@mlightcad/data-model 1.10.7 → 1.11.1
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/README.md +1 -1
- package/dist/data-model.cjs +12 -12
- package/lib/acis/AcDbAcisDecode.d.ts +3 -3
- package/lib/acis/AcDbAcisDecode.js +8 -8
- package/lib/acis/AcDbAcisEntities.d.ts +2 -2
- package/lib/acis/AcDbAcisEntities.js +2 -2
- package/lib/acis/AcDbAcisGeometry.d.ts +5 -5
- package/lib/acis/AcDbAcisGeometry.js +5 -5
- package/lib/acis/AcDbAcisSab.d.ts +1 -1
- package/lib/acis/AcDbAcisSab.js +1 -1
- package/lib/acis/AcDbAcisSatWireframe.d.ts +1 -1
- package/lib/acis/AcDbAcisSatWireframe.js +3 -3
- package/lib/acis/AcDbAcisWireframe.js +8 -8
- package/lib/acis/index.d.ts +6 -6
- package/lib/acis/index.d.ts.map +1 -1
- package/lib/acis/index.js +6 -6
- package/lib/acis/index.js.map +1 -1
- package/lib/base/AcDbHostApplicationServices.d.ts +1 -1
- package/lib/base/AcDbHostApplicationServices.js +3 -3
- package/lib/base/AcDbObject.d.ts +1 -1
- package/lib/base/AcDbObject.d.ts.map +1 -1
- package/lib/base/AcDbObject.js +9 -6
- package/lib/base/AcDbObject.js.map +1 -1
- package/lib/base/index.d.ts +2 -2
- package/lib/base/index.js +2 -2
- package/lib/converter/AcDbRegenerator.d.ts.map +1 -1
- package/lib/converter/AcDbRegenerator.js +40 -4
- package/lib/converter/AcDbRegenerator.js.map +1 -1
- package/lib/converter/index.d.ts +1 -1
- package/lib/converter/index.d.ts.map +1 -1
- package/lib/converter/index.js +1 -1
- package/lib/converter/index.js.map +1 -1
- package/lib/converter/worker/AcDbWorkerManager.d.ts +1 -1
- package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -1
- package/lib/converter/worker/AcDbWorkerManager.js +1 -1
- package/lib/converter/worker/AcDbWorkerManager.js.map +1 -1
- package/lib/converter/worker/index.d.ts +1 -1
- package/lib/converter/worker/index.d.ts.map +1 -1
- package/lib/converter/worker/index.js +1 -1
- package/lib/converter/worker/index.js.map +1 -1
- package/lib/database/AcDbBlockTableRecord.d.ts +12 -7
- package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbBlockTableRecord.js +15 -9
- package/lib/database/AcDbBlockTableRecord.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +49 -0
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +304 -27
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbLayerTableRecord.d.ts +1 -1
- package/lib/database/AcDbLayerTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbLayerTableRecord.js +3 -3
- package/lib/database/AcDbLayerTableRecord.js.map +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.d.ts.map +1 -1
- package/lib/database/index.js +1 -1
- package/lib/database/index.js.map +1 -1
- package/lib/database/transaction/AcDbChangeApplier.d.ts +4 -4
- package/lib/database/transaction/AcDbChangeApplier.d.ts.map +1 -1
- package/lib/database/transaction/AcDbChangeApplier.js +6 -6
- package/lib/database/transaction/AcDbChangeApplier.js.map +1 -1
- package/lib/database/transaction/AcDbChangeRecorder.d.ts.map +1 -1
- package/lib/database/transaction/AcDbChangeRecorder.js +2 -2
- package/lib/database/transaction/AcDbChangeRecorder.js.map +1 -1
- package/lib/database/transaction/AcDbDatabaseChange.d.ts +1 -1
- package/lib/database/transaction/AcDbDatabaseChange.d.ts.map +1 -1
- package/lib/database/transaction/AcDbDatabaseChange.js +1 -1
- package/lib/database/transaction/AcDbDatabaseChange.js.map +1 -1
- package/lib/database/transaction/AcDbDatabaseTransactionManager.js +7 -7
- package/lib/database/transaction/AcDbDatabaseTransactionManager.js.map +1 -1
- package/lib/database/transaction/index.d.ts +2 -2
- package/lib/database/transaction/index.d.ts.map +1 -1
- package/lib/database/transaction/index.js +2 -2
- package/lib/database/transaction/index.js.map +1 -1
- package/lib/entity/AcDb3dSolid.js +3 -3
- package/lib/entity/AcDbArc.d.ts.map +1 -1
- package/lib/entity/AcDbArc.js +7 -7
- package/lib/entity/AcDbArc.js.map +1 -1
- package/lib/entity/AcDbBlockReference.d.ts +6 -0
- package/lib/entity/AcDbBlockReference.d.ts.map +1 -1
- package/lib/entity/AcDbBlockReference.js +12 -0
- package/lib/entity/AcDbBlockReference.js.map +1 -1
- package/lib/entity/AcDbCircle.d.ts.map +1 -1
- package/lib/entity/AcDbCircle.js +3 -3
- package/lib/entity/AcDbCircle.js.map +1 -1
- package/lib/entity/AcDbEllipse.d.ts.map +1 -1
- package/lib/entity/AcDbEllipse.js +3 -3
- package/lib/entity/AcDbEllipse.js.map +1 -1
- package/lib/entity/AcDbFace.js +2 -2
- package/lib/entity/AcDbFrame.d.ts +15 -0
- package/lib/entity/AcDbFrame.d.ts.map +1 -0
- package/lib/entity/AcDbFrame.js +36 -0
- package/lib/entity/AcDbFrame.js.map +1 -0
- package/lib/entity/AcDbLeader.js +2 -2
- package/lib/entity/AcDbLeader.js.map +1 -1
- package/lib/entity/AcDbOle2Frame.d.ts +390 -0
- package/lib/entity/AcDbOle2Frame.d.ts.map +1 -0
- package/lib/entity/AcDbOle2Frame.js +717 -0
- package/lib/entity/AcDbOle2Frame.js.map +1 -0
- package/lib/entity/AcDbOleFrame.d.ts +112 -0
- package/lib/entity/AcDbOleFrame.d.ts.map +1 -0
- package/lib/entity/AcDbOleFrame.js +198 -0
- package/lib/entity/AcDbOleFrame.js.map +1 -0
- package/lib/entity/AcDbPolyFaceMesh.js +2 -2
- package/lib/entity/AcDbPolyFaceMesh.js.map +1 -1
- package/lib/entity/AcDbPolygonMesh.js +2 -2
- package/lib/entity/AcDbPolygonMesh.js.map +1 -1
- package/lib/entity/AcDbPolyline.d.ts +2 -2
- package/lib/entity/AcDbPolyline.d.ts.map +1 -1
- package/lib/entity/AcDbPolyline.js +4 -4
- package/lib/entity/AcDbPolyline.js.map +1 -1
- package/lib/entity/AcDbProxyEntity.d.ts.map +1 -1
- package/lib/entity/AcDbProxyEntity.js +3 -3
- package/lib/entity/AcDbProxyEntity.js.map +1 -1
- package/lib/entity/AcDbRasterImage.d.ts +1 -1
- package/lib/entity/AcDbRasterImage.d.ts.map +1 -1
- package/lib/entity/AcDbRasterImage.js +4 -4
- package/lib/entity/AcDbRasterImage.js.map +1 -1
- package/lib/entity/AcDbRay.d.ts.map +1 -1
- package/lib/entity/AcDbRay.js +2 -2
- package/lib/entity/AcDbRay.js.map +1 -1
- package/lib/entity/AcDbSpline.d.ts.map +1 -1
- package/lib/entity/AcDbSpline.js +4 -4
- package/lib/entity/AcDbSpline.js.map +1 -1
- package/lib/entity/AcDbTrace.js +2 -2
- package/lib/entity/AcDbTrace.js.map +1 -1
- package/lib/entity/AcDbXline.d.ts.map +1 -1
- package/lib/entity/AcDbXline.js +2 -2
- package/lib/entity/AcDbXline.js.map +1 -1
- package/lib/entity/index.d.ts +5 -1
- package/lib/entity/index.d.ts.map +1 -1
- package/lib/entity/index.js +4 -1
- package/lib/entity/index.js.map +1 -1
- package/lib/index.d.ts +11 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -7
- package/lib/index.js.map +1 -1
- package/lib/ly/AcLyBoolExpr.d.ts +28 -0
- package/lib/ly/AcLyBoolExpr.d.ts.map +1 -0
- package/lib/ly/AcLyBoolExpr.js +36 -0
- package/lib/ly/AcLyBoolExpr.js.map +1 -0
- package/lib/ly/AcLyLayerFilter.d.ts +289 -0
- package/lib/ly/AcLyLayerFilter.d.ts.map +1 -0
- package/lib/ly/AcLyLayerFilter.js +509 -0
- package/lib/ly/AcLyLayerFilter.js.map +1 -0
- package/lib/ly/AcLyLayerFilterIO.d.ts +155 -0
- package/lib/ly/AcLyLayerFilterIO.d.ts.map +1 -0
- package/lib/ly/AcLyLayerFilterIO.js +517 -0
- package/lib/ly/AcLyLayerFilterIO.js.map +1 -0
- package/lib/ly/AcLyLayerFilterTree.d.ts +71 -0
- package/lib/ly/AcLyLayerFilterTree.d.ts.map +1 -0
- package/lib/ly/AcLyLayerFilterTree.js +95 -0
- package/lib/ly/AcLyLayerFilterTree.js.map +1 -0
- package/lib/ly/AcLyLayerGroup.d.ts +107 -0
- package/lib/ly/AcLyLayerGroup.d.ts.map +1 -0
- package/lib/ly/AcLyLayerGroup.js +158 -0
- package/lib/ly/AcLyLayerGroup.js.map +1 -0
- package/lib/ly/index.d.ts +8 -0
- package/lib/ly/index.d.ts.map +1 -0
- package/lib/ly/index.js +6 -0
- package/lib/ly/index.js.map +1 -0
- package/lib/misc/AcDbCodePage.d.ts +1 -1
- package/lib/misc/AcDbCodePage.d.ts.map +1 -1
- package/lib/misc/AcDbCodePage.js +1 -1
- package/lib/misc/AcDbCodePage.js.map +1 -1
- package/lib/misc/AcDbFormatter.d.ts.map +1 -1
- package/lib/misc/AcDbFormatter.js +3 -3
- package/lib/misc/AcDbFormatter.js.map +1 -1
- package/lib/misc/AcDbMLeaderStyleColorCodec.d.ts +2 -2
- package/lib/misc/AcDbMLeaderStyleColorCodec.d.ts.map +1 -1
- package/lib/misc/AcDbMLeaderStyleColorCodec.js +2 -2
- package/lib/misc/AcDbMLeaderStyleColorCodec.js.map +1 -1
- package/lib/misc/AcDbOleImageExtractor.d.ts +21 -0
- package/lib/misc/AcDbOleImageExtractor.d.ts.map +1 -0
- package/lib/misc/AcDbOleImageExtractor.js +659 -0
- package/lib/misc/AcDbOleImageExtractor.js.map +1 -0
- package/lib/misc/AcDbPreviewIcon.d.ts +13 -0
- package/lib/misc/AcDbPreviewIcon.d.ts.map +1 -0
- package/lib/misc/AcDbPreviewIcon.js +69 -0
- package/lib/misc/AcDbPreviewIcon.js.map +1 -0
- package/lib/misc/AcDbUnitsValue.d.ts +6 -6
- package/lib/misc/AcDbUnitsValue.d.ts.map +1 -1
- package/lib/misc/AcDbUnitsValue.js +6 -6
- package/lib/misc/AcDbUnitsValue.js.map +1 -1
- package/lib/misc/acdbDrawImageFrame.d.ts +17 -0
- package/lib/misc/acdbDrawImageFrame.d.ts.map +1 -0
- package/lib/misc/acdbDrawImageFrame.js +44 -0
- package/lib/misc/acdbDrawImageFrame.js.map +1 -0
- package/lib/misc/index.d.ts +8 -7
- package/lib/misc/index.d.ts.map +1 -1
- package/lib/misc/index.js +8 -7
- package/lib/misc/index.js.map +1 -1
- package/lib/misc/proxyGraphic/AcDbProxyGraphic.d.ts +1 -1
- package/lib/misc/proxyGraphic/AcDbProxyGraphic.d.ts.map +1 -1
- package/lib/misc/proxyGraphic/AcDbProxyGraphic.js +9 -9
- package/lib/misc/proxyGraphic/AcDbProxyGraphic.js.map +1 -1
- package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.d.ts +2 -2
- package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.d.ts.map +1 -1
- package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.js +2 -2
- package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.js.map +1 -1
- package/lib/misc/proxyGraphic/index.d.ts +2 -2
- package/lib/misc/proxyGraphic/index.d.ts.map +1 -1
- package/lib/misc/proxyGraphic/index.js +2 -2
- package/lib/misc/proxyGraphic/index.js.map +1 -1
- package/lib/object/AcDbFilter.d.ts +51 -0
- package/lib/object/AcDbFilter.d.ts.map +1 -0
- package/lib/object/AcDbFilter.js +63 -0
- package/lib/object/AcDbFilter.js.map +1 -0
- package/lib/object/AcDbIndex.d.ts +144 -0
- package/lib/object/AcDbIndex.d.ts.map +1 -0
- package/lib/object/AcDbIndex.js +146 -0
- package/lib/object/AcDbIndex.js.map +1 -0
- package/lib/object/AcDbLayerFilter.d.ts +144 -0
- package/lib/object/AcDbLayerFilter.d.ts.map +1 -0
- package/lib/object/AcDbLayerFilter.js +250 -0
- package/lib/object/AcDbLayerFilter.js.map +1 -0
- package/lib/object/AcDbLayerIndex.d.ts +165 -0
- package/lib/object/AcDbLayerIndex.d.ts.map +1 -0
- package/lib/object/AcDbLayerIndex.js +295 -0
- package/lib/object/AcDbLayerIndex.js.map +1 -0
- package/lib/object/AcDbMLeaderStyle.js +4 -4
- package/lib/object/AcDbMLeaderStyle.js.map +1 -1
- package/lib/object/index.d.ts +6 -0
- package/lib/object/index.d.ts.map +1 -1
- package/lib/object/index.js +4 -0
- package/lib/object/index.js.map +1 -1
- package/package.json +4 -4
package/dist/data-model.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Nr=(i=>(i[i.Invalid=-9999]="Invalid",i[i.Start=0]="Start",i[i.Text=1]="Text",i[i.AttributeTag=2]="AttributeTag",i[i.BlockName=2]="BlockName",i[i.ShapeName=2]="ShapeName",i[i.SymbolTableName=2]="SymbolTableName",i[i.SymbolTableRecordName=2]="SymbolTableRecordName",i[i.MlineStyleName=2]="MlineStyleName",i[i.AttributePrompt=3]="AttributePrompt",i[i.Description=3]="Description",i[i.DimPostString=3]="DimPostString",i[i.DimStyleName=3]="DimStyleName",i[i.LinetypeProse=3]="LinetypeProse",i[i.TextFontFile=3]="TextFontFile",i[i.CLShapeName=4]="CLShapeName",i[i.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",i[i.SymbolTableRecordComments=4]="SymbolTableRecordComments",i[i.TextBigFontFile=4]="TextBigFontFile",i[i.Handle=5]="Handle",i[i.DimensionBlock=5]="DimensionBlock",i[i.LinetypeName=6]="LinetypeName",i[i.DimBlk1=6]="DimBlk1",i[i.TextStyleName=7]="TextStyleName",i[i.DimBlk2=7]="DimBlk2",i[i.LayerName=8]="LayerName",i[i.CLShapeText=9]="CLShapeText",i[i.XCoordinate=10]="XCoordinate",i[i.YCoordinate=20]="YCoordinate",i[i.ZCoordinate=30]="ZCoordinate",i[i.Real=40]="Real",i[i.TxtSize=40]="TxtSize",i[i.ViewportHeight=40]="ViewportHeight",i[i.Angle=50]="Angle",i[i.ViewportSnapAngle=50]="ViewportSnapAngle",i[i.Visibility=60]="Visibility",i[i.Int16=70]="Int16",i[i.Int32=90]="Int32",i[i.Int64=160]="Int64",i[i.Int8=280]="Int8",i[i.Thickness=39]="Thickness",i[i.Elevation=38]="Elevation",i[i.LinetypeScale=48]="LinetypeScale",i[i.DashLength=49]="DashLength",i[i.MlineOffset=49]="MlineOffset",i[i.LinetypeElement=49]="LinetypeElement",i[i.NormalX=210]="NormalX",i[i.NormalY=220]="NormalY",i[i.NormalZ=230]="NormalZ",i[i.UcsOrg=110]="UcsOrg",i[i.UcsOrientationX=111]="UcsOrientationX",i[i.UcsOrientationY=112]="UcsOrientationY",i[i.ViewHeight=45]="ViewHeight",i[i.ViewWidth=41]="ViewWidth",i[i.ViewLensLength=42]="ViewLensLength",i[i.ViewFrontClip=43]="ViewFrontClip",i[i.ViewBackClip=44]="ViewBackClip",i[i.ViewBrightness=141]="ViewBrightness",i[i.ViewContrast=142]="ViewContrast",i[i.ViewMode=71]="ViewMode",i[i.ViewportActive=68]="ViewportActive",i[i.ViewportAspect=41]="ViewportAspect",i[i.ViewportGrid=76]="ViewportGrid",i[i.ViewportIcon=74]="ViewportIcon",i[i.ViewportNumber=69]="ViewportNumber",i[i.ViewportSnap=75]="ViewportSnap",i[i.ViewportSnapPair=78]="ViewportSnapPair",i[i.ViewportSnapStyle=77]="ViewportSnapStyle",i[i.ViewportTwist=51]="ViewportTwist",i[i.ViewportVisibility=67]="ViewportVisibility",i[i.ViewportZoom=73]="ViewportZoom",i[i.Color=62]="Color",i[i.ColorRgb=420]="ColorRgb",i[i.ColorName=430]="ColorName",i[i.LineWeight=370]="LineWeight",i[i.PlotStyleNameType=380]="PlotStyleNameType",i[i.PlotStyleNameId=390]="PlotStyleNameId",i[i.GradientObjType=450]="GradientObjType",i[i.GradientAngle=460]="GradientAngle",i[i.GradientName=470]="GradientName",i[i.GradientColCount=453]="GradientColCount",i[i.GradientPatType=451]="GradientPatType",i[i.GradientTintType=452]="GradientTintType",i[i.GradientShift=461]="GradientShift",i[i.GradientColVal=463]="GradientColVal",i[i.GradientTintVal=462]="GradientTintVal",i[i.SoftPointerId=330]="SoftPointerId",i[i.HardPointerId=340]="HardPointerId",i[i.SoftOwnershipId=350]="SoftOwnershipId",i[i.HardOwnershipId=360]="HardOwnershipId",i[i.ArbitraryHandle=320]="ArbitraryHandle",i[i.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",i[i.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",i[i.ExtendedDataControlString=1002]="ExtendedDataControlString",i[i.ExtendedDataLayerName=1003]="ExtendedDataLayerName",i[i.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",i[i.ExtendedDataHandle=1005]="ExtendedDataHandle",i[i.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",i[i.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",i[i.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",i[i.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",i[i.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",i[i.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",i[i.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",i[i.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",i[i.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",i[i.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",i[i.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",i[i.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",i[i.ExtendedDataReal=1040]="ExtendedDataReal",i[i.ExtendedDataDist=1041]="ExtendedDataDist",i[i.ExtendedDataScale=1042]="ExtendedDataScale",i[i.ExtendedDataInteger16=1070]="ExtendedDataInteger16",i[i.ExtendedDataInteger32=1071]="ExtendedDataInteger32",i[i.XTextString=300]="XTextString",i[i.XReal=140]="XReal",i[i.XInt16=170]="XInt16",i[i.XXInt16=270]="XXInt16",i[i.Subclass=100]="Subclass",i[i.ControlString=102]="ControlString",i[i.EmbeddedObjectStart=101]="EmbeddedObjectStart",i[i.End=-1]="End",i[i.FirstEntityId=-2]="FirstEntityId",i[i.HeaderId=-2]="HeaderId",i[i.XDataStart=-3]="XDataStart",i[i.Operator=-4]="Operator",i[i.PReactors=-5]="PReactors",i[i.XDictionary=-6]="XDictionary",i))(Nr||{});exports.AcCmColorMethod=void 0;(function(i){i[i.ByColor=1]="ByColor",i[i.ByACI=2]="ByACI",i[i.ByLayer=3]="ByLayer",i[i.ByBlock=4]="ByBlock",i[i.None=0]="None"})(exports.AcCmColorMethod||(exports.AcCmColorMethod={}));var fh=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ph=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Fs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},li=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],Ht=function(){function i(){}return i.getColorByIndex=function(t){return li[t]},i.getIndexByColor=function(t){for(var e=li.length-1,n=1;n<e;++n)if(li[n]===t)return n},i.getColorByName=function(t){return Fs[t.toLowerCase()]},i.getNameByColor=function(t){var e,n;try{for(var r=fh(Object.entries(Fs)),s=r.next();!s.done;s=r.next()){var o=ph(s.value,2),a=o[0],l=o[1];if(l===t)return a}}catch(h){e={error:h}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},i.getNameByIndex=function(t){var e=this.getColorByIndex(t);return this.getNameByColor(e)},i}(),yh=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},O=function(){function i(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByLayer),this._colorMethod=t,this._colorMethod==exports.AcCmColorMethod.ByColor&&e==null?this._value=16777215:this._colorMethod==exports.AcCmColorMethod.ByACI?e==null?this._value=8:e===0?this._colorMethod=exports.AcCmColorMethod.ByBlock:e===256?this._colorMethod=exports.AcCmColorMethod.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}return Object.defineProperty(i.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(t){this._colorMethod=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"red",{get:function(){var t=this.RGB;return t!=null?t>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"green",{get:function(){var t=this.RGB;return t!=null?t>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blue",{get:function(){var t=this.RGB;return t!=null?t&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"RGB",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByColor:case exports.AcCmColorMethod.ByBlock:case exports.AcCmColorMethod.ByLayer:return this._value;case exports.AcCmColorMethod.ByACI:return this._value?Ht.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),i.prototype.setRGB=function(t,e,n){var r=Math.max(0,Math.min(255,Math.round(t))),s=Math.max(0,Math.min(255,Math.round(e))),o=Math.max(0,Math.min(255,Math.round(n)));return this._value=r<<16|s<<8|o,this._colorMethod=exports.AcCmColorMethod.ByColor,this},i.prototype.setRGBValue=function(t){return t==null||!Number.isFinite(t)?this:(this._value=t&16777215,this._colorMethod=exports.AcCmColorMethod.ByColor,this)},i.prototype.setRGBFromCss=function(t){if(!t)return this;var e=t.trim().toLowerCase();if(e.startsWith("#")){var n=0,r=0,s=0;if(e.length===7)n=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),s=parseInt(e.substr(5,2),16);else if(e.length===4)n=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),s=parseInt(e[3]+e[3],16);else return this;return this.setRGB(n,r,s)}var o=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var n=parseInt(o[1],10),r=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(n,r,s)}var a=Ht.getColorByName(t);return a!==void 0?this.setRGBValue(a):this},i.prototype.setScalar=function(t){return this.setRGB(t,t,t)},Object.defineProperty(i.prototype,"hexColor",{get:function(){var t=this.RGB;if(t!=null){var e=t.toString(16).padStart(6,"0").toUpperCase();return"0x"+e}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cssColor",{get:function(){var t=this.RGB;if(t!=null)return"rgb(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,")")},enumerable:!1,configurable:!0}),i.prototype.cssColorAlpha=function(t){var e=this.RGB;if(e!=null)return"rgba(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,",").concat(t,")")},Object.defineProperty(i.prototype,"colorIndex",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI?this._value:this._colorMethod===exports.AcCmColorMethod.ByLayer?256:this._colorMethod===exports.AcCmColorMethod.ByBlock?0:void 0},set:function(t){if(t!=null){var e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=exports.AcCmColorMethod.ByBlock,this._value=void 0):e===256?(this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=void 0):(this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=e)}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByColor",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByACI",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isForeground",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI&&this._value===7},enumerable:!1,configurable:!0}),i.prototype.setForeground=function(){return this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=7,this},Object.defineProperty(i.prototype,"isByLayer",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},enumerable:!1,configurable:!0}),i.prototype.setByLayer=function(t){return this._colorMethod=exports.AcCmColorMethod.ByLayer,t==null?this._value=256:this._value=t,this},Object.defineProperty(i.prototype,"isByBlock",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},enumerable:!1,configurable:!0}),i.prototype.setByBlock=function(t){return this._colorMethod=exports.AcCmColorMethod.ByBlock,t==null?this._value=0:this._value=t,this},Object.defineProperty(i.prototype,"colorName",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByColor:return this._value?Ht.getNameByColor(this._value):"";case exports.AcCmColorMethod.ByACI:return this._value?Ht.getNameByIndex(this._value):"";default:return}},set:function(t){if(t){var e=Ht.getColorByName(t);e!==void 0&&(this._value=e,this._colorMethod=exports.AcCmColorMethod.ByColor)}},enumerable:!1,configurable:!0}),i.prototype.clone=function(){var t=new i;return t._colorMethod=this._colorMethod,t._value=this._value,t},i.prototype.copy=function(t){return this._colorMethod=t._colorMethod,this._value=t._value,this},i.prototype.equals=function(t){return this._colorMethod===t._colorMethod&&this._value===t._value},i.prototype.toString=function(){switch(this._colorMethod){case exports.AcCmColorMethod.None:return"None";case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByACI:return this._value!==void 0?String(this._value):"";case exports.AcCmColorMethod.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},i.fromString=function(t){if(t){var e=t.trim();if(/^none$/i.test(e))return new i(exports.AcCmColorMethod.None);if(/^bylayer$/i.test(e))return new i(exports.AcCmColorMethod.ByLayer);if(/^byblock$/i.test(e))return new i(exports.AcCmColorMethod.ByBlock);var n=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(n){var r=Number(n[1]),s=Number(n[2]),o=Number(n[3]),a=new i(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){var l=yh(e.split(",").map(Number),3),r=l[0],s=l[1],o=l[2],a=new i(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d+$/.test(e)){var h=parseInt(e,10);return new i(exports.AcCmColorMethod.ByACI,h)}if(/^book\$/i.test(e)){var c=e.substring(e.indexOf("$")+1),u=Ht.getColorByName(c);return u!=null?new i(exports.AcCmColorMethod.ByColor,u):void 0}var g=Ht.getColorByName(e);if(g!=null)return new i(exports.AcCmColorMethod.ByColor,g)}},i}(),mh=function(){function i(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByColor),e===void 0&&(e=0),this._colorMethod=t,this._value=e}return Object.defineProperty(i.prototype,"colorMethd",{get:function(){return this._colorMethod},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"red",{get:function(){return this._value>>16&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&65535|(t&255)<<16},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"green",{get:function(){return this._value>>8&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16711935|(t&255)<<8},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blue",{get:function(){return this._value&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16776960|t&255},enumerable:!1,configurable:!0}),i.prototype.setRGB=function(t,e,n){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=(t&255)<<16|(e&255)<<8|n&255},Object.defineProperty(i.prototype,"colorIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"layerIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=t},enumerable:!1,configurable:!0}),i.prototype.isByColor=function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},i.prototype.isByLayer=function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},i.prototype.isByBlock=function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},i.prototype.isByACI=function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},i.prototype.isNone=function(){return this._colorMethod===exports.AcCmColorMethod.None},Object.defineProperty(i.prototype,"rawValue",{get:function(){return this._value},set:function(t){this._value=t},enumerable:!1,configurable:!0}),i}(),ut={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}},_h=function(){function i(){this._listeners={}}return i.prototype.addEventListener=function(t,e){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},i.prototype.hasEventListener=function(t,e){if(this._listeners===void 0)return!1;var n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},i.prototype.removeEventListener=function(t,e){if(this._listeners!==void 0){var n=this._listeners,r=n[t];if(r!==void 0){var s=r.indexOf(e);s!==-1&&r.splice(s,1)}}},i.prototype.dispatchEvent=function(t){if(this._listeners!==void 0){var e=this._listeners,n=e[t.type];if(n!==void 0){t.target=this;for(var r=n.slice(0),s=0,o=r.length;s<o;s++)r[s].call(this,t)}}},i}(),bh=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xh=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},wh=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},U=function(){function i(){this.listeners=[]}return i.prototype.addEventListener=function(t){this.listeners.push(t)},i.prototype.removeEventListener=function(t){this.listeners=this.listeners.filter(function(e){return e!==t})},i.prototype.replaceEventListener=function(t){this.removeEventListener(t),this.addEventListener(t)},i.prototype.dispatch=function(t){for(var e,n,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];try{for(var o=bh(this.listeners),a=o.next();!a.done;a=o.next()){var l=a.value,h=l;h.call.apply(h,wh([null,t],xh(r),!1))}}catch(c){e={error:c}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},i}(),Ti=function(){return Ti=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ti.apply(this,arguments)},vh=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Ph=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},Mo=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Ge(i){return i===null||typeof i!="object"?i:Array.isArray(i)?Ph([],vh(i),!1):Ti({},i)}function Ci(i){if(i===null||typeof i!="object")return i;if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp)return new RegExp(i.source,i.flags);if(Array.isArray(i))return i.map(Ci);var t={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=Ci(i[e]));return t}function Pt(i){for(var t,e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];try{for(var s=Mo(n),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&i[l]===void 0&&(i[l]=a[l])}}catch(h){t={error:h}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return i}function To(i,t){return i!=null&&Object.prototype.hasOwnProperty.call(i,t)}function Co(i){return i==null?!0:Array.isArray(i)||typeof i=="string"?i.length===0:i instanceof Map||i instanceof Set?i.size===0:typeof i=="object"?Object.keys(i).length===0:!1}function ce(i,t){var e,n;if(i===t)return!0;if(i==null||t==null)return i===t;if(typeof i!=typeof t)return!1;if(typeof i!="object")return i===t;if(Array.isArray(i)!==Array.isArray(t))return!1;if(Array.isArray(i)){if(i.length!==t.length)return!1;for(var r=0;r<i.length;r++)if(!ce(i[r],t[r]))return!1;return!0}var s=Object.keys(i),o=Object.keys(t);if(s.length!==o.length)return!1;try{for(var a=Mo(s),l=a.next();!l.done;l=a.next()){var h=l.value;if(!Object.prototype.hasOwnProperty.call(t,h)||!ce(i[h],t[h]))return!1}}catch(c){e={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0}var Ah=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sh(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ko={exports:{}};(function(i){(function(t,e){i.exports?i.exports=e():t.log=e()})(Ah,function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(p,m){var _=p[m];if(typeof _.bind=="function")return _.bind(p);try{return Function.prototype.bind.call(_,p)}catch{return function(){return Function.prototype.apply.apply(_,[p,arguments])}}}function l(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function h(p){return p==="debug"&&(p="log"),typeof console===e?!1:p==="trace"&&n?l:console[p]!==void 0?a(console,p):console.log!==void 0?a(console,"log"):t}function c(){for(var p=this.getLevel(),m=0;m<r.length;m++){var _=r[m];this[_]=m<p?t:this.methodFactory(_,p,this.name)}if(this.log=this.debug,typeof console===e&&p<this.levels.SILENT)return"No console available for logging"}function u(p){return function(){typeof console!==e&&(c.call(this),this[p].apply(this,arguments))}}function g(p,m,_){return h(p)||u.apply(this,arguments)}function d(p,m){var _=this,v,P,S,L="loglevel";typeof p=="string"?L+=":"+p:typeof p=="symbol"&&(L=void 0);function T(N){var F=(r[N]||"silent").toUpperCase();if(!(typeof window===e||!L)){try{window.localStorage[L]=F;return}catch{}try{window.document.cookie=encodeURIComponent(L)+"="+F+";"}catch{}}}function I(){var N;if(!(typeof window===e||!L)){try{N=window.localStorage[L]}catch{}if(typeof N===e)try{var F=window.document.cookie,$=encodeURIComponent(L),ot=F.indexOf($+"=");ot!==-1&&(N=/^([^;]+)/.exec(F.slice(ot+$.length+1))[1])}catch{}return _.levels[N]===void 0&&(N=void 0),N}}function X(){if(!(typeof window===e||!L)){try{window.localStorage.removeItem(L)}catch{}try{window.document.cookie=encodeURIComponent(L)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function M(N){var F=N;if(typeof F=="string"&&_.levels[F.toUpperCase()]!==void 0&&(F=_.levels[F.toUpperCase()]),typeof F=="number"&&F>=0&&F<=_.levels.SILENT)return F;throw new TypeError("log.setLevel() called with invalid level: "+N)}_.name=p,_.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_.methodFactory=m||g,_.getLevel=function(){return S??P??v},_.setLevel=function(N,F){return S=M(N),F!==!1&&T(S),c.call(_)},_.setDefaultLevel=function(N){P=M(N),I()||_.setLevel(N,!1)},_.resetLevel=function(){S=null,X(),c.call(_)},_.enableAll=function(N){_.setLevel(_.levels.TRACE,N)},_.disableAll=function(N){_.setLevel(_.levels.SILENT,N)},_.rebuild=function(){if(o!==_&&(v=M(o.getLevel())),c.call(_),o===_)for(var N in s)s[N].rebuild()},v=M(o?o.getLevel():"WARN");var j=I();j!=null&&(S=M(j)),c.call(_)}o=new d,o.getLogger=function(m){if(typeof m!="symbol"&&typeof m!="string"||m==="")throw new TypeError("You must supply a name when creating a logger.");var _=s[m];return _||(_=s[m]=new d(m,o.methodFactory)),_};var f=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=f),o},o.getLoggers=function(){return s},o.default=o,o})})(ko);var Lh=ko.exports;const Eh=Sh(Lh);var Ih=!0,He=Eh;He.setLevel("debug");var Mh=function(i){try{He.setLevel(i)}catch(t){He.setLevel("error"),He.error(t)}},ki=function(){function i(t,e){this.events={attrChanged:new U,modelChanged:new U},this._changing=!1,this._previousAttributes={},this._pending=!1;var n=t||{};e&&Pt(n,e),this.attributes=n,this.changed={}}return i.prototype.get=function(t){return this.attributes[t]},i.prototype.set=function(t,e,n){if(t==null)return this;var r;typeof t=="object"?(r=t,n=e):(r={},r[t]=e),n||(n={});var s=n.unset,o=n.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=Ge(this.attributes),this.changed={});var h=this.attributes,c=this.changed,u=this._previousAttributes;for(var g in r)e=r[g],ce(h[g],e)||a.push(g),ce(u[g],e)?delete c[g]:c[g]=e,s?delete h[g]:h[g]=e;if(!o){a.length&&(this._pending=n);for(var d=0;d<a.length;d++)this.events.attrChanged.dispatch({object:this,attrName:a[d],attrValue:h[a[d]],options:n})}if(l)return this;if(!o)for(;this._pending;)n=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:n});return this._pending=!1,this._changing=!1,this},i.prototype.has=function(t){return this.get(t)!=null},i.prototype.hasChanged=function(t){return t==null?!Co(this.changed):To(this.changed,t)},i.prototype.changedAttributes=function(t){if(!t)return this.hasChanged()?Ge(this.changed):{};var e=this._changing?this._previousAttributes:this.attributes,n={};for(var r in t){var s=t[r];ce(e[r],s)||(n[r]=s)}return n},i.prototype.previous=function(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]},i.prototype.previousAttributes=function(){return Ge(this._previousAttributes)},i.prototype.clone=function(){var t=Ge(this.attributes);return new i(t)},i}(),Th=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ch=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Xr=function(){function i(){this.entries=new Map}return i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i.prototype.collect=function(t){this.entries.set(t.name,t)},i.prototype.printAll=function(){var t,e;try{for(var n=Th(this.entries),r=n.next();!r.done;r=n.next())var s=Ch(r.value,2),o=s[0],a=s[1]}catch(l){t={error:l}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},i.prototype.clear=function(){this.entries.clear()},i.prototype.getAll=function(){return Array.from(this.entries.values())},i.prototype.getEntry=function(t){return this.entries.get(t)},i.prototype.remove=function(t){return this.entries.delete(t)},i}(),kh=function(){function i(){}return i.formatBytes=function(t,e){if(e===void 0&&(e=2),t===0)return"0 B";var n=1024,r=Math.max(0,e),s=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(n)),a=t/Math.pow(n,o);return"".concat(parseFloat(a.toFixed(r))," ").concat(s[o])},i}();exports.AcCmTransparencyMethod=void 0;(function(i){i[i.ByLayer=0]="ByLayer",i[i.ByBlock=1]="ByBlock",i[i.ByAlpha=2]="ByAlpha",i[i.ErrorValue=3]="ErrorValue"})(exports.AcCmTransparencyMethod||(exports.AcCmTransparencyMethod={}));var Q=function(){function i(t){t!==void 0?(this._method=exports.AcCmTransparencyMethod.ByAlpha,this._alpha=i.clampAlpha(t)):(this._method=exports.AcCmTransparencyMethod.ByLayer,this._alpha=255)}return Object.defineProperty(i.prototype,"method",{get:function(){return this._method},set:function(t){this._method=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=i.clampAlpha(t),this._method=exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"percentage",{get:function(){if(this._method===exports.AcCmTransparencyMethod.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(t){var e=Math.max(0,Math.min(100,t)),n=Math.round(255*(1-e/100));this.alpha=n},enumerable:!1,configurable:!0}),i.clampAlpha=function(t){return Math.max(0,Math.min(255,Math.floor(t)))},Object.defineProperty(i.prototype,"isByAlpha",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByBlock",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByLayer",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isInvalid",{get:function(){return this._method===exports.AcCmTransparencyMethod.ErrorValue},enumerable:!1,configurable:!0}),i.prototype.serialize=function(){var t=this._method;return t<<24|this._alpha},i.prototype.clone=function(){var t=new i;return t._method=this._method,t._alpha=this._alpha,t},i.prototype.equals=function(t){return this._method===t._method&&this._alpha===t._alpha},i.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},i.fromString=function(t){var e=t.trim(),n=e.toLowerCase();if(n===""||n==="."||n==="use current"||n==="bylayer"){var r=new i;return r._method=exports.AcCmTransparencyMethod.ByLayer,r}if(n==="byblock"){var s=new i;return s._method=exports.AcCmTransparencyMethod.ByBlock,s}var o=Number(e);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new i;return o<=90?a.percentage=o:a.alpha=o,a}var l=new i;return l._method=exports.AcCmTransparencyMethod.ErrorValue,l},i.deserialize=function(t){var e=t>>>24&255,n=t&255,r=e>=exports.AcCmTransparencyMethod.ByLayer&&e<=exports.AcCmTransparencyMethod.ErrorValue?e:exports.AcCmTransparencyMethod.ErrorValue,s=new i;return s._method=r,s._alpha=i.clampAlpha(n),s},i}(),zs=function(i,t,e,n){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(c){try{h(n.next(c))}catch(u){o(u)}}function l(c){try{h(n.throw(c))}catch(u){o(u)}}function h(c){c.done?s(c.value):r(c.value).then(a,l)}h((n=n.apply(i,t||[])).next())})},hi=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},Oo=function(){function i(t){this.name=t}return i.prototype.run=function(t){throw new Error("run() must be implemented by subclass")},i}(),No=function(){function i(){this.tasks=[],this.onProgress=function(){},this.onComplete=function(){},this.onError=function(){return!1}}return i.prototype.scheduleTask=function(t){return new Promise(function(e,n){var r=function(){Promise.resolve(t()).then(e).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})},i.prototype.addTask=function(t){this.tasks.push(t)},i.prototype.setProgressCallback=function(t){this.onProgress=t},i.prototype.setCompleteCallback=function(t){this.onComplete=t},i.prototype.setErrorCallback=function(t){this.onError=t},i.prototype.run=function(t){return zs(this,void 0,void 0,function(){var e,n,r,s,o,a,l=this;return hi(this,function(h){switch(h.label){case 0:e=this.tasks.length,n=t,r=function(c){var u,g,d;return hi(this,function(f){switch(f.label){case 0:u=s.tasks[c],f.label=1;case 1:return f.trys.push([1,3,,4]),[4,s.scheduleTask(function(){return zs(l,void 0,void 0,function(){var p;return hi(this,function(m){switch(m.label){case 0:return[4,u.run(n)];case 1:return p=m.sent(),this.onProgress((c+1)/e,u),[2,p]}})})})];case 2:return n=f.sent(),[3,4];case 3:return g=f.sent(),d=s.onError({error:g,taskIndex:c,task:u}),d?[2,{value:Promise.reject(g)}]:[3,4];case 4:return[2]}})},s=this,o=0,h.label=1;case 1:return o<e?[5,r(o)]:[3,4];case 2:if(a=h.sent(),typeof a=="object")return[2,a.value];h.label=3;case 3:return o++,[3,1];case 4:return this.onComplete(n),[2]}})})},i}(),Xo=function(){function i(t,e,n){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n}return i.prototype.itemStart=function(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0},i.prototype.itemEnd=function(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())},i.prototype.itemError=function(t){this.onError!==void 0&&this.onError(t)},i.prototype.resolveURL=function(t){return this.urlModifier?this.urlModifier(t):t},i.prototype.setURLModifier=function(t){return this.urlModifier=t,this},i.prototype.addHandler=function(t,e){return this.handlers.push(t,e),this},i.prototype.removeHandler=function(t){var e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this},i.prototype.getHandler=function(t){for(var e=0,n=this.handlers.length;e<n;e+=2){var r=this.handlers[e],s=this.handlers[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return s}return null},i}(),Yo=new Xo,Oh=function(){function i(t){this.manager=t!==void 0?t:Yo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return i.prototype.loadAsync=function(t,e){var n=this;return new Promise(function(r,s){n.load(t,r,e,s)})},i.prototype.parse=function(t){},i.prototype.setCrossOrigin=function(t){return this.crossOrigin=t,this},i.prototype.setWithCredentials=function(t){return this.withCredentials=t,this},i.prototype.setPath=function(t){return this.path=t,this},i.prototype.setResourcePath=function(t){return this.resourcePath=t,this},i.prototype.setRequestHeader=function(t){return this.requestHeader=t,this},i}();const Vs=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class Rt{constructor(t){if(typeof t=="string"){const e=Vs.find(n=>n.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=Vs.find(n=>n.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Ro{constructor(t={}){this._database=t.database,this._precision=Math.max(0,Math.min(16,t.precision??16)),this._version=t.version instanceof Rt?t.version:t.version!=null?new Rt(t.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(t){this._database=t}get precision(){return this._precision}setPrecision(t){return this._precision=Math.max(0,Math.min(16,t)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(t){return this._version=t instanceof Rt?t:new Rt(t),this}toString(){return this._lines.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Qr=(i=>(i[i.Invalid=-9999]="Invalid",i[i.Start=0]="Start",i[i.Text=1]="Text",i[i.AttributeTag=2]="AttributeTag",i[i.BlockName=2]="BlockName",i[i.ShapeName=2]="ShapeName",i[i.SymbolTableName=2]="SymbolTableName",i[i.SymbolTableRecordName=2]="SymbolTableRecordName",i[i.MlineStyleName=2]="MlineStyleName",i[i.AttributePrompt=3]="AttributePrompt",i[i.Description=3]="Description",i[i.DimPostString=3]="DimPostString",i[i.DimStyleName=3]="DimStyleName",i[i.LinetypeProse=3]="LinetypeProse",i[i.TextFontFile=3]="TextFontFile",i[i.CLShapeName=4]="CLShapeName",i[i.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",i[i.SymbolTableRecordComments=4]="SymbolTableRecordComments",i[i.TextBigFontFile=4]="TextBigFontFile",i[i.Handle=5]="Handle",i[i.DimensionBlock=5]="DimensionBlock",i[i.LinetypeName=6]="LinetypeName",i[i.DimBlk1=6]="DimBlk1",i[i.TextStyleName=7]="TextStyleName",i[i.DimBlk2=7]="DimBlk2",i[i.LayerName=8]="LayerName",i[i.CLShapeText=9]="CLShapeText",i[i.XCoordinate=10]="XCoordinate",i[i.YCoordinate=20]="YCoordinate",i[i.ZCoordinate=30]="ZCoordinate",i[i.Real=40]="Real",i[i.TxtSize=40]="TxtSize",i[i.ViewportHeight=40]="ViewportHeight",i[i.Angle=50]="Angle",i[i.ViewportSnapAngle=50]="ViewportSnapAngle",i[i.Visibility=60]="Visibility",i[i.Int16=70]="Int16",i[i.Int32=90]="Int32",i[i.Int64=160]="Int64",i[i.Int8=280]="Int8",i[i.Thickness=39]="Thickness",i[i.Elevation=38]="Elevation",i[i.LinetypeScale=48]="LinetypeScale",i[i.DashLength=49]="DashLength",i[i.MlineOffset=49]="MlineOffset",i[i.LinetypeElement=49]="LinetypeElement",i[i.NormalX=210]="NormalX",i[i.NormalY=220]="NormalY",i[i.NormalZ=230]="NormalZ",i[i.UcsOrg=110]="UcsOrg",i[i.UcsOrientationX=111]="UcsOrientationX",i[i.UcsOrientationY=112]="UcsOrientationY",i[i.ViewHeight=45]="ViewHeight",i[i.ViewWidth=41]="ViewWidth",i[i.ViewLensLength=42]="ViewLensLength",i[i.ViewFrontClip=43]="ViewFrontClip",i[i.ViewBackClip=44]="ViewBackClip",i[i.ViewBrightness=141]="ViewBrightness",i[i.ViewContrast=142]="ViewContrast",i[i.ViewMode=71]="ViewMode",i[i.ViewportActive=68]="ViewportActive",i[i.ViewportAspect=41]="ViewportAspect",i[i.ViewportGrid=76]="ViewportGrid",i[i.ViewportIcon=74]="ViewportIcon",i[i.ViewportNumber=69]="ViewportNumber",i[i.ViewportSnap=75]="ViewportSnap",i[i.ViewportSnapPair=78]="ViewportSnapPair",i[i.ViewportSnapStyle=77]="ViewportSnapStyle",i[i.ViewportTwist=51]="ViewportTwist",i[i.ViewportVisibility=67]="ViewportVisibility",i[i.ViewportZoom=73]="ViewportZoom",i[i.Color=62]="Color",i[i.ColorRgb=420]="ColorRgb",i[i.ColorName=430]="ColorName",i[i.LineWeight=370]="LineWeight",i[i.PlotStyleNameType=380]="PlotStyleNameType",i[i.PlotStyleNameId=390]="PlotStyleNameId",i[i.GradientObjType=450]="GradientObjType",i[i.GradientAngle=460]="GradientAngle",i[i.GradientName=470]="GradientName",i[i.GradientColCount=453]="GradientColCount",i[i.GradientPatType=451]="GradientPatType",i[i.GradientTintType=452]="GradientTintType",i[i.GradientShift=461]="GradientShift",i[i.GradientColVal=463]="GradientColVal",i[i.GradientTintVal=462]="GradientTintVal",i[i.SoftPointerId=330]="SoftPointerId",i[i.HardPointerId=340]="HardPointerId",i[i.SoftOwnershipId=350]="SoftOwnershipId",i[i.HardOwnershipId=360]="HardOwnershipId",i[i.ArbitraryHandle=320]="ArbitraryHandle",i[i.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",i[i.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",i[i.ExtendedDataControlString=1002]="ExtendedDataControlString",i[i.ExtendedDataLayerName=1003]="ExtendedDataLayerName",i[i.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",i[i.ExtendedDataHandle=1005]="ExtendedDataHandle",i[i.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",i[i.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",i[i.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",i[i.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",i[i.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",i[i.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",i[i.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",i[i.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",i[i.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",i[i.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",i[i.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",i[i.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",i[i.ExtendedDataReal=1040]="ExtendedDataReal",i[i.ExtendedDataDist=1041]="ExtendedDataDist",i[i.ExtendedDataScale=1042]="ExtendedDataScale",i[i.ExtendedDataInteger16=1070]="ExtendedDataInteger16",i[i.ExtendedDataInteger32=1071]="ExtendedDataInteger32",i[i.XTextString=300]="XTextString",i[i.XReal=140]="XReal",i[i.XInt16=170]="XInt16",i[i.XXInt16=270]="XXInt16",i[i.Subclass=100]="Subclass",i[i.ControlString=102]="ControlString",i[i.EmbeddedObjectStart=101]="EmbeddedObjectStart",i[i.End=-1]="End",i[i.FirstEntityId=-2]="FirstEntityId",i[i.HeaderId=-2]="HeaderId",i[i.XDataStart=-3]="XDataStart",i[i.Operator=-4]="Operator",i[i.PReactors=-5]="PReactors",i[i.XDictionary=-6]="XDictionary",i))(Qr||{});exports.AcCmColorMethod=void 0;(function(i){i[i.ByColor=1]="ByColor",i[i.ByACI=2]="ByACI",i[i.ByLayer=3]="ByLayer",i[i.ByBlock=4]="ByBlock",i[i.None=0]="None"})(exports.AcCmColorMethod||(exports.AcCmColorMethod={}));var qh=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Kh=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},so={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},wi=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0],Zt=(function(){function i(){}return i.getColorByIndex=function(t){return wi[t]},i.getIndexByColor=function(t){for(var e=wi.length-1,n=1;n<e;++n)if(wi[n]===t)return n},i.getColorByName=function(t){return so[t.toLowerCase()]},i.getNameByColor=function(t){var e,n;try{for(var r=qh(Object.entries(so)),s=r.next();!s.done;s=r.next()){var o=Kh(s.value,2),a=o[0],l=o[1];if(l===t)return a}}catch(h){e={error:h}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},i.getNameByIndex=function(t){var e=this.getColorByIndex(t);return this.getNameByColor(e)},i})(),Zh=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},X=(function(){function i(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByLayer),this._colorMethod=t,this._colorMethod==exports.AcCmColorMethod.ByColor&&e==null?this._value=16777215:this._colorMethod==exports.AcCmColorMethod.ByACI?e==null?this._value=8:e===0?this._colorMethod=exports.AcCmColorMethod.ByBlock:e===256?this._colorMethod=exports.AcCmColorMethod.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}return Object.defineProperty(i.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(t){this._colorMethod=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"red",{get:function(){var t=this.RGB;return t!=null?t>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"green",{get:function(){var t=this.RGB;return t!=null?t>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blue",{get:function(){var t=this.RGB;return t!=null?t&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"RGB",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByColor:case exports.AcCmColorMethod.ByBlock:case exports.AcCmColorMethod.ByLayer:return this._value;case exports.AcCmColorMethod.ByACI:return this._value?Zt.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),i.prototype.setRGB=function(t,e,n){var r=Math.max(0,Math.min(255,Math.round(t))),s=Math.max(0,Math.min(255,Math.round(e))),o=Math.max(0,Math.min(255,Math.round(n)));return this._value=r<<16|s<<8|o,this._colorMethod=exports.AcCmColorMethod.ByColor,this},i.prototype.setRGBValue=function(t){return t==null||!Number.isFinite(t)?this:(this._value=t&16777215,this._colorMethod=exports.AcCmColorMethod.ByColor,this)},i.prototype.setRGBFromCss=function(t){if(!t)return this;var e=t.trim().toLowerCase();if(e.startsWith("#")){var n=0,r=0,s=0;if(e.length===7)n=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),s=parseInt(e.substr(5,2),16);else if(e.length===4)n=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),s=parseInt(e[3]+e[3],16);else return this;return this.setRGB(n,r,s)}var o=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var n=parseInt(o[1],10),r=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(n,r,s)}var a=Zt.getColorByName(t);return a!==void 0?this.setRGBValue(a):this},i.prototype.setScalar=function(t){return this.setRGB(t,t,t)},Object.defineProperty(i.prototype,"hexColor",{get:function(){var t=this.RGB;if(t!=null){var e=t.toString(16).padStart(6,"0").toUpperCase();return"0x"+e}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cssColor",{get:function(){var t=this.RGB;if(t!=null)return"rgb(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,")")},enumerable:!1,configurable:!0}),i.prototype.cssColorAlpha=function(t){var e=this.RGB;if(e!=null)return"rgba(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,",").concat(t,")")},Object.defineProperty(i.prototype,"colorIndex",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI?this._value:this._colorMethod===exports.AcCmColorMethod.ByLayer?256:this._colorMethod===exports.AcCmColorMethod.ByBlock?0:void 0},set:function(t){if(t!=null){var e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=exports.AcCmColorMethod.ByBlock,this._value=void 0):e===256?(this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=void 0):(this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=e)}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByColor",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByACI",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isForeground",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI&&this._value===7},enumerable:!1,configurable:!0}),i.prototype.setForeground=function(){return this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=7,this},Object.defineProperty(i.prototype,"isByLayer",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},enumerable:!1,configurable:!0}),i.prototype.setByLayer=function(t){return this._colorMethod=exports.AcCmColorMethod.ByLayer,t==null?this._value=256:this._value=t,this},Object.defineProperty(i.prototype,"isByBlock",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},enumerable:!1,configurable:!0}),i.prototype.setByBlock=function(t){return this._colorMethod=exports.AcCmColorMethod.ByBlock,t==null?this._value=0:this._value=t,this},Object.defineProperty(i.prototype,"colorName",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByColor:return this._value?Zt.getNameByColor(this._value):"";case exports.AcCmColorMethod.ByACI:return this._value?Zt.getNameByIndex(this._value):"";default:return}},set:function(t){if(t){var e=Zt.getColorByName(t);e!==void 0&&(this._value=e,this._colorMethod=exports.AcCmColorMethod.ByColor)}},enumerable:!1,configurable:!0}),i.prototype.clone=function(){var t=new i;return t._colorMethod=this._colorMethod,t._value=this._value,t},i.prototype.copy=function(t){return this._colorMethod=t._colorMethod,this._value=t._value,this},i.prototype.equals=function(t){return this._colorMethod===t._colorMethod&&this._value===t._value},i.prototype.toString=function(){switch(this._colorMethod){case exports.AcCmColorMethod.None:return"None";case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByACI:return this._value!==void 0?String(this._value):"";case exports.AcCmColorMethod.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},i.fromString=function(t){if(t){var e=t.trim();if(/^none$/i.test(e))return new i(exports.AcCmColorMethod.None);if(/^bylayer$/i.test(e))return new i(exports.AcCmColorMethod.ByLayer);if(/^byblock$/i.test(e))return new i(exports.AcCmColorMethod.ByBlock);var n=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(n){var r=Number(n[1]),s=Number(n[2]),o=Number(n[3]),a=new i(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){var l=Zh(e.split(",").map(Number),3),r=l[0],s=l[1],o=l[2],a=new i(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d+$/.test(e)){var h=parseInt(e,10);return new i(exports.AcCmColorMethod.ByACI,h)}if(/^book\$/i.test(e)){var c=e.substring(e.indexOf("$")+1),u=Zt.getColorByName(c);return u!=null?new i(exports.AcCmColorMethod.ByColor,u):void 0}var g=Zt.getColorByName(e);if(g!=null)return new i(exports.AcCmColorMethod.ByColor,g)}},i})(),Qh=(function(){function i(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByColor),e===void 0&&(e=0),this._colorMethod=t,this._value=e}return Object.defineProperty(i.prototype,"colorMethd",{get:function(){return this._colorMethod},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"red",{get:function(){return this._value>>16&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&65535|(t&255)<<16},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"green",{get:function(){return this._value>>8&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16711935|(t&255)<<8},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blue",{get:function(){return this._value&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16776960|t&255},enumerable:!1,configurable:!0}),i.prototype.setRGB=function(t,e,n){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=(t&255)<<16|(e&255)<<8|n&255},Object.defineProperty(i.prototype,"colorIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"layerIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=t},enumerable:!1,configurable:!0}),i.prototype.isByColor=function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},i.prototype.isByLayer=function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},i.prototype.isByBlock=function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},i.prototype.isByACI=function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},i.prototype.isNone=function(){return this._colorMethod===exports.AcCmColorMethod.None},Object.defineProperty(i.prototype,"rawValue",{get:function(){return this._value},set:function(t){this._value=t},enumerable:!1,configurable:!0}),i})(),gt={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}},Jh=(function(){function i(){this._listeners={}}return i.prototype.addEventListener=function(t,e){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},i.prototype.hasEventListener=function(t,e){if(this._listeners===void 0)return!1;var n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1},i.prototype.removeEventListener=function(t,e){if(this._listeners!==void 0){var n=this._listeners,r=n[t];if(r!==void 0){var s=r.indexOf(e);s!==-1&&r.splice(s,1)}}},i.prototype.dispatchEvent=function(t){if(this._listeners!==void 0){var e=this._listeners,n=e[t.type];if(n!==void 0){t.target=this;for(var r=n.slice(0),s=0,o=r.length;s<o;s++)r[s].call(this,t)}}},i})(),tc=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ec=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},nc=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},q=(function(){function i(){this.listeners=[]}return i.prototype.addEventListener=function(t){this.listeners.push(t)},i.prototype.removeEventListener=function(t){this.listeners=this.listeners.filter(function(e){return e!==t})},i.prototype.replaceEventListener=function(t){this.removeEventListener(t),this.addEventListener(t)},i.prototype.dispatch=function(t){for(var e,n,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];try{for(var o=tc(this.listeners),a=o.next();!a.done;a=o.next()){var l=a.value,h=l;h.call.apply(h,nc([null,t],ec(r),!1))}}catch(c){e={error:c}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},i})(),Ui=function(){return Ui=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ui.apply(this,arguments)},ic=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},rc=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},Qo=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function qe(i){return i===null||typeof i!="object"?i:Array.isArray(i)?rc([],ic(i),!1):Ui({},i)}function Hi(i){if(i===null||typeof i!="object")return i;if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp)return new RegExp(i.source,i.flags);if(Array.isArray(i))return i.map(Hi);var t={};for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=Hi(i[e]));return t}function It(i){for(var t,e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];try{for(var s=Qo(n),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&i[l]===void 0&&(i[l]=a[l])}}catch(h){t={error:h}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return i}function Jo(i,t){return i!=null&&Object.prototype.hasOwnProperty.call(i,t)}function ta(i){return i==null?!0:Array.isArray(i)||typeof i=="string"?i.length===0:i instanceof Map||i instanceof Set?i.size===0:typeof i=="object"?Object.keys(i).length===0:!1}function fe(i,t){var e,n;if(i===t)return!0;if(i==null||t==null)return i===t;if(typeof i!=typeof t)return!1;if(typeof i!="object")return i===t;if(Array.isArray(i)!==Array.isArray(t))return!1;if(Array.isArray(i)){if(i.length!==t.length)return!1;for(var r=0;r<i.length;r++)if(!fe(i[r],t[r]))return!1;return!0}var s=Object.keys(i),o=Object.keys(t);if(s.length!==o.length)return!1;try{for(var a=Qo(s),l=a.next();!l.done;l=a.next()){var h=l.value;if(!Object.prototype.hasOwnProperty.call(t,h)||!fe(i[h],t[h]))return!1}}catch(c){e={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0}function sc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Rn={exports:{}},oc=Rn.exports,oo;function ac(){return oo||(oo=1,(function(i){(function(t,e){i.exports?i.exports=e():t.log=e()})(oc,function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(p,y){var _=p[y];if(typeof _.bind=="function")return _.bind(p);try{return Function.prototype.bind.call(_,p)}catch{return function(){return Function.prototype.apply.apply(_,[p,arguments])}}}function l(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function h(p){return p==="debug"&&(p="log"),typeof console===e?!1:p==="trace"&&n?l:console[p]!==void 0?a(console,p):console.log!==void 0?a(console,"log"):t}function c(){for(var p=this.getLevel(),y=0;y<r.length;y++){var _=r[y];this[_]=y<p?t:this.methodFactory(_,p,this.name)}if(this.log=this.debug,typeof console===e&&p<this.levels.SILENT)return"No console available for logging"}function u(p){return function(){typeof console!==e&&(c.call(this),this[p].apply(this,arguments))}}function g(p,y,_){return h(p)||u.apply(this,arguments)}function d(p,y){var _=this,x,P,A,I="loglevel";typeof p=="string"?I+=":"+p:typeof p=="symbol"&&(I=void 0);function E(N){var R=(r[N]||"silent").toUpperCase();if(!(typeof window===e||!I)){try{window.localStorage[I]=R;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+R+";"}catch{}}}function L(){var N;if(!(typeof window===e||!I)){try{N=window.localStorage[I]}catch{}if(typeof N===e)try{var R=window.document.cookie,G=encodeURIComponent(I),U=R.indexOf(G+"=");U!==-1&&(N=/^([^;]+)/.exec(R.slice(U+G.length+1))[1])}catch{}return _.levels[N]===void 0&&(N=void 0),N}}function C(){if(!(typeof window===e||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function M(N){var R=N;if(typeof R=="string"&&_.levels[R.toUpperCase()]!==void 0&&(R=_.levels[R.toUpperCase()]),typeof R=="number"&&R>=0&&R<=_.levels.SILENT)return R;throw new TypeError("log.setLevel() called with invalid level: "+N)}_.name=p,_.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_.methodFactory=y||g,_.getLevel=function(){return A??P??x},_.setLevel=function(N,R){return A=M(N),R!==!1&&E(A),c.call(_)},_.setDefaultLevel=function(N){P=M(N),L()||_.setLevel(N,!1)},_.resetLevel=function(){A=null,C(),c.call(_)},_.enableAll=function(N){_.setLevel(_.levels.TRACE,N)},_.disableAll=function(N){_.setLevel(_.levels.SILENT,N)},_.rebuild=function(){if(o!==_&&(x=M(o.getLevel())),c.call(_),o===_)for(var N in s)s[N].rebuild()},x=M(o?o.getLevel():"WARN");var Y=L();Y!=null&&(A=M(Y)),c.call(_)}o=new d,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var _=s[y];return _||(_=s[y]=new d(y,o.methodFactory)),_};var f=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=f),o},o.getLoggers=function(){return s},o.default=o,o})})(Rn)),Rn.exports}var lc=ac();const hc=sc(lc);var cc=!0,Ke=hc;Ke.setLevel("debug");var uc=function(i){try{Ke.setLevel(i)}catch(t){Ke.setLevel("error"),Ke.error(t)}},Wi=(function(){function i(t,e){this.events={attrChanged:new q,modelChanged:new q},this._changing=!1,this._previousAttributes={},this._pending=!1;var n=t||{};e&&It(n,e),this.attributes=n,this.changed={}}return i.prototype.get=function(t){return this.attributes[t]},i.prototype.set=function(t,e,n){if(t==null)return this;var r;typeof t=="object"?(r=t,n=e):(r={},r[t]=e),n||(n={});var s=n.unset,o=n.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=qe(this.attributes),this.changed={});var h=this.attributes,c=this.changed,u=this._previousAttributes;for(var g in r)e=r[g],fe(h[g],e)||a.push(g),fe(u[g],e)?delete c[g]:c[g]=e,s?delete h[g]:h[g]=e;if(!o){a.length&&(this._pending=n);for(var d=0;d<a.length;d++)this.events.attrChanged.dispatch({object:this,attrName:a[d],attrValue:h[a[d]],options:n})}if(l)return this;if(!o)for(;this._pending;)n=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:n});return this._pending=!1,this._changing=!1,this},i.prototype.has=function(t){return this.get(t)!=null},i.prototype.hasChanged=function(t){return t==null?!ta(this.changed):Jo(this.changed,t)},i.prototype.changedAttributes=function(t){if(!t)return this.hasChanged()?qe(this.changed):{};var e=this._changing?this._previousAttributes:this.attributes,n={};for(var r in t){var s=t[r];fe(e[r],s)||(n[r]=s)}return n},i.prototype.previous=function(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]},i.prototype.previousAttributes=function(){return qe(this._previousAttributes)},i.prototype.clone=function(){var t=qe(this.attributes);return new i(t)},i})(),dc=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},gc=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Jr=(function(){function i(){this.entries=new Map}return i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i.prototype.collect=function(t){this.entries.set(t.name,t)},i.prototype.printAll=function(){var t,e;try{for(var n=dc(this.entries),r=n.next();!r.done;r=n.next())var s=gc(r.value,2),o=s[0],a=s[1]}catch(l){t={error:l}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},i.prototype.clear=function(){this.entries.clear()},i.prototype.getAll=function(){return Array.from(this.entries.values())},i.prototype.getEntry=function(t){return this.entries.get(t)},i.prototype.remove=function(t){return this.entries.delete(t)},i})(),fc=(function(){function i(){}return i.formatBytes=function(t,e){if(e===void 0&&(e=2),t===0)return"0 B";var n=1024,r=Math.max(0,e),s=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(n)),a=t/Math.pow(n,o);return"".concat(parseFloat(a.toFixed(r))," ").concat(s[o])},i})();exports.AcCmTransparencyMethod=void 0;(function(i){i[i.ByLayer=0]="ByLayer",i[i.ByBlock=1]="ByBlock",i[i.ByAlpha=2]="ByAlpha",i[i.ErrorValue=3]="ErrorValue"})(exports.AcCmTransparencyMethod||(exports.AcCmTransparencyMethod={}));var Q=(function(){function i(t){t!==void 0?(this._method=exports.AcCmTransparencyMethod.ByAlpha,this._alpha=i.clampAlpha(t)):(this._method=exports.AcCmTransparencyMethod.ByLayer,this._alpha=255)}return Object.defineProperty(i.prototype,"method",{get:function(){return this._method},set:function(t){this._method=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=i.clampAlpha(t),this._method=exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"percentage",{get:function(){if(this._method===exports.AcCmTransparencyMethod.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(t){var e=Math.max(0,Math.min(100,t)),n=Math.round(255*(1-e/100));this.alpha=n},enumerable:!1,configurable:!0}),i.clampAlpha=function(t){return Math.max(0,Math.min(255,Math.floor(t)))},Object.defineProperty(i.prototype,"isByAlpha",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByBlock",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isByLayer",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isInvalid",{get:function(){return this._method===exports.AcCmTransparencyMethod.ErrorValue},enumerable:!1,configurable:!0}),i.prototype.serialize=function(){var t=this._method;return t<<24|this._alpha},i.prototype.clone=function(){var t=new i;return t._method=this._method,t._alpha=this._alpha,t},i.prototype.equals=function(t){return this._method===t._method&&this._alpha===t._alpha},i.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},i.fromString=function(t){var e=t.trim(),n=e.toLowerCase();if(n===""||n==="."||n==="use current"||n==="bylayer"){var r=new i;return r._method=exports.AcCmTransparencyMethod.ByLayer,r}if(n==="byblock"){var s=new i;return s._method=exports.AcCmTransparencyMethod.ByBlock,s}var o=Number(e);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new i;return o<=90?a.percentage=o:a.alpha=o,a}var l=new i;return l._method=exports.AcCmTransparencyMethod.ErrorValue,l},i.deserialize=function(t){var e=t>>>24&255,n=t&255,r=e>=exports.AcCmTransparencyMethod.ByLayer&&e<=exports.AcCmTransparencyMethod.ErrorValue?e:exports.AcCmTransparencyMethod.ErrorValue,s=new i;return s._method=r,s._alpha=i.clampAlpha(n),s},i})(),ao=function(i,t,e,n){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(c){try{h(n.next(c))}catch(u){o(u)}}function l(c){try{h(n.throw(c))}catch(u){o(u)}}function h(c){c.done?s(c.value):r(c.value).then(a,l)}h((n=n.apply(i,t||[])).next())})},xi=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},ea=(function(){function i(t){this.name=t}return i.prototype.run=function(t){throw new Error("run() must be implemented by subclass")},i})(),na=(function(){function i(){this.tasks=[],this.onProgress=function(){},this.onComplete=function(){},this.onError=function(){return!1}}return i.prototype.scheduleTask=function(t){return new Promise(function(e,n){var r=function(){Promise.resolve(t()).then(e).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})},i.prototype.addTask=function(t){this.tasks.push(t)},i.prototype.setProgressCallback=function(t){this.onProgress=t},i.prototype.setCompleteCallback=function(t){this.onComplete=t},i.prototype.setErrorCallback=function(t){this.onError=t},i.prototype.run=function(t){return ao(this,void 0,void 0,function(){var e,n,r,s,o,a,l=this;return xi(this,function(h){switch(h.label){case 0:e=this.tasks.length,n=t,r=function(c){var u,g,d;return xi(this,function(f){switch(f.label){case 0:u=s.tasks[c],f.label=1;case 1:return f.trys.push([1,3,,4]),[4,s.scheduleTask(function(){return ao(l,void 0,void 0,function(){var p;return xi(this,function(y){switch(y.label){case 0:return[4,u.run(n)];case 1:return p=y.sent(),this.onProgress((c+1)/e,u),[2,p]}})})})];case 2:return n=f.sent(),[3,4];case 3:return g=f.sent(),d=s.onError({error:g,taskIndex:c,task:u}),d?[2,{value:Promise.reject(g)}]:[3,4];case 4:return[2]}})},s=this,o=0,h.label=1;case 1:return o<e?[5,r(o)]:[3,4];case 2:if(a=h.sent(),typeof a=="object")return[2,a.value];h.label=3;case 3:return o++,[3,1];case 4:return this.onComplete(n),[2]}})})},i})(),ia=(function(){function i(t,e,n){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n}return i.prototype.itemStart=function(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0},i.prototype.itemEnd=function(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())},i.prototype.itemError=function(t){this.onError!==void 0&&this.onError(t)},i.prototype.resolveURL=function(t){return this.urlModifier?this.urlModifier(t):t},i.prototype.setURLModifier=function(t){return this.urlModifier=t,this},i.prototype.addHandler=function(t,e){return this.handlers.push(t,e),this},i.prototype.removeHandler=function(t){var e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this},i.prototype.getHandler=function(t){for(var e=0,n=this.handlers.length;e<n;e+=2){var r=this.handlers[e],s=this.handlers[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return s}return null},i})(),ra=new ia,pc=(function(){function i(t){this.manager=t!==void 0?t:ra,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return i.prototype.loadAsync=function(t,e){var n=this;return new Promise(function(r,s){n.load(t,r,e,s)})},i.prototype.parse=function(t){},i.prototype.setCrossOrigin=function(t){return this.crossOrigin=t,this},i.prototype.setWithCredentials=function(t){return this.withCredentials=t,this},i.prototype.setPath=function(t){return this.path=t,this},i.prototype.setResourcePath=function(t){return this.resourcePath=t,this},i.prototype.setRequestHeader=function(t){return this.requestHeader=t,this},i})();const lo=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class jt{constructor(t){if(typeof t=="string"){const e=lo.find(n=>n.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=lo.find(n=>n.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class sa{constructor(t={}){this._database=t.database,this._precision=Math.max(0,Math.min(16,t.precision??16)),this._version=t.version instanceof jt?t.version:t.version!=null?new jt(t.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(t){this._database=t}get precision(){return this._precision}setPrecision(t){return this._precision=Math.max(0,Math.min(16,t)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(t){return this._version=t instanceof jt?t:new jt(t),this}toString(){return this._lines.join(`
|
|
2
2
|
`)+`
|
|
3
|
-
`}registerHandle(t){return this._handleMap.has(t)||(/^[0-9A-F]+$/i.test(t)?this._handleMap.set(t,t.toUpperCase()):(this._handleMap.set(t,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(t)}resolveHandle(t){if(t)return this.registerHandle(t)}writeGroup(t,e){if(e==null)return this;this._lines.push(String(Math.trunc(t)));const n=this.formatValue(e);return this._lines.push(n===""?"0":n),this}writeStart(t){return this.writeString(0,t)}writeSubclassMarker(t){return this.writeString(100,t)}writeString(t,e){return!e&&e!==""?this:this.writeGroup(t,e)}writeInt8(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt16(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt32(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt64(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeUInt16(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeUInt32(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeBoolean(t,e){return e==null?this:this.writeGroup(t,e?1:0)}writeBool(t,e){return this.writeBoolean(t,e)}writeDouble(t,e){return e==null||!Number.isFinite(e)?this:this.writeGroup(t,e)}writeAngle(t,e){return e==null||!Number.isFinite(e)?this:this.writeDouble(t,e*180/Math.PI)}writeHandle(t,e){const n=this.resolveHandle(e);return n?this.writeString(t,n):this}writeObjectId(t,e){return this.writeHandle(t,e)}writePoint2d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this):this}writePoint3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeVector3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeCmColor(t,e=62,n=420){if(!t)return this;const r=t.colorIndex;r!=null&&this.writeInt16(e,r);const s=t.RGB;return s!=null&&t.colorIndex==null&&this.writeInt32(n,s),this}writeTransparency(t,e=440){return!t||t.method===exports.AcCmTransparencyMethod.ErrorValue?this:this.writeInt32(e,t.serialize())}writeResultBuffer(t){if(!t)return this;for(const e of t)this.writeGroup(e.code,e.value);return this}startSection(t){return this.writeStart("SECTION"),this.writeString(2,t),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(t){return this.writeStart("TABLE"),this.writeString(2,t),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(t){if(typeof t=="string")return this.sanitizeStringForDxfLine(t);if(typeof t=="boolean")return t?"1":"0";if(typeof t=="number"){if(!Number.isFinite(t))return"0";if(Number.isInteger(t))return String(t);const n=t.toFixed(this._precision).replace(/\.?0+$/,"");return n===""||n==="-"?"0":n}return String(t)}sanitizeStringForDxfLine(t){return t.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var ae=256,Bo=[],js=256,yn;for(;ae--;)Bo[ae]=(ae+256).toString(16).substring(1);function Nh(i){var t=0,e=11;if(!yn||ae+e>js*2)for(yn="",ae=0;t<js;t++)yn+=Bo[Math.random()*256|0];return yn.substring(ae,ae+++e)}const qt="TEMP_";let tn;function Fo(i){tn=i}function Xh(){if(tn)return tn().workingDatabase;throw new Error("The current working database must be set before using it!")}const Lt=class Lt{constructor(t,e){if(t=t||{},this._attrs=new ki(t,e),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return qt+Nh()}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t),t&&!t.startsWith(qt)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(qt)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){if(this._database)return this._database;if(tn)return tn().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this.assignDatabase(t)}assignDatabase(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Nr.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}getOwnSnapshotKeys(){return Reflect.ownKeys(this).filter(t=>typeof t=="string"&&!Lt.SNAPSHOT_EXCLUDED_KEYS.has(t))}cloneAttrs(t){const e=this.cloneValue(t.attributes);return new ki(e)}restoreAttrsFrom(t){const e=this.cloneValue(t.attributes),n=this._attrs.attributes;for(const r of Object.keys(n))r in e||this._attrs.set(r,void 0,{unset:!0,silent:!0});this._attrs.set(e,{silent:!0})}restoreXDataMapFrom(t){this._xDataMap.clear();for(const[e,n]of t.entries())this._xDataMap.set(e,this.cloneValue(n))}copySnapshotStateTo(t){t._attrs=this.cloneAttrs(this._attrs),t._xDataMap=this.cloneValue(this._xDataMap);const e=this,n=t;for(const r of this.getOwnSnapshotKeys())Lt.SNAPSHOT_INTERNAL_KEYS.has(r)||(n[r]=this.cloneValue(e[r]))}clone(){const t=Object.create(Object.getPrototypeOf(this));return this.copySnapshotStateTo(t),t.objectId=this.generateTemporaryHandle(),t}clonePreservingIdentity(){const t=this.clone(),e=this.getAttrWithoutException("objectId");e&&t._attrs.set("objectId",e);const n=this.getAttrWithoutException("ownerId");return n!==void 0&&t._attrs.set("ownerId",n),this._database&&(t._database=this._database),t}restoreFrom(t){const e=this.objectId,n=this._database;this.restoreAttrsFrom(t._attrs),this.restoreXDataMapFrom(t._xDataMap);const r=t,s=this,o=new Set(t.getOwnSnapshotKeys());for(const a of o)Lt.SNAPSHOT_INTERNAL_KEYS.has(a)||Lt.SNAPSHOT_EXCLUDED_KEYS.has(a)||(s[a]=this.cloneValue(r[a]));for(const a of this.getOwnSnapshotKeys())Lt.SNAPSHOT_INTERNAL_KEYS.has(a)||Lt.SNAPSHOT_EXCLUDED_KEYS.has(a)||o.has(a)||delete s[a];this.objectId=e,n&&(this.database=n)}cloneValue(t){if(t==null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(r=>this.cloneValue(r));if(t instanceof Map){const r=new Map;for(const[s,o]of t.entries())r.set(this.cloneValue(s),this.cloneValue(o));return r}if(t instanceof Set){const r=new Set;for(const s of t.values())r.add(this.cloneValue(s));return r}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));const r=t.constructor;return new r(t)}if(t instanceof ArrayBuffer)return t.slice(0);if(t&&typeof t=="object"&&"tables"in t&&"transactionManager"in t)return t;if("clone"in t&&typeof t.clone=="function")return t.clone();const e=Object.create(Object.getPrototypeOf(t)),n=t;for(const r of Object.keys(n))e[r]=this.cloneValue(n[r]);return e}dxfOut(...t){const[e,n=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),n)for(const r of this._xDataMap.values())e.writeResultBuffer(r);return this}dxfOutFields(t){return this}};Lt.SNAPSHOT_EXCLUDED_KEYS=new Set(["_database","transactionManager"]),Lt.SNAPSHOT_INTERNAL_KEYS=new Set(["_attrs","_xDataMap"]);let gt=Lt;var rt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Ds=1234567,Yr=Math.PI/180,Rr=180/Math.PI;function zo(){var i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=rt[i&255]+rt[i>>8&255]+rt[i>>16&255]+rt[i>>24&255]+"-"+rt[t&255]+rt[t>>8&255]+"-"+rt[t>>16&15|64]+rt[t>>24&255]+"-"+rt[e&63|128]+rt[e>>8&255]+"-"+rt[e>>16&255]+rt[e>>24&255]+rt[n&255]+rt[n>>8&255]+rt[n>>16&255]+rt[n>>24&255];return r.toLowerCase()}function Yt(i,t,e){return Math.max(t,Math.min(e,i))}function Br(i,t){return(i%t+t)%t}function Vo(i,t,e,n,r){return n+(i-t)*(r-n)/(e-t)}function jo(i,t,e){return i!==t?(e-i)/(t-i):0}function Fr(i,t,e){return(1-e)*i+e*t}function Do(i,t,e,n){return Fr(i,t,1-Math.exp(-e*n))}function Go(i,t){return t===void 0&&(t=1),t-Math.abs(Br(i,t*2)-t)}function Ho(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Wo(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Uo(i,t){return i+Math.floor(Math.random()*(t-i+1))}function $o(i,t){return i+Math.random()*(t-i)}function qo(i){return i*(.5-Math.random())}function Ko(i){i!==void 0&&(Ds=i);var t=Ds+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Zo(i){return i*Yr}function Qo(i){return i*Rr}function Jo(i){return(i&i-1)===0&&i!==0}function ta(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function ea(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function We(i){var t=Math.PI*2;return(i%t+t)%t}function na(i,t,e){return i>t&&i<e||i>e&&i<t}function ia(i,t,e,n){return n===void 0&&(n=!1),i=We(i),t=We(t),e=We(e),n?t>e?i<=t&&i>=e:i<=t||i>=e:t<e?i>=t&&i<=e:i>=t||i<=e}function zr(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function ra(i,t){t===void 0&&(t=1e-7);var e=zr(i);return Math.max(Math.pow(10,e)*t,t)}var E={DEG2RAD:Yr,RAD2DEG:Rr,generateUUID:zo,clamp:Yt,euclideanModulo:Br,mapLinear:Vo,inverseLerp:jo,lerp:Fr,damp:Do,pingpong:Go,smoothstep:Ho,smootherstep:Wo,randInt:Uo,randFloat:$o,randFloatSpread:qo,seededRandom:Ko,degToRad:Zo,radToDeg:Qo,isPowerOfTwo:Jo,ceilPowerOfTwo:ta,floorPowerOfTwo:ea,normalizeAngle:We,isBetween:na,isBetweenAngle:ia,intPartLength:zr,relativeEps:ra},Yh=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},H=function(){function i(t,e){this.x=0,this.y=0;var n=+(t!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(n===1){var r=t,s=r.x,o=r.y;this.x=s,this.y=o;return}if(n===2){this.x=t,this.y=e;return}throw ut.ILLEGAL_PARAMETERS}}return Object.defineProperty(i.prototype,"width",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),i.prototype.set=function(t,e){return this.x=t,this.y=e,this},i.prototype.setScalar=function(t){return this.x=t,this.y=t,this},i.prototype.setX=function(t){return this.x=t,this},i.prototype.setY=function(t){return this.y=t,this},i.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},i.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},i.prototype.clone=function(){return new i(this.x,this.y)},i.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},i.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},i.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},i.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},i.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},i.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},i.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},i.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},i.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},i.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},i.prototype.applyMatrix2d=function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},i.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},i.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},i.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},i.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},i.prototype.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},i.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},i.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},i.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},i.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},i.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},i.prototype.dot=function(t){return this.x*t.x+this.y*t.y},i.prototype.cross=function(t){return this.x*t.y-this.y*t.x},i.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},i.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},i.prototype.normalize=function(){return this.divideScalar(this.length()||1)},i.prototype.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},i.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,n)))},i.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},i.prototype.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},i.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},i.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},i.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},i.prototype.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this},i.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},i.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t},i.prototype.rotateAround=function(t,e){var n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*n-o*r+t.x,this.y=s*r+o*n+t.y,this},i.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},i.prototype.relativeEps=function(t){return t===void 0&&(t=1e-7),Math.min(E.relativeEps(this.x,t),E.relativeEps(this.y,t))},i.prototype[Symbol.iterator]=function(){return Yh(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[2]}})},i.EMPTY=Object.freeze(new i(0,0)),i}(),dn=function(){function i(t,e,n,r,s,o,a,l,h){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&n!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&h!=null&&this.set(t,e,n,r,s,o,a,l,h)}return i.prototype.set=function(t,e,n,r,s,o,a,l,h){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=s,c[5]=l,c[6]=n,c[7]=o,c[8]=h,this},i.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},i.prototype.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},i.prototype.extractBasis=function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},i.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},i.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},i.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},i.prototype.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[3],l=n[6],h=n[1],c=n[4],u=n[7],g=n[2],d=n[5],f=n[8],p=r[0],m=r[3],_=r[6],v=r[1],P=r[4],S=r[7],L=r[2],T=r[5],I=r[8];return s[0]=o*p+a*v+l*L,s[3]=o*m+a*P+l*T,s[6]=o*_+a*S+l*I,s[1]=h*p+c*v+u*L,s[4]=h*m+c*P+u*T,s[7]=h*_+c*S+u*I,s[2]=g*p+d*v+f*L,s[5]=g*m+d*P+f*T,s[8]=g*_+d*S+f*I,this},i.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},i.prototype.determinant=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8];return e*o*c-e*a*h-n*s*c+n*a*l+r*s*h-r*o*l},i.prototype.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*o-a*h,g=a*l-c*s,d=h*s-o*l,f=e*u+n*g+r*d;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return t[0]=u*p,t[1]=(r*h-c*n)*p,t[2]=(a*n-r*o)*p,t[3]=g*p,t[4]=(c*e-r*l)*p,t[5]=(r*s-a*e)*p,t[6]=d*p,t[7]=(n*l-h*e)*p,t[8]=(o*e-n*s)*p,this},i.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},i.prototype.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},i.prototype.transposeIntoArray=function(t){var e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this},i.prototype.setUvTransform=function(t,e,n,r,s,o,a){var l=Math.cos(s),h=Math.sin(s);return this.set(n*l,n*h,-n*(l*o+h*a)+o+t,-r*h,r*l,-r*(-h*o+l*a)+a+e,0,0,1),this},i.prototype.scale=function(t,e){return this.premultiply(ci.makeScale(t,e)),this},i.prototype.rotate=function(t){return this.premultiply(ci.makeRotation(-t)),this},i.prototype.translate=function(t,e){return this.premultiply(ci.makeTranslation(t,e)),this},i.prototype.makeTranslation=function(t,e){return t instanceof H?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this},i.prototype.makeRotation=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this},i.prototype.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},i.prototype.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},i.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},i.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t},i.prototype.clone=function(){return new i().fromArray(this.elements)},i.IDENTITY=Object.freeze(new i),i}(),ci=new dn,Xt=1e-6,R=2*Math.PI,Rh={x:0,y:0},Vr={x:0,y:0,z:0},D=function(){function i(){this.equalPointTol=Xt,this.equalVectorTol=Xt}return i.prototype.clone=function(){var t=new i;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t},i.prototype.equalPoint2d=function(t,e){return new H(t).sub(e).length()<this.equalPointTol},i.prototype.equalPoint3d=function(t,e){return new b(t).sub(e).length()<this.equalPointTol},i.equalToZero=function(t,e){return e===void 0&&(e=Xt),t<e&&t>-e},i.equal=function(t,e,n){return n===void 0&&(n=Xt),Math.abs(t-e)<n},i.great=function(t,e,n){return n===void 0&&(n=Xt),t-e>n},i.less=function(t,e,n){return n===void 0&&(n=Xt),t-e<n},i.isPositive=function(t,e){return e===void 0&&(e=Xt),t>e},i.isNonPositive=function(t,e){return e===void 0&&(e=Xt),t<=e},i}(),ti=new D,Bh=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},ke=function(){function i(t,e,n,r){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=1),this._x=t,this._y=e,this._z=n,this._w=r}return i.slerpFlat=function(t,e,n,r,s,o,a){var l=n[r+0],h=n[r+1],c=n[r+2],u=n[r+3],g=s[o+0],d=s[o+1],f=s[o+2],p=s[o+3];if(a===0){t[e+0]=l,t[e+1]=h,t[e+2]=c,t[e+3]=u;return}if(a===1){t[e+0]=g,t[e+1]=d,t[e+2]=f,t[e+3]=p;return}if(u!==p||l!==g||h!==d||c!==f){var m=1-a,_=l*g+h*d+c*f+u*p,v=_>=0?1:-1,P=1-_*_;if(P>Number.EPSILON){var S=Math.sqrt(P),L=Math.atan2(S,_*v);m=Math.sin(m*L)/S,a=Math.sin(a*L)/S}var T=a*v;if(l=l*m+g*T,h=h*m+d*T,c=c*m+f*T,u=u*m+p*T,m===1-a){var I=1/Math.sqrt(l*l+h*h+c*c+u*u);l*=I,h*=I,c*=I,u*=I}}t[e]=l,t[e+1]=h,t[e+2]=c,t[e+3]=u},i.multiplyQuaternionsFlat=function(t,e,n,r,s,o){var a=n[r],l=n[r+1],h=n[r+2],c=n[r+3],u=s[o],g=s[o+1],d=s[o+2],f=s[o+3];return t[e]=a*f+c*u+l*d-h*g,t[e+1]=l*f+c*g+h*u-a*d,t[e+2]=h*f+c*d+a*g-l*u,t[e+3]=c*f-a*u-l*g-h*d,t},Object.defineProperty(i.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),i.prototype.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},i.prototype.clone=function(){return new i(this._x,this._y,this._z,this._w)},i.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},i.prototype.setFromEuler=function(t,e){e===void 0&&(e=!0);var n=t.x,r=t.y,s=t.z,o=t.order,a=Math.cos,l=Math.sin,h=a(n/2),c=a(r/2),u=a(s/2),g=l(n/2),d=l(r/2),f=l(s/2);switch(o){case"XYZ":this._x=g*c*u+h*d*f,this._y=h*d*u-g*c*f,this._z=h*c*f+g*d*u,this._w=h*c*u-g*d*f;break;case"YXZ":this._x=g*c*u+h*d*f,this._y=h*d*u-g*c*f,this._z=h*c*f-g*d*u,this._w=h*c*u+g*d*f;break;case"ZXY":this._x=g*c*u-h*d*f,this._y=h*d*u+g*c*f,this._z=h*c*f+g*d*u,this._w=h*c*u-g*d*f;break;case"ZYX":this._x=g*c*u-h*d*f,this._y=h*d*u+g*c*f,this._z=h*c*f-g*d*u,this._w=h*c*u+g*d*f;break;case"YZX":this._x=g*c*u+h*d*f,this._y=h*d*u+g*c*f,this._z=h*c*f-g*d*u,this._w=h*c*u-g*d*f;break;case"XZY":this._x=g*c*u-h*d*f,this._y=h*d*u-g*c*f,this._z=h*c*f+g*d*u,this._w=h*c*u+g*d*f;break;default:}return e===!0&&this._onChangeCallback(),this},i.prototype.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},i.prototype.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],s=e[8],o=e[1],a=e[5],l=e[9],h=e[2],c=e[6],u=e[10],g=n+a+u;if(g>0){var d=.5/Math.sqrt(g+1);this._w=.25/d,this._x=(c-l)*d,this._y=(s-h)*d,this._z=(o-r)*d}else if(n>a&&n>u){var d=2*Math.sqrt(1+n-a-u);this._w=(c-l)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+h)/d}else if(a>u){var d=2*Math.sqrt(1+a-n-u);this._w=(s-h)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(l+c)/d}else{var d=2*Math.sqrt(1+u-n-a);this._w=(o-r)/d,this._x=(s+h)/d,this._y=(l+c)/d,this._z=.25*d}return this._onChangeCallback(),this},i.prototype.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},i.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(Yt(this.dot(t),-1,1)))},i.prototype.rotateTowards=function(t,e){var n=this.angleTo(t);if(n===0)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},i.prototype.identity=function(){return this.set(0,0,0,1)},i.prototype.invert=function(){return this.conjugate()},i.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},i.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},i.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},i.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},i.prototype.normalize=function(){var t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},i.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},i.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},i.prototype.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,s=t._z,o=t._w,a=e._x,l=e._y,h=e._z,c=e._w;return this._x=n*c+o*a+r*h-s*l,this._y=r*c+o*l+s*a-n*h,this._z=s*c+o*h+n*l-r*a,this._w=o*c-n*a-r*l-s*h,this._onChangeCallback(),this},i.prototype.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copy(t);var n=this._x,r=this._y,s=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;var l=1-a*a;if(l<=Number.EPSILON){var h=1-e;return this._w=h*o+e*this._w,this._x=h*n+e*this._x,this._y=h*r+e*this._y,this._z=h*s+e*this._z,this.normalize(),this}var c=Math.sqrt(l),u=Math.atan2(c,a),g=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*g+this._w*d,this._x=n*g+this._x*d,this._y=r*g+this._y*d,this._z=s*g+this._z*d,this._onChangeCallback(),this},i.prototype.slerpQuaternions=function(t,e,n){return this.copy(t).slerp(e,n)},i.prototype.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))},i.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},i.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},i.prototype.toJSON=function(){return this.toArray()},i.prototype._onChange=function(t){return this._onChangeCallback=t,this},i.prototype._onChangeCallback=function(){},i.prototype[Symbol.iterator]=function(){return Bh(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._w];case 4:return t.sent(),[2]}})},i}(),Fh=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},b=function(){function i(t,e,n){this.x=0,this.y=0,this.z=0;var r=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){var s=t,o=s.x,a=s.y,l=s.z;this.x=o,this.y=a,this.z=l||0;return}if(r===3){this.x=t,this.y=e,this.z=n;return}throw ut.ILLEGAL_PARAMETERS}}return i.prototype.set=function(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this},i.prototype.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},i.prototype.setX=function(t){return this.x=t,this},i.prototype.setY=function(t){return this.y=t,this},i.prototype.setZ=function(t){return this.z=t,this},i.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},i.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},i.prototype.clone=function(){return new i(this.x,this.y,this.z)},i.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},i.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},i.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},i.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},i.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},i.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},i.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},i.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},i.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},i.prototype.applyEuler=function(t){return this.applyQuaternion(Gs.setFromEuler(t))},i.prototype.applyAxisAngle=function(t,e){return this.applyQuaternion(Gs.setFromAxisAngle(t,e))},i.prototype.applyMatrix3=function(t){var e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this},i.prototype.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},i.prototype.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*o,this},i.prototype.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,s=t.x,o=t.y,a=t.z,l=t.w,h=2*(o*r-a*n),c=2*(a*e-s*r),u=2*(s*n-o*e);return this.x=e+l*h+o*u-a*c,this.y=n+l*c+a*h-s*u,this.z=r+l*u+s*c-o*h,this},i.prototype.transformDirection=function(t){var e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()},i.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},i.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},i.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},i.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},i.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},i.prototype.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},i.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},i.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},i.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},i.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},i.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.prototype.isParallelTo=function(t){var e=this.dot(t),n=this.length(),r=t.length();return Math.abs(e)===n*r},i.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},i.prototype.normalize=function(){return this.divideScalar(this.length()||1)},i.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},i.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},i.prototype.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},i.prototype.cross=function(t){return this.crossVectors(this,t)},i.prototype.crossVectors=function(t,e){var n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,l=e.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this},i.prototype.projectOnVector=function(t){var e=t.lengthSq();if(e===0)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},i.prototype.projectOnPlane=function(t){return ui.copy(this).projectOnVector(t),this.sub(ui)},i.prototype.reflect=function(t){return this.sub(ui.copy(t).multiplyScalar(2*this.dot(t)))},i.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,n)))},i.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},i.prototype.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},i.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},i.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},i.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},i.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,e*4)},i.prototype.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,e*3)},i.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},i.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},i.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},i.prototype.randomDirection=function(){var t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this},i.prototype[Symbol.iterator]=function(){return Fh(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[4,this.z];case 3:return t.sent(),[2]}})},i.ORIGIN=Object.freeze(new i(0,0,0)),i.X_AXIS=Object.freeze(new i(1,0,0)),i.NEGATIVE_X_AXIS=Object.freeze(new i(-1,0,0)),i.Y_AXIS=Object.freeze(new i(0,1,0)),i.NEGATIVE_Y_AXIS=Object.freeze(new i(0,-1,0)),i.Z_AXIS=Object.freeze(new i(0,0,1)),i.NEGATIVE_Z_AXIS=Object.freeze(new i(0,0,-1)),i}(),ui=new b,Gs=new ke,C=function(){function i(t,e,n,r,s,o,a,l,h,c,u,g,d,f,p,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&n!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&h!=null&&c!=null&&u!=null&&g!=null&&d!=null&&f!=null&&p!=null&&m!=null&&this.set(t,e,n,r,s,o,a,l,h,c,u,g,d,f,p,m)}return i.makeTranslation=function(t,e,n){return new i().makeTranslation(t,e,n)},i.prototype.set=function(t,e,n,r,s,o,a,l,h,c,u,g,d,f,p,m){var _=this.elements;return _[0]=t,_[4]=e,_[8]=n,_[12]=r,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=h,_[6]=c,_[10]=u,_[14]=g,_[3]=d,_[7]=f,_[11]=p,_[15]=m,this},i.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},i.prototype.clone=function(){return new i().fromArray(this.elements)},i.prototype.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},i.prototype.copyPosition=function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},i.prototype.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},i.prototype.setFromExtrusionDirection=function(t){var e=Math.hypot(t.x,t.y,t.z);if(!Number.isFinite(e)||e<1e-12)return this.identity(),this;var n=Math.abs(e-1)>1e-6?t.clone().multiplyScalar(1/e):t;if(ti.equalPoint3d(n,b.Z_AXIS))this.identity();else{var r=new b(1,0,0);Math.abs(n.x)<1/64&&Math.abs(n.y)<1/64?r.crossVectors(b.Y_AXIS,n).normalize():r.crossVectors(b.Z_AXIS,n).normalize();var s=n.clone().cross(r).normalize();this.set(r.x,r.y,r.z,0,s.x,s.y,s.z,0,n.x,n.y,n.z,0,0,0,0,1)}return this},i.prototype.extractBasis=function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},i.prototype.makeBasis=function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},i.prototype.extractRotation=function(t){var e=this.elements,n=t.elements,r=1/me.setFromMatrixColumn(t,0).length(),s=1/me.setFromMatrixColumn(t,1).length(),o=1/me.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},i.prototype.makeRotationFromQuaternion=function(t){return this.compose(zh,t,Vh)},i.prototype.lookAt=function(t,e,n){var r=this.elements;return dt.subVectors(t,e),dt.lengthSq()===0&&(dt.z=1),dt.normalize(),Gt.crossVectors(n,dt),Gt.lengthSq()===0&&(Math.abs(n.z)===1?dt.x+=1e-4:dt.z+=1e-4,dt.normalize(),Gt.crossVectors(n,dt)),Gt.normalize(),mn.crossVectors(dt,Gt),r[0]=Gt.x,r[4]=mn.x,r[8]=dt.x,r[1]=Gt.y,r[5]=mn.y,r[9]=dt.y,r[2]=Gt.z,r[6]=mn.z,r[10]=dt.z,this},i.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},i.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},i.prototype.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[4],l=n[8],h=n[12],c=n[1],u=n[5],g=n[9],d=n[13],f=n[2],p=n[6],m=n[10],_=n[14],v=n[3],P=n[7],S=n[11],L=n[15],T=r[0],I=r[4],X=r[8],M=r[12],j=r[1],N=r[5],F=r[9],$=r[13],ot=r[2],At=r[6],fe=r[10],pe=r[14],ne=r[3],ye=r[7],jt=r[11],Dt=r[15];return s[0]=o*T+a*j+l*ot+h*ne,s[4]=o*I+a*N+l*At+h*ye,s[8]=o*X+a*F+l*fe+h*jt,s[12]=o*M+a*$+l*pe+h*Dt,s[1]=c*T+u*j+g*ot+d*ne,s[5]=c*I+u*N+g*At+d*ye,s[9]=c*X+u*F+g*fe+d*jt,s[13]=c*M+u*$+g*pe+d*Dt,s[2]=f*T+p*j+m*ot+_*ne,s[6]=f*I+p*N+m*At+_*ye,s[10]=f*X+p*F+m*fe+_*jt,s[14]=f*M+p*$+m*pe+_*Dt,s[3]=v*T+P*j+S*ot+L*ne,s[7]=v*I+P*N+S*At+L*ye,s[11]=v*X+P*F+S*fe+L*jt,s[15]=v*M+P*$+S*pe+L*Dt,this},i.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},i.prototype.determinant=function(){var t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],o=t[1],a=t[5],l=t[9],h=t[13],c=t[2],u=t[6],g=t[10],d=t[14],f=t[3],p=t[7],m=t[11],_=t[15];return f*(+s*l*u-r*h*u-s*a*g+n*h*g+r*a*d-n*l*d)+p*(+e*l*d-e*h*g+s*o*g-r*o*d+r*h*c-s*l*c)+m*(+e*h*u-e*a*d-s*o*u+n*o*d+s*a*c-n*h*c)+_*(-r*a*c-e*l*u+e*a*g+r*o*u-n*o*g+n*l*c)},i.prototype.transpose=function(){var t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},i.prototype.setPosition=function(t,e,n){var r=this.elements;return t instanceof b?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this},i.prototype.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=t[9],g=t[10],d=t[11],f=t[12],p=t[13],m=t[14],_=t[15],v=u*m*h-p*g*h+p*l*d-a*m*d-u*l*_+a*g*_,P=f*g*h-c*m*h-f*l*d+o*m*d+c*l*_-o*g*_,S=c*p*h-f*u*h+f*a*d-o*p*d-c*a*_+o*u*_,L=f*u*l-c*p*l-f*a*g+o*p*g+c*a*m-o*u*m,T=e*v+n*P+r*S+s*L;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var I=1/T;return t[0]=v*I,t[1]=(p*g*s-u*m*s-p*r*d+n*m*d+u*r*_-n*g*_)*I,t[2]=(a*m*s-p*l*s+p*r*h-n*m*h-a*r*_+n*l*_)*I,t[3]=(u*l*s-a*g*s-u*r*h+n*g*h+a*r*d-n*l*d)*I,t[4]=P*I,t[5]=(c*m*s-f*g*s+f*r*d-e*m*d-c*r*_+e*g*_)*I,t[6]=(f*l*s-o*m*s-f*r*h+e*m*h+o*r*_-e*l*_)*I,t[7]=(o*g*s-c*l*s+c*r*h-e*g*h-o*r*d+e*l*d)*I,t[8]=S*I,t[9]=(f*u*s-c*p*s-f*n*d+e*p*d+c*n*_-e*u*_)*I,t[10]=(o*p*s-f*a*s+f*n*h-e*p*h-o*n*_+e*a*_)*I,t[11]=(c*a*s-o*u*s-c*n*h+e*u*h+o*n*d-e*a*d)*I,t[12]=L*I,t[13]=(c*p*r-f*u*r+f*n*g-e*p*g-c*n*m+e*u*m)*I,t[14]=(f*a*r-o*p*r-f*n*l+e*p*l+o*n*m-e*a*m)*I,t[15]=(o*u*r-c*a*r+c*n*l-e*u*l-o*n*g+e*a*g)*I,this},i.prototype.scale=function(t){var e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this},i.prototype.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},i.prototype.makeTranslation=function(t,e,n){var r;return typeof t=="object"?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,(r=t.z)!==null&&r!==void 0?r:0,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},i.prototype.makeRotationX=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},i.prototype.makeRotationY=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},i.prototype.makeRotationZ=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},i.prototype.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),s=1-n,o=t.x,a=t.y,l=t.z,h=s*o,c=s*a;return this.set(h*o+n,h*a-r*l,h*l+r*a,0,h*a+r*l,c*a+n,c*l-r*o,0,h*l-r*a,c*l+r*o,s*l*l+n,0,0,0,0,1),this},i.prototype.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},i.prototype.makeShear=function(t,e,n,r,s,o){return this.set(1,n,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this},i.prototype.compose=function(t,e,n){var r=this.elements,s=e.x,o=e.y,a=e.z,l=e.w,h=s+s,c=o+o,u=a+a,g=s*h,d=s*c,f=s*u,p=o*c,m=o*u,_=a*u,v=l*h,P=l*c,S=l*u,L=n.x,T=n.y,I=n.z;return r[0]=(1-(p+_))*L,r[1]=(d+S)*L,r[2]=(f-P)*L,r[3]=0,r[4]=(d-S)*T,r[5]=(1-(g+_))*T,r[6]=(m+v)*T,r[7]=0,r[8]=(f+P)*I,r[9]=(m-v)*I,r[10]=(1-(g+p))*I,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},i.prototype.decompose=function(t,e,n){var r=this.elements,s=me.set(r[0],r[1],r[2]).length(),o=me.set(r[4],r[5],r[6]).length(),a=me.set(r[8],r[9],r[10]).length(),l=this.determinant();l<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],vt.copy(this);var h=1/s,c=1/o,u=1/a;return vt.elements[0]*=h,vt.elements[1]*=h,vt.elements[2]*=h,vt.elements[4]*=c,vt.elements[5]*=c,vt.elements[6]*=c,vt.elements[8]*=u,vt.elements[9]*=u,vt.elements[10]*=u,e.setFromRotationMatrix(vt),n.x=s,n.y=o,n.z=a,this},i.prototype.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},i.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},i.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t},i.IDENTITY=Object.freeze(new i),i}(),me=new b,vt=new C,zh=new b(0,0,0),Vh=new b(1,1,1),Gt=new b,mn=new b,dt=new b,k=function(){function i(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new b(1/0,1/0,1/0):new b(t.x,t.y,t.z),this.max=e==null?new b(-1/0,-1/0,-1/0):new b(e.x,e.y,e.z)}return i.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},i.prototype.setFromArray=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e+=3)this.expandByPoint(di.fromArray(t,e));return this},i.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},i.prototype.setFromCenterAndSize=function(t,e){var n=di.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},i.prototype.clone=function(){return new i().copy(this)},i.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},i.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},i.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},i.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},i.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},Object.defineProperty(i.prototype,"center",{get:function(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),i.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},i.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},i.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},i.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},i.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},i.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},i.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},i.prototype.intersectsPlane=function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},i.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},i.prototype.distanceToPoint=function(t){return this.clampPoint(t,di).distanceTo(t)},i.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},i.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},i.prototype.applyMatrix4=function(t){return this.isEmpty()?this:(Nt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Nt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Nt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Nt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Nt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Nt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Nt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Nt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Nt),this)},i.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},i.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},i}(),Nt=[new b,new b,new b,new b,new b,new b,new b,new b],di=new b,Hs=new H,nt=function(){function i(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new H(1/0,1/0):new H(t.x,t.y),this.max=e==null?new H(-1/0,-1/0):new H(e.x,e.y)}return i.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},i.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},i.prototype.setFromCenterAndSize=function(t,e){var n=Hs.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},i.prototype.clone=function(){return new i().copy(this)},i.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},i.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},i.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},i.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},i.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},Object.defineProperty(i.prototype,"center",{get:function(){return this.isEmpty()?new H(0,0):new H(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){return this.isEmpty()?new H(0,0):new H(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),i.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},i.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},i.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},i.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},i.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},i.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},i.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},i.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},i.prototype.distanceToPoint=function(t){return this.clampPoint(t,Hs).distanceTo(t)},i.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},i.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},i.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},i.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},i}(),Ws=new b,jh=new b,Dh=new dn,jr=function(){function i(t,e){t===void 0&&(t=new b(1,0,0)),e===void 0&&(e=0),this.normal=t,this.constant=e}return i.prototype.set=function(t,e){return this.normal.copy(t),this.constant=e,this},i.prototype.setComponents=function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},i.prototype.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},i.prototype.setFromCoplanarPoints=function(t,e,n){var r=Ws.subVectors(n,e).cross(jh.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},i.prototype.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},i.prototype.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},i.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},i.prototype.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},i.prototype.projectPoint=function(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},i.prototype.intersectsBox=function(t){return t.intersectsPlane(this)},i.prototype.coplanarPoint=function(t){return t.copy(this.normal).multiplyScalar(-this.constant)},i.prototype.applyMatrix4=function(t,e){var n=e||Dh.getNormalMatrix(t),r=this.coplanarPoint(Ws).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this},i.prototype.translate=function(t){return this.constant-=t.dot(this.normal),this},i.prototype.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},i.prototype.clone=function(){return new i().copy(this)},i}(),Gh=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),A=function(i){Gh(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y)},t.pointArrayToNumberArray=function(e){var n=new Array(e.length*2);return e.forEach(function(r,s){r.toArray(n,s*2)}),n},t}(H),Hh=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),y=function(i){Hh(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.pointArrayToNumberArray=function(e,n){n===void 0&&(n=!0);var r=n?3:2,s=new Array(e.length*r);return e.forEach(function(o,a){o.toArray(s,a*r)}),s},t}(b),Wh=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},Us=new C,$s=new ke,Uh=function(){function i(t,e,n,r){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=i.DEFAULT_ORDER),this._x=t,this._y=e,this._z=n,this._order=r}return Object.defineProperty(i.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),i.prototype.set=function(t,e,n,r){return r===void 0&&(r=this._order),this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this},i.prototype.clone=function(){return new i(this._x,this._y,this._z,this._order)},i.prototype.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},i.prototype.setFromRotationMatrix=function(t,e,n){e===void 0&&(e=this._order),n===void 0&&(n=!0);var r=t.elements,s=r[0],o=r[4],a=r[8],l=r[1],h=r[5],c=r[9],u=r[2],g=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(Yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Yt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Yt(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Yt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(Yt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Yt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:}return this._order=e,n===!0&&this._onChangeCallback(),this},i.prototype.setFromQuaternion=function(t,e,n){return n===void 0&&(n=!0),Us.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Us,e,n)},i.prototype.setFromVector3=function(t,e){return e===void 0&&(e=this._order),this.set(t.x,t.y,t.z,e)},i.prototype.reorder=function(t){return $s.setFromEuler(this),this.setFromQuaternion($s,t)},i.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},i.prototype.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},i.prototype._onChange=function(t){return this._onChangeCallback=t,this},i.prototype._onChangeCallback=function(){},i.prototype[Symbol.iterator]=function(){return Wh(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._order];case 4:return t.sent(),[2]}})},i.DEFAULT_ORDER="XYZ",i}();function $h(i){var t,e=i;return{x:i.x,y:i.y,z:(t=e.z)!==null&&t!==void 0?t:0}}function qh(i,t){var e,n;i.x+=t.x,i.y+=t.y,i.z=((e=i.z)!==null&&e!==void 0?e:0)+((n=t.z)!==null&&n!==void 0?n:0)}function Kh(i,t,e){e===void 0&&(e=!1);for(var n=i.x,r=i.y,s=!1,o=t.length,a=0,l=o-1;a<o;l=a++){var h=t[a].x,c=t[a].y,u=t[l].x,g=t[l].y,d=c>r!=g>r;e&&(d=c>=r!=g>=r);var f=d&&n<(u-h)*(r-c)/(g-c)+h;f&&(s=!s)}return s}function Zh(i,t){if(i.length===0||t.length===0)return!1;var e=new nt().setFromPoints(i),n=new nt().setFromPoints(t);if(!e.intersectsBox(n))return!1;for(var r=0;r<i.length;){if(st.isPointInPolygon(i[r],t,!0))return!0;r<i.length-1&&ti.equalPoint2d(i[r+1],i[r])&&++r,++r}return!1}var st={applyOffsetToPoint3d:qh,isPointInPolygon:Kh,isPolygonIntersect:Zh,point2dToPoint3d:$h},_n=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},bn=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))};function Qh(i,t){for(var e=[],n=t-1,r=i,s=0;s<=r;s++)e.push(0);for(var s=1;s<=n-r;s++)e.push(s);for(var s=0;s<=r;s++)e.push(n-r+1);return e}function Jh(i,t){for(var e=t.length-1,n=i,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],l=t[o][1]-t[o-1][1],h=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+l*l+h*h);s+=c,r.push(s)}for(var u=[],o=0;o<=n;o++)u.push(0);for(var o=1;o<=e-n;o++){var g=r[o]/s;u.push(g*(e-n+1))}for(var o=0;o<=n;o++)u.push(e-n+1);return u}function sa(i,t){t===void 0&&(t="Uniform");var e=i.length;if(e===0)return[];if(e===1)return[0];var n=e-1;if(t==="Uniform")return new Array(e).fill(0).map(function(g,d){return d/n});for(var r=[0],s=0,o=1;o<=n;o++){var a=i[o][0]-i[o-1][0],l=i[o][1]-i[o-1][1],h=i[o][2]-i[o-1][2],c=Math.sqrt(a*a+l*l+h*h),u=t==="SqrtChord"?Math.sqrt(c):c;s+=u,r.push(s)}return s<1e-12?new Array(e).fill(0).map(function(g,d){return d/n}):r.map(function(g){return g/s})}function oa(i,t){for(var e=t.length-1,n=i,r=e+n+1,s=new Array(r+1).fill(0),o=t[t.length-1],a=r-n;a<=r;a++)s[a]=o;for(var l=1;l<=e-n;l++){for(var h=0,a=l;a<l+n;a++)h+=t[a];s[l+n]=h/n}return s}function tc(i,t){for(var e=t.length-1,n=i,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],l=t[o][1]-t[o-1][1],h=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+l*l+h*h),u=Math.sqrt(c);s+=u,r.push(s)}for(var g=[],o=0;o<=n;o++)g.push(0);for(var o=1;o<=e-n;o++){var d=r[o]/s;g.push(d*(e-n+1))}for(var o=0;o<=n;o++)g.push(e-n+1);return g}function gi(i,t){for(var e=i.length,n=i.map(function(m){return m.slice()}),r=t.slice(),s=0;s<e;s++){for(var o=s,a=Math.abs(n[s][s]),l=s+1;l<e;l++){var h=Math.abs(n[l][s]);h>a&&(a=h,o=l)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==s){var c=n[s];n[s]=n[o],n[o]=c;var u=r[s];r[s]=r[o],r[o]=u}for(var l=s+1;l<e;l++){var g=n[l][s]/n[s][s];if(!(Math.abs(g)<1e-14)){for(var d=s;d<e;d++)n[l][d]-=g*n[s][d];r[l]-=g*r[s]}}}for(var f=new Array(e).fill(0),l=e-1;l>=0;l--){for(var p=r[l],d=l+1;d<e;d++)p-=n[l][d]*f[d];f[l]=p/n[l][l]}return f}function Dr(i,t,e,n,r){var s,o,a,l,h,c;if(e===void 0&&(e="Uniform"),i.length===0)return{controlPoints:[],knots:[],weights:[]};var u=i.map(function(jt){var Dt;return[jt[0],jt[1],(Dt=jt[2])!==null&&Dt!==void 0?Dt:0]}),g=!!n,d=!!r,f=(g?1:0)+(d?1:0),p=u.length-1,m=p+f;if(m<t)throw new Error("Not enough points to interpolate a curve of this degree.");var _=sa(u,e),v=_.slice();g&&v.unshift(_[0]),d&&v.push(_[_.length-1]);var P=oa(t,v),S=m+1,L=new Array(S),T=new Array(S),I=new Array(S),X=new Array(S),M=0;L[M]=new Array(S).fill(0),L[M][0]=1,T[M]=u[0][0],I[M]=u[0][1],X[M]=u[0][2],M++;for(var j=1;j<=p-1;j++){var N=_[j];L[M]=new Array(S).fill(0);for(var F=0;F<=m;F++)L[M][F]=te(F,t,N,P);T[M]=u[j][0],I[M]=u[j][1],X[M]=u[j][2],M++}if(L[M]=new Array(S).fill(0),L[M][m]=1,T[M]=u[p][0],I[M]=u[p][1],X[M]=u[p][2],M++,g){var $=P[t+1]-P[0],ot=$!==0?t/$:0;L[M]=new Array(S).fill(0),L[M][0]=-ot,L[M][1]=ot,T[M]=(s=n==null?void 0:n[0])!==null&&s!==void 0?s:0,I[M]=(o=n==null?void 0:n[1])!==null&&o!==void 0?o:0,X[M]=(a=n==null?void 0:n[2])!==null&&a!==void 0?a:0,M++}if(d){var $=P[m+t+1]-P[m],ot=$!==0?t/$:0;L[M]=new Array(S).fill(0),L[M][m-1]=-ot,L[M][m]=ot,T[M]=(l=r==null?void 0:r[0])!==null&&l!==void 0?l:0,I[M]=(h=r==null?void 0:r[1])!==null&&h!==void 0?h:0,X[M]=(c=r==null?void 0:r[2])!==null&&c!==void 0?c:0,M++}for(var At=gi(L,T),fe=gi(L,I),pe=gi(L,X),ne=new Array(S),j=0;j<S;j++)ne[j]=[At[j],fe[j],pe[j]];var ye=new Array(S).fill(1);return{controlPoints:ne,knots:P,weights:ye}}function te(i,t,e,n){if(t===0)return e>=n[i]&&e<n[i+1]?1:0;var r=n[i+t]-n[i],s=n[i+t+1]-n[i+1],o=r>1e-10?(e-n[i])/r:0,a=s>1e-10?(n[i+t+1]-e)/s:0;return o*te(i,t-1,e,n)+a*te(i+1,t-1,e,n)}function Ue(i,t,e,n,r){var s=n.length-1,o=t;if(i=Math.max(e[o],Math.min(e[s+1],i)),Math.abs(i-e[s+1])<1e-8)return bn([],_n(n[s]),!1);if(Math.abs(i-e[o])<1e-8)return bn([],_n(n[0]),!1);for(var a=[0,0,0],l=0,h=0;h<=s;h++){var c=te(h,o,i,e),u=r[h]*c;a[0]+=n[h][0]*u,a[1]+=n[h][1]*u,a[2]+=n[h][2]*u,l+=u}if(Math.abs(l)<1e-10){var g=e[e.length-o-1];if(Math.abs(i-g)<1e-8)return bn([],_n(n[s]),!1);if(Math.abs(i-e[o])<1e-8)return bn([],_n(n[0]),!1)}return Math.abs(l)>=1e-10&&(a[0]/=l,a[1]/=l,a[2]/=l),a}function Oi(i,t,e,n){if(t===0)return 0;var r=n[i+t]-n[i],s=n[i+t+1]-n[i+1],o=0;return r>1e-10&&(o+=t/r*te(i,t-1,e,n)),s>1e-10&&(o-=t/s*te(i+1,t-1,e,n)),o}function ec(i,t,e,n){if(t<=1)return 0;var r=n[i+t]-n[i],s=n[i+t+1]-n[i+1],o=0;return r>1e-10&&(o+=t/r*Oi(i,t-1,e,n)),s>1e-10&&(o-=t/s*Oi(i+1,t-1,e,n)),o}function nc(i,t,e,n,r){var s=n.length-1,o=t,a=e[o],l=e[s+1];i=Math.max(a,Math.min(l,i));for(var h=[0,0,0],c=[0,0,0],u=[0,0,0],g=0,d=0,f=0,p=0;p<=s;p++){var m=te(p,o,i,e),_=Oi(p,o,i,e),v=ec(p,o,i,e),P=r[p],S=P*m,L=P*_,T=P*v,I=n[p];h[0]+=S*I[0],h[1]+=S*I[1],h[2]+=S*I[2],c[0]+=L*I[0],c[1]+=L*I[1],c[2]+=L*I[2],u[0]+=T*I[0],u[1]+=T*I[1],u[2]+=T*I[2],g+=S,d+=L,f+=T}if(Math.abs(g)<1e-10){var X=Ue(i,t,e,n,r);return{point:X,deriv1:[0,0,0],deriv2:[0,0,0]}}var M=g*g,j=[h[0]/g,h[1]/g,h[2]/g],N=[(c[0]*g-h[0]*d)/M,(c[1]*g-h[1]*d)/M,(c[2]*g-h[2]*d)/M],F=u[0]*g-h[0]*f,$=u[1]*g-h[1]*f,ot=u[2]*g-h[2]*f,At=[F/M-2*d*N[0]/g,$/M-2*d*N[1]/g,ot/M-2*d*N[2]/g];return{point:j,deriv1:N,deriv2:At}}function ic(i,t){var e=i[0],n=i[1],r=t[0],s=t[1],o=e*e+n*n;return o<1e-20?0:(e*s-n*r)/Math.pow(o,1.5)}function aa(i,t,e,n){for(var r=i,s=t[r],o=t[t.length-r-1],a=0,l=1e3,h=(o-s)/l,c=Ue(s,i,t,e,n),u=1;u<=l;u++){var g=s+u*h,d=Ue(g,i,t,e,n),f=d[0]-c[0],p=d[1]-c[1],m=d[2]-c[2];a+=Math.sqrt(f*f+p*p+m*m),c=d}var _=Ue(o,i,t,e,n),v=_[0]-c[0],P=_[1]-c[1],S=_[2]-c[2];return a+=Math.sqrt(v*v+P*P+S*S),a}function rc(i,t,e,n,r){return t===void 0&&(t=3),e===void 0&&(e="Uniform"),i.length===0?[]:Dr(i,t,e,n,r).controlPoints}var qs=new C,Ks=new b,sc=new b,oc=new b,fi=new y;function la(i){return new C().setFromExtrusionDirection(new b(i.x,i.y,i.z))}function en(i){return qs.setFromExtrusionDirection(new b(i.x,i.y,i.z)),qs.extractBasis(Ks,sc,oc),Ks.clone()}function Ni(i,t){var e;return new y(i.x,i.y,(e=i.z)!==null&&e!==void 0?e:0).applyMatrix4(la(t))}function Oe(i,t){var e;return new y(i.x,i.y,(e=i.z)!==null&&e!==void 0?e:0).applyMatrix4(la(t).invert())}function Bt(i,t,e){var n,r,s=Oe(i,e),o=Oe(t,e);return fi.set(o.x-s.x,o.y-s.y,((n=o.z)!==null&&n!==void 0?n:0)-((r=s.z)!==null&&r!==void 0?r:0)),E.normalizeAngle(Math.atan2(fi.y,fi.x))}function ha(i){var t=i.length;if(t<3)return 0;for(var e=0,n=0,r=t-1;n<t;r=n++){var s=i[r],o=i[n];e+=s.x*o.y-o.x*s.y}return e*.5}function ac(i){return Math.abs(ha(i))}function lc(i){var t,e,n=i.length;if(n<3)return 0;for(var r=0,s=0,o=0,a=0,l=n-1;a<n;l=a++){var h=i[l],c=i[a],u=h.x,g=h.y,d=(t=h.z)!==null&&t!==void 0?t:0,f=c.x,p=c.y,m=(e=c.z)!==null&&e!==void 0?e:0;r+=(d+m)*(g-p),s+=(u+f)*(d-m),o+=(g+p)*(u-f)}return .5*Math.hypot(r,s,o)}function hc(i){return i.length<3?0:ac(i)}function ca(i){return i.length<3?0:lc(i)}var ua=function(){function i(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(i.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),i}(),cc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Gr=function(i){cc(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new dn().makeTranslation(e.x,e.y))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t}(ua),uc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fe=function(i){uc(t,i);function t(){var e=i.call(this)||this;return e.arcLengthDivisions=100,e}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},t.prototype.getPointAt=function(e){var n=this.getUtoTmapping(e);return this.getPoint(n)},t.prototype.getPoints=function(e){e===void 0&&(e=5);for(var n=[],r=0;r<=e;r++)n.push(this.getPoint(r/e));return n},t.prototype.getSpacedPoints=function(e){e===void 0&&(e=5);for(var n=[],r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n},t.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},t.prototype.getLengths=function(e){e===void 0&&(e=this.arcLengthDivisions);var n=[],r,s=this.getPoint(0),o=0;n.push(0);for(var a=1;a<=e;a++)r=this.getPoint(a/e),o+=r.distanceTo(s),n.push(o),s=r;return n},t.prototype.getUtoTmapping=function(e,n){var r=this.getLengths(),s=0,o=r.length,a;n?a=n:a=e*r[o-1];for(var l=0,h=o-1,c;l<=h;)if(s=Math.floor(l+(h-l)/2),c=r[s]-a,c<0)l=s+1;else if(c>0)h=s-1;else{h=s;break}if(s=h,r[s]===a)return s/(o-1);var u=r[s],g=r[s+1],d=g-u,f=(a-u)/d,p=(s+f)/(o-1);return p},t.prototype.getTangent=function(e){var n=1e-4,r=e-n,s=e+n;r<0&&(r=0),s>1&&(s=1);var o=this.getPoint(r),a=this.getPoint(s),l=new A;return l.copy(a).sub(o).normalize(),l},t.prototype.getTangentAt=function(e){var n=this.getUtoTmapping(e);return this.getTangent(n)},t}(Gr),dc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),xn=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wn=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},vn=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},ht=function(i){dc(t,i);function t(e,n,r,s,o){var a=i.call(this)||this,l=+(e!==void 0)+ +(n!==void 0)+ +(r!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(l==3)typeof e=="object"&&typeof n=="object"&&typeof r=="object"?a.createByThreePoints(e,n,r):a.createByStartEndPointsAndBulge(e,n,r);else if(l==5){var h=e;a.center=new A(h.x,h.y),a.radius=n,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(E.normalizeAngle(r)):E.normalizeAngle(r),a._endAngle=a._clockwise?a._mirrorAngle(E.normalizeAngle(s)):E.normalizeAngle(s)}else throw ut.ILLEGAL_PARAMETERS;return a}return t.prototype.createByThreePoints=function(e,n,r){var s=function(X,M){return{x:(X.x+M.x)/2,y:(X.y+M.y)/2}},o=function(X,M){return(M.y-X.y)/(M.x-X.x)},a=function(X){return-1/X},l=s(e,n),h=s(n,r),c=o(e,n),u=o(n,r),g=a(c),d=a(u),f=function(X,M,j,N){var F=(N-M)/(X-j),$=X*F+M;return{x:F,y:$}},p=l.y-g*l.x,m=h.y-d*h.x,_=f(g,p,d,m),v=Math.sqrt(Math.pow(e.x-_.x,2)+Math.pow(e.y-_.y,2)),P=function(X,M){return Math.atan2(X.y-M.y,X.x-M.x)},S=P(e,_),L=P(n,_),T=P(r,_),I=T>S&&T<L||S>T&&S<L||L>T&&L<S;this.center=_,this.radius=v,this._clockwise=!I,this._startAngle=S,this._endAngle=T},t.prototype.createByStartEndPointsAndBulge=function(e,n,r){var s,o,a;r<0?(s=Math.atan(-r)*4,o=new H(e),a=new H(n)):(s=Math.atan(r)*4,o=new H(n),a=new H(e));var l=new H().subVectors(a,o),h=l.length(),c=new H().addVectors(o,l.multiplyScalar(.5)),u=Math.abs(h/2/Math.tan(s/2)),g=l.normalize(),d=r<0?-Math.PI/2:Math.PI/2,f=new H(g.x*Math.cos(d)-g.y*Math.sin(d),g.y*Math.cos(d)+g.x*Math.sin(d)),p;s<Math.PI?r<0?p=c.add(f.multiplyScalar(u)):p=c.add(f.multiplyScalar(-u)):r<0?p=c.add(f.multiplyScalar(-u)):p=c.add(f.multiplyScalar(u)),r<0?(this._startAngle=Math.atan2(o.y-p.y,o.x-p.x),this._endAngle=Math.atan2(a.y-p.y,a.x-p.x)):(this._startAngle=Math.atan2(a.y-p.y,a.x-p.x),this._endAngle=Math.atan2(o.y-p.y,o.x-p.x)),this._clockwise=r<0,this.center=p,this.radius=a.sub(p).length()},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new A(e.x,e.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(e){this._startAngle=this._clockwise?this._mirrorAngle(E.normalizeAngle(e)):E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(e){var n=this.startAngle==0&&e==R?e:E.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(n):n,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype._mirrorAngle=function(e){var n=e*180/Math.PI,r=(360-n)%360;return r*Math.PI/180},t.prototype._getInternalAngle=function(e){return this._clockwise?this._mirrorAngle(e):e},Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this._getInternalAngle(this.startAngle),n=this._getInternalAngle(this.endAngle);return this.clockwise?E.normalizeAngle(e-n):E.normalizeAngle(n-e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this._getInternalAngle(this.startAngle),n=this._clockwise?E.normalizeAngle(e-this.deltaAngle/2):E.normalizeAngle(e+this.deltaAngle/2),r=this._clockwise?this._mirrorAngle(n):n;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){var e=this._getInternalAngle(this.startAngle),n=this._getInternalAngle(this.endAngle);return Math.abs(n-e)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,n,r=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=xn(s),a=o.next();!a.done;a=o.next()){var l=a.value,h=this._getInternalAngle(l);E.isBetweenAngle(h,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&r.push(this.getPointAtAngle(l))}}catch(g){e={error:g}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}var c=r.map(function(g){return g.x}),u=r.map(function(g){return g.y});return new nt(new A(Math.min.apply(Math,vn([],wn(c),!1)),Math.min.apply(Math,vn([],wn(u),!1))),new A(Math.max.apply(Math,vn([],wn(c),!1)),Math.max.apply(Math,vn([],wn(u),!1))))},Object.defineProperty(t.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){var n=this,r=e,s=this.center.clone().applyMatrix2d(r),o=this.startPoint.clone().applyMatrix2d(r);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=r.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(r),l=this.endPoint.clone().applyMatrix2d(r),h=new t(o,a,l),c=r.determinant()<0?!this.clockwise:this.clockwise,u=function(g){var d=E.normalizeAngle(g);return c?n._mirrorAngle(d):d};return this.center=h.center,this.radius=h.radius,this.clockwise=c,this.startAngle=u(Math.atan2(o.y-h.center.y,o.x-h.center.x)),this.endAngle=u(Math.atan2(l.y-h.center.y,l.x-h.center.x)),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},t.prototype.getPointAtAngle=function(e){var n=this._getInternalAngle(e),r=this.center.x+this.radius*Math.cos(n),s=this.center.y+this.radius*Math.sin(n);return new A(r,s)},t.prototype.getQuadrantPoints=function(){var e,n,r=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var l=xn(a),h=l.next();!h.done;h=l.next()){var c=h.value,u=this._getInternalAngle(c);E.isBetweenAngle(u,s,o,this.clockwise)&&r.push(this.getPointAtAngle(c))}}catch(g){e={error:g}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}return r},t.prototype.nearestPoint=function(e){var n=new A(e.x,e.y),r=n.x-this.center.x,s=n.y-this.center.y,o=Math.hypot(r,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,r),l=this.clockwise?this._mirrorAngle(E.normalizeAngle(a)):E.normalizeAngle(a),h=this._getInternalAngle(l),c=this._getInternalAngle(this.startAngle),u=this._getInternalAngle(this.endAngle);if(E.isBetweenAngle(h,c,u,this.clockwise))return this.getPointAtAngle(l);var g=n.distanceToSquared(this.startPoint),d=n.distanceToSquared(this.endPoint);return g<=d?this.startPoint.clone():this.endPoint.clone()},t.prototype.perpendicularPoints=function(e){var n,r,s=new A(e.x,e.y),o=s.x-this.center.x,a=s.y-this.center.y,l=Math.hypot(o,a);if(l<1e-12)return[];var h=o/l,c=a/l,u=[new A(this.center.x+h*this.radius,this.center.y+c*this.radius),new A(this.center.x-h*this.radius,this.center.y-c*this.radius)],g=[],d=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var p=xn(u),m=p.next();!m.done;m=p.next()){var _=m.value,v=Math.atan2(_.y-this.center.y,_.x-this.center.x),P=this.clockwise?this._mirrorAngle(E.normalizeAngle(v)):E.normalizeAngle(v),S=this._getInternalAngle(P);(this.closed||E.isBetweenAngle(S,d,f,this.clockwise))&&g.push(_)}}catch(L){n={error:L}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return g},t.prototype.tangentPoints=function(e){var n,r,s=[],o=e.x-this.center.x,a=e.y-this.center.y,l=Math.hypot(o,a),h=this.radius;if(l<h)return s;var c=Math.acos(h/l),u=Math.atan2(a,o),g=[u+c,u-c],d=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var p=xn(g),m=p.next();!m.done;m=p.next()){var _=m.value,v=this.clockwise?this._mirrorAngle(E.normalizeAngle(_)):E.normalizeAngle(_),P=this._getInternalAngle(v);(this.closed||E.isBetweenAngle(P,d,f,this.clockwise))&&s.push(this.getPointAtAngle(v))}}catch(S){n={error:S}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return s},t.prototype.getPoints=function(e){e===void 0&&(e=100);var n=[],r=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(r=R,s=0),this.clockwise)for(var o=0;o<=e;o++){var a=s-r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(l);n.push(new A(h.x,h.y))}else for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(l);n.push(new A(h.x,h.y))}return n},t}(Fe),Xi=function(){return Xi=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Xi.apply(this,arguments)},gc=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Pn=1e-6;function da(i,t){if(Xc(i)){var e=pc(i,t);return e?[e]:[]}var n=ya(i),r=n.numberOfVertices;if(r<2)return[];var s=Rc(n,t);return s?[s]:[]}function fc(i){return ya(i)}function pc(i,t){var e,n,r=yc(i);if(r.length===0)return null;var s=[];try{for(var o=gc(r),a=o.next();!a.done;a=o.next()){var l=a.value,h=_c(l,t);if(!h)return null;s.push(h)}}catch(d){e={error:d}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}var c=mc(i),u=vc(s,c,i.closed,t);if(u.length<2)return null;var g=new V;return u.forEach(function(d,f){g.addVertexAt(f,{x:d.x,y:d.y})}),g.closed=i.closed,g}function yc(i){for(var t,e=[],n=i.numberOfVertices,r=i.closed?n:n-1,s=0;s<r;s++){var o=i.vertices[s],a=i.vertices[(s+1)%n];D.isPositive(Math.abs((t=o.bulge)!==null&&t!==void 0?t:0))?e.push({kind:"arc",arc:new ht(o,a,o.bulge)}):e.push({kind:"line",start:new A(o.x,o.y),end:new A(a.x,a.y)})}return e}function mc(i){for(var t=[],e=0;e<i.numberOfVertices;e++)t.push(i.getPointAt(e));return t}function _c(i,t){if(i.kind==="line"){var e=wc(i.start,i.end,t);return e?Xi({kind:"line"},e):null}var n=bc(i.arc,i.arc.startPoint,i.arc.endPoint,t);return n?{kind:"arc",arc:n}:null}function bc(i,t,e,n){var r=xc(i,t,e,n),s=i.radius+r;return D.isNonPositive(s)?null:new ht(i.center,s,i.startAngle,i.endAngle,i.clockwise)}function xc(i,t,e,n){var r=e.x-t.x,s=e.y-t.y,o=Math.hypot(r,s);if(D.isNonPositive(o))return i.clockwise?-n:n;var a=-s/o,l=r/o,h=i.center.x-(t.x+e.x)/2,c=i.center.y-(t.y+e.y)/2,u=h*a+c*l>0;return u?-n:n}function wc(i,t,e){var n=t.x-i.x,r=t.y-i.y,s=Math.hypot(n,r);if(D.isNonPositive(s))return null;var o=-r/s*e,a=n/s*e;return{start:new A(i.x+o,i.y+a),end:new A(t.x+o,t.y+a),dx:n,dy:r}}function vc(i,t,e,n){var r,s,o,a=i.length;if(a===0)return[];for(var l=Pc(i,t,e,n),h=[(s=(r=l[0].nextSegmentStart)===null||r===void 0?void 0:r.clone())!==null&&s!==void 0?s:l[0].point.clone()],c=0;c<a;c++){var u=i[c],g=c===a-1&&!e?{point:Ic(u)}:l[(c+1)%a];if(c>0&&l[c].filletPoints&&l[c].filletPoints.forEach(function(_){return h.push(_.clone())}),u.kind==="arc")for(var d=(o=l[c].nextSegmentStart)!==null&&o!==void 0?o:l[c].point,f=g.point,p=Ac(u.arc,d,f,Math.max(16,32)),m=1;m<p.length;m++)h.push(p[m]);else h.push(g.point.clone())}return ma(h)}function Pc(i,t,e,n){for(var r=i.length,s=[],o=0;o<r;o++)o===0?s.push(e?Zs(i[r-1],i[0],t[0],n):{point:Ec(i[0])}):s.push(Zs(i[o-1],i[o],t[o],n));return s}function Ac(i,t,e,n){for(var r=i.nearestPoint(t),s=i.nearestPoint(e),o=Yi(i,r),a=Yi(i,s),l=Lc(i,o,a),h=[],c=0;c<=n;c++){var u=c/n,g=i.clockwise?o-l*u:o+l*u;h.push(i.getPointAtAngle(Sc(i,g)))}return h}function Yi(i,t){return Math.atan2(t.y-i.center.y,t.x-i.center.x)}function Sc(i,t){var e=E.normalizeAngle(t);return i.clockwise?Ri(e):e}function Ri(i){var t=i*180/Math.PI;return(360-t)%360*(Math.PI/180)}function Lc(i,t,e){if(i.clockwise){var n=t-e;return D.isNonPositive(n)&&(n+=R),n}var r=e-t;return D.isNonPositive(r)&&(r+=R),r}function Ec(i){return i.kind==="line"?i.start.clone():i.arc.startPoint.clone()}function Ic(i){return i.kind==="line"?i.end.clone():i.arc.endPoint.clone()}function Zs(i,t,e,n){return i.kind==="line"&&t.kind==="line"?{point:Bi({start:i.start,end:i.end,dx:i.dx,dy:i.dy},{start:t.start,end:t.end,dx:t.dx,dy:t.dy})}:i.kind==="line"&&t.kind==="arc"?Qs(i,t.arc,e,n,!0):i.kind==="arc"&&t.kind==="line"?Qs(t,i.arc,e,n,!1):i.kind==="arc"&&t.kind==="arc"?Mc(i.arc,t.arc,e,n):{point:e.clone()}}function Mc(i,t,e,n){var r=pa(i.endPoint,t.startPoint),s=Nc(i,t),o=s.filter(function(c){return kn(i,c)&&kn(t,c)});if(o.length>0)return{point:fa(o,r)};var a=i.endPoint.clone(),l=t.startPoint.clone(),h=ga(e,Math.abs(n),a,l);return{point:a,filletPoints:h,nextSegmentStart:l}}function Qs(i,t,e,n,r){var s=pa(r?i.end:i.start,r?t.startPoint:t.endPoint),o=Oc(i,t,s);if(Cc(i,o)&&kn(t,o))return{point:o};var a=Tc(i,e,n),l=r?t.startPoint.clone():t.endPoint.clone(),h=ga(e,Math.abs(n),r?a:l,r?l:a);return r?{point:a,filletPoints:h,nextSegmentStart:l}:{point:l,filletPoints:h,nextSegmentStart:a}}function Tc(i,t,e){var n=Math.hypot(i.dx,i.dy),r=-i.dy/n*e,s=i.dx/n*e;return new A(t.x+r,t.y+s)}function Cc(i,t){var e=Math.hypot(i.dx,i.dy);if(D.isNonPositive(e))return!1;var n=i.dx/e,r=i.dy/e,s=t.x-i.start.x,o=t.y-i.start.y,a=Math.abs(s*r-o*n);return D.equalToZero(a)}function ga(i,t,e,n){var r=Math.atan2(e.y-i.y,e.x-i.x),s=Math.atan2(n.y-i.y,n.x-i.x),o=kc(r,s);if(D.equalToZero(Math.abs(o)))return[];for(var a=[],l=Math.max(2,Math.ceil(Math.abs(o)/Math.PI*16)),h=1;h<l;h++){var c=h/l,u=r+o*c;a.push(new A(i.x+t*Math.cos(u),i.y+t*Math.sin(u)))}return a}function kc(i,t){for(var e=t-i;e>Math.PI;)e-=R;for(;e<=-Math.PI;)e+=R;return e}function Oc(i,t,e){var n=Math.hypot(i.dx,i.dy);if(D.isNonPositive(n))return e.clone();var r=i.dx/n,s=i.dy/n,o=i.start.x-t.center.x,a=i.start.y-t.center.y,l=2*(o*r+a*s),h=o*o+a*a-t.radius*t.radius,c=l*l-4*h;if(c<0)return e.clone();var u=Math.sqrt(c),g=[(-l-u)/2,(-l+u)/2].map(function(f){return new A(i.start.x+r*f,i.start.y+s*f)}),d=g.filter(function(f){return kn(t,f)});return fa(d.length>0?d:g,e)}function kn(i,t){var e=Math.abs(Math.hypot(t.x-i.center.x,t.y-i.center.y)-i.radius);if(D.isPositive(e))return!1;var n=Yi(i,t),r=i.clockwise?Ri(E.normalizeAngle(i.startAngle)):E.normalizeAngle(i.startAngle),s=i.clockwise?Ri(E.normalizeAngle(i.endAngle)):E.normalizeAngle(i.endAngle);return E.isBetweenAngle(n,r,s,i.clockwise)}function Nc(i,t){var e=t.center.x-i.center.x,n=t.center.y-i.center.y,r=Math.hypot(e,n);if(D.isNonPositive(r))return[];var s=i.radius+t.radius,o=Math.abs(i.radius-t.radius);if(r>s+Pn)return[];if(r<o-Pn)return[];var a=(i.radius*i.radius-t.radius*t.radius+r*r)/(2*r),l=i.radius*i.radius-a*a;if(l<-Pn)return[];var h=i.center.x+a*e/r,c=i.center.y+a*n/r;if(l<=Pn)return[new A(h,c)];var u=Math.sqrt(l),g=-n*u/r,d=e*u/r;return[new A(h+g,c+d),new A(h-g,c-d)]}function fa(i,t){for(var e=i[0],n=e.distanceToSquared(t),r=1;r<i.length;r++){var s=i[r].distanceToSquared(t);s<n&&(e=i[r],n=s)}return e.clone()}function pa(i,t){return new A((i.x+t.x)/2,(i.y+t.y)/2)}function Xc(i){for(var t,e=i.numberOfVertices,n=i.closed?e:e-1,r=0;r<n;r++){var s=i.vertices[r];if(D.isPositive(Math.abs((t=s.bulge)!==null&&t!==void 0?t:0)))return!0}return!1}function ya(i){var t=Yc(i.vertices.map(function(e){return new A(e.x,e.y)}),i.closed);return t.length===i.numberOfVertices?i:new V(t.map(function(e){return{x:e.x,y:e.y}}),i.closed)}function Yc(i,t){var e=ma(i);if(!t||e.length<2)return e;var n=e[0],r=e[e.length-1];return D.isNonPositive(Math.hypot(n.x-r.x,n.y-r.y))&&e.pop(),e}function ma(i){var t=[];return i.forEach(function(e){var n=t[t.length-1];(!n||D.isPositive(Math.hypot(n.x-e.x,n.y-e.y)))&&t.push(new A(e.x,e.y))}),t}function Rc(i,t){for(var e=[],n=0;n<i.numberOfVertices;n++)e.push(i.getPointAt(n));var r=Bc(e,i.closed,t);if(r.length===0)return null;var s=[];if(i.closed){if(r.length<2)return null;for(var o=r.length,n=0;n<o;n++){var a=r[(n-1+o)%o],l=r[n];s.push(Bi(a,l))}}else{s.push(r[0].start);for(var n=1;n<r.length;n++)s.push(Bi(r[n-1],r[n]));s.push(r[r.length-1].end)}var h=new V;return s.forEach(function(c,u){h.addVertexAt(u,{x:c.x,y:c.y})}),h.closed=i.closed,h}function Bc(i,t,e){for(var n=[],r=t?i.length:i.length-1,s=0;s<r;s++){var o=i[s],a=i[t?(s+1)%i.length:s+1],l=a.x-o.x,h=a.y-o.y,c=Math.hypot(l,h);if(!D.isNonPositive(c)){var u=-h/c*e,g=l/c*e;n.push({start:new A(o.x+u,o.y+g),end:new A(a.x+u,a.y+g),dx:l,dy:h})}}return n}function Bi(i,t){var e=i.dx*t.dy-i.dy*t.dx;if(D.equalToZero(e))return new A((i.end.x+t.start.x)/2,(i.end.y+t.start.y)/2);var n=t.start.x-i.start.x,r=t.start.y-i.start.y,s=(n*t.dy-r*t.dx)/e;return new A(i.start.x+s*i.dx,i.start.y+s*i.dy)}var Fc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fi=function(){return Fi=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Fi.apply(this,arguments)},V=function(i){Fc(t,i);function t(e,n){e===void 0&&(e=null),n===void 0&&(n=!1);var r=i.call(this)||this;return r._vertices=e||new Array,r._closed=n,r}return Object.defineProperty(t.prototype,"vertices",{get:function(){return this._vertices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numberOfVertices",{get:function(){return this._vertices.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this._closed=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this.numberOfVertices>0){var e=this._vertices[0];return new A(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this.numberOfVertices;if(e>0)if(this.closed){var n=this._vertices[0];return new A(n.x,n.y)}else{var n=this._vertices[e-1];return new A(n.x,n.y)}throw new Error("End point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){for(var e=0,n=this._vertices.length,r=0;r<n;++r){var s=this._vertices[r],o=null;if(r<n-1?o=this._vertices[r+1]:r==n-1&&this.closed&&(o=this._vertices[0]),o)if(s.bulge){var a=new ht(s,o,s.bulge);e+=a.length}else e+=new A(s.x,s.y).distanceTo(o)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed||this._vertices.length<3)return 0;var e=this.getPoints(128);return hc(e)},enumerable:!1,configurable:!0}),t.prototype.addVertexAt=function(e,n){e<=0?this._vertices.unshift(n):this._vertices.splice(e,0,n),this._boundingBoxNeedsUpdate=!0},t.prototype.removeVertexAt=function(e){if(e<0||e>=this._vertices.length)throw new Error("Index ".concat(e," is out of bounds. Valid range is 0 to ").concat(this._vertices.length-1,"."));this._vertices.splice(e,1),this._boundingBoxNeedsUpdate=!0},t.prototype.reset=function(e,n){e?n!==void 0&&n>=0&&n<this._vertices.length&&(this._vertices=this._vertices.slice(0,n),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)},t.prototype.getPointAt=function(e){var n=this._vertices[e];return new A(n.x,n.y)},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new nt().setFromPoints(e)},t.prototype.transform=function(e){var n=e.determinant()<0;return this._vertices.forEach(function(r){var s=new A(r).applyMatrix2d(e);r.x=s.x,r.y=s.y,n&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._vertices.map(function(e){return Fi({},e)}),this._closed)},t.prototype.getPoints3d=function(e,n){var r=[],s=this.getPoints(e);return s.forEach(function(o){return r.push(new y().set(o.x,o.y,n))}),r},t.prototype.getPoints=function(e){for(var n=[],r=this._vertices.length,s=0;s<r;++s){var o=this._vertices[s];if(o.bulge){var a=null;if(s<r-1?a=this._vertices[s+1]:s==r-1&&this.closed&&(a=this._vertices[0]),a)for(var l=new ht(o,a,o.bulge),h=l.getPoints(e),c=h.length,u=0;u<c;++u){var g=h[u];n.push(new A(g.x,g.y))}}else n.push(new A(o.x,o.y)),s==r-1&&this.closed&&n.push(n[0])}return n},t.prototype.offset=function(e){return da(this,e)},t}(Fe);function _a(i,t,e){var n=Math.hypot(t.x,t.y);if(D.isNonPositive(n))return null;var r=-t.y/n*e,s=t.x/n*e;return new y(i.x+r,i.y+s,i.z)}function zc(i,t,e){var n;if(i.length<2)return null;var r=fc(new V(i.map(function(o){return{x:o.x,y:o.y}}),t)),s=da(r,e);return(n=s[0])!==null&&n!==void 0?n:null}var On=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Te=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))};function Vc(i,t,e,n){if(i.length<2||D.equalToZero(e))return null;var r=xa(i,n),s=r.points,o=r.tangents;if(s.length<2)return null;var a=o??jc(s,t),l=Dc(s,a,e),h=t?Hc(l):Gc(l);if(h.length<2)return null;var c=new V;return h.forEach(function(u,g){c.addVertexAt(g,{x:u.x,y:u.y})}),c.closed=t,c}function jc(i,t){for(var e=i.length,n=new Array(e),r=0;r<e;r++){var s=0,o=0;if(t){var a=i[(r-1+e)%e],l=i[(r+1)%e];s=l.x-a.x,o=l.y-a.y}else r===0?(s=i[1].x-i[0].x,o=i[1].y-i[0].y):r===e-1?(s=i[e-1].x-i[e-2].x,o=i[e-1].y-i[e-2].y):(s=i[r+1].x-i[r-1].x,o=i[r+1].y-i[r-1].y);var h=Math.hypot(s,o);D.isNonPositive(h)?n[r]=new A(1,0):n[r]=new A(s/h,o/h)}return n}function Dc(i,t,e){return i.map(function(n,r){var s=t[r],o=-s.y*e,a=s.x*e;return new A(n.x+o,n.y+a)})}function Gc(i){var t=Nn(i);if(t.length<3)return t;for(;;){var e=ba(t,!1);if(!e||(t=Nn(Te(Te(Te([],On(t.slice(0,e.segmentA+1)),!1),[e.point],!1),On(t.slice(e.segmentB+1)),!1)),t.length<2))break}return t}function Hc(i){var t=Nn(i);if(t.length<4)return t;for(;;){var e=ba(t,!0);if(!e||(t=Nn(Te(Te(Te([],On(t.slice(0,e.segmentA+1)),!1),[e.point],!1),On(t.slice(e.segmentB+1)),!1)),t.length<3))break}return t}function ba(i,t){var e=t?i.length:i.length-1;if(e<2)return null;for(var n=0;n<e;n++)for(var r=i[n],s=i[(n+1)%i.length],o=n+1;o<e;o++)if(!Wc(n,o,e,t)){var a=i[o],l=i[(o+1)%i.length],h=Uc(r,s,a,l);if(h)return{point:h,segmentA:n,segmentB:o}}return null}function Wc(i,t,e,n){return!!(t===i||t===i+1||n&&i===0&&t===e-1)}function Uc(i,t,e,n){var r=t.x-i.x,s=t.y-i.y,o=n.x-e.x,a=n.y-e.y,l=r*a-s*o;if(D.equalToZero(l))return null;var h=e.x-i.x,c=e.y-i.y,u=(h*a-c*o)/l,g=(h*s-c*r)/l,d=ti.equalPointTol;return u<-d||u>1+d||g<-d||g>1+d?null:new A(i.x+u*r,i.y+u*s)}function xa(i,t){var e=[],n=[],r=t!=null&&t.length===i.length;return i.forEach(function(s,o){var a=e[e.length-1];if((!a||D.isPositive(Math.hypot(a.x-s.x,a.y-s.y)))&&(e.push(new A(s.x,s.y)),r)){var l=t[o];n.push(new A(l.x,l.y))}}),{points:e,tangents:r?n:void 0}}function Nn(i){return xa(i).points}var $c=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),kt=function(i){$c(t,i);function t(){var e=i.call(this)||this;return e._loops=[],e}return t.prototype.add=function(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"loops",{get:function(){return this._loops},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outter",{get:function(){if(this._loops.length>0)return this._loops[0]},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.outter;return e?e.box:new nt},t.prototype.transform=function(e){return this._loops.forEach(function(n){n.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){var e=new t;return this._loops.forEach(function(n){e.add(n.clone())}),e},t.prototype.getPoints=function(e){for(var n=[],r=0;r<this.loops.length;++r){var s=this.loops[r],o=s.getPoints(e);n.push(o)}return n},t.prototype.buildHierarchy=function(){for(var e,n=this.getPoints(100),r=this.calculateBoundaryBoxes(n),s=this.sortBoundaryBoxesByAreas(r),o=new Map,a=s.length,l=0;l<a;l++)o.set(s[l],{index:s[l],children:[]});for(var h={index:-1,children:[]},l=0;l<a;l++){for(var c=s[l],u=n[c],g=r[c],d=l+1;d<a;d++){var f=s[d],p=n[f],m=r[f];if(m.containsBox(g)&&st.isPointInPolygon(u[E.randInt(0,u.length-1)],p)){(e=o.get(f))===null||e===void 0||e.children.push(o.get(c));break}}d===a&&h.children.push(o.get(c))}return h},Object.defineProperty(t.prototype,"area",{get:function(){if(this._loops.length===0)return 0;for(var e=0,n=0;n<this._loops.length;n++){var r=this._loops[n],s=r.getPoints(128),o=ha(s);n===0?e+=Math.abs(o):e-=Math.abs(o)}return e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundaryBoxes=function(e){var n=[];return e.forEach(function(r){n.push(new nt().setFromPoints(r))}),n},t.prototype.sortBoundaryBoxesByAreas=function(e){var n=[];e.forEach(function(s,o){var a=s.size,l=a.width*a.height;n.push({area:l,index:o})}),n.sort(function(s,o){return s.area-o.area});var r=[];return n.forEach(function(s){r.push(s.index)}),r},t}(Gr),qc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Kc=function(i){qc(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new C().makeTranslation(e.x,e.y,e.z))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t}(ua),Zc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),gn=function(i){Zc(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t}(Kc),Qc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ft=function(i){Qc(t,i);function t(e,n){var r=i.call(this)||this;return r._start=new y(e),r._end=new y(n),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return new b().subVectors(this.endPoint,this.startPoint).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){return new y((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){return this.project(e)},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.isPointOnLine=function(e){var n=this.project(e),r=1e-6;return n.distanceTo(e)<r},t.prototype.at=function(e,n){return this.delta(n).multiplyScalar(e).add(this._start)},t.prototype.atLength=function(e,n){if(n===void 0&&(n=!1),n){var r=this.delta(ie).normalize();return new y(this._start).addScaledVector(r,e)}else{var r=this.delta(ie).normalize();return new y(this._end).addScaledVector(r,e)}},t.prototype.extend=function(e,n){if(n===void 0&&(n=!1),n){var r=ie.subVectors(this._start,this._end).normalize();this._start=new y(this._start).addScaledVector(r,e)}else{var r=this.delta(ie).normalize();this._end=new y(this._end).addScaledVector(r,e)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.closestPointToPointParameter=function(e,n){Js.subVectors(e,this._start),An.subVectors(this.endPoint,this.startPoint);var r=An.dot(An),s=An.dot(Js),o=s/r;return n&&(o=E.clamp(o,0,1)),o},t.prototype.closestPointToPoint=function(e,n,r){var s=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(s).add(this._start)},t.prototype.delta=function(e){return e.subVectors(this._end,this._start)},t.prototype.distanceSq=function(){return this._start.distanceToSquared(this._end)},t.prototype.distance=function(){return this._start.distanceTo(this._end)},t.prototype.project=function(e){var n=this.direction,r=ie.subVectors(e,this.startPoint),s=r.dot(n);return new y().copy(n).multiplyScalar(s).add(this.startPoint)},t.prototype.perpPoint=function(e){var n=this.direction,r=this.startPoint,s=ie.subVectors(e,r),o=s.dot(n),a=ie.copy(n).multiplyScalar(o);return new y().addVectors(r,a)},t.prototype.calculateBoundingBox=function(){var e=new y(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),n=new y(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new k(e,n)},t.prototype.transform=function(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.offset=function(e){var n=this.startPoint,r=this.endPoint,s=Math.hypot(r.x-n.x,r.y-n.y);if(s===0)return this.clone();var o=new b(r.x-n.x,r.y-n.y,0).normalize(),a=new b(-o.y,o.x,0);return new t(new y(n.x+a.x*e,n.y+a.y*e,n.z),new y(r.x+a.x*e,r.y+a.y*e,r.z))},t}(gn),ie=new b,Js=new b,An=new b,Jc=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),pi=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},It=function(i){Jc(t,i);function t(e,n,r,s,o,a){a===void 0&&(a=b.X_AXIS);var l=i.call(this)||this;return l.center=e,l.radius=n,l.startAngle=r,l.endAngle=s,l.normal=o,l.refVec=a,(s-r)%R==0?(l.startAngle=0,l.endAngle=R):(l.startAngle=r,l.endAngle=s),l}return t.computeCenterPoint=function(e,n,r){var s=new b().addVectors(e,n).multiplyScalar(.5),o=new b().addVectors(e,r).multiplyScalar(.5),a=new b().subVectors(n,e),l=new b().subVectors(r,e),h=new b().crossVectors(a,l).normalize();if(h.lengthSq()===0)return null;var c=new b().crossVectors(a,h).normalize(),u=new b().crossVectors(l,h).normalize(),g=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=u.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),f=new Ft(s,s.clone().add(g)),p=new Ft(o,o.clone().add(d)),m=new b,_=f.closestPointToPoint(p.startPoint,!0,m);return _?m:null},t.createByThreePoints=function(e,n,r){var s=t.computeCenterPoint(e,n,r);if(s){var o=s.distanceTo(e),a=new b().subVectors(e,s),l=new b().subVectors(n,s),h=Math.atan2(a.y,a.x),c=Math.atan2(l.y,l.x);return new t(s,o,h,c,b.Z_AXIS)}},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new y(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){if(e<0)throw ut.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==R?e:E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return E.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new b(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refVec",{get:function(){return this._refVec},set:function(e){this._refVec=new b(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,n=this.deltaAngle;this.closed&&(e=0,n=R);var r=e+n*.5;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:0},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){var n=new b(e.x,e.y,e.z||0),r=this.center,s=this.normal,o=n.clone().sub(r),a=o.dot(s),l=n.clone().sub(s.clone().multiplyScalar(a)),h=l.clone().sub(r);if(h.lengthSq()===0)return this.startPoint.clone();h.normalize().multiplyScalar(this.radius);var c=r.clone().add(h),u=this.getAngle(c.clone()),g=this.startAngle,d=this.deltaAngle,f=E.normalizeAngle(u-g);f<0&&(f=0),f>d&&(f=d);var p=this.getPointAtAngle(g+f),m=p.distanceTo(n),_=this.startPoint.distanceTo(n),v=this.endPoint.distanceTo(n);return _<m&&_<=v?this.startPoint.clone():v<m&&v<_?this.endPoint.clone():p},t.prototype.tangentPoints=function(e){var n,r,s=[],o=new b(e.x,e.y,e.z||0),a=this.center,l=this.normal,h=this.radius,c=o.clone().sub(a),u=c.dot(l),g=o.clone().sub(l.clone().multiplyScalar(u)),d=a.clone(),f=g.clone().sub(d),p=f.length();if(p<h)return s;var m=Math.acos(h/p),_=this.getAngle(g.clone()),v=[_+m,_-m];try{for(var P=pi(v),S=P.next();!S.done;S=P.next()){var L=S.value,T=E.normalizeAngle(L-this.startAngle);T>=0&&T<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+T))}}catch(I){n={error:I}}finally{try{S&&!S.done&&(r=P.return)&&r.call(P)}finally{if(n)throw n.error}}return s},t.prototype.perpendicularPoints=function(e){var n,r,s=[],o=new b(e.x,e.y,e.z||0),a=this.center,l=this.normal,h=this.radius,c=o.clone().sub(a),u=c.dot(l),g=o.clone().sub(l.clone().multiplyScalar(u)),d=g.clone().sub(a);if(d.lengthSq()<1e-24)return s;d.normalize();var f=[a.clone().add(d.clone().multiplyScalar(h)),a.clone().sub(d.clone().multiplyScalar(h))];try{for(var p=pi(f),m=p.next();!m.done;m=p.next()){var _=m.value,v=this.getAngle(_.clone()),P=E.normalizeAngle(v-this.startAngle);P>=0&&P<=this.deltaAngle&&s.push(new y(_.x,_.y,_.z||0))}}catch(S){n={error:S}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return s},t.prototype.nearestTangentPoint=function(e){var n=this.tangentPoints(e);if(n.length===0)return null;var r=new y(e.x,e.y,e.z||0);return n.length===1||n[0].distanceTo(r)<n[1].distanceTo(r)?n[0]:n[1]},t.prototype.calculateBoundingBox=function(){for(var e,n,r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)E.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,h=-1/0,c=-1/0,u=-1/0;try{for(var g=pi(r),d=g.next();!d.done;d=g.next()){var f=d.value,p=this.getPointAtAngle(f);p.x<o&&(o=p.x),p.y<a&&(a=p.y),p.z<l&&(l=p.z),p.x>h&&(h=p.x),p.y>c&&(c=p.y),p.z>u&&(u=p.z)}}catch(m){e={error:m}}finally{try{d&&!d.done&&(n=g.return)&&n.call(g)}finally{if(e)throw e.error}}return new k({x:o,y:a,z:l},{x:h,y:c,z:u})},Object.defineProperty(t.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var n=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=R,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);n.push(l)}return n},t.prototype.transform=function(e){var n=this.center.clone().applyMatrix4(e),r=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new b(r).sub(n).normalize(),l=n.distanceTo(r),h=new b().crossVectors(new b(r).sub(n),new b(o).sub(n)).normalize();h.lengthSq()===0&&(h=this.normal.clone().transformDirection(e));var c=function(u){var g=new b(u).sub(n);return Math.atan2(g.dot(to.crossVectors(h,a)),g.dot(a))};return this.center=n,this.radius=l,this.normal=h,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?R:c(s),this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},t.prototype.getAngle=function(e){return e.sub(this.center),Math.atan2(e.dot(to.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))},t.prototype.getPointAtAngle=function(e){var n=this.normal,r=this.refVec,s={x:n.y*r.z-n.z*r.y,y:n.z*r.x-n.x*r.z,z:n.x*r.y-n.y*r.x},o=this.center,a=this.radius;return new y(o.x+a*(r.x*Math.cos(e)+s.x*Math.sin(e)),o.y+a*(r.y*Math.cos(e)+s.y*Math.sin(e)),o.z+a*(r.z*Math.cos(e)+s.z*Math.sin(e)))},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new b(this.center).distanceTo(Vr);return new jr(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var n=this.radius+e;return n<=0?null:new t(this.center,n,this.startAngle,this.endAngle,this.normal,this.refVec)},t}(gn),to=new b,tu=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),le=function(i){tu(t,i);function t(e,n,r,s,o,a,l){s===void 0&&(s=0),o===void 0&&(o=R),a===void 0&&(a=!1),l===void 0&&(l=0);var h=i.call(this)||this;return h.center=e,h.majorAxisRadius=n,h.minorAxisRadius=r,(o-s)%R==0?(h.startAngle=0,h.endAngle=R):(h.startAngle=s,h.endAngle=o),h.clockwise=a,h.rotation=l,h}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new y(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw ut.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw ut.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==R?e:E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return E.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){for(var e=100,n=1/0,r=1/0,s=-1/0,o=-1/0,a=0;a<=e;a++){var l=this.getPoint(a/e);n=Math.min(n,l.x),r=Math.min(r,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y)}return new nt({x:n,y:r},{x:s,y:o})},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){for(var n=Math.PI*2,r=this.endAngle-this.startAngle,s=Math.abs(r)<Number.EPSILON;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise===!0&&!s&&(r===n?r=-n:r=r-n);var o=this.startAngle+e*r,a=this.center.x+this.majorAxisRadius*Math.cos(o),l=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,g=l-this.center.y;a=u*h-g*c+this.center.x,l=u*c+g*h+this.center.y}return new A(a,l)},t.prototype.transform=function(e){var n=e,r=new A(this.center).applyMatrix2d(n),s=new y(r.x,r.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(n),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(n),l=new A(o).sub(r),h=new A(a).sub(r),c=l.length(),u=h.length(),g=Math.atan2(l.y,l.x),d=l.clone().normalize(),f=h.clone().normalize(),p=function(v){var P=new A(v).sub(r),S=P.dot(d),L=P.dot(f);return E.normalizeAngle(Math.atan2(L/u,S/c))},m=n.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new t(s,c,u,0,R,m,g):new t(s,c,u,p(this.startPoint.clone().applyMatrix2d(n)),p(this.endPoint.clone().applyMatrix2d(n)),m,g);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this},t.prototype.getPointAtAngle=function(e){return this.getPoint(this.closed?e/R:E.normalizeAngle(e-this.startAngle)/this.deltaAngle)},t.prototype.copy=function(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this},t.prototype.clone=function(){return new t(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},t.prototype.getFocusPoints=function(){var e=Math.max(this.majorAxisRadius,this.minorAxisRadius),n=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(e-n<1e-9)return[];var r=Math.sqrt(e*e-n*n),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,l=a?s:-o,h=a?o:s;return[new A(this.center.x-r*l,this.center.y-r*h),new A(this.center.x+r*l,this.center.y+r*h)]},t.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},t.prototype.nearestPoint=function(e){for(var n=new A(e.x,e.y),r=this.getPoint(0),s=n.distanceToSquared(r),o=72,a=1;a<=o;a++){var l=this.getPoint(a/o),h=n.distanceToSquared(l);h<s&&(s=h,r=l)}return r},t.prototype.tangentPoints=function(e){var n=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,h){var c=-n.majorAxisRadius*h,u=n.minorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var n=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,h){var c=n.minorAxisRadius*l,u=n.majorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype._projectPointToLocal=function(e){var n=e.x-this.center.x,r=e.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:n*s-r*o,y:n*o+r*s}},t.prototype._findSnapAngles=function(e,n,r){r===void 0&&(r=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,l=this.deltaAngle,h=[],c=function(S){var L=Math.cos(S),T=Math.sin(S);return n(s*L,o*T,L,T)},u=a,g=c(u),d=1;d<=r;d++){var f=a+l*d/r,p=c(f);if(Math.abs(g)<1e-10&&h.push(u),g*p<0){for(var m=u,_=f,v=0;v<32;v++){var P=(m+_)/2;c(m)*c(P)<=0?_=P:m=P}h.push((m+_)/2)}u=f,g=p}return h},t}(Fe),eu=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),nu=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Hr=function(i){eu(t,i);function t(e,n,r,s,o,a,l){a===void 0&&(a=0),l===void 0&&(l=R);var h=i.call(this)||this;h.center=e,h.normal=n,h.majorAxis=r,h.majorAxisRadius=s,h.minorAxisRadius=o;var c=Math.abs(l-a);return Math.abs(c-R)<1e-10||Math.abs(c-2*R)<1e-10?(h.startAngle=0,h.endAngle=R):(h.startAngle=a,h.endAngle=l),h}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new y(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw ut.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw ut.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==R?e:E.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this.endAngle-this.startAngle;return Math.abs(e-R)<1e-10?R:E.normalizeAngle(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new b(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(e){this._majorAxis=new b(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxis",{get:function(){return new b().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,n=this.deltaAngle;(this.closed||Math.abs(n-R)<1e-10)&&(e=0,n=R);var r=e+n/2;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCircular",{get:function(){return D.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var e=1e3,n=this.deltaAngle/e,r=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=e;o++){var a=this.startAngle+o*n,l=this.getPointAtAngle(a),h=l.x-s.x,c=l.y-s.y,u=l.z-s.z;r+=Math.sqrt(h*h+c*c+u*u),s=l}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return Math.abs(this.deltaAngle-R)>=1e-10?0:Math.PI*this.majorAxisRadius*this.minorAxisRadius},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,n;if(this.majorAxis.equals(b.X_AXIS)||this.majorAxis.equals(b.Y_AXIS)||this.majorAxis.isParallelTo(b.X_AXIS)||this.majorAxis.isParallelTo(b.Y_AXIS)){for(var r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)E.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,h=-1/0,c=-1/0,u=-1/0;try{for(var g=nu(r),d=g.next();!d.done;d=g.next()){var f=d.value,p=this.getPointAtAngle(f);p.x<o&&(o=p.x),p.y<a&&(a=p.y),p.z<l&&(l=p.z),p.x>h&&(h=p.x),p.y>c&&(c=p.y),p.z>u&&(u=p.z)}}catch(_){e={error:_}}finally{try{d&&!d.done&&(n=g.return)&&n.call(g)}finally{if(e)throw e.error}}return new k({x:o,y:a,z:l},{x:h,y:c,z:u})}else{for(var m=100,o=1/0,a=1/0,l=1/0,h=-1/0,c=-1/0,u=-1/0,s=0;s<=m;s++){var f=this.startAngle+this.deltaAngle*(s/m),p=this.getPointAtAngle(f);o=Math.min(o,p.x),a=Math.min(a,p.y),l=Math.min(l,p.z),h=Math.max(h,p.x),c=Math.max(c,p.y),u=Math.max(u,p.z)}return new k({x:o,y:a,z:l},{x:h,y:c,z:u})}},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){e===void 0&&(e=100);var n=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=R,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);n.push(l)}return n},t.prototype.getPointAtAngle=function(e){var n=Math.cos(e),r=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(r),o=this.majorAxis.clone().multiplyScalar(n*this.majorAxisRadius).add(s);return new y(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},t.prototype.nearestPoint=function(e,n){n===void 0&&(n=72);for(var r=new y(e.x,e.y,e.z||0),s=this.getPointAtAngle(this.startAngle),o=r.distanceToSquared(s),a=1;a<=n;a++){var l=this.startAngle+this.deltaAngle*a/n,h=this.getPointAtAngle(l),c=r.distanceToSquared(h);c<o&&(o=c,s=h)}var u=r.distanceToSquared(this.startPoint),g=r.distanceToSquared(this.endPoint);return u<o&&u<=g?this.startPoint.clone():g<o&&g<u?this.endPoint.clone():s.clone()},t.prototype.tangentPoints=function(e){var n=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,h){var c=-n.majorAxisRadius*h,u=n.minorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var n=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,h){var c=n.minorAxisRadius*l,u=n.majorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype._projectPointToLocalPlane=function(e){var n=new y(e.x,e.y,e.z||0),r=new b(n).sub(this.center),s=r.dot(this.normal);return r.sub(this.normal.clone().multiplyScalar(s)),{x:r.dot(this.majorAxis),y:r.dot(this.minorAxis)}},t.prototype._findSnapParameterAngles=function(e,n){n===void 0&&(n=144);for(var r=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,l=[],h=function(P){var S=Math.cos(P),L=Math.sin(P);return e(r*S,s*L,S,L)},c=o,u=h(c),g=1;g<=n;g++){var d=o+a*g/n,f=h(d);if(Math.abs(u)<1e-10&&l.push(c),u*f<0){for(var p=c,m=d,_=0;_<32;_++){var v=(p+m)/2;h(p)*h(v)<=0?m=v:p=v}l.push((p+m)/2)}c=d,u=f}return l},t.prototype.contains=function(e){var n=new b(e).sub(this.center),r=n.dot(this.majorAxis),s=n.dot(this.minorAxis),o=r/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},t.prototype.transform=function(e){var n=e,r=this.center.clone().applyMatrix4(n),s=this.getPointAtAngle(0).clone().applyMatrix4(n),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(n),a=new b(s).sub(r),l=new b(o).sub(r),h=a.length(),c=l.length(),u=a.clone().normalize(),g=new b().crossVectors(a,l).normalize(),d=new b().crossVectors(g,u).normalize();d.dot(l)<0&&(g.negate(),d=new b().crossVectors(g,u).normalize());var f=function(m){var _=new b(m).sub(r),v=_.dot(u),P=_.dot(d);return E.normalizeAngle(Math.atan2(P/c,v/h))},p=this.closed?new t(r,g,u,h,c,0,R):new t(r,g,u,h,c,f(this.startPoint.clone().applyMatrix4(n)),f(this.endPoint.clone().applyMatrix4(n)));return this.center=p.center,this.normal=p.normal,this.majorAxis=p.majorAxis,this.majorAxisRadius=p.majorAxisRadius,this.minorAxisRadius=p.minorAxisRadius,this._startAngle=p._startAngle,this._endAngle=p._endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new b(this.center).distanceTo(Vr);return new jr(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var n=this.majorAxisRadius+e,r=this.minorAxisRadius+e;return n<=0||r<=0?null:new t(this.center,this.normal,this.majorAxis,n,r,this.startAngle,this.endAngle)},t}(gn),iu=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Mt=function(i){iu(t,i);function t(e,n){var r=i.call(this)||this;return r._start=new A(e),r._end=new A(n),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=new A(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),n=new A(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new nt(e,n)},t.prototype.transform=function(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.project=function(e){var n=this._end.x-this._start.x,r=this._end.y-this._start.y,s=n*n+r*r;if(s<1e-18)return this._start.clone();var o=((e.x-this._start.x)*n+(e.y-this._start.y)*r)/s;return o=Math.max(0,Math.min(1,o)),new A(this._start.x+o*n,this._start.y+o*r)},t.prototype.nearestPoint=function(e){return this.project(e)},t}(Fe),ru=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),yi=function(){function i(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return i.prototype.init=function(t,e,n,r){this.c0=t,this.c1=n,this.c2=-3*t+3*e-2*n-r,this.c3=2*t-2*e+n+r},i.prototype.initCatmullRom=function(t,e,n,r,s){this.init(e,n,s*(n-t),s*(r-e))},i.prototype.initNonuniformCatmullRom=function(t,e,n,r,s,o,a){var l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,h=(n-e)/o-(r-e)/(o+a)+(r-n)/a;l*=o,h*=o,this.init(e,n,l,h)},i.prototype.calc=function(t){var e=t*t,n=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*n},i}(),wa=function(i){ru(t,i);function t(e,n,r,s){e===void 0&&(e=[]),n===void 0&&(n=!1),r===void 0&&(r="centripetal"),s===void 0&&(s=.5);var o=i.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new b,o._px=new yi,o._py=new yi,o._pz=new yi,o._points=e.map(function(a){return new y(a)}),o._closed=n,o._curveType=r,o._tension=s,o}return Object.defineProperty(t.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var e=0,n=1;n<this._points.length;n++)e+=this._points[n-1].distanceTo(this._points[n]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e,n){n===void 0&&(n=new y);var r=n,s=this._points,o=s.length;if(o===0)return r.set(0,0,0);if(o===1)return r.copy(s[0]);var a=(o-(this._closed?0:1))*e,l=Math.floor(a),h=a-l;this._closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:h===0&&l===o-1&&(l=o-2,h=1);var c,u;this._closed||l>0?c=s[(l-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),c=new y(this._tmp.x,this._tmp.y,this._tmp.z));var g=s[l%o],d=s[(l+1)%o];if(this._closed||l+2<o?u=s[(l+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),u=new y(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var f=this._curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(g),f),m=Math.pow(g.distanceToSquared(d),f),_=Math.pow(d.distanceToSquared(u),f);m<1e-4&&(m=1),p<1e-4&&(p=m),_<1e-4&&(_=m),this._px.initNonuniformCatmullRom(c.x,g.x,d.x,u.x,p,m,_),this._py.initNonuniformCatmullRom(c.y,g.y,d.y,u.y,p,m,_),this._pz.initNonuniformCatmullRom(c.z,g.z,d.z,u.z,p,m,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,g.x,d.x,u.x,this._tension),this._py.initCatmullRom(c.y,g.y,d.y,u.y,this._tension),this._pz.initCatmullRom(c.z,g.z,d.z,u.z,this._tension));return r.set(this._px.calc(h),this._py.calc(h),this._pz.calc(h)),r},t.prototype.getPoints=function(e){for(var n=[],r=0;r<=e;r++)n.push(this.getPoint(r/e));return n},t.prototype.setPoints=function(e){this._points=e.map(function(n){return new y(n)}),this._boundingBoxNeedsUpdate=!0},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)},t.prototype.setCurveType=function(e){this._curveType=e},t.prototype.setTension=function(e){this._tension=e},t.prototype.clone=function(){return new t(this._points.map(function(e){return e.clone()}),this._closed,this._curveType,this._tension)},t.prototype.transform=function(e){return this._points=this._points.map(function(n){var r=new y;return r.copy(n),r.applyMatrix4(e),r}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new k;var e=new k;return this._points.forEach(function(n){e.expandByPoint(n)}),e},t}(gn),Pe=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Ae=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))};function eo(i,t){var e,n,r=i.x-t[0],s=i.y-t[1],o=((e=i.z)!==null&&e!==void 0?e:0)-((n=t[2])!==null&&n!==void 0?n:0);return r*r+s*s+o*o}var pt=function(){function i(t,e,n,r){this._degree=t,this._knots=Ae([],Pe(e),!1),this._controlPoints=n.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=r?Ae([],Pe(r),!1):new Array(n.length).fill(1)}return i.prototype.degree=function(){return this._degree},i.prototype.knots=function(){return Ae([],Pe(this._knots),!1)},i.prototype.controlPoints=function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z}})},i.prototype.weights=function(){return Ae([],Pe(this._weights),!1)},i.prototype.clone=function(){return new i(this._degree,this._knots,this._controlPoints,this._weights)},i.prototype.point=function(t){return this.evaluate(t).point},i.prototype.evaluate=function(t){var e=this._controlPoints.map(function(n){return[n.x,n.y,n.z]});return nc(t,this._degree,this._knots,e,this._weights)},i.prototype.signedPlanarCurvatureAt=function(t){var e=this.evaluate(t);return ic(e.deriv1,e.deriv2)},i.prototype.getOffsetSamplePath2d=function(t,e){var n=this;e===void 0&&(e=512);for(var r=Math.abs(t),s=this.getParameterRange(),o=s.start,a=s.end,l=this.length(),h=Math.max(64,Math.ceil(l/Math.max(r*.2,1e-6))),c=su(o,a,Math.min(h,e)),u=0;u<8&&c.length<e;u++){for(var g=[],d=0;d<c.length-1;d++){var f=c[d],p=c[d+1],m=(f+p)/2,_=Math.max(Math.abs(this.signedPlanarCurvatureAt(f)),Math.abs(this.signedPlanarCurvatureAt(p)),Math.abs(this.signedPlanarCurvatureAt(m)));r*_>.85&&g.push(m)}if(g.length===0)break;if(c=ou(c,g),c.length>e){c=c.slice(0,e);break}}var v=[],P=[];return c.forEach(function(S){var L=n.evaluate(S);v.push(new A(L.point[0],L.point[1]));var T=L.deriv1[0],I=L.deriv1[1],X=Math.hypot(T,I);P.push(X>1e-10?new A(T/X,I/X):new A(1,0))}),{points:v,tangents:P}},i.prototype.length=function(){var t=this._controlPoints.map(function(e){return[e.x,e.y,e.z]});return aa(this._degree,this._knots,t,this._weights)},i.byKnotsControlPointsWeights=function(t,e,n,r){return new i(t,e,n,r)},i.byPoints=function(t,e,n,r,s){n===void 0&&(n="Uniform");var o=Dr(t,e,n,r,s),a=o.controlPoints.map(function(l){return{x:l[0],y:l[1],z:l[2]}});return new i(e,o.knots,a,o.weights)},i.prototype.getParameterRange=function(){var t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}},i.prototype.getPoints=function(t){for(var e=[],n=this.getParameterRange(),r=n.start,s=n.end,o=0;o<=t;o++){var a=r+(s-r)*(o/t);e.push(this.point(a))}return e},i.prototype.isClosed=function(t){t===void 0&&(t=1e-6);var e=this.getParameterRange(),n=e.start,r=e.end,s=this.point(n),o=this.point(r),a=s[0]-o[0],l=s[1]-o[1],h=s[2]-o[2];return Math.sqrt(a*a+l*l+h*h)<t},i.createFitPointsForClosedCurve=function(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var e=new wa(t,!0,"centripetal"),n=Math.max(50,t.length*2);return e.getPoints(n)},i.prototype.nearestPoint=function(t,e){var n;e===void 0&&(e=64);for(var r=this.getParameterRange(),s=r.start,o=r.end,a=this.point(s),l=eo(t,a),h=0;h<=e;h++){var c=s+(o-s)*h/e,u=this.point(c),g=eo(t,u);g<l&&(l=g,a=u)}return{x:a[0],y:a[1],z:(n=a[2])!==null&&n!==void 0?n:0}},i.createClosedCurve=function(t,e,n){n===void 0&&(n="Chord");var r=this.createFitPointsForClosedCurve(t),s=r.map(function(o){return[o.x,o.y,o.z]});return i.byPoints(s,e,n)},i}();function su(i,t,e){if(e<2)return[i,t];for(var n=[],r=0;r<e;r++)n.push(r===e-1?t:i+(t-i)*r/(e-1));return n}function ou(i,t){var e=Ae(Ae([],Pe(i),!1),Pe(t),!1).sort(function(r,s){return r-s}),n=[];return e.forEach(function(r){var s=n[n.length-1];(s===void 0||Math.abs(s-r)>1e-10)&&n.push(r)}),n}function no(i){var t,e,n;if(!i)return!1;var r=(t=i.x)!==null&&t!==void 0?t:0,s=(e=i.y)!==null&&e!==void 0?e:0,o=(n=i.z)!==null&&n!==void 0?n:0;return r*r+s*s+o*o>1e-20}function au(i,t,e){var n=i??0;return n<1&&e>0&&t>0&&(n=e-t-1),n<1&&(n=3),n=Math.min(n,t-1),Math.max(1,n)}function lu(i,t,e){var n=i??0;n<1&&(n=3);var r=t+e-1;return n=Math.min(n,r),Math.max(1,n)}function hu(i,t){if(!(!i||i.length!==t))return i}var cu=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),io=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},ro=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},so=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Tt=function(i){cu(t,i);function t(e,n,r,s,o,a){var l=i.call(this)||this,h=arguments.length;if(l._degree=3,l._closed=!1,Array.isArray(n)){if(h<2||h>5)throw ut.ILLEGAL_PARAMETERS;l._controlPoints=e;var d=void 0,f=3,p=!1;if(h>=3&&(Array.isArray(r)?(d=r,h>=4&&(f=s||3),h>=5&&(p=o)):r!==void 0&&(f=r||3,h>=4&&(p=s))),r===void 0&&h>=4&&(f=s||3,h>=5&&(p=o)),l._degree=f,l._closed=p,l._controlPoints.length<l._degree+1)throw ut.ILLEGAL_PARAMETERS;l._nurbsCurve=pt.byKnotsControlPointsWeights(l._degree,n,l._controlPoints,d)}else{if(h<2||h>6)throw ut.ILLEGAL_PARAMETERS;l._fitPoints=e,l._knotParameterization=n,h>=3&&(l._degree=r||3);var c=typeof s=="boolean";h>=4&&c&&(l._closed=s),c?(h>=5&&(l._startTangent=o),h>=6&&(l._endTangent=a)):(h>=4&&(l._startTangent=s),h>=5&&(l._endTangent=o)),l._closed&&(l._startTangent=void 0,l._endTangent=void 0);var u=(l._startTangent?1:0)+(l._endTangent?1:0);if(l._fitPoints.length+u<l._degree+1)throw ut.ILLEGAL_PARAMETERS;if(l._closed)l._nurbsCurve=pt.createClosedCurve(l._fitPoints,l._degree,l._knotParameterization);else{var g=l.toNurbsPoints(l._fitPoints);l._nurbsCurve=pt.byPoints(g,l._degree,l._knotParameterization,l._startTangent?l.toNurbsPoint(l._startTangent):void 0,l._endTangent?l.toNurbsPoint(l._endTangent):void 0)}l._controlPoints=l.toGePoints(l._nurbsCurve.controlPoints().map(function(m){return[m.x,m.y,m.z||0]}))}return l}return t.prototype.buildCurve=function(){if(this._fitPoints&&this._knotParameterization){if(this._closed){var e=pt.createFitPointsForClosedCurve(this._fitPoints),n=this.toNurbsPoints(e);this._nurbsCurve=pt.byPoints(n,this._degree,this._knotParameterization)}else{var n=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=pt.byPoints(n,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(o){return[o.x,o.y,o.z||0]}))}else if(this._controlPoints)if(this._closed){var e=pt.createFitPointsForClosedCurve(this._controlPoints),n=this.toNurbsPoints(e);this._nurbsCurve=pt.byPoints(n,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(l){return[l.x,l.y,l.z||0]}))}else{var r=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=pt.byKnotsControlPointsWeights(this._degree,r,this._controlPoints,s)}},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())},Object.defineProperty(t.prototype,"degree",{get:function(){return this._degree},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knotParameterization",{get:function(){return this._knotParameterization},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlPoints",{get:function(){return this._controlPoints.map(st.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fitPoints",{get:function(){var e;return(e=this._fitPoints)===null||e===void 0?void 0:e.map(st.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knots",{get:function(){return ro([],io(this._nurbsCurve.knots()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return ro([],io(this._nurbsCurve.weights()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){var e=this._nurbsCurve.knots(),n=this._nurbsCurve.degree(),r=e[n],s=this._nurbsCurve.point(r);return new y(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this._nurbsCurve.knots(),n=this._nurbsCurve.degree(),r=e[e.length-n-1],s=this._nurbsCurve.point(r);return new y(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._nurbsCurve.length()},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e,n){n===void 0&&(n=64);var r=this._nurbsCurve.nearestPoint(e,n);return new y(r.x,r.y,r.z||0)},t.prototype.evaluateAt=function(e){var n=this._nurbsCurve.point(e);return new y(n[0],n[1],n[2])},t.prototype.getFitPointAt=function(e){if(!this._fitPoints)throw new Error("No fit points in this spline");var n=this._fitPoints.length,r=e<0||e>=n?n-1:e,s=this._fitPoints[r];return st.point2dToPoint3d(s)},t.prototype.getControlPointAt=function(e){var n=this._controlPoints.length,r=e<0||e>=n?n-1:e;return this._controlPoints[r]},Object.defineProperty(t.prototype,"isFitPointSpline",{get:function(){return!!(this._fitPoints&&this._fitPoints.length>0&&this._knotParameterization)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isControlPointSpline",{get:function(){return!this.isFitPointSpline},enumerable:!1,configurable:!0}),t.prototype.getGripPoints=function(){return this.isFitPointSpline?this._fitPoints.map(function(e){var n;return new y(e.x,e.y,(n=e.z)!==null&&n!==void 0?n:0)}):this._controlPoints.map(function(e){var n;return new y(e.x,e.y,(n=e.z)!==null&&n!==void 0?n:0)})},t.prototype.moveGripPointsAt=function(e,n){return this.isFitPointSpline?(this.moveFitPointsAt(e,n),this):(this.moveControlPointsAt(e,n),this)},t.prototype.moveFitPointsAt=function(e,n){var r,s;if(this._fitPoints){try{for(var o=so(e),a=o.next();!a.done;a=o.next()){var l=a.value;if(!(!Number.isInteger(l)||l<0)){var h=this._fitPoints[l];h&&st.applyOffsetToPoint3d(h,n)}}}catch(c){r={error:c}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}this._boundingBoxNeedsUpdate=!0,this.buildCurve()}},t.prototype.moveControlPointsAt=function(e,n){var r,s;try{for(var o=so(e),a=o.next();!a.done;a=o.next()){var l=a.value;if(!(!Number.isInteger(l)||l<0)){var h=this.getControlPointAt(l);h&&st.applyOffsetToPoint3d(h,n)}}}catch(c){r={error:c}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}this.rebuildAfterControlPointMutation()},t.prototype.rebuildAfterControlPointMutation=function(){var e=this._nurbsCurve.knots(),n=this._nurbsCurve.weights();this.isFitPointSpline&&(this._fitPoints=void 0,this._knotParameterization=void 0,this._startTangent=void 0,this._endTangent=void 0),this._nurbsCurve=pt.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,n.length>0?n:void 0),this._boundingBoxNeedsUpdate=!0},t.prototype.getOffsetSamplePath2d=function(e){return this._nurbsCurve.getOffsetSamplePath2d(e)},t.prototype.getPoints=function(e){e===void 0&&(e=100);for(var n=this._nurbsCurve,r=[],s=n.knots(),o=this._nurbsCurve.degree(),a=s[o],l=s[s.length-o-1],h=(l-a)/(e-1),c=0;c<e;c++){var u=c===e-1?l:a+c*h,g=n.point(u);r.push(new y(g[0],g[1],g[2]))}return r},t.prototype.getCurvePoints=function(e,n){for(var r=[],s=e.knots(),o=e.degree(),a=s[o],l=s[s.length-o-1],h=(l-a)/(n-1),c=0;c<n;c++){var u=a+c*h;r.push(e.point(u))}return r},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new k().setFromPoints(e)},Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this.setClosed(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed)return 0;var e=this.getPoints(128);return ca(e)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(function(s){return new y(s).applyMatrix4(e)}),this._startTangent&&(this._startTangent=new y(this._startTangent).transformDirection(e)),this._endTangent&&(this._endTangent=new y(this._endTangent).transformDirection(e)),this.buildCurve();else{var n=this._nurbsCurve.knots(),r=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(function(s){return new y(s).applyMatrix4(e)}),this._nurbsCurve=pt.byKnotsControlPointsWeights(this._degree,n,this._controlPoints,r.length>0?r:void 0)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return this._fitPoints&&this._knotParameterization?new t(this._fitPoints.map(st.point2dToPoint3d),this._knotParameterization,this._degree,this._closed,this._startTangent?st.point2dToPoint3d(this._startTangent):void 0,this._endTangent?st.point2dToPoint3d(this._endTangent):void 0):new t(this._controlPoints.map(st.point2dToPoint3d),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)},t.prototype.toNurbsPoints=function(e){var n=new Array(e.length);return e.forEach(function(r,s){n[s]=[r.x,r.y,r.z||0]}),n},t.prototype.toGePoints=function(e){var n=new Array(e.length);return e.forEach(function(r,s){n[s]={x:r[0],y:r[1],z:r[2]}}),n},t.prototype.toNurbsPoint=function(e){return[e.x,e.y,e.z||0]},t.createClosedSpline=function(e,n,r){if(n===void 0&&(n="Uniform"),r===void 0&&(r=3),e.length<r+1)throw new Error("At least ".concat(r+1," points are required for a degree ").concat(r," closed spline"));return new t(e,n,r,!0)},t.fromControlPoints=function(e,n,r,s,o){if(e.length<2||n.length<2)return null;var a=au(s,e.length,n.length);if(e.length<a+1)return null;try{return new t(e,n,hu(r,e.length),a,o)}catch{return null}},t.fromFitPoints=function(e,n,r,s,o,a){if(e.length<2)return null;var l=no(o),h=no(a),c=(l?1:0)+(h?1:0),u=lu(r,e.length,c);if(e.length+c<u+1)return null;try{return l||h?new t(e,n,u,s,l?o:void 0,h?a:void 0):new t(e,n,u,s)}catch{return null}},t.fromDwgSplineEdge=function(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){var n=e.controlPoints.map(st.point2dToPoint3d),r=!0,s=e.controlPoints.map(function(a){return a.weight==null&&(r=!1),a.weight||1});return t.fromControlPoints(n,e.knots,r?s:void 0,e.degree,!1)}if(e.numberOfFitData>0){var o=e.fitDatum.map(st.point2dToPoint3d);return t.fromFitPoints(o,"Uniform",e.degree,!1,e.startTangent?st.point2dToPoint3d(e.startTangent):void 0,e.endTangent?st.point2dToPoint3d(e.endTangent):void 0)}return null},t}(gn),uu=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),mi=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},_i=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},Wr=function(i){uu(t,i);function t(e){e===void 0&&(e=[]);var n=i.call(this)||this;return n._curves=e,n}return Object.defineProperty(t.prototype,"curves",{get:function(){return this._curves},enumerable:!1,configurable:!0}),t.buildFromEdges=function(e,n){if(n===void 0&&(n=.001),e.length===0)return[];for(var r=_i([],mi(e),!1),s=[],o=n*n,a=function(f,p){var m=f.x-p.x,_=f.y-p.y;return m*m+_*_<=o};r.length>0;){var l=[],h=r.shift();l.push(h);var c=t.getEdgeStartPoint(h),u=t.getEdgeEndPoint(h);if(!a(c,u))for(;r.length>0;){var g=t.findConnectingEdge(r,u,o);if(g.index<0)break;var d=r.splice(g.index,1)[0];if(g.reverse&&(d=t.reverseEdge(d)),l.push(d),u=t.getEdgeEndPoint(d),a(u,c))break}s.push(new t(l))}return s},t.prototype.add=function(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"numberOfEdges",{get:function(){return this._curves.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this._curves.length>0){var e=this._curves[0].startPoint;return new A(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.startPoint},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){var e=0;return this._curves.forEach(function(n){e+=n.length}),e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100),n=new nt;return n.setFromPoints(e),n},t.prototype.transform=function(e){var n=new C().set(e.elements[0],e.elements[3],0,e.elements[6],e.elements[1],e.elements[4],0,e.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(function(r){r instanceof Tt?r.transform(n):r.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._curves.map(function(e){return e.clone()}))},Object.defineProperty(t.prototype,"closed",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var n=[];return this.curves.forEach(function(r){r.getPoints(e).forEach(function(s){n.push(new A(s.x,s.y))})}),n},t.findConnectingEdge=function(e,n,r){for(var s=-1,o=!1,a=Number.POSITIVE_INFINITY,l=0;l<e.length;l++){var h=e[l],c=t.getEdgeStartPoint(h),u=t.getEdgeEndPoint(h),g=n.x-c.x,d=n.y-c.y,f=g*g+d*d;f<a&&(a=f,s=l,o=!1);var p=n.x-u.x,m=n.y-u.y,_=p*p+m*m;_<a&&(a=_,s=l,o=!0)}return a>r?{index:-1,reverse:!1}:{index:s,reverse:o}},t.getEdgeStartPoint=function(e){var n=e.startPoint;return new A(n.x,n.y)},t.getEdgeEndPoint=function(e){var n=e.endPoint;return new A(n.x,n.y)},t.reverseEdge=function(e){return e instanceof Mt?new Mt(e.endPoint,e.startPoint):e instanceof ht?t.reverseCircArcEdge(e):e instanceof le?new le(e.center,e.majorAxisRadius,e.minorAxisRadius,e.endAngle,e.startAngle,!e.clockwise,e.rotation):e instanceof Tt?t.reverseSplineEdge(e):e},t.reverseCircArcEdge=function(e){var n=e.startPoint,r=e.endPoint,s=!e.clockwise,o=Math.atan2(r.y-e.center.y,r.x-e.center.x),a=Math.atan2(n.y-e.center.y,n.x-e.center.x),l=function(h){var c=E.normalizeAngle(h);return s?E.normalizeAngle(-c):c};return new ht(e.center,e.radius,l(o),l(a),s)},t.reverseSplineEdge=function(e){var n=_i([],mi(e.controlPoints),!1).reverse(),r=e.knots,s=r[0],o=r[r.length-1],a=r.map(function(c){return s+o-c}).reverse(),l=e.weights,h=l.length>0?_i([],mi(l),!1).reverse():void 0;return new Tt(n,a,h,e.degree,e.closed)},t}(Fe);exports.AcGiArrowType=void 0;(function(i){i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK"})(exports.AcGiArrowType||(exports.AcGiArrowType={}));exports.AcGiLineWeight=void 0;(function(i){i[i.ByBlock=-2]="ByBlock",i[i.ByDIPs=-4]="ByDIPs",i[i.ByLayer=-1]="ByLayer",i[i.ByLineWeightDefault=-3]="ByLineWeightDefault",i[i.LineWeight000=0]="LineWeight000",i[i.LineWeight005=5]="LineWeight005",i[i.LineWeight009=9]="LineWeight009",i[i.LineWeight013=13]="LineWeight013",i[i.LineWeight015=15]="LineWeight015",i[i.LineWeight018=18]="LineWeight018",i[i.LineWeight020=20]="LineWeight020",i[i.LineWeight025=25]="LineWeight025",i[i.LineWeight030=30]="LineWeight030",i[i.LineWeight035=35]="LineWeight035",i[i.LineWeight040=40]="LineWeight040",i[i.LineWeight050=50]="LineWeight050",i[i.LineWeight053=53]="LineWeight053",i[i.LineWeight060=60]="LineWeight060",i[i.LineWeight070=70]="LineWeight070",i[i.LineWeight080=80]="LineWeight080",i[i.LineWeight090=90]="LineWeight090",i[i.LineWeight100=100]="LineWeight100",i[i.LineWeight106=106]="LineWeight106",i[i.LineWeight120=120]="LineWeight120",i[i.LineWeight140=140]="LineWeight140",i[i.LineWeight158=158]="LineWeight158",i[i.LineWeight200=200]="LineWeight200",i[i.LineWeight211=211]="LineWeight211"})(exports.AcGiLineWeight||(exports.AcGiLineWeight={}));var ei=function(){function i(t){t===void 0&&(t={});var e,n,r,s;this.database=t.database,this.foregroundOnDark=(e=t.foregroundOnDark)!==null&&e!==void 0?e:nn,this.foregroundOnLight=(n=t.foregroundOnLight)!==null&&n!==void 0?n:rn,this.backgroundIsDark=(r=t.backgroundIsDark)!==null&&r!==void 0?r:!0,this.fallbackRgb=(s=t.fallbackRgb)!==null&&s!==void 0?s:16777215}return i.prototype.resolveSubEntityTraitsRgb=function(t){var e,n,r,s=t.color;return s.isForeground?this.backgroundIsDark?this.foregroundOnDark:this.foregroundOnLight:s.isByLayer||s.isByBlock?(e=this.fallbackRgb)!==null&&e!==void 0?e:16777215:(r=(n=s.RGB)!==null&&n!==void 0?n:this.fallbackRgb)!==null&&r!==void 0?r:16777215},i.fromBackgroundColor=function(t,e){return t===void 0&&(t=va),new i({database:e,foregroundOnDark:nn,foregroundOnLight:rn,backgroundIsDark:!Pa(t),fallbackRgb:16777215})},i}(),va=0,nn=16777215,rn=0,du=16777215,gu=128,fu=new ei({database:void 0,foregroundOnDark:nn,foregroundOnLight:rn,backgroundIsDark:!0,fallbackRgb:16777215});function Pa(i){var t=i>>16&255,e=i>>8&255,n=i&255;return .299*t+.587*e+.114*n>gu}function pu(i){var t=ei.fromBackgroundColor(i);return t.backgroundIsDark?t.foregroundOnDark:t.foregroundOnLight}function yu(i){return i?rn:nn}function mu(i,t){return ei.fromBackgroundColor(t).resolveSubEntityTraitsRgb(i)}exports.AcGiMTextFlowDirection=void 0;(function(i){i[i.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",i[i.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",i[i.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",i[i.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",i[i.BY_STYLE=5]="BY_STYLE"})(exports.AcGiMTextFlowDirection||(exports.AcGiMTextFlowDirection={}));exports.AcGiMTextAttachmentPoint=void 0;(function(i){i[i.TopLeft=1]="TopLeft",i[i.TopCenter=2]="TopCenter",i[i.TopRight=3]="TopRight",i[i.MiddleLeft=4]="MiddleLeft",i[i.MiddleCenter=5]="MiddleCenter",i[i.MiddleRight=6]="MiddleRight",i[i.BottomLeft=7]="BottomLeft",i[i.BottomCenter=8]="BottomCenter",i[i.BottomRight=9]="BottomRight",i[i.BaselineLeft=10]="BaselineLeft",i[i.BaselineCenter=11]="BaselineCenter",i[i.BaselineRight=12]="BaselineRight"})(exports.AcGiMTextAttachmentPoint||(exports.AcGiMTextAttachmentPoint={}));exports.AcGiRenderMode=void 0;(function(i){i[i.OPTIMIZED_2D=0]="OPTIMIZED_2D",i[i.WIREFRAME=1]="WIREFRAME",i[i.HIDDEN_LINE=2]="HIDDEN_LINE",i[i.FLAT_SHADED=3]="FLAT_SHADED",i[i.GOURAUD_SHADED=4]="GOURAUD_SHADED",i[i.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",i[i.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME"})(exports.AcGiRenderMode||(exports.AcGiRenderMode={}));exports.AcGiOrthographicType=void 0;(function(i){i[i.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",i[i.TOP=1]="TOP",i[i.BOTTOM=2]="BOTTOM",i[i.FRONT=3]="FRONT",i[i.BACK=4]="BACK",i[i.LEFT=5]="LEFT",i[i.RIGHT=6]="RIGHT"})(exports.AcGiOrthographicType||(exports.AcGiOrthographicType={}));exports.AcGiDefaultLightingType=void 0;(function(i){i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS"})(exports.AcGiDefaultLightingType||(exports.AcGiDefaultLightingType={}));var Aa=function(){function i(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new y,this._height=0,this._width=0,this._viewCenter=new y,this._viewHeight=0}return Object.defineProperty(i.prototype,"number",{get:function(){return this._number},set:function(t){this._number=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"id",{get:function(){return this._id},set:function(t){this._id=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"groupId",{get:function(){return this._groupId},set:function(t){this._groupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"centerPoint",{get:function(){return this._centerPoint},set:function(t){this._centerPoint.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"box",{get:function(){var t=new nt;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewCenter",{get:function(){return this._viewCenter},set:function(t){this._viewCenter.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(t){this._viewHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewWidth",{get:function(){return this.viewHeight*(this.width/this.height)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewBox",{get:function(){var t=new nt;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t},enumerable:!1,configurable:!0}),i.prototype.clone=function(){var t=new i;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t},i.prototype.copy=function(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this},i}();const Jt="Continuous",q="Standard",Kt="Standard",Zt="Standard",_u="ANSI31",Sa="ANGLE",he="SOLID",La="USER",Ea="LINEAR",K="ByLayer",Ct="ByBlock",Ne="*Active",zi="mlightcad",Vi="ACAD",bu=Object.freeze({x:0,y:0}),xu=Object.freeze({x:0,y:0}),wu=Object.freeze({x:1,y:1}),vu=Object.freeze({x:0,y:0,z:1}),Pu=Object.freeze({x:0,y:0,z:0}),Ia=150,ji=1,Di=255,Ma=12,Gi=1,Hi=255,Au=0,Su=32767,Lu=0,Eu=2,Ta=5,Wi=1,Ui=255,ss=class ss extends gt{constructor(){super(...arguments),this._visibility=!0,this._transparency=new Q,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this.getEntityColor()}set color(t){this.setEntityColor(t)}get resolvedColor(){return this.resolveStandardColor()}resolveStandardColor(){var e;let t=this.color;if(t.isByLayer){const n=this.getLayerColor();n&&n.RGB!=null&&(t=n)}else if(t.isByBlock){const n=this.database.cecolor;if(n&&(t=n,t.isByLayer)){const r=this.database.clayer||this.layer,s=this.database.tables.layerTable.getAt(r);((e=s==null?void 0:s.color)==null?void 0:e.RGB)!=null&&(t=s.color)}}return t}get lineType(){var t;return this._lineType==null&&(this._lineType=((t=this.database)==null?void 0:t.celtype)??K),this._lineType}set lineType(t){t?t.toUpperCase()==="BYLAYER"?this._lineType=K:t.toUpperCase()==="BYBLOCK"?this._lineType=Ct:this._lineType=t:this._lineType=K}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new O,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(t){this._color==null&&(this._color=new O),this._color.copy(t)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(t){t.writeSubclassMarker("AcDbEntity"),t.writeString(8,this.layer),t.writeString(6,this.lineType),t.writeDouble(48,this.linetypeScale),t.writeInt16(60,this.visibility?0:1),t.writeCmColor(this.color),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency);const e=this.database.tables.blockTable.getIdAt(this.ownerId);return e!=null&&e.isPaperSapce&&t.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new O,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??K),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subMoveGripPointsAt(t,e){return this}subGetOsnapPoints(t,e,n,r,s,o){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){if(!this.database.isLayerDrawable(this.layer))return;const n=t.subEntityTraits;n.color=this.resolvedColor,n.lineType=this.lineStyle,n.lineTypeScale=this.linetypeScale,n.lineWeight=this.lineWeight,n.transparency=this.transparency,n.layer=this.layer,n.drawOrder=0,"thickness"in this&&(n.thickness=this.thickness),t.context.database=this.database;const r=this.subWorldDraw(t,e);return this.attachEntityInfo(r),r}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color=t}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var r;const{type:t,name:e}=this.getLineType(),n=(r=this.database)==null?void 0:r.tables.linetypeTable.getAt(e);return n?{type:t,...n.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==K){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==Ct?{type:"ByBlock",name:Jt}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Jt}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);return t!=null?t.color:null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};ss.typeName="Entity";let z=ss;class Xe{constructor(t){this.i=0,t instanceof Map?(this._records=t,this._array=null,this._keys=Array.from(t.keys())):(this._records=null,this._array=t,this._keys=[])}get count(){var t;return((t=this._records)==null?void 0:t.size)??this._array.length}toArray(){return this._records?Array.from(this._records.values()):[...this._array]}[Symbol.iterator](){return this}next(){if(this._array){if(this.i<this._array.length){const t=this._array[this.i];return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}class ee extends gt{constructor(t,e){t=t||{},Pt(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}setAttr(t,e){this.assertOpenForWrite(),super.setAttr(t,e)}assertOpenForWrite(){if(this.isTemp)return;const t=this.database;if(!t)return;const e=t.transactionManager;if(!e.isApplyingUndoRedo()){if(e.strictMode&&!e.isRecording())throw new Error("Cannot modify symbol table records outside an active transaction.");if(e.isRecording()&&!e.isOpenedForWriteInTransaction(this.objectId))throw new Error(`Symbol table record "${this.name||this.objectId}" is not open for write. Use openObjectForWrite().`)}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var Ca=(i=>(i[i.Any=0]="Any",i[i.Uniform=1]="Uniform",i))(Ca||{}),ka=(i=>(i[i.None=0]="None",i[i.Anonymous=1]="Anonymous",i[i.HasNonConstantAttributes=2]="HasNonConstantAttributes",i[i.Xref=4]="Xref",i[i.XrefOverlay=8]="XrefOverlay",i[i.ExternallyDependent=16]="ExternallyDependent",i[i.Resolved=32]="Resolved",i[i.Referenced=64]="Referenced",i))(ka||{});const Ut=class Ut extends ee{static isModelSapceName(t){return t.toLowerCase()==Ut.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Ut.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(t,e){t=t||{},Pt(t,{origin:new y,layoutId:"",flags:0,pathName:"",blockInsertUnits:0,explodability:1,blockScaling:1,bmpPreview:void 0}),super(t,e),this._entities=[]}get isModelSapce(){return Ut.isModelSapceName(this.name)}get isPaperSapce(){return Ut.isPaperSapceName(this.name)}get origin(){return this.getAttr("origin")}set origin(t){this.getAttr("origin").copy(t)}get layoutId(){return this.getAttr("layoutId")}set layoutId(t){this.setAttr("layoutId",t)}get flags(){return this.getAttr("flags")}set flags(t){this.setAttr("flags",t)}get pathName(){return this.getAttr("pathName")}set pathName(t){this.setAttr("pathName",t)}get isXref(){return(this.flags&12)!==0}get isOverlayReference(){return(this.flags&8)!==0}get isUnresolvedXref(){return!this.isXref||this.flags&32?!1:this._entities.length===0}get blockInsertUnits(){return this.getAttr("blockInsertUnits")}set blockInsertUnits(t){this.setAttr("blockInsertUnits",t)}get explodability(){return this.getAttr("explodability")}set explodability(t){this.setAttr("explodability",t)}get blockScaling(){return this.getAttr("blockScaling")}set blockScaling(t){this.setAttr("blockScaling",t)}get bmpPreview(){return this.getAttrWithoutException("bmpPreview")}set bmpPreview(t){this.setAttr("bmpPreview",t)}appendEntity(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot append entities outside an active transaction.");const n=s=>{s.database=this.database,s.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(s),this.database.commitObjectHandle(s,o=>this.hasEntityId(o)),s.resolveEffectiveProperties(),this._entities.push(s),s.dxfTypeName==="INSERT"&&"syncAttributeDatabases"in s&&typeof s.syncAttributeDatabases=="function"&&s.syncAttributeDatabases()},r=Array.isArray(t)?t:[t];for(const s of r)n(s);if(e.isRecording())for(const s of r)e.recordAppend({type:"blockTableRecord",ownerId:this.objectId},s);(this.isModelSapce||this.isPaperSapce)&&!e.isRecording()&&!e.isApplyingUndoRedo()&&this.database.notifyEntityAppended(t)}removeEntity(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot remove entities outside an active transaction.");const n=Array.isArray(t)?t:[t];if(n.length===0)return!1;const r=new Set(n),s=[];let o=0;for(const a of this._entities)r.has(a.objectId)?(e.isRecording()&&e.recordRemove({type:"blockTableRecord",ownerId:this.objectId},a),s.push(a),this.database.releaseObjectHandle(a)):this._entities[o++]=a;return this._entities.length=o,s.length>0&&!e.isRecording()&&!e.isApplyingUndoRedo()&&this.database.notifyEntityErased(s),s.length>0}newIterator(){return new Xe(this._entities)}getIdAt(t){const e=this.database.getObjectById(t);if(!(!(e instanceof z)||e.getAttrWithoutException("ownerId")!==this.objectId))return e}hasEntityId(t){return this.getIdAt(t)!==void 0}dxfOutBlockRecord(t){return t.writeStart("BLOCK_RECORD"),this.dxfOut(t),this}dxfOutBlockBegin(t){return t.writeStart("BLOCK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeString(8,"0"),t.writeSubclassMarker("AcDbBlockBegin"),t.writeString(2,this.name),t.writeInt16(70,this.flags),t.writePoint3d(10,this.origin),t.writeString(3,this.name),this.pathName&&t.writeString(1,this.pathName),this}dxfOutBlockEnd(t){return t.writeStart("ENDBLK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.blockInsertUnits),t.writeInt16(280,this.explodability),t.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&t.writeObjectId(340,this.layoutId),this}};Ut.MODEL_SPACE_NAME="*Model_Space",Ut.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let J=Ut;var Oa=(i=>(i[i.kInches=0]="kInches",i[i.kMillimeters=1]="kMillimeters",i[i.kPixels=2]="kPixels",i))(Oa||{}),Na=(i=>(i[i.k0degrees=0]="k0degrees",i[i.k90degrees=1]="k90degrees",i[i.k180degrees=2]="k180degrees",i[i.k270degrees=3]="k270degrees",i))(Na||{}),Xa=(i=>(i[i.kDisplay=0]="kDisplay",i[i.kExtents=1]="kExtents",i[i.kLimits=2]="kLimits",i[i.kView=3]="kView",i[i.kWindow=4]="kWindow",i[i.kLayout=5]="kLayout",i))(Xa||{}),Ya=(i=>(i[i.kDraft=0]="kDraft",i[i.kPreview=1]="kPreview",i[i.kNormal=2]="kNormal",i[i.kPresentation=3]="kPresentation",i[i.kMaximum=4]="kMaximum",i[i.kCustom=5]="kCustom",i))(Ya||{}),Ra=(i=>(i[i.kAsDisplayed=0]="kAsDisplayed",i[i.kWireframe=1]="kWireframe",i[i.kHidden=2]="kHidden",i[i.kRendered=3]="kRendered",i[i.kVisualStyle=4]="kVisualStyle",i[i.kRenderPreset=5]="kRenderPreset",i))(Ra||{}),Ba=(i=>(i[i.kScaleToFit=0]="kScaleToFit",i[i.k1_128in_1ft=1]="k1_128in_1ft",i[i.k1_64in_1ft=2]="k1_64in_1ft",i[i.k1_32in_1ft=3]="k1_32in_1ft",i[i.k1_16in_1ft=4]="k1_16in_1ft",i[i.k3_32in_1ft=5]="k3_32in_1ft",i[i.k1_8in_1ft=6]="k1_8in_1ft",i[i.k3_16in_1ft=7]="k3_16in_1ft",i[i.k1_4in_1ft=8]="k1_4in_1ft",i[i.k3_8in_1ft=9]="k3_8in_1ft",i[i.k1_2in_1ft=10]="k1_2in_1ft",i[i.k3_4in_1ft=11]="k3_4in_1ft",i[i.k1in_1ft=12]="k1in_1ft",i[i.k3in_1ft=13]="k3in_1ft",i[i.k6in_1ft=14]="k6in_1ft",i[i.k1ft_1ft=15]="k1ft_1ft",i[i.k1_1=16]="k1_1",i[i.k1_2=17]="k1_2",i[i.k1_4=18]="k1_4",i[i.k1_5=19]="k1_5",i[i.k1_8=20]="k1_8",i[i.k1_10=21]="k1_10",i[i.k1_16=22]="k1_16",i[i.k1_20=23]="k1_20",i[i.k1_30=24]="k1_30",i[i.k1_40=25]="k1_40",i[i.k1_50=26]="k1_50",i[i.k1_100=27]="k1_100",i[i.k2_1=28]="k2_1",i[i.k4_1=29]="k4_1",i[i.k8_1=30]="k8_1",i[i.k10_1=31]="k10_1",i[i.k100_1=32]="k100_1",i[i.k1000_1=33]="k1000_1",i[i.k1and1_2in_1ft=34]="k1and1_2in_1ft",i))(Ba||{});const Iu={0:0,1:1/1536,2:1/768,3:1/384,4:1/192,5:1/128,6:1/96,7:1/64,8:1/48,9:1/32,10:1/24,11:1/16,12:1/12,13:1/4,14:1/2,15:1,16:1,17:1/2,18:1/4,19:1/5,20:1/8,21:1/10,22:1/16,23:1/20,24:1/30,25:1/40,26:1/50,27:1/100,28:2,29:4,30:8,31:10,32:100,33:1e3,34:1/8};class Fa extends gt{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new A,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new A,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new nt,this._modelType=t,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(t){this._plotSettingsName=t}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(t){this._plotSettingsName=t}get plotCfgName(){return this._plotCfgName}set plotCfgName(t){this._plotCfgName=t}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(t){this._canonicalMediaName=t}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(t){this._currentStyleSheet=t}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(t){this._plotOrigin=t}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(t){this._customPrintScale=t}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(t){this._plotPaperSize=t}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(t){this._plotPaperMargins=t}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(t){this._plotViewName=t}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(t){this._plotWindowArea=t}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(t){this._modelType=t}getModelType(){return this._modelType}setModelType(t){this._modelType=t}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(t){this._drawViewportsFirst=t}setDrawViewportsFirst(t){this._drawViewportsFirst=t}get plotCentered(){return this._plotCentered}set plotCentered(t){this._plotCentered=t}setPlotCentered(t){this._plotCentered=t}get plotHidden(){return this._plotHidden}set plotHidden(t){this._plotHidden=t}setPlotHidden(t){this._plotHidden=t}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(t){this._plotPaperUnits=t}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(t){this._plotPlotStyles=t}setPlotPlotStyles(t){this._plotPlotStyles=t}get plotRotation(){return this._plotRotation}set plotRotation(t){this._plotRotation=t}get plotType(){return this._plotType}set plotType(t){this._plotType=t}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(t){this._plotViewportBorders=t}setPlotViewportBorders(t){this._plotViewportBorders=t}get printLineweights(){return this._printLineweights}set printLineweights(t){this._printLineweights=t}setPrintLineweights(t){this._printLineweights=t}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(t){this._scaleLineweights=t}setScaleLineweights(t){this._scaleLineweights=t}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(t){this._showPlotStyles=t}setShowPlotStyles(t){this._showPlotStyles=t}get shadePlot(){return this._shadePlotType}set shadePlot(t){this._shadePlotType=t}setShadePlot(t){this._shadePlotType=t}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(t){this._shadePlotResLevel=t}setShadePlotResLevel(t){this._shadePlotResLevel=t}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(t){this._shadePlotCustomDpi=t}setShadePlotCustomDPI(t){this._shadePlotCustomDpi=t}get shadePlotId(){return this._shadePlotId}set shadePlotId(t){this._shadePlotId=t}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(t){this._stdScaleType=t}get stdScale(){return Iu[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(t){this._useStandardScale=t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPlotSettings"),t.writeString(1,this.plotSettingsName),t.writeString(2,this.plotCfgName),t.writeString(4,this.canonicalMediaName),t.writeString(6,this.plotViewName),t.writeDouble(40,this.plotPaperMargins.left),t.writeDouble(41,this.plotPaperMargins.bottom),t.writeDouble(42,this.plotPaperMargins.right),t.writeDouble(43,this.plotPaperMargins.top),t.writeDouble(44,this.plotPaperSize.x),t.writeDouble(45,this.plotPaperSize.y),t.writeDouble(46,this.plotOrigin.x),t.writeDouble(47,this.plotOrigin.y),t.writeDouble(48,this.plotWindowArea.min.x),t.writeDouble(49,this.plotWindowArea.min.y),t.writeDouble(140,this.plotWindowArea.max.x),t.writeDouble(141,this.plotWindowArea.max.y),t.writeDouble(142,this.customPrintScale.numerator),t.writeDouble(143,this.customPrintScale.denominator);let e=0;return this.plotViewportBorders&&(e|=1),this.showPlotStyles&&(e|=2),this.plotCentered&&(e|=4),this.plotHidden&&(e|=8),this.useStandardScale&&(e|=16),this.plotPlotStyles&&(e|=32),this.scaleLineweights&&(e|=64),this.printLineweights&&(e|=128),this.drawViewportsFirst&&(e|=512),this.modelType&&(e|=1024),t.writeInt16(70,e),t.writeInt16(72,this.plotPaperUnits),t.writeInt16(73,this.plotRotation),t.writeInt16(74,this.plotType),t.writeString(7,this.currentStyleSheet),t.writeInt16(75,this.stdScaleType),t.writeInt16(76,this.shadePlot),t.writeInt16(77,this.shadePlotResLevel),t.writeInt16(78,this.shadePlotCustomDPI),t.writeDouble(147,this.stdScale),t.writeObjectId(333,this.shadePlotId),this}}class ni extends Fa{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new nt,this._extents=new k,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}get viewportArray(){return this._viewportArray}set viewportArray(t){this._viewportArray=t.slice()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayout"),t.writeString(1,this.layoutName),t.writeInt16(70,this.tabSelected?1:0),t.writeInt16(71,this.tabOrder),t.writeObjectId(330,this.blockTableRecordId),t.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),t.writePoint2d(10,this.limits.min),t.writePoint2d(11,this.limits.max),t.writePoint3d(14,this.extents.min),t.writePoint3d(15,this.extents.max),this}}class za{constructor(){this.events={layoutCreated:new U,layoutRemoved:new U,layoutRenamed:new U,layoutSwitched:new U}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const n=this.getWorkingDatabase(e),r=n.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(r,n)}setCurrentLayoutBtrId(t,e){const n=this.getWorkingDatabase(e),r=n.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(r,n)}setCurrentLayout(t,e){const n=this.getWorkingDatabase(e),r=n.objects.layout.getAt(t);return this.setCurrentLayoutInternal(r,n)}renameLayout(t,e,n){const s=this.getWorkingDatabase(n).objects.layout.getAt(t);return s?(s.layoutName=e,this.events.layoutRenamed.dispatch({layout:s,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const n=this.getWorkingDatabase(e).objects.layout,r=n.getAt(t);let s=!1;return r&&(s=n.remove(t),s&&this.events.layoutRemoved.dispatch({layout:r})),s}createLayout(t,e){const n=this.getWorkingDatabase(e),r=new ni;r.layoutName=t,r.tabOrder=n.objects.layout.maxTabOrder;const s=new J;return s.name=`*Paper_Space${r.tabOrder}`,n.tables.blockTable.add(s),n.objects.layout.setAt(t,r),this.events.layoutCreated.dispatch({layout:r}),{layout:r,btr:s}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||Xh()}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}let In;function Mu(i){In=i}function Va(){return Xn.instance}const Gn=class Gn{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager||(In||(In=()=>new za),this._layoutManager=In()),this._layoutManager}};Gn.instance=new Gn;let Xn=Gn;Fo(Va);var Ye=(i=>(i.kForRead="kForRead",i.kForWrite="kForWrite",i))(Ye||{});class Ur{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new Ur(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class ja{constructor(t,e,n){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=n,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,n)=>{const r=()=>{Promise.resolve(t()).then(e).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let n=0;const r=async()=>{const s=n,o=Math.min(n+this._chunkSize,this._count);await t(s,o),n=o,n<this._count&&await this.scheduleTask(r)};await r(),await(e==null?void 0:e())}}const Tu=/\\[fF](.*?)\|/g,Cu=/\\[fF]([^|;]+);/g;class bt{constructor(t){this.styles=t.styles,this.styleMap=bt.buildStyleFontMap(this.styles),this.textStyleVar=t.textStyleVar??q}collect(t,e){const n=new Set;for(const r of bt.collectShapeDefinitionFonts(this.styles))n.add(r);for(const r of bt.collectNamedStyleTableFonts(this.styles))n.add(r);return this.collectFromEntities(t,e,n),Array.from(n)}static normalizeFontFileName(t){if(!t)return;const e=t.lastIndexOf(".");return e>=0?t.substring(0,e).toLowerCase():t.toLowerCase()}collectFromEntities(t,e,n){for(const r of t){const s=e.getEntityFontInfo(r);if(s){if(s.formattedText)for(const o of bt.extractInlineMTextFonts(s.formattedText))n.add(o);if(s.resolveStyle&&this.addResolvedStyleFonts(s.styleName,n),s.blockName&&e.getBlockEntities){const o=e.getBlockEntities(s.blockName);o&&this.collectFromEntities(o,e,n)}}}}resolveStyleFontNames(t){const e=[],n=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};n(t),n(this.textStyleVar),n(q),n("STANDARD");for(const r of e){const s=this.styleMap.get(r);if(s)return s;const o=r.toUpperCase();for(const[a,l]of this.styleMap)if(a.toUpperCase()===o)return l}return this.styleMap.values().next().value}addResolvedStyleFonts(t,e){const n=this.resolveStyleFontNames(t);n==null||n.forEach(r=>e.add(r))}static buildStyleFontMap(t){const e=new Map;for(const n of t)e.set(n.name,bt.collectStyleEntryFontNames(n));return e}static collectStyleEntryFontNames(t){const e=[];for(const n of[t.font,t.bigFont,t.extendedFont]){const r=bt.normalizeFontFileName(n);r&&e.push(r)}return e}static collectNamedStyleTableFonts(t){const e=[];for(const n of t)n.standardFlag&&n.standardFlag&1||e.push(...bt.collectStyleEntryFontNames(n));return e}static collectShapeDefinitionFonts(t){const e=[];for(const n of t)if(n.standardFlag&&n.standardFlag&1){const r=bt.normalizeFontFileName(n.font);r&&e.push(r)}return e}static extractInlineMTextFonts(t){const e=new Set;for(const n of t.matchAll(Tu))e.add(n[1].toLowerCase());for(const n of t.matchAll(Cu))e.add(n[1].toLowerCase());return Array.from(e)}}class ge{static get instance(){return this._instance||(this._instance=new ge),this._instance}constructor(){this._blocks=new Map}createKey(t,e){let n=e.toString();return!n&&e.isByColor&&(n=`RGB:${e.red},${e.green},${e.blue}`),`${t}_${n}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,n,r=[],s=!0,o,a){const l=[];if(e!=null){const h=n.RGB??0,c=this.createKey(e.name,n);let u;if(this.has(c))u=this.get(c);else{const g=e.newIterator();for(const d of g)d.visibility&&(d.color.isByBlock?(oo.copy(d.color),n.isForeground?d.color.setForeground():d.color.setRGBValue(h),this.addEntity(d,l,t),d.color.copy(oo)):this.addEntity(d,l,t));u=t.group(l),u&&s&&J.name&&!J.name.startsWith("*U")&&this.set(c,u)}if(u&&o&&(Sn.copy(o),u.applyMatrix(Sn),a&&(a.x!=0||a.y!=0||a.z!=1)&&(bi.setFromExtrusionDirection(a),u.applyMatrix(bi),Sn.premultiply(bi))),u&&r&&r.length>0){const g=o!=null?ku.copy(Sn).invert():void 0;r.forEach(d=>{g&&d.applyMatrix(g),u.addChild(d)})}return u}else return t.group(l)}addEntity(t,e,n){if(!t.visibility)return;const r=t.worldDraw(n);r&&(this.attachEntityInfo(r,t),e.push(r))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const oo=new O,Sn=new C,bi=new C,ku=new C;var ct=(i=>(i[i.DecimalDegrees=0]="DecimalDegrees",i[i.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",i[i.Gradians=2]="Gradians",i[i.Radians=3]="Radians",i[i.SurveyorsUnits=4]="SurveyorsUnits",i))(ct||{}),W=(i=>(i[i.Scientific=1]="Scientific",i[i.Decimal=2]="Decimal",i[i.Engineering=3]="Engineering",i[i.Architectural=4]="Architectural",i[i.Fractional=5]="Fractional",i[i.WindowsDesktop=6]="WindowsDesktop",i))(W||{}),G=(i=>(i[i.Undefined=0]="Undefined",i[i.Inches=1]="Inches",i[i.Feet=2]="Feet",i[i.Miles=3]="Miles",i[i.Millimeters=4]="Millimeters",i[i.Centimeters=5]="Centimeters",i[i.Meters=6]="Meters",i[i.Kilometers=7]="Kilometers",i[i.Microinches=8]="Microinches",i[i.Mils=9]="Mils",i[i.Yards=10]="Yards",i[i.Angstroms=11]="Angstroms",i[i.Nanometers=12]="Nanometers",i[i.Microns=13]="Microns",i[i.Decimeters=14]="Decimeters",i[i.Dekameters=15]="Dekameters",i[i.Hectometers=16]="Hectometers",i[i.Gigameters=17]="Gigameters",i[i.Astronomical=18]="Astronomical",i[i.LightYears=19]="LightYears",i[i.Parsecs=20]="Parsecs",i[i.USSurveyFeet=21]="USSurveyFeet",i[i.USSurveyInch=22]="USSurveyInch",i[i.USSurveyYard=23]="USSurveyYard",i[i.USSurveyMile=24]="USSurveyMile",i[i.Max=24]="Max",i))(G||{});function Da(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function Ga(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}const w={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELTYPE:"CELTYPE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLEADERSTYLE:"CMLEADERSTYLE",CMLSCALE:"CMLSCALE",CMLSTYLE:"CMLSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",DWGNAME:"DWGNAME",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",GRIPCOLOR:"GRIPCOLOR",GRIPHOT:"GRIPHOT",GRIPOBJLIMIT:"GRIPOBJLIMIT",GRIPS:"GRIPS",GRIPSIZE:"GRIPSIZE",HPANG:"HPANG",HPASSOC:"HPASSOC",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENT:"MEASUREMENT",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",MODELBKCOLOR:"MODELBKCOLOR",OSMODE:"OSMODE",ORTHOMODE:"ORTHOMODE",PAPERBKCOLOR:"PAPERBKCOLOR",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",POLARADDANG:"POLARADDANG",POLARMODE:"POLARMODE",POLARANG:"POLARANG",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",UNITMODE:"UNITMODE"},Ou=Object.freeze(Object.values(w)),Hn=class Hn{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new U},this.registerVar({name:w.ANGBASE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:w.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:w.AUNITS,type:"number",isDbVar:!0,defaultValue:ct.DecimalDegrees}),this.registerVar({name:w.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:w.CECOLOR,type:"color",isDbVar:!0,defaultValue:new O(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:w.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:w.CELTYPE,type:"string",isDbVar:!0,defaultValue:K}),this.registerVar({name:w.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:exports.AcGiLineWeight.ByLayer}),this.registerVar({name:w.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new Q}),this.registerVar({name:w.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:w.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:Zt}),this.registerVar({name:w.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:w.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:Kt}),this.registerVar({name:w.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:w.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:w.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:w.DWGNAME,type:"string",isDbVar:!0,readOnly:!0,defaultValue:"Drawing1.dwg"}),this.registerVar({name:w.GRIPCOLOR,type:"number",isDbVar:!1,defaultValue:Ia}),this.registerVar({name:w.GRIPHOT,type:"number",isDbVar:!1,defaultValue:Ma}),this.registerVar({name:w.GRIPOBJLIMIT,type:"number",isDbVar:!1,defaultValue:100}),this.registerVar({name:w.GRIPS,type:"number",isDbVar:!1,defaultValue:2}),this.registerVar({name:w.GRIPSIZE,type:"number",isDbVar:!1,defaultValue:Ta}),this.registerVar({name:w.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:w.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:w.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new O(exports.AcCmColorMethod.None)}),this.registerVar({name:w.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new O(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:w.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:w.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:w.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:w.HPNAME,type:"string",isDbVar:!1,defaultValue:Sa}),this.registerVar({name:w.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:w.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:w.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new Q}),this.registerVar({name:w.INSUNITS,type:"number",isDbVar:!0,defaultValue:G.Millimeters}),this.registerVar({name:w.LUNITS,type:"number",isDbVar:!0,defaultValue:W.Decimal}),this.registerVar({name:w.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:w.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:w.MEASUREMENT,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:w.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new O(exports.AcCmColorMethod.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:w.MODELBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new O(exports.AcCmColorMethod.ByColor);return t.setRGB(0,0,0),t})()}),this.registerVar({name:w.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:w.ORTHOMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:w.PAPERBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new O(exports.AcCmColorMethod.ByColor);return t.setRGB(255,255,255),t})()}),this.registerVar({name:w.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:w.POLARADDANG,type:"string",isDbVar:!1,defaultValue:""}),this.registerVar({name:w.POLARMODE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:w.POLARANG,type:"number",isDbVar:!1,defaultValue:90}),this.registerVar({name:w.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:w.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:q}),this.registerVar({name:w.UNITMODE,type:"number",isDbVar:!0,defaultValue:0})}static instance(){return this._instance||(this._instance=new Hn),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const n=this.getDescriptor(t);if(!n)throw new Error(`System variable ${t} not found!`);if(n.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}getDefaultValue(t){t=this.normalizeName(t);const e=this.getDescriptor(t);if(!e)throw new Error(`System variable ${t} not found!`);return e.defaultValue}applyVarMutation(t,e,n,r,s){const o=this.normalizeName(t);if(this.hasValueChanged(e,n)){if(r.transactionManager.isRecording())r.transactionManager.recordSysvar(o,e);else if(r.transactionManager.strictMode&&!r.transactionManager.isApplyingUndoRedo())throw new Error(`Cannot change system variable ${o} outside an active transaction.`);s(),!r.transactionManager.isApplyingUndoRedo()&&!r.transactionManager.isRecording()&&this.events.sysVarChanged.dispatch({database:r,name:o,newVal:n,oldVal:e})}}setVar(t,e,n){t=this.normalizeName(t);const r=this.getDescriptor(t);if(r){if(r.readOnly)throw new Error(`System variable ${t} is read-only!`);const s=this.getVar(t,n);if(r.type==="transparency"){const o=this.parseTransparency(e);if(o==null||o.isInvalid)throw new Error("Invalid transparency value!");e=o}else if(r.type!=="string"&&(typeof e=="string"||e instanceof String)){if(r.type==="number"){const o=Number(e);if(Number.isNaN(o))throw new Error("Invalid number input!");e=o}else if(r.type==="boolean")e=this.parseBoolean(e);else if(r.type==="color"){const o=this.parseColorSysVar(t,e,n);if(o==null)throw new Error("Invalid color value!");e=o}}if(t===w.GRIPCOLOR.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<ji||o>Di)throw new Error(`Invalid GRIPCOLOR value! Valid range is ${ji} to ${Di}.`);e=o}if(t===w.GRIPHOT.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<Gi||o>Hi)throw new Error(`Invalid GRIPHOT value! Valid range is ${Gi} to ${Hi}.`);e=o}if(t===w.GRIPOBJLIMIT.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<0||o>32767)throw new Error("Invalid GRIPOBJLIMIT value! Valid range is 0 to 32767.");e=o}if(t===w.GRIPS.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<0||o>2)throw new Error("Invalid GRIPS value! Valid range is 0 to 2.");e=o}if(t===w.GRIPSIZE.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<Wi||o>Ui)throw new Error(`Invalid GRIPSIZE value! Valid range is ${Wi} to ${Ui}.`);e=o}r.isDbVar?this.applyVarMutation(t,s,e,n,()=>{n[t.toLowerCase()]=e}):this.applyVarMutation(t,s,e,n,()=>{this.cache.set(t,e)})}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),n=new Set(["true","t","1","yes","y"]),r=new Set(["false","f","0","no","n"]);return n.has(e)?!0:(r.has(e),!1)}parseColorSysVar(t,e,n){const r=e.trim().toLowerCase();return t===w.HPCOLOR.toLowerCase()&&(r==="."||r==="use current")?n.cecolor.clone():t===w.HPBACKGROUNDCOLOR.toLowerCase()&&(r===""||r==="."||r==="none")?new O(exports.AcCmColorMethod.None):O.fromString(e)}parseTransparency(t){if(t instanceof Q)return t;if(typeof t=="number")return Q.deserialize(t);if(!(typeof t!="string"&&!(t instanceof String)))return Q.fromString(String(t))}hasValueChanged(t,e){return t instanceof O&&e instanceof O||t instanceof Q&&e instanceof Q?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};Hn._instance=null;let tt=Hn;const Ha="Load Database",ao=3e4,Nu=12e4,Xu=1024*1024;class at extends Oo{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Xr.getInstance().getEntry(Ha),n=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",r?r.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-n),r}}class Wa{constructor(t={}){this.config={useWorker:t.useWorker??!0,...t}}async read(t,e,n,r,s,o){const a={name:Ha,data:{total:0},format(){let u="";return Object.keys(this.data).forEach(g=>{g!=="total"&&(u+=`- ${g}: ${this.data[g]} ms
|
|
4
|
-
`)}),u+=`- total: ${this.data.total} ms`,u}};Xr.getInstance().collect(a),this.progress=r;const l={value:0},h=new No;h.setCompleteCallback(()=>this.onFinished()),h.setErrorCallback(u=>this.onError(u)),h.addTask(new at({stage:"START",step:1,progress:l,task:async u=>u},r)),h.addTask(new at({stage:"PARSE",step:5,progress:l,task:async u=>await this.parse(u,s)},r)),h.addTask(new at({stage:"FONT",step:5,progress:l,task:async u=>{const g=this.getFonts(u.model);return{model:u.model,data:g}}},r)),h.addTask(new at({stage:"LTYPE",step:1,progress:l,task:async u=>(this.processLineTypes(u.model,e),u)},r)),h.addTask(new at({stage:"STYLE",step:1,progress:l,task:async u=>(this.processTextStyles(u.model,e),u)},r)),h.addTask(new at({stage:"DIMSTYLE",step:1,progress:l,task:async u=>(this.processDimStyles(u.model,e),u)},r)),h.addTask(new at({stage:"LAYER",step:1,progress:l,task:async u=>(this.processLayers(u.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),u)},r)),h.addTask(new at({stage:"VPORT",step:1,progress:l,task:async u=>(this.processViewports(u.model,e),u)},r)),h.addTask(new at({stage:"HEADER",step:1,progress:l,task:async u=>{if(this.processClasses(u.model,e),this.processHeader(u.model,e),o){const g=tt.instance();for(const[d,f]of Object.entries(o))g.setVar(d,f,e)}return u}},r)),h.addTask(new at({stage:"BLOCK_RECORD",step:5,progress:l,task:async u=>(this.processBlockTables(u.model,e),u)},r)),h.addTask(new at({stage:"OBJECT",step:5,progress:l,task:async u=>(this.processObjects(u.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),u)},r)),h.addTask(new at({stage:"BLOCK",step:5,progress:l,task:async u=>(await this.processBlocks(u.model,e),u)},r)),h.addTask(new at({stage:"ENTITY",step:100,progress:l,task:async u=>(await this.processEntities(u.model,e,n,l,r),u)},r)),h.addTask(new at({stage:"END",step:0,progress:l,task:async u=>u},r));const c=Date.now();await h.run(t),a.data.total=Date.now()-c}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),ge.instance.clear())}getParserWorkerTimeout(t,e){const n=e??this.config.timeout;if(n!=null)return n;const r=Math.ceil(t.byteLength/Xu),s=ao+r*1e3;return Math.min(Nu,Math.max(ao,s))}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processClasses(t,e){}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,n,r,s){throw new Error("Not impelemented yet!")}}class Ua extends Wa{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,n,r,s){let o=t.tables.blockTable.modelSpace.newIterator().toArray();const a=o.length,l=new ja(a,100-r.value,n);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const h=e.tables.blockTable.modelSpace;await l.processChunk(async(c,u)=>{let g=[],d=c<u?o[c].type:"";for(let f=c;f<u;f++){const p=o[f];this.config.convertByEntityType&&p.type!==d&&(this.triggerEvents(h,g),g=[],d=p.type),g.push(p)}if(this.triggerEvents(h,g),s){let f=r.value+u/a*(100-r.value);f>100&&(f=100),await s(f,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const n=e.newIterator().toArray();this.triggerEvents(e,n)}}processHeader(){}processClasses(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const r of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const r of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.objectId});const n=this._database.objects.mleaderStyle.newIterator();for(const r of n)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},n=[];for(const r of t)e[r.type]||(e[r.type]=[],n.push(r.type)),e[r.type].push(r);return n.flatMap(r=>e[r])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}class $a{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const n=Date.now(),r=this.generateTaskId();try{return await this.executeInWorker(r,t,e||this.config.workerUrl)}catch(s){const o=Date.now()-n,a=s instanceof Error?s.message:String(s);return{success:!1,error:a,errorCode:a.toLowerCase().includes("timed out")?"worker_timeout":void 0,duration:o}}}async executeInWorker(t,e,n){const r=Date.now();return new Promise((s,o)=>{const a=this.getAvailableWorker(n),l=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(a),o(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:u=>{clearTimeout(l),this.releaseWorker(a),s(u)},reject:u=>{clearTimeout(l),this.releaseWorker(a),o(u)},timeout:l});const h=u=>{const{id:g,success:d,data:f,error:p,errorCode:m}=u.data;if(g!==t)return;this.cleanupTask(t);const _=Date.now()-r;s(d?{success:!0,data:f,duration:_}:{success:!1,error:p,errorCode:m,duration:_})},c=u=>{this.cleanupTask(t),o(new Error(`Worker error: ${u.message}`))};a.addEventListener("message",h),a.addEventListener("error",c),a.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[n,r]of this.workers)if(!r.isBusy)return r.isBusy=!0,r.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const n=new Worker(t,{type:"module"}),r=this.generateWorkerId(),s={worker:n,isBusy:!0,id:r,createdAt:new Date};return this.workers.set(r,s),n}const e=Array.from(this.workers.values()).sort((n,r)=>n.createdAt.getTime()-r.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,n]of this.workers)if(n.worker===t){n.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class qa{constructor(t){this.framework=new $a(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Yu(i){return new qa(i)}class Ru{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:n}=t.data;try{const r=await this.executeTask(n);this.sendResponse(e,!0,r)}catch(r){this.sendResponse(e,!1,void 0,r instanceof Error?r.message:String(r))}}}sendResponse(t,e,n,r,s){const o={id:t,success:e,data:n,error:r,errorCode:s};try{self.postMessage(o)}catch(a){const l=a instanceof Error?a.message:String(a);self.postMessage({id:t,success:!1,error:l,errorCode:this.classifyPostMessageError(l)})}}classifyPostMessageError(t){const e=t.toLowerCase();return e.includes("out of memory")||e.includes("data cannot be cloned")?"worker_oom":"worker_error"}}var $e=(i=>(i.DXF="dxf",i.DWG="dwg",i))($e||{});class Et{constructor(){this.events={registered:new U,unregistered:new U},this._converters=new Map}static createInstance(){return Et._instance==null&&(Et._instance=new Et),this._instance}static get instance(){return Et._instance||(Et._instance=new Et),Et._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}var Ka=(i=>(i[i.Center=0]="Center",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.OverFirst=3]="OverFirst",i[i.OverSecond=4]="OverSecond",i))(Ka||{}),$r=(i=>(i[i.Center=0]="Center",i[i.Above=1]="Above",i[i.Outside=2]="Outside",i[i.JIS=3]="JIS",i[i.Below=4]="Below",i))($r||{}),Za=(i=>(i[i.Feet=0]="Feet",i[i.None=1]="None",i[i.Inch=2]="Inch",i[i.FeetAndInch=3]="FeetAndInch",i[i.Leading=4]="Leading",i[i.Trailing=8]="Trailing",i[i.LeadingAndTrailing=12]="LeadingAndTrailing",i))(Za||{}),Qa=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(Qa||{}),Ja=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(Ja||{});const Wn=class Wn extends ee{constructor(t,e){t=t||{},Pt(t,Wn.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}dxfOutFields(t){super.dxfOutFields(t);const e=this.database.tables.textStyleTable.getAt(this.dimtxsty),n=this.database.tables.blockTable.getAt(this.dimldrblk),r=this.database.tables.blockTable.getAt(this.dimblk),s=this.database.tables.blockTable.getAt(this.dimblk1),o=this.database.tables.blockTable.getAt(this.dimblk2);return t.writeSubclassMarker("AcDbDimStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),t.writeString(3,this.dimpost),t.writeString(4,this.dimapost),t.writeDouble(40,this.dimscale),t.writeDouble(41,this.dimasz),t.writeDouble(42,this.dimexo),t.writeDouble(43,this.dimdli),t.writeDouble(44,this.dimexe),t.writeDouble(140,this.dimtxt),t.writeDouble(147,this.dimgap),t.writeInt16(170,this.dimalt),t.writeInt16(171,this.dimtol),t.writeInt16(172,this.dimlim),t.writeInt16(173,this.dimtih),t.writeInt16(174,this.dimtoh),t.writeObjectId(340,e==null?void 0:e.objectId),t.writeObjectId(341,n==null?void 0:n.objectId),t.writeObjectId(342,r==null?void 0:r.objectId),t.writeObjectId(343,s==null?void 0:s.objectId),t.writeObjectId(344,o==null?void 0:o.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};Wn.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:q,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let xt=Wn;function tl(){return{color:new O,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new Q,linetype:"",lineWeight:1,materialId:-1}}const Bu=["name",...Object.keys(tl())];class ii extends ee{constructor(t,e){t=t||{},Pt(t,tl()),super(t,e)}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeCmColor(this.color),t.writeString(6,this.linetype),t.writeInt16(290,this.isPlottable?1:0),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency),this.description&&t.writeString(4,this.description),this}}class ue extends ee{constructor(t,e){t=t||{},Pt(t,{standardFlag:0,description:"",totalPatternLength:0}),super(t,e)}get numDashes(){const t=this.getAttrWithoutException("pattern");return t?t.length:0}get patternLength(){return this.getAttr("totalPatternLength")}get comments(){return this.getAttr("description")}get linetype(){return{name:this.name,standardFlag:this.getAttr("standardFlag"),description:this.getAttr("description"),totalPatternLength:this.getAttr("totalPatternLength"),pattern:this.getAttrWithoutException("pattern")}}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this.getAttr("pattern")[t].elementLength}toPreviewSvgString(t){const e=Math.max((t==null?void 0:t.width)??220,1),n=Math.max((t==null?void 0:t.height)??36,1),r=Math.min(Math.max((t==null?void 0:t.padding)??8,0),Math.floor(e/2)),s=Math.max((t==null?void 0:t.strokeWidth)??2,.5),o=this.escapeSvgAttribute((t==null?void 0:t.stroke)??"currentColor"),a=Math.max((t==null?void 0:t.repeats)??4,1),l=n/2,h=r,c=Math.max(e-r,h+1),u=c-h,g=this.getAttrWithoutException("pattern")??[];if(g.length===0||this.patternLength<=0||!g.some(P=>P.elementLength!==0))return this.buildSvgString({width:e,height:n,stroke:o,strokeWidth:s,lineSegments:[[h,c]],dots:[],y:l});const d=[],f=[],p=u/(this.patternLength*a),m=.5,_=Math.max(s*2,2);let v=h;for(;v<c;)for(const P of g){if(v>=c)break;const S=P.elementLength;if(S===0){f.push(v),v=Math.min(v+_,c);continue}const L=Math.max(Math.abs(S)*p,m),T=Math.min(v+L,c);S>0&&T>v&&d.push([v,T]),v=T}return this.buildSvgString({width:e,height:n,stroke:o,strokeWidth:s,lineSegments:d,dots:f,y:l})}buildSvgString(t){const{width:e,height:n,stroke:r,strokeWidth:s,lineSegments:o,dots:a,y:l}=t,h=o.map(([u,g])=>`<line x1="${u.toFixed(2)}" y1="${l.toFixed(2)}" x2="${g.toFixed(2)}" y2="${l.toFixed(2)}" stroke="${r}" stroke-width="${s.toFixed(2)}" stroke-linecap="round" />`).join(""),c=a.map(u=>`<circle cx="${u.toFixed(2)}" cy="${l.toFixed(2)}" r="${(s/2).toFixed(2)}" fill="${r}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${n}" viewBox="0 0 ${e} ${n}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${h}${c}</svg>`}escapeSvgAttribute(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'")}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLinetypeTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.getAttr("standardFlag")),t.writeString(3,this.comments),t.writeInt16(72,65),t.writeInt16(73,this.numDashes),t.writeDouble(40,this.patternLength);for(const e of this.getAttrWithoutException("pattern")??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class qr extends ee{constructor(t,e){t=t||{},Pt(t,{standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:0,font:"",bigFont:""}),super(t,e),this.setAttr("font",this.getFileNameWithoutExtension(this.getAttr("font")||this.getAttrWithoutException("extendedFont")||this.name))}get obliquingAngle(){return this.getAttr("obliqueAngle")}set obliquingAngle(t){this.setAttr("obliqueAngle",t)}get priorSize(){return this.getAttr("lastHeight")}set priorSize(t){this.setAttr("lastHeight",t)}get textSize(){return this.getAttr("fixedTextHeight")}set textSize(t){this.setAttr("fixedTextHeight",t)}get xScale(){return this.getAttr("widthFactor")}set xScale(t){this.setAttr("widthFactor",t)}get isVertical(){return(this.getAttr("standardFlag")&4)===4}set isVertical(t){const e=this.getAttr("standardFlag");this.setAttr("standardFlag",t?e|4:e&-5)}get isShapeFile(){return(this.getAttr("standardFlag")&1)===1}set isShapeFile(t){const e=this.getAttr("standardFlag");this.setAttr("standardFlag",t?e|1:e&-2)}get fileName(){return this.getAttr("font")}set fileName(t){this.setAttr("font",t)}get bigFontFileName(){return this.getAttr("bigFont")}set bigFontFileName(t){this.setAttr("bigFont",t)}get textStyle(){return{name:this.name,standardFlag:this.getAttr("standardFlag"),fixedTextHeight:this.getAttr("fixedTextHeight"),widthFactor:this.getAttr("widthFactor"),obliqueAngle:this.getAttr("obliqueAngle"),textGenerationFlag:this.getAttr("textGenerationFlag"),lastHeight:this.getAttr("lastHeight"),font:this.getAttr("font"),bigFont:this.getAttr("bigFont"),extendedFont:this.getAttrWithoutException("extendedFont")}}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const n=e.lastIndexOf(".");return n===-1?e:e.substring(0,n)}return t}get dxfFontFileName(){var e;const t=((e=this.fileName)==null?void 0:e.trim())??"";return!t||!this.isShapeFile||/\.[^./\\]+$/i.test(t)?t:`${t}.shx`}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.getAttr("standardFlag")),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.getAttr("textGenerationFlag")),t.writeDouble(42,this.priorSize),t.writeString(3,this.dxfFontFileName),t.writeString(4,this.bigFontFileName),this}}var x=(i=>(i[i.EndPoint=1]="EndPoint",i[i.MidPoint=2]="MidPoint",i[i.Center=3]="Center",i[i.Node=4]="Node",i[i.Quadrant=5]="Quadrant",i[i.Insertion=7]="Insertion",i[i.Perpendicular=8]="Perpendicular",i[i.Tangent=9]="Tangent",i[i.Nearest=10]="Nearest",i[i.Centroid=11]="Centroid",i))(x||{});function Fu(i){let t=0;for(const e of i)t|=1<<e-1;return t}function zu(i){const t=[];for(const e of Object.values(x)){if(typeof e!="number")continue;const n=1<<e-1;i&n&&t.push(e)}return t}function Vu(i,t){return i^1<<t-1}function ju(i,t){return(i&1<<t-1)!==0}function Du(i,t){return i|1<<t-1}function Gu(i,t){return i&~(1<<t-1)}const Hu={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:23},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:24}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:26}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:28},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:29}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:31},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:32}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:34},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:35},{angle:45,originX:.353553391,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:36},{angle:45,originX:.530330086,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:37}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:39},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.3125,-.0625,0,-.0625],sourceLine:40}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:.21875,deltaY:.125,dashes:[.3125,-.0625,0,-.0625],sourceLine:42}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:45}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:47},{angle:135,originX:0,originY:0,deltaX:.25,deltaY:.125,dashes:[.3125,-.1875],sourceLine:48}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:54},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[8,-8],sourceLine:55}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:57},{angle:0,originX:-8,originY:.375,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:58},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:59},{angle:90,originX:-.375,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:60}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:62},{angle:90,originX:0,originY:0,deltaX:8,deltaY:4,dashes:[8,-8],sourceLine:63}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:65},{angle:0,originX:0,originY:2.25,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:66},{angle:0,originX:2,originY:2.667,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:67},{angle:0,originX:2,originY:4.917,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:68},{angle:90,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:69},{angle:90,originX:-.375,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:70},{angle:90,originX:2,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:71},{angle:90,originX:1.625,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:72}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:2.667,dashes:[],sourceLine:74},{angle:90,originX:0,originY:0,deltaX:2.667,deltaY:4,dashes:[2.667,-2.667],sourceLine:75}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:77},{angle:355,originX:0,originY:0,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:78},{angle:100.45144446,originX:.59771681,originY:-.05229344,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.63740192,-7.01142112],sourceLine:79},{angle:46.1842,originX:0,originY:2,deltaX:6.19462554,deltaY:-8.84684596,dashes:[1.125,-12.375],sourceLine:80},{angle:96.63563549,originX:.88936745,originY:1.86206693,deltaX:8.59588239,deltaY:-10.40964966,dashes:[.95610342,-10.5171376],sourceLine:81},{angle:351.18416399,originX:0,originY:2,deltaX:7.74327494,deltaY:11.05855746,dashes:[.9,-9.90000001],sourceLine:82},{angle:21,originX:1,originY:1.5,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:83},{angle:326,originX:1,originY:1.5,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:84},{angle:71.45144474,originX:1.49742254,originY:1.16448426,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.6374019,-7.01142112],sourceLine:85},{angle:37.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-6.52,0,-6.7,0,-6.625],sourceLine:86},{angle:7.5,originX:0,originY:0,deltaX:3.123,deltaY:3.567,dashes:[0,-3.82,0,-6.37,0,-2.525],sourceLine:87},{angle:-32.5,originX:-2.23,originY:0,deltaX:4.6234,deltaY:2.678,dashes:[0,-2.5,0,-7.8,0,-10.35],sourceLine:88},{angle:-42.5,originX:-3.23,originY:0,deltaX:3.6234,deltaY:4.678,dashes:[0,-3.25,0,-5.18,0,-7.35],sourceLine:89}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:4,deltaY:4,dashes:[12,-4],sourceLine:91},{angle:135,originX:2.828427125,originY:2.828427125,deltaX:4,deltaY:-4,dashes:[12,-4],sourceLine:92}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:94},{angle:90,originX:2,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:95},{angle:90,originX:4,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:96},{angle:90,originX:6,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:97},{angle:90,originX:8,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:98},{angle:90,originX:10,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:99},{angle:90,originX:12,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:100},{angle:0,originX:0,originY:12,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:101},{angle:0,originX:0,originY:14,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:102},{angle:0,originX:0,originY:16,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:103},{angle:0,originX:0,originY:18,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:104},{angle:0,originX:0,originY:20,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:105},{angle:0,originX:0,originY:22,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:106},{angle:0,originX:0,originY:24,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:107}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:2.2,deltaY:1,dashes:[15,-2,5,-1],sourceLine:109},{angle:0,originX:1.33,originY:.5,deltaX:-1,deltaY:1.33,dashes:[3,-.33,6,-.75],sourceLine:110},{angle:0,originX:.5,originY:.85,deltaX:5.2,deltaY:.67,dashes:[8,-1.4,4,-1],sourceLine:111}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:25.5,deltaY:12,dashes:[6,-5,7,-3,9,-4],sourceLine:113},{angle:0,originX:6,originY:.5,deltaX:25.5,deltaY:12,dashes:[5,-19,4,-6],sourceLine:114},{angle:0,originX:18,originY:-.75,deltaX:25.5,deltaY:12,dashes:[3,-31],sourceLine:115},{angle:90,originX:0,originY:0,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:116},{angle:90,originX:6,originY:0,deltaX:12,deltaY:8.5,dashes:[11.25,-36.75],sourceLine:117},{angle:90,originX:11,originY:0,deltaX:12,deltaY:8.5,dashes:[10.5,-37.5],sourceLine:118},{angle:90,originX:18,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:119},{angle:90,originX:21,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:120},{angle:90,originX:30,originY:0,deltaX:12,deltaY:8.5,dashes:[11,-37],sourceLine:121}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:1.123,deltaY:1.567,dashes:[0,-1.52,0,-1.7,0,-1.625],sourceLine:123},{angle:7.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-.82,0,-1.37,0,-.525],sourceLine:124},{angle:-32.5,originX:-1.23,originY:0,deltaX:2.6234,deltaY:1.678,dashes:[0,-.5,0,-1.8,0,-2.35],sourceLine:125},{angle:-42.5,originX:-1.23,originY:0,deltaX:1.6234,deltaY:2.678,dashes:[0,-.25,0,-1.18,0,-1.35],sourceLine:126}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:128},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:129},{angle:0,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:130},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:131},{angle:0,originX:0,originY:.5,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:132},{angle:0,originX:0,originY:.75,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:133},{angle:90,originX:.5,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:134},{angle:90,originX:.75,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:135}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:137},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:138}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:140},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.5,dashes:[.25,-.25],sourceLine:141},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:.5,dashes:[-.25,.25],sourceLine:142}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.33,dashes:[],sourceLine:144},{angle:90,originX:.9,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:145},{angle:90,originX:.8,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:146},{angle:0,originX:.9,originY:.055,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:147},{angle:0,originX:.9,originY:.11,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:148},{angle:0,originX:.9,originY:.165,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:149},{angle:0,originX:.9,originY:.22,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:150},{angle:0,originX:.9,originY:.275,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:151}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.1875,dashes:[],sourceLine:153},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.1875,dashes:[],sourceLine:154},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.1875,dashes:[],sourceLine:155},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.1875,dashes:[.1875,-.125],sourceLine:156}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:158},{angle:135,originX:.0625,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:159},{angle:135,originX:.09375,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:160},{angle:135,originX:.125,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:161}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:163},{angle:90,originX:.0625,originY:-.0625,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:164}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:166}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:168},{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[.3535533905932738,-.7071067811865476],sourceLine:169}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.03125,deltaY:.0625,dashes:[0,-.0625],sourceLine:171}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:173},{angle:0,originX:0,originY:.09375,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:174},{angle:0,originX:0,originY:.1875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:175},{angle:90,originX:.03125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:176},{angle:90,originX:.125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:177},{angle:90,originX:.21875,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:178}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:180},{angle:180,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:181},{angle:300,originX:0,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:182},{angle:60,originX:.1,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:183},{angle:300,originX:.1,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:184},{angle:60,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:185},{angle:180,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:186},{angle:300,originX:-.05,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:187},{angle:180,originX:-.05,originY:-.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:188},{angle:60,originX:-.4,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:189},{angle:300,originX:-.4,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:190},{angle:60,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:191},{angle:180,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:192},{angle:300,originX:.2,originY:.346410161,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:193},{angle:180,originX:.2,originY:.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:194},{angle:0,originX:.2,originY:.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:195},{angle:0,originX:.2,originY:-.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:196},{angle:120,originX:.05,originY:.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:197},{angle:120,originX:-.25,originY:.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:198},{angle:240,originX:-.25,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:199},{angle:240,originX:.05,originY:-.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:200}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[.25,-.25],sourceLine:202},{angle:45,originX:.25,originY:0,deltaX:.176776695296,deltaY:.176776695296,dashes:[.0625,-.2285533906,.0625,-.353553390593],sourceLine:203}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:205},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:206},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:207}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:209},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:210},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:211}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:213},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:214},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:215}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:.707106781,deltaY:.707106781,dashes:[.1875,-1.226713563],sourceLine:217},{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:218},{angle:135,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:219}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.03125,dashes:[],sourceLine:221},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:222}]},{name:"GRAVEL",description:"",lines:[{angle:228.012787504,originX:.72,originY:1,deltaX:12.0413651692039,deltaY:.0743294146632,dashes:[.134536,-13.3190880470737],sourceLine:224},{angle:184.969740728,originX:.63,originY:.9,deltaX:-12.0415166747131,deltaY:.0433148081592,dashes:[.230868,-22.85592476123],sourceLine:225},{angle:132.510447078,originX:.4,originY:.88,deltaX:-14.8659418273816,deltaY:.061429511683,dashes:[.162788,-16.1160325960997],sourceLine:226},{angle:267.273689006,originX:.01,originY:.63,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:227},{angle:292.833654178,originX:0,originY:.42,deltaX:-12.9999095019474,deltaY:.048507125026,dashes:[.206155,-20.4093731280883],sourceLine:228},{angle:357.273689006,originX:.08,originY:.23,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:229},{angle:37.6942404667,originX:.29,originY:.22,deltaX:-16.4011800288558,deltaY:.0359675000664,dashes:[.278029,-27.524848548916],sourceLine:230},{angle:72.2553283749,originX:.51,originY:.39,deltaX:23.0867613281116,deltaY:.0380969659053,dashes:[.262488,-25.9863214968134],sourceLine:231},{angle:121.429565615,originX:.59,originY:.64,deltaX:15.2642639131074,deltaY:.047404546271,dashes:[.21095,-20.884073109729],sourceLine:232},{angle:175.236358309,originX:.48,originY:.82,deltaX:-11.0450488205478,deltaY:.083045479801,dashes:[.240832,-11.8007625787923],sourceLine:233},{angle:222.397437798,originX:.24,originY:.84,deltaX:16.2787889313724,deltaY:.0321080648114,dashes:[.311448,-30.8333750047949],sourceLine:234},{angle:138.814074834,originX:1,originY:.62,deltaX:9.2190645101588,deltaY:.0940720868851,dashes:[.106301,-10.5238448127347],sourceLine:235},{angle:171.46923439,originX:.92,originY:.69,deltaX:-13.1528534931484,deltaY:.0494468176315,dashes:[.202237,-20.021511416157],sourceLine:236},{angle:225,originX:.72,originY:.72,deltaX:.7071067811865,deltaY:.7071067811865,dashes:[.141421,-1.2727925623731],sourceLine:237},{angle:203.198590514,originX:.65,originY:.84,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.076158,-7.5396151058639],sourceLine:238},{angle:291.801409486,originX:.58,originY:.81,deltaX:-3.156820749011,deltaY:.185695338158,dashes:[.107703,-5.2774618071345],sourceLine:239},{angle:30.9637565321,originX:.62,originY:.71,deltaX:3.6014702879928,deltaY:.1714985851408,dashes:[.174929,-5.6560228948453],sourceLine:240},{angle:161.565051177,originX:.77,originY:.8,deltaX:-2.2135943621183,deltaY:.3162277660138,dashes:[.126491,-3.0357866601684],sourceLine:241},{angle:16.389540334,originX:0,originY:.81,deltaX:10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.5428451466694],sourceLine:242},{angle:70.3461759419,originX:.17,originY:.86,deltaX:-11.7045066155395,deltaY:.0672672793901,dashes:[.148661,-14.717407747319],sourceLine:243},{angle:293.198590514,originX:.77,originY:1,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.152315,-7.4634581058639],sourceLine:244},{angle:343.610459666,originX:.83,originY:.86,deltaX:-10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.542845146669],sourceLine:245},{angle:339.44395478,originX:0,originY:.19,deltaX:-5.3838927710229,deltaY:.117041147157,dashes:[.17088,-8.3731237453175],sourceLine:246},{angle:294.775140569,originX:.16,originY:.13,deltaX:-12.0828441168135,deltaY:.0698430296124,dashes:[.143178,-14.174643063276],sourceLine:247},{angle:66.8014094864,originX:.78,originY:0,deltaX:5.3835637472487,deltaY:.1313064328552,dashes:[.152315,-7.4634581058639],sourceLine:248},{angle:17.3540246363,originX:.84,originY:.14,deltaX:-13.6013396869991,deltaY:.0596549986364,dashes:[.167631,-16.59542361424],sourceLine:249},{angle:69.4439547804,originX:.29,originY:0,deltaX:-5.383892771022,deltaY:.1170411471946,dashes:[.08544,-8.4585637453175],sourceLine:250},{angle:101.309932474,originX:.72,originY:0,deltaX:4.1184388379018,deltaY:.1961161351396,dashes:[.05099,-5.0480295135928],sourceLine:251},{angle:165.963756532,originX:.71,originY:.05,deltaX:-3.1529631254726,deltaY:.2425356250323,dashes:[.206155,-3.9169506256177],sourceLine:252},{angle:186.009005957,originX:.51,originY:.1,deltaX:-10.0497393137326,deltaY:.0523423921723,dashes:[.19105,-18.9139231745428],sourceLine:253},{angle:303.690067526,originX:.62,originY:.62,deltaX:-2.2188007849008,deltaY:.2773500981134,dashes:[.144222,-3.461329275464],sourceLine:254},{angle:353.157226587,originX:.7,originY:.5,deltaX:17.1171966955143,deltaY:.0397150736497,dashes:[.251794,-24.9275626240283],sourceLine:255},{angle:60.9453959009,originX:.95,originY:.47,deltaX:-8.0616726575653,deltaY:.0971285862325,dashes:[.102956,-10.192674140987],sourceLine:256},{angle:90,originX:1,originY:.56,deltaX:1,deltaY:1,dashes:[.06,-.94],sourceLine:257},{angle:120.256437164,originX:.49,originY:.13,deltaX:-8.0619364083848,deltaY:.0719815751411,dashes:[.138924,-13.7535199894498],sourceLine:258},{angle:48.0127875042,originX:.42,originY:.25,deltaX:12.0413651692041,deltaY:.0743294146212,dashes:[.269072,-13.1845520470737],sourceLine:259},{angle:0,originX:.6,originY:.45,deltaX:1,deltaY:1,dashes:[.26,-.74],sourceLine:260},{angle:325.304846469,originX:.86,originY:.45,deltaX:12.2063917682497,deltaY:-.063245553253,dashes:[.158114,-15.653274300842],sourceLine:261},{angle:254.054604099,originX:.99,originY:.36,deltaX:4.1208169184605,deltaY:.1373605639542,dashes:[.145602,-7.1345078892805],sourceLine:262},{angle:207.645975364,originX:.95,originY:.22,deltaX:21.4708691170287,deltaY:.0421824539631,dashes:[.237065,-23.4694741822594],sourceLine:263},{angle:175.42607874,originX:.74,originY:.11,deltaX:13.0383438432524,deltaY:.039872611164,dashes:[.250799,-24.8290734079689],sourceLine:264}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:266},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:267},{angle:60,originX:.125,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:268}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:270},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:271},{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[-.25,.125],sourceLine:272}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.0625,dashes:[1,-.5],sourceLine:274},{angle:90,originX:0,originY:0,deltaX:-.25,deltaY:.0625,dashes:[1,-.5],sourceLine:275}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:277},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:278},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:279}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:292}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:294}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:296}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:298}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:300},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:301}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:303}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:305}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:307}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:309}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:311}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:313}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:315},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:316}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:318},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:319}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:321},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:322}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:327}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.25,dashes:[.25,-.25,0,-.25,0,-.25],sourceLine:329}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:331},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:332}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:334},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:335},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:336}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:338},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:339},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:340}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:342},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:343},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:344},{angle:0,originX:0,originY:.15625,deltaX:0,deltaY:.25,dashes:[],sourceLine:345}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.09375,dashes:[],sourceLine:347},{angle:45,originX:.066291261,originY:0,deltaX:0,deltaY:.09375,dashes:[0,-.09375],sourceLine:348}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:350},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:351}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:353},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:354},{angle:120,originX:.0625,originY:.108253176,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:355}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:357},{angle:45,originX:0,originY:.0625,deltaX:0,deltaY:.125,dashes:[],sourceLine:358}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.125,-.875],sourceLine:360},{angle:90,originX:.0625,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.0625,-1.669550806],sourceLine:361},{angle:90,originX:.078125,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:362},{angle:90,originX:.046875,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:363},{angle:60,originX:.09375,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:364},{angle:120,originX:.03125,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:365}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:367},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.125],sourceLine:368}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:370},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:371},{angle:0,originX:-.09375,originY:.162379763,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:372}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:374},{angle:90,originX:.125,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:375}]}],issues:[]},el={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:20},{angle:90,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:21}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:23}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:25},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:26}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:28},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:29}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:31},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:32},{angle:45,originX:8.98026,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:33},{angle:45,originX:13.4704,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:34}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:36},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:37}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:5.55625,deltaY:3.175,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:39}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:41},{angle:135,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:42}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:6.35,deltaY:3.175,dashes:[7.9375,-4.7625],sourceLine:45}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:47},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[203.2,-203.2],sourceLine:48}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:50},{angle:0,originX:-203.2,originY:9.525,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:51},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:52},{angle:90,originX:-9.525,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:53}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:55},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:101.6,dashes:[203.2,-203.2],sourceLine:56}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:58},{angle:0,originX:0,originY:57.15,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:59},{angle:0,originX:50.8,originY:67.7418,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:60},{angle:0,originX:50.8,originY:124.892,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:61},{angle:90,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:62},{angle:90,originX:-9.525,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:63},{angle:90,originX:50.8,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:64},{angle:90,originX:41.275,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:65}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:67.7418,dashes:[],sourceLine:67},{angle:90,originX:0,originY:0,deltaX:67.7418,deltaY:101.6,dashes:[67.7418,-67.7418],sourceLine:68}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:104.896,deltaY:-149.807,dashes:[19.05,-209.55],sourceLine:70},{angle:355,originX:0,originY:0,deltaX:-51.76101082,deltaY:187.25814969,dashes:[15.24,-167.64058417],sourceLine:71},{angle:100.4514447,originX:15.182007,originY:-1.3282535,deltaX:145.5569059,deltaY:-176.270089,dashes:[16.1900088,-178.0902446],sourceLine:72},{angle:46.1842,originX:0,originY:50.8,deltaX:157.343,deltaY:-224.71,dashes:[28.575,-314.325],sourceLine:73},{angle:96.63555761,originX:22.5899,originY:47.2965,deltaX:218.33577212,deltaY:-264.40480444,dashes:[24.28502314,-267.13560816],sourceLine:74},{angle:351.18415117,originX:0,originY:50.8,deltaX:196.67912063,deltaY:280.88740361,dashes:[22.85996707,-251.45973192],sourceLine:75},{angle:21,originX:25.4,originY:38.1,deltaX:104.89565868,deltaY:-149.80652586,dashes:[19.05,-209.55],sourceLine:76},{angle:326,originX:25.4,originY:38.1,deltaX:-51.7604,deltaY:187.258,dashes:[15.24,-167.64],sourceLine:77},{angle:71.451445,originX:38.0345326,originY:29.5779001,deltaX:145.5567546,deltaY:-176.2700748,dashes:[16.1900088,-178.0899376],sourceLine:78},{angle:37.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-165.608,0,-170.18,0,-168.275],sourceLine:79},{angle:7.5,originX:0,originY:0,deltaX:79.3242,deltaY:90.6018,dashes:[0,-97.028,0,-161.798,0,-64.135],sourceLine:80},{angle:-32.5,originX:-56.642,originY:0,deltaX:117.434,deltaY:68.0212,dashes:[0,-63.5,0,-198.12,0,-262.89],sourceLine:81},{angle:-42.5,originX:-82.042,originY:0,deltaX:92.0344,deltaY:118.821,dashes:[0,-82.55,0,-131.572,0,-186.69],sourceLine:82}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:101.6,deltaY:101.6,dashes:[304.8,-101.6],sourceLine:84},{angle:135,originX:71.842,originY:71.842,deltaX:101.6,deltaY:-101.6,dashes:[304.8,-101.6],sourceLine:85}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:87},{angle:90,originX:50.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:88},{angle:90,originX:101.6,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:89},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:90},{angle:90,originX:203.2,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:91},{angle:90,originX:254,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:92},{angle:90,originX:304.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:93},{angle:0,originX:0,originY:304.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:94},{angle:0,originX:0,originY:355.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:95},{angle:0,originX:0,originY:406.4,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:96},{angle:0,originX:0,originY:457.2,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:97},{angle:0,originX:0,originY:508,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:98},{angle:0,originX:0,originY:558.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:99},{angle:0,originX:0,originY:609.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:100}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:55.88,deltaY:25.4,dashes:[381,-50.8,127,-25.4],sourceLine:102},{angle:0,originX:33.782,originY:12.7,deltaX:-25.4,deltaY:33.782,dashes:[76.2,-8.382,152.4,-19.05],sourceLine:103},{angle:0,originX:12.7,originY:21.59,deltaX:132.08,deltaY:17.018,dashes:[203.2,-35.56,101.6,-25.4],sourceLine:104}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:647.7,deltaY:304.8,dashes:[152.4,-127,177.8,-76.2,228.6,-101.6],sourceLine:106},{angle:0,originX:152.4,originY:12.7,deltaX:647.7,deltaY:304.8,dashes:[127,-482.6,101.6,-152.4],sourceLine:107},{angle:0,originX:457.2,originY:-19.05,deltaX:647.7,deltaY:304.8,dashes:[76.2,-787.4],sourceLine:108},{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:109},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[285.75,-933.45],sourceLine:110},{angle:90,originX:279.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[266.7,-952.5],sourceLine:111},{angle:90,originX:457.2,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:112},{angle:90,originX:533.4,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:113},{angle:90,originX:762,originY:0,deltaX:304.8,deltaY:215.9,dashes:[279.4,-939.8],sourceLine:114}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:28.5242,deltaY:39.8018,dashes:[0,-38.608,0,-43.18,0,-41.275],sourceLine:116},{angle:7.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-20.828,0,-34.798,0,-13.335],sourceLine:117},{angle:-32.5,originX:-31.242,originY:0,deltaX:66.6344,deltaY:42.6212,dashes:[0,-12.7,0,-45.72,0,-59.69],sourceLine:118},{angle:-42.5,originX:-31.242,originY:0,deltaX:41.2344,deltaY:68.0212,dashes:[0,-6.35,0,-29.972,0,-34.29],sourceLine:119}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:121},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:122},{angle:0,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:123},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:124},{angle:0,originX:0,originY:12.7,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:125},{angle:0,originX:0,originY:19.05,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:126},{angle:90,originX:12.7,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:127},{angle:90,originX:19.05,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:128}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:130},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:131}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:133},{angle:90,originX:0,originY:0,deltaX:0,deltaY:12.7,dashes:[6.35,-6.35],sourceLine:134},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:12.7,dashes:[-6.35,6.35],sourceLine:135}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8.382,dashes:[],sourceLine:137},{angle:90,originX:22.86,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:138},{angle:90,originX:20.32,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:139},{angle:0,originX:22.86,originY:1.397,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:140},{angle:0,originX:22.86,originY:2.794,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:141},{angle:0,originX:22.86,originY:4.191,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:142},{angle:0,originX:22.86,originY:5.588,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:143},{angle:0,originX:22.86,originY:6.985,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:144}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:146},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:147},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:148},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:4.7625,dashes:[4.7625,-3.175],sourceLine:149}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:151},{angle:135,originX:1.5875,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:152},{angle:135,originX:2.38125,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:153},{angle:135,originX:3.175,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:154}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:156},{angle:90,originX:1.5875,originY:-1.5875,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:157}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:159}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:161},{angle:45,originX:0,originY:0,deltaX:0,deltaY:17.9605,dashes:[8.980256121069154,-17.960512242138307],sourceLine:162}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.79375,deltaY:1.5875,dashes:[0,-1.5875],sourceLine:164}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:166},{angle:0,originX:0,originY:2.38125,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:167},{angle:0,originX:0,originY:4.7625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:168},{angle:90,originX:.79375,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:169},{angle:90,originX:3.175,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:170},{angle:90,originX:5.55625,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:171}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:173},{angle:180,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:174},{angle:300,originX:0,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:175},{angle:60,originX:2.54,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:176},{angle:300,originX:2.54,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:177},{angle:60,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:178},{angle:180,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:179},{angle:300,originX:-1.27,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:180},{angle:180,originX:-1.27,originY:-2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:181},{angle:60,originX:-10.16,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:182},{angle:300,originX:-10.16,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:183},{angle:60,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:184},{angle:180,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:185},{angle:300,originX:5.08,originY:8.7988180894,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:186},{angle:180,originX:5.08,originY:8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:187},{angle:0,originX:5.08,originY:4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:188},{angle:0,originX:5.08,originY:-4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:189},{angle:120,originX:1.27,originY:6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:190},{angle:120,originX:-6.35,originY:2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:191},{angle:240,originX:-6.35,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:192},{angle:240,originX:1.27,originY:-6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:193}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:195},{angle:45,originX:6.35,originY:0,deltaX:4.490128053,deltaY:4.490128053,dashes:[1.5875,-5.8052561314,1.5875,-8.9802561314],sourceLine:196}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:198},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:199},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:200}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:202},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:203},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:204}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:206},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:207},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:208}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:17.96051224,deltaY:17.96051224,dashes:[4.7625,-31.15852448],sourceLine:210},{angle:45,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:211},{angle:135,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:212}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.79375,dashes:[],sourceLine:214},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:215}]},{name:"GRAVEL",description:"",lines:[{angle:228.0127875,originX:18.288,originY:25.4,deltaX:305.85067529778,deltaY:1.88796713245,dashes:[3.4172144,-338.30483639565],sourceLine:217},{angle:184.969741,originX:16.002,originY:22.86,deltaX:-305.8545235377,deltaY:1.10019612724,dashes:[5.8640472,-580.54048893524],sourceLine:218},{angle:132.5104471,originX:10.16,originY:22.352,deltaX:-377.59492241548,deltaY:1.56030959675,dashes:[4.1348152,-409.347227941],sourceLine:219},{angle:267.273689,originX:.254,originY:16.002,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:220},{angle:292.83365418,originX:0,originY:10.668,deltaX:-330.19770134945,deltaY:1.23208097566,dashes:[5.236337,-518.39807745344],sourceLine:221},{angle:357.273689,originX:2.032,originY:5.842,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:222},{angle:37.69424047,originX:7.366,originY:5.588,deltaX:-416.58997273292,deltaY:.91357450169,dashes:[7.0619366,-699.13115314247],sourceLine:223},{angle:72.25532837,originX:12.954,originY:9.906,deltaX:586.40373773403,deltaY:.96766293399,dashes:[6.6671952,-660.05256601905],sourceLine:224},{angle:121.42956562,originX:14.986,originY:16.256,deltaX:387.71230339293,deltaY:1.2040754753,dashes:[5.35813,-530.45545698712],sourceLine:225},{angle:175.2363583,originX:12.192,originY:20.828,deltaX:-280.5442400419,deltaY:2.10935518695,dashes:[6.1171328,-299.7393695],sourceLine:226},{angle:222.3974378,originX:6.096,originY:21.336,deltaX:413.48123885686,deltaY:.81554484621,dashes:[7.9107792,-783.16772512177],sourceLine:227},{angle:138.81407483,originX:25.4,originY:15.748,deltaX:234.164238558,deltaY:2.38943100688,dashes:[2.7000454,-267.30565824344],sourceLine:228},{angle:171.4692344,originX:23.368,originY:17.526,deltaX:-334.082478726,deltaY:1.25594916784,dashes:[5.1368198,-508.5463899704],sourceLine:229},{angle:225,originX:18.288,originY:18.288,deltaX:17.96051224214,deltaY:17.96051224214,dashes:[3.5920934,-32.32893108428],sourceLine:230},{angle:203.19859051,originX:16.51,originY:21.336,deltaX:-136.74251918,deltaY:3.33518339548,dashes:[1.9344132,-191.50622368894],sourceLine:231},{angle:291.80140949,originX:14.732,originY:20.574,deltaX:-80.18324702488,deltaY:4.71666158921,dashes:[2.7356562,-134.0475299],sourceLine:232},{angle:30.96375653,originX:15.748,originY:18.034,deltaX:91.47734531502,deltaY:4.35606406258,dashes:[4.4431966,-143.6629815291],sourceLine:233},{angle:161.56505118,originX:19.558,originY:20.32,deltaX:-56.2252967978,deltaY:8.03218525675,dashes:[3.2128714,-77.10898116828],sourceLine:234},{angle:16.389540334,originX:0,originY:20.574,deltaX:265.17991128726,deltaY:1.43340492604,dashes:[4.50088,-445.58826672539],sourceLine:235},{angle:70.34617594,originX:4.318,originY:21.844,deltaX:-297.29446803469,deltaY:1.70858889651,dashes:[3.7759894,-373.822156782],sourceLine:236},{angle:293.19859051,originX:19.558,originY:25.4,deltaX:-136.7425191801,deltaY:3.33518339548,dashes:[3.868801,-189.57183588894],sourceLine:237},{angle:343.61045967,originX:21.082,originY:21.844,deltaX:-265.17991128725,deltaY:1.433404926,dashes:[4.50088,-445.5882667254],sourceLine:238},{angle:339.44395478,originX:0,originY:4.826,deltaX:-136.75087638398,deltaY:2.97284513779,dashes:[4.340352,-212.67734313106],sourceLine:239},{angle:294.7751406,originX:4.064,originY:3.302,deltaX:-306.90424056705,deltaY:1.77401295215,dashes:[3.6367212,-360.0359338072],sourceLine:240},{angle:66.80140949,originX:19.812,originY:0,deltaX:136.74251918012,deltaY:3.33518339452,dashes:[3.868801,-189.57183588894],sourceLine:241},{angle:17.35402464,originX:21.336,originY:3.556,deltaX:-345.47402804977,deltaY:1.51523696536,dashes:[4.2578274,-421.523759802],sourceLine:242},{angle:69.44395478,originX:7.366,originY:0,deltaX:-136.75087638396,deltaY:2.97284513874,dashes:[2.170176,-214.84751913106],sourceLine:243},{angle:101.309932474,originX:18.288,originY:0,deltaX:104.60834648271,deltaY:4.98134983255,dashes:[1.295146,-128.21994964526],sourceLine:244},{angle:165.963756532,originX:18.034,originY:1.27,deltaX:-80.085263387,deltaY:6.16040487582,dashes:[5.236337,-99.49054589069],sourceLine:245},{angle:186.00900596,originX:12.954,originY:2.54,deltaX:-255.26337856879,deltaY:1.32949676118,dashes:[4.85267,-480.41364863337],sourceLine:246},{angle:303.69006753,originX:15.748,originY:15.748,deltaX:-56.35753993648,deltaY:7.0446924921,dashes:[3.6632388,-87.9177635968],sourceLine:247},{angle:353.15722659,originX:17.78,originY:12.7,deltaX:434.77679606606,deltaY:1.0087628707,dashes:[6.3955676,-633.16009065031],sourceLine:248},{angle:60.9453959,originX:24.13,originY:11.938,deltaX:-204.76648550216,deltaY:2.46706609031,dashes:[2.6150824,-258.8939231811],sourceLine:249},{angle:90,originX:25.4,originY:14.224,deltaX:25.4,deltaY:25.4,dashes:[1.524,-23.876],sourceLine:250},{angle:120.25643716,originX:12.446,originY:3.302,deltaX:-204.77318477297,deltaY:1.8283320086,dashes:[3.5286696,-349.339407732],sourceLine:251},{angle:48.0127875,originX:10.668,originY:6.35,deltaX:305.85067529778,deltaY:1.88796713138,dashes:[6.8344288,-334.88762199565],sourceLine:252},{angle:0,originX:15.24,originY:11.43,deltaX:25.4,deltaY:25.4,dashes:[6.604,-18.796],sourceLine:253},{angle:325.3048465,originX:21.844,originY:11.43,deltaX:310.04235091354,deltaY:-1.6064370526,dashes:[4.0160956,-397.5931672414],sourceLine:254},{angle:254.0546041,originX:25.146,originY:9.144,deltaX:104.6687497289,deltaY:3.48895832444,dashes:[3.6982908,-181.21650038772],sourceLine:255},{angle:207.64597536,originX:24.13,originY:5.588,deltaX:545.36007557253,deltaY:1.07143433066,dashes:[6.021451,-596.12464422938],sourceLine:256},{angle:175.42607874,originX:18.796,originY:2.794,deltaX:331.1739336186,deltaY:1.01276432357,dashes:[6.3702946,-630.6584645624],sourceLine:257}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:259},{angle:120,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:260},{angle:60,originX:3.175,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:261}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:263},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:264},{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[-6.35,3.175],sourceLine:265}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:267},{angle:90,originX:0,originY:0,deltaX:-6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:268}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:270},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:271},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:272}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:285}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:287}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:289}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:291}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:293},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:294}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:296}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:298}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:300}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:302}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:304}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:306}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:308},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:309}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:311},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:312}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:314},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:315}]},{name:"JIS_LC_20",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:322},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:323}]},{name:"JIS_LC_20A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:325},{angle:45,originX:1,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:326}]},{name:"JIS_LC_8",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:328},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:329}]},{name:"JIS_LC_8A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:331},{angle:45,originX:1,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:332}]},{name:"JIS_RC_10",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:334},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:335},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:336}]},{name:"JIS_RC_15",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:338},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:339},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:340}]},{name:"JIS_RC_18",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:342},{angle:45,originX:1,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:343},{angle:45,originX:2,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:344}]},{name:"JIS_RC_30",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:346},{angle:45,originX:1,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:347},{angle:45,originX:2,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:348}]},{name:"JIS_STN_1E",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:350},{angle:45,originX:.705,originY:0,deltaX:0,deltaY:1,dashes:[1,-.5],sourceLine:351}]},{name:"JIS_STN_2.5",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.5,dashes:[],sourceLine:353},{angle:45,originX:1.765,originY:0,deltaX:0,deltaY:2.5,dashes:[1.2,-.5],sourceLine:354}]},{name:"JIS_WOOD",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[],sourceLine:356}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:359}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:6.35,dashes:[6.35,-6.35,0,-6.35,0,-6.35],sourceLine:361}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:363},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:364}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:366},{angle:60,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:367},{angle:120,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:368}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:370},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:371},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:372}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:374},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:375},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:376},{angle:0,originX:0,originY:3.96875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:377}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.38125,dashes:[],sourceLine:379},{angle:45,originX:1.6838,originY:0,deltaX:0,deltaY:2.38125,dashes:[0,-2.38125],sourceLine:380}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:382},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:383}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:385},{angle:60,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:386},{angle:120,originX:1.5875,originY:2.7496306704,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:387}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:389},{angle:45,originX:0,originY:1.5875,deltaX:0,deltaY:3.175,dashes:[],sourceLine:390}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[3.175,-22.225],sourceLine:392},{angle:90,originX:1.5875,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.5875,-42.4065904724],sourceLine:393},{angle:90,originX:1.984375,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:394},{angle:90,originX:1.190625,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:395},{angle:60,originX:2.38125,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:396},{angle:120,originX:.79375,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:397}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:399},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-3.175],sourceLine:400}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:402},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:403},{angle:0,originX:-2.38125,originY:4.1244459802,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:404}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:406},{angle:90,originX:3.175,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:407}]}],issues:[]};function Z(i,t){for(const e of i)Number.isInteger(e)&&e>=0&&t(e)}function Ot(i,t,e){Z(i,n=>{n===0&&e.add(t)})}function qe(i,t,e){const n=i[t];n&&(n.x+=e.x,n.y+=e.y)}function fn(i,t,e){Z(i,n=>{const r=e[n];r&&r.add(t)})}function lo(i,t){const e=i.x-t.x,n=i.y-t.y,r=(i.z||0)-(t.z||0);return e*e+n*n+r*r}function wt(i,t){if(t.length===0)return;let e=new y(t[0].x,t[0].y,t[0].z||0),n=lo(i,e);for(let r=1;r<t.length;r++){const s=t[r],o=new y(s.x,s.y,s.z||0),a=lo(i,o);a<n&&(e=o,n=a)}return e}function ze(i,t,e,n,r){const s=new y(i.x,i.y,i.z||0),o=new y(t.x,t.y,t.z||0),a=new Ft(s,o);switch(e){case x.EndPoint:r.push(s,o);break;case x.MidPoint:r.push(a.midPoint);break;case x.Nearest:r.push(a.nearestPoint(n));break;case x.Perpendicular:r.push(a.perpPoint(n));break}}function sn(i,t,e,n,r,s,o){if(e){const a=new ht(i,t,e);switch(r){case x.EndPoint:o.push(new y(a.startPoint.x,a.startPoint.y,n),new y(a.endPoint.x,a.endPoint.y,n));break;case x.MidPoint:o.push(new y(a.midPoint.x,a.midPoint.y,n));break;case x.Nearest:{const l=a.nearestPoint({x:s.x,y:s.y});o.push(new y(l.x,l.y,n));break}case x.Perpendicular:{a.perpendicularPoints({x:s.x,y:s.y}).forEach(h=>o.push(new y(h.x,h.y,n)));break}case x.Tangent:{a.tangentPoints({x:s.x,y:s.y}).forEach(h=>o.push(new y(h.x,h.y,n)));break}}return}ze(new y(i.x,i.y,n),new y(t.x,t.y,n),r,s,o)}function Kr(i,t,e,n,r){if(i.length!==0)switch(e){case x.EndPoint:i.forEach(s=>r.push(new y(s.x,s.y,s.z||0)));break;case x.MidPoint:case x.Nearest:case x.Perpendicular:{const s=i.length,o=[];for(let a=0;a<s;a++){const l=[];ze(i[a],i[(a+1)%i.length],e,n,l),o.push(...l)}if(e===x.MidPoint)r.push(...o);else{const a=wt(n,o);a&&r.push(a)}break}}}var Ke=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(Ke||{}),nl=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(nl||{}),il=(i=>(i[i.HatchObject=0]="HatchObject",i[i.GradientObject=1]="GradientObject",i))(il||{}),rl=(i=>(i[i.PreDefinedGradient=0]="PreDefinedGradient",i[i.UserDefinedGradient=1]="UserDefinedGradient",i))(rl||{});const os=class os extends z{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new kt,this._isSolidFill=!1,this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1,this._patternName="",this._patternNameSet=!1,this._patternType=1,this._patternAngle=0,this._patternAngleSet=!1,this._patternScale=1,this._patternScaleSet=!1,this._associative=!1,this._associativeSet=!1,this._backgroundColor=void 0,this._backgroundColorSet=!1,this._patternDouble=!1,this._patternDoubleSet=!1,this._hatchStyle=0,this._hatchStyleSet=!1,this._hatchObjectType=0,this._gradientAngle=0,this._gradientShift=0,this._shadeTintValue=0,this._gradientStartColor=void 0,this._gradientEndColor=void 0,this._gradientType=0,this._gradientName="",this._gradientOneColorMode=!1}get dxfTypeName(){return"HATCH"}get isGradient(){return this._hatchObjectType===1}get isHatch(){return this._hatchObjectType===0}get isSolidFill(){return this._isSolidFill||this.getEffectivePatternName().trim().toUpperCase()===he}set isSolidFill(t){this._isSolidFill=t}get color(){if(this.hasExplicitColor())return this.getEntityColor();const t=this.database,e=tt.instance().getVar(w.HPCOLOR,t);return e instanceof O&&e.colorMethod!==exports.AcCmColorMethod.None?e.clone():t.cecolor.clone()}set color(t){this.setEntityColor(t)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t??"",this._isSolidFill=this._patternName.trim().toUpperCase()===he,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(t){this._patternType=t,t!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(t){this._associative=!!t,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t==null?void 0:t.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(t){this._patternDouble=!!t,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(t){this._hatchObjectType=t}get gradientAngle(){return this._gradientAngle}set gradientAngle(t){this._gradientAngle=t}get gradientShift(){return this._gradientShift}set gradientShift(t){this._gradientShift=t}get gradientType(){return this._gradientType}set gradientType(t){this._gradientType=t}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?Ea:this._gradientName}set gradientName(t){this._gradientName=t??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(t){this._gradientOneColorMode=t}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(t){this._shadeTintValue=t}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(t){this._gradientStartColor=t==null||!Number.isFinite(t)?void 0:t&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(t){this._gradientEndColor=t==null||!Number.isFinite(t)?void 0:t&16777215}applyPatternDefaultsFromSysVars(t){const e=tt.instance();if(!this.hasExplicitLayer()){const n=e.getVar(w.HPLAYER,t);this.shouldUseSysVarOverride(n)&&(this.layer=n)}if(!this.hasExplicitTransparency()){const n=this.parseHpTransparency(e.getVar(w.HPTRANSPARENCY,t));n&&(this.transparency=n)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(e.getVar(w.HPBACKGROUNDCOLOR,t)),this._backgroundColorSet=!0),!this._patternNameSet){const n=e.getVar(w.HPNAME,t);this._patternName=typeof n=="string"?n:"",this._patternNameSet=!0}if(!this._patternAngleSet){const n=e.getVar(w.HPANG,t);this._patternAngle=typeof n=="number"&&Number.isFinite(n)?n:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(e.getVar(w.HPSCALE,t)),this._patternScaleSet=!0),!this._associativeSet){const n=e.getVar(w.HPASSOC,t);this._associative=typeof n=="number"?n!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(e.getVar(w.HPISLANDDETECTION,t)),this._hatchStyleSet=!0),!this._patternDoubleSet){const n=e.getVar(w.HPDOUBLE,t);this._patternDouble=typeof n=="number"?n!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const t=this.database,e=tt.instance().getVar(w.HPNAME,t);return typeof e=="string"?e:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const t=this.database,e=tt.instance().getVar(w.HPANG,t);return typeof e=="number"&&Number.isFinite(e)?e:this._patternAngle}getRenderablePatternAngle(){return!this._definitionLinesAutoGenerated&&this._definitionLines.length>0?0:this.getEffectivePatternAngle()}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const t=this.database;return this.normalizePatternScale(tt.instance().getVar(w.HPSCALE,t))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const t=this.database,e=tt.instance().getVar(w.HPASSOC,t);return typeof e=="number"?e!==0:this._associative}normalizePatternScale(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}normalizeHatchStyle(t){return typeof t!="number"||!Number.isFinite(t)?1:t===0?0:t===2?2:1}shouldUseSysVarOverride(t){if(typeof t!="string")return!1;const e=t.trim().toLowerCase();return e!==""&&e!=="."&&e!=="use current"}parseHpBackgroundColor(t){if(t instanceof O)return t.colorMethod===exports.AcCmColorMethod.None?void 0:t.clone();if(typeof t!="string")return;const e=t.trim().toLowerCase();if(!(!e||e==="."||e==="none"))return O.fromString(t)}parseHpTransparency(t){if(t instanceof Q)return t.clone();if(!this.shouldUseSysVarOverride(t))return;const e=t.trim();if(/^bylayer$/i.test(e)||/^byblock$/i.test(e))return Q.fromString(e);const n=Number(e);if(Number.isInteger(n)&&n>=0&&n<=90){const r=new Q;return r.percentage=n,r}}updatePredefinedPatternDefinitionLines(t=this.getEffectivePatternName(),e=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const r=t.trim().toUpperCase();if(!r||r===he){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const s=this.normalizePatternScale(e);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===r&&this._definitionLinesPatternScale===s)return;const o=el.patterns.find(a=>a.name.trim().toUpperCase()===r);if(!o){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=o.lines.map(a=>({angle:a.angle*Math.PI/180,base:{x:a.originX*s,y:a.originY*s},offset:{x:a.deltaX*s,y:a.deltaY*s},dashLengths:a.dashes.map(l=>l*s)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=r,this._definitionLinesPatternScale=s}add(t){this._geo.add(t)}buildAreasFromLoops(){const t=this._geo.loops;if(t.length===0)return[];if(t.length===1)return[this._geo];const e=this._geo.buildHierarchy(),n=[],r=(s,o)=>{if(s.index>=0&&o%2===0){const a=new kt;a.add(t[s.index]),s.children.forEach(l=>{l.index>=0&&a.add(t[l.index])}),n.push(a)}s.children.forEach(a=>r(a,o+1))};return e.children.forEach(s=>r(s,0)),n.length>0?n:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,n)=>e+n.area,0)}get area(){return this.getCalculatedAreaValue()}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new k;const e=new k;return t.forEach(n=>{const r=n.box;e.union(new k({x:r.min.x,y:r.min.y,z:this._elevation},{x:r.max.x,y:r.max.y,z:this._elevation}))}),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Ke[0],value:0},{label:Ke[1],value:1},{label:Ke[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:t=>{this.associative=t}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:t=>{this.backgroundColor=t}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:t=>{this.patternDouble=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){return this.associative?[]:this.collectBoundaryGripPoints()}subMoveGripPointsAt(t,e){return this.associative?this:(Z(t,n=>{this.moveBoundaryGripPointAt(n,e)}),this)}collectBoundaryGripPoints(){const t=new Array,e=this._elevation,n=new Set,r=s=>{const o=`${s.x},${s.y},${s.z??0}`;n.has(o)||(n.add(o),t.push(new y(s.x,s.y,s.z??e)))};return this._geo.loops.forEach(s=>{if(s instanceof V){const o=s.numberOfVertices;for(let a=0;a<o;a++){const l=s.getPointAt(a);r({x:l.x,y:l.y,z:e})}return}s.curves.forEach(o=>{if(o instanceof Mt)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});else if(o instanceof ht)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e}),r({x:o.midPoint.x,y:o.midPoint.y,z:e});else if(o instanceof le){r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});const a=o.getPoint(.5);r({x:a.x,y:a.y,z:e})}})}),t}moveBoundaryGripPointAt(t,e){let n=0;const r=this._elevation,s=new Set,o=(a,l)=>{const h=`${a.x},${a.y},${a.z??0}`;s.has(h)||(s.add(h),n===t&&l(),n++)};this._geo.loops.forEach(a=>{if(a instanceof V){const l=a.numberOfVertices;for(let h=0;h<l;h++){const c=a.vertices[h];c&&o({x:c.x,y:c.y,z:r},()=>{qe(a.vertices,h,e)})}return}a.curves.forEach(l=>{if(l instanceof Mt)o({x:l.startPoint.x,y:l.startPoint.y,z:r},()=>{l.startPoint.x+=e.x,l.startPoint.y+=e.y}),o({x:l.endPoint.x,y:l.endPoint.y,z:r},()=>{l.endPoint.x+=e.x,l.endPoint.y+=e.y});else if(l instanceof ht)o({x:l.startPoint.x,y:l.startPoint.y,z:r},()=>this.moveCircArc2dGripPoint(l,"start",e)),o({x:l.endPoint.x,y:l.endPoint.y,z:r},()=>this.moveCircArc2dGripPoint(l,"end",e)),o({x:l.midPoint.x,y:l.midPoint.y,z:r},()=>this.moveCircArc2dGripPoint(l,"mid",e));else if(l instanceof le){o({x:l.startPoint.x,y:l.startPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(l,"start",e)),o({x:l.endPoint.x,y:l.endPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(l,"end",e));const h=l.getPoint(.5);o({x:h.x,y:h.y,z:r},()=>this.moveEllipseArc2dGripPoint(l,"mid",e))}})})}moveCircArc2dGripPoint(t,e,n){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"mid":{const s=t.midPoint,o=new ht(t.startPoint,{x:s.x+n.x,y:s.y+n.y},t.endPoint);t.center=o.center,t.radius=o.radius,t.startAngle=o.startAngle,t.endAngle=o.endAngle,t.clockwise=o.clockwise;break}}}moveEllipseArc2dGripPoint(t,e,n){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"mid":{const s=t.getPoint(.5),o=s.x+n.x-t.center.x,a=s.y+n.y-t.center.y,l=Math.hypot(s.x-t.center.x,s.y-t.center.y),h=Math.hypot(o,a);if(l>0&&h>0){const c=h/l;t.majorAxisRadius*=c,t.minorAxisRadius*=c}break}}}subGetOsnapPoints(t,e,n,r){const s=this._elevation,o=[];if(this._geo.loops.forEach(a=>{var l;if(a instanceof V){const h=a,c=h.numberOfVertices;if(c===0)return;switch(t){case x.EndPoint:for(let u=0;u<c;u++){const g=h.getPointAt(u);r.push(new y(g.x,g.y,s))}break;case x.MidPoint:case x.Nearest:case x.Perpendicular:case x.Tangent:{const u=a.closed?c:c-1;for(let g=0;g<u;g++){const d=[];sn(h.getPointAt(g),h.getPointAt((g+1)%c),(l=h.vertices[g])==null?void 0:l.bulge,s,t,e,d),t===x.MidPoint?r.push(...d):o.push(...d)}break}}return}a.curves.forEach(h=>{if(h instanceof Mt){const c=[];sn(h.startPoint,h.endPoint,void 0,s,t,e,c),t===x.MidPoint?r.push(...c):t===x.Nearest||t===x.Perpendicular||t===x.Tangent?o.push(...c):r.push(...c)}else if(h instanceof ht)switch(t){case x.EndPoint:r.push(new y(h.startPoint.x,h.startPoint.y,s),new y(h.endPoint.x,h.endPoint.y,s));break;case x.MidPoint:r.push(new y(h.midPoint.x,h.midPoint.y,s));break;case x.Nearest:{const c=h.nearestPoint({x:e.x,y:e.y});o.push(new y(c.x,c.y,s));break}case x.Perpendicular:{h.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new y(u.x,u.y,s)));break}case x.Tangent:{h.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new y(u.x,u.y,s)));break}}else if(h instanceof le)switch(t){case x.EndPoint:r.push(new y(h.startPoint.x,h.startPoint.y,s),new y(h.endPoint.x,h.endPoint.y,s));break;case x.MidPoint:{const c=h.getPoint(.5);r.push(new y(c.x,c.y,s));break}case x.Nearest:{const c=h.nearestPoint({x:e.x,y:e.y});o.push(new y(c.x,c.y,s));break}case x.Perpendicular:{h.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new y(u.x,u.y,s)));break}case x.Tangent:{h.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new y(u.x,u.y,s)));break}}})}),(t===x.Nearest||t===x.Perpendicular||t===x.Tangent)&&o.length>0){const a=wt(e,o);r.length=0,a&&r.push(a)}}subWorldDraw(t){var s;this.updatePredefinedPatternDefinitionLines();const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.getRenderablePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(s=this.backgroundColor)==null?void 0:s.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},e.drawOrder=-1;const n=this.buildAreasFromLoops();if(n.length===0)return t.area(this._geo);if(n.length===1)return t.area(n[0]);const r=n.map(o=>t.area(o));return t.group(r)}transformBy(t){const e=t.elements,n=new dn(e[0],e[4],e[12],e[1],e[5],e[13],0,0,1);this._geo.transform(n),this._elevation=new y(0,0,this._elevation).applyMatrix4(t).z;const r=new y(1,0,0).applyMatrix4(t),s=new y().applyMatrix4(t),o=new y(r).sub(s);if(o.length()>0){const a=Math.atan2(o.y,o.x);this._patternAngle=this.getEffectivePatternAngle()+a,this._gradientAngle+=a,this._patternScale=this.getEffectivePatternScale()*o.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops,n=this.getEffectivePatternName(),r=this.getEffectivePatternAngle(),s=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(n,s),t.writeSubclassMarker("AcDbHatch"),t.writePoint3d(10,{x:0,y:0,z:this.elevation}),t.writeVector3d(210,{x:0,y:0,z:1}),t.writeString(2,n||(this.isSolidFill?he:La)),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,this.getEffectiveAssociative()?1:0),t.writeInt16(91,e.length),e.forEach((o,a)=>{const l=a===0;if(o instanceof V){const h=o.vertices,c=h.some(g=>(g.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,c?1:0),t.writeInt16(73,o.closed?1:0),t.writeInt16(93,h.length);for(const g of h)t.writePoint2d(10,g),c&&t.writeDouble(42,g.bulge??0);t.writeInt16(97,0);return}if(o instanceof Wr){const h=l?1:0;t.writeInt16(92,h),t.writeInt16(93,o.numberOfEdges);for(const c of o.curves){if(c instanceof Mt){t.writeInt16(72,1),t.writePoint2d(10,c.startPoint),t.writePoint2d(11,c.endPoint);continue}if(c instanceof ht){t.writeInt16(72,2),t.writePoint2d(10,c.center),t.writeDouble(40,c.radius),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof le){t.writeInt16(72,3),t.writePoint2d(10,c.center);const u=new A(c.majorAxisRadius*Math.cos(c.rotation),c.majorAxisRadius*Math.sin(c.rotation));t.writePoint2d(11,u);const g=c.majorAxisRadius===0?0:c.minorAxisRadius/c.majorAxisRadius;t.writeDouble(40,g),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof Tt){const u=c.knots,g=c.controlPoints,d=c.weights,f=c.fitPoints,p=d.some(m=>m!==1);t.writeInt16(72,4),t.writeInt16(94,c.degree),t.writeInt16(73,p?1:0),t.writeInt16(74,c.closed?1:0),t.writeInt16(95,u.length),t.writeInt16(96,g.length),u.forEach(m=>t.writeDouble(40,m)),g.forEach((m,_)=>{t.writePoint2d(10,m),p&&t.writeDouble(42,d[_]??1)}),t.writeInt16(97,(f==null?void 0:f.length)??0),f==null||f.forEach(m=>t.writePoint2d(11,m))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,r),t.writeDouble(41,s),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(o=>{t.writeAngle(53,o.angle),t.writeDouble(43,o.base.x),t.writeDouble(44,o.base.y),t.writeDouble(45,o.offset.x),t.writeDouble(46,o.offset.y),t.writeInt16(79,o.dashLengths.length),o.dashLengths.forEach(a=>t.writeDouble(49,a))}),this.isGradient&&(t.writeInt16(450,this._hatchObjectType),t.writeInt16(451,0),t.writeInt16(452,this._gradientOneColorMode?1:0),t.writeAngle(460,this._gradientAngle),t.writeDouble(461,this._gradientShift),t.writeString(470,this.gradientName)),t.writeInt16(98,0),this}};os.typeName="Hatch";let Yn=os;class sl{constructor(t){this.db=t}createDefaultLayer(){const t=new O;return t.colorIndex=7,this.db.tables.layerTable.add(new ii({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new ue({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new ue({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new ue({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new qr({name:q,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new xt({name:q,dimtxsty:q}))}createDefaultLayout(){const t=new ni;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new Yn;e.patternName=he;const n=new Wr;n.add(new Mt({x:0,y:0},{x:-1,y:.125})),n.add(new Mt({x:-1,y:.125},{x:-1,y:-.125})),n.add(new Mt({x:-1,y:-.125},{x:0,y:0})),e.add(n);const r=new J;r.name="_CAXARROW",r.appendEntity(e),this.db.tables.blockTable.add(r)}}}const $i=Math.PI/200;class ol{constructor(t){this.database=t}formatLength(t,e){const n=this.createContext(e);return _e(t,n)}formatPoint2d(t,e){const n=this.createContext(e);return`${_e(t.x,n)}, ${_e(t.y,n)}`}formatPoint3d(t,e){const n=this.createContext(e);return`${_e(t.x,n)}, ${_e(t.y,n)}, ${_e(t.z,n)}`}formatAngle(t,e){const n=this.createContext(e),s=(e==null?void 0:e.applyAngbaseAngdir)??!0?Uu(t,this.database.angbase,this.database.angdir):E.normalizeAngle(t);return Wu(s,n)}createContext(t){return{lunits:this.database.lunits,luprec:on(this.database.luprec),insunits:this.database.insunits,unitmode:this.database.unitmode,measurement:this.database.measurement,aunits:this.database.aunits,auprec:on(this.database.auprec),showUnits:(t==null?void 0:t.showUnits)??!1,showApproximate:(t==null?void 0:t.showApproximate)??!1}}}function _e(i,t){let e;switch(t.lunits){case W.Scientific:e=xi(nd(i,t.luprec),t);break;case W.Engineering:e=id(i,t);break;case W.Architectural:e=rd(i,t);break;case W.Fractional:e=xi(sd(i,t),t);break;case W.WindowsDesktop:case W.Decimal:default:e=xi(je(i,t.luprec),t)}return al(e,$u(i,t),t)}function Wu(i,t){let e;switch(t.aunits){case ct.DegreesMinutesSeconds:e=cl(i,t);break;case ct.Gradians:e=ld(i,t);break;case ct.Radians:e=ad(i,t);break;case ct.SurveyorsUnits:e=hd(i,t);break;case ct.DecimalDegrees:default:e=od(i,t)}return al(e,qu(i,t),t)}function Uu(i,t,e){let n=i-t;return e===1&&(n=-n),E.normalizeAngle(n)}function Zr(i){const t=i.showUnits?'"':"";return i.unitmode===1?{feetInchSeparator:"",fractionSeparator:"-",inchSuffix:t}:{feetInchSeparator:"-",fractionSeparator:" ",inchSuffix:t}}function on(i,t=0,e=8){return Number.isFinite(i)?Math.max(t,Math.min(e,Math.round(i))):t}function Ve(i){return Object.is(i,-0)?0:i}function al(i,t,e){return!e.showApproximate||!t?i:`~ ${i}`}function $u(i,t){if(!Number.isFinite(i))return!1;const e=Zu(i,t);return Qr(i,e)}function qu(i,t){if(!Number.isFinite(i))return!1;if(t.aunits===ct.SurveyorsUnits)return Ku(i,t.auprec);const e=Qu(i,t);return Qr(i,e)}function Ku(i,t){const n=((90-E.radToDeg(i))%360+360)%360,r=ul(n),s=Math.min(Math.abs(n-r.base),Math.abs(r.base+90-n)),o=E.degToRad(s),a=ll(o,t);return Qr(o,a)}function Zu(i,t){const e=Ve(i);switch(t.lunits){case W.Scientific:return Ju(e,t.luprec);case W.Engineering:case W.Architectural:case W.Fractional:return td(e,t);case W.WindowsDesktop:case W.Decimal:default:return Ce(e,t.luprec)}}function Qu(i,t){const e=Ve(i);switch(t.aunits){case ct.DegreesMinutesSeconds:return ll(e,t.auprec);case ct.Gradians:return Ce(e/$i,t.auprec)*$i;case ct.Radians:return Ce(e,t.auprec);case ct.DecimalDegrees:default:return E.degToRad(Ce(E.radToDeg(e),t.auprec))}}function Ce(i,t){if(!Number.isFinite(i))return 0;const e=10**t;return Math.round(Ve(i)*e)/e}function Ju(i,t){if(!Number.isFinite(i))return 0;const e=Ve(i);if(e===0)return 0;const n=e.toExponential(t);return Number(n)}function td(i,t){if(!Number.isFinite(i))return 0;const e=i<0?-1:1,n=Math.abs(i),r=Math.floor(n/12),s=n-r*12;if(t.lunits===W.Architectural||t.lunits===W.Fractional){const o=1<<on(t.luprec,0,8),a=ed(s,o);return e*(r*12+a)}return e*(r*12+Ce(s,t.luprec))}function ed(i,t){const e=Math.floor(i),n=i-e,r=Math.round(n*t);return r>=t?e+1:e+r/t}function ll(i,t){const e=E.radToDeg(i),n=e<0?-1:1,r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),l=Ce((o-a)*60,t),h=s+a/60+l/3600;return E.degToRad(n*h)}function Qr(i,t){if(i===t)return!1;const e=Math.max(Math.abs(i),Math.abs(t),1);return Math.abs(i-t)>e*Number.EPSILON*8}function je(i,t){if(!Number.isFinite(i))return"0";const e=Ve(i);if(Number.isInteger(e)&&t===0)return String(e);const r=e.toFixed(t).replace(/\.?0+$/,"");return r===""||r==="-"?"0":r}function nd(i,t){if(!Number.isFinite(i))return"0";const e=Ve(i);if(e===0)return"0";const n=e.toExponential(t).match(/^(.+)e([+-])(\d+)$/i);if(!n)return"0";const[,r,s,o]=n,a=o.length<2?o.padStart(2,"0"):o;return`${r}E${s}${a}`.toUpperCase()}function id(i,t){if(!Number.isFinite(i))return"0";const e=Zr(t),n=i<0?"-":"",r=Math.abs(i),s=Math.floor(r/12),o=r-s*12,a=je(o,t.luprec);return s===0?`${n}${a}${e.inchSuffix}`:`${n}${s}'${e.feetInchSeparator}${a}${e.inchSuffix}`}function rd(i,t){if(!Number.isFinite(i))return"0";const e=Zr(t),n=i<0?"-":"",r=Math.abs(i),s=Math.floor(r/12),o=r-s*12,a=1<<on(t.luprec,0,8),l=hl(o,a,e.fractionSeparator);return s===0?`${n}${l}${e.inchSuffix}`:`${n}${s}'${e.feetInchSeparator}${l}${e.inchSuffix}`}function sd(i,t){if(!Number.isFinite(i))return"0";const e=Zr(t),n=i<0?"-":"",r=Math.abs(i),s=1<<on(t.luprec,0,8);return`${n}${hl(r,s,e.fractionSeparator)}`}function hl(i,t,e){const n=Math.floor(i),r=i-n;let s=Math.round(r*t);if(s>=t)return String(n+1);if(s===0)return String(n);const o=gd(s,t);s/=o;const a=t/o,l=`${s}/${a}`;return n===0?l:`${n}${e}${l}`}function od(i,t){const e=E.radToDeg(i);return`${je(e,t.auprec)}${t.showUnits?"°":""}`}function ad(i,t){return`${je(i,t.auprec)}${t.showUnits?" rad":""}`}function ld(i,t){const e=i/$i;return`${je(e,t.auprec)}${t.showUnits?"g":""}`}function cl(i,t){const e=E.radToDeg(i),n=e<0?"-":"",r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),l=(o-a)*60,h=je(l,t.auprec),c=t.showUnits?'"':"";return`${n}${s}d${a}'${h}${c}`}function hd(i,t){const n=((90-E.radToDeg(i))%360+360)%360,r=ul(n),s=Math.min(Math.abs(n-r.base),Math.abs(r.base+90-n)),a=cl(E.degToRad(s),t).replace(/^-/,"");return`${r.prefix} ${a} ${r.suffix}`.trim()}function ul(i){return i<90?{prefix:"N",suffix:"E",base:0}:i<180?{prefix:"S",suffix:"E",base:90}:i<270?{prefix:"S",suffix:"W",base:180}:{prefix:"N",suffix:"W",base:270}}function xi(i,t){if(!t.showUnits||t.lunits===W.Engineering||t.lunits===W.Architectural)return i;const e=cd(t.insunits,t.measurement);return e?`${i}${e}`:i}function cd(i,t){return i===G.Undefined?t===0?'"':" mm":Da(i)?ud(i):Ga(i)?dd(i):""}function ud(i){switch(i){case G.Millimeters:return" mm";case G.Centimeters:return" cm";case G.Meters:return" m";case G.Kilometers:return" km";case G.Decimeters:return" dm";case G.Microns:return" µm";case G.Nanometers:return" nm";default:return""}}function dd(i){switch(i){case G.Inches:case G.Microinches:case G.Mils:case G.USSurveyInch:return'"';case G.Feet:case G.USSurveyFeet:return"'";case G.Miles:case G.USSurveyMile:return" mi";case G.Yards:case G.USSurveyYard:return" yd";default:return""}}function gd(i,t){let e=Math.abs(i),n=Math.abs(t);for(;n!==0;){const r=n;n=e%n,e=r}return e||1}class se extends gt{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){const n=this.database.transactionManager;if(n.strictMode&&!n.isRecording()&&!n.isApplyingUndoRedo())throw new Error("Cannot modify dictionary entries outside an active transaction.");const r=this.getAt(t);r&&(n.isRecording()&&n.recordRemove({type:"dictionary",dictionaryId:this.objectId,key:t},r),this.database.releaseObjectHandle(r)),e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,s=>this.hasId(s)),this._recordsByName.set(t,e),n.isRecording()&&n.recordAppend({type:"dictionary",dictionaryId:this.objectId,key:t},e),!n.isRecording()&&!n.isApplyingUndoRedo()&&this.database.notifyDictObjectSet(e,t)}remove(t){const e=this.getAt(t);return e?(this.removeStoredObject(e,t),!0):!1}removeId(t){const e=this.getIdAt(t);if(e){let n="";return this._recordsByName.forEach((r,s)=>{r===e&&(n=s)}),this.removeStoredObject(e,n),!0}return!1}removeStoredObject(t,e){const n=this.database.transactionManager;if(n.strictMode&&!n.isRecording()&&!n.isApplyingUndoRedo())throw new Error("Cannot remove dictionary entries outside an active transaction.");n.isRecording()&&n.recordRemove({type:"dictionary",dictionaryId:this.objectId,key:e},t),this._recordsByName.forEach((r,s)=>{r===t&&this._recordsByName.delete(s)}),this.database.releaseObjectHandle(t),e&&!n.isRecording()&&!n.isApplyingUndoRedo()&&this.database.notifyDictObjectErased(t,e)}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.releaseObjectHandle(t),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this.getIdAt(t)!==void 0}getAt(t){return this._recordsByName.get(t)}getIdAt(t){const e=this.database.getObjectById(t);if(!(!e||e.getAttrWithoutException("ownerId")!==this.objectId))return e}newIterator(){return new Xe(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const[e,n]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,n.objectId);return this}}const ri=192,an=193,si=194,oi=195,dl=200;function Mn(i){if(i.isByBlock)return an<<24>>0;if(i.isByLayer)return ri<<24>>0;const t=i.colorIndex;if(t!=null&&t>0&&t<256)return(oi<<24|t&255)>>0;const e=i.RGB;return e!=null?(si<<24|e&16777215)>>0:an<<24>>0}function fd(i){const t=new O(exports.AcCmColorMethod.ByBlock);switch(i>>>24&255){case ri:t.setByLayer();break;case an:case dl:t.setByBlock();break;case oi:t.colorIndex=i&255;break;case si:t.setRGBValue(i&16777215);break;default:i===256?t.setByLayer():i===0?t.setByBlock():i>0&&i<256&&(t.colorIndex=i);break}return t}class gl extends gt{constructor(){super(),this._contentType=2,this._drawMLeaderOrderType=1,this._drawLeaderOrderType=0,this._bitFlags=0,this._maxLeaderSegmentsPoints=-1,this._firstSegmentAngleConstraint=0,this._secondSegmentAngleConstraint=0,this._leaderLineType=1,this._leaderLineColor=new O(exports.AcCmColorMethod.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new O(exports.AcCmColorMethod.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new O(exports.AcCmColorMethod.ByBlock),this._blockScale=new b(1,1,1),this._enableBlockScale=!0,this._blockRotation=0,this._enableBlockRotation=!1,this._blockConnectionType=0,this._scale=1,this._overwritePropChanged=!1,this._annotative=!1,this._breakSize=0,this._textAttachmentDirection=0,this._bottomTextAttachmentType=9,this._topTextAttachmentType=9,this._extendLeaderToText=!1}get unknown1(){return this._unknown1}set unknown1(t){this._unknown1=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(t){this._drawMLeaderOrderType=t}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(t){this._drawLeaderOrderType=t}get bitFlags(){return this._bitFlags}set bitFlags(t){this._bitFlags=t}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(t){this._maxLeaderSegmentsPoints=t}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(t){this.maxLeaderSegmentsPoints=t}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(t){this._firstSegmentAngleConstraint=t}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(t){this._secondSegmentAngleConstraint=t}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor.copy(t)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get enableLanding(){return this._enableLanding}set enableLanding(t){this._enableLanding=t}get landingEnabled(){return this.enableLanding}set landingEnabled(t){this.enableLanding=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get enableDogleg(){return this._enableDogleg}set enableDogleg(t){this._enableDogleg=t}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(t){this.enableDogleg=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get description(){return this._description}set description(t){this._description=t}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(t){this._arrowSymbolId=t}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(t){this.arrowSymbolId=t}get arrowSize(){return this._arrowSize}set arrowSize(t){this._arrowSize=t}get arrowheadSize(){return this.arrowSize}set arrowheadSize(t){this.arrowSize=t}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(t){this._defaultMTextContents=t}get defaultMText(){return this.defaultMTextContents}set defaultMText(t){this.defaultMTextContents=t}get textString(){return this.defaultMTextContents}set textString(t){this.defaultMTextContents=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textStyle(){return this.textStyleId}set textStyle(t){this.textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor.copy(t)}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get enableFrameText(){return this._enableFrameText}set enableFrameText(t){this._enableFrameText=t}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(t){this.enableFrameText=t}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(t){this._textAlignAlwaysLeft=t}get alignSpace(){return this._alignSpace}set alignSpace(t){this._alignSpace=t}get blockId(){return this._blockId}set blockId(t){this._blockId=t}get blockContentId(){return this.blockId}set blockContentId(t){this.blockId=t}get blockColor(){return this._blockColor}set blockColor(t){this._blockColor.copy(t)}get blockContentColor(){return this.blockColor}set blockContentColor(t){this.blockColor=t}get blockScale(){return this._blockScale.clone()}set blockScale(t){this._blockScale.copy(t)}get blockContentScale(){return this.blockScale}set blockContentScale(t){this.blockScale=t}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(t){this._enableBlockScale=t}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(t){this.enableBlockScale=t}get blockRotation(){return this._blockRotation}set blockRotation(t){this._blockRotation=t}get blockContentRotation(){return this.blockRotation}set blockContentRotation(t){this.blockRotation=t}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(t){this._enableBlockRotation=t}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(t){this.enableBlockRotation=t}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(t){this._blockConnectionType=t}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(t){this.blockConnectionType=t}get scale(){return this._scale}set scale(t){this._scale=t}get scaleFactor(){return this.scale}set scaleFactor(t){this.scale=t}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(t){this._overwritePropChanged=t}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(t){this.overwritePropChanged=t}get annotative(){return this._annotative}set annotative(t){this._annotative=t}get breakSize(){return this._breakSize}set breakSize(t){this._breakSize=t}get breakGapSize(){return this.breakSize}set breakGapSize(t){this.breakSize=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(t){this._bottomTextAttachmentType=t}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(t){this.bottomTextAttachmentType=t}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(t){this._topTextAttachmentType=t}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(t){this.topTextAttachmentType=t}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(t){this._extendLeaderToText=t}get unknown2(){return this._unknown2}set unknown2(t){this._unknown2=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeaderStyle"),t.writeInt16(179,this.unknown1),t.writeInt16(170,this.contentType),t.writeInt16(171,this.drawMLeaderOrderType),t.writeInt16(172,this.drawLeaderOrderType),t.writeInt32(90,this.maxLeaderSegmentsPoints),t.writeDouble(40,this.firstSegmentAngleConstraint),t.writeDouble(41,this.secondSegmentAngleConstraint),t.writeInt16(173,this.leaderLineType),t.writeInt32(91,Mn(this.leaderLineColor)),t.writeHandle(340,this.leaderLineTypeId),t.writeInt32(92,this.leaderLineWeight),t.writeBoolean(290,this.enableLanding),t.writeDouble(42,this.landingGap),t.writeBoolean(291,this.enableDogleg),t.writeDouble(43,this.doglegLength),t.writeString(3,this.description),t.writeHandle(341,this.arrowSymbolId),t.writeDouble(44,this.arrowSize),t.writeString(300,this.defaultMTextContents),t.writeHandle(342,this.textStyleId),t.writeInt16(174,this.textLeftAttachmentType),t.writeInt16(175,this.textAngleType),t.writeInt16(176,this.textAlignmentType),t.writeInt16(178,this.textRightAttachmentType),t.writeInt32(93,Mn(this.textColor)),t.writeDouble(45,this.textHeight),t.writeBoolean(292,this.enableFrameText),t.writeBoolean(297,this.textAlignAlwaysLeft),t.writeDouble(46,this.alignSpace),t.writeHandle(343,this.blockId),t.writeInt32(94,Mn(this.blockColor)),t.writeDouble(47,this._blockScale.x),t.writeDouble(49,this._blockScale.y),t.writeDouble(140,this._blockScale.z),t.writeBoolean(293,this.enableBlockScale),t.writeDouble(141,this.blockRotation),t.writeBoolean(294,this.enableBlockRotation),t.writeInt16(177,this.blockConnectionType),t.writeDouble(142,this.scale),t.writeBoolean(295,this.overwritePropChanged),t.writeBoolean(296,this.annotative),t.writeDouble(143,this.breakSize),t.writeInt16(271,this.textAttachmentDirection),t.writeInt16(272,this.bottomTextAttachmentType),t.writeInt16(273,this.topTextAttachmentType),t.writeBoolean(298,this.unknown2),this}}class fl extends gt{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new O,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get flags(){return this._flags}set flags(t){this._flags=t}get description(){return this._description}set description(t){this._description=t}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor.copy(t)}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=t}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=t}get elementCount(){return this._elements.length}get elements(){return this._elements.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}set elements(t){this._elements=t.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}addElement(t){this._elements.push({offset:t.offset,color:t.color.clone(),lineType:t.lineType})}removeElementAt(t){if(t<0||t>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(t,1)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMlineStyle"),t.writeString(2,this.styleName),t.writeInt16(70,this.flags),t.writeString(3,this.description),t.writeCmColor(this.fillColor),t.writeDouble(51,this.startAngle),t.writeDouble(52,this.endAngle),t.writeInt16(71,this.elementCount),this._elements.forEach(e=>{t.writeDouble(49,e.offset),t.writeCmColor(e.color),t.writeString(6,e.lineType)}),this}}class Vt extends gt{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._unnamedRecords=[]}get numEntries(){return this._recordsByName.size}get totalRecordCount(){return this._recordsByName.size+this._unnamedRecords.length}add(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot add symbol table records outside an active transaction.");const n=e.resolveSymbolTableName(this);t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,s=>this.hasId(s));const r=this.normalizeName(t.name);r?this._recordsByName.set(r,t):this._unnamedRecords.push(t),e.isRecording()&&e.recordAppend({type:"symbolTable",tableName:n},t)}remove(t){const e=this.normalizeName(t),n=this._recordsByName.get(e);return n?(this.removeRecord(n),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this.removeRecord(e),!0):!1}removeRecord(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot remove symbol table records outside an active transaction.");if(e.isRecording()){const n=e.resolveSymbolTableName(this);e.recordRemove({type:"symbolTable",tableName:n},t)}this.removeFromMembership(t),this.database.releaseObjectHandle(t)}removeAll(){for(const t of this._recordsByName.values())this.database.releaseObjectHandle(t);for(const t of this._unnamedRecords)this.database.releaseObjectHandle(t);this._recordsByName.clear(),this._unnamedRecords.length=0}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this.getIdAt(t)!==void 0}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){const e=this.database.getObjectById(t);if(!(!e||e.getAttrWithoutException("ownerId")!==this.objectId))return e}getOwnerIdAt(t){return this.getIdAt(t)}newIterator(t=!1){return t?new Xe([...this._recordsByName.values(),...this._unnamedRecords]):new Xe(this._recordsByName)}normalizeName(t){return t.trim().toUpperCase()}get dxfEntryCount(){return this.numEntries}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.dxfEntryCount),this}removeFromMembership(t){const e=this.normalizeName(t.name);if(e){this._recordsByName.delete(e);return}const n=this._unnamedRecords.indexOf(t);n>=0&&this._unnamedRecords.splice(n,1)}}class pl extends Vt{constructor(t){super(t)}get modelSpace(){let t=this.getAt(J.MODEL_SPACE_NAME);return t||(t=new J,t.name=J.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){const e=this.database.getObjectById(t);if(e instanceof z)return e}removeEntity(t){let e=!1;for(const n of this.database.tables.blockTable.newIterator())if(n.removeEntity(t)){e=!0;break}return e}getXrefs(){const t=[];for(const e of this.newIterator())e.isXref&&t.push(e);return t}getUnresolvedXrefs(){return this.getXrefs().filter(t=>t.isUnresolvedXref)}normalizeName(t){const e=t.trim();if(J.isModelSapceName(e))return J.MODEL_SPACE_NAME;if(J.isPaperSapceName(e)){const n=J.PAPER_SPACE_NAME_PREFIX,r=e.substring(n.length);return n+r}return super.normalizeName(e)}}const _t=class _t extends Error{constructor(t,e,n){super(t),this.name="AcDbOpenDatabaseError",this.code=e,this.stage=n==null?void 0:n.stage}static isWorkerOutOfMemoryMessage(t){const e=t.toLowerCase();return _t.WORKER_OOM_PATTERNS.some(n=>e.includes(n))}static classifyWorkerErrorMessage(t){return _t.isWorkerOutOfMemoryMessage(t)?"worker_oom":t.toLowerCase().includes("timed out")?"worker_timeout":"worker_error"}static from(t,e){if(t instanceof _t)return t;const n=t instanceof Error?t.message:String(t),r=_t.classifyWorkerErrorMessage(n);return new _t(n,r,{stage:e,cause:t})}static fromTask(t){const e=t.task.name;return _t.from(t.error,e)}static throwOnWorkerParseFailure(t,e="PARSE"){if(t.success)return;const n=t.error!=null?`Failed to parse drawing due to error: '${t.error}'`:"Failed to parse drawing due to an unknown worker error",r=_t.mapWorkerResultCode(t.errorCode,t.error);throw new _t(n,r,{stage:e})}static mapWorkerResultCode(t,e){switch(t){case"worker_oom":return"worker_oom";case"worker_timeout":return"worker_timeout";case"worker_error":return"worker_error";default:return _t.classifyWorkerErrorMessage(e??"")}}};_t.WORKER_OOM_PATTERNS=["out of memory","data cannot be cloned","allocation failed","memory access out of bounds"];let ln=_t;class yl extends Vt{constructor(t){super(t)}}class ml extends Vt{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class _l extends Vt{constructor(t){super(t)}}class bl extends Vt{constructor(t){super(t)}get dxfEntryCount(){return this.totalRecordCount}resolveAt(t){this.database.ensureTextStyleDefaults();const e=[],n=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};n(t),n(this.database.textstyle),n(q),n("STANDARD");for(const r of e){const s=this.getAt(r);if(s)return s;const o=r.toUpperCase();for(const a of this.newIterator())if(a.name.toUpperCase()===o)return a}return this.newIterator().next().value??void 0}get shapeFiles(){return this.newIterator(!0).toArray().filter(t=>t.isShapeFile)}get fonts(){const t=new Set;for(const e of this.newIterator()){const n=bt.normalizeFontFileName(e.fileName);n&&t.add(n);const r=bt.normalizeFontFileName(e.bigFontFileName);r&&t.add(r)}return Array.from(t)}}class xl extends Vt{constructor(t){super(t)}}const pd=()=>({center:new A,viewDirectionFromTarget:new y(0,0,1),viewTarget:new y(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:exports.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new y(0,0,0),ucsXAxis:new y(1,0,0),ucsYAxis:new y(0,1,0),orthographicType:exports.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:exports.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0,aspectRatio:void 0});class Jr extends ee{constructor(t,e){t=t||{},Pt(t,{gsView:pd()}),super(t,e)}get gsView(){return this.getAttr("gsView")}get centerPoint(){return this.gsView.center}set centerPoint(t){this.gsView.center.copy(t)}get viewDirectionFromTarget(){return this.gsView.viewDirectionFromTarget}set viewDirectionFromTarget(t){this.gsView.viewDirectionFromTarget.copy(t)}get viewTarget(){return this.gsView.viewTarget}set viewTarget(t){this.gsView.viewTarget.copy(t)}get viewHeight(){return this.gsView.viewHeight}set viewHeight(t){this.gsView.viewHeight=t}get viewTwistAngle(){return this.gsView.viewTwistAngle}set viewTwistAngle(t){this.gsView.viewTwistAngle=t}get lensLength(){return this.gsView.lensLength}set lensLength(t){this.gsView.lensLength=t}get frontClippingPlane(){return this.gsView.frontClippingPlane}set frontClippingPlane(t){this.gsView.frontClippingPlane=t}get backClippingPlane(){return this.gsView.backClippingPlane}set backClippingPlane(t){this.gsView.backClippingPlane=t}get renderMode(){return this.gsView.renderMode}set renderMode(t){this.gsView.renderMode=t}get viewMode(){return this.gsView.viewMode}set viewMode(t){this.gsView.viewMode=t}get ucsIconSetting(){return this.gsView.ucsIconSetting}set ucsIconSetting(t){this.gsView.ucsIconSetting=t}get ucsOrigin(){return this.gsView.ucsOrigin}set ucsOrigin(t){this.gsView.ucsOrigin.copy(t)}get ucsXAxis(){return this.gsView.ucsXAxis}set ucsXAxis(t){this.gsView.ucsXAxis.copy(t)}get ucsYAxis(){return this.gsView.ucsYAxis}set ucsYAxis(t){this.gsView.ucsYAxis.copy(t)}get orthographicType(){return this.gsView.orthographicType}set orthographicType(t){this.gsView.orthographicType=t}get shadePlotSetting(){return this.gsView.shadePlotSetting}set shadePlotSetting(t){this.gsView.shadePlotSetting=t}get shadePlotObjectId(){return this.gsView.shadePlotObjectId}set shadePlotObjectId(t){this.gsView.shadePlotObjectId=t}get visualStyleObjectId(){return this.gsView.visualStyleObjectId}set visualStyleObjectId(t){this.gsView.visualStyleObjectId=t}get isDefaultLightingOn(){return this.gsView.isDefaultLightingOn}set isDefaultLightingOn(t){this.gsView.isDefaultLightingOn=t}get defaultLightingType(){return this.gsView.defaultLightingType}set defaultLightingType(t){this.gsView.defaultLightingType=t}get brightness(){return this.gsView.brightness}set brightness(t){this.gsView.brightness=t}get contrast(){return this.gsView.contrast}set contrast(t){this.gsView.contrast=t}get ambientColor(){return this.gsView.ambientColor}set ambientColor(t){this.gsView.ambientColor=t}get aspectRatio(){return this.gsView.aspectRatio}set aspectRatio(t){this.gsView.aspectRatio=t}}const ho=2,yd=.45,md=1e5;function _d(i){var n;const t=i,e=t.aspectRatio??((n=t.gsView)==null?void 0:n.aspectRatio);return Number.isFinite(e)?e:void 0}function bd(i,t){if(Number.isFinite(t)&&t>0)return t;const e=_d(i);return e!=null&&e>0?e:1}function xd(i,t){const e=Math.max(i.min.x,t.min.x),n=Math.max(i.min.y,t.min.y),r=Math.min(i.max.x,t.max.x),s=Math.min(i.max.y,t.max.y);return e>=r||n>=s?0:(r-e)*(s-n)}function co(i){return{x:(i.min.x+i.max.x)/2,y:(i.min.y+i.max.y)/2}}function wd(i){if(!i||i.isEmpty())return!1;const t=i.max.x-i.min.x,e=i.max.y-i.min.y;return t>0&&e>0}class de extends Jr{static isActiveVportName(t){return t.toLowerCase()===Ne.toLowerCase()}constructor(t,e){t=t||{},Pt(t,{circleSides:100,lowerLeftCorner:new A(0,0),upperRightCorner:new A(1,1),snapBase:new A(0,0),snapAngle:0,snapSpacing:new A(0,0),standardFlag:0,gridSpacing:new A,gridMajor:10}),super(t,e)}get circleSides(){return this.getAttr("circleSides")}set circleSides(t){this.setAttr("circleSides",t)}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this.getAttr("lowerLeftCorner")}set lowerLeftCorner(t){this.getAttr("lowerLeftCorner").copy(t)}get upperRightCorner(){return this.getAttr("upperRightCorner")}set upperRightCorner(t){this.getAttr("upperRightCorner").copy(t)}get snapBase(){return this.getAttr("snapBase")}set snapBase(t){this.getAttr("snapBase").copy(t)}get snapAngle(){return this.getAttr("snapAngle")}set snapAngle(t){this.setAttr("snapAngle",t)}get snapIncrements(){return this.getAttr("snapSpacing")}set snapIncrements(t){this.getAttr("snapSpacing").copy(t)}get gridMajor(){return this.getAttr("gridMajor")}set gridMajor(t){this.setAttr("gridMajor",t)}get gridIncrements(){return this.getAttr("gridSpacing")}set gridIncrements(t){this.getAttr("gridSpacing").copy(t)}get standardFlag(){return this.getAttr("standardFlag")}set standardFlag(t){this.setAttr("standardFlag",t)}get snapEnabled(){return!!(this.standardFlag&256)}get backgroundObjectId(){return this.getAttrWithoutException("backgroundObjectId")}set backgroundObjectId(t){this.setAttr("backgroundObjectId",t)}modelViewBox(t){const e=this.centerPoint,n=this.viewHeight;if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(n)||n<=0)return;const r=this.viewTwistAngle;let s=e.x,o=e.y;if(Number.isFinite(r)&&r!==0){const g=Math.cos(r),d=Math.sin(r);s=e.x*g-e.y*d,o=e.x*d+e.y*g}const a=this.viewTarget;a&&Number.isFinite(a.x)&&Number.isFinite(a.y)&&(s+=a.x,o+=a.y);const l=bd(this,t),h=n*l,c=n/2,u=h/2;return new nt().expandByPoint({x:s-u,y:o-c}).expandByPoint({x:s+u,y:o+c})}static isModelViewBoxUsable(t,e){if(t.isEmpty()||e.isEmpty())return!1;const n=t.max.x-t.min.x,r=t.max.y-t.min.y,s=e.max.x-e.min.x,o=e.max.y-e.min.y;if(n<=0||r<=0||s<=0||o<=0||n>s*ho||r>o*ho)return!1;const a=Math.max(s,o)*yd,l=co(t),h=co(e);if(Math.hypot(l.x-h.x,l.y-h.y)>a)return!1;const u=n*r,g=xd(t,e);return!(g<=0||g/u<.25)}resolveModelViewBox(t,e){const n=this.modelViewBox(t);if(!(!n||!de.isModelViewBoxStructurallyValid(n))){if(wd(e)){if(!de.isModelViewBoxUsable(n,e))return}else if(!de.isModelViewBoxPlausibleWithoutExtents(n))return;return n}}static isModelViewBoxStructurallyValid(t){if(t.isEmpty())return!1;const e=t.max.x-t.min.x,n=t.max.y-t.min.y;return Number.isFinite(e)&&Number.isFinite(n)&&e>0&&n>0}static isModelViewBoxPlausibleWithoutExtents(t){const e=t.max.x-t.min.x,n=t.max.y-t.min.y;return Math.max(e,n)<=md}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),t.writeDouble(40,this.gsView.viewHeight),this.gsView.aspectRatio!=null&&Number.isFinite(this.gsView.aspectRatio)&&t.writeDouble(41,this.gsView.aspectRatio),t.writeDouble(45,this.gsView.viewHeight),t.writePoint2d(10,this.lowerLeftCorner),t.writePoint2d(11,this.upperRightCorner),t.writePoint2d(12,this.center),t.writePoint2d(13,this.snapBase),t.writePoint2d(14,this.snapIncrements),t.writePoint2d(15,this.gridIncrements),t.writeInt16(70,this.standardFlag),t.writeInt16(71,this.circleSides),t.writeDouble(42,this.gsView.lensLength),t.writePoint3d(16,this.gsView.viewDirectionFromTarget),t.writePoint3d(17,this.gsView.viewTarget),t.writeAngle(50,this.snapAngle),t.writeAngle(51,this.gsView.viewTwistAngle),t.writeInt16(61,this.gridMajor),t.writeInt16(281,this.backgroundObjectId?1:0),t.writeObjectId(332,this.backgroundObjectId),this}}class wl extends Vt{constructor(t){super(t)}normalizeName(t){const e=t.trim();return de.isActiveVportName(e)?Ne:super.normalizeName(e)}getActiveVport(){return this.getAt(Ne)}getActiveVportBox(t,e){const n=this.getActiveVport();return n==null?void 0:n.resolveModelViewBox(t,e)}}class vl extends Vt{constructor(t){super(t)}}class qi extends ee{constructor(t){typeof t=="string"&&(t={name:t}),super(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}class Pl extends se{getBtrIdAt(t){for(const[e,n]of this._recordsByName)if(n.blockTableRecordId==t)return n}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class Al{constructor(t){this.database=t}applyForward(t){for(const e of t)this.applyChange(e,!0)}applyInverse(t){for(let e=t.length-1;e>=0;e--)this.applyChange(t[e],!1)}applyChange(t,e){switch(t.kind){case"modify":this.applyModify(t,e);break;case"append":e?this.applyAppend(t.container,t.object):this.applyRemove(t.container,t.object);break;case"remove":e?this.applyRemove(t.container,t.object):this.applyAppend(t.container,t.object);break;case"sysvar":this.applySysvar(t,e);break}}applyModify(t,e){const n=this.database.getObjectById(t.objectId);if(!n)return;const r=e?t.after:t.before;r&&n.restoreFrom(r)}applySysvar(t,e){const n=e?t.after:t.before;n!==void 0&&tt.instance().setVar(t.name,n,this.database)}applyAppend(t,e){switch(t.type){case"blockTableRecord":{const n=this.database.tables.blockTable.getIdAt(t.ownerId);n&&n.appendEntity(e);break}case"symbolTable":{const n=this.getSymbolTable(t.tableName);n&&n.add(e);break}case"dictionary":{const n=this.database.getObjectById(t.dictionaryId);n&&n.setAt(t.key,e);break}}}applyRemove(t,e){switch(t.type){case"blockTableRecord":{const n=this.database.tables.blockTable.getIdAt(t.ownerId);n&&n.removeEntity(e.objectId);break}case"symbolTable":{const n=this.getSymbolTable(t.tableName);n&&n.removeId(e.objectId);break}case"dictionary":{const n=this.database.getObjectById(t.dictionaryId);n&&n.removeId(e.objectId);break}}}getSymbolTable(t){const e=this.database.tables;switch(t){case"appIdTable":return e.appIdTable;case"blockTable":return e.blockTable;case"dimStyleTable":return e.dimStyleTable;case"linetypeTable":return e.linetypeTable;case"textStyleTable":return e.textStyleTable;case"viewTable":return e.viewTable;case"layerTable":return e.layerTable;case"viewportTable":return e.viewportTable;default:return}}}function Ki(i,t){const e=[],n=[],r=[];for(const s of t)if(s.kind==="modify"){const o=i.getObjectById(s.objectId);o instanceof z&&e.push(o)}else if(s.kind==="append"){if(s.container.type==="blockTableRecord"){const o=i.tables.blockTable.getEntityById(s.object.objectId)??(s.object instanceof z?s.object:void 0);o&&n.push(o)}}else s.kind==="remove"&&s.container.type==="blockTableRecord"&&s.object instanceof z&&r.push(s.object);return{modified:e,appended:n,erased:r}}function uo(i,t){const e=[],n=[];for(const r of t){if(r.kind!=="append"&&r.kind!=="remove"||r.container.type!=="dictionary")continue;const s=r.container.key;if(r.kind==="append"){const o=i.getObjectById(r.object.objectId)??r.object;e.push({object:o,key:s})}else r.kind==="remove"&&n.push({object:r.object,key:s})}return{set:e,erased:n}}function go(i,t){const e={};for(const n of Bu){const r=i.getAttrWithoutException(n),s=t.getAttrWithoutException(n);ce(r,s)||(e[n]=s)}return e}function fo(i,t,e=!1){const n=[];for(const r of t){if(r.kind!=="modify")continue;const s=i.getObjectById(r.objectId);if(!(s instanceof ii))continue;const o=r.before,a=r.after;if(!o||!a)continue;const l=e?go(a,o):go(o,a);Object.keys(l).length!==0&&n.push({database:i,layer:s,changes:l})}return n}function vd(i,t){if(i.type!==t.type)return!1;switch(i.type){case"blockTableRecord":return t.type==="blockTableRecord"&&i.ownerId===t.ownerId;case"symbolTable":return t.type==="symbolTable"&&i.tableName===t.tableName;case"dictionary":return t.type==="dictionary"&&i.dictionaryId===t.dictionaryId&&i.key===t.key}}class Sl{constructor(){this.changes=[]}getChanges(){return this.changes}clear(){this.changes.length=0}mergeFrom(t){for(const e of t.getChanges())this.mergeChange(e)}recordModify(t){const e=t.objectId;this.changes.find(r=>r.kind==="modify"&&r.objectId===e)||this.changes.push({kind:"modify",objectId:e,before:t.clonePreservingIdentity()})}hasModify(t){return this.changes.some(e=>e.kind==="modify"&&e.objectId===t)}recordAppend(t,e){this.recordStructuralChange({kind:"append",container:t,object:e.clonePreservingIdentity()})}recordRemove(t,e){this.recordStructuralChange({kind:"remove",container:t,object:e.clonePreservingIdentity()})}recordSysvar(t,e){const n=t.toLowerCase();this.changes.find(s=>s.kind==="sysvar"&&s.name===n)||this.changes.push({kind:"sysvar",name:n,before:e})}finalize(t){for(const e of this.changes)if(e.kind==="modify"){const n=t.getObjectById(e.objectId);n&&(e.after=n.clonePreservingIdentity())}else e.kind==="sysvar"&&(e.after=this.getSysvarValue(t,e.name))}recordStructuralChange(t){const e=t.kind==="append"?"remove":"append",n=this.findStructuralChangeIndex(e,t.container,t.object.objectId);if(n>=0){this.changes.splice(n,1);return}this.changes.push(t)}mergeChange(t){if(t.kind==="modify"){this.changes.find(n=>n.kind==="modify"&&n.objectId===t.objectId)||this.changes.push(t);return}if(t.kind==="sysvar"){this.changes.find(n=>n.kind==="sysvar"&&n.name===t.name)||this.changes.push(t);return}this.recordStructuralChange(t)}findStructuralChangeIndex(t,e,n){return this.changes.findIndex(r=>r.kind===t&&r.object.objectId===n&&vd(r.container,e))}getSysvarValue(t,e){return tt.instance().getVar(e,t)}}class ts{constructor(){this.openedObjects=new Map,this.originalStates=new Map,this.recorder=new Sl}getObject(t,e,n=!1){const r=this.openedObjects.get(t);if(r){if(e===Ye.kForWrite&&!this.originalStates.has(t)){const o=r.clonePreservingIdentity();this.originalStates.set(t,o),this.recorder.recordModify(r)}return r}const s=this.lookupObject(t,n);if(this.openedObjects.set(t,s),e===Ye.kForWrite){const o=s.clonePreservingIdentity();this.originalStates.set(s.objectId,o),this.recorder.recordModify(s)}return s}commit(){this.originalStates.clear(),this.openedObjects.clear()}abort(){for(const[t,e]of this.originalStates){const n=this.openedObjects.get(t);n&&n.restoreFrom(e)}this.originalStates.clear(),this.openedObjects.clear(),this.recorder.clear()}lookupObject(t,e){throw new Error(`lookupObject(${t}) not implemented`)}}class Ll extends ts{constructor(t){super(),this.database=t}lookupObject(t,e){const n=this.database.getObjectById(t,e);if(!n)throw new Error(`lookupObject(${t}) not found`);return n}}class El{constructor(){this.undoRecords=[],this.redoRecords=[],this.maxDepth=100}push(t){this.undoRecords.push(t),this.redoRecords.length=0,this.undoRecords.length>this.maxDepth&&this.undoRecords.shift()}popUndo(){return this.undoRecords.pop()}pushRedo(t){this.redoRecords.push(t)}popRedo(){return this.redoRecords.pop()}canUndo(){return this.undoRecords.length>0}canRedo(){return this.redoRecords.length>0}clear(){this.undoRecords.length=0,this.redoRecords.length=0}}class Il{constructor(t){this.database=t,this.transactionStack=[],this.undoStack=new El,this.undoMarkStack=[],this._applyingUndoRedo=!1,this._pendingEntityModified=new Set,this._pendingLayerModified=new Map,this.strictMode=!1,this.changeApplier=new Al(t)}startTransaction(){const t=new Ll(this.database);return this.transactionStack.push(t),t}currentTransaction(){return this.transactionStack[this.transactionStack.length-1]}hasTransaction(){return this.transactionStack.length>0}isRecording(){return this.hasTransaction()&&!this._applyingUndoRedo}isApplyingUndoRedo(){return this._applyingUndoRedo}isOpenedForWriteInTransaction(t){for(const e of this.transactionStack)if(e.recorder.hasModify(t))return!0;return!1}commitTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to commit.");if(this.transactionStack.length>0){this.transactionStack[this.transactionStack.length-1].recorder.mergeFrom(t.recorder),t.commit();return}t.recorder.finalize(this.database);const e=t.recorder.getChanges();t.commit(),e.length>0&&(this.dispatchCommitEvents(e),this.enqueueUndoChanges(e))}abortTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to abort.");const e=[...t.recorder.getChanges()];this.database.beginEventBatch(),this._applyingUndoRedo=!0;try{t.abort(),e.length>0&&this.changeApplier.applyInverse(e)}finally{this._applyingUndoRedo=!1,this.database.endEventBatch()}}startUndoMark(t){this.undoMarkStack.push({label:t,pendingChanges:[]})}endUndoMark(){const t=this.undoMarkStack.pop();if(!t)throw new Error("No active undo mark to end.");t.pendingChanges.length!==0&&this.undoStack.push({label:t.label,changes:t.pendingChanges})}cancelUndoMark(){this.undoMarkStack.length>0&&this.undoMarkStack.pop()}undo(){const t=this.undoStack.popUndo();if(!t)return!1;this.database.beginEventBatch(),this._applyingUndoRedo=!0;try{this.changeApplier.applyInverse(t.changes),this.dispatchUndoRedoEvents(t.changes,!0)}finally{this._applyingUndoRedo=!1,this.database.endEventBatch()}return this.undoStack.pushRedo(t),!0}redo(){const t=this.undoStack.popRedo();if(!t)return!1;this.database.beginEventBatch(),this._applyingUndoRedo=!0;try{this.changeApplier.applyForward(t.changes),this.dispatchUndoRedoEvents(t.changes,!1)}finally{this._applyingUndoRedo=!1,this.database.endEventBatch()}return this.undoStack.push(t),!0}canUndo(){return this.undoStack.canUndo()}canRedo(){return this.undoStack.canRedo()}clearUndoStack(){this.undoStack.clear()}recordAppend(t,e){var n;this.isRecording()&&((n=this.currentTransaction())==null||n.recorder.recordAppend(t,e))}recordRemove(t,e){var n;this.isRecording()&&((n=this.currentTransaction())==null||n.recorder.recordRemove(t,e))}recordSysvar(t,e){var n;this.isRecording()&&((n=this.currentTransaction())==null||n.recorder.recordSysvar(t,e))}resolveSymbolTableName(t){const e=this.database.tables;return t===e.appIdTable?"appIdTable":t===e.blockTable?"blockTable":t===e.dimStyleTable?"dimStyleTable":t===e.linetypeTable?"linetypeTable":t===e.textStyleTable?"textStyleTable":t===e.viewTable?"viewTable":t===e.layerTable?"layerTable":t===e.viewportTable?"viewportTable":t.objectId}runUndoable(t,e){this.startUndoMark(t),this.startTransaction();try{const n=e(this.currentTransaction());return this.commitTransaction(),this.endUndoMark(),n}catch(n){throw this.hasTransaction()&&this.abortTransaction(),this.cancelUndoMark(),n}}enqueueUndoChanges(t){const e=this.undoMarkStack[this.undoMarkStack.length-1];if(e)for(const n of t)e.pendingChanges.push(n)}dispatchCommitEvents(t){const{modified:e,appended:n,erased:r}=Ki(this.database,t);for(const a of e)this.dispatchEntityModified(a);n.length>0&&this.database.notifyEntityAppended(n),r.length>0&&this.database.notifyEntityErased(r);const{set:s,erased:o}=uo(this.database,t);for(const{object:a,key:l}of s)this.database.notifyDictObjectSet(a,l);for(const{object:a,key:l}of o)this.database.notifyDictObjectErased(a,l);for(const a of t)a.kind==="sysvar"&&a.after!==void 0&&tt.instance().events.sysVarChanged.dispatch({database:this.database,name:a.name,oldVal:a.before,newVal:a.after});for(const a of fo(this.database,t))this.dispatchLayerModified(a)}dispatchUndoRedoEvents(t,e){const{modified:n,appended:r,erased:s}=Ki(this.database,t),{set:o,erased:a}=uo(this.database,t);if(e){for(const l of n)this.dispatchEntityModified(l);s.length>0&&this.database.notifyEntityAppended(s),r.length>0&&this.database.notifyEntityErased(r);for(const{object:l,key:h}of a)this.database.notifyDictObjectSet(l,h);for(const{object:l,key:h}of o)this.database.notifyDictObjectErased(l,h)}else{for(const l of n)this.dispatchEntityModified(l);r.length>0&&this.database.notifyEntityAppended(r),s.length>0&&this.database.notifyEntityErased(s);for(const{object:l,key:h}of o)this.database.notifyDictObjectSet(l,h);for(const{object:l,key:h}of a)this.database.notifyDictObjectErased(l,h)}for(const l of t)if(l.kind==="sysvar"){const h=e?l.after:l.before,c=e?l.before:l.after;c!==void 0&&tt.instance().events.sysVarChanged.dispatch({database:this.database,name:l.name,oldVal:h,newVal:c})}for(const l of fo(this.database,t,e))this.dispatchLayerModified(l)}dispatchLayerModified(t){if(this.database.isEventBatched()){const e=this._pendingLayerModified.get(t.layer.objectId);if(e){e.changes={...e.changes,...t.changes};return}this._pendingLayerModified.set(t.layer.objectId,{database:t.database,layer:t.layer,changes:{...t.changes}});return}this.database.events.layerModified.dispatch(t)}dispatchEntityModified(t){if(this.database.isEventBatched()){this._pendingEntityModified.add(t);return}this.database.events.entityModified.dispatch({database:this.database,entity:t})}flushPendingLayerModifiedEvents(){if(this._pendingLayerModified.size===0)return;const t=[...this._pendingLayerModified.values()];this._pendingLayerModified.clear();for(const e of t)this.database.events.layerModified.dispatch(e)}flushPendingEntityModifiedEvents(){if(this._pendingEntityModified.size===0)return;const t=[...this._pendingEntityModified];this._pendingEntityModified.clear();for(const e of t)this.database.events.entityModified.dispatch({database:this.database,entity:e})}}const Qe=class Qe extends gt{constructor(){super({objectId:"0"}),this._classes=[],this._handleRegistry=new Map,this._drawNoPlotLayers=!0,this._eventBatchDepth=0,this._pendingEntityAppended=[],this._pendingEntityErased=[],this._pendingDictObjectSet=[],this._pendingDictObjectErased=[],this._lastOpenError=null,this.events={dictObjetSet:new U,dictObjectErased:new U,entityAppended:new U,entityModified:new U,entityErased:new U,layerAppended:new U,layerModified:new U,layerErased:new U,openProgress:new U,openFailed:new U},Qe._unsavedDrawingSequence+=1,this._dwgname=`Drawing${Qe._unsavedDrawingSequence}.dwg`,this._version=new Rt("AC1014"),this._angbase=0,this._angdir=0,this._aunits=ct.DecimalDegrees,this._auprec=0,this._lunits=W.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new O,this._celtype=K,this._celweight=exports.AcGiLineWeight.ByLayer,this._cetransparency=new Q,this._clayer="0",this._cmlstyle=Kt,this._cmlscale=1,this._cmleaderstyle=Zt,this._hpbackgroundcolor=new O(exports.AcCmColorMethod.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new Q,this._textstyle=q,this._extents=new k,this._insunits=G.Millimeters,this._unitmode=0,this._measurement=1,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._orthomode=0,this._maxHandle=0,this._tables={appIdTable:new vl(this),blockTable:new pl(this),dimStyleTable:new yl(this),linetypeTable:new _l(this),textStyleTable:new bl(this),viewTable:new xl(this),layerTable:new ml(this),viewportTable:new wl(this)},this._objects={dictionary:new se(this),imageDefinition:new se(this),layout:new Pl(this),mleaderStyle:new se(this),mlineStyle:new se(this),xrecord:new se(this)},this.transactionManager=new Il(this),this.registerBootstrapHandles()}get tables(){return this._tables}get classes(){return this._classes}set classes(t){this._classes=t.map(e=>({...e}))}get objects(){return this._objects}getObjectById(t,e=!1){return t===this.objectId?this:this._handleRegistry.get(t)}isUndoRecording(){return this.transactionManager.isRecording()}openObject(t,e){const n=this.transactionManager.currentTransaction();if(n){const r=n.getObject(t,e);if(r)return r}return this.getObjectById(t)}openObjectForRead(t){return this.openObject(t,Ye.kForRead)}openObjectForWrite(t){return this.openObject(t,Ye.kForWrite)}openEntityForRead(t){const e=typeof t=="string"?t:t.objectId;return this.openObjectForRead(e)}openEntityForWrite(t){const e=typeof t=="string"?t:t.objectId;return this.openObjectForWrite(e)}runDatabaseEdit(t,e){if(this.isUndoRecording()){e();return}this.transactionManager.runUndoable(t,e)}getRootDictionaries(){return[this.objects.dictionary,this.objects.imageDefinition,this.objects.layout,this.objects.mleaderStyle,this.objects.mlineStyle,this.objects.xrecord]}beginEventBatch(){this._eventBatchDepth++}endEventBatch(){this._eventBatchDepth<=0||(this._eventBatchDepth--,this._eventBatchDepth===0&&(this.transactionManager.flushPendingEntityModifiedEvents(),this.transactionManager.flushPendingLayerModifiedEvents(),this.flushEventBatch()))}isEventBatched(){return this._eventBatchDepth>0}notifyEntityAppended(t){if(this.isEventBatched()){const e=Array.isArray(t)?t:[t];this._pendingEntityAppended.push(...e);return}this.events.entityAppended.dispatch({database:this,entity:t})}notifyEntityErased(t){if(this.isEventBatched()){const e=Array.isArray(t)?t:[t];this._pendingEntityErased.push(...e);return}this.events.entityErased.dispatch({database:this,entity:t})}notifyDictObjectSet(t,e){if(this.isEventBatched()){this._pendingDictObjectSet.push({object:t,key:e});return}this.events.dictObjetSet.dispatch({database:this,object:t,key:e})}notifyDictObjectErased(t,e){if(this.isEventBatched()){this._pendingDictObjectErased.push({object:t,key:e});return}this.events.dictObjectErased.dispatch({database:this,object:t,key:e})}flushEventBatch(){if(this._pendingEntityAppended.length>0){const t=this._pendingEntityAppended;this._pendingEntityAppended=[],this.events.entityAppended.dispatch({database:this,entity:t})}if(this._pendingEntityErased.length>0){const t=this._pendingEntityErased;this._pendingEntityErased=[],this.events.entityErased.dispatch({database:this,entity:t})}if(this._pendingDictObjectSet.length>0){const t=this._pendingDictObjectSet;this._pendingDictObjectSet=[];for(const{object:e,key:n}of t)this.events.dictObjetSet.dispatch({database:this,object:e,key:n})}if(this._pendingDictObjectErased.length>0){const t=this._pendingDictObjectErased;this._pendingDictObjectErased=[];for(const{object:e,key:n}of t)this.events.dictObjectErased.dispatch({database:this,object:e,key:n})}}get formatter(){return this._formatter??(this._formatter=new ol(this))}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}generateUniqueHandle(){let t=this.generateHandle();for(;this.isHandleTaken(t);)t=this.generateHandle();return t}initializeHandleSeed(t){const e=parseInt(t,16);if(!isNaN(e)&&e>0){const n=e-1;n>this._maxHandle&&(this._maxHandle=n)}}adoptExternalHandle(t,e){return this.releaseObjectHandle(t),e&&!e.startsWith(qt)&&!this.isHandleTaken(e)?(t.objectId=e,this.registerObjectHandle(t),this.updateMaxHandle(e),e):this.assignGeneratedHandle(t)}registerObjectHandle(t){const e=t.objectId;!e||e.startsWith(qt)||this._handleRegistry.set(e,t)}releaseObjectHandle(t){const e=t.objectId;!e||e.startsWith(qt)||this._handleRegistry.get(e)===t&&this._handleRegistry.delete(e)}isHandleTaken(t,e){if(!t||t.startsWith(qt))return!1;const n=this._handleRegistry.get(t);return n!==void 0&&n!==e}registerBootstrapHandles(){this._handleRegistry.clear(),this.registerObjectHandle(this);for(const t of Object.values(this._tables))this.registerObjectHandle(t);for(const t of Object.values(this._objects))this.registerObjectHandle(t)}assignGeneratedHandle(t){const e=t.objectId;this.releaseObjectHandle(t);const n=this.generateUniqueHandle();return t.objectId=n,this.registerObjectHandle(t),e&&e!==n&&this.updateMaxHandle(n),n}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const n=t.getAttrWithoutException("objectId"),r=e!=null&&n!=null&&e(n);if(!n||t.isTemp||r){this.assignGeneratedHandle(t);return}const o=this._handleRegistry.get(n);if(o&&o!==t)if(this.shouldPreserveIncomingHandle(t))this.assignGeneratedHandle(o);else{this.assignGeneratedHandle(t);return}this.registerObjectHandle(t),this.updateMaxHandle(n)}shouldPreserveIncomingHandle(t){return!t.isTemp}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar(w.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get auprec(){return this._auprec}set auprec(t){this.updateSysVar(w.AUPREC,this._auprec,t??0,e=>{this._auprec=e})}get lunits(){return this._lunits}set lunits(t){this.updateSysVar(w.LUNITS,this._lunits,t??W.Decimal,e=>{this._lunits=e})}get luprec(){return this._luprec}set luprec(t){this.updateSysVar(w.LUPREC,this._luprec,t??4,e=>{this._luprec=e})}get version(){return this._version}set version(t){this.updateSysVar(w.ACADVER,this._version,new Rt(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(w.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get unitmode(){return this._unitmode}set unitmode(t){this.updateSysVar(w.UNITMODE,this._unitmode,t??0,e=>{this._unitmode=e})}get measurement(){return this._measurement}set measurement(t){this.updateSysVar(w.MEASUREMENT,this._measurement,t??1,e=>{this._measurement=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(w.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}get drawNoPlotLayers(){return this._drawNoPlotLayers}get dwgname(){return this._dwgname}setDwgName(t){const e=t.trim();e&&this.updateSysVar(w.DWGNAME,this._dwgname,e,n=>{this._dwgname=n})}isLayerDrawable(t){if(this._drawNoPlotLayers)return!0;const e=this.tables.layerTable.getAt(t);return e==null||e.isPlottable}set lwdisplay(t){this.updateSysVar(w.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(w.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(w.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celtype(){return this._celtype}set celtype(t){const e=this.normalizeLinetypeName(t??K);this.updateSysVar(w.CELTYPE,this._celtype,e,n=>{this._celtype=n})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(w.CELWEIGHT,this._celweight,t??exports.AcGiLineWeight.ByLayer,e=>{this._celweight=e})}get cetransparency(){return this._cetransparency}set cetransparency(t){this.updateSysVar(w.CETRANSPARENCY,this._cetransparency,t??new Q,e=>{this._cetransparency=e.clone()})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(w.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get cmlstyle(){return this._cmlstyle}set cmlstyle(t){this.updateSysVar(w.CMLSTYLE,this._cmlstyle,t??Kt,e=>{this._cmlstyle=e})}get cmlscale(){return this._cmlscale}set cmlscale(t){this.updateSysVar(w.CMLSCALE,this._cmlscale,t??1,e=>{this._cmlscale=e})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(t){this.updateSysVar(w.CMLEADERSTYLE,this._cmleaderstyle,t??Zt,e=>{this._cmleaderstyle=e})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(t){this.updateSysVar(w.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,t??new O(exports.AcCmColorMethod.None),e=>{this._hpbackgroundcolor=e.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(t){this.updateSysVar(w.HPCOLOR,this._hpcolor,t??this._cecolor,e=>{this._hpcolor=e.clone()})}get hplayer(){return this._hplayer}set hplayer(t){this.updateSysVar(w.HPLAYER,this._hplayer,t??".",e=>{this._hplayer=e})}get hptransparency(){return this._hptransparency}set hptransparency(t){this.updateSysVar(w.HPTRANSPARENCY,this._hptransparency,t??new Q,e=>{this._hptransparency=e.clone()})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(w.TEXTSTYLE,this._textstyle,t??q,e=>{this._textstyle=e})}get angbase(){return this._angbase}set angbase(t){this.updateSysVar(w.ANGBASE,this._angbase,t??0,e=>{this._angbase=e})}get angdir(){return this._angdir}set angdir(t){this.updateSysVar(w.ANGDIR,this._angdir,t??0,e=>{this._angdir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent(w.EXTMAX,e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent(w.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(w.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(w.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(w.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}get orthomode(){return this._orthomode}set orthomode(t){this.updateSysVar(w.ORTHOMODE,this._orthomode,t??0,e=>{this._orthomode=e})}get lastOpenError(){return this._lastOpenError}async read(t,e,n=$e.DXF){const r=Et.instance.get(n);if(r==null)throw new Error(`Database converter for file type '${n}' isn't registered and can can't read this file!`);this.clear(),this._lastOpenError=null,this._drawNoPlotLayers=(e==null?void 0:e.drawNoPlotLayers)??!0,e!=null&&e.fileName&&this.setDwgName(e.fileName);try{await r.read(t,this,e&&e.minimumChunkSize||10,this.createConversionProgressHandler(e),e==null?void 0:e.timeout,e==null?void 0:e.sysVars)}catch(s){const o=ln.from(s);throw this._lastOpenError=o,this.events.openFailed.dispatch({database:this,error:o}),o}this._lastOpenError=null,this.ensureDatabaseDefaults()}createConversionProgressHandler(t){return async(e,n,r,s,o)=>{let a=s;if(r==="ERROR"&&o){const l=ln.fromTask(o);this._lastOpenError=l,a={code:l.code,message:l.message,stage:l.stage??n}}if(this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:n,subStageStatus:r,data:a}),t&&t.fontLoader&&n=="FONT"&&r=="END"){const l=s||this.tables.textStyleTable.fonts;try{await t.fontLoader.load(l)}catch(h){if(t.failOnFontLoadError)throw h;const c=h instanceof Error?h.message:String(h);this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:n,subStageStatus:"ERROR",data:{fonts:l,error:c,code:"font_load_failed"}})}}}}async openUri(t,e){var d;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const n=await fetch(t);if(!n.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${n.status}'!`);const r=n.headers.get("content-length"),s=r?parseInt(r,10):null;let o=0;const a=(d=n.body)==null?void 0:d.getReader();if(!a)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:f,value:p}=await a.read();if(f)break;if(l.push(p),o+=p.length,s!==null){const m=Math.round(o/s*100);this.events.openProgress.dispatch({database:this,percentage:m,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const h=new Uint8Array(o);let c=0;for(const f of l)h.set(f,c),c+=f.length;const u=this.getFileNameFromUri(t);u&&this.setDwgName(u);const g=u.toLowerCase().split(".").pop();g==="dwg"?await this.read(h.buffer,e,$e.DWG):g==="dxf"?await this.read(h.buffer,e,$e.DXF):await this.read(h.buffer,e,g),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,n=this.version.name,r=!1){this.ensureDatabaseDefaults();const s=n instanceof Rt?n:new Rt(n),o=new Ro({database:this,precision:e,version:s});return this.writeDxfHeaderSection(o),this.writeDxfClassesSection(o),this.writeDxfTablesSection(o,s),this.writeDxfBlocksSection(o),this.writeDxfEntitiesSection(o),this.writeDxfObjectsSection(o),o.writeStart("EOF"),o.toString()}async regen(){await new Ua(this).read(null,this,500,this.createConversionProgressHandler())}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new sl(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureEntityStyleDefaults(t){var e;if(t.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||Kt);return}if(t.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||Zt);return}if(t.dxfTypeName==="HATCH"){const n=t;(e=n.applyPatternDefaultsFromSysVars)==null||e.call(n,this)}}ensureTextStyleDefaults(){this.hasDefaultTextStyle()||this.tables.textStyleTable.add(new qr({name:q,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}hasDefaultTextStyle(){const t=[q,"STANDARD"];for(const e of t)if(this.tables.textStyleTable.has(e))return!0;for(const e of this.tables.textStyleTable.newIterator())if(e.name.toUpperCase()===q.toUpperCase())return!0;return!1}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new O;e.colorIndex=7,this.tables.layerTable.add(new ii({name:"0",standardFlags:0,linetype:Jt,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(Ct)||this.tables.linetypeTable.add(new ue({name:Ct,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(K)||this.tables.linetypeTable.add(new ue({name:K,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Jt)||this.tables.linetypeTable.add(new ue({name:Jt,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.ensureTextStyleDefaults(),this.tables.dimStyleTable.has(q)||this.tables.dimStyleTable.add(new xt({name:q,dimtxsty:q})),!this.tables.viewportTable.has(Ne)){const e=new de;e.name=Ne,this.tables.viewportTable.add(e)}this.ensureMLineStyle(this._cmlstyle||Kt),this.ensureMLeaderStyle(this._cmleaderstyle||Zt);const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new ni;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=t.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(e.layoutName,e),t.layoutId=e.objectId}this.tables.appIdTable.has(Vi)||this.tables.appIdTable.add(new qi(Vi)),this.tables.appIdTable.has(zi)||this.tables.appIdTable.add(new qi(zi))}ensureMLineStyle(t){const e=this.objects.mlineStyle,n=t.trim();if(!n||e.getAt(n))return;for(const[s,o]of e.entries())if(s.toUpperCase()===n.toUpperCase()||o.styleName.toUpperCase()===n.toUpperCase())return;const r=new fl;r.styleName=n,r.elements=[{offset:.5,color:new O().setByLayer(),lineType:K},{offset:-.5,color:new O().setByLayer(),lineType:K}],e.setAt(n,r)}ensureMLeaderStyle(t){const e=this.objects.mleaderStyle,n=t.trim();if(!n||e.getAt(n))return;for(const[a]of e.entries())if(a.toUpperCase()===n.toUpperCase())return;const r=new gl;r.unknown1=2,r.maxLeaderSegmentsPoints=2,r.leaderLineColor=new O().setByBlock(),r.textColor=new O().setByBlock(),r.blockColor=new O().setByBlock(),r.alignSpace=4,r.breakSize=3.75,r.enableBlockRotation=!0,r.unknown2=!1;const s=this.tables.linetypeTable.getAt(Ct);r.leaderLineTypeId=s==null?void 0:s.objectId;const o=this.tables.textStyleTable.getAt(q);r.textStyleId=o==null?void 0:o.objectId,e.setAt(n,r)}writeDxfHeaderSection(t){var e;t.startSection("HEADER"),t.writeString(9,"$ACADVER"),t.writeString(1,((e=t.version)==null?void 0:e.name)??this.version.name),t.writeString(9,"$HANDSEED"),t.writeString(5,t.nextHandle.toString(16).toUpperCase()),t.version!=null&&t.version.value>=27&&(t.writeString(9,"$DWGCODEPAGE"),t.writeString(3,"UTF-8")),t.writeString(9,"$INSUNITS"),t.writeInt16(70,this.insunits),t.writeString(9,"$LUNITS"),t.writeInt16(70,this.lunits),t.writeString(9,"$LUPREC"),t.writeInt16(70,this.luprec),t.writeString(9,"$UNITMODE"),t.writeInt16(70,this.unitmode),t.writeString(9,"$MEASUREMENT"),t.writeInt16(70,this.measurement),t.writeString(9,"$LTSCALE"),t.writeDouble(40,this.ltscale),t.writeString(9,"$LWDISPLAY"),t.writeInt16(70,this.lwdisplay?1:0),t.writeString(9,"$CLAYER"),t.writeString(8,this.clayer),t.writeString(9,"$CELTYPE"),t.writeString(6,this.celtype),this.cetransparency.isInvalid||(t.writeString(9,"$CETRANSPARENCY"),t.writeTransparency(this.cetransparency)),t.writeString(9,"$CMLSTYLE"),t.writeString(2,this.cmlstyle),t.writeString(9,"$CMLSCALE"),t.writeDouble(40,this.cmlscale),t.writeString(9,"$CMLEADERSTYLE"),t.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPCOLOR"),t.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPBACKGROUNDCOLOR"),t.writeCmColor(this.hpbackgroundcolor,2)),t.writeString(9,"$HPLAYER"),t.writeString(8,this.hplayer),this.hptransparency.isInvalid||(t.writeString(9,"$HPTRANSPARENCY"),t.writeTransparency(this.hptransparency)),t.writeString(9,"$TEXTSTYLE"),t.writeString(7,this.textstyle),t.writeString(9,"$ANGBASE"),t.writeAngle(50,this.angbase),t.writeString(9,"$ANGDIR"),t.writeInt16(70,this.angdir),t.writeString(9,"$AUNITS"),t.writeInt16(70,this.aunits),t.writeString(9,"$AUPREC"),t.writeInt16(70,this.auprec),t.writeString(9,"$EXTMIN"),t.writePoint3d(10,this.extmin),t.writeString(9,"$EXTMAX"),t.writePoint3d(10,this.extmax),t.writeString(9,"$PDMODE"),t.writeInt32(70,this.pdmode),t.writeString(9,"$PDSIZE"),t.writeDouble(40,this.pdsize),t.writeString(9,"$OSMODE"),t.writeInt32(70,this.osmode),t.writeString(9,"$ORTHOMODE"),t.writeInt16(70,this.orthomode),t.endSection()}writeDxfClassesSection(t){if(this._classes.length!==0){t.startSection("CLASSES");for(const e of this._classes)t.writeStart("CLASS"),t.writeString(1,e.name),t.writeString(2,e.cppClassName),t.writeString(3,e.appName),t.writeInt32(90,e.proxyFlag),t.writeInt32(91,e.instanceCount),t.writeInt8(280,e.wasProxy?1:0),t.writeInt8(281,e.isEntity?1:0);t.endSection()}}writeDxfTablesSection(t,e){t.startSection("TABLES"),this.writeDxfTable(t,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(t,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(t,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(t,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(t,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(!0),"STYLE"),this.writeDxfTable(t,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(t,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),e.value>=19&&this.writeDxfTable(t,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),t.endSection()}writeDxfBlocksSection(t){t.startSection("BLOCKS");for(const e of this.tables.blockTable.newIterator()){if(e.dxfOutBlockBegin(t),!e.isModelSapce&&!e.isPaperSapce)for(const n of e.newIterator())this.writeDxfEntity(t,n);e.dxfOutBlockEnd(t)}t.endSection()}writeDxfEntitiesSection(t){t.startSection("ENTITIES");for(const e of this.tables.blockTable.newIterator())if(!(!e.isModelSapce&&!e.isPaperSapce))for(const n of e.newIterator())this.writeDxfEntity(t,n);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const n=o=>{t.writeStart("DICTIONARY"),o.dxfOut(t)},r=(o,a)=>{e.getAt(o)!==a&&e.setAt(o,a)},s=o=>{e.getAt(o)&&e.remove(o)};r("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?r("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):s("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?r("ACAD_MLINESTYLE",this.objects.mlineStyle):s("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?r("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):s("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?r("MLIGHT_XRECORD",this.objects.xrecord):s("MLIGHT_XRECORD"),n(e),n(this.objects.layout),this.objects.mleaderStyle.numEntries>0&&n(this.objects.mleaderStyle),this.objects.mlineStyle.numEntries>0&&n(this.objects.mlineStyle),this.objects.imageDefinition.numEntries>0&&n(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&n(this.objects.xrecord);for(const[o,a]of this.objects.layout.entries())t.writeStart("LAYOUT"),a.dxfOut(t);for(const[o,a]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),a.dxfOut(t);for(const[o,a]of this.objects.mleaderStyle.entries())t.writeStart("MLEADERSTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.mlineStyle.entries())t.writeStart("MLINESTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.xrecord.entries())t.writeStart("XRECORD"),a.dxfOut(t);t.endSection()}writeDxfTable(t,e,n,r,s){const o=[...r];t.startTable(e),n.dxfOut(t);for(const a of o){if(s==="BLOCK_RECORD"&&a instanceof J){a.dxfOutBlockRecord(t);continue}t.writeStart(s),a.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){this.transactionManager.clearUndoStack(),this._classes=[],this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty(),this.registerBootstrapHandles()}updateSysVar(t,e,n,r){tt.instance().applyVarMutation(t,e,n,this,()=>r(n))}normalizeLinetypeName(t){const e=t.trim();return e.toUpperCase()==="BYLAYER"?K:e.toUpperCase()==="BYBLOCK"?Ct:e}triggerSysVarChangedEvent(t,e,n){const r=tt.instance(),s=t.toLowerCase();r.getDescriptor(s)!=null&&r.events.sysVarChanged.dispatch({database:this,name:s,oldVal:e,newVal:n})}getFileNameFromUri(t){try{const n=new URL(t).pathname.split("/");return n[n.length-1]||""}catch{return""}}};Qe._unsavedDrawingSequence=0;let Zi=Qe;class Pd{constructor(){this.transactionStack=[]}startTransaction(){const t=new ts;return this.transactionStack.push(t),t}currentTransaction(){return this.transactionStack[this.transactionStack.length-1]}commitTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to commit.");t.commit()}abortTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to abort.");t.abort()}hasTransaction(){return this.transactionStack.length>0}}class Ad extends Jr{constructor(t,e){t=t||{};const n=t.viewWidth!==void 0;Pt(t,{standardFlags:0,ucsAssociated:!1,cameraPlottable:!1,ucsElevation:0}),super(t,e),n||(this.viewWidth=this.viewHeight)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get viewWidth(){return this.getAttr("viewWidth")}set viewWidth(t){this.setAttr("viewWidth",t)}get ucsAssociated(){return this.getAttr("ucsAssociated")}set ucsAssociated(t){this.setAttr("ucsAssociated",t)}get cameraPlottable(){return this.getAttr("cameraPlottable")}set cameraPlottable(t){this.setAttr("cameraPlottable",t)}get ucsElevation(){return this.getAttr("ucsElevation")}set ucsElevation(t){this.setAttr("ucsElevation",t)}get ucsObjectId(){return this.getAttrWithoutException("ucsObjectId")}set ucsObjectId(t){this.setAttr("ucsObjectId",t)}get ucsBaseObjectId(){return this.getAttrWithoutException("ucsBaseObjectId")}set ucsBaseObjectId(t){this.setAttr("ucsBaseObjectId",t)}get backgroundObjectId(){return this.getAttrWithoutException("backgroundObjectId")}set backgroundObjectId(t){this.setAttr("backgroundObjectId",t)}get liveSectionObjectId(){return this.getAttrWithoutException("liveSectionObjectId")}set liveSectionObjectId(t){this.setAttr("liveSectionObjectId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeDouble(40,this.gsView.viewHeight),t.writePoint2d(10,this.centerPoint),t.writeDouble(41,this.viewWidth),t.writePoint3d(11,this.gsView.viewDirectionFromTarget),t.writePoint3d(12,this.gsView.viewTarget),t.writeDouble(42,this.gsView.lensLength),t.writeDouble(43,this.gsView.frontClippingPlane),t.writeDouble(44,this.gsView.backClippingPlane),t.writeAngle(50,this.gsView.viewTwistAngle),t.writeInt16(71,this.gsView.viewMode),t.writeInt16(281,this.gsView.renderMode),t.writeInt16(72,this.ucsAssociated?1:0),t.writeInt16(73,this.cameraPlottable?1:0),t.writeObjectId(332,this.backgroundObjectId),t.writeObjectId(334,this.liveSectionObjectId),t.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(t.writePoint3d(110,this.gsView.ucsOrigin),t.writePoint3d(111,this.gsView.ucsXAxis),t.writePoint3d(112,this.gsView.ucsYAxis),t.writeInt16(79,this.gsView.orthographicType),t.writeDouble(146,this.ucsElevation),t.writeObjectId(345,this.ucsObjectId),t.writeObjectId(346,this.ucsBaseObjectId)),this}}const as=class as extends z{getOffsetSideAtPoint(t){return 1}};as.typeName="Curve";let it=as;const Ee=class Ee extends it{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new V}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}addVertexAt(t,e,n=0,r=-1,s=-1){const o=r<0?void 0:r,a=s<0?void 0:s,l={x:e.x,y:e.y,bulge:n,startWidth:o,endWidth:a};this._geo.addVertexAt(t,l)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new y(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new k({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return this.shouldIncludeSegmentMidpointGrips()&&this.appendSegmentMidpointGrips(t),t}subMoveGripPointsAt(t,e){const n=this.numberOfVertices,r=this.shouldIncludeSegmentMidpointGrips(),s=r?this.getSegmentCount():0;return Z(t,o=>{if(o<n){qe(this._geo.vertices,o,e);return}if(!r||o>=n+s)return;const a=o-n;qe(this._geo.vertices,a,e),qe(this._geo.vertices,(a+1)%n,e)}),this}shouldIncludeSegmentMidpointGrips(){return this.getGripsMode()>=2}getGripsMode(){try{const t=tt.instance().getVar(w.GRIPS,this.database);return typeof t=="number"?t:2}catch{return 2}}getSegmentCount(){const t=this.numberOfVertices;return t<2?0:this.closed?t:t-1}appendSegmentMidpointGrips(t){var o;const e=this._geo,n=this._elevation,r=this.getSegmentCount(),s=e.numberOfVertices;for(let a=0;a<r;a++){const l=[];sn(e.getPointAt(a),e.getPointAt((a+1)%s),(o=e.vertices[a])==null?void 0:o.bulge,n,x.MidPoint,{x:0,y:0,z:0},l),t.push(...l)}}subGetOsnapPoints(t,e,n,r){var l;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case x.EndPoint:for(let h=0;h<a;h++){const c=s.getPointAt(h);r.push(new y(c.x,c.y,o))}break;case x.MidPoint:case x.Nearest:case x.Perpendicular:case x.Tangent:{const h=this.closed?a:a-1,c=[];for(let u=0;u<h;u++){const g=[];sn(s.getPointAt(u),s.getPointAt((u+1)%a),(l=s.vertices[u])==null?void 0:l.bulge,o,t,e,g),c.push(...g)}if(t===x.MidPoint)r.push(...c);else{const u=wt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let n=this._elevation;return this._geo.vertices.forEach(r=>{const s=new y(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,n=s.z,e&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._elevation=n,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.getPoints(100),n=this.createWidthProfile();if(n!=null){const s=Ld(n,this.closed);if(s!=null){const o=t.subEntityTraits;return o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}}const r=[];return e.forEach(s=>r.push(new y().set(s.x,s.y,this.elevation))),t.lines(r)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0);const e=this.resolveConstantWidth();e!=null&&t.writeDouble(43,e),t.writeDouble(38,this.elevation);const n=this._geo.vertices;for(let r=0;r<n.length;++r){const s=n[r];t.writePoint2d(10,this.getPoint2dAt(r)),e==null&&(s.startWidth!=null&&t.writeDouble(40,s.startWidth),s.endWidth!=null&&t.writeDouble(41,s.endWidth));const o=s.bulge??0;o!==0&&t.writeDouble(42,o)}return this}resolveConstantWidth(){const t=this._geo.vertices;if(t.length===0)return;let e;for(const n of t){const r=n.startWidth,s=n.endWidth;if(r==null&&s==null){if(e!=null&&e!==0)return;e=e??0;continue}const o=r??0;if(o!==(s??0))return;if(e==null)e=o;else if(e!==o)return}return e!=null&&e!==0?e:void 0}createWidthProfile(){const t=this._geo.vertices,e=t.length;if(e<2)return null;const n=this.closed?e:e-1,r=[];let s=!1;for(let o=0;o<n;o++){const a=t[o],l=t[(o+1)%e],h=Math.max(0,a.startWidth??0),c=Math.max(0,a.endWidth??0);(h>et||c>et)&&(s=!0);const u=this.sampleSegment(a,l),g=u.length-1;for(let d=0;d<=g;d++){if(d===0&&r.length>0||this.closed&&o===n-1&&d===g)continue;const f=g>0?d/g:0;r.push({x:u[d].x,y:u[d].y,width:Xd(h,c,f)})}}return s&&r.length>=2?r:null}sampleSegment(t,e){if(t.bulge&&Math.abs(t.bulge)>et){const r=new ht(t,e,t.bulge).getPoints(32);if(r.length>1)return r.map(s=>new A(s.x,s.y))}return[new A(t.x,t.y),new A(e.x,e.y)]}static from2dPoints(t,e){const n=new Ee;return t.forEach((r,s)=>n.addVertexAt(s,r)),n.closed=e,n}static fromGePolyline(t){const e=new Ee;return t.vertices.forEach((n,r)=>{e.addVertexAt(r,new A(n.x,n.y),n.bulge??0)}),e.closed=t.closed,e}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.numberOfVertices;let n=1/0,r=1;const s=this.closed?e:e-1;for(let o=0;o<s;o++){const a=this.getPoint2dAt(o),l=this.getPoint2dAt((o+1)%e),h=l.x-a.x,c=l.y-a.y,u=h*h+c*c;if(u===0)continue;const g=Math.max(0,Math.min(1,((t.x-a.x)*h+(t.y-a.y)*c)/u)),d=(t.x-a.x-g*h)**2+(t.y-a.y-g*c)**2;d<n&&(n=d,r=h*(t.y-a.y)-c*(t.x-a.x)>=0?1:-1)}return r}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:Ee.fromGePolyline(e[0])}};Ee.typeName="Polyline";let ft=Ee;function ai(i,t,e){const n=zc(i,t,e);return n?ft.fromGePolyline(n):null}const et=1e-6,po=4,Sd=.75;function Ld(i,t){if(i.length<2)return null;if(t)return wi(i,!0);const e=Ed(i);if(e.length===1)return wi(e[0],!1);const n=new kt;let r=!1;for(const s of e){const o=wi(s,!1);if(o!=null){for(const a of o.loops)n.add(a);r=!0}}return r?n:null}function wi(i,t){const e=Od(i,t);if(e.length<2)return null;const{left:n,right:r}=Ml(e,t);if(mo(n)<2||mo(r)<2)return null;const s=new kt;if(t){const o=Rn(n),a=Rn(r);if(!cn(o)||!cn(a))return null;const l=Math.abs(hn(o)),h=Math.abs(hn(a)),[c,u]=l>=h?[o,a]:[a,o];return s.add(new V(c,!0)),s.add(new V(u,!0)),s}return Md(e)&&Td(s,e)||kd(s,n,r)?s:null}function Ed(i){if(i.length<2)return[i];const t=[];let e=0;const n=new Map;for(let s=0;s<i.length;s++){const o=yo(i[s]),a=n.get(o);if(a!=null&&s-a>1){const l=i.slice(e,s+1);l.length>=2&&t.push(l),e=a,n.clear();for(let h=e;h<=s;h++)n.set(yo(i[h]),h);continue}n.set(o,s)}const r=i.slice(e);return r.length>=2&&t.push(r),t.length>0?t:[i]}function yo(i){return`${i.x.toFixed(4)}:${i.y.toFixed(4)}`}function Id(i,t){const e=Math.max(i,t),n=Math.min(i,t);return e<=et||e-n<=et?!1:n/e<=Sd}function Md(i){const t=i[0],e=i[i.length-1],n=Math.hypot(e.x-t.x,e.y-t.y);if(n<=et)return!0;const r=Math.max(...i.map(s=>s.width));return r<=et?!1:n<=r*4}function Td(i,t){const{left:e,right:n}=Ml(t,!0),r=Rn(e),s=Rn(n);if(!cn(r)||!cn(s))return!1;const o=Math.abs(hn(r)),a=Math.abs(hn(s));if(!Id(o,a))return!1;const[l,h]=o>=a?[r,s]:[s,r];return i.add(new V(l,!0)),i.add(new V(h,!0)),!0}function Ml(i,t){const e=new Array(i.length),n=new Array(i.length);for(let r=0;r<i.length;r++){const s=i[r],o=Math.max(0,s.width)/2;if(o<=et){e[r]=null,n[r]=null;continue}const a=Nd(i,r,t);if(a==null){e[r]=null,n[r]=null;continue}e[r]={x:s.x+a.x*o,y:s.y+a.y*o},n[r]={x:s.x-a.x*o,y:s.y-a.y*o}}return{left:e,right:n}}function Cd(i,t,e,n,r){const s=[t,e,n,r];return cn(s)?(i.add(new V(s,!0)),!0):!1}function kd(i,t,e){let n=!1;for(let r=0;r<t.length-1;r++){const s=t[r],o=t[r+1],a=e[r],l=e[r+1];s==null||o==null||a==null||l==null||Cd(i,s,o,l,a)&&(n=!0)}return n}function mo(i){return i.reduce((t,e)=>e==null?t:t+1,0)}function Rn(i){return i.filter(t=>t!=null)}function Od(i,t){const e=[];if(i.forEach(n=>{const r=e[e.length-1];(!r||Math.abs(r.x-n.x)>et||Math.abs(r.y-n.y)>et||Math.abs(r.width-n.width)>et)&&e.push(n)}),t&&e.length>1){const n=e[0],r=e[e.length-1];Math.abs(n.x-r.x)<=et&&Math.abs(n.y-r.y)<=et&&e.pop()}return e}function Nd(i,t,e){const n=i.length,r=i[t],s=i[(t-1+n)%n],o=i[(t+1)%n];let a=_o(r.x-s.x,r.y-s.y),l=_o(o.x-r.x,o.y-r.y);if(e||(t===0&&(a=l),t===n-1&&(l=a)),a==null&&l==null)return null;if(a==null)return Ln(l);if(l==null)return Ln(a);const h=Ln(a),c=Ln(l),u=h.x+c.x,g=h.y+c.y,d=Math.hypot(u,g);if(d<=et)return c;const f={x:u/d,y:g/d},p=Math.abs(f.x*c.x+f.y*c.y),m=p<=et?po:Math.min(1/p,po);return{x:f.x*m,y:f.y*m}}function _o(i,t){const e=Math.hypot(i,t);return e<=et?null:{x:i/e,y:t/e}}function Ln(i){return{x:-i.y,y:i.x}}function hn(i){let t=0;const e=i.length;for(let n=0;n<e;n++){const r=i[n],s=i[(n+1)%e];t+=r.x*s.y-s.x*r.y}return t/2}function cn(i){return i.length>=3&&Math.abs(hn(i))>et}function Xd(i,t,e){return i+(t-i)*e}var Tl=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.FitCurvePoly=1]="FitCurvePoly",i[i.QuadSplinePoly=2]="QuadSplinePoly",i[i.CubicSplinePoly=3]="CubicSplinePoly",i))(Tl||{});const ls=class ls extends it{get dxfTypeName(){return"POLYLINE"}constructor(t,e,n=0,r=!1,s=0,o=0,a=null){super(),this._polyType=t,this._elevation=n;const l=a&&(a==null?void 0:a.length)===e.length,h=e.map((c,u)=>({x:c.x,y:c.y,bulge:l?a[u]:void 0}));this._geo=new V(h,r)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}getBulgeAt(t){const e=this._geo.vertices[t];return(e==null?void 0:e.bulge)||0}get geometricExtents(){const t=this._geo.box;return new k({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const n=this._geo.getPointAt(e);t.push(new y(n.x,n.y,this._elevation))}return t}subMoveGripPointsAt(t,e){return Z(t,n=>{qe(this._geo.vertices,n,e)}),this}subGetOsnapPoints(t,e,n,r){var l;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case x.EndPoint:for(let h=0;h<a;h++){const c=s.getPointAt(h);r.push(new y(c.x,c.y,o))}break;case x.MidPoint:case x.Nearest:case x.Perpendicular:case x.Tangent:{const h=this.closed?a:a-1,c=[];for(let u=0;u<h;u++){const g=[];sn(s.getPointAt(u),s.getPointAt((u+1)%a),(l=s.vertices[u])==null?void 0:l.bulge,o,t,e,g),c.push(...g)}if(t===x.MidPoint)r.push(...c);else{const u=wt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let n=this._elevation;return this._geo.vertices.forEach(r=>{const s=new y(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,n=s.z,e&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._elevation=n,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(r=>e.push(new y().set(r.x,r.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;++n)t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint3d(10,{x:this.getPointAt(n).x,y:this.getPointAt(n).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(n)),t.writeInt16(70,0);return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb2dPolyline");let e=this.closed?1:0;return this.polyType===1&&(e|=2),this.polyType===2&&(e|=4),this.polyType===3&&(e|=8),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),t.writeDouble(10,0),t.writeDouble(20,0),t.writeDouble(30,this.elevation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ft.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:ft.fromGePolyline(e[0])}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}};ls.typeName="2dPolyline";let Qi=ls;var Cl=(i=>(i[i.Vertex=0]="Vertex",i[i.CurveFitVertex=1]="CurveFitVertex",i[i.SplineFitVertex=8]="SplineFitVertex",i[i.SplineCtlVertex=9]="SplineCtlVertex",i))(Cl||{});const hs=class hs extends z{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new y,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new k().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return Ot(t,e,this._position),this}subGetOsnapPoints(t,e,n,r){(t===x.EndPoint||t===x.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint2d(10,this.position),t.writeDouble(40,this.startWidth),t.writeDouble(41,this.endWidth),t.writeDouble(42,this.bulge),t.writeInt16(70,this.vertexType),this}};hs.typeName="2dVertex";let Ji=hs;var kl=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.QuadSplinePoly=1]="QuadSplinePoly",i[i.CubicSplinePoly=2]="CubicSplinePoly",i))(kl||{});const Un=class Un extends it{get dxfTypeName(){return"POLYLINE"}constructor(t,e,n=!1){super(),this._polyType=t,this._geo=new V(e,n)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}get area(){return 0}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){const e=this._geo.vertices[t];return new y(e.x,e.y,e.z||0)}get geometricExtents(){const t=this._geo.vertices.map(e=>new y(e.x,e.y,e.z||0));return new k().setFromPoints(t)}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e)t.push(this.getPointAt(e));return t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveVertexAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){const s=Array.from({length:this._geo.numberOfVertices},(o,a)=>this.getPointAt(a));if(s.length!==0)switch(t){case x.EndPoint:r.push(...s);break;case x.MidPoint:case x.Nearest:case x.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];ze(s[a],s[a+1],t,e,l),o.push(...l)}if(t===x.MidPoint)r.push(...o);else{const a=wt(e,o);a&&r.push(a)}break}}}transformBy(t){return this._geo.vertices.forEach(e=>{const n=new y(e.x,e.y,e.z||0).applyMatrix4(t);e.x=n.x,e.y=n.y,e.z=n.z}),this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.vertices.map(n=>new y(n.x,n.y,n.z||0));return t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;++n){const r=this.getPointAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,{x:r.x,y:r.y,z:r.z}),t.writeInt16(70,32)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dPolyline");let e=this.closed?1:0;return e|=8,this.polyType===1&&(e|=16),this.polyType===2&&(e|=32),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ft.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);if(e.length===0)return null;const n=e[0],r=[];for(let s=0;s<n.numberOfVertices;s++){const o=n.getPointAt(s);r.push(new y(o.x,o.y,this.interpolateZ(o.x,o.y)))}return new Un(this.polyType,r,this.closed)}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}interpolateZ(t,e){const n=this.numberOfVertices;if(n<=0)return 0;let r=1/0,s=this.getPointAt(0).z;const o=this.closed?n:n-1;for(let a=0;a<o;a++){const l=this.getPointAt(a),h=this.getPointAt((a+1)%n),c=h.x-l.x,u=h.y-l.y,g=c*c+u*u;if(g===0)continue;const d=Math.max(0,Math.min(1,((t-l.x)*c+(e-l.y)*u)/g)),f=l.x+c*d,p=l.y+u*d,m=(t-f)**2+(e-p)**2;m<r&&(r=m,s=l.z+(h.z-l.z)*d)}return s}moveVertexAt(t,e){const n=this._geo.vertices[t];if(!n)return;n.x+=e.x,n.y+=e.y;const r=n;r.z=(r.z??0)+(e.z??0)}};Un.typeName="3dPolyline";let tr=Un;const Yd=["ACIS BinaryFile","ASM BinaryFile4"],Ol=new Set(["End-of-ACIS-data","End-of-ASM-data","End-of-ACIS-History-data"]),B={NoType:0,Byte:1,Char:2,Short:3,Int:4,Float:5,Double:6,Str:7,Str2:8,Str3:9,BoolTrue:10,BoolFalse:11,Pointer:12,EntityType:13,EntityTypeEx:14,SubtypeStart:15,SubtypeEnd:16,RecordEnd:17,LiteralStr:18,LocationVec:19,DirectionVec:20,Enum:21,Unknown0x17:23};class Rd{constructor(t){this.data=t,this.index=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}get hasData(){return this.index<this.data.length}require(t){if(this.index+t>this.data.length)throw new RangeError(`SAB: read past end of data (need ${String(t)} at ${String(this.index)})`)}readByte(){return this.require(1),this.data[this.index++]??0}readInt(){this.require(4);const t=this.view.getInt32(this.index,!0);return this.index+=4,t}readFloat(){this.require(8);const t=this.view.getFloat64(this.index,!0);return this.index+=8,t}readStr(t){this.require(t);const e=Bd.decode(this.data.subarray(this.index,this.index+t));return this.index+=t,e}}const Bd=new TextDecoder("latin1");function Fd(i,t){let e="";for(const d of Yd)if(jd(t,d)){e=d,i.index=d.length;break}if(e==="")throw new RangeError("SAB: not a SAB stream (missing signature)");const n=i.readInt(),r=i.readInt(),s=i.readInt(),o=i.readInt(),a=vi(i),l=vi(i),h=vi(i),c=Pi(i),u=Pi(i),g=Pi(i);return{signature:e,version:n,numRecords:r,numEntities:s,flags:o,productId:a,acisVersion:l,creationDate:h,unitsInMm:c,resTol:u,norTol:g}}function vi(i){if(i.readByte()!==B.Str)throw new RangeError("SAB: expected string tag (0x07)");return i.readStr(i.readByte())}function Pi(i){if(i.readByte()!==B.Double)throw new RangeError("SAB: expected double tag (0x06)");return i.readFloat()}function zd(i){const t=[],e=[];let n="",r=0;for(;;){if(!i.hasData){if(Ol.has(n))return{type:n,tokens:t};throw new RangeError("SAB: premature end of data")}const s=i.readByte();switch(s){case B.Int:t.push({tag:s,value:i.readInt()});break;case B.Double:t.push({tag:s,value:i.readFloat()});break;case B.Str:t.push({tag:s,value:i.readStr(i.readByte())});break;case B.Pointer:t.push({tag:s,value:i.readInt()});break;case B.BoolTrue:t.push({tag:s,value:!0});break;case B.BoolFalse:t.push({tag:s,value:!1});break;case B.LiteralStr:t.push({tag:s,value:i.readStr(i.readInt())});break;case B.EntityTypeEx:e.push(i.readStr(i.readByte()));break;case B.EntityType:{e.push(i.readStr(i.readByte()));const o=e.join("-");e.length=0,n===""&&(n=o),t.push({tag:s,value:o});break}case B.LocationVec:t.push({tag:s,value:bo(i)});break;case B.DirectionVec:t.push({tag:s,value:bo(i)});break;case B.Enum:t.push({tag:s,value:i.readInt()});break;case B.Unknown0x17:t.push({tag:s,value:i.readFloat()});break;case B.SubtypeStart:r++,t.push({tag:s,value:r});break;case B.SubtypeEnd:t.push({tag:s,value:r}),r--;break;case B.RecordEnd:return{type:n,tokens:t};default:throw new RangeError(`SAB: unknown tag 0x${s.toString(16)} (${String(s)}) in record '${n}'`)}}}function bo(i){return[i.readFloat(),i.readFloat(),i.readFloat()]}function Vd(i){const t=new Rd(i),e=Fd(t,i),n=[];for(;t.hasData;){const r=zd(t);if(n.push(r),Ol.has(r.type))break}return{header:e,records:n}}function jd(i,t){if(i.length<t.length)return!1;for(let e=0;e<t.length;e++)if(i[e]!==t.charCodeAt(e))return!1;return!0}const Dd=new Set(["End-of-ACIS-data","End-of-ASM-data","End-of-ACIS-History-data"]);function Gd(i){const e=i.records.map((o,a)=>({index:a,type:o.type,record:o,refs:[]}));for(const o of e)for(const a of o.record.tokens){if(a.tag!==B.Pointer)continue;const l=a.value;o.refs.push(l>=0&&l<e.length?e[l]:null)}const n=e,r=new Map,s=new Map;for(const o of n){if(Dd.has(o.type))continue;let a=r.get(o.type);a===void 0&&(a=[],r.set(o.type,a)),a.push(o),s.set(o.type,(s.get(o.type)??0)+1)}return{header:i.header,nodes:n,bodies:r.get("body")??[],typeCounts:s,nodesOfType:o=>r.get(o)??[],pointLocations(){const o=[];for(const a of r.get("point")??[]){const l=a.record.tokens.find(h=>h.tag===B.LocationVec);l!==void 0&&o.push(l.value)}return o}}}const Hd=["ACIS BinaryFile","ASM BinaryFile","ASM BinaryFile4"];function Wd(i,t){if(t.length===0||i.length<t.length)return-1;const e=t.charCodeAt(0);for(let n=0;n<=i.length-t.length;n++){if(i[n]!==e)continue;let r=!0;for(let s=1;s<t.length;s++)if(i[n+s]!==t.charCodeAt(s)){r=!1;break}if(r)return n}return-1}function Ud(i){for(const t of Hd){const e=Wd(i,t);if(e>=0)return e}return-1}function $d(i){if(i.length===0)return null;const t=Ud(i);if(t<0)return null;try{return Gd(Vd(i.subarray(t)))}catch{return null}}class Nl{constructor(t){this.tokens=t,this.i=0}next(...t){for(;this.i<this.tokens.length;){const e=this.tokens[this.i++];if(e!==void 0&&t.includes(e.tag))return e}}nextVec(){var t;return(t=this.next(B.LocationVec,B.DirectionVec))==null?void 0:t.value}nextDouble(){var t;return(t=this.next(B.Double))==null?void 0:t.value}}const Se=(i,t)=>i.refs.find(e=>e!==null&&(e.type===t||e.type.endsWith(t)))??null,Xl=(i,t)=>i.refs.filter(e=>e!==null&&e.type===t);function Ai(i){if(i===null)return null;const t=Se(i,"point");if(t===null)return null;const e=t.record.tokens.find(n=>n.tag===B.LocationVec);return e?e.value:null}function qd(i){const t=new Nl(i.record.tokens);if(i.type==="straight-curve"){const e=t.nextVec(),n=t.nextVec();if(e&&n)return{kind:"straight",origin:e,direction:n}}else if(i.type==="ellipse-curve"){const e=t.nextVec(),n=t.nextVec(),r=t.nextVec(),s=t.nextDouble();if(e&&n&&r&&s!==void 0)return{kind:"ellipse",center:e,normal:n,majorAxis:r,ratio:s}}else if(i.type==="intcurve-curve")return{kind:"intcurve",controlPoints:Kd(i.record.tokens)};return{kind:"unknown"}}function Kd(i){var o,a,l;const t=i.findIndex(h=>h.tag===B.EntityType&&(h.value==="nubs"||h.value==="nurbs"));if(t<0)return[];let e=t+1,n=-1;for(;e<i.length;e++){const h=i[e];if(h===void 0||h.tag===B.Double)break;if(h.tag===B.Int&&(n=h.value),h.tag===B.EntityType||h.tag===B.SubtypeEnd)return[]}if(n<0)return[];for(let h=0;h<n;h++){if(((o=i[e])==null?void 0:o.tag)!==B.Double)return[];e+=1,((a=i[e])==null?void 0:a.tag)===B.Int&&(e+=1)}const r=[];for(;((l=i[e])==null?void 0:l.tag)===B.Double;){const h=i[e];if(h===void 0)break;r.push(h.value),e+=1}const s=[];for(let h=0;h+3<=r.length;h+=3){const c=r[h],u=r[h+1],g=r[h+2];if(c===void 0||u===void 0||g===void 0)break;s.push([c,u,g])}return s}function Yl(i){const t=new Nl(i.record.tokens);if(i.type==="plane-surface"){const e=t.nextVec(),n=t.nextVec(),r=t.nextVec();if(e&&n)return r?{kind:"plane",origin:e,normal:n,uDir:r}:{kind:"plane",origin:e,normal:n}}else if(i.type==="cone-surface"){const e=t.nextVec(),n=t.nextVec(),r=t.nextVec(),s=t.nextDouble(),o=t.nextDouble(),a=t.nextDouble();if(e&&n&&r&&s!==void 0&&o!==void 0&&a!==void 0)return{kind:"cone",origin:e,axis:n,majorAxis:r,ratio:s,sineAngle:o,cosineAngle:a}}else if(i.type==="torus-surface"){const e=t.nextVec(),n=t.nextVec(),r=t.nextDouble(),s=t.nextDouble();if(e&&n&&r!==void 0&&s!==void 0)return{kind:"torus",center:e,axis:n,majorRadius:r,minorRadius:s}}else if(i.type==="sphere-surface"){const e=t.nextVec(),n=t.nextDouble(),r=t.nextVec(),s=t.nextVec();if(e&&n!==void 0&&r&&s)return{kind:"sphere",center:e,radius:n,uDir:r,poleAxis:s}}return{kind:"unknown"}}function Zd(i){return Yl(i)}const Qd={"plane-surface":"plane","cone-surface":"cone","torus-surface":"torus","sphere-surface":"sphere","spline-surface":"spline"},Jd={"straight-curve":"straight","ellipse-curve":"ellipse","intcurve-curve":"intcurve"};function tg(i){const t=Se(i,"coedge");if(t===null)return 0;const e=new Set;let n=t;for(;n!==null&&!e.has(n.index);)e.add(n.index),n=Xl(n,"coedge")[0]??null;return e.size}function eg(i){const t=[];let e=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,a=-1/0;const l=d=>{d[0]<e&&(e=d[0]),d[0]>s&&(s=d[0]),d[1]<n&&(n=d[1]),d[1]>o&&(o=d[1]),d[2]<r&&(r=d[2]),d[2]>a&&(a=d[2])},h=i.nodesOfType("vertex").map(d=>{const f=Ai(d);return f===null?t.push(`vertex#${String(d.index)}: no resolvable point`):l(f),{nodeIndex:d.index,point:f}}),c=i.nodesOfType("edge").map(d=>{const f=Xl(d,"vertex"),p=Ai(f[0]??null),m=Ai(f[1]??null),_=Se(d,"-curve"),v=_?Jd[_.type]??"unknown":"unknown",P=_?qd(_):void 0;return p!==null&&m!==null&&p[0]===m[0]&&p[1]===m[1]&&p[2]===m[2]&&t.push(`edge#${String(d.index)}: degenerate (coincident endpoints)`),P===void 0||P.kind==="unknown"?{nodeIndex:d.index,start:p,end:m,curveType:v}:{nodeIndex:d.index,start:p,end:m,curveType:v,curve:P}}),u=i.nodesOfType("face").map(d=>{const f=Se(d,"-surface"),p=f?Qd[f.type]??"unknown":"unknown",m=f?Yl(f):void 0,_=[],v=new Set;let P=Se(d,"loop");for(;P!==null&&!v.has(P.index);)v.add(P.index),_.push({nodeIndex:P.index,coedgeCount:tg(P)}),P=Se(P,"loop");return f===null&&t.push(`face#${String(d.index)}: no surface`),m===void 0||m.kind==="unknown"?{nodeIndex:d.index,surfaceType:p,loops:_}:{nodeIndex:d.index,surfaceType:p,surface:m,loops:_}});return{vertices:h,edges:c,faces:u,bbox:e===1/0?null:{min:[e,n,r],max:[s,o,a]},diagnostics:t}}const oe=(i,t)=>[i[0]+t[0],i[1]+t[1],i[2]+t[2]],$t=(i,t)=>[i[0]*t,i[1]*t,i[2]*t],ng=i=>Math.hypot(i[0],i[1],i[2]),Tn=(i,t)=>[i[1]*t[2]-i[2]*t[1],i[2]*t[0]-i[0]*t[2],i[0]*t[1]-i[1]*t[0]],we=i=>{const t=Math.hypot(i[0],i[1],i[2]);return t>0?[i[0]/t,i[1]/t,i[2]/t]:[0,0,0]};function ig(i){const t=[];for(const r of i.record.tokens)if(r.tag===B.Double&&(t.push(r.value),t.length===2))break;const e=t[0],n=t[1];return e===void 0||n===void 0?null:[e,n]}function Rl(i,t,e,n){const r=$t(Tn(we(i.normal),i.majorAxis),i.ratio),s=Math.max(1,n),o=[];for(let a=0;a<=s;a++){const l=t+(e-t)*a/s;o.push(oe(i.center,oe($t(i.majorAxis,Math.cos(l)),$t(r,Math.sin(l)))))}return o}function rg(i,t=16){const e=we(i.poleAxis);let n=we(i.uDir),r=Tn(e,n);ng(r)<1e-9?(n=Math.abs(e[0])<.9?[1,0,0]:[0,1,0],r=we(Tn(e,n))):r=we(r),n=we(Tn(r,e));const s=[],o=(a,l)=>{const h=[],c=Math.max(8,t);for(let u=0;u<=c;u++){const g=Math.PI*2*u/c;h.push(oe(i.center,oe($t(a,i.radius*Math.cos(g)),$t(l,i.radius*Math.sin(g)))))}s.push(h)};o(n,r),o(n,e),o(r,e);for(const a of[-.5,.5]){const l=$t(e,i.radius*a),h=oe(i.center,l),c=i.radius*Math.sqrt(Math.max(0,1-a*a));if(c>1e-6){const u=[],g=Math.max(8,t);for(let d=0;d<=g;d++){const f=Math.PI*2*d/g;u.push(oe(h,oe($t(n,c*Math.cos(f)),$t(r,c*Math.sin(f)))))}s.push(u)}}return s}const sg=16,og=(i,t)=>i.refs.find(e=>e!==null&&(e.type===t||e.type.endsWith(t)))??null;function Bl(i,t,e){i.push(t[0],t[1],t[2],e[0],e[1],e[2])}function er(i,t){for(let e=0;e+1<t.length;e++){const n=t[e],r=t[e+1];n&&r&&Bl(i,n,r)}}function ag(i){const t=[];for(const e of i.nodesOfType("face")){const n=og(e,"-surface");if((n==null?void 0:n.type)!=="sphere-surface")continue;const r=Zd(n);if(r.kind==="sphere")for(const s of rg(r))er(t,s)}return new Float32Array(t)}function lg(i,t){var n,r;const e=[];for(const s of i.edges){const o=t==null?void 0:t.nodes[s.nodeIndex];if(((n=s.curve)==null?void 0:n.kind)==="ellipse"){const a=o!==void 0?ig(o):null,l=(a==null?void 0:a[0])??0,h=(a==null?void 0:a[1])??Math.PI*2;er(e,Rl(s.curve,l,h,sg));continue}if(((r=s.curve)==null?void 0:r.kind)==="intcurve"&&s.curve.controlPoints.length>0){er(e,s.curve.controlPoints);continue}s.start&&s.end&&Bl(e,s.start,s.end)}return new Float32Array(e)}function hg(i){const t=$d(i);if(t===null)return null;const e=eg(t),n=lg(e,t);if(n.length>0)return n;const r=ag(t);return r.length>0?r:null}const cg=16;function Fl(i,t=!0){const e=i.split(/\s+/),n=[];let r=!t;for(const s of e){if(!r&&/^-?\d+$/.test(s)){r=!0;continue}if(s.startsWith("$")||s==="I"||s==="F"||s==="#")continue;const o=Number.parseFloat(s);Number.isFinite(o)&&n.push(o)}return n}function xo(i,t,e){i.push(t[0],t[1],t[2],e[0],e[1],e[2])}function ug(i){return i.split("#").map(t=>t.trim()).filter(t=>t.length>0)}function dg(i){if(!i.includes("straight-curve"))return null;const t=Fl(i);if(t.length<6)return null;const e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5];return[[e,n,r],[e+s,n+o,r+a]]}function gg(i){if(!i.includes("ellipse-curve"))return null;const t=Fl(i);return t.length<10?null:{kind:"ellipse",center:[t[0],t[1],t[2]],normal:[t[3],t[4],t[5]],majorAxis:[t[6],t[7],t[8]],ratio:t[9]}}function fg(i){const t=[];if(!i||i.trim().length===0)return new Float32Array(0);for(const e of ug(i)){const n=dg(e);if(n!==null){xo(t,n[0],n[1]);continue}const r=gg(e);if(r!==null){const s=Rl(r,0,Math.PI*2,cg);for(let o=1;o<s.length;o++)xo(t,s[o-1],s[o])}}return new Float32Array(t)}const pg=/\bpoint\s+(?:\$-?\d+\s+){1,4}([-\d.eE+]+)\s+([-\d.eE+]+)\s+([-\d.eE+]+)/g;function yg(i){return i.split("#").map(t=>t.trim()).filter(t=>t.length>0)}function mg(i,t=1){const e=i.split(/\s+/),n=[];for(let r=t;r<e.length;r++){const s=e[r];if(s.startsWith("$")||s==="I"||s==="F")continue;const o=Number.parseFloat(s);Number.isFinite(o)&&n.push(o)}return n}function _g(i){const t=[];for(const e of i.matchAll(pg)){const n=Number.parseFloat(e[1]),r=Number.parseFloat(e[2]),s=Number.parseFloat(e[3]);Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(s)&&t.push(new y(n,r,s))}if(t.length>0)return t;for(const e of yg(i)){if(!e.startsWith("point "))continue;const n=mg(e);if(n.length>=3){const r=n[n.length-3],s=n[n.length-2],o=n[n.length-1];t.push(new y(r,s,o))}}return t}function bg(i){const t=[];for(let e=0;e<i.length;e+=3){const n=i[e],r=i[e+1],s=i[e+2];t.push(new y(n,r,s))}return t}function xg(i,t){return typeof i=="string"?{satText:i,version:t}:{sabBytes:i.sabBytes,satText:i.satText??i.acisData??"",version:i.version??t}}const cs=class cs extends z{get dxfTypeName(){return"3DSOLID"}constructor(t,e){super();const n=xg(t,e);this._acisData=n.satText,this._version=n.version;let r=new Float32Array(0);n.sabBytes&&n.sabBytes.length>0&&(r=hg(n.sabBytes)??new Float32Array(0)),r.length===0&&n.satText&&(r=fg(n.satText)),this._wireframe=r,r.length>0?this._points=bg(r):this._points=_g(n.satText)}get acisData(){return this._acisData}get version(){return this._version}get hasRenderableGeometry(){return this._wireframe.length>0||this._points.length>0}get geometricExtents(){return this._points.length===0?new k(new y(0,0,0),new y(0,0,0)):new k().setFromPoints(this._points)}transformBy(t){if(this._points.forEach(e=>e.applyMatrix4(t)),this._wireframe.length>0){const e=new Float32Array(this._wireframe.length);for(let n=0;n<this._wireframe.length;n+=3){const r=new y(this._wireframe[n],this._wireframe[n+1],this._wireframe[n+2]);r.applyMatrix4(t),e[n]=r.x,e[n+1]=r.y,e[n+2]=r.z}this._wireframe=e}return this}subWorldDraw(t){if(this._wireframe.length>=6){const l=this._wireframe.length/3,h=new Uint16Array(l);for(let c=0;c<l;c++)h[c]=c;return t.lineSegments(this._wireframe,3,h)}if(this._points.length===0)return;const e=this.geometricExtents,n=e.min,r=e.max,s=[new y(n.x,n.y,n.z),new y(r.x,n.y,n.z),new y(r.x,r.y,n.z),new y(n.x,r.y,n.z),new y(n.x,n.y,r.z),new y(r.x,n.y,r.z),new y(r.x,r.y,r.z),new y(n.x,r.y,r.z)],o=new Float32Array(s.length*3);s.forEach((l,h)=>{o[h*3]=l.x,o[h*3+1]=l.y,o[h*3+2]=l.z});const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);return t.lineSegments(o,3,a)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dSolid"),this._version!=null&&t.writeInt16(70,this._version);const e=255,n=this._acisData.split(`
|
|
5
|
-
`);for(let r=0;r<n.length;r++){const s=r===n.length-1;let o=n[r];for(;o.length>e;)t.writeString(3,o.slice(0,e)),o=o.slice(e);t.writeString(s?1:3,o)}return this}};
|
|
6
|
-
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"")}function
|
|
7
|
-
`).replace(Pg,"").replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"").trim()}function Sg(i,t,e=1){const n=i.trim();if(!n||t<=0)return 0;const r=Ag(n),s=vg.test(n);return r?Math.max(t,pn(r,t,e)):s?t:0}function pn(i,t,e=1){if(!i||t<=0)return 0;const n=es(i),r=Math.max(...n.split(/\r\n|\r|\n/g).map(s=>s.length),0);return r===0?0:Math.max(t,r*t*wg*e)}function Vl(i){const t=es(i);return Math.max(t.split(/\r\n|\r|\n/g).length,1)}function jl(i,t,e){if(t<=0||i<=0)return 0;if(i===1)return t;const n=Math.max(e,0);return t+(i-1)*t*n}function ns(i,t,e){switch(e){case exports.AcGiMTextAttachmentPoint.TopCenter:return{minX:-i/2,minY:-t,maxX:i/2,maxY:0};case exports.AcGiMTextAttachmentPoint.TopRight:return{minX:-i,minY:-t,maxX:0,maxY:0};case exports.AcGiMTextAttachmentPoint.MiddleLeft:return{minX:0,minY:-t/2,maxX:i,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleCenter:return{minX:-i/2,minY:-t/2,maxX:i/2,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleRight:return{minX:-i,minY:-t/2,maxX:0,maxY:t/2};case exports.AcGiMTextAttachmentPoint.BottomLeft:case exports.AcGiMTextAttachmentPoint.BaselineLeft:return{minX:0,minY:0,maxX:i,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomCenter:case exports.AcGiMTextAttachmentPoint.BaselineCenter:return{minX:-i/2,minY:0,maxX:i/2,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomRight:case exports.AcGiMTextAttachmentPoint.BaselineRight:return{minX:-i,minY:0,maxX:0,maxY:t};case exports.AcGiMTextAttachmentPoint.TopLeft:default:return{minX:0,minY:-t,maxX:i,maxY:0}}}function is(i,t){let e;t&&t.lengthSq()>0?e=t.clone().normalize():e=new b(Math.cos(i),Math.sin(i),0);const n=new b(-e.y,e.x,e.z);return n.lengthSq()===0?n.set(0,1,0):n.normalize(),{xAxis:e,yAxis:n}}function Dl(i,t,e,n,r,s=0,o){if(e<=0&&n<=0)return i.expandByPoint(t),i;const a=ns(e,n,r),{xAxis:l,yAxis:h}=is(s,o?new b(o.x,o.y,o.z||0):void 0),c=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];for(const[u,g]of c)i.expandByPoint(new y(t.x+l.x*u+h.x*g,t.y+l.y*u+h.y*g,t.z+l.z*u+h.z*g));return i}function Lg(i){const t=i.extentsWidth>0?i.extentsWidth:i.width>0?i.width:pn(i.contents,i.height),e=jl(Vl(i.contents),i.height,i.lineSpacingFactor);return{width:t,height:e,attachment:i.attachmentPoint,rotation:i.rotation,direction:i.direction.lengthSq()>0?i.direction.clone():void 0,location:new y(i.location.x,i.location.y,i.location.z??0)}}function Eg(i,t){const{xAxis:e,yAxis:n}=is(t.rotation,t.direction),r=i.x-t.location.x,s=i.y-t.location.y,o=(i.z??0)-t.location.z;return{x:r*e.x+s*e.y+o*e.z,y:r*n.x+s*n.y+o*n.z}}function Ig(i){const t=ns(i.width,i.height,i.attachment),{xAxis:e,yAxis:n}=is(i.rotation,i.direction);return[[t.minX,t.minY],[t.maxX,t.minY],[t.maxX,t.maxY],[t.minX,t.maxY]].map(([s,o])=>new y(i.location.x+e.x*s+n.x*o,i.location.y+e.y*s+n.y*o,i.location.z+e.z*s+n.z*o))}function Mg(i,t,e){const n=ns(t.width,t.height,t.attachment),{x:r,y:s}=Eg(i,t),o=n.minX-e.padX,a=n.maxX+e.padX,l=n.minY-e.padYBelow,h=n.maxY+e.padYAbove;if(r<o||r>a||s<l||s>h)return null;const c=r<n.minX?n.minX-r:r>n.maxX?n.maxX-r:0,u=s<n.minY?n.minY-s:s>n.maxY?s-n.maxY:0;return c+u}var Gl=(i=>(i[i.LEFT=0]="LEFT",i[i.CENTER=1]="CENTER",i[i.RIGHT=2]="RIGHT",i[i.ALIGNED=3]="ALIGNED",i[i.MIDDLE=4]="MIDDLE",i[i.FIT=5]="FIT",i))(Gl||{}),Hl=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(Hl||{});const ds=class ds extends z{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new y,this._alignmentPoint=new y,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(t){this._alignmentPoint.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){const t=new k,{anchor:e,attachmentPoint:n}=this.resolveTextAnchor(),r=pn(this.textString,this.height,this.widthFactor);return Dl(t,e,r,this.height,n,this.rotation)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return Ot(t,e,this._position),this._alignmentPoint.add(e),this}subGetOsnapPoints(t,e,n,r){x.Insertion===t&&r.push(this._position)}transformBy(t){const e=this._position.clone(),n=this._position.clone().add(new b(Math.cos(this._rotation),Math.sin(this._rotation),0)),r=this._position.clone().add(new b(-Math.sin(this._rotation),Math.cos(this._rotation),0)),s=this._position.clone().add(new b(0,0,1));e.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t),s.applyMatrix4(t);const o=new b(n).sub(e),a=new b(r).sub(e),l=new b(s).sub(e),h=a.length(),c=o.length(),u=l.length();this._position.copy(e),c>0&&(this._rotation=Math.atan2(o.y,o.x)),h>0&&(this._height*=h,c>0&&(this._widthFactor*=c/h)),u>0&&(this._thickness*=u);const g=this._alignmentPoint.clone();return g.applyMatrix4(t),this._alignmentPoint.copy(g),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const{anchor:n,attachmentPoint:r}=this.resolveTextAnchor(),s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:n,rotation:this.rotation,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:r};return t.mtext(s,this.getTextStyle(),e)}resolveTextAnchor(){const t=this.resolveAttachmentPoint();if(t===exports.AcGiMTextAttachmentPoint.BaselineLeft)return{anchor:this._position,attachmentPoint:t};const e=this._alignmentPoint;return e.x===0&&e.y===0&&e.z===0||e.x===this._position.x&&e.y===this._position.y&&e.z===this._position.z?{anchor:this._position,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft}:{anchor:e,attachmentPoint:t}}resolveAttachmentPoint(){const t=this._horizontalMode,e=this._verticalModel;if(t===4)return exports.AcGiMTextAttachmentPoint.MiddleCenter;if(t===3||t===5)return exports.AcGiMTextAttachmentPoint.BaselineLeft;switch(e){case 3:return t===1?exports.AcGiMTextAttachmentPoint.TopCenter:t===2?exports.AcGiMTextAttachmentPoint.TopRight:exports.AcGiMTextAttachmentPoint.TopLeft;case 2:return t===1?exports.AcGiMTextAttachmentPoint.MiddleCenter:t===2?exports.AcGiMTextAttachmentPoint.MiddleRight:exports.AcGiMTextAttachmentPoint.MiddleLeft;case 1:return t===1?exports.AcGiMTextAttachmentPoint.BottomCenter:t===2?exports.AcGiMTextAttachmentPoint.BottomRight:exports.AcGiMTextAttachmentPoint.BottomLeft;case 0:default:return t===1?exports.AcGiMTextAttachmentPoint.BaselineCenter:t===2?exports.AcGiMTextAttachmentPoint.BaselineRight:exports.AcGiMTextAttachmentPoint.BaselineLeft}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbText"),t.writePoint3d(10,this.position),t.writeDouble(39,this.thickness),t.writeDouble(40,this.height),t.writeString(1,this.textString),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeString(7,this.styleName),t.writeInt16(72,this.horizontalMode),t.writeInt16(73,this.verticalMode),t.writePoint3d(11,this.alignmentPoint),this}};ds.typeName="Text";let un=ds;var lt=(i=>(i[i.Invisible=1]="Invisible",i[i.Const=2]="Const",i[i.Verifiable=4]="Verifiable",i[i.Preset=8]="Preset",i))(lt||{}),Wt=(i=>(i[i.MultiLine=2]="MultiLine",i[i.ConstMultiLine=4]="ConstMultiLine",i))(Wt||{});const gs=class gs extends un{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttributeDefinition"),t.writeString(3,this.prompt),t.writeString(2,this.tag),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeInt16(74,this.isReallyLocked?1:0),this}};gs.typeName="AttDef";let sr=gs;function Tg(i){return i!=null&&typeof i=="object"&&"blockTableRecord"in i}const fs=class fs extends un{get dxfTypeName(){return"ATTRIB"}get resolvedColor(){var t;if(this.color.isByBlock){const e=(t=this.database)==null?void 0:t.tables.blockTable.getEntityById(this.ownerId);if(Tg(e))return e.resolvedColor}return this.resolveStandardColor()}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags<.Invisible)!==0}set isInvisible(t){t?this._flags|=lt.Invisible:this._flags&=~lt.Invisible}get isConst(){return(this._flags<.Const)!==0}set isConst(t){t?this._flags|=lt.Const:this._flags&=~lt.Const}get isVerifiable(){return(this._flags<.Verifiable)!==0}set isVerifiable(t){t?this._flags|=lt.Verifiable:this._flags&=~lt.Verifiable}get isPreset(){return(this._flags<.Preset)!==0}set isPreset(t){t?this._flags|=lt.Preset:this._flags&=~lt.Preset}get isMTextAttribute(){return(this._mtextFlag&Wt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=Wt.MultiLine:this._mtextFlag&=~Wt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&Wt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=Wt.ConstMultiLine:this._mtextFlag&=~Wt.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttribute"),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeString(2,this.tag),t.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&t.writeInt16(71,this.isMTextAttribute?1:0),this}};fs.typeName="Attrib";let or=fs;const Ie=class Ie extends z{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new y,this._rotation=0,this._normal=new b(0,0,1),this._scaleFactors=new y(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId,this.syncAttributeDatabases()}syncAttributeDatabases(){try{const t=this.database;this._attribs.forEach(e=>{e.database=t})}catch{}}attributeIterator(){return new Xe(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??y.ORIGIN,n=new C().makeTranslation(-e.x,-e.y,-e.z),r=new C().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),s=new ke().setFromAxisAngle(b.Z_AXIS,this._rotation),o=new C().makeRotationFromQuaternion(s),a=new C().makeTranslation(this._position.x,this._position.y,this._position.z);return new C().multiplyMatrices(a,o).multiply(r).multiply(n)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return Ot(t,e,this._position),this}subGetOsnapPoints(t,e,n,r,s,o){const a=o??new C;x.Insertion===t?r.push(this.getInsertionPoint(a)):s?this.subEntityGetOsnapPoints(t,e,n,r,s,a):this.collectBlockOsnapPoints(t,e,n,r,a)}transformBy(t){const e=new C().setFromExtrusionDirection(this._normal),n=new C().makeRotationZ(this._rotation),r=new C().multiplyMatrices(e,n),s=this._position.clone(),o=new y(this._scaleFactors.x,0,0).applyMatrix4(r).add(s),a=new y(0,this._scaleFactors.y,0).applyMatrix4(r).add(s),l=new y(0,0,this._scaleFactors.z).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b(o).sub(s),c=new b(a).sub(s),u=new b(l).sub(s);let g=new b().crossVectors(h,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const f=new C().setFromExtrusionDirection(g).clone().invert(),p=h.clone().applyMatrix4(f);return this._position.copy(s),this._normal.copy(g),this._rotation=Math.atan2(p.y,p.x),this._scaleFactors.set(h.length(),c.length(),u.length()),this._attribs.forEach(m=>m.transformBy(t)),this}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(n=>{e.properties.push({name:n.tag,type:"string",editable:!n.isConst,skipTranslation:!0,accessor:{get:()=>n.textString,set:r=>{n.textString=r}}})})}return t}get geometricExtents(){const t=new k,e=this.blockTableRecord;if(e!=null){const r=e.newIterator();for(const s of r)t.union(s.geometricExtents)}const n=this.blockTransform;return t.applyMatrix4(n),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const n=this.blockTransform,r=[];return this._attribs.forEach(o=>{if(!o.isInvisible){const a=o.worldDraw(t);a&&r.push(a)}}),ge.instance.draw(t,e,this.resolvedColor,r,!0,n,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let n=!1;for(const r of this.attributeIterator())n=!0,t.writeStart("ATTRIB"),r.dxfOut(t);return n&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}collectBlockOsnapPoints(t,e,n,r,s){const o=this.blockTableRecord;if(!o)return;const a=new C().multiplyMatrices(s,this.getFullInsertionTransform()),l=a.clone().invert(),h=new y(e).applyMatrix4(l),c=new y(n).applyMatrix4(l),u=[];for(const g of o.newIterator()){const d=[];if(g instanceof Ie){g.subGetOsnapPoints(t,e,n,d,void 0,a),u.push(...d);continue}g.subGetOsnapPoints(t,h,c,d,void 0,a),d.forEach(f=>u.push(new y(f).applyMatrix4(a)))}if(u.length!==0)if(t===x.Nearest||t===x.Perpendicular||t===x.Tangent){const g=wt(e,u);g&&r.push(g)}else r.push(...u)}subEntityGetOsnapPoints(t,e,n,r,s,o,a=new Set){if(s===this.objectId||a.has(this.objectId))return!1;a.add(this.objectId);try{const l=this.blockTableRecord;if(l==null)return!1;const h=new C().multiplyMatrices(o,this.getFullInsertionTransform());for(const c of l.newIterator()){if(c.objectId===s){const u=new y(e).applyMatrix4(h.clone().invert()),g=new y(n).applyMatrix4(h.clone().invert()),d=[];return c.subGetOsnapPoints(t,u,g,d,s,h),c instanceof Ie?d.forEach(f=>{r.push(f.clone())}):d.forEach(f=>{r.push(new y(f).applyMatrix4(h))}),!0}if(c instanceof Ie&&c.subEntityGetOsnapPoints(t,e,n,r,s,h,a))return!0}return!1}finally{a.delete(this.objectId)}}getInsertionPoint(t){var r;const e=((r=this.blockTableRecord)==null?void 0:r.origin)??y.ORIGIN,n=new C().multiplyMatrices(t,this.getFullInsertionTransform());return new y(e).applyMatrix4(n)}getFullInsertionTransform(){const t=new C().setFromExtrusionDirection(this._normal);return new C().multiplyMatrices(t,this.blockTransform)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockReference"),t.writePoint3d(10,this.position),t.writeString(2,this.blockName),t.writeDouble(41,this.scaleFactors.x),t.writeDouble(42,this.scaleFactors.y),t.writeDouble(43,this.scaleFactors.z),t.writeAngle(50,this.rotation),t.writeVector3d(210,this.normal),this}};Ie.typeName="BlockReference";let Re=Ie;const wo=[0,Math.PI/2,Math.PI,Math.PI/2*3],qn=class qn extends it{get dxfTypeName(){return"CIRCLE"}constructor(t,e,n=b.Z_AXIS){super();const r=en(n);this._geo=new It(t,e,0,R,n,r)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}subGetOsnapPoints(t,e,n,r){switch(t){case x.Center:case x.Centroid:r.push(this._geo.center);break;case x.Quadrant:r.push(this._geo.getPointAtAngle(0)),r.push(this._geo.getPointAtAngle(Math.PI/2)),r.push(this._geo.getPointAtAngle(Math.PI)),r.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case x.Nearest:{const s=this._geo.nearestPoint(e);r.push(s)}break;case x.Tangent:{const s=this._geo.tangentPoints(e);r.push(...s);break}case x.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=wt(e,s);o&&r.push(o);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;t.push(this.center);for(const e of wo)t.push(this._geo.getPointAtAngle(e));return t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Oe(this.center,this.normal);return t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,n=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=n?1:-1}createOffsetCurve(t){const e=this._geo.offset(t);return e?new qn(e.center,e.radius,e.normal):null}moveGripAt(t,e){switch(t){case 0:this.transformBy(C.makeTranslation(e));break;case 1:case 2:case 3:case 4:{const n=wo[t-1],r=this._geo.getPointAtAngle(n),o=new y(r.x+e.x,r.y+e.y,(r.z??0)+(e.z??0)).distanceTo(this.center);o>0&&(this.radius=o);break}}}};qn.typeName="Circle";let ar=qn;const De=[0,Math.PI/2,Math.PI,Math.PI/2*3],Kn=class Kn extends it{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,n,r,s,o,a){super(),this._geo=new Hr(t,e,n,r,s,o,a)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxis(){return this._geo.majorAxis}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed||Math.abs(this._geo.deltaAngle-R)<1e-10}get area(){return this._geo.area}subGetGripPoints(){const t=new Array;if(t.push(this._geo.center),this.closed)for(const e of De)t.push(this._geo.getPointAtAngle(e));else t.push(this._geo.startPoint),t.push(this._geo.endPoint);return t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){switch(t){case x.EndPoint:this.closed||(r.push(this._geo.startPoint),r.push(this._geo.endPoint));break;case x.MidPoint:this.closed||r.push(this._geo.midPoint);break;case x.Center:case x.Centroid:r.push(this._geo.center);break;case x.Quadrant:if(this.closed)for(const s of De)r.push(this._geo.getPointAtAngle(s));break;case x.Nearest:r.push(this._geo.nearestPoint(e));break;case x.Tangent:r.push(...this._geo.tangentPoints(e));break;case x.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=wt(e,s);o&&r.push(o);break}}}transformBy(t){return this._geo.transform(t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbEllipse"),t.writePoint3d(10,this.center);const e=this._geo.majorAxis,n=this.majorAxisRadius;return t.writePoint3d(11,{x:e.x*n,y:e.y*n,z:e.z*n}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,n=t.x-e.x,r=t.y-e.y,s=this.majorAxis,o=Math.hypot(s.x,s.y)||1,a=this.minorAxisRadius/this.majorAxisRadius*o||1,l=s.x/o,h=s.y/o,c=-h,u=l,g=n*l+r*h,d=n*c+r*u;return(g/o)**2+(d/a)**2>=1?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(C.makeTranslation(e));break;case 1:if(this.closed)this.moveQuadrantGripAt(De[0],e);else{const n=this._geo.startPoint;this._geo.startAngle=Bt(this._geo.center,{x:n.x+e.x,y:n.y+e.y,z:(n.z??0)+(e.z??0)},this._geo.normal)}break;case 2:if(this.closed)this.moveQuadrantGripAt(De[1],e);else{const n=this._geo.endPoint;this._geo.endAngle=Bt(this._geo.center,{x:n.x+e.x,y:n.y+e.y,z:(n.z??0)+(e.z??0)},this._geo.normal)}break;case 3:case 4:this.closed&&this.moveQuadrantGripAt(De[t-1],e);break}}moveQuadrantGripAt(t,e){const n=this._geo.getPointAtAngle(t),r=new y(n.x+e.x,n.y+e.y,(n.z??0)+(e.z??0)),s=this._geo.center,o=r.x-s.x,a=r.y-s.y,l=(r.z??0)-(s.z??0),h=t===0||t===Math.PI?this._geo.majorAxis:this._geo.minorAxis,c=o*h.x+a*h.y+l*h.z,u=Math.abs(c);u<=0||(t===0||t===Math.PI?this.majorAxisRadius=u:this.minorAxisRadius=u)}createOffsetCurve(t){const e=this._geo.offset(t);return e?new Kn(e.center,e.normal,e.majorAxis,e.majorAxisRadius,e.minorAxisRadius,e.startAngle,e.endAngle):null}};Kn.typeName="Ellipse";let lr=Kn;const ps=class ps extends z{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new y,new y,new y],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new y),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new k().setFromPoints(this._vertices)}get area(){const t=[this.getVertexAt(0),this.getVertexAt(1),this.getVertexAt(2)],e=this.getVertexAt(3);return(e.x!==t[2].x||e.y!==t[2].y||e.z!==t[2].z)&&t.push(e),ca(t)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return fn(t,e,this._vertices),this}subGetOsnapPoints(t,e,n,r){Kr(this._vertices,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._vertices.length,n=new Float32Array(e*3),r=new Uint16Array(e*2);for(let s=0;s<e;s++)n[s*3]=this._vertices[s].x,n[s*3+1]=this._vertices[s].y,n[s*3+2]=this._vertices[s].z,this.isEdgeVisibleAt(s)&&(r[s*2]=s,r[s*2+1]=(s+1)%4);return t.lineSegments(n,3,r)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),n=this.getVertexAt(1),r=this.getVertexAt(2),s=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,n),t.writePoint3d(12,r),t.writePoint3d(13,s);let o=0;for(let a=0;a<4;++a)this.isEdgeVisibleAt(a)||(o|=1<<a);return t.writeInt16(70,o),this}};ps.typeName="Face";let hr=ps;const Si=6,ys=class ys extends z{get dxfTypeName(){return"TOLERANCE"}constructor(){super(),this._location=new y,this._text="",this._dimensionStyle="",this._normal=new b(0,0,1),this._direction=new b(1,0,0)}get location(){return this._location}set location(t){this._location.set(t.x,t.y,t.z??0)}get text(){return this._text}set text(t){this._text=t}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get normal(){return this._normal}set normal(t){this._normal.set(t.x,t.y,t.z??0),this._normal.lengthSq()>0&&this._normal.normalize()}get direction(){return this._direction}set direction(t){this._direction.set(t.x,t.y,t.z??0),this._direction.lengthSq()>0&&this._direction.normalize()}setOrientation(t,e){return this.normal=t,this.direction=e,this}getBoundingPoints(){return this.getBoundingPolyline().slice(0,4)}getBoundingPolyline(){const{width:t,rowHeight:e,rowCount:n}=this.resolveFrameLayout(),r=e/2,s=r-e*n;return[new y(0,r,0),new y(t,r,0),new y(t,s,0),new y(0,s,0),new y(0,r,0)].map(a=>this.toFrameWcs(a.x,a.y))}get geometricExtents(){const t=new k;for(const e of this.getBoundingPoints())t.expandByPoint(e);return t.isEmpty()&&t.expandByPoint(this._location),t}subGetGripPoints(){return[this._location]}subMoveGripPointsAt(t,e){return Ot(t,e,this._location),this}subGetOsnapPoints(t,e,n,r){t===x.Insertion&&r.push(this._location)}transformBy(t){const e=this.resolveLocalBasis(),n=this._location.clone(),r=n.clone().add(e.xAxis),s=n.clone().add(e.yAxis);n.applyMatrix4(t),r.applyMatrix4(t),s.applyMatrix4(t);const o=new b(r).sub(n),a=new b(s).sub(n);let l=new b().crossVectors(o,a);l.lengthSq()===0?l=this._normal.clone().transformDirection(t):l.normalize();let h=o.clone();return h.lengthSq()===0?h=this._direction.clone().transformDirection(t):h.normalize(),this._location.copy(n),this._normal.copy(l),this._direction.copy(h),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"tolerance",properties:[{name:"text",type:"string",editable:!0,accessor:{get:()=>this.text,set:t=>{this.text=t}}},{name:"dimensionStyle",type:"string",editable:!0,accessor:{get:()=>this.dimensionStyle,set:t=>{this.dimensionStyle=t}}},{name:"textHeight",type:"float",editable:!1,accessor:{get:()=>this.textHeight}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}subWorldDraw(t,e){const r=this.collectFrameLineSegments().map(([o,a])=>t.lines([o,a])),s=this.drawToleranceText(t,e);return r.length>0&&s?t.group([...r,s]):r.length===1?r[0]:r.length>1?t.group(r):s}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbFcf"),this._dimensionStyle&&t.writeString(3,this._dimensionStyle),t.writePoint3d(10,this._location),t.writeString(1,this._text),this._normal.equals(b.Z_AXIS)||t.writeVector3d(210,this._normal),this._direction.equals(b.X_AXIS)||t.writeVector3d(11,this._direction),this}get textHeight(){const t=this.resolveDimensionStyle(),e=(t==null?void 0:t.dimtxt)??xt.DEFAULT_DIM_VALUES.dimtxt,n=(t==null?void 0:t.dimscale)??xt.DEFAULT_DIM_VALUES.dimscale;return e*n}drawToleranceText(t,e){const n=this.parseToleranceFrame(this._text);if(n.length===0)return;const r=this.resolveFrameLayout(n),s=this.getTextStyle(),o=[];for(let a=0;a<n.length;a++){const l=n[a];let h=r.cellPadding;const c=-r.rowHeight*a;for(let u=0;u<l.cells.length;u++){const g=l.cells[u],d=r.columnWidths[u]??this.textHeight;if(g.trim()){const f=this.toFrameWcs(h+d/2,c),p={text:g,height:this.textHeight,width:1/0,position:f,directionVector:this._direction,attachmentPoint:exports.AcGiMTextAttachmentPoint.MiddleCenter,drawingDirection:exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT};o.push(t.mtext(p,s,e))}h+=d+r.columnGap}}if(o.length!==0)return o.length===1?o[0]:t.group(o)}collectFrameLineSegments(){const t=this.parseToleranceFrame(this._text),e=this.resolveFrameLayout(t),{width:n,rowHeight:r,rowCount:s,columnDivisions:o}=e;if(n<=0||r<=0||s<=0)return[];const a=r/2,l=a-r*s,h=[],c=(u,g)=>{h.push([u,g])};c(this.toFrameWcs(0,a),this.toFrameWcs(n,a)),c(this.toFrameWcs(n,a),this.toFrameWcs(n,l)),c(this.toFrameWcs(n,l),this.toFrameWcs(0,l)),c(this.toFrameWcs(0,l),this.toFrameWcs(0,a));for(const u of o)c(this.toFrameWcs(u,a),this.toFrameWcs(u,l));for(let u=1;u<t.length;u++){const g=a-r*u;c(this.toFrameWcs(0,g),this.toFrameWcs(n,g))}return h}toFrameWcs(t,e){const n=this.resolveLocalBasis();return this._location.clone().addScaledVector(n.xAxis,t).addScaledVector(n.yAxis,e)}resolveFrameLayout(t){const e=t??this.parseToleranceFrame(this._text),n=this.textHeight,r=n*2,s=n/2,o=n;if(n<=0||e.length===0)return{width:0,totalHeight:0,rowHeight:0,columnWidths:[],columnDivisions:[],rowCount:0,cellPadding:0,columnGap:0};const a=Math.max(...e.map(g=>g.cells.length),0),l=[];for(let g=0;g<a;g++){let d=n;for(const f of e){const p=f.cells[g]??"";if(!p.trim())continue;const m=Sg(p,n);d=Math.max(d,m)}l.push(d)}const h=[0];let c=s;for(let g=0;g<l.length;g++)c+=l[g],c+=o,h.push(c-s);return{width:h[h.length-1]??0,totalHeight:r*e.length,rowHeight:r,columnWidths:l,columnDivisions:h,rowCount:e.length,cellPadding:s,columnGap:o}}parseToleranceFrame(t){if(!t)return[];const e=this.splitToleranceRows(t);if(e.length===0)return[];if(!t.includes("%%v"))return e.map(s=>({cells:this.parsePipeSeparatedCells(s)}));const n=e.map(s=>{const a=this.splitToleranceTokens(s,"%%v").slice(0,Si);for(;a.length<Si;)a.push("");return a}),r=[0,1];n.some(s=>{var o;return(o=s[2])==null?void 0:o.trim()})&&r.push(2);for(let s=3;s<Si;s++)n.some(o=>{var a;return(a=o[s])==null?void 0:a.trim()})&&r.push(s);return n.map(s=>({cells:r.map(o=>s[o]??"")}))}splitToleranceRows(t){return t.replace(/\^J/g,`
|
|
8
|
-
`).split(/\r\n|\r|\n|\\P/i).map(n=>n.trim()).filter(n=>n.length>0)}splitToleranceTokens(t,e){if(!t)return[];const n=[];let r="",s=0;for(let o=0;o<t.length;){if(t.startsWith(e,o)&&s===0){n.push(r),r="",o+=e.length;continue}const a=t[o];a==="{"?s++:a==="}"&&(s=Math.max(0,s-1)),r+=a,o++}return n.push(r),n}parsePipeSeparatedCells(t){return t?this.splitToleranceTokens(t,"|").filter(n=>n.length>0):[]}resolveLocalBasis(){const t=this._normal.clone();t.lengthSq()===0?t.set(0,0,1):t.normalize();let e=this._direction.clone();e.lengthSq()===0?e.set(1,0,0):e.normalize();let n=new b().crossVectors(t,e);return n.lengthSq()===0&&(e=b.X_AXIS.clone(),n=new b().crossVectors(t,e)),n.normalize(),e=new b().crossVectors(n,t).normalize(),{xAxis:e,yAxis:n,zAxis:t}}resolveDimensionStyle(){const t=this._dimensionStyle.trim(),e=this.tryGetDatabase();if(!(!t||!e))return e.tables.dimStyleTable.getAt(t)}tryGetDatabase(){try{return this.database}catch{return}}getTextStyle(){const t=this.resolveDimensionStyle(),e=(t==null?void 0:t.dimtxsty)??xt.DEFAULT_DIM_VALUES.dimtxsty??"Standard",n=this.database.tables.textStyleTable.resolveAt(e);if(!n)throw new Error("No valid text style found in text style table.");return n.textStyle}};ys.typeName="Fcf";let cr=ys;const ms=class ms extends z{get dxfTypeName(){return"MTEXT"}constructor(){super(),this._contents="",this._height=0,this._width=0,this._extentsWidth=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new y,this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._direction=new b(1,0,0),this._drawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get extentsWidth(){return this._extentsWidth}set extentsWidth(t){this._extentsWidth=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){const t=new k,e=this.extentsWidth>0?this.extentsWidth:this.width>0?this.width:pn(this.contents,this.height),n=Vl(this.contents),r=jl(n,this.height,this.lineSpacingFactor);return Dl(t,this._location,e,r,this.attachmentPoint,this.rotation,this.direction)}subGetGripPoints(){return[this._location]}subMoveGripPointsAt(t,e){return Ot(t,e,this._location),this}subGetOsnapPoints(t,e,n,r){x.Insertion===t&&r.push(this._location)}transformBy(t){const e=this._location.clone(),n=this._direction.lengthSq()>0?this._direction.clone().normalize():new b(Math.cos(this._rotation),Math.sin(this._rotation),0),r=new b(-n.y,n.x,n.z);r.lengthSq()===0&&r.set(0,1,0),r.normalize();const s=e.clone().add(n),o=e.clone().add(r);e.applyMatrix4(t),s.applyMatrix4(t),o.applyMatrix4(t);const a=new b(s).sub(e),l=new b(o).sub(e),h=a.length(),c=l.length();return this._location.copy(e),h>0&&(this._direction.copy(a).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=h,this._extentsWidth>0&&(this._extentsWidth*=h)),c>0&&(this._height*=c),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:exports.AcGiMTextAttachmentPoint[1],value:1},{label:exports.AcGiMTextAttachmentPoint[2],value:2},{label:exports.AcGiMTextAttachmentPoint[3],value:3},{label:exports.AcGiMTextAttachmentPoint[4],value:4},{label:exports.AcGiMTextAttachmentPoint[5],value:5},{label:exports.AcGiMTextAttachmentPoint[6],value:6},{label:exports.AcGiMTextAttachmentPoint[7],value:7},{label:exports.AcGiMTextAttachmentPoint[8],value:8},{label:exports.AcGiMTextAttachmentPoint[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:exports.AcGiMTextFlowDirection[1],value:1},{label:exports.AcGiMTextFlowDirection[2],value:2},{label:exports.AcGiMTextFlowDirection[3],value:3},{label:exports.AcGiMTextFlowDirection[4],value:4},{label:exports.AcGiMTextFlowDirection[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const n={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return t.mtext(n,this.getTextStyle(),e)}encodeMTextContentsForDxf(t){return(t??"").replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMText"),t.writePoint3d(10,this.location),t.writeDouble(40,this.height),t.writeDouble(41,this.width),this.extentsWidth>0&&t.writeDouble(42,this.extentsWidth),t.writeString(1,this.encodeMTextContentsForDxf(this.contents??"")),t.writeString(7,this.styleName),t.writeAngle(50,this.rotation),t.writeVector3d(11,this.direction),t.writeInt16(71,this.attachmentPoint),t.writeInt16(72,this.drawingDirection),t.writeInt16(73,this.lineSpacingStyle),t.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(t.writeInt16(90,1),t.writeInt32(63,this.backgroundFillColor),t.writeInt32(441,this.backgroundFillTransparency),t.writeDouble(45,this.backgroundScaleFactor)),this}};ms.typeName="MText";let Be=ms;var Wl=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(Wl||{});const _s=class _s extends it{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._isHookLineSameDirection=!1,this._annoType=3,this._textHeight=0,this._textWidth=0,this._associatedAnnotation="",this._normal=new b(0,0,1),this._horizontalDirection=new b(1,0,0)}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(t){this._isHookLineSameDirection=t}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(t=>t.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get byBlockColor(){return this._byBlockColor}set byBlockColor(t){this._byBlockColor=t}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(t){this._associatedAnnotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(t){this._horizontalDirection.copy(t)}get offsetFromBlock(){var t;return(t=this._offsetFromBlock)==null?void 0:t.clone()}set offsetFromBlock(t){this._offsetFromBlock=t?new b(t):void 0}get offsetFromAnnotation(){var t;return(t=this._offsetFromAnnotation)==null?void 0:t.clone()}set offsetFromAnnotation(t){this._offsetFromAnnotation=t?new b(t):void 0}appendVertex(t){this._vertices.push(new y().copy(t)),this._updated=!0}setVertexAt(t,e){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].copy(e),this._updated=!0,this}vertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].clone()}subGetGripPoints(){return this._vertices.map(t=>t.clone())}subMoveGripPointsAt(t,e){return fn(t,e,this._vertices),this}subGetOsnapPoints(t,e,n,r){if(this.numVertices===0)return;if(this.isSplined&&this.splineGeo){switch(t){case x.EndPoint:r.push(this._vertices[0]),r.push(this._vertices[this.numVertices-1]);break;case x.Nearest:r.push(this.splineGeo.nearestPoint(e));break}return}const s=this._vertices;switch(t){case x.EndPoint:r.push(...s);break;case x.MidPoint:case x.Nearest:case x.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];ze(s[a],s[a+1],t,e,l),o.push(...l)}if(t===x.MidPoint)r.push(...o);else{const a=wt(e,o);a&&r.push(a)}break}}}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new k().setFromPoints(this.collectDrawPoints())}get closed(){return!1}set closed(t){}get area(){return 0}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this.transformVector(this._normal,t),this.transformVector(this._horizontalDirection,t),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,t),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,t),this._splineGeo?(this._splineGeo.transform(t),this._updated=!1):this._updated=!0,this}subWorldDraw(t){return t.lines(this.collectDrawPoints())}collectDrawPoints(){if(this.isSplined&&this.splineGeo)return this.splineGeo.getPoints(100);const t=this._vertices.map(e=>e.clone());if(t.length>0&&!this._isSplined){const e=t[t.length-1];if(this.shouldDrawHookLine(e)){const n=this.computeHookLineEndPoint(e);n&&t.push(n)}}return t}shouldDrawHookLine(t){if(this.resolveHookLineLength(t)<=0)return!1;if(this._hasHookLine)return!0;const e=this.resolveAssociatedMText();if(e&&this.resolveHookSpanFromMText(e,t)>0)return!0;if(this._annoType!==0)return!1;const n=this.resolveDimensionStyle();return((n==null?void 0:n.dimtad)??xt.DEFAULT_DIM_VALUES.dimtad)!==$r.Center}computeHookLineEndPoint(t){const e=this.resolveHookLineLength(t);if(e<=0)return null;const n=this.resolveHookAxis();return t.clone().addScaledVector(n,e)}resolveHookLineLength(t){const e=this.resolveDimensionStyle(),n=((e==null?void 0:e.dimgap)??xt.DEFAULT_DIM_VALUES.dimgap)*((e==null?void 0:e.dimscale)??xt.DEFAULT_DIM_VALUES.dimscale);let r=this._textWidth+n;const s=this.resolveAssociatedMText();if(s){const o=this.resolveHookSpanFromMText(s,t);if(o>0)r=Math.max(r,o);else{const a=this.resolveAnnotationWidth(s);a>0&&(r=Math.max(r,a))}}return r}resolveHookAxis(){const t=this._horizontalDirection.clone();t.lengthSq()===0?t.set(1,0,0):t.normalize();const e=this._isHookLineSameDirection?1:-1;return t.multiplyScalar(e),t}resolveHookSpanFromMText(t,e){const n=this.resolveHookAxis(),r=this.resolveMTextLayoutMetrics(t);let s=0;for(const o of Ig(r)){const a=(o.x-e.x)*n.x+(o.y-e.y)*n.y+(o.z-e.z)*n.z;a>s&&(s=a)}return s}resolveAnnotationWidth(t){if(t.extentsWidth>0)return t.extentsWidth;const e=es(t.contents).split(`
|
|
9
|
-
`);return Math.max(...e.map(n=>pn(n.trim(),t.height)),0)}resolveMTextLayoutMetrics(t){return Lg({contents:t.contents,height:t.height,width:t.width,extentsWidth:t.extentsWidth,lineSpacingFactor:t.lineSpacingFactor,attachmentPoint:t.attachmentPoint,rotation:t.rotation,direction:t.direction,location:t.location})}scoreMTextAssociation(t,e){const n=this.resolveMTextLayoutMetrics(t),r=Math.max(t.height*2,1),s=Math.max(t.height,1),o=Math.max(n.height,t.height*4,10);return Mg(e,n,{padX:r,padYAbove:s,padYBelow:o})}resolveDimensionStyle(){var n;const t=(n=this._dimensionStyle)==null?void 0:n.trim(),e=this.tryGetDatabase();if(!(!t||!e))return e.tables.dimStyleTable.getAt(t)}resolveAssociatedMText(){const t=this.tryGetDatabase();if(!t)return;if(this._associatedAnnotation){const a=t.getObjectById(this._associatedAnnotation);if(a instanceof Be)return a}if(this._vertices.length===0)return;const e=this.getAttrWithoutException("ownerId");if(!e)return;const n=t.getObjectById(e);if(!(n instanceof J))return;const r=this._vertices[this._vertices.length-1];let s,o=Number.POSITIVE_INFINITY;for(const a of n.newIterator()){if(!(a instanceof Be))continue;const l=this.scoreMTextAssociation(a,r);l==null||l>=o||(o=l,s=a)}return s}tryGetDatabase(){try{return this.database}catch{return}}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Tt(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLeader"),t.writeString(3,this.dimensionStyle),t.writeInt16(71,this.hasArrowHead?1:0),t.writeInt16(72,this.isSplined?1:0),t.writeInt16(73,this.annoType),t.writeInt16(74,this.isHookLineSameDirection?1:0),t.writeInt16(75,this.hasHookLine?1:0),t.writeInt16(76,this.numVertices),this.textHeight!==0&&t.writeDouble(40,this.textHeight),this.textWidth!==0&&t.writeDouble(41,this.textWidth),this.byBlockColor!=null&&t.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&t.writeHandle(340,this.associatedAnnotation);for(const e of this.vertices)t.writePoint3d(10,e);return t.writeVector3d(210,this.normal),t.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&t.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&t.writeVector3d(213,this._offsetFromAnnotation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ft.from2dPoints(e,!1).getOffsetSideAtPoint(t)}createOffsetCurve(t){return ai(this.collectPath2d(),!1,t)}collectPath2d(){return this.isSplined&&this.splineGeo?this.splineGeo.getPoints(64).map(t=>new A(t.x,t.y)):this._vertices.map(t=>new A(t.x,t.y))}transformVector(t,e){const n=new y,r=new y(t.x,t.y,t.z);n.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-n.x,r.y-n.y,r.z-n.z)}};_s.typeName="Leader";let ur=_s;const Zn=class Zn extends it{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new Ft(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get area(){return 0}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return Z(t,n=>{switch(n){case 0:this.transformBy(C.makeTranslation(e));break;case 1:this.startPoint.add(e);break;case 2:this.endPoint.add(e);break}}),this}subGetOsnapPoints(t,e,n,r){const s=this.startPoint,o=this.endPoint;switch(t){case x.EndPoint:r.push(s),r.push(o);break;case x.MidPoint:r.push(this.midPoint);break;case x.Nearest:{const a=this._geo.project(e);r.push(a)}break;case x.Perpendicular:{const a=this._geo.perpPoint(e);r.push(a)}break;case x.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,n=this.endPoint,r=[new y(e.x,e.y,0),new y(n.x,n.y,0)];return t.lines(r)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}getOffsetCurves(t){const e=this._geo.offset(t);return[new Zn(e.startPoint,e.endPoint)]}getOffsetSideAtPoint(t){const e=this.startPoint,n=this.endPoint;return(n.x-e.x)*(t.y-e.y)-(n.y-e.y)*(t.x-e.x)>=0?1:-1}};Zn.typeName="Line";let Bn=Zn;var Ul=(i=>(i[i.Top=0]="Top",i[i.Zero=1]="Zero",i[i.Bottom=2]="Bottom",i))(Ul||{}),$l=(i=>(i[i.HasVertex=1]="HasVertex",i[i.Closed=2]="Closed",i[i.SuppressStartCaps=4]="SuppressStartCaps",i[i.SuppressEndCaps=8]="SuppressEndCaps",i))($l||{});const bs=class bs extends z{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new y,this._normal=new b(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(t){this._styleName=t}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(t){this._styleObjectHandle=t}get scale(){return this._scale}set scale(t){this._scale=t}get justification(){return this._justification}set justification(t){this._justification=t}get flags(){return this._flags}set flags(t){this._flags=t}get styleCount(){return this._styleCount}set styleCount(t){this._styleCount=Math.max(0,t)}get startPosition(){return this._startPosition}set startPosition(t){this._startPosition.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get segments(){return this._segments.map(t=>this.cloneSegment(t))}set segments(t){this._segments=t.map(e=>this.createSegment(e)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(t){this.setFlag(2,t)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(t){this.setFlag(4,t)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(t){this.setFlag(8,t)}appendSegment(t){this._segments.push(this.createSegment(t)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const t=this.collectGeometryPoints();return new k().setFromPoints(t)}transformBy(t){return this._startPosition.applyMatrix4(t),this._segments.forEach(e=>{e.position.applyMatrix4(t),this.transformVector(e.direction,t),this.transformVector(e.miterDirection,t)}),this.transformVector(this._normal,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:t=>{this.scale=t}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:t=>{this.justification=t}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this._startPosition.clone()),this._segments.forEach(e=>t.push(e.position.clone())),t}subMoveGripPointsAt(t,e){const n=[this._startPosition,...this._segments.map(r=>r.position)];return fn(t,e,n),Z(t,r=>{this.updateReferencePathDirectionsAfterGripMove(r)}),this}subGetOsnapPoints(t,e,n,r){const s=[this._startPosition,...this._segments.map(o=>o.position)];if(s.length!==0)switch(t){case x.EndPoint:r.push(...s);break;case x.MidPoint:case x.Nearest:case x.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];ze(s[a],s[a+1],t,e,l),o.push(...l)}if(t===x.MidPoint)r.push(...o);else{const a=wt(e,o);a&&r.push(a)}break}}}subWorldDraw(t){if(this._segments.length===0)return;const e=[],n=this.getMLineStyle(),r=this.getRenderableElementCount(n),s=t.subEntityTraits,o=s.color,a=s.lineType,l=s.fillType,h=s.drawOrder,c=this.createFillArea(n,r);if(c&&(s.color=o,this.applyFillTraits(n,s),s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},s.drawOrder=-1,e.push(t.area(c)),s.fillType=l,s.drawOrder=h),r<=0){const u=this.getReferencePath();u.length>=2&&e.push(t.lines(u))}else{for(let u=0;u<r;u++){s.color=o,s.lineType=a,this.applyStyleElementTraits(n,u,s);const g=this.getElementPath(u,n);g.length>=2&&e.push(t.lines(g))}this.appendStyleDrivenJointAndCapEntities(t,e,n,r,o,a)}if(s.color=o,s.lineType=a,s.fillType=l,s.drawOrder=h,e.length!==0)return e.length===1?e[0]:t.group(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMline"),t.writeString(2,this.styleName),t.writeHandle(340,this._styleObjectHandle),t.writeDouble(40,this._scale),t.writeInt16(70,this._justification),t.writeInt16(71,this._flags),t.writeInt16(72,this.vertexCount),t.writeInt16(73,this._styleCount),t.writePoint3d(10,this._startPosition),t.writeVector3d(210,this._normal),this._segments.forEach(e=>{t.writePoint3d(11,e.position),t.writeVector3d(12,e.direction),t.writeVector3d(13,e.miterDirection),e.elements.forEach(n=>{t.writeInt16(74,n.parameterCount),n.parameters.forEach(r=>t.writeDouble(41,r)),t.writeInt16(75,n.fillCount),n.fillParameters.forEach(r=>t.writeDouble(42,r))})}),this}setFlag(t,e){e?this._flags|=t:this._flags&=~t}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}updateReferencePathDirectionsAfterGripMove(t){const e=r=>{const s=this._segments[r];if(!s)return;const o=r===0?this._startPosition:this._segments[r-1].position,a=new b().subVectors(s.position,o);a.lengthSq()>0&&s.direction.copy(a.normalize())};if(t===0){this._segments.length>0&&e(0);return}const n=t-1;n<0||n>=this._segments.length||(e(n),n+1<this._segments.length&&e(n+1))}createSegment(t){var e;return{position:new y().copy(t.position),direction:new b().copy(t.direction),miterDirection:new b().copy(t.miterDirection),elements:((e=t.elements)==null?void 0:e.map(n=>this.createElement(n)))??[]}}createElement(t){const e=t.parameters?[...t.parameters]:[],n=t.fillParameters?[...t.fillParameters]:[];return{parameterCount:t.parameterCount??e.length,parameters:e,fillCount:t.fillCount??n.length,fillParameters:n}}cloneSegment(t){return{position:t.position.clone(),direction:t.direction.clone(),miterDirection:t.miterDirection.clone(),elements:t.elements.map(e=>({parameterCount:e.parameterCount,parameters:[...e.parameters],fillCount:e.fillCount,fillParameters:[...e.fillParameters]}))}}collectGeometryPoints(){const t=[this._startPosition];if(this._segments.length===0)return t;const e=this.getMLineStyle(),n=this.getRenderableElementCount(e);if(n<=0)return this._segments.forEach(r=>t.push(r.position)),t;for(let r=0;r<n;r++)t.push(...this.getElementPath(r,e));return t}getRenderableElementCount(t){const e=(t==null?void 0:t.elementCount)??0;return Math.max(this._styleCount,e,...this._segments.map(n=>n.elements.length),0)}getReferencePath(){const t=[this._startPosition.clone(),...this._segments.map(e=>e.position.clone())];return this.closePathIfNeeded(t)}getElementPath(t,e){const n=[],r=this._segments[0];return n.push(this.getElementBoundaryPoint("start",r,t,e)),this._segments.forEach(s=>{n.push(this.offsetPoint(s.position,s.miterDirection,this.getElementMiterOffset(s,t,e)))}),n[n.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],t,e),this.closePathIfNeeded(n)}getElementMiterOffset(t,e,n){var s;const r=t.elements[e];return(s=r==null?void 0:r.parameters)!=null&&s.length?r.parameters[0]:this.getStyleElementOffset(e,n)}getElementBoundaryPoint(t,e,n,r){const s=this.getElementMiterOffset(e,n,r),o=t==="start"?this._startPosition:e.position,a=this.offsetPoint(o,e.miterDirection,s);if(!this.shouldApplyCapCutAtSide(t,r))return a;const l=t==="start"?r==null?void 0:r.startAngle:r==null?void 0:r.endAngle,h=this.computeCapCutDistance(s,l,t);if(h===0)return a;const c=t==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return c.lengthSq()===0?a:a.add(c.multiplyScalar(h))}shouldApplyCapCutAtSide(t,e){return!e||this.closed?!1:t==="start"?this.suppressStartCaps?!1:(e.flags&112)!==0:this.suppressEndCaps?!1:(e.flags&1792)!==0}computeCapCutDistance(t,e,n){const r=this.normalizeCapAngle(e),s=Math.tan(r);if(Math.abs(s)<1e-6)return 0;const o=t/s;return o}normalizeCapAngle(t){if(t==null||!Number.isFinite(t))return Math.PI/2;let e=t%180;return e<0&&(e+=180),(e<1||e>179)&&(e=90),e*Math.PI/180}getStartSegmentDirection(){const t=this._segments[0],e=new b;return t&&(e.subVectors(t.position,this._startPosition),e.lengthSq()===0&&e.copy(t.direction)),e.lengthSq()>0&&e.normalize(),e}getEndSegmentDirection(){const t=this._segments[this._segments.length-1];if(!t)return new b;const e=new b,n=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return e.subVectors(t.position,n),e.lengthSq()===0&&e.copy(t.direction),e.lengthSq()>0&&e.normalize(),e}createFillArea(t,e){if(!t||!(t.flags&1)||e<2)return;const n=this.getFillBoundaryElementIndices(e,t);if(!n)return;const r=this.getElementPath(n.outerIndex,t),s=this.getElementPath(n.innerIndex,t),o=this.stripClosingPoint(r),a=this.stripClosingPoint(s);if(o.length<2||a.length<2)return;const l=new kt;if(this.closed){if(o.length<3||a.length<3)return;l.add(new V(o.map(h=>({x:h.x,y:h.y})),!0)),l.add(new V(a.map(h=>({x:h.x,y:h.y})),!0))}else{const h=[...o,...a.slice().reverse()].map(c=>({x:c.x,y:c.y}));if(h.length<3)return;l.add(new V(h,!0))}return l}getFillBoundaryElementIndices(t,e){let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=-1,o=-1;for(let a=0;a<t;a++){const l=this.getElementReferenceOffset(a,e);l<n&&(n=l,s=a),l>r&&(r=l,o=a)}if(!(s<0||o<0||s===o))return{outerIndex:o,innerIndex:s}}getElementReferenceOffset(t,e){var r;const n=this._segments[0];if(n){const s=n.elements[t];if((r=s==null?void 0:s.parameters)!=null&&r.length)return s.parameters[0]}return this.getStyleElementOffset(t,e)}getStyleElementOffset(t,e){const n=e==null?void 0:e.elements[t];if(!n)return 0;const r=this.getStyleJustificationShift(e);return(n.offset+r)*this._scale}getStyleJustificationShift(t){const e=(t==null?void 0:t.elements)??[];if(e.length<=0)return 0;let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const s of e){const o=s.offset;o<n&&(n=o),o>r&&(r=o)}return this._justification===0?-r:this._justification===2?-n:0}stripClosingPoint(t){if(t.length<2)return t;const e=t[0],n=t[t.length-1],r=1e-9;return Math.abs(e.x-n.x)<=r&&Math.abs(e.y-n.y)<=r&&Math.abs(e.z-n.z)<=r?t.slice(0,-1):t}offsetPoint(t,e,n){if(n===0||e.lengthSq()===0)return t.clone();const r=e.clone().normalize().multiplyScalar(n);return t.clone().add(r)}closePathIfNeeded(t){if(!this.closed||t.length<2)return t;const e=t[0],n=t[t.length-1],r=1e-9;return Math.abs(e.x-n.x)<=r&&Math.abs(e.y-n.y)<=r&&Math.abs(e.z-n.z)<=r||t.push(e.clone()),t}appendStyleDrivenJointAndCapEntities(t,e,n,r,s,o){!n||r<2||(e.push(...this.drawMiterJointEntities(t,n,r,s,o)),e.push(...this.drawCapEntities(t,n,r,s,o)))}drawMiterJointEntities(t,e,n,r,s){if(this.closed||this._segments.length<2||!(e.flags&2))return[];const o=[],a=t.subEntityTraits;for(let l=0;l<this._segments.length-1;l++){const h=this._segments[l],c=Array.from({length:n},(u,g)=>{const d=this.getElementMiterOffset(h,g,e);return{elementIndex:g,offset:d,point:this.offsetPoint(h.position,h.miterDirection,d)}}).sort((u,g)=>g.offset-u.offset);for(let u=0;u<c.length-1;u++)this.applyElementDrawTraits(a,r,s,e,c[u].elementIndex),o.push(t.lines([c[u].point,c[u+1].point]))}return o}drawCapEntities(t,e,n,r,s){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(t,"start",e,n,r,s)),o.push(...this.drawCapEntitiesForSide(t,"end",e,n,r,s)),o}drawCapEntitiesForSide(t,e,n,r,s,o){if(e==="start"&&this.suppressStartCaps)return[];if(e==="end"&&this.suppressEndCaps)return[];const a=n.flags,l=e==="start",h=l?(a&16)!==0:(a&256)!==0,c=l?(a&64)!==0:(a&1024)!==0,u=l?(a&32)!==0:(a&512)!==0;if(!h&&!c&&!u)return[];const g=this.getCapElementPoints(e,r,n);if(g.length<2)return[];const d=[],f=t.subEntityTraits;if(h)for(let m=0;m<g.length-1;m++)this.applyElementDrawTraits(f,s,o,n,g[m].elementIndex),d.push(t.lines([g[m].point,g[m+1].point]));const p=l?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(c){const m=this.drawCapArcBetweenElements(t,e,g[0],g[g.length-1],p,f,s,o,n);m&&d.push(m)}if(u)for(let m=1;m<Math.floor(g.length/2);m++){const _=g[m],v=g[g.length-1-m];if(!_||!v||_===v)continue;const P=this.drawCapArcBetweenElements(t,e,_,v,p,f,s,o,n);P&&d.push(P)}return d}getCapElementPoints(t,e,n){const r=t==="start"?this._segments[0]:this._segments[this._segments.length-1];return r?Array.from({length:e},(s,o)=>({elementIndex:o,offset:this.getElementMiterOffset(r,o,n),point:this.getElementBoundaryPoint(t,r,o,n)})).sort((s,o)=>o.offset-s.offset):[]}drawCapArcBetweenElements(t,e,n,r,s,o,a,l,h){const c=e==="end"?r.point:n.point,u=e==="end"?n.point:r.point,g=c.distanceTo(u);if(g<=1e-9||s.lengthSq()===0)return;const f=c.clone().add(new b().subVectors(u,c).multiplyScalar(.5)).add(s.clone().normalize().multiplyScalar(g/2)),p=It.createByThreePoints(c,u,f);if(p)return this.applyElementDrawTraits(o,a,l,h,e==="end"?r.elementIndex:n.elementIndex),t.circularArc(p)}applyElementDrawTraits(t,e,n,r,s){t.color=e,t.lineType=n,this.applyStyleElementTraits(r,s,t)}transformVector(t,e){const n=new y,r=new y(t.x,t.y,t.z);n.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-n.x,r.y-n.y,r.z-n.z)}getMLineStyle(){var s;const t=this.database.objects.mlineStyle,e=this.styleObjectHandle?t.getIdAt(this.styleObjectHandle):void 0;if(e)return e;const n=this.styleName?t.getAt(this.styleName):void 0;if(n)return n;const r=(s=this.styleName)==null?void 0:s.toUpperCase();if(r)for(const[o,a]of t.entries()){const l=(a.styleName||o).toUpperCase();if(o.toUpperCase()===r||l===r)return a}}applyStyleElementTraits(t,e,n){const r=t==null?void 0:t.elements[e];if(!r)return;const s=this.resolveStyleElementLineType(r.lineType);s&&(n.lineType=s),!(r.color.isByBlock||r.color.isByLayer)&&(n.color=r.color.clone())}applyFillTraits(t,e){const n=t==null?void 0:t.fillColor;!n||n.isByBlock||n.isByLayer||(e.color=n.clone())}resolveStyleElementLineType(t){var h;const e=t==null?void 0:t.trim();if(!e)return;const n=e.toUpperCase(),r=K.toUpperCase(),s=Ct.toUpperCase();let o="UserSpecified",a=e;if(n===r){o="ByLayer";const c=(h=this.database.tables.layerTable.getAt(this.layer))==null?void 0:h.linetype;a=c&&c.toUpperCase()!==r&&c.toUpperCase()!==s?c:Jt}else n===s&&(o="ByBlock",a=Jt);const l=this.database.tables.linetypeTable.getAt(a);return l?{type:o,...l.linetype}:{type:o,name:a,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||Kt}catch{return Kt}}};bs.typeName="MLine";let dr=bs;var Ze=(i=>(i[i.InvisibleLeader=0]="InvisibleLeader",i[i.StraightLeader=1]="StraightLeader",i[i.SplineLeader=2]="SplineLeader",i))(Ze||{}),Le=(i=>(i[i.NoneContent=0]="NoneContent",i[i.BlockContent=1]="BlockContent",i[i.MTextContent=2]="MTextContent",i[i.ToleranceContent=3]="ToleranceContent",i))(Le||{}),ql=(i=>(i[i.Horizontal=0]="Horizontal",i[i.Vertical=1]="Vertical",i))(ql||{}),Kl=(i=>(i[i.Unknown=0]="Unknown",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.Top=3]="Top",i[i.Bottom=4]="Bottom",i))(Kl||{});const Cg=1,kg=2,Og=4,Ng=8,Xg=64,Yg=128,Rg=32768,xs=class xs extends z{get dxfTypeName(){return"MULTILEADER"}constructor(){super(),this._leaders=[],this._leaderLineType=1,this._contentType=0,this._doglegEnabled=!1,this._doglegLength=0,this._doglegVector=new b(1,0,0),this._normal=new b(0,0,1),this._mleaderStyleId="",this._textHeight=2.5,this._textWidth=0,this._textRotation=0,this._textDirection=new b(1,0,0),this._textStyleName="",this._textAttachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,this._textDrawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(t=>this.cloneLeader(t))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(t){this._doglegEnabled=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get doglegVector(){return this._doglegVector}set doglegVector(t){this._doglegVector.copy(t)}get landingPoint(){return this._landingPoint}set landingPoint(t){this._landingPoint=t?this.createPoint(t):void 0}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(t){this._mleaderStyleId=t}get version(){return this._version}set version(t){this._version=t}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(t){this._leaderStyleId=t}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(t){this._propertyOverrideFlag=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor=t==null?void 0:t.clone()}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get landingEnabled(){return this._landingEnabled}set landingEnabled(t){this._landingEnabled=t}get arrowheadId(){return this._arrowheadId}set arrowheadId(t){this._arrowheadId=t}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(t){this._arrowheadSize=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor=t==null?void 0:t.clone()}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(t){this._textFrameEnabled=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get textAttachment(){return this._textAttachment}set textAttachment(t){this._textAttachment=t}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(t){this._textFlowDirection=t}get blockContentId(){return this._blockContentId}set blockContentId(t){this._blockContentId=t}get blockContentColor(){return this._blockContentColor}set blockContentColor(t){this._blockContentColor=t==null?void 0:t.clone()}get blockContentScale(){return this._blockContentScale}set blockContentScale(t){this._blockContentScale=t}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(t){this._blockContentRotation=t}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(t){this._blockContentConnectionType=t}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(t){this._annotativeScaleEnabled=t}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(t){this._arrowheadOverrides=t}get blockAttributes(){return this._blockAttributes}set blockAttributes(t){this._blockAttributes=t}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(t){this._textDirectionNegative=t}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(t){this._textAlignInIPE=t}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(t){this._bottomTextAttachmentDirection=t}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(t){this._topTextAttachmentDirection=t}get contentScale(){return this._contentScale}set contentScale(t){this._contentScale=t}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(t){this._contentBasePosition=t}get textAnchor(){return this._textAnchor}set textAnchor(t){this._textAnchor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(t){this._textBackgroundColor=t==null?void 0:t.clone()}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(t){this._textBackgroundScaleFactor=t}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(t){this._textBackgroundTransparency=t}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(t){this._textBackgroundColorOn=t}get textFillOn(){return this._textFillOn}set textFillOn(t){this._textFillOn=t}get textColumnType(){return this._textColumnType}set textColumnType(t){this._textColumnType=t}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(t){this._textUseAutoHeight=t}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(t){this._textColumnWidth=t}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(t){this._textColumnGutterWidth=t}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(t){this._textColumnFlowReversed=t}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(t){this._textColumnHeight=t}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(t){this._textUseWordBreak=t}get hasMText(){return this._hasMText}set hasMText(t){this._hasMText=t}get hasBlock(){return this._hasBlock}set hasBlock(t){this._hasBlock=t}get planeOrigin(){return this._planeOrigin}set planeOrigin(t){this._planeOrigin=t}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(t){this._planeXAxisDirection=t}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(t){this._planeYAxisDirection=t}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(t){this._planeNormalReversed=t}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(t){if(!t){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:t.text,anchorPoint:this.createPoint(t.anchorPoint)},this._contentType=2}get contents(){var t;return((t=this._mtextContent)==null?void 0:t.text)??""}set contents(t){this._mtextContent?this._mtextContent.text=t:this._mtextContent={text:t,anchorPoint:new y},this._contentType=2}get textLocation(){var t;return(t=this._mtextContent)==null?void 0:t.anchorPoint}set textLocation(t){if(!t){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(t):this._mtextContent={text:"",anchorPoint:this.createPoint(t)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get textDirection(){return this._textDirection}set textDirection(t){this._textDirection.copy(t)}get textStyleName(){return this._textStyleName}set textStyleName(t){this._textStyleName=t}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(t){this._textAttachmentPoint=t}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(t){this._textDrawingDirection=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get blockContent(){var t,e,n;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(t=this._blockContent.normal)==null?void 0:t.clone(),position:(e=this._blockContent.position)==null?void 0:e.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:(n=this._blockContent.color)==null?void 0:n.clone(),transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(t){var e;if(!t){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:t.blockContentId??t.blockHandle,blockHandle:t.blockHandle,normal:t.normal?new b(t.normal):void 0,position:t.position?this.createPoint(t.position):void 0,scale:new b(t.scale??{x:1,y:1,z:1}),rotation:t.rotation??0,color:(e=t.color)==null?void 0:e.clone(),transformationMatrix:t.transformationMatrix?[...t.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(t={}){var n,r;const e={lastLeaderLinePoint:t.lastLeaderLinePoint?this.createPoint(t.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:t.landingPoint?this.createPoint(t.landingPoint):void 0,doglegVector:t.doglegVector?new b(t.doglegVector):void 0,doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:((n=t.breaks)==null?void 0:n.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[],leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:[]};return(r=t.leaderLines)==null||r.forEach(s=>{e.leaderLines.push(this.createLeaderLine(s))}),this._leaders.push(e),this._leaders.length-1}removeLeader(t){return this.checkLeaderIndex(t),this._leaders.splice(t,1),this}addLeaderLine(t,e=[]){return this.checkLeaderIndex(t),this._leaders[t].leaderLines.push(this.createLeaderLine({vertices:e})),this._leaders[t].leaderLines.length-1}appendVertex(t,e,n){return this.getMutableLeaderLine(t,e).vertices.push(this.createPoint(n)),this}setLeaderLineVertices(t,e,n){return this.getMutableLeaderLine(t,e).vertices=n.map(r=>this.createPoint(r)),this}getLeaderLineVertices(t,e){return this.getMutableLeaderLine(t,e).vertices.map(n=>n.clone())}addBreak(t,e,n,r){return this.getMutableLeaderLine(t,e).breaks.push({start:this.createPoint(n),end:this.createPoint(r)}),this}setLandingPoint(t,e){return this.checkLeaderIndex(t),this._leaders[t].landingPoint=e?this.createPoint(e):void 0,this}setDoglegDirection(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegVector=new b(e),this}setDoglegLength(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegLength=e,this}get geometricExtents(){const t=this.collectGeometryPoints();return t.length>0?new k().setFromPoints(t):new k}subGetGripPoints(){return this.collectGeometryPoints().map(t=>t.clone())}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGeometryGripPointAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){var s;if(t===x.Insertion){this.contentBasePosition?r.push(this.contentBasePosition):this._mtextContent?r.push(this._mtextContent.anchorPoint):(s=this._blockContent)!=null&&s.position&&r.push(this._blockContent.position);return}this._leaders.forEach(o=>{o.leaderLines.forEach(a=>{const l=this.getLeaderLineDrawPoints(o,a);if(l.length!==0)switch(t){case x.EndPoint:r.push(...l);break;case x.MidPoint:case x.Nearest:case x.Perpendicular:{const h=[];for(let c=0;c<l.length-1;c++){const u=[];ze(l[c],l[c+1],t,e,u),h.push(...u)}if(t===x.MidPoint)r.push(...h);else{const c=wt(e,h);c&&r.push(c)}break}}})})}transformBy(t){var e,n,r,s,o,a,l,h;return this._leaders.forEach(c=>{var u,g;(u=c.lastLeaderLinePoint)==null||u.applyMatrix4(t),(g=c.landingPoint)==null||g.applyMatrix4(t),c.doglegVector&&this.transformVector(c.doglegVector,t),c.breaks.forEach(d=>{d.start.applyMatrix4(t),d.end.applyMatrix4(t)}),c.leaderLines.forEach(d=>{d.vertices.forEach(f=>f.applyMatrix4(t)),d.breaks.forEach(f=>{f.start.applyMatrix4(t),f.end.applyMatrix4(t)})})}),(e=this._landingPoint)==null||e.applyMatrix4(t),(n=this.contentBasePosition)==null||n.applyMatrix4(t),this.transformVector(this._doglegVector,t),this.transformVector(this._normal,t),(r=this.textAnchor)==null||r.applyMatrix4(t),(s=this._mtextContent)==null||s.anchorPoint.applyMatrix4(t),this.transformVector(this._textDirection,t),(a=(o=this._blockContent)==null?void 0:o.position)==null||a.applyMatrix4(t),(l=this._blockContent)!=null&&l.normal&&this.transformVector(this._blockContent.normal,t),this.blockContentScale&&this.transformVector(this.blockContentScale,t),(h=this.planeOrigin)==null||h.applyMatrix4(t),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,t),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:Le[0],value:0},{label:Le[1],value:1},{label:Le[2],value:2},{label:Le[3],value:3}],accessor:{get:()=>this.contentType,set:t=>{this.contentType=t}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:Ze[0],value:0},{label:Ze[1],value:1},{label:Ze[2],value:2}],accessor:{get:()=>this.leaderLineType,set:t=>{this.leaderLineType=t}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:t=>{this.doglegEnabled=t}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:t=>{this.doglegLength=t}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:t=>{this.textHeight=t}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:t=>{this.textWidth=t}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:t=>{this.textStyleName=t}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const t=this.getDefaultMLeaderStyle();t&&(this._mleaderStyleId=t.objectId)}subWorldDraw(t,e){const n=[],r=t.subEntityTraits,s=r.color,o=r.lineType,a=r.lineWeight,l=this.getResolvedLeaderLineColor(),h=this.getResolvedLeaderLineStyle(),c=this.getResolvedLeaderLineWeight(),u=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(r,l,s),this.applyLineTraits(r,h,c),this._leaders.forEach(d=>{d.leaderLines.forEach(p=>{const m=this.getLeaderLineDrawPoints(d,p);if(m.length>0){const _=this.drawLeaderLine(t,m);_&&n.push(_)}});const f=this.getDoglegPoints(d);f&&n.push(t.lines(f))}));const g=this.getRenderableMTextContent();if(this.contentType===2&&g){this.applyColorTraits(r,u,s);const d=this.getResolvedTextHeight(),f={text:g.text,height:d,width:this.getMTextRenderWidth(g.text,d),position:g.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};n.push(t.mtext(f,this.getTextStyle(),e))}if(r.color=s,r.lineType=o,r.lineWeight=a,n.length!==0)return n.length===1?n[0]:t.group(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeader"),t.writeInt16(170,this.leaderLineType),t.writeBoolean(290,this.doglegEnabled),t.writeDouble(41,this.doglegLength),t.writeInt16(172,this.contentType),t.writeVector3d(210,this.normal),t.writeHandle(340,this.mleaderStyleId),this._landingPoint&&t.writePoint3d(10,this._landingPoint),t.writeVector3d(11,this.doglegVector),this._mtextContent&&(t.writeString(1,this._mtextContent.text),t.writePoint3d(12,this._mtextContent.anchorPoint),t.writeDouble(40,this.textHeight),t.writeDouble(42,this.textWidth),t.writeAngle(50,this.textRotation),t.writeString(7,this.textStyleName)),this._blockContent&&(t.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&t.writePoint3d(15,this._blockContent.position),t.writeVector3d(16,this._blockContent.scale),t.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(e=>{e.landingPoint&&t.writePoint3d(110,e.landingPoint),e.doglegVector&&t.writeVector3d(111,e.doglegVector),t.writeDouble(140,e.doglegLength),t.writeInt16(171,e.leaderLines.length),e.leaderLines.forEach(n=>{t.writeInt16(90,n.vertices.length),n.vertices.forEach(r=>t.writePoint3d(10,r))})}),this}createPoint(t){return new y().copy(t)}createLeaderLine(t){var e,n;return{vertices:((e=t.vertices)==null?void 0:e.map(r=>this.createPoint(r)))??[],breakPointIndexes:t.breakPointIndexes?[...t.breakPointIndexes]:[],leaderLineIndex:t.leaderLineIndex,breaks:((n=t.breaks)==null?void 0:n.map(r=>({index:r.index,start:this.createPoint(r.start),end:this.createPoint(r.end)})))??[]}}cloneLeader(t){var e,n,r;return{lastLeaderLinePoint:(e=t.lastLeaderLinePoint)==null?void 0:e.clone(),lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:(n=t.landingPoint)==null?void 0:n.clone(),doglegVector:(r=t.doglegVector)==null?void 0:r.clone(),doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:t.breaks.map(s=>({index:s.index,start:s.start.clone(),end:s.end.clone()})),leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:t.leaderLines.map(s=>({vertices:s.vertices.map(o=>o.clone()),breakPointIndexes:[...s.breakPointIndexes],leaderLineIndex:s.leaderLineIndex,breaks:s.breaks.map(o=>({index:o.index,start:o.start.clone(),end:o.end.clone()}))}))}}checkLeaderIndex(t){if(t<0||t>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(t,e){this.checkLeaderIndex(t);const n=this._leaders[t].leaderLines[e];if(!n)throw new Error("The leader line index is out of range!");return n}collectGeometryPoints(){var e;const t=[];return this._leaders.forEach(n=>{n.lastLeaderLinePoint&&t.push(n.lastLeaderLinePoint),n.landingPoint&&t.push(n.landingPoint),n.breaks.forEach(s=>t.push(s.start,s.end)),n.leaderLines.forEach(s=>{t.push(...s.vertices),s.breaks.forEach(o=>t.push(o.start,o.end))});const r=this.getDoglegPoints(n);r&&t.push(...r),n.leaderLines.forEach(s=>{const o=this.getArrowheadPoints(this.getLeaderLineDrawPoints(n,s));o&&t.push(...o)})}),this._landingPoint&&t.push(this._landingPoint),this.contentBasePosition&&t.push(this.contentBasePosition),this.textAnchor&&t.push(this.textAnchor),this._mtextContent&&t.push(this._mtextContent.anchorPoint),(e=this._blockContent)!=null&&e.position&&t.push(this._blockContent.position),this.planeOrigin&&t.push(this.planeOrigin),t}moveGeometryGripPointAt(t,e){var s;let n=0;const r=(o,a)=>{if(o){n===t&&o.add(e),n++;return}a&&(n===t&&a(),n++)};this._leaders.forEach(o=>{r(o.lastLeaderLinePoint),r(o.landingPoint),o.breaks.forEach(l=>{r(l.start),r(l.end)}),o.leaderLines.forEach(l=>{l.vertices.forEach(h=>r(h)),l.breaks.forEach(h=>{r(h.start),r(h.end)})});const a=this.getDoglegPoints(o);a&&(r(a[0]),r(void 0,()=>{const l=a[0],h=a[1];if(!l||!h)return;const c=l.distanceTo({x:h.x+e.x,y:h.y+e.y,z:(h.z??0)+(e.z??0)});o.doglegLength!=null||o.doglegVectorSet?o.doglegLength=c:this._doglegLength=c})),o.leaderLines.forEach(l=>{const h=this.getLeaderLineDrawPoints(o,l),c=this.getArrowheadPoints(h);c&&c.forEach((u,g)=>{g===0||g===c.length-1?r(h[0]):r(void 0)})})}),r(this._landingPoint),r(this.contentBasePosition),r(this.textAnchor),this._mtextContent&&r(this._mtextContent.anchorPoint),(s=this._blockContent)!=null&&s.position&&r(this._blockContent.position),r(this.planeOrigin)}getLeaderLineDrawPoints(t,e){if(e.vertices.length>=2)return e.vertices;if(e.vertices.length===0)return[];const n=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint??this.contentBasePosition;return!n||e.vertices[0].equals(n)?e.vertices:[e.vertices[0],n]}getDoglegPoints(t){if(!this.getResolvedDoglegEnabled())return;const e=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint,n=t.doglegVector??this._doglegVector,r=t.doglegLength??this.getResolvedDoglegLength();if(!e||r==null||r===0||n.lengthSq()===0)return;const s=e.clone().add(n.clone().normalize().multiplyScalar(r));return[e,s]}getArrowheadPoints(t){if(!this.isArrowheadVisible()||t.length<2)return;const e=this.getArrowheadFrame(t);if(!e)return;const n=this.getResolvedArrowheadSize(),{tip:r,unit:s}=e,o=r.clone().add(s.clone().multiplyScalar(n)),a=n/6,l=new b(-s.y,s.x,0),h=o.clone().add(l.clone().multiplyScalar(a)),c=o.clone().add(l.clone().multiplyScalar(-a));return[r,h,c,r]}isArrowheadVisible(){const t=this.getResolvedArrowheadId();return(t==null?void 0:t.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(t,e){const n=[],r=this.getLeaderLinePointsForDraw(e);r.length>=2&&n.push(t.lines(r));const s=this.drawArrowhead(t,e);if(s&&n.push(s),n.length!==0)return n.length===1?n[0]:t.group(n)}getLeaderLinePointsForDraw(t){const e=this.getArrowheadLeaderLineTrimDistance();return e<=0?t:this.trimPolylineStart(t,e)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const t=this.getResolvedArrowheadBlockTableRecord();if(!t)return 0;const e=this.getResolvedArrowheadSize();if(e<=0)return 0;const n=t.origin??y.ORIGIN;let r=n.x;for(const s of t.newIterator()){const o=s.geometricExtents;o.isEmpty()||o.max.x>r&&(r=o.max.x)}return Math.max(0,(r-n.x)*e)}trimPolylineStart(t,e){if(t.length<2||e<=0)return t;let n=e;for(let r=0;r<t.length-1;r++){const s=t[r],o=t[r+1],a=o.distanceTo(s);if(!(a<=0)){if(n<a){const l=new b().subVectors(o,s);return[s.clone().add(l.multiplyScalar(n/a)),...t.slice(r+1)]}n-=a}}return[t[t.length-1]]}drawArrowhead(t,e){if(!this.isArrowheadVisible())return;const n=this.drawArrowheadBlock(t,e);if(n)return n;const r=this.getArrowheadPoints(e);if(!r)return;const s=new kt;s.add(new V(r,!0));const o=t.subEntityTraits,a=o.fillType;o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const l=t.area(s);return o.fillType=a,l}drawArrowheadBlock(t,e){const n=this.getResolvedArrowheadBlockTableRecord();if(!n)return;const r=this.getArrowheadFrame(e);if(!r)return;const{tip:s,unit:o}=r,a=this.getResolvedArrowheadSize(),l=Math.atan2(o.y,o.x),h=n.origin??y.ORIGIN,c=new C().makeTranslation(-h.x,-h.y,-h.z),u=new C().makeScale(a,a,a),g=new C().makeRotationZ(l),d=new C().makeTranslation(s.x,s.y,s.z),f=new C().multiplyMatrices(d,g).multiply(u).multiply(c);return ge.instance.draw(t,n,this.resolvedColor,[],!0,f,new b(this.normal))}getArrowheadFrame(t){if(t.length<2)return;const e=t[0],n=t.find(s=>!s.equals(e));if(!n)return;const r=new b().subVectors(n,e);if(r.lengthSq()!==0)return{tip:e,unit:r.normalize()}}getResolvedArrowheadId(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.arrowSymbolId;return this.arrowheadId??t}getResolvedArrowheadBlockTableRecord(){const t=this.getResolvedArrowheadId();if(t)return this.database.tables.blockTable.getIdAt(t)}getResolvedArrowheadSize(){const t=this.getMLeaderStyle(),e=(t==null?void 0:t.arrowSize)??(t==null?void 0:t.scale);return this.arrowheadSize??this.contentScale??e??this.getResolvedTextHeight()}getResolvedTextHeight(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.textHeight;return this.textHeight>0?this.textHeight:t!=null&&t>0?t:2.5}getRenderableMTextContent(){var n;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const t=(n=this.getMLeaderStyle())==null?void 0:n.defaultMTextContents,e=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!t||!e))return{text:t,anchorPoint:e}}getMTextRenderWidth(t,e){if(this._textWidth>0)return this._textWidth;if(!t)return this._textWidth;const n=t.replace(/\\[PpNn]/g,`
|
|
10
|
-
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),r=Math.max(...n.split(/\r\n|\r|\n/g).map(s=>s.length),1);return Math.max(e,r*e)}transformVector(t,e){const n=new y,r=new y(t.x,t.y,t.z);n.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-n.x,r.y-n.y,r.z-n.z)}getMLeaderStyle(){const t=this.database.objects.mleaderStyle,e=this.mleaderStyleId||this.leaderStyleId;if(e){const n=t.getIdAt(e);if(n)return n}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const t=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return t||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(t){const e=t==null?void 0:t.trim();if(!e)return;const n=this.database.objects.mleaderStyle,r=n.getAt(e);if(r)return r;const s=n.getIdAt(e);if(s)return s;const o=e.toUpperCase();for(const[a,l]of n.entries())if(a.toUpperCase()===o)return l}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||Zt}catch{return Zt}}getResolvedTextStyleName(){var s,o,a;const t=this.database.tables.textStyleTable,e=(s=this.getMLeaderStyle())==null?void 0:s.textStyleId,n=e?(o=t.getIdAt(e))==null?void 0:o.name:void 0,r=this.textStyleId?(a=t.getIdAt(this.textStyleId))==null?void 0:a.name:void 0;if(this.textStyleName){const l=t.getAt(this.textStyleName);if(l!=null&&l.name)return l.name;const h=t.getIdAt(this.textStyleName);if(h!=null&&h.name)return h.name}return r||n}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.getResolvedTextStyleName());if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}getResolvedLeaderLineColor(){var t;return this.getResolvedComponentColor(this.leaderLineColor,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineColor,kg)}getResolvedLeaderLineType(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,t,Cg)}getResolvedLeaderLineTypeId(){var t;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineTypeId,Og)}getResolvedLeaderLineStyle(){const t=this.getResolvedLeaderLineTypeId();if(!t)return;const e=this.database.tables.linetypeTable.getIdAt(t);if(e)return{type:"UserSpecified",...e.linetype}}getResolvedLeaderLineWeight(){var n;const t=(n=this.getMLeaderStyle())==null?void 0:n.leaderLineWeight,e=this.getResolvedStyleDrivenValue(this.leaderLineWeight,t,Ng);if(e!=null)return e}getResolvedDoglegEnabled(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,t,Xg)}getResolvedDoglegLength(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,t,Yg)}getResolvedTextColor(){var t;return this.getResolvedComponentColor(this.textColor,(t=this.getMLeaderStyle())==null?void 0:t.textColor,Rg)}getResolvedComponentColor(t,e,n){if(!t)return e;const r=this.isPropertyOverrideEnabled(n);return r===!0?t:r===!1?e??t:!t.isByBlock&&!t.isByLayer?t:e??t}getResolvedStyleDrivenValue(t,e,n){const r=this.isPropertyOverrideEnabled(n);return r===!0?t??e:e??t}isPropertyOverrideEnabled(t){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&t)!==0}applyColorTraits(t,e,n){t.color=n,e&&(t.color=e)}applyLineTraits(t,e,n){e&&(t.lineType=e),n!=null&&(t.lineWeight=n)}};xs.typeName="MLeader";let gr=xs;function Bg(i){return i&2048?"SqrtChord":i&1024?"Chord":"Uniform"}function vo(i,t){try{return new Fn(i.controlPoints,i.knots,Fg(i.weights,i.controlPoints.length),i.degree,t)}catch{return null}}function Fg(i,t){if(!(!i||i.length!==t))return i}const Je=class Je extends it{get dxfTypeName(){return"SPLINE"}static fromControlPoints(t,e,n,r,s){const o=Tt.fromControlPoints(t,e,n,r,s);return o?vo(o,s):null}static fromFitPoints(t,e,n,r,s,o){const a=Tt.fromFitPoints(t,e,n,r,s,o);return a?vo(a,r):null}static fromDwgSpline(t){const e=!!(t.flag&1),n=Bg(t.flag);if(t.numberOfControlPoints>0&&t.numberOfKnots>0){const r=Je.fromControlPoints(t.controlPoints,t.knots,t.weights,t.degree,e);if(r)return r}return t.numberOfFitPoints>0?Je.fromFitPoints(t.fitPoints,n,t.degree,e,t.startTangent,t.endTangent):null}constructor(t,e,n,r,s){super(),this.rebuild(t,e,n,r,s)}rebuild(t,e,n,r,s){const o=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(r!==void 0)+ +(s!==void 0);if(o<2||o>5)throw ut.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Tt(t,e,n,r):this._geo=new Tt(t,e,n,r,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}subGetGripPoints(){return this._geo.getGripPoints()}subMoveGripPointsAt(t,e){return this._geo.moveGripPointsAt(t,e),this}subGetOsnapPoints(t,e,n,r){switch(t){case x.EndPoint:r.push(this._geo.startPoint),r.push(this._geo.endPoint);break;case x.Node:{const s=new Set;for(const o of this._geo.knots)s.has(o)||(s.add(o),r.push(this._geo.evaluateAt(o)));break}case x.Nearest:r.push(this._geo.nearestPoint(e));break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var n;const e=this._geo;super.dxfOutFields(t),t.writeSubclassMarker("AcDbSpline"),t.writeInt16(70,this.closed?1:0),t.writeInt16(71,e.degree),t.writeInt16(72,e.knots.length),t.writeInt16(73,e.controlPoints.length),t.writeInt16(74,((n=e.fitPoints)==null?void 0:n.length)??0);for(const r of e.knots)t.writeDouble(40,r);for(const r of e.weights)t.writeDouble(41,r);for(const r of e.controlPoints)t.writePoint3d(10,r);for(const r of e.fitPoints??[])t.writePoint3d(11,r);return this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d(1);return e.length<2?1:ft.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const{points:e,tangents:n}=this._geo.getOffsetSamplePath2d(t),r=Vc(e,this.closed,t,n);return r?ft.fromGePolyline(r):null}collectPath2d(t){return this._geo.getOffsetSamplePath2d(t).points}};Je.typeName="Spline";let Fn=Je;const zg=new b,ws=class ws extends Re{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,n){super(t),this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=n,this._numRows=e,this._columnWidth=new Array(n),this._rowHeight=new Array(e),this._cells=new Array(e*n)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,n){var s;const r=t*this._numColumns+e;return(s=this._cells[r])==null?void 0:s.text}setTextString(t,e,n){const r=t*this._numColumns+e;if(!this._cells[r]){this._cells[r]={text:n,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[r].text=n}isEmpty(t,e){var r;const n=t*this._numColumns+e;return!((r=this._cells[n])!=null&&r.text)}get geometricExtents(){let t;try{t=this.blockTableRecord}catch{t=void 0}if(t&&t.newIterator().count>0){const a=new k;for(const l of t.newIterator())a.union(l.geometricExtents);return a.applyMatrix4(this.blockTransform),a}const e=this._columnWidth.reduce((a,l)=>a+l,0),n=this._rowHeight.reduce((a,l)=>a+l,0),r=new k;if(e===0&&n===0)return r.expandByPoint(this.position),r;const s=new ke;s.setFromAxisAngle(b.Z_AXIS,this.rotation),be.compose(this.position,s,this.scaleFactors);const o=[new y(0,0,0),new y(e,0,0),new y(e,-n,0),new y(0,-n,0)];for(const a of o)r.expandByPoint(a.applyMatrix4(be));return r}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){const e=this.blockTableRecord;if(e&&e.newIterator().count>0){const d=this.drawAnonymousTableBlock(t,e);if(d)return d}let n=0,r=0;const s=new Uint16Array(this.numColumns*this.numRows*8),o=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let d=0;d<=this.numRows;d++){n-=d>0?this.rowHeight(d-1):0,r=0;for(let f=0;f<=this.numColumns;f++)r+=f>0?this.columnWidth(f-1):0,o[a++]=r,o[a++]=n,o[a++]=0}const l=[],h=new Array(this.numRows*this.numColumns).fill(!1);r=0,a=0;let c=0;for(let d=0;d<this.numColumns;d++){r+=d>0?this.columnWidth(d-1):0,n=0;for(let f=0;f<this.numRows;f++){n+=f>0?this.rowHeight(f-1):0;const p=this.cell(f*this.numColumns+d);if(c=f*this.numColumns+d,p&&!h[c]){const m=p.borderWidth??1,_=p.borderHeight??1;this.fillVisited(h,c,this.numColumns,m,_),s[a++]=d+f*(this.numColumns+1),s[a++]=d+f*(this.numColumns+1)+m;const v=o[s[a-1]*3]-r,P=d+(f+_)*(this.numColumns+1)+m;d+m==this.numColumns&&(s[a++]=d+f*(this.numColumns+1)+m,s[a++]=P);const S=-o[P*3+1]-n;if(f+_==this.numRows&&(s[a++]=d+(f+_)*(this.numColumns+1)+_,s[a++]=d+(f+_)*(this.numColumns+1)),s[a++]=d+(f+_)*(this.numColumns+1),s[a++]=d+f*(this.numColumns+1),p.text){const L=p.attachmentPoint||this.attachmentPoint||exports.AcGiMTextAttachmentPoint.MiddleCenter,T=this.getTableTextOffset(L,v,S),I={text:p.text,height:this.getCellTextHeight(p,S),width:v,position:zg.set(r,-n,0).clone().add(T),rotation:this.rotation,attachmentPoint:L},X=this.getTextStyle(p);l.push(t.mtext(I,X))}}}}l.push(t.lineSegments(o,3,s));const u=t.group(l),g=new ke;return g.setFromAxisAngle(b.Z_AXIS,this.rotation),be.compose(this.position,g,this.scaleFactors),u.applyMatrix(be),u}drawAnonymousTableBlock(t,e){const n=[],r=e.newIterator();for(const a of r){let l;if(a.color.isByBlock){Po.copy(a.color);const h=this.resolvedColor;h.isForeground?a.color.setForeground():h.RGB!=null&&a.color.setRGBValue(h.RGB),l=a.worldDraw(t),a.color.copy(Po)}else l=a.worldDraw(t);l&&(l.objectId=this.objectId,l.ownerId=this.ownerId,l.layerName=this.layer,l.visible=this.visibility&&a.visibility,n.push(l))}const s=t.group(n);s.applyMatrix(this.blockTransform);const o=this.normal;return o&&(o.x!==0||o.y!==0||o.z!==1)&&(be.setFromExtrusionDirection(o),s.applyMatrix(be)),s}fillVisited(t,e,n,r,s){if(s==1&&r==1)t[e]=!0;else for(let o=0;o<r;++o)for(let a=0;a<s;++a)t[e+o+a*n]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable.resolveAt(t.textStyle);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}getTableTextOffset(t,e,n){const r=new b;switch(t){case 1:break;case 2:r.setX(e/2);break;case 3:r.setX(e);break;case 4:r.setY(-n/2);break;case 5:r.set(e/2,-n/2,0);break;case 6:r.set(e,-n/2,0);break;case 7:r.setY(-n);break;case 8:r.set(e/2,-n,0);break;case 9:r.set(e,-n,0);break}return r}getCellTextHeight(t,e){return t.textHeight&&t.textHeight>0?t.textHeight:Math.max(e/2,1)}dxfOutFields(t){var s,o,a,l,h,c,u;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((s=t.database)==null?void 0:s.version)??((o=this.database)==null?void 0:o.version),n=(e==null?void 0:e.value)!=null?e.value>=27:!1;t.writeInt16(280,this.tableDataVersion),t.writeObjectId(342,this.tableStyleId),t.writeObjectId(343,this.owningBlockRecordId),t.writeVector3d(11,this.horizontalDirection),t.writeUInt32(90,this.tableValueFlag),t.writeUInt32(93,this.tableOverrideFlag),t.writeUInt32(94,this.borderColorOverrideFlag),t.writeUInt32(95,this.borderLineweightOverrideFlag),t.writeUInt32(96,this.borderVisibilityOverrideFlag),t.writeInt16(71,this.attachmentPoint),t.writeInt32(91,this.numRows),t.writeInt32(92,this.numColumns);for(let g=0;g<this.numRows;++g)t.writeDouble(141,this.rowHeight(g));for(let g=0;g<this.numColumns;++g)t.writeDouble(142,this.columnWidth(g));const r=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let g=0;g<r;g++){const d=this._cells[g],f=(d==null?void 0:d.cellType)??(d!=null&&d.blockTableRecordId?2:1);if(t.writeInt16(171,f),t.writeInt16(172,(d==null?void 0:d.flagValue)??0),t.writeInt16(173,(d==null?void 0:d.mergedValue)??0),t.writeBoolean(174,d==null?void 0:d.autoFit),t.writeInt16(175,d==null?void 0:d.borderWidth),t.writeInt16(176,d==null?void 0:d.borderHeight),(d==null?void 0:d.overrideFlag)!=null&&(n?t.writeInt32(91,d.overrideFlag):t.writeInt16(177,d.overrideFlag)),t.writeInt16(178,d==null?void 0:d.virtualEdgeFlag),t.writeAngle(145,d==null?void 0:d.rotation),n&&t.writeInt16(92,d==null?void 0:d.extendedCellFlags),f===1)d!=null&&d.fieldObjetId?t.writeObjectId(344,d.fieldObjetId):this.writeCellText(t,(d==null?void 0:d.text)??"",n,d==null?void 0:d.cellValueBlockBegin);else if(f===2){if(t.writeObjectId(340,d==null?void 0:d.blockTableRecordId),t.writeDouble(144,d==null?void 0:d.blockScale),t.writeInt16(179,d==null?void 0:d.blockAttrNum),(a=d==null?void 0:d.attrDefineId)!=null&&a.length)for(const p of d.attrDefineId)t.writeObjectId(331,p);if((d==null?void 0:d.attrText)!=null)if(Array.isArray(d.attrText))for(const p of d.attrText)t.writeString(300,p);else t.writeString(300,d.attrText)}d!=null&&d.textStyle&&t.writeString(7,d.textStyle),(d==null?void 0:d.textHeight)!=null&&t.writeDouble(140,d.textHeight),(d==null?void 0:d.attachmentPoint)!=null&&t.writeInt16(170,d.attachmentPoint),(d==null?void 0:d.topBorderVisibility)!=null&&t.writeInt16(289,d.topBorderVisibility?1:0),(d==null?void 0:d.rightBorderVisibility)!=null&&t.writeInt16(285,d.rightBorderVisibility?1:0),(d==null?void 0:d.bottomBorderVisibility)!=null&&t.writeInt16(286,d.bottomBorderVisibility?1:0),(d==null?void 0:d.leftBorderVisibility)!=null&&t.writeInt16(288,d.leftBorderVisibility?1:0)}if(t.writeInt16(70,this.flowDirection),t.writeDouble(40,this.horizontalCellMargin),t.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&t.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&t.writeInt16(281,this.suppressHeader?1:0),(l=this.cellTypeOverrides)!=null&&l.length)for(const g of this.cellTypeOverrides){t.writeString(7,g.textStyle),t.writeDouble(140,g.textHeight),t.writeInt16(170,g.alignment),t.writeInt16(63,g.backgroundColor),t.writeInt16(64,g.contentColor),g.backgroundColorEnabled!=null&&t.writeInt16(283,g.backgroundColorEnabled?1:0);const d=g.borderLineweights;d&&(t.writeInt16(274,d.top),t.writeInt16(275,d.right),t.writeInt16(276,d.bottom),t.writeInt16(277,d.left),t.writeInt16(278,d.insideHorizontal),t.writeInt16(279,d.insideVertical));const f=g.borderVisibility;f&&(t.writeInt16(284,f.top?1:0),t.writeInt16(285,f.right?1:0),t.writeInt16(286,f.bottom?1:0),t.writeInt16(287,f.left?1:0),t.writeInt16(288,f.insideHorizontal?1:0),t.writeInt16(289,f.insideVertical?1:0))}if(this.tableBorderColors&&(t.writeInt16(63,this.tableBorderColors.left),t.writeInt16(64,this.tableBorderColors.top),t.writeInt16(65,this.tableBorderColors.insideHorizontal),t.writeInt16(66,this.tableBorderColors.bottom),t.writeInt16(68,this.tableBorderColors.insideVertical),t.writeInt16(69,this.tableBorderColors.right)),(h=this.rowDataTypes)!=null&&h.length)for(const g of this.rowDataTypes)t.writeInt16(97,g);if((c=this.rowUnitTypes)!=null&&c.length)for(const g of this.rowUnitTypes)t.writeInt16(98,g);if((u=this.rowFormats)!=null&&u.length)for(const g of this.rowFormats)t.writeString(4,g);return this}writeCellText(t,e,n,r){if(!n){if(e.length<=250){t.writeString(1,e);return}const a=Math.ceil(e.length/250);for(let l=0;l<a;l++){const h=l*250,c=h+250,u=e.slice(h,c);l===a-1?t.writeString(1,u):t.writeString(2,u)}return}if(t.writeString(301,r??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const o=Math.ceil(e.length/250);for(let a=0;a<o;a++){const l=a*250,h=l+250,c=e.slice(l,h);a===o-1?t.writeString(302,c):t.writeString(303,c)}t.writeString(304,"ACVALUE_END")}};ws.typeName="Table";let fr=ws;const be=new C,Po=new O,Me=class Me extends it{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=0,this._vertices=[new y,new y,new y,new y]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get area(){return new V(Me.boundaryPointsFromVertices(this._vertices),!0).area}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new k().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return fn(t,e,this._vertices),this}subGetOsnapPoints(t,e,n,r){const s=[this._vertices[0],this._vertices[1],this._vertices[3],this._vertices[2]];Kr(s,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._elevation=this._vertices[0].z,this}subWorldDraw(t){const e=new V(Me.boundaryPointsFromVertices(this._vertices),!0),n=new kt;n.add(e);const r=t.subEntityTraits;return r.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),this.thickness!==0&&t.writeDouble(39,this.thickness),t.writePoint3d(10,this.getPointAt(0)),t.writePoint3d(11,this.getPointAt(1)),t.writePoint3d(12,this.getPointAt(2)),t.writePoint3d(13,this.getPointAt(3)),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:ft.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return ai(this.collectBoundary2d(),!0,t)}collectBoundary2d(){return Me.boundaryPointsFromVertices(this._vertices)}static boundaryPointsFromVertices(t){const e=t[0],n=t[1],r=t[2],s=t[3];return[new A(e.x,e.y),new A(n.x,n.y),new A(s.x,s.y),new A(r.x,r.y)]}};Me.typeName="Trace";let zn=Me;const vs=class vs extends zn{get dxfTypeName(){return"SOLID"}};vs.typeName="Solid";let pr=vs;class Qt extends Error{constructor(t="Unexpected end of buffer."){super(t),this.name="AcDbProxyGraphicEndOfBufferError"}}function Zl(i){return i instanceof ArrayBuffer?new Uint8Array(i):i}class yt{constructor(t,e=4){this._index=0,this._buffer=Zl(t),this._align=e}get index(){return this._index}get hasData(){return this._index<this._buffer.length}alignIndex(t){const e=t%this._align;return e?t+this._align-e:t}readStruct(t){if(!this.hasData)throw new Qt;const e=[];let n=0;for(const r of t){const s=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index+n,r);if(r===8)e.push(s.getFloat64(0,!0));else if(r===4)e.push(s.getUint32(0,!0));else throw new Error(`Unsupported struct size: ${r}`);n+=r}return this._index=this.alignIndex(this._index+n),e}readFloat(){return this.readStruct([8])[0]}readLong(){return this.readStruct([4])[0]}readSignedLong(){if(!this.hasData)throw new Qt;const e=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index,4).getInt32(0,!0);return this._index=this.alignIndex(this._index+4),e}readVertex(){return this.readStruct([8,8,8])}readPaddedString(t="utf-8"){const e=this._buffer;for(let n=this._index;n<e.length;n++)if(e[n]===0){const r=this._index;this._index=this.alignIndex(n+1);const s=e.subarray(r,n);return new TextDecoder(t).decode(s)}throw new Qt("Did not detect terminating zero byte.")}readPaddedUnicodeString(){const t=this._buffer;for(let e=this._index;e<t.length;e+=2)if(e+1<t.length&&t[e]===0&&t[e+1]===0){const n=this._index;this._index=this.alignIndex(e+2);const r=t.subarray(n,e);return new TextDecoder("utf-16le").decode(r)}throw new Qt("Did not detect terminating zero bytes.")}}class Ql{constructor(t,e="AC1015",n="cp1252"){this._bitIndex=0,this._buffer=Zl(t),this.dxfversion=e,this.encoding=n}get hasData(){return this._bitIndex>>3<this._buffer.length}readBit(){const t=this._bitIndex;this._bitIndex+=1;const e=t>>3;if(e>=this._buffer.length)throw new Qt;return this._buffer[e]&128>>(t&7)?1:0}readBits(t){const e=this._bitIndex,n=e+t;if(n-1>>3>=this._buffer.length)throw new Qt;this._bitIndex=n;let r=128>>(e&7),s=e>>3,o=0,a=this._buffer[s];for(;t>0;)o<<=1,a&r&&(o|=1),t-=1,r>>=1,!r&&t&&(r=128,s+=1,a=this._buffer[s]);return o}readUnsignedByte(){return this.readBits(8)}readSignedByte(){const t=this.readBits(8);return t&128?-((~t&255)+1):t}readAlignedBytes(t){const e=this._bitIndex>>3,n=e+t;if(n>this._buffer.length)throw new Qt;return this._bitIndex+=t<<3,this._buffer.subarray(e,n)}readUnsignedShort(){if(this._bitIndex&7){const e=this.readBits(8);return(this.readBits(8)<<8)+e}const t=this.readAlignedBytes(2);return t[1]<<8|t[0]}readSignedShort(){const t=this.readUnsignedShort();return t&32768?-((~t&65535)+1):t}readUnsignedLong(){if(this._bitIndex&7){const e=this.readBits(8),n=this.readBits(8),r=this.readBits(8);return(this.readBits(8)<<24)+(r<<16)+(n<<8)+e}const t=this.readAlignedBytes(4);return(t[3]<<24)+(t[2]<<16)+(t[1]<<8)+t[0]}readSignedLong(){const t=this.readUnsignedLong();return t&2147483648?-((~t&4294967295)+1):t}readFloat(){if(this._bitIndex&7){const n=new Uint8Array(8);for(let r=0;r<8;r++)n[r]=this.readBits(8);return new DataView(n.buffer).getFloat64(0,!0)}const t=this.readAlignedBytes(8),e=new Uint8Array(t);return new DataView(e.buffer).getFloat64(0,!0)}readRawDouble(t=1){return t===1?this.readFloat():Array.from({length:t},()=>this.readFloat())}readBitShort(t=1){const e=()=>{const n=this.readBits(2);return n===0?this.readSignedShort():n===1?this.readUnsignedByte():n===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitLong(t=1){const e=()=>{const n=this.readBits(2);return n===0?this.readSignedLong():n===1?this.readUnsignedByte():n===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitDouble(t=1){const e=()=>{const n=this.readBits(2);return n===0?this.readFloat():n===1?1:0};return t===1?e():Array.from({length:t},()=>e())}readBitDoubleDefault(t=1,e=0){const n=new Uint8Array(8);new DataView(n.buffer).setFloat64(0,e,!0);const r=()=>{const s=this.readBits(2);if(s===0)return e;if(s===1){const o=new Uint8Array(n);return o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}if(s===2){const o=new Uint8Array(n);return o[4]=this.readUnsignedByte(),o[5]=this.readUnsignedByte(),o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}return this.readFloat()};return t===1?r():Array.from({length:t},()=>r())}}function Jl(i){return Array.from(i,t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}function Vg(i){const t=i.reduce((r,s)=>r+Math.floor(s.length/2),0),e=new Uint8Array(t);let n=0;for(const r of i)for(let s=0;s<r.length;s+=2)e[n++]=parseInt(r.slice(s,s+2),16);return e}const jg=127;var th=(i=>(i[i.Extents=1]="Extents",i[i.Circle=2]="Circle",i[i.Circle3P=3]="Circle3P",i[i.CircularArc=4]="CircularArc",i[i.CircularArc3P=5]="CircularArc3P",i[i.Polyline=6]="Polyline",i[i.Polygon=7]="Polygon",i[i.Mesh=8]="Mesh",i[i.Shell=9]="Shell",i[i.Text=10]="Text",i[i.Text2=11]="Text2",i[i.Xline=12]="Xline",i[i.Ray=13]="Ray",i[i.AttributeColor=14]="AttributeColor",i[i.AttributeLayer=16]="AttributeLayer",i[i.AttributeLinetype=18]="AttributeLinetype",i[i.AttributeMarker=19]="AttributeMarker",i[i.AttributeFill=20]="AttributeFill",i[i.AttributeTrueColor=22]="AttributeTrueColor",i[i.AttributeLineweight=23]="AttributeLineweight",i[i.AttributeLtscale=24]="AttributeLtscale",i[i.AttributeThickness=25]="AttributeThickness",i[i.PushMatrix=29]="PushMatrix",i[i.PopMatrix=31]="PopMatrix",i[i.PolylineWithNormals=32]="PolylineWithNormals",i[i.LwPolyline=33]="LwPolyline",i[i.UnicodeText=36]="UnicodeText",i[i.UnicodeText2=38]="UnicodeText2",i[i.EllipticArc=44]="EllipticArc",i))(th||{});const re=b.Z_AXIS,Dg=529;function Gg(i){const t=i>>24&255;return t===si?{rgb:i&16777215}:t===ri?{colorIndex:256}:t===an?{colorIndex:0}:t===oi?{colorIndex:i&255}:{colorIndex:i&255}}function Li(i){return new b(i.x,i.y,i.z??0)}function Ei(i){return new y(i.x,i.y,i.z??0)}function Ao(i){return{x:i[0],y:i[1],z:i[2]}}class yr{constructor(t,e={}){this._index=8,this._colorIndex=256,this._layer="0",this._linetype=K,this._lineweight=exports.AcGiLineWeight.ByLineWeightDefault,this._ltscale=1,this._thickness=0,this._fill=!1,this._layers=[],this._linetypes=[],this._matrices=[],this._buffer=t,this._database=e.database,this._dxfversion=e.dxfversion??"AC1015",this._encoding=e.encoding??(this._dxfversion<"AC1024"?"windows-1252":"utf-8"),this._layer=e.defaultLayer??"0",this._database&&(this._database.tables.layerTable.newIterator().toArray().forEach(n=>this._layers.push(n.name)),this._database.tables.linetypeTable.newIterator().toArray().forEach(n=>this._linetypes.push(n.name)))}get extents(){return this._extents}scanExtents(){var n;const t=this._buffer;let e=this._index;for(;e<t.length;){const r=new DataView(t.buffer,t.byteOffset+e,8),s=r.getUint32(0,!0),o=r.getUint32(4,!0);if(s<8)break;if(o===1){const a=t.subarray(e+8,e+s);return this.readExtents(a),((n=this._extents)==null?void 0:n.length)===2?[this._extents[0],this._extents[1]]:void 0}e+=s}}worldDraw(t){const e=[],n=t.subEntityTraits,r={color:n.color.clone(),lineType:n.lineType,lineTypeScale:n.lineTypeScale,lineWeight:n.lineWeight,layer:n.layer,thickness:n.thickness},s=this._buffer;let o=this._index;for(;o<s.length;){const a=new DataView(s.buffer,s.byteOffset+o,8),l=a.getUint32(0,!0),h=a.getUint32(4,!0);if(l<8)break;const c=s.subarray(o+8,o+l);this.dispatchChunk(t,e,h,c),h!==20&&(this._fill=!1),o+=l}if(n.color=r.color,n.lineType=r.lineType,n.lineTypeScale=r.lineTypeScale,n.lineWeight=r.lineWeight,n.layer=r.layer,n.thickness=r.thickness,e.length!==0)return t.group(e)}dispatchChunk(t,e,n,r){switch(n){case 1:this.readExtents(r);break;case 2:this.drawCircle(t,e,r);break;case 3:this.drawCircle3P(t,e,r);break;case 4:this.drawCircularArc(t,e,r);break;case 5:this.drawCircularArc3P(t,e,r);break;case 44:this.drawEllipticArc(t,e,r);break;case 6:this.drawPolyline(t,e,r,!1);break;case 32:this.drawPolyline(t,e,r,!0);break;case 7:this.drawPolygon(t,e,r);break;case 33:this.drawLwPolyline(t,e,r);break;case 9:this.drawShell(t,e,r);break;case 10:this.drawText(t,e,r,!1);break;case 36:this.drawText(t,e,r,!0);break;case 11:this.drawText2(t,e,r,!1);break;case 38:this.drawText2(t,e,r,!0);break;case 12:this.drawXline(t,e,r,!1);break;case 13:this.drawXline(t,e,r,!0);break;case 14:this.readAttributeColor(r);break;case 16:this.readAttributeLayer(r);break;case 18:this.readAttributeLinetype(r);break;case 20:this.readAttributeFill(r);break;case 22:this.readAttributeTrueColor(r);break;case 23:this.readAttributeLineweight(r);break;case 24:this.readAttributeLtscale(r);break;case 25:this.readAttributeThickness(r);break;case 29:this.pushMatrix(r);break;case 31:this.popMatrix();break}}applyTraits(t){const e=t.subEntityTraits;e.layer=this._layer,e.lineTypeScale=this._ltscale,e.thickness=this._thickness,e.lineWeight=this._lineweight,this._rgbColor!=null?e.color=new O(exports.AcCmColorMethod.ByColor,this._rgbColor):this._colorIndex===256?e.color=new O(exports.AcCmColorMethod.ByLayer):this._colorIndex===0?e.color=new O(exports.AcCmColorMethod.ByBlock):this._colorIndex===7?e.color=new O(exports.AcCmColorMethod.ByACI,7):e.color=new O(exports.AcCmColorMethod.ByACI,this._colorIndex),e.lineType={name:this._linetype,type:this.resolveLineStyleType(),standardFlag:0,description:"",totalPatternLength:0}}resolveLineStyleType(){return this._linetype===K?"ByLayer":this._linetype===Ct?"ByBlock":"UserSpecified"}transformPoint(t){const e=Array.isArray(t)?Ao(t):t,n=Ei(e);return this._matrices.length>0&&n.applyMatrix4(this._matrices[this._matrices.length-1]),n}transformVector(t){const e=Array.isArray(t)?Ao(t):t,n=Li(e);return this._matrices.length>0&&n.transformDirection(this._matrices[this._matrices.length-1]),!Number.isFinite(n.lengthSq())||n.lengthSq()<1e-24?re.clone():n.normalize()}pushEntity(t,e){e&&t.push(e)}readExtents(t){const e=new yt(t),n=e.readVertex(),r=e.readVertex();this._extents=[new y(n[0],n[1],n[2]),new y(r[0],r[1],r[2])]}readAttributeColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);this._rgbColor=void 0,this._colorIndex=e>256||e<0?256:e}readAttributeLayer(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e<this._layers.length&&(this._layer=this._layers[e])}readAttributeLinetype(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e+2<this._linetypes.length?this._linetype=this._linetypes[e+2]:e===32766?this._linetype=Ct:this._linetype=K}readAttributeFill(t){this._fill=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0)!==0}readAttributeTrueColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0),n=Gg(e);this._rgbColor=n.rgb,n.colorIndex!=null&&(this._colorIndex=n.colorIndex)}readAttributeLineweight(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e>Dg?this._lineweight=e-4294967296:this._lineweight=e}readAttributeLtscale(t){this._ltscale=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}readAttributeThickness(t){this._thickness=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}pushMatrix(t){const e=new Float64Array(t.buffer,t.byteOffset,16),n=new C().fromArray(Array.from(e));n.transpose(),this._matrices.push(n)}popMatrix(){this._matrices.length>0&&this._matrices.pop()}loadVertices(t,e){const n=new yt(t);let r=n.readLong();e&&(r+=1);const s=[];for(;r>0;){const[a,l,h]=n.readVertex();s.push(this.transformPoint({x:a,y:l,z:h})),r-=1}let o=re;return e&&s.length>0&&(o=Li(s.pop())),{vertices:s,normal:o}}drawCircle(t,e,n){const r=new yt(n),s=r.readVertex(),o=r.readFloat(),a=this.transformVector(r.readVertex());let l=Ei({x:s[0],y:s[1],z:s[2]});a.equals(re)||(l=Oe(l,a)),l=this.transformPoint(l);const h=en(a),c=new It(Ni(l,a),o,0,R,a,h);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircle3P(t,e,n){const r=new yt(n),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),l=It.computeCenterPoint(s,o,a);if(!l)return;const h=l.distanceTo(s),c=new It(l,h,0,R,re);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircularArc(t,e,n){const r=new yt(n),s=r.readVertex(),o=r.readFloat(),a=r.readVertex(),l=r.readVertex(),h=r.readFloat(),c=this.transformVector(a),u=Ei({x:s[0],y:s[1],z:s[2]}),g=Li({x:l[0],y:l[1],z:l[2]});this._matrices.length>0&&g.transformDirection(this._matrices[this._matrices.length-1]);const d=Number.isFinite(g.lengthSq())&&g.lengthSq()>=1e-24?g.normalize():en(c),f=0,p=h,m=new It(this.transformPoint(u),o,f,p,c,d);this.applyTraits(t),this.pushEntity(e,t.circularArc(m))}drawCircularArc3P(t,e,n){const r=new yt(n),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),l=It.computeCenterPoint(s,a,o);if(!l)return;const h=l.distanceTo(s),c=Bt(l,s,re),u=Bt(l,a,re),g=new It(l,h,c,u,re);this.applyTraits(t),this.pushEntity(e,t.circularArc(g))}drawEllipticArc(t,e,n){const r=new yt(n),s=this.transformPoint(r.readVertex()),o=this.transformVector(r.readVertex()),a=r.readFloat(),l=r.readFloat(),h=r.readFloat(),c=r.readFloat(),u=r.readFloat(),g=Ni({x:Math.cos(u)*a,y:Math.sin(u)*a,z:0},o),d=new Hr(s,o,g,a,l,h,c);this.applyTraits(t),this.pushEntity(e,t.ellipticalArc(d))}drawPolyline(t,e,n,r){var o,a;const{vertices:s}=this.loadVertices(n,r);if(s.length!==0){if(s.length===1){this.applyTraits(t);const l=((o=this._database)==null?void 0:o.pdmode)??0,h=((a=this._database)==null?void 0:a.pdsize)??0;this.pushEntity(e,t.point(s[0],{displayMode:l,displaySize:h}));return}this.applyTraits(t),this.pushEntity(e,t.lines(s))}}drawPolygon(t,e,n){const{vertices:r}=this.loadVertices(n,!1);if(r.length<2)return;if(this._fill){const o=new V(r.map(h=>({x:h.x,y:h.y})),!0),a=new kt;a.add(o);const l=t.subEntityTraits;l.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},l.drawOrder=-1,this.applyTraits(t),this.pushEntity(e,t.area(a));return}const s=[...r,r[0]];this.applyTraits(t),this.pushEntity(e,t.lines(s))}drawLwPolyline(t,e,n){const r=new Ql(n,this._dxfversion,this._encoding);let s=0,o=!1;r.readUnsignedLong();const a=r.readBitShort();a&8&&(s=r.readBitDouble()),a&512&&(o=!0);const l=r.readBitLong();if(l<=0)return;const h=a&16?r.readBitLong():0;this._dxfversion>="AC1024"&&(a&1024&&r.readBitLong(),a&32&&r.readBitLong());const c=r.readRawDouble(2),u=[this.transformPoint({x:c[0],y:c[1],z:s})];let g=c;for(let d=1;d<l;d++){const f=r.readBitDoubleDefault(1,g[0]),p=r.readBitDoubleDefault(1,g[1]);g=[f,p],u.push(this.transformPoint({x:f,y:p,z:s}))}for(let d=0;d<h;d++)r.readBitDouble();o&&u.length>1&&u.push(u[0].clone()),this.applyTraits(t),this.pushEntity(e,t.lines(u))}drawShell(t,e,n){const r=new yt(n),s=r.readLong(),o=[];for(let c=0;c<s;c++){const[u,g,d]=r.readVertex();o.push(this.transformPoint({x:u,y:g,z:d}))}const a=r.readLong(),l=[];let h=0;for(;h<a;){const c=Math.abs(r.readSignedLong());h+=1+c;const u=[];for(let d=0;d<c;d++)u.push(r.readLong());const g=u.map(d=>o[d]).filter(Boolean);if(g.length>=3)for(let d=0;d<g.length;d++)l.push(g[d]),l.push(g[(d+1)%g.length])}l.length!==0&&(this.applyTraits(t),this.pushEntity(e,t.lines(l)))}drawText(t,e,n,r){const s=new yt(n),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),l=this.transformVector(s.readVertex()),[h,c,u]=s.readStruct([8,8,8]),g=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:l,text:g,height:h,widthFactor:c,obliqueAngle:u})}drawText2(t,e,n,r){const s=new yt(n),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),l=this.transformVector(s.readVertex()),h=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);s.readSignedLong(),s.readSignedLong();const[c,u,g]=s.readStruct([8,8,8]);s.readFloat(),this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:l,text:h,height:c,widthFactor:u,obliqueAngle:g})}drawTextPrimitive(t,e,n){const r=Math.atan2(n.textDirection.y,n.textDirection.x),s={text:n.text,height:n.height,width:1/0,widthFactor:n.widthFactor,position:n.insert,rotation:r*180/Math.PI,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft},o={name:q,standardFlag:0,fixedTextHeight:0,widthFactor:n.widthFactor,obliqueAngle:n.obliqueAngle*180/Math.PI,textGenerationFlag:0,lastHeight:n.height,font:"txt",bigFont:""};this.applyTraits(t),this.pushEntity(e,t.mtext(s,o))}drawXline(t,e,n,r){const s=new yt(n),o=this.transformPoint(s.readVertex()),a=this.transformPoint(s.readVertex()),l=new b().subVectors(a,o);if(l.lengthSq()===0)return;const h=1e6,c=r?o.clone().add(l.normalize().multiplyScalar(h)):o.clone().sub(l.normalize().multiplyScalar(h)),u=a.clone().add(l.normalize().multiplyScalar(h));this.applyTraits(t),this.pushEntity(e,t.lines([c,u]))}}function eh(i,t){if(!(t!=null&&t.length))return;const e=new Uint8Array(t.reduce((r,s)=>r+Math.floor(s.length/2),0));let n=0;for(const r of t)for(let s=0;s<r.length;s+=2)e[n++]=parseInt(r.slice(s,s+2),16);return i!=null&&i>0&&e.length>=i?e.subarray(0,i):e}const Ps=class Ps extends z{constructor(){super(...arguments),this._originalDxfName="",this._originalClassName="",this._applicationName="",this._proxyEntityClassId=498,this._applicationEntityClassId=0,this._objectDrawingFormat=0,this._originalDataFormat=0,this._entityOrigins=[],this._worldTransform=new C}get dxfTypeName(){return"ACAD_PROXY_ENTITY"}get originalDxfName(){return this._originalDxfName}set originalDxfName(t){this._originalDxfName=t}get originalClassName(){return this._originalClassName}set originalClassName(t){this._originalClassName=t}get applicationName(){return this._applicationName}set applicationName(t){this._applicationName=t}get proxyEntityClassId(){return this._proxyEntityClassId}set proxyEntityClassId(t){this._proxyEntityClassId=t}get applicationEntityClassId(){return this._applicationEntityClassId}set applicationEntityClassId(t){this._applicationEntityClassId=t}get objectDrawingFormat(){return this._objectDrawingFormat}set objectDrawingFormat(t){this._objectDrawingFormat=t}get graphicsMetafileType(){return this._objectDrawingFormat}set graphicsMetafileType(t){this._objectDrawingFormat=t}get originalDataFormat(){return this._originalDataFormat}set originalDataFormat(t){this._originalDataFormat=t}get proxyGraphic(){return this._proxyGraphic}setProxyGraphic(t){this._proxyGraphic=t?new Uint8Array(t):void 0}get entityOrigins(){return this._entityOrigins}setEntityOrigins(t){this._entityOrigins=t.map(e=>new y(e.x,e.y,e.z))}get geometricExtents(){const t=this._proxyGraphic;if(!(t!=null&&t.length))return new k;const n=new yr(t,{database:this.database,defaultLayer:this.layer}).scanExtents();if(n){const r=new k().setFromPoints(n);return this._worldTransform.equals(new C)||r.applyMatrix4(this._worldTransform),r}return new k}subGetGripPoints(){if(this._entityOrigins.length>0)return[...this._entityOrigins];const t=this.geometricExtents;return t.isEmpty()?[]:[new y(t.min.x,t.min.y,t.min.z),new y(t.max.x,t.max.y,t.max.z)]}subMoveGripPointsAt(t,e){return this._entityOrigins.length>0?(fn(t,e,this._entityOrigins),this):this.geometricExtents.isEmpty()?this:(Z(t,r=>{r===0&&this.transformBy(C.makeTranslation(e))}),this)}transformBy(t){return this._entityOrigins.forEach(e=>e.applyMatrix4(t)),this._worldTransform.premultiply(t),this}subWorldDraw(t){const e=this._proxyGraphic;if(!(e!=null&&e.length))return;const r=new yr(e,{database:this.database,defaultLayer:this.layer}).worldDraw(t);return r&&!this._worldTransform.equals(new C)&&r.applyMatrix(this._worldTransform),r}dxfOutFields(t){var e;if(super.dxfOutFields(t),t.writeSubclassMarker("AcDbProxyEntity"),this._originalDxfName&&t.writeString(1,this._originalDxfName),this._originalClassName&&t.writeString(3,this._originalClassName),t.writeInt32(90,this._proxyEntityClassId||498),this._applicationEntityClassId&&t.writeInt32(91,this._applicationEntityClassId),this._objectDrawingFormat&&t.writeInt32(95,this._objectDrawingFormat),t.writeInt16(70,this._originalDataFormat),(e=this._proxyGraphic)!=null&&e.length){t.writeInt32(160,this._proxyGraphic.length);let n=0;for(;n<this._proxyGraphic.length;){const r=this._proxyGraphic.subarray(n,n+127);t.writeString(310,Jl(r)),n+=127}}return this}loadProxyGraphicFromDxf(t,e){const n=eh(t,e);n&&this.setProxyGraphic(n)}};Ps.typeName="ProxyEntity";let mr=Ps;const As=class As extends z{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new y}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new k().expandByPoint(this._geo)}subGetGripPoints(){return[this._geo]}subMoveGripPointsAt(t,e){return Ot(t,e,this._geo),this}subGetOsnapPoints(t,e,n,r){t===x.Node&&r.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbPoint"),t.writePoint3d(10,this.position),this}};As.typeName="Point";let _r=As;var nh=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(nh||{}),ih=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(ih||{});const Ss=class Ss extends z{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new y,this._scale=new H(1,1),this._rotation=0,this._imageSize=new A,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get imageSize(){return this._imageSize}set imageSize(t){this._imageSize.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new k;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subMoveGripPointsAt(t,e){return Z(t,n=>{this.isClipped&&this._clipBoundary.length>3?this.moveClippedBoundaryGripAt(n,e):this.moveUnclippedGripAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){if(t===x.Insertion){r.push(this._position);return}const s=this.boundaryPath();if(s.length===0)return;let o=s;if(s.length>1){const a=s[0],l=s[s.length-1];a.x===l.x&&a.y===l.y&&(a.z||0)===(l.z||0)&&(o=s.slice(0,-1))}if(t===x.EndPoint){r.push(...o);return}Kr(o,!0,t,e,r)}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}transformBy(t){const e=this._width*this._scale.x,n=this._height*this._scale.y,r=new b(e*Math.cos(this._rotation),e*Math.sin(this._rotation),0),s=new b(-n*Math.sin(this._rotation),n*Math.cos(this._rotation),0),o=this._position.clone(),a=this._position.clone().add(r),l=this._position.clone().add(s);o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b(a).sub(o),c=new b(l).sub(o);return this._position.copy(o),this._rotation=Math.atan2(h.y,h.x),this._width=h.length(),this._height=c.length(),this._scale.set(1,1),this}moveUnclippedGripAt(t,e){const n=this._position.x,r=this._position.y,s=this._width,o=this._height;switch(t){case 0:this._position.add(e);break;case 1:{const a=n,l=r+o,h=n+s+e.x,c=r+e.y;this._position.x=a,this._position.y=c,this._width=h-a,this._height=l-c;break}case 2:{const a=n+s+e.x,l=r+o+e.y;this._width=a-n,this._height=l-r;break}case 3:{const a=n+s,l=r,h=n+e.x,c=r+o+e.y;this._position.x=h,this._position.y=l,this._width=a-h,this._height=c-l;break}}}moveClippedBoundaryGripAt(t,e){if(t<0||t>=this._clipBoundary.length)return;const n=this._width,r=this._height,s=new nt;s.setFromPoints(this._clipBoundary);const o=new A;o.setX(this._position.x-s.min.x*n),o.setY(this._position.y-s.min.y*r);const a=this._clipBoundary[t],l=a.x*n+o.x+e.x,h=a.y*r+o.y+e.y;a.x=(l-o.x)/n,a.y=(h-o.y)/r}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,n=this._height,r=new nt;r.setFromPoints(this._clipBoundary);const s=new A;s.setX(this._position.x-r.min.x*e),s.setY(this._position.y-r.min.y*n),this._clipBoundary.forEach(o=>{const a=o.x*e+s.x,l=o.y*n+s.y;t.push(new y(a,l,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){So.copy(t[1]);for(let e=1;e<4;e++)En.copy(t[e]),En.rotateAround(So,this._rotation),t[e].setX(En.x),t[e].setY(En.y)}t.push(t[0])}return t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImage"),t.writePoint3d(10,this.position);const e=this.width*this.scale.x,n=this.height*this.scale.y,r=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:n},s=r.x>0?e/r.x:e,o=r.y>0?n/r.y:n,a=Math.cos(this._rotation),l=Math.sin(this._rotation);t.writePoint3d(11,{x:s*a,y:s*l,z:0}),t.writePoint3d(12,{x:-o*l,y:o*a,z:0}),t.writePoint2d(13,r),t.writeObjectId(340,this.imageDefId);const h=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,h),t.writeInt16(280,this.isClipped?1:0),t.writeInt16(281,this.brightness),t.writeInt16(282,this.contrast),t.writeInt16(283,this.fade),t.writeInt16(71,this.clipBoundaryType),this.isClipped){t.writeInt16(91,this.clipBoundary.length);for(const c of this.clipBoundary)t.writePoint2d(14,c)}return this}};Ss.typeName="RasterImage";let Vn=Ss;const So=new A,En=new A,Qn=class Qn extends it{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new y,this._unitDir=new b}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new k;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return Ot(t,e,this.basePoint),this}subGetOsnapPoints(t,e,n,r){const s=this.basePoint;if(t===x.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ft(s,s.clone().add(o));switch(t){case x.Nearest:{const l=a.project(e),c=new b(l).sub(s).dot(o);r.push(c<0?s:l);break}case x.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRay"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,n=this.unitDir,r=Math.hypot(n.x,n.y);return r<=1e-9||(n.x*(t.y-e.y)-n.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=_a(this.basePoint,this.unitDir,t);if(!e)return null;const n=new Qn;return n.basePoint=e,n.unitDir=this.unitDir.clone(),n}};Qn.typeName="Ray";let br=Qn;const Ls=class Ls extends z{get dxfTypeName(){return"SHAPE"}constructor(){super(),this._position=new y,this._size=1,this._name="",this._rotation=0,this._widthFactor=1,this._oblique=0,this._thickness=0,this._normal=new b(0,0,1),this._shapeNumber=0,this._styleName=""}get position(){return this._position}set position(t){this._position.copy(t)}get size(){return this._size}set size(t){this._size=t}get name(){return this._name}set name(t){this._name=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get shapeNumber(){return this._shapeNumber}set shapeNumber(t){this._shapeNumber=t}get styleId(){var e,n,r;const t=(r=(n=(e=this.database)==null?void 0:e.tables)==null?void 0:n.textStyleTable)==null?void 0:r.resolveAt(this._styleName);return(t==null?void 0:t.objectId)??""}set styleId(t){var n,r,s;const e=(s=(r=(n=this.database)==null?void 0:n.tables)==null?void 0:r.textStyleTable)==null?void 0:s.getIdAt(t);e&&(this._styleName=e.name)}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get isPlanar(){return!0}get geometricExtents(){const t=Math.abs(this._size)/2,e=new k;return e.expandByPoint(this._position),t>0&&(e.expandByPoint(new y(this._position.x-t,this._position.y-t,this._position.z)),e.expandByPoint(new y(this._position.x+t,this._position.y+t,this._position.z))),e}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return Ot(t,e,this._position),this}subGetOsnapPoints(t,e,n,r){t===x.Insertion&&r.push(this._position)}transformBy(t){const e=new C().setFromExtrusionDirection(this._normal),n=new C().makeRotationZ(this._rotation),r=new C().multiplyMatrices(e,n),s=this._position.clone(),o=new y(this._widthFactor,0,0).applyMatrix4(r).add(s),a=new y(0,1,0).applyMatrix4(r).add(s),l=new y(0,0,1).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b(o).sub(s),c=new b(a).sub(s),u=new b(l).sub(s);let g=new b().crossVectors(h,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const f=new C().setFromExtrusionDirection(g).clone().invert(),p=h.clone().applyMatrix4(f),m=c.length(),_=h.length();this._position.copy(s),this._normal.copy(g),_>0&&(this._rotation=Math.atan2(p.y,p.x)),m>0&&(this._size*=m,_>0&&(this._widthFactor*=_/m));const v=u.length();return v>0&&(this._thickness*=v),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"shape",properties:[{name:"name",type:"string",editable:!0,accessor:{get:()=>this.name,set:t=>{this.name=t}}},{name:"size",type:"float",editable:!0,accessor:{get:()=>this.size,set:t=>{this.size=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}},{name:"shapeNumber",type:"int",editable:!0,accessor:{get:()=>this.shapeNumber,set:t=>{this.shapeNumber=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t,e){const n=this.getTextStyle(),r=n?{...n,widthFactor:this.widthFactor,obliqueAngle:this.oblique*180/Math.PI}:void 0,s={...this.renderGlyphIdentity(),size:this.size,position:this._position,rotation:this._rotation,directionVector:this._normal,widthFactor:this.widthFactor};return t.shape(s,r,e)}renderGlyphIdentity(){const t=this._name.trim(),e=Number(t);return t!==""&&Number.isInteger(e)&&e!==0&&String(e)===t?{shapeNumber:e}:{name:t||void 0,shapeNumber:this._shapeNumber!==0?this._shapeNumber:void 0}}getTextStyle(){const t=this.styleName.trim();if(!t)return;const e=this.database.tables.textStyleTable.resolveAt(t);return e==null?void 0:e.textStyle}get dxfShapeIdentity(){const t=this._name.trim();return t||(this._shapeNumber!==0?String(this._shapeNumber):"")}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbShape"),t.writePoint3d(10,this.position),t.writeDouble(40,this.size);const e=this.dxfShapeIdentity;return e&&t.writeString(2,e),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeDouble(39,this.thickness),this._styleName&&t.writeString(3,this._styleName),t.writeVector3d(210,this.normal),this}};Ls.typeName="Shape";let xr=Ls;const Es=class Es extends z{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new y,this._height=0,this._width=0,this._viewCenter=new y,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){const t=this._width/2,e=this._height/2,n=new k;return n.expandByPoint(new y(this._centerPoint.x-t,this._centerPoint.y-e,this._centerPoint.z)),n.expandByPoint(new y(this._centerPoint.x+t,this._centerPoint.y+e,this._centerPoint.z)),n}subGetGripPoints(){const t=new Array,e=this._width/2,n=this._height/2,r=this._centerPoint.z;return t.push(this._centerPoint),(e>0||n>0)&&t.push(new y(this._centerPoint.x-e,this._centerPoint.y-n,r),new y(this._centerPoint.x+e,this._centerPoint.y-n,r),new y(this._centerPoint.x+e,this._centerPoint.y+n,r),new y(this._centerPoint.x-e,this._centerPoint.y+n,r)),t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}transformBy(t){const e=this._centerPoint.clone(),n=this._centerPoint.clone().add(new b(this._width,0,0)),r=this._centerPoint.clone().add(new b(0,this._height,0));e.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t);const s=new b(n).sub(e),o=new b(r).sub(e),a=this._height!==0?o.length()/this._height:1;return this._centerPoint.copy(e),this._width=s.length(),this._height=o.length(),this._viewHeight*=a,this}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Aa;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const n=[];return n.push(e.lines([new y(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new y(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),n.push(e.lines([new y(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new y(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),n.push(e.lines([new y(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new y(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),n.push(e.lines([new y(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new y(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),n}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewport"),t.writePoint3d(10,this.centerPoint),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writePoint3d(12,this.viewCenter),t.writeDouble(45,this.viewHeight),t.writeInt32(69,this.number),this}moveGripAt(t,e){switch(t){case 0:this._centerPoint.add(e);break;case 1:case 2:case 3:case 4:{const n=this.width/2,r=this.height/2,s=this._centerPoint.x,o=this._centerPoint.y,a={1:{x:s-n,y:o-r},2:{x:s+n,y:o-r},3:{x:s+n,y:o+r},4:{x:s-n,y:o+r}},l=t===1?3:t===2?4:t===3?1:2,h=a[t],c=a[l];h.x+=e.x,h.y+=e.y,this._centerPoint.x=(h.x+c.x)/2,this._centerPoint.y=(h.y+c.y)/2,this._centerPoint.z=(this._centerPoint.z??0)+(e.z??0),this.width=Math.abs(c.x-h.x),this.height=Math.abs(c.y-h.y);break}}}};Es.typeName="Viewport";let wr=Es;const Is=class Is extends Vn{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),n=new kt;return n.add(new V(e)),t.area(n)}dxfOutFields(t){return super.dxfOutFields(t),this}};Is.typeName="Wipeout";let vr=Is;const Jn=class Jn extends it{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new y,this._unitDir=new b}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new k;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return Ot(t,e,this.basePoint),this}subGetOsnapPoints(t,e,n,r){const s=this.basePoint;if(t===x.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ft(s,s.clone().add(o));switch(t){case x.Nearest:r.push(a.project(e));break;case x.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXline"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,n=this.unitDir,r=Math.hypot(n.x,n.y);return r<=1e-9||(n.x*(t.y-e.y)-n.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=_a(this.basePoint,this.unitDir,t);if(!e)return null;const n=new Jn;return n.basePoint=e,n.unitDir=this.unitDir.clone(),n}};Jn.typeName="Xline";let Pr=Jn;class rh{constructor(t){this.position=new y(t.x,t.y,t.z||0)}}const Ms=class Ms extends it{get dxfTypeName(){return"POLYLINE"}constructor(t,e,n,r=!1,s=!1){super(),this._mCount=t,this._nCount=e,this._closedM=r,this._closedN=s,this._vertices=n.map(o=>new rh(o))}get mCount(){return this._mCount}get nCount(){return this._nCount}get closedM(){return this._closedM}get closedN(){return this._closedN}get closed(){return this._closedM}get area(){return 0}set closed(t){this._closedM=t}get numberOfVertices(){return this._vertices.length}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getVertexAtMN(t,e){const n=t*this._nCount+e;return this.getVertexAt(n)}get geometricExtents(){if(this._vertices.length===0)return new k(new y(0,0,0),new y(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,n=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),n=Math.min(n,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new k(new y(t,e,n),new y(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return Z(t,n=>{const r=this._vertices[n];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,n,r){switch(t){case x.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"mCount",type:"float",editable:!1,accessor:{get:()=>this._mCount}},{name:"nCount",type:"float",editable:!1,accessor:{get:()=>this._nCount}},{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:t=>{this._closedM=t}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:t=>{this._closedN=t}}}]}]}}subWorldDraw(t){const e=[];for(let n=0;n<this._mCount;n++)for(let r=0;r<this._nCount;r++){const s=this.getVertexAtMN(n,r);let o=r+1;if(o>=this._nCount)if(this._closedN)o=0;else continue;const a=this.getVertexAtMN(n,o);e.push(s.position),e.push(a.position)}for(let n=0;n<this._nCount;n++)for(let r=0;r<this._mCount;r++){const s=this.getVertexAtMN(r,n);let o=r+1;if(o>=this._mCount)if(this._closedM)o=0;else continue;const a=this.getVertexAtMN(o,n);e.push(s.position),e.push(a.position)}return t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolygonMesh");let e=16;return this._closedM&&(e|=1),this._closedN&&(e|=32),t.writeInt16(66,1),t.writeInt16(70,e),t.writeInt32(71,this._mCount),t.writeInt32(72,this._nCount),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;n++){const r=this.getVertexAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolygonMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,16)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:ft.from2dPoints(e,this.isBoundaryClosed()).getOffsetSideAtPoint(t)}createOffsetCurve(t){return ai(this.collectBoundary2d(),this.isBoundaryClosed(),t)}isBoundaryClosed(){return this._closedM&&this._closedN&&this._mCount>1&&this._nCount>1}collectBoundary2d(){const t=this._mCount,e=this._nCount;if(t<1||e<1)return[];const n=[],r=(s,o)=>{const a=this.getVertexAtMN(s,o).position;n.push(new A(a.x,a.y))};if(t===1){for(let s=0;s<e;s++)r(0,s);return n}if(e===1){for(let s=0;s<t;s++)r(s,0);return n}for(let s=0;s<e;s++)r(0,s);for(let s=1;s<t;s++)r(s,e-1);for(let s=e-2;s>=0;s--)r(t-1,s);for(let s=t-2;s>=1;s--)r(s,0);return n}};Ms.typeName="PolygonMesh";let Ar=Ms;class sh{constructor(t){this.position=new y(t.x,t.y,t.z||0)}}class oh{constructor(t){this.vertexIndices=t}}const Ts=class Ts extends it{get dxfTypeName(){return"POLYLINE"}constructor(t,e){super(),this._vertices=t.map(n=>new sh(n)),this._faces=e.map(n=>new oh(n))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}get area(){return 0}set closed(t){}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getFaceAt(t){if(t<0||t>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[t]}get geometricExtents(){if(this._vertices.length===0)return new k(new y(0,0,0),new y(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,n=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),n=Math.min(n,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new k(new y(t,e,n),new y(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return Z(t,n=>{const r=this._vertices[n];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,n,r){switch(t){case x.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}},{name:"faces",type:"array",editable:!1,itemSchema:{properties:[{name:"vertexIndices",type:"array",editable:!1,itemSchema:{properties:[{name:"index",type:"int",editable:!1}]}}]},accessor:{get:()=>this._faces.map(t=>({vertexIndices:t.vertexIndices}))}}]}]}}subWorldDraw(t){const e=[];return this._faces.forEach(n=>{const r=[];if(n.vertexIndices.forEach(s=>{const o=Math.abs(s)-1;o>=0&&o<this._vertices.length&&r.push(this._vertices[o].position)}),r.length>=3)for(let s=0;s<r.length;s++){const o=r[s],a=r[(s+1)%r.length];e.push(o),e.push(a)}}),t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyFaceMesh");const e=64;return t.writeInt16(66,1),t.writeInt16(70,e),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;n++){const r=this.getVertexAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,64)}for(let n=0;n<this.numberOfFaces;n++){const r=this.getFaceAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writeInt16(70,128),r.vertexIndices.forEach((s,o)=>{t.writeInt32(10+o,s)})}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectLargestFaceBoundary2d();return e.length<2?1:ft.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return ai(this.collectLargestFaceBoundary2d(),!0,t)}collectLargestFaceBoundary2d(){let t=[];for(const e of this._faces){const n=e.vertexIndices.filter(r=>r>=0);n.length>t.length&&(t=n)}return t.length<2?this._vertices.map(e=>new A(e.position.x,e.position.y)):t.map(e=>{const n=this.getVertexAt(e).position;return new A(n.x,n.y)})}};Ts.typeName="PolyFaceMesh";let Sr=Ts;var ah=(i=>(i[i.UTF8=0]="UTF8",i[i.US_ASCII=1]="US_ASCII",i[i.ISO_8859_1=2]="ISO_8859_1",i[i.ISO_8859_2=3]="ISO_8859_2",i[i.ISO_8859_3=4]="ISO_8859_3",i[i.ISO_8859_4=5]="ISO_8859_4",i[i.ISO_8859_5=6]="ISO_8859_5",i[i.ISO_8859_6=7]="ISO_8859_6",i[i.ISO_8859_7=8]="ISO_8859_7",i[i.ISO_8859_8=9]="ISO_8859_8",i[i.ISO_8859_9=10]="ISO_8859_9",i[i.CP437=11]="CP437",i[i.CP850=12]="CP850",i[i.CP852=13]="CP852",i[i.CP855=14]="CP855",i[i.CP857=15]="CP857",i[i.CP860=16]="CP860",i[i.CP861=17]="CP861",i[i.CP863=18]="CP863",i[i.CP864=19]="CP864",i[i.CP865=20]="CP865",i[i.CP869=21]="CP869",i[i.CP932=22]="CP932",i[i.MACINTOSH=23]="MACINTOSH",i[i.BIG5=24]="BIG5",i[i.CP949=25]="CP949",i[i.JOHAB=26]="JOHAB",i[i.CP866=27]="CP866",i[i.ANSI_1250=28]="ANSI_1250",i[i.ANSI_1251=29]="ANSI_1251",i[i.ANSI_1252=30]="ANSI_1252",i[i.GB2312=31]="GB2312",i[i.ANSI_1253=32]="ANSI_1253",i[i.ANSI_1254=33]="ANSI_1254",i[i.ANSI_1255=34]="ANSI_1255",i[i.ANSI_1256=35]="ANSI_1256",i[i.ANSI_1257=36]="ANSI_1257",i[i.ANSI_874=37]="ANSI_874",i[i.ANSI_932=38]="ANSI_932",i[i.ANSI_936=39]="ANSI_936",i[i.ANSI_949=40]="ANSI_949",i[i.ANSI_950=41]="ANSI_950",i[i.ANSI_1361=42]="ANSI_1361",i[i.UTF16=43]="UTF16",i[i.ANSI_1258=44]="ANSI_1258",i[i.UNDEFINED=255]="UNDEFINED",i))(ah||{});const Hg=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],Wg=i=>Hg[i];var lh=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(lh||{});const xe=48,Lo=8,Ug=48,hh=80,ch=32,Ii=80,Mi=24,Lr=40,$g=8,qg=4,Eo=64,Kg=64,Zg=new Set(["_version","_angbase","_angdir","_aunits","_auprec","_lunits","_luprec","_celtscale","_cecolor","_celtype","_celweight","_cetransparency","_clayer","_cmlstyle","_cmlscale","_cmleaderstyle","_hpbackgroundcolor","_hpcolor","_hplayer","_hptransparency","_textstyle","_extents","_insunits","_unitmode","_measurement","_ltscale","_lwdisplay","_pdmode","_pdsize","_osmode","_orthomode","_maxHandle","_drawNoPlotLayers","_dwgname","_currentSpace","_formatter","_eventBatchDepth","_pendingEntityAppended","_pendingEntityErased","_pendingDictObjectSet","_pendingDictObjectErased","_lastOpenError"]),uh=new Set(["constructor","prototype","__proto__","caller","callee","arguments"]);function St(i,t){let e=i.get(t);return e||(e={bytes:0,count:0},i.set(t,e)),e}function mt(i,t,e,n=0){if(e<=0&&n===0)return;const r=St(i.byCategory,t);r.bytes+=e,r.count+=n}function Qg(i){const t=Object.getPrototypeOf(i);return t===Object.prototype||t===null}function Jg(i){return ArrayBuffer.isView(i)}function tf(i){return typeof i.addEventListener=="function"&&typeof i.dispatch=="function"&&"listeners"in i}function ef(i,t,e){return uh.has(t)?!0:!i.includeEventManagers&&(t==="events"||e==="events")?t==="events":!i.includeTransactionManager&&(t==="transactionManager"||e==="transaction")?t==="transactionManager":!1}function Io(i,t,e){return t==="_xDataMap"||i==="xdata"?"xdata":t==="_tables"||i==="tables"?e instanceof z?"entities":"tables":t==="_entities"||i==="entities"?"entities":t==="_objects"||i==="objects"?"objects":t==="_handleRegistry"||i==="handleRegistry"?"handleRegistry":t==="transactionManager"||i==="transaction"?"transaction":t==="events"||i==="events"?"events":i==="sysvars"||Zg.has(t)?"sysvars":e instanceof z?"entities":i==="other"?"other":i}function nf(i){const t=new Set;let e=i;for(;e&&e!==Object.prototype;){for(const n of Object.getOwnPropertyNames(e)){if(uh.has(n))continue;const r=Object.getOwnPropertyDescriptor(e,n);r&&typeof r.value=="function"||r&&(r.get||r.set)&&r.value===void 0||t.add(n)}if(e=Object.getPrototypeOf(e),e===Object.prototype||e===null||e===Array.prototype||e===Map.prototype||e===Set.prototype)break}return[...t]}function dh(i){if(i==null)return 0;switch(typeof i){case"number":return $g;case"boolean":return qg;case"string":return Lr+i.length*2;case"bigint":return 16;case"symbol":return Lr+String(i.description??"").length*2;default:return 0}}function rf(i,t){if(i.visited.has(t))return 0;i.visited.add(t),i.objectCount+=1;let e=hh+t.size*ch;for(const n of t.keys())e+=dh(n);return mt(i,"handleRegistry",e,1),e}function ve(i,t,e,n){if(t==null)return 0;const r=typeof t;if(r==="function")return 0;if(r!=="object"){const c=dh(t);if(mt(i,e,c),n){const u=St(i.byEntityType,n);u.bytes+=c}return c}const s=t;if(typeof s.nodeType=="number"||i.visited.has(s))return 0;if(i.visited.add(s),i.objectCount+=1,!i.includeEventManagers&&tf(s))return mt(i,e,xe,1),xe;let o=n,a=e;if(s instanceof z){a="entities",o=s.type,i.entityCount+=1;const c=St(i.byEntityType,o);c.count+=1}if(typeof s.then=="function")return mt(i,a,xe,1),xe;if(s instanceof ArrayBuffer){const c=Eo+s.byteLength;return mt(i,a,c,1),o&&(St(i.byEntityType,o).bytes+=c),c}if(Jg(s)){const c=Eo+s.byteLength;return s.buffer&&!i.visited.has(s.buffer)&&i.visited.add(s.buffer),mt(i,a,c,1),o&&(St(i.byEntityType,o).bytes+=c),c}if(typeof Blob<"u"&&s instanceof Blob){const c=Kg+s.size;return mt(i,a,c,1),o&&(St(i.byEntityType,o).bytes+=c),c}if(s instanceof Date){const c=xe+8;return mt(i,a,c,1),c}if(s instanceof Map){const c=a==="handleRegistry",u=hh+s.size*ch;let g=u;mt(i,a,u,1),o&&(St(i.byEntityType,o).bytes+=u);for(const[d,f]of s)g+=ve(i,d,a,o),c||(g+=ve(i,f,a,o));return g}if(s instanceof Set){let c=Ii+s.size*Mi;for(const u of s)c+=ve(i,u,a,o);return mt(i,a,Ii+s.size*Mi,1),o&&(St(i.byEntityType,o).bytes+=Ii+s.size*Mi),c}if(Array.isArray(s)){let c=Ug+s.length*Lo;mt(i,a,c,1),o&&(St(i.byEntityType,o).bytes+=c);for(let u=0;u<s.length;u++){const g=s[u],d=Io(a,String(u),g);c+=ve(i,g,d,o)}return c}let l=xe;const h=Qg(s)?Object.getOwnPropertyNames(s):nf(s);for(const c of h)l+=Lo,l+=Math.min(Lr+c.length*2,64);mt(i,a,l,1),o&&(St(i.byEntityType,o).bytes+=l);for(const c of h){if(ef(i,c,a)||c==="_database"||c==="database")continue;let u;try{u=s[c]}catch{continue}if(typeof u=="function")continue;if(c==="_handleRegistry"&&u instanceof Map){l+=rf(i,u);continue}const g=Io(a,c,u);!i.includeTransactionManager&&g==="transaction"||!i.includeEventManagers&&g==="events"||(l+=ve(i,u,g,o))}return l}function sf(i,t){const e={visited:new WeakSet,objectCount:0,entityCount:0,byCategory:new Map,byEntityType:new Map,includeTransactionManager:(t==null?void 0:t.includeTransactionManager)===!0,includeEventManagers:(t==null?void 0:t.includeEventManagers)===!0};ve(e,i,"sysvars",null);let n=0;const r={};for(const[o,a]of e.byCategory)r[o]={bytes:a.bytes,count:a.count},n+=a.bytes;const s={};for(const[o,a]of e.byEntityType)s[o]={bytes:a.bytes,count:a.count};return{totalBytes:n,objectCount:e.objectCount,entityCount:e.entityCount,byCategory:r,byEntityType:s}}function Cn(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(2)} KiB`:`${(i/(1024*1024)).toFixed(2)} MiB`}function of(i){const t=[`AcDbDatabase memory estimate: ${Cn(i.totalBytes)} (${i.totalBytes} bytes)`,`Objects: ${i.objectCount}, Entities: ${i.entityCount}`,"By category:"],e=Object.entries(i.byCategory).sort((r,s)=>s[1].bytes-r[1].bytes);for(const[r,s]of e)t.push(` ${r}: ${Cn(s.bytes)} (${s.bytes} bytes), count=${s.count}`);const n=Object.entries(i.byEntityType).sort((r,s)=>s[1].bytes-r[1].bytes);if(n.length>0){t.push("By entity type:");for(const[r,s]of n)t.push(` ${r}: ${Cn(s.bytes)} (${s.bytes} bytes), count=${s.count}`)}return t.join(`
|
|
11
|
-
`)}class
|
|
12
|
-
`),r=[],s=[];let o=null;return n.forEach((a,l)=>{const h=l+1,c=this.stripInlineComment(a).trim();if(!c)return;if(c.startsWith("*")){this.flushCurrentPattern(o,r,s);const g=this.parseHeader(c.slice(1));if(!g){s.push({line:h,message:"Invalid pattern header.",source:a}),o=null;return}o={pattern:{name:g.name,description:g.description,lines:[]},headerLine:h};return}if(!o){s.push({line:h,message:"Line descriptor appears before any pattern header.",source:a});return}const u=this.parseLineDescriptor(c,h);if(!u){s.push({line:h,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:a});return}o.pattern.lines.push(u)}),this.flushCurrentPattern(o,r,s),{patterns:r,issues:s}}static parse(t){return new
|
|
3
|
+
`}registerHandle(t){return this._handleMap.has(t)||(/^[0-9A-F]+$/i.test(t)?this._handleMap.set(t,t.toUpperCase()):(this._handleMap.set(t,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(t)}resolveHandle(t){if(t)return this.registerHandle(t)}writeGroup(t,e){if(e==null)return this;this._lines.push(String(Math.trunc(t)));const n=this.formatValue(e);return this._lines.push(n===""?"0":n),this}writeStart(t){return this.writeString(0,t)}writeSubclassMarker(t){return this.writeString(100,t)}writeString(t,e){return!e&&e!==""?this:this.writeGroup(t,e)}writeInt8(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt16(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt32(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt64(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeUInt16(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeUInt32(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeBoolean(t,e){return e==null?this:this.writeGroup(t,e?1:0)}writeBool(t,e){return this.writeBoolean(t,e)}writeDouble(t,e){return e==null||!Number.isFinite(e)?this:this.writeGroup(t,e)}writeAngle(t,e){return e==null||!Number.isFinite(e)?this:this.writeDouble(t,e*180/Math.PI)}writeHandle(t,e){const n=this.resolveHandle(e);return n?this.writeString(t,n):this}writeObjectId(t,e){return this.writeHandle(t,e)}writePoint2d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this):this}writePoint3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeVector3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeCmColor(t,e=62,n=420){if(!t)return this;const r=t.colorIndex;r!=null&&this.writeInt16(e,r);const s=t.RGB;return s!=null&&t.colorIndex==null&&this.writeInt32(n,s),this}writeTransparency(t,e=440){return!t||t.method===exports.AcCmTransparencyMethod.ErrorValue?this:this.writeInt32(e,t.serialize())}writeResultBuffer(t){if(!t)return this;for(const e of t)this.writeGroup(e.code,e.value);return this}startSection(t){return this.writeStart("SECTION"),this.writeString(2,t),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(t){return this.writeStart("TABLE"),this.writeString(2,t),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(t){if(typeof t=="string")return this.sanitizeStringForDxfLine(t);if(typeof t=="boolean")return t?"1":"0";if(typeof t=="number"){if(!Number.isFinite(t))return"0";if(Number.isInteger(t))return String(t);const n=t.toFixed(this._precision).replace(/\.?0+$/,"");return n===""||n==="-"?"0":n}return String(t)}sanitizeStringForDxfLine(t){return t.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var ue=256,oa=[],ho=256,xn;for(;ue--;)oa[ue]=(ue+256).toString(16).substring(1);function yc(i){var t=0,e=11;if(!xn||ue+e>ho*2)for(xn="",ue=0;t<ho;t++)xn+=oa[Math.random()*256|0];return xn.substring(ue,ue+++e)}const ee="TEMP_";let on;function aa(i){on=i}function mc(){if(on)return on().workingDatabase;throw new Error("The current working database must be set before using it!")}const Ct=class Ct{constructor(t,e){t=t||{},this._attrs=new Wi(t,e),this._xDataMap=new Map,this._attrs.get("objectId")||(this._database?this._attrs.set("objectId",this._database.generateHandle()):this._attrs.set("objectId",this.generateTemporaryHandle()))}generateTemporaryHandle(){return ee+yc()}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t),t&&!t.startsWith(ee)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(ee)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){if(this._database)return this._database;if(on)return on().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this.assignDatabase(t)}assignDatabase(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Qr.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}getOwnSnapshotKeys(){return Reflect.ownKeys(this).filter(t=>typeof t=="string"&&!Ct.SNAPSHOT_EXCLUDED_KEYS.has(t))}cloneAttrs(t){const e=this.cloneValue(t.attributes);return new Wi(e)}restoreAttrsFrom(t){const e=this.cloneValue(t.attributes),n=this._attrs.attributes;for(const r of Object.keys(n))r in e||this._attrs.set(r,void 0,{unset:!0,silent:!0});this._attrs.set(e,{silent:!0})}restoreXDataMapFrom(t){this._xDataMap.clear();for(const[e,n]of t.entries())this._xDataMap.set(e,this.cloneValue(n))}copySnapshotStateTo(t){t._attrs=this.cloneAttrs(this._attrs),t._xDataMap=this.cloneValue(this._xDataMap);const e=this,n=t;for(const r of this.getOwnSnapshotKeys())Ct.SNAPSHOT_INTERNAL_KEYS.has(r)||(n[r]=this.cloneValue(e[r]))}clone(){const t=Object.create(Object.getPrototypeOf(this));return this.copySnapshotStateTo(t),t.objectId=this.generateTemporaryHandle(),t}clonePreservingIdentity(){const t=this.clone(),e=this.getAttrWithoutException("objectId");e&&t._attrs.set("objectId",e);const n=this.getAttrWithoutException("ownerId");return n!==void 0&&t._attrs.set("ownerId",n),this._database&&(t._database=this._database),t}restoreFrom(t){const e=this.objectId,n=this._database;this.restoreAttrsFrom(t._attrs),this.restoreXDataMapFrom(t._xDataMap);const r=t,s=this,o=new Set(t.getOwnSnapshotKeys());for(const a of o)Ct.SNAPSHOT_INTERNAL_KEYS.has(a)||Ct.SNAPSHOT_EXCLUDED_KEYS.has(a)||(s[a]=this.cloneValue(r[a]));for(const a of this.getOwnSnapshotKeys())Ct.SNAPSHOT_INTERNAL_KEYS.has(a)||Ct.SNAPSHOT_EXCLUDED_KEYS.has(a)||o.has(a)||delete s[a];this.objectId=e,n&&(this.database=n)}cloneValue(t){if(t==null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(r=>this.cloneValue(r));if(t instanceof Map){const r=new Map;for(const[s,o]of t.entries())r.set(this.cloneValue(s),this.cloneValue(o));return r}if(t instanceof Set){const r=new Set;for(const s of t.values())r.add(this.cloneValue(s));return r}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));const r=t.constructor;return new r(t)}if(t instanceof ArrayBuffer)return t.slice(0);if(t&&typeof t=="object"&&"tables"in t&&"transactionManager"in t)return t;if("clone"in t&&typeof t.clone=="function")return t.clone();const e=Object.create(Object.getPrototypeOf(t)),n=t;for(const r of Object.keys(n))e[r]=this.cloneValue(n[r]);return e}dxfOut(...t){const[e,n=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),n)for(const r of this._xDataMap.values())e.writeResultBuffer(r);return this}dxfOutFields(t){return this}};Ct.SNAPSHOT_EXCLUDED_KEYS=new Set(["_database","transactionManager"]),Ct.SNAPSHOT_INTERNAL_KEYS=new Set(["_attrs","_xDataMap"]);let lt=Ct;var st=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],co=1234567,ts=Math.PI/180,es=180/Math.PI;function la(){var i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=st[i&255]+st[i>>8&255]+st[i>>16&255]+st[i>>24&255]+"-"+st[t&255]+st[t>>8&255]+"-"+st[t>>16&15|64]+st[t>>24&255]+"-"+st[e&63|128]+st[e>>8&255]+"-"+st[e>>16&255]+st[e>>24&255]+st[n&255]+st[n>>8&255]+st[n>>16&255]+st[n>>24&255];return r.toLowerCase()}function zt(i,t,e){return Math.max(t,Math.min(e,i))}function ns(i,t){return(i%t+t)%t}function ha(i,t,e,n,r){return n+(i-t)*(r-n)/(e-t)}function ca(i,t,e){return i!==t?(e-i)/(t-i):0}function is(i,t,e){return(1-e)*i+e*t}function ua(i,t,e,n){return is(i,t,1-Math.exp(-e*n))}function da(i,t){return t===void 0&&(t=1),t-Math.abs(ns(i,t*2)-t)}function ga(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function fa(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function pa(i,t){return i+Math.floor(Math.random()*(t-i+1))}function ya(i,t){return i+Math.random()*(t-i)}function ma(i){return i*(.5-Math.random())}function _a(i){i!==void 0&&(co=i);var t=co+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function ba(i){return i*ts}function wa(i){return i*es}function xa(i){return(i&i-1)===0&&i!==0}function va(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Pa(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Ze(i){var t=Math.PI*2;return(i%t+t)%t}function Aa(i,t,e){return i>t&&i<e||i>e&&i<t}function Sa(i,t,e,n){return n===void 0&&(n=!1),i=Ze(i),t=Ze(t),e=Ze(e),n?t>e?i<=t&&i>=e:i<=t||i>=e:t<e?i>=t&&i<=e:i>=t||i<=e}function rs(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function La(i,t){t===void 0&&(t=1e-7);var e=rs(i);return Math.max(Math.pow(10,e)*t,t)}var T={DEG2RAD:ts,RAD2DEG:es,generateUUID:la,clamp:zt,euclideanModulo:ns,mapLinear:ha,inverseLerp:ca,lerp:is,damp:ua,pingpong:da,smoothstep:ga,smootherstep:fa,randInt:pa,randFloat:ya,randFloatSpread:ma,seededRandom:_a,degToRad:ba,radToDeg:wa,isPowerOfTwo:xa,ceilPowerOfTwo:va,floorPowerOfTwo:Pa,normalizeAngle:Ze,isBetween:Aa,isBetweenAngle:Sa,intPartLength:rs,relativeEps:La},_c=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},W=(function(){function i(t,e){this.x=0,this.y=0;var n=+(t!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(n===1){var r=t,s=r.x,o=r.y;this.x=s,this.y=o;return}if(n===2){this.x=t,this.y=e;return}throw gt.ILLEGAL_PARAMETERS}}return Object.defineProperty(i.prototype,"width",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),i.prototype.set=function(t,e){return this.x=t,this.y=e,this},i.prototype.setScalar=function(t){return this.x=t,this.y=t,this},i.prototype.setX=function(t){return this.x=t,this},i.prototype.setY=function(t){return this.y=t,this},i.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},i.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},i.prototype.clone=function(){return new i(this.x,this.y)},i.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},i.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},i.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},i.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},i.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},i.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},i.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},i.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},i.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},i.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},i.prototype.applyMatrix2d=function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},i.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},i.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},i.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},i.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},i.prototype.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},i.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},i.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},i.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},i.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},i.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},i.prototype.dot=function(t){return this.x*t.x+this.y*t.y},i.prototype.cross=function(t){return this.x*t.y-this.y*t.x},i.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},i.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},i.prototype.normalize=function(){return this.divideScalar(this.length()||1)},i.prototype.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},i.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,n)))},i.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},i.prototype.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},i.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},i.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},i.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},i.prototype.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this},i.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},i.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t},i.prototype.rotateAround=function(t,e){var n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*n-o*r+t.x,this.y=s*r+o*n+t.y,this},i.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},i.prototype.relativeEps=function(t){return t===void 0&&(t=1e-7),Math.min(T.relativeEps(this.x,t),T.relativeEps(this.y,t))},i.prototype[Symbol.iterator]=function(){return _c(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[2]}})},i.EMPTY=Object.freeze(new i(0,0)),i})(),_n=(function(){function i(t,e,n,r,s,o,a,l,h){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&n!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&h!=null&&this.set(t,e,n,r,s,o,a,l,h)}return i.prototype.set=function(t,e,n,r,s,o,a,l,h){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=s,c[5]=l,c[6]=n,c[7]=o,c[8]=h,this},i.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},i.prototype.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},i.prototype.extractBasis=function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},i.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},i.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},i.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},i.prototype.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[3],l=n[6],h=n[1],c=n[4],u=n[7],g=n[2],d=n[5],f=n[8],p=r[0],y=r[3],_=r[6],x=r[1],P=r[4],A=r[7],I=r[2],E=r[5],L=r[8];return s[0]=o*p+a*x+l*I,s[3]=o*y+a*P+l*E,s[6]=o*_+a*A+l*L,s[1]=h*p+c*x+u*I,s[4]=h*y+c*P+u*E,s[7]=h*_+c*A+u*L,s[2]=g*p+d*x+f*I,s[5]=g*y+d*P+f*E,s[8]=g*_+d*A+f*L,this},i.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},i.prototype.determinant=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8];return e*o*c-e*a*h-n*s*c+n*a*l+r*s*h-r*o*l},i.prototype.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=c*o-a*h,g=a*l-c*s,d=h*s-o*l,f=e*u+n*g+r*d;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return t[0]=u*p,t[1]=(r*h-c*n)*p,t[2]=(a*n-r*o)*p,t[3]=g*p,t[4]=(c*e-r*l)*p,t[5]=(r*s-a*e)*p,t[6]=d*p,t[7]=(n*l-h*e)*p,t[8]=(o*e-n*s)*p,this},i.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},i.prototype.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},i.prototype.transposeIntoArray=function(t){var e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this},i.prototype.setUvTransform=function(t,e,n,r,s,o,a){var l=Math.cos(s),h=Math.sin(s);return this.set(n*l,n*h,-n*(l*o+h*a)+o+t,-r*h,r*l,-r*(-h*o+l*a)+a+e,0,0,1),this},i.prototype.scale=function(t,e){return this.premultiply(vi.makeScale(t,e)),this},i.prototype.rotate=function(t){return this.premultiply(vi.makeRotation(-t)),this},i.prototype.translate=function(t,e){return this.premultiply(vi.makeTranslation(t,e)),this},i.prototype.makeTranslation=function(t,e){return t instanceof W?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this},i.prototype.makeRotation=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this},i.prototype.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},i.prototype.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},i.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},i.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t},i.prototype.clone=function(){return new i().fromArray(this.elements)},i.IDENTITY=Object.freeze(new i),i})(),vi=new _n,Ft=1e-6,F=2*Math.PI,bc={x:0,y:0},ss={x:0,y:0,z:0},D=(function(){function i(){this.equalPointTol=Ft,this.equalVectorTol=Ft}return i.prototype.clone=function(){var t=new i;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t},i.prototype.equalPoint2d=function(t,e){return new W(t).sub(e).length()<this.equalPointTol},i.prototype.equalPoint3d=function(t,e){return new b(t).sub(e).length()<this.equalPointTol},i.equalToZero=function(t,e){return e===void 0&&(e=Ft),t<e&&t>-e},i.equal=function(t,e,n){return n===void 0&&(n=Ft),Math.abs(t-e)<n},i.great=function(t,e,n){return n===void 0&&(n=Ft),t-e>n},i.less=function(t,e,n){return n===void 0&&(n=Ft),t-e<n},i.isPositive=function(t,e){return e===void 0&&(e=Ft),t>e},i.isNonPositive=function(t,e){return e===void 0&&(e=Ft),t<=e},i})(),li=new D,wc=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},Re=(function(){function i(t,e,n,r){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=1),this._x=t,this._y=e,this._z=n,this._w=r}return i.slerpFlat=function(t,e,n,r,s,o,a){var l=n[r+0],h=n[r+1],c=n[r+2],u=n[r+3],g=s[o+0],d=s[o+1],f=s[o+2],p=s[o+3];if(a===0){t[e+0]=l,t[e+1]=h,t[e+2]=c,t[e+3]=u;return}if(a===1){t[e+0]=g,t[e+1]=d,t[e+2]=f,t[e+3]=p;return}if(u!==p||l!==g||h!==d||c!==f){var y=1-a,_=l*g+h*d+c*f+u*p,x=_>=0?1:-1,P=1-_*_;if(P>Number.EPSILON){var A=Math.sqrt(P),I=Math.atan2(A,_*x);y=Math.sin(y*I)/A,a=Math.sin(a*I)/A}var E=a*x;if(l=l*y+g*E,h=h*y+d*E,c=c*y+f*E,u=u*y+p*E,y===1-a){var L=1/Math.sqrt(l*l+h*h+c*c+u*u);l*=L,h*=L,c*=L,u*=L}}t[e]=l,t[e+1]=h,t[e+2]=c,t[e+3]=u},i.multiplyQuaternionsFlat=function(t,e,n,r,s,o){var a=n[r],l=n[r+1],h=n[r+2],c=n[r+3],u=s[o],g=s[o+1],d=s[o+2],f=s[o+3];return t[e]=a*f+c*u+l*d-h*g,t[e+1]=l*f+c*g+h*u-a*d,t[e+2]=h*f+c*d+a*g-l*u,t[e+3]=c*f-a*u-l*g-h*d,t},Object.defineProperty(i.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),i.prototype.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},i.prototype.clone=function(){return new i(this._x,this._y,this._z,this._w)},i.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},i.prototype.setFromEuler=function(t,e){e===void 0&&(e=!0);var n=t.x,r=t.y,s=t.z,o=t.order,a=Math.cos,l=Math.sin,h=a(n/2),c=a(r/2),u=a(s/2),g=l(n/2),d=l(r/2),f=l(s/2);switch(o){case"XYZ":this._x=g*c*u+h*d*f,this._y=h*d*u-g*c*f,this._z=h*c*f+g*d*u,this._w=h*c*u-g*d*f;break;case"YXZ":this._x=g*c*u+h*d*f,this._y=h*d*u-g*c*f,this._z=h*c*f-g*d*u,this._w=h*c*u+g*d*f;break;case"ZXY":this._x=g*c*u-h*d*f,this._y=h*d*u+g*c*f,this._z=h*c*f+g*d*u,this._w=h*c*u-g*d*f;break;case"ZYX":this._x=g*c*u-h*d*f,this._y=h*d*u+g*c*f,this._z=h*c*f-g*d*u,this._w=h*c*u+g*d*f;break;case"YZX":this._x=g*c*u+h*d*f,this._y=h*d*u+g*c*f,this._z=h*c*f-g*d*u,this._w=h*c*u-g*d*f;break;case"XZY":this._x=g*c*u-h*d*f,this._y=h*d*u-g*c*f,this._z=h*c*f+g*d*u,this._w=h*c*u+g*d*f;break;default:}return e===!0&&this._onChangeCallback(),this},i.prototype.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},i.prototype.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],s=e[8],o=e[1],a=e[5],l=e[9],h=e[2],c=e[6],u=e[10],g=n+a+u;if(g>0){var d=.5/Math.sqrt(g+1);this._w=.25/d,this._x=(c-l)*d,this._y=(s-h)*d,this._z=(o-r)*d}else if(n>a&&n>u){var d=2*Math.sqrt(1+n-a-u);this._w=(c-l)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+h)/d}else if(a>u){var d=2*Math.sqrt(1+a-n-u);this._w=(s-h)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(l+c)/d}else{var d=2*Math.sqrt(1+u-n-a);this._w=(o-r)/d,this._x=(s+h)/d,this._y=(l+c)/d,this._z=.25*d}return this._onChangeCallback(),this},i.prototype.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},i.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(zt(this.dot(t),-1,1)))},i.prototype.rotateTowards=function(t,e){var n=this.angleTo(t);if(n===0)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},i.prototype.identity=function(){return this.set(0,0,0,1)},i.prototype.invert=function(){return this.conjugate()},i.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},i.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},i.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},i.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},i.prototype.normalize=function(){var t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},i.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},i.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},i.prototype.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,s=t._z,o=t._w,a=e._x,l=e._y,h=e._z,c=e._w;return this._x=n*c+o*a+r*h-s*l,this._y=r*c+o*l+s*a-n*h,this._z=s*c+o*h+n*l-r*a,this._w=o*c-n*a-r*l-s*h,this._onChangeCallback(),this},i.prototype.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copy(t);var n=this._x,r=this._y,s=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;var l=1-a*a;if(l<=Number.EPSILON){var h=1-e;return this._w=h*o+e*this._w,this._x=h*n+e*this._x,this._y=h*r+e*this._y,this._z=h*s+e*this._z,this.normalize(),this}var c=Math.sqrt(l),u=Math.atan2(c,a),g=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*g+this._w*d,this._x=n*g+this._x*d,this._y=r*g+this._y*d,this._z=s*g+this._z*d,this._onChangeCallback(),this},i.prototype.slerpQuaternions=function(t,e,n){return this.copy(t).slerp(e,n)},i.prototype.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))},i.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},i.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},i.prototype.toJSON=function(){return this.toArray()},i.prototype._onChange=function(t){return this._onChangeCallback=t,this},i.prototype._onChangeCallback=function(){},i.prototype[Symbol.iterator]=function(){return wc(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._w];case 4:return t.sent(),[2]}})},i})(),xc=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},b=(function(){function i(t,e,n){this.x=0,this.y=0,this.z=0;var r=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){var s=t,o=s.x,a=s.y,l=s.z;this.x=o,this.y=a,this.z=l||0;return}if(r===3){this.x=t,this.y=e,this.z=n;return}throw gt.ILLEGAL_PARAMETERS}}return i.prototype.set=function(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this},i.prototype.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},i.prototype.setX=function(t){return this.x=t,this},i.prototype.setY=function(t){return this.y=t,this},i.prototype.setZ=function(t){return this.z=t,this},i.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},i.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},i.prototype.clone=function(){return new i(this.x,this.y,this.z)},i.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},i.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},i.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},i.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},i.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},i.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},i.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},i.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},i.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},i.prototype.applyEuler=function(t){return this.applyQuaternion(uo.setFromEuler(t))},i.prototype.applyAxisAngle=function(t,e){return this.applyQuaternion(uo.setFromAxisAngle(t,e))},i.prototype.applyMatrix3=function(t){var e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this},i.prototype.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},i.prototype.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*o,this},i.prototype.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,s=t.x,o=t.y,a=t.z,l=t.w,h=2*(o*r-a*n),c=2*(a*e-s*r),u=2*(s*n-o*e);return this.x=e+l*h+o*u-a*c,this.y=n+l*c+a*h-s*u,this.z=r+l*u+s*c-o*h,this},i.prototype.transformDirection=function(t){var e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()},i.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},i.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},i.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},i.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},i.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},i.prototype.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},i.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},i.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},i.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},i.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},i.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.prototype.isParallelTo=function(t){var e=this.dot(t),n=this.length(),r=t.length();return Math.abs(e)===n*r},i.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},i.prototype.normalize=function(){return this.divideScalar(this.length()||1)},i.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},i.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},i.prototype.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},i.prototype.cross=function(t){return this.crossVectors(this,t)},i.prototype.crossVectors=function(t,e){var n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,l=e.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this},i.prototype.projectOnVector=function(t){var e=t.lengthSq();if(e===0)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},i.prototype.projectOnPlane=function(t){return Pi.copy(this).projectOnVector(t),this.sub(Pi)},i.prototype.reflect=function(t){return this.sub(Pi.copy(t).multiplyScalar(2*this.dot(t)))},i.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,n)))},i.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},i.prototype.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},i.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},i.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},i.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},i.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,e*4)},i.prototype.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,e*3)},i.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},i.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},i.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},i.prototype.randomDirection=function(){var t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this},i.prototype[Symbol.iterator]=function(){return xc(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[4,this.z];case 3:return t.sent(),[2]}})},i.ORIGIN=Object.freeze(new i(0,0,0)),i.X_AXIS=Object.freeze(new i(1,0,0)),i.NEGATIVE_X_AXIS=Object.freeze(new i(-1,0,0)),i.Y_AXIS=Object.freeze(new i(0,1,0)),i.NEGATIVE_Y_AXIS=Object.freeze(new i(0,-1,0)),i.Z_AXIS=Object.freeze(new i(0,0,1)),i.NEGATIVE_Z_AXIS=Object.freeze(new i(0,0,-1)),i})(),Pi=new b,uo=new Re,O=(function(){function i(t,e,n,r,s,o,a,l,h,c,u,g,d,f,p,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&n!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&h!=null&&c!=null&&u!=null&&g!=null&&d!=null&&f!=null&&p!=null&&y!=null&&this.set(t,e,n,r,s,o,a,l,h,c,u,g,d,f,p,y)}return i.makeTranslation=function(t,e,n){return new i().makeTranslation(t,e,n)},i.prototype.set=function(t,e,n,r,s,o,a,l,h,c,u,g,d,f,p,y){var _=this.elements;return _[0]=t,_[4]=e,_[8]=n,_[12]=r,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=h,_[6]=c,_[10]=u,_[14]=g,_[3]=d,_[7]=f,_[11]=p,_[15]=y,this},i.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},i.prototype.clone=function(){return new i().fromArray(this.elements)},i.prototype.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},i.prototype.copyPosition=function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},i.prototype.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},i.prototype.setFromExtrusionDirection=function(t){var e=Math.hypot(t.x,t.y,t.z);if(!Number.isFinite(e)||e<1e-12)return this.identity(),this;var n=Math.abs(e-1)>1e-6?t.clone().multiplyScalar(1/e):t;if(li.equalPoint3d(n,b.Z_AXIS))this.identity();else{var r=new b(1,0,0);Math.abs(n.x)<1/64&&Math.abs(n.y)<1/64?r.crossVectors(b.Y_AXIS,n).normalize():r.crossVectors(b.Z_AXIS,n).normalize();var s=n.clone().cross(r).normalize();this.set(r.x,r.y,r.z,0,s.x,s.y,s.z,0,n.x,n.y,n.z,0,0,0,0,1)}return this},i.prototype.extractBasis=function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},i.prototype.makeBasis=function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},i.prototype.extractRotation=function(t){var e=this.elements,n=t.elements,r=1/be.setFromMatrixColumn(t,0).length(),s=1/be.setFromMatrixColumn(t,1).length(),o=1/be.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},i.prototype.makeRotationFromQuaternion=function(t){return this.compose(vc,t,Pc)},i.prototype.lookAt=function(t,e,n){var r=this.elements;return ft.subVectors(t,e),ft.lengthSq()===0&&(ft.z=1),ft.normalize(),Kt.crossVectors(n,ft),Kt.lengthSq()===0&&(Math.abs(n.z)===1?ft.x+=1e-4:ft.z+=1e-4,ft.normalize(),Kt.crossVectors(n,ft)),Kt.normalize(),vn.crossVectors(ft,Kt),r[0]=Kt.x,r[4]=vn.x,r[8]=ft.x,r[1]=Kt.y,r[5]=vn.y,r[9]=ft.y,r[2]=Kt.z,r[6]=vn.z,r[10]=ft.z,this},i.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},i.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},i.prototype.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,s=this.elements,o=n[0],a=n[4],l=n[8],h=n[12],c=n[1],u=n[5],g=n[9],d=n[13],f=n[2],p=n[6],y=n[10],_=n[14],x=n[3],P=n[7],A=n[11],I=n[15],E=r[0],L=r[4],C=r[8],M=r[12],Y=r[1],N=r[5],R=r[9],G=r[13],U=r[2],at=r[6],yt=r[10],At=r[14],St=r[3],_e=r[7],$t=r[11],qt=r[15];return s[0]=o*E+a*Y+l*U+h*St,s[4]=o*L+a*N+l*at+h*_e,s[8]=o*C+a*R+l*yt+h*$t,s[12]=o*M+a*G+l*At+h*qt,s[1]=c*E+u*Y+g*U+d*St,s[5]=c*L+u*N+g*at+d*_e,s[9]=c*C+u*R+g*yt+d*$t,s[13]=c*M+u*G+g*At+d*qt,s[2]=f*E+p*Y+y*U+_*St,s[6]=f*L+p*N+y*at+_*_e,s[10]=f*C+p*R+y*yt+_*$t,s[14]=f*M+p*G+y*At+_*qt,s[3]=x*E+P*Y+A*U+I*St,s[7]=x*L+P*N+A*at+I*_e,s[11]=x*C+P*R+A*yt+I*$t,s[15]=x*M+P*G+A*At+I*qt,this},i.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},i.prototype.determinant=function(){var t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],o=t[1],a=t[5],l=t[9],h=t[13],c=t[2],u=t[6],g=t[10],d=t[14],f=t[3],p=t[7],y=t[11],_=t[15];return f*(+s*l*u-r*h*u-s*a*g+n*h*g+r*a*d-n*l*d)+p*(+e*l*d-e*h*g+s*o*g-r*o*d+r*h*c-s*l*c)+y*(+e*h*u-e*a*d-s*o*u+n*o*d+s*a*c-n*h*c)+_*(-r*a*c-e*l*u+e*a*g+r*o*u-n*o*g+n*l*c)},i.prototype.transpose=function(){var t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},i.prototype.setPosition=function(t,e,n){var r=this.elements;return t instanceof b?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this},i.prototype.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=t[9],g=t[10],d=t[11],f=t[12],p=t[13],y=t[14],_=t[15],x=u*y*h-p*g*h+p*l*d-a*y*d-u*l*_+a*g*_,P=f*g*h-c*y*h-f*l*d+o*y*d+c*l*_-o*g*_,A=c*p*h-f*u*h+f*a*d-o*p*d-c*a*_+o*u*_,I=f*u*l-c*p*l-f*a*g+o*p*g+c*a*y-o*u*y,E=e*x+n*P+r*A+s*I;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var L=1/E;return t[0]=x*L,t[1]=(p*g*s-u*y*s-p*r*d+n*y*d+u*r*_-n*g*_)*L,t[2]=(a*y*s-p*l*s+p*r*h-n*y*h-a*r*_+n*l*_)*L,t[3]=(u*l*s-a*g*s-u*r*h+n*g*h+a*r*d-n*l*d)*L,t[4]=P*L,t[5]=(c*y*s-f*g*s+f*r*d-e*y*d-c*r*_+e*g*_)*L,t[6]=(f*l*s-o*y*s-f*r*h+e*y*h+o*r*_-e*l*_)*L,t[7]=(o*g*s-c*l*s+c*r*h-e*g*h-o*r*d+e*l*d)*L,t[8]=A*L,t[9]=(f*u*s-c*p*s-f*n*d+e*p*d+c*n*_-e*u*_)*L,t[10]=(o*p*s-f*a*s+f*n*h-e*p*h-o*n*_+e*a*_)*L,t[11]=(c*a*s-o*u*s-c*n*h+e*u*h+o*n*d-e*a*d)*L,t[12]=I*L,t[13]=(c*p*r-f*u*r+f*n*g-e*p*g-c*n*y+e*u*y)*L,t[14]=(f*a*r-o*p*r-f*n*l+e*p*l+o*n*y-e*a*y)*L,t[15]=(o*u*r-c*a*r+c*n*l-e*u*l-o*n*g+e*a*g)*L,this},i.prototype.scale=function(t){var e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this},i.prototype.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},i.prototype.makeTranslation=function(t,e,n){var r;return typeof t=="object"?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,(r=t.z)!==null&&r!==void 0?r:0,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},i.prototype.makeRotationX=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},i.prototype.makeRotationY=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},i.prototype.makeRotationZ=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},i.prototype.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),s=1-n,o=t.x,a=t.y,l=t.z,h=s*o,c=s*a;return this.set(h*o+n,h*a-r*l,h*l+r*a,0,h*a+r*l,c*a+n,c*l-r*o,0,h*l-r*a,c*l+r*o,s*l*l+n,0,0,0,0,1),this},i.prototype.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},i.prototype.makeShear=function(t,e,n,r,s,o){return this.set(1,n,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this},i.prototype.compose=function(t,e,n){var r=this.elements,s=e.x,o=e.y,a=e.z,l=e.w,h=s+s,c=o+o,u=a+a,g=s*h,d=s*c,f=s*u,p=o*c,y=o*u,_=a*u,x=l*h,P=l*c,A=l*u,I=n.x,E=n.y,L=n.z;return r[0]=(1-(p+_))*I,r[1]=(d+A)*I,r[2]=(f-P)*I,r[3]=0,r[4]=(d-A)*E,r[5]=(1-(g+_))*E,r[6]=(y+x)*E,r[7]=0,r[8]=(f+P)*L,r[9]=(y-x)*L,r[10]=(1-(g+p))*L,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},i.prototype.decompose=function(t,e,n){var r=this.elements,s=be.set(r[0],r[1],r[2]).length(),o=be.set(r[4],r[5],r[6]).length(),a=be.set(r[8],r[9],r[10]).length(),l=this.determinant();l<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Lt.copy(this);var h=1/s,c=1/o,u=1/a;return Lt.elements[0]*=h,Lt.elements[1]*=h,Lt.elements[2]*=h,Lt.elements[4]*=c,Lt.elements[5]*=c,Lt.elements[6]*=c,Lt.elements[8]*=u,Lt.elements[9]*=u,Lt.elements[10]*=u,e.setFromRotationMatrix(Lt),n.x=s,n.y=o,n.z=a,this},i.prototype.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},i.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},i.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t},i.IDENTITY=Object.freeze(new i),i})(),be=new b,Lt=new O,vc=new b(0,0,0),Pc=new b(1,1,1),Kt=new b,vn=new b,ft=new b,k=(function(){function i(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new b(1/0,1/0,1/0):new b(t.x,t.y,t.z),this.max=e==null?new b(-1/0,-1/0,-1/0):new b(e.x,e.y,e.z)}return i.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},i.prototype.setFromArray=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e+=3)this.expandByPoint(Ai.fromArray(t,e));return this},i.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},i.prototype.setFromCenterAndSize=function(t,e){var n=Ai.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},i.prototype.clone=function(){return new i().copy(this)},i.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},i.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},i.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},i.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},i.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},Object.defineProperty(i.prototype,"center",{get:function(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),i.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},i.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},i.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},i.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},i.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},i.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},i.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},i.prototype.intersectsPlane=function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},i.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},i.prototype.distanceToPoint=function(t){return this.clampPoint(t,Ai).distanceTo(t)},i.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},i.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},i.prototype.applyMatrix4=function(t){return this.isEmpty()?this:(Bt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Bt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Bt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Bt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Bt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Bt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Bt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Bt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Bt),this)},i.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},i.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},i})(),Bt=[new b,new b,new b,new b,new b,new b,new b,new b],Ai=new b,go=new W,it=(function(){function i(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new W(1/0,1/0):new W(t.x,t.y),this.max=e==null?new W(-1/0,-1/0):new W(e.x,e.y)}return i.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},i.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},i.prototype.setFromCenterAndSize=function(t,e){var n=go.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},i.prototype.clone=function(){return new i().copy(this)},i.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},i.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},i.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},i.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},i.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},Object.defineProperty(i.prototype,"center",{get:function(){return this.isEmpty()?new W(0,0):new W(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"size",{get:function(){return this.isEmpty()?new W(0,0):new W(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),i.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},i.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},i.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},i.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},i.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},i.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},i.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},i.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},i.prototype.distanceToPoint=function(t){return this.clampPoint(t,go).distanceTo(t)},i.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},i.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},i.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},i.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},i})(),fo=new b,Ac=new b,Sc=new _n,os=(function(){function i(t,e){t===void 0&&(t=new b(1,0,0)),e===void 0&&(e=0),this.normal=t,this.constant=e}return i.prototype.set=function(t,e){return this.normal.copy(t),this.constant=e,this},i.prototype.setComponents=function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},i.prototype.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},i.prototype.setFromCoplanarPoints=function(t,e,n){var r=fo.subVectors(n,e).cross(Ac.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},i.prototype.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},i.prototype.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},i.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},i.prototype.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},i.prototype.projectPoint=function(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},i.prototype.intersectsBox=function(t){return t.intersectsPlane(this)},i.prototype.coplanarPoint=function(t){return t.copy(this.normal).multiplyScalar(-this.constant)},i.prototype.applyMatrix4=function(t,e){var n=e||Sc.getNormalMatrix(t),r=this.coplanarPoint(fo).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this},i.prototype.translate=function(t){return this.constant-=t.dot(this.normal),this},i.prototype.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},i.prototype.clone=function(){return new i().copy(this)},i})(),Lc=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),S=(function(i){Lc(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y)},t.pointArrayToNumberArray=function(e){var n=new Array(e.length*2);return e.forEach(function(r,s){r.toArray(n,s*2)}),n},t})(W),Ec=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),m=(function(i){Ec(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.pointArrayToNumberArray=function(e,n){n===void 0&&(n=!0);var r=n?3:2,s=new Array(e.length*r);return e.forEach(function(o,a){o.toArray(s,a*r)}),s},t})(b),Ic=function(i,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(h){return function(c){return l([h,c])}}function l(h){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,h[0]&&(e=0)),e;)try{if(n=1,r&&(s=h[0]&2?r.return:h[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,h[1])).done)return s;switch(r=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,r=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){e.label=h[1];break}if(h[0]===6&&e.label<s[1]){e.label=s[1],s=h;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(h);break}s[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(i,e)}catch(c){h=[6,c],r=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},po=new O,yo=new Re,Mc=(function(){function i(t,e,n,r){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=i.DEFAULT_ORDER),this._x=t,this._y=e,this._z=n,this._order=r}return Object.defineProperty(i.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),i.prototype.set=function(t,e,n,r){return r===void 0&&(r=this._order),this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this},i.prototype.clone=function(){return new i(this._x,this._y,this._z,this._order)},i.prototype.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},i.prototype.setFromRotationMatrix=function(t,e,n){e===void 0&&(e=this._order),n===void 0&&(n=!0);var r=t.elements,s=r[0],o=r[4],a=r[8],l=r[1],h=r[5],c=r[9],u=r[2],g=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(zt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,h),this._z=0);break;case"YXZ":this._x=Math.asin(-zt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(zt(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-zt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(zt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-zt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:}return this._order=e,n===!0&&this._onChangeCallback(),this},i.prototype.setFromQuaternion=function(t,e,n){return n===void 0&&(n=!0),po.makeRotationFromQuaternion(t),this.setFromRotationMatrix(po,e,n)},i.prototype.setFromVector3=function(t,e){return e===void 0&&(e=this._order),this.set(t.x,t.y,t.z,e)},i.prototype.reorder=function(t){return yo.setFromEuler(this),this.setFromQuaternion(yo,t)},i.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},i.prototype.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this},i.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},i.prototype._onChange=function(t){return this._onChangeCallback=t,this},i.prototype._onChangeCallback=function(){},i.prototype[Symbol.iterator]=function(){return Ic(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._order];case 4:return t.sent(),[2]}})},i.DEFAULT_ORDER="XYZ",i})();function Tc(i){var t,e=i;return{x:i.x,y:i.y,z:(t=e.z)!==null&&t!==void 0?t:0}}function Cc(i,t){var e,n;i.x+=t.x,i.y+=t.y,i.z=((e=i.z)!==null&&e!==void 0?e:0)+((n=t.z)!==null&&n!==void 0?n:0)}function Oc(i,t,e){e===void 0&&(e=!1);for(var n=i.x,r=i.y,s=!1,o=t.length,a=0,l=o-1;a<o;l=a++){var h=t[a].x,c=t[a].y,u=t[l].x,g=t[l].y,d=c>r!=g>r;e&&(d=c>=r!=g>=r);var f=d&&n<(u-h)*(r-c)/(g-c)+h;f&&(s=!s)}return s}function kc(i,t){if(i.length===0||t.length===0)return!1;var e=new it().setFromPoints(i),n=new it().setFromPoints(t);if(!e.intersectsBox(n))return!1;for(var r=0;r<i.length;){if(ot.isPointInPolygon(i[r],t,!0))return!0;r<i.length-1&&li.equalPoint2d(i[r+1],i[r])&&++r,++r}return!1}var ot={applyOffsetToPoint3d:Cc,isPointInPolygon:Oc,isPolygonIntersect:kc,point2dToPoint3d:Tc},Pn=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},An=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))};function Nc(i,t){for(var e=[],n=t-1,r=i,s=0;s<=r;s++)e.push(0);for(var s=1;s<=n-r;s++)e.push(s);for(var s=0;s<=r;s++)e.push(n-r+1);return e}function Rc(i,t){for(var e=t.length-1,n=i,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],l=t[o][1]-t[o-1][1],h=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+l*l+h*h);s+=c,r.push(s)}for(var u=[],o=0;o<=n;o++)u.push(0);for(var o=1;o<=e-n;o++){var g=r[o]/s;u.push(g*(e-n+1))}for(var o=0;o<=n;o++)u.push(e-n+1);return u}function Ea(i,t){t===void 0&&(t="Uniform");var e=i.length;if(e===0)return[];if(e===1)return[0];var n=e-1;if(t==="Uniform")return new Array(e).fill(0).map(function(g,d){return d/n});for(var r=[0],s=0,o=1;o<=n;o++){var a=i[o][0]-i[o-1][0],l=i[o][1]-i[o-1][1],h=i[o][2]-i[o-1][2],c=Math.sqrt(a*a+l*l+h*h),u=t==="SqrtChord"?Math.sqrt(c):c;s+=u,r.push(s)}return s<1e-12?new Array(e).fill(0).map(function(g,d){return d/n}):r.map(function(g){return g/s})}function Ia(i,t){for(var e=t.length-1,n=i,r=e+n+1,s=new Array(r+1).fill(0),o=t[t.length-1],a=r-n;a<=r;a++)s[a]=o;for(var l=1;l<=e-n;l++){for(var h=0,a=l;a<l+n;a++)h+=t[a];s[l+n]=h/n}return s}function Xc(i,t){for(var e=t.length-1,n=i,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],l=t[o][1]-t[o-1][1],h=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+l*l+h*h),u=Math.sqrt(c);s+=u,r.push(s)}for(var g=[],o=0;o<=n;o++)g.push(0);for(var o=1;o<=e-n;o++){var d=r[o]/s;g.push(d*(e-n+1))}for(var o=0;o<=n;o++)g.push(e-n+1);return g}function Si(i,t){for(var e=i.length,n=i.map(function(y){return y.slice()}),r=t.slice(),s=0;s<e;s++){for(var o=s,a=Math.abs(n[s][s]),l=s+1;l<e;l++){var h=Math.abs(n[l][s]);h>a&&(a=h,o=l)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==s){var c=n[s];n[s]=n[o],n[o]=c;var u=r[s];r[s]=r[o],r[o]=u}for(var l=s+1;l<e;l++){var g=n[l][s]/n[s][s];if(!(Math.abs(g)<1e-14)){for(var d=s;d<e;d++)n[l][d]-=g*n[s][d];r[l]-=g*r[s]}}}for(var f=new Array(e).fill(0),l=e-1;l>=0;l--){for(var p=r[l],d=l+1;d<e;d++)p-=n[l][d]*f[d];f[l]=p/n[l][l]}return f}function as(i,t,e,n,r){var s,o,a,l,h,c;if(e===void 0&&(e="Uniform"),i.length===0)return{controlPoints:[],knots:[],weights:[]};var u=i.map(function($t){var qt;return[$t[0],$t[1],(qt=$t[2])!==null&&qt!==void 0?qt:0]}),g=!!n,d=!!r,f=(g?1:0)+(d?1:0),p=u.length-1,y=p+f;if(y<t)throw new Error("Not enough points to interpolate a curve of this degree.");var _=Ea(u,e),x=_.slice();g&&x.unshift(_[0]),d&&x.push(_[_.length-1]);var P=Ia(t,x),A=y+1,I=new Array(A),E=new Array(A),L=new Array(A),C=new Array(A),M=0;I[M]=new Array(A).fill(0),I[M][0]=1,E[M]=u[0][0],L[M]=u[0][1],C[M]=u[0][2],M++;for(var Y=1;Y<=p-1;Y++){var N=_[Y];I[M]=new Array(A).fill(0);for(var R=0;R<=y;R++)I[M][R]=oe(R,t,N,P);E[M]=u[Y][0],L[M]=u[Y][1],C[M]=u[Y][2],M++}if(I[M]=new Array(A).fill(0),I[M][y]=1,E[M]=u[p][0],L[M]=u[p][1],C[M]=u[p][2],M++,g){var G=P[t+1]-P[0],U=G!==0?t/G:0;I[M]=new Array(A).fill(0),I[M][0]=-U,I[M][1]=U,E[M]=(s=n==null?void 0:n[0])!==null&&s!==void 0?s:0,L[M]=(o=n==null?void 0:n[1])!==null&&o!==void 0?o:0,C[M]=(a=n==null?void 0:n[2])!==null&&a!==void 0?a:0,M++}if(d){var G=P[y+t+1]-P[y],U=G!==0?t/G:0;I[M]=new Array(A).fill(0),I[M][y-1]=-U,I[M][y]=U,E[M]=(l=r==null?void 0:r[0])!==null&&l!==void 0?l:0,L[M]=(h=r==null?void 0:r[1])!==null&&h!==void 0?h:0,C[M]=(c=r==null?void 0:r[2])!==null&&c!==void 0?c:0,M++}for(var at=Si(I,E),yt=Si(I,L),At=Si(I,C),St=new Array(A),Y=0;Y<A;Y++)St[Y]=[at[Y],yt[Y],At[Y]];var _e=new Array(A).fill(1);return{controlPoints:St,knots:P,weights:_e}}function oe(i,t,e,n){if(t===0)return e>=n[i]&&e<n[i+1]?1:0;var r=n[i+t]-n[i],s=n[i+t+1]-n[i+1],o=r>1e-10?(e-n[i])/r:0,a=s>1e-10?(n[i+t+1]-e)/s:0;return o*oe(i,t-1,e,n)+a*oe(i+1,t-1,e,n)}function Qe(i,t,e,n,r){var s=n.length-1,o=t;if(i=Math.max(e[o],Math.min(e[s+1],i)),Math.abs(i-e[s+1])<1e-8)return An([],Pn(n[s]),!1);if(Math.abs(i-e[o])<1e-8)return An([],Pn(n[0]),!1);for(var a=[0,0,0],l=0,h=0;h<=s;h++){var c=oe(h,o,i,e),u=r[h]*c;a[0]+=n[h][0]*u,a[1]+=n[h][1]*u,a[2]+=n[h][2]*u,l+=u}if(Math.abs(l)<1e-10){var g=e[e.length-o-1];if(Math.abs(i-g)<1e-8)return An([],Pn(n[s]),!1);if(Math.abs(i-e[o])<1e-8)return An([],Pn(n[0]),!1)}return Math.abs(l)>=1e-10&&(a[0]/=l,a[1]/=l,a[2]/=l),a}function $i(i,t,e,n){if(t===0)return 0;var r=n[i+t]-n[i],s=n[i+t+1]-n[i+1],o=0;return r>1e-10&&(o+=t/r*oe(i,t-1,e,n)),s>1e-10&&(o-=t/s*oe(i+1,t-1,e,n)),o}function Yc(i,t,e,n){if(t<=1)return 0;var r=n[i+t]-n[i],s=n[i+t+1]-n[i+1],o=0;return r>1e-10&&(o+=t/r*$i(i,t-1,e,n)),s>1e-10&&(o-=t/s*$i(i+1,t-1,e,n)),o}function Bc(i,t,e,n,r){var s=n.length-1,o=t,a=e[o],l=e[s+1];i=Math.max(a,Math.min(l,i));for(var h=[0,0,0],c=[0,0,0],u=[0,0,0],g=0,d=0,f=0,p=0;p<=s;p++){var y=oe(p,o,i,e),_=$i(p,o,i,e),x=Yc(p,o,i,e),P=r[p],A=P*y,I=P*_,E=P*x,L=n[p];h[0]+=A*L[0],h[1]+=A*L[1],h[2]+=A*L[2],c[0]+=I*L[0],c[1]+=I*L[1],c[2]+=I*L[2],u[0]+=E*L[0],u[1]+=E*L[1],u[2]+=E*L[2],g+=A,d+=I,f+=E}if(Math.abs(g)<1e-10){var C=Qe(i,t,e,n,r);return{point:C,deriv1:[0,0,0],deriv2:[0,0,0]}}var M=g*g,Y=[h[0]/g,h[1]/g,h[2]/g],N=[(c[0]*g-h[0]*d)/M,(c[1]*g-h[1]*d)/M,(c[2]*g-h[2]*d)/M],R=u[0]*g-h[0]*f,G=u[1]*g-h[1]*f,U=u[2]*g-h[2]*f,at=[R/M-2*d*N[0]/g,G/M-2*d*N[1]/g,U/M-2*d*N[2]/g];return{point:Y,deriv1:N,deriv2:at}}function Fc(i,t){var e=i[0],n=i[1],r=t[0],s=t[1],o=e*e+n*n;return o<1e-20?0:(e*s-n*r)/Math.pow(o,1.5)}function Ma(i,t,e,n){for(var r=i,s=t[r],o=t[t.length-r-1],a=0,l=1e3,h=(o-s)/l,c=Qe(s,i,t,e,n),u=1;u<=l;u++){var g=s+u*h,d=Qe(g,i,t,e,n),f=d[0]-c[0],p=d[1]-c[1],y=d[2]-c[2];a+=Math.sqrt(f*f+p*p+y*y),c=d}var _=Qe(o,i,t,e,n),x=_[0]-c[0],P=_[1]-c[1],A=_[2]-c[2];return a+=Math.sqrt(x*x+P*P+A*A),a}function zc(i,t,e,n,r){return t===void 0&&(t=3),e===void 0&&(e="Uniform"),i.length===0?[]:as(i,t,e,n,r).controlPoints}var mo=new O,_o=new b,Vc=new b,jc=new b,Li=new m;function Ta(i){return new O().setFromExtrusionDirection(new b(i.x,i.y,i.z))}function an(i){return mo.setFromExtrusionDirection(new b(i.x,i.y,i.z)),mo.extractBasis(_o,Vc,jc),_o.clone()}function qi(i,t){var e;return new m(i.x,i.y,(e=i.z)!==null&&e!==void 0?e:0).applyMatrix4(Ta(t))}function Xe(i,t){var e;return new m(i.x,i.y,(e=i.z)!==null&&e!==void 0?e:0).applyMatrix4(Ta(t).invert())}function Dt(i,t,e){var n,r,s=Xe(i,e),o=Xe(t,e);return Li.set(o.x-s.x,o.y-s.y,((n=o.z)!==null&&n!==void 0?n:0)-((r=s.z)!==null&&r!==void 0?r:0)),T.normalizeAngle(Math.atan2(Li.y,Li.x))}function Ca(i){var t=i.length;if(t<3)return 0;for(var e=0,n=0,r=t-1;n<t;r=n++){var s=i[r],o=i[n];e+=s.x*o.y-o.x*s.y}return e*.5}function Dc(i){return Math.abs(Ca(i))}function Gc(i){var t,e,n=i.length;if(n<3)return 0;for(var r=0,s=0,o=0,a=0,l=n-1;a<n;l=a++){var h=i[l],c=i[a],u=h.x,g=h.y,d=(t=h.z)!==null&&t!==void 0?t:0,f=c.x,p=c.y,y=(e=c.z)!==null&&e!==void 0?e:0;r+=(d+y)*(g-p),s+=(u+f)*(d-y),o+=(g+p)*(u-f)}return .5*Math.hypot(r,s,o)}function Uc(i){return i.length<3?0:Dc(i)}function Oa(i){return i.length<3?0:Gc(i)}var ka=(function(){function i(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(i.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),i})(),Hc=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),ls=(function(i){Hc(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new _n().makeTranslation(e.x,e.y))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t})(ka),Wc=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),De=(function(i){Wc(t,i);function t(){var e=i.call(this)||this;return e.arcLengthDivisions=100,e}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},t.prototype.getPointAt=function(e){var n=this.getUtoTmapping(e);return this.getPoint(n)},t.prototype.getPoints=function(e){e===void 0&&(e=5);for(var n=[],r=0;r<=e;r++)n.push(this.getPoint(r/e));return n},t.prototype.getSpacedPoints=function(e){e===void 0&&(e=5);for(var n=[],r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n},t.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},t.prototype.getLengths=function(e){e===void 0&&(e=this.arcLengthDivisions);var n=[],r,s=this.getPoint(0),o=0;n.push(0);for(var a=1;a<=e;a++)r=this.getPoint(a/e),o+=r.distanceTo(s),n.push(o),s=r;return n},t.prototype.getUtoTmapping=function(e,n){var r=this.getLengths(),s=0,o=r.length,a;n?a=n:a=e*r[o-1];for(var l=0,h=o-1,c;l<=h;)if(s=Math.floor(l+(h-l)/2),c=r[s]-a,c<0)l=s+1;else if(c>0)h=s-1;else{h=s;break}if(s=h,r[s]===a)return s/(o-1);var u=r[s],g=r[s+1],d=g-u,f=(a-u)/d,p=(s+f)/(o-1);return p},t.prototype.getTangent=function(e){var n=1e-4,r=e-n,s=e+n;r<0&&(r=0),s>1&&(s=1);var o=this.getPoint(r),a=this.getPoint(s),l=new S;return l.copy(a).sub(o).normalize(),l},t.prototype.getTangentAt=function(e){var n=this.getUtoTmapping(e);return this.getTangent(n)},t})(ls),$c=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Sn=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ln=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},En=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},ut=(function(i){$c(t,i);function t(e,n,r,s,o){var a=i.call(this)||this,l=+(e!==void 0)+ +(n!==void 0)+ +(r!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(l==3)typeof e=="object"&&typeof n=="object"&&typeof r=="object"?a.createByThreePoints(e,n,r):a.createByStartEndPointsAndBulge(e,n,r);else if(l==5){var h=e;a.center=new S(h.x,h.y),a.radius=n,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(T.normalizeAngle(r)):T.normalizeAngle(r),a._endAngle=a._clockwise?a._mirrorAngle(T.normalizeAngle(s)):T.normalizeAngle(s)}else throw gt.ILLEGAL_PARAMETERS;return a}return t.prototype.createByThreePoints=function(e,n,r){var s=function(C,M){return{x:(C.x+M.x)/2,y:(C.y+M.y)/2}},o=function(C,M){return(M.y-C.y)/(M.x-C.x)},a=function(C){return-1/C},l=s(e,n),h=s(n,r),c=o(e,n),u=o(n,r),g=a(c),d=a(u),f=function(C,M,Y,N){var R=(N-M)/(C-Y),G=C*R+M;return{x:R,y:G}},p=l.y-g*l.x,y=h.y-d*h.x,_=f(g,p,d,y),x=Math.sqrt(Math.pow(e.x-_.x,2)+Math.pow(e.y-_.y,2)),P=function(C,M){return Math.atan2(C.y-M.y,C.x-M.x)},A=P(e,_),I=P(n,_),E=P(r,_),L=E>A&&E<I||A>E&&A<I||I>E&&I<A;this.center=_,this.radius=x,this._clockwise=!L,this._startAngle=A,this._endAngle=E},t.prototype.createByStartEndPointsAndBulge=function(e,n,r){var s,o,a;r<0?(s=Math.atan(-r)*4,o=new W(e),a=new W(n)):(s=Math.atan(r)*4,o=new W(n),a=new W(e));var l=new W().subVectors(a,o),h=l.length(),c=new W().addVectors(o,l.multiplyScalar(.5)),u=Math.abs(h/2/Math.tan(s/2)),g=l.normalize(),d=r<0?-Math.PI/2:Math.PI/2,f=new W(g.x*Math.cos(d)-g.y*Math.sin(d),g.y*Math.cos(d)+g.x*Math.sin(d)),p;s<Math.PI?r<0?p=c.add(f.multiplyScalar(u)):p=c.add(f.multiplyScalar(-u)):r<0?p=c.add(f.multiplyScalar(-u)):p=c.add(f.multiplyScalar(u)),r<0?(this._startAngle=Math.atan2(o.y-p.y,o.x-p.x),this._endAngle=Math.atan2(a.y-p.y,a.x-p.x)):(this._startAngle=Math.atan2(a.y-p.y,a.x-p.x),this._endAngle=Math.atan2(o.y-p.y,o.x-p.x)),this._clockwise=r<0,this.center=p,this.radius=a.sub(p).length()},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new S(e.x,e.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(e){this._startAngle=this._clockwise?this._mirrorAngle(T.normalizeAngle(e)):T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(e){var n=this.startAngle==0&&e==F?e:T.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(n):n,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype._mirrorAngle=function(e){var n=e*180/Math.PI,r=(360-n)%360;return r*Math.PI/180},t.prototype._getInternalAngle=function(e){return this._clockwise?this._mirrorAngle(e):e},Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this._getInternalAngle(this.startAngle),n=this._getInternalAngle(this.endAngle);return this.clockwise?T.normalizeAngle(e-n):T.normalizeAngle(n-e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this._getInternalAngle(this.startAngle),n=this._clockwise?T.normalizeAngle(e-this.deltaAngle/2):T.normalizeAngle(e+this.deltaAngle/2),r=this._clockwise?this._mirrorAngle(n):n;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){var e=this._getInternalAngle(this.startAngle),n=this._getInternalAngle(this.endAngle);return Math.abs(n-e)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,n,r=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=Sn(s),a=o.next();!a.done;a=o.next()){var l=a.value,h=this._getInternalAngle(l);T.isBetweenAngle(h,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&r.push(this.getPointAtAngle(l))}}catch(g){e={error:g}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}var c=r.map(function(g){return g.x}),u=r.map(function(g){return g.y});return new it(new S(Math.min.apply(Math,En([],Ln(c),!1)),Math.min.apply(Math,En([],Ln(u),!1))),new S(Math.max.apply(Math,En([],Ln(c),!1)),Math.max.apply(Math,En([],Ln(u),!1))))},Object.defineProperty(t.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){var n=this,r=e,s=this.center.clone().applyMatrix2d(r),o=this.startPoint.clone().applyMatrix2d(r);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=r.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(r),l=this.endPoint.clone().applyMatrix2d(r),h=new t(o,a,l),c=r.determinant()<0?!this.clockwise:this.clockwise,u=function(g){var d=T.normalizeAngle(g);return c?n._mirrorAngle(d):d};return this.center=h.center,this.radius=h.radius,this.clockwise=c,this.startAngle=u(Math.atan2(o.y-h.center.y,o.x-h.center.x)),this.endAngle=u(Math.atan2(l.y-h.center.y,l.x-h.center.x)),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},t.prototype.getPointAtAngle=function(e){var n=this._getInternalAngle(e),r=this.center.x+this.radius*Math.cos(n),s=this.center.y+this.radius*Math.sin(n);return new S(r,s)},t.prototype.getQuadrantPoints=function(){var e,n,r=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var l=Sn(a),h=l.next();!h.done;h=l.next()){var c=h.value,u=this._getInternalAngle(c);T.isBetweenAngle(u,s,o,this.clockwise)&&r.push(this.getPointAtAngle(c))}}catch(g){e={error:g}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}return r},t.prototype.nearestPoint=function(e){var n=new S(e.x,e.y),r=n.x-this.center.x,s=n.y-this.center.y,o=Math.hypot(r,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,r),l=this.clockwise?this._mirrorAngle(T.normalizeAngle(a)):T.normalizeAngle(a),h=this._getInternalAngle(l),c=this._getInternalAngle(this.startAngle),u=this._getInternalAngle(this.endAngle);if(T.isBetweenAngle(h,c,u,this.clockwise))return this.getPointAtAngle(l);var g=n.distanceToSquared(this.startPoint),d=n.distanceToSquared(this.endPoint);return g<=d?this.startPoint.clone():this.endPoint.clone()},t.prototype.perpendicularPoints=function(e){var n,r,s=new S(e.x,e.y),o=s.x-this.center.x,a=s.y-this.center.y,l=Math.hypot(o,a);if(l<1e-12)return[];var h=o/l,c=a/l,u=[new S(this.center.x+h*this.radius,this.center.y+c*this.radius),new S(this.center.x-h*this.radius,this.center.y-c*this.radius)],g=[],d=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var p=Sn(u),y=p.next();!y.done;y=p.next()){var _=y.value,x=Math.atan2(_.y-this.center.y,_.x-this.center.x),P=this.clockwise?this._mirrorAngle(T.normalizeAngle(x)):T.normalizeAngle(x),A=this._getInternalAngle(P);(this.closed||T.isBetweenAngle(A,d,f,this.clockwise))&&g.push(_)}}catch(I){n={error:I}}finally{try{y&&!y.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return g},t.prototype.tangentPoints=function(e){var n,r,s=[],o=e.x-this.center.x,a=e.y-this.center.y,l=Math.hypot(o,a),h=this.radius;if(l<h)return s;var c=Math.acos(h/l),u=Math.atan2(a,o),g=[u+c,u-c],d=this._getInternalAngle(this.startAngle),f=this._getInternalAngle(this.endAngle);try{for(var p=Sn(g),y=p.next();!y.done;y=p.next()){var _=y.value,x=this.clockwise?this._mirrorAngle(T.normalizeAngle(_)):T.normalizeAngle(_),P=this._getInternalAngle(x);(this.closed||T.isBetweenAngle(P,d,f,this.clockwise))&&s.push(this.getPointAtAngle(x))}}catch(A){n={error:A}}finally{try{y&&!y.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return s},t.prototype.getPoints=function(e){e===void 0&&(e=100);var n=[],r=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(r=F,s=0),this.clockwise)for(var o=0;o<=e;o++){var a=s-r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(l);n.push(new S(h.x,h.y))}else for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(l);n.push(new S(h.x,h.y))}return n},t})(De),Ki=function(){return Ki=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ki.apply(this,arguments)},qc=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},In=1e-6;function Na(i,t){if(mu(i)){var e=Zc(i,t);return e?[e]:[]}var n=Ba(i),r=n.numberOfVertices;if(r<2)return[];var s=bu(n,t);return s?[s]:[]}function Kc(i){return Ba(i)}function Zc(i,t){var e,n,r=Qc(i);if(r.length===0)return null;var s=[];try{for(var o=qc(r),a=o.next();!a.done;a=o.next()){var l=a.value,h=tu(l,t);if(!h)return null;s.push(h)}}catch(d){e={error:d}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}var c=Jc(i),u=ru(s,c,i.closed,t);if(u.length<2)return null;var g=new j;return u.forEach(function(d,f){g.addVertexAt(f,{x:d.x,y:d.y})}),g.closed=i.closed,g}function Qc(i){for(var t,e=[],n=i.numberOfVertices,r=i.closed?n:n-1,s=0;s<r;s++){var o=i.vertices[s],a=i.vertices[(s+1)%n];D.isPositive(Math.abs((t=o.bulge)!==null&&t!==void 0?t:0))?e.push({kind:"arc",arc:new ut(o,a,o.bulge)}):e.push({kind:"line",start:new S(o.x,o.y),end:new S(a.x,a.y)})}return e}function Jc(i){for(var t=[],e=0;e<i.numberOfVertices;e++)t.push(i.getPointAt(e));return t}function tu(i,t){if(i.kind==="line"){var e=iu(i.start,i.end,t);return e?Ki({kind:"line"},e):null}var n=eu(i.arc,i.arc.startPoint,i.arc.endPoint,t);return n?{kind:"arc",arc:n}:null}function eu(i,t,e,n){var r=nu(i,t,e,n),s=i.radius+r;return D.isNonPositive(s)?null:new ut(i.center,s,i.startAngle,i.endAngle,i.clockwise)}function nu(i,t,e,n){var r=e.x-t.x,s=e.y-t.y,o=Math.hypot(r,s);if(D.isNonPositive(o))return i.clockwise?-n:n;var a=-s/o,l=r/o,h=i.center.x-(t.x+e.x)/2,c=i.center.y-(t.y+e.y)/2,u=h*a+c*l>0;return u?-n:n}function iu(i,t,e){var n=t.x-i.x,r=t.y-i.y,s=Math.hypot(n,r);if(D.isNonPositive(s))return null;var o=-r/s*e,a=n/s*e;return{start:new S(i.x+o,i.y+a),end:new S(t.x+o,t.y+a),dx:n,dy:r}}function ru(i,t,e,n){var r,s,o,a=i.length;if(a===0)return[];for(var l=su(i,t,e,n),h=[(s=(r=l[0].nextSegmentStart)===null||r===void 0?void 0:r.clone())!==null&&s!==void 0?s:l[0].point.clone()],c=0;c<a;c++){var u=i[c],g=c===a-1&&!e?{point:cu(u)}:l[(c+1)%a];if(c>0&&l[c].filletPoints&&l[c].filletPoints.forEach(function(_){return h.push(_.clone())}),u.kind==="arc")for(var d=(o=l[c].nextSegmentStart)!==null&&o!==void 0?o:l[c].point,f=g.point,p=ou(u.arc,d,f,Math.max(16,32)),y=1;y<p.length;y++)h.push(p[y]);else h.push(g.point.clone())}return Fa(h)}function su(i,t,e,n){for(var r=i.length,s=[],o=0;o<r;o++)o===0?s.push(e?bo(i[r-1],i[0],t[0],n):{point:hu(i[0])}):s.push(bo(i[o-1],i[o],t[o],n));return s}function ou(i,t,e,n){for(var r=i.nearestPoint(t),s=i.nearestPoint(e),o=Zi(i,r),a=Zi(i,s),l=lu(i,o,a),h=[],c=0;c<=n;c++){var u=c/n,g=i.clockwise?o-l*u:o+l*u;h.push(i.getPointAtAngle(au(i,g)))}return h}function Zi(i,t){return Math.atan2(t.y-i.center.y,t.x-i.center.x)}function au(i,t){var e=T.normalizeAngle(t);return i.clockwise?Qi(e):e}function Qi(i){var t=i*180/Math.PI;return(360-t)%360*(Math.PI/180)}function lu(i,t,e){if(i.clockwise){var n=t-e;return D.isNonPositive(n)&&(n+=F),n}var r=e-t;return D.isNonPositive(r)&&(r+=F),r}function hu(i){return i.kind==="line"?i.start.clone():i.arc.startPoint.clone()}function cu(i){return i.kind==="line"?i.end.clone():i.arc.endPoint.clone()}function bo(i,t,e,n){return i.kind==="line"&&t.kind==="line"?{point:Ji({start:i.start,end:i.end,dx:i.dx,dy:i.dy},{start:t.start,end:t.end,dx:t.dx,dy:t.dy})}:i.kind==="line"&&t.kind==="arc"?wo(i,t.arc,e,n,!0):i.kind==="arc"&&t.kind==="line"?wo(t,i.arc,e,n,!1):i.kind==="arc"&&t.kind==="arc"?uu(i.arc,t.arc,e,n):{point:e.clone()}}function uu(i,t,e,n){var r=Ya(i.endPoint,t.startPoint),s=yu(i,t),o=s.filter(function(c){return Bn(i,c)&&Bn(t,c)});if(o.length>0)return{point:Xa(o,r)};var a=i.endPoint.clone(),l=t.startPoint.clone(),h=Ra(e,Math.abs(n),a,l);return{point:a,filletPoints:h,nextSegmentStart:l}}function wo(i,t,e,n,r){var s=Ya(r?i.end:i.start,r?t.startPoint:t.endPoint),o=pu(i,t,s);if(gu(i,o)&&Bn(t,o))return{point:o};var a=du(i,e,n),l=r?t.startPoint.clone():t.endPoint.clone(),h=Ra(e,Math.abs(n),r?a:l,r?l:a);return r?{point:a,filletPoints:h,nextSegmentStart:l}:{point:l,filletPoints:h,nextSegmentStart:a}}function du(i,t,e){var n=Math.hypot(i.dx,i.dy),r=-i.dy/n*e,s=i.dx/n*e;return new S(t.x+r,t.y+s)}function gu(i,t){var e=Math.hypot(i.dx,i.dy);if(D.isNonPositive(e))return!1;var n=i.dx/e,r=i.dy/e,s=t.x-i.start.x,o=t.y-i.start.y,a=Math.abs(s*r-o*n);return D.equalToZero(a)}function Ra(i,t,e,n){var r=Math.atan2(e.y-i.y,e.x-i.x),s=Math.atan2(n.y-i.y,n.x-i.x),o=fu(r,s);if(D.equalToZero(Math.abs(o)))return[];for(var a=[],l=Math.max(2,Math.ceil(Math.abs(o)/Math.PI*16)),h=1;h<l;h++){var c=h/l,u=r+o*c;a.push(new S(i.x+t*Math.cos(u),i.y+t*Math.sin(u)))}return a}function fu(i,t){for(var e=t-i;e>Math.PI;)e-=F;for(;e<=-Math.PI;)e+=F;return e}function pu(i,t,e){var n=Math.hypot(i.dx,i.dy);if(D.isNonPositive(n))return e.clone();var r=i.dx/n,s=i.dy/n,o=i.start.x-t.center.x,a=i.start.y-t.center.y,l=2*(o*r+a*s),h=o*o+a*a-t.radius*t.radius,c=l*l-4*h;if(c<0)return e.clone();var u=Math.sqrt(c),g=[(-l-u)/2,(-l+u)/2].map(function(f){return new S(i.start.x+r*f,i.start.y+s*f)}),d=g.filter(function(f){return Bn(t,f)});return Xa(d.length>0?d:g,e)}function Bn(i,t){var e=Math.abs(Math.hypot(t.x-i.center.x,t.y-i.center.y)-i.radius);if(D.isPositive(e))return!1;var n=Zi(i,t),r=i.clockwise?Qi(T.normalizeAngle(i.startAngle)):T.normalizeAngle(i.startAngle),s=i.clockwise?Qi(T.normalizeAngle(i.endAngle)):T.normalizeAngle(i.endAngle);return T.isBetweenAngle(n,r,s,i.clockwise)}function yu(i,t){var e=t.center.x-i.center.x,n=t.center.y-i.center.y,r=Math.hypot(e,n);if(D.isNonPositive(r))return[];var s=i.radius+t.radius,o=Math.abs(i.radius-t.radius);if(r>s+In)return[];if(r<o-In)return[];var a=(i.radius*i.radius-t.radius*t.radius+r*r)/(2*r),l=i.radius*i.radius-a*a;if(l<-In)return[];var h=i.center.x+a*e/r,c=i.center.y+a*n/r;if(l<=In)return[new S(h,c)];var u=Math.sqrt(l),g=-n*u/r,d=e*u/r;return[new S(h+g,c+d),new S(h-g,c-d)]}function Xa(i,t){for(var e=i[0],n=e.distanceToSquared(t),r=1;r<i.length;r++){var s=i[r].distanceToSquared(t);s<n&&(e=i[r],n=s)}return e.clone()}function Ya(i,t){return new S((i.x+t.x)/2,(i.y+t.y)/2)}function mu(i){for(var t,e=i.numberOfVertices,n=i.closed?e:e-1,r=0;r<n;r++){var s=i.vertices[r];if(D.isPositive(Math.abs((t=s.bulge)!==null&&t!==void 0?t:0)))return!0}return!1}function Ba(i){var t=_u(i.vertices.map(function(e){return new S(e.x,e.y)}),i.closed);return t.length===i.numberOfVertices?i:new j(t.map(function(e){return{x:e.x,y:e.y}}),i.closed)}function _u(i,t){var e=Fa(i);if(!t||e.length<2)return e;var n=e[0],r=e[e.length-1];return D.isNonPositive(Math.hypot(n.x-r.x,n.y-r.y))&&e.pop(),e}function Fa(i){var t=[];return i.forEach(function(e){var n=t[t.length-1];(!n||D.isPositive(Math.hypot(n.x-e.x,n.y-e.y)))&&t.push(new S(e.x,e.y))}),t}function bu(i,t){for(var e=[],n=0;n<i.numberOfVertices;n++)e.push(i.getPointAt(n));var r=wu(e,i.closed,t);if(r.length===0)return null;var s=[];if(i.closed){if(r.length<2)return null;for(var o=r.length,n=0;n<o;n++){var a=r[(n-1+o)%o],l=r[n];s.push(Ji(a,l))}}else{s.push(r[0].start);for(var n=1;n<r.length;n++)s.push(Ji(r[n-1],r[n]));s.push(r[r.length-1].end)}var h=new j;return s.forEach(function(c,u){h.addVertexAt(u,{x:c.x,y:c.y})}),h.closed=i.closed,h}function wu(i,t,e){for(var n=[],r=t?i.length:i.length-1,s=0;s<r;s++){var o=i[s],a=i[t?(s+1)%i.length:s+1],l=a.x-o.x,h=a.y-o.y,c=Math.hypot(l,h);if(!D.isNonPositive(c)){var u=-h/c*e,g=l/c*e;n.push({start:new S(o.x+u,o.y+g),end:new S(a.x+u,a.y+g),dx:l,dy:h})}}return n}function Ji(i,t){var e=i.dx*t.dy-i.dy*t.dx;if(D.equalToZero(e))return new S((i.end.x+t.start.x)/2,(i.end.y+t.start.y)/2);var n=t.start.x-i.start.x,r=t.start.y-i.start.y,s=(n*t.dy-r*t.dx)/e;return new S(i.start.x+s*i.dx,i.start.y+s*i.dy)}var xu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),tr=function(){return tr=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},tr.apply(this,arguments)},j=(function(i){xu(t,i);function t(e,n){e===void 0&&(e=null),n===void 0&&(n=!1);var r=i.call(this)||this;return r._vertices=e||new Array,r._closed=n,r}return Object.defineProperty(t.prototype,"vertices",{get:function(){return this._vertices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numberOfVertices",{get:function(){return this._vertices.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this._closed=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this.numberOfVertices>0){var e=this._vertices[0];return new S(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this.numberOfVertices;if(e>0)if(this.closed){var n=this._vertices[0];return new S(n.x,n.y)}else{var n=this._vertices[e-1];return new S(n.x,n.y)}throw new Error("End point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){for(var e=0,n=this._vertices.length,r=0;r<n;++r){var s=this._vertices[r],o=null;if(r<n-1?o=this._vertices[r+1]:r==n-1&&this.closed&&(o=this._vertices[0]),o)if(s.bulge){var a=new ut(s,o,s.bulge);e+=a.length}else e+=new S(s.x,s.y).distanceTo(o)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed||this._vertices.length<3)return 0;var e=this.getPoints(128);return Uc(e)},enumerable:!1,configurable:!0}),t.prototype.addVertexAt=function(e,n){e<=0?this._vertices.unshift(n):this._vertices.splice(e,0,n),this._boundingBoxNeedsUpdate=!0},t.prototype.removeVertexAt=function(e){if(e<0||e>=this._vertices.length)throw new Error("Index ".concat(e," is out of bounds. Valid range is 0 to ").concat(this._vertices.length-1,"."));this._vertices.splice(e,1),this._boundingBoxNeedsUpdate=!0},t.prototype.reset=function(e,n){e?n!==void 0&&n>=0&&n<this._vertices.length&&(this._vertices=this._vertices.slice(0,n),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)},t.prototype.getPointAt=function(e){var n=this._vertices[e];return new S(n.x,n.y)},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new it().setFromPoints(e)},t.prototype.transform=function(e){var n=e.determinant()<0;return this._vertices.forEach(function(r){var s=new S(r).applyMatrix2d(e);r.x=s.x,r.y=s.y,n&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._vertices.map(function(e){return tr({},e)}),this._closed)},t.prototype.getPoints3d=function(e,n){var r=[],s=this.getPoints(e);return s.forEach(function(o){return r.push(new m().set(o.x,o.y,n))}),r},t.prototype.getPoints=function(e){for(var n=[],r=this._vertices.length,s=0;s<r;++s){var o=this._vertices[s];if(o.bulge){var a=null;if(s<r-1?a=this._vertices[s+1]:s==r-1&&this.closed&&(a=this._vertices[0]),a)for(var l=new ut(o,a,o.bulge),h=l.getPoints(e),c=h.length,u=0;u<c;++u){var g=h[u];n.push(new S(g.x,g.y))}}else n.push(new S(o.x,o.y)),s==r-1&&this.closed&&n.push(n[0])}return n},t.prototype.offset=function(e){return Na(this,e)},t})(De);function za(i,t,e){var n=Math.hypot(t.x,t.y);if(D.isNonPositive(n))return null;var r=-t.y/n*e,s=t.x/n*e;return new m(i.x+r,i.y+s,i.z)}function vu(i,t,e){var n;if(i.length<2)return null;var r=Kc(new j(i.map(function(o){return{x:o.x,y:o.y}}),t)),s=Na(r,e);return(n=s[0])!==null&&n!==void 0?n:null}var Fn=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Oe=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))};function Pu(i,t,e,n){if(i.length<2||D.equalToZero(e))return null;var r=ja(i,n),s=r.points,o=r.tangents;if(s.length<2)return null;var a=o??Au(s,t),l=Su(s,a,e),h=t?Eu(l):Lu(l);if(h.length<2)return null;var c=new j;return h.forEach(function(u,g){c.addVertexAt(g,{x:u.x,y:u.y})}),c.closed=t,c}function Au(i,t){for(var e=i.length,n=new Array(e),r=0;r<e;r++){var s=0,o=0;if(t){var a=i[(r-1+e)%e],l=i[(r+1)%e];s=l.x-a.x,o=l.y-a.y}else r===0?(s=i[1].x-i[0].x,o=i[1].y-i[0].y):r===e-1?(s=i[e-1].x-i[e-2].x,o=i[e-1].y-i[e-2].y):(s=i[r+1].x-i[r-1].x,o=i[r+1].y-i[r-1].y);var h=Math.hypot(s,o);D.isNonPositive(h)?n[r]=new S(1,0):n[r]=new S(s/h,o/h)}return n}function Su(i,t,e){return i.map(function(n,r){var s=t[r],o=-s.y*e,a=s.x*e;return new S(n.x+o,n.y+a)})}function Lu(i){var t=zn(i);if(t.length<3)return t;for(;;){var e=Va(t,!1);if(!e||(t=zn(Oe(Oe(Oe([],Fn(t.slice(0,e.segmentA+1)),!1),[e.point],!1),Fn(t.slice(e.segmentB+1)),!1)),t.length<2))break}return t}function Eu(i){var t=zn(i);if(t.length<4)return t;for(;;){var e=Va(t,!0);if(!e||(t=zn(Oe(Oe(Oe([],Fn(t.slice(0,e.segmentA+1)),!1),[e.point],!1),Fn(t.slice(e.segmentB+1)),!1)),t.length<3))break}return t}function Va(i,t){var e=t?i.length:i.length-1;if(e<2)return null;for(var n=0;n<e;n++)for(var r=i[n],s=i[(n+1)%i.length],o=n+1;o<e;o++)if(!Iu(n,o,e,t)){var a=i[o],l=i[(o+1)%i.length],h=Mu(r,s,a,l);if(h)return{point:h,segmentA:n,segmentB:o}}return null}function Iu(i,t,e,n){return!!(t===i||t===i+1||n&&i===0&&t===e-1)}function Mu(i,t,e,n){var r=t.x-i.x,s=t.y-i.y,o=n.x-e.x,a=n.y-e.y,l=r*a-s*o;if(D.equalToZero(l))return null;var h=e.x-i.x,c=e.y-i.y,u=(h*a-c*o)/l,g=(h*s-c*r)/l,d=li.equalPointTol;return u<-d||u>1+d||g<-d||g>1+d?null:new S(i.x+u*r,i.y+u*s)}function ja(i,t){var e=[],n=[],r=t!=null&&t.length===i.length;return i.forEach(function(s,o){var a=e[e.length-1];if((!a||D.isPositive(Math.hypot(a.x-s.x,a.y-s.y)))&&(e.push(new S(s.x,s.y)),r)){var l=t[o];n.push(new S(l.x,l.y))}}),{points:e,tangents:r?n:void 0}}function zn(i){return ja(i).points}var Tu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Et=(function(i){Tu(t,i);function t(){var e=i.call(this)||this;return e._loops=[],e}return t.prototype.add=function(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"loops",{get:function(){return this._loops},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outter",{get:function(){if(this._loops.length>0)return this._loops[0]},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.outter;return e?e.box:new it},t.prototype.transform=function(e){return this._loops.forEach(function(n){n.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){var e=new t;return this._loops.forEach(function(n){e.add(n.clone())}),e},t.prototype.getPoints=function(e){for(var n=[],r=0;r<this.loops.length;++r){var s=this.loops[r],o=s.getPoints(e);n.push(o)}return n},t.prototype.buildHierarchy=function(){for(var e,n=this.getPoints(100),r=this.calculateBoundaryBoxes(n),s=this.sortBoundaryBoxesByAreas(r),o=new Map,a=s.length,l=0;l<a;l++)o.set(s[l],{index:s[l],children:[]});for(var h={index:-1,children:[]},l=0;l<a;l++){for(var c=s[l],u=n[c],g=r[c],d=l+1;d<a;d++){var f=s[d],p=n[f],y=r[f];if(y.containsBox(g)&&ot.isPointInPolygon(u[T.randInt(0,u.length-1)],p)){(e=o.get(f))===null||e===void 0||e.children.push(o.get(c));break}}d===a&&h.children.push(o.get(c))}return h},Object.defineProperty(t.prototype,"area",{get:function(){if(this._loops.length===0)return 0;for(var e=0,n=0;n<this._loops.length;n++){var r=this._loops[n],s=r.getPoints(128),o=Ca(s);n===0?e+=Math.abs(o):e-=Math.abs(o)}return e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundaryBoxes=function(e){var n=[];return e.forEach(function(r){n.push(new it().setFromPoints(r))}),n},t.prototype.sortBoundaryBoxesByAreas=function(e){var n=[];e.forEach(function(s,o){var a=s.size,l=a.width*a.height;n.push({area:l,index:o})}),n.sort(function(s,o){return s.area-o.area});var r=[];return n.forEach(function(s){r.push(s.index)}),r},t})(ls),Cu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Ou=(function(i){Cu(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new O().makeTranslation(e.x,e.y,e.z))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t})(ka),ku=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),bn=(function(i){ku(t,i);function t(){return i!==null&&i.apply(this,arguments)||this}return t})(Ou),Nu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Ut=(function(i){Nu(t,i);function t(e,n){var r=i.call(this)||this;return r._start=new m(e),r._end=new m(n),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return new b().subVectors(this.endPoint,this.startPoint).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){return new m((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){return this.project(e)},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.isPointOnLine=function(e){var n=this.project(e),r=1e-6;return n.distanceTo(e)<r},t.prototype.at=function(e,n){return this.delta(n).multiplyScalar(e).add(this._start)},t.prototype.atLength=function(e,n){if(n===void 0&&(n=!1),n){var r=this.delta(le).normalize();return new m(this._start).addScaledVector(r,e)}else{var r=this.delta(le).normalize();return new m(this._end).addScaledVector(r,e)}},t.prototype.extend=function(e,n){if(n===void 0&&(n=!1),n){var r=le.subVectors(this._start,this._end).normalize();this._start=new m(this._start).addScaledVector(r,e)}else{var r=this.delta(le).normalize();this._end=new m(this._end).addScaledVector(r,e)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.closestPointToPointParameter=function(e,n){xo.subVectors(e,this._start),Mn.subVectors(this.endPoint,this.startPoint);var r=Mn.dot(Mn),s=Mn.dot(xo),o=s/r;return n&&(o=T.clamp(o,0,1)),o},t.prototype.closestPointToPoint=function(e,n,r){var s=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(s).add(this._start)},t.prototype.delta=function(e){return e.subVectors(this._end,this._start)},t.prototype.distanceSq=function(){return this._start.distanceToSquared(this._end)},t.prototype.distance=function(){return this._start.distanceTo(this._end)},t.prototype.project=function(e){var n=this.direction,r=le.subVectors(e,this.startPoint),s=r.dot(n);return new m().copy(n).multiplyScalar(s).add(this.startPoint)},t.prototype.perpPoint=function(e){var n=this.direction,r=this.startPoint,s=le.subVectors(e,r),o=s.dot(n),a=le.copy(n).multiplyScalar(o);return new m().addVectors(r,a)},t.prototype.calculateBoundingBox=function(){var e=new m(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),n=new m(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new k(e,n)},t.prototype.transform=function(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.offset=function(e){var n=this.startPoint,r=this.endPoint,s=Math.hypot(r.x-n.x,r.y-n.y);if(s===0)return this.clone();var o=new b(r.x-n.x,r.y-n.y,0).normalize(),a=new b(-o.y,o.x,0);return new t(new m(n.x+a.x*e,n.y+a.y*e,n.z),new m(r.x+a.x*e,r.y+a.y*e,r.z))},t})(bn),le=new b,xo=new b,Mn=new b,Ru=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Ei=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},kt=(function(i){Ru(t,i);function t(e,n,r,s,o,a){a===void 0&&(a=b.X_AXIS);var l=i.call(this)||this;return l.center=e,l.radius=n,l.startAngle=r,l.endAngle=s,l.normal=o,l.refVec=a,(s-r)%F==0?(l.startAngle=0,l.endAngle=F):(l.startAngle=r,l.endAngle=s),l}return t.computeCenterPoint=function(e,n,r){var s=new b().addVectors(e,n).multiplyScalar(.5),o=new b().addVectors(e,r).multiplyScalar(.5),a=new b().subVectors(n,e),l=new b().subVectors(r,e),h=new b().crossVectors(a,l).normalize();if(h.lengthSq()===0)return null;var c=new b().crossVectors(a,h).normalize(),u=new b().crossVectors(l,h).normalize(),g=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=u.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),f=new Ut(s,s.clone().add(g)),p=new Ut(o,o.clone().add(d)),y=new b,_=f.closestPointToPoint(p.startPoint,!0,y);return _?y:null},t.createByThreePoints=function(e,n,r){var s=t.computeCenterPoint(e,n,r);if(s){var o=s.distanceTo(e),a=new b().subVectors(e,s),l=new b().subVectors(n,s),h=Math.atan2(a.y,a.x),c=Math.atan2(l.y,l.x);return new t(s,o,h,c,b.Z_AXIS)}},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){if(e<0)throw gt.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==F?e:T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return T.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new b(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refVec",{get:function(){return this._refVec},set:function(e){this._refVec=new b(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,n=this.deltaAngle;this.closed&&(e=0,n=F);var r=e+n*.5;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:0},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){var n=new b(e.x,e.y,e.z||0),r=this.center,s=this.normal,o=n.clone().sub(r),a=o.dot(s),l=n.clone().sub(s.clone().multiplyScalar(a)),h=l.clone().sub(r);if(h.lengthSq()===0)return this.startPoint.clone();h.normalize().multiplyScalar(this.radius);var c=r.clone().add(h),u=this.getAngle(c.clone()),g=this.startAngle,d=this.deltaAngle,f=T.normalizeAngle(u-g);f<0&&(f=0),f>d&&(f=d);var p=this.getPointAtAngle(g+f),y=p.distanceTo(n),_=this.startPoint.distanceTo(n),x=this.endPoint.distanceTo(n);return _<y&&_<=x?this.startPoint.clone():x<y&&x<_?this.endPoint.clone():p},t.prototype.tangentPoints=function(e){var n,r,s=[],o=new b(e.x,e.y,e.z||0),a=this.center,l=this.normal,h=this.radius,c=o.clone().sub(a),u=c.dot(l),g=o.clone().sub(l.clone().multiplyScalar(u)),d=a.clone(),f=g.clone().sub(d),p=f.length();if(p<h)return s;var y=Math.acos(h/p),_=this.getAngle(g.clone()),x=[_+y,_-y];try{for(var P=Ei(x),A=P.next();!A.done;A=P.next()){var I=A.value,E=T.normalizeAngle(I-this.startAngle);E>=0&&E<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+E))}}catch(L){n={error:L}}finally{try{A&&!A.done&&(r=P.return)&&r.call(P)}finally{if(n)throw n.error}}return s},t.prototype.perpendicularPoints=function(e){var n,r,s=[],o=new b(e.x,e.y,e.z||0),a=this.center,l=this.normal,h=this.radius,c=o.clone().sub(a),u=c.dot(l),g=o.clone().sub(l.clone().multiplyScalar(u)),d=g.clone().sub(a);if(d.lengthSq()<1e-24)return s;d.normalize();var f=[a.clone().add(d.clone().multiplyScalar(h)),a.clone().sub(d.clone().multiplyScalar(h))];try{for(var p=Ei(f),y=p.next();!y.done;y=p.next()){var _=y.value,x=this.getAngle(_.clone()),P=T.normalizeAngle(x-this.startAngle);P>=0&&P<=this.deltaAngle&&s.push(new m(_.x,_.y,_.z||0))}}catch(A){n={error:A}}finally{try{y&&!y.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return s},t.prototype.nearestTangentPoint=function(e){var n=this.tangentPoints(e);if(n.length===0)return null;var r=new m(e.x,e.y,e.z||0);return n.length===1||n[0].distanceTo(r)<n[1].distanceTo(r)?n[0]:n[1]},t.prototype.calculateBoundingBox=function(){for(var e,n,r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)T.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,h=-1/0,c=-1/0,u=-1/0;try{for(var g=Ei(r),d=g.next();!d.done;d=g.next()){var f=d.value,p=this.getPointAtAngle(f);p.x<o&&(o=p.x),p.y<a&&(a=p.y),p.z<l&&(l=p.z),p.x>h&&(h=p.x),p.y>c&&(c=p.y),p.z>u&&(u=p.z)}}catch(y){e={error:y}}finally{try{d&&!d.done&&(n=g.return)&&n.call(g)}finally{if(e)throw e.error}}return new k({x:o,y:a,z:l},{x:h,y:c,z:u})},Object.defineProperty(t.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var n=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=F,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);n.push(l)}return n},t.prototype.transform=function(e){var n=this.center.clone().applyMatrix4(e),r=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new b(r).sub(n).normalize(),l=n.distanceTo(r),h=new b().crossVectors(new b(r).sub(n),new b(o).sub(n)).normalize();h.lengthSq()===0&&(h=this.normal.clone().transformDirection(e));var c=function(u){var g=new b(u).sub(n);return Math.atan2(g.dot(vo.crossVectors(h,a)),g.dot(a))};return this.center=n,this.radius=l,this.normal=h,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?F:c(s),this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},t.prototype.getAngle=function(e){return e.sub(this.center),Math.atan2(e.dot(vo.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))},t.prototype.getPointAtAngle=function(e){var n=this.normal,r=this.refVec,s={x:n.y*r.z-n.z*r.y,y:n.z*r.x-n.x*r.z,z:n.x*r.y-n.y*r.x},o=this.center,a=this.radius;return new m(o.x+a*(r.x*Math.cos(e)+s.x*Math.sin(e)),o.y+a*(r.y*Math.cos(e)+s.y*Math.sin(e)),o.z+a*(r.z*Math.cos(e)+s.z*Math.sin(e)))},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new b(this.center).distanceTo(ss);return new os(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var n=this.radius+e;return n<=0?null:new t(this.center,n,this.startAngle,this.endAngle,this.normal,this.refVec)},t})(bn),vo=new b,Xu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),de=(function(i){Xu(t,i);function t(e,n,r,s,o,a,l){s===void 0&&(s=0),o===void 0&&(o=F),a===void 0&&(a=!1),l===void 0&&(l=0);var h=i.call(this)||this;return h.center=e,h.majorAxisRadius=n,h.minorAxisRadius=r,(o-s)%F==0?(h.startAngle=0,h.endAngle=F):(h.startAngle=s,h.endAngle=o),h.clockwise=a,h.rotation=l,h}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw gt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw gt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==F?e:T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return T.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){for(var e=100,n=1/0,r=1/0,s=-1/0,o=-1/0,a=0;a<=e;a++){var l=this.getPoint(a/e);n=Math.min(n,l.x),r=Math.min(r,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y)}return new it({x:n,y:r},{x:s,y:o})},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){for(var n=Math.PI*2,r=this.endAngle-this.startAngle,s=Math.abs(r)<Number.EPSILON;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise===!0&&!s&&(r===n?r=-n:r=r-n);var o=this.startAngle+e*r,a=this.center.x+this.majorAxisRadius*Math.cos(o),l=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var h=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,g=l-this.center.y;a=u*h-g*c+this.center.x,l=u*c+g*h+this.center.y}return new S(a,l)},t.prototype.transform=function(e){var n=e,r=new S(this.center).applyMatrix2d(n),s=new m(r.x,r.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(n),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(n),l=new S(o).sub(r),h=new S(a).sub(r),c=l.length(),u=h.length(),g=Math.atan2(l.y,l.x),d=l.clone().normalize(),f=h.clone().normalize(),p=function(x){var P=new S(x).sub(r),A=P.dot(d),I=P.dot(f);return T.normalizeAngle(Math.atan2(I/u,A/c))},y=n.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new t(s,c,u,0,F,y,g):new t(s,c,u,p(this.startPoint.clone().applyMatrix2d(n)),p(this.endPoint.clone().applyMatrix2d(n)),y,g);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this},t.prototype.getPointAtAngle=function(e){return this.getPoint(this.closed?e/F:T.normalizeAngle(e-this.startAngle)/this.deltaAngle)},t.prototype.copy=function(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this},t.prototype.clone=function(){return new t(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},t.prototype.getFocusPoints=function(){var e=Math.max(this.majorAxisRadius,this.minorAxisRadius),n=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(e-n<1e-9)return[];var r=Math.sqrt(e*e-n*n),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,l=a?s:-o,h=a?o:s;return[new S(this.center.x-r*l,this.center.y-r*h),new S(this.center.x+r*l,this.center.y+r*h)]},t.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},t.prototype.nearestPoint=function(e){for(var n=new S(e.x,e.y),r=this.getPoint(0),s=n.distanceToSquared(r),o=72,a=1;a<=o;a++){var l=this.getPoint(a/o),h=n.distanceToSquared(l);h<s&&(s=h,r=l)}return r},t.prototype.tangentPoints=function(e){var n=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,h){var c=-n.majorAxisRadius*h,u=n.minorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var n=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,h){var c=n.minorAxisRadius*l,u=n.majorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype._projectPointToLocal=function(e){var n=e.x-this.center.x,r=e.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:n*s-r*o,y:n*o+r*s}},t.prototype._findSnapAngles=function(e,n,r){r===void 0&&(r=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,l=this.deltaAngle,h=[],c=function(A){var I=Math.cos(A),E=Math.sin(A);return n(s*I,o*E,I,E)},u=a,g=c(u),d=1;d<=r;d++){var f=a+l*d/r,p=c(f);if(Math.abs(g)<1e-10&&h.push(u),g*p<0){for(var y=u,_=f,x=0;x<32;x++){var P=(y+_)/2;c(y)*c(P)<=0?_=P:y=P}h.push((y+_)/2)}u=f,g=p}return h},t})(De),Yu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Bu=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},hs=(function(i){Yu(t,i);function t(e,n,r,s,o,a,l){a===void 0&&(a=0),l===void 0&&(l=F);var h=i.call(this)||this;h.center=e,h.normal=n,h.majorAxis=r,h.majorAxisRadius=s,h.minorAxisRadius=o;var c=Math.abs(l-a);return Math.abs(c-F)<1e-10||Math.abs(c-2*F)<1e-10?(h.startAngle=0,h.endAngle=F):(h.startAngle=a,h.endAngle=l),h}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw gt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw gt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==F?e:T.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this.endAngle-this.startAngle;return Math.abs(e-F)<1e-10?F:T.normalizeAngle(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new b(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(e){this._majorAxis=new b(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxis",{get:function(){return new b().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,n=this.deltaAngle;(this.closed||Math.abs(n-F)<1e-10)&&(e=0,n=F);var r=e+n/2;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCircular",{get:function(){return D.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var e=1e3,n=this.deltaAngle/e,r=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=e;o++){var a=this.startAngle+o*n,l=this.getPointAtAngle(a),h=l.x-s.x,c=l.y-s.y,u=l.z-s.z;r+=Math.sqrt(h*h+c*c+u*u),s=l}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return Math.abs(this.deltaAngle-F)>=1e-10?0:Math.PI*this.majorAxisRadius*this.minorAxisRadius},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,n;if(this.majorAxis.equals(b.X_AXIS)||this.majorAxis.equals(b.Y_AXIS)||this.majorAxis.isParallelTo(b.X_AXIS)||this.majorAxis.isParallelTo(b.Y_AXIS)){for(var r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)T.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,h=-1/0,c=-1/0,u=-1/0;try{for(var g=Bu(r),d=g.next();!d.done;d=g.next()){var f=d.value,p=this.getPointAtAngle(f);p.x<o&&(o=p.x),p.y<a&&(a=p.y),p.z<l&&(l=p.z),p.x>h&&(h=p.x),p.y>c&&(c=p.y),p.z>u&&(u=p.z)}}catch(_){e={error:_}}finally{try{d&&!d.done&&(n=g.return)&&n.call(g)}finally{if(e)throw e.error}}return new k({x:o,y:a,z:l},{x:h,y:c,z:u})}else{for(var y=100,o=1/0,a=1/0,l=1/0,h=-1/0,c=-1/0,u=-1/0,s=0;s<=y;s++){var f=this.startAngle+this.deltaAngle*(s/y),p=this.getPointAtAngle(f);o=Math.min(o,p.x),a=Math.min(a,p.y),l=Math.min(l,p.z),h=Math.max(h,p.x),c=Math.max(c,p.y),u=Math.max(u,p.z)}return new k({x:o,y:a,z:l},{x:h,y:c,z:u})}},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){e===void 0&&(e=100);var n=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=F,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);n.push(l)}return n},t.prototype.getPointAtAngle=function(e){var n=Math.cos(e),r=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(r),o=this.majorAxis.clone().multiplyScalar(n*this.majorAxisRadius).add(s);return new m(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},t.prototype.nearestPoint=function(e,n){n===void 0&&(n=72);for(var r=new m(e.x,e.y,e.z||0),s=this.getPointAtAngle(this.startAngle),o=r.distanceToSquared(s),a=1;a<=n;a++){var l=this.startAngle+this.deltaAngle*a/n,h=this.getPointAtAngle(l),c=r.distanceToSquared(h);c<o&&(o=c,s=h)}var u=r.distanceToSquared(this.startPoint),g=r.distanceToSquared(this.endPoint);return u<o&&u<=g?this.startPoint.clone():g<o&&g<u?this.endPoint.clone():s.clone()},t.prototype.tangentPoints=function(e){var n=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,h){var c=-n.majorAxisRadius*h,u=n.minorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var n=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,h){var c=n.minorAxisRadius*l,u=n.majorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return n.getPointAtAngle(o)})},t.prototype._projectPointToLocalPlane=function(e){var n=new m(e.x,e.y,e.z||0),r=new b(n).sub(this.center),s=r.dot(this.normal);return r.sub(this.normal.clone().multiplyScalar(s)),{x:r.dot(this.majorAxis),y:r.dot(this.minorAxis)}},t.prototype._findSnapParameterAngles=function(e,n){n===void 0&&(n=144);for(var r=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,l=[],h=function(P){var A=Math.cos(P),I=Math.sin(P);return e(r*A,s*I,A,I)},c=o,u=h(c),g=1;g<=n;g++){var d=o+a*g/n,f=h(d);if(Math.abs(u)<1e-10&&l.push(c),u*f<0){for(var p=c,y=d,_=0;_<32;_++){var x=(p+y)/2;h(p)*h(x)<=0?y=x:p=x}l.push((p+y)/2)}c=d,u=f}return l},t.prototype.contains=function(e){var n=new b(e).sub(this.center),r=n.dot(this.majorAxis),s=n.dot(this.minorAxis),o=r/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},t.prototype.transform=function(e){var n=e,r=this.center.clone().applyMatrix4(n),s=this.getPointAtAngle(0).clone().applyMatrix4(n),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(n),a=new b(s).sub(r),l=new b(o).sub(r),h=a.length(),c=l.length(),u=a.clone().normalize(),g=new b().crossVectors(a,l).normalize(),d=new b().crossVectors(g,u).normalize();d.dot(l)<0&&(g.negate(),d=new b().crossVectors(g,u).normalize());var f=function(y){var _=new b(y).sub(r),x=_.dot(u),P=_.dot(d);return T.normalizeAngle(Math.atan2(P/c,x/h))},p=this.closed?new t(r,g,u,h,c,0,F):new t(r,g,u,h,c,f(this.startPoint.clone().applyMatrix4(n)),f(this.endPoint.clone().applyMatrix4(n)));return this.center=p.center,this.normal=p.normal,this.majorAxis=p.majorAxis,this.majorAxisRadius=p.majorAxisRadius,this.minorAxisRadius=p.minorAxisRadius,this._startAngle=p._startAngle,this._endAngle=p._endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new b(this.center).distanceTo(ss);return new os(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var n=this.majorAxisRadius+e,r=this.minorAxisRadius+e;return n<=0||r<=0?null:new t(this.center,this.normal,this.majorAxis,n,r,this.startAngle,this.endAngle)},t})(bn),Fu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Nt=(function(i){Fu(t,i);function t(e,n){var r=i.call(this)||this;return r._start=new S(e),r._end=new S(n),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=new S(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),n=new S(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new it(e,n)},t.prototype.transform=function(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.project=function(e){var n=this._end.x-this._start.x,r=this._end.y-this._start.y,s=n*n+r*r;if(s<1e-18)return this._start.clone();var o=((e.x-this._start.x)*n+(e.y-this._start.y)*r)/s;return o=Math.max(0,Math.min(1,o)),new S(this._start.x+o*n,this._start.y+o*r)},t.prototype.nearestPoint=function(e){return this.project(e)},t})(De),zu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Ii=(function(){function i(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return i.prototype.init=function(t,e,n,r){this.c0=t,this.c1=n,this.c2=-3*t+3*e-2*n-r,this.c3=2*t-2*e+n+r},i.prototype.initCatmullRom=function(t,e,n,r,s){this.init(e,n,s*(n-t),s*(r-e))},i.prototype.initNonuniformCatmullRom=function(t,e,n,r,s,o,a){var l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,h=(n-e)/o-(r-e)/(o+a)+(r-n)/a;l*=o,h*=o,this.init(e,n,l,h)},i.prototype.calc=function(t){var e=t*t,n=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*n},i})(),Da=(function(i){zu(t,i);function t(e,n,r,s){e===void 0&&(e=[]),n===void 0&&(n=!1),r===void 0&&(r="centripetal"),s===void 0&&(s=.5);var o=i.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new b,o._px=new Ii,o._py=new Ii,o._pz=new Ii,o._points=e.map(function(a){return new m(a)}),o._closed=n,o._curveType=r,o._tension=s,o}return Object.defineProperty(t.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var e=0,n=1;n<this._points.length;n++)e+=this._points[n-1].distanceTo(this._points[n]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e,n){n===void 0&&(n=new m);var r=n,s=this._points,o=s.length;if(o===0)return r.set(0,0,0);if(o===1)return r.copy(s[0]);var a=(o-(this._closed?0:1))*e,l=Math.floor(a),h=a-l;this._closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:h===0&&l===o-1&&(l=o-2,h=1);var c,u;this._closed||l>0?c=s[(l-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),c=new m(this._tmp.x,this._tmp.y,this._tmp.z));var g=s[l%o],d=s[(l+1)%o];if(this._closed||l+2<o?u=s[(l+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),u=new m(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var f=this._curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(g),f),y=Math.pow(g.distanceToSquared(d),f),_=Math.pow(d.distanceToSquared(u),f);y<1e-4&&(y=1),p<1e-4&&(p=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(c.x,g.x,d.x,u.x,p,y,_),this._py.initNonuniformCatmullRom(c.y,g.y,d.y,u.y,p,y,_),this._pz.initNonuniformCatmullRom(c.z,g.z,d.z,u.z,p,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,g.x,d.x,u.x,this._tension),this._py.initCatmullRom(c.y,g.y,d.y,u.y,this._tension),this._pz.initCatmullRom(c.z,g.z,d.z,u.z,this._tension));return r.set(this._px.calc(h),this._py.calc(h),this._pz.calc(h)),r},t.prototype.getPoints=function(e){for(var n=[],r=0;r<=e;r++)n.push(this.getPoint(r/e));return n},t.prototype.setPoints=function(e){this._points=e.map(function(n){return new m(n)}),this._boundingBoxNeedsUpdate=!0},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)},t.prototype.setCurveType=function(e){this._curveType=e},t.prototype.setTension=function(e){this._tension=e},t.prototype.clone=function(){return new t(this._points.map(function(e){return e.clone()}),this._closed,this._curveType,this._tension)},t.prototype.transform=function(e){return this._points=this._points.map(function(n){var r=new m;return r.copy(n),r.applyMatrix4(e),r}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new k;var e=new k;return this._points.forEach(function(n){e.expandByPoint(n)}),e},t})(bn),Se=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Le=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))};function Po(i,t){var e,n,r=i.x-t[0],s=i.y-t[1],o=((e=i.z)!==null&&e!==void 0?e:0)-((n=t[2])!==null&&n!==void 0?n:0);return r*r+s*s+o*o}var mt=(function(){function i(t,e,n,r){this._degree=t,this._knots=Le([],Se(e),!1),this._controlPoints=n.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=r?Le([],Se(r),!1):new Array(n.length).fill(1)}return i.prototype.degree=function(){return this._degree},i.prototype.knots=function(){return Le([],Se(this._knots),!1)},i.prototype.controlPoints=function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z}})},i.prototype.weights=function(){return Le([],Se(this._weights),!1)},i.prototype.clone=function(){return new i(this._degree,this._knots,this._controlPoints,this._weights)},i.prototype.point=function(t){return this.evaluate(t).point},i.prototype.evaluate=function(t){var e=this._controlPoints.map(function(n){return[n.x,n.y,n.z]});return Bc(t,this._degree,this._knots,e,this._weights)},i.prototype.signedPlanarCurvatureAt=function(t){var e=this.evaluate(t);return Fc(e.deriv1,e.deriv2)},i.prototype.getOffsetSamplePath2d=function(t,e){var n=this;e===void 0&&(e=512);for(var r=Math.abs(t),s=this.getParameterRange(),o=s.start,a=s.end,l=this.length(),h=Math.max(64,Math.ceil(l/Math.max(r*.2,1e-6))),c=Vu(o,a,Math.min(h,e)),u=0;u<8&&c.length<e;u++){for(var g=[],d=0;d<c.length-1;d++){var f=c[d],p=c[d+1],y=(f+p)/2,_=Math.max(Math.abs(this.signedPlanarCurvatureAt(f)),Math.abs(this.signedPlanarCurvatureAt(p)),Math.abs(this.signedPlanarCurvatureAt(y)));r*_>.85&&g.push(y)}if(g.length===0)break;if(c=ju(c,g),c.length>e){c=c.slice(0,e);break}}var x=[],P=[];return c.forEach(function(A){var I=n.evaluate(A);x.push(new S(I.point[0],I.point[1]));var E=I.deriv1[0],L=I.deriv1[1],C=Math.hypot(E,L);P.push(C>1e-10?new S(E/C,L/C):new S(1,0))}),{points:x,tangents:P}},i.prototype.length=function(){var t=this._controlPoints.map(function(e){return[e.x,e.y,e.z]});return Ma(this._degree,this._knots,t,this._weights)},i.byKnotsControlPointsWeights=function(t,e,n,r){return new i(t,e,n,r)},i.byPoints=function(t,e,n,r,s){n===void 0&&(n="Uniform");var o=as(t,e,n,r,s),a=o.controlPoints.map(function(l){return{x:l[0],y:l[1],z:l[2]}});return new i(e,o.knots,a,o.weights)},i.prototype.getParameterRange=function(){var t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}},i.prototype.getPoints=function(t){for(var e=[],n=this.getParameterRange(),r=n.start,s=n.end,o=0;o<=t;o++){var a=r+(s-r)*(o/t);e.push(this.point(a))}return e},i.prototype.isClosed=function(t){t===void 0&&(t=1e-6);var e=this.getParameterRange(),n=e.start,r=e.end,s=this.point(n),o=this.point(r),a=s[0]-o[0],l=s[1]-o[1],h=s[2]-o[2];return Math.sqrt(a*a+l*l+h*h)<t},i.createFitPointsForClosedCurve=function(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var e=new Da(t,!0,"centripetal"),n=Math.max(50,t.length*2);return e.getPoints(n)},i.prototype.nearestPoint=function(t,e){var n;e===void 0&&(e=64);for(var r=this.getParameterRange(),s=r.start,o=r.end,a=this.point(s),l=Po(t,a),h=0;h<=e;h++){var c=s+(o-s)*h/e,u=this.point(c),g=Po(t,u);g<l&&(l=g,a=u)}return{x:a[0],y:a[1],z:(n=a[2])!==null&&n!==void 0?n:0}},i.createClosedCurve=function(t,e,n){n===void 0&&(n="Chord");var r=this.createFitPointsForClosedCurve(t),s=r.map(function(o){return[o.x,o.y,o.z]});return i.byPoints(s,e,n)},i})();function Vu(i,t,e){if(e<2)return[i,t];for(var n=[],r=0;r<e;r++)n.push(r===e-1?t:i+(t-i)*r/(e-1));return n}function ju(i,t){var e=Le(Le([],Se(i),!1),Se(t),!1).sort(function(r,s){return r-s}),n=[];return e.forEach(function(r){var s=n[n.length-1];(s===void 0||Math.abs(s-r)>1e-10)&&n.push(r)}),n}function Ao(i){var t,e,n;if(!i)return!1;var r=(t=i.x)!==null&&t!==void 0?t:0,s=(e=i.y)!==null&&e!==void 0?e:0,o=(n=i.z)!==null&&n!==void 0?n:0;return r*r+s*s+o*o>1e-20}function Du(i,t,e){var n=i??0;return n<1&&e>0&&t>0&&(n=e-t-1),n<1&&(n=3),n=Math.min(n,t-1),Math.max(1,n)}function Gu(i,t,e){var n=i??0;n<1&&(n=3);var r=t+e-1;return n=Math.min(n,r),Math.max(1,n)}function Uu(i,t){if(!(!i||i.length!==t))return i}var Hu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),So=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Lo=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},Eo=function(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Rt=(function(i){Hu(t,i);function t(e,n,r,s,o,a){var l=i.call(this)||this,h=arguments.length;if(l._degree=3,l._closed=!1,Array.isArray(n)){if(h<2||h>5)throw gt.ILLEGAL_PARAMETERS;l._controlPoints=e;var d=void 0,f=3,p=!1;if(h>=3&&(Array.isArray(r)?(d=r,h>=4&&(f=s||3),h>=5&&(p=o)):r!==void 0&&(f=r||3,h>=4&&(p=s))),r===void 0&&h>=4&&(f=s||3,h>=5&&(p=o)),l._degree=f,l._closed=p,l._controlPoints.length<l._degree+1)throw gt.ILLEGAL_PARAMETERS;l._nurbsCurve=mt.byKnotsControlPointsWeights(l._degree,n,l._controlPoints,d)}else{if(h<2||h>6)throw gt.ILLEGAL_PARAMETERS;l._fitPoints=e,l._knotParameterization=n,h>=3&&(l._degree=r||3);var c=typeof s=="boolean";h>=4&&c&&(l._closed=s),c?(h>=5&&(l._startTangent=o),h>=6&&(l._endTangent=a)):(h>=4&&(l._startTangent=s),h>=5&&(l._endTangent=o)),l._closed&&(l._startTangent=void 0,l._endTangent=void 0);var u=(l._startTangent?1:0)+(l._endTangent?1:0);if(l._fitPoints.length+u<l._degree+1)throw gt.ILLEGAL_PARAMETERS;if(l._closed)l._nurbsCurve=mt.createClosedCurve(l._fitPoints,l._degree,l._knotParameterization);else{var g=l.toNurbsPoints(l._fitPoints);l._nurbsCurve=mt.byPoints(g,l._degree,l._knotParameterization,l._startTangent?l.toNurbsPoint(l._startTangent):void 0,l._endTangent?l.toNurbsPoint(l._endTangent):void 0)}l._controlPoints=l.toGePoints(l._nurbsCurve.controlPoints().map(function(y){return[y.x,y.y,y.z||0]}))}return l}return t.prototype.buildCurve=function(){if(this._fitPoints&&this._knotParameterization){if(this._closed){var e=mt.createFitPointsForClosedCurve(this._fitPoints),n=this.toNurbsPoints(e);this._nurbsCurve=mt.byPoints(n,this._degree,this._knotParameterization)}else{var n=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=mt.byPoints(n,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(o){return[o.x,o.y,o.z||0]}))}else if(this._controlPoints)if(this._closed){var e=mt.createFitPointsForClosedCurve(this._controlPoints),n=this.toNurbsPoints(e);this._nurbsCurve=mt.byPoints(n,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(l){return[l.x,l.y,l.z||0]}))}else{var r=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=mt.byKnotsControlPointsWeights(this._degree,r,this._controlPoints,s)}},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())},Object.defineProperty(t.prototype,"degree",{get:function(){return this._degree},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knotParameterization",{get:function(){return this._knotParameterization},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlPoints",{get:function(){return this._controlPoints.map(ot.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fitPoints",{get:function(){var e;return(e=this._fitPoints)===null||e===void 0?void 0:e.map(ot.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knots",{get:function(){return Lo([],So(this._nurbsCurve.knots()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return Lo([],So(this._nurbsCurve.weights()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){var e=this._nurbsCurve.knots(),n=this._nurbsCurve.degree(),r=e[n],s=this._nurbsCurve.point(r);return new m(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this._nurbsCurve.knots(),n=this._nurbsCurve.degree(),r=e[e.length-n-1],s=this._nurbsCurve.point(r);return new m(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._nurbsCurve.length()},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e,n){n===void 0&&(n=64);var r=this._nurbsCurve.nearestPoint(e,n);return new m(r.x,r.y,r.z||0)},t.prototype.evaluateAt=function(e){var n=this._nurbsCurve.point(e);return new m(n[0],n[1],n[2])},t.prototype.getFitPointAt=function(e){if(!this._fitPoints)throw new Error("No fit points in this spline");var n=this._fitPoints.length,r=e<0||e>=n?n-1:e,s=this._fitPoints[r];return ot.point2dToPoint3d(s)},t.prototype.getControlPointAt=function(e){var n=this._controlPoints.length,r=e<0||e>=n?n-1:e;return this._controlPoints[r]},Object.defineProperty(t.prototype,"isFitPointSpline",{get:function(){return!!(this._fitPoints&&this._fitPoints.length>0&&this._knotParameterization)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isControlPointSpline",{get:function(){return!this.isFitPointSpline},enumerable:!1,configurable:!0}),t.prototype.getGripPoints=function(){return this.isFitPointSpline?this._fitPoints.map(function(e){var n;return new m(e.x,e.y,(n=e.z)!==null&&n!==void 0?n:0)}):this._controlPoints.map(function(e){var n;return new m(e.x,e.y,(n=e.z)!==null&&n!==void 0?n:0)})},t.prototype.moveGripPointsAt=function(e,n){return this.isFitPointSpline?(this.moveFitPointsAt(e,n),this):(this.moveControlPointsAt(e,n),this)},t.prototype.moveFitPointsAt=function(e,n){var r,s;if(this._fitPoints){try{for(var o=Eo(e),a=o.next();!a.done;a=o.next()){var l=a.value;if(!(!Number.isInteger(l)||l<0)){var h=this._fitPoints[l];h&&ot.applyOffsetToPoint3d(h,n)}}}catch(c){r={error:c}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}this._boundingBoxNeedsUpdate=!0,this.buildCurve()}},t.prototype.moveControlPointsAt=function(e,n){var r,s;try{for(var o=Eo(e),a=o.next();!a.done;a=o.next()){var l=a.value;if(!(!Number.isInteger(l)||l<0)){var h=this.getControlPointAt(l);h&&ot.applyOffsetToPoint3d(h,n)}}}catch(c){r={error:c}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(r)throw r.error}}this.rebuildAfterControlPointMutation()},t.prototype.rebuildAfterControlPointMutation=function(){var e=this._nurbsCurve.knots(),n=this._nurbsCurve.weights();this.isFitPointSpline&&(this._fitPoints=void 0,this._knotParameterization=void 0,this._startTangent=void 0,this._endTangent=void 0),this._nurbsCurve=mt.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,n.length>0?n:void 0),this._boundingBoxNeedsUpdate=!0},t.prototype.getOffsetSamplePath2d=function(e){return this._nurbsCurve.getOffsetSamplePath2d(e)},t.prototype.getPoints=function(e){e===void 0&&(e=100);for(var n=this._nurbsCurve,r=[],s=n.knots(),o=this._nurbsCurve.degree(),a=s[o],l=s[s.length-o-1],h=(l-a)/(e-1),c=0;c<e;c++){var u=c===e-1?l:a+c*h,g=n.point(u);r.push(new m(g[0],g[1],g[2]))}return r},t.prototype.getCurvePoints=function(e,n){for(var r=[],s=e.knots(),o=e.degree(),a=s[o],l=s[s.length-o-1],h=(l-a)/(n-1),c=0;c<n;c++){var u=a+c*h;r.push(e.point(u))}return r},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new k().setFromPoints(e)},Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this.setClosed(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed)return 0;var e=this.getPoints(128);return Oa(e)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(function(s){return new m(s).applyMatrix4(e)}),this._startTangent&&(this._startTangent=new m(this._startTangent).transformDirection(e)),this._endTangent&&(this._endTangent=new m(this._endTangent).transformDirection(e)),this.buildCurve();else{var n=this._nurbsCurve.knots(),r=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(function(s){return new m(s).applyMatrix4(e)}),this._nurbsCurve=mt.byKnotsControlPointsWeights(this._degree,n,this._controlPoints,r.length>0?r:void 0)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return this._fitPoints&&this._knotParameterization?new t(this._fitPoints.map(ot.point2dToPoint3d),this._knotParameterization,this._degree,this._closed,this._startTangent?ot.point2dToPoint3d(this._startTangent):void 0,this._endTangent?ot.point2dToPoint3d(this._endTangent):void 0):new t(this._controlPoints.map(ot.point2dToPoint3d),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)},t.prototype.toNurbsPoints=function(e){var n=new Array(e.length);return e.forEach(function(r,s){n[s]=[r.x,r.y,r.z||0]}),n},t.prototype.toGePoints=function(e){var n=new Array(e.length);return e.forEach(function(r,s){n[s]={x:r[0],y:r[1],z:r[2]}}),n},t.prototype.toNurbsPoint=function(e){return[e.x,e.y,e.z||0]},t.createClosedSpline=function(e,n,r){if(n===void 0&&(n="Uniform"),r===void 0&&(r=3),e.length<r+1)throw new Error("At least ".concat(r+1," points are required for a degree ").concat(r," closed spline"));return new t(e,n,r,!0)},t.fromControlPoints=function(e,n,r,s,o){if(e.length<2||n.length<2)return null;var a=Du(s,e.length,n.length);if(e.length<a+1)return null;try{return new t(e,n,Uu(r,e.length),a,o)}catch{return null}},t.fromFitPoints=function(e,n,r,s,o,a){if(e.length<2)return null;var l=Ao(o),h=Ao(a),c=(l?1:0)+(h?1:0),u=Gu(r,e.length,c);if(e.length+c<u+1)return null;try{return l||h?new t(e,n,u,s,l?o:void 0,h?a:void 0):new t(e,n,u,s)}catch{return null}},t.fromDwgSplineEdge=function(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){var n=e.controlPoints.map(ot.point2dToPoint3d),r=!0,s=e.controlPoints.map(function(a){return a.weight==null&&(r=!1),a.weight||1});return t.fromControlPoints(n,e.knots,r?s:void 0,e.degree,!1)}if(e.numberOfFitData>0){var o=e.fitDatum.map(ot.point2dToPoint3d);return t.fromFitPoints(o,"Uniform",e.degree,!1,e.startTangent?ot.point2dToPoint3d(e.startTangent):void 0,e.endTangent?ot.point2dToPoint3d(e.endTangent):void 0)}return null},t})(bn),Wu=(function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}})(),Mi=function(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var n=e.call(i),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return s},Ti=function(i,t,e){if(e||arguments.length===2)for(var n=0,r=t.length,s;n<r;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return i.concat(s||Array.prototype.slice.call(t))},cs=(function(i){Wu(t,i);function t(e){e===void 0&&(e=[]);var n=i.call(this)||this;return n._curves=e,n}return Object.defineProperty(t.prototype,"curves",{get:function(){return this._curves},enumerable:!1,configurable:!0}),t.buildFromEdges=function(e,n){if(n===void 0&&(n=.001),e.length===0)return[];for(var r=Ti([],Mi(e),!1),s=[],o=n*n,a=function(f,p){var y=f.x-p.x,_=f.y-p.y;return y*y+_*_<=o};r.length>0;){var l=[],h=r.shift();l.push(h);var c=t.getEdgeStartPoint(h),u=t.getEdgeEndPoint(h);if(!a(c,u))for(;r.length>0;){var g=t.findConnectingEdge(r,u,o);if(g.index<0)break;var d=r.splice(g.index,1)[0];if(g.reverse&&(d=t.reverseEdge(d)),l.push(d),u=t.getEdgeEndPoint(d),a(u,c))break}s.push(new t(l))}return s},t.prototype.add=function(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"numberOfEdges",{get:function(){return this._curves.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this._curves.length>0){var e=this._curves[0].startPoint;return new S(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.startPoint},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){var e=0;return this._curves.forEach(function(n){e+=n.length}),e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100),n=new it;return n.setFromPoints(e),n},t.prototype.transform=function(e){var n=new O().set(e.elements[0],e.elements[3],0,e.elements[6],e.elements[1],e.elements[4],0,e.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(function(r){r instanceof Rt?r.transform(n):r.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._curves.map(function(e){return e.clone()}))},Object.defineProperty(t.prototype,"closed",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var n=[];return this.curves.forEach(function(r){r.getPoints(e).forEach(function(s){n.push(new S(s.x,s.y))})}),n},t.findConnectingEdge=function(e,n,r){for(var s=-1,o=!1,a=Number.POSITIVE_INFINITY,l=0;l<e.length;l++){var h=e[l],c=t.getEdgeStartPoint(h),u=t.getEdgeEndPoint(h),g=n.x-c.x,d=n.y-c.y,f=g*g+d*d;f<a&&(a=f,s=l,o=!1);var p=n.x-u.x,y=n.y-u.y,_=p*p+y*y;_<a&&(a=_,s=l,o=!0)}return a>r?{index:-1,reverse:!1}:{index:s,reverse:o}},t.getEdgeStartPoint=function(e){var n=e.startPoint;return new S(n.x,n.y)},t.getEdgeEndPoint=function(e){var n=e.endPoint;return new S(n.x,n.y)},t.reverseEdge=function(e){return e instanceof Nt?new Nt(e.endPoint,e.startPoint):e instanceof ut?t.reverseCircArcEdge(e):e instanceof de?new de(e.center,e.majorAxisRadius,e.minorAxisRadius,e.endAngle,e.startAngle,!e.clockwise,e.rotation):e instanceof Rt?t.reverseSplineEdge(e):e},t.reverseCircArcEdge=function(e){var n=e.startPoint,r=e.endPoint,s=!e.clockwise,o=Math.atan2(r.y-e.center.y,r.x-e.center.x),a=Math.atan2(n.y-e.center.y,n.x-e.center.x),l=function(h){var c=T.normalizeAngle(h);return s?T.normalizeAngle(-c):c};return new ut(e.center,e.radius,l(o),l(a),s)},t.reverseSplineEdge=function(e){var n=Ti([],Mi(e.controlPoints),!1).reverse(),r=e.knots,s=r[0],o=r[r.length-1],a=r.map(function(c){return s+o-c}).reverse(),l=e.weights,h=l.length>0?Ti([],Mi(l),!1).reverse():void 0;return new Rt(n,a,h,e.degree,e.closed)},t})(De);exports.AcGiArrowType=void 0;(function(i){i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK"})(exports.AcGiArrowType||(exports.AcGiArrowType={}));exports.AcGiLineWeight=void 0;(function(i){i[i.ByBlock=-2]="ByBlock",i[i.ByDIPs=-4]="ByDIPs",i[i.ByLayer=-1]="ByLayer",i[i.ByLineWeightDefault=-3]="ByLineWeightDefault",i[i.LineWeight000=0]="LineWeight000",i[i.LineWeight005=5]="LineWeight005",i[i.LineWeight009=9]="LineWeight009",i[i.LineWeight013=13]="LineWeight013",i[i.LineWeight015=15]="LineWeight015",i[i.LineWeight018=18]="LineWeight018",i[i.LineWeight020=20]="LineWeight020",i[i.LineWeight025=25]="LineWeight025",i[i.LineWeight030=30]="LineWeight030",i[i.LineWeight035=35]="LineWeight035",i[i.LineWeight040=40]="LineWeight040",i[i.LineWeight050=50]="LineWeight050",i[i.LineWeight053=53]="LineWeight053",i[i.LineWeight060=60]="LineWeight060",i[i.LineWeight070=70]="LineWeight070",i[i.LineWeight080=80]="LineWeight080",i[i.LineWeight090=90]="LineWeight090",i[i.LineWeight100=100]="LineWeight100",i[i.LineWeight106=106]="LineWeight106",i[i.LineWeight120=120]="LineWeight120",i[i.LineWeight140=140]="LineWeight140",i[i.LineWeight158=158]="LineWeight158",i[i.LineWeight200=200]="LineWeight200",i[i.LineWeight211=211]="LineWeight211"})(exports.AcGiLineWeight||(exports.AcGiLineWeight={}));var hi=(function(){function i(t){t===void 0&&(t={});var e,n,r,s;this.database=t.database,this.foregroundOnDark=(e=t.foregroundOnDark)!==null&&e!==void 0?e:ln,this.foregroundOnLight=(n=t.foregroundOnLight)!==null&&n!==void 0?n:hn,this.backgroundIsDark=(r=t.backgroundIsDark)!==null&&r!==void 0?r:!0,this.fallbackRgb=(s=t.fallbackRgb)!==null&&s!==void 0?s:16777215}return i.prototype.resolveSubEntityTraitsRgb=function(t){var e,n,r,s=t.color;return s.isForeground?this.backgroundIsDark?this.foregroundOnDark:this.foregroundOnLight:s.isByLayer||s.isByBlock?(e=this.fallbackRgb)!==null&&e!==void 0?e:16777215:(r=(n=s.RGB)!==null&&n!==void 0?n:this.fallbackRgb)!==null&&r!==void 0?r:16777215},i.fromBackgroundColor=function(t,e){return t===void 0&&(t=Ga),new i({database:e,foregroundOnDark:ln,foregroundOnLight:hn,backgroundIsDark:!Ua(t),fallbackRgb:16777215})},i})(),Ga=0,ln=16777215,hn=0,$u=16777215,qu=128,Ku=new hi({database:void 0,foregroundOnDark:ln,foregroundOnLight:hn,backgroundIsDark:!0,fallbackRgb:16777215});function Ua(i){var t=i>>16&255,e=i>>8&255,n=i&255;return .299*t+.587*e+.114*n>qu}function Zu(i){var t=hi.fromBackgroundColor(i);return t.backgroundIsDark?t.foregroundOnDark:t.foregroundOnLight}function Qu(i){return i?hn:ln}function Ju(i,t){return hi.fromBackgroundColor(t).resolveSubEntityTraitsRgb(i)}exports.AcGiMTextFlowDirection=void 0;(function(i){i[i.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",i[i.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",i[i.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",i[i.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",i[i.BY_STYLE=5]="BY_STYLE"})(exports.AcGiMTextFlowDirection||(exports.AcGiMTextFlowDirection={}));exports.AcGiMTextAttachmentPoint=void 0;(function(i){i[i.TopLeft=1]="TopLeft",i[i.TopCenter=2]="TopCenter",i[i.TopRight=3]="TopRight",i[i.MiddleLeft=4]="MiddleLeft",i[i.MiddleCenter=5]="MiddleCenter",i[i.MiddleRight=6]="MiddleRight",i[i.BottomLeft=7]="BottomLeft",i[i.BottomCenter=8]="BottomCenter",i[i.BottomRight=9]="BottomRight",i[i.BaselineLeft=10]="BaselineLeft",i[i.BaselineCenter=11]="BaselineCenter",i[i.BaselineRight=12]="BaselineRight"})(exports.AcGiMTextAttachmentPoint||(exports.AcGiMTextAttachmentPoint={}));exports.AcGiRenderMode=void 0;(function(i){i[i.OPTIMIZED_2D=0]="OPTIMIZED_2D",i[i.WIREFRAME=1]="WIREFRAME",i[i.HIDDEN_LINE=2]="HIDDEN_LINE",i[i.FLAT_SHADED=3]="FLAT_SHADED",i[i.GOURAUD_SHADED=4]="GOURAUD_SHADED",i[i.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",i[i.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME"})(exports.AcGiRenderMode||(exports.AcGiRenderMode={}));exports.AcGiOrthographicType=void 0;(function(i){i[i.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",i[i.TOP=1]="TOP",i[i.BOTTOM=2]="BOTTOM",i[i.FRONT=3]="FRONT",i[i.BACK=4]="BACK",i[i.LEFT=5]="LEFT",i[i.RIGHT=6]="RIGHT"})(exports.AcGiOrthographicType||(exports.AcGiOrthographicType={}));exports.AcGiDefaultLightingType=void 0;(function(i){i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS"})(exports.AcGiDefaultLightingType||(exports.AcGiDefaultLightingType={}));var Ha=(function(){function i(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new m,this._height=0,this._width=0,this._viewCenter=new m,this._viewHeight=0}return Object.defineProperty(i.prototype,"number",{get:function(){return this._number},set:function(t){this._number=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"id",{get:function(){return this._id},set:function(t){this._id=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"groupId",{get:function(){return this._groupId},set:function(t){this._groupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"centerPoint",{get:function(){return this._centerPoint},set:function(t){this._centerPoint.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"box",{get:function(){var t=new it;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewCenter",{get:function(){return this._viewCenter},set:function(t){this._viewCenter.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(t){this._viewHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewWidth",{get:function(){return this.viewHeight*(this.width/this.height)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viewBox",{get:function(){var t=new it;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t},enumerable:!1,configurable:!0}),i.prototype.clone=function(){var t=new i;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t},i.prototype.copy=function(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this},i})();const se="Continuous",K="Standard",ne="Standard",ie="Standard",td="ANSI31",Wa="ANGLE",ge="SOLID",$a="USER",qa="LINEAR",J="ByLayer",Xt="ByBlock",Ye="*Active",er="mlightcad",nr="ACAD",ed=Object.freeze({x:0,y:0}),nd=Object.freeze({x:0,y:0}),id=Object.freeze({x:1,y:1}),rd=Object.freeze({x:0,y:0,z:1}),sd=Object.freeze({x:0,y:0,z:0}),Ka=150,ir=1,rr=255,Za=12,sr=1,or=255,od=0,ad=32767,ld=0,hd=2,Qa=5,ar=1,lr=255,vs=class vs extends lt{constructor(){super(...arguments),this._visibility=!0,this._transparency=new Q,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this.getEntityColor()}set color(t){this.setEntityColor(t)}get resolvedColor(){return this.resolveStandardColor()}resolveStandardColor(){var e;let t=this.color;if(t.isByLayer){const n=this.getLayerColor();n&&n.RGB!=null&&(t=n)}else if(t.isByBlock){const n=this.database.cecolor;if(n&&(t=n,t.isByLayer)){const r=this.database.clayer||this.layer,s=this.database.tables.layerTable.getAt(r);((e=s==null?void 0:s.color)==null?void 0:e.RGB)!=null&&(t=s.color)}}return t}get lineType(){var t;return this._lineType==null&&(this._lineType=((t=this.database)==null?void 0:t.celtype)??J),this._lineType}set lineType(t){t?t.toUpperCase()==="BYLAYER"?this._lineType=J:t.toUpperCase()==="BYBLOCK"?this._lineType=Xt:this._lineType=t:this._lineType=J}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new X,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(t){this._color==null&&(this._color=new X),this._color.copy(t)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(t){t.writeSubclassMarker("AcDbEntity"),t.writeString(8,this.layer),t.writeString(6,this.lineType),t.writeDouble(48,this.linetypeScale),t.writeInt16(60,this.visibility?0:1),t.writeCmColor(this.color),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency);const e=this.database.tables.blockTable.getIdAt(this.ownerId);return e!=null&&e.isPaperSapce&&t.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new X,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??J),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subMoveGripPointsAt(t,e){return this}subGetOsnapPoints(t,e,n,r,s,o){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){if(!this.database.isLayerDrawable(this.layer))return;const n=t.subEntityTraits;n.color=this.resolvedColor,n.lineType=this.lineStyle,n.lineTypeScale=this.linetypeScale,n.lineWeight=this.lineWeight,n.transparency=this.transparency,n.layer=this.layer,n.drawOrder=0,"thickness"in this&&(n.thickness=this.thickness),t.context.database=this.database;const r=this.subWorldDraw(t,e);return this.attachEntityInfo(r),r}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color=t}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var r;const{type:t,name:e}=this.getLineType(),n=(r=this.database)==null?void 0:r.tables.linetypeTable.getAt(e);return n?{type:t,...n.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==J){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==Xt?{type:"ByBlock",name:se}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:se}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);return t!=null?t.color:null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};vs.typeName="Entity";let V=vs;class Be{constructor(t){this.i=0,t instanceof Map?(this._records=t,this._array=null,this._keys=Array.from(t.keys())):(this._records=null,this._array=t,this._keys=[])}get count(){var t;return((t=this._records)==null?void 0:t.size)??this._array.length}toArray(){return this._records?Array.from(this._records.values()):[...this._array]}[Symbol.iterator](){return this}next(){if(this._array){if(this.i<this._array.length){const t=this._array[this.i];return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}class ae extends lt{constructor(t,e){t=t||{},It(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}setAttr(t,e){this.assertOpenForWrite(),super.setAttr(t,e)}assertOpenForWrite(){if(this.isTemp)return;const t=this.database;if(!t)return;const e=t.transactionManager;if(!e.isApplyingUndoRedo()){if(e.strictMode&&!e.isRecording())throw new Error("Cannot modify symbol table records outside an active transaction.");if(e.isRecording()&&!e.isOpenedForWriteInTransaction(this.objectId))throw new Error(`Symbol table record "${this.name||this.objectId}" is not open for write. Use openObjectForWrite().`)}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var Ja=(i=>(i[i.Any=0]="Any",i[i.Uniform=1]="Uniform",i))(Ja||{}),tl=(i=>(i[i.None=0]="None",i[i.Anonymous=1]="Anonymous",i[i.HasNonConstantAttributes=2]="HasNonConstantAttributes",i[i.Xref=4]="Xref",i[i.XrefOverlay=8]="XrefOverlay",i[i.ExternallyDependent=16]="ExternallyDependent",i[i.Resolved=32]="Resolved",i[i.Referenced=64]="Referenced",i))(tl||{});const Jt=class Jt extends ae{static isModelSapceName(t){return t.toLowerCase()==Jt.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Jt.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(t,e){t=t||{},It(t,{origin:new m,layoutId:"",flags:0,pathName:"",blockInsertUnits:0,explodability:1,blockScaling:1,previewIcon:void 0}),super(t,e),this._entities=[]}get isModelSapce(){return Jt.isModelSapceName(this.name)}get isPaperSapce(){return Jt.isPaperSapceName(this.name)}get origin(){return this.getAttr("origin")}set origin(t){this.getAttr("origin").copy(t)}get layoutId(){return this.getAttr("layoutId")}set layoutId(t){this.setAttr("layoutId",t)}get flags(){return this.getAttr("flags")}set flags(t){this.setAttr("flags",t)}get pathName(){return this.getAttr("pathName")}set pathName(t){this.setAttr("pathName",t)}get isXref(){return(this.flags&12)!==0}get isOverlayReference(){return(this.flags&8)!==0}get isUnresolvedXref(){return!this.isXref||(this.flags&32)!==0?!1:this._entities.length===0}get blockInsertUnits(){return this.getAttr("blockInsertUnits")}set blockInsertUnits(t){this.setAttr("blockInsertUnits",t)}get explodability(){return this.getAttr("explodability")}set explodability(t){this.setAttr("explodability",t)}get blockScaling(){return this.getAttr("blockScaling")}set blockScaling(t){this.setAttr("blockScaling",t)}get previewIcon(){return this.getAttrWithoutException("previewIcon")}set previewIcon(t){if(!t||t.length===0){this.setAttr("previewIcon",void 0);return}this.setAttr("previewIcon",t)}appendEntity(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot append entities outside an active transaction.");const n=s=>{s.database=this.database,s.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(s),this.database.commitObjectHandle(s,o=>this.hasEntityId(o)),s.resolveEffectiveProperties(),this._entities.push(s),s.dxfTypeName==="INSERT"&&"syncAttributeDatabases"in s&&typeof s.syncAttributeDatabases=="function"&&s.syncAttributeDatabases()},r=Array.isArray(t)?t:[t];for(const s of r)n(s);if(e.isRecording())for(const s of r)e.recordAppend({type:"blockTableRecord",ownerId:this.objectId},s);(this.isModelSapce||this.isPaperSapce)&&!e.isRecording()&&!e.isApplyingUndoRedo()&&this.database.notifyEntityAppended(t)}removeEntity(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot remove entities outside an active transaction.");const n=Array.isArray(t)?t:[t];if(n.length===0)return!1;const r=new Set(n),s=[];let o=0;for(const a of this._entities)r.has(a.objectId)?(e.isRecording()&&e.recordRemove({type:"blockTableRecord",ownerId:this.objectId},a),s.push(a),this.database.releaseObjectHandle(a)):this._entities[o++]=a;return this._entities.length=o,s.length>0&&!e.isRecording()&&!e.isApplyingUndoRedo()&&this.database.notifyEntityErased(s),s.length>0}newIterator(){return new Be(this._entities)}getIdAt(t){const e=this.database.getObjectById(t);if(!(!(e instanceof V)||e.getAttrWithoutException("ownerId")!==this.objectId))return e}hasEntityId(t){return this.getIdAt(t)!==void 0}dxfOutBlockRecord(t){return t.writeStart("BLOCK_RECORD"),this.dxfOut(t),this}dxfOutBlockBegin(t){return t.writeStart("BLOCK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeString(8,"0"),t.writeSubclassMarker("AcDbBlockBegin"),t.writeString(2,this.name),t.writeInt16(70,this.flags),t.writePoint3d(10,this.origin),t.writeString(3,this.name),this.pathName&&t.writeString(1,this.pathName),this}dxfOutBlockEnd(t){return t.writeStart("ENDBLK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.blockInsertUnits),t.writeInt16(280,this.explodability),t.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&t.writeObjectId(340,this.layoutId),this}};Jt.MODEL_SPACE_NAME="*Model_Space",Jt.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let tt=Jt;var el=(i=>(i[i.kInches=0]="kInches",i[i.kMillimeters=1]="kMillimeters",i[i.kPixels=2]="kPixels",i))(el||{}),nl=(i=>(i[i.k0degrees=0]="k0degrees",i[i.k90degrees=1]="k90degrees",i[i.k180degrees=2]="k180degrees",i[i.k270degrees=3]="k270degrees",i))(nl||{}),il=(i=>(i[i.kDisplay=0]="kDisplay",i[i.kExtents=1]="kExtents",i[i.kLimits=2]="kLimits",i[i.kView=3]="kView",i[i.kWindow=4]="kWindow",i[i.kLayout=5]="kLayout",i))(il||{}),rl=(i=>(i[i.kDraft=0]="kDraft",i[i.kPreview=1]="kPreview",i[i.kNormal=2]="kNormal",i[i.kPresentation=3]="kPresentation",i[i.kMaximum=4]="kMaximum",i[i.kCustom=5]="kCustom",i))(rl||{}),sl=(i=>(i[i.kAsDisplayed=0]="kAsDisplayed",i[i.kWireframe=1]="kWireframe",i[i.kHidden=2]="kHidden",i[i.kRendered=3]="kRendered",i[i.kVisualStyle=4]="kVisualStyle",i[i.kRenderPreset=5]="kRenderPreset",i))(sl||{}),ol=(i=>(i[i.kScaleToFit=0]="kScaleToFit",i[i.k1_128in_1ft=1]="k1_128in_1ft",i[i.k1_64in_1ft=2]="k1_64in_1ft",i[i.k1_32in_1ft=3]="k1_32in_1ft",i[i.k1_16in_1ft=4]="k1_16in_1ft",i[i.k3_32in_1ft=5]="k3_32in_1ft",i[i.k1_8in_1ft=6]="k1_8in_1ft",i[i.k3_16in_1ft=7]="k3_16in_1ft",i[i.k1_4in_1ft=8]="k1_4in_1ft",i[i.k3_8in_1ft=9]="k3_8in_1ft",i[i.k1_2in_1ft=10]="k1_2in_1ft",i[i.k3_4in_1ft=11]="k3_4in_1ft",i[i.k1in_1ft=12]="k1in_1ft",i[i.k3in_1ft=13]="k3in_1ft",i[i.k6in_1ft=14]="k6in_1ft",i[i.k1ft_1ft=15]="k1ft_1ft",i[i.k1_1=16]="k1_1",i[i.k1_2=17]="k1_2",i[i.k1_4=18]="k1_4",i[i.k1_5=19]="k1_5",i[i.k1_8=20]="k1_8",i[i.k1_10=21]="k1_10",i[i.k1_16=22]="k1_16",i[i.k1_20=23]="k1_20",i[i.k1_30=24]="k1_30",i[i.k1_40=25]="k1_40",i[i.k1_50=26]="k1_50",i[i.k1_100=27]="k1_100",i[i.k2_1=28]="k2_1",i[i.k4_1=29]="k4_1",i[i.k8_1=30]="k8_1",i[i.k10_1=31]="k10_1",i[i.k100_1=32]="k100_1",i[i.k1000_1=33]="k1000_1",i[i.k1and1_2in_1ft=34]="k1and1_2in_1ft",i))(ol||{});const cd={0:0,1:1/1536,2:1/768,3:1/384,4:1/192,5:1/128,6:1/96,7:1/64,8:1/48,9:1/32,10:1/24,11:1/16,12:1/12,13:1/4,14:1/2,15:1,16:1,17:1/2,18:1/4,19:1/5,20:1/8,21:1/10,22:1/16,23:1/20,24:1/30,25:1/40,26:1/50,27:1/100,28:2,29:4,30:8,31:10,32:100,33:1e3,34:1/8};class al extends lt{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new S,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new S,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new it,this._modelType=t,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(t){this._plotSettingsName=t}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(t){this._plotSettingsName=t}get plotCfgName(){return this._plotCfgName}set plotCfgName(t){this._plotCfgName=t}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(t){this._canonicalMediaName=t}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(t){this._currentStyleSheet=t}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(t){this._plotOrigin=t}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(t){this._customPrintScale=t}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(t){this._plotPaperSize=t}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(t){this._plotPaperMargins=t}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(t){this._plotViewName=t}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(t){this._plotWindowArea=t}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(t){this._modelType=t}getModelType(){return this._modelType}setModelType(t){this._modelType=t}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(t){this._drawViewportsFirst=t}setDrawViewportsFirst(t){this._drawViewportsFirst=t}get plotCentered(){return this._plotCentered}set plotCentered(t){this._plotCentered=t}setPlotCentered(t){this._plotCentered=t}get plotHidden(){return this._plotHidden}set plotHidden(t){this._plotHidden=t}setPlotHidden(t){this._plotHidden=t}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(t){this._plotPaperUnits=t}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(t){this._plotPlotStyles=t}setPlotPlotStyles(t){this._plotPlotStyles=t}get plotRotation(){return this._plotRotation}set plotRotation(t){this._plotRotation=t}get plotType(){return this._plotType}set plotType(t){this._plotType=t}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(t){this._plotViewportBorders=t}setPlotViewportBorders(t){this._plotViewportBorders=t}get printLineweights(){return this._printLineweights}set printLineweights(t){this._printLineweights=t}setPrintLineweights(t){this._printLineweights=t}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(t){this._scaleLineweights=t}setScaleLineweights(t){this._scaleLineweights=t}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(t){this._showPlotStyles=t}setShowPlotStyles(t){this._showPlotStyles=t}get shadePlot(){return this._shadePlotType}set shadePlot(t){this._shadePlotType=t}setShadePlot(t){this._shadePlotType=t}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(t){this._shadePlotResLevel=t}setShadePlotResLevel(t){this._shadePlotResLevel=t}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(t){this._shadePlotCustomDpi=t}setShadePlotCustomDPI(t){this._shadePlotCustomDpi=t}get shadePlotId(){return this._shadePlotId}set shadePlotId(t){this._shadePlotId=t}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(t){this._stdScaleType=t}get stdScale(){return cd[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(t){this._useStandardScale=t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPlotSettings"),t.writeString(1,this.plotSettingsName),t.writeString(2,this.plotCfgName),t.writeString(4,this.canonicalMediaName),t.writeString(6,this.plotViewName),t.writeDouble(40,this.plotPaperMargins.left),t.writeDouble(41,this.plotPaperMargins.bottom),t.writeDouble(42,this.plotPaperMargins.right),t.writeDouble(43,this.plotPaperMargins.top),t.writeDouble(44,this.plotPaperSize.x),t.writeDouble(45,this.plotPaperSize.y),t.writeDouble(46,this.plotOrigin.x),t.writeDouble(47,this.plotOrigin.y),t.writeDouble(48,this.plotWindowArea.min.x),t.writeDouble(49,this.plotWindowArea.min.y),t.writeDouble(140,this.plotWindowArea.max.x),t.writeDouble(141,this.plotWindowArea.max.y),t.writeDouble(142,this.customPrintScale.numerator),t.writeDouble(143,this.customPrintScale.denominator);let e=0;return this.plotViewportBorders&&(e|=1),this.showPlotStyles&&(e|=2),this.plotCentered&&(e|=4),this.plotHidden&&(e|=8),this.useStandardScale&&(e|=16),this.plotPlotStyles&&(e|=32),this.scaleLineweights&&(e|=64),this.printLineweights&&(e|=128),this.drawViewportsFirst&&(e|=512),this.modelType&&(e|=1024),t.writeInt16(70,e),t.writeInt16(72,this.plotPaperUnits),t.writeInt16(73,this.plotRotation),t.writeInt16(74,this.plotType),t.writeString(7,this.currentStyleSheet),t.writeInt16(75,this.stdScaleType),t.writeInt16(76,this.shadePlot),t.writeInt16(77,this.shadePlotResLevel),t.writeInt16(78,this.shadePlotCustomDPI),t.writeDouble(147,this.stdScale),t.writeObjectId(333,this.shadePlotId),this}}class ci extends al{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new it,this._extents=new k,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}get viewportArray(){return this._viewportArray}set viewportArray(t){this._viewportArray=t.slice()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayout"),t.writeString(1,this.layoutName),t.writeInt16(70,this.tabSelected?1:0),t.writeInt16(71,this.tabOrder),t.writeObjectId(330,this.blockTableRecordId),t.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),t.writePoint2d(10,this.limits.min),t.writePoint2d(11,this.limits.max),t.writePoint3d(14,this.extents.min),t.writePoint3d(15,this.extents.max),this}}class ll{constructor(){this.events={layoutCreated:new q,layoutRemoved:new q,layoutRenamed:new q,layoutSwitched:new q}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const n=this.getWorkingDatabase(e),r=n.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(r,n)}setCurrentLayoutBtrId(t,e){const n=this.getWorkingDatabase(e),r=n.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(r,n)}setCurrentLayout(t,e){const n=this.getWorkingDatabase(e),r=n.objects.layout.getAt(t);return this.setCurrentLayoutInternal(r,n)}renameLayout(t,e,n){const s=this.getWorkingDatabase(n).objects.layout.getAt(t);return s?(s.layoutName=e,this.events.layoutRenamed.dispatch({layout:s,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const n=this.getWorkingDatabase(e).objects.layout,r=n.getAt(t);let s=!1;return r&&(s=n.remove(t),s&&this.events.layoutRemoved.dispatch({layout:r})),s}createLayout(t,e){const n=this.getWorkingDatabase(e),r=new ci;r.layoutName=t,r.tabOrder=n.objects.layout.maxTabOrder;const s=new tt;return s.name=`*Paper_Space${r.tabOrder}`,n.tables.blockTable.add(s),n.objects.layout.setAt(t,r),this.events.layoutCreated.dispatch({layout:r}),{layout:r,btr:s}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||mc()}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}let Xn;function ud(i){Xn=i}function hl(){return Vn.instance}const Qn=class Qn{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager||(Xn||(Xn=()=>new ll),this._layoutManager=Xn()),this._layoutManager}};Qn.instance=new Qn;let Vn=Qn;aa(hl);var Fe=(i=>(i.kForRead="kForRead",i.kForWrite="kForWrite",i))(Fe||{});class ui{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new ui(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class cl{constructor(t,e,n){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=n,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,n)=>{const r=()=>{Promise.resolve(t()).then(e).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let n=0;const r=async()=>{const s=n,o=Math.min(n+this._chunkSize,this._count);await t(s,o),n=o,n<this._count&&await this.scheduleTask(r)};await r(),await(e==null?void 0:e())}}const dd=/\\[fF](.*?)\|/g,gd=/\\[fF]([^|;]+);/g;class xt{constructor(t){this.styles=t.styles,this.styleMap=xt.buildStyleFontMap(this.styles),this.textStyleVar=t.textStyleVar??K}collect(t,e){const n=new Set;for(const r of xt.collectShapeDefinitionFonts(this.styles))n.add(r);for(const r of xt.collectNamedStyleTableFonts(this.styles))n.add(r);return this.collectFromEntities(t,e,n),Array.from(n)}static normalizeFontFileName(t){if(!t)return;const e=t.lastIndexOf(".");return e>=0?t.substring(0,e).toLowerCase():t.toLowerCase()}collectFromEntities(t,e,n){for(const r of t){const s=e.getEntityFontInfo(r);if(s){if(s.formattedText)for(const o of xt.extractInlineMTextFonts(s.formattedText))n.add(o);if(s.resolveStyle&&this.addResolvedStyleFonts(s.styleName,n),s.blockName&&e.getBlockEntities){const o=e.getBlockEntities(s.blockName);o&&this.collectFromEntities(o,e,n)}}}}resolveStyleFontNames(t){const e=[],n=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};n(t),n(this.textStyleVar),n(K),n("STANDARD");for(const r of e){const s=this.styleMap.get(r);if(s)return s;const o=r.toUpperCase();for(const[a,l]of this.styleMap)if(a.toUpperCase()===o)return l}return this.styleMap.values().next().value}addResolvedStyleFonts(t,e){const n=this.resolveStyleFontNames(t);n==null||n.forEach(r=>e.add(r))}static buildStyleFontMap(t){const e=new Map;for(const n of t)e.set(n.name,xt.collectStyleEntryFontNames(n));return e}static collectStyleEntryFontNames(t){const e=[];for(const n of[t.font,t.bigFont,t.extendedFont]){const r=xt.normalizeFontFileName(n);r&&e.push(r)}return e}static collectNamedStyleTableFonts(t){const e=[];for(const n of t)n.standardFlag&&n.standardFlag&1||e.push(...xt.collectStyleEntryFontNames(n));return e}static collectShapeDefinitionFonts(t){const e=[];for(const n of t)if(n.standardFlag&&n.standardFlag&1){const r=xt.normalizeFontFileName(n.font);r&&e.push(r)}return e}static extractInlineMTextFonts(t){const e=new Set;for(const n of t.matchAll(dd))e.add(n[1].toLowerCase());for(const n of t.matchAll(gd))e.add(n[1].toLowerCase());return Array.from(e)}}class me{static get instance(){return this._instance||(this._instance=new me),this._instance}constructor(){this._blocks=new Map}createKey(t,e){let n=e.toString();return!n&&e.isByColor&&(n=`RGB:${e.red},${e.green},${e.blue}`),`${t}_${n}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,n,r=[],s=!0,o,a){const l=[];if(e!=null){const h=n.RGB??0,c=this.createKey(e.name,n);let u;if(this.has(c))u=this.get(c);else{const g=e.newIterator();for(const d of g)d.visibility&&(d.color.isByBlock?(Io.copy(d.color),n.isForeground?d.color.setForeground():d.color.setRGBValue(h),this.addEntity(d,l,t),d.color.copy(Io)):this.addEntity(d,l,t));u=t.group(l),u&&s&&tt.name&&!tt.name.startsWith("*U")&&this.set(c,u)}if(u&&o&&(Tn.copy(o),u.applyMatrix(Tn),a&&(a.x!=0||a.y!=0||a.z!=1)&&(Ci.setFromExtrusionDirection(a),u.applyMatrix(Ci),Tn.premultiply(Ci))),u&&r&&r.length>0){const g=o!=null?fd.copy(Tn).invert():void 0;r.forEach(d=>{g&&d.applyMatrix(g),u.addChild(d)})}return u}else return t.group(l)}addEntity(t,e,n){if(!t.visibility)return;const r=t.worldDraw(n);r&&(this.attachEntityInfo(r,t),e.push(r))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const Io=new X,Tn=new O,Ci=new O,fd=new O;var dt=(i=>(i[i.DecimalDegrees=0]="DecimalDegrees",i[i.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",i[i.Gradians=2]="Gradians",i[i.Radians=3]="Radians",i[i.SurveyorsUnits=4]="SurveyorsUnits",i))(dt||{}),$=(i=>(i[i.Scientific=1]="Scientific",i[i.Decimal=2]="Decimal",i[i.Engineering=3]="Engineering",i[i.Architectural=4]="Architectural",i[i.Fractional=5]="Fractional",i[i.WindowsDesktop=6]="WindowsDesktop",i))($||{}),H=(i=>(i[i.Undefined=0]="Undefined",i[i.Inches=1]="Inches",i[i.Feet=2]="Feet",i[i.Miles=3]="Miles",i[i.Millimeters=4]="Millimeters",i[i.Centimeters=5]="Centimeters",i[i.Meters=6]="Meters",i[i.Kilometers=7]="Kilometers",i[i.Microinches=8]="Microinches",i[i.Mils=9]="Mils",i[i.Yards=10]="Yards",i[i.Angstroms=11]="Angstroms",i[i.Nanometers=12]="Nanometers",i[i.Microns=13]="Microns",i[i.Decimeters=14]="Decimeters",i[i.Dekameters=15]="Dekameters",i[i.Hectometers=16]="Hectometers",i[i.Gigameters=17]="Gigameters",i[i.Astronomical=18]="Astronomical",i[i.LightYears=19]="LightYears",i[i.Parsecs=20]="Parsecs",i[i.USSurveyFeet=21]="USSurveyFeet",i[i.USSurveyInch=22]="USSurveyInch",i[i.USSurveyYard=23]="USSurveyYard",i[i.USSurveyMile=24]="USSurveyMile",i[i.Max=24]="Max",i))(H||{});function pd(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function yd(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}const v={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELTYPE:"CELTYPE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLEADERSTYLE:"CMLEADERSTYLE",CMLSCALE:"CMLSCALE",CMLSTYLE:"CMLSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",DWGNAME:"DWGNAME",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",GRIPCOLOR:"GRIPCOLOR",GRIPHOT:"GRIPHOT",GRIPOBJLIMIT:"GRIPOBJLIMIT",GRIPS:"GRIPS",GRIPSIZE:"GRIPSIZE",HPANG:"HPANG",HPASSOC:"HPASSOC",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENT:"MEASUREMENT",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",MODELBKCOLOR:"MODELBKCOLOR",OSMODE:"OSMODE",ORTHOMODE:"ORTHOMODE",PAPERBKCOLOR:"PAPERBKCOLOR",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",POLARADDANG:"POLARADDANG",POLARMODE:"POLARMODE",POLARANG:"POLARANG",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",UNITMODE:"UNITMODE"},md=Object.freeze(Object.values(v)),Jn=class Jn{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new q},this.registerVar({name:v.ANGBASE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:v.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:v.AUNITS,type:"number",isDbVar:!0,defaultValue:dt.DecimalDegrees}),this.registerVar({name:v.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:v.CECOLOR,type:"color",isDbVar:!0,defaultValue:new X(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:v.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:v.CELTYPE,type:"string",isDbVar:!0,defaultValue:J}),this.registerVar({name:v.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:exports.AcGiLineWeight.ByLayer}),this.registerVar({name:v.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new Q}),this.registerVar({name:v.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:v.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:ie}),this.registerVar({name:v.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:v.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:ne}),this.registerVar({name:v.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:v.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:v.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:v.DWGNAME,type:"string",isDbVar:!0,readOnly:!0,defaultValue:"Drawing1.dwg"}),this.registerVar({name:v.GRIPCOLOR,type:"number",isDbVar:!1,defaultValue:Ka}),this.registerVar({name:v.GRIPHOT,type:"number",isDbVar:!1,defaultValue:Za}),this.registerVar({name:v.GRIPOBJLIMIT,type:"number",isDbVar:!1,defaultValue:100}),this.registerVar({name:v.GRIPS,type:"number",isDbVar:!1,defaultValue:2}),this.registerVar({name:v.GRIPSIZE,type:"number",isDbVar:!1,defaultValue:Qa}),this.registerVar({name:v.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:v.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:v.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new X(exports.AcCmColorMethod.None)}),this.registerVar({name:v.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new X(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:v.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:v.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:v.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:v.HPNAME,type:"string",isDbVar:!1,defaultValue:Wa}),this.registerVar({name:v.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:v.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:v.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new Q}),this.registerVar({name:v.INSUNITS,type:"number",isDbVar:!0,defaultValue:H.Millimeters}),this.registerVar({name:v.LUNITS,type:"number",isDbVar:!0,defaultValue:$.Decimal}),this.registerVar({name:v.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:v.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:v.MEASUREMENT,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:v.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new X(exports.AcCmColorMethod.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:v.MODELBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new X(exports.AcCmColorMethod.ByColor);return t.setRGB(0,0,0),t})()}),this.registerVar({name:v.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:v.ORTHOMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:v.PAPERBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new X(exports.AcCmColorMethod.ByColor);return t.setRGB(255,255,255),t})()}),this.registerVar({name:v.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:v.POLARADDANG,type:"string",isDbVar:!1,defaultValue:""}),this.registerVar({name:v.POLARMODE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:v.POLARANG,type:"number",isDbVar:!1,defaultValue:90}),this.registerVar({name:v.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:v.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:K}),this.registerVar({name:v.UNITMODE,type:"number",isDbVar:!0,defaultValue:0})}static instance(){return this._instance||(this._instance=new Jn),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const n=this.getDescriptor(t);if(!n)throw new Error(`System variable ${t} not found!`);if(n.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}getDefaultValue(t){t=this.normalizeName(t);const e=this.getDescriptor(t);if(!e)throw new Error(`System variable ${t} not found!`);return e.defaultValue}applyVarMutation(t,e,n,r,s){const o=this.normalizeName(t);if(this.hasValueChanged(e,n)){if(r.transactionManager.isRecording())r.transactionManager.recordSysvar(o,e);else if(r.transactionManager.strictMode&&!r.transactionManager.isApplyingUndoRedo())throw new Error(`Cannot change system variable ${o} outside an active transaction.`);s(),!r.transactionManager.isApplyingUndoRedo()&&!r.transactionManager.isRecording()&&this.events.sysVarChanged.dispatch({database:r,name:o,newVal:n,oldVal:e})}}setVar(t,e,n){t=this.normalizeName(t);const r=this.getDescriptor(t);if(r){if(r.readOnly)throw new Error(`System variable ${t} is read-only!`);const s=this.getVar(t,n);if(r.type==="transparency"){const o=this.parseTransparency(e);if(o==null||o.isInvalid)throw new Error("Invalid transparency value!");e=o}else if(r.type!=="string"&&(typeof e=="string"||e instanceof String)){if(r.type==="number"){const o=Number(e);if(Number.isNaN(o))throw new Error("Invalid number input!");e=o}else if(r.type==="boolean")e=this.parseBoolean(e);else if(r.type==="color"){const o=this.parseColorSysVar(t,e,n);if(o==null)throw new Error("Invalid color value!");e=o}}if(t===v.GRIPCOLOR.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<ir||o>rr)throw new Error(`Invalid GRIPCOLOR value! Valid range is ${ir} to ${rr}.`);e=o}if(t===v.GRIPHOT.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<sr||o>or)throw new Error(`Invalid GRIPHOT value! Valid range is ${sr} to ${or}.`);e=o}if(t===v.GRIPOBJLIMIT.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<0||o>32767)throw new Error("Invalid GRIPOBJLIMIT value! Valid range is 0 to 32767.");e=o}if(t===v.GRIPS.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<0||o>2)throw new Error("Invalid GRIPS value! Valid range is 0 to 2.");e=o}if(t===v.GRIPSIZE.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<ar||o>lr)throw new Error(`Invalid GRIPSIZE value! Valid range is ${ar} to ${lr}.`);e=o}r.isDbVar?this.applyVarMutation(t,s,e,n,()=>{n[t.toLowerCase()]=e}):this.applyVarMutation(t,s,e,n,()=>{this.cache.set(t,e)})}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),n=new Set(["true","t","1","yes","y"]),r=new Set(["false","f","0","no","n"]);return n.has(e)?!0:(r.has(e),!1)}parseColorSysVar(t,e,n){const r=e.trim().toLowerCase();return t===v.HPCOLOR.toLowerCase()&&(r==="."||r==="use current")?n.cecolor.clone():t===v.HPBACKGROUNDCOLOR.toLowerCase()&&(r===""||r==="."||r==="none")?new X(exports.AcCmColorMethod.None):X.fromString(e)}parseTransparency(t){if(t instanceof Q)return t;if(typeof t=="number")return Q.deserialize(t);if(!(typeof t!="string"&&!(t instanceof String)))return Q.fromString(String(t))}hasValueChanged(t,e){return t instanceof X&&e instanceof X||t instanceof Q&&e instanceof Q?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};Jn._instance=null;let et=Jn;const ul="Load Database",Mo=3e4,_d=12e4,bd=1024*1024;class ht extends ea{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Jr.getInstance().getEntry(ul),n=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",r?r.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-n),r}}class dl{constructor(t={}){this.config={useWorker:t.useWorker??!0,...t}}async read(t,e,n,r,s,o){const a={name:ul,data:{total:0},format(){let u="";return Object.keys(this.data).forEach(g=>{g!=="total"&&(u+=`- ${g}: ${this.data[g]} ms
|
|
4
|
+
`)}),u+=`- total: ${this.data.total} ms`,u}};Jr.getInstance().collect(a),this.progress=r;const l={value:0},h=new na;h.setCompleteCallback(()=>this.onFinished()),h.setErrorCallback(u=>this.onError(u)),h.addTask(new ht({stage:"START",step:1,progress:l,task:async u=>u},r)),h.addTask(new ht({stage:"PARSE",step:5,progress:l,task:async u=>await this.parse(u,s)},r)),h.addTask(new ht({stage:"FONT",step:5,progress:l,task:async u=>{const g=this.getFonts(u.model);return{model:u.model,data:g}}},r)),h.addTask(new ht({stage:"LTYPE",step:1,progress:l,task:async u=>(this.processLineTypes(u.model,e),u)},r)),h.addTask(new ht({stage:"STYLE",step:1,progress:l,task:async u=>(this.processTextStyles(u.model,e),u)},r)),h.addTask(new ht({stage:"DIMSTYLE",step:1,progress:l,task:async u=>(this.processDimStyles(u.model,e),u)},r)),h.addTask(new ht({stage:"LAYER",step:1,progress:l,task:async u=>(this.processLayers(u.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),u)},r)),h.addTask(new ht({stage:"VPORT",step:1,progress:l,task:async u=>(this.processViewports(u.model,e),u)},r)),h.addTask(new ht({stage:"HEADER",step:1,progress:l,task:async u=>{if(this.processClasses(u.model,e),this.processHeader(u.model,e),o){const g=et.instance();for(const[d,f]of Object.entries(o))g.setVar(d,f,e)}return u}},r)),h.addTask(new ht({stage:"BLOCK_RECORD",step:5,progress:l,task:async u=>(this.processBlockTables(u.model,e),u)},r)),h.addTask(new ht({stage:"OBJECT",step:5,progress:l,task:async u=>(this.processObjects(u.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),u)},r)),h.addTask(new ht({stage:"BLOCK",step:5,progress:l,task:async u=>(await this.processBlocks(u.model,e),u)},r)),h.addTask(new ht({stage:"ENTITY",step:100,progress:l,task:async u=>(await this.processEntities(u.model,e,n,l,r),u)},r)),h.addTask(new ht({stage:"END",step:0,progress:l,task:async u=>u},r));const c=Date.now();await h.run(t),a.data.total=Date.now()-c}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),me.instance.clear())}getParserWorkerTimeout(t,e){const n=e??this.config.timeout;if(n!=null)return n;const r=Math.ceil(t.byteLength/bd),s=Mo+r*1e3;return Math.min(_d,Math.max(Mo,s))}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processClasses(t,e){}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,n,r,s){throw new Error("Not impelemented yet!")}}class gl extends dl{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,n,r,s){let o=t.tables.blockTable.modelSpace.newIterator().toArray();const a=o.length,l=new cl(a,100-r.value,n);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const h=e.tables.blockTable.modelSpace;await l.processChunk(async(c,u)=>{let g=[],d=c<u?o[c].type:"";for(let f=c;f<u;f++){const p=o[f];this.config.convertByEntityType&&p.type!==d&&(this.triggerEvents(h,g),g=[],d=p.type),g.push(p)}if(this.triggerEvents(h,g),s){let f=r.value+u/a*(100-r.value);f>100&&(f=100),await s(f,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const n=e.newIterator().toArray();this.triggerEvents(e,n)}}processHeader(){}processClasses(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const o of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:o,key:o.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const o of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:o,key:o.objectId});const n=this._database.objects.mleaderStyle.newIterator();for(const o of n)this._database.events.dictObjetSet.dispatch({database:this._database,object:o,key:o.objectId});const r=this._database.objects.layerFilter.newIterator();for(const o of r)this._database.events.dictObjetSet.dispatch({database:this._database,object:o,key:o.objectId});const s=this._database.objects.layerIndex.newIterator();for(const o of s)this._database.events.dictObjetSet.dispatch({database:this._database,object:o,key:o.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},n=[];for(const r of t)e[r.type]||(e[r.type]=[],n.push(r.type)),e[r.type].push(r);return n.flatMap(r=>e[r])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}class fl{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const n=Date.now(),r=this.generateTaskId();try{return await this.executeInWorker(r,t,e||this.config.workerUrl)}catch(s){const o=Date.now()-n,a=s instanceof Error?s.message:String(s);return{success:!1,error:a,errorCode:a.toLowerCase().includes("timed out")?"worker_timeout":void 0,duration:o}}}async executeInWorker(t,e,n){const r=Date.now();return new Promise((s,o)=>{const a=this.getAvailableWorker(n),l=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(a),o(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:u=>{clearTimeout(l),this.releaseWorker(a),s(u)},reject:u=>{clearTimeout(l),this.releaseWorker(a),o(u)},timeout:l});const h=u=>{const{id:g,success:d,data:f,error:p,errorCode:y}=u.data;if(g!==t)return;this.cleanupTask(t);const _=Date.now()-r;s(d?{success:!0,data:f,duration:_}:{success:!1,error:p,errorCode:y,duration:_})},c=u=>{this.cleanupTask(t),o(new Error(`Worker error: ${u.message}`))};a.addEventListener("message",h),a.addEventListener("error",c),a.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[n,r]of this.workers)if(!r.isBusy)return r.isBusy=!0,r.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const n=new Worker(t,{type:"module"}),r=this.generateWorkerId(),s={worker:n,isBusy:!0,id:r,createdAt:new Date};return this.workers.set(r,s),n}const e=Array.from(this.workers.values()).sort((n,r)=>n.createdAt.getTime()-r.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,n]of this.workers)if(n.worker===t){n.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class pl{constructor(t){this.framework=new fl(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function wd(i){return new pl(i)}class xd{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:n}=t.data;try{const r=await this.executeTask(n);this.sendResponse(e,!0,r)}catch(r){this.sendResponse(e,!1,void 0,r instanceof Error?r.message:String(r))}}}sendResponse(t,e,n,r,s){const o={id:t,success:e,data:n,error:r,errorCode:s};try{self.postMessage(o)}catch(a){const l=a instanceof Error?a.message:String(a);self.postMessage({id:t,success:!1,error:l,errorCode:this.classifyPostMessageError(l)})}}classifyPostMessageError(t){const e=t.toLowerCase();return e.includes("out of memory")||e.includes("data cannot be cloned")?"worker_oom":"worker_error"}}var Je=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Je||{});class Ot{constructor(){this.events={registered:new q,unregistered:new q},this._converters=new Map}static createInstance(){return Ot._instance==null&&(Ot._instance=new Ot),this._instance}static get instance(){return Ot._instance||(Ot._instance=new Ot),Ot._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}var yl=(i=>(i[i.Center=0]="Center",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.OverFirst=3]="OverFirst",i[i.OverSecond=4]="OverSecond",i))(yl||{}),us=(i=>(i[i.Center=0]="Center",i[i.Above=1]="Above",i[i.Outside=2]="Outside",i[i.JIS=3]="JIS",i[i.Below=4]="Below",i))(us||{}),ml=(i=>(i[i.Feet=0]="Feet",i[i.None=1]="None",i[i.Inch=2]="Inch",i[i.FeetAndInch=3]="FeetAndInch",i[i.Leading=4]="Leading",i[i.Trailing=8]="Trailing",i[i.LeadingAndTrailing=12]="LeadingAndTrailing",i))(ml||{}),_l=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(_l||{}),bl=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(bl||{});const ti=class ti extends ae{constructor(t,e){t=t||{},It(t,ti.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}dxfOutFields(t){super.dxfOutFields(t);const e=this.database.tables.textStyleTable.getAt(this.dimtxsty),n=this.database.tables.blockTable.getAt(this.dimldrblk),r=this.database.tables.blockTable.getAt(this.dimblk),s=this.database.tables.blockTable.getAt(this.dimblk1),o=this.database.tables.blockTable.getAt(this.dimblk2);return t.writeSubclassMarker("AcDbDimStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),t.writeString(3,this.dimpost),t.writeString(4,this.dimapost),t.writeDouble(40,this.dimscale),t.writeDouble(41,this.dimasz),t.writeDouble(42,this.dimexo),t.writeDouble(43,this.dimdli),t.writeDouble(44,this.dimexe),t.writeDouble(140,this.dimtxt),t.writeDouble(147,this.dimgap),t.writeInt16(170,this.dimalt),t.writeInt16(171,this.dimtol),t.writeInt16(172,this.dimlim),t.writeInt16(173,this.dimtih),t.writeInt16(174,this.dimtoh),t.writeObjectId(340,e==null?void 0:e.objectId),t.writeObjectId(341,n==null?void 0:n.objectId),t.writeObjectId(342,r==null?void 0:r.objectId),t.writeObjectId(343,s==null?void 0:s.objectId),t.writeObjectId(344,o==null?void 0:o.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};ti.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:K,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let vt=ti;function wl(){return{color:new X,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new Q,linetype:"",lineWeight:1,materialId:-1}}const vd=["name",...Object.keys(wl())];class di extends ae{constructor(t,e){t=t||{},It(t,wl()),super(t,e)}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeCmColor(this.color),t.writeString(6,this.linetype),t.writeInt16(290,this.isPlottable?1:0),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency),this.description&&t.writeString(4,this.description),this}}class pe extends ae{constructor(t,e){t=t||{},It(t,{standardFlag:0,description:"",totalPatternLength:0}),super(t,e)}get numDashes(){const t=this.getAttrWithoutException("pattern");return t?t.length:0}get patternLength(){return this.getAttr("totalPatternLength")}get comments(){return this.getAttr("description")}get linetype(){return{name:this.name,standardFlag:this.getAttr("standardFlag"),description:this.getAttr("description"),totalPatternLength:this.getAttr("totalPatternLength"),pattern:this.getAttrWithoutException("pattern")}}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this.getAttr("pattern")[t].elementLength}toPreviewSvgString(t){const e=Math.max((t==null?void 0:t.width)??220,1),n=Math.max((t==null?void 0:t.height)??36,1),r=Math.min(Math.max((t==null?void 0:t.padding)??8,0),Math.floor(e/2)),s=Math.max((t==null?void 0:t.strokeWidth)??2,.5),o=this.escapeSvgAttribute((t==null?void 0:t.stroke)??"currentColor"),a=Math.max((t==null?void 0:t.repeats)??4,1),l=n/2,h=r,c=Math.max(e-r,h+1),u=c-h,g=this.getAttrWithoutException("pattern")??[];if(g.length===0||this.patternLength<=0||!g.some(P=>P.elementLength!==0))return this.buildSvgString({width:e,height:n,stroke:o,strokeWidth:s,lineSegments:[[h,c]],dots:[],y:l});const d=[],f=[],p=u/(this.patternLength*a),y=.5,_=Math.max(s*2,2);let x=h;for(;x<c;)for(const P of g){if(x>=c)break;const A=P.elementLength;if(A===0){f.push(x),x=Math.min(x+_,c);continue}const I=Math.max(Math.abs(A)*p,y),E=Math.min(x+I,c);A>0&&E>x&&d.push([x,E]),x=E}return this.buildSvgString({width:e,height:n,stroke:o,strokeWidth:s,lineSegments:d,dots:f,y:l})}buildSvgString(t){const{width:e,height:n,stroke:r,strokeWidth:s,lineSegments:o,dots:a,y:l}=t,h=o.map(([u,g])=>`<line x1="${u.toFixed(2)}" y1="${l.toFixed(2)}" x2="${g.toFixed(2)}" y2="${l.toFixed(2)}" stroke="${r}" stroke-width="${s.toFixed(2)}" stroke-linecap="round" />`).join(""),c=a.map(u=>`<circle cx="${u.toFixed(2)}" cy="${l.toFixed(2)}" r="${(s/2).toFixed(2)}" fill="${r}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${n}" viewBox="0 0 ${e} ${n}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${h}${c}</svg>`}escapeSvgAttribute(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'")}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLinetypeTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.getAttr("standardFlag")),t.writeString(3,this.comments),t.writeInt16(72,65),t.writeInt16(73,this.numDashes),t.writeDouble(40,this.patternLength);for(const e of this.getAttrWithoutException("pattern")??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class ds extends ae{constructor(t,e){t=t||{},It(t,{standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:0,font:"",bigFont:""}),super(t,e),this.setAttr("font",this.getFileNameWithoutExtension(this.getAttr("font")||this.getAttrWithoutException("extendedFont")||this.name))}get obliquingAngle(){return this.getAttr("obliqueAngle")}set obliquingAngle(t){this.setAttr("obliqueAngle",t)}get priorSize(){return this.getAttr("lastHeight")}set priorSize(t){this.setAttr("lastHeight",t)}get textSize(){return this.getAttr("fixedTextHeight")}set textSize(t){this.setAttr("fixedTextHeight",t)}get xScale(){return this.getAttr("widthFactor")}set xScale(t){this.setAttr("widthFactor",t)}get isVertical(){return(this.getAttr("standardFlag")&4)===4}set isVertical(t){const e=this.getAttr("standardFlag");this.setAttr("standardFlag",t?e|4:e&-5)}get isShapeFile(){return(this.getAttr("standardFlag")&1)===1}set isShapeFile(t){const e=this.getAttr("standardFlag");this.setAttr("standardFlag",t?e|1:e&-2)}get fileName(){return this.getAttr("font")}set fileName(t){this.setAttr("font",t)}get bigFontFileName(){return this.getAttr("bigFont")}set bigFontFileName(t){this.setAttr("bigFont",t)}get textStyle(){return{name:this.name,standardFlag:this.getAttr("standardFlag"),fixedTextHeight:this.getAttr("fixedTextHeight"),widthFactor:this.getAttr("widthFactor"),obliqueAngle:this.getAttr("obliqueAngle"),textGenerationFlag:this.getAttr("textGenerationFlag"),lastHeight:this.getAttr("lastHeight"),font:this.getAttr("font"),bigFont:this.getAttr("bigFont"),extendedFont:this.getAttrWithoutException("extendedFont")}}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const n=e.lastIndexOf(".");return n===-1?e:e.substring(0,n)}return t}get dxfFontFileName(){var e;const t=((e=this.fileName)==null?void 0:e.trim())??"";return!t||!this.isShapeFile||/\.[^./\\]+$/i.test(t)?t:`${t}.shx`}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.getAttr("standardFlag")),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.getAttr("textGenerationFlag")),t.writeDouble(42,this.priorSize),t.writeString(3,this.dxfFontFileName),t.writeString(4,this.bigFontFileName),this}}var w=(i=>(i[i.EndPoint=1]="EndPoint",i[i.MidPoint=2]="MidPoint",i[i.Center=3]="Center",i[i.Node=4]="Node",i[i.Quadrant=5]="Quadrant",i[i.Insertion=7]="Insertion",i[i.Perpendicular=8]="Perpendicular",i[i.Tangent=9]="Tangent",i[i.Nearest=10]="Nearest",i[i.Centroid=11]="Centroid",i))(w||{});function Pd(i){let t=0;for(const e of i)t|=1<<e-1;return t}function Ad(i){const t=[];for(const e of Object.values(w)){if(typeof e!="number")continue;const n=1<<e-1;(i&n)!==0&&t.push(e)}return t}function Sd(i,t){return i^1<<t-1}function Ld(i,t){return(i&1<<t-1)!==0}const Ed={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:23},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:24}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:26}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:28},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:29}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:31},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:32}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:34},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:35},{angle:45,originX:.353553391,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:36},{angle:45,originX:.530330086,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:37}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:39},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.3125,-.0625,0,-.0625],sourceLine:40}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:.21875,deltaY:.125,dashes:[.3125,-.0625,0,-.0625],sourceLine:42}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:45}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:47},{angle:135,originX:0,originY:0,deltaX:.25,deltaY:.125,dashes:[.3125,-.1875],sourceLine:48}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:54},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[8,-8],sourceLine:55}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:57},{angle:0,originX:-8,originY:.375,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:58},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:59},{angle:90,originX:-.375,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:60}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:62},{angle:90,originX:0,originY:0,deltaX:8,deltaY:4,dashes:[8,-8],sourceLine:63}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:65},{angle:0,originX:0,originY:2.25,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:66},{angle:0,originX:2,originY:2.667,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:67},{angle:0,originX:2,originY:4.917,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:68},{angle:90,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:69},{angle:90,originX:-.375,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:70},{angle:90,originX:2,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:71},{angle:90,originX:1.625,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:72}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:2.667,dashes:[],sourceLine:74},{angle:90,originX:0,originY:0,deltaX:2.667,deltaY:4,dashes:[2.667,-2.667],sourceLine:75}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:77},{angle:355,originX:0,originY:0,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:78},{angle:100.45144446,originX:.59771681,originY:-.05229344,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.63740192,-7.01142112],sourceLine:79},{angle:46.1842,originX:0,originY:2,deltaX:6.19462554,deltaY:-8.84684596,dashes:[1.125,-12.375],sourceLine:80},{angle:96.63563549,originX:.88936745,originY:1.86206693,deltaX:8.59588239,deltaY:-10.40964966,dashes:[.95610342,-10.5171376],sourceLine:81},{angle:351.18416399,originX:0,originY:2,deltaX:7.74327494,deltaY:11.05855746,dashes:[.9,-9.90000001],sourceLine:82},{angle:21,originX:1,originY:1.5,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:83},{angle:326,originX:1,originY:1.5,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:84},{angle:71.45144474,originX:1.49742254,originY:1.16448426,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.6374019,-7.01142112],sourceLine:85},{angle:37.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-6.52,0,-6.7,0,-6.625],sourceLine:86},{angle:7.5,originX:0,originY:0,deltaX:3.123,deltaY:3.567,dashes:[0,-3.82,0,-6.37,0,-2.525],sourceLine:87},{angle:-32.5,originX:-2.23,originY:0,deltaX:4.6234,deltaY:2.678,dashes:[0,-2.5,0,-7.8,0,-10.35],sourceLine:88},{angle:-42.5,originX:-3.23,originY:0,deltaX:3.6234,deltaY:4.678,dashes:[0,-3.25,0,-5.18,0,-7.35],sourceLine:89}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:4,deltaY:4,dashes:[12,-4],sourceLine:91},{angle:135,originX:2.828427125,originY:2.828427125,deltaX:4,deltaY:-4,dashes:[12,-4],sourceLine:92}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:94},{angle:90,originX:2,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:95},{angle:90,originX:4,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:96},{angle:90,originX:6,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:97},{angle:90,originX:8,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:98},{angle:90,originX:10,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:99},{angle:90,originX:12,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:100},{angle:0,originX:0,originY:12,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:101},{angle:0,originX:0,originY:14,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:102},{angle:0,originX:0,originY:16,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:103},{angle:0,originX:0,originY:18,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:104},{angle:0,originX:0,originY:20,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:105},{angle:0,originX:0,originY:22,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:106},{angle:0,originX:0,originY:24,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:107}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:2.2,deltaY:1,dashes:[15,-2,5,-1],sourceLine:109},{angle:0,originX:1.33,originY:.5,deltaX:-1,deltaY:1.33,dashes:[3,-.33,6,-.75],sourceLine:110},{angle:0,originX:.5,originY:.85,deltaX:5.2,deltaY:.67,dashes:[8,-1.4,4,-1],sourceLine:111}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:25.5,deltaY:12,dashes:[6,-5,7,-3,9,-4],sourceLine:113},{angle:0,originX:6,originY:.5,deltaX:25.5,deltaY:12,dashes:[5,-19,4,-6],sourceLine:114},{angle:0,originX:18,originY:-.75,deltaX:25.5,deltaY:12,dashes:[3,-31],sourceLine:115},{angle:90,originX:0,originY:0,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:116},{angle:90,originX:6,originY:0,deltaX:12,deltaY:8.5,dashes:[11.25,-36.75],sourceLine:117},{angle:90,originX:11,originY:0,deltaX:12,deltaY:8.5,dashes:[10.5,-37.5],sourceLine:118},{angle:90,originX:18,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:119},{angle:90,originX:21,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:120},{angle:90,originX:30,originY:0,deltaX:12,deltaY:8.5,dashes:[11,-37],sourceLine:121}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:1.123,deltaY:1.567,dashes:[0,-1.52,0,-1.7,0,-1.625],sourceLine:123},{angle:7.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-.82,0,-1.37,0,-.525],sourceLine:124},{angle:-32.5,originX:-1.23,originY:0,deltaX:2.6234,deltaY:1.678,dashes:[0,-.5,0,-1.8,0,-2.35],sourceLine:125},{angle:-42.5,originX:-1.23,originY:0,deltaX:1.6234,deltaY:2.678,dashes:[0,-.25,0,-1.18,0,-1.35],sourceLine:126}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:128},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:129},{angle:0,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:130},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:131},{angle:0,originX:0,originY:.5,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:132},{angle:0,originX:0,originY:.75,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:133},{angle:90,originX:.5,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:134},{angle:90,originX:.75,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:135}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:137},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:138}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:140},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.5,dashes:[.25,-.25],sourceLine:141},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:.5,dashes:[-.25,.25],sourceLine:142}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.33,dashes:[],sourceLine:144},{angle:90,originX:.9,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:145},{angle:90,originX:.8,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:146},{angle:0,originX:.9,originY:.055,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:147},{angle:0,originX:.9,originY:.11,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:148},{angle:0,originX:.9,originY:.165,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:149},{angle:0,originX:.9,originY:.22,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:150},{angle:0,originX:.9,originY:.275,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:151}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.1875,dashes:[],sourceLine:153},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.1875,dashes:[],sourceLine:154},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.1875,dashes:[],sourceLine:155},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.1875,dashes:[.1875,-.125],sourceLine:156}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:158},{angle:135,originX:.0625,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:159},{angle:135,originX:.09375,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:160},{angle:135,originX:.125,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:161}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:163},{angle:90,originX:.0625,originY:-.0625,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:164}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:166}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:168},{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[.3535533905932738,-.7071067811865476],sourceLine:169}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.03125,deltaY:.0625,dashes:[0,-.0625],sourceLine:171}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:173},{angle:0,originX:0,originY:.09375,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:174},{angle:0,originX:0,originY:.1875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:175},{angle:90,originX:.03125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:176},{angle:90,originX:.125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:177},{angle:90,originX:.21875,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:178}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:180},{angle:180,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:181},{angle:300,originX:0,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:182},{angle:60,originX:.1,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:183},{angle:300,originX:.1,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:184},{angle:60,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:185},{angle:180,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:186},{angle:300,originX:-.05,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:187},{angle:180,originX:-.05,originY:-.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:188},{angle:60,originX:-.4,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:189},{angle:300,originX:-.4,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:190},{angle:60,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:191},{angle:180,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:192},{angle:300,originX:.2,originY:.346410161,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:193},{angle:180,originX:.2,originY:.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:194},{angle:0,originX:.2,originY:.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:195},{angle:0,originX:.2,originY:-.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:196},{angle:120,originX:.05,originY:.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:197},{angle:120,originX:-.25,originY:.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:198},{angle:240,originX:-.25,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:199},{angle:240,originX:.05,originY:-.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:200}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[.25,-.25],sourceLine:202},{angle:45,originX:.25,originY:0,deltaX:.176776695296,deltaY:.176776695296,dashes:[.0625,-.2285533906,.0625,-.353553390593],sourceLine:203}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:205},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:206},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:207}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:209},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:210},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:211}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:213},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:214},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:215}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:.707106781,deltaY:.707106781,dashes:[.1875,-1.226713563],sourceLine:217},{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:218},{angle:135,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:219}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.03125,dashes:[],sourceLine:221},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:222}]},{name:"GRAVEL",description:"",lines:[{angle:228.012787504,originX:.72,originY:1,deltaX:12.0413651692039,deltaY:.0743294146632,dashes:[.134536,-13.3190880470737],sourceLine:224},{angle:184.969740728,originX:.63,originY:.9,deltaX:-12.0415166747131,deltaY:.0433148081592,dashes:[.230868,-22.85592476123],sourceLine:225},{angle:132.510447078,originX:.4,originY:.88,deltaX:-14.8659418273816,deltaY:.061429511683,dashes:[.162788,-16.1160325960997],sourceLine:226},{angle:267.273689006,originX:.01,originY:.63,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:227},{angle:292.833654178,originX:0,originY:.42,deltaX:-12.9999095019474,deltaY:.048507125026,dashes:[.206155,-20.4093731280883],sourceLine:228},{angle:357.273689006,originX:.08,originY:.23,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:229},{angle:37.6942404667,originX:.29,originY:.22,deltaX:-16.4011800288558,deltaY:.0359675000664,dashes:[.278029,-27.524848548916],sourceLine:230},{angle:72.2553283749,originX:.51,originY:.39,deltaX:23.0867613281116,deltaY:.0380969659053,dashes:[.262488,-25.9863214968134],sourceLine:231},{angle:121.429565615,originX:.59,originY:.64,deltaX:15.2642639131074,deltaY:.047404546271,dashes:[.21095,-20.884073109729],sourceLine:232},{angle:175.236358309,originX:.48,originY:.82,deltaX:-11.0450488205478,deltaY:.083045479801,dashes:[.240832,-11.8007625787923],sourceLine:233},{angle:222.397437798,originX:.24,originY:.84,deltaX:16.2787889313724,deltaY:.0321080648114,dashes:[.311448,-30.8333750047949],sourceLine:234},{angle:138.814074834,originX:1,originY:.62,deltaX:9.2190645101588,deltaY:.0940720868851,dashes:[.106301,-10.5238448127347],sourceLine:235},{angle:171.46923439,originX:.92,originY:.69,deltaX:-13.1528534931484,deltaY:.0494468176315,dashes:[.202237,-20.021511416157],sourceLine:236},{angle:225,originX:.72,originY:.72,deltaX:.7071067811865,deltaY:.7071067811865,dashes:[.141421,-1.2727925623731],sourceLine:237},{angle:203.198590514,originX:.65,originY:.84,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.076158,-7.5396151058639],sourceLine:238},{angle:291.801409486,originX:.58,originY:.81,deltaX:-3.156820749011,deltaY:.185695338158,dashes:[.107703,-5.2774618071345],sourceLine:239},{angle:30.9637565321,originX:.62,originY:.71,deltaX:3.6014702879928,deltaY:.1714985851408,dashes:[.174929,-5.6560228948453],sourceLine:240},{angle:161.565051177,originX:.77,originY:.8,deltaX:-2.2135943621183,deltaY:.3162277660138,dashes:[.126491,-3.0357866601684],sourceLine:241},{angle:16.389540334,originX:0,originY:.81,deltaX:10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.5428451466694],sourceLine:242},{angle:70.3461759419,originX:.17,originY:.86,deltaX:-11.7045066155395,deltaY:.0672672793901,dashes:[.148661,-14.717407747319],sourceLine:243},{angle:293.198590514,originX:.77,originY:1,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.152315,-7.4634581058639],sourceLine:244},{angle:343.610459666,originX:.83,originY:.86,deltaX:-10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.542845146669],sourceLine:245},{angle:339.44395478,originX:0,originY:.19,deltaX:-5.3838927710229,deltaY:.117041147157,dashes:[.17088,-8.3731237453175],sourceLine:246},{angle:294.775140569,originX:.16,originY:.13,deltaX:-12.0828441168135,deltaY:.0698430296124,dashes:[.143178,-14.174643063276],sourceLine:247},{angle:66.8014094864,originX:.78,originY:0,deltaX:5.3835637472487,deltaY:.1313064328552,dashes:[.152315,-7.4634581058639],sourceLine:248},{angle:17.3540246363,originX:.84,originY:.14,deltaX:-13.6013396869991,deltaY:.0596549986364,dashes:[.167631,-16.59542361424],sourceLine:249},{angle:69.4439547804,originX:.29,originY:0,deltaX:-5.383892771022,deltaY:.1170411471946,dashes:[.08544,-8.4585637453175],sourceLine:250},{angle:101.309932474,originX:.72,originY:0,deltaX:4.1184388379018,deltaY:.1961161351396,dashes:[.05099,-5.0480295135928],sourceLine:251},{angle:165.963756532,originX:.71,originY:.05,deltaX:-3.1529631254726,deltaY:.2425356250323,dashes:[.206155,-3.9169506256177],sourceLine:252},{angle:186.009005957,originX:.51,originY:.1,deltaX:-10.0497393137326,deltaY:.0523423921723,dashes:[.19105,-18.9139231745428],sourceLine:253},{angle:303.690067526,originX:.62,originY:.62,deltaX:-2.2188007849008,deltaY:.2773500981134,dashes:[.144222,-3.461329275464],sourceLine:254},{angle:353.157226587,originX:.7,originY:.5,deltaX:17.1171966955143,deltaY:.0397150736497,dashes:[.251794,-24.9275626240283],sourceLine:255},{angle:60.9453959009,originX:.95,originY:.47,deltaX:-8.0616726575653,deltaY:.0971285862325,dashes:[.102956,-10.192674140987],sourceLine:256},{angle:90,originX:1,originY:.56,deltaX:1,deltaY:1,dashes:[.06,-.94],sourceLine:257},{angle:120.256437164,originX:.49,originY:.13,deltaX:-8.0619364083848,deltaY:.0719815751411,dashes:[.138924,-13.7535199894498],sourceLine:258},{angle:48.0127875042,originX:.42,originY:.25,deltaX:12.0413651692041,deltaY:.0743294146212,dashes:[.269072,-13.1845520470737],sourceLine:259},{angle:0,originX:.6,originY:.45,deltaX:1,deltaY:1,dashes:[.26,-.74],sourceLine:260},{angle:325.304846469,originX:.86,originY:.45,deltaX:12.2063917682497,deltaY:-.063245553253,dashes:[.158114,-15.653274300842],sourceLine:261},{angle:254.054604099,originX:.99,originY:.36,deltaX:4.1208169184605,deltaY:.1373605639542,dashes:[.145602,-7.1345078892805],sourceLine:262},{angle:207.645975364,originX:.95,originY:.22,deltaX:21.4708691170287,deltaY:.0421824539631,dashes:[.237065,-23.4694741822594],sourceLine:263},{angle:175.42607874,originX:.74,originY:.11,deltaX:13.0383438432524,deltaY:.039872611164,dashes:[.250799,-24.8290734079689],sourceLine:264}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:266},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:267},{angle:60,originX:.125,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:268}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:270},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:271},{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[-.25,.125],sourceLine:272}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.0625,dashes:[1,-.5],sourceLine:274},{angle:90,originX:0,originY:0,deltaX:-.25,deltaY:.0625,dashes:[1,-.5],sourceLine:275}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:277},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:278},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:279}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:292}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:294}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:296}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:298}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:300},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:301}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:303}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:305}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:307}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:309}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:311}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:313}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:315},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:316}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:318},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:319}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:321},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:322}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:327}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.25,dashes:[.25,-.25,0,-.25,0,-.25],sourceLine:329}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:331},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:332}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:334},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:335},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:336}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:338},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:339},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:340}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:342},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:343},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:344},{angle:0,originX:0,originY:.15625,deltaX:0,deltaY:.25,dashes:[],sourceLine:345}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.09375,dashes:[],sourceLine:347},{angle:45,originX:.066291261,originY:0,deltaX:0,deltaY:.09375,dashes:[0,-.09375],sourceLine:348}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:350},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:351}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:353},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:354},{angle:120,originX:.0625,originY:.108253176,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:355}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:357},{angle:45,originX:0,originY:.0625,deltaX:0,deltaY:.125,dashes:[],sourceLine:358}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.125,-.875],sourceLine:360},{angle:90,originX:.0625,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.0625,-1.669550806],sourceLine:361},{angle:90,originX:.078125,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:362},{angle:90,originX:.046875,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:363},{angle:60,originX:.09375,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:364},{angle:120,originX:.03125,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:365}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:367},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.125],sourceLine:368}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:370},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:371},{angle:0,originX:-.09375,originY:.162379763,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:372}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:374},{angle:90,originX:.125,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:375}]}],issues:[]},xl={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:20},{angle:90,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:21}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:23}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:25},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:26}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:28},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:29}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:31},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:32},{angle:45,originX:8.98026,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:33},{angle:45,originX:13.4704,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:34}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:36},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:37}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:5.55625,deltaY:3.175,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:39}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:41},{angle:135,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:42}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:6.35,deltaY:3.175,dashes:[7.9375,-4.7625],sourceLine:45}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:47},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[203.2,-203.2],sourceLine:48}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:50},{angle:0,originX:-203.2,originY:9.525,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:51},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:52},{angle:90,originX:-9.525,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:53}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:55},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:101.6,dashes:[203.2,-203.2],sourceLine:56}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:58},{angle:0,originX:0,originY:57.15,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:59},{angle:0,originX:50.8,originY:67.7418,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:60},{angle:0,originX:50.8,originY:124.892,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:61},{angle:90,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:62},{angle:90,originX:-9.525,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:63},{angle:90,originX:50.8,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:64},{angle:90,originX:41.275,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:65}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:67.7418,dashes:[],sourceLine:67},{angle:90,originX:0,originY:0,deltaX:67.7418,deltaY:101.6,dashes:[67.7418,-67.7418],sourceLine:68}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:104.896,deltaY:-149.807,dashes:[19.05,-209.55],sourceLine:70},{angle:355,originX:0,originY:0,deltaX:-51.76101082,deltaY:187.25814969,dashes:[15.24,-167.64058417],sourceLine:71},{angle:100.4514447,originX:15.182007,originY:-1.3282535,deltaX:145.5569059,deltaY:-176.270089,dashes:[16.1900088,-178.0902446],sourceLine:72},{angle:46.1842,originX:0,originY:50.8,deltaX:157.343,deltaY:-224.71,dashes:[28.575,-314.325],sourceLine:73},{angle:96.63555761,originX:22.5899,originY:47.2965,deltaX:218.33577212,deltaY:-264.40480444,dashes:[24.28502314,-267.13560816],sourceLine:74},{angle:351.18415117,originX:0,originY:50.8,deltaX:196.67912063,deltaY:280.88740361,dashes:[22.85996707,-251.45973192],sourceLine:75},{angle:21,originX:25.4,originY:38.1,deltaX:104.89565868,deltaY:-149.80652586,dashes:[19.05,-209.55],sourceLine:76},{angle:326,originX:25.4,originY:38.1,deltaX:-51.7604,deltaY:187.258,dashes:[15.24,-167.64],sourceLine:77},{angle:71.451445,originX:38.0345326,originY:29.5779001,deltaX:145.5567546,deltaY:-176.2700748,dashes:[16.1900088,-178.0899376],sourceLine:78},{angle:37.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-165.608,0,-170.18,0,-168.275],sourceLine:79},{angle:7.5,originX:0,originY:0,deltaX:79.3242,deltaY:90.6018,dashes:[0,-97.028,0,-161.798,0,-64.135],sourceLine:80},{angle:-32.5,originX:-56.642,originY:0,deltaX:117.434,deltaY:68.0212,dashes:[0,-63.5,0,-198.12,0,-262.89],sourceLine:81},{angle:-42.5,originX:-82.042,originY:0,deltaX:92.0344,deltaY:118.821,dashes:[0,-82.55,0,-131.572,0,-186.69],sourceLine:82}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:101.6,deltaY:101.6,dashes:[304.8,-101.6],sourceLine:84},{angle:135,originX:71.842,originY:71.842,deltaX:101.6,deltaY:-101.6,dashes:[304.8,-101.6],sourceLine:85}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:87},{angle:90,originX:50.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:88},{angle:90,originX:101.6,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:89},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:90},{angle:90,originX:203.2,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:91},{angle:90,originX:254,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:92},{angle:90,originX:304.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:93},{angle:0,originX:0,originY:304.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:94},{angle:0,originX:0,originY:355.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:95},{angle:0,originX:0,originY:406.4,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:96},{angle:0,originX:0,originY:457.2,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:97},{angle:0,originX:0,originY:508,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:98},{angle:0,originX:0,originY:558.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:99},{angle:0,originX:0,originY:609.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:100}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:55.88,deltaY:25.4,dashes:[381,-50.8,127,-25.4],sourceLine:102},{angle:0,originX:33.782,originY:12.7,deltaX:-25.4,deltaY:33.782,dashes:[76.2,-8.382,152.4,-19.05],sourceLine:103},{angle:0,originX:12.7,originY:21.59,deltaX:132.08,deltaY:17.018,dashes:[203.2,-35.56,101.6,-25.4],sourceLine:104}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:647.7,deltaY:304.8,dashes:[152.4,-127,177.8,-76.2,228.6,-101.6],sourceLine:106},{angle:0,originX:152.4,originY:12.7,deltaX:647.7,deltaY:304.8,dashes:[127,-482.6,101.6,-152.4],sourceLine:107},{angle:0,originX:457.2,originY:-19.05,deltaX:647.7,deltaY:304.8,dashes:[76.2,-787.4],sourceLine:108},{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:109},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[285.75,-933.45],sourceLine:110},{angle:90,originX:279.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[266.7,-952.5],sourceLine:111},{angle:90,originX:457.2,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:112},{angle:90,originX:533.4,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:113},{angle:90,originX:762,originY:0,deltaX:304.8,deltaY:215.9,dashes:[279.4,-939.8],sourceLine:114}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:28.5242,deltaY:39.8018,dashes:[0,-38.608,0,-43.18,0,-41.275],sourceLine:116},{angle:7.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-20.828,0,-34.798,0,-13.335],sourceLine:117},{angle:-32.5,originX:-31.242,originY:0,deltaX:66.6344,deltaY:42.6212,dashes:[0,-12.7,0,-45.72,0,-59.69],sourceLine:118},{angle:-42.5,originX:-31.242,originY:0,deltaX:41.2344,deltaY:68.0212,dashes:[0,-6.35,0,-29.972,0,-34.29],sourceLine:119}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:121},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:122},{angle:0,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:123},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:124},{angle:0,originX:0,originY:12.7,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:125},{angle:0,originX:0,originY:19.05,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:126},{angle:90,originX:12.7,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:127},{angle:90,originX:19.05,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:128}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:130},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:131}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:133},{angle:90,originX:0,originY:0,deltaX:0,deltaY:12.7,dashes:[6.35,-6.35],sourceLine:134},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:12.7,dashes:[-6.35,6.35],sourceLine:135}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8.382,dashes:[],sourceLine:137},{angle:90,originX:22.86,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:138},{angle:90,originX:20.32,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:139},{angle:0,originX:22.86,originY:1.397,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:140},{angle:0,originX:22.86,originY:2.794,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:141},{angle:0,originX:22.86,originY:4.191,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:142},{angle:0,originX:22.86,originY:5.588,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:143},{angle:0,originX:22.86,originY:6.985,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:144}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:146},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:147},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:148},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:4.7625,dashes:[4.7625,-3.175],sourceLine:149}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:151},{angle:135,originX:1.5875,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:152},{angle:135,originX:2.38125,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:153},{angle:135,originX:3.175,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:154}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:156},{angle:90,originX:1.5875,originY:-1.5875,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:157}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:159}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:161},{angle:45,originX:0,originY:0,deltaX:0,deltaY:17.9605,dashes:[8.980256121069154,-17.960512242138307],sourceLine:162}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.79375,deltaY:1.5875,dashes:[0,-1.5875],sourceLine:164}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:166},{angle:0,originX:0,originY:2.38125,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:167},{angle:0,originX:0,originY:4.7625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:168},{angle:90,originX:.79375,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:169},{angle:90,originX:3.175,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:170},{angle:90,originX:5.55625,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:171}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:173},{angle:180,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:174},{angle:300,originX:0,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:175},{angle:60,originX:2.54,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:176},{angle:300,originX:2.54,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:177},{angle:60,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:178},{angle:180,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:179},{angle:300,originX:-1.27,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:180},{angle:180,originX:-1.27,originY:-2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:181},{angle:60,originX:-10.16,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:182},{angle:300,originX:-10.16,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:183},{angle:60,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:184},{angle:180,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:185},{angle:300,originX:5.08,originY:8.7988180894,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:186},{angle:180,originX:5.08,originY:8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:187},{angle:0,originX:5.08,originY:4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:188},{angle:0,originX:5.08,originY:-4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:189},{angle:120,originX:1.27,originY:6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:190},{angle:120,originX:-6.35,originY:2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:191},{angle:240,originX:-6.35,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:192},{angle:240,originX:1.27,originY:-6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:193}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:195},{angle:45,originX:6.35,originY:0,deltaX:4.490128053,deltaY:4.490128053,dashes:[1.5875,-5.8052561314,1.5875,-8.9802561314],sourceLine:196}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:198},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:199},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:200}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:202},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:203},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:204}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:206},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:207},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:208}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:17.96051224,deltaY:17.96051224,dashes:[4.7625,-31.15852448],sourceLine:210},{angle:45,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:211},{angle:135,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:212}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.79375,dashes:[],sourceLine:214},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:215}]},{name:"GRAVEL",description:"",lines:[{angle:228.0127875,originX:18.288,originY:25.4,deltaX:305.85067529778,deltaY:1.88796713245,dashes:[3.4172144,-338.30483639565],sourceLine:217},{angle:184.969741,originX:16.002,originY:22.86,deltaX:-305.8545235377,deltaY:1.10019612724,dashes:[5.8640472,-580.54048893524],sourceLine:218},{angle:132.5104471,originX:10.16,originY:22.352,deltaX:-377.59492241548,deltaY:1.56030959675,dashes:[4.1348152,-409.347227941],sourceLine:219},{angle:267.273689,originX:.254,originY:16.002,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:220},{angle:292.83365418,originX:0,originY:10.668,deltaX:-330.19770134945,deltaY:1.23208097566,dashes:[5.236337,-518.39807745344],sourceLine:221},{angle:357.273689,originX:2.032,originY:5.842,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:222},{angle:37.69424047,originX:7.366,originY:5.588,deltaX:-416.58997273292,deltaY:.91357450169,dashes:[7.0619366,-699.13115314247],sourceLine:223},{angle:72.25532837,originX:12.954,originY:9.906,deltaX:586.40373773403,deltaY:.96766293399,dashes:[6.6671952,-660.05256601905],sourceLine:224},{angle:121.42956562,originX:14.986,originY:16.256,deltaX:387.71230339293,deltaY:1.2040754753,dashes:[5.35813,-530.45545698712],sourceLine:225},{angle:175.2363583,originX:12.192,originY:20.828,deltaX:-280.5442400419,deltaY:2.10935518695,dashes:[6.1171328,-299.7393695],sourceLine:226},{angle:222.3974378,originX:6.096,originY:21.336,deltaX:413.48123885686,deltaY:.81554484621,dashes:[7.9107792,-783.16772512177],sourceLine:227},{angle:138.81407483,originX:25.4,originY:15.748,deltaX:234.164238558,deltaY:2.38943100688,dashes:[2.7000454,-267.30565824344],sourceLine:228},{angle:171.4692344,originX:23.368,originY:17.526,deltaX:-334.082478726,deltaY:1.25594916784,dashes:[5.1368198,-508.5463899704],sourceLine:229},{angle:225,originX:18.288,originY:18.288,deltaX:17.96051224214,deltaY:17.96051224214,dashes:[3.5920934,-32.32893108428],sourceLine:230},{angle:203.19859051,originX:16.51,originY:21.336,deltaX:-136.74251918,deltaY:3.33518339548,dashes:[1.9344132,-191.50622368894],sourceLine:231},{angle:291.80140949,originX:14.732,originY:20.574,deltaX:-80.18324702488,deltaY:4.71666158921,dashes:[2.7356562,-134.0475299],sourceLine:232},{angle:30.96375653,originX:15.748,originY:18.034,deltaX:91.47734531502,deltaY:4.35606406258,dashes:[4.4431966,-143.6629815291],sourceLine:233},{angle:161.56505118,originX:19.558,originY:20.32,deltaX:-56.2252967978,deltaY:8.03218525675,dashes:[3.2128714,-77.10898116828],sourceLine:234},{angle:16.389540334,originX:0,originY:20.574,deltaX:265.17991128726,deltaY:1.43340492604,dashes:[4.50088,-445.58826672539],sourceLine:235},{angle:70.34617594,originX:4.318,originY:21.844,deltaX:-297.29446803469,deltaY:1.70858889651,dashes:[3.7759894,-373.822156782],sourceLine:236},{angle:293.19859051,originX:19.558,originY:25.4,deltaX:-136.7425191801,deltaY:3.33518339548,dashes:[3.868801,-189.57183588894],sourceLine:237},{angle:343.61045967,originX:21.082,originY:21.844,deltaX:-265.17991128725,deltaY:1.433404926,dashes:[4.50088,-445.5882667254],sourceLine:238},{angle:339.44395478,originX:0,originY:4.826,deltaX:-136.75087638398,deltaY:2.97284513779,dashes:[4.340352,-212.67734313106],sourceLine:239},{angle:294.7751406,originX:4.064,originY:3.302,deltaX:-306.90424056705,deltaY:1.77401295215,dashes:[3.6367212,-360.0359338072],sourceLine:240},{angle:66.80140949,originX:19.812,originY:0,deltaX:136.74251918012,deltaY:3.33518339452,dashes:[3.868801,-189.57183588894],sourceLine:241},{angle:17.35402464,originX:21.336,originY:3.556,deltaX:-345.47402804977,deltaY:1.51523696536,dashes:[4.2578274,-421.523759802],sourceLine:242},{angle:69.44395478,originX:7.366,originY:0,deltaX:-136.75087638396,deltaY:2.97284513874,dashes:[2.170176,-214.84751913106],sourceLine:243},{angle:101.309932474,originX:18.288,originY:0,deltaX:104.60834648271,deltaY:4.98134983255,dashes:[1.295146,-128.21994964526],sourceLine:244},{angle:165.963756532,originX:18.034,originY:1.27,deltaX:-80.085263387,deltaY:6.16040487582,dashes:[5.236337,-99.49054589069],sourceLine:245},{angle:186.00900596,originX:12.954,originY:2.54,deltaX:-255.26337856879,deltaY:1.32949676118,dashes:[4.85267,-480.41364863337],sourceLine:246},{angle:303.69006753,originX:15.748,originY:15.748,deltaX:-56.35753993648,deltaY:7.0446924921,dashes:[3.6632388,-87.9177635968],sourceLine:247},{angle:353.15722659,originX:17.78,originY:12.7,deltaX:434.77679606606,deltaY:1.0087628707,dashes:[6.3955676,-633.16009065031],sourceLine:248},{angle:60.9453959,originX:24.13,originY:11.938,deltaX:-204.76648550216,deltaY:2.46706609031,dashes:[2.6150824,-258.8939231811],sourceLine:249},{angle:90,originX:25.4,originY:14.224,deltaX:25.4,deltaY:25.4,dashes:[1.524,-23.876],sourceLine:250},{angle:120.25643716,originX:12.446,originY:3.302,deltaX:-204.77318477297,deltaY:1.8283320086,dashes:[3.5286696,-349.339407732],sourceLine:251},{angle:48.0127875,originX:10.668,originY:6.35,deltaX:305.85067529778,deltaY:1.88796713138,dashes:[6.8344288,-334.88762199565],sourceLine:252},{angle:0,originX:15.24,originY:11.43,deltaX:25.4,deltaY:25.4,dashes:[6.604,-18.796],sourceLine:253},{angle:325.3048465,originX:21.844,originY:11.43,deltaX:310.04235091354,deltaY:-1.6064370526,dashes:[4.0160956,-397.5931672414],sourceLine:254},{angle:254.0546041,originX:25.146,originY:9.144,deltaX:104.6687497289,deltaY:3.48895832444,dashes:[3.6982908,-181.21650038772],sourceLine:255},{angle:207.64597536,originX:24.13,originY:5.588,deltaX:545.36007557253,deltaY:1.07143433066,dashes:[6.021451,-596.12464422938],sourceLine:256},{angle:175.42607874,originX:18.796,originY:2.794,deltaX:331.1739336186,deltaY:1.01276432357,dashes:[6.3702946,-630.6584645624],sourceLine:257}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:259},{angle:120,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:260},{angle:60,originX:3.175,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:261}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:263},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:264},{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[-6.35,3.175],sourceLine:265}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:267},{angle:90,originX:0,originY:0,deltaX:-6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:268}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:270},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:271},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:272}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:285}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:287}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:289}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:291}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:293},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:294}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:296}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:298}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:300}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:302}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:304}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:306}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:308},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:309}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:311},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:312}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:314},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:315}]},{name:"JIS_LC_20",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:322},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:323}]},{name:"JIS_LC_20A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:325},{angle:45,originX:1,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:326}]},{name:"JIS_LC_8",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:328},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:329}]},{name:"JIS_LC_8A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:331},{angle:45,originX:1,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:332}]},{name:"JIS_RC_10",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:334},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:335},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:336}]},{name:"JIS_RC_15",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:338},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:339},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:340}]},{name:"JIS_RC_18",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:342},{angle:45,originX:1,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:343},{angle:45,originX:2,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:344}]},{name:"JIS_RC_30",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:346},{angle:45,originX:1,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:347},{angle:45,originX:2,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:348}]},{name:"JIS_STN_1E",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:350},{angle:45,originX:.705,originY:0,deltaX:0,deltaY:1,dashes:[1,-.5],sourceLine:351}]},{name:"JIS_STN_2.5",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.5,dashes:[],sourceLine:353},{angle:45,originX:1.765,originY:0,deltaX:0,deltaY:2.5,dashes:[1.2,-.5],sourceLine:354}]},{name:"JIS_WOOD",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[],sourceLine:356}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:359}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:6.35,dashes:[6.35,-6.35,0,-6.35,0,-6.35],sourceLine:361}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:363},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:364}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:366},{angle:60,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:367},{angle:120,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:368}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:370},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:371},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:372}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:374},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:375},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:376},{angle:0,originX:0,originY:3.96875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:377}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.38125,dashes:[],sourceLine:379},{angle:45,originX:1.6838,originY:0,deltaX:0,deltaY:2.38125,dashes:[0,-2.38125],sourceLine:380}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:382},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:383}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:385},{angle:60,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:386},{angle:120,originX:1.5875,originY:2.7496306704,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:387}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:389},{angle:45,originX:0,originY:1.5875,deltaX:0,deltaY:3.175,dashes:[],sourceLine:390}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[3.175,-22.225],sourceLine:392},{angle:90,originX:1.5875,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.5875,-42.4065904724],sourceLine:393},{angle:90,originX:1.984375,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:394},{angle:90,originX:1.190625,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:395},{angle:60,originX:2.38125,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:396},{angle:120,originX:.79375,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:397}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:399},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-3.175],sourceLine:400}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:402},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:403},{angle:0,originX:-2.38125,originY:4.1244459802,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:404}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:406},{angle:90,originX:3.175,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:407}]}],issues:[]};function Z(i,t){for(const e of i)Number.isInteger(e)&&e>=0&&t(e)}function Yt(i,t,e){Z(i,n=>{n===0&&e.add(t)})}function tn(i,t,e){const n=i[t];n&&(n.x+=e.x,n.y+=e.y)}function Ge(i,t,e){Z(i,n=>{const r=e[n];r&&r.add(t)})}function To(i,t){const e=i.x-t.x,n=i.y-t.y,r=(i.z||0)-(t.z||0);return e*e+n*n+r*r}function Pt(i,t){if(t.length===0)return;let e=new m(t[0].x,t[0].y,t[0].z||0),n=To(i,e);for(let r=1;r<t.length;r++){const s=t[r],o=new m(s.x,s.y,s.z||0),a=To(i,o);a<n&&(e=o,n=a)}return e}function Ue(i,t,e,n,r){const s=new m(i.x,i.y,i.z||0),o=new m(t.x,t.y,t.z||0),a=new Ut(s,o);switch(e){case w.EndPoint:r.push(s,o);break;case w.MidPoint:r.push(a.midPoint);break;case w.Nearest:r.push(a.nearestPoint(n));break;case w.Perpendicular:r.push(a.perpPoint(n));break}}function cn(i,t,e,n,r,s,o){if(e){const a=new ut(i,t,e);switch(r){case w.EndPoint:o.push(new m(a.startPoint.x,a.startPoint.y,n),new m(a.endPoint.x,a.endPoint.y,n));break;case w.MidPoint:o.push(new m(a.midPoint.x,a.midPoint.y,n));break;case w.Nearest:{const l=a.nearestPoint({x:s.x,y:s.y});o.push(new m(l.x,l.y,n));break}case w.Perpendicular:{a.perpendicularPoints({x:s.x,y:s.y}).forEach(h=>o.push(new m(h.x,h.y,n)));break}case w.Tangent:{a.tangentPoints({x:s.x,y:s.y}).forEach(h=>o.push(new m(h.x,h.y,n)));break}}return}Ue(new m(i.x,i.y,n),new m(t.x,t.y,n),r,s,o)}function gi(i,t,e,n,r){if(i.length!==0)switch(e){case w.EndPoint:i.forEach(s=>r.push(new m(s.x,s.y,s.z||0)));break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const s=i.length,o=[];for(let a=0;a<s;a++){const l=[];Ue(i[a],i[(a+1)%i.length],e,n,l),o.push(...l)}if(e===w.MidPoint)r.push(...o);else{const a=Pt(n,o);a&&r.push(a)}break}}}var en=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(en||{}),vl=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(vl||{}),Pl=(i=>(i[i.HatchObject=0]="HatchObject",i[i.GradientObject=1]="GradientObject",i))(Pl||{}),Al=(i=>(i[i.PreDefinedGradient=0]="PreDefinedGradient",i[i.UserDefinedGradient=1]="UserDefinedGradient",i))(Al||{});const Ps=class Ps extends V{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new Et,this._isSolidFill=!1,this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1,this._patternName="",this._patternNameSet=!1,this._patternType=1,this._patternAngle=0,this._patternAngleSet=!1,this._patternScale=1,this._patternScaleSet=!1,this._associative=!1,this._associativeSet=!1,this._backgroundColor=void 0,this._backgroundColorSet=!1,this._patternDouble=!1,this._patternDoubleSet=!1,this._hatchStyle=0,this._hatchStyleSet=!1,this._hatchObjectType=0,this._gradientAngle=0,this._gradientShift=0,this._shadeTintValue=0,this._gradientStartColor=void 0,this._gradientEndColor=void 0,this._gradientType=0,this._gradientName="",this._gradientOneColorMode=!1}get dxfTypeName(){return"HATCH"}get isGradient(){return this._hatchObjectType===1}get isHatch(){return this._hatchObjectType===0}get isSolidFill(){return this._isSolidFill||this.getEffectivePatternName().trim().toUpperCase()===ge}set isSolidFill(t){this._isSolidFill=t}get color(){if(this.hasExplicitColor())return this.getEntityColor();const t=this.database,e=et.instance().getVar(v.HPCOLOR,t);return e instanceof X&&e.colorMethod!==exports.AcCmColorMethod.None?e.clone():t.cecolor.clone()}set color(t){this.setEntityColor(t)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t??"",this._isSolidFill=this._patternName.trim().toUpperCase()===ge,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(t){this._patternType=t,t!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(t){this._associative=!!t,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t==null?void 0:t.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(t){this._patternDouble=!!t,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(t){this._hatchObjectType=t}get gradientAngle(){return this._gradientAngle}set gradientAngle(t){this._gradientAngle=t}get gradientShift(){return this._gradientShift}set gradientShift(t){this._gradientShift=t}get gradientType(){return this._gradientType}set gradientType(t){this._gradientType=t}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?qa:this._gradientName}set gradientName(t){this._gradientName=t??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(t){this._gradientOneColorMode=t}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(t){this._shadeTintValue=t}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(t){this._gradientStartColor=t==null||!Number.isFinite(t)?void 0:t&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(t){this._gradientEndColor=t==null||!Number.isFinite(t)?void 0:t&16777215}applyPatternDefaultsFromSysVars(t){const e=et.instance();if(!this.hasExplicitLayer()){const n=e.getVar(v.HPLAYER,t);this.shouldUseSysVarOverride(n)&&(this.layer=n)}if(!this.hasExplicitTransparency()){const n=this.parseHpTransparency(e.getVar(v.HPTRANSPARENCY,t));n&&(this.transparency=n)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(e.getVar(v.HPBACKGROUNDCOLOR,t)),this._backgroundColorSet=!0),!this._patternNameSet){const n=e.getVar(v.HPNAME,t);this._patternName=typeof n=="string"?n:"",this._patternNameSet=!0}if(!this._patternAngleSet){const n=e.getVar(v.HPANG,t);this._patternAngle=typeof n=="number"&&Number.isFinite(n)?n:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(e.getVar(v.HPSCALE,t)),this._patternScaleSet=!0),!this._associativeSet){const n=e.getVar(v.HPASSOC,t);this._associative=typeof n=="number"?n!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(e.getVar(v.HPISLANDDETECTION,t)),this._hatchStyleSet=!0),!this._patternDoubleSet){const n=e.getVar(v.HPDOUBLE,t);this._patternDouble=typeof n=="number"?n!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const t=this.database,e=et.instance().getVar(v.HPNAME,t);return typeof e=="string"?e:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const t=this.database,e=et.instance().getVar(v.HPANG,t);return typeof e=="number"&&Number.isFinite(e)?e:this._patternAngle}getRenderablePatternAngle(){return!this._definitionLinesAutoGenerated&&this._definitionLines.length>0?0:this.getEffectivePatternAngle()}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const t=this.database;return this.normalizePatternScale(et.instance().getVar(v.HPSCALE,t))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const t=this.database,e=et.instance().getVar(v.HPASSOC,t);return typeof e=="number"?e!==0:this._associative}normalizePatternScale(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}normalizeHatchStyle(t){return typeof t!="number"||!Number.isFinite(t)?1:t===0?0:t===2?2:1}shouldUseSysVarOverride(t){if(typeof t!="string")return!1;const e=t.trim().toLowerCase();return e!==""&&e!=="."&&e!=="use current"}parseHpBackgroundColor(t){if(t instanceof X)return t.colorMethod===exports.AcCmColorMethod.None?void 0:t.clone();if(typeof t!="string")return;const e=t.trim().toLowerCase();if(!(!e||e==="."||e==="none"))return X.fromString(t)}parseHpTransparency(t){if(t instanceof Q)return t.clone();if(!this.shouldUseSysVarOverride(t))return;const e=t.trim();if(/^bylayer$/i.test(e)||/^byblock$/i.test(e))return Q.fromString(e);const n=Number(e);if(Number.isInteger(n)&&n>=0&&n<=90){const r=new Q;return r.percentage=n,r}}updatePredefinedPatternDefinitionLines(t=this.getEffectivePatternName(),e=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const r=t.trim().toUpperCase();if(!r||r===ge){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const s=this.normalizePatternScale(e);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===r&&this._definitionLinesPatternScale===s)return;const o=xl.patterns.find(a=>a.name.trim().toUpperCase()===r);if(!o){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=o.lines.map(a=>({angle:a.angle*Math.PI/180,base:{x:a.originX*s,y:a.originY*s},offset:{x:a.deltaX*s,y:a.deltaY*s},dashLengths:a.dashes.map(l=>l*s)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=r,this._definitionLinesPatternScale=s}add(t){this._geo.add(t)}buildAreasFromLoops(){const t=this._geo.loops;if(t.length===0)return[];if(t.length===1)return[this._geo];const e=this._geo.buildHierarchy(),n=[],r=(s,o)=>{if(s.index>=0&&o%2===0){const a=new Et;a.add(t[s.index]),s.children.forEach(l=>{l.index>=0&&a.add(t[l.index])}),n.push(a)}s.children.forEach(a=>r(a,o+1))};return e.children.forEach(s=>r(s,0)),n.length>0?n:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,n)=>e+n.area,0)}get area(){return this.getCalculatedAreaValue()}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new k;const e=new k;return t.forEach(n=>{const r=n.box;e.union(new k({x:r.min.x,y:r.min.y,z:this._elevation},{x:r.max.x,y:r.max.y,z:this._elevation}))}),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:en[0],value:0},{label:en[1],value:1},{label:en[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:t=>{this.associative=t}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:t=>{this.backgroundColor=t}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:t=>{this.patternDouble=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){return this.associative?[]:this.collectBoundaryGripPoints()}subMoveGripPointsAt(t,e){return this.associative?this:(Z(t,n=>{this.moveBoundaryGripPointAt(n,e)}),this)}collectBoundaryGripPoints(){const t=new Array,e=this._elevation,n=new Set,r=s=>{const o=`${s.x},${s.y},${s.z??0}`;n.has(o)||(n.add(o),t.push(new m(s.x,s.y,s.z??e)))};return this._geo.loops.forEach(s=>{if(s instanceof j){const o=s.numberOfVertices;for(let a=0;a<o;a++){const l=s.getPointAt(a);r({x:l.x,y:l.y,z:e})}return}s.curves.forEach(o=>{if(o instanceof Nt)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});else if(o instanceof ut)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e}),r({x:o.midPoint.x,y:o.midPoint.y,z:e});else if(o instanceof de){r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});const a=o.getPoint(.5);r({x:a.x,y:a.y,z:e})}})}),t}moveBoundaryGripPointAt(t,e){let n=0;const r=this._elevation,s=new Set,o=(a,l)=>{const h=`${a.x},${a.y},${a.z??0}`;s.has(h)||(s.add(h),n===t&&l(),n++)};this._geo.loops.forEach(a=>{if(a instanceof j){const l=a.numberOfVertices;for(let h=0;h<l;h++){const c=a.vertices[h];c&&o({x:c.x,y:c.y,z:r},()=>{tn(a.vertices,h,e)})}return}a.curves.forEach(l=>{if(l instanceof Nt)o({x:l.startPoint.x,y:l.startPoint.y,z:r},()=>{l.startPoint.x+=e.x,l.startPoint.y+=e.y}),o({x:l.endPoint.x,y:l.endPoint.y,z:r},()=>{l.endPoint.x+=e.x,l.endPoint.y+=e.y});else if(l instanceof ut)o({x:l.startPoint.x,y:l.startPoint.y,z:r},()=>this.moveCircArc2dGripPoint(l,"start",e)),o({x:l.endPoint.x,y:l.endPoint.y,z:r},()=>this.moveCircArc2dGripPoint(l,"end",e)),o({x:l.midPoint.x,y:l.midPoint.y,z:r},()=>this.moveCircArc2dGripPoint(l,"mid",e));else if(l instanceof de){o({x:l.startPoint.x,y:l.startPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(l,"start",e)),o({x:l.endPoint.x,y:l.endPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(l,"end",e));const h=l.getPoint(.5);o({x:h.x,y:h.y,z:r},()=>this.moveEllipseArc2dGripPoint(l,"mid",e))}})})}moveCircArc2dGripPoint(t,e,n){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"mid":{const s=t.midPoint,o=new ut(t.startPoint,{x:s.x+n.x,y:s.y+n.y},t.endPoint);t.center=o.center,t.radius=o.radius,t.startAngle=o.startAngle,t.endAngle=o.endAngle,t.clockwise=o.clockwise;break}}}moveEllipseArc2dGripPoint(t,e,n){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+n.y-r.y,s.x+n.x-r.x);break}case"mid":{const s=t.getPoint(.5),o=s.x+n.x-t.center.x,a=s.y+n.y-t.center.y,l=Math.hypot(s.x-t.center.x,s.y-t.center.y),h=Math.hypot(o,a);if(l>0&&h>0){const c=h/l;t.majorAxisRadius*=c,t.minorAxisRadius*=c}break}}}subGetOsnapPoints(t,e,n,r){const s=this._elevation,o=[];if(this._geo.loops.forEach(a=>{var l;if(a instanceof j){const h=a,c=h.numberOfVertices;if(c===0)return;switch(t){case w.EndPoint:for(let u=0;u<c;u++){const g=h.getPointAt(u);r.push(new m(g.x,g.y,s))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const u=a.closed?c:c-1;for(let g=0;g<u;g++){const d=[];cn(h.getPointAt(g),h.getPointAt((g+1)%c),(l=h.vertices[g])==null?void 0:l.bulge,s,t,e,d),t===w.MidPoint?r.push(...d):o.push(...d)}break}}return}a.curves.forEach(h=>{if(h instanceof Nt){const c=[];cn(h.startPoint,h.endPoint,void 0,s,t,e,c),t===w.MidPoint?r.push(...c):t===w.Nearest||t===w.Perpendicular||t===w.Tangent?o.push(...c):r.push(...c)}else if(h instanceof ut)switch(t){case w.EndPoint:r.push(new m(h.startPoint.x,h.startPoint.y,s),new m(h.endPoint.x,h.endPoint.y,s));break;case w.MidPoint:r.push(new m(h.midPoint.x,h.midPoint.y,s));break;case w.Nearest:{const c=h.nearestPoint({x:e.x,y:e.y});o.push(new m(c.x,c.y,s));break}case w.Perpendicular:{h.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}case w.Tangent:{h.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}}else if(h instanceof de)switch(t){case w.EndPoint:r.push(new m(h.startPoint.x,h.startPoint.y,s),new m(h.endPoint.x,h.endPoint.y,s));break;case w.MidPoint:{const c=h.getPoint(.5);r.push(new m(c.x,c.y,s));break}case w.Nearest:{const c=h.nearestPoint({x:e.x,y:e.y});o.push(new m(c.x,c.y,s));break}case w.Perpendicular:{h.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}case w.Tangent:{h.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}}})}),(t===w.Nearest||t===w.Perpendicular||t===w.Tangent)&&o.length>0){const a=Pt(e,o);r.length=0,a&&r.push(a)}}subWorldDraw(t){var s;this.updatePredefinedPatternDefinitionLines();const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.getRenderablePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(s=this.backgroundColor)==null?void 0:s.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},e.drawOrder=-1;const n=this.buildAreasFromLoops();if(n.length===0)return t.area(this._geo);if(n.length===1)return t.area(n[0]);const r=n.map(o=>t.area(o));return t.group(r)}transformBy(t){const e=t.elements,n=new _n(e[0],e[4],e[12],e[1],e[5],e[13],0,0,1);this._geo.transform(n),this._elevation=new m(0,0,this._elevation).applyMatrix4(t).z;const r=new m(1,0,0).applyMatrix4(t),s=new m().applyMatrix4(t),o=new m(r).sub(s);if(o.length()>0){const a=Math.atan2(o.y,o.x);this._patternAngle=this.getEffectivePatternAngle()+a,this._gradientAngle+=a,this._patternScale=this.getEffectivePatternScale()*o.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops,n=this.getEffectivePatternName(),r=this.getEffectivePatternAngle(),s=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(n,s),t.writeSubclassMarker("AcDbHatch"),t.writePoint3d(10,{x:0,y:0,z:this.elevation}),t.writeVector3d(210,{x:0,y:0,z:1}),t.writeString(2,n||(this.isSolidFill?ge:$a)),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,this.getEffectiveAssociative()?1:0),t.writeInt16(91,e.length),e.forEach((o,a)=>{const l=a===0;if(o instanceof j){const h=o.vertices,c=h.some(g=>(g.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,c?1:0),t.writeInt16(73,o.closed?1:0),t.writeInt16(93,h.length);for(const g of h)t.writePoint2d(10,g),c&&t.writeDouble(42,g.bulge??0);t.writeInt16(97,0);return}if(o instanceof cs){const h=l?1:0;t.writeInt16(92,h),t.writeInt16(93,o.numberOfEdges);for(const c of o.curves){if(c instanceof Nt){t.writeInt16(72,1),t.writePoint2d(10,c.startPoint),t.writePoint2d(11,c.endPoint);continue}if(c instanceof ut){t.writeInt16(72,2),t.writePoint2d(10,c.center),t.writeDouble(40,c.radius),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof de){t.writeInt16(72,3),t.writePoint2d(10,c.center);const u=new S(c.majorAxisRadius*Math.cos(c.rotation),c.majorAxisRadius*Math.sin(c.rotation));t.writePoint2d(11,u);const g=c.majorAxisRadius===0?0:c.minorAxisRadius/c.majorAxisRadius;t.writeDouble(40,g),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof Rt){const u=c.knots,g=c.controlPoints,d=c.weights,f=c.fitPoints,p=d.some(y=>y!==1);t.writeInt16(72,4),t.writeInt16(94,c.degree),t.writeInt16(73,p?1:0),t.writeInt16(74,c.closed?1:0),t.writeInt16(95,u.length),t.writeInt16(96,g.length),u.forEach(y=>t.writeDouble(40,y)),g.forEach((y,_)=>{t.writePoint2d(10,y),p&&t.writeDouble(42,d[_]??1)}),t.writeInt16(97,(f==null?void 0:f.length)??0),f==null||f.forEach(y=>t.writePoint2d(11,y))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,r),t.writeDouble(41,s),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(o=>{t.writeAngle(53,o.angle),t.writeDouble(43,o.base.x),t.writeDouble(44,o.base.y),t.writeDouble(45,o.offset.x),t.writeDouble(46,o.offset.y),t.writeInt16(79,o.dashLengths.length),o.dashLengths.forEach(a=>t.writeDouble(49,a))}),this.isGradient&&(t.writeInt16(450,this._hatchObjectType),t.writeInt16(451,0),t.writeInt16(452,this._gradientOneColorMode?1:0),t.writeAngle(460,this._gradientAngle),t.writeDouble(461,this._gradientShift),t.writeString(470,this.gradientName)),t.writeInt16(98,0),this}};Ps.typeName="Hatch";let jn=Ps;class Sl{constructor(t){this.db=t}createDefaultLayer(){const t=new X;return t.colorIndex=7,this.db.tables.layerTable.add(new di({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new pe({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new pe({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new pe({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new ds({name:K,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new vt({name:K,dimtxsty:K}))}createDefaultLayout(){const t=new ci;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new jn;e.patternName=ge;const n=new cs;n.add(new Nt({x:0,y:0},{x:-1,y:.125})),n.add(new Nt({x:-1,y:.125},{x:-1,y:-.125})),n.add(new Nt({x:-1,y:-.125},{x:0,y:0})),e.add(n);const r=new tt;r.name="_CAXARROW",r.appendEntity(e),this.db.tables.blockTable.add(r)}}}const hr=Math.PI/200;class Ll{constructor(t){this.database=t}formatLength(t,e){const n=this.createContext(e);return we(t,n)}formatPoint2d(t,e){const n=this.createContext(e);return`${we(t.x,n)}, ${we(t.y,n)}`}formatPoint3d(t,e){const n=this.createContext(e);return`${we(t.x,n)}, ${we(t.y,n)}, ${we(t.z,n)}`}formatAngle(t,e){const n=this.createContext(e),s=(e==null?void 0:e.applyAngbaseAngdir)??!0?Md(t,this.database.angbase,this.database.angdir):T.normalizeAngle(t);return Id(s,n)}createContext(t){return{lunits:this.database.lunits,luprec:un(this.database.luprec),insunits:this.database.insunits,unitmode:this.database.unitmode,measurement:this.database.measurement,aunits:this.database.aunits,auprec:un(this.database.auprec),showUnits:(t==null?void 0:t.showUnits)??!1,showApproximate:(t==null?void 0:t.showApproximate)??!1}}}function we(i,t){let e;switch(t.lunits){case $.Scientific:e=Oi(Bd(i,t.luprec),t);break;case $.Engineering:e=Fd(i,t);break;case $.Architectural:e=zd(i,t);break;case $.Fractional:e=Oi(Vd(i,t),t);break;case $.WindowsDesktop:case $.Decimal:default:e=Oi(We(i,t.luprec),t)}return El(e,Td(i,t),t)}function Id(i,t){let e;switch(t.aunits){case dt.DegreesMinutesSeconds:e=Tl(i,t);break;case dt.Gradians:e=Gd(i,t);break;case dt.Radians:e=Dd(i,t);break;case dt.SurveyorsUnits:e=Ud(i,t);break;case dt.DecimalDegrees:default:e=jd(i,t)}return El(e,Cd(i,t),t)}function Md(i,t,e){let n=i-t;return e===1&&(n=-n),T.normalizeAngle(n)}function gs(i){const t=i.showUnits?'"':"";return i.unitmode===1?{feetInchSeparator:"",fractionSeparator:"-",inchSuffix:t}:{feetInchSeparator:"-",fractionSeparator:" ",inchSuffix:t}}function un(i,t=0,e=8){return Number.isFinite(i)?Math.max(t,Math.min(e,Math.round(i))):t}function He(i){return Object.is(i,-0)?0:i}function El(i,t,e){return!e.showApproximate||!t?i:`~ ${i}`}function Td(i,t){if(!Number.isFinite(i))return!1;const e=kd(i,t);return fs(i,e)}function Cd(i,t){if(!Number.isFinite(i))return!1;if(t.aunits===dt.SurveyorsUnits)return Od(i,t.auprec);const e=Nd(i,t);return fs(i,e)}function Od(i,t){const n=((90-T.radToDeg(i))%360+360)%360,r=Cl(n),s=Math.min(Math.abs(n-r.base),Math.abs(r.base+90-n)),o=T.degToRad(s),a=Il(o,t);return fs(o,a)}function kd(i,t){const e=He(i);switch(t.lunits){case $.Scientific:return Rd(e,t.luprec);case $.Engineering:case $.Architectural:case $.Fractional:return Xd(e,t);case $.WindowsDesktop:case $.Decimal:default:return ke(e,t.luprec)}}function Nd(i,t){const e=He(i);switch(t.aunits){case dt.DegreesMinutesSeconds:return Il(e,t.auprec);case dt.Gradians:return ke(e/hr,t.auprec)*hr;case dt.Radians:return ke(e,t.auprec);case dt.DecimalDegrees:default:return T.degToRad(ke(T.radToDeg(e),t.auprec))}}function ke(i,t){if(!Number.isFinite(i))return 0;const e=10**t;return Math.round(He(i)*e)/e}function Rd(i,t){if(!Number.isFinite(i))return 0;const e=He(i);if(e===0)return 0;const n=e.toExponential(t);return Number(n)}function Xd(i,t){if(!Number.isFinite(i))return 0;const e=i<0?-1:1,n=Math.abs(i),r=Math.floor(n/12),s=n-r*12;if(t.lunits===$.Architectural||t.lunits===$.Fractional){const o=1<<un(t.luprec,0,8),a=Yd(s,o);return e*(r*12+a)}return e*(r*12+ke(s,t.luprec))}function Yd(i,t){const e=Math.floor(i),n=i-e,r=Math.round(n*t);return r>=t?e+1:e+r/t}function Il(i,t){const e=T.radToDeg(i),n=e<0?-1:1,r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),l=ke((o-a)*60,t),h=s+a/60+l/3600;return T.degToRad(n*h)}function fs(i,t){if(i===t)return!1;const e=Math.max(Math.abs(i),Math.abs(t),1);return Math.abs(i-t)>e*Number.EPSILON*8}function We(i,t){if(!Number.isFinite(i))return"0";const e=He(i);if(Number.isInteger(e)&&t===0)return String(e);const r=e.toFixed(t).replace(/\.?0+$/,"");return r===""||r==="-"?"0":r}function Bd(i,t){if(!Number.isFinite(i))return"0";const e=He(i);if(e===0)return"0";const n=e.toExponential(t).match(/^(.+)e([+-])(\d+)$/i);if(!n)return"0";const[,r,s,o]=n,a=o.length<2?o.padStart(2,"0"):o;return`${r}E${s}${a}`.toUpperCase()}function Fd(i,t){if(!Number.isFinite(i))return"0";const e=gs(t),n=i<0?"-":"",r=Math.abs(i),s=Math.floor(r/12),o=r-s*12,a=We(o,t.luprec);return s===0?`${n}${a}${e.inchSuffix}`:`${n}${s}'${e.feetInchSeparator}${a}${e.inchSuffix}`}function zd(i,t){if(!Number.isFinite(i))return"0";const e=gs(t),n=i<0?"-":"",r=Math.abs(i),s=Math.floor(r/12),o=r-s*12,a=1<<un(t.luprec,0,8),l=Ml(o,a,e.fractionSeparator);return s===0?`${n}${l}${e.inchSuffix}`:`${n}${s}'${e.feetInchSeparator}${l}${e.inchSuffix}`}function Vd(i,t){if(!Number.isFinite(i))return"0";const e=gs(t),n=i<0?"-":"",r=Math.abs(i),s=1<<un(t.luprec,0,8);return`${n}${Ml(r,s,e.fractionSeparator)}`}function Ml(i,t,e){const n=Math.floor(i),r=i-n;let s=Math.round(r*t);if(s>=t)return String(n+1);if(s===0)return String(n);const o=qd(s,t);s/=o;const a=t/o,l=`${s}/${a}`;return n===0?l:`${n}${e}${l}`}function jd(i,t){const e=T.radToDeg(i);return`${We(e,t.auprec)}${t.showUnits?"°":""}`}function Dd(i,t){return`${We(i,t.auprec)}${t.showUnits?" rad":""}`}function Gd(i,t){const e=i/hr;return`${We(e,t.auprec)}${t.showUnits?"g":""}`}function Tl(i,t){const e=T.radToDeg(i),n=e<0?"-":"",r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),l=(o-a)*60,h=We(l,t.auprec),c=t.showUnits?'"':"";return`${n}${s}d${a}'${h}${c}`}function Ud(i,t){const n=((90-T.radToDeg(i))%360+360)%360,r=Cl(n),s=Math.min(Math.abs(n-r.base),Math.abs(r.base+90-n)),a=Tl(T.degToRad(s),t).replace(/^-/,"");return`${r.prefix} ${a} ${r.suffix}`.trim()}function Cl(i){return i<90?{prefix:"N",suffix:"E",base:0}:i<180?{prefix:"S",suffix:"E",base:90}:i<270?{prefix:"S",suffix:"W",base:180}:{prefix:"N",suffix:"W",base:270}}function Oi(i,t){if(!t.showUnits||t.lunits===$.Engineering||t.lunits===$.Architectural)return i;const e=Hd(t.insunits,t.measurement);return e?`${i}${e}`:i}function Hd(i,t){return i===H.Undefined?t===0?'"':" mm":pd(i)?Wd(i):yd(i)?$d(i):""}function Wd(i){switch(i){case H.Millimeters:return" mm";case H.Centimeters:return" cm";case H.Meters:return" m";case H.Kilometers:return" km";case H.Decimeters:return" dm";case H.Microns:return" µm";case H.Nanometers:return" nm";default:return""}}function $d(i){switch(i){case H.Inches:case H.Microinches:case H.Mils:case H.USSurveyInch:return'"';case H.Feet:case H.USSurveyFeet:return"'";case H.Miles:case H.USSurveyMile:return" mi";case H.Yards:case H.USSurveyYard:return" yd";default:return""}}function qd(i,t){let e=Math.abs(i),n=Math.abs(t);for(;n!==0;){const r=n;n=e%n,e=r}return e||1}class Tt extends lt{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){const n=this.database.transactionManager;if(n.strictMode&&!n.isRecording()&&!n.isApplyingUndoRedo())throw new Error("Cannot modify dictionary entries outside an active transaction.");const r=this.getAt(t);r&&(n.isRecording()&&n.recordRemove({type:"dictionary",dictionaryId:this.objectId,key:t},r),this.database.releaseObjectHandle(r)),e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,s=>this.hasId(s)),this._recordsByName.set(t,e),n.isRecording()&&n.recordAppend({type:"dictionary",dictionaryId:this.objectId,key:t},e),!n.isRecording()&&!n.isApplyingUndoRedo()&&this.database.notifyDictObjectSet(e,t)}remove(t){const e=this.getAt(t);return e?(this.removeStoredObject(e,t),!0):!1}removeId(t){const e=this.getIdAt(t);if(e){let n="";return this._recordsByName.forEach((r,s)=>{r===e&&(n=s)}),this.removeStoredObject(e,n),!0}return!1}removeStoredObject(t,e){const n=this.database.transactionManager;if(n.strictMode&&!n.isRecording()&&!n.isApplyingUndoRedo())throw new Error("Cannot remove dictionary entries outside an active transaction.");n.isRecording()&&n.recordRemove({type:"dictionary",dictionaryId:this.objectId,key:e},t),this._recordsByName.forEach((r,s)=>{r===t&&this._recordsByName.delete(s)}),this.database.releaseObjectHandle(t),e&&!n.isRecording()&&!n.isApplyingUndoRedo()&&this.database.notifyDictObjectErased(t,e)}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.releaseObjectHandle(t),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this.getIdAt(t)!==void 0}getAt(t){return this._recordsByName.get(t)}getIdAt(t){const e=this.database.getObjectById(t);if(!(!e||e.getAttrWithoutException("ownerId")!==this.objectId))return e}newIterator(){return new Be(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const[e,n]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,n.objectId);return this}}const fi=192,dn=193,pi=194,yi=195,Ol=200;function ki(i){if(i.isByBlock)return dn<<24>>0;if(i.isByLayer)return fi<<24>>0;const t=i.colorIndex;if(t!=null&&t>0&&t<256)return(yi<<24|t&255)>>0;const e=i.RGB;return e!=null?(pi<<24|e&16777215)>>0:dn<<24>>0}function Kd(i){const t=new X(exports.AcCmColorMethod.ByBlock);switch(i>>>24&255){case fi:t.setByLayer();break;case dn:case Ol:t.setByBlock();break;case yi:t.colorIndex=i&255;break;case pi:t.setRGBValue(i&16777215);break;default:i===256?t.setByLayer():i===0?t.setByBlock():i>0&&i<256&&(t.colorIndex=i);break}return t}class kl extends lt{constructor(){super(),this._contentType=2,this._drawMLeaderOrderType=1,this._drawLeaderOrderType=0,this._bitFlags=0,this._maxLeaderSegmentsPoints=-1,this._firstSegmentAngleConstraint=0,this._secondSegmentAngleConstraint=0,this._leaderLineType=1,this._leaderLineColor=new X(exports.AcCmColorMethod.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new X(exports.AcCmColorMethod.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new X(exports.AcCmColorMethod.ByBlock),this._blockScale=new b(1,1,1),this._enableBlockScale=!0,this._blockRotation=0,this._enableBlockRotation=!1,this._blockConnectionType=0,this._scale=1,this._overwritePropChanged=!1,this._annotative=!1,this._breakSize=0,this._textAttachmentDirection=0,this._bottomTextAttachmentType=9,this._topTextAttachmentType=9,this._extendLeaderToText=!1}get unknown1(){return this._unknown1}set unknown1(t){this._unknown1=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(t){this._drawMLeaderOrderType=t}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(t){this._drawLeaderOrderType=t}get bitFlags(){return this._bitFlags}set bitFlags(t){this._bitFlags=t}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(t){this._maxLeaderSegmentsPoints=t}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(t){this.maxLeaderSegmentsPoints=t}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(t){this._firstSegmentAngleConstraint=t}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(t){this._secondSegmentAngleConstraint=t}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor.copy(t)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get enableLanding(){return this._enableLanding}set enableLanding(t){this._enableLanding=t}get landingEnabled(){return this.enableLanding}set landingEnabled(t){this.enableLanding=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get enableDogleg(){return this._enableDogleg}set enableDogleg(t){this._enableDogleg=t}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(t){this.enableDogleg=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get description(){return this._description}set description(t){this._description=t}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(t){this._arrowSymbolId=t}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(t){this.arrowSymbolId=t}get arrowSize(){return this._arrowSize}set arrowSize(t){this._arrowSize=t}get arrowheadSize(){return this.arrowSize}set arrowheadSize(t){this.arrowSize=t}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(t){this._defaultMTextContents=t}get defaultMText(){return this.defaultMTextContents}set defaultMText(t){this.defaultMTextContents=t}get textString(){return this.defaultMTextContents}set textString(t){this.defaultMTextContents=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textStyle(){return this.textStyleId}set textStyle(t){this.textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor.copy(t)}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get enableFrameText(){return this._enableFrameText}set enableFrameText(t){this._enableFrameText=t}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(t){this.enableFrameText=t}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(t){this._textAlignAlwaysLeft=t}get alignSpace(){return this._alignSpace}set alignSpace(t){this._alignSpace=t}get blockId(){return this._blockId}set blockId(t){this._blockId=t}get blockContentId(){return this.blockId}set blockContentId(t){this.blockId=t}get blockColor(){return this._blockColor}set blockColor(t){this._blockColor.copy(t)}get blockContentColor(){return this.blockColor}set blockContentColor(t){this.blockColor=t}get blockScale(){return this._blockScale.clone()}set blockScale(t){this._blockScale.copy(t)}get blockContentScale(){return this.blockScale}set blockContentScale(t){this.blockScale=t}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(t){this._enableBlockScale=t}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(t){this.enableBlockScale=t}get blockRotation(){return this._blockRotation}set blockRotation(t){this._blockRotation=t}get blockContentRotation(){return this.blockRotation}set blockContentRotation(t){this.blockRotation=t}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(t){this._enableBlockRotation=t}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(t){this.enableBlockRotation=t}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(t){this._blockConnectionType=t}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(t){this.blockConnectionType=t}get scale(){return this._scale}set scale(t){this._scale=t}get scaleFactor(){return this.scale}set scaleFactor(t){this.scale=t}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(t){this._overwritePropChanged=t}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(t){this.overwritePropChanged=t}get annotative(){return this._annotative}set annotative(t){this._annotative=t}get breakSize(){return this._breakSize}set breakSize(t){this._breakSize=t}get breakGapSize(){return this.breakSize}set breakGapSize(t){this.breakSize=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(t){this._bottomTextAttachmentType=t}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(t){this.bottomTextAttachmentType=t}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(t){this._topTextAttachmentType=t}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(t){this.topTextAttachmentType=t}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(t){this._extendLeaderToText=t}get unknown2(){return this._unknown2}set unknown2(t){this._unknown2=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeaderStyle"),t.writeInt16(179,this.unknown1),t.writeInt16(170,this.contentType),t.writeInt16(171,this.drawMLeaderOrderType),t.writeInt16(172,this.drawLeaderOrderType),t.writeInt32(90,this.maxLeaderSegmentsPoints),t.writeDouble(40,this.firstSegmentAngleConstraint),t.writeDouble(41,this.secondSegmentAngleConstraint),t.writeInt16(173,this.leaderLineType),t.writeInt32(91,ki(this.leaderLineColor)),t.writeHandle(340,this.leaderLineTypeId),t.writeInt32(92,this.leaderLineWeight),t.writeBoolean(290,this.enableLanding),t.writeDouble(42,this.landingGap),t.writeBoolean(291,this.enableDogleg),t.writeDouble(43,this.doglegLength),t.writeString(3,this.description),t.writeHandle(341,this.arrowSymbolId),t.writeDouble(44,this.arrowSize),t.writeString(300,this.defaultMTextContents),t.writeHandle(342,this.textStyleId),t.writeInt16(174,this.textLeftAttachmentType),t.writeInt16(175,this.textAngleType),t.writeInt16(176,this.textAlignmentType),t.writeInt16(178,this.textRightAttachmentType),t.writeInt32(93,ki(this.textColor)),t.writeDouble(45,this.textHeight),t.writeBoolean(292,this.enableFrameText),t.writeBoolean(297,this.textAlignAlwaysLeft),t.writeDouble(46,this.alignSpace),t.writeHandle(343,this.blockId),t.writeInt32(94,ki(this.blockColor)),t.writeDouble(47,this._blockScale.x),t.writeDouble(49,this._blockScale.y),t.writeDouble(140,this._blockScale.z),t.writeBoolean(293,this.enableBlockScale),t.writeDouble(141,this.blockRotation),t.writeBoolean(294,this.enableBlockRotation),t.writeInt16(177,this.blockConnectionType),t.writeDouble(142,this.scale),t.writeBoolean(295,this.overwritePropChanged),t.writeBoolean(296,this.annotative),t.writeDouble(143,this.breakSize),t.writeInt16(271,this.textAttachmentDirection),t.writeInt16(272,this.bottomTextAttachmentType),t.writeInt16(273,this.topTextAttachmentType),t.writeBoolean(298,this.unknown2),this}}class Nl extends lt{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new X,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get flags(){return this._flags}set flags(t){this._flags=t}get description(){return this._description}set description(t){this._description=t}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor.copy(t)}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=t}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=t}get elementCount(){return this._elements.length}get elements(){return this._elements.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}set elements(t){this._elements=t.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}addElement(t){this._elements.push({offset:t.offset,color:t.color.clone(),lineType:t.lineType})}removeElementAt(t){if(t<0||t>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(t,1)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMlineStyle"),t.writeString(2,this.styleName),t.writeInt16(70,this.flags),t.writeString(3,this.description),t.writeCmColor(this.fillColor),t.writeDouble(51,this.startAngle),t.writeDouble(52,this.endAngle),t.writeInt16(71,this.elementCount),this._elements.forEach(e=>{t.writeDouble(49,e.offset),t.writeCmColor(e.color),t.writeString(6,e.lineType)}),this}}var Rl=(i=>(i[i.NotApplicable=0]="NotApplicable",i[i.Ignore=1]="Ignore",i[i.Replace=2]="Replace",i[i.XrefMangleName=3]="XrefMangleName",i[i.MangleName=4]="MangleName",i))(Rl||{});class Xl extends lt{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXrecord"),t.writeInt16(280,1),t.writeResultBuffer(this.data),this}}class Yl{constructor(t){this._expression=t}get expression(){return this._expression}}var Bl=(i=>(i[i.Cancel=0]="Cancel",i[i.Ok=1]="Ok",i))(Bl||{});class mi{constructor(){this._name="",this._filterExpression="",this._nestedFilters=[],this._parent=null,this._allowDelete=!0,this._allowRename=!0,this._dynamicallyGenerated=!1,this._isProxy=!1}get name(){return this._name}setName(t){return!this.allowRename()&&this._name.length>0?!1:(this._name=t,!0)}set name(t){this.setName(t)}get filterExpression(){return this._filterExpression}setFilterExpression(t){return this.isIdFilter()?!1:(this._filterExpression=t??"",!0)}set filterExpression(t){this.setFilterExpression(t)}filterExpressionTree(){return this.isIdFilter()||!this._filterExpression?null:new Yl(this._filterExpression)}getNestedFilters(){return this._nestedFilters}get nestedFilters(){return this._nestedFilters}parent(){return this._parent}isIdFilter(){return!1}allowNested(){return!0}allowDelete(){return this._allowDelete}setAllowDelete(t){this._allowDelete=t}allowRename(){return this._allowRename}setAllowRename(t){this._allowRename=t}dynamicallyGenerated(){return this._dynamicallyGenerated}setDynamicallyGenerated(t){this._dynamicallyGenerated=t}isProxy(){return this._isProxy}setIsProxy(t){this._isProxy=t}addNested(t){return!t||t===this||!this.allowNested()||!(this._parent==null)&&!this.isIdFilter()&&t.isIdFilter()||this._nestedFilters.includes(t)?!1:(t._parent&&t._parent.removeNested(t),t._parent=this,this._nestedFilters.push(t),!0)}removeNested(t){const e=this._nestedFilters.indexOf(t);return e<0?!1:(this._nestedFilters.splice(e,1),t._parent===this&&(t._parent=null),!0)}generateNested(){return!1}compareTo(t){return t?this.isIdFilter()===t.isIdFilter()&&this._name===t._name&&this._filterExpression===t._filterExpression:!1}filter(t){return t?this._filterExpression?Zd(this._filterExpression,t):!0:!1}showEditor(){return 0}}function Zd(i,t){const e=i.trim();return e?Co(e,"OR").some(r=>Co(r,"AND").every(o=>Qd(o,t))):!0}function Co(i,t){const e=new RegExp(`\\s+${t}\\s+`,"i");return i.split(e).map(n=>n.trim()).filter(n=>n.length>0)}function Qd(i,t){var o;const e=i.trim().match(/^([A-Za-z_]+)\s*(==|=)\s*"?(.*?)"?\s*$/);if(!e)return!1;const n=e[1].toUpperCase(),r=e[3],s=tg(r);switch(n){case"NAME":return Jd(t.name,r);case"LOCKED":return s!=null?t.isLocked===s:!1;case"FROZEN":return s!=null?t.isFrozen===s:!1;case"OFF":return s!=null?t.isOff===s:!1;case"PLOT":return s!=null?t.isPlottable===s:!1;case"COLOR":{const a=(o=t.color)==null?void 0:o.colorIndex;return a!=null&&String(a)===r}case"LINETYPE":return t.linetype.localeCompare(r,void 0,{sensitivity:"accent"})===0;default:return!1}}function Jd(i,t){return/[*?]/.test(t)?new RegExp(`^${t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")}$`,"i").test(i):i.localeCompare(t,void 0,{sensitivity:"accent"})===0}function tg(i){const t=i.trim().toLowerCase();return t==="true"||t==="1"?!0:t==="false"||t==="0"?!1:null}class Gt{constructor(t,e){this._root=t??Gt.createDefaultRoot(),this._current=e===void 0?this._root:e}static createDefaultRoot(){const t=new mi;return t.setName("All"),t.setAllowDelete(!1),t.setAllowRename(!1),t.setFilterExpression(""),t}get root(){return this._root}get current(){return this._current}set current(t){this._current=t}clone(){return new Gt(this._root,this._current)}}class Fl extends mi{constructor(){super(),this._layerIds=[]}isIdFilter(){return!0}layerIds(){return this._layerIds}get layerIdList(){return this._layerIds}addLayerId(t){return!t||this._layerIds.includes(t)?!1:(this._layerIds.push(t),!0)}removeLayerId(t){const e=this._layerIds.indexOf(t);return e<0?!1:(this._layerIds.splice(e,1),!0)}filter(t){return t?this._layerIds.includes(t.objectId):!1}setFilterExpression(t){return!1}}const _i="ACAD_LAYERFILTERS",ze="ACLYDICTIONARY";function eg(i){const t=Gt.createDefaultRoot(),e=new Gt(t,t),n=Oo(i,ze),r=Oo(i,_i);if(n){for(const[s,o]of Object.entries(n.entries)){const a=cr(i,o,s);a&&t.addNested(a)}return e}if(r)for(const[s,o]of Object.entries(r.entries)){const a=cr(i,o,s);a&&t.addNested(a)}return e}function zl(i){const t=[];for(const e of i.root.getNestedFilters())t.push(Dl(e));return{nodes:t}}function Vl(i){const t=new ui;for(const e of i)t.add({code:e.code,value:e.value});return t}function ng(i){return i?i.toArray().map(t=>({code:Number(t.code),value:t.value})):[]}function Oo(i,t){let e;for(const n of i.dictionaries.values()){const r=n.entries[t];if(!r)continue;const s=i.dictionaries.get(Vt(r));if(!s)continue;if(!(n.ownerObjectId?i.xrecords.has(Vt(n.ownerObjectId)):!1))return s;e=s}return e}function cr(i,t,e){const n=i.xrecords.get(Vt(t));if(!n)return;const r=jl(n.data,e),s=r.isIdFilter?new Fl:new mi;if(s.setAllowRename(!0),s.setName(r.name||e),!r.isIdFilter)s.setFilterExpression(r.filterExpression);else{const o=s;for(const a of r.layerIds)o.addLayerId(a)}for(const o of ig(i,n)){const a=cr(i,o.handle,o.key);a&&s.addNested(a)}return s}function ig(i,t){const e=[],n=new Set,r=Vt(t.handle),s=t.extensionDictionaryId?Vt(t.extensionDictionaryId):void 0,o=(a,l)=>{const h=Vt(l);n.has(h)||(n.add(h),e.push({key:a,handle:l}))};for(const a of i.dictionaries.values()){const l=a.ownerObjectId?Vt(a.ownerObjectId):void 0;if(!(l===r||l===s))continue;const c=a.entries[ze];if(c){const u=i.dictionaries.get(Vt(c));if(u){for(const[g,d]of Object.entries(u.entries))o(g,d);continue}}for(const[u,g]of Object.entries(a.entries))u===ze||u===_i||o(u,g)}return e}function jl(i,t=""){const e=[],n=[];let r=0,s,o,a;for(const f of i){const p=Number(f.code),y=f.value;p===1&&typeof y=="string"?e.push(y):p===300&&typeof y=="string"?o=y:p===301&&typeof y=="string"?a=y:p===70||p===90?r=Number(y)||0:p===290||p===280?s=Number(y)===1:(p===330||p===340||p===350||p===360)&&y!=null&&String(y).length>0&&n.push(Vt(String(y)))}const l=e[0],c=o||(l==="AcLyLayerFilter"||l==="AcLyLayerGroup"?void 0:l)||t,u=e[1]??"";let g=a??u;!a&&g&&g!=="*"&&!/==/.test(g)&&(g=`NAME=="${g}"`);const d=a!=null&&a.length>0?!1:s===!0&&n.length>0?!0:n.length>0&&(g.length===0||g==="*");return{name:c,filterExpression:d?"":g,flags:r,layerIds:n,isIdFilter:d}}function Dl(i){const t=i.isIdFilter(),e=Gl(i),n=i.getNestedFilters().map(s=>Dl(s));return{key:i.name||(t?"Group":"Filter"),isIdFilter:t,data:e,children:n}}function Gl(i){const t=[];if(t.push({code:1,value:i.name}),i.isIdFilter()){t.push({code:1,value:""}),t.push({code:1,value:"*"}),t.push({code:1,value:"*"}),t.push({code:70,value:0}),t.push({code:1,value:"*"}),t.push({code:1,value:"*"}),t.push({code:290,value:1});const e=i;for(const n of e.layerIds())t.push({code:330,value:n})}else t.push({code:1,value:i.filterExpression||"*"}),t.push({code:1,value:"*"}),t.push({code:1,value:"*"}),t.push({code:70,value:0}),t.push({code:1,value:"*"}),t.push({code:1,value:"*"}),t.push({code:290,value:0});return t}function Vt(i){return i.trim().toUpperCase()}class Wt extends lt{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._unnamedRecords=[]}get numEntries(){return this._recordsByName.size}get totalRecordCount(){return this._recordsByName.size+this._unnamedRecords.length}add(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot add symbol table records outside an active transaction.");const n=e.resolveSymbolTableName(this);t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,s=>this.hasId(s));const r=this.normalizeName(t.name);r?this._recordsByName.set(r,t):this._unnamedRecords.push(t),e.isRecording()&&e.recordAppend({type:"symbolTable",tableName:n},t)}remove(t){const e=this.normalizeName(t),n=this._recordsByName.get(e);return n?(this.removeRecord(n),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this.removeRecord(e),!0):!1}removeRecord(t){const e=this.database.transactionManager;if(e.strictMode&&!e.isRecording()&&!e.isApplyingUndoRedo())throw new Error("Cannot remove symbol table records outside an active transaction.");if(e.isRecording()){const n=e.resolveSymbolTableName(this);e.recordRemove({type:"symbolTable",tableName:n},t)}this.removeFromMembership(t),this.database.releaseObjectHandle(t)}removeAll(){for(const t of this._recordsByName.values())this.database.releaseObjectHandle(t);for(const t of this._unnamedRecords)this.database.releaseObjectHandle(t);this._recordsByName.clear(),this._unnamedRecords.length=0}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this.getIdAt(t)!==void 0}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){const e=this.database.getObjectById(t);if(!(!e||e.getAttrWithoutException("ownerId")!==this.objectId))return e}getOwnerIdAt(t){return this.getIdAt(t)}newIterator(t=!1){return t?new Be([...this._recordsByName.values(),...this._unnamedRecords]):new Be(this._recordsByName)}normalizeName(t){return t.trim().toUpperCase()}get dxfEntryCount(){return this.numEntries}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.dxfEntryCount),this}removeFromMembership(t){const e=this.normalizeName(t.name);if(e){this._recordsByName.delete(e);return}const n=this._unnamedRecords.indexOf(t);n>=0&&this._unnamedRecords.splice(n,1)}}class Ul extends Wt{constructor(t){super(t)}get modelSpace(){let t=this.getAt(tt.MODEL_SPACE_NAME);return t||(t=new tt,t.name=tt.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){const e=this.database.getObjectById(t);if(e instanceof V)return e}removeEntity(t){let e=!1;for(const n of this.database.tables.blockTable.newIterator())if(n.removeEntity(t)){e=!0;break}return e}getXrefs(){const t=[];for(const e of this.newIterator())e.isXref&&t.push(e);return t}getUnresolvedXrefs(){return this.getXrefs().filter(t=>t.isUnresolvedXref)}normalizeName(t){const e=t.trim();if(tt.isModelSapceName(e))return tt.MODEL_SPACE_NAME;if(tt.isPaperSapceName(e)){const n=tt.PAPER_SPACE_NAME_PREFIX,r=e.substring(n.length);return n+r}return super.normalizeName(e)}}const wt=class wt extends Error{constructor(t,e,n){super(t),this.name="AcDbOpenDatabaseError",this.code=e,this.stage=n==null?void 0:n.stage}static isWorkerOutOfMemoryMessage(t){const e=t.toLowerCase();return wt.WORKER_OOM_PATTERNS.some(n=>e.includes(n))}static classifyWorkerErrorMessage(t){return wt.isWorkerOutOfMemoryMessage(t)?"worker_oom":t.toLowerCase().includes("timed out")?"worker_timeout":"worker_error"}static from(t,e){if(t instanceof wt)return t;const n=t instanceof Error?t.message:String(t),r=wt.classifyWorkerErrorMessage(n);return new wt(n,r,{stage:e,cause:t})}static fromTask(t){const e=t.task.name;return wt.from(t.error,e)}static throwOnWorkerParseFailure(t,e="PARSE"){if(t.success)return;const n=t.error!=null?`Failed to parse drawing due to error: '${t.error}'`:"Failed to parse drawing due to an unknown worker error",r=wt.mapWorkerResultCode(t.errorCode,t.error);throw new wt(n,r,{stage:e})}static mapWorkerResultCode(t,e){switch(t){case"worker_oom":return"worker_oom";case"worker_timeout":return"worker_timeout";case"worker_error":return"worker_error";default:return wt.classifyWorkerErrorMessage(e??"")}}};wt.WORKER_OOM_PATTERNS=["out of memory","data cannot be cloned","allocation failed","memory access out of bounds"];let gn=wt;class Hl extends Wt{constructor(t){super(t)}}class Wl extends Wt{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class $l extends Wt{constructor(t){super(t)}}class ql extends Wt{constructor(t){super(t)}get dxfEntryCount(){return this.totalRecordCount}resolveAt(t){this.database.ensureTextStyleDefaults();const e=[],n=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};n(t),n(this.database.textstyle),n(K),n("STANDARD");for(const r of e){const s=this.getAt(r);if(s)return s;const o=r.toUpperCase();for(const a of this.newIterator())if(a.name.toUpperCase()===o)return a}return this.newIterator().next().value??void 0}get shapeFiles(){return this.newIterator(!0).toArray().filter(t=>t.isShapeFile)}get fonts(){const t=new Set;for(const e of this.newIterator()){const n=xt.normalizeFontFileName(e.fileName);n&&t.add(n);const r=xt.normalizeFontFileName(e.bigFontFileName);r&&t.add(r)}return Array.from(t)}}class Kl extends Wt{constructor(t){super(t)}}const rg=()=>({center:new S,viewDirectionFromTarget:new m(0,0,1),viewTarget:new m(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:exports.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new m(0,0,0),ucsXAxis:new m(1,0,0),ucsYAxis:new m(0,1,0),orthographicType:exports.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:exports.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0,aspectRatio:void 0});class ps extends ae{constructor(t,e){t=t||{},It(t,{gsView:rg()}),super(t,e)}get gsView(){return this.getAttr("gsView")}get centerPoint(){return this.gsView.center}set centerPoint(t){this.gsView.center.copy(t)}get viewDirectionFromTarget(){return this.gsView.viewDirectionFromTarget}set viewDirectionFromTarget(t){this.gsView.viewDirectionFromTarget.copy(t)}get viewTarget(){return this.gsView.viewTarget}set viewTarget(t){this.gsView.viewTarget.copy(t)}get viewHeight(){return this.gsView.viewHeight}set viewHeight(t){this.gsView.viewHeight=t}get viewTwistAngle(){return this.gsView.viewTwistAngle}set viewTwistAngle(t){this.gsView.viewTwistAngle=t}get lensLength(){return this.gsView.lensLength}set lensLength(t){this.gsView.lensLength=t}get frontClippingPlane(){return this.gsView.frontClippingPlane}set frontClippingPlane(t){this.gsView.frontClippingPlane=t}get backClippingPlane(){return this.gsView.backClippingPlane}set backClippingPlane(t){this.gsView.backClippingPlane=t}get renderMode(){return this.gsView.renderMode}set renderMode(t){this.gsView.renderMode=t}get viewMode(){return this.gsView.viewMode}set viewMode(t){this.gsView.viewMode=t}get ucsIconSetting(){return this.gsView.ucsIconSetting}set ucsIconSetting(t){this.gsView.ucsIconSetting=t}get ucsOrigin(){return this.gsView.ucsOrigin}set ucsOrigin(t){this.gsView.ucsOrigin.copy(t)}get ucsXAxis(){return this.gsView.ucsXAxis}set ucsXAxis(t){this.gsView.ucsXAxis.copy(t)}get ucsYAxis(){return this.gsView.ucsYAxis}set ucsYAxis(t){this.gsView.ucsYAxis.copy(t)}get orthographicType(){return this.gsView.orthographicType}set orthographicType(t){this.gsView.orthographicType=t}get shadePlotSetting(){return this.gsView.shadePlotSetting}set shadePlotSetting(t){this.gsView.shadePlotSetting=t}get shadePlotObjectId(){return this.gsView.shadePlotObjectId}set shadePlotObjectId(t){this.gsView.shadePlotObjectId=t}get visualStyleObjectId(){return this.gsView.visualStyleObjectId}set visualStyleObjectId(t){this.gsView.visualStyleObjectId=t}get isDefaultLightingOn(){return this.gsView.isDefaultLightingOn}set isDefaultLightingOn(t){this.gsView.isDefaultLightingOn=t}get defaultLightingType(){return this.gsView.defaultLightingType}set defaultLightingType(t){this.gsView.defaultLightingType=t}get brightness(){return this.gsView.brightness}set brightness(t){this.gsView.brightness=t}get contrast(){return this.gsView.contrast}set contrast(t){this.gsView.contrast=t}get ambientColor(){return this.gsView.ambientColor}set ambientColor(t){this.gsView.ambientColor=t}get aspectRatio(){return this.gsView.aspectRatio}set aspectRatio(t){this.gsView.aspectRatio=t}}const ko=2,sg=.45,og=1e5;function ag(i){var n;const t=i,e=t.aspectRatio??((n=t.gsView)==null?void 0:n.aspectRatio);return Number.isFinite(e)?e:void 0}function lg(i,t){if(Number.isFinite(t)&&t>0)return t;const e=ag(i);return e!=null&&e>0?e:1}function hg(i,t){const e=Math.max(i.min.x,t.min.x),n=Math.max(i.min.y,t.min.y),r=Math.min(i.max.x,t.max.x),s=Math.min(i.max.y,t.max.y);return e>=r||n>=s?0:(r-e)*(s-n)}function No(i){return{x:(i.min.x+i.max.x)/2,y:(i.min.y+i.max.y)/2}}function cg(i){if(!i||i.isEmpty())return!1;const t=i.max.x-i.min.x,e=i.max.y-i.min.y;return t>0&&e>0}class ye extends ps{static isActiveVportName(t){return t.toLowerCase()===Ye.toLowerCase()}constructor(t,e){t=t||{},It(t,{circleSides:100,lowerLeftCorner:new S(0,0),upperRightCorner:new S(1,1),snapBase:new S(0,0),snapAngle:0,snapSpacing:new S(0,0),standardFlag:0,gridSpacing:new S,gridMajor:10}),super(t,e)}get circleSides(){return this.getAttr("circleSides")}set circleSides(t){this.setAttr("circleSides",t)}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this.getAttr("lowerLeftCorner")}set lowerLeftCorner(t){this.getAttr("lowerLeftCorner").copy(t)}get upperRightCorner(){return this.getAttr("upperRightCorner")}set upperRightCorner(t){this.getAttr("upperRightCorner").copy(t)}get snapBase(){return this.getAttr("snapBase")}set snapBase(t){this.getAttr("snapBase").copy(t)}get snapAngle(){return this.getAttr("snapAngle")}set snapAngle(t){this.setAttr("snapAngle",t)}get snapIncrements(){return this.getAttr("snapSpacing")}set snapIncrements(t){this.getAttr("snapSpacing").copy(t)}get gridMajor(){return this.getAttr("gridMajor")}set gridMajor(t){this.setAttr("gridMajor",t)}get gridIncrements(){return this.getAttr("gridSpacing")}set gridIncrements(t){this.getAttr("gridSpacing").copy(t)}get standardFlag(){return this.getAttr("standardFlag")}set standardFlag(t){this.setAttr("standardFlag",t)}get snapEnabled(){return!!(this.standardFlag&256)}get backgroundObjectId(){return this.getAttrWithoutException("backgroundObjectId")}set backgroundObjectId(t){this.setAttr("backgroundObjectId",t)}modelViewBox(t){const e=this.centerPoint,n=this.viewHeight;if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(n)||n<=0)return;const r=this.viewTwistAngle;let s=e.x,o=e.y;if(Number.isFinite(r)&&r!==0){const g=Math.cos(r),d=Math.sin(r);s=e.x*g-e.y*d,o=e.x*d+e.y*g}const a=this.viewTarget;a&&Number.isFinite(a.x)&&Number.isFinite(a.y)&&(s+=a.x,o+=a.y);const l=lg(this,t),h=n*l,c=n/2,u=h/2;return new it().expandByPoint({x:s-u,y:o-c}).expandByPoint({x:s+u,y:o+c})}static isModelViewBoxUsable(t,e){if(t.isEmpty()||e.isEmpty())return!1;const n=t.max.x-t.min.x,r=t.max.y-t.min.y,s=e.max.x-e.min.x,o=e.max.y-e.min.y;if(n<=0||r<=0||s<=0||o<=0||n>s*ko||r>o*ko)return!1;const a=Math.max(s,o)*sg,l=No(t),h=No(e);if(Math.hypot(l.x-h.x,l.y-h.y)>a)return!1;const u=n*r,g=hg(t,e);return!(g<=0||g/u<.25)}resolveModelViewBox(t,e){const n=this.modelViewBox(t);if(!(!n||!ye.isModelViewBoxStructurallyValid(n))){if(cg(e)){if(!ye.isModelViewBoxUsable(n,e))return}else if(!ye.isModelViewBoxPlausibleWithoutExtents(n))return;return n}}static isModelViewBoxStructurallyValid(t){if(t.isEmpty())return!1;const e=t.max.x-t.min.x,n=t.max.y-t.min.y;return Number.isFinite(e)&&Number.isFinite(n)&&e>0&&n>0}static isModelViewBoxPlausibleWithoutExtents(t){const e=t.max.x-t.min.x,n=t.max.y-t.min.y;return Math.max(e,n)<=og}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),t.writeDouble(40,this.gsView.viewHeight),this.gsView.aspectRatio!=null&&Number.isFinite(this.gsView.aspectRatio)&&t.writeDouble(41,this.gsView.aspectRatio),t.writeDouble(45,this.gsView.viewHeight),t.writePoint2d(10,this.lowerLeftCorner),t.writePoint2d(11,this.upperRightCorner),t.writePoint2d(12,this.center),t.writePoint2d(13,this.snapBase),t.writePoint2d(14,this.snapIncrements),t.writePoint2d(15,this.gridIncrements),t.writeInt16(70,this.standardFlag),t.writeInt16(71,this.circleSides),t.writeDouble(42,this.gsView.lensLength),t.writePoint3d(16,this.gsView.viewDirectionFromTarget),t.writePoint3d(17,this.gsView.viewTarget),t.writeAngle(50,this.snapAngle),t.writeAngle(51,this.gsView.viewTwistAngle),t.writeInt16(61,this.gridMajor),t.writeInt16(281,this.backgroundObjectId?1:0),t.writeObjectId(332,this.backgroundObjectId),this}}class Zl extends Wt{constructor(t){super(t)}normalizeName(t){const e=t.trim();return ye.isActiveVportName(e)?Ye:super.normalizeName(e)}getActiveVport(){return this.getAt(Ye)}getActiveVportBox(t,e){const n=this.getActiveVport();return n==null?void 0:n.resolveModelViewBox(t,e)}}class Ql extends Wt{constructor(t){super(t)}}class ur extends ae{constructor(t){typeof t=="string"&&(t={name:t}),super(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}class Jl extends Tt{getBtrIdAt(t){for(const[e,n]of this._recordsByName)if(n.blockTableRecordId==t)return n}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class th{constructor(t){this.database=t}applyForward(t){for(const e of t)this.applyChange(e,!0)}applyInverse(t){for(let e=t.length-1;e>=0;e--)this.applyChange(t[e],!1)}applyChange(t,e){switch(t.kind){case"modify":this.applyModify(t,e);break;case"append":e?this.applyAppend(t.container,t.object):this.applyRemove(t.container,t.object);break;case"remove":e?this.applyRemove(t.container,t.object):this.applyAppend(t.container,t.object);break;case"sysvar":this.applySysvar(t,e);break}}applyModify(t,e){const n=this.database.getObjectById(t.objectId);if(!n)return;const r=e?t.after:t.before;r&&n.restoreFrom(r)}applySysvar(t,e){const n=e?t.after:t.before;n!==void 0&&et.instance().setVar(t.name,n,this.database)}applyAppend(t,e){switch(t.type){case"blockTableRecord":{const n=this.database.tables.blockTable.getIdAt(t.ownerId);n&&n.appendEntity(e);break}case"symbolTable":{const n=this.getSymbolTable(t.tableName);n&&n.add(e);break}case"dictionary":{const n=this.database.getObjectById(t.dictionaryId);n&&n.setAt(t.key,e);break}}}applyRemove(t,e){switch(t.type){case"blockTableRecord":{const n=this.database.tables.blockTable.getIdAt(t.ownerId);n&&n.removeEntity(e.objectId);break}case"symbolTable":{const n=this.getSymbolTable(t.tableName);n&&n.removeId(e.objectId);break}case"dictionary":{const n=this.database.getObjectById(t.dictionaryId);n&&n.removeId(e.objectId);break}}}getSymbolTable(t){const e=this.database.tables;switch(t){case"appIdTable":return e.appIdTable;case"blockTable":return e.blockTable;case"dimStyleTable":return e.dimStyleTable;case"linetypeTable":return e.linetypeTable;case"textStyleTable":return e.textStyleTable;case"viewTable":return e.viewTable;case"layerTable":return e.layerTable;case"viewportTable":return e.viewportTable;default:return}}}function dr(i,t){const e=[],n=[],r=[];for(const s of t)if(s.kind==="modify"){const o=i.getObjectById(s.objectId);o instanceof V&&e.push(o)}else if(s.kind==="append"){if(s.container.type==="blockTableRecord"){const o=i.tables.blockTable.getEntityById(s.object.objectId)??(s.object instanceof V?s.object:void 0);o&&n.push(o)}}else s.kind==="remove"&&s.container.type==="blockTableRecord"&&s.object instanceof V&&r.push(s.object);return{modified:e,appended:n,erased:r}}function Ro(i,t){const e=[],n=[];for(const r of t){if(r.kind!=="append"&&r.kind!=="remove"||r.container.type!=="dictionary")continue;const s=r.container.key;if(r.kind==="append"){const o=i.getObjectById(r.object.objectId)??r.object;e.push({object:o,key:s})}else r.kind==="remove"&&n.push({object:r.object,key:s})}return{set:e,erased:n}}function Xo(i,t){const e={};for(const n of vd){const r=i.getAttrWithoutException(n),s=t.getAttrWithoutException(n);fe(r,s)||(e[n]=s)}return e}function Yo(i,t,e=!1){const n=[];for(const r of t){if(r.kind!=="modify")continue;const s=i.getObjectById(r.objectId);if(!(s instanceof di))continue;const o=r.before,a=r.after;if(!o||!a)continue;const l=e?Xo(a,o):Xo(o,a);Object.keys(l).length!==0&&n.push({database:i,layer:s,changes:l})}return n}function ug(i,t){if(i.type!==t.type)return!1;switch(i.type){case"blockTableRecord":return t.type==="blockTableRecord"&&i.ownerId===t.ownerId;case"symbolTable":return t.type==="symbolTable"&&i.tableName===t.tableName;case"dictionary":return t.type==="dictionary"&&i.dictionaryId===t.dictionaryId&&i.key===t.key}}class eh{constructor(){this.changes=[]}getChanges(){return this.changes}clear(){this.changes.length=0}mergeFrom(t){for(const e of t.getChanges())this.mergeChange(e)}recordModify(t){const e=t.objectId;this.changes.find(r=>r.kind==="modify"&&r.objectId===e)||this.changes.push({kind:"modify",objectId:e,before:t.clonePreservingIdentity()})}hasModify(t){return this.changes.some(e=>e.kind==="modify"&&e.objectId===t)}recordAppend(t,e){this.recordStructuralChange({kind:"append",container:t,object:e.clonePreservingIdentity()})}recordRemove(t,e){this.recordStructuralChange({kind:"remove",container:t,object:e.clonePreservingIdentity()})}recordSysvar(t,e){const n=t.toLowerCase();this.changes.find(s=>s.kind==="sysvar"&&s.name===n)||this.changes.push({kind:"sysvar",name:n,before:e})}finalize(t){for(const e of this.changes)if(e.kind==="modify"){const n=t.getObjectById(e.objectId);n&&(e.after=n.clonePreservingIdentity())}else e.kind==="sysvar"&&(e.after=this.getSysvarValue(t,e.name))}recordStructuralChange(t){const e=t.kind==="append"?"remove":"append",n=this.findStructuralChangeIndex(e,t.container,t.object.objectId);if(n>=0){this.changes.splice(n,1);return}this.changes.push(t)}mergeChange(t){if(t.kind==="modify"){this.changes.find(n=>n.kind==="modify"&&n.objectId===t.objectId)||this.changes.push(t);return}if(t.kind==="sysvar"){this.changes.find(n=>n.kind==="sysvar"&&n.name===t.name)||this.changes.push(t);return}this.recordStructuralChange(t)}findStructuralChangeIndex(t,e,n){return this.changes.findIndex(r=>r.kind===t&&r.object.objectId===n&&ug(r.container,e))}getSysvarValue(t,e){return et.instance().getVar(e,t)}}class ys{constructor(){this.openedObjects=new Map,this.originalStates=new Map,this.recorder=new eh}getObject(t,e,n=!1){const r=this.openedObjects.get(t);if(r){if(e===Fe.kForWrite&&!this.originalStates.has(t)){const o=r.clonePreservingIdentity();this.originalStates.set(t,o),this.recorder.recordModify(r)}return r}const s=this.lookupObject(t,n);if(this.openedObjects.set(t,s),e===Fe.kForWrite){const o=s.clonePreservingIdentity();this.originalStates.set(s.objectId,o),this.recorder.recordModify(s)}return s}commit(){this.originalStates.clear(),this.openedObjects.clear()}abort(){for(const[t,e]of this.originalStates){const n=this.openedObjects.get(t);n&&n.restoreFrom(e)}this.originalStates.clear(),this.openedObjects.clear(),this.recorder.clear()}lookupObject(t,e){throw new Error(`lookupObject(${t}) not implemented`)}}class nh extends ys{constructor(t){super(),this.database=t}lookupObject(t,e){const n=this.database.getObjectById(t,e);if(!n)throw new Error(`lookupObject(${t}) not found`);return n}}class ih{constructor(){this.undoRecords=[],this.redoRecords=[],this.maxDepth=100}push(t){this.undoRecords.push(t),this.redoRecords.length=0,this.undoRecords.length>this.maxDepth&&this.undoRecords.shift()}popUndo(){return this.undoRecords.pop()}pushRedo(t){this.redoRecords.push(t)}popRedo(){return this.redoRecords.pop()}canUndo(){return this.undoRecords.length>0}canRedo(){return this.redoRecords.length>0}clear(){this.undoRecords.length=0,this.redoRecords.length=0}}class rh{constructor(t){this.database=t,this.transactionStack=[],this.undoStack=new ih,this.undoMarkStack=[],this._applyingUndoRedo=!1,this._pendingEntityModified=new Set,this._pendingLayerModified=new Map,this.strictMode=!1,this.changeApplier=new th(t)}startTransaction(){const t=new nh(this.database);return this.transactionStack.push(t),t}currentTransaction(){return this.transactionStack[this.transactionStack.length-1]}hasTransaction(){return this.transactionStack.length>0}isRecording(){return this.hasTransaction()&&!this._applyingUndoRedo}isApplyingUndoRedo(){return this._applyingUndoRedo}isOpenedForWriteInTransaction(t){for(const e of this.transactionStack)if(e.recorder.hasModify(t))return!0;return!1}commitTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to commit.");if(this.transactionStack.length>0){this.transactionStack[this.transactionStack.length-1].recorder.mergeFrom(t.recorder),t.commit();return}t.recorder.finalize(this.database);const e=t.recorder.getChanges();t.commit(),e.length>0&&(this.dispatchCommitEvents(e),this.enqueueUndoChanges(e))}abortTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to abort.");const e=[...t.recorder.getChanges()];this.database.beginEventBatch(),this._applyingUndoRedo=!0;try{t.abort(),e.length>0&&this.changeApplier.applyInverse(e)}finally{this._applyingUndoRedo=!1,this.database.endEventBatch()}}startUndoMark(t){this.undoMarkStack.push({label:t,pendingChanges:[]})}endUndoMark(){const t=this.undoMarkStack.pop();if(!t)throw new Error("No active undo mark to end.");t.pendingChanges.length!==0&&this.undoStack.push({label:t.label,changes:t.pendingChanges})}cancelUndoMark(){this.undoMarkStack.length>0&&this.undoMarkStack.pop()}undo(){const t=this.undoStack.popUndo();if(!t)return!1;this.database.beginEventBatch(),this._applyingUndoRedo=!0;try{this.changeApplier.applyInverse(t.changes),this.dispatchUndoRedoEvents(t.changes,!0)}finally{this._applyingUndoRedo=!1,this.database.endEventBatch()}return this.undoStack.pushRedo(t),!0}redo(){const t=this.undoStack.popRedo();if(!t)return!1;this.database.beginEventBatch(),this._applyingUndoRedo=!0;try{this.changeApplier.applyForward(t.changes),this.dispatchUndoRedoEvents(t.changes,!1)}finally{this._applyingUndoRedo=!1,this.database.endEventBatch()}return this.undoStack.push(t),!0}canUndo(){return this.undoStack.canUndo()}canRedo(){return this.undoStack.canRedo()}clearUndoStack(){this.undoStack.clear()}recordAppend(t,e){var n;this.isRecording()&&((n=this.currentTransaction())==null||n.recorder.recordAppend(t,e))}recordRemove(t,e){var n;this.isRecording()&&((n=this.currentTransaction())==null||n.recorder.recordRemove(t,e))}recordSysvar(t,e){var n;this.isRecording()&&((n=this.currentTransaction())==null||n.recorder.recordSysvar(t,e))}resolveSymbolTableName(t){const e=this.database.tables;return t===e.appIdTable?"appIdTable":t===e.blockTable?"blockTable":t===e.dimStyleTable?"dimStyleTable":t===e.linetypeTable?"linetypeTable":t===e.textStyleTable?"textStyleTable":t===e.viewTable?"viewTable":t===e.layerTable?"layerTable":t===e.viewportTable?"viewportTable":t.objectId}runUndoable(t,e){this.startUndoMark(t),this.startTransaction();try{const n=e(this.currentTransaction());return this.commitTransaction(),this.endUndoMark(),n}catch(n){throw this.hasTransaction()&&this.abortTransaction(),this.cancelUndoMark(),n}}enqueueUndoChanges(t){const e=this.undoMarkStack[this.undoMarkStack.length-1];if(e)for(const n of t)e.pendingChanges.push(n)}dispatchCommitEvents(t){const{modified:e,appended:n,erased:r}=dr(this.database,t);for(const a of e)this.dispatchEntityModified(a);n.length>0&&this.database.notifyEntityAppended(n),r.length>0&&this.database.notifyEntityErased(r);const{set:s,erased:o}=Ro(this.database,t);for(const{object:a,key:l}of s)this.database.notifyDictObjectSet(a,l);for(const{object:a,key:l}of o)this.database.notifyDictObjectErased(a,l);for(const a of t)a.kind==="sysvar"&&a.after!==void 0&&et.instance().events.sysVarChanged.dispatch({database:this.database,name:a.name,oldVal:a.before,newVal:a.after});for(const a of Yo(this.database,t))this.dispatchLayerModified(a)}dispatchUndoRedoEvents(t,e){const{modified:n,appended:r,erased:s}=dr(this.database,t),{set:o,erased:a}=Ro(this.database,t);if(e){for(const l of n)this.dispatchEntityModified(l);s.length>0&&this.database.notifyEntityAppended(s),r.length>0&&this.database.notifyEntityErased(r);for(const{object:l,key:h}of a)this.database.notifyDictObjectSet(l,h);for(const{object:l,key:h}of o)this.database.notifyDictObjectErased(l,h)}else{for(const l of n)this.dispatchEntityModified(l);r.length>0&&this.database.notifyEntityAppended(r),s.length>0&&this.database.notifyEntityErased(s);for(const{object:l,key:h}of o)this.database.notifyDictObjectSet(l,h);for(const{object:l,key:h}of a)this.database.notifyDictObjectErased(l,h)}for(const l of t)if(l.kind==="sysvar"){const h=e?l.after:l.before,c=e?l.before:l.after;c!==void 0&&et.instance().events.sysVarChanged.dispatch({database:this.database,name:l.name,oldVal:h,newVal:c})}for(const l of Yo(this.database,t,e))this.dispatchLayerModified(l)}dispatchLayerModified(t){if(this.database.isEventBatched()){const e=this._pendingLayerModified.get(t.layer.objectId);if(e){e.changes={...e.changes,...t.changes};return}this._pendingLayerModified.set(t.layer.objectId,{database:t.database,layer:t.layer,changes:{...t.changes}});return}this.database.events.layerModified.dispatch(t)}dispatchEntityModified(t){if(this.database.isEventBatched()){this._pendingEntityModified.add(t);return}this.database.events.entityModified.dispatch({database:this.database,entity:t})}flushPendingLayerModifiedEvents(){if(this._pendingLayerModified.size===0)return;const t=[...this._pendingLayerModified.values()];this._pendingLayerModified.clear();for(const e of t)this.database.events.layerModified.dispatch(e)}flushPendingEntityModifiedEvents(){if(this._pendingEntityModified.size===0)return;const t=[...this._pendingEntityModified];this._pendingEntityModified.clear();for(const e of t)this.database.events.entityModified.dispatch({database:this.database,entity:e})}}const rn=class rn extends lt{constructor(){super({objectId:"0"}),this._classes=[],this._handleRegistry=new Map,this._drawNoPlotLayers=!0,this._eventBatchDepth=0,this._pendingEntityAppended=[],this._pendingEntityErased=[],this._pendingDictObjectSet=[],this._pendingDictObjectErased=[],this._lastOpenError=null,this.events={dictObjetSet:new q,dictObjectErased:new q,entityAppended:new q,entityModified:new q,entityErased:new q,layerAppended:new q,layerModified:new q,layerErased:new q,openProgress:new q,openFailed:new q},rn._unsavedDrawingSequence+=1,this._dwgname=`Drawing${rn._unsavedDrawingSequence}.dwg`,this._version=new jt("AC1014"),this._angbase=0,this._angdir=0,this._aunits=dt.DecimalDegrees,this._auprec=0,this._lunits=$.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new X,this._celtype=J,this._celweight=exports.AcGiLineWeight.ByLayer,this._cetransparency=new Q,this._clayer="0",this._cmlstyle=ne,this._cmlscale=1,this._cmleaderstyle=ie,this._hpbackgroundcolor=new X(exports.AcCmColorMethod.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new Q,this._textstyle=K,this._extents=new k,this._insunits=H.Millimeters,this._unitmode=0,this._measurement=1,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._orthomode=0,this._maxHandle=0,this._tables={appIdTable:new Ql(this),blockTable:new Ul(this),dimStyleTable:new Hl(this),linetypeTable:new $l(this),textStyleTable:new ql(this),viewTable:new Kl(this),layerTable:new Wl(this),viewportTable:new Zl(this)},this._objects={dictionary:new Tt(this),imageDefinition:new Tt(this),layerFilter:new Tt(this),layerIndex:new Tt(this),layout:new Jl(this),mleaderStyle:new Tt(this),mlineStyle:new Tt(this),xrecord:new Tt(this)},this._layerFilters=new Gt,this.transactionManager=new rh(this),this.registerBootstrapHandles()}get tables(){return this._tables}get classes(){return this._classes}set classes(t){this._classes=t.map(e=>({...e}))}get objects(){return this._objects}get layerFilters(){return this._layerFilters}set layerFilters(t){this._layerFilters=t??new Gt}getObjectById(t,e=!1){return t===this.objectId?this:this._handleRegistry.get(t)}isUndoRecording(){return this.transactionManager.isRecording()}openObject(t,e){const n=this.transactionManager.currentTransaction();if(n){const r=n.getObject(t,e);if(r)return r}return this.getObjectById(t)}openObjectForRead(t){return this.openObject(t,Fe.kForRead)}openObjectForWrite(t){return this.openObject(t,Fe.kForWrite)}openEntityForRead(t){const e=typeof t=="string"?t:t.objectId;return this.openObjectForRead(e)}openEntityForWrite(t){const e=typeof t=="string"?t:t.objectId;return this.openObjectForWrite(e)}runDatabaseEdit(t,e){if(this.isUndoRecording()){e();return}this.transactionManager.runUndoable(t,e)}getRootDictionaries(){return[this.objects.dictionary,this.objects.imageDefinition,this.objects.layerFilter,this.objects.layerIndex,this.objects.layout,this.objects.mleaderStyle,this.objects.mlineStyle,this.objects.xrecord]}beginEventBatch(){this._eventBatchDepth++}endEventBatch(){this._eventBatchDepth<=0||(this._eventBatchDepth--,this._eventBatchDepth===0&&(this.transactionManager.flushPendingEntityModifiedEvents(),this.transactionManager.flushPendingLayerModifiedEvents(),this.flushEventBatch()))}isEventBatched(){return this._eventBatchDepth>0}notifyEntityAppended(t){if(this.isEventBatched()){const e=Array.isArray(t)?t:[t];this._pendingEntityAppended.push(...e);return}this.events.entityAppended.dispatch({database:this,entity:t})}notifyEntityErased(t){if(this.isEventBatched()){const e=Array.isArray(t)?t:[t];this._pendingEntityErased.push(...e);return}this.events.entityErased.dispatch({database:this,entity:t})}notifyDictObjectSet(t,e){if(this.isEventBatched()){this._pendingDictObjectSet.push({object:t,key:e});return}this.events.dictObjetSet.dispatch({database:this,object:t,key:e})}notifyDictObjectErased(t,e){if(this.isEventBatched()){this._pendingDictObjectErased.push({object:t,key:e});return}this.events.dictObjectErased.dispatch({database:this,object:t,key:e})}flushEventBatch(){if(this._pendingEntityAppended.length>0){const t=this._pendingEntityAppended;this._pendingEntityAppended=[],this.events.entityAppended.dispatch({database:this,entity:t})}if(this._pendingEntityErased.length>0){const t=this._pendingEntityErased;this._pendingEntityErased=[],this.events.entityErased.dispatch({database:this,entity:t})}if(this._pendingDictObjectSet.length>0){const t=this._pendingDictObjectSet;this._pendingDictObjectSet=[];for(const{object:e,key:n}of t)this.events.dictObjetSet.dispatch({database:this,object:e,key:n})}if(this._pendingDictObjectErased.length>0){const t=this._pendingDictObjectErased;this._pendingDictObjectErased=[];for(const{object:e,key:n}of t)this.events.dictObjectErased.dispatch({database:this,object:e,key:n})}}get formatter(){return this._formatter??(this._formatter=new Ll(this))}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}generateUniqueHandle(){let t=this.generateHandle();for(;this.isHandleTaken(t);)t=this.generateHandle();return t}initializeHandleSeed(t){const e=parseInt(t,16);if(!isNaN(e)&&e>0){const n=e-1;n>this._maxHandle&&(this._maxHandle=n)}}adoptExternalHandle(t,e){return this.releaseObjectHandle(t),e&&!e.startsWith(ee)&&!this.isHandleTaken(e)?(t.objectId=e,this.registerObjectHandle(t),this.updateMaxHandle(e),e):this.assignGeneratedHandle(t)}registerObjectHandle(t){const e=t.objectId;!e||e.startsWith(ee)||this._handleRegistry.set(e,t)}releaseObjectHandle(t){const e=t.objectId;!e||e.startsWith(ee)||this._handleRegistry.get(e)===t&&this._handleRegistry.delete(e)}isHandleTaken(t,e){if(!t||t.startsWith(ee))return!1;const n=this._handleRegistry.get(t);return n!==void 0&&n!==e}registerBootstrapHandles(){this._handleRegistry.clear(),this.registerObjectHandle(this);for(const t of[this._tables.blockTable,this._tables.dimStyleTable,this._tables.layerTable,this._tables.linetypeTable,this._tables.appIdTable,this._tables.textStyleTable,this._tables.viewTable,this._tables.viewportTable])this.registerObjectHandle(t);for(const t of[this._objects.dictionary,this._objects.imageDefinition,this._objects.layerFilter,this._objects.layerIndex,this._objects.layout,this._objects.mleaderStyle,this._objects.mlineStyle,this._objects.xrecord])this.registerObjectHandle(t)}assignGeneratedHandle(t){const e=t.objectId;this.releaseObjectHandle(t);const n=this.generateUniqueHandle();return t.objectId=n,this.registerObjectHandle(t),e&&e!==n&&this.updateMaxHandle(n),n}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const n=t.getAttrWithoutException("objectId"),r=e!=null&&n!=null&&e(n);if(!n||t.isTemp||r){this.assignGeneratedHandle(t);return}const o=this._handleRegistry.get(n);if(o&&o!==t)if(this.shouldPreserveIncomingHandle(t))this.assignGeneratedHandle(o);else{this.assignGeneratedHandle(t);return}this.registerObjectHandle(t),this.updateMaxHandle(n)}shouldPreserveIncomingHandle(t){return!t.isTemp}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar(v.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get auprec(){return this._auprec}set auprec(t){this.updateSysVar(v.AUPREC,this._auprec,t??0,e=>{this._auprec=e})}get lunits(){return this._lunits}set lunits(t){this.updateSysVar(v.LUNITS,this._lunits,t??$.Decimal,e=>{this._lunits=e})}get luprec(){return this._luprec}set luprec(t){this.updateSysVar(v.LUPREC,this._luprec,t??4,e=>{this._luprec=e})}get version(){return this._version}set version(t){this.updateSysVar(v.ACADVER,this._version,new jt(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(v.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get unitmode(){return this._unitmode}set unitmode(t){this.updateSysVar(v.UNITMODE,this._unitmode,t??0,e=>{this._unitmode=e})}get measurement(){return this._measurement}set measurement(t){this.updateSysVar(v.MEASUREMENT,this._measurement,t??1,e=>{this._measurement=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(v.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}get drawNoPlotLayers(){return this._drawNoPlotLayers}get dwgname(){return this._dwgname}setDwgName(t){const e=t.trim();e&&this.updateSysVar(v.DWGNAME,this._dwgname,e,n=>{this._dwgname=n})}isLayerDrawable(t){if(this._drawNoPlotLayers)return!0;const e=this.tables.layerTable.getAt(t);return e==null||e.isPlottable}set lwdisplay(t){this.updateSysVar(v.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(v.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(v.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celtype(){return this._celtype}set celtype(t){const e=this.normalizeLinetypeName(t??J);this.updateSysVar(v.CELTYPE,this._celtype,e,n=>{this._celtype=n})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(v.CELWEIGHT,this._celweight,t??exports.AcGiLineWeight.ByLayer,e=>{this._celweight=e})}get cetransparency(){return this._cetransparency}set cetransparency(t){this.updateSysVar(v.CETRANSPARENCY,this._cetransparency,t??new Q,e=>{this._cetransparency=e.clone()})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(v.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get cmlstyle(){return this._cmlstyle}set cmlstyle(t){this.updateSysVar(v.CMLSTYLE,this._cmlstyle,t??ne,e=>{this._cmlstyle=e})}get cmlscale(){return this._cmlscale}set cmlscale(t){this.updateSysVar(v.CMLSCALE,this._cmlscale,t??1,e=>{this._cmlscale=e})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(t){this.updateSysVar(v.CMLEADERSTYLE,this._cmleaderstyle,t??ie,e=>{this._cmleaderstyle=e})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(t){this.updateSysVar(v.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,t??new X(exports.AcCmColorMethod.None),e=>{this._hpbackgroundcolor=e.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(t){this.updateSysVar(v.HPCOLOR,this._hpcolor,t??this._cecolor,e=>{this._hpcolor=e.clone()})}get hplayer(){return this._hplayer}set hplayer(t){this.updateSysVar(v.HPLAYER,this._hplayer,t??".",e=>{this._hplayer=e})}get hptransparency(){return this._hptransparency}set hptransparency(t){this.updateSysVar(v.HPTRANSPARENCY,this._hptransparency,t??new Q,e=>{this._hptransparency=e.clone()})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(v.TEXTSTYLE,this._textstyle,t??K,e=>{this._textstyle=e})}get angbase(){return this._angbase}set angbase(t){this.updateSysVar(v.ANGBASE,this._angbase,t??0,e=>{this._angbase=e})}get angdir(){return this._angdir}set angdir(t){this.updateSysVar(v.ANGDIR,this._angdir,t??0,e=>{this._angdir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent(v.EXTMAX,e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent(v.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(v.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(v.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(v.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}get orthomode(){return this._orthomode}set orthomode(t){this.updateSysVar(v.ORTHOMODE,this._orthomode,t??0,e=>{this._orthomode=e})}get lastOpenError(){return this._lastOpenError}async read(t,e,n=Je.DXF){const r=Ot.instance.get(n);if(r==null)throw new Error(`Database converter for file type '${n}' isn't registered and can can't read this file!`);this.clear(),this._lastOpenError=null,this._drawNoPlotLayers=(e==null?void 0:e.drawNoPlotLayers)??!0,e!=null&&e.fileName&&this.setDwgName(e.fileName);try{await r.read(t,this,e&&e.minimumChunkSize||10,this.createConversionProgressHandler(e),e==null?void 0:e.timeout,e==null?void 0:e.sysVars)}catch(s){const o=gn.from(s);throw this._lastOpenError=o,this.events.openFailed.dispatch({database:this,error:o}),o}this._lastOpenError=null,this.ensureDatabaseDefaults()}createConversionProgressHandler(t){return async(e,n,r,s,o)=>{let a=s;if(r==="ERROR"&&o){const l=gn.fromTask(o);this._lastOpenError=l,a={code:l.code,message:l.message,stage:l.stage??n}}if(this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:n,subStageStatus:r,data:a}),t&&t.fontLoader&&n=="FONT"&&r=="END"){const l=s||this.tables.textStyleTable.fonts;try{await t.fontLoader.load(l)}catch(h){if(t.failOnFontLoadError)throw h;const c=h instanceof Error?h.message:String(h);this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:n,subStageStatus:"ERROR",data:{fonts:l,error:c,code:"font_load_failed"}})}}}}async openUri(t,e){var d;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const n=await fetch(t);if(!n.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${n.status}'!`);const r=n.headers.get("content-length"),s=r?parseInt(r,10):null;let o=0;const a=(d=n.body)==null?void 0:d.getReader();if(!a)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:f,value:p}=await a.read();if(f)break;if(l.push(p),o+=p.length,s!==null){const y=Math.round(o/s*100);this.events.openProgress.dispatch({database:this,percentage:y,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const h=new Uint8Array(o);let c=0;for(const f of l)h.set(f,c),c+=f.length;const u=this.getFileNameFromUri(t);u&&this.setDwgName(u);const g=u.toLowerCase().split(".").pop();g==="dwg"?await this.read(h.buffer,e,Je.DWG):g==="dxf"?await this.read(h.buffer,e,Je.DXF):await this.read(h.buffer,e,g),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,n=this.version.name,r=!1){this.ensureDatabaseDefaults(),this._layerFilters.root.getNestedFilters().length>0&&!this.tables.layerTable.extensionDictionary&&(this.tables.layerTable.extensionDictionary=this.generateHandle());const s=n instanceof jt?n:new jt(n),o=new sa({database:this,precision:e,version:s});return this.writeDxfHeaderSection(o),this.writeDxfClassesSection(o),this.writeDxfTablesSection(o,s),this.writeDxfBlocksSection(o),this.writeDxfEntitiesSection(o),this.writeDxfObjectsSection(o),o.writeStart("EOF"),o.toString()}async regen(){await new gl(this).read(null,this,500,this.createConversionProgressHandler())}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Sl(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureEntityStyleDefaults(t){var e;if(t.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||ne);return}if(t.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||ie);return}if(t.dxfTypeName==="HATCH"){const n=t;(e=n.applyPatternDefaultsFromSysVars)==null||e.call(n,this)}}ensureTextStyleDefaults(){this.hasDefaultTextStyle()||this.tables.textStyleTable.add(new ds({name:K,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}hasDefaultTextStyle(){const t=[K,"STANDARD"];for(const e of t)if(this.tables.textStyleTable.has(e))return!0;for(const e of this.tables.textStyleTable.newIterator())if(e.name.toUpperCase()===K.toUpperCase())return!0;return!1}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new X;e.colorIndex=7,this.tables.layerTable.add(new di({name:"0",standardFlags:0,linetype:se,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(Xt)||this.tables.linetypeTable.add(new pe({name:Xt,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(J)||this.tables.linetypeTable.add(new pe({name:J,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(se)||this.tables.linetypeTable.add(new pe({name:se,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.ensureTextStyleDefaults(),this.tables.dimStyleTable.has(K)||this.tables.dimStyleTable.add(new vt({name:K,dimtxsty:K})),!this.tables.viewportTable.has(Ye)){const e=new ye;e.name=Ye,this.tables.viewportTable.add(e)}this.ensureMLineStyle(this._cmlstyle||ne),this.ensureMLeaderStyle(this._cmleaderstyle||ie);const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new ci;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=t.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(e.layoutName,e),t.layoutId=e.objectId}this.tables.appIdTable.has(nr)||this.tables.appIdTable.add(new ur(nr)),this.tables.appIdTable.has(er)||this.tables.appIdTable.add(new ur(er))}ensureMLineStyle(t){const e=this.objects.mlineStyle,n=t.trim();if(!n||e.getAt(n))return;for(const[s,o]of e.entries())if(s.toUpperCase()===n.toUpperCase()||o.styleName.toUpperCase()===n.toUpperCase())return;const r=new Nl;r.styleName=n,r.elements=[{offset:.5,color:new X().setByLayer(),lineType:J},{offset:-.5,color:new X().setByLayer(),lineType:J}],e.setAt(n,r)}ensureMLeaderStyle(t){const e=this.objects.mleaderStyle,n=t.trim();if(!n||e.getAt(n))return;for(const[a]of e.entries())if(a.toUpperCase()===n.toUpperCase())return;const r=new kl;r.unknown1=2,r.maxLeaderSegmentsPoints=2,r.leaderLineColor=new X().setByBlock(),r.textColor=new X().setByBlock(),r.blockColor=new X().setByBlock(),r.alignSpace=4,r.breakSize=3.75,r.enableBlockRotation=!0,r.unknown2=!1;const s=this.tables.linetypeTable.getAt(Xt);r.leaderLineTypeId=s==null?void 0:s.objectId;const o=this.tables.textStyleTable.getAt(K);r.textStyleId=o==null?void 0:o.objectId,e.setAt(n,r)}writeDxfHeaderSection(t){var e;t.startSection("HEADER"),t.writeString(9,"$ACADVER"),t.writeString(1,((e=t.version)==null?void 0:e.name)??this.version.name),t.writeString(9,"$HANDSEED"),t.writeString(5,t.nextHandle.toString(16).toUpperCase()),t.version!=null&&t.version.value>=27&&(t.writeString(9,"$DWGCODEPAGE"),t.writeString(3,"UTF-8")),t.writeString(9,"$INSUNITS"),t.writeInt16(70,this.insunits),t.writeString(9,"$LUNITS"),t.writeInt16(70,this.lunits),t.writeString(9,"$LUPREC"),t.writeInt16(70,this.luprec),t.writeString(9,"$UNITMODE"),t.writeInt16(70,this.unitmode),t.writeString(9,"$MEASUREMENT"),t.writeInt16(70,this.measurement),t.writeString(9,"$LTSCALE"),t.writeDouble(40,this.ltscale),t.writeString(9,"$LWDISPLAY"),t.writeInt16(70,this.lwdisplay?1:0),t.writeString(9,"$CLAYER"),t.writeString(8,this.clayer),t.writeString(9,"$CELTYPE"),t.writeString(6,this.celtype),this.cetransparency.isInvalid||(t.writeString(9,"$CETRANSPARENCY"),t.writeTransparency(this.cetransparency)),t.writeString(9,"$CMLSTYLE"),t.writeString(2,this.cmlstyle),t.writeString(9,"$CMLSCALE"),t.writeDouble(40,this.cmlscale),t.writeString(9,"$CMLEADERSTYLE"),t.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPCOLOR"),t.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPBACKGROUNDCOLOR"),t.writeCmColor(this.hpbackgroundcolor,2)),t.writeString(9,"$HPLAYER"),t.writeString(8,this.hplayer),this.hptransparency.isInvalid||(t.writeString(9,"$HPTRANSPARENCY"),t.writeTransparency(this.hptransparency)),t.writeString(9,"$TEXTSTYLE"),t.writeString(7,this.textstyle),t.writeString(9,"$ANGBASE"),t.writeAngle(50,this.angbase),t.writeString(9,"$ANGDIR"),t.writeInt16(70,this.angdir),t.writeString(9,"$AUNITS"),t.writeInt16(70,this.aunits),t.writeString(9,"$AUPREC"),t.writeInt16(70,this.auprec),t.writeString(9,"$EXTMIN"),t.writePoint3d(10,this.extmin),t.writeString(9,"$EXTMAX"),t.writePoint3d(10,this.extmax),t.writeString(9,"$PDMODE"),t.writeInt32(70,this.pdmode),t.writeString(9,"$PDSIZE"),t.writeDouble(40,this.pdsize),t.writeString(9,"$OSMODE"),t.writeInt32(70,this.osmode),t.writeString(9,"$ORTHOMODE"),t.writeInt16(70,this.orthomode),t.endSection()}writeDxfClassesSection(t){if(this._classes.length!==0){t.startSection("CLASSES");for(const e of this._classes)t.writeStart("CLASS"),t.writeString(1,e.name),t.writeString(2,e.cppClassName),t.writeString(3,e.appName),t.writeInt32(90,e.proxyFlag),t.writeInt32(91,e.instanceCount),t.writeInt8(280,e.wasProxy?1:0),t.writeInt8(281,e.isEntity?1:0);t.endSection()}}writeDxfTablesSection(t,e){t.startSection("TABLES"),this.writeDxfTable(t,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(t,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(t,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(t,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(t,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(!0),"STYLE"),this.writeDxfTable(t,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(t,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),e.value>=19&&this.writeDxfTable(t,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),t.endSection()}writeDxfBlocksSection(t){t.startSection("BLOCKS");for(const e of this.tables.blockTable.newIterator()){if(e.dxfOutBlockBegin(t),!e.isModelSapce&&!e.isPaperSapce)for(const n of e.newIterator())this.writeDxfEntity(t,n);e.dxfOutBlockEnd(t)}t.endSection()}writeDxfEntitiesSection(t){t.startSection("ENTITIES");for(const e of this.tables.blockTable.newIterator())if(!(!e.isModelSapce&&!e.isPaperSapce))for(const n of e.newIterator())this.writeDxfEntity(t,n);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const n=o=>{t.writeStart("DICTIONARY"),o.dxfOut(t)},r=(o,a)=>{e.getAt(o)!==a&&e.setAt(o,a)},s=o=>{e.getAt(o)&&e.remove(o)};r("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?r("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):s("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?r("ACAD_MLINESTYLE",this.objects.mlineStyle):s("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?r("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):s("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?r("MLIGHT_XRECORD",this.objects.xrecord):s("MLIGHT_XRECORD"),n(e),n(this.objects.layout),this.objects.mleaderStyle.numEntries>0&&n(this.objects.mleaderStyle),this.objects.mlineStyle.numEntries>0&&n(this.objects.mlineStyle),this.objects.imageDefinition.numEntries>0&&n(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&n(this.objects.xrecord);for(const[o,a]of this.objects.layout.entries())t.writeStart("LAYOUT"),a.dxfOut(t);for(const[o,a]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),a.dxfOut(t);for(const[o,a]of this.objects.layerFilter.entries())t.writeStart("LAYER_FILTER"),a.dxfOut(t);for(const[o,a]of this.objects.layerIndex.entries())t.writeStart("LAYER_INDEX"),a.dxfOut(t);for(const[o,a]of this.objects.mleaderStyle.entries())t.writeStart("MLEADERSTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.mlineStyle.entries())t.writeStart("MLINESTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.xrecord.entries())t.writeStart("XRECORD"),a.dxfOut(t);this.writeAcLyLayerFilterObjects(t),t.endSection()}writeAcLyLayerFilterObjects(t){const e=zl(this._layerFilters);if(e.nodes.length===0)return;const n=[],r=[],s=this.tables.layerTable,o=s.extensionDictionary??this.generateHandle();s.extensionDictionary=o;const a=this.generateHandle(),l=this.generateHandle(),h=[],c=[],u=(f,p,y)=>{const _=this.generateHandle();let x;if(f.children.length>0){const P=this.generateHandle(),A=this.generateHandle(),I=[];for(const E of f.children)I.push({name:E.key,id:u(E,A,!1)});n.push({handle:P,ownerId:_,entries:[{name:ze,id:A}]}),n.push({handle:A,ownerId:P,entries:I}),x=P}return r.push({handle:_,ownerId:p,extensionDictionaryId:x,data:f.data}),y&&c.push({name:f.key,id:_}),_};for(const f of e.nodes)h.push({name:f.key,id:u(f,a,!0)});const g=new Map,d=this.getObjectById(o);if(d instanceof Tt)for(const[f,p]of d.entries())g.set(f,p.objectId);g.set(ze,a),g.set(_i,l),n.unshift({handle:o,ownerId:s.objectId,entries:Array.from(g,([f,p])=>({name:f,id:p}))},{handle:a,ownerId:o,entries:h},{handle:l,ownerId:o,entries:c});for(const f of n){t.writeStart("DICTIONARY"),t.writeHandle(5,f.handle),t.writeObjectId(330,f.ownerId),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const p of f.entries)t.writeString(3,p.name),t.writeObjectId(350,p.id)}for(const f of r){const p=new Xl;p.objectId=f.handle,p.ownerId=f.ownerId,f.extensionDictionaryId&&(p.extensionDictionary=f.extensionDictionaryId),p.data=Vl(f.data),t.writeStart("XRECORD"),p.dxfOut(t)}}writeDxfTable(t,e,n,r,s){const o=[...r];t.startTable(e),n.dxfOut(t);for(const a of o){if(s==="BLOCK_RECORD"&&a instanceof tt){a.dxfOutBlockRecord(t);continue}t.writeStart(s),a.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){this.transactionManager.clearUndoStack(),this._classes=[],this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._objects.imageDefinition.removeAll(),this._objects.layerFilter.removeAll(),this._objects.layerIndex.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._layerFilters=new Gt,this._currentSpace=void 0,this._extents.makeEmpty(),this.registerBootstrapHandles()}updateSysVar(t,e,n,r){et.instance().applyVarMutation(t,e,n,this,()=>r(n))}normalizeLinetypeName(t){const e=t.trim();return e.toUpperCase()==="BYLAYER"?J:e.toUpperCase()==="BYBLOCK"?Xt:e}triggerSysVarChangedEvent(t,e,n){const r=et.instance(),s=t.toLowerCase();r.getDescriptor(s)!=null&&r.events.sysVarChanged.dispatch({database:this,name:s,oldVal:e,newVal:n})}getFileNameFromUri(t){try{const n=new URL(t).pathname.split("/");return n[n.length-1]||""}catch{return""}}};rn._unsavedDrawingSequence=0;let gr=rn;class dg{constructor(){this.transactionStack=[]}startTransaction(){const t=new ys;return this.transactionStack.push(t),t}currentTransaction(){return this.transactionStack[this.transactionStack.length-1]}commitTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to commit.");t.commit()}abortTransaction(){const t=this.transactionStack.pop();if(!t)throw new Error("No active transaction to abort.");t.abort()}hasTransaction(){return this.transactionStack.length>0}}class gg extends ps{constructor(t,e){t=t||{};const n=t.viewWidth!==void 0;It(t,{standardFlags:0,ucsAssociated:!1,cameraPlottable:!1,ucsElevation:0}),super(t,e),n||(this.viewWidth=this.viewHeight)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get viewWidth(){return this.getAttr("viewWidth")}set viewWidth(t){this.setAttr("viewWidth",t)}get ucsAssociated(){return this.getAttr("ucsAssociated")}set ucsAssociated(t){this.setAttr("ucsAssociated",t)}get cameraPlottable(){return this.getAttr("cameraPlottable")}set cameraPlottable(t){this.setAttr("cameraPlottable",t)}get ucsElevation(){return this.getAttr("ucsElevation")}set ucsElevation(t){this.setAttr("ucsElevation",t)}get ucsObjectId(){return this.getAttrWithoutException("ucsObjectId")}set ucsObjectId(t){this.setAttr("ucsObjectId",t)}get ucsBaseObjectId(){return this.getAttrWithoutException("ucsBaseObjectId")}set ucsBaseObjectId(t){this.setAttr("ucsBaseObjectId",t)}get backgroundObjectId(){return this.getAttrWithoutException("backgroundObjectId")}set backgroundObjectId(t){this.setAttr("backgroundObjectId",t)}get liveSectionObjectId(){return this.getAttrWithoutException("liveSectionObjectId")}set liveSectionObjectId(t){this.setAttr("liveSectionObjectId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeDouble(40,this.gsView.viewHeight),t.writePoint2d(10,this.centerPoint),t.writeDouble(41,this.viewWidth),t.writePoint3d(11,this.gsView.viewDirectionFromTarget),t.writePoint3d(12,this.gsView.viewTarget),t.writeDouble(42,this.gsView.lensLength),t.writeDouble(43,this.gsView.frontClippingPlane),t.writeDouble(44,this.gsView.backClippingPlane),t.writeAngle(50,this.gsView.viewTwistAngle),t.writeInt16(71,this.gsView.viewMode),t.writeInt16(281,this.gsView.renderMode),t.writeInt16(72,this.ucsAssociated?1:0),t.writeInt16(73,this.cameraPlottable?1:0),t.writeObjectId(332,this.backgroundObjectId),t.writeObjectId(334,this.liveSectionObjectId),t.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(t.writePoint3d(110,this.gsView.ucsOrigin),t.writePoint3d(111,this.gsView.ucsXAxis),t.writePoint3d(112,this.gsView.ucsYAxis),t.writeInt16(79,this.gsView.orthographicType),t.writeDouble(146,this.ucsElevation),t.writeObjectId(345,this.ucsObjectId),t.writeObjectId(346,this.ucsBaseObjectId)),this}}const As=class As extends V{getOffsetSideAtPoint(t){return 1}};As.typeName="Curve";let rt=As;const Me=class Me extends rt{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new j}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}addVertexAt(t,e,n=0,r=-1,s=-1){const o=r<0?void 0:r,a=s<0?void 0:s,l={x:e.x,y:e.y,bulge:n,startWidth:o,endWidth:a};this._geo.addVertexAt(t,l)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new m(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new k({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return this.shouldIncludeSegmentMidpointGrips()&&this.appendSegmentMidpointGrips(t),t}subMoveGripPointsAt(t,e){const n=this.numberOfVertices,r=this.shouldIncludeSegmentMidpointGrips(),s=r?this.getSegmentCount():0;return Z(t,o=>{if(o<n){tn(this._geo.vertices,o,e);return}if(!r||o>=n+s)return;const a=o-n;tn(this._geo.vertices,a,e),tn(this._geo.vertices,(a+1)%n,e)}),this}shouldIncludeSegmentMidpointGrips(){return this.getGripsMode()>=2}getGripsMode(){try{const t=et.instance().getVar(v.GRIPS,this.database);return typeof t=="number"?t:2}catch{return 2}}getSegmentCount(){const t=this.numberOfVertices;return t<2?0:this.closed?t:t-1}appendSegmentMidpointGrips(t){var o;const e=this._geo,n=this._elevation,r=this.getSegmentCount(),s=e.numberOfVertices;for(let a=0;a<r;a++){const l=[];cn(e.getPointAt(a),e.getPointAt((a+1)%s),(o=e.vertices[a])==null?void 0:o.bulge,n,w.MidPoint,{x:0,y:0,z:0},l),t.push(...l)}}subGetOsnapPoints(t,e,n,r){var l;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case w.EndPoint:for(let h=0;h<a;h++){const c=s.getPointAt(h);r.push(new m(c.x,c.y,o))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const h=this.closed?a:a-1,c=[];for(let u=0;u<h;u++){const g=[];cn(s.getPointAt(u),s.getPointAt((u+1)%a),(l=s.vertices[u])==null?void 0:l.bulge,o,t,e,g),c.push(...g)}if(t===w.MidPoint)r.push(...c);else{const u=Pt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let n=this._elevation;return this._geo.vertices.forEach(r=>{const s=new m(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,n=s.z,e&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._elevation=n,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.getPoints(100),n=this.createWidthProfile();if(n!=null){const s=pg(n,this.closed);if(s!=null){const o=t.subEntityTraits;return o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}}const r=[];return e.forEach(s=>r.push(new m().set(s.x,s.y,this.elevation))),t.lines(r)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0);const e=this.resolveConstantWidth();e!=null&&t.writeDouble(43,e),t.writeDouble(38,this.elevation);const n=this._geo.vertices;for(let r=0;r<n.length;++r){const s=n[r];t.writePoint2d(10,this.getPoint2dAt(r)),e==null&&(s.startWidth!=null&&t.writeDouble(40,s.startWidth),s.endWidth!=null&&t.writeDouble(41,s.endWidth));const o=s.bulge??0;o!==0&&t.writeDouble(42,o)}return this}resolveConstantWidth(){const t=this._geo.vertices;if(t.length===0)return;let e;for(const n of t){const r=n.startWidth,s=n.endWidth;if(r==null&&s==null){if(e!=null&&e!==0)return;e=e??0;continue}const o=r??0;if(o!==(s??0))return;if(e==null)e=o;else if(e!==o)return}return e!=null&&e!==0?e:void 0}createWidthProfile(){const t=this._geo.vertices,e=t.length;if(e<2)return null;const n=this.closed?e:e-1,r=[];let s=!1;for(let o=0;o<n;o++){const a=t[o],l=t[(o+1)%e],h=Math.max(0,a.startWidth??0),c=Math.max(0,a.endWidth??0);(h>nt||c>nt)&&(s=!0);const u=this.sampleSegment(a,l),g=u.length-1;for(let d=0;d<=g;d++){if(d===0&&r.length>0||this.closed&&o===n-1&&d===g)continue;const f=g>0?d/g:0;r.push({x:u[d].x,y:u[d].y,width:Ag(h,c,f)})}}return s&&r.length>=2?r:null}sampleSegment(t,e){if(t.bulge&&Math.abs(t.bulge)>nt){const r=new ut(t,e,t.bulge).getPoints(32);if(r.length>1)return r.map(s=>new S(s.x,s.y))}return[new S(t.x,t.y),new S(e.x,e.y)]}static from2dPoints(t,e){const n=new Me;return t.forEach((r,s)=>n.addVertexAt(s,r)),n.closed=e,n}static fromGePolyline(t){const e=new Me;return t.vertices.forEach((n,r)=>{e.addVertexAt(r,new S(n.x,n.y),n.bulge??0)}),e.closed=t.closed,e}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.numberOfVertices;let n=1/0,r=1;const s=this.closed?e:e-1;for(let o=0;o<s;o++){const a=this.getPoint2dAt(o),l=this.getPoint2dAt((o+1)%e),h=l.x-a.x,c=l.y-a.y,u=h*h+c*c;if(u===0)continue;const g=Math.max(0,Math.min(1,((t.x-a.x)*h+(t.y-a.y)*c)/u)),d=(t.x-a.x-g*h)**2+(t.y-a.y-g*c)**2;d<n&&(n=d,r=h*(t.y-a.y)-c*(t.x-a.x)>=0?1:-1)}return r}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:Me.fromGePolyline(e[0])}};Me.typeName="Polyline";let pt=Me;function bi(i,t,e){const n=vu(i,t,e);return n?pt.fromGePolyline(n):null}const nt=1e-6,Bo=4,fg=.75;function pg(i,t){if(i.length<2)return null;if(t)return Ni(i,!0);const e=yg(i);if(e.length===1)return Ni(e[0],!1);const n=new Et;let r=!1;for(const s of e){const o=Ni(s,!1);if(o!=null){for(const a of o.loops)n.add(a);r=!0}}return r?n:null}function Ni(i,t){const e=vg(i,t);if(e.length<2)return null;const{left:n,right:r}=sh(e,t);if(zo(n)<2||zo(r)<2)return null;const s=new Et;if(t){const o=Dn(n),a=Dn(r);if(!pn(o)||!pn(a))return null;const l=Math.abs(fn(o)),h=Math.abs(fn(a)),[c,u]=l>=h?[o,a]:[a,o];return s.add(new j(c,!0)),s.add(new j(u,!0)),s}return _g(e)&&bg(s,e)||xg(s,n,r)?s:null}function yg(i){if(i.length<2)return[i];const t=[];let e=0;const n=new Map;for(let s=0;s<i.length;s++){const o=Fo(i[s]),a=n.get(o);if(a!=null&&s-a>1){const l=i.slice(e,s+1);l.length>=2&&t.push(l),e=a,n.clear();for(let h=e;h<=s;h++)n.set(Fo(i[h]),h);continue}n.set(o,s)}const r=i.slice(e);return r.length>=2&&t.push(r),t.length>0?t:[i]}function Fo(i){return`${i.x.toFixed(4)}:${i.y.toFixed(4)}`}function mg(i,t){const e=Math.max(i,t),n=Math.min(i,t);return e<=nt||e-n<=nt?!1:n/e<=fg}function _g(i){const t=i[0],e=i[i.length-1],n=Math.hypot(e.x-t.x,e.y-t.y);if(n<=nt)return!0;const r=Math.max(...i.map(s=>s.width));return r<=nt?!1:n<=r*4}function bg(i,t){const{left:e,right:n}=sh(t,!0),r=Dn(e),s=Dn(n);if(!pn(r)||!pn(s))return!1;const o=Math.abs(fn(r)),a=Math.abs(fn(s));if(!mg(o,a))return!1;const[l,h]=o>=a?[r,s]:[s,r];return i.add(new j(l,!0)),i.add(new j(h,!0)),!0}function sh(i,t){const e=new Array(i.length),n=new Array(i.length);for(let r=0;r<i.length;r++){const s=i[r],o=Math.max(0,s.width)/2;if(o<=nt){e[r]=null,n[r]=null;continue}const a=Pg(i,r,t);if(a==null){e[r]=null,n[r]=null;continue}e[r]={x:s.x+a.x*o,y:s.y+a.y*o},n[r]={x:s.x-a.x*o,y:s.y-a.y*o}}return{left:e,right:n}}function wg(i,t,e,n,r){const s=[t,e,n,r];return pn(s)?(i.add(new j(s,!0)),!0):!1}function xg(i,t,e){let n=!1;for(let r=0;r<t.length-1;r++){const s=t[r],o=t[r+1],a=e[r],l=e[r+1];s==null||o==null||a==null||l==null||wg(i,s,o,l,a)&&(n=!0)}return n}function zo(i){return i.reduce((t,e)=>e==null?t:t+1,0)}function Dn(i){return i.filter(t=>t!=null)}function vg(i,t){const e=[];if(i.forEach(n=>{const r=e[e.length-1];(!r||Math.abs(r.x-n.x)>nt||Math.abs(r.y-n.y)>nt||Math.abs(r.width-n.width)>nt)&&e.push(n)}),t&&e.length>1){const n=e[0],r=e[e.length-1];Math.abs(n.x-r.x)<=nt&&Math.abs(n.y-r.y)<=nt&&e.pop()}return e}function Pg(i,t,e){const n=i.length,r=i[t],s=i[(t-1+n)%n],o=i[(t+1)%n];let a=Vo(r.x-s.x,r.y-s.y),l=Vo(o.x-r.x,o.y-r.y);if(e||(t===0&&(a=l),t===n-1&&(l=a)),a==null&&l==null)return null;if(a==null)return Cn(l);if(l==null)return Cn(a);const h=Cn(a),c=Cn(l),u=h.x+c.x,g=h.y+c.y,d=Math.hypot(u,g);if(d<=nt)return c;const f={x:u/d,y:g/d},p=Math.abs(f.x*c.x+f.y*c.y),y=p<=nt?Bo:Math.min(1/p,Bo);return{x:f.x*y,y:f.y*y}}function Vo(i,t){const e=Math.hypot(i,t);return e<=nt?null:{x:i/e,y:t/e}}function Cn(i){return{x:-i.y,y:i.x}}function fn(i){let t=0;const e=i.length;for(let n=0;n<e;n++){const r=i[n],s=i[(n+1)%e];t+=r.x*s.y-s.x*r.y}return t/2}function pn(i){return i.length>=3&&Math.abs(fn(i))>nt}function Ag(i,t,e){return i+(t-i)*e}var oh=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.FitCurvePoly=1]="FitCurvePoly",i[i.QuadSplinePoly=2]="QuadSplinePoly",i[i.CubicSplinePoly=3]="CubicSplinePoly",i))(oh||{});const Ss=class Ss extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,n=0,r=!1,s=0,o=0,a=null){super(),this._polyType=t,this._elevation=n;const l=a&&(a==null?void 0:a.length)===e.length,h=e.map((c,u)=>({x:c.x,y:c.y,bulge:l?a[u]:void 0}));this._geo=new j(h,r)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}getBulgeAt(t){const e=this._geo.vertices[t];return(e==null?void 0:e.bulge)||0}get geometricExtents(){const t=this._geo.box;return new k({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const n=this._geo.getPointAt(e);t.push(new m(n.x,n.y,this._elevation))}return t}subMoveGripPointsAt(t,e){return Z(t,n=>{tn(this._geo.vertices,n,e)}),this}subGetOsnapPoints(t,e,n,r){var l;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case w.EndPoint:for(let h=0;h<a;h++){const c=s.getPointAt(h);r.push(new m(c.x,c.y,o))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const h=this.closed?a:a-1,c=[];for(let u=0;u<h;u++){const g=[];cn(s.getPointAt(u),s.getPointAt((u+1)%a),(l=s.vertices[u])==null?void 0:l.bulge,o,t,e,g),c.push(...g)}if(t===w.MidPoint)r.push(...c);else{const u=Pt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let n=this._elevation;return this._geo.vertices.forEach(r=>{const s=new m(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,n=s.z,e&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._elevation=n,this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(r=>e.push(new m().set(r.x,r.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;++n)t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint3d(10,{x:this.getPointAt(n).x,y:this.getPointAt(n).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(n)),t.writeInt16(70,0);return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb2dPolyline");let e=this.closed?1:0;return this.polyType===1&&(e|=2),this.polyType===2&&(e|=4),this.polyType===3&&(e|=8),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),t.writeDouble(10,0),t.writeDouble(20,0),t.writeDouble(30,this.elevation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:pt.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:pt.fromGePolyline(e[0])}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}};Ss.typeName="2dPolyline";let fr=Ss;var ah=(i=>(i[i.Vertex=0]="Vertex",i[i.CurveFitVertex=1]="CurveFitVertex",i[i.SplineFitVertex=8]="SplineFitVertex",i[i.SplineCtlVertex=9]="SplineCtlVertex",i))(ah||{});const Ls=class Ls extends V{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new m,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new k().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return Yt(t,e,this._position),this}subGetOsnapPoints(t,e,n,r){(t===w.EndPoint||t===w.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint2d(10,this.position),t.writeDouble(40,this.startWidth),t.writeDouble(41,this.endWidth),t.writeDouble(42,this.bulge),t.writeInt16(70,this.vertexType),this}};Ls.typeName="2dVertex";let pr=Ls;var lh=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.QuadSplinePoly=1]="QuadSplinePoly",i[i.CubicSplinePoly=2]="CubicSplinePoly",i))(lh||{});const ei=class ei extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,n=!1){super(),this._polyType=t,this._geo=new j(e,n)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}get area(){return 0}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){const e=this._geo.vertices[t];return new m(e.x,e.y,e.z||0)}get geometricExtents(){const t=this._geo.vertices.map(e=>new m(e.x,e.y,e.z||0));return new k().setFromPoints(t)}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e)t.push(this.getPointAt(e));return t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveVertexAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){const s=Array.from({length:this._geo.numberOfVertices},(o,a)=>this.getPointAt(a));if(s.length!==0)switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];Ue(s[a],s[a+1],t,e,l),o.push(...l)}if(t===w.MidPoint)r.push(...o);else{const a=Pt(e,o);a&&r.push(a)}break}}}transformBy(t){return this._geo.vertices.forEach(e=>{const n=new m(e.x,e.y,e.z||0).applyMatrix4(t);e.x=n.x,e.y=n.y,e.z=n.z}),this._geo._boundingBoxNeedsUpdate=!0,this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.vertices.map(n=>new m(n.x,n.y,n.z||0));return t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;++n){const r=this.getPointAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,{x:r.x,y:r.y,z:r.z}),t.writeInt16(70,32)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dPolyline");let e=this.closed?1:0;return e|=8,this.polyType===1&&(e|=16),this.polyType===2&&(e|=32),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:pt.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);if(e.length===0)return null;const n=e[0],r=[];for(let s=0;s<n.numberOfVertices;s++){const o=n.getPointAt(s);r.push(new m(o.x,o.y,this.interpolateZ(o.x,o.y)))}return new ei(this.polyType,r,this.closed)}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}interpolateZ(t,e){const n=this.numberOfVertices;if(n<=0)return 0;let r=1/0,s=this.getPointAt(0).z;const o=this.closed?n:n-1;for(let a=0;a<o;a++){const l=this.getPointAt(a),h=this.getPointAt((a+1)%n),c=h.x-l.x,u=h.y-l.y,g=c*c+u*u;if(g===0)continue;const d=Math.max(0,Math.min(1,((t-l.x)*c+(e-l.y)*u)/g)),f=l.x+c*d,p=l.y+u*d,y=(t-f)**2+(e-p)**2;y<r&&(r=y,s=l.z+(h.z-l.z)*d)}return s}moveVertexAt(t,e){const n=this._geo.vertices[t];if(!n)return;n.x+=e.x,n.y+=e.y;const r=n;r.z=(r.z??0)+(e.z??0)}};ei.typeName="3dPolyline";let yr=ei;const Sg=["ACIS BinaryFile","ASM BinaryFile4"],hh=new Set(["End-of-ACIS-data","End-of-ASM-data","End-of-ACIS-History-data"]),z={Int:4,Double:6,Str:7,BoolTrue:10,BoolFalse:11,Pointer:12,EntityType:13,EntityTypeEx:14,SubtypeStart:15,SubtypeEnd:16,RecordEnd:17,LiteralStr:18,LocationVec:19,DirectionVec:20,Enum:21,Unknown0x17:23};class Lg{constructor(t){this.data=t,this.index=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}get hasData(){return this.index<this.data.length}require(t){if(this.index+t>this.data.length)throw new RangeError(`SAB: read past end of data (need ${String(t)} at ${String(this.index)})`)}readByte(){return this.require(1),this.data[this.index++]??0}readInt(){this.require(4);const t=this.view.getInt32(this.index,!0);return this.index+=4,t}readFloat(){this.require(8);const t=this.view.getFloat64(this.index,!0);return this.index+=8,t}readStr(t){this.require(t);const e=Eg.decode(this.data.subarray(this.index,this.index+t));return this.index+=t,e}}const Eg=new TextDecoder("latin1");function Ig(i,t){let e="";for(const d of Sg)if(Cg(t,d)){e=d,i.index=d.length;break}if(e==="")throw new RangeError("SAB: not a SAB stream (missing signature)");const n=i.readInt(),r=i.readInt(),s=i.readInt(),o=i.readInt(),a=Ri(i),l=Ri(i),h=Ri(i),c=Xi(i),u=Xi(i),g=Xi(i);return{signature:e,version:n,numRecords:r,numEntities:s,flags:o,productId:a,acisVersion:l,creationDate:h,unitsInMm:c,resTol:u,norTol:g}}function Ri(i){if(i.readByte()!==z.Str)throw new RangeError("SAB: expected string tag (0x07)");return i.readStr(i.readByte())}function Xi(i){if(i.readByte()!==z.Double)throw new RangeError("SAB: expected double tag (0x06)");return i.readFloat()}function Mg(i){const t=[],e=[];let n="",r=0;for(;;){if(!i.hasData){if(hh.has(n))return{type:n,tokens:t};throw new RangeError("SAB: premature end of data")}const s=i.readByte();switch(s){case z.Int:t.push({tag:s,value:i.readInt()});break;case z.Double:t.push({tag:s,value:i.readFloat()});break;case z.Str:t.push({tag:s,value:i.readStr(i.readByte())});break;case z.Pointer:t.push({tag:s,value:i.readInt()});break;case z.BoolTrue:t.push({tag:s,value:!0});break;case z.BoolFalse:t.push({tag:s,value:!1});break;case z.LiteralStr:t.push({tag:s,value:i.readStr(i.readInt())});break;case z.EntityTypeEx:e.push(i.readStr(i.readByte()));break;case z.EntityType:{e.push(i.readStr(i.readByte()));const o=e.join("-");e.length=0,n===""&&(n=o),t.push({tag:s,value:o});break}case z.LocationVec:t.push({tag:s,value:jo(i)});break;case z.DirectionVec:t.push({tag:s,value:jo(i)});break;case z.Enum:t.push({tag:s,value:i.readInt()});break;case z.Unknown0x17:t.push({tag:s,value:i.readFloat()});break;case z.SubtypeStart:r++,t.push({tag:s,value:r});break;case z.SubtypeEnd:t.push({tag:s,value:r}),r--;break;case z.RecordEnd:return{type:n,tokens:t};default:throw new RangeError(`SAB: unknown tag 0x${s.toString(16)} (${String(s)}) in record '${n}'`)}}}function jo(i){return[i.readFloat(),i.readFloat(),i.readFloat()]}function Tg(i){const t=new Lg(i),e=Ig(t,i),n=[];for(;t.hasData;){const r=Mg(t);if(n.push(r),hh.has(r.type))break}return{header:e,records:n}}function Cg(i,t){if(i.length<t.length)return!1;for(let e=0;e<t.length;e++)if(i[e]!==t.charCodeAt(e))return!1;return!0}const Og=new Set(["End-of-ACIS-data","End-of-ASM-data","End-of-ACIS-History-data"]);function kg(i){const e=i.records.map((o,a)=>({index:a,type:o.type,record:o,refs:[]}));for(const o of e)for(const a of o.record.tokens){if(a.tag!==z.Pointer)continue;const l=a.value;o.refs.push(l>=0&&l<e.length?e[l]:null)}const n=e,r=new Map,s=new Map;for(const o of n){if(Og.has(o.type))continue;let a=r.get(o.type);a===void 0&&(a=[],r.set(o.type,a)),a.push(o),s.set(o.type,(s.get(o.type)??0)+1)}return{header:i.header,nodes:n,bodies:r.get("body")??[],typeCounts:s,nodesOfType:o=>r.get(o)??[],pointLocations(){const o=[];for(const a of r.get("point")??[]){const l=a.record.tokens.find(h=>h.tag===z.LocationVec);l!==void 0&&o.push(l.value)}return o}}}const Ng=["ACIS BinaryFile","ASM BinaryFile","ASM BinaryFile4"];function Rg(i,t){if(t.length===0||i.length<t.length)return-1;const e=t.charCodeAt(0);for(let n=0;n<=i.length-t.length;n++){if(i[n]!==e)continue;let r=!0;for(let s=1;s<t.length;s++)if(i[n+s]!==t.charCodeAt(s)){r=!1;break}if(r)return n}return-1}function Xg(i){for(const t of Ng){const e=Rg(i,t);if(e>=0)return e}return-1}function Yg(i){if(i.length===0)return null;const t=Xg(i);if(t<0)return null;try{return kg(Tg(i.subarray(t)))}catch{return null}}class ch{constructor(t){this.tokens=t,this.i=0}next(...t){for(;this.i<this.tokens.length;){const e=this.tokens[this.i++];if(e!==void 0&&t.includes(e.tag))return e}}nextVec(){var t;return(t=this.next(z.LocationVec,z.DirectionVec))==null?void 0:t.value}nextDouble(){var t;return(t=this.next(z.Double))==null?void 0:t.value}}const Ee=(i,t)=>i.refs.find(e=>e!==null&&(e.type===t||e.type.endsWith(t)))??null,uh=(i,t)=>i.refs.filter(e=>e!==null&&e.type===t);function Yi(i){if(i===null)return null;const t=Ee(i,"point");if(t===null)return null;const e=t.record.tokens.find(n=>n.tag===z.LocationVec);return e?e.value:null}function Bg(i){const t=new ch(i.record.tokens);if(i.type==="straight-curve"){const e=t.nextVec(),n=t.nextVec();if(e&&n)return{kind:"straight",origin:e,direction:n}}else if(i.type==="ellipse-curve"){const e=t.nextVec(),n=t.nextVec(),r=t.nextVec(),s=t.nextDouble();if(e&&n&&r&&s!==void 0)return{kind:"ellipse",center:e,normal:n,majorAxis:r,ratio:s}}else if(i.type==="intcurve-curve")return{kind:"intcurve",controlPoints:Fg(i.record.tokens)};return{kind:"unknown"}}function Fg(i){var o,a,l;const t=i.findIndex(h=>h.tag===z.EntityType&&(h.value==="nubs"||h.value==="nurbs"));if(t<0)return[];let e=t+1,n=-1;for(;e<i.length;e++){const h=i[e];if(h===void 0||h.tag===z.Double)break;if(h.tag===z.Int&&(n=h.value),h.tag===z.EntityType||h.tag===z.SubtypeEnd)return[]}if(n<0)return[];for(let h=0;h<n;h++){if(((o=i[e])==null?void 0:o.tag)!==z.Double)return[];e+=1,((a=i[e])==null?void 0:a.tag)===z.Int&&(e+=1)}const r=[];for(;((l=i[e])==null?void 0:l.tag)===z.Double;){const h=i[e];if(h===void 0)break;r.push(h.value),e+=1}const s=[];for(let h=0;h+3<=r.length;h+=3){const c=r[h],u=r[h+1],g=r[h+2];if(c===void 0||u===void 0||g===void 0)break;s.push([c,u,g])}return s}function dh(i){const t=new ch(i.record.tokens);if(i.type==="plane-surface"){const e=t.nextVec(),n=t.nextVec(),r=t.nextVec();if(e&&n)return r?{kind:"plane",origin:e,normal:n,uDir:r}:{kind:"plane",origin:e,normal:n}}else if(i.type==="cone-surface"){const e=t.nextVec(),n=t.nextVec(),r=t.nextVec(),s=t.nextDouble(),o=t.nextDouble(),a=t.nextDouble();if(e&&n&&r&&s!==void 0&&o!==void 0&&a!==void 0)return{kind:"cone",origin:e,axis:n,majorAxis:r,ratio:s,sineAngle:o,cosineAngle:a}}else if(i.type==="torus-surface"){const e=t.nextVec(),n=t.nextVec(),r=t.nextDouble(),s=t.nextDouble();if(e&&n&&r!==void 0&&s!==void 0)return{kind:"torus",center:e,axis:n,majorRadius:r,minorRadius:s}}else if(i.type==="sphere-surface"){const e=t.nextVec(),n=t.nextDouble(),r=t.nextVec(),s=t.nextVec();if(e&&n!==void 0&&r&&s)return{kind:"sphere",center:e,radius:n,uDir:r,poleAxis:s}}return{kind:"unknown"}}function zg(i){return dh(i)}const Vg={"plane-surface":"plane","cone-surface":"cone","torus-surface":"torus","sphere-surface":"sphere","spline-surface":"spline"},jg={"straight-curve":"straight","ellipse-curve":"ellipse","intcurve-curve":"intcurve"};function Dg(i){const t=Ee(i,"coedge");if(t===null)return 0;const e=new Set;let n=t;for(;n!==null&&!e.has(n.index);)e.add(n.index),n=uh(n,"coedge")[0]??null;return e.size}function Gg(i){const t=[];let e=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,a=-1/0;const l=d=>{d[0]<e&&(e=d[0]),d[0]>s&&(s=d[0]),d[1]<n&&(n=d[1]),d[1]>o&&(o=d[1]),d[2]<r&&(r=d[2]),d[2]>a&&(a=d[2])},h=i.nodesOfType("vertex").map(d=>{const f=Yi(d);return f===null?t.push(`vertex#${String(d.index)}: no resolvable point`):l(f),{nodeIndex:d.index,point:f}}),c=i.nodesOfType("edge").map(d=>{const f=uh(d,"vertex"),p=Yi(f[0]??null),y=Yi(f[1]??null),_=Ee(d,"-curve"),x=_?jg[_.type]??"unknown":"unknown",P=_?Bg(_):void 0;return p!==null&&y!==null&&p[0]===y[0]&&p[1]===y[1]&&p[2]===y[2]&&t.push(`edge#${String(d.index)}: degenerate (coincident endpoints)`),P===void 0||P.kind==="unknown"?{nodeIndex:d.index,start:p,end:y,curveType:x}:{nodeIndex:d.index,start:p,end:y,curveType:x,curve:P}}),u=i.nodesOfType("face").map(d=>{const f=Ee(d,"-surface"),p=f?Vg[f.type]??"unknown":"unknown",y=f?dh(f):void 0,_=[],x=new Set;let P=Ee(d,"loop");for(;P!==null&&!x.has(P.index);)x.add(P.index),_.push({nodeIndex:P.index,coedgeCount:Dg(P)}),P=Ee(P,"loop");return f===null&&t.push(`face#${String(d.index)}: no surface`),y===void 0||y.kind==="unknown"?{nodeIndex:d.index,surfaceType:p,loops:_}:{nodeIndex:d.index,surfaceType:p,surface:y,loops:_}});return{vertices:h,edges:c,faces:u,bbox:e===1/0?null:{min:[e,n,r],max:[s,o,a]},diagnostics:t}}const ce=(i,t)=>[i[0]+t[0],i[1]+t[1],i[2]+t[2]],te=(i,t)=>[i[0]*t,i[1]*t,i[2]*t],Ug=i=>Math.hypot(i[0],i[1],i[2]),Yn=(i,t)=>[i[1]*t[2]-i[2]*t[1],i[2]*t[0]-i[0]*t[2],i[0]*t[1]-i[1]*t[0]],Pe=i=>{const t=Math.hypot(i[0],i[1],i[2]);return t>0?[i[0]/t,i[1]/t,i[2]/t]:[0,0,0]};function Hg(i){const t=[];for(const r of i.record.tokens)if(r.tag===z.Double&&(t.push(r.value),t.length===2))break;const e=t[0],n=t[1];return e===void 0||n===void 0?null:[e,n]}function gh(i,t,e,n){const r=te(Yn(Pe(i.normal),i.majorAxis),i.ratio),s=Math.max(1,n),o=[];for(let a=0;a<=s;a++){const l=t+(e-t)*a/s;o.push(ce(i.center,ce(te(i.majorAxis,Math.cos(l)),te(r,Math.sin(l)))))}return o}function Wg(i,t=16){const e=Pe(i.poleAxis);let n=Pe(i.uDir),r=Yn(e,n);Ug(r)<1e-9?(n=Math.abs(e[0])<.9?[1,0,0]:[0,1,0],r=Pe(Yn(e,n))):r=Pe(r),n=Pe(Yn(r,e));const s=[],o=(a,l)=>{const h=[],c=Math.max(8,t);for(let u=0;u<=c;u++){const g=Math.PI*2*u/c;h.push(ce(i.center,ce(te(a,i.radius*Math.cos(g)),te(l,i.radius*Math.sin(g)))))}s.push(h)};o(n,r),o(n,e),o(r,e);for(const a of[-.5,.5]){const l=te(e,i.radius*a),h=ce(i.center,l),c=i.radius*Math.sqrt(Math.max(0,1-a*a));if(c>1e-6){const u=[],g=Math.max(8,t);for(let d=0;d<=g;d++){const f=Math.PI*2*d/g;u.push(ce(h,ce(te(n,c*Math.cos(f)),te(r,c*Math.sin(f)))))}s.push(u)}}return s}const $g=16,qg=(i,t)=>i.refs.find(e=>e!==null&&(e.type===t||e.type.endsWith(t)))??null;function fh(i,t,e){i.push(t[0],t[1],t[2],e[0],e[1],e[2])}function mr(i,t){for(let e=0;e+1<t.length;e++){const n=t[e],r=t[e+1];n&&r&&fh(i,n,r)}}function Kg(i){const t=[];for(const e of i.nodesOfType("face")){const n=qg(e,"-surface");if((n==null?void 0:n.type)!=="sphere-surface")continue;const r=zg(n);if(r.kind==="sphere")for(const s of Wg(r))mr(t,s)}return new Float32Array(t)}function Zg(i,t){var n,r;const e=[];for(const s of i.edges){const o=t==null?void 0:t.nodes[s.nodeIndex];if(((n=s.curve)==null?void 0:n.kind)==="ellipse"){const a=o!==void 0?Hg(o):null,l=(a==null?void 0:a[0])??0,h=(a==null?void 0:a[1])??Math.PI*2;mr(e,gh(s.curve,l,h,$g));continue}if(((r=s.curve)==null?void 0:r.kind)==="intcurve"&&s.curve.controlPoints.length>0){mr(e,s.curve.controlPoints);continue}s.start&&s.end&&fh(e,s.start,s.end)}return new Float32Array(e)}function Qg(i){const t=Yg(i);if(t===null)return null;const e=Gg(t),n=Zg(e,t);if(n.length>0)return n;const r=Kg(t);return r.length>0?r:null}const Jg=16;function ph(i,t=!0){const e=i.split(/\s+/),n=[];let r=!t;for(const s of e){if(!r&&/^-?\d+$/.test(s)){r=!0;continue}if(s.startsWith("$")||s==="I"||s==="F"||s==="#")continue;const o=Number.parseFloat(s);Number.isFinite(o)&&n.push(o)}return n}function Do(i,t,e){i.push(t[0],t[1],t[2],e[0],e[1],e[2])}function tf(i){return i.split("#").map(t=>t.trim()).filter(t=>t.length>0)}function ef(i){if(!i.includes("straight-curve"))return null;const t=ph(i);if(t.length<6)return null;const e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5];return[[e,n,r],[e+s,n+o,r+a]]}function nf(i){if(!i.includes("ellipse-curve"))return null;const t=ph(i);return t.length<10?null:{kind:"ellipse",center:[t[0],t[1],t[2]],normal:[t[3],t[4],t[5]],majorAxis:[t[6],t[7],t[8]],ratio:t[9]}}function rf(i){const t=[];if(!i||i.trim().length===0)return new Float32Array(0);for(const e of tf(i)){const n=ef(e);if(n!==null){Do(t,n[0],n[1]);continue}const r=nf(e);if(r!==null){const s=gh(r,0,Math.PI*2,Jg);for(let o=1;o<s.length;o++)Do(t,s[o-1],s[o])}}return new Float32Array(t)}const sf=/\bpoint\s+(?:\$-?\d+\s+){1,4}([-\d.eE+]+)\s+([-\d.eE+]+)\s+([-\d.eE+]+)/g;function of(i){return i.split("#").map(t=>t.trim()).filter(t=>t.length>0)}function af(i,t=1){const e=i.split(/\s+/),n=[];for(let r=t;r<e.length;r++){const s=e[r];if(s.startsWith("$")||s==="I"||s==="F")continue;const o=Number.parseFloat(s);Number.isFinite(o)&&n.push(o)}return n}function lf(i){const t=[];for(const e of i.matchAll(sf)){const n=Number.parseFloat(e[1]),r=Number.parseFloat(e[2]),s=Number.parseFloat(e[3]);Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(s)&&t.push(new m(n,r,s))}if(t.length>0)return t;for(const e of of(i)){if(!e.startsWith("point "))continue;const n=af(e);if(n.length>=3){const r=n[n.length-3],s=n[n.length-2],o=n[n.length-1];t.push(new m(r,s,o))}}return t}function hf(i){const t=[];for(let e=0;e<i.length;e+=3){const n=i[e],r=i[e+1],s=i[e+2];t.push(new m(n,r,s))}return t}function cf(i,t){return typeof i=="string"?{satText:i,version:t}:{sabBytes:i.sabBytes,satText:i.satText??i.acisData??"",version:i.version??t}}const Es=class Es extends V{get dxfTypeName(){return"3DSOLID"}constructor(t,e){super();const n=cf(t,e);this._acisData=n.satText,this._version=n.version;let r=new Float32Array(0);n.sabBytes&&n.sabBytes.length>0&&(r=Qg(n.sabBytes)??new Float32Array(0)),r.length===0&&n.satText&&(r=rf(n.satText)),this._wireframe=r,r.length>0?this._points=hf(r):this._points=lf(n.satText)}get acisData(){return this._acisData}get version(){return this._version}get hasRenderableGeometry(){return this._wireframe.length>0||this._points.length>0}get geometricExtents(){return this._points.length===0?new k(new m(0,0,0),new m(0,0,0)):new k().setFromPoints(this._points)}transformBy(t){if(this._points.forEach(e=>e.applyMatrix4(t)),this._wireframe.length>0){const e=new Float32Array(this._wireframe.length);for(let n=0;n<this._wireframe.length;n+=3){const r=new m(this._wireframe[n],this._wireframe[n+1],this._wireframe[n+2]);r.applyMatrix4(t),e[n]=r.x,e[n+1]=r.y,e[n+2]=r.z}this._wireframe=e}return this}subWorldDraw(t){if(this._wireframe.length>=6){const l=this._wireframe.length/3,h=new Uint16Array(l);for(let c=0;c<l;c++)h[c]=c;return t.lineSegments(this._wireframe,3,h)}if(this._points.length===0)return;const e=this.geometricExtents,n=e.min,r=e.max,s=[new m(n.x,n.y,n.z),new m(r.x,n.y,n.z),new m(r.x,r.y,n.z),new m(n.x,r.y,n.z),new m(n.x,n.y,r.z),new m(r.x,n.y,r.z),new m(r.x,r.y,r.z),new m(n.x,r.y,r.z)],o=new Float32Array(s.length*3);s.forEach((l,h)=>{o[h*3]=l.x,o[h*3+1]=l.y,o[h*3+2]=l.z});const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]);return t.lineSegments(o,3,a)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dSolid"),this._version!=null&&t.writeInt16(70,this._version);const e=255,n=this._acisData.split(`
|
|
5
|
+
`);for(let r=0;r<n.length;r++){const s=r===n.length-1;let o=n[r];for(;o.length>e;)t.writeString(3,o.slice(0,e)),o=o.slice(e);t.writeString(s?1:3,o)}return this}};Es.typeName="3dSolid";let _r=Es;var yh=(i=>(i[i.SimpleVertex=0]="SimpleVertex",i[i.ControlVertex=1]="ControlVertex",i[i.FitVertex=2]="FitVertex",i))(yh||{});const Is=class Is extends V{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new m,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new k().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return Yt(t,e,this._position),this}subGetOsnapPoints(t,e,n,r){(t===w.EndPoint||t===w.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,this.position),t.writeInt16(70,this.vertexType|32),this}};Is.typeName="3dVertex";let br=Is;const ni=class ni extends rt{get dxfTypeName(){return"ARC"}constructor(t,e,n,r,s=b.Z_AXIS){super();const o=an(s);this._geo=new kt(t,e,n,r,s,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>T.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){const s=this.startPoint,o=this.endPoint;switch(t){case w.EndPoint:r.push(s),r.push(o);break;case w.MidPoint:r.push(this.midPoint);break;case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:{const a=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const l of a)T.isBetweenAngle(l,this.startAngle,this.endAngle)&&r.push(this._geo.getPointAtAngle(l));break}case w.Nearest:{const a=this._geo.nearestPoint(e);r.push(a)}break;case w.Perpendicular:{const a=this._geo.perpendicularPoints(e),l=Pt(e,a);l&&r.push(l);break}case w.Tangent:{const a=this._geo.tangentPoints(e);r.push(...a);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Xe(this.center,this.normal);return t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeAngle(50,Dt(this.center,this.startPoint,this.normal)),t.writeAngle(51,Dt(this.center,this.endPoint,this.normal)),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,n=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=n?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:{const n=this._geo.startPoint;this._geo.startAngle=Dt(this._geo.center,{x:n.x+e.x,y:n.y+e.y,z:(n.z??0)+(e.z??0)},this._geo.normal);break}case 2:{const n=this._geo.endPoint;this._geo.endAngle=Dt(this._geo.center,{x:n.x+e.x,y:n.y+e.y,z:(n.z??0)+(e.z??0)},this._geo.normal);break}}}createOffsetCurve(t){const e=this._geo.offset(t);return e?new ni(e.center,e.radius,e.startAngle,e.endAngle,e.normal):null}};ni.typeName="Arc";let wr=ni;const uf=1,df=/\\[fF][^\\|{}]*(?:\|[^;\\|{}]*)*;./i,gf=/\\[fF][^\\|{}]*(?:\|[^;\\|{}]*)*;./gi;function ms(i){return i.replace(/\\[PpNn]/g,`
|
|
6
|
+
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"")}function ff(i){return i.replace(/\\[PpNn]/g,`
|
|
7
|
+
`).replace(gf,"").replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"").trim()}function pf(i,t,e=1){const n=i.trim();if(!n||t<=0)return 0;const r=ff(n),s=df.test(n);return r?Math.max(t,wn(r,t,e)):s?t:0}function wn(i,t,e=1){if(!i||t<=0)return 0;const n=ms(i),r=Math.max(...n.split(/\r\n|\r|\n/g).map(s=>s.length),0);return r===0?0:Math.max(t,r*t*uf*e)}function mh(i){const t=ms(i);return Math.max(t.split(/\r\n|\r|\n/g).length,1)}function _h(i,t,e){if(t<=0||i<=0)return 0;if(i===1)return t;const n=Math.max(e,0);return t+(i-1)*t*n}function _s(i,t,e){switch(e){case exports.AcGiMTextAttachmentPoint.TopCenter:return{minX:-i/2,minY:-t,maxX:i/2,maxY:0};case exports.AcGiMTextAttachmentPoint.TopRight:return{minX:-i,minY:-t,maxX:0,maxY:0};case exports.AcGiMTextAttachmentPoint.MiddleLeft:return{minX:0,minY:-t/2,maxX:i,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleCenter:return{minX:-i/2,minY:-t/2,maxX:i/2,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleRight:return{minX:-i,minY:-t/2,maxX:0,maxY:t/2};case exports.AcGiMTextAttachmentPoint.BottomLeft:case exports.AcGiMTextAttachmentPoint.BaselineLeft:return{minX:0,minY:0,maxX:i,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomCenter:case exports.AcGiMTextAttachmentPoint.BaselineCenter:return{minX:-i/2,minY:0,maxX:i/2,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomRight:case exports.AcGiMTextAttachmentPoint.BaselineRight:return{minX:-i,minY:0,maxX:0,maxY:t};case exports.AcGiMTextAttachmentPoint.TopLeft:default:return{minX:0,minY:-t,maxX:i,maxY:0}}}function bs(i,t){let e;t&&t.lengthSq()>0?e=t.clone().normalize():e=new b(Math.cos(i),Math.sin(i),0);const n=new b(-e.y,e.x,e.z);return n.lengthSq()===0?n.set(0,1,0):n.normalize(),{xAxis:e,yAxis:n}}function bh(i,t,e,n,r,s=0,o){if(e<=0&&n<=0)return i.expandByPoint(t),i;const a=_s(e,n,r),{xAxis:l,yAxis:h}=bs(s,o?new b(o.x,o.y,o.z||0):void 0),c=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];for(const[u,g]of c)i.expandByPoint(new m(t.x+l.x*u+h.x*g,t.y+l.y*u+h.y*g,t.z+l.z*u+h.z*g));return i}function yf(i){const t=i.extentsWidth>0?i.extentsWidth:i.width>0?i.width:wn(i.contents,i.height),e=_h(mh(i.contents),i.height,i.lineSpacingFactor);return{width:t,height:e,attachment:i.attachmentPoint,rotation:i.rotation,direction:i.direction.lengthSq()>0?i.direction.clone():void 0,location:new m(i.location.x,i.location.y,i.location.z??0)}}function mf(i,t){const{xAxis:e,yAxis:n}=bs(t.rotation,t.direction),r=i.x-t.location.x,s=i.y-t.location.y,o=(i.z??0)-t.location.z;return{x:r*e.x+s*e.y+o*e.z,y:r*n.x+s*n.y+o*n.z}}function _f(i){const t=_s(i.width,i.height,i.attachment),{xAxis:e,yAxis:n}=bs(i.rotation,i.direction);return[[t.minX,t.minY],[t.maxX,t.minY],[t.maxX,t.maxY],[t.minX,t.maxY]].map(([s,o])=>new m(i.location.x+e.x*s+n.x*o,i.location.y+e.y*s+n.y*o,i.location.z+e.z*s+n.z*o))}function bf(i,t,e){const n=_s(t.width,t.height,t.attachment),{x:r,y:s}=mf(i,t),o=n.minX-e.padX,a=n.maxX+e.padX,l=n.minY-e.padYBelow,h=n.maxY+e.padYAbove;if(r<o||r>a||s<l||s>h)return null;const c=r<n.minX?n.minX-r:r>n.maxX?n.maxX-r:0,u=s<n.minY?n.minY-s:s>n.maxY?s-n.maxY:0;return c+u}var wh=(i=>(i[i.LEFT=0]="LEFT",i[i.CENTER=1]="CENTER",i[i.RIGHT=2]="RIGHT",i[i.ALIGNED=3]="ALIGNED",i[i.MIDDLE=4]="MIDDLE",i[i.FIT=5]="FIT",i))(wh||{}),xh=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(xh||{});const Ms=class Ms extends V{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new m,this._alignmentPoint=new m,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(t){this._alignmentPoint.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){const t=new k,{anchor:e,attachmentPoint:n}=this.resolveTextAnchor(),r=wn(this.textString,this.height,this.widthFactor);return bh(t,e,r,this.height,n,this.rotation)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return Yt(t,e,this._position),this._alignmentPoint.add(e),this}subGetOsnapPoints(t,e,n,r){w.Insertion===t&&r.push(this._position)}transformBy(t){const e=this._position.clone(),n=this._position.clone().add(new b(Math.cos(this._rotation),Math.sin(this._rotation),0)),r=this._position.clone().add(new b(-Math.sin(this._rotation),Math.cos(this._rotation),0)),s=this._position.clone().add(new b(0,0,1));e.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t),s.applyMatrix4(t);const o=new b(n).sub(e),a=new b(r).sub(e),l=new b(s).sub(e),h=a.length(),c=o.length(),u=l.length();this._position.copy(e),c>0&&(this._rotation=Math.atan2(o.y,o.x)),h>0&&(this._height*=h,c>0&&(this._widthFactor*=c/h)),u>0&&(this._thickness*=u);const g=this._alignmentPoint.clone();return g.applyMatrix4(t),this._alignmentPoint.copy(g),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const{anchor:n,attachmentPoint:r}=this.resolveTextAnchor(),s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:n,rotation:this.rotation,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:r};return t.mtext(s,this.getTextStyle(),e)}resolveTextAnchor(){const t=this.resolveAttachmentPoint();if(t===exports.AcGiMTextAttachmentPoint.BaselineLeft)return{anchor:this._position,attachmentPoint:t};const e=this._alignmentPoint;return e.x===0&&e.y===0&&e.z===0||e.x===this._position.x&&e.y===this._position.y&&e.z===this._position.z?{anchor:this._position,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft}:{anchor:e,attachmentPoint:t}}resolveAttachmentPoint(){const t=this._horizontalMode,e=this._verticalModel;if(t===4)return exports.AcGiMTextAttachmentPoint.MiddleCenter;if(t===3||t===5)return exports.AcGiMTextAttachmentPoint.BaselineLeft;switch(e){case 3:return t===1?exports.AcGiMTextAttachmentPoint.TopCenter:t===2?exports.AcGiMTextAttachmentPoint.TopRight:exports.AcGiMTextAttachmentPoint.TopLeft;case 2:return t===1?exports.AcGiMTextAttachmentPoint.MiddleCenter:t===2?exports.AcGiMTextAttachmentPoint.MiddleRight:exports.AcGiMTextAttachmentPoint.MiddleLeft;case 1:return t===1?exports.AcGiMTextAttachmentPoint.BottomCenter:t===2?exports.AcGiMTextAttachmentPoint.BottomRight:exports.AcGiMTextAttachmentPoint.BottomLeft;case 0:default:return t===1?exports.AcGiMTextAttachmentPoint.BaselineCenter:t===2?exports.AcGiMTextAttachmentPoint.BaselineRight:exports.AcGiMTextAttachmentPoint.BaselineLeft}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbText"),t.writePoint3d(10,this.position),t.writeDouble(39,this.thickness),t.writeDouble(40,this.height),t.writeString(1,this.textString),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeString(7,this.styleName),t.writeInt16(72,this.horizontalMode),t.writeInt16(73,this.verticalMode),t.writePoint3d(11,this.alignmentPoint),this}};Ms.typeName="Text";let yn=Ms;var ct=(i=>(i[i.Invisible=1]="Invisible",i[i.Const=2]="Const",i[i.Verifiable=4]="Verifiable",i[i.Preset=8]="Preset",i))(ct||{}),Qt=(i=>(i[i.MultiLine=2]="MultiLine",i[i.ConstMultiLine=4]="ConstMultiLine",i))(Qt||{});const Ts=class Ts extends yn{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttributeDefinition"),t.writeString(3,this.prompt),t.writeString(2,this.tag),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeInt16(74,this.isReallyLocked?1:0),this}};Ts.typeName="AttDef";let xr=Ts;function wf(i){return i!=null&&typeof i=="object"&&"blockTableRecord"in i}const Cs=class Cs extends yn{get dxfTypeName(){return"ATTRIB"}get resolvedColor(){var t;if(this.color.isByBlock){const e=(t=this.database)==null?void 0:t.tables.blockTable.getEntityById(this.ownerId);if(wf(e))return e.resolvedColor}return this.resolveStandardColor()}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&ct.Invisible)!==0}set isInvisible(t){t?this._flags|=ct.Invisible:this._flags&=~ct.Invisible}get isConst(){return(this._flags&ct.Const)!==0}set isConst(t){t?this._flags|=ct.Const:this._flags&=~ct.Const}get isVerifiable(){return(this._flags&ct.Verifiable)!==0}set isVerifiable(t){t?this._flags|=ct.Verifiable:this._flags&=~ct.Verifiable}get isPreset(){return(this._flags&ct.Preset)!==0}set isPreset(t){t?this._flags|=ct.Preset:this._flags&=~ct.Preset}get isMTextAttribute(){return(this._mtextFlag&Qt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=Qt.MultiLine:this._mtextFlag&=~Qt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&Qt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=Qt.ConstMultiLine:this._mtextFlag&=~Qt.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttribute"),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeString(2,this.tag),t.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&t.writeInt16(71,this.isMTextAttribute?1:0),this}};Cs.typeName="Attrib";let vr=Cs;const Te=class Te extends V{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new m,this._rotation=0,this._normal=new b(0,0,1),this._scaleFactors=new m(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId,this.syncAttributeDatabases()}syncAttributeDatabases(){try{const t=this.database,e=new Map;this._attribs.forEach(n=>{n.database=t,n.ownerId=this.objectId,t.commitObjectHandle(n),e.set(n.objectId,n)}),this._attribs=e}catch{}}attributeIterator(){return new Be(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??m.ORIGIN,n=new O().makeTranslation(-e.x,-e.y,-e.z),r=new O().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),s=new Re().setFromAxisAngle(b.Z_AXIS,this._rotation),o=new O().makeRotationFromQuaternion(s),a=new O().makeTranslation(this._position.x,this._position.y,this._position.z);return new O().multiplyMatrices(a,o).multiply(r).multiply(n)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return Yt(t,e,this._position),this}subGetOsnapPoints(t,e,n,r,s,o){const a=o??new O;w.Insertion===t?r.push(this.getInsertionPoint(a)):s?this.subEntityGetOsnapPoints(t,e,n,r,s,a):this.collectBlockOsnapPoints(t,e,n,r,a)}transformBy(t){const e=new O().setFromExtrusionDirection(this._normal),n=new O().makeRotationZ(this._rotation),r=new O().multiplyMatrices(e,n),s=this._position.clone(),o=new m(this._scaleFactors.x,0,0).applyMatrix4(r).add(s),a=new m(0,this._scaleFactors.y,0).applyMatrix4(r).add(s),l=new m(0,0,this._scaleFactors.z).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b(o).sub(s),c=new b(a).sub(s),u=new b(l).sub(s);let g=new b().crossVectors(h,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const f=new O().setFromExtrusionDirection(g).clone().invert(),p=h.clone().applyMatrix4(f);return this._position.copy(s),this._normal.copy(g),this._rotation=Math.atan2(p.y,p.x),this._scaleFactors.set(h.length(),c.length(),u.length()),this._attribs.forEach(y=>y.transformBy(t)),this}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(n=>{e.properties.push({name:n.tag,type:"string",editable:!n.isConst,skipTranslation:!0,accessor:{get:()=>n.textString,set:r=>{n.textString=r}}})})}return t}get geometricExtents(){const t=new k,e=this.blockTableRecord;if(e!=null){const r=e.newIterator();for(const s of r)t.union(s.geometricExtents)}const n=this.blockTransform;return t.applyMatrix4(n),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const n=this.blockTransform,r=[];return this._attribs.forEach(o=>{if(!o.isInvisible){const a=o.worldDraw(t);a&&r.push(a)}}),me.instance.draw(t,e,this.resolvedColor,r,!0,n,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let n=!1;for(const r of this.attributeIterator())n=!0,t.writeStart("ATTRIB"),r.dxfOut(t);return n&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}collectBlockOsnapPoints(t,e,n,r,s){const o=this.blockTableRecord;if(!o)return;const a=new O().multiplyMatrices(s,this.getFullInsertionTransform()),l=a.clone().invert(),h=new m(e).applyMatrix4(l),c=new m(n).applyMatrix4(l),u=[];for(const g of o.newIterator()){const d=[];if(g instanceof Te){g.subGetOsnapPoints(t,e,n,d,void 0,a),u.push(...d);continue}g.subGetOsnapPoints(t,h,c,d,void 0,a),d.forEach(f=>u.push(new m(f).applyMatrix4(a)))}if(u.length!==0)if(t===w.Nearest||t===w.Perpendicular||t===w.Tangent){const g=Pt(e,u);g&&r.push(g)}else r.push(...u)}subEntityGetOsnapPoints(t,e,n,r,s,o,a=new Set){if(s===this.objectId||a.has(this.objectId))return!1;a.add(this.objectId);try{const l=this.blockTableRecord;if(l==null)return!1;const h=new O().multiplyMatrices(o,this.getFullInsertionTransform());for(const c of l.newIterator()){if(c.objectId===s){const u=new m(e).applyMatrix4(h.clone().invert()),g=new m(n).applyMatrix4(h.clone().invert()),d=[];return c.subGetOsnapPoints(t,u,g,d,s,h),c instanceof Te?d.forEach(f=>{r.push(f.clone())}):d.forEach(f=>{r.push(new m(f).applyMatrix4(h))}),!0}if(c instanceof Te&&c.subEntityGetOsnapPoints(t,e,n,r,s,h,a))return!0}return!1}finally{a.delete(this.objectId)}}getInsertionPoint(t){var r;const e=((r=this.blockTableRecord)==null?void 0:r.origin)??m.ORIGIN,n=new O().multiplyMatrices(t,this.getFullInsertionTransform());return new m(e).applyMatrix4(n)}getFullInsertionTransform(){const t=new O().setFromExtrusionDirection(this._normal);return new O().multiplyMatrices(t,this.blockTransform)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockReference"),t.writePoint3d(10,this.position),t.writeString(2,this.blockName),t.writeDouble(41,this.scaleFactors.x),t.writeDouble(42,this.scaleFactors.y),t.writeDouble(43,this.scaleFactors.z),t.writeAngle(50,this.rotation),t.writeVector3d(210,this.normal),this}};Te.typeName="BlockReference";let Ve=Te;const Go=[0,Math.PI/2,Math.PI,Math.PI/2*3],ii=class ii extends rt{get dxfTypeName(){return"CIRCLE"}constructor(t,e,n=b.Z_AXIS){super();const r=an(n);this._geo=new kt(t,e,0,F,n,r)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}subGetOsnapPoints(t,e,n,r){switch(t){case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:r.push(this._geo.getPointAtAngle(0)),r.push(this._geo.getPointAtAngle(Math.PI/2)),r.push(this._geo.getPointAtAngle(Math.PI)),r.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case w.Nearest:{const s=this._geo.nearestPoint(e);r.push(s)}break;case w.Tangent:{const s=this._geo.tangentPoints(e);r.push(...s);break}case w.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=Pt(e,s);o&&r.push(o);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;t.push(this.center);for(const e of Go)t.push(this._geo.getPointAtAngle(e));return t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Xe(this.center,this.normal);return t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,n=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=n?1:-1}createOffsetCurve(t){const e=this._geo.offset(t);return e?new ii(e.center,e.radius,e.normal):null}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:case 2:case 3:case 4:{const n=Go[t-1],r=this._geo.getPointAtAngle(n),o=new m(r.x+e.x,r.y+e.y,(r.z??0)+(e.z??0)).distanceTo(this.center);o>0&&(this.radius=o);break}}}};ii.typeName="Circle";let Pr=ii;const $e=[0,Math.PI/2,Math.PI,Math.PI/2*3],ri=class ri extends rt{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,n,r,s,o,a){super(),this._geo=new hs(t,e,n,r,s,o,a)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxis(){return this._geo.majorAxis}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed||Math.abs(this._geo.deltaAngle-F)<1e-10}get area(){return this._geo.area}subGetGripPoints(){const t=new Array;if(t.push(this._geo.center),this.closed)for(const e of $e)t.push(this._geo.getPointAtAngle(e));else t.push(this._geo.startPoint),t.push(this._geo.endPoint);return t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){switch(t){case w.EndPoint:this.closed||(r.push(this._geo.startPoint),r.push(this._geo.endPoint));break;case w.MidPoint:this.closed||r.push(this._geo.midPoint);break;case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:if(this.closed)for(const s of $e)r.push(this._geo.getPointAtAngle(s));break;case w.Nearest:r.push(this._geo.nearestPoint(e));break;case w.Tangent:r.push(...this._geo.tangentPoints(e));break;case w.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=Pt(e,s);o&&r.push(o);break}}}transformBy(t){return this._geo.transform(t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbEllipse"),t.writePoint3d(10,this.center);const e=this._geo.majorAxis,n=this.majorAxisRadius;return t.writePoint3d(11,{x:e.x*n,y:e.y*n,z:e.z*n}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,n=t.x-e.x,r=t.y-e.y,s=this.majorAxis,o=Math.hypot(s.x,s.y)||1,a=this.minorAxisRadius/this.majorAxisRadius*o||1,l=s.x/o,h=s.y/o,c=-h,u=l,g=n*l+r*h,d=n*c+r*u;return(g/o)**2+(d/a)**2>=1?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:if(this.closed)this.moveQuadrantGripAt($e[0],e);else{const n=this._geo.startPoint;this._geo.startAngle=Dt(this._geo.center,{x:n.x+e.x,y:n.y+e.y,z:(n.z??0)+(e.z??0)},this._geo.normal)}break;case 2:if(this.closed)this.moveQuadrantGripAt($e[1],e);else{const n=this._geo.endPoint;this._geo.endAngle=Dt(this._geo.center,{x:n.x+e.x,y:n.y+e.y,z:(n.z??0)+(e.z??0)},this._geo.normal)}break;case 3:case 4:this.closed&&this.moveQuadrantGripAt($e[t-1],e);break}}moveQuadrantGripAt(t,e){const n=this._geo.getPointAtAngle(t),r=new m(n.x+e.x,n.y+e.y,(n.z??0)+(e.z??0)),s=this._geo.center,o=r.x-s.x,a=r.y-s.y,l=(r.z??0)-(s.z??0),h=t===0||t===Math.PI?this._geo.majorAxis:this._geo.minorAxis,c=o*h.x+a*h.y+l*h.z,u=Math.abs(c);u<=0||(t===0||t===Math.PI?this.majorAxisRadius=u:this.minorAxisRadius=u)}createOffsetCurve(t){const e=this._geo.offset(t);return e?new ri(e.center,e.normal,e.majorAxis,e.majorAxisRadius,e.minorAxisRadius,e.startAngle,e.endAngle):null}};ri.typeName="Ellipse";let Ar=ri;const Os=class Os extends V{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new m,new m,new m],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new m),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new k().setFromPoints(this._vertices)}get area(){const t=[this.getVertexAt(0),this.getVertexAt(1),this.getVertexAt(2)],e=this.getVertexAt(3);return(e.x!==t[2].x||e.y!==t[2].y||e.z!==t[2].z)&&t.push(e),Oa(t)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return Ge(t,e,this._vertices),this}subGetOsnapPoints(t,e,n,r){gi(this._vertices,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._vertices.length,n=new Float32Array(e*3),r=new Uint16Array(e*2);for(let s=0;s<e;s++)n[s*3]=this._vertices[s].x,n[s*3+1]=this._vertices[s].y,n[s*3+2]=this._vertices[s].z,this.isEdgeVisibleAt(s)&&(r[s*2]=s,r[s*2+1]=(s+1)%4);return t.lineSegments(n,3,r)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),n=this.getVertexAt(1),r=this.getVertexAt(2),s=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,n),t.writePoint3d(12,r),t.writePoint3d(13,s);let o=0;for(let a=0;a<4;++a)this.isEdgeVisibleAt(a)||(o|=1<<a);return t.writeInt16(70,o),this}};Os.typeName="Face";let Sr=Os;const Bi=6,ks=class ks extends V{get dxfTypeName(){return"TOLERANCE"}constructor(){super(),this._location=new m,this._text="",this._dimensionStyle="",this._normal=new b(0,0,1),this._direction=new b(1,0,0)}get location(){return this._location}set location(t){this._location.set(t.x,t.y,t.z??0)}get text(){return this._text}set text(t){this._text=t}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get normal(){return this._normal}set normal(t){this._normal.set(t.x,t.y,t.z??0),this._normal.lengthSq()>0&&this._normal.normalize()}get direction(){return this._direction}set direction(t){this._direction.set(t.x,t.y,t.z??0),this._direction.lengthSq()>0&&this._direction.normalize()}setOrientation(t,e){return this.normal=t,this.direction=e,this}getBoundingPoints(){return this.getBoundingPolyline().slice(0,4)}getBoundingPolyline(){const{width:t,rowHeight:e,rowCount:n}=this.resolveFrameLayout(),r=e/2,s=r-e*n;return[new m(0,r,0),new m(t,r,0),new m(t,s,0),new m(0,s,0),new m(0,r,0)].map(a=>this.toFrameWcs(a.x,a.y))}get geometricExtents(){const t=new k;for(const e of this.getBoundingPoints())t.expandByPoint(e);return t.isEmpty()&&t.expandByPoint(this._location),t}subGetGripPoints(){return[this._location]}subMoveGripPointsAt(t,e){return Yt(t,e,this._location),this}subGetOsnapPoints(t,e,n,r){t===w.Insertion&&r.push(this._location)}transformBy(t){const e=this.resolveLocalBasis(),n=this._location.clone(),r=n.clone().add(e.xAxis),s=n.clone().add(e.yAxis);n.applyMatrix4(t),r.applyMatrix4(t),s.applyMatrix4(t);const o=new b(r).sub(n),a=new b(s).sub(n);let l=new b().crossVectors(o,a);l.lengthSq()===0?l=this._normal.clone().transformDirection(t):l.normalize();let h=o.clone();return h.lengthSq()===0?h=this._direction.clone().transformDirection(t):h.normalize(),this._location.copy(n),this._normal.copy(l),this._direction.copy(h),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"tolerance",properties:[{name:"text",type:"string",editable:!0,accessor:{get:()=>this.text,set:t=>{this.text=t}}},{name:"dimensionStyle",type:"string",editable:!0,accessor:{get:()=>this.dimensionStyle,set:t=>{this.dimensionStyle=t}}},{name:"textHeight",type:"float",editable:!1,accessor:{get:()=>this.textHeight}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}subWorldDraw(t,e){const r=this.collectFrameLineSegments().map(([o,a])=>t.lines([o,a])),s=this.drawToleranceText(t,e);return r.length>0&&s?t.group([...r,s]):r.length===1?r[0]:r.length>1?t.group(r):s}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbFcf"),this._dimensionStyle&&t.writeString(3,this._dimensionStyle),t.writePoint3d(10,this._location),t.writeString(1,this._text),this._normal.equals(b.Z_AXIS)||t.writeVector3d(210,this._normal),this._direction.equals(b.X_AXIS)||t.writeVector3d(11,this._direction),this}get textHeight(){const t=this.resolveDimensionStyle(),e=(t==null?void 0:t.dimtxt)??vt.DEFAULT_DIM_VALUES.dimtxt,n=(t==null?void 0:t.dimscale)??vt.DEFAULT_DIM_VALUES.dimscale;return e*n}drawToleranceText(t,e){const n=this.parseToleranceFrame(this._text);if(n.length===0)return;const r=this.resolveFrameLayout(n),s=this.getTextStyle(),o=[];for(let a=0;a<n.length;a++){const l=n[a];let h=r.cellPadding;const c=-r.rowHeight*a;for(let u=0;u<l.cells.length;u++){const g=l.cells[u],d=r.columnWidths[u]??this.textHeight;if(g.trim()){const f=this.toFrameWcs(h+d/2,c),p={text:g,height:this.textHeight,width:1/0,position:f,directionVector:this._direction,attachmentPoint:exports.AcGiMTextAttachmentPoint.MiddleCenter,drawingDirection:exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT};o.push(t.mtext(p,s,e))}h+=d+r.columnGap}}if(o.length!==0)return o.length===1?o[0]:t.group(o)}collectFrameLineSegments(){const t=this.parseToleranceFrame(this._text),e=this.resolveFrameLayout(t),{width:n,rowHeight:r,rowCount:s,columnDivisions:o}=e;if(n<=0||r<=0||s<=0)return[];const a=r/2,l=a-r*s,h=[],c=(u,g)=>{h.push([u,g])};c(this.toFrameWcs(0,a),this.toFrameWcs(n,a)),c(this.toFrameWcs(n,a),this.toFrameWcs(n,l)),c(this.toFrameWcs(n,l),this.toFrameWcs(0,l)),c(this.toFrameWcs(0,l),this.toFrameWcs(0,a));for(const u of o)c(this.toFrameWcs(u,a),this.toFrameWcs(u,l));for(let u=1;u<t.length;u++){const g=a-r*u;c(this.toFrameWcs(0,g),this.toFrameWcs(n,g))}return h}toFrameWcs(t,e){const n=this.resolveLocalBasis();return this._location.clone().addScaledVector(n.xAxis,t).addScaledVector(n.yAxis,e)}resolveFrameLayout(t){const e=t??this.parseToleranceFrame(this._text),n=this.textHeight,r=n*2,s=n/2,o=n;if(n<=0||e.length===0)return{width:0,totalHeight:0,rowHeight:0,columnWidths:[],columnDivisions:[],rowCount:0,cellPadding:0,columnGap:0};const a=Math.max(...e.map(g=>g.cells.length),0),l=[];for(let g=0;g<a;g++){let d=n;for(const f of e){const p=f.cells[g]??"";if(!p.trim())continue;const y=pf(p,n);d=Math.max(d,y)}l.push(d)}const h=[0];let c=s;for(let g=0;g<l.length;g++)c+=l[g],c+=o,h.push(c-s);return{width:h[h.length-1]??0,totalHeight:r*e.length,rowHeight:r,columnWidths:l,columnDivisions:h,rowCount:e.length,cellPadding:s,columnGap:o}}parseToleranceFrame(t){if(!t)return[];const e=this.splitToleranceRows(t);if(e.length===0)return[];if(!t.includes("%%v"))return e.map(s=>({cells:this.parsePipeSeparatedCells(s)}));const n=e.map(s=>{const a=this.splitToleranceTokens(s,"%%v").slice(0,Bi);for(;a.length<Bi;)a.push("");return a}),r=[0,1];n.some(s=>{var o;return(o=s[2])==null?void 0:o.trim()})&&r.push(2);for(let s=3;s<Bi;s++)n.some(o=>{var a;return(a=o[s])==null?void 0:a.trim()})&&r.push(s);return n.map(s=>({cells:r.map(o=>s[o]??"")}))}splitToleranceRows(t){return t.replace(/\^J/g,`
|
|
8
|
+
`).split(/\r\n|\r|\n|\\P/i).map(n=>n.trim()).filter(n=>n.length>0)}splitToleranceTokens(t,e){if(!t)return[];const n=[];let r="",s=0;for(let o=0;o<t.length;){if(t.startsWith(e,o)&&s===0){n.push(r),r="",o+=e.length;continue}const a=t[o];a==="{"?s++:a==="}"&&(s=Math.max(0,s-1)),r+=a,o++}return n.push(r),n}parsePipeSeparatedCells(t){return t?this.splitToleranceTokens(t,"|").filter(n=>n.length>0):[]}resolveLocalBasis(){const t=this._normal.clone();t.lengthSq()===0?t.set(0,0,1):t.normalize();let e=this._direction.clone();e.lengthSq()===0?e.set(1,0,0):e.normalize();let n=new b().crossVectors(t,e);return n.lengthSq()===0&&(e=b.X_AXIS.clone(),n=new b().crossVectors(t,e)),n.normalize(),e=new b().crossVectors(n,t).normalize(),{xAxis:e,yAxis:n,zAxis:t}}resolveDimensionStyle(){const t=this._dimensionStyle.trim(),e=this.tryGetDatabase();if(!(!t||!e))return e.tables.dimStyleTable.getAt(t)}tryGetDatabase(){try{return this.database}catch{return}}getTextStyle(){const t=this.resolveDimensionStyle(),e=(t==null?void 0:t.dimtxsty)??vt.DEFAULT_DIM_VALUES.dimtxsty??"Standard",n=this.database.tables.textStyleTable.resolveAt(e);if(!n)throw new Error("No valid text style found in text style table.");return n.textStyle}};ks.typeName="Fcf";let Lr=ks;const Ns=class Ns extends V{get dxfTypeName(){return"MTEXT"}constructor(){super(),this._contents="",this._height=0,this._width=0,this._extentsWidth=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new m,this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._direction=new b(1,0,0),this._drawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get extentsWidth(){return this._extentsWidth}set extentsWidth(t){this._extentsWidth=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){const t=new k,e=this.extentsWidth>0?this.extentsWidth:this.width>0?this.width:wn(this.contents,this.height),n=mh(this.contents),r=_h(n,this.height,this.lineSpacingFactor);return bh(t,this._location,e,r,this.attachmentPoint,this.rotation,this.direction)}subGetGripPoints(){return[this._location]}subMoveGripPointsAt(t,e){return Yt(t,e,this._location),this}subGetOsnapPoints(t,e,n,r){w.Insertion===t&&r.push(this._location)}transformBy(t){const e=this._location.clone(),n=this._direction.lengthSq()>0?this._direction.clone().normalize():new b(Math.cos(this._rotation),Math.sin(this._rotation),0),r=new b(-n.y,n.x,n.z);r.lengthSq()===0&&r.set(0,1,0),r.normalize();const s=e.clone().add(n),o=e.clone().add(r);e.applyMatrix4(t),s.applyMatrix4(t),o.applyMatrix4(t);const a=new b(s).sub(e),l=new b(o).sub(e),h=a.length(),c=l.length();return this._location.copy(e),h>0&&(this._direction.copy(a).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=h,this._extentsWidth>0&&(this._extentsWidth*=h)),c>0&&(this._height*=c),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:exports.AcGiMTextAttachmentPoint[1],value:1},{label:exports.AcGiMTextAttachmentPoint[2],value:2},{label:exports.AcGiMTextAttachmentPoint[3],value:3},{label:exports.AcGiMTextAttachmentPoint[4],value:4},{label:exports.AcGiMTextAttachmentPoint[5],value:5},{label:exports.AcGiMTextAttachmentPoint[6],value:6},{label:exports.AcGiMTextAttachmentPoint[7],value:7},{label:exports.AcGiMTextAttachmentPoint[8],value:8},{label:exports.AcGiMTextAttachmentPoint[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:exports.AcGiMTextFlowDirection[1],value:1},{label:exports.AcGiMTextFlowDirection[2],value:2},{label:exports.AcGiMTextFlowDirection[3],value:3},{label:exports.AcGiMTextFlowDirection[4],value:4},{label:exports.AcGiMTextFlowDirection[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const n={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return t.mtext(n,this.getTextStyle(),e)}encodeMTextContentsForDxf(t){return(t??"").replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMText"),t.writePoint3d(10,this.location),t.writeDouble(40,this.height),t.writeDouble(41,this.width),this.extentsWidth>0&&t.writeDouble(42,this.extentsWidth),t.writeString(1,this.encodeMTextContentsForDxf(this.contents??"")),t.writeString(7,this.styleName),t.writeAngle(50,this.rotation),t.writeVector3d(11,this.direction),t.writeInt16(71,this.attachmentPoint),t.writeInt16(72,this.drawingDirection),t.writeInt16(73,this.lineSpacingStyle),t.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(t.writeInt16(90,1),t.writeInt32(63,this.backgroundFillColor),t.writeInt32(441,this.backgroundFillTransparency),t.writeDouble(45,this.backgroundScaleFactor)),this}};Ns.typeName="MText";let je=Ns;var vh=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(vh||{});const Rs=class Rs extends rt{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._isHookLineSameDirection=!1,this._annoType=3,this._textHeight=0,this._textWidth=0,this._associatedAnnotation="",this._normal=new b(0,0,1),this._horizontalDirection=new b(1,0,0)}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(t){this._isHookLineSameDirection=t}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(t=>t.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get byBlockColor(){return this._byBlockColor}set byBlockColor(t){this._byBlockColor=t}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(t){this._associatedAnnotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(t){this._horizontalDirection.copy(t)}get offsetFromBlock(){var t;return(t=this._offsetFromBlock)==null?void 0:t.clone()}set offsetFromBlock(t){this._offsetFromBlock=t?new b(t):void 0}get offsetFromAnnotation(){var t;return(t=this._offsetFromAnnotation)==null?void 0:t.clone()}set offsetFromAnnotation(t){this._offsetFromAnnotation=t?new b(t):void 0}appendVertex(t){this._vertices.push(new m().copy(t)),this._updated=!0}setVertexAt(t,e){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].copy(e),this._updated=!0,this}vertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].clone()}subGetGripPoints(){return this._vertices.map(t=>t.clone())}subMoveGripPointsAt(t,e){return Ge(t,e,this._vertices),this}subGetOsnapPoints(t,e,n,r){if(this.numVertices===0)return;if(this.isSplined&&this.splineGeo){switch(t){case w.EndPoint:r.push(this._vertices[0]),r.push(this._vertices[this.numVertices-1]);break;case w.Nearest:r.push(this.splineGeo.nearestPoint(e));break}return}const s=this._vertices;switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];Ue(s[a],s[a+1],t,e,l),o.push(...l)}if(t===w.MidPoint)r.push(...o);else{const a=Pt(e,o);a&&r.push(a)}break}}}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new k().setFromPoints(this.collectDrawPoints())}get closed(){return!1}set closed(t){}get area(){return 0}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this.transformVector(this._normal,t),this.transformVector(this._horizontalDirection,t),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,t),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,t),this._splineGeo?(this._splineGeo.transform(t),this._updated=!1):this._updated=!0,this}subWorldDraw(t){return t.lines(this.collectDrawPoints())}collectDrawPoints(){if(this.isSplined&&this.splineGeo)return this.splineGeo.getPoints(100);const t=this._vertices.map(e=>e.clone());if(t.length>0&&!this._isSplined){const e=t[t.length-1];if(this.shouldDrawHookLine(e)){const n=this.computeHookLineEndPoint(e);n&&t.push(n)}}return t}shouldDrawHookLine(t){if(this.resolveHookLineLength(t)<=0)return!1;if(this._hasHookLine)return!0;const e=this.resolveAssociatedMText();if(e&&this.resolveHookSpanFromMText(e,t)>0)return!0;if(this._annoType!==0)return!1;const n=this.resolveDimensionStyle();return((n==null?void 0:n.dimtad)??vt.DEFAULT_DIM_VALUES.dimtad)!==us.Center}computeHookLineEndPoint(t){const e=this.resolveHookLineLength(t);if(e<=0)return null;const n=this.resolveHookAxis();return t.clone().addScaledVector(n,e)}resolveHookLineLength(t){const e=this.resolveDimensionStyle(),n=((e==null?void 0:e.dimgap)??vt.DEFAULT_DIM_VALUES.dimgap)*((e==null?void 0:e.dimscale)??vt.DEFAULT_DIM_VALUES.dimscale);let r=this._textWidth+n;const s=this.resolveAssociatedMText();if(s){const o=this.resolveHookSpanFromMText(s,t);if(o>0)r=Math.max(r,o);else{const a=this.resolveAnnotationWidth(s);a>0&&(r=Math.max(r,a))}}return r}resolveHookAxis(){const t=this._horizontalDirection.clone();t.lengthSq()===0?t.set(1,0,0):t.normalize();const e=this._isHookLineSameDirection?1:-1;return t.multiplyScalar(e),t}resolveHookSpanFromMText(t,e){const n=this.resolveHookAxis(),r=this.resolveMTextLayoutMetrics(t);let s=0;for(const o of _f(r)){const a=(o.x-e.x)*n.x+(o.y-e.y)*n.y+(o.z-e.z)*n.z;a>s&&(s=a)}return s}resolveAnnotationWidth(t){if(t.extentsWidth>0)return t.extentsWidth;const e=ms(t.contents).split(`
|
|
9
|
+
`);return Math.max(...e.map(n=>wn(n.trim(),t.height)),0)}resolveMTextLayoutMetrics(t){return yf({contents:t.contents,height:t.height,width:t.width,extentsWidth:t.extentsWidth,lineSpacingFactor:t.lineSpacingFactor,attachmentPoint:t.attachmentPoint,rotation:t.rotation,direction:t.direction,location:t.location})}scoreMTextAssociation(t,e){const n=this.resolveMTextLayoutMetrics(t),r=Math.max(t.height*2,1),s=Math.max(t.height,1),o=Math.max(n.height,t.height*4,10);return bf(e,n,{padX:r,padYAbove:s,padYBelow:o})}resolveDimensionStyle(){var n;const t=(n=this._dimensionStyle)==null?void 0:n.trim(),e=this.tryGetDatabase();if(!(!t||!e))return e.tables.dimStyleTable.getAt(t)}resolveAssociatedMText(){const t=this.tryGetDatabase();if(!t)return;if(this._associatedAnnotation){const a=t.getObjectById(this._associatedAnnotation);if(a instanceof je)return a}if(this._vertices.length===0)return;const e=this.getAttrWithoutException("ownerId");if(!e)return;const n=t.getObjectById(e);if(!(n instanceof tt))return;const r=this._vertices[this._vertices.length-1];let s,o=Number.POSITIVE_INFINITY;for(const a of n.newIterator()){if(!(a instanceof je))continue;const l=this.scoreMTextAssociation(a,r);l==null||l>=o||(o=l,s=a)}return s}tryGetDatabase(){try{return this.database}catch{return}}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Rt(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLeader"),t.writeString(3,this.dimensionStyle),t.writeInt16(71,this.hasArrowHead?1:0),t.writeInt16(72,this.isSplined?1:0),t.writeInt16(73,this.annoType),t.writeInt16(74,this.isHookLineSameDirection?1:0),t.writeInt16(75,this.hasHookLine?1:0),t.writeInt16(76,this.numVertices),this.textHeight!==0&&t.writeDouble(40,this.textHeight),this.textWidth!==0&&t.writeDouble(41,this.textWidth),this.byBlockColor!=null&&t.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&t.writeHandle(340,this.associatedAnnotation);for(const e of this.vertices)t.writePoint3d(10,e);return t.writeVector3d(210,this.normal),t.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&t.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&t.writeVector3d(213,this._offsetFromAnnotation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:pt.from2dPoints(e,!1).getOffsetSideAtPoint(t)}createOffsetCurve(t){return bi(this.collectPath2d(),!1,t)}collectPath2d(){return this.isSplined&&this.splineGeo?this.splineGeo.getPoints(64).map(t=>new S(t.x,t.y)):this._vertices.map(t=>new S(t.x,t.y))}transformVector(t,e){const n=new m,r=new m(t.x,t.y,t.z);n.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-n.x,r.y-n.y,r.z-n.z)}};Rs.typeName="Leader";let Er=Rs;const si=class si extends rt{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new Ut(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get area(){return 0}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return Z(t,n=>{switch(n){case 0:this.transformBy(O.makeTranslation(e));break;case 1:this.startPoint.add(e);break;case 2:this.endPoint.add(e);break}}),this}subGetOsnapPoints(t,e,n,r){const s=this.startPoint,o=this.endPoint;switch(t){case w.EndPoint:r.push(s),r.push(o);break;case w.MidPoint:r.push(this.midPoint);break;case w.Nearest:{const a=this._geo.project(e);r.push(a)}break;case w.Perpendicular:{const a=this._geo.perpPoint(e);r.push(a)}break;case w.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,n=this.endPoint,r=[new m(e.x,e.y,0),new m(n.x,n.y,0)];return t.lines(r)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}getOffsetCurves(t){const e=this._geo.offset(t);return[new si(e.startPoint,e.endPoint)]}getOffsetSideAtPoint(t){const e=this.startPoint,n=this.endPoint;return(n.x-e.x)*(t.y-e.y)-(n.y-e.y)*(t.x-e.x)>=0?1:-1}};si.typeName="Line";let Gn=si;var Ph=(i=>(i[i.Top=0]="Top",i[i.Zero=1]="Zero",i[i.Bottom=2]="Bottom",i))(Ph||{}),Ah=(i=>(i[i.HasVertex=1]="HasVertex",i[i.Closed=2]="Closed",i[i.SuppressStartCaps=4]="SuppressStartCaps",i[i.SuppressEndCaps=8]="SuppressEndCaps",i))(Ah||{});const Xs=class Xs extends V{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new m,this._normal=new b(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(t){this._styleName=t}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(t){this._styleObjectHandle=t}get scale(){return this._scale}set scale(t){this._scale=t}get justification(){return this._justification}set justification(t){this._justification=t}get flags(){return this._flags}set flags(t){this._flags=t}get styleCount(){return this._styleCount}set styleCount(t){this._styleCount=Math.max(0,t)}get startPosition(){return this._startPosition}set startPosition(t){this._startPosition.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get segments(){return this._segments.map(t=>this.cloneSegment(t))}set segments(t){this._segments=t.map(e=>this.createSegment(e)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(t){this.setFlag(2,t)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(t){this.setFlag(4,t)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(t){this.setFlag(8,t)}appendSegment(t){this._segments.push(this.createSegment(t)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const t=this.collectGeometryPoints();return new k().setFromPoints(t)}transformBy(t){return this._startPosition.applyMatrix4(t),this._segments.forEach(e=>{e.position.applyMatrix4(t),this.transformVector(e.direction,t),this.transformVector(e.miterDirection,t)}),this.transformVector(this._normal,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:t=>{this.scale=t}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:t=>{this.justification=t}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this._startPosition.clone()),this._segments.forEach(e=>t.push(e.position.clone())),t}subMoveGripPointsAt(t,e){const n=[this._startPosition,...this._segments.map(r=>r.position)];return Ge(t,e,n),Z(t,r=>{this.updateReferencePathDirectionsAfterGripMove(r)}),this}subGetOsnapPoints(t,e,n,r){const s=[this._startPosition,...this._segments.map(o=>o.position)];if(s.length!==0)switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const l=[];Ue(s[a],s[a+1],t,e,l),o.push(...l)}if(t===w.MidPoint)r.push(...o);else{const a=Pt(e,o);a&&r.push(a)}break}}}subWorldDraw(t){if(this._segments.length===0)return;const e=[],n=this.getMLineStyle(),r=this.getRenderableElementCount(n),s=t.subEntityTraits,o=s.color,a=s.lineType,l=s.fillType,h=s.drawOrder,c=this.createFillArea(n,r);if(c&&(s.color=o,this.applyFillTraits(n,s),s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},s.drawOrder=-1,e.push(t.area(c)),s.fillType=l,s.drawOrder=h),r<=0){const u=this.getReferencePath();u.length>=2&&e.push(t.lines(u))}else{for(let u=0;u<r;u++){s.color=o,s.lineType=a,this.applyStyleElementTraits(n,u,s);const g=this.getElementPath(u,n);g.length>=2&&e.push(t.lines(g))}this.appendStyleDrivenJointAndCapEntities(t,e,n,r,o,a)}if(s.color=o,s.lineType=a,s.fillType=l,s.drawOrder=h,e.length!==0)return e.length===1?e[0]:t.group(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMline"),t.writeString(2,this.styleName),t.writeHandle(340,this._styleObjectHandle),t.writeDouble(40,this._scale),t.writeInt16(70,this._justification),t.writeInt16(71,this._flags),t.writeInt16(72,this.vertexCount),t.writeInt16(73,this._styleCount),t.writePoint3d(10,this._startPosition),t.writeVector3d(210,this._normal),this._segments.forEach(e=>{t.writePoint3d(11,e.position),t.writeVector3d(12,e.direction),t.writeVector3d(13,e.miterDirection),e.elements.forEach(n=>{t.writeInt16(74,n.parameterCount),n.parameters.forEach(r=>t.writeDouble(41,r)),t.writeInt16(75,n.fillCount),n.fillParameters.forEach(r=>t.writeDouble(42,r))})}),this}setFlag(t,e){e?this._flags|=t:this._flags&=~t}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}updateReferencePathDirectionsAfterGripMove(t){const e=r=>{const s=this._segments[r];if(!s)return;const o=r===0?this._startPosition:this._segments[r-1].position,a=new b().subVectors(s.position,o);a.lengthSq()>0&&s.direction.copy(a.normalize())};if(t===0){this._segments.length>0&&e(0);return}const n=t-1;n<0||n>=this._segments.length||(e(n),n+1<this._segments.length&&e(n+1))}createSegment(t){var e;return{position:new m().copy(t.position),direction:new b().copy(t.direction),miterDirection:new b().copy(t.miterDirection),elements:((e=t.elements)==null?void 0:e.map(n=>this.createElement(n)))??[]}}createElement(t){const e=t.parameters?[...t.parameters]:[],n=t.fillParameters?[...t.fillParameters]:[];return{parameterCount:t.parameterCount??e.length,parameters:e,fillCount:t.fillCount??n.length,fillParameters:n}}cloneSegment(t){return{position:t.position.clone(),direction:t.direction.clone(),miterDirection:t.miterDirection.clone(),elements:t.elements.map(e=>({parameterCount:e.parameterCount,parameters:[...e.parameters],fillCount:e.fillCount,fillParameters:[...e.fillParameters]}))}}collectGeometryPoints(){const t=[this._startPosition];if(this._segments.length===0)return t;const e=this.getMLineStyle(),n=this.getRenderableElementCount(e);if(n<=0)return this._segments.forEach(r=>t.push(r.position)),t;for(let r=0;r<n;r++)t.push(...this.getElementPath(r,e));return t}getRenderableElementCount(t){const e=(t==null?void 0:t.elementCount)??0;return Math.max(this._styleCount,e,...this._segments.map(n=>n.elements.length),0)}getReferencePath(){const t=[this._startPosition.clone(),...this._segments.map(e=>e.position.clone())];return this.closePathIfNeeded(t)}getElementPath(t,e){const n=[],r=this._segments[0];return n.push(this.getElementBoundaryPoint("start",r,t,e)),this._segments.forEach(s=>{n.push(this.offsetPoint(s.position,s.miterDirection,this.getElementMiterOffset(s,t,e)))}),n[n.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],t,e),this.closePathIfNeeded(n)}getElementMiterOffset(t,e,n){var s;const r=t.elements[e];return(s=r==null?void 0:r.parameters)!=null&&s.length?r.parameters[0]:this.getStyleElementOffset(e,n)}getElementBoundaryPoint(t,e,n,r){const s=this.getElementMiterOffset(e,n,r),o=t==="start"?this._startPosition:e.position,a=this.offsetPoint(o,e.miterDirection,s);if(!this.shouldApplyCapCutAtSide(t,r))return a;const l=t==="start"?r==null?void 0:r.startAngle:r==null?void 0:r.endAngle,h=this.computeCapCutDistance(s,l,t);if(h===0)return a;const c=t==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return c.lengthSq()===0?a:a.add(c.multiplyScalar(h))}shouldApplyCapCutAtSide(t,e){return!e||this.closed?!1:t==="start"?this.suppressStartCaps?!1:(e.flags&112)!==0:this.suppressEndCaps?!1:(e.flags&1792)!==0}computeCapCutDistance(t,e,n){const r=this.normalizeCapAngle(e),s=Math.tan(r);if(Math.abs(s)<1e-6)return 0;const o=t/s;return o}normalizeCapAngle(t){if(t==null||!Number.isFinite(t))return Math.PI/2;let e=t%180;return e<0&&(e+=180),(e<1||e>179)&&(e=90),e*Math.PI/180}getStartSegmentDirection(){const t=this._segments[0],e=new b;return t&&(e.subVectors(t.position,this._startPosition),e.lengthSq()===0&&e.copy(t.direction)),e.lengthSq()>0&&e.normalize(),e}getEndSegmentDirection(){const t=this._segments[this._segments.length-1];if(!t)return new b;const e=new b,n=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return e.subVectors(t.position,n),e.lengthSq()===0&&e.copy(t.direction),e.lengthSq()>0&&e.normalize(),e}createFillArea(t,e){if(!t||(t.flags&1)===0||e<2)return;const n=this.getFillBoundaryElementIndices(e,t);if(!n)return;const r=this.getElementPath(n.outerIndex,t),s=this.getElementPath(n.innerIndex,t),o=this.stripClosingPoint(r),a=this.stripClosingPoint(s);if(o.length<2||a.length<2)return;const l=new Et;if(this.closed){if(o.length<3||a.length<3)return;l.add(new j(o.map(h=>({x:h.x,y:h.y})),!0)),l.add(new j(a.map(h=>({x:h.x,y:h.y})),!0))}else{const h=[...o,...a.slice().reverse()].map(c=>({x:c.x,y:c.y}));if(h.length<3)return;l.add(new j(h,!0))}return l}getFillBoundaryElementIndices(t,e){let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=-1,o=-1;for(let a=0;a<t;a++){const l=this.getElementReferenceOffset(a,e);l<n&&(n=l,s=a),l>r&&(r=l,o=a)}if(!(s<0||o<0||s===o))return{outerIndex:o,innerIndex:s}}getElementReferenceOffset(t,e){var r;const n=this._segments[0];if(n){const s=n.elements[t];if((r=s==null?void 0:s.parameters)!=null&&r.length)return s.parameters[0]}return this.getStyleElementOffset(t,e)}getStyleElementOffset(t,e){const n=e==null?void 0:e.elements[t];if(!n)return 0;const r=this.getStyleJustificationShift(e);return(n.offset+r)*this._scale}getStyleJustificationShift(t){const e=(t==null?void 0:t.elements)??[];if(e.length<=0)return 0;let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const s of e){const o=s.offset;o<n&&(n=o),o>r&&(r=o)}return this._justification===0?-r:this._justification===2?-n:0}stripClosingPoint(t){if(t.length<2)return t;const e=t[0],n=t[t.length-1],r=1e-9;return Math.abs(e.x-n.x)<=r&&Math.abs(e.y-n.y)<=r&&Math.abs(e.z-n.z)<=r?t.slice(0,-1):t}offsetPoint(t,e,n){if(n===0||e.lengthSq()===0)return t.clone();const r=e.clone().normalize().multiplyScalar(n);return t.clone().add(r)}closePathIfNeeded(t){if(!this.closed||t.length<2)return t;const e=t[0],n=t[t.length-1],r=1e-9;return Math.abs(e.x-n.x)<=r&&Math.abs(e.y-n.y)<=r&&Math.abs(e.z-n.z)<=r||t.push(e.clone()),t}appendStyleDrivenJointAndCapEntities(t,e,n,r,s,o){!n||r<2||(e.push(...this.drawMiterJointEntities(t,n,r,s,o)),e.push(...this.drawCapEntities(t,n,r,s,o)))}drawMiterJointEntities(t,e,n,r,s){if(this.closed||this._segments.length<2||(e.flags&2)===0)return[];const o=[],a=t.subEntityTraits;for(let l=0;l<this._segments.length-1;l++){const h=this._segments[l],c=Array.from({length:n},(u,g)=>{const d=this.getElementMiterOffset(h,g,e);return{elementIndex:g,offset:d,point:this.offsetPoint(h.position,h.miterDirection,d)}}).sort((u,g)=>g.offset-u.offset);for(let u=0;u<c.length-1;u++)this.applyElementDrawTraits(a,r,s,e,c[u].elementIndex),o.push(t.lines([c[u].point,c[u+1].point]))}return o}drawCapEntities(t,e,n,r,s){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(t,"start",e,n,r,s)),o.push(...this.drawCapEntitiesForSide(t,"end",e,n,r,s)),o}drawCapEntitiesForSide(t,e,n,r,s,o){if(e==="start"&&this.suppressStartCaps)return[];if(e==="end"&&this.suppressEndCaps)return[];const a=n.flags,l=e==="start",h=l?(a&16)!==0:(a&256)!==0,c=l?(a&64)!==0:(a&1024)!==0,u=l?(a&32)!==0:(a&512)!==0;if(!h&&!c&&!u)return[];const g=this.getCapElementPoints(e,r,n);if(g.length<2)return[];const d=[],f=t.subEntityTraits;if(h)for(let y=0;y<g.length-1;y++)this.applyElementDrawTraits(f,s,o,n,g[y].elementIndex),d.push(t.lines([g[y].point,g[y+1].point]));const p=l?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(c){const y=this.drawCapArcBetweenElements(t,e,g[0],g[g.length-1],p,f,s,o,n);y&&d.push(y)}if(u)for(let y=1;y<Math.floor(g.length/2);y++){const _=g[y],x=g[g.length-1-y];if(!_||!x||_===x)continue;const P=this.drawCapArcBetweenElements(t,e,_,x,p,f,s,o,n);P&&d.push(P)}return d}getCapElementPoints(t,e,n){const r=t==="start"?this._segments[0]:this._segments[this._segments.length-1];return r?Array.from({length:e},(s,o)=>({elementIndex:o,offset:this.getElementMiterOffset(r,o,n),point:this.getElementBoundaryPoint(t,r,o,n)})).sort((s,o)=>o.offset-s.offset):[]}drawCapArcBetweenElements(t,e,n,r,s,o,a,l,h){const c=e==="end"?r.point:n.point,u=e==="end"?n.point:r.point,g=c.distanceTo(u);if(g<=1e-9||s.lengthSq()===0)return;const f=c.clone().add(new b().subVectors(u,c).multiplyScalar(.5)).add(s.clone().normalize().multiplyScalar(g/2)),p=kt.createByThreePoints(c,u,f);if(p)return this.applyElementDrawTraits(o,a,l,h,e==="end"?r.elementIndex:n.elementIndex),t.circularArc(p)}applyElementDrawTraits(t,e,n,r,s){t.color=e,t.lineType=n,this.applyStyleElementTraits(r,s,t)}transformVector(t,e){const n=new m,r=new m(t.x,t.y,t.z);n.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-n.x,r.y-n.y,r.z-n.z)}getMLineStyle(){var s;const t=this.database.objects.mlineStyle,e=this.styleObjectHandle?t.getIdAt(this.styleObjectHandle):void 0;if(e)return e;const n=this.styleName?t.getAt(this.styleName):void 0;if(n)return n;const r=(s=this.styleName)==null?void 0:s.toUpperCase();if(r)for(const[o,a]of t.entries()){const l=(a.styleName||o).toUpperCase();if(o.toUpperCase()===r||l===r)return a}}applyStyleElementTraits(t,e,n){const r=t==null?void 0:t.elements[e];if(!r)return;const s=this.resolveStyleElementLineType(r.lineType);s&&(n.lineType=s),!(r.color.isByBlock||r.color.isByLayer)&&(n.color=r.color.clone())}applyFillTraits(t,e){const n=t==null?void 0:t.fillColor;!n||n.isByBlock||n.isByLayer||(e.color=n.clone())}resolveStyleElementLineType(t){var h;const e=t==null?void 0:t.trim();if(!e)return;const n=e.toUpperCase(),r=J.toUpperCase(),s=Xt.toUpperCase();let o="UserSpecified",a=e;if(n===r){o="ByLayer";const c=(h=this.database.tables.layerTable.getAt(this.layer))==null?void 0:h.linetype;a=c&&c.toUpperCase()!==r&&c.toUpperCase()!==s?c:se}else n===s&&(o="ByBlock",a=se);const l=this.database.tables.linetypeTable.getAt(a);return l?{type:o,...l.linetype}:{type:o,name:a,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||ne}catch{return ne}}};Xs.typeName="MLine";let Ir=Xs;var nn=(i=>(i[i.InvisibleLeader=0]="InvisibleLeader",i[i.StraightLeader=1]="StraightLeader",i[i.SplineLeader=2]="SplineLeader",i))(nn||{}),Ie=(i=>(i[i.NoneContent=0]="NoneContent",i[i.BlockContent=1]="BlockContent",i[i.MTextContent=2]="MTextContent",i[i.ToleranceContent=3]="ToleranceContent",i))(Ie||{}),Sh=(i=>(i[i.Horizontal=0]="Horizontal",i[i.Vertical=1]="Vertical",i))(Sh||{}),Lh=(i=>(i[i.Unknown=0]="Unknown",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.Top=3]="Top",i[i.Bottom=4]="Bottom",i))(Lh||{});const xf=1,vf=2,Pf=4,Af=8,Sf=64,Lf=128,Ef=32768,Ys=class Ys extends V{get dxfTypeName(){return"MULTILEADER"}constructor(){super(),this._leaders=[],this._leaderLineType=1,this._contentType=0,this._doglegEnabled=!1,this._doglegLength=0,this._doglegVector=new b(1,0,0),this._normal=new b(0,0,1),this._mleaderStyleId="",this._textHeight=2.5,this._textWidth=0,this._textRotation=0,this._textDirection=new b(1,0,0),this._textStyleName="",this._textAttachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,this._textDrawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(t=>this.cloneLeader(t))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(t){this._doglegEnabled=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get doglegVector(){return this._doglegVector}set doglegVector(t){this._doglegVector.copy(t)}get landingPoint(){return this._landingPoint}set landingPoint(t){this._landingPoint=t?this.createPoint(t):void 0}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(t){this._mleaderStyleId=t}get version(){return this._version}set version(t){this._version=t}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(t){this._leaderStyleId=t}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(t){this._propertyOverrideFlag=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor=t==null?void 0:t.clone()}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get landingEnabled(){return this._landingEnabled}set landingEnabled(t){this._landingEnabled=t}get arrowheadId(){return this._arrowheadId}set arrowheadId(t){this._arrowheadId=t}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(t){this._arrowheadSize=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor=t==null?void 0:t.clone()}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(t){this._textFrameEnabled=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get textAttachment(){return this._textAttachment}set textAttachment(t){this._textAttachment=t}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(t){this._textFlowDirection=t}get blockContentId(){return this._blockContentId}set blockContentId(t){this._blockContentId=t}get blockContentColor(){return this._blockContentColor}set blockContentColor(t){this._blockContentColor=t==null?void 0:t.clone()}get blockContentScale(){return this._blockContentScale}set blockContentScale(t){this._blockContentScale=t}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(t){this._blockContentRotation=t}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(t){this._blockContentConnectionType=t}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(t){this._annotativeScaleEnabled=t}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(t){this._arrowheadOverrides=t}get blockAttributes(){return this._blockAttributes}set blockAttributes(t){this._blockAttributes=t}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(t){this._textDirectionNegative=t}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(t){this._textAlignInIPE=t}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(t){this._bottomTextAttachmentDirection=t}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(t){this._topTextAttachmentDirection=t}get contentScale(){return this._contentScale}set contentScale(t){this._contentScale=t}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(t){this._contentBasePosition=t}get textAnchor(){return this._textAnchor}set textAnchor(t){this._textAnchor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(t){this._textBackgroundColor=t==null?void 0:t.clone()}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(t){this._textBackgroundScaleFactor=t}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(t){this._textBackgroundTransparency=t}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(t){this._textBackgroundColorOn=t}get textFillOn(){return this._textFillOn}set textFillOn(t){this._textFillOn=t}get textColumnType(){return this._textColumnType}set textColumnType(t){this._textColumnType=t}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(t){this._textUseAutoHeight=t}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(t){this._textColumnWidth=t}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(t){this._textColumnGutterWidth=t}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(t){this._textColumnFlowReversed=t}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(t){this._textColumnHeight=t}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(t){this._textUseWordBreak=t}get hasMText(){return this._hasMText}set hasMText(t){this._hasMText=t}get hasBlock(){return this._hasBlock}set hasBlock(t){this._hasBlock=t}get planeOrigin(){return this._planeOrigin}set planeOrigin(t){this._planeOrigin=t}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(t){this._planeXAxisDirection=t}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(t){this._planeYAxisDirection=t}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(t){this._planeNormalReversed=t}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(t){if(!t){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:t.text,anchorPoint:this.createPoint(t.anchorPoint)},this._contentType=2}get contents(){var t;return((t=this._mtextContent)==null?void 0:t.text)??""}set contents(t){this._mtextContent?this._mtextContent.text=t:this._mtextContent={text:t,anchorPoint:new m},this._contentType=2}get textLocation(){var t;return(t=this._mtextContent)==null?void 0:t.anchorPoint}set textLocation(t){if(!t){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(t):this._mtextContent={text:"",anchorPoint:this.createPoint(t)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get textDirection(){return this._textDirection}set textDirection(t){this._textDirection.copy(t)}get textStyleName(){return this._textStyleName}set textStyleName(t){this._textStyleName=t}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(t){this._textAttachmentPoint=t}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(t){this._textDrawingDirection=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get blockContent(){var t,e,n;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(t=this._blockContent.normal)==null?void 0:t.clone(),position:(e=this._blockContent.position)==null?void 0:e.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:(n=this._blockContent.color)==null?void 0:n.clone(),transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(t){var e;if(!t){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:t.blockContentId??t.blockHandle,blockHandle:t.blockHandle,normal:t.normal?new b(t.normal):void 0,position:t.position?this.createPoint(t.position):void 0,scale:new b(t.scale??{x:1,y:1,z:1}),rotation:t.rotation??0,color:(e=t.color)==null?void 0:e.clone(),transformationMatrix:t.transformationMatrix?[...t.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(t={}){var n,r;const e={lastLeaderLinePoint:t.lastLeaderLinePoint?this.createPoint(t.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:t.landingPoint?this.createPoint(t.landingPoint):void 0,doglegVector:t.doglegVector?new b(t.doglegVector):void 0,doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:((n=t.breaks)==null?void 0:n.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[],leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:[]};return(r=t.leaderLines)==null||r.forEach(s=>{e.leaderLines.push(this.createLeaderLine(s))}),this._leaders.push(e),this._leaders.length-1}removeLeader(t){return this.checkLeaderIndex(t),this._leaders.splice(t,1),this}addLeaderLine(t,e=[]){return this.checkLeaderIndex(t),this._leaders[t].leaderLines.push(this.createLeaderLine({vertices:e})),this._leaders[t].leaderLines.length-1}appendVertex(t,e,n){return this.getMutableLeaderLine(t,e).vertices.push(this.createPoint(n)),this}setLeaderLineVertices(t,e,n){return this.getMutableLeaderLine(t,e).vertices=n.map(r=>this.createPoint(r)),this}getLeaderLineVertices(t,e){return this.getMutableLeaderLine(t,e).vertices.map(n=>n.clone())}addBreak(t,e,n,r){return this.getMutableLeaderLine(t,e).breaks.push({start:this.createPoint(n),end:this.createPoint(r)}),this}setLandingPoint(t,e){return this.checkLeaderIndex(t),this._leaders[t].landingPoint=e?this.createPoint(e):void 0,this}setDoglegDirection(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegVector=new b(e),this}setDoglegLength(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegLength=e,this}get geometricExtents(){const t=this.collectGeometryPoints();return t.length>0?new k().setFromPoints(t):new k}subGetGripPoints(){return this.collectGeometryPoints().map(t=>t.clone())}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGeometryGripPointAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){var s;if(t===w.Insertion){this.contentBasePosition?r.push(this.contentBasePosition):this._mtextContent?r.push(this._mtextContent.anchorPoint):(s=this._blockContent)!=null&&s.position&&r.push(this._blockContent.position);return}this._leaders.forEach(o=>{o.leaderLines.forEach(a=>{const l=this.getLeaderLineDrawPoints(o,a);if(l.length!==0)switch(t){case w.EndPoint:r.push(...l);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const h=[];for(let c=0;c<l.length-1;c++){const u=[];Ue(l[c],l[c+1],t,e,u),h.push(...u)}if(t===w.MidPoint)r.push(...h);else{const c=Pt(e,h);c&&r.push(c)}break}}})})}transformBy(t){var e,n,r,s,o,a,l,h;return this._leaders.forEach(c=>{var u,g;(u=c.lastLeaderLinePoint)==null||u.applyMatrix4(t),(g=c.landingPoint)==null||g.applyMatrix4(t),c.doglegVector&&this.transformVector(c.doglegVector,t),c.breaks.forEach(d=>{d.start.applyMatrix4(t),d.end.applyMatrix4(t)}),c.leaderLines.forEach(d=>{d.vertices.forEach(f=>f.applyMatrix4(t)),d.breaks.forEach(f=>{f.start.applyMatrix4(t),f.end.applyMatrix4(t)})})}),(e=this._landingPoint)==null||e.applyMatrix4(t),(n=this.contentBasePosition)==null||n.applyMatrix4(t),this.transformVector(this._doglegVector,t),this.transformVector(this._normal,t),(r=this.textAnchor)==null||r.applyMatrix4(t),(s=this._mtextContent)==null||s.anchorPoint.applyMatrix4(t),this.transformVector(this._textDirection,t),(a=(o=this._blockContent)==null?void 0:o.position)==null||a.applyMatrix4(t),(l=this._blockContent)!=null&&l.normal&&this.transformVector(this._blockContent.normal,t),this.blockContentScale&&this.transformVector(this.blockContentScale,t),(h=this.planeOrigin)==null||h.applyMatrix4(t),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,t),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:Ie[0],value:0},{label:Ie[1],value:1},{label:Ie[2],value:2},{label:Ie[3],value:3}],accessor:{get:()=>this.contentType,set:t=>{this.contentType=t}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:nn[0],value:0},{label:nn[1],value:1},{label:nn[2],value:2}],accessor:{get:()=>this.leaderLineType,set:t=>{this.leaderLineType=t}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:t=>{this.doglegEnabled=t}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:t=>{this.doglegLength=t}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:t=>{this.textHeight=t}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:t=>{this.textWidth=t}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:t=>{this.textStyleName=t}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const t=this.getDefaultMLeaderStyle();t&&(this._mleaderStyleId=t.objectId)}subWorldDraw(t,e){const n=[],r=t.subEntityTraits,s=r.color,o=r.lineType,a=r.lineWeight,l=this.getResolvedLeaderLineColor(),h=this.getResolvedLeaderLineStyle(),c=this.getResolvedLeaderLineWeight(),u=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(r,l,s),this.applyLineTraits(r,h,c),this._leaders.forEach(d=>{d.leaderLines.forEach(p=>{const y=this.getLeaderLineDrawPoints(d,p);if(y.length>0){const _=this.drawLeaderLine(t,y);_&&n.push(_)}});const f=this.getDoglegPoints(d);f&&n.push(t.lines(f))}));const g=this.getRenderableMTextContent();if(this.contentType===2&&g){this.applyColorTraits(r,u,s);const d=this.getResolvedTextHeight(),f={text:g.text,height:d,width:this.getMTextRenderWidth(g.text,d),position:g.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};n.push(t.mtext(f,this.getTextStyle(),e))}if(r.color=s,r.lineType=o,r.lineWeight=a,n.length!==0)return n.length===1?n[0]:t.group(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeader"),t.writeInt16(170,this.leaderLineType),t.writeBoolean(290,this.doglegEnabled),t.writeDouble(41,this.doglegLength),t.writeInt16(172,this.contentType),t.writeVector3d(210,this.normal),t.writeHandle(340,this.mleaderStyleId),this._landingPoint&&t.writePoint3d(10,this._landingPoint),t.writeVector3d(11,this.doglegVector),this._mtextContent&&(t.writeString(1,this._mtextContent.text),t.writePoint3d(12,this._mtextContent.anchorPoint),t.writeDouble(40,this.textHeight),t.writeDouble(42,this.textWidth),t.writeAngle(50,this.textRotation),t.writeString(7,this.textStyleName)),this._blockContent&&(t.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&t.writePoint3d(15,this._blockContent.position),t.writeVector3d(16,this._blockContent.scale),t.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(e=>{e.landingPoint&&t.writePoint3d(110,e.landingPoint),e.doglegVector&&t.writeVector3d(111,e.doglegVector),t.writeDouble(140,e.doglegLength),t.writeInt16(171,e.leaderLines.length),e.leaderLines.forEach(n=>{t.writeInt16(90,n.vertices.length),n.vertices.forEach(r=>t.writePoint3d(10,r))})}),this}createPoint(t){return new m().copy(t)}createLeaderLine(t){var e,n;return{vertices:((e=t.vertices)==null?void 0:e.map(r=>this.createPoint(r)))??[],breakPointIndexes:t.breakPointIndexes?[...t.breakPointIndexes]:[],leaderLineIndex:t.leaderLineIndex,breaks:((n=t.breaks)==null?void 0:n.map(r=>({index:r.index,start:this.createPoint(r.start),end:this.createPoint(r.end)})))??[]}}cloneLeader(t){var e,n,r;return{lastLeaderLinePoint:(e=t.lastLeaderLinePoint)==null?void 0:e.clone(),lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:(n=t.landingPoint)==null?void 0:n.clone(),doglegVector:(r=t.doglegVector)==null?void 0:r.clone(),doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:t.breaks.map(s=>({index:s.index,start:s.start.clone(),end:s.end.clone()})),leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:t.leaderLines.map(s=>({vertices:s.vertices.map(o=>o.clone()),breakPointIndexes:[...s.breakPointIndexes],leaderLineIndex:s.leaderLineIndex,breaks:s.breaks.map(o=>({index:o.index,start:o.start.clone(),end:o.end.clone()}))}))}}checkLeaderIndex(t){if(t<0||t>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(t,e){this.checkLeaderIndex(t);const n=this._leaders[t].leaderLines[e];if(!n)throw new Error("The leader line index is out of range!");return n}collectGeometryPoints(){var e;const t=[];return this._leaders.forEach(n=>{n.lastLeaderLinePoint&&t.push(n.lastLeaderLinePoint),n.landingPoint&&t.push(n.landingPoint),n.breaks.forEach(s=>t.push(s.start,s.end)),n.leaderLines.forEach(s=>{t.push(...s.vertices),s.breaks.forEach(o=>t.push(o.start,o.end))});const r=this.getDoglegPoints(n);r&&t.push(...r),n.leaderLines.forEach(s=>{const o=this.getArrowheadPoints(this.getLeaderLineDrawPoints(n,s));o&&t.push(...o)})}),this._landingPoint&&t.push(this._landingPoint),this.contentBasePosition&&t.push(this.contentBasePosition),this.textAnchor&&t.push(this.textAnchor),this._mtextContent&&t.push(this._mtextContent.anchorPoint),(e=this._blockContent)!=null&&e.position&&t.push(this._blockContent.position),this.planeOrigin&&t.push(this.planeOrigin),t}moveGeometryGripPointAt(t,e){var s;let n=0;const r=(o,a)=>{if(o){n===t&&o.add(e),n++;return}a&&(n===t&&a(),n++)};this._leaders.forEach(o=>{r(o.lastLeaderLinePoint),r(o.landingPoint),o.breaks.forEach(l=>{r(l.start),r(l.end)}),o.leaderLines.forEach(l=>{l.vertices.forEach(h=>r(h)),l.breaks.forEach(h=>{r(h.start),r(h.end)})});const a=this.getDoglegPoints(o);a&&(r(a[0]),r(void 0,()=>{const l=a[0],h=a[1];if(!l||!h)return;const c=l.distanceTo({x:h.x+e.x,y:h.y+e.y,z:(h.z??0)+(e.z??0)});o.doglegLength!=null||o.doglegVectorSet?o.doglegLength=c:this._doglegLength=c})),o.leaderLines.forEach(l=>{const h=this.getLeaderLineDrawPoints(o,l),c=this.getArrowheadPoints(h);c&&c.forEach((u,g)=>{g===0||g===c.length-1?r(h[0]):r(void 0)})})}),r(this._landingPoint),r(this.contentBasePosition),r(this.textAnchor),this._mtextContent&&r(this._mtextContent.anchorPoint),(s=this._blockContent)!=null&&s.position&&r(this._blockContent.position),r(this.planeOrigin)}getLeaderLineDrawPoints(t,e){if(e.vertices.length>=2)return e.vertices;if(e.vertices.length===0)return[];const n=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint??this.contentBasePosition;return!n||e.vertices[0].equals(n)?e.vertices:[e.vertices[0],n]}getDoglegPoints(t){if(!this.getResolvedDoglegEnabled())return;const e=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint,n=t.doglegVector??this._doglegVector,r=t.doglegLength??this.getResolvedDoglegLength();if(!e||r==null||r===0||n.lengthSq()===0)return;const s=e.clone().add(n.clone().normalize().multiplyScalar(r));return[e,s]}getArrowheadPoints(t){if(!this.isArrowheadVisible()||t.length<2)return;const e=this.getArrowheadFrame(t);if(!e)return;const n=this.getResolvedArrowheadSize(),{tip:r,unit:s}=e,o=r.clone().add(s.clone().multiplyScalar(n)),a=n/6,l=new b(-s.y,s.x,0),h=o.clone().add(l.clone().multiplyScalar(a)),c=o.clone().add(l.clone().multiplyScalar(-a));return[r,h,c,r]}isArrowheadVisible(){const t=this.getResolvedArrowheadId();return(t==null?void 0:t.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(t,e){const n=[],r=this.getLeaderLinePointsForDraw(e);r.length>=2&&n.push(t.lines(r));const s=this.drawArrowhead(t,e);if(s&&n.push(s),n.length!==0)return n.length===1?n[0]:t.group(n)}getLeaderLinePointsForDraw(t){const e=this.getArrowheadLeaderLineTrimDistance();return e<=0?t:this.trimPolylineStart(t,e)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const t=this.getResolvedArrowheadBlockTableRecord();if(!t)return 0;const e=this.getResolvedArrowheadSize();if(e<=0)return 0;const n=t.origin??m.ORIGIN;let r=n.x;for(const s of t.newIterator()){const o=s.geometricExtents;o.isEmpty()||o.max.x>r&&(r=o.max.x)}return Math.max(0,(r-n.x)*e)}trimPolylineStart(t,e){if(t.length<2||e<=0)return t;let n=e;for(let r=0;r<t.length-1;r++){const s=t[r],o=t[r+1],a=o.distanceTo(s);if(!(a<=0)){if(n<a){const l=new b().subVectors(o,s);return[s.clone().add(l.multiplyScalar(n/a)),...t.slice(r+1)]}n-=a}}return[t[t.length-1]]}drawArrowhead(t,e){if(!this.isArrowheadVisible())return;const n=this.drawArrowheadBlock(t,e);if(n)return n;const r=this.getArrowheadPoints(e);if(!r)return;const s=new Et;s.add(new j(r,!0));const o=t.subEntityTraits,a=o.fillType;o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const l=t.area(s);return o.fillType=a,l}drawArrowheadBlock(t,e){const n=this.getResolvedArrowheadBlockTableRecord();if(!n)return;const r=this.getArrowheadFrame(e);if(!r)return;const{tip:s,unit:o}=r,a=this.getResolvedArrowheadSize(),l=Math.atan2(o.y,o.x),h=n.origin??m.ORIGIN,c=new O().makeTranslation(-h.x,-h.y,-h.z),u=new O().makeScale(a,a,a),g=new O().makeRotationZ(l),d=new O().makeTranslation(s.x,s.y,s.z),f=new O().multiplyMatrices(d,g).multiply(u).multiply(c);return me.instance.draw(t,n,this.resolvedColor,[],!0,f,new b(this.normal))}getArrowheadFrame(t){if(t.length<2)return;const e=t[0],n=t.find(s=>!s.equals(e));if(!n)return;const r=new b().subVectors(n,e);if(r.lengthSq()!==0)return{tip:e,unit:r.normalize()}}getResolvedArrowheadId(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.arrowSymbolId;return this.arrowheadId??t}getResolvedArrowheadBlockTableRecord(){const t=this.getResolvedArrowheadId();if(t)return this.database.tables.blockTable.getIdAt(t)}getResolvedArrowheadSize(){const t=this.getMLeaderStyle(),e=(t==null?void 0:t.arrowSize)??(t==null?void 0:t.scale);return this.arrowheadSize??this.contentScale??e??this.getResolvedTextHeight()}getResolvedTextHeight(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.textHeight;return this.textHeight>0?this.textHeight:t!=null&&t>0?t:2.5}getRenderableMTextContent(){var n;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const t=(n=this.getMLeaderStyle())==null?void 0:n.defaultMTextContents,e=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!t||!e))return{text:t,anchorPoint:e}}getMTextRenderWidth(t,e){if(this._textWidth>0)return this._textWidth;if(!t)return this._textWidth;const n=t.replace(/\\[PpNn]/g,`
|
|
10
|
+
`).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),r=Math.max(...n.split(/\r\n|\r|\n/g).map(s=>s.length),1);return Math.max(e,r*e)}transformVector(t,e){const n=new m,r=new m(t.x,t.y,t.z);n.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-n.x,r.y-n.y,r.z-n.z)}getMLeaderStyle(){const t=this.database.objects.mleaderStyle,e=this.mleaderStyleId||this.leaderStyleId;if(e){const n=t.getIdAt(e);if(n)return n}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const t=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return t||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(t){const e=t==null?void 0:t.trim();if(!e)return;const n=this.database.objects.mleaderStyle,r=n.getAt(e);if(r)return r;const s=n.getIdAt(e);if(s)return s;const o=e.toUpperCase();for(const[a,l]of n.entries())if(a.toUpperCase()===o)return l}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||ie}catch{return ie}}getResolvedTextStyleName(){var s,o,a;const t=this.database.tables.textStyleTable,e=(s=this.getMLeaderStyle())==null?void 0:s.textStyleId,n=e?(o=t.getIdAt(e))==null?void 0:o.name:void 0,r=this.textStyleId?(a=t.getIdAt(this.textStyleId))==null?void 0:a.name:void 0;if(this.textStyleName){const l=t.getAt(this.textStyleName);if(l!=null&&l.name)return l.name;const h=t.getIdAt(this.textStyleName);if(h!=null&&h.name)return h.name}return r||n}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.getResolvedTextStyleName());if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}getResolvedLeaderLineColor(){var t;return this.getResolvedComponentColor(this.leaderLineColor,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineColor,vf)}getResolvedLeaderLineType(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,t,xf)}getResolvedLeaderLineTypeId(){var t;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineTypeId,Pf)}getResolvedLeaderLineStyle(){const t=this.getResolvedLeaderLineTypeId();if(!t)return;const e=this.database.tables.linetypeTable.getIdAt(t);if(e)return{type:"UserSpecified",...e.linetype}}getResolvedLeaderLineWeight(){var n;const t=(n=this.getMLeaderStyle())==null?void 0:n.leaderLineWeight,e=this.getResolvedStyleDrivenValue(this.leaderLineWeight,t,Af);if(e!=null)return e}getResolvedDoglegEnabled(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,t,Sf)}getResolvedDoglegLength(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,t,Lf)}getResolvedTextColor(){var t;return this.getResolvedComponentColor(this.textColor,(t=this.getMLeaderStyle())==null?void 0:t.textColor,Ef)}getResolvedComponentColor(t,e,n){if(!t)return e;const r=this.isPropertyOverrideEnabled(n);return r===!0?t:r===!1?e??t:!t.isByBlock&&!t.isByLayer?t:e??t}getResolvedStyleDrivenValue(t,e,n){const r=this.isPropertyOverrideEnabled(n);return r===!0?t??e:e??t}isPropertyOverrideEnabled(t){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&t)!==0}applyColorTraits(t,e,n){t.color=n,e&&(t.color=e)}applyLineTraits(t,e,n){e&&(t.lineType=e),n!=null&&(t.lineWeight=n)}};Ys.typeName="MLeader";let Mr=Ys;const Bs=class Bs extends V{};Bs.typeName="Frame";let Un=Bs;class re extends Error{constructor(t="Unexpected end of buffer."){super(t),this.name="AcDbProxyGraphicEndOfBufferError"}}function Eh(i){return i instanceof ArrayBuffer?new Uint8Array(i):i}class _t{constructor(t,e=4){this._index=0,this._buffer=Eh(t),this._align=e}get index(){return this._index}get hasData(){return this._index<this._buffer.length}alignIndex(t){const e=t%this._align;return e?t+this._align-e:t}readStruct(t){if(!this.hasData)throw new re;const e=[];let n=0;for(const r of t){const s=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index+n,r);if(r===8)e.push(s.getFloat64(0,!0));else if(r===4)e.push(s.getUint32(0,!0));else throw new Error(`Unsupported struct size: ${r}`);n+=r}return this._index=this.alignIndex(this._index+n),e}readFloat(){return this.readStruct([8])[0]}readLong(){return this.readStruct([4])[0]}readSignedLong(){if(!this.hasData)throw new re;const e=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index,4).getInt32(0,!0);return this._index=this.alignIndex(this._index+4),e}readVertex(){return this.readStruct([8,8,8])}readPaddedString(t="utf-8"){const e=this._buffer;for(let n=this._index;n<e.length;n++)if(e[n]===0){const r=this._index;this._index=this.alignIndex(n+1);const s=e.subarray(r,n);return new TextDecoder(t).decode(s)}throw new re("Did not detect terminating zero byte.")}readPaddedUnicodeString(){const t=this._buffer;for(let e=this._index;e<t.length;e+=2)if(e+1<t.length&&t[e]===0&&t[e+1]===0){const n=this._index;this._index=this.alignIndex(e+2);const r=t.subarray(n,e);return new TextDecoder("utf-16le").decode(r)}throw new re("Did not detect terminating zero bytes.")}}class Ih{constructor(t,e="AC1015",n="cp1252"){this._bitIndex=0,this._buffer=Eh(t),this.dxfversion=e,this.encoding=n}get hasData(){return this._bitIndex>>3<this._buffer.length}readBit(){const t=this._bitIndex;this._bitIndex+=1;const e=t>>3;if(e>=this._buffer.length)throw new re;return this._buffer[e]&128>>(t&7)?1:0}readBits(t){const e=this._bitIndex,n=e+t;if(n-1>>3>=this._buffer.length)throw new re;this._bitIndex=n;let r=128>>(e&7),s=e>>3,o=0,a=this._buffer[s];for(;t>0;)o<<=1,a&r&&(o|=1),t-=1,r>>=1,!r&&t&&(r=128,s+=1,a=this._buffer[s]);return o}readUnsignedByte(){return this.readBits(8)}readSignedByte(){const t=this.readBits(8);return t&128?-((~t&255)+1):t}readAlignedBytes(t){const e=this._bitIndex>>3,n=e+t;if(n>this._buffer.length)throw new re;return this._bitIndex+=t<<3,this._buffer.subarray(e,n)}readUnsignedShort(){if(this._bitIndex&7){const e=this.readBits(8);return(this.readBits(8)<<8)+e}const t=this.readAlignedBytes(2);return t[1]<<8|t[0]}readSignedShort(){const t=this.readUnsignedShort();return t&32768?-((~t&65535)+1):t}readUnsignedLong(){if(this._bitIndex&7){const e=this.readBits(8),n=this.readBits(8),r=this.readBits(8);return(this.readBits(8)<<24)+(r<<16)+(n<<8)+e}const t=this.readAlignedBytes(4);return(t[3]<<24)+(t[2]<<16)+(t[1]<<8)+t[0]}readSignedLong(){const t=this.readUnsignedLong();return t&2147483648?-((~t&4294967295)+1):t}readFloat(){if(this._bitIndex&7){const n=new Uint8Array(8);for(let r=0;r<8;r++)n[r]=this.readBits(8);return new DataView(n.buffer).getFloat64(0,!0)}const t=this.readAlignedBytes(8),e=new Uint8Array(t);return new DataView(e.buffer).getFloat64(0,!0)}readRawDouble(t=1){return t===1?this.readFloat():Array.from({length:t},()=>this.readFloat())}readBitShort(t=1){const e=()=>{const n=this.readBits(2);return n===0?this.readSignedShort():n===1?this.readUnsignedByte():n===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitLong(t=1){const e=()=>{const n=this.readBits(2);return n===0?this.readSignedLong():n===1?this.readUnsignedByte():n===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitDouble(t=1){const e=()=>{const n=this.readBits(2);return n===0?this.readFloat():n===1?1:0};return t===1?e():Array.from({length:t},()=>e())}readBitDoubleDefault(t=1,e=0){const n=new Uint8Array(8);new DataView(n.buffer).setFloat64(0,e,!0);const r=()=>{const s=this.readBits(2);if(s===0)return e;if(s===1){const o=new Uint8Array(n);return o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}if(s===2){const o=new Uint8Array(n);return o[4]=this.readUnsignedByte(),o[5]=this.readUnsignedByte(),o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}return this.readFloat()};return t===1?r():Array.from({length:t},()=>r())}}function ws(i){return Array.from(i,t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}function If(i){const t=i.reduce((r,s)=>r+Math.floor(s.length/2),0),e=new Uint8Array(t);let n=0;for(const r of i)for(let s=0;s<r.length;s+=2)e[n++]=parseInt(r.slice(s,s+2),16);return e}const Mf=127;var Mh=(i=>(i[i.Extents=1]="Extents",i[i.Circle=2]="Circle",i[i.Circle3P=3]="Circle3P",i[i.CircularArc=4]="CircularArc",i[i.CircularArc3P=5]="CircularArc3P",i[i.Polyline=6]="Polyline",i[i.Polygon=7]="Polygon",i[i.Mesh=8]="Mesh",i[i.Shell=9]="Shell",i[i.Text=10]="Text",i[i.Text2=11]="Text2",i[i.Xline=12]="Xline",i[i.Ray=13]="Ray",i[i.AttributeColor=14]="AttributeColor",i[i.AttributeLayer=16]="AttributeLayer",i[i.AttributeLinetype=18]="AttributeLinetype",i[i.AttributeMarker=19]="AttributeMarker",i[i.AttributeFill=20]="AttributeFill",i[i.AttributeTrueColor=22]="AttributeTrueColor",i[i.AttributeLineweight=23]="AttributeLineweight",i[i.AttributeLtscale=24]="AttributeLtscale",i[i.AttributeThickness=25]="AttributeThickness",i[i.PushMatrix=29]="PushMatrix",i[i.PopMatrix=31]="PopMatrix",i[i.PolylineWithNormals=32]="PolylineWithNormals",i[i.LwPolyline=33]="LwPolyline",i[i.UnicodeText=36]="UnicodeText",i[i.UnicodeText2=38]="UnicodeText2",i[i.EllipticArc=44]="EllipticArc",i))(Mh||{});const he=b.Z_AXIS,Tf=529;function Cf(i){const t=i>>24&255;return t===pi?{rgb:i&16777215}:t===fi?{colorIndex:256}:t===dn?{colorIndex:0}:t===yi?{colorIndex:i&255}:{colorIndex:i&255}}function Fi(i){return new b(i.x,i.y,i.z??0)}function zi(i){return new m(i.x,i.y,i.z??0)}function Uo(i){return{x:i[0],y:i[1],z:i[2]}}class Tr{constructor(t,e={}){this._index=8,this._colorIndex=256,this._layer="0",this._linetype=J,this._lineweight=exports.AcGiLineWeight.ByLineWeightDefault,this._ltscale=1,this._thickness=0,this._fill=!1,this._layers=[],this._linetypes=[],this._matrices=[],this._buffer=t,this._database=e.database,this._dxfversion=e.dxfversion??"AC1015",this._encoding=e.encoding??(this._dxfversion<"AC1024"?"windows-1252":"utf-8"),this._layer=e.defaultLayer??"0",this._database&&(this._database.tables.layerTable.newIterator().toArray().forEach(n=>this._layers.push(n.name)),this._database.tables.linetypeTable.newIterator().toArray().forEach(n=>this._linetypes.push(n.name)))}get extents(){return this._extents}scanExtents(){var n;const t=this._buffer;let e=this._index;for(;e<t.length;){const r=new DataView(t.buffer,t.byteOffset+e,8),s=r.getUint32(0,!0),o=r.getUint32(4,!0);if(s<8)break;if(o===1){const a=t.subarray(e+8,e+s);return this.readExtents(a),((n=this._extents)==null?void 0:n.length)===2?[this._extents[0],this._extents[1]]:void 0}e+=s}}worldDraw(t){const e=[],n=t.subEntityTraits,r={color:n.color.clone(),lineType:n.lineType,lineTypeScale:n.lineTypeScale,lineWeight:n.lineWeight,layer:n.layer,thickness:n.thickness},s=this._buffer;let o=this._index;for(;o<s.length;){const a=new DataView(s.buffer,s.byteOffset+o,8),l=a.getUint32(0,!0),h=a.getUint32(4,!0);if(l<8)break;const c=s.subarray(o+8,o+l);this.dispatchChunk(t,e,h,c),h!==20&&(this._fill=!1),o+=l}if(n.color=r.color,n.lineType=r.lineType,n.lineTypeScale=r.lineTypeScale,n.lineWeight=r.lineWeight,n.layer=r.layer,n.thickness=r.thickness,e.length!==0)return t.group(e)}dispatchChunk(t,e,n,r){switch(n){case 1:this.readExtents(r);break;case 2:this.drawCircle(t,e,r);break;case 3:this.drawCircle3P(t,e,r);break;case 4:this.drawCircularArc(t,e,r);break;case 5:this.drawCircularArc3P(t,e,r);break;case 44:this.drawEllipticArc(t,e,r);break;case 6:this.drawPolyline(t,e,r,!1);break;case 32:this.drawPolyline(t,e,r,!0);break;case 7:this.drawPolygon(t,e,r);break;case 33:this.drawLwPolyline(t,e,r);break;case 9:this.drawShell(t,e,r);break;case 10:this.drawText(t,e,r,!1);break;case 36:this.drawText(t,e,r,!0);break;case 11:this.drawText2(t,e,r,!1);break;case 38:this.drawText2(t,e,r,!0);break;case 12:this.drawXline(t,e,r,!1);break;case 13:this.drawXline(t,e,r,!0);break;case 14:this.readAttributeColor(r);break;case 16:this.readAttributeLayer(r);break;case 18:this.readAttributeLinetype(r);break;case 20:this.readAttributeFill(r);break;case 22:this.readAttributeTrueColor(r);break;case 23:this.readAttributeLineweight(r);break;case 24:this.readAttributeLtscale(r);break;case 25:this.readAttributeThickness(r);break;case 29:this.pushMatrix(r);break;case 31:this.popMatrix();break}}applyTraits(t){const e=t.subEntityTraits;e.layer=this._layer,e.lineTypeScale=this._ltscale,e.thickness=this._thickness,e.lineWeight=this._lineweight,this._rgbColor!=null?e.color=new X(exports.AcCmColorMethod.ByColor,this._rgbColor):this._colorIndex===256?e.color=new X(exports.AcCmColorMethod.ByLayer):this._colorIndex===0?e.color=new X(exports.AcCmColorMethod.ByBlock):this._colorIndex===7?e.color=new X(exports.AcCmColorMethod.ByACI,7):e.color=new X(exports.AcCmColorMethod.ByACI,this._colorIndex),e.lineType={name:this._linetype,type:this.resolveLineStyleType(),standardFlag:0,description:"",totalPatternLength:0}}resolveLineStyleType(){return this._linetype===J?"ByLayer":this._linetype===Xt?"ByBlock":"UserSpecified"}transformPoint(t){const e=Array.isArray(t)?Uo(t):t,n=zi(e);return this._matrices.length>0&&n.applyMatrix4(this._matrices[this._matrices.length-1]),n}transformVector(t){const e=Array.isArray(t)?Uo(t):t,n=Fi(e);return this._matrices.length>0&&n.transformDirection(this._matrices[this._matrices.length-1]),!Number.isFinite(n.lengthSq())||n.lengthSq()<1e-24?he.clone():n.normalize()}pushEntity(t,e){e&&t.push(e)}readExtents(t){const e=new _t(t),n=e.readVertex(),r=e.readVertex();this._extents=[new m(n[0],n[1],n[2]),new m(r[0],r[1],r[2])]}readAttributeColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);this._rgbColor=void 0,this._colorIndex=e>256||e<0?256:e}readAttributeLayer(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e<this._layers.length&&(this._layer=this._layers[e])}readAttributeLinetype(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e+2<this._linetypes.length?this._linetype=this._linetypes[e+2]:e===32766?this._linetype=Xt:this._linetype=J}readAttributeFill(t){this._fill=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0)!==0}readAttributeTrueColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0),n=Cf(e);this._rgbColor=n.rgb,n.colorIndex!=null&&(this._colorIndex=n.colorIndex)}readAttributeLineweight(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e>Tf?this._lineweight=e-4294967296:this._lineweight=e}readAttributeLtscale(t){this._ltscale=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}readAttributeThickness(t){this._thickness=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}pushMatrix(t){const e=new Float64Array(t.buffer,t.byteOffset,16),n=new O().fromArray(Array.from(e));n.transpose(),this._matrices.push(n)}popMatrix(){this._matrices.length>0&&this._matrices.pop()}loadVertices(t,e){const n=new _t(t);let r=n.readLong();e&&(r+=1);const s=[];for(;r>0;){const[a,l,h]=n.readVertex();s.push(this.transformPoint({x:a,y:l,z:h})),r-=1}let o=he;return e&&s.length>0&&(o=Fi(s.pop())),{vertices:s,normal:o}}drawCircle(t,e,n){const r=new _t(n),s=r.readVertex(),o=r.readFloat(),a=this.transformVector(r.readVertex());let l=zi({x:s[0],y:s[1],z:s[2]});a.equals(he)||(l=Xe(l,a)),l=this.transformPoint(l);const h=an(a),c=new kt(qi(l,a),o,0,F,a,h);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircle3P(t,e,n){const r=new _t(n),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),l=kt.computeCenterPoint(s,o,a);if(!l)return;const h=l.distanceTo(s),c=new kt(l,h,0,F,he);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircularArc(t,e,n){const r=new _t(n),s=r.readVertex(),o=r.readFloat(),a=r.readVertex(),l=r.readVertex(),h=r.readFloat(),c=this.transformVector(a),u=zi({x:s[0],y:s[1],z:s[2]}),g=Fi({x:l[0],y:l[1],z:l[2]});this._matrices.length>0&&g.transformDirection(this._matrices[this._matrices.length-1]);const d=Number.isFinite(g.lengthSq())&&g.lengthSq()>=1e-24?g.normalize():an(c),f=0,p=h,y=new kt(this.transformPoint(u),o,f,p,c,d);this.applyTraits(t),this.pushEntity(e,t.circularArc(y))}drawCircularArc3P(t,e,n){const r=new _t(n),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),l=kt.computeCenterPoint(s,a,o);if(!l)return;const h=l.distanceTo(s),c=Dt(l,s,he),u=Dt(l,a,he),g=new kt(l,h,c,u,he);this.applyTraits(t),this.pushEntity(e,t.circularArc(g))}drawEllipticArc(t,e,n){const r=new _t(n),s=this.transformPoint(r.readVertex()),o=this.transformVector(r.readVertex()),a=r.readFloat(),l=r.readFloat(),h=r.readFloat(),c=r.readFloat(),u=r.readFloat(),g=qi({x:Math.cos(u)*a,y:Math.sin(u)*a,z:0},o),d=new hs(s,o,g,a,l,h,c);this.applyTraits(t),this.pushEntity(e,t.ellipticalArc(d))}drawPolyline(t,e,n,r){var o,a;const{vertices:s}=this.loadVertices(n,r);if(s.length!==0){if(s.length===1){this.applyTraits(t);const l=((o=this._database)==null?void 0:o.pdmode)??0,h=((a=this._database)==null?void 0:a.pdsize)??0;this.pushEntity(e,t.point(s[0],{displayMode:l,displaySize:h}));return}this.applyTraits(t),this.pushEntity(e,t.lines(s))}}drawPolygon(t,e,n){const{vertices:r}=this.loadVertices(n,!1);if(r.length<2)return;if(this._fill){const o=new j(r.map(h=>({x:h.x,y:h.y})),!0),a=new Et;a.add(o);const l=t.subEntityTraits;l.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},l.drawOrder=-1,this.applyTraits(t),this.pushEntity(e,t.area(a));return}const s=[...r,r[0]];this.applyTraits(t),this.pushEntity(e,t.lines(s))}drawLwPolyline(t,e,n){const r=new Ih(n,this._dxfversion,this._encoding);let s=0,o=!1;r.readUnsignedLong();const a=r.readBitShort();a&8&&(s=r.readBitDouble()),a&512&&(o=!0);const l=r.readBitLong();if(l<=0)return;const h=a&16?r.readBitLong():0;this._dxfversion>="AC1024"&&(a&1024&&r.readBitLong(),a&32&&r.readBitLong());const c=r.readRawDouble(2),u=[this.transformPoint({x:c[0],y:c[1],z:s})];let g=c;for(let d=1;d<l;d++){const f=r.readBitDoubleDefault(1,g[0]),p=r.readBitDoubleDefault(1,g[1]);g=[f,p],u.push(this.transformPoint({x:f,y:p,z:s}))}for(let d=0;d<h;d++)r.readBitDouble();o&&u.length>1&&u.push(u[0].clone()),this.applyTraits(t),this.pushEntity(e,t.lines(u))}drawShell(t,e,n){const r=new _t(n),s=r.readLong(),o=[];for(let c=0;c<s;c++){const[u,g,d]=r.readVertex();o.push(this.transformPoint({x:u,y:g,z:d}))}const a=r.readLong(),l=[];let h=0;for(;h<a;){const c=Math.abs(r.readSignedLong());h+=1+c;const u=[];for(let d=0;d<c;d++)u.push(r.readLong());const g=u.map(d=>o[d]).filter(Boolean);if(g.length>=3)for(let d=0;d<g.length;d++)l.push(g[d]),l.push(g[(d+1)%g.length])}l.length!==0&&(this.applyTraits(t),this.pushEntity(e,t.lines(l)))}drawText(t,e,n,r){const s=new _t(n),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),l=this.transformVector(s.readVertex()),[h,c,u]=s.readStruct([8,8,8]),g=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:l,text:g,height:h,widthFactor:c,obliqueAngle:u})}drawText2(t,e,n,r){const s=new _t(n),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),l=this.transformVector(s.readVertex()),h=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);s.readSignedLong(),s.readSignedLong();const[c,u,g]=s.readStruct([8,8,8]);s.readFloat(),this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:l,text:h,height:c,widthFactor:u,obliqueAngle:g})}drawTextPrimitive(t,e,n){const r=Math.atan2(n.textDirection.y,n.textDirection.x),s={text:n.text,height:n.height,width:1/0,widthFactor:n.widthFactor,position:n.insert,rotation:r*180/Math.PI,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft},o={name:K,standardFlag:0,fixedTextHeight:0,widthFactor:n.widthFactor,obliqueAngle:n.obliqueAngle*180/Math.PI,textGenerationFlag:0,lastHeight:n.height,font:"txt",bigFont:""};this.applyTraits(t),this.pushEntity(e,t.mtext(s,o))}drawXline(t,e,n,r){const s=new _t(n),o=this.transformPoint(s.readVertex()),a=this.transformPoint(s.readVertex()),l=new b().subVectors(a,o);if(l.lengthSq()===0)return;const h=1e6,c=r?o.clone().add(l.normalize().multiplyScalar(h)):o.clone().sub(l.normalize().multiplyScalar(h)),u=a.clone().add(l.normalize().multiplyScalar(h));this.applyTraits(t),this.pushEntity(e,t.lines([c,u]))}}function Of(i,t){if(!(t!=null&&t.length))return;const e=new Uint8Array(t.reduce((r,s)=>r+Math.floor(s.length/2),0));let n=0;for(const r of t)for(let s=0;s<r.length;s+=2)e[n++]=parseInt(r.slice(s,s+2),16);return i!=null&&i>0&&e.length>=i?e.subarray(0,i):e}const Fs=class Fs extends Un{constructor(){super(),this._oleVersion=0}get dxfTypeName(){return"OLEFRAME"}get oleVersion(){return this._oleVersion}set oleVersion(t){this._oleVersion=t}getOleObject(){return this._oleObject?new Uint8Array(this._oleObject):void 0}setOleObject(t){t==null?this._oleObject=void 0:this._oleObject=t instanceof ArrayBuffer?new Uint8Array(t.slice(0)):new Uint8Array(t),this.onOleObjectChanged()}loadOleObjectFromDxf(t,e){e!=null&&e.length?t!=null&&t>0&&t<e.length?this._oleObject=e.subarray(0,t):this._oleObject=new Uint8Array(e):this._oleObject=void 0,this.onOleObjectChanged()}get oleObjectData(){return this._oleObject}onOleObjectChanged(){}get geometricExtents(){return new k}subWorldDraw(t){}dxfOutFields(t){var e;if(super.dxfOutFields(t),t.writeSubclassMarker("AcDbOleFrame"),t.writeInt16(70,this._oleVersion),(e=this._oleObject)!=null&&e.length){t.writeInt32(90,this._oleObject.length);let n=0;for(;n<this._oleObject.length;){const r=this._oleObject.subarray(n,n+127);t.writeString(310,ws(r)),n+=127}}return t.writeString(1,"OLE"),this}};Fs.typeName="OleFrame";let Hn=Fs;function Th(i,t){if(t.length<3)return;const e=i.subEntityTraits,n=e.fillType,r=e.transparency;e.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.transparency=new Q(0);const s=new Et;s.add(new j(t,!0));const o=i.area(s);e.fillType=n,e.transparency=r;const a=i.lines(t);return o?a?i.group([o,a]):o:a}const Cr=[208,207,17,224,161,177,26,225],kf=2,Nf=8,Vi=128,Rf=64*1024*1024;function Xf(i){if(!(i!=null&&i.length))return;const t=Yf(i);return t||Ne(i)}function Yf(i){const t=mn(i,Cr);if(t<0)return;const e=i.subarray(t);let n;try{n=Uf(e)}catch{return}const r=["CONTENTS","Package","Ole10Native","Ole10Native"];for(const s of r){const o=n.readStream(s);if(!(o!=null&&o.length))continue;const a=Ne(o);if(a)return a}for(const s of n.entries()){if(s.type!=="stream"||!/olepres/i.test(s.name)&&!s.name.includes("OlePres"))continue;const o=n.readStream(s.name);if(!(o!=null&&o.length))continue;const a=Bf(o);if(a)return a;const l=Ne(o);if(l)return l}for(const s of n.entries()){if(s.type!=="stream")continue;const o=n.readStream(s.name);if(!(o!=null&&o.length))continue;const a=Ne(o);if(a)return a}}function Bf(i){if(i.length<28)return;const t=new DataView(i.buffer,i.byteOffset,i.byteLength);let e=0;const n=t.getUint32(e,!0);e+=4;let r=0;if(n===4294967295)r=t.getUint32(e,!0),e+=4;else{if(n===4294967294)return;if(n>0&&n<65535)e+=n;else return}if(e+4>i.length)return;const s=t.getUint32(e,!0);if(e+=4,s>4&&(e+=s-4),e+=24,e+4>i.length)return;const o=t.getUint32(e,!0);if(e+=4,o<=0||e+o>i.length)return;const a=i.subarray(e,e+o);return r===Nf?Oh(a):Ne(a)}function Ne(i){const t=Ff(i);if(t)return t;const e=zf(i);if(e)return e;const n=Vf(i);if(n)return n;const r=jf(i);if(r)return r;const s=Df(i);if(s)return s}function Ff(i){for(let t=0;t<i.length-14;t++){if(i[t]!==66||i[t+1]!==77)continue;const e=new DataView(i.buffer,i.byteOffset+t,i.length-t),n=e.getUint32(2,!0);if(n<14||n>i.length-t)continue;const r=e.getUint32(10,!0);if(!(r<14||r>=n))return new Blob([i.subarray(t,t+n)],{type:"image/bmp"})}}function zf(i){const e=mn(i,[137,80,78,71,13,10,26,10]);if(!(e<0)){for(let n=e+8;n+12<=i.length;n++)if(i[n+4]===73&&i[n+5]===69&&i[n+6]===78&&i[n+7]===68){const r=n+12;return new Blob([i.subarray(e,r)],{type:"image/png"})}return new Blob([i.subarray(e)],{type:"image/png"})}}function Vf(i){const t=mn(i,[255,216,255]);if(!(t<0)){for(let e=t+3;e+1<i.length;e++)if(i[e]===255&&i[e+1]===217)return new Blob([i.subarray(t,e+2)],{type:"image/jpeg"})}}function jf(i){const t=mn(i,[71,73,70,56,55,97]),e=mn(i,[71,73,70,56,57,97]),n=t>=0?t:e;if(!(n<0)){for(let r=n+6;r<i.length;r++)if(i[r]===59)return new Blob([i.subarray(n,r+1)],{type:"image/gif"});return new Blob([i.subarray(n)],{type:"image/gif"})}}function Df(i){for(let t=0;t+40<=i.length;t++){const e=new DataView(i.buffer,i.byteOffset+t,i.length-t),n=e.getUint32(0,!0);if(n!==40)continue;const r=e.getInt32(4,!0),s=e.getInt32(8,!0),o=e.getUint16(12,!0),a=e.getUint16(14,!0),l=e.getUint32(16,!0),h=e.getUint32(20,!0),c=e.getUint32(32,!0);if(r<=0||r>65536||s===0||Math.abs(s)>65536||o!==1||![1,4,8,16,24,32].includes(a)||l!==0&&l!==3)continue;const u=Ch(n,a,l,c),g=Math.abs(s),d=r*a+31>>5<<2,f=h>0?h:d*g,p=u+f;if(!(p<=40||t+p>i.length))return Oh(i.subarray(t,t+p))}}function Ch(i,t,e,n){let r=0;return t>8&&e===3&&(r+=12),n>0?r+=n*4:t<=8&&(r+=(1<<t)*4),i+r}function Oh(i){if(i.length<40)return;const e=new DataView(i.buffer,i.byteOffset,i.byteLength).getUint32(0,!0);if(e!==40&&e!==12)return;const n=14+i.length,r=new Uint8Array(14),s=new DataView(r.buffer);r[0]=66,r[1]=77,s.setUint32(2,n,!0),s.setUint32(10,14+Gf(i),!0);const o=new Uint8Array(n);return o.set(r,0),o.set(i,14),new Blob([o],{type:"image/bmp"})}function Gf(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength),e=t.getUint32(0,!0);if(e===12){const o=t.getUint16(10,!0),a=o<=8?1<<o:0;return e+a*3}const n=t.getUint16(14,!0),r=t.getUint32(16,!0),s=t.getUint32(32,!0);return Ch(e,n,r,s)}function mn(i,t){t:for(let e=0;e<=i.length-t.length;e++){for(let n=0;n<t.length;n++)if(i[e+n]!==t[n])continue t;return e}return-1}function Uf(i){if(i.length<512)throw new Error("CFB too small");for(let E=0;E<Cr.length;E++)if(i[E]!==Cr[E])throw new Error("Not a CFB document");const t=new DataView(i.buffer,i.byteOffset,i.byteLength),n=1<<t.getUint16(30,!0);if(n!==512&&n!==4096)throw new Error("Unsupported CFB sector size");const r=t.getUint32(44,!0),s=t.getUint32(48,!0),o=t.getUint32(56,!0),a=t.getUint32(60,!0),l=t.getUint32(64,!0),h=t.getUint32(68,!0),c=t.getUint32(72,!0),u=[];for(let E=0;E<109;E++){const L=t.getUint32(76+E*4,!0);L<=4294967290&&u.push(L)}let g=h;for(let E=0;E<c&&g<=4294967290;E++){const L=(g+1)*n;if(L+n>i.length)break;const C=n/4-1;for(let M=0;M<C;M++){const Y=t.getUint32(L+M*4,!0);Y<=4294967290&&u.push(Y)}g=t.getUint32(L+C*4,!0)}const d=[];for(let E=0;E<Math.min(r,u.length);E++){const C=(u[E]+1)*n;if(C+n>i.length)break;const M=n/4;for(let Y=0;Y<M;Y++)d.push(t.getUint32(C+Y*4,!0))}const f=On(d,s,4096),p=kn(i,f,n),y=[],_=Math.floor(p.length/Vi);for(let E=0;E<_;E++){const L=E*Vi,C=new DataView(p.buffer,p.byteOffset+L,Vi),M=C.getUint16(64,!0);if(M<2||M>64)continue;const Y=Math.floor((M-2)/2);let N="";for(let St=0;St<Y;St++)N+=String.fromCharCode(C.getUint16(St*2,!0));const R=C.getUint8(66),G=C.getUint32(116,!0),U=C.getUint32(120,!0),at=C.getUint32(124,!0),yt=at===0?U:U+at*4294967296;let At="unknown";R===5?At="root":R===1?At="storage":R===2&&(At="stream"),y.push({name:N,type:At,size:yt,startSector:G})}const x=y.find(E=>E.type==="root"),P=[];if(l>0&&a<=4294967290){const E=On(d,a,l),L=kn(i,E,n),C=new DataView(L.buffer,L.byteOffset,L.byteLength);for(let M=0;M+4<=L.length;M+=4)P.push(C.getUint32(M,!0))}let A;if(x&&x.size>0){const E=On(d,x.startSector,65536);A=kn(i,E,n).subarray(0,x.size)}return{entries:()=>y,readStream:E=>{const L=y.find(M=>M.type==="stream"&&(M.name===E||M.name.toLowerCase()===E.toLowerCase()));if(!L||L.size<=0||L.size>Rf)return;if(L.size<o&&A&&P.length>0){const Y=kh(P,L.startSector,65536),N=new Uint8Array(L.size);let R=0;for(const G of Y){if(R>=L.size)break;const U=G*64,at=Math.min(U+64,A.length);if(U>=A.length)break;const yt=A.subarray(U,at);N.set(yt.subarray(0,Math.min(yt.length,L.size-R)),R),R+=yt.length}return N.subarray(0,Math.min(R,L.size))}const C=On(d,L.startSector,65536);return kn(i,C,n).subarray(0,L.size)}}}function On(i,t,e){return kh(i,t,e)}function kh(i,t,e){const n=[];let r=t;const s=new Set;for(;r<=4294967290&&n.length<e&&!(s.has(r)||(s.add(r),n.push(r),r>=i.length));)r=i[r];return n}function kn(i,t,e){const n=new Uint8Array(t.length*e);let r=0;for(const s of t){const o=(s+1)*e,a=Math.min(o+e,i.length);if(o>=i.length)break;n.set(i.subarray(o,a),r),r+=e}return n}var Nh=(i=>(i[i.Link=1]="Link",i[i.Embedded=2]="Embedded",i[i.Static=3]="Static",i))(Nh||{}),Rh=(i=>(i[i.ModelSpace=0]="ModelSpace",i[i.PaperSpace=1]="PaperSpace",i))(Rh||{});const zs=class zs extends Hn{constructor(){super(),this._upperLeft=new m,this._lowerRight=new m,this._rotation=0,this._scaleWidth=1,this._scaleHeight=1,this._lockAspect=!1,this._outputQuality=0,this._autoOutputQuality=0,this._oleObjectType=2,this._tileMode=0,this._userType="",this._linkName="",this._linkPath="",this._oleClientItem=null,this._imageResolved=!1}get dxfTypeName(){return"OLE2FRAME"}get upperLeftCorner(){return this._upperLeft}set upperLeftCorner(t){this._upperLeft.copy(t)}get lowerRightCorner(){return this._lowerRight}set lowerRightCorner(t){this._lowerRight.copy(t)}getLocation(t){return t?t.copy(this._upperLeft):this._upperLeft.clone()}setLocation(t){const e=t.x-this._upperLeft.x,n=t.y-this._upperLeft.y,r=(t.z??0)-this._upperLeft.z;this._upperLeft.copy(t),this._lowerRight.x+=e,this._lowerRight.y+=n,this._lowerRight.z+=r}position(){return{upperLeft:this._upperLeft.clone(),upperRight:this.cornerUpperRight(),lowerLeft:this.cornerLowerLeft(),lowerRight:this._lowerRight.clone()}}setPosition(t){this._upperLeft.copy(t.upperLeft),this._lowerRight.copy(t.lowerRight)}wcsWidth(){return Math.abs(this._lowerRight.x-this._upperLeft.x)}setWcsWidth(t){const e=this._lowerRight.x>=this._upperLeft.x?1:-1;this._lowerRight.x=this._upperLeft.x+e*Math.abs(t),this._lockAspect&&this.syncHeightFromAspect()}wcsHeight(){return Math.abs(this._upperLeft.y-this._lowerRight.y)}setWcsHeight(t){const e=this._upperLeft.y>=this._lowerRight.y?1:-1;this._lowerRight.y=this._upperLeft.y-e*Math.abs(t),this._lockAspect&&this.syncWidthFromAspect()}scaleWidth(){return this._scaleWidth}setScaleWidth(t){this._scaleWidth=t}scaleHeight(){return this._scaleHeight}setScaleHeight(t){this._scaleHeight=t}rotation(){return this._rotation}setRotation(t){this._rotation=t}lockAspect(){return this._lockAspect}setLockAspect(t){this._lockAspect=!!t}outputQuality(){return this._outputQuality}setOutputQuality(t){this._outputQuality=t&255}autoOutputQuality(){return this._autoOutputQuality}setAutoOutputQuality(t){this._autoOutputQuality=t&255}getType(){return this._oleObjectType}setType(t){this._oleObjectType=t}get oleObjectType(){return this._oleObjectType}set oleObjectType(t){this._oleObjectType=t}get tileMode(){return this._tileMode}set tileMode(t){this._tileMode=t}getUserType(){return this._userType}setUserType(t){this._userType=t}get userType(){return this._userType}set userType(t){this._userType=t}getLinkName(){return this._linkName}setLinkName(t){this._linkName=t}getLinkPath(){return this._linkPath}setLinkPath(t){this._linkPath=t}getOleClientItem(){return this._oleClientItem}setOleClientItem(t){this._oleClientItem=t??null}get geometricExtents(){return new k().setFromPoints(this.boundaryPath())}subGetGripPoints(){return this.boundaryPath().slice(0,4)}subMoveGripPointsAt(t,e){const n=this.boundaryPath().slice(0,4);return Ge(t,e,n),Z(t,r=>{r===0?this._upperLeft.copy(n[0]):r===2?this._lowerRight.copy(n[2]):r===1?(this._upperLeft.y=n[1].y,this._lowerRight.x=n[1].x,this._upperLeft.z=n[1].z,this._lowerRight.z=n[1].z):r===3&&(this._upperLeft.x=n[3].x,this._lowerRight.y=n[3].y,this._upperLeft.z=n[3].z,this._lowerRight.z=n[3].z)}),this}subGetOsnapPoints(t,e,n,r){if(t===w.Insertion){r.push(this._upperLeft.clone());return}const s=this.boundaryPath().slice(0,4);if(t===w.EndPoint){r.push(...s);return}gi(s,!0,t,e,r)}transformBy(t){const e=this._lowerRight.x-this._upperLeft.x,n=this._upperLeft.y-this._lowerRight.y,r=Math.cos(this._rotation),s=Math.sin(this._rotation),o=this._upperLeft.clone(),a=o.clone().add(new b(e*r,e*s,0)),l=o.clone().add(new b(n*s,-n*r,0));o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b().subVectors(a,o),c=new b().subVectors(l,o);return this._upperLeft.copy(o),this._rotation=Math.atan2(h.y,h.x),this._lowerRight.set(o.x+h.length(),o.y-c.length(),o.z),this}get image(){return this.resolveImage()}subWorldDraw(t){const e=this.resolveImage(),n=this.imageBoundaryPath();return e?t.image(e,{boundary:n,roation:this._rotation}):Th(t,this.boundaryPath())}onOleObjectChanged(){this._image=void 0,this._imageResolved=!1}resolveImage(){return this._imageResolved?this._image:(this._imageResolved=!0,this._image=Xf(this.oleObjectData),this._image)}imageBoundaryPath(){const t=this.boundaryPath(),e=[t[3],t[2],t[1],t[0]];return e.push(e[0].clone()),e}dxfOutFields(t){V.prototype.dxfOutFields.call(this,t),t.writeSubclassMarker("AcDbOle2Frame"),t.writeInt16(70,this.oleVersion),this._userType&&t.writeString(3,this._userType),t.writePoint3d(10,this._upperLeft),t.writePoint3d(11,this._lowerRight),t.writeInt16(71,this._oleObjectType),t.writeInt16(72,this._tileMode),this._outputQuality&&t.writeInt16(73,this._outputQuality);const e=this.getOleObject();if(e!=null&&e.length){t.writeInt32(90,e.length);let n=0;for(;n<e.length;){const r=e.subarray(n,n+127);t.writeString(310,ws(r)),n+=127}}return t.writeString(1,"OLE"),this}cornerUpperRight(){return new m(this._lowerRight.x,this._upperLeft.y,this._upperLeft.z)}cornerLowerLeft(){return new m(this._upperLeft.x,this._lowerRight.y,this._lowerRight.z)}boundaryPath(){const t=[this._upperLeft.clone(),this.cornerUpperRight(),this._lowerRight.clone(),this.cornerLowerLeft()];if(this._rotation!==0){const e=this._upperLeft;for(let n=1;n<t.length;n++)t[n].sub(e).applyMatrix4(new O().makeRotationZ(this._rotation)),t[n].add(e)}return t.push(t[0].clone()),t}syncHeightFromAspect(){const t=this.wcsWidth();if(t===0||this._scaleWidth===0)return;const e=this._scaleHeight/this._scaleWidth,n=t*e,r=this._upperLeft.y>=this._lowerRight.y?1:-1;this._lowerRight.y=this._upperLeft.y-r*Math.abs(n)}syncWidthFromAspect(){const t=this.wcsHeight();if(t===0||this._scaleHeight===0)return;const e=this._scaleWidth/this._scaleHeight,n=t*e,r=this._lowerRight.x>=this._upperLeft.x?1:-1;this._lowerRight.x=this._upperLeft.x+r*Math.abs(n)}};zs.typeName="Ole2Frame";let Or=zs;function Hf(i){return i&2048?"SqrtChord":i&1024?"Chord":"Uniform"}function Ho(i,t){try{return new Wn(i.controlPoints,i.knots,Wf(i.weights,i.controlPoints.length),i.degree,t)}catch{return null}}function Wf(i,t){if(!(!i||i.length!==t))return i}const sn=class sn extends rt{get dxfTypeName(){return"SPLINE"}static fromControlPoints(t,e,n,r,s){const o=Rt.fromControlPoints(t,e,n,r,s);return o?Ho(o,s):null}static fromFitPoints(t,e,n,r,s,o){const a=Rt.fromFitPoints(t,e,n,r,s,o);return a?Ho(a,r):null}static fromDwgSpline(t){const e=!!(t.flag&1),n=Hf(t.flag);if(t.numberOfControlPoints>0&&t.numberOfKnots>0){const r=sn.fromControlPoints(t.controlPoints,t.knots,t.weights,t.degree,e);if(r)return r}return t.numberOfFitPoints>0?sn.fromFitPoints(t.fitPoints,n,t.degree,e,t.startTangent,t.endTangent):null}constructor(t,e,n,r,s){super(),this.rebuild(t,e,n,r,s)}rebuild(t,e,n,r,s){const o=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(r!==void 0)+ +(s!==void 0);if(o<2||o>5)throw gt.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Rt(t,e,n,r):this._geo=new Rt(t,e,n,r,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}subGetGripPoints(){return this._geo.getGripPoints()}subMoveGripPointsAt(t,e){return this._geo.moveGripPointsAt(t,e),this}subGetOsnapPoints(t,e,n,r){switch(t){case w.EndPoint:r.push(this._geo.startPoint),r.push(this._geo.endPoint);break;case w.Node:{const s=new Set;for(const o of this._geo.knots)s.has(o)||(s.add(o),r.push(this._geo.evaluateAt(o)));break}case w.Nearest:r.push(this._geo.nearestPoint(e));break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var n;const e=this._geo;super.dxfOutFields(t),t.writeSubclassMarker("AcDbSpline"),t.writeInt16(70,this.closed?1:0),t.writeInt16(71,e.degree),t.writeInt16(72,e.knots.length),t.writeInt16(73,e.controlPoints.length),t.writeInt16(74,((n=e.fitPoints)==null?void 0:n.length)??0);for(const r of e.knots)t.writeDouble(40,r);for(const r of e.weights)t.writeDouble(41,r);for(const r of e.controlPoints)t.writePoint3d(10,r);for(const r of e.fitPoints??[])t.writePoint3d(11,r);return this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d(1);return e.length<2?1:pt.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const{points:e,tangents:n}=this._geo.getOffsetSamplePath2d(t),r=Pu(e,this.closed,t,n);return r?pt.fromGePolyline(r):null}collectPath2d(t){return this._geo.getOffsetSamplePath2d(t).points}};sn.typeName="Spline";let Wn=sn;const $f=new b,Vs=class Vs extends Ve{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,n){super(t),this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=n,this._numRows=e,this._columnWidth=new Array(n),this._rowHeight=new Array(e),this._cells=new Array(e*n)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,n){var s;const r=t*this._numColumns+e;return(s=this._cells[r])==null?void 0:s.text}setTextString(t,e,n){const r=t*this._numColumns+e;if(!this._cells[r]){this._cells[r]={text:n,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[r].text=n}isEmpty(t,e){var r;const n=t*this._numColumns+e;return!((r=this._cells[n])!=null&&r.text)}get geometricExtents(){let t;try{t=this.blockTableRecord}catch{t=void 0}if(t&&t.newIterator().count>0){const a=new k;for(const l of t.newIterator())a.union(l.geometricExtents);return a.applyMatrix4(this.blockTransform),a}const e=this._columnWidth.reduce((a,l)=>a+l,0),n=this._rowHeight.reduce((a,l)=>a+l,0),r=new k;if(e===0&&n===0)return r.expandByPoint(this.position),r;const s=new Re;s.setFromAxisAngle(b.Z_AXIS,this.rotation),xe.compose(this.position,s,this.scaleFactors);const o=[new m(0,0,0),new m(e,0,0),new m(e,-n,0),new m(0,-n,0)];for(const a of o)r.expandByPoint(a.applyMatrix4(xe));return r}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){const e=this.blockTableRecord;if(e&&e.newIterator().count>0){const d=this.drawAnonymousTableBlock(t,e);if(d)return d}let n=0,r=0;const s=new Uint16Array(this.numColumns*this.numRows*8),o=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let d=0;d<=this.numRows;d++){n-=d>0?this.rowHeight(d-1):0,r=0;for(let f=0;f<=this.numColumns;f++)r+=f>0?this.columnWidth(f-1):0,o[a++]=r,o[a++]=n,o[a++]=0}const l=[],h=new Array(this.numRows*this.numColumns).fill(!1);r=0,a=0;let c=0;for(let d=0;d<this.numColumns;d++){r+=d>0?this.columnWidth(d-1):0,n=0;for(let f=0;f<this.numRows;f++){n+=f>0?this.rowHeight(f-1):0;const p=this.cell(f*this.numColumns+d);if(c=f*this.numColumns+d,p&&!h[c]){const y=p.borderWidth??1,_=p.borderHeight??1;this.fillVisited(h,c,this.numColumns,y,_),s[a++]=d+f*(this.numColumns+1),s[a++]=d+f*(this.numColumns+1)+y;const x=o[s[a-1]*3]-r,P=d+(f+_)*(this.numColumns+1)+y;d+y==this.numColumns&&(s[a++]=d+f*(this.numColumns+1)+y,s[a++]=P);const A=-o[P*3+1]-n;if(f+_==this.numRows&&(s[a++]=d+(f+_)*(this.numColumns+1)+_,s[a++]=d+(f+_)*(this.numColumns+1)),s[a++]=d+(f+_)*(this.numColumns+1),s[a++]=d+f*(this.numColumns+1),p.text){const I=p.attachmentPoint||this.attachmentPoint||exports.AcGiMTextAttachmentPoint.MiddleCenter,E=this.getTableTextOffset(I,x,A),L={text:p.text,height:this.getCellTextHeight(p,A),width:x,position:$f.set(r,-n,0).clone().add(E),rotation:this.rotation,attachmentPoint:I},C=this.getTextStyle(p);l.push(t.mtext(L,C))}}}}l.push(t.lineSegments(o,3,s));const u=t.group(l),g=new Re;return g.setFromAxisAngle(b.Z_AXIS,this.rotation),xe.compose(this.position,g,this.scaleFactors),u.applyMatrix(xe),u}drawAnonymousTableBlock(t,e){const n=[],r=e.newIterator();for(const a of r){let l;if(a.color.isByBlock){Wo.copy(a.color);const h=this.resolvedColor;h.isForeground?a.color.setForeground():h.RGB!=null&&a.color.setRGBValue(h.RGB),l=a.worldDraw(t),a.color.copy(Wo)}else l=a.worldDraw(t);l&&(l.objectId=this.objectId,l.ownerId=this.ownerId,l.layerName=this.layer,l.visible=this.visibility&&a.visibility,n.push(l))}const s=t.group(n);s.applyMatrix(this.blockTransform);const o=this.normal;return o&&(o.x!==0||o.y!==0||o.z!==1)&&(xe.setFromExtrusionDirection(o),s.applyMatrix(xe)),s}fillVisited(t,e,n,r,s){if(s==1&&r==1)t[e]=!0;else for(let o=0;o<r;++o)for(let a=0;a<s;++a)t[e+o+a*n]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable.resolveAt(t.textStyle);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}getTableTextOffset(t,e,n){const r=new b;switch(t){case 1:break;case 2:r.setX(e/2);break;case 3:r.setX(e);break;case 4:r.setY(-n/2);break;case 5:r.set(e/2,-n/2,0);break;case 6:r.set(e,-n/2,0);break;case 7:r.setY(-n);break;case 8:r.set(e/2,-n,0);break;case 9:r.set(e,-n,0);break}return r}getCellTextHeight(t,e){return t.textHeight&&t.textHeight>0?t.textHeight:Math.max(e/2,1)}dxfOutFields(t){var s,o,a,l,h,c,u;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((s=t.database)==null?void 0:s.version)??((o=this.database)==null?void 0:o.version),n=(e==null?void 0:e.value)!=null?e.value>=27:!1;t.writeInt16(280,this.tableDataVersion),t.writeObjectId(342,this.tableStyleId),t.writeObjectId(343,this.owningBlockRecordId),t.writeVector3d(11,this.horizontalDirection),t.writeUInt32(90,this.tableValueFlag),t.writeUInt32(93,this.tableOverrideFlag),t.writeUInt32(94,this.borderColorOverrideFlag),t.writeUInt32(95,this.borderLineweightOverrideFlag),t.writeUInt32(96,this.borderVisibilityOverrideFlag),t.writeInt16(71,this.attachmentPoint),t.writeInt32(91,this.numRows),t.writeInt32(92,this.numColumns);for(let g=0;g<this.numRows;++g)t.writeDouble(141,this.rowHeight(g));for(let g=0;g<this.numColumns;++g)t.writeDouble(142,this.columnWidth(g));const r=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let g=0;g<r;g++){const d=this._cells[g],f=(d==null?void 0:d.cellType)??(d!=null&&d.blockTableRecordId?2:1);if(t.writeInt16(171,f),t.writeInt16(172,(d==null?void 0:d.flagValue)??0),t.writeInt16(173,(d==null?void 0:d.mergedValue)??0),t.writeBoolean(174,d==null?void 0:d.autoFit),t.writeInt16(175,d==null?void 0:d.borderWidth),t.writeInt16(176,d==null?void 0:d.borderHeight),(d==null?void 0:d.overrideFlag)!=null&&(n?t.writeInt32(91,d.overrideFlag):t.writeInt16(177,d.overrideFlag)),t.writeInt16(178,d==null?void 0:d.virtualEdgeFlag),t.writeAngle(145,d==null?void 0:d.rotation),n&&t.writeInt16(92,d==null?void 0:d.extendedCellFlags),f===1)d!=null&&d.fieldObjetId?t.writeObjectId(344,d.fieldObjetId):this.writeCellText(t,(d==null?void 0:d.text)??"",n,d==null?void 0:d.cellValueBlockBegin);else if(f===2){if(t.writeObjectId(340,d==null?void 0:d.blockTableRecordId),t.writeDouble(144,d==null?void 0:d.blockScale),t.writeInt16(179,d==null?void 0:d.blockAttrNum),(a=d==null?void 0:d.attrDefineId)!=null&&a.length)for(const p of d.attrDefineId)t.writeObjectId(331,p);if((d==null?void 0:d.attrText)!=null)if(Array.isArray(d.attrText))for(const p of d.attrText)t.writeString(300,p);else t.writeString(300,d.attrText)}d!=null&&d.textStyle&&t.writeString(7,d.textStyle),(d==null?void 0:d.textHeight)!=null&&t.writeDouble(140,d.textHeight),(d==null?void 0:d.attachmentPoint)!=null&&t.writeInt16(170,d.attachmentPoint),(d==null?void 0:d.topBorderVisibility)!=null&&t.writeInt16(289,d.topBorderVisibility?1:0),(d==null?void 0:d.rightBorderVisibility)!=null&&t.writeInt16(285,d.rightBorderVisibility?1:0),(d==null?void 0:d.bottomBorderVisibility)!=null&&t.writeInt16(286,d.bottomBorderVisibility?1:0),(d==null?void 0:d.leftBorderVisibility)!=null&&t.writeInt16(288,d.leftBorderVisibility?1:0)}if(t.writeInt16(70,this.flowDirection),t.writeDouble(40,this.horizontalCellMargin),t.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&t.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&t.writeInt16(281,this.suppressHeader?1:0),(l=this.cellTypeOverrides)!=null&&l.length)for(const g of this.cellTypeOverrides){t.writeString(7,g.textStyle),t.writeDouble(140,g.textHeight),t.writeInt16(170,g.alignment),t.writeInt16(63,g.backgroundColor),t.writeInt16(64,g.contentColor),g.backgroundColorEnabled!=null&&t.writeInt16(283,g.backgroundColorEnabled?1:0);const d=g.borderLineweights;d&&(t.writeInt16(274,d.top),t.writeInt16(275,d.right),t.writeInt16(276,d.bottom),t.writeInt16(277,d.left),t.writeInt16(278,d.insideHorizontal),t.writeInt16(279,d.insideVertical));const f=g.borderVisibility;f&&(t.writeInt16(284,f.top?1:0),t.writeInt16(285,f.right?1:0),t.writeInt16(286,f.bottom?1:0),t.writeInt16(287,f.left?1:0),t.writeInt16(288,f.insideHorizontal?1:0),t.writeInt16(289,f.insideVertical?1:0))}if(this.tableBorderColors&&(t.writeInt16(63,this.tableBorderColors.left),t.writeInt16(64,this.tableBorderColors.top),t.writeInt16(65,this.tableBorderColors.insideHorizontal),t.writeInt16(66,this.tableBorderColors.bottom),t.writeInt16(68,this.tableBorderColors.insideVertical),t.writeInt16(69,this.tableBorderColors.right)),(h=this.rowDataTypes)!=null&&h.length)for(const g of this.rowDataTypes)t.writeInt16(97,g);if((c=this.rowUnitTypes)!=null&&c.length)for(const g of this.rowUnitTypes)t.writeInt16(98,g);if((u=this.rowFormats)!=null&&u.length)for(const g of this.rowFormats)t.writeString(4,g);return this}writeCellText(t,e,n,r){if(!n){if(e.length<=250){t.writeString(1,e);return}const a=Math.ceil(e.length/250);for(let l=0;l<a;l++){const h=l*250,c=h+250,u=e.slice(h,c);l===a-1?t.writeString(1,u):t.writeString(2,u)}return}if(t.writeString(301,r??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const o=Math.ceil(e.length/250);for(let a=0;a<o;a++){const l=a*250,h=l+250,c=e.slice(l,h);a===o-1?t.writeString(302,c):t.writeString(303,c)}t.writeString(304,"ACVALUE_END")}};Vs.typeName="Table";let kr=Vs;const xe=new O,Wo=new X,Ce=class Ce extends rt{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=0,this._vertices=[new m,new m,new m,new m]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get area(){return new j(Ce.boundaryPointsFromVertices(this._vertices),!0).area}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new k().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return Ge(t,e,this._vertices),this}subGetOsnapPoints(t,e,n,r){const s=[this._vertices[0],this._vertices[1],this._vertices[3],this._vertices[2]];gi(s,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._elevation=this._vertices[0].z,this}subWorldDraw(t){const e=new j(Ce.boundaryPointsFromVertices(this._vertices),!0),n=new Et;n.add(e);const r=t.subEntityTraits;return r.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),this.thickness!==0&&t.writeDouble(39,this.thickness),t.writePoint3d(10,this.getPointAt(0)),t.writePoint3d(11,this.getPointAt(1)),t.writePoint3d(12,this.getPointAt(2)),t.writePoint3d(13,this.getPointAt(3)),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:pt.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return bi(this.collectBoundary2d(),!0,t)}collectBoundary2d(){return Ce.boundaryPointsFromVertices(this._vertices)}static boundaryPointsFromVertices(t){const e=t[0],n=t[1],r=t[2],s=t[3];return[new S(e.x,e.y),new S(n.x,n.y),new S(s.x,s.y),new S(r.x,r.y)]}};Ce.typeName="Trace";let $n=Ce;const js=class js extends $n{get dxfTypeName(){return"SOLID"}};js.typeName="Solid";let Nr=js;const Ds=class Ds extends V{constructor(){super(...arguments),this._originalDxfName="",this._originalClassName="",this._applicationName="",this._proxyEntityClassId=498,this._applicationEntityClassId=0,this._objectDrawingFormat=0,this._originalDataFormat=0,this._entityOrigins=[],this._worldTransform=new O}get dxfTypeName(){return"ACAD_PROXY_ENTITY"}get originalDxfName(){return this._originalDxfName}set originalDxfName(t){this._originalDxfName=t}get originalClassName(){return this._originalClassName}set originalClassName(t){this._originalClassName=t}get applicationName(){return this._applicationName}set applicationName(t){this._applicationName=t}get proxyEntityClassId(){return this._proxyEntityClassId}set proxyEntityClassId(t){this._proxyEntityClassId=t}get applicationEntityClassId(){return this._applicationEntityClassId}set applicationEntityClassId(t){this._applicationEntityClassId=t}get objectDrawingFormat(){return this._objectDrawingFormat}set objectDrawingFormat(t){this._objectDrawingFormat=t}get graphicsMetafileType(){return this._objectDrawingFormat}set graphicsMetafileType(t){this._objectDrawingFormat=t}get originalDataFormat(){return this._originalDataFormat}set originalDataFormat(t){this._originalDataFormat=t}get proxyGraphic(){return this._proxyGraphic}setProxyGraphic(t){this._proxyGraphic=t?new Uint8Array(t):void 0}get entityOrigins(){return this._entityOrigins}setEntityOrigins(t){this._entityOrigins=t.map(e=>new m(e.x,e.y,e.z))}get geometricExtents(){const t=this._proxyGraphic;if(!(t!=null&&t.length))return new k;const n=new Tr(t,{database:this.database,defaultLayer:this.layer}).scanExtents();if(n){const r=new k().setFromPoints(n);return this._worldTransform.equals(new O)||r.applyMatrix4(this._worldTransform),r}return new k}subGetGripPoints(){if(this._entityOrigins.length>0)return[...this._entityOrigins];const t=this.geometricExtents;return t.isEmpty()?[]:[new m(t.min.x,t.min.y,t.min.z),new m(t.max.x,t.max.y,t.max.z)]}subMoveGripPointsAt(t,e){return this._entityOrigins.length>0?(Ge(t,e,this._entityOrigins),this):this.geometricExtents.isEmpty()?this:(Z(t,r=>{r===0&&this.transformBy(O.makeTranslation(e))}),this)}transformBy(t){return this._entityOrigins.forEach(e=>e.applyMatrix4(t)),this._worldTransform.premultiply(t),this}subWorldDraw(t){const e=this._proxyGraphic;if(!(e!=null&&e.length))return;const r=new Tr(e,{database:this.database,defaultLayer:this.layer}).worldDraw(t);return r&&!this._worldTransform.equals(new O)&&r.applyMatrix(this._worldTransform),r}dxfOutFields(t){var e;if(super.dxfOutFields(t),t.writeSubclassMarker("AcDbProxyEntity"),this._originalDxfName&&t.writeString(1,this._originalDxfName),this._originalClassName&&t.writeString(3,this._originalClassName),t.writeInt32(90,this._proxyEntityClassId||498),this._applicationEntityClassId&&t.writeInt32(91,this._applicationEntityClassId),this._objectDrawingFormat&&t.writeInt32(95,this._objectDrawingFormat),t.writeInt16(70,this._originalDataFormat),(e=this._proxyGraphic)!=null&&e.length){t.writeInt32(160,this._proxyGraphic.length);let n=0;for(;n<this._proxyGraphic.length;){const r=this._proxyGraphic.subarray(n,n+127);t.writeString(310,ws(r)),n+=127}}return this}loadProxyGraphicFromDxf(t,e){const n=Of(t,e);n&&this.setProxyGraphic(n)}};Ds.typeName="ProxyEntity";let Rr=Ds;const Gs=class Gs extends V{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new m}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new k().expandByPoint(this._geo)}subGetGripPoints(){return[this._geo]}subMoveGripPointsAt(t,e){return Yt(t,e,this._geo),this}subGetOsnapPoints(t,e,n,r){t===w.Node&&r.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbPoint"),t.writePoint3d(10,this.position),this}};Gs.typeName="Point";let Xr=Gs;var Xh=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(Xh||{}),Yh=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(Yh||{});const Us=class Us extends V{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new m,this._scale=new W(1,1),this._rotation=0,this._imageSize=new S,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get imageSize(){return this._imageSize}set imageSize(t){this._imageSize.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new k;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subMoveGripPointsAt(t,e){return Z(t,n=>{this.isClipped&&this._clipBoundary.length>3?this.moveClippedBoundaryGripAt(n,e):this.moveUnclippedGripAt(n,e)}),this}subGetOsnapPoints(t,e,n,r){if(t===w.Insertion){r.push(this._position);return}const s=this.boundaryPath();if(s.length===0)return;let o=s;if(s.length>1){const a=s[0],l=s[s.length-1];a.x===l.x&&a.y===l.y&&(a.z||0)===(l.z||0)&&(o=s.slice(0,-1))}if(t===w.EndPoint){r.push(...o);return}gi(o,!0,t,e,r)}subWorldDraw(t){const e=this.boundaryPath();return this._image&&this.isImageShown?t.image(this._image,{boundary:e,roation:this._rotation}):Th(t,e)}transformBy(t){const e=this._width*this._scale.x,n=this._height*this._scale.y,r=new b(e*Math.cos(this._rotation),e*Math.sin(this._rotation),0),s=new b(-n*Math.sin(this._rotation),n*Math.cos(this._rotation),0),o=this._position.clone(),a=this._position.clone().add(r),l=this._position.clone().add(s);o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b(a).sub(o),c=new b(l).sub(o);return this._position.copy(o),this._rotation=Math.atan2(h.y,h.x),this._width=h.length(),this._height=c.length(),this._scale.set(1,1),this}moveUnclippedGripAt(t,e){const n=this._position.x,r=this._position.y,s=this._width,o=this._height;switch(t){case 0:this._position.add(e);break;case 1:{const a=n,l=r+o,h=n+s+e.x,c=r+e.y;this._position.x=a,this._position.y=c,this._width=h-a,this._height=l-c;break}case 2:{const a=n+s+e.x,l=r+o+e.y;this._width=a-n,this._height=l-r;break}case 3:{const a=n+s,l=r,h=n+e.x,c=r+o+e.y;this._position.x=h,this._position.y=l,this._width=a-h,this._height=c-l;break}}}moveClippedBoundaryGripAt(t,e){if(t<0||t>=this._clipBoundary.length)return;const n=this._width,r=this._height,s=new it;s.setFromPoints(this._clipBoundary);const o=new S;o.setX(this._position.x-s.min.x*n),o.setY(this._position.y-s.min.y*r);const a=this._clipBoundary[t],l=a.x*n+o.x+e.x,h=a.y*r+o.y+e.y;a.x=(l-o.x)/n,a.y=(h-o.y)/r}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,n=this._height,r=new it;r.setFromPoints(this._clipBoundary);const s=new S;s.setX(this._position.x-r.min.x*e),s.setY(this._position.y-r.min.y*n),this._clipBoundary.forEach(o=>{const a=o.x*e+s.x,l=o.y*n+s.y;t.push(new m(a,l,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){$o.copy(t[1]);for(let e=1;e<4;e++)Nn.copy(t[e]),Nn.rotateAround($o,this._rotation),t[e].setX(Nn.x),t[e].setY(Nn.y)}t.push(t[0])}return t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImage"),t.writePoint3d(10,this.position);const e=this.width*this.scale.x,n=this.height*this.scale.y,r=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:n},s=r.x>0?e/r.x:e,o=r.y>0?n/r.y:n,a=Math.cos(this._rotation),l=Math.sin(this._rotation);t.writePoint3d(11,{x:s*a,y:s*l,z:0}),t.writePoint3d(12,{x:-o*l,y:o*a,z:0}),t.writePoint2d(13,r),t.writeObjectId(340,this.imageDefId);const h=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,h),t.writeInt16(280,this.isClipped?1:0),t.writeInt16(281,this.brightness),t.writeInt16(282,this.contrast),t.writeInt16(283,this.fade),t.writeInt16(71,this.clipBoundaryType),this.isClipped){t.writeInt16(91,this.clipBoundary.length);for(const c of this.clipBoundary)t.writePoint2d(14,c)}return this}};Us.typeName="RasterImage";let qn=Us;const $o=new S,Nn=new S,oi=class oi extends rt{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new m,this._unitDir=new b}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new k;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return Yt(t,e,this.basePoint),this}subGetOsnapPoints(t,e,n,r){const s=this.basePoint;if(t===w.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ut(s,s.clone().add(o));switch(t){case w.Nearest:{const l=a.project(e),c=new b(l).sub(s).dot(o);r.push(c<0?s:l);break}case w.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRay"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,n=this.unitDir,r=Math.hypot(n.x,n.y);return r<=1e-9||(n.x*(t.y-e.y)-n.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=za(this.basePoint,this.unitDir,t);if(!e)return null;const n=new oi;return n.basePoint=e,n.unitDir=this.unitDir.clone(),n}};oi.typeName="Ray";let Yr=oi;const Hs=class Hs extends V{get dxfTypeName(){return"SHAPE"}constructor(){super(),this._position=new m,this._size=1,this._name="",this._rotation=0,this._widthFactor=1,this._oblique=0,this._thickness=0,this._normal=new b(0,0,1),this._shapeNumber=0,this._styleName=""}get position(){return this._position}set position(t){this._position.copy(t)}get size(){return this._size}set size(t){this._size=t}get name(){return this._name}set name(t){this._name=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get shapeNumber(){return this._shapeNumber}set shapeNumber(t){this._shapeNumber=t}get styleId(){var e,n,r;const t=(r=(n=(e=this.database)==null?void 0:e.tables)==null?void 0:n.textStyleTable)==null?void 0:r.resolveAt(this._styleName);return(t==null?void 0:t.objectId)??""}set styleId(t){var n,r,s;const e=(s=(r=(n=this.database)==null?void 0:n.tables)==null?void 0:r.textStyleTable)==null?void 0:s.getIdAt(t);e&&(this._styleName=e.name)}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get isPlanar(){return!0}get geometricExtents(){const t=Math.abs(this._size)/2,e=new k;return e.expandByPoint(this._position),t>0&&(e.expandByPoint(new m(this._position.x-t,this._position.y-t,this._position.z)),e.expandByPoint(new m(this._position.x+t,this._position.y+t,this._position.z))),e}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return Yt(t,e,this._position),this}subGetOsnapPoints(t,e,n,r){t===w.Insertion&&r.push(this._position)}transformBy(t){const e=new O().setFromExtrusionDirection(this._normal),n=new O().makeRotationZ(this._rotation),r=new O().multiplyMatrices(e,n),s=this._position.clone(),o=new m(this._widthFactor,0,0).applyMatrix4(r).add(s),a=new m(0,1,0).applyMatrix4(r).add(s),l=new m(0,0,1).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),l.applyMatrix4(t);const h=new b(o).sub(s),c=new b(a).sub(s),u=new b(l).sub(s);let g=new b().crossVectors(h,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const f=new O().setFromExtrusionDirection(g).clone().invert(),p=h.clone().applyMatrix4(f),y=c.length(),_=h.length();this._position.copy(s),this._normal.copy(g),_>0&&(this._rotation=Math.atan2(p.y,p.x)),y>0&&(this._size*=y,_>0&&(this._widthFactor*=_/y));const x=u.length();return x>0&&(this._thickness*=x),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"shape",properties:[{name:"name",type:"string",editable:!0,accessor:{get:()=>this.name,set:t=>{this.name=t}}},{name:"size",type:"float",editable:!0,accessor:{get:()=>this.size,set:t=>{this.size=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}},{name:"shapeNumber",type:"int",editable:!0,accessor:{get:()=>this.shapeNumber,set:t=>{this.shapeNumber=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t,e){const n=this.getTextStyle(),r=n?{...n,widthFactor:this.widthFactor,obliqueAngle:this.oblique*180/Math.PI}:void 0,s={...this.renderGlyphIdentity(),size:this.size,position:this._position,rotation:this._rotation,directionVector:this._normal,widthFactor:this.widthFactor};return t.shape(s,r,e)}renderGlyphIdentity(){const t=this._name.trim(),e=Number(t);return t!==""&&Number.isInteger(e)&&e!==0&&String(e)===t?{shapeNumber:e}:{name:t||void 0,shapeNumber:this._shapeNumber!==0?this._shapeNumber:void 0}}getTextStyle(){const t=this.styleName.trim();if(!t)return;const e=this.database.tables.textStyleTable.resolveAt(t);return e==null?void 0:e.textStyle}get dxfShapeIdentity(){const t=this._name.trim();return t||(this._shapeNumber!==0?String(this._shapeNumber):"")}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbShape"),t.writePoint3d(10,this.position),t.writeDouble(40,this.size);const e=this.dxfShapeIdentity;return e&&t.writeString(2,e),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeDouble(39,this.thickness),this._styleName&&t.writeString(3,this._styleName),t.writeVector3d(210,this.normal),this}};Hs.typeName="Shape";let Br=Hs;const Ws=class Ws extends V{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new m,this._height=0,this._width=0,this._viewCenter=new m,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){const t=this._width/2,e=this._height/2,n=new k;return n.expandByPoint(new m(this._centerPoint.x-t,this._centerPoint.y-e,this._centerPoint.z)),n.expandByPoint(new m(this._centerPoint.x+t,this._centerPoint.y+e,this._centerPoint.z)),n}subGetGripPoints(){const t=new Array,e=this._width/2,n=this._height/2,r=this._centerPoint.z;return t.push(this._centerPoint),(e>0||n>0)&&t.push(new m(this._centerPoint.x-e,this._centerPoint.y-n,r),new m(this._centerPoint.x+e,this._centerPoint.y-n,r),new m(this._centerPoint.x+e,this._centerPoint.y+n,r),new m(this._centerPoint.x-e,this._centerPoint.y+n,r)),t}subMoveGripPointsAt(t,e){return Z(t,n=>{this.moveGripAt(n,e)}),this}transformBy(t){const e=this._centerPoint.clone(),n=this._centerPoint.clone().add(new b(this._width,0,0)),r=this._centerPoint.clone().add(new b(0,this._height,0));e.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t);const s=new b(n).sub(e),o=new b(r).sub(e),a=this._height!==0?o.length()/this._height:1;return this._centerPoint.copy(e),this._width=s.length(),this._height=o.length(),this._viewHeight*=a,this}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Ha;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const n=[];return n.push(e.lines([new m(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new m(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),n.push(e.lines([new m(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new m(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),n.push(e.lines([new m(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new m(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),n.push(e.lines([new m(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new m(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),n}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewport"),t.writePoint3d(10,this.centerPoint),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writePoint3d(12,this.viewCenter),t.writeDouble(45,this.viewHeight),t.writeInt32(69,this.number),this}moveGripAt(t,e){switch(t){case 0:this._centerPoint.add(e);break;case 1:case 2:case 3:case 4:{const n=this.width/2,r=this.height/2,s=this._centerPoint.x,o=this._centerPoint.y,a={1:{x:s-n,y:o-r},2:{x:s+n,y:o-r},3:{x:s+n,y:o+r},4:{x:s-n,y:o+r}},l=t===1?3:t===2?4:t===3?1:2,h=a[t],c=a[l];h.x+=e.x,h.y+=e.y,this._centerPoint.x=(h.x+c.x)/2,this._centerPoint.y=(h.y+c.y)/2,this._centerPoint.z=(this._centerPoint.z??0)+(e.z??0),this.width=Math.abs(c.x-h.x),this.height=Math.abs(c.y-h.y);break}}}};Ws.typeName="Viewport";let Fr=Ws;const $s=class $s extends qn{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),n=new Et;return n.add(new j(e)),t.area(n)}dxfOutFields(t){return super.dxfOutFields(t),this}};$s.typeName="Wipeout";let zr=$s;const ai=class ai extends rt{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new m,this._unitDir=new b}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new k;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return Yt(t,e,this.basePoint),this}subGetOsnapPoints(t,e,n,r){const s=this.basePoint;if(t===w.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ut(s,s.clone().add(o));switch(t){case w.Nearest:r.push(a.project(e));break;case w.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXline"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,n=this.unitDir,r=Math.hypot(n.x,n.y);return r<=1e-9||(n.x*(t.y-e.y)-n.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=za(this.basePoint,this.unitDir,t);if(!e)return null;const n=new ai;return n.basePoint=e,n.unitDir=this.unitDir.clone(),n}};ai.typeName="Xline";let Vr=ai;class Bh{constructor(t){this.position=new m(t.x,t.y,t.z||0)}}const qs=class qs extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,n,r=!1,s=!1){super(),this._mCount=t,this._nCount=e,this._closedM=r,this._closedN=s,this._vertices=n.map(o=>new Bh(o))}get mCount(){return this._mCount}get nCount(){return this._nCount}get closedM(){return this._closedM}get closedN(){return this._closedN}get closed(){return this._closedM}get area(){return 0}set closed(t){this._closedM=t}get numberOfVertices(){return this._vertices.length}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getVertexAtMN(t,e){const n=t*this._nCount+e;return this.getVertexAt(n)}get geometricExtents(){if(this._vertices.length===0)return new k(new m(0,0,0),new m(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,n=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),n=Math.min(n,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new k(new m(t,e,n),new m(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return Z(t,n=>{const r=this._vertices[n];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,n,r){switch(t){case w.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"mCount",type:"float",editable:!1,accessor:{get:()=>this._mCount}},{name:"nCount",type:"float",editable:!1,accessor:{get:()=>this._nCount}},{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:t=>{this._closedM=t}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:t=>{this._closedN=t}}}]}]}}subWorldDraw(t){const e=[];for(let n=0;n<this._mCount;n++)for(let r=0;r<this._nCount;r++){const s=this.getVertexAtMN(n,r);let o=r+1;if(o>=this._nCount)if(this._closedN)o=0;else continue;const a=this.getVertexAtMN(n,o);e.push(s.position),e.push(a.position)}for(let n=0;n<this._nCount;n++)for(let r=0;r<this._mCount;r++){const s=this.getVertexAtMN(r,n);let o=r+1;if(o>=this._mCount)if(this._closedM)o=0;else continue;const a=this.getVertexAtMN(o,n);e.push(s.position),e.push(a.position)}return t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolygonMesh");let e=16;return this._closedM&&(e|=1),this._closedN&&(e|=32),t.writeInt16(66,1),t.writeInt16(70,e),t.writeInt32(71,this._mCount),t.writeInt32(72,this._nCount),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;n++){const r=this.getVertexAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolygonMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,16)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:pt.from2dPoints(e,this.isBoundaryClosed()).getOffsetSideAtPoint(t)}createOffsetCurve(t){return bi(this.collectBoundary2d(),this.isBoundaryClosed(),t)}isBoundaryClosed(){return this._closedM&&this._closedN&&this._mCount>1&&this._nCount>1}collectBoundary2d(){const t=this._mCount,e=this._nCount;if(t<1||e<1)return[];const n=[],r=(s,o)=>{const a=this.getVertexAtMN(s,o).position;n.push(new S(a.x,a.y))};if(t===1){for(let s=0;s<e;s++)r(0,s);return n}if(e===1){for(let s=0;s<t;s++)r(s,0);return n}for(let s=0;s<e;s++)r(0,s);for(let s=1;s<t;s++)r(s,e-1);for(let s=e-2;s>=0;s--)r(t-1,s);for(let s=t-2;s>=1;s--)r(s,0);return n}};qs.typeName="PolygonMesh";let jr=qs;class Fh{constructor(t){this.position=new m(t.x,t.y,t.z||0)}}class zh{constructor(t){this.vertexIndices=t}}const Ks=class Ks extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e){super(),this._vertices=t.map(n=>new Fh(n)),this._faces=e.map(n=>new zh(n))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}get area(){return 0}set closed(t){}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getFaceAt(t){if(t<0||t>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[t]}get geometricExtents(){if(this._vertices.length===0)return new k(new m(0,0,0),new m(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,n=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),n=Math.min(n,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new k(new m(t,e,n),new m(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return Z(t,n=>{const r=this._vertices[n];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,n,r){switch(t){case w.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}},{name:"faces",type:"array",editable:!1,itemSchema:{properties:[{name:"vertexIndices",type:"array",editable:!1,itemSchema:{properties:[{name:"index",type:"int",editable:!1}]}}]},accessor:{get:()=>this._faces.map(t=>({vertexIndices:t.vertexIndices}))}}]}]}}subWorldDraw(t){const e=[];return this._faces.forEach(n=>{const r=[];if(n.vertexIndices.forEach(s=>{const o=Math.abs(s)-1;o>=0&&o<this._vertices.length&&r.push(this._vertices[o].position)}),r.length>=3)for(let s=0;s<r.length;s++){const o=r[s],a=r[(s+1)%r.length];e.push(o),e.push(a)}}),t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyFaceMesh");const e=64;return t.writeInt16(66,1),t.writeInt16(70,e),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let n=0;n<this.numberOfVertices;n++){const r=this.getVertexAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,64)}for(let n=0;n<this.numberOfFaces;n++){const r=this.getFaceAt(n);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writeInt16(70,128),r.vertexIndices.forEach((s,o)=>{t.writeInt32(10+o,s)})}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectLargestFaceBoundary2d();return e.length<2?1:pt.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return bi(this.collectLargestFaceBoundary2d(),!0,t)}collectLargestFaceBoundary2d(){let t=[];for(const e of this._faces){const n=e.vertexIndices.filter(r=>r>=0);n.length>t.length&&(t=n)}return t.length<2?this._vertices.map(e=>new S(e.position.x,e.position.y)):t.map(e=>{const n=this.getVertexAt(e).position;return new S(n.x,n.y)})}};Ks.typeName="PolyFaceMesh";let Dr=Ks;var Vh=(i=>(i[i.UTF8=0]="UTF8",i[i.US_ASCII=1]="US_ASCII",i[i.ISO_8859_1=2]="ISO_8859_1",i[i.ISO_8859_2=3]="ISO_8859_2",i[i.ISO_8859_3=4]="ISO_8859_3",i[i.ISO_8859_4=5]="ISO_8859_4",i[i.ISO_8859_5=6]="ISO_8859_5",i[i.ISO_8859_6=7]="ISO_8859_6",i[i.ISO_8859_7=8]="ISO_8859_7",i[i.ISO_8859_8=9]="ISO_8859_8",i[i.ISO_8859_9=10]="ISO_8859_9",i[i.CP437=11]="CP437",i[i.CP850=12]="CP850",i[i.CP852=13]="CP852",i[i.CP855=14]="CP855",i[i.CP857=15]="CP857",i[i.CP860=16]="CP860",i[i.CP861=17]="CP861",i[i.CP863=18]="CP863",i[i.CP864=19]="CP864",i[i.CP865=20]="CP865",i[i.CP869=21]="CP869",i[i.CP932=22]="CP932",i[i.MACINTOSH=23]="MACINTOSH",i[i.BIG5=24]="BIG5",i[i.CP949=25]="CP949",i[i.JOHAB=26]="JOHAB",i[i.CP866=27]="CP866",i[i.ANSI_1250=28]="ANSI_1250",i[i.ANSI_1251=29]="ANSI_1251",i[i.ANSI_1252=30]="ANSI_1252",i[i.GB2312=31]="GB2312",i[i.ANSI_1253=32]="ANSI_1253",i[i.ANSI_1254=33]="ANSI_1254",i[i.ANSI_1255=34]="ANSI_1255",i[i.ANSI_1256=35]="ANSI_1256",i[i.ANSI_1257=36]="ANSI_1257",i[i.ANSI_874=37]="ANSI_874",i[i.ANSI_932=38]="ANSI_932",i[i.ANSI_936=39]="ANSI_936",i[i.ANSI_949=40]="ANSI_949",i[i.ANSI_950=41]="ANSI_950",i[i.ANSI_1361=42]="ANSI_1361",i[i.UTF16=43]="UTF16",i[i.ANSI_1258=44]="ANSI_1258",i[i.UNDEFINED=255]="UNDEFINED",i))(Vh||{});const qf=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],Kf=i=>qf[i];var jh=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(jh||{});const ve=48,qo=8,Zf=48,Dh=80,Gh=32,ji=80,Di=24,Gr=40,Qf=8,Jf=4,Ko=64,tp=64,ep=new Set(["_version","_angbase","_angdir","_aunits","_auprec","_lunits","_luprec","_celtscale","_cecolor","_celtype","_celweight","_cetransparency","_clayer","_cmlstyle","_cmlscale","_cmleaderstyle","_hpbackgroundcolor","_hpcolor","_hplayer","_hptransparency","_textstyle","_extents","_insunits","_unitmode","_measurement","_ltscale","_lwdisplay","_pdmode","_pdsize","_osmode","_orthomode","_maxHandle","_drawNoPlotLayers","_dwgname","_currentSpace","_formatter","_eventBatchDepth","_pendingEntityAppended","_pendingEntityErased","_pendingDictObjectSet","_pendingDictObjectErased","_lastOpenError"]),Uh=new Set(["constructor","prototype","__proto__","caller","callee","arguments"]);function Mt(i,t){let e=i.get(t);return e||(e={bytes:0,count:0},i.set(t,e)),e}function bt(i,t,e,n=0){if(e<=0&&n===0)return;const r=Mt(i.byCategory,t);r.bytes+=e,r.count+=n}function np(i){const t=Object.getPrototypeOf(i);return t===Object.prototype||t===null}function ip(i){return ArrayBuffer.isView(i)}function rp(i){return typeof i.addEventListener=="function"&&typeof i.dispatch=="function"&&"listeners"in i}function sp(i,t,e){return Uh.has(t)?!0:!i.includeEventManagers&&(t==="events"||e==="events")?t==="events":!i.includeTransactionManager&&(t==="transactionManager"||e==="transaction")?t==="transactionManager":!1}function Zo(i,t,e){return t==="_xDataMap"||i==="xdata"?"xdata":t==="_tables"||i==="tables"?e instanceof V?"entities":"tables":t==="_entities"||i==="entities"?"entities":t==="_objects"||i==="objects"?"objects":t==="_handleRegistry"||i==="handleRegistry"?"handleRegistry":t==="transactionManager"||i==="transaction"?"transaction":t==="events"||i==="events"?"events":i==="sysvars"||ep.has(t)?"sysvars":e instanceof V?"entities":i==="other"?"other":i}function op(i){const t=new Set;let e=i;for(;e&&e!==Object.prototype;){for(const n of Object.getOwnPropertyNames(e)){if(Uh.has(n))continue;const r=Object.getOwnPropertyDescriptor(e,n);r&&typeof r.value=="function"||r&&(r.get||r.set)&&r.value===void 0||t.add(n)}if(e=Object.getPrototypeOf(e),e===Object.prototype||e===null||e===Array.prototype||e===Map.prototype||e===Set.prototype)break}return[...t]}function Hh(i){if(i==null)return 0;switch(typeof i){case"number":return Qf;case"boolean":return Jf;case"string":return Gr+i.length*2;case"bigint":return 16;case"symbol":return Gr+String(i.description??"").length*2;default:return 0}}function ap(i,t){if(i.visited.has(t))return 0;i.visited.add(t),i.objectCount+=1;let e=Dh+t.size*Gh;for(const n of t.keys())e+=Hh(n);return bt(i,"handleRegistry",e,1),e}function Ae(i,t,e,n){if(t==null)return 0;const r=typeof t;if(r==="function")return 0;if(r!=="object"){const c=Hh(t);if(bt(i,e,c),n){const u=Mt(i.byEntityType,n);u.bytes+=c}return c}const s=t;if(typeof s.nodeType=="number"||i.visited.has(s))return 0;if(i.visited.add(s),i.objectCount+=1,!i.includeEventManagers&&rp(s))return bt(i,e,ve,1),ve;let o=n,a=e;if(s instanceof V){a="entities",o=s.type,i.entityCount+=1;const c=Mt(i.byEntityType,o);c.count+=1}if(typeof s.then=="function")return bt(i,a,ve,1),ve;if(s instanceof ArrayBuffer){const c=Ko+s.byteLength;return bt(i,a,c,1),o&&(Mt(i.byEntityType,o).bytes+=c),c}if(ip(s)){const c=Ko+s.byteLength;return s.buffer&&!i.visited.has(s.buffer)&&i.visited.add(s.buffer),bt(i,a,c,1),o&&(Mt(i.byEntityType,o).bytes+=c),c}if(typeof Blob<"u"&&s instanceof Blob){const c=tp+s.size;return bt(i,a,c,1),o&&(Mt(i.byEntityType,o).bytes+=c),c}if(s instanceof Date){const c=ve+8;return bt(i,a,c,1),c}if(s instanceof Map){const c=a==="handleRegistry",u=Dh+s.size*Gh;let g=u;bt(i,a,u,1),o&&(Mt(i.byEntityType,o).bytes+=u);for(const[d,f]of s)g+=Ae(i,d,a,o),c||(g+=Ae(i,f,a,o));return g}if(s instanceof Set){let c=ji+s.size*Di;for(const u of s)c+=Ae(i,u,a,o);return bt(i,a,ji+s.size*Di,1),o&&(Mt(i.byEntityType,o).bytes+=ji+s.size*Di),c}if(Array.isArray(s)){let c=Zf+s.length*qo;bt(i,a,c,1),o&&(Mt(i.byEntityType,o).bytes+=c);for(let u=0;u<s.length;u++){const g=s[u],d=Zo(a,String(u),g);c+=Ae(i,g,d,o)}return c}let l=ve;const h=np(s)?Object.getOwnPropertyNames(s):op(s);for(const c of h)l+=qo,l+=Math.min(Gr+c.length*2,64);bt(i,a,l,1),o&&(Mt(i.byEntityType,o).bytes+=l);for(const c of h){if(sp(i,c,a)||c==="_database"||c==="database")continue;let u;try{u=s[c]}catch{continue}if(typeof u=="function")continue;if(c==="_handleRegistry"&&u instanceof Map){l+=ap(i,u);continue}const g=Zo(a,c,u);!i.includeTransactionManager&&g==="transaction"||!i.includeEventManagers&&g==="events"||(l+=Ae(i,u,g,o))}return l}function lp(i,t){const e={visited:new WeakSet,objectCount:0,entityCount:0,byCategory:new Map,byEntityType:new Map,includeTransactionManager:(t==null?void 0:t.includeTransactionManager)===!0,includeEventManagers:(t==null?void 0:t.includeEventManagers)===!0};Ae(e,i,"sysvars",null);let n=0;const r={};for(const[o,a]of e.byCategory)r[o]={bytes:a.bytes,count:a.count},n+=a.bytes;const s={};for(const[o,a]of e.byEntityType)s[o]={bytes:a.bytes,count:a.count};return{totalBytes:n,objectCount:e.objectCount,entityCount:e.entityCount,byCategory:r,byEntityType:s}}function Gi(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(2)} KiB`:`${(i/(1024*1024)).toFixed(2)} MiB`}function hp(i){const t=[`AcDbDatabase memory estimate: ${Gi(i.totalBytes)} (${i.totalBytes} bytes)`,`Objects: ${i.objectCount}, Entities: ${i.entityCount}`,"By category:"],e=Object.entries(i.byCategory).sort((r,s)=>s[1].bytes-r[1].bytes);for(const[r,s]of e)t.push(` ${r}: ${Gi(s.bytes)} (${s.bytes} bytes), count=${s.count}`);const n=Object.entries(i.byEntityType).sort((r,s)=>s[1].bytes-r[1].bytes);if(n.length>0){t.push("By entity type:");for(const[r,s]of n)t.push(` ${r}: ${Gi(s.bytes)} (${s.bytes} bytes), count=${s.count}`)}return t.join(`
|
|
11
|
+
`)}class xs{parse(t){const n=this.normalizeLineEndings(t).split(`
|
|
12
|
+
`),r=[],s=[];let o=null;return n.forEach((a,l)=>{const h=l+1,c=this.stripInlineComment(a).trim();if(!c)return;if(c.startsWith("*")){this.flushCurrentPattern(o,r,s);const g=this.parseHeader(c.slice(1));if(!g){s.push({line:h,message:"Invalid pattern header.",source:a}),o=null;return}o={pattern:{name:g.name,description:g.description,lines:[]},headerLine:h};return}if(!o){s.push({line:h,message:"Line descriptor appears before any pattern header.",source:a});return}const u=this.parseLineDescriptor(c,h);if(!u){s.push({line:h,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:a});return}o.pattern.lines.push(u)}),this.flushCurrentPattern(o,r,s),{patterns:r,issues:s}}static parse(t){return new xs().parse(t)}normalizeLineEndings(t){return t.replace(/\r\n/g,`
|
|
13
13
|
`).replace(/\r/g,`
|
|
14
|
-
`)}stripInlineComment(t){const e=t.indexOf(";");return e<0?t:t.slice(0,e)}parseHeader(t){const e=t.indexOf(",");if(e<0){const s=t.trim();return s?{name:s,description:""}:null}const n=t.slice(0,e).trim(),r=t.slice(e+1).trim();return n?{name:n,description:r}:null}parseNumber(t){const e=Number(t.trim());return Number.isFinite(e)?e:null}parseLineDescriptor(t,e){const n=t.split(",").map(u=>u.trim()).filter(u=>u.length>0);if(n.length<5)return null;const r=this.parseNumber(n[0]),s=this.parseNumber(n[1]),o=this.parseNumber(n[2]),a=this.parseNumber(n[3]),l=this.parseNumber(n[4]);if(r==null||s==null||o==null||a==null||l==null)return null;const h=n.slice(5),c=[];for(const u of h){const g=this.parseNumber(u);if(g==null)return null;c.push(g)}return{angle:r,originX:s,originY:o,deltaX:a,deltaY:l,dashes:c,sourceLine:e}}flushCurrentPattern(t,e,n){t&&(t.pattern.lines.length===0&&n.push({line:t.headerLine,message:`Pattern "${t.pattern.name}" has no line descriptor.`,source:""}),e.push(t.pattern))}}const Y=class Y{static nextGradientId(t){return Y.gradientIdCounter+=1,`acdb-pat-gradient-${t.toLowerCase()}-${Y.gradientIdCounter}`}static packedRgbToCss(t){return`#${(t&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(t,e){return typeof t=="number"?Y.packedRgbToCss(t):t??e}static applyShadeTint(t,e){const n=E.clamp(e,0,1),r=n<.5?0:16777215,s=n<.5?1-n*2:n*2-1,o=t>>16&255,a=t>>8&255,l=t&255,h=r>>16&255,c=r>>8&255,u=r&255;return Math.round(o+(h-o)*s)*65536+Math.round(a+(c-a)*s)*256+Math.round(l+(u-l)*s)}static resolveGradientColors(t){const e="#2563eb",n="#f8fafc",r=Y.gradientColorToCss(t.startColor,e);if(t.oneColorMode&&t.endColor==null){if(typeof t.startColor=="number"){const s=Y.applyShadeTint(t.startColor,t.shadeTintValue??.5);return{start:r,end:Y.packedRgbToCss(s)}}return{start:r,end:(t.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:r,end:Y.gradientColorToCss(t.endColor,n)}}static renderGradientStops(t){return t.map(e=>`<stop offset="${(E.clamp(e.offset,0,1)*100).toFixed(2)}%" stop-color="${e.color}" />`).join("")}static getGradientVector(t){return{x:Math.cos(t),y:-Math.sin(t)}}static isSolidPattern(t){return t.name.trim().toUpperCase()===he}static renderBackground(t,e,n){return`<rect x="${-t/2}" y="${-e/2}" width="${t}" height="${e}" fill="${n}" />`}static estimateUnitScale(t){const e=[];for(const s of t.lines){e.push(Math.abs(s.deltaX),Math.abs(s.deltaY));for(const o of s.dashes)e.push(Math.abs(o))}const n=e.filter(s=>s>Y.EPSILON);if(n.length===0)return 1;const r=n.sort((s,o)=>s-o);return r[Math.floor(r.length/2)]||1}static segmentToSvgPath(t){return`M ${t.x1.toFixed(2)} ${(-t.y1).toFixed(2)} L ${t.x2.toFixed(2)} ${(-t.y2).toFixed(2)}`}static buildDashSegments(t,e,n,r,s,o,a){const l=t.dashes;if(l.length===0)return[{x1:r+o*e,y1:s+a*e,x2:r+o*n,y2:s+a*n}];const h=l.reduce((d,f)=>d+Math.abs(f),0);if(h<=Y.EPSILON)return[{x1:r+o*e,y1:s+a*e,x2:r+o*n,y2:s+a*n}];const c=[],u=Math.ceil((n-e)/h)+2;let g=e-h;for(let d=0;d<u;d++){let f=g;for(const p of l){const m=Math.abs(p),_=f+m;if(p>0||p===0){const v=E.clamp(f,e,n),P=E.clamp(_,e,n);P>v?c.push({x1:r+o*v,y1:s+a*v,x2:r+o*P,y2:s+a*P}):p===0&&v>=e&&v<=n&&c.push({x1:r+o*(v-.35),y1:s+a*(v-.35),x2:r+o*(v+.35),y2:s+a*(v+.35)})}f=_}g+=h}return c}static renderFamily(t,e){const n=E.degToRad(t.angle),r=Math.cos(n),s=Math.sin(n),o=-s,a=r,l=r*t.deltaX+o*t.deltaY,h=s*t.deltaX+a*t.deltaY,c=Math.hypot(l,h),u=c<=Y.EPSILON?1:Math.max(1,Math.ceil(e*2/c)+1),g=Math.floor(u/2),d=-e*1.5,f=e*1.5,p=[];for(let m=-g;m<=g;m++){const _=t.originX+l*m,v=t.originY+h*m,P=Y.buildDashSegments(t,d,f,_,v,r,s);for(const S of P)p.push(Y.segmentToSvgPath(S))}return`<path d="${p.join(" ")}" fill="none" />`}static renderLinearGradientDef(t,e,n,r,s){const o=Y.getGradientVector(e),a=E.clamp(n,-1,1)*r*.5,l=o.x*a,h=o.y*a;return[`<linearGradient id="${t}" gradientUnits="userSpaceOnUse"`,` x1="${(-o.x*r+l).toFixed(2)}"`,` y1="${(-o.y*r+h).toFixed(2)}"`,` x2="${(o.x*r+l).toFixed(2)}"`,` y2="${(o.y*r+h).toFixed(2)}">`,Y.renderGradientStops(s),"</linearGradient>"].join("")}static renderRadialGradientDef(t,e,n,r,s){return[`<radialGradient id="${t}" gradientUnits="userSpaceOnUse"`,` cx="${e.toFixed(2)}" cy="${n.toFixed(2)}" r="${r.toFixed(2)}"`,` fx="${e.toFixed(2)}" fy="${n.toFixed(2)}">`,Y.renderGradientStops(s),"</radialGradient>"].join("")}static renderGradientDef(t,e,n,r,s,o,a){const l=e.toUpperCase(),h=l.startsWith("INV"),c=l.replace(/^INV/,""),u=h?n.end:n.start,g=h?n.start:n.end,d=Math.hypot(o,a)/2,f=Y.getGradientVector(r),p=E.clamp(s,-1,1),m=f.x*p*o*.25,_=f.y*p*a*.25;switch(c){case"CYLINDER":{const v=E.clamp(.5+p*.45,.05,.95);return Y.renderLinearGradientDef(t,r,0,d,[{offset:0,color:u},{offset:v,color:g},{offset:1,color:u}])}case"SPHERICAL":return Y.renderRadialGradientDef(t,m,_,d,[{offset:0,color:g},{offset:1,color:u}]);case"HEMISPHERICAL":return Y.renderRadialGradientDef(t,m+f.x*o*.18,_+f.y*a*.18,d*.92,[{offset:0,color:g},{offset:.72,color:u},{offset:1,color:u}]);case"CURVED":return Y.renderRadialGradientDef(t,-f.x*o*.95+m,-f.y*a*.95+_,d*1.65,[{offset:0,color:u},{offset:.55,color:u},{offset:1,color:g}]);case"LINEAR":default:return Y.renderLinearGradientDef(t,r,s,d,[{offset:0,color:u},{offset:1,color:g}])}}renderPattern(t,e={}){const n=e.width??260,r=e.height??160,s=e.stroke??"#1f2937",o=e.strokeWidth??1.3,a=e.background??"#ffffff",l=`${-n/2} ${-r/2} ${n} ${r}`;if(Y.isSolidPattern(t))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${n}" height="${r}">`,Y.renderBackground(n,r,a),`<rect x="${-n/2}" y="${-r/2}" width="${n}" height="${r}" fill="${s}" />`,"</svg>"].join("");const h=Y.estimateUnitScale(t),u=Math.min(n,r)*.18/Math.max(h,Y.EPSILON),g={...t,lines:t.lines.map(p=>({...p,originX:p.originX*u,originY:p.originY*u,deltaX:p.deltaX*u,deltaY:p.deltaY*u,dashes:p.dashes.map(m=>m*u)}))},d=Math.hypot(n,r)*.75,f=g.lines.map(p=>Y.renderFamily(p,d)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${n}" height="${r}">`,Y.renderBackground(n,r,a),`<g stroke="${s}" stroke-width="${o.toFixed(2)}" stroke-linecap="round">`,f,"</g>","</svg>"].join("")}renderGradient(t,e={}){const n=e.width??260,r=e.height??160,s=e.background??"#ffffff",o=e.angle??0,a=e.shift??0,l=`${-n/2} ${-r/2} ${n} ${r}`,h=Y.nextGradientId(t),c=Y.resolveGradientColors(e),u=Y.renderGradientDef(h,t,c,o,a,n,r);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${n}" height="${r}">`,Y.renderBackground(n,r,s),"<defs>",u,"</defs>",`<rect x="${-n/2}" y="${-r/2}" width="${n}" height="${r}" fill="url(#${h})" />`,"</svg>"].join("")}};Y.EPSILON=1e-9,Y.gradientIdCounter=0;let Er=Y;var jn=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(jn||{});const Cs=class Cs extends z{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new y,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new y,this._textRotation=0,this._normal=new b(0,0,1),this._dimBlockRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new xt),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(t){const e=this._textPosition.clone(),n=this._textPosition.clone().add(new b(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(t),this._textPosition.applyMatrix4(t),this._normal.transformDirection(t);const r=new b(1,0,0).transformDirection(t);r.lengthSq()>0&&(this._dimBlockRotation+=Math.atan2(r.y,r.x)),e.applyMatrix4(t),n.applyMatrix4(t);const s=new b(n).sub(e);return s.lengthSq()>0&&(this._textRotation=Math.atan2(s.y,s.x)),this.subTransformBy(t),this}subGetOsnapPoints(t,e,n,r,s){const o=this.getDimBlockTableRecord();if(!o)return;const a=this.getFullDimBlockTransform(),l=new y(e).applyMatrix4(a.clone().invert()),h=new y(n).applyMatrix4(a.clone().invert()),c=(u,g)=>{const d=[];u.subGetOsnapPoints(t,l,h,d,g,a),u instanceof Re?d.forEach(f=>r.push(f.clone())):d.forEach(f=>r.push(new y(f).applyMatrix4(a)))};if(s){const u=o.getIdAt(s);if(u&&(c(u,s),r.length>0))return}for(const u of o.newIterator())c(u)}subWorldDraw(t){const e=this.getDimBlockTableRecord();if(e){const r=this.computeDimBlockTransform();return ge.instance.draw(t,e,this.resolvedColor,[],!1,r,this._normal)}return t.group([])}getDimBlockGeometricExtents(){const t=new k,e=this.getDimBlockTableRecord();if(!e)return t;for(const n of e.newIterator())t.union(n.geometricExtents);return t.applyMatrix4(this.getFullDimBlockTransform()),t}getGeometricExtentsFromDimBlockOrPoints(t){const e=this.getDimBlockGeometricExtents();if(!e.isEmpty())return e;const n=new k;for(const r of t)n.expandByPoint(r);return this.hasExplicitTextPosition()&&n.expandByPoint(this.textPosition),n}hasExplicitTextPosition(){const{x:t,y:e,z:n}=this.textPosition;return t!==0||e!==0||n!==0}collectDimensionDefinitionGripPoints(){return[]}subGetGripPoints(){return this.collectDimensionDefinitionGripPoints().concat([this.textPosition])}subMoveGripPointsAt(t,e){const n=this.collectDimensionDefinitionGripPoints();return Z(t,r=>{r>=0&&r<n.length?n[r].add(e):r===n.length&&this.textPosition.add(e)}),this}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",t=>{this.dimensionStyleName=t.trim()===""?null:t}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",t=>{this.dimensionText=t}),this.createProperty("measurement","float",()=>this.getMeasurementPropertyValue()),this.createProperty("dimBlockId","string",()=>this.dimBlockId??""),...this.createPoint3dProperties("dimBlockPosition",()=>this.dimBlockPosition),...this.createPoint3dProperties("textPosition",()=>this.textPosition),this.createProperty("textRotation","float",()=>this.textRotation,t=>{this.textRotation=t}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,t=>{this.textLineSpacingFactor=t}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,t=>{this.textLineSpacingStyle=t},[{label:jn[1],value:1},{label:jn[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(t,e,n,r,s){return{name:t,type:e,editable:r!=null,options:s,accessor:r?{get:n,set:r}:{get:n}}}createPoint3dProperties(t,e){return[this.createProperty(`${t}X`,"float",()=>e().x,n=>{e().x=n}),this.createProperty(`${t}Y`,"float",()=>e().y,n=>{e().y=n}),this.createProperty(`${t}Z`,"float",()=>e().z,n=>{e().z=n})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const t=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return t;const e=new C().setFromExtrusionDirection(this._normal);return new C().multiplyMatrices(e,t)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}findPointOnLine1(t,e,n){const r=new y().subVectors(e,t).normalize();return new y(e).addScaledVector(r,n)}findPointOnLine2(t,e,n){const r=t.x+n*Math.cos(e),s=t.y+n*Math.sin(e);return{x:r,y:s}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():exports.AcGiArrowType.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??y.ORIGIN,n=new C().makeTranslation(-e.x,-e.y,-e.z),r=new C().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z),s=new C().makeRotationZ(this._dimBlockRotation);return new C().multiplyMatrices(r,new C().multiplyMatrices(s,n))}subTransformBy(t){}dxfOutFields(t){super.dxfOutFields(t);const e=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return t.writeSubclassMarker("AcDbDimension"),t.writeInt16(280,0),t.writeString(2,this.dimBlockId??void 0),t.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),t.writePoint3d(10,this.dimBlockPosition),t.writeString(1,this.dimensionText??""),t.writeAngle(53,this.textRotation),t.writePoint3d(11,this.textPosition),t.writeInt16(70,0),t.writeInt16(72,this.textLineSpacingStyle),t.writeDouble(41,this.textLineSpacingFactor),t.writeDouble(42,this.measurement),t.writeVector3d(210,this.normal),t.writeObjectId(340,e==null?void 0:e.objectId),this}};Cs.typeName="Dimension";let zt=Cs;const ks=class ks extends zt{constructor(t,e,n,r,s=null,o=null){super(),this._centerPoint=new y().copy(t),this._xLine1Point=new y().copy(e),this._xLine2Point=new y().copy(n),this._arcPoint=new y().copy(r),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDb3PointAngularDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};ks.typeName="3PointAngularDimension";let Ir=ks;const Os=class Os extends zt{constructor(t,e,n,r=null,s=null){super(),this._dimLinePoint=new y().copy(n),this._xLine1Point=new y().copy(t),this._xLine2Point=new y().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),r?this.dimensionText=r:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=s}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("dimLinePoint",()=>this.dimLinePoint),this.createProperty("rotation","float",()=>this.rotation,e=>{this.rotation=e}),this.createProperty("oblique","float",()=>this.oblique,e=>{this.oblique=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.xLine1Point,this.xLine2Point,this.dimLinePoint]}subMoveGripPointsAt(t,e){return super.subMoveGripPointsAt(t,e),this.calculateRotation(),this}subTransformBy(t){this._dimLinePoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t),this.calculateRotation()}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.dimLinePoint])}get isAppendArrow(){return!1}createDimBlock(t){const e=new J;e.name=t;const n=this.createLines();n.forEach(a=>e.appendEntity(new Bn(a.startPoint,a.endPoint))),this.createArrows(n[0]).forEach(a=>e.appendEntity(a));const s=n[0].midPoint,o=this.createMText(s,this._rotation);return o&&e.appendEntity(o),e}createMText(t,e){const n=r=>({x:Math.cos(r),y:Math.sin(r),z:0});if(this.dimensionText){const r=new Be;return r.attachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,r.layer="0",r.color=new O(exports.AcCmColorMethod.ByBlock),r.location=t,r.contents=this.dimensionText??"",r.height=10,r.direction=n(e),r.styleName=this.dimensionStyle.dimtxsty,r}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,n){const r="_CAXARROW",s=new Re(r);return s.position=t,s.rotation=e,s.scaleFactors={x:n,y:n,z:n},s}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),n=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(e,this._dimLinePoint),s=this.findIntersectionPoint(n,this._dimLinePoint),o=new Ft(r,s);return t.push(o),e.endPoint=r,this.adjustExtensionLine(e),t.push(e),n.endPoint=s,this.adjustExtensionLine(n),t.push(n),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,n=this.findPointOnLine2(t,e,100);return new Ft(t,{...n,z:t.z})}findIntersectionPoint(t,e){const n=t.startPoint,r=t.endPoint,s=new b().subVectors(r,n).normalize(),a=new b().subVectors(e,n).dot(s),l=new b().copy(s).multiplyScalar(a);return new b().addVectors(n,l)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,n=e.x-t.x,r=e.y-t.y;this._rotation=Math.atan2(r,n)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker(this.dxfSubclassMarker),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.dimLinePoint),t.writeAngle(50,this.rotation),t.writeAngle(52,this.oblique),this}};Os.typeName="AlignedDimension";let Dn=Os;const Ns=class Ns extends zt{constructor(t,e,n,r,s=null,o=null){super(),this._arcPoint=new y().copy(r),this._xLine1Point=new y().copy(e),this._xLine2Point=new y().copy(n),this._centerPoint=new y().copy(t),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArcDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Ns.typeName="ArcDimension";let Mr=Ns;const Xs=class Xs extends zt{constructor(t,e,n=0,r=null,s=null){super(),this._chordPoint=new y().copy(t),this._farChordPoint=new y().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=n,this.dimensionText=r,this.dimensionStyleName=s}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.chordPoint,this.farChordPoint]}subTransformBy(t){this._chordPoint.applyMatrix4(t),this._farChordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){const t=[this.chordPoint,this.farChordPoint];if(this.leaderLength>0){const e=this.farChordPoint.clone().sub(this.chordPoint);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.farChordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbDiametricDimension"),t.writePoint3d(15,this.chordPoint),t.writePoint3d(16,this.farChordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Xs.typeName="DiametricDimension";let Tr=Xs;const Ys=class Ys extends zt{constructor(t,e,n=null,r=null){super(),this._definingPoint=new y().copy(t),this._leaderEndPoint=new y().copy(e),this.dimensionText=n,this.dimensionStyleName=r}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.definingPoint,this.leaderEndPoint]}subTransformBy(t){this._definingPoint.applyMatrix4(t),this._leaderEndPoint.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.definingPoint,this.leaderEndPoint])}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};Ys.typeName="OrdinateDimension";let Cr=Ys;const Rs=class Rs extends zt{constructor(t,e,n,r=null,s=null){super(),this._center=new y().copy(t),this._chordPoint=new y().copy(e),this._leaderLength=n,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=s}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}set leaderLenght(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.center,this.chordPoint]}subTransformBy(t){this._center.applyMatrix4(t),this._chordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){const t=[this.center,this.chordPoint];if(this.leaderLength>0){const e=this.chordPoint.clone().sub(this.center);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.chordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRadialDimension"),t.writePoint3d(15,this.center),t.writePoint3d(13,this.chordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Rs.typeName="RadialDimension";let kr=Rs;const Bs=class Bs extends Dn{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};Bs.typeName="RotatedDimension";let Or=Bs;class af extends gt{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImageDef"),t.writeString(1,this.sourceFileName),t.writeInt16(280,1),t.writeInt16(281,0),this}}var gh=(i=>(i[i.NotApplicable=0]="NotApplicable",i[i.Ignore=1]="Ignore",i[i.Replace=2]="Replace",i[i.XrefMangleName=3]="XrefMangleName",i[i.MangleName=4]="MangleName",i))(gh||{});class lf extends gt{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXrecord"),t.writeInt16(280,1),t.writeResultBuffer(this.data),this}}exports.ACAD_APPID=Vi;exports.ACDB_GRIPCOLOR_DEFAULT=Ia;exports.ACDB_GRIPCOLOR_MAX=Di;exports.ACDB_GRIPCOLOR_MIN=ji;exports.ACDB_GRIPHOT_DEFAULT=Ma;exports.ACDB_GRIPHOT_MAX=Hi;exports.ACDB_GRIPHOT_MIN=Gi;exports.ACDB_GRIPOBJLIMIT_MAX=Su;exports.ACDB_GRIPOBJLIMIT_MIN=Au;exports.ACDB_GRIPSIZE_DEFAULT=Ta;exports.ACDB_GRIPSIZE_MAX=Ui;exports.ACDB_GRIPSIZE_MIN=Wi;exports.ACDB_GRIPS_MAX=Eu;exports.ACDB_GRIPS_MIN=Lu;exports.ACDB_PROXY_GRAPHIC_CHUNK_SIZE=jg;exports.ACGI_DARK_THEME_FOREGROUND=nn;exports.ACGI_LIGHT_THEME_FOREGROUND=rn;exports.ACGI_MODEL_SPACE_BACKGROUND=va;exports.ACGI_PAPER_SPACE_BACKGROUND=du;exports.ACTIVE_VPORT_NAME=Ne;exports.AC_DB_SYSTEM_VARIABLE_NAMES=Ou;exports.AcCmColor=O;exports.AcCmColorUtil=Ht;exports.AcCmEntityColor=mh;exports.AcCmErrors=ut;exports.AcCmEventDispatcher=_h;exports.AcCmEventManager=U;exports.AcCmLoader=Oh;exports.AcCmLoadingManager=Xo;exports.AcCmObject=ki;exports.AcCmPerformanceCollector=Xr;exports.AcCmTask=Oo;exports.AcCmTaskScheduler=No;exports.AcCmTransparency=Q;exports.AcDb2dPolyline=Qi;exports.AcDb2dVertex=Ji;exports.AcDb2dVertexType=Cl;exports.AcDb3PointAngularDimension=Ir;exports.AcDb3dPolyline=tr;exports.AcDb3dSolid=nr;exports.AcDb3dVertex=ir;exports.AcDb3dVertexType=zl;exports.AcDbAbstractViewTableRecord=Jr;exports.AcDbAlignedDimension=Dn;exports.AcDbAngleUnits=ct;exports.AcDbArc=rr;exports.AcDbArcDimension=Mr;exports.AcDbAttribute=or;exports.AcDbAttributeDefinition=sr;exports.AcDbAttributeFlags=lt;exports.AcDbAttributeMTextFlag=Wt;exports.AcDbBaseWorker=Ru;exports.AcDbBatchProcessing=ja;exports.AcDbBlockReference=Re;exports.AcDbBlockScaling=Ca;exports.AcDbBlockTable=pl;exports.AcDbBlockTableRecord=J;exports.AcDbBlockTableRecordFlag=ka;exports.AcDbChangeApplier=Al;exports.AcDbChangeRecorder=Sl;exports.AcDbCircle=ar;exports.AcDbCodePage=ah;exports.AcDbCurve=it;exports.AcDbDataGenerator=sl;exports.AcDbDatabase=Zi;exports.AcDbDatabaseConverter=Wa;exports.AcDbDatabaseConverterManager=Et;exports.AcDbDatabaseTransaction=Ll;exports.AcDbDatabaseTransactionManager=Il;exports.AcDbDiametricDimension=Tr;exports.AcDbDictionary=se;exports.AcDbDimArrowType=lh;exports.AcDbDimStyleTable=yl;exports.AcDbDimStyleTableRecord=xt;exports.AcDbDimTextHorizontal=Ka;exports.AcDbDimTextVertical=$r;exports.AcDbDimVerticalJustification=Ja;exports.AcDbDimZeroSuppression=Za;exports.AcDbDimZeroSuppressionAngular=Qa;exports.AcDbDimension=zt;exports.AcDbDuplicateRecordCloning=gh;exports.AcDbDwgVersion=Rt;exports.AcDbDxfCode=Nr;exports.AcDbDxfFiler=Ro;exports.AcDbEllipse=lr;exports.AcDbEntity=z;exports.AcDbFace=hr;exports.AcDbFcf=cr;exports.AcDbFileType=$e;exports.AcDbFontNameCollector=bt;exports.AcDbFormatter=ol;exports.AcDbGradientPatternType=rl;exports.AcDbHatch=Yn;exports.AcDbHatchObjectType=il;exports.AcDbHatchPatternType=Ke;exports.AcDbHatchStyle=nl;exports.AcDbHostApplicationServices=Xn;exports.AcDbLayerTable=ml;exports.AcDbLayerTableRecord=ii;exports.AcDbLayout=ni;exports.AcDbLayoutDictionary=Pl;exports.AcDbLayoutManager=za;exports.AcDbLeader=ur;exports.AcDbLeaderAnnotationType=Wl;exports.AcDbLine=Bn;exports.AcDbLineSpacingStyle=jn;exports.AcDbLinearUnits=W;exports.AcDbLinetypeTable=_l;exports.AcDbLinetypeTableRecord=ue;exports.AcDbMLeader=gr;exports.AcDbMLeaderContentType=Le;exports.AcDbMLeaderDirectionType=Kl;exports.AcDbMLeaderLineType=Ze;exports.AcDbMLeaderStyle=gl;exports.AcDbMLeaderTextAttachmentDirection=ql;exports.AcDbMLine=dr;exports.AcDbMLineFlags=$l;exports.AcDbMLineJustification=Ul;exports.AcDbMText=Be;exports.AcDbMlineStyle=fl;exports.AcDbObject=gt;exports.AcDbObjectIterator=Xe;exports.AcDbOpenDatabaseError=ln;exports.AcDbOpenMode=Ye;exports.AcDbOrdinateDimension=Cr;exports.AcDbOsnapMode=x;exports.AcDbPatParser=rs;exports.AcDbPatSvgRenderer=Er;exports.AcDbPlotPaperUnits=Oa;exports.AcDbPlotRotation=Na;exports.AcDbPlotSettings=Fa;exports.AcDbPlotShadePlotResLevel=Ya;exports.AcDbPlotShadePlotType=Ra;exports.AcDbPlotStdScaleType=Ba;exports.AcDbPlotType=Xa;exports.AcDbPoint=_r;exports.AcDbPoly2dType=Tl;exports.AcDbPoly3dType=kl;exports.AcDbPolyFaceMesh=Sr;exports.AcDbPolyFaceMeshFace=oh;exports.AcDbPolyFaceMeshVertex=sh;exports.AcDbPolygonMesh=Ar;exports.AcDbPolygonMeshVertex=rh;exports.AcDbPolyline=ft;exports.AcDbPredefinedAcadIsoPat=el;exports.AcDbPredefinedAcadPat=Hu;exports.AcDbProxyEntity=mr;exports.AcDbProxyGraphic=yr;exports.AcDbProxyGraphicBitStream=Ql;exports.AcDbProxyGraphicByteStream=yt;exports.AcDbProxyGraphicEndOfBufferError=Qt;exports.AcDbProxyGraphicType=th;exports.AcDbRadialDimension=kr;exports.AcDbRasterImage=Vn;exports.AcDbRasterImageClipBoundaryType=nh;exports.AcDbRasterImageDef=af;exports.AcDbRasterImageImageDisplayOpt=ih;exports.AcDbRay=br;exports.AcDbRegAppTable=vl;exports.AcDbRegAppTableRecord=qi;exports.AcDbRegenerator=Ua;exports.AcDbRenderingCache=ge;exports.AcDbResultBuffer=Ur;exports.AcDbRotatedDimension=Or;exports.AcDbShape=xr;exports.AcDbSolid=pr;exports.AcDbSpline=Fn;exports.AcDbSymbolTable=Vt;exports.AcDbSymbolTableRecord=ee;exports.AcDbSysVarManager=tt;exports.AcDbSystemVariables=w;exports.AcDbTable=fr;exports.AcDbText=un;exports.AcDbTextHorizontalMode=Gl;exports.AcDbTextStyleTable=bl;exports.AcDbTextStyleTableRecord=qr;exports.AcDbTextVerticalMode=Hl;exports.AcDbTrace=zn;exports.AcDbTransaction=ts;exports.AcDbTransactionManager=Pd;exports.AcDbUndoStack=El;exports.AcDbUnitsValue=G;exports.AcDbViewTable=xl;exports.AcDbViewTableRecord=Ad;exports.AcDbViewport=wr;exports.AcDbViewportTable=wl;exports.AcDbViewportTableRecord=de;exports.AcDbWipeout=vr;exports.AcDbWorkerApi=qa;exports.AcDbWorkerManager=$a;exports.AcDbXline=Pr;exports.AcDbXrecord=lf;exports.AcGeArea2d=kt;exports.AcGeBox2d=nt;exports.AcGeBox3d=k;exports.AcGeCatmullRomCurve3d=wa;exports.AcGeCircArc2d=ht;exports.AcGeCircArc3d=It;exports.AcGeCurve2d=Fe;exports.AcGeEllipseArc2d=le;exports.AcGeEllipseArc3d=Hr;exports.AcGeEuler=Uh;exports.AcGeGeometryUtil=st;exports.AcGeLine2d=Mt;exports.AcGeLine3d=Ft;exports.AcGeLoop2d=Wr;exports.AcGeMathUtil=E;exports.AcGeMatrix2d=dn;exports.AcGeMatrix3d=C;exports.AcGeNurbsCurve=pt;exports.AcGePlane=jr;exports.AcGePoint2d=A;exports.AcGePoint3d=y;exports.AcGePolyline2d=V;exports.AcGeQuaternion=ke;exports.AcGeShape2d=Gr;exports.AcGeSpline3d=Tt;exports.AcGeTol=D;exports.AcGeVector2d=H;exports.AcGeVector3d=b;exports.AcGiContext=ei;exports.AcGiViewport=Aa;exports.AcTrStringUtil=kh;exports.ByBlock=Ct;exports.ByLayer=K;exports.DEBUG_MODE=Ih;exports.DEFAULT_ACGI_CONTEXT=fu;exports.DEFAULT_GRADIENT_HATCH_NAME=Ea;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=_u;exports.DEFAULT_HATCH_PATTERN_METRIC=Sa;exports.DEFAULT_LINE_TYPE=Jt;exports.DEFAULT_MLEADER_STYLE=Zt;exports.DEFAULT_MLINE_STYLE=Kt;exports.DEFAULT_TEXT_STYLE=q;exports.DEFAULT_TOL=ti;exports.DEG2RAD=Yr;exports.DefaultLoadingManager=Yo;exports.FLOAT_TOL=Xt;exports.HATCH_PATTERN_SOLID=he;exports.HATCH_PATTERN_USER=La;exports.MLIGHTCAD_APPID=zi;exports.ORIGIN_POINT_2D=Rh;exports.ORIGIN_POINT_3D=Vr;exports.RAD2DEG=Rr;exports.RAW_COLOR_TYPE_ACI=oi;exports.RAW_COLOR_TYPE_BY_BLOCK=an;exports.RAW_COLOR_TYPE_BY_LAYER=ri;exports.RAW_COLOR_TYPE_RGB=si;exports.RAW_COLOR_TYPE_WINDOW_BG=dl;exports.TAU=R;exports.TEMP_OBJECT_ID_PREFIX=qt;exports.VPORT_FALLBACK_CENTER_2D=bu;exports.VPORT_FALLBACK_LLC=xu;exports.VPORT_FALLBACK_URC=wu;exports.VPORT_FALLBACK_VIEW_DIR=vu;exports.VPORT_FALLBACK_VIEW_TARGET=Pu;exports.acdbDisableOsnapMode=Gu;exports.acdbEnableOsnapMode=Du;exports.acdbEstimateDatabaseMemory=sf;exports.acdbFormatMemoryBytes=Cn;exports.acdbFormatMemoryEstimate=of;exports.acdbHasOsnapMode=ju;exports.acdbHostApplicationServices=Va;exports.acdbMaskToOsnapModes=zu;exports.acdbOsnapModesToMask=Fu;exports.acdbToggleOsnapMode=Vu;exports.acgiContrastingForegroundColor=yu;exports.acgiForegroundColorForBackground=pu;exports.acgiIsLightBackground=Pa;exports.acgiResolveSubEntityTraitsRgbFromBackground=mu;exports.basisFunction=te;exports.bytesToHexString=Jl;exports.calculateCurveLength=aa;exports.ceilPowerOfTwo=ta;exports.clamp=Yt;exports.clone=Ge;exports.collectChangeEntities=Ki;exports.computeParameterValues=sa;exports.createWorkerApi=Yu;exports.damp=Do;exports.decodeMLeaderStyleRawColor=fd;exports.deepClone=Ci;exports.defaults=Pt;exports.degToRad=Zo;exports.dwgCodePageToEncoding=Wg;exports.encodeMLeaderStyleRawColor=Mn;exports.euclideanModulo=Br;exports.evaluateNurbsPoint=Ue;exports.floorPowerOfTwo=ea;exports.generateAveragedKnots=oa;exports.generateChordKnots=Jh;exports.generateSqrtChordKnots=tc;exports.generateUUID=zo;exports.generateUniformKnots=Qh;exports.getOcsAngle=Bt;exports.getOcsReferenceVector=en;exports.has=To;exports.hexStringsToBytes=Vg;exports.intPartLength=zr;exports.interpolateControlPoints=rc;exports.interpolateNurbsCurve=Dr;exports.inverseLerp=jo;exports.isBetween=na;exports.isBetweenAngle=ia;exports.isEmpty=Co;exports.isEqual=ce;exports.isImperialUnits=Ga;exports.isMetricUnits=Da;exports.isPowerOfTwo=Jo;exports.lerp=Fr;exports.loadAcDbProxyGraphicFromDxf=eh;exports.log=He;exports.mapLinear=Vo;exports.normalizeAngle=We;exports.pingpong=Go;exports.radToDeg=Qo;exports.randFloat=$o;exports.randFloatSpread=qo;exports.randInt=Uo;exports.relativeEps=ra;exports.seededRandom=Ko;exports.setAcDbHostApplicationServicesProvider=Fo;exports.setAcDbLayoutManagerFactory=Mu;exports.setLogLevel=Mh;exports.smootherstep=Wo;exports.smoothstep=Ho;exports.transformOcsPointToWcs=Ni;exports.transformWcsPointToOcs=Oe;
|
|
14
|
+
`)}stripInlineComment(t){const e=t.indexOf(";");return e<0?t:t.slice(0,e)}parseHeader(t){const e=t.indexOf(",");if(e<0){const s=t.trim();return s?{name:s,description:""}:null}const n=t.slice(0,e).trim(),r=t.slice(e+1).trim();return n?{name:n,description:r}:null}parseNumber(t){const e=Number(t.trim());return Number.isFinite(e)?e:null}parseLineDescriptor(t,e){const n=t.split(",").map(u=>u.trim()).filter(u=>u.length>0);if(n.length<5)return null;const r=this.parseNumber(n[0]),s=this.parseNumber(n[1]),o=this.parseNumber(n[2]),a=this.parseNumber(n[3]),l=this.parseNumber(n[4]);if(r==null||s==null||o==null||a==null||l==null)return null;const h=n.slice(5),c=[];for(const u of h){const g=this.parseNumber(u);if(g==null)return null;c.push(g)}return{angle:r,originX:s,originY:o,deltaX:a,deltaY:l,dashes:c,sourceLine:e}}flushCurrentPattern(t,e,n){t&&(t.pattern.lines.length===0&&n.push({line:t.headerLine,message:`Pattern "${t.pattern.name}" has no line descriptor.`,source:""}),e.push(t.pattern))}}const B=class B{static nextGradientId(t){return B.gradientIdCounter+=1,`acdb-pat-gradient-${t.toLowerCase()}-${B.gradientIdCounter}`}static packedRgbToCss(t){return`#${(t&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(t,e){return typeof t=="number"?B.packedRgbToCss(t):t??e}static applyShadeTint(t,e){const n=T.clamp(e,0,1),r=n<.5?0:16777215,s=n<.5?1-n*2:n*2-1,o=t>>16&255,a=t>>8&255,l=t&255,h=r>>16&255,c=r>>8&255,u=r&255;return Math.round(o+(h-o)*s)*65536+Math.round(a+(c-a)*s)*256+Math.round(l+(u-l)*s)}static resolveGradientColors(t){const e="#2563eb",n="#f8fafc",r=B.gradientColorToCss(t.startColor,e);if(t.oneColorMode&&t.endColor==null){if(typeof t.startColor=="number"){const s=B.applyShadeTint(t.startColor,t.shadeTintValue??.5);return{start:r,end:B.packedRgbToCss(s)}}return{start:r,end:(t.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:r,end:B.gradientColorToCss(t.endColor,n)}}static renderGradientStops(t){return t.map(e=>`<stop offset="${(T.clamp(e.offset,0,1)*100).toFixed(2)}%" stop-color="${e.color}" />`).join("")}static getGradientVector(t){return{x:Math.cos(t),y:-Math.sin(t)}}static isSolidPattern(t){return t.name.trim().toUpperCase()===ge}static renderBackground(t,e,n){return`<rect x="${-t/2}" y="${-e/2}" width="${t}" height="${e}" fill="${n}" />`}static estimateUnitScale(t){const e=[];for(const s of t.lines){e.push(Math.abs(s.deltaX),Math.abs(s.deltaY));for(const o of s.dashes)e.push(Math.abs(o))}const n=e.filter(s=>s>B.EPSILON);if(n.length===0)return 1;const r=n.sort((s,o)=>s-o);return r[Math.floor(r.length/2)]||1}static segmentToSvgPath(t){return`M ${t.x1.toFixed(2)} ${(-t.y1).toFixed(2)} L ${t.x2.toFixed(2)} ${(-t.y2).toFixed(2)}`}static buildDashSegments(t,e,n,r,s,o,a){const l=t.dashes;if(l.length===0)return[{x1:r+o*e,y1:s+a*e,x2:r+o*n,y2:s+a*n}];const h=l.reduce((d,f)=>d+Math.abs(f),0);if(h<=B.EPSILON)return[{x1:r+o*e,y1:s+a*e,x2:r+o*n,y2:s+a*n}];const c=[],u=Math.ceil((n-e)/h)+2;let g=e-h;for(let d=0;d<u;d++){let f=g;for(const p of l){const y=Math.abs(p),_=f+y;if(p>0||p===0){const x=T.clamp(f,e,n),P=T.clamp(_,e,n);P>x?c.push({x1:r+o*x,y1:s+a*x,x2:r+o*P,y2:s+a*P}):p===0&&x>=e&&x<=n&&c.push({x1:r+o*(x-.35),y1:s+a*(x-.35),x2:r+o*(x+.35),y2:s+a*(x+.35)})}f=_}g+=h}return c}static renderFamily(t,e){const n=T.degToRad(t.angle),r=Math.cos(n),s=Math.sin(n),o=-s,a=r,l=r*t.deltaX+o*t.deltaY,h=s*t.deltaX+a*t.deltaY,c=Math.hypot(l,h),u=c<=B.EPSILON?1:Math.max(1,Math.ceil(e*2/c)+1),g=Math.floor(u/2),d=-e*1.5,f=e*1.5,p=[];for(let y=-g;y<=g;y++){const _=t.originX+l*y,x=t.originY+h*y,P=B.buildDashSegments(t,d,f,_,x,r,s);for(const A of P)p.push(B.segmentToSvgPath(A))}return`<path d="${p.join(" ")}" fill="none" />`}static renderLinearGradientDef(t,e,n,r,s){const o=B.getGradientVector(e),a=T.clamp(n,-1,1)*r*.5,l=o.x*a,h=o.y*a;return[`<linearGradient id="${t}" gradientUnits="userSpaceOnUse"`,` x1="${(-o.x*r+l).toFixed(2)}"`,` y1="${(-o.y*r+h).toFixed(2)}"`,` x2="${(o.x*r+l).toFixed(2)}"`,` y2="${(o.y*r+h).toFixed(2)}">`,B.renderGradientStops(s),"</linearGradient>"].join("")}static renderRadialGradientDef(t,e,n,r,s){return[`<radialGradient id="${t}" gradientUnits="userSpaceOnUse"`,` cx="${e.toFixed(2)}" cy="${n.toFixed(2)}" r="${r.toFixed(2)}"`,` fx="${e.toFixed(2)}" fy="${n.toFixed(2)}">`,B.renderGradientStops(s),"</radialGradient>"].join("")}static renderGradientDef(t,e,n,r,s,o,a){const l=e.toUpperCase(),h=l.startsWith("INV"),c=l.replace(/^INV/,""),u=h?n.end:n.start,g=h?n.start:n.end,d=Math.hypot(o,a)/2,f=B.getGradientVector(r),p=T.clamp(s,-1,1),y=f.x*p*o*.25,_=f.y*p*a*.25;switch(c){case"CYLINDER":{const x=T.clamp(.5+p*.45,.05,.95);return B.renderLinearGradientDef(t,r,0,d,[{offset:0,color:u},{offset:x,color:g},{offset:1,color:u}])}case"SPHERICAL":return B.renderRadialGradientDef(t,y,_,d,[{offset:0,color:g},{offset:1,color:u}]);case"HEMISPHERICAL":return B.renderRadialGradientDef(t,y+f.x*o*.18,_+f.y*a*.18,d*.92,[{offset:0,color:g},{offset:.72,color:u},{offset:1,color:u}]);case"CURVED":return B.renderRadialGradientDef(t,-f.x*o*.95+y,-f.y*a*.95+_,d*1.65,[{offset:0,color:u},{offset:.55,color:u},{offset:1,color:g}]);case"LINEAR":default:return B.renderLinearGradientDef(t,r,s,d,[{offset:0,color:u},{offset:1,color:g}])}}renderPattern(t,e={}){const n=e.width??260,r=e.height??160,s=e.stroke??"#1f2937",o=e.strokeWidth??1.3,a=e.background??"#ffffff",l=`${-n/2} ${-r/2} ${n} ${r}`;if(B.isSolidPattern(t))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${n}" height="${r}">`,B.renderBackground(n,r,a),`<rect x="${-n/2}" y="${-r/2}" width="${n}" height="${r}" fill="${s}" />`,"</svg>"].join("");const h=B.estimateUnitScale(t),u=Math.min(n,r)*.18/Math.max(h,B.EPSILON),g={...t,lines:t.lines.map(p=>({...p,originX:p.originX*u,originY:p.originY*u,deltaX:p.deltaX*u,deltaY:p.deltaY*u,dashes:p.dashes.map(y=>y*u)}))},d=Math.hypot(n,r)*.75,f=g.lines.map(p=>B.renderFamily(p,d)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${n}" height="${r}">`,B.renderBackground(n,r,a),`<g stroke="${s}" stroke-width="${o.toFixed(2)}" stroke-linecap="round">`,f,"</g>","</svg>"].join("")}renderGradient(t,e={}){const n=e.width??260,r=e.height??160,s=e.background??"#ffffff",o=e.angle??0,a=e.shift??0,l=`${-n/2} ${-r/2} ${n} ${r}`,h=B.nextGradientId(t),c=B.resolveGradientColors(e),u=B.renderGradientDef(h,t,c,o,a,n,r);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${l}" width="${n}" height="${r}">`,B.renderBackground(n,r,s),"<defs>",u,"</defs>",`<rect x="${-n/2}" y="${-r/2}" width="${n}" height="${r}" fill="url(#${h})" />`,"</svg>"].join("")}};B.EPSILON=1e-9,B.gradientIdCounter=0;let Ur=B;function cp(i){if(!i||i.length===0)return;const t=up(i);if(!t)return;let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return`data:image/bmp;base64,${btoa(e)}`}function up(i){if(i.length>=14&&i[0]===66&&i[1]===77)return i;if(i.length<40)return;const t=new DataView(i.buffer,i.byteOffset,i.byteLength),e=t.getUint32(0,!0);if(e<12||e>i.length)return;const n=t.getUint16(14,!0),r=t.getUint32(32,!0),s=n<=8?r>0?r:1<<n:r>0?r:0,o=e===12?s*3:s*4,a=14+e+o;if(a>14+i.length)return;const l=14+i.length,h=new Uint8Array(14),c=new DataView(h.buffer);h[0]=66,h[1]=77,c.setUint32(2,l,!0),c.setUint32(6,0,!0),c.setUint32(10,a,!0);const u=new Uint8Array(l);return u.set(h,0),u.set(i,14),u}var Kn=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(Kn||{});const Zs=class Zs extends V{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new m,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new m,this._textRotation=0,this._normal=new b(0,0,1),this._dimBlockRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new vt),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(t){const e=this._textPosition.clone(),n=this._textPosition.clone().add(new b(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(t),this._textPosition.applyMatrix4(t),this._normal.transformDirection(t);const r=new b(1,0,0).transformDirection(t);r.lengthSq()>0&&(this._dimBlockRotation+=Math.atan2(r.y,r.x)),e.applyMatrix4(t),n.applyMatrix4(t);const s=new b(n).sub(e);return s.lengthSq()>0&&(this._textRotation=Math.atan2(s.y,s.x)),this.subTransformBy(t),this}subGetOsnapPoints(t,e,n,r,s){const o=this.getDimBlockTableRecord();if(!o)return;const a=this.getFullDimBlockTransform(),l=new m(e).applyMatrix4(a.clone().invert()),h=new m(n).applyMatrix4(a.clone().invert()),c=(u,g)=>{const d=[];u.subGetOsnapPoints(t,l,h,d,g,a),u instanceof Ve?d.forEach(f=>r.push(f.clone())):d.forEach(f=>r.push(new m(f).applyMatrix4(a)))};if(s){const u=o.getIdAt(s);if(u&&(c(u,s),r.length>0))return}for(const u of o.newIterator())c(u)}subWorldDraw(t){const e=this.getDimBlockTableRecord();if(e){const r=this.computeDimBlockTransform();return me.instance.draw(t,e,this.resolvedColor,[],!1,r,this._normal)}return t.group([])}getDimBlockGeometricExtents(){const t=new k,e=this.getDimBlockTableRecord();if(!e)return t;for(const n of e.newIterator())t.union(n.geometricExtents);return t.applyMatrix4(this.getFullDimBlockTransform()),t}getGeometricExtentsFromDimBlockOrPoints(t){const e=this.getDimBlockGeometricExtents();if(!e.isEmpty())return e;const n=new k;for(const r of t)n.expandByPoint(r);return this.hasExplicitTextPosition()&&n.expandByPoint(this.textPosition),n}hasExplicitTextPosition(){const{x:t,y:e,z:n}=this.textPosition;return t!==0||e!==0||n!==0}collectDimensionDefinitionGripPoints(){return[]}subGetGripPoints(){return this.collectDimensionDefinitionGripPoints().concat([this.textPosition])}subMoveGripPointsAt(t,e){const n=this.collectDimensionDefinitionGripPoints();return Z(t,r=>{r>=0&&r<n.length?n[r].add(e):r===n.length&&this.textPosition.add(e)}),this}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",t=>{this.dimensionStyleName=t.trim()===""?null:t}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",t=>{this.dimensionText=t}),this.createProperty("measurement","float",()=>this.getMeasurementPropertyValue()),this.createProperty("dimBlockId","string",()=>this.dimBlockId??""),...this.createPoint3dProperties("dimBlockPosition",()=>this.dimBlockPosition),...this.createPoint3dProperties("textPosition",()=>this.textPosition),this.createProperty("textRotation","float",()=>this.textRotation,t=>{this.textRotation=t}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,t=>{this.textLineSpacingFactor=t}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,t=>{this.textLineSpacingStyle=t},[{label:Kn[1],value:1},{label:Kn[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(t,e,n,r,s){return{name:t,type:e,editable:r!=null,options:s,accessor:r?{get:n,set:r}:{get:n}}}createPoint3dProperties(t,e){return[this.createProperty(`${t}X`,"float",()=>e().x,n=>{e().x=n}),this.createProperty(`${t}Y`,"float",()=>e().y,n=>{e().y=n}),this.createProperty(`${t}Z`,"float",()=>e().z,n=>{e().z=n})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const t=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return t;const e=new O().setFromExtrusionDirection(this._normal);return new O().multiplyMatrices(e,t)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}findPointOnLine1(t,e,n){const r=new m().subVectors(e,t).normalize();return new m(e).addScaledVector(r,n)}findPointOnLine2(t,e,n){const r=t.x+n*Math.cos(e),s=t.y+n*Math.sin(e);return{x:r,y:s}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():exports.AcGiArrowType.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??m.ORIGIN,n=new O().makeTranslation(-e.x,-e.y,-e.z),r=new O().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z),s=new O().makeRotationZ(this._dimBlockRotation);return new O().multiplyMatrices(r,new O().multiplyMatrices(s,n))}subTransformBy(t){}dxfOutFields(t){super.dxfOutFields(t);const e=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return t.writeSubclassMarker("AcDbDimension"),t.writeInt16(280,0),t.writeString(2,this.dimBlockId??void 0),t.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),t.writePoint3d(10,this.dimBlockPosition),t.writeString(1,this.dimensionText??""),t.writeAngle(53,this.textRotation),t.writePoint3d(11,this.textPosition),t.writeInt16(70,0),t.writeInt16(72,this.textLineSpacingStyle),t.writeDouble(41,this.textLineSpacingFactor),t.writeDouble(42,this.measurement),t.writeVector3d(210,this.normal),t.writeObjectId(340,e==null?void 0:e.objectId),this}};Zs.typeName="Dimension";let Ht=Zs;const Qs=class Qs extends Ht{constructor(t,e,n,r,s=null,o=null){super(),this._centerPoint=new m().copy(t),this._xLine1Point=new m().copy(e),this._xLine2Point=new m().copy(n),this._arcPoint=new m().copy(r),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDb3PointAngularDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Qs.typeName="3PointAngularDimension";let Hr=Qs;const Js=class Js extends Ht{constructor(t,e,n,r=null,s=null){super(),this._dimLinePoint=new m().copy(n),this._xLine1Point=new m().copy(t),this._xLine2Point=new m().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),r?this.dimensionText=r:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=s}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("dimLinePoint",()=>this.dimLinePoint),this.createProperty("rotation","float",()=>this.rotation,e=>{this.rotation=e}),this.createProperty("oblique","float",()=>this.oblique,e=>{this.oblique=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.xLine1Point,this.xLine2Point,this.dimLinePoint]}subMoveGripPointsAt(t,e){return super.subMoveGripPointsAt(t,e),this.calculateRotation(),this}subTransformBy(t){this._dimLinePoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t),this.calculateRotation()}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.dimLinePoint])}get isAppendArrow(){return!1}createDimBlock(t){const e=new tt;e.name=t;const n=this.createLines();n.forEach(a=>e.appendEntity(new Gn(a.startPoint,a.endPoint))),this.createArrows(n[0]).forEach(a=>e.appendEntity(a));const s=n[0].midPoint,o=this.createMText(s,this._rotation);return o&&e.appendEntity(o),e}createMText(t,e){const n=r=>({x:Math.cos(r),y:Math.sin(r),z:0});if(this.dimensionText){const r=new je;return r.attachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,r.layer="0",r.color=new X(exports.AcCmColorMethod.ByBlock),r.location=t,r.contents=this.dimensionText??"",r.height=10,r.direction=n(e),r.styleName=this.dimensionStyle.dimtxsty,r}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,n){const r="_CAXARROW",s=new Ve(r);return s.position=t,s.rotation=e,s.scaleFactors={x:n,y:n,z:n},s}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),n=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(e,this._dimLinePoint),s=this.findIntersectionPoint(n,this._dimLinePoint),o=new Ut(r,s);return t.push(o),e.endPoint=r,this.adjustExtensionLine(e),t.push(e),n.endPoint=s,this.adjustExtensionLine(n),t.push(n),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,n=this.findPointOnLine2(t,e,100);return new Ut(t,{...n,z:t.z})}findIntersectionPoint(t,e){const n=t.startPoint,r=t.endPoint,s=new b().subVectors(r,n).normalize(),a=new b().subVectors(e,n).dot(s),l=new b().copy(s).multiplyScalar(a);return new b().addVectors(n,l)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,n=e.x-t.x,r=e.y-t.y;this._rotation=Math.atan2(r,n)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker(this.dxfSubclassMarker),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.dimLinePoint),t.writeAngle(50,this.rotation),t.writeAngle(52,this.oblique),this}};Js.typeName="AlignedDimension";let Zn=Js;const to=class to extends Ht{constructor(t,e,n,r,s=null,o=null){super(),this._arcPoint=new m().copy(r),this._xLine1Point=new m().copy(e),this._xLine2Point=new m().copy(n),this._centerPoint=new m().copy(t),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArcDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};to.typeName="ArcDimension";let Wr=to;const eo=class eo extends Ht{constructor(t,e,n=0,r=null,s=null){super(),this._chordPoint=new m().copy(t),this._farChordPoint=new m().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=n,this.dimensionText=r,this.dimensionStyleName=s}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.chordPoint,this.farChordPoint]}subTransformBy(t){this._chordPoint.applyMatrix4(t),this._farChordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){const t=[this.chordPoint,this.farChordPoint];if(this.leaderLength>0){const e=this.farChordPoint.clone().sub(this.chordPoint);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.farChordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbDiametricDimension"),t.writePoint3d(15,this.chordPoint),t.writePoint3d(16,this.farChordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};eo.typeName="DiametricDimension";let $r=eo;const no=class no extends Ht{constructor(t,e,n=null,r=null){super(),this._definingPoint=new m().copy(t),this._leaderEndPoint=new m().copy(e),this.dimensionText=n,this.dimensionStyleName=r}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.definingPoint,this.leaderEndPoint]}subTransformBy(t){this._definingPoint.applyMatrix4(t),this._leaderEndPoint.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.definingPoint,this.leaderEndPoint])}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};no.typeName="OrdinateDimension";let qr=no;const io=class io extends Ht{constructor(t,e,n,r=null,s=null){super(),this._center=new m().copy(t),this._chordPoint=new m().copy(e),this._leaderLength=n,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=s}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}set leaderLenght(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.center,this.chordPoint]}subTransformBy(t){this._center.applyMatrix4(t),this._chordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){const t=[this.center,this.chordPoint];if(this.leaderLength>0){const e=this.chordPoint.clone().sub(this.center);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.chordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRadialDimension"),t.writePoint3d(15,this.center),t.writePoint3d(13,this.chordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};io.typeName="RadialDimension";let Kr=io;const ro=class ro extends Zn{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};ro.typeName="RotatedDimension";let Zr=ro;class Wh extends lt{constructor(){super()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbFilter"),this}}class $h extends lt{constructor(){super(),this._lastUpdatedAt=0,this._lastUpdatedAtU=0,this._isUptoDate=!1,this._objectBeingIndexedId=""}get lastUpdatedAt(){return this._lastUpdatedAt}set lastUpdatedAt(t){this._lastUpdatedAt=t}get lastUpdatedAtU(){return this._lastUpdatedAtU}set lastUpdatedAtU(t){this._lastUpdatedAtU=t}get isUptoDate(){return this._isUptoDate}set isUptoDate(t){this._isUptoDate=t}objectBeingIndexedId(){return this._objectBeingIndexedId}setObjectBeingIndexedId(t){this._objectBeingIndexedId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbIndex"),t.writeDouble(40,this.lastUpdatedAt),this}}class dp extends Wh{constructor(){super(),this._layerNames=[]}get layerNames(){return this._layerNames}set layerNames(t){this._layerNames=[...t]}add(t){const e=t==null?void 0:t.trim();return!e||this._layerNames.includes(e)?!1:(this._layerNames.push(e),!0)}getAt(t){if(t<0||t>=this._layerNames.length)throw new Error("The layer index is out of range!");return this._layerNames[t]}remove(t){const e=this._layerNames.indexOf(t);return e<0?!1:(this._layerNames.splice(e,1),!0)}layerCount(){return this._layerNames.length}indexClass(){return"AcDbLayerIndex"}isValid(){return this._layerNames.some(t=>t.length>0)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerFilter");for(const e of this._layerNames)t.writeString(8,e);return this}}class gp extends $h{constructor(){super(),this._layerNames=[],this._idBufferIds=[],this._idBufferEntryCounts=[]}get layerNames(){return this._layerNames}set layerNames(t){this._layerNames=[...t]}get idBufferIds(){return this._idBufferIds}set idBufferIds(t){this._idBufferIds=[...t]}get idBufferEntryCounts(){return this._idBufferEntryCounts}set idBufferEntryCounts(t){this._idBufferEntryCounts=[...t]}get entries(){const t=Math.max(this._layerNames.length,this._idBufferIds.length,this._idBufferEntryCounts.length),e=[];for(let n=0;n<t;n++)e.push({layerName:this._layerNames[n]??"",idBufferId:this._idBufferIds[n]??"",idBufferEntryCount:this._idBufferEntryCounts[n]??0});return e}set entries(t){this._layerNames=t.map(e=>e.layerName),this._idBufferIds=t.map(e=>e.idBufferId),this._idBufferEntryCounts=t.map(e=>e.idBufferEntryCount)}compute(t,e){if(e&&this.setObjectBeingIndexedId(e.objectId),t){this._layerNames=[];for(const n of t.newIterator())this._layerNames.push(n.name)}return this.lastUpdatedAt=Date.now(),this.lastUpdatedAtU=Date.now(),this.isUptoDate=!0,!0}newIterator(t){return null}rebuildFull(t){return this.lastUpdatedAt=Date.now(),this.lastUpdatedAtU=Date.now(),this.isUptoDate=!0,!0}rebuildModified(t){return this.lastUpdatedAt=Date.now(),this.lastUpdatedAtU=Date.now(),this.isUptoDate=!0,!0}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerIndex");const e=Math.max(this._layerNames.length,this._idBufferIds.length,this._idBufferEntryCounts.length);for(let n=0;n<e;n++)this._layerNames[n]!=null&&t.writeString(8,this._layerNames[n]),this._idBufferIds[n]&&t.writeHandle(360,this._idBufferIds[n]),this._idBufferEntryCounts[n]!=null&&t.writeInt32(90,this._idBufferEntryCounts[n]);return this}}class fp extends lt{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImageDef"),t.writeString(1,this.sourceFileName),t.writeInt16(280,1),t.writeInt16(281,0),this}}exports.ACAD_APPID=nr;exports.ACAD_LAYERFILTERS_NAME=_i;exports.ACDB_GRIPCOLOR_DEFAULT=Ka;exports.ACDB_GRIPCOLOR_MAX=rr;exports.ACDB_GRIPCOLOR_MIN=ir;exports.ACDB_GRIPHOT_DEFAULT=Za;exports.ACDB_GRIPHOT_MAX=or;exports.ACDB_GRIPHOT_MIN=sr;exports.ACDB_GRIPOBJLIMIT_MAX=ad;exports.ACDB_GRIPOBJLIMIT_MIN=od;exports.ACDB_GRIPSIZE_DEFAULT=Qa;exports.ACDB_GRIPSIZE_MAX=lr;exports.ACDB_GRIPSIZE_MIN=ar;exports.ACDB_GRIPS_MAX=hd;exports.ACDB_GRIPS_MIN=ld;exports.ACDB_PROXY_GRAPHIC_CHUNK_SIZE=Mf;exports.ACGI_DARK_THEME_FOREGROUND=ln;exports.ACGI_LIGHT_THEME_FOREGROUND=hn;exports.ACGI_MODEL_SPACE_BACKGROUND=Ga;exports.ACGI_PAPER_SPACE_BACKGROUND=$u;exports.ACLY_DICTIONARY_NAME=ze;exports.ACTIVE_VPORT_NAME=Ye;exports.AC_DB_SYSTEM_VARIABLE_NAMES=md;exports.AcCmColor=X;exports.AcCmColorUtil=Zt;exports.AcCmEntityColor=Qh;exports.AcCmErrors=gt;exports.AcCmEventDispatcher=Jh;exports.AcCmEventManager=q;exports.AcCmLoader=pc;exports.AcCmLoadingManager=ia;exports.AcCmObject=Wi;exports.AcCmPerformanceCollector=Jr;exports.AcCmTask=ea;exports.AcCmTaskScheduler=na;exports.AcCmTransparency=Q;exports.AcDb2dPolyline=fr;exports.AcDb2dVertex=pr;exports.AcDb2dVertexType=ah;exports.AcDb3PointAngularDimension=Hr;exports.AcDb3dPolyline=yr;exports.AcDb3dSolid=_r;exports.AcDb3dVertex=br;exports.AcDb3dVertexType=yh;exports.AcDbAbstractViewTableRecord=ps;exports.AcDbAlignedDimension=Zn;exports.AcDbAngleUnits=dt;exports.AcDbArc=wr;exports.AcDbArcDimension=Wr;exports.AcDbAttribute=vr;exports.AcDbAttributeDefinition=xr;exports.AcDbAttributeFlags=ct;exports.AcDbAttributeMTextFlag=Qt;exports.AcDbBaseWorker=xd;exports.AcDbBatchProcessing=cl;exports.AcDbBlockReference=Ve;exports.AcDbBlockScaling=Ja;exports.AcDbBlockTable=Ul;exports.AcDbBlockTableRecord=tt;exports.AcDbBlockTableRecordFlag=tl;exports.AcDbChangeApplier=th;exports.AcDbChangeRecorder=eh;exports.AcDbCircle=Pr;exports.AcDbCodePage=Vh;exports.AcDbCurve=rt;exports.AcDbDataGenerator=Sl;exports.AcDbDatabase=gr;exports.AcDbDatabaseConverter=dl;exports.AcDbDatabaseConverterManager=Ot;exports.AcDbDatabaseTransaction=nh;exports.AcDbDatabaseTransactionManager=rh;exports.AcDbDiametricDimension=$r;exports.AcDbDictionary=Tt;exports.AcDbDimArrowType=jh;exports.AcDbDimStyleTable=Hl;exports.AcDbDimStyleTableRecord=vt;exports.AcDbDimTextHorizontal=yl;exports.AcDbDimTextVertical=us;exports.AcDbDimVerticalJustification=bl;exports.AcDbDimZeroSuppression=ml;exports.AcDbDimZeroSuppressionAngular=_l;exports.AcDbDimension=Ht;exports.AcDbDuplicateRecordCloning=Rl;exports.AcDbDwgVersion=jt;exports.AcDbDxfCode=Qr;exports.AcDbDxfFiler=sa;exports.AcDbEllipse=Ar;exports.AcDbEntity=V;exports.AcDbFace=Sr;exports.AcDbFcf=Lr;exports.AcDbFileType=Je;exports.AcDbFilter=Wh;exports.AcDbFontNameCollector=xt;exports.AcDbFormatter=Ll;exports.AcDbFrame=Un;exports.AcDbGradientPatternType=Al;exports.AcDbHatch=jn;exports.AcDbHatchObjectType=Pl;exports.AcDbHatchPatternType=en;exports.AcDbHatchStyle=vl;exports.AcDbHostApplicationServices=Vn;exports.AcDbIndex=$h;exports.AcDbLayerFilter=dp;exports.AcDbLayerIndex=gp;exports.AcDbLayerTable=Wl;exports.AcDbLayerTableRecord=di;exports.AcDbLayout=ci;exports.AcDbLayoutDictionary=Jl;exports.AcDbLayoutManager=ll;exports.AcDbLeader=Er;exports.AcDbLeaderAnnotationType=vh;exports.AcDbLine=Gn;exports.AcDbLineSpacingStyle=Kn;exports.AcDbLinearUnits=$;exports.AcDbLinetypeTable=$l;exports.AcDbLinetypeTableRecord=pe;exports.AcDbMLeader=Mr;exports.AcDbMLeaderContentType=Ie;exports.AcDbMLeaderDirectionType=Lh;exports.AcDbMLeaderLineType=nn;exports.AcDbMLeaderStyle=kl;exports.AcDbMLeaderTextAttachmentDirection=Sh;exports.AcDbMLine=Ir;exports.AcDbMLineFlags=Ah;exports.AcDbMLineJustification=Ph;exports.AcDbMText=je;exports.AcDbMlineStyle=Nl;exports.AcDbObject=lt;exports.AcDbObjectIterator=Be;exports.AcDbOle2Frame=Or;exports.AcDbOleFrame=Hn;exports.AcDbOleObjectType=Nh;exports.AcDbOleTileMode=Rh;exports.AcDbOpenDatabaseError=gn;exports.AcDbOpenMode=Fe;exports.AcDbOrdinateDimension=qr;exports.AcDbOsnapMode=w;exports.AcDbPatParser=xs;exports.AcDbPatSvgRenderer=Ur;exports.AcDbPlotPaperUnits=el;exports.AcDbPlotRotation=nl;exports.AcDbPlotSettings=al;exports.AcDbPlotShadePlotResLevel=rl;exports.AcDbPlotShadePlotType=sl;exports.AcDbPlotStdScaleType=ol;exports.AcDbPlotType=il;exports.AcDbPoint=Xr;exports.AcDbPoly2dType=oh;exports.AcDbPoly3dType=lh;exports.AcDbPolyFaceMesh=Dr;exports.AcDbPolyFaceMeshFace=zh;exports.AcDbPolyFaceMeshVertex=Fh;exports.AcDbPolygonMesh=jr;exports.AcDbPolygonMeshVertex=Bh;exports.AcDbPolyline=pt;exports.AcDbPredefinedAcadIsoPat=xl;exports.AcDbPredefinedAcadPat=Ed;exports.AcDbProxyEntity=Rr;exports.AcDbProxyGraphic=Tr;exports.AcDbProxyGraphicBitStream=Ih;exports.AcDbProxyGraphicByteStream=_t;exports.AcDbProxyGraphicEndOfBufferError=re;exports.AcDbProxyGraphicType=Mh;exports.AcDbRadialDimension=Kr;exports.AcDbRasterImage=qn;exports.AcDbRasterImageClipBoundaryType=Xh;exports.AcDbRasterImageDef=fp;exports.AcDbRasterImageImageDisplayOpt=Yh;exports.AcDbRay=Yr;exports.AcDbRegAppTable=Ql;exports.AcDbRegAppTableRecord=ur;exports.AcDbRegenerator=gl;exports.AcDbRenderingCache=me;exports.AcDbResultBuffer=ui;exports.AcDbRotatedDimension=Zr;exports.AcDbShape=Br;exports.AcDbSolid=Nr;exports.AcDbSpline=Wn;exports.AcDbSymbolTable=Wt;exports.AcDbSymbolTableRecord=ae;exports.AcDbSysVarManager=et;exports.AcDbSystemVariables=v;exports.AcDbTable=kr;exports.AcDbText=yn;exports.AcDbTextHorizontalMode=wh;exports.AcDbTextStyleTable=ql;exports.AcDbTextStyleTableRecord=ds;exports.AcDbTextVerticalMode=xh;exports.AcDbTrace=$n;exports.AcDbTransaction=ys;exports.AcDbTransactionManager=dg;exports.AcDbUndoStack=ih;exports.AcDbUnitsValue=H;exports.AcDbViewTable=Kl;exports.AcDbViewTableRecord=gg;exports.AcDbViewport=Fr;exports.AcDbViewportTable=Zl;exports.AcDbViewportTableRecord=ye;exports.AcDbWipeout=zr;exports.AcDbWorkerApi=pl;exports.AcDbWorkerManager=fl;exports.AcDbXline=Vr;exports.AcDbXrecord=Xl;exports.AcGeArea2d=Et;exports.AcGeBox2d=it;exports.AcGeBox3d=k;exports.AcGeCatmullRomCurve3d=Da;exports.AcGeCircArc2d=ut;exports.AcGeCircArc3d=kt;exports.AcGeCurve2d=De;exports.AcGeEllipseArc2d=de;exports.AcGeEllipseArc3d=hs;exports.AcGeEuler=Mc;exports.AcGeGeometryUtil=ot;exports.AcGeLine2d=Nt;exports.AcGeLine3d=Ut;exports.AcGeLoop2d=cs;exports.AcGeMathUtil=T;exports.AcGeMatrix2d=_n;exports.AcGeMatrix3d=O;exports.AcGeNurbsCurve=mt;exports.AcGePlane=os;exports.AcGePoint2d=S;exports.AcGePoint3d=m;exports.AcGePolyline2d=j;exports.AcGeQuaternion=Re;exports.AcGeShape2d=ls;exports.AcGeSpline3d=Rt;exports.AcGeTol=D;exports.AcGeVector2d=W;exports.AcGeVector3d=b;exports.AcGiContext=hi;exports.AcGiViewport=Ha;exports.AcLyBoolExpr=Yl;exports.AcLyLayerFilter=mi;exports.AcLyLayerFilterDialogResult=Bl;exports.AcLyLayerFilterTree=Gt;exports.AcLyLayerGroup=Fl;exports.AcTrStringUtil=fc;exports.ByBlock=Xt;exports.ByLayer=J;exports.DEBUG_MODE=cc;exports.DEFAULT_ACGI_CONTEXT=Ku;exports.DEFAULT_GRADIENT_HATCH_NAME=qa;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=td;exports.DEFAULT_HATCH_PATTERN_METRIC=Wa;exports.DEFAULT_LINE_TYPE=se;exports.DEFAULT_MLEADER_STYLE=ie;exports.DEFAULT_MLINE_STYLE=ne;exports.DEFAULT_TEXT_STYLE=K;exports.DEFAULT_TOL=li;exports.DEG2RAD=ts;exports.DefaultLoadingManager=ra;exports.FLOAT_TOL=Ft;exports.HATCH_PATTERN_SOLID=ge;exports.HATCH_PATTERN_USER=$a;exports.MLIGHTCAD_APPID=er;exports.ORIGIN_POINT_2D=bc;exports.ORIGIN_POINT_3D=ss;exports.RAD2DEG=es;exports.RAW_COLOR_TYPE_ACI=yi;exports.RAW_COLOR_TYPE_BY_BLOCK=dn;exports.RAW_COLOR_TYPE_BY_LAYER=fi;exports.RAW_COLOR_TYPE_RGB=pi;exports.RAW_COLOR_TYPE_WINDOW_BG=Ol;exports.TAU=F;exports.TEMP_OBJECT_ID_PREFIX=ee;exports.VPORT_FALLBACK_CENTER_2D=ed;exports.VPORT_FALLBACK_LLC=nd;exports.VPORT_FALLBACK_URC=id;exports.VPORT_FALLBACK_VIEW_DIR=rd;exports.VPORT_FALLBACK_VIEW_TARGET=sd;exports.acdbCollectChangeEntities=dr;exports.acdbCreateWorkerApi=wd;exports.acdbDecodeMLeaderStyleRawColor=Kd;exports.acdbDwgCodePageToEncoding=Kf;exports.acdbEstimateDatabaseMemory=lp;exports.acdbFormatMemoryEstimate=hp;exports.acdbHasOsnapMode=Ld;exports.acdbHexStringsToBytes=If;exports.acdbHostApplicationServices=hl;exports.acdbLayerGroupsToResultBuffer=Vl;exports.acdbMaskToOsnapModes=Ad;exports.acdbOsnapModesToMask=Pd;exports.acdbParseFilterXRecordData=jl;exports.acdbPreviewIconToDataUrl=cp;exports.acdbReadLayerFilterTree=eg;exports.acdbResultBufferToLayerGroups=ng;exports.acdbSerializeLayerFilterTree=zl;exports.acdbSetHostApplicationServicesProvider=aa;exports.acdbSetLayoutManagerFactory=ud;exports.acdbToggleOsnapMode=Sd;exports.acdbWriteFilterXRecordData=Gl;exports.acgeBasisFunction=oe;exports.acgeCalculateCurveLength=Ma;exports.acgeCeilPowerOfTwo=va;exports.acgeClamp=zt;exports.acgeComputeParameterValues=Ea;exports.acgeDamp=ua;exports.acgeDegToRad=ba;exports.acgeEuclideanModulo=ns;exports.acgeEvaluateNurbsPoint=Qe;exports.acgeFloorPowerOfTwo=Pa;exports.acgeGenerateAveragedKnots=Ia;exports.acgeGenerateChordKnots=Rc;exports.acgeGenerateSqrtChordKnots=Xc;exports.acgeGenerateUUID=la;exports.acgeGenerateUniformKnots=Nc;exports.acgeGetOcsAngle=Dt;exports.acgeGetOcsReferenceVector=an;exports.acgeIntPartLength=rs;exports.acgeInterpolateControlPoints=zc;exports.acgeInterpolateNurbsCurve=as;exports.acgeInverseLerp=ca;exports.acgeIsBetween=Aa;exports.acgeIsBetweenAngle=Sa;exports.acgeIsPowerOfTwo=xa;exports.acgeLerp=is;exports.acgeMapLinear=ha;exports.acgeNormalizeAngle=Ze;exports.acgePingpong=da;exports.acgeRadToDeg=wa;exports.acgeRandFloat=ya;exports.acgeRandFloatSpread=ma;exports.acgeRandInt=pa;exports.acgeRelativeEps=La;exports.acgeSeededRandom=_a;exports.acgeSmootherstep=fa;exports.acgeSmoothstep=ga;exports.acgeTransformOcsPointToWcs=qi;exports.acgeTransformWcsPointToOcs=Xe;exports.acgiContrastingForegroundColor=Qu;exports.acgiForegroundColorForBackground=Zu;exports.acgiIsLightBackground=Ua;exports.acgiResolveSubEntityTraitsRgbFromBackground=Ju;exports.clone=qe;exports.deepClone=Hi;exports.defaults=It;exports.has=Jo;exports.isEmpty=ta;exports.isEqual=fe;exports.log=Ke;exports.setLogLevel=uc;
|