@mlightcad/data-model 1.7.25 → 1.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-model.cjs +3 -3
- package/dist/data-model.js +1418 -1302
- package/dist/dxf-parser-worker.js +222 -210
- package/lib/converter/AcDbDxfConverter.js +2 -2
- package/lib/converter/AcDbDxfConverter.js.map +1 -1
- package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
- package/lib/converter/AcDbEntitiyConverter.js +25 -2
- package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
- package/lib/entity/AcDbHatch.d.ts +136 -0
- package/lib/entity/AcDbHatch.d.ts.map +1 -1
- package/lib/entity/AcDbHatch.js +231 -2
- package/lib/entity/AcDbHatch.js.map +1 -1
- package/lib/entity/AcDbTable.d.ts +10 -0
- package/lib/entity/AcDbTable.d.ts.map +1 -1
- package/lib/entity/AcDbTable.js +86 -16
- package/lib/entity/AcDbTable.js.map +1 -1
- package/package.json +5 -5
package/dist/data-model.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Fn=(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))(Fn||{});const qr=[{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 vt{constructor(t){if(typeof t=="string"){const e=qr.find(s=>s.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=qr.find(s=>s.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 ba{constructor(t={}){this._database=t.database,this._precision=Math.max(0,Math.min(16,t.precision??16)),this._version=t.version instanceof vt?t.version:t.version!=null?new vt(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 vt?t:new vt(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 s=this.formatValue(e);return this._lines.push(s===""?"0":s),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 s=this.resolveHandle(e);return s?this.writeString(t,s):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,s=420){if(!t)return this;const n=t.colorIndex;n!=null&&this.writeInt16(e,n);const r=t.RGB;return r!=null&&t.colorIndex==null&&this.writeInt32(s,r),this}writeTransparency(t,e=440){return t?this.writeInt32(e,t.serialize()):this}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 s=t.toFixed(this._precision).replace(/\.?0+$/,"");return s===""||s==="-"?"0":s}return String(t)}sanitizeStringForDxfLine(t){return t.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}function Pl(i,t){for(var e=0;e<t.length;e++){const s=t[e];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in i)){const r=Object.getOwnPropertyDescriptor(s,n);r&&Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var E=(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",i))(E||{});const $r={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},sn=[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];let ue=class{static getColorByIndex(t){return sn[t]}static getIndexByColor(t){const e=sn.length-1;for(let s=1;s<e;++s)if(sn[s]===t)return s}static getColorByName(t){return $r[t.toLowerCase()]}static getNameByColor(t){for(const[e,s]of Object.entries($r))if(s===t)return e}static getNameByIndex(t){const e=this.getColorByIndex(t);return this.getNameByColor(e)}},tt=class ne{constructor(t=E.ByLayer,e){this._colorMethod=t,this._colorMethod==E.ByColor&&e==null?this._value=16777215:this._colorMethod==E.ByACI?e==null?this._value=8:e===0?this._colorMethod=E.ByBlock:e===256?this._colorMethod=E.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}get colorMethod(){return this._colorMethod}set colorMethod(t){this._colorMethod=t}get red(){const t=this.RGB;return t!=null?t>>16&255:void 0}get green(){const t=this.RGB;return t!=null?t>>8&255:void 0}get blue(){const t=this.RGB;return t!=null?t&255:void 0}get RGB(){switch(this._colorMethod){case E.ByColor:case E.ByBlock:case E.ByLayer:return this._value;case E.ByACI:return this._value?ue.getColorByIndex(this._value):this._value;default:return}}setRGB(t,e,s){const n=Math.max(0,Math.min(255,Math.round(t))),r=Math.max(0,Math.min(255,Math.round(e))),a=Math.max(0,Math.min(255,Math.round(s)));return this._value=n<<16|r<<8|a,this._colorMethod=E.ByColor,this}setRGBValue(t){return t==null||!Number.isFinite(t)?this:(this._value=t&16777215,this._colorMethod=E.ByColor,this)}setRGBFromCss(t){if(!t)return this;const e=t.trim().toLowerCase();if(e.startsWith("#")){let r=0,a=0,o=0;if(e.length===7)r=parseInt(e.substr(1,2),16),a=parseInt(e.substr(3,2),16),o=parseInt(e.substr(5,2),16);else if(e.length===4)r=parseInt(e[1]+e[1],16),a=parseInt(e[2]+e[2],16),o=parseInt(e[3]+e[3],16);else return this;return this.setRGB(r,a,o)}const s=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(s){const r=parseInt(s[1],10),a=parseInt(s[2],10),o=parseInt(s[3],10);return this.setRGB(r,a,o)}const n=ue.getColorByName(t);return n!==void 0?this.setRGBValue(n):this}setScalar(t){return this.setRGB(t,t,t)}get hexColor(){const t=this.RGB;return t==null?void 0:"0x"+t.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const t=this.RGB;if(t!=null)return`rgb(${t>>16&255},${t>>8&255},${t&255})`}cssColorAlpha(t){const e=this.RGB;if(e!=null)return`rgba(${e>>16&255},${e>>8&255},${e&255},${t})`}get colorIndex(){return this._colorMethod===E.ByACI?this._value:this._colorMethod===E.ByLayer?256:this._colorMethod===E.ByBlock?0:void 0}set colorIndex(t){if(t==null)return;const e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=E.ByBlock,this._value=void 0):e===256?(this._colorMethod=E.ByLayer,this._value=void 0):(this._colorMethod=E.ByACI,this._value=e)}get isByColor(){return this._colorMethod===E.ByColor}get isByACI(){return this._colorMethod===E.ByACI}get isForeground(){return this._colorMethod===E.ByACI&&this._value===7}setForeground(){return this._colorMethod=E.ByACI,this._value=7,this}get isByLayer(){return this._colorMethod===E.ByLayer}setByLayer(t){return this._colorMethod=E.ByLayer,t==null?this._value=256:this._value=t,this}get isByBlock(){return this._colorMethod===E.ByBlock}setByBlock(t){return this._colorMethod=E.ByBlock,t==null?this._value=0:this._value=t,this}get colorName(){switch(this._colorMethod){case E.ByLayer:return"ByLayer";case E.ByBlock:return"ByBlock";case E.ByColor:return this._value?ue.getNameByColor(this._value):"";case E.ByACI:return this._value?ue.getNameByIndex(this._value):"";default:return}}set colorName(t){if(!t)return;const e=ue.getColorByName(t);e!==void 0&&(this._value=e,this._colorMethod=E.ByColor)}clone(){const t=new ne;return t._colorMethod=this._colorMethod,t._value=this._value,t}copy(t){return this._colorMethod=t._colorMethod,this._value=t._value,this}equals(t){return this._colorMethod===t._colorMethod&&this._value===t._value}toString(){switch(this._colorMethod){case E.ByLayer:return"ByLayer";case E.ByBlock:return"ByBlock";case E.ByACI:return this._value!==void 0?String(this._value):"";case E.ByColor:return this._value?`${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(t){if(!t)return;const e=t.trim();if(/^bylayer$/i.test(e))return new ne(E.ByLayer);if(/^byblock$/i.test(e))return new ne(E.ByBlock);const s=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(s){const r=Number(s[1]),a=Number(s[2]),o=Number(s[3]),l=new ne(E.ByColor);return l.setRGB(r,a,o),l}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){const[r,a,o]=e.split(",").map(Number),l=new ne(E.ByColor);return l.setRGB(r,a,o),l}if(/^\d+$/.test(e)){const r=parseInt(e,10);return new ne(E.ByACI,r)}if(/^book\$/i.test(e)){const r=e.substring(e.indexOf("$")+1),a=ue.getColorByName(r);return a!=null?new ne(E.ByColor,a):void 0}const n=ue.getColorByName(e);if(n!=null)return new ne(E.ByColor,n)}};class Sl{constructor(t=E.ByColor,e=0){this._colorMethod=t,this._value=e}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(t){this._colorMethod=E.ByColor,this._value=this._value&65535|(t&255)<<16}get green(){return this._value>>8&255}set green(t){this._colorMethod=E.ByColor,this._value=this._value&16711935|(t&255)<<8}get blue(){return this._value&255}set blue(t){this._colorMethod=E.ByColor,this._value=this._value&16776960|t&255}setRGB(t,e,s){this._colorMethod=E.ByColor,this._value=(t&255)<<16|(e&255)<<8|s&255}get colorIndex(){return this._value}set colorIndex(t){this._colorMethod=E.ByACI,this._value=t}get layerIndex(){return this._value}set layerIndex(t){this._colorMethod=E.ByLayer,this._value=t}isByColor(){return this._colorMethod===E.ByColor}isByLayer(){return this._colorMethod===E.ByLayer}isByBlock(){return this._colorMethod===E.ByBlock}isByACI(){return this._colorMethod===E.ByACI}isNone(){return this._colorMethod===E.None}get rawValue(){return this._value}set rawValue(t){this._value=t}}const yt={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")}};let El=class{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let n=0,r=s.length;n<r;n++)s[n].call(this,t)}}},Z=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const s of this.listeners)s.call(null,t,...e)}};function bs(i){return i===null||typeof i!="object"?i:Array.isArray(i)?[...i]:{...i}}function wn(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(wn);const t={};for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=wn(i[e]));return t}function Hs(i,...t){for(const e of t)if(e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&i[s]===void 0&&(i[s]=e[s]);return i}function fa(i,t){return i!=null&&Object.prototype.hasOwnProperty.call(i,t)}function ba(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 Ze(i,t){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(let n=0;n<i.length;n++)if(!Ze(i[n],t[n]))return!1;return!0}const e=Object.keys(i),s=Object.keys(t);if(e.length!==s.length)return!1;for(const n of e)if(!Object.prototype.hasOwnProperty.call(t,n)||!Ze(i[n],t[n]))return!1;return!0}var Al=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ml(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ia={exports:{}};(function(i){(function(t,e){i.exports?i.exports=e():t.log=e()})(Al,function(){var t=function(){},e="undefined",s=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],r={},a=null;function o(y,x){var f=y[x];if(typeof f.bind=="function")return f.bind(y);try{return Function.prototype.bind.call(f,y)}catch{return function(){return Function.prototype.apply.apply(f,[y,arguments])}}}function l(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function c(y){return y==="debug"&&(y="log"),typeof console===e?!1:y==="trace"&&s?l:console[y]!==void 0?o(console,y):console.log!==void 0?o(console,"log"):t}function u(){for(var y=this.getLevel(),x=0;x<n.length;x++){var f=n[x];this[f]=x<y?t:this.methodFactory(f,y,this.name)}if(this.log=this.debug,typeof console===e&&y<this.levels.SILENT)return"No console available for logging"}function d(y){return function(){typeof console!==e&&(u.call(this),this[y].apply(this,arguments))}}function g(y,x,f){return c(y)||d.apply(this,arguments)}function p(y,x){var f=this,P,I,T,A="loglevel";typeof y=="string"?A+=":"+y:typeof y=="symbol"&&(A=void 0);function j(F){var U=(n[F]||"silent").toUpperCase();if(!(typeof window===e||!A)){try{window.localStorage[A]=U;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+U+";"}catch{}}}function M(){var F;if(!(typeof window===e||!A)){try{F=window.localStorage[A]}catch{}if(typeof F===e)try{var U=window.document.cookie,fe=encodeURIComponent(A),be=U.indexOf(fe+"=");be!==-1&&(F=/^([^;]+)/.exec(U.slice(be+fe.length+1))[1])}catch{}return f.levels[F]===void 0&&(F=void 0),F}}function $(){if(!(typeof window===e||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function B(F){var U=F;if(typeof U=="string"&&f.levels[U.toUpperCase()]!==void 0&&(U=f.levels[U.toUpperCase()]),typeof U=="number"&&U>=0&&U<=f.levels.SILENT)return U;throw new TypeError("log.setLevel() called with invalid level: "+F)}f.name=y,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=x||g,f.getLevel=function(){return T??I??P},f.setLevel=function(F,U){return T=B(F),U!==!1&&j(T),u.call(f)},f.setDefaultLevel=function(F){I=B(F),M()||f.setLevel(F,!1)},f.resetLevel=function(){T=null,$(),u.call(f)},f.enableAll=function(F){f.setLevel(f.levels.TRACE,F)},f.disableAll=function(F){f.setLevel(f.levels.SILENT,F)},f.rebuild=function(){if(a!==f&&(P=B(a.getLevel())),u.call(f),a===f)for(var F in r)r[F].rebuild()},P=B(a?a.getLevel():"WARN");var et=M();et!=null&&(T=B(et)),u.call(f)}a=new p,a.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var x=r[y];return x||(x=r[y]=new p(y,a.methodFactory)),x};var m=typeof window!==e?window.log:void 0;return a.noConflict=function(){return typeof window!==e&&window.log===a&&(window.log=m),a},a.getLoggers=function(){return r},a.default=a,a})})(Ia);var Pa=Ia.exports;const Tl=Ml(Pa),vl=Pl({__proto__:null,default:Tl},[Pa]),kl=!0,Ss=vl;Ss.setLevel("debug");const Ll=i=>{try{Ss.setLevel(i)}catch(t){Ss.setLevel("error"),Ss.error(t)}};let Sa=class Ea{constructor(t,e){this.events={attrChanged:new Z,modelChanged:new Z},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=t||{};e&&Hs(s,e),this.attributes=s,this.changed={}}get(t){return this.attributes[t]}set(t,e,s){if(t==null)return this;let n;typeof t=="object"?(n=t,s=e):(n={},n[t]=e),s||(s={});const r=s.unset,a=s.silent,o=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=bs(this.attributes),this.changed={});const c=this.attributes,u=this.changed,d=this._previousAttributes;for(const g in n)e=n[g],Ze(c[g],e)||o.push(g),Ze(d[g],e)?delete u[g]:u[g]=e,r?delete c[g]:c[g]=e;if(!a){o.length&&(this._pending=s);for(let g=0;g<o.length;g++)this.events.attrChanged.dispatch({object:this,attrName:o[g],attrValue:c[o[g]],options:s})}if(l)return this;if(!a)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!ba(this.changed):fa(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?bs(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,s={};for(const n in t){const r=t[n];Ze(e[n],r)||(s[n]=r)}return s}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return bs(this._previousAttributes)}clone(){const t=bs(this.attributes);return new Ea(t)}},Fn=class Is{constructor(){this.entries=new Map}static getInstance(){return Is.instance||(Is.instance=new Is),Is.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries);}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class Ol{static formatBytes(t,e=2){if(t===0)return"0 B";const s=1024,n=Math.max(0,e),r=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(s)),o=t/Math.pow(s,a);return`${parseFloat(o.toFixed(n))} ${r[a]}`}}var ut=(i=>(i[i.ByLayer=0]="ByLayer",i[i.ByBlock=1]="ByBlock",i[i.ByAlpha=2]="ByAlpha",i[i.ErrorValue=3]="ErrorValue",i))(ut||{});let Ki=class Ft{constructor(t){t!==void 0?(this._method=ut.ByAlpha,this._alpha=Ft.clampAlpha(t)):(this._method=ut.ByLayer,this._alpha=255)}get method(){return this._method}set method(t){this._method=t}get alpha(){return this._alpha}set alpha(t){this._alpha=Ft.clampAlpha(t),this._method=ut.ByAlpha}get percentage(){if(this._method===ut.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(t){const e=Math.max(0,Math.min(100,t)),s=Math.round(255*(1-e/100));this.alpha=s}static clampAlpha(t){return Math.max(0,Math.min(255,Math.floor(t)))}get isByAlpha(){return this._method===ut.ByAlpha}get isByBlock(){return this._method===ut.ByBlock}get isByLayer(){return this._method===ut.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===ut.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const t=new Ft;return t._method=this._method,t._alpha=this._alpha,t}equals(t){return this._method===t._method&&this._alpha===t._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(t){const e=t.trim();if(/^bylayer$/i.test(e)){const r=new Ft;return r._method=ut.ByLayer,r}if(/^byblock$/i.test(e)){const r=new Ft;return r._method=ut.ByBlock,r}const s=Number(e);if(Number.isInteger(s)&&s>=0&&s<=255)return new Ft(s);const n=new Ft;return n._method=ut.ErrorValue,n}static deserialize(t){const e=t>>>24&255,s=t&255,n=Object.values(ut)[e]??ut.ErrorValue,r=new Ft;return r._method=n,r._alpha=Ft.clampAlpha(s),r}};class Aa{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class Ma{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(t){return new Promise((e,s)=>{const n=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(n):setTimeout(n,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let s=t;for(let n=0;n<e;n++){const r=this.tasks[n];try{s=await this.scheduleTask(async()=>{const a=await r.run(s);return this.onProgress((n+1)/e,r),a})}catch(a){if(this.onError({error:a,taskIndex:n,task:r}))return Promise.reject(a)}}this.onComplete(s)}}let Ta=class{constructor(t,e,s){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=s}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(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())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,s=this.handlers.length;e<s;e+=2){const n=this.handlers[e],r=this.handlers[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}};const va=new Ta;class Nl{constructor(t){this.manager=t!==void 0?t:va,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((s,n)=>{this.load(t,s,e,n)})}parse(t){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}var De=256,ka=[],qr=256,ri;for(;De--;)ka[De]=(De+256).toString(16).substring(1);function Cl(i){var t=0,e=11;if(!ri||De+e>qr*2)for(ri="",De=0;t<qr;t++)ri+=ka[Math.random()*256|0];return ri.substring(De,De+++e)}const ui="TEMP_";let xn;function La(i){xn=i}class he{constructor(t,e){if(t=t||{},this._attrs=new Sa(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 ui+Cl()}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(ui)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(ui)}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(xn)return xn().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Bn.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}clone(){const t=Object.create(Object.getPrototypeOf(this)),e=this,s=t;for(const n of Object.keys(e))n!=="_database"&&(s[n]=this.cloneValue(e[n]));return t.objectId=this.generateTemporaryHandle(),t}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(n=>this.cloneValue(n));if(t instanceof Map){const n=new Map;for(const[r,a]of t.entries())n.set(this.cloneValue(r),this.cloneValue(a));return n}if(t instanceof Set){const n=new Set;for(const r of t.values())n.add(this.cloneValue(r));return n}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));const n=t.constructor;return new n(t)}if(t instanceof ArrayBuffer)return t.slice(0);if("clone"in t&&typeof t.clone=="function")return t.clone();const e=Object.create(Object.getPrototypeOf(t)),s=t;for(const n of Object.keys(s))e[n]=this.cloneValue(s[n]);return e}dxfOut(...t){const[e,s=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),s)for(const n of this._xDataMap.values())e.writeResultBuffer(n);return this}dxfOutFields(t){return this}}let fn;function Oa(i){fn=i}function Rn(){return bi.instance}const $i=class $i{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(){if(!this._layoutManager){if(!fn)throw new Error("The layout manager factory must be registered before using it!");this._layoutManager=fn()}return this._layoutManager}};$i.instance=new $i;let bi=$i;La(Rn);var Na=(i=>(i.kForRead="kForRead",i.kForWrite="kForWrite",i))(Na||{});class zn{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 zn(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Vn{constructor(t,e,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=s,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,s)=>{const n=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(n):setTimeout(n,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let s=0;const n=async()=>{const r=s,a=Math.min(s+this._chunkSize,this._count);await t(r,a),s=a,s<this._count&&await this.scheduleTask(n)};await n(),await(e==null?void 0:e())}}var Es=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Es||{});class Rt{constructor(){this.events={registered:new Z,unregistered:new Z},this._converters=new Map,this.register("dxf",new bl)}static createInstance(){return Rt._instance==null&&(Rt._instance=new Rt),this._instance}static get instance(){return Rt._instance||(Rt._instance=new Rt),Rt._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 Dn=(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))(Dn||{});class ss{static get instance(){return this._instance||(this._instance=new ss),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}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,s,n=[],r=!0,a,o){const l=[];if(e!=null){const c=this.createKey(e.name,s);let u;if(this.has(c))u=this.get(c);else{const d=e.newIterator();for(const g of d)g.color.isByBlock&&s?(Zr.copy(g.color),g.color.setRGBValue(s),this.addEntity(g,l,t),g.color.copy(Zr)):this.addEntity(g,l,t);u=t.group(l),u&&r&&K.name&&!K.name.startsWith("*U")&&this.set(c,u)}return u&&a&&(u.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),u.applyMatrix(a))),u&&n&&n.length>0&&(u.bakeTransformToChildren(),n.forEach(d=>u.addChild(d))),u}else return t.group(l)}addEntity(t,e,s){const n=t.worldDraw(s);n&&(this.attachEntityInfo(n,t),e.push(n))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const Zr=new tt;var jn=(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))(jn||{});const Bl=["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"],Ca=i=>Bl[i],Ke="Continuous",J="Standard",At="ByLayer",Qe="ByBlock",bn="mlightcad",In="ACAD",at=["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"];let Kr=1234567;const Wn=Math.PI/180,Gn=180/Math.PI;function Ba(){const i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(at[i&255]+at[i>>8&255]+at[i>>16&255]+at[i>>24&255]+"-"+at[t&255]+at[t>>8&255]+"-"+at[t>>16&15|64]+at[t>>24&255]+"-"+at[e&63|128]+at[e>>8&255]+"-"+at[e>>16&255]+at[e>>24&255]+at[s&255]+at[s>>8&255]+at[s>>16&255]+at[s>>24&255]).toLowerCase()}function re(i,t,e){return Math.max(t,Math.min(e,i))}function Hn(i,t){return(i%t+t)%t}function Fa(i,t,e,s,n){return s+(i-t)*(n-s)/(e-t)}function Ra(i,t,e){return i!==t?(e-i)/(t-i):0}function Un(i,t,e){return(1-e)*i+e*t}function za(i,t,e,s){return Un(i,t,1-Math.exp(-e*s))}function Va(i,t=1){return t-Math.abs(Hn(i,t*2)-t)}function Da(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function ja(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Wa(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Ga(i,t){return i+Math.random()*(t-i)}function Ha(i){return i*(.5-Math.random())}function Ua(i){i!==void 0&&(Kr=i);let t=Kr+=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 Xa(i){return i*Wn}function Ya(i){return i*Gn}function $a(i){return(i&i-1)===0&&i!==0}function qa(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Za(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function As(i){const t=Math.PI*2;return(i%t+t)%t}function Ka(i,t,e){return i>t&&i<e||i>e&&i<t}function Qa(i,t,e,s=!1){return i=As(i),t=As(t),e=As(e),s?t>e?i<=t&&i>=e:i<=t||i>=e:t<e?i>=t&&i<=e:i>=t||i<=e}function Xn(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function Ja(i,t=1e-7){const e=Xn(i);return Math.max(Math.pow(10,e)*t,t)}const v={DEG2RAD:Wn,RAD2DEG:Gn,generateUUID:Ba,clamp:re,euclideanModulo:Hn,mapLinear:Fa,inverseLerp:Ra,lerp:Un,damp:za,pingpong:Va,smoothstep:Da,smootherstep:ja,randInt:Wa,randFloat:Ga,randFloatSpread:Ha,seededRandom:Ua,degToRad:Xa,radToDeg:Ya,isPowerOfTwo:$a,ceilPowerOfTwo:qa,floorPowerOfTwo:Za,normalizeAngle:As,isBetween:Ka,isBetweenAngle:Qa,intPartLength:Xn,relativeEps:Ja},Pn=class to{constructor(t,e){this.x=0,this.y=0;const s=+(t!==void 0)+ +(e!==void 0);if(s!==0){if(s===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(s===1){const{x:n,y:r}=t;this.x=n,this.y=r;return}if(s===2){this.x=t,this.y=e;return}throw yt.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(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}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new to(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const e=this.x,s=this.y,n=t.elements;return this.x=n[0]*e+n[3]*s+n[6],this.y=n[1]*e+n[4]*s+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(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}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const s=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*s-a*n+t.x,this.y=r*n+a*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(v.relativeEps(this.x,t),v.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};Pn.EMPTY=Object.freeze(new Pn(0,0));let X=Pn;const Sn=class eo{constructor(t,e,s,n,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&s!=null&&n!=null&&r!=null&&a!=null&&o!=null&&l!=null&&c!=null&&this.set(t,e,s,n,r,a,o,l,c)}set(t,e,s,n,r,a,o,l,c){const u=this.elements;return u[0]=t,u[1]=n,u[2]=o,u[3]=e,u[4]=r,u[5]=l,u[6]=s,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const 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}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,n=e.elements,r=this.elements,a=s[0],o=s[3],l=s[6],c=s[1],u=s[4],d=s[7],g=s[2],p=s[5],m=s[8],y=n[0],x=n[3],f=n[6],P=n[1],I=n[4],T=n[7],A=n[2],j=n[5],M=n[8];return r[0]=a*y+o*P+l*A,r[3]=a*x+o*I+l*j,r[6]=a*f+o*T+l*M,r[1]=c*y+u*P+d*A,r[4]=c*x+u*I+d*j,r[7]=c*f+u*T+d*M,r[2]=g*y+p*P+m*A,r[5]=g*x+p*I+m*j,r[8]=g*f+p*T+m*M,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],s=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],u=t[8];return e*a*u-e*o*c-s*r*u+s*o*l+n*r*c-n*a*l}invert(){const t=this.elements,e=t[0],s=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],u=t[8],d=u*a-o*c,g=o*l-u*r,p=c*r-a*l,m=e*d+s*g+n*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return t[0]=d*y,t[1]=(n*c-u*s)*y,t[2]=(o*s-n*a)*y,t[3]=g*y,t[4]=(u*e-n*l)*y,t[5]=(n*r-o*e)*y,t[6]=p*y,t[7]=(s*l-c*e)*y,t[8]=(a*e-s*r)*y,this}transpose(){let t;const 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}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const 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}setUvTransform(t,e,s,n,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(s*l,s*c,-s*(l*a+c*o)+a+t,-n*c,n*l,-n*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(nn.makeScale(t,e)),this}rotate(t){return this.premultiply(nn.makeRotation(-t)),this}translate(t,e){return this.premultiply(nn.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof X?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}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let n=0;n<9;n++)if(e[n]!==s[n])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new eo().fromArray(this.elements)}};Sn.IDENTITY=Object.freeze(new Sn);let Us=Sn;const nn=new Us,Ve=1e-6,W=2*Math.PI,Fl={x:0,y:0},Yn={x:0,y:0,z:0};class Xs{constructor(){this.equalPointTol=Ve,this.equalVectorTol=Ve}clone(){const t=new Xs;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t}equalPoint2d(t,e){return new X(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new b(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Ve){return t<e&&t>-e}static equal(t,e,s=Ve){return Math.abs(t-e)<s}static great(t,e,s=Ve){return t-e>s}static less(t,e,s=Ve){return t-e<s}}const $n=new Xs;class Ue{constructor(t=0,e=0,s=0,n=1){this._x=t,this._y=e,this._z=s,this._w=n}static slerpFlat(t,e,s,n,r,a,o){let l=s[n+0],c=s[n+1],u=s[n+2],d=s[n+3];const g=r[a+0],p=r[a+1],m=r[a+2],y=r[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=u,t[e+3]=d;return}if(o===1){t[e+0]=g,t[e+1]=p,t[e+2]=m,t[e+3]=y;return}if(d!==y||l!==g||c!==p||u!==m){let x=1-o;const f=l*g+c*p+u*m+d*y,P=f>=0?1:-1,I=1-f*f;if(I>Number.EPSILON){const A=Math.sqrt(I),j=Math.atan2(A,f*P);x=Math.sin(x*j)/A,o=Math.sin(o*j)/A}const T=o*P;if(l=l*x+g*T,c=c*x+p*T,u=u*x+m*T,d=d*x+y*T,x===1-o){const A=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=A,c*=A,u*=A,d*=A}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=d}static multiplyQuaternionsFlat(t,e,s,n,r,a){const o=s[n],l=s[n+1],c=s[n+2],u=s[n+3],d=r[a],g=r[a+1],p=r[a+2],m=r[a+3];return t[e]=o*m+u*d+l*p-c*g,t[e+1]=l*m+u*g+c*d-o*p,t[e+2]=c*m+u*p+o*g-l*d,t[e+3]=u*m-o*d-l*g-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,n){return this._x=t,this._y=e,this._z=s,this._w=n,this._onChangeCallback(),this}clone(){return new Ue(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t.x,n=t.y,r=t.z,a=t.order,o=Math.cos,l=Math.sin,c=o(s/2),u=o(n/2),d=o(r/2),g=l(s/2),p=l(n/2),m=l(r/2);switch(a){case"XYZ":this._x=g*u*d+c*p*m,this._y=c*p*d-g*u*m,this._z=c*u*m+g*p*d,this._w=c*u*d-g*p*m;break;case"YXZ":this._x=g*u*d+c*p*m,this._y=c*p*d-g*u*m,this._z=c*u*m-g*p*d,this._w=c*u*d+g*p*m;break;case"ZXY":this._x=g*u*d-c*p*m,this._y=c*p*d+g*u*m,this._z=c*u*m+g*p*d,this._w=c*u*d-g*p*m;break;case"ZYX":this._x=g*u*d-c*p*m,this._y=c*p*d+g*u*m,this._z=c*u*m-g*p*d,this._w=c*u*d+g*p*m;break;case"YZX":this._x=g*u*d+c*p*m,this._y=c*p*d+g*u*m,this._z=c*u*m-g*p*d,this._w=c*u*d-g*p*m;break;case"XZY":this._x=g*u*d-c*p*m,this._y=c*p*d-g*u*m,this._z=c*u*m+g*p*d,this._w=c*u*d+g*p*m;break}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,n=Math.sin(s);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],n=e[4],r=e[8],a=e[1],o=e[5],l=e[9],c=e[2],u=e[6],d=e[10],g=s+o+d;if(g>0){const p=.5/Math.sqrt(g+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(a-n)*p}else if(s>o&&s>d){const p=2*Math.sqrt(1+s-o-d);this._w=(u-l)/p,this._x=.25*p,this._y=(n+a)/p,this._z=(r+c)/p}else if(o>d){const p=2*Math.sqrt(1+o-s-d);this._w=(r-c)/p,this._x=(n+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+d-s-o);this._w=(a-n)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(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=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(re(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const n=Math.min(1,e/s);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,n=t._y,r=t._z,a=t._w,o=e._x,l=e._y,c=e._z,u=e._w;return this._x=s*u+a*o+n*c-r*l,this._y=n*u+a*l+r*o-s*c,this._z=r*u+a*c+s*l-n*o,this._w=a*u-s*o-n*l-r*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,n=this._y,r=this._z,a=this._w;let o=a*t._w+s*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=s,this._y=n,this._z=r,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-e;return this._w=p*a+e*this._w,this._x=p*s+e*this._x,this._y=p*n+e*this._y,this._z=p*r+e*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-e)*u)/c,g=Math.sin(e*u)/c;return this._w=a*d+this._w*g,this._x=s*d+this._x*g,this._y=n*d+this._y*g,this._z=r*d+this._z*g,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),n=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(n*Math.sin(t),n*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const dt=class so{constructor(t,e,s){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:r,y:a,z:o}=t;this.x=r,this.y=a,this.z=o||0;return}if(n===3){this.x=t,this.y=e,this.z=s;return}throw yt.ILLEGAL_PARAMETERS}}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(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}getComponent(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)}}clone(){return new so(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Qr.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Qr.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*n,this.y=r[1]*e+r[4]*s+r[7]*n,this.z=r[2]*e+r[5]*s+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*s+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*s+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*s+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,s=this.y,n=this.z,r=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*n-o*s),u=2*(o*e-r*n),d=2*(r*s-a*e);return this.x=e+l*c+a*d-o*u,this.y=s+l*u+o*c-r*d,this.z=n+l*d+r*u-a*c,this}transformDirection(t){const e=this.x,s=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*n,this.y=r[1]*e+r[5]*s+r[9]*n,this.z=r[2]*e+r[6]*s+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(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}max(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}clamp(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}clampScalar(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}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const e=this.dot(t),s=this.length(),n=t.length();return Math.abs(e)===s*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,n=t.y,r=t.z,a=e.x,o=e.y,l=e.z;return this.x=n*l-r*o,this.y=r*a-s*l,this.z=s*o-n*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return rn.copy(this).projectOnVector(t),this.sub(rn)}reflect(t){return this.sub(rn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,n=this.z-t.z;return e*e+s*s+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};dt.ORIGIN=Object.freeze(new dt(0,0,0)),dt.X_AXIS=Object.freeze(new dt(1,0,0)),dt.NEGATIVE_X_AXIS=Object.freeze(new dt(-1,0,0)),dt.Y_AXIS=Object.freeze(new dt(0,1,0)),dt.NEGATIVE_Y_AXIS=Object.freeze(new dt(0,-1,0)),dt.Z_AXIS=Object.freeze(new dt(0,0,1)),dt.NEGATIVE_Z_AXIS=Object.freeze(new dt(0,0,-1));let b=dt;const rn=new b,Qr=new Ue,En=class io{constructor(t,e,s,n,r,a,o,l,c,u,d,g,p,m,y,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&s!=null&&n!=null&&r!=null&&a!=null&&o!=null&&l!=null&&c!=null&&u!=null&&d!=null&&g!=null&&p!=null&&m!=null&&y!=null&&x!=null&&this.set(t,e,s,n,r,a,o,l,c,u,d,g,p,m,y,x)}set(t,e,s,n,r,a,o,l,c,u,d,g,p,m,y,x){const f=this.elements;return f[0]=t,f[4]=e,f[8]=s,f[12]=n,f[1]=r,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=u,f[10]=d,f[14]=g,f[3]=p,f[7]=m,f[11]=y,f[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new io().fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const 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}setFromExtrusionDirection(t){if($n.equalPoint3d(t,b.Z_AXIS))this.identity();else{const e=new b(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(b.Y_AXIS,t).normalize():e.crossVectors(b.Z_AXIS,t).normalize();const s=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,s.x,s.y,s.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,n=1/Xe.setFromMatrixColumn(t,0).length(),r=1/Xe.setFromMatrixColumn(t,1).length(),a=1/Xe.setFromMatrixColumn(t,2).length();return e[0]=s[0]*n,e[1]=s[1]*n,e[2]=s[2]*n,e[3]=0,e[4]=s[4]*r,e[5]=s[5]*r,e[6]=s[6]*r,e[7]=0,e[8]=s[8]*a,e[9]=s[9]*a,e[10]=s[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Rl,t,zl)}lookAt(t,e,s){const n=this.elements;return _t.subVectors(t,e),_t.lengthSq()===0&&(_t.z=1),_t.normalize(),de.crossVectors(s,_t),de.lengthSq()===0&&(Math.abs(s.z)===1?_t.x+=1e-4:_t.z+=1e-4,_t.normalize(),de.crossVectors(s,_t)),de.normalize(),ai.crossVectors(_t,de),n[0]=de.x,n[4]=ai.x,n[8]=_t.x,n[1]=de.y,n[5]=ai.y,n[9]=_t.y,n[2]=de.z,n[6]=ai.z,n[10]=_t.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,n=e.elements,r=this.elements,a=s[0],o=s[4],l=s[8],c=s[12],u=s[1],d=s[5],g=s[9],p=s[13],m=s[2],y=s[6],x=s[10],f=s[14],P=s[3],I=s[7],T=s[11],A=s[15],j=n[0],M=n[4],$=n[8],B=n[12],et=n[1],F=n[5],U=n[9],fe=n[13],be=n[2],Qs=n[6],Js=n[10],ti=n[14],ei=n[3],si=n[7],ii=n[11],ni=n[15];return r[0]=a*j+o*et+l*be+c*ei,r[4]=a*M+o*F+l*Qs+c*si,r[8]=a*$+o*U+l*Js+c*ii,r[12]=a*B+o*fe+l*ti+c*ni,r[1]=u*j+d*et+g*be+p*ei,r[5]=u*M+d*F+g*Qs+p*si,r[9]=u*$+d*U+g*Js+p*ii,r[13]=u*B+d*fe+g*ti+p*ni,r[2]=m*j+y*et+x*be+f*ei,r[6]=m*M+y*F+x*Qs+f*si,r[10]=m*$+y*U+x*Js+f*ii,r[14]=m*B+y*fe+x*ti+f*ni,r[3]=P*j+I*et+T*be+A*ei,r[7]=P*M+I*F+T*Qs+A*si,r[11]=P*$+I*U+T*Js+A*ii,r[15]=P*B+I*fe+T*ti+A*ni,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],s=t[4],n=t[8],r=t[12],a=t[1],o=t[5],l=t[9],c=t[13],u=t[2],d=t[6],g=t[10],p=t[14],m=t[3],y=t[7],x=t[11],f=t[15];return m*(+r*l*d-n*c*d-r*o*g+s*c*g+n*o*p-s*l*p)+y*(+e*l*p-e*c*g+r*a*g-n*a*p+n*c*u-r*l*u)+x*(+e*c*d-e*o*p-r*a*d+s*a*p+r*o*u-s*c*u)+f*(-n*o*u-e*l*d+e*o*g+n*a*d-s*a*g+s*l*u)}transpose(){const t=this.elements;let 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}setPosition(t,e,s){const n=this.elements;return t instanceof b?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],u=t[8],d=t[9],g=t[10],p=t[11],m=t[12],y=t[13],x=t[14],f=t[15],P=d*x*c-y*g*c+y*l*p-o*x*p-d*l*f+o*g*f,I=m*g*c-u*x*c-m*l*p+a*x*p+u*l*f-a*g*f,T=u*y*c-m*d*c+m*o*p-a*y*p-u*o*f+a*d*f,A=m*d*l-u*y*l-m*o*g+a*y*g+u*o*x-a*d*x,j=e*P+s*I+n*T+r*A;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/j;return t[0]=P*M,t[1]=(y*g*r-d*x*r-y*n*p+s*x*p+d*n*f-s*g*f)*M,t[2]=(o*x*r-y*l*r+y*n*c-s*x*c-o*n*f+s*l*f)*M,t[3]=(d*l*r-o*g*r-d*n*c+s*g*c+o*n*p-s*l*p)*M,t[4]=I*M,t[5]=(u*x*r-m*g*r+m*n*p-e*x*p-u*n*f+e*g*f)*M,t[6]=(m*l*r-a*x*r-m*n*c+e*x*c+a*n*f-e*l*f)*M,t[7]=(a*g*r-u*l*r+u*n*c-e*g*c-a*n*p+e*l*p)*M,t[8]=T*M,t[9]=(m*d*r-u*y*r-m*s*p+e*y*p+u*s*f-e*d*f)*M,t[10]=(a*y*r-m*o*r+m*s*c-e*y*c-a*s*f+e*o*f)*M,t[11]=(u*o*r-a*d*r-u*s*c+e*d*c+a*s*p-e*o*p)*M,t[12]=A*M,t[13]=(u*y*n-m*d*n+m*s*g-e*y*g-u*s*x+e*d*x)*M,t[14]=(m*o*n-a*y*n-m*s*l+e*y*l+a*s*x-e*o*x)*M,t[15]=(a*d*n-u*o*n+u*s*l-e*d*l-a*s*g+e*o*g)*M,this}scale(t){const e=this.elements,s=t.x,n=t.y,r=t.z;return e[0]*=s,e[4]*=n,e[8]*=r,e[1]*=s,e[5]*=n,e[9]*=r,e[2]*=s,e[6]*=n,e[10]*=r,e[3]*=s,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,n))}makeTranslation(t,e,s){return t instanceof b?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),n=Math.sin(e),r=1-s,a=t.x,o=t.y,l=t.z,c=r*a,u=r*o;return this.set(c*a+s,c*o-n*l,c*l+n*o,0,c*o+n*l,u*o+s,u*l-n*a,0,c*l-n*o,u*l+n*a,r*l*l+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,n,r,a){return this.set(1,s,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,s){const n=this.elements,r=e.x,a=e.y,o=e.z,l=e.w,c=r+r,u=a+a,d=o+o,g=r*c,p=r*u,m=r*d,y=a*u,x=a*d,f=o*d,P=l*c,I=l*u,T=l*d,A=s.x,j=s.y,M=s.z;return n[0]=(1-(y+f))*A,n[1]=(p+T)*A,n[2]=(m-I)*A,n[3]=0,n[4]=(p-T)*j,n[5]=(1-(g+f))*j,n[6]=(x+P)*j,n[7]=0,n[8]=(m+I)*M,n[9]=(x-P)*M,n[10]=(1-(g+y))*M,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,s){const n=this.elements;let r=Xe.set(n[0],n[1],n[2]).length();const a=Xe.set(n[4],n[5],n[6]).length(),o=Xe.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],kt.copy(this);const l=1/r,c=1/a,u=1/o;return kt.elements[0]*=l,kt.elements[1]*=l,kt.elements[2]*=l,kt.elements[4]*=c,kt.elements[5]*=c,kt.elements[6]*=c,kt.elements[8]*=u,kt.elements[9]*=u,kt.elements[10]*=u,e.setFromRotationMatrix(kt),s.x=r,s.y=a,s.z=o,this}equals(t){const e=this.elements,s=t.elements;for(let n=0;n<16;n++)if(e[n]!==s[n])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};En.IDENTITY=Object.freeze(new En);let G=En;const Xe=new b,kt=new G,Rl=new b(0,0,0),zl=new b(1,1,1),de=new b,ai=new b,_t=new b;let C=class no{constructor(t=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)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(an.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=an.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new no().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(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)}containsBox(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}getParameter(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))}intersectsBox(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)}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,an).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Wt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Wt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Wt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Wt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Wt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Wt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Wt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Wt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Wt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const Wt=[new b,new b,new b,new b,new b,new b,new b,new b],an=new b,Jr=new X;let pt=class ro{constructor(t=void 0,e=void 0){this.min=t==null?new X(1/0,1/0):new X(t.x,t.y),this.max=e==null?new X(-1/0,-1/0):new X(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=Jr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new ro().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new X(0,0):new X(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new X(0,0):new X(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(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}getParameter(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))}intersectsBox(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)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Jr).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const ta=new b,Vl=new b,Dl=new Us;class Ys{constructor(t=new b(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,n){return this.normal.set(t,e,s),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const n=ta.subVectors(s,e).cross(Vl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||Dl.getNormalMatrix(t),n=this.coplanarPoint(ta).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new Ys().copy(this)}}let k=class ao extends X{clone(){return new ao(this.x,this.y)}static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((s,n)=>{s.toArray(e,n*2)}),e}},w=class oo extends b{clone(){return new oo(this.x,this.y,this.z)}static pointArrayToNumberArray(t,e=!0){const s=e?3:2,n=new Array(t.length*s);return t.forEach((r,a)=>{r.toArray(n,a*s)}),n}};const ea=new G,sa=new Ue,ho=class An{constructor(t=0,e=0,s=0,n=An.DEFAULT_ORDER){this._x=t,this._y=e,this._z=s,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,n=this._order){return this._x=t,this._y=e,this._z=s,this._order=n,this._onChangeCallback(),this}clone(){return new An(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const n=t.elements,r=n[0],a=n[4],o=n[8],l=n[1],c=n[5],u=n[9],d=n[2],g=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(re(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-re(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(re(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-re(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(g,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(re(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-re(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,p),this._y=0);break}return this._order=e,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,s=!0){return ea.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ea,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return sa.setFromEuler(this),this.setFromQuaternion(sa,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(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}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ho.DEFAULT_ORDER="XYZ";let jl=ho;function qn(i,t,e=!1){const s=i.x,n=i.y;let r=!1;const a=t.length;for(let o=0,l=a-1;o<a;l=o++){const c=t[o].x,u=t[o].y,d=t[l].x,g=t[l].y;let p=u>n!=g>n;e&&(p=u>=n!=g>=n),p&&s<(d-c)*(n-u)/(g-u)+c&&(r=!r)}return r}function lo(i,t){if(i.length===0||t.length===0)return!1;const e=new pt().setFromPoints(i),s=new pt().setFromPoints(t);if(!e.intersectsBox(s))return!1;for(let n=0;n<i.length;){if(qn(i[n],t,!0))return!0;n<i.length-1&&$n.equalPoint2d(i[n+1],i[n])&&++n,++n}return!1}const co={isPointInPolygon:qn,isPolygonIntersect:lo};function Wl(i,t){const e=[],s=t-1,n=i;for(let r=0;r<=n;r++)e.push(0);for(let r=1;r<=s-n;r++)e.push(r);for(let r=0;r<=n;r++)e.push(s-n+1);return e}function Gl(i,t){const e=t.length-1,s=i,n=[0];let r=0;for(let o=1;o<=e;o++){const l=t[o][0]-t[o-1][0],c=t[o][1]-t[o-1][1],u=t[o][2]-t[o-1][2],d=Math.sqrt(l*l+c*c+u*u);r+=d,n.push(r)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=e-s;o++){const l=n[o]/r;a.push(l*(e-s+1))}for(let o=0;o<=s;o++)a.push(e-s+1);return a}function uo(i,t="Uniform"){const e=i.length;if(e===0)return[];if(e===1)return[0];const s=e-1;if(t==="Uniform")return new Array(e).fill(0).map((a,o)=>o/s);const n=[0];let r=0;for(let a=1;a<=s;a++){const o=i[a][0]-i[a-1][0],l=i[a][1]-i[a-1][1],c=i[a][2]-i[a-1][2],u=Math.sqrt(o*o+l*l+c*c),d=t==="SqrtChord"?Math.sqrt(u):u;r+=d,n.push(r)}return r<1e-12?new Array(e).fill(0).map((a,o)=>o/s):n.map(a=>a/r)}function po(i,t){const e=t.length-1,s=i,n=e+s+1,r=new Array(n+1).fill(0),a=t[t.length-1];for(let o=n-s;o<=n;o++)r[o]=a;for(let o=1;o<=e-s;o++){let l=0;for(let c=o;c<o+s;c++)l+=t[c];r[o+s]=l/s}return r}function Hl(i,t){const e=t.length-1,s=i,n=[0];let r=0;for(let o=1;o<=e;o++){const l=t[o][0]-t[o-1][0],c=t[o][1]-t[o-1][1],u=t[o][2]-t[o-1][2],d=Math.sqrt(l*l+c*c+u*u),g=Math.sqrt(d);r+=g,n.push(r)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=e-s;o++){const l=n[o]/r;a.push(l*(e-s+1))}for(let o=0;o<=s;o++)a.push(e-s+1);return a}function on(i,t){const e=i.length,s=i.map(a=>a.slice()),n=t.slice();for(let a=0;a<e;a++){let o=a,l=Math.abs(s[a][a]);for(let c=a+1;c<e;c++){const u=Math.abs(s[c][a]);u>l&&(l=u,o=c)}if(l<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==a){const c=s[a];s[a]=s[o],s[o]=c;const u=n[a];n[a]=n[o],n[o]=u}for(let c=a+1;c<e;c++){const u=s[c][a]/s[a][a];if(!(Math.abs(u)<1e-14)){for(let d=a;d<e;d++)s[c][d]-=u*s[a][d];n[c]-=u*n[a]}}}const r=new Array(e).fill(0);for(let a=e-1;a>=0;a--){let o=n[a];for(let l=a+1;l<e;l++)o-=s[a][l]*r[l];r[a]=o/s[a][a]}return r}function Zn(i,t,e="Uniform",s,n){if(i.length===0)return{controlPoints:[],knots:[],weights:[]};const r=i.map(B=>[B[0],B[1],B[2]??0]),a=!!s,o=!!n,l=(a?1:0)+(o?1:0),c=r.length-1,u=c+l;if(u<t)throw new Error("Not enough points to interpolate a curve of this degree.");const d=uo(r,e),g=d.slice();a&&g.unshift(d[0]),o&&g.push(d[d.length-1]);const p=po(t,g),m=u+1,y=new Array(m),x=new Array(m),f=new Array(m),P=new Array(m);let I=0;y[I]=new Array(m).fill(0),y[I][0]=1,x[I]=r[0][0],f[I]=r[0][1],P[I]=r[0][2],I++;for(let B=1;B<=c-1;B++){const et=d[B];y[I]=new Array(m).fill(0);for(let F=0;F<=u;F++)y[I][F]=Ns(F,t,et,p);x[I]=r[B][0],f[I]=r[B][1],P[I]=r[B][2],I++}if(y[I]=new Array(m).fill(0),y[I][u]=1,x[I]=r[c][0],f[I]=r[c][1],P[I]=r[c][2],I++,a){const B=p[t+1]-p[0],et=B!==0?t/B:0;y[I]=new Array(m).fill(0),y[I][0]=-et,y[I][1]=et,x[I]=(s==null?void 0:s[0])??0,f[I]=(s==null?void 0:s[1])??0,P[I]=(s==null?void 0:s[2])??0,I++}if(o){const B=p[u+t+1]-p[u],et=B!==0?t/B:0;y[I]=new Array(m).fill(0),y[I][u-1]=-et,y[I][u]=et,x[I]=(n==null?void 0:n[0])??0,f[I]=(n==null?void 0:n[1])??0,P[I]=(n==null?void 0:n[2])??0,I++}const T=on(y,x),A=on(y,f),j=on(y,P),M=new Array(m);for(let B=0;B<m;B++)M[B]=[T[B],A[B],j[B]];const $=new Array(m).fill(1);return{controlPoints:M,knots:p,weights:$}}function Ns(i,t,e,s){if(t===0)return e>=s[i]&&e<s[i+1]?1:0;const n=s[i+t]-s[i],r=s[i+t+1]-s[i+1],a=n>1e-10?(e-s[i])/n:0,o=r>1e-10?(s[i+t+1]-e)/r:0;return a*Ns(i,t-1,e,s)+o*Ns(i+1,t-1,e,s)}function Ms(i,t,e,s,n){const r=s.length-1,a=t;if(i=Math.max(e[a],Math.min(e[r+1],i)),Math.abs(i-e[r+1])<1e-8)return[...s[r]];if(Math.abs(i-e[a])<1e-8)return[...s[0]];const o=[0,0,0];let l=0;for(let c=0;c<=r;c++){const u=Ns(c,a,i,e),d=n[c]*u;o[0]+=s[c][0]*d,o[1]+=s[c][1]*d,o[2]+=s[c][2]*d,l+=d}if(Math.abs(l)<1e-10){const c=e[e.length-a-1];if(Math.abs(i-c)<1e-8)return[...s[r]];if(Math.abs(i-e[a])<1e-8)return[...s[0]]}return Math.abs(l)>=1e-10&&(o[0]/=l,o[1]/=l,o[2]/=l),o}function go(i,t,e,s){const n=i,r=t[n],a=t[t.length-n-1];let o=0;const l=1e3,c=(a-r)/l;let u=Ms(r,i,t,e,s);for(let y=1;y<=l;y++){const x=r+y*c,f=Ms(x,i,t,e,s),P=f[0]-u[0],I=f[1]-u[1],T=f[2]-u[2];o+=Math.sqrt(P*P+I*I+T*T),u=f}const d=Ms(a,i,t,e,s),g=d[0]-u[0],p=d[1]-u[1],m=d[2]-u[2];return o+=Math.sqrt(g*g+p*p+m*m),o}function Ul(i,t=3,e="Uniform",s,n){return i.length===0?[]:Zn(i,t,e,s,n).controlPoints}const ia=new G,na=new b,Xl=new b,Yl=new b,hn=new w;function mo(i){return new G().setFromExtrusionDirection(new b(i.x,i.y,i.z))}function Kn(i){return ia.setFromExtrusionDirection(new b(i.x,i.y,i.z)),ia.extractBasis(na,Xl,Yl),na.clone()}function Mn(i,t){return new w(i.x,i.y,i.z??0).applyMatrix4(mo(t))}function Cs(i,t){return new w(i.x,i.y,i.z??0).applyMatrix4(mo(t).invert())}function Tn(i,t,e){const s=Cs(i,e),n=Cs(t,e);return hn.set(n.x-s.x,n.y-s.y,(n.z??0)-(s.z??0)),v.normalizeAngle(Math.atan2(hn.y,hn.x))}let yo=class{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}};class Qn extends yo{translate(t){return this.transform(new Us().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}let ts=class _o extends Qn{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new pt}transform(t){return this._loops.forEach(e=>{e.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){const t=new _o;return this._loops.forEach(e=>{t.add(e.clone())}),t}getPoints(t){const e=[];for(let s=0;s<this.loops.length;++s){const n=this.loops[s].getPoints(t);e.push(n)}return e}buildHierarchy(){var t;const e=this.getPoints(100),s=this.calculateBoundaryBoxes(e),n=this.sortBoundaryBoxesByAreas(s),r=new Map,a=n.length;for(let l=0;l<a;l++)r.set(n[l],{index:n[l],children:[]});const o={index:-1,children:[]};for(let l=0;l<a;l++){const c=n[l],u=e[c],d=s[c];let g=l+1;for(;g<a;g++){const p=n[g],m=e[p];if(s[p].containsBox(d)&&co.isPointInPolygon(u[v.randInt(0,u.length-1)],m)){(t=r.get(p))==null||t.children.push(r.get(c));break}}g===a&&o.children.push(r.get(c))}return o}get area(){if(this._loops.length===0)return 0;let t=0;for(let e=0;e<this._loops.length;e++){const s=this._loops[e].getPoints(128),n=this.polygonArea(s);e===0?t+=Math.abs(n):t-=Math.abs(n)}return t}polygonArea(t){const e=t.length;if(e<3)return 0;let s=0;for(let n=0,r=e-1;n<e;r=n++){const a=t[r],o=t[n];s+=a.x*o.y-o.x*a.y}return s*.5}calculateBoundaryBoxes(t){const e=[];return t.forEach(s=>{e.push(new pt().setFromPoints(s))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((n,r)=>{const a=n.size,o=a.width*a.height;e.push({area:o,index:r})}),e.sort((n,r)=>n.area-r.area);const s=[];return e.forEach(n=>{s.push(n.index)}),s}},is=class extends Qn{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let s,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)s=this.getPoint(a/t),r+=s.distanceTo(n),e.push(r),n=s;return e}getUtoTmapping(t,e){const s=this.getLengths();let n=0;const r=s.length;let a;e?a=e:a=t*s[r-1];let o=0,l=r-1,c;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),c=s[n]-a,c<0)o=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,s[n]===a)return n/(r-1);const u=s[n],d=s[n+1]-u,g=(a-u)/d;return(n+g)/(r-1)}getTangent(t){let e=t-1e-4,s=t+1e-4;e<0&&(e=0),s>1&&(s=1);const n=this.getPoint(e),r=this.getPoint(s),a=new k;return a.copy(r).sub(n).normalize(),a}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}},ye=class vn extends is{constructor(t,e,s,n,r){super();const a=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(n!==void 0)+ +(r!==void 0);if(a==3)typeof t=="object"&&typeof e=="object"&&typeof s=="object"?this.createByThreePoints(t,e,s):this.createByStartEndPointsAndBulge(t,e,s);else if(a==5){const o=t;this.center=new k(o.x,o.y),this.radius=e,this._clockwise=r,this._startAngle=this._clockwise?this._mirrorAngle(v.normalizeAngle(s)):v.normalizeAngle(s),this._endAngle=this._clockwise?this._mirrorAngle(v.normalizeAngle(n)):v.normalizeAngle(n)}else throw yt.ILLEGAL_PARAMETERS}createByThreePoints(t,e,s){const n=(M,$)=>({x:(M.x+$.x)/2,y:(M.y+$.y)/2}),r=(M,$)=>($.y-M.y)/($.x-M.x),a=M=>-1/M,o=n(t,e),l=n(e,s),c=r(t,e),u=r(e,s),d=a(c),g=a(u),p=(M,$,B,et)=>{const F=(et-$)/(M-B),U=M*F+$;return{x:F,y:U}},m=o.y-d*o.x,y=l.y-g*l.x,x=p(d,m,g,y),f=Math.sqrt(Math.pow(t.x-x.x,2)+Math.pow(t.y-x.y,2)),P=(M,$)=>Math.atan2(M.y-$.y,M.x-$.x),I=P(t,x),T=P(e,x),A=P(s,x),j=A>I&&A<T||I>A&&I<T||T>A&&T<I;this.center=x,this.radius=f,this._clockwise=!j,this._startAngle=I,this._endAngle=A}createByStartEndPointsAndBulge(t,e,s){let n,r,a;s<0?(n=Math.atan(-s)*4,r=new X(t),a=new X(e)):(n=Math.atan(s)*4,r=new X(e),a=new X(t));const o=new X().subVectors(a,r),l=o.length(),c=new X().addVectors(r,o.multiplyScalar(.5)),u=Math.abs(l/2/Math.tan(n/2)),d=o.normalize(),g=s<0?-Math.PI/2:Math.PI/2,p=new X(d.x*Math.cos(g)-d.y*Math.sin(g),d.y*Math.cos(g)+d.x*Math.sin(g));let m;n<Math.PI?s<0?m=c.add(p.multiplyScalar(u)):m=c.add(p.multiplyScalar(-u)):s<0?m=c.add(p.multiplyScalar(-u)):m=c.add(p.multiplyScalar(u)),s<0?(this._startAngle=Math.atan2(r.y-m.y,r.x-m.x),this._endAngle=Math.atan2(a.y-m.y,a.x-m.x)):(this._startAngle=Math.atan2(a.y-m.y,a.x-m.x),this._endAngle=Math.atan2(r.y-m.y,r.x-m.x)),this._clockwise=s<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(t){this._center=new k(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(v.normalizeAngle(t)):v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const e=this.startAngle==0&&t==W?t:v.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(e):e,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return this.clockwise?v.normalizeAngle(t-e):v.normalizeAngle(e-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),e=this._clockwise?v.normalizeAngle(t-this.deltaAngle/2):v.normalizeAngle(t+this.deltaAngle/2),s=this._clockwise?this._mirrorAngle(e):e;return this.getPointAtAngle(s)}get closed(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return Math.abs(e-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const r of e){const a=this._getInternalAngle(r);v.isBetweenAngle(a,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(r))}const s=t.map(r=>r.x),n=t.map(r=>r.y);return new pt(new k(Math.min(...s),Math.min(...n)),new k(Math.max(...s),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){const e=t,s=this.center.clone().applyMatrix2d(e),n=this.startPoint.clone().applyMatrix2d(e);if(this.closed)return this.center=s,this.radius=s.distanceTo(n),this._startAngle=Math.atan2(n.y-s.y,n.x-s.x),this._endAngle=this._startAngle,this._clockwise=e.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;const r=this.midPoint.clone().applyMatrix2d(e),a=this.endPoint.clone().applyMatrix2d(e),o=new vn(n,r,a),l=e.determinant()<0?!this.clockwise:this.clockwise,c=u=>{const d=v.normalizeAngle(u);return l?this._mirrorAngle(d):d};return this.center=o.center,this.radius=o.radius,this.clockwise=l,this.startAngle=c(Math.atan2(n.y-o.center.y,n.x-o.center.x)),this.endAngle=c(Math.atan2(a.y-o.center.y,a.x-o.center.x)),this._boundingBoxNeedsUpdate=!0,this}clone(){return new vn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const e=this._getInternalAngle(t),s=this.center.x+this.radius*Math.cos(e),n=this.center.y+this.radius*Math.sin(e);return new k(s,n)}getPoints(t=100){const e=[];let s=this.deltaAngle,n=this._getInternalAngle(this.startAngle);if(this.closed&&(s=W,n=0),this.clockwise)for(let r=0;r<=t;r++){const a=n-s*(r/t),o=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(o);e.push(new k(l.x,l.y))}else for(let r=0;r<=t;r++){const a=n+s*(r/t),o=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(o);e.push(new k(l.x,l.y))}return e}};class $l extends yo{translate(t){return this.transform(new G().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class $s extends $l{}class _e extends $s{constructor(t,e){super(),this._start=new w(t),this._end=new w(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new b().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new w((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const s=this.delta(Ie).normalize();return new w(this._start).addScaledVector(s,t)}else{const s=this.delta(Ie).normalize();return new w(this._end).addScaledVector(s,t)}}extend(t,e=!1){if(e){const s=Ie.subVectors(this._start,this._end).normalize();this._start=new w(this._start).addScaledVector(s,t)}else{const s=this.delta(Ie).normalize();this._end=new w(this._end).addScaledVector(s,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){ra.subVectors(t,this._start),oi.subVectors(this.endPoint,this.startPoint);const s=oi.dot(oi);let n=oi.dot(ra)/s;return e&&(n=v.clamp(n,0,1)),n}closestPointToPoint(t,e,s){const n=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,s=Ie.subVectors(t,this.startPoint).dot(e);return new w().copy(e).multiplyScalar(s).add(this.startPoint)}perpPoint(t){const e=this.direction,s=this.startPoint,n=Ie.subVectors(t,s).dot(e),r=Ie.copy(e).multiplyScalar(n);return new w().addVectors(s,r)}calculateBoundingBox(){const t=new w(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),e=new w(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 C(t,e)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new _e(this._start.clone(),this._end.clone())}}const Ie=new b,ra=new b,oi=new b;class je extends $s{static computeCenterPoint(t,e,s){const n=new b().addVectors(t,e).multiplyScalar(.5),r=new b().addVectors(t,s).multiplyScalar(.5),a=new b().subVectors(e,t),o=new b().subVectors(s,t),l=new b().crossVectors(a,o).normalize();if(l.lengthSq()===0)return null;const c=new b().crossVectors(a,l).normalize(),u=new b().crossVectors(o,l).normalize(),d=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),g=u.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new _e(n,n.clone().add(d)),m=new _e(r,r.clone().add(g)),y=new b;return p.closestPointToPoint(m.startPoint,!0,y)?y:null}static createByThreePoints(t,e,s){const n=je.computeCenterPoint(t,e,s);if(n){const r=n.distanceTo(t),a=new b().subVectors(t,n),o=new b().subVectors(e,n),l=Math.atan2(a.y,a.x),c=Math.atan2(o.y,o.x);return new je(n,r,l,c,b.Z_AXIS)}}constructor(t,e,s,n,r,a=b.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=s,this.endAngle=n,this.normal=r,this.refVec=a,(n-s)%W==0?(this.startAngle=0,this.endAngle=W):(this.startAngle=s,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new w(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==W?t:v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return v.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new b(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new b(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;this.closed&&(t=0,e=W);const s=t+e*.5;return this.getPointAtAngle(s)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const e=new b(t.x,t.y,t.z||0),s=this.center,n=this.normal,r=e.clone().sub(s).dot(n),a=e.clone().sub(n.clone().multiplyScalar(r)).clone().sub(s);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const o=s.clone().add(a),l=this.getAngle(o.clone()),c=this.startAngle,u=this.deltaAngle;let d=v.normalizeAngle(l-c);d<0&&(d=0),d>u&&(d=u);const g=this.getPointAtAngle(c+d),p=g.distanceTo(e),m=this.startPoint.distanceTo(e),y=this.endPoint.distanceTo(e);return m<p&&m<=y?this.startPoint.clone():y<p&&y<m?this.endPoint.clone():g}tangentPoints(t){const e=[],s=new b(t.x,t.y,t.z||0),n=this.center,r=this.normal,a=this.radius,o=s.clone().sub(n).dot(r),l=s.clone().sub(r.clone().multiplyScalar(o)),c=n.clone(),u=l.clone().sub(c).length();if(u<a)return e;const d=Math.acos(a/u),g=this.getAngle(l.clone()),p=[g+d,g-d];for(const m of p){const y=v.normalizeAngle(m-this.startAngle);y>=0&&y<=this.deltaAngle&&e.push(this.getPointAtAngle(this.startAngle+y))}return e}nearestTangentPoint(t){const e=this.tangentPoints(t);if(e.length===0)return null;const s=new w(t.x,t.y,t.z||0);return e.length===1||e[0].distanceTo(s)<e[1].distanceTo(s)?e[0]:e[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let l=0;l<2*Math.PI;l+=Math.PI/2)v.isBetweenAngle(l,this.startAngle,this.endAngle)&&t.push(l);let e=1/0,s=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(const l of t){const c=this.getPointAtAngle(l);c.x<e&&(e=c.x),c.y<s&&(s=c.y),c.z<n&&(n=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new C({x:e,y:s,z:n},{x:r,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let s=this.deltaAngle,n=this.startAngle;this.closed&&(s=W,n=0);for(let r=0;r<=t;r++){const a=n+s*(r/t),o=this.getPointAtAngle(a);e.push(o)}return e}transform(t){const e=this.center.clone().applyMatrix4(t),s=this.startPoint.clone().applyMatrix4(t),n=this.endPoint.clone().applyMatrix4(t),r=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(t),a=new b(s).sub(e).normalize(),o=e.distanceTo(s);let l=new b().crossVectors(new b(s).sub(e),new b(r).sub(e)).normalize();l.lengthSq()===0&&(l=this.normal.clone().transformDirection(t));const c=u=>{const d=new b(u).sub(e);return Math.atan2(d.dot(aa.crossVectors(l,a)),d.dot(a))};return this.center=e,this.radius=o,this.normal=l,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?W:c(n),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new je(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(aa.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,s=this.refVec,n={x:e.y*s.z-e.z*s.y,y:e.z*s.x-e.x*s.z,z:e.x*s.y-e.y*s.x},r=this.center,a=this.radius;return new w(r.x+a*(s.x*Math.cos(t)+n.x*Math.sin(t)),r.y+a*(s.y*Math.cos(t)+n.y*Math.sin(t)),r.z+a*(s.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new b(this.center).distanceTo(Yn);return new Ys(this.normal,t)}}const aa=new b;let Bs=class pi extends is{constructor(t,e,s,n=0,r=W,a=!1,o=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=s,(r-n)%W==0?(this.startAngle=0,this.endAngle=W):(this.startAngle=n,this.endAngle=r),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(t){this._center=new w(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==W?t:v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return v.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,s=-1/0,n=-1/0;for(let r=0;r<=100;r++){const a=this.getPoint(r/100);t=Math.min(t,a.x),e=Math.min(e,a.y),s=Math.max(s,a.x),n=Math.max(n,a.y)}return new pt({x:t,y:e},{x:s,y:n})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let s=this.endAngle-this.startAngle;const n=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=e;for(;s>e;)s-=e;s<Number.EPSILON&&(n?s=0:s=e),this.clockwise===!0&&!n&&(s===e?s=-e:s=s-e);const r=this.startAngle+t*s;let a=this.center.x+this.majorAxisRadius*Math.cos(r),o=this.center.y+this.minorAxisRadius*Math.sin(r);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,d=o-this.center.y;a=u*l-d*c+this.center.x,o=u*c+d*l+this.center.y}return new k(a,o)}transform(t){const e=t,s=new k(this.center).applyMatrix2d(e),n=new w(s.x,s.y,this.center.z),r=this.getPointAtAngle(0).clone().applyMatrix2d(e),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(e),o=new k(r).sub(s),l=new k(a).sub(s),c=o.length(),u=l.length(),d=Math.atan2(o.y,o.x),g=o.clone().normalize(),p=l.clone().normalize(),m=f=>{const P=new k(f).sub(s),I=P.dot(g),T=P.dot(p);return v.normalizeAngle(Math.atan2(T/u,I/c))},y=e.determinant()<0?!this.clockwise:this.clockwise,x=this.closed?new pi(n,c,u,0,W,y,d):new pi(n,c,u,m(this.startPoint.clone().applyMatrix2d(e)),m(this.endPoint.clone().applyMatrix2d(e)),y,d);return this.center=x.center,this.majorAxisRadius=x.majorAxisRadius,this.minorAxisRadius=x.minorAxisRadius,this._startAngle=x._startAngle,this._endAngle=x._endAngle,this._clockwise=x._clockwise,this.rotation=x.rotation,this._boundingBoxNeedsUpdate=!0,this}getPointAtAngle(t){return this.getPoint(this.closed?t/W:v.normalizeAngle(t-this.startAngle)/this.deltaAngle)}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new pi(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}};class Je extends $s{constructor(t,e,s,n,r,a=0,o=W){super(),this.center=t,this.normal=e,this.majorAxis=s,this.majorAxisRadius=n,this.minorAxisRadius=r;const l=Math.abs(o-a);Math.abs(l-W)<1e-10||Math.abs(l-2*W)<1e-10?(this.startAngle=0,this.endAngle=W):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new w(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==W?t:v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-W)<1e-10?W:v.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new b(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new b(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new b().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;(this.closed||Math.abs(e-W)<1e-10)&&(t=0,e=W);const s=t+e/2;return this.getPointAtAngle(s)}get isCircular(){return Xs.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let s=0,n=this.getPointAtAngle(this.startAngle);for(let r=1;r<=t;r++){const a=this.startAngle+r*e,o=this.getPointAtAngle(a),l=o.x-n.x,c=o.y-n.y,u=o.z-n.z;s+=Math.sqrt(l*l+c*c+u*u),n=o}return s}get area(){const t=this.majorAxisRadius,e=this.minorAxisRadius,s=this.startAngle,n=s+this.deltaAngle;if(Math.abs(this.deltaAngle-W)<1e-10)return Math.PI*t*e;const r=t*e/2*(n-s-(Math.sin(n)*Math.cos(n)-Math.sin(s)*Math.cos(s)));return Math.abs(r)}calculateBoundingBox(){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)){const t=[this.startAngle,this.endAngle];for(let l=0;l<2*Math.PI;l+=Math.PI/2)v.isBetweenAngle(l,this.startAngle,this.endAngle)&&t.push(l);let e=1/0,s=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(const l of t){const c=this.getPointAtAngle(l);c.x<e&&(e=c.x),c.y<s&&(s=c.y),c.z<n&&(n=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new C({x:e,y:s,z:n},{x:r,y:a,z:o})}else{let t=1/0,e=1/0,s=1/0,n=-1/0,r=-1/0,a=-1/0;for(let o=0;o<=100;o++){const l=this.startAngle+this.deltaAngle*(o/100),c=this.getPointAtAngle(l);t=Math.min(t,c.x),e=Math.min(e,c.y),s=Math.min(s,c.z),n=Math.max(n,c.x),r=Math.max(r,c.y),a=Math.max(a,c.z)}return new C({x:t,y:e,z:s},{x:n,y:r,z:a})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let s=this.deltaAngle,n=this.startAngle;this.closed&&(s=W,n=0);for(let r=0;r<=t;r++){const a=n+s*(r/t),o=this.getPointAtAngle(a);e.push(o)}return e}getPointAtAngle(t){const e=Math.cos(t),s=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),r=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(n);return new w(this.center.x+r.x,this.center.y+r.y,this.center.z+r.z)}contains(t){const e=new b(t).sub(this.center),s=e.dot(this.majorAxis),n=e.dot(this.minorAxis),r=s/this.majorAxisRadius,a=n/this.minorAxisRadius;return r*r+a*a<=1}transform(t){const e=t,s=this.center.clone().applyMatrix4(e),n=this.getPointAtAngle(0).clone().applyMatrix4(e),r=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(e),a=new b(n).sub(s),o=new b(r).sub(s),l=a.length(),c=o.length(),u=a.clone().normalize(),d=new b().crossVectors(a,o).normalize();let g=new b().crossVectors(d,u).normalize();g.dot(o)<0&&(d.negate(),g=new b().crossVectors(d,u).normalize());const p=y=>{const x=new b(y).sub(s),f=x.dot(u),P=x.dot(g);return v.normalizeAngle(Math.atan2(P/c,f/l))},m=this.closed?new Je(s,d,u,l,c,0,W):new Je(s,d,u,l,c,p(this.startPoint.clone().applyMatrix4(e)),p(this.endPoint.clone().applyMatrix4(e)));return this.center=m.center,this.normal=m.normal,this.majorAxis=m.majorAxis,this.majorAxisRadius=m.majorAxisRadius,this.minorAxisRadius=m.minorAxisRadius,this._startAngle=m._startAngle,this._endAngle=m._endAngle,this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Je(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new b(this.center).distanceTo(Yn);return new Ys(this.normal,t)}}class Tt extends is{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new k(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new k(e.x,e.y)}else{const e=this._vertices[t-1];return new k(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let s=0;s<e;++s){const n=this._vertices[s];let r=null;if(s<e-1?r=this._vertices[s+1]:s==e-1&&this.closed&&(r=this._vertices[0]),r)if(n.bulge){const a=new ye(n,r,n.bulge);t+=a.length}else t+=new k(n.x,n.y).distanceTo(r)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}removeVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error(`Index ${t} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0}reset(t,e){t?e!==void 0&&e>=0&&e<this._vertices.length&&(this._vertices=this._vertices.slice(0,e),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(t){const e=this._vertices[t];return new k(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new pt().setFromPoints(t)}transform(t){const e=t.determinant()<0;return this._vertices.forEach(s=>{const n=new k(s).applyMatrix2d(t);s.x=n.x,s.y=n.y,e&&s.bulge!=null&&(s.bulge=-s.bulge)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Tt(this._vertices.map(t=>({...t})),this._closed)}getPoints3d(t,e){const s=[];return this.getPoints(t).forEach(n=>s.push(new w().set(n.x,n.y,e))),s}getPoints(t){const e=[],s=this._vertices.length;for(let n=0;n<s;++n){const r=this._vertices[n];if(r.bulge){let a=null;if(n<s-1?a=this._vertices[n+1]:n==s-1&&this.closed&&(a=this._vertices[0]),a){const o=new ye(r,a,r.bulge).getPoints(t),l=o.length;for(let c=0;c<l;++c){const u=o[c];e.push(new k(u.x,u.y))}}}else e.push(new k(r.x,r.y)),n==s-1&&this.closed&&e.push(e[0])}return e}}class Vt extends is{constructor(t,e){super(),this._start=new k(t),this._end=new k(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new k(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new k(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new pt(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Vt(this._start.clone(),this._end.clone())}}let Fs=class Ct extends is{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}static buildFromEdges(t,e=.001){if(t.length===0)return[];const s=[...t],n=[],r=e*e,a=(o,l)=>{const c=o.x-l.x,u=o.y-l.y;return c*c+u*u<=r};for(;s.length>0;){const o=[],l=s.shift();o.push(l);const c=Ct.getEdgeStartPoint(l);let u=Ct.getEdgeEndPoint(l);if(!a(c,u))for(;s.length>0;){const d=Ct.findConnectingEdge(s,u,r);if(d.index<0)break;let g=s.splice(d.index,1)[0];if(d.reverse&&(g=Ct.reverseEdge(g)),o.push(g),u=Ct.getEdgeEndPoint(g),a(u,c))break}n.push(new Ct(o))}return n}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new k(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new pt;return e.setFromPoints(t),e}transform(t){const e=new G().set(t.elements[0],t.elements[3],0,t.elements[6],t.elements[1],t.elements[4],0,t.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(s=>{s instanceof Dt?s.transform(e):s.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ct(this._curves.map(t=>t.clone()))}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(s=>{s.getPoints(t).forEach(n=>{e.push(new k(n.x,n.y))})}),e}static findConnectingEdge(t,e,s){let n=-1,r=!1,a=Number.POSITIVE_INFINITY;for(let o=0;o<t.length;o++){const l=t[o],c=Ct.getEdgeStartPoint(l),u=Ct.getEdgeEndPoint(l),d=e.x-c.x,g=e.y-c.y,p=d*d+g*g;p<a&&(a=p,n=o,r=!1);const m=e.x-u.x,y=e.y-u.y,x=m*m+y*y;x<a&&(a=x,n=o,r=!0)}return a>s?{index:-1,reverse:!1}:{index:n,reverse:r}}static getEdgeStartPoint(t){const e=t.startPoint;return new k(e.x,e.y)}static getEdgeEndPoint(t){const e=t.endPoint;return new k(e.x,e.y)}static reverseEdge(t){return t instanceof Vt?new Vt(t.endPoint,t.startPoint):t instanceof ye?new ye(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof Bs?new Bs(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof Dt?Ct.reverseSplineEdge(t):t}static reverseSplineEdge(t){const e=[...t.controlPoints].reverse(),s=t.knots,n=s[0],r=s[s.length-1],a=s.map(c=>n+r-c).reverse(),o=t.weights,l=o.length>0?[...o].reverse():void 0;return new Dt(e,a,l,t.degree,t.closed)}};class ln{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,s,n){this.c0=t,this.c1=s,this.c2=-3*t+3*e-2*s-n,this.c3=2*t-2*e+s+n}initCatmullRom(t,e,s,n,r){this.init(e,s,r*(s-t),r*(n-e))}initNonuniformCatmullRom(t,e,s,n,r,a,o){let l=(e-t)/r-(s-t)/(r+a)+(s-e)/a,c=(s-e)/a-(n-e)/(a+o)+(n-s)/o;l*=a,c*=a,this.init(e,s,l,c)}calc(t){const e=t*t,s=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*s}}class Qi extends $s{constructor(t=[],e=!1,s="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new b,this._px=new ln,this._py=new ln,this._pz=new ln,this._points=t.map(r=>new w(r)),this._closed=e,this._curveType=s,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new w}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new w}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new w){const s=e,n=this._points,r=n.length;if(r===0)return s.set(0,0,0);if(r===1)return s.copy(n[0]);const a=(r-(this._closed?0:1))*t;let o=Math.floor(a),l=a-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,u;this._closed||o>0?c=n[(o-1)%r]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),c=new w(this._tmp.x,this._tmp.y,this._tmp.z));const d=n[o%r],g=n[(o+1)%r];if(this._closed||o+2<r?u=n[(o+2)%r]:(this._tmp.subVectors(n[r-1],n[r-2]).add(n[r-1]),u=new w(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const p=this._curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(d),p),y=Math.pow(d.distanceToSquared(g),p),x=Math.pow(g.distanceToSquared(u),p);y<1e-4&&(y=1),m<1e-4&&(m=y),x<1e-4&&(x=y),this._px.initNonuniformCatmullRom(c.x,d.x,g.x,u.x,m,y,x),this._py.initNonuniformCatmullRom(c.y,d.y,g.y,u.y,m,y,x),this._pz.initNonuniformCatmullRom(c.z,d.z,g.z,u.z,m,y,x)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,d.x,g.x,u.x,this._tension),this._py.initCatmullRom(c.y,d.y,g.y,u.y,this._tension),this._pz.initCatmullRom(c.z,d.z,g.z,u.z,this._tension));return s.set(this._px.calc(l),this._py.calc(l),this._pz.calc(l)),s}getPoints(t){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}setPoints(t){this._points=t.map(e=>new w(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}clone(){return new Qi(this._points.map(t=>t.clone()),this._closed,this._curveType,this._tension)}transform(t){return this._points=this._points.map(e=>{const s=new w;return s.copy(e),s.applyMatrix4(t),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new C;const t=new C;return this._points.forEach(e=>{t.expandByPoint(e)}),t}}let Bt=class Ps{constructor(t,e,s,n){this._degree=t,this._knots=[...e],this._controlPoints=s.map(r=>({x:r.x,y:r.y,z:r.z})),this._weights=n?[...n]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}clone(){return new Ps(this._degree,this._knots,this._controlPoints,this._weights)}point(t){const e=this._controlPoints.map(s=>[s.x,s.y,s.z]);return Ms(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return go(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,s,n){return new Ps(t,e,s,n)}static byPoints(t,e,s="Uniform",n,r){const a=Zn(t,e,s,n,r),o=a.controlPoints.map(l=>({x:l[0],y:l[1],z:l[2]}));return new Ps(e,a.knots,o,a.weights)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:s,end:n}=this.getParameterRange();for(let r=0;r<=t;r++){const a=s+(n-s)*(r/t);e.push(this.point(a))}return e}isClosed(t=1e-6){const{start:e,end:s}=this.getParameterRange(),n=this.point(e),r=this.point(s),a=n[0]-r[0],o=n[1]-r[1],l=n[2]-r[2];return Math.sqrt(a*a+o*o+l*l)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Qi(t,!0,"centripetal"),s=Math.max(50,t.length*2);return e.getPoints(s)}static createClosedCurve(t,e,s="Chord"){const n=this.createFitPointsForClosedCurve(t).map(r=>[r.x,r.y,r.z]);return Ps.byPoints(n,e,s)}},Dt=class gi extends $s{constructor(t,e,s,n,r,a){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(e)){if(o<2||o>5)throw yt.ILLEGAL_PARAMETERS;this._controlPoints=t;let l,c=3,u=!1;if(o>=3&&(Array.isArray(s)?(l=s,o>=4&&(c=n||3),o>=5&&(u=r)):s!==void 0&&(c=s||3,o>=4&&(u=n))),s===void 0&&o>=4&&(c=n||3,o>=5&&(u=r)),this._degree=c,this._closed=u,this._controlPoints.length<this._degree+1)throw yt.ILLEGAL_PARAMETERS;this._nurbsCurve=Bt.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,l)}else{if(o<2||o>6)throw yt.ILLEGAL_PARAMETERS;this._fitPoints=t,this._knotParameterization=e,o>=3&&(this._degree=s||3);const l=typeof n=="boolean";o>=4&&l&&(this._closed=n),l?(o>=5&&(this._startTangent=r),o>=6&&(this._endTangent=a)):(o>=4&&(this._startTangent=n),o>=5&&(this._endTangent=r)),this._closed&&(this._startTangent=void 0,this._endTangent=void 0);const c=(this._startTangent?1:0)+(this._endTangent?1:0);if(this._fitPoints.length+c<this._degree+1)throw yt.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=Bt.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const u=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Bt.byPoints(u,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(u=>[u.x,u.y,u.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=Bt.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Bt.byPoints(e,this._degree,this._knotParameterization)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Bt.byPoints(t,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(t=>[t.x,t.y,t.z||0]))}else if(this._controlPoints)if(this._closed){const t=Bt.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Bt.byPoints(e,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(s=>[s.x,s.y,s.z||0]))}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._nurbsCurve=Bt.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get fitPoints(){var t;return(t=this._fitPoints)==null?void 0:t.map(e=>({x:e.x,y:e.y,z:e.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[e],n=this._nurbsCurve.point(s);return new w(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[t.length-e-1],n=this._nurbsCurve.point(s);return new w(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,s=t<0||t>=e?e-1:t,n=this._fitPoints[s];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const e=this._controlPoints.length,s=t<0||t>=e?e-1:t;return this._controlPoints[s]}getPoints(t=100){const e=this._nurbsCurve,s=[],n=e.knots(),r=this._nurbsCurve.degree(),a=n[r],o=n[n.length-r-1],l=(o-a)/(t-1);for(let c=0;c<t;c++){const u=c===t-1?o:a+c*l,d=e.point(u);s.push(new w(d[0],d[1],d[2]))}return s}getCurvePoints(t,e){const s=[],n=t.knots(),r=t.degree(),a=n[r],o=(n[n.length-r-1]-a)/(e-1);for(let l=0;l<e;l++){const c=a+l*o;s.push(t.point(c))}return s}calculateBoundingBox(){const t=this.getPoints(100);return new C().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(e=>new w(e).applyMatrix4(t)),this._startTangent&&(this._startTangent=new w(this._startTangent).transformDirection(t)),this._endTangent&&(this._endTangent=new w(this._endTangent).transformDirection(t)),this.buildCurve();else{const e=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(n=>new w(n).applyMatrix4(t)),this._nurbsCurve=Bt.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,s.length>0?s:void 0)}return this._boundingBoxNeedsUpdate=!0,this}clone(){return this._fitPoints&&this._knotParameterization?new gi(this._fitPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._knotParameterization,this._degree,this._closed,this._startTangent?{x:this._startTangent.x,y:this._startTangent.y,z:this._startTangent.z||0}:void 0,this._endTangent?{x:this._endTangent.x,y:this._endTangent.y,z:this._endTangent.z||0}:void 0):new gi(this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((s,n)=>{e[n]=[s.x,s.y,s.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((s,n)=>{e[n]={x:s[0],y:s[1],z:s[2]}}),e}toNurbsPoint(t){return[t.x,t.y,t.z||0]}static createClosedSpline(t,e="Uniform",s=3){if(t.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new gi(t,e,s,!0)}};var Jn=(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))(Jn||{}),We=(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",i))(We||{}),ae=(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",i))(ae||{}),ot=(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))(ot||{}),tr=(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",i))(tr||{}),er=(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",i))(er||{}),sr=(i=>(i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",i))(sr||{});let wo=class xo{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new w,this._height=0,this._width=0,this._viewCenter=new w,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new pt;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new pt;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new xo;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}copy(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}};const cr=class cr extends he{constructor(){super(...arguments),this._visibility=!0,this._transparency=new Ki}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._color==null&&(this._color=new tt,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}set color(t){this._color==null&&(this._color=new tt),this._color.copy(t)}get resolvedColor(){var e;let t=this.color;if(t.isByLayer){const s=this.getLayerColor();s&&s.RGB!=null&&(t=s)}else if(t.isByBlock){const s=this.database.cecolor;if(s&&(t=s,t.isByLayer)){const n=this.database.clayer||this.layer,r=this.database.tables.layerTable.getAt(n);((e=r==null?void 0:r.color)==null?void 0:e.RGB)!=null&&(t=r.color)}}return t}get rgbColor(){const e=this.resolvedColor.RGB;return e??16777215}get lineType(){var t;return this._lineType==null&&(this._lineType=((t=this.database)==null?void 0:t.celtype)??At),this._lineType}set lineType(t){t?t.toUpperCase()==="BYLAYER"?this._lineType=At:t.toUpperCase()==="BYBLOCK"?this._lineType=Qe:this._lineType=t:this._lineType=At}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??We.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()}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._color=new tt,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??At),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??We.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,s,n,r,a){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){const s=t.subEntityTraits;s.color=this.resolvedColor,s.rgbColor=this.rgbColor,s.lineType=this.lineStyle,s.lineTypeScale=this.linetypeScale,s.lineWeight=this.lineWeight,s.transparency=this.transparency,s.layer=this.layer,s.drawOrder=0,"thickness"in this&&(s.thickness=this.thickness);const n=this.subWorldDraw(t,e);return this.attachEntityInfo(n),n}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}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.copy(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 n;const{type:t,name:e}=this.getLineType(),s=(n=this.database)==null?void 0:n.tables.linetypeTable.getAt(e);return s?{type:t,...s.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==At){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==Qe?{type:"ByBlock",name:Ke}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Ke}}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)}};cr.typeName="Entity";let gt=cr;const dr=class dr extends gt{};dr.typeName="Curve";let rt=dr;var $e=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.FitCurvePoly=1]="FitCurvePoly",i[i.QuadSplinePoly=2]="QuadSplinePoly",i[i.CubicSplinePoly=3]="CubicSplinePoly",i))($e||{});const ur=class ur extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,s=0,n=!1,r=0,a=0,o=null){super(),this._polyType=t,this._elevation=s;const l=o&&(o==null?void 0:o.length)===e.length,c=e.map((u,d)=>({x:u.x,y:u.y,bulge:l?o[d]:void 0}));this._geo=new Tt(c,n)}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}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 C({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 s=this._geo.getPointAt(e);t.push(new w(s.x,s.y,0))}return t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r){const a=this._geo.getPointAt(r);n.push(new w(a.x,a.y,0))}break}}transformBy(t){const e=t.determinant()<0;let s=this._elevation;return this._geo.vertices.forEach(n=>{const r=new w(n.x,n.y,this._elevation).applyMatrix4(t);n.x=r.x,n.y=r.y,s=r.z,e&&n.bulge!=null&&(n.bulge=-n.bulge)}),this._elevation=s,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(n=>e.push(new w().set(n.x,n.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let s=0;s<this.numberOfVertices;++s)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(s).x,y:this.getPointAt(s).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(s)),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}};ur.typeName="2dPolyline";let Ii=ur;var fo=(i=>(i[i.Vertex=0]="Vertex",i[i.CurveFitVertex=1]="CurveFitVertex",i[i.SplineFitVertex=8]="SplineFitVertex",i[i.SplineCtlVertex=9]="SplineCtlVertex",i))(fo||{});const pr=class pr extends gt{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new w,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 C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,s,n){n.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}};pr.typeName="2dVertex";let kn=pr;var Ts=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.QuadSplinePoly=1]="QuadSplinePoly",i[i.CubicSplinePoly=2]="CubicSplinePoly",i))(Ts||{});const gr=class gr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,s=!1){super(),this._polyType=t,this._geo=new Tt(e,s)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){const e=this._geo.vertices[t];return new w(e.x,e.y,e.z||0)}get geometricExtents(){const t=this._geo.vertices.map(e=>new w(e.x,e.y,e.z||0));return new C().setFromPoints(t)}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const s=this._geo.getPointAt(e);t.push(new w(s.x,s.y,0))}return t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r)n.push(this.getPointAt(r));break}}transformBy(t){return this._geo.vertices.forEach(e=>{const s=new w(e.x,e.y,e.z||0).applyMatrix4(t);e.x=s.x,e.y=s.y,e.z=s.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(s=>new w(s.x,s.y,s.z||0));return t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let s=0;s<this.numberOfVertices;++s){const n=this.getPointAt(s);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:n.x,y:n.y,z:n.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}};gr.typeName="3dPolyline";let Pi=gr;var bo=(i=>(i[i.SimpleVertex=0]="SimpleVertex",i[i.ControlVertex=1]="ControlVertex",i[i.FitVertex=2]="FitVertex",i))(bo||{});const mr=class mr extends gt{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new w,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 C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,s,n){n.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}};mr.typeName="3dVertex";let Ln=mr;const yr=class yr extends rt{get dxfTypeName(){return"ARC"}constructor(t,e,s,n,r=b.Z_AXIS){super();const a=Kn(r);this._geo=new je(t,e,s,n,r,a)}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 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:()=>v.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,n){const r=this.startPoint,a=this.endPoint;switch(t){case z.EndPoint:n.push(r),n.push(a);break;case z.MidPoint:n.push(this.midPoint);break;case z.Nearest:{const o=this._geo.nearestPoint(e);n.push(o)}break;case z.Perpendicular:break;case z.Tangent:{const o=this._geo.tangentPoints(e);n.push(...o);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Cs(this.center,this.normal);return t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeAngle(50,Tn(this.center,this.startPoint,this.normal)),t.writeAngle(51,Tn(this.center,this.endPoint,this.normal)),t.writeVector3d(210,this.normal),this}};yr.typeName="Arc";let Si=yr;var Io=(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))(Io||{}),Po=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(Po||{});const _r=class _r extends gt{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new w,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 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(){return new C}subGetOsnapPoints(t,e,s,n){z.Insertion===t&&n.push(this._position)}transformBy(t){const e=this._position.clone(),s=this._position.clone().add(new b(Math.cos(this._rotation),Math.sin(this._rotation),0)),n=this._position.clone().add(new b(-Math.sin(this._rotation),Math.cos(this._rotation),0)),r=this._position.clone().add(new b(0,0,1));e.applyMatrix4(t),s.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t);const a=new b(s).sub(e),o=new b(n).sub(e),l=new b(r).sub(e),c=o.length(),u=a.length(),d=l.length();return this._position.copy(e),u>0&&(this._rotation=Math.atan2(a.y,a.x)),c>0&&(this._height*=c,u>0&&(this._widthFactor*=u/c)),d>0&&(this._thickness*=d),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,e=t.getAt(this.styleName)??t.getAt(this.database.textstyle)??t.getAt(J);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(t,e){const s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:ae.BOTTOM_TO_TOP,attachmentPoint:ot.BottomLeft};return t.mtext(s,this.getTextStyle(),e)}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.position),this}};_r.typeName="Text";let es=_r;var Q=(i=>(i[i.Invisible=1]="Invisible",i[i.Const=2]="Const",i[i.Verifiable=4]="Verifiable",i[i.Preset=8]="Preset",i))(Q||{}),zt=(i=>(i[i.MultiLine=2]="MultiLine",i[i.ConstMultiLine=4]="ConstMultiLine",i))(zt||{});const wr=class wr extends es{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}};wr.typeName="AttDef";let Ei=wr;const xr=class xr extends es{get dxfTypeName(){return"ATTRIB"}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&Q.Invisible)!==0}set isInvisible(t){t?this._flags|=Q.Invisible:this._flags&=~Q.Invisible}get isConst(){return(this._flags&Q.Const)!==0}set isConst(t){t?this._flags|=Q.Const:this._flags&=~Q.Const}get isVerifiable(){return(this._flags&Q.Verifiable)!==0}set isVerifiable(t){t?this._flags|=Q.Verifiable:this._flags&=~Q.Verifiable}get isPreset(){return(this._flags&Q.Preset)!==0}set isPreset(t){t?this._flags|=Q.Preset:this._flags&=~Q.Preset}get isMTextAttribute(){return(this._mtextFlag&zt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=zt.MultiLine:this._mtextFlag&=~zt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&zt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=zt.ConstMultiLine:this._mtextFlag&=~zt.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}};xr.typeName="Attrib";let Ai=xr;const Os=class Os extends gt{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new w,this._rotation=0,this._normal=new b(0,0,1),this._scaleFactors=new w(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}attributeIterator(){return new Zs(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??w.ORIGIN,s=new G().makeTranslation(-e.x,-e.y,-e.z),n=new G().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),r=new Ue().setFromAxisAngle(b.Z_AXIS,this._rotation),a=new G().makeRotationFromQuaternion(r),o=new G().makeTranslation(this._position.x,this._position.y,this._position.z);return new G().multiplyMatrices(o,a).multiply(n).multiply(s)}subGetOsnapPoints(t,e,s,n,r,a){const o=a??new G;z.Insertion===t?n.push(this.getInsertionPoint(o)):r&&this.subEntityGetOsnapPoints(t,e,s,n,r,o)}transformBy(t){const e=new G().setFromExtrusionDirection(this._normal),s=new G().makeRotationZ(this._rotation),n=new G().multiplyMatrices(e,s),r=this._position.clone(),a=new w(this._scaleFactors.x,0,0).applyMatrix4(n).add(r),o=new w(0,this._scaleFactors.y,0).applyMatrix4(n).add(r),l=new w(0,0,this._scaleFactors.z).applyMatrix4(n).add(r);r.applyMatrix4(t),a.applyMatrix4(t),o.applyMatrix4(t),l.applyMatrix4(t);const c=new b(a).sub(r),u=new b(o).sub(r),d=new b(l).sub(r);let g=new b().crossVectors(c,u);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const m=new G().setFromExtrusionDirection(g).clone().invert(),y=c.clone().applyMatrix4(m);return this._position.copy(r),this._normal.copy(g),this._rotation=Math.atan2(y.y,y.x),this._scaleFactors.set(c.length(),u.length(),d.length()),this._attribs.forEach(x=>x.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(s=>{e.properties.push({name:s.tag,type:"string",editable:!s.isConst,skipTranslation:!0,accessor:{get:()=>s.textString,set:n=>{s.textString=n}}})})}return t}get geometricExtents(){const t=new C,e=this.blockTableRecord;if(e!=null){const n=e.newIterator();for(const r of n)t.union(r.geometricExtents)}const s=this.blockTransform;return t.applyMatrix4(s),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const s=this.blockTransform,n=[];return this._attribs.forEach(a=>{if(!a.isInvisible){const o=a.worldDraw(t);o&&n.push(o)}}),ss.instance.draw(t,e,this.rgbColor,n,!0,s,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let s=!1;for(const n of this.attributeIterator())s=!0,t.writeStart("ATTRIB"),n.dxfOut(t);return s&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}subEntityGetOsnapPoints(t,e,s,n,r,a,o=new Set){if(r===this.objectId||o.has(this.objectId))return!1;o.add(this.objectId);try{const l=this.blockTableRecord;if(l==null)return!1;const c=new G().multiplyMatrices(a,this.getFullInsertionTransform());for(const u of l.newIterator()){if(u.objectId===r){const d=new w(e).applyMatrix4(c.clone().invert()),g=new w(s).applyMatrix4(c.clone().invert()),p=[];return u.subGetOsnapPoints(t,d,g,p,r,c),u instanceof Os?p.forEach(m=>{n.push(m.clone())}):p.forEach(m=>{n.push(new w(m).applyMatrix4(c))}),!0}if(u instanceof Os&&u.subEntityGetOsnapPoints(t,e,s,n,r,c,o))return!0}return!1}finally{o.delete(this.objectId)}}getInsertionPoint(t){var n;const e=((n=this.blockTableRecord)==null?void 0:n.origin)??w.ORIGIN,s=new G().multiplyMatrices(t,this.getFullInsertionTransform());return new w(e).applyMatrix4(s)}getFullInsertionTransform(){const t=new G().setFromExtrusionDirection(this._normal);return new G().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}};Os.typeName="BlockReference";let Ge=Os;const fr=class fr extends rt{get dxfTypeName(){return"CIRCLE"}constructor(t,e,s=b.Z_AXIS){super();const n=Kn(s);this._geo=new je(t,e,0,W,s,n)}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}subGetOsnapPoints(t,e,s,n){switch(t){case z.Center:case z.Centroid:n.push(this._geo.center);break;case z.Quadrant:n.push(this._geo.getPointAtAngle(0)),n.push(this._geo.getPointAtAngle(Math.PI/2)),n.push(this._geo.getPointAtAngle(Math.PI)),n.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case z.Nearest:{const r=this._geo.nearestPoint(e);n.push(r)}break;case z.Tangent:{const r=this._geo.tangentPoints(e);n.push(...r);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._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Cs(this.center,this.normal);return t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}};fr.typeName="Circle";let Mi=fr;const br=class br extends rt{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,s,n,r,a,o){super(),this._geo=new Je(t,e,s,n,r,a,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}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}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:this.closed||(n.push(this._geo.startPoint),n.push(this._geo.endPoint));break;case z.MidPoint:this.closed||n.push(this._geo.midPoint);break;case z.Quadrant:this.closed&&(n.push(this._geo.getPointAtAngle(0)),n.push(this._geo.getPointAtAngle(Math.PI/2)),n.push(this._geo.getPointAtAngle(Math.PI)),n.push(this._geo.getPointAtAngle(Math.PI/2*3)));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._geo.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,s=this.majorAxisRadius;return t.writePoint3d(11,{x:e.x*s,y:e.y*s,z:e.z*s}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}};br.typeName="Ellipse";let Ti=br;const Ir=class Ir extends gt{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new w,new w,new w],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 w),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 C().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(...this._vertices);break}}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._vertices.length,s=new Float32Array(e*3),n=new Uint16Array(e*2);for(let r=0;r<e;r++)s[r*3]=this._vertices[r].x,s[r*3+1]=this._vertices[r].y,s[r*3+2]=this._vertices[r].z,this.isEdgeVisibleAt(r)&&(n[r*2]=r,n[r*2+1]=(r+1)%4);return t.lineSegments(s,3,n)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),s=this.getVertexAt(1),n=this.getVertexAt(2),r=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,s),t.writePoint3d(12,n),t.writePoint3d(13,r);let a=0;for(let o=0;o<4;++o)this.isEdgeVisibleAt(o)||(a|=1<<o);return t.writeInt16(70,a),this}};Ir.typeName="Face";let vi=Ir;var vs=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(vs||{}),So=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(So||{});const Pr=class Pr extends gt{get dxfTypeName(){return"HATCH"}constructor(){super(),this._elevation=0,this._geo=new ts,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get isSolidFill(){return this._isSolidFill||this._patternName.toUpperCase()==="SOLID"}set isSolidFill(t){this._isSolidFill=t}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}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(),s=[],n=(r,a)=>{if(r.index>=0&&a%2===0){const o=new ts;o.add(t[r.index]),r.children.forEach(l=>{l.index>=0&&o.add(t[l.index])}),s.push(o)}r.children.forEach(o=>n(o,a+1))};return e.children.forEach(r=>n(r,0)),s.length>0?s:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,s)=>e+s.area,0)}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new C;const e=new C;return t.forEach(s=>{const n=s.box;e.union(new C({x:n.min.x,y:n.min.y,z:this._elevation},{x:n.max.x,y:n.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:vs[0],value:0},{label:vs[1],value:1},{label:vs[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}}}]},{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.getCalculatedAreaValue()}}]}]}}subWorldDraw(t){const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,definitionLines:this.definitionLines},e.drawOrder=-1;const s=this.buildAreasFromLoops();if(s.length===0)return t.area(this._geo);if(s.length===1)return t.area(s[0]);const n=s.map(r=>t.area(r));return t.group(n)}transformBy(t){const e=t.elements,s=new Us(e[0],e[4],e[12],e[1],e[5],e[13],0,0,1);this._geo.transform(s),this._elevation=new w(0,0,this._elevation).applyMatrix4(t).z;const n=new w(1,0,0).applyMatrix4(t),r=new w().applyMatrix4(t),a=new w(n).sub(r);return a.length()>0&&(this._patternAngle+=Math.atan2(a.y,a.x),this._patternScale*=a.length()),this}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops;return 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,this.patternName||(this.isSolidFill?"SOLID":"USER")),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,0),t.writeInt16(91,e.length),e.forEach((s,n)=>{const r=n===0;if(s instanceof Tt){const a=s.vertices,o=a.some(c=>(c.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,o?1:0),t.writeInt16(73,s.closed?1:0),t.writeInt16(93,a.length);for(const c of a)t.writePoint2d(10,c),o&&t.writeDouble(42,c.bulge??0);t.writeInt16(97,0);return}if(s instanceof Fs){const a=r?1:0;t.writeInt16(92,a),t.writeInt16(93,s.numberOfEdges);for(const o of s.curves){if(o instanceof Vt){t.writeInt16(72,1),t.writePoint2d(10,o.startPoint),t.writePoint2d(11,o.endPoint);continue}if(o instanceof ye){t.writeInt16(72,2),t.writePoint2d(10,o.center),t.writeDouble(40,o.radius),t.writeAngle(50,o.startAngle),t.writeAngle(51,o.endAngle),t.writeInt16(73,o.clockwise?0:1);continue}if(o instanceof Bs){t.writeInt16(72,3),t.writePoint2d(10,o.center);const l=new k(o.majorAxisRadius*Math.cos(o.rotation),o.majorAxisRadius*Math.sin(o.rotation));t.writePoint2d(11,l);const c=o.majorAxisRadius===0?0:o.minorAxisRadius/o.majorAxisRadius;t.writeDouble(40,c),t.writeAngle(50,o.startAngle),t.writeAngle(51,o.endAngle),t.writeInt16(73,o.clockwise?0:1);continue}if(o instanceof Dt){const l=o.knots,c=o.controlPoints,u=o.weights,d=o.fitPoints,g=u.some(p=>p!==1);t.writeInt16(72,4),t.writeInt16(94,o.degree),t.writeInt16(73,g?1:0),t.writeInt16(74,o.closed?1:0),t.writeInt16(95,l.length),t.writeInt16(96,c.length),l.forEach(p=>t.writeDouble(40,p)),c.forEach((p,m)=>{t.writePoint2d(10,p),g&&t.writeDouble(42,u[m]??1)}),t.writeInt16(97,(d==null?void 0:d.length)??0),d==null||d.forEach(p=>t.writePoint2d(11,p))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,this.patternAngle),t.writeDouble(41,this.patternScale),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(s=>{t.writeAngle(53,s.angle),t.writePoint2d(43,s.base),t.writePoint2d(45,s.offset),t.writeInt16(79,s.dashLengths.length),s.dashLengths.forEach(n=>t.writeDouble(49,n))}),t.writeInt16(98,0),this}};Pr.typeName="Hatch";let Rs=Pr;var Eo=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(Eo||{});const Sr=class Sr 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._annoType=3}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 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}appendVertex(t){this._vertices.push(new w().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new C().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._splineGeo?(this._splineGeo.transform(t),this._updated=!1):this._updated=!0,this}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Dt(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.annoType),t.writeInt16(73,this.hasHookLine?1:0),t.writeInt16(74,this.isSplined?1:0),t.writeInt16(76,this.numVertices);for(const e of this.vertices)t.writePoint3d(10,e);return this}};Sr.typeName="Leader";let ki=Sr;var z=(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))(z||{});function ql(i){let t=0;for(const e of i)t|=1<<e-1;return t}function Zl(i){const t=[];for(const e of Object.values(z)){if(typeof e!="number")continue;const s=1<<e-1;i&s&&t.push(e)}return t}function Kl(i,t){return i^1<<t-1}function Ql(i,t){return(i&1<<t-1)!==0}function Jl(i,t){return i|1<<t-1}function tc(i,t){return i&~(1<<t-1)}const Er=class Er extends rt{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new _e(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 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}subGetOsnapPoints(t,e,s,n){const r=this.startPoint,a=this.endPoint;switch(t){case z.EndPoint:n.push(r),n.push(a);break;case z.MidPoint:n.push(this.midPoint);break;case z.Nearest:{const o=this._geo.project(e);n.push(o)}break;case z.Perpendicular:{const o=this._geo.perpPoint(e);n.push(o)}break;case z.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,s=this.endPoint,n=[new w(e.x,e.y,0),new w(s.x,s.y,0)];return t.lines(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}};Er.typeName="Line";let zs=Er;const Ar=class Ar extends gt{get dxfTypeName(){return"MTEXT"}constructor(){super(),this._contents="",this._height=0,this._width=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 w,this._attachmentPoint=ot.TopLeft,this._direction=new b(1,0,0),this._drawingDirection=ae.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 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(){return new C}subGetOsnapPoints(t,e,s,n){z.Insertion===t&&n.push(this._location)}transformBy(t){const e=this._location.clone(),s=this._direction.lengthSq()>0?this._direction.clone().normalize():new b(Math.cos(this._rotation),Math.sin(this._rotation),0),n=new b(-s.y,s.x,s.z);n.lengthSq()===0&&n.set(0,1,0),n.normalize();const r=e.clone().add(s),a=e.clone().add(n);e.applyMatrix4(t),r.applyMatrix4(t),a.applyMatrix4(t);const o=new b(r).sub(e),l=new b(a).sub(e),c=o.length(),u=l.length();return this._location.copy(e),c>0&&(this._direction.copy(o).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=c),u>0&&(this._height*=u),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:ot[1],value:1},{label:ot[2],value:2},{label:ot[3],value:3},{label:ot[4],value:4},{label:ot[5],value:5},{label:ot[6],value:6},{label:ot[7],value:7},{label:ot[8],value:8},{label:ot[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:ae[1],value:1},{label:ae[2],value:2},{label:ae[3],value:3},{label:ae[4],value:4},{label:ae[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,e=t.getAt(this.styleName)??t.getAt(this.database.textstyle)??t.getAt(J);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(t,e){const s={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(s,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),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}};Ar.typeName="MText";let Vs=Ar;const Mr=class Mr extends rt{get dxfTypeName(){return"SPLINE"}constructor(t,e,s,n,r){super(),this.rebuild(t,e,s,n,r)}rebuild(t,e,s,n,r){const a=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(n!==void 0)+ +(r!==void 0);if(a<2||a>5)throw yt.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Dt(t,e,s,n):this._geo=new Dt(t,e,s,n,r)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(this._geo.startPoint),n.push(this._geo.endPoint);break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var s;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,((s=e.fitPoints)==null?void 0:s.length)??0);for(const n of e.knots)t.writeDouble(40,n);for(const n of e.weights)t.writeDouble(41,n);for(const n of e.controlPoints)t.writePoint3d(10,n);for(const n of e.fitPoints??[])t.writePoint3d(11,n);return this}};Mr.typeName="Spline";let Ds=Mr;const ec=new b,Tr=class Tr extends Ge{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,s){super(t),this._attachmentPoint=ot.TopLeft,this._numColumns=s,this._numRows=e,this._columnWidth=new Array(s),this._rowHeight=new Array(e),this._cells=new Array(e*s)}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,s){var r;const n=t*this._numColumns+e;return(r=this._cells[n])==null?void 0:r.text}setTextString(t,e,s){const n=t*this._numColumns+e;if(!this._cells[n]){this._cells[n]={text:s,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[n].text=s}isEmpty(t,e){var n;const s=t*this._numColumns+e;return!((n=this._cells[s])!=null&&n.text)}get geometricExtents(){return new C}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){let e=0,s=0;const n=new Uint16Array(this.numColumns*this.numRows*8),r=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let g=0;g<=this.numRows;g++){e-=g>0?this.rowHeight(g-1):0,s=0;for(let p=0;p<=this.numColumns;p++)s+=p>0?this.columnWidth(p-1):0,r[a++]=s,r[a++]=e,r[a++]=0}const o=[],l=new Array(this.numRows*this.numColumns).fill(!1);s=0,a=0;let c=0;for(let g=0;g<this.numColumns;g++){s+=g>0?this.columnWidth(g-1):0,e=0;for(let p=0;p<this.numRows;p++){e+=p>0?this.rowHeight(p-1):0;const m=this.cell(p*this.numColumns+g);if(c=p*this.numColumns+g,m&&!l[c]){const y=m.borderWidth??1,x=m.borderHeight??1;this.fillVisited(l,c,this.numColumns,y,x),n[a++]=g+p*(this.numColumns+1),n[a++]=g+p*(this.numColumns+1)+y;const f=r[n[a-1]*3]-s,P=g+(p+x)*(this.numColumns+1)+y;g+y==this.numColumns&&(n[a++]=g+p*(this.numColumns+1)+y,n[a++]=P);const I=-r[P*3+1]-e;if(p+x==this.numRows&&(n[a++]=g+(p+x)*(this.numColumns+1)+x,n[a++]=g+(p+x)*(this.numColumns+1)),n[a++]=g+(p+x)*(this.numColumns+1),n[a++]=g+p*(this.numColumns+1),m.text){const T=m.attachmentPoint||this.attachmentPoint||ot.MiddleCenter,A=this.getTableTextOffset(T,f,I),j={text:m.text,height:m.textHeight,width:f,position:ec.set(s,-e,0).clone().add(A),rotation:this.rotation,attachmentPoint:T},M=this.getTextStyle(m);o.push(t.mtext(j,M))}}}}o.push(t.lineSegments(r,3,n));const u=t.group(o),d=new Ue;return d.setFromAxisAngle(b.Z_AXIS,this.rotation),oa.compose(this.position,d,this.scaleFactors),u.applyMatrix(oa),u}fillVisited(t,e,s,n,r){if(r==1&&n==1)t[e]=!0;else for(let a=0;a<n;++a)for(let o=0;o<r;++o)t[e+a+o*s]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable,s=(t.textStyle?e.getAt(t.textStyle):void 0)??e.getAt(this.database.textstyle)??e.getAt(J);if(!s)throw new Error("No valid text style found in text style table.");return s.textStyle}getTableTextOffset(t,e,s){const n=new b;switch(t){case 1:break;case 2:n.setX(e/2);break;case 3:n.setX(e);break;case 4:n.setY(-s/2);break;case 5:n.set(e/2,-s/2,0);break;case 6:n.set(e,-s/2,0);break;case 7:n.setY(-s);break;case 8:n.set(e/2,-s,0);break;case 9:n.set(e,-s,0);break}return n}dxfOutFields(t){var r,a,o,l,c,u,d;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((r=t.database)==null?void 0:r.version)??((a=this.database)==null?void 0:a.version),s=(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 n=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let g=0;g<n;g++){const p=this._cells[g],m=(p==null?void 0:p.cellType)??(p!=null&&p.blockTableRecordId?2:1);if(t.writeInt16(171,m),t.writeInt16(172,(p==null?void 0:p.flagValue)??0),t.writeInt16(173,(p==null?void 0:p.mergedValue)??0),t.writeBoolean(174,p==null?void 0:p.autoFit),t.writeInt16(175,p==null?void 0:p.borderWidth),t.writeInt16(176,p==null?void 0:p.borderHeight),(p==null?void 0:p.overrideFlag)!=null&&(s?t.writeInt32(91,p.overrideFlag):t.writeInt16(177,p.overrideFlag)),t.writeInt16(178,p==null?void 0:p.virtualEdgeFlag),t.writeAngle(145,p==null?void 0:p.rotation),s&&t.writeInt16(92,p==null?void 0:p.extendedCellFlags),m===1)p!=null&&p.fieldObjetId?t.writeObjectId(344,p.fieldObjetId):this.writeCellText(t,(p==null?void 0:p.text)??"",s,p==null?void 0:p.cellValueBlockBegin);else if(m===2){if(t.writeObjectId(340,p==null?void 0:p.blockTableRecordId),t.writeDouble(144,p==null?void 0:p.blockScale),t.writeInt16(179,p==null?void 0:p.blockAttrNum),(o=p==null?void 0:p.attrDefineId)!=null&&o.length)for(const y of p.attrDefineId)t.writeObjectId(331,y);if((p==null?void 0:p.attrText)!=null)if(Array.isArray(p.attrText))for(const y of p.attrText)t.writeString(300,y);else t.writeString(300,p.attrText)}p!=null&&p.textStyle&&t.writeString(7,p.textStyle),(p==null?void 0:p.textHeight)!=null&&t.writeDouble(140,p.textHeight),(p==null?void 0:p.attachmentPoint)!=null&&t.writeInt16(170,p.attachmentPoint),(p==null?void 0:p.topBorderVisibility)!=null&&t.writeInt16(289,p.topBorderVisibility?1:0),(p==null?void 0:p.rightBorderVisibility)!=null&&t.writeInt16(285,p.rightBorderVisibility?1:0),(p==null?void 0:p.bottomBorderVisibility)!=null&&t.writeInt16(286,p.bottomBorderVisibility?1:0),(p==null?void 0:p.leftBorderVisibility)!=null&&t.writeInt16(288,p.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 p=g.borderLineweights;p&&(t.writeInt16(274,p.top),t.writeInt16(275,p.right),t.writeInt16(276,p.bottom),t.writeInt16(277,p.left),t.writeInt16(278,p.insideHorizontal),t.writeInt16(279,p.insideVertical));const m=g.borderVisibility;m&&(t.writeInt16(284,m.top?1:0),t.writeInt16(285,m.right?1:0),t.writeInt16(286,m.bottom?1:0),t.writeInt16(287,m.left?1:0),t.writeInt16(288,m.insideHorizontal?1:0),t.writeInt16(289,m.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)),(c=this.rowDataTypes)!=null&&c.length)for(const g of this.rowDataTypes)t.writeInt16(97,g);if((u=this.rowUnitTypes)!=null&&u.length)for(const g of this.rowUnitTypes)t.writeInt16(98,g);if((d=this.rowFormats)!=null&&d.length)for(const g of this.rowFormats)t.writeString(4,g);return this}writeCellText(t,e,s,n){if(!s){if(e.length<=250){t.writeString(1,e);return}const o=Math.ceil(e.length/250);for(let l=0;l<o;l++){const c=l*250,u=c+250,d=e.slice(c,u);l===o-1?t.writeString(1,d):t.writeString(2,d)}return}if(t.writeString(301,n??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const a=Math.ceil(e.length/250);for(let o=0;o<a;o++){const l=o*250,c=l+250,u=e.slice(l,c);o===a-1?t.writeString(302,u):t.writeString(303,u)}t.writeString(304,"ACVALUE_END")}};Tr.typeName="Table";let Li=Tr;const oa=new G,vr=class vr extends rt{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new w,new w,new w,new w]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}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 C().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(...this._vertices);break}}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._elevation=this._vertices[0].z,this}subWorldDraw(t){const e=new Tt(this._vertices,!0),s=new ts;s.add(e);const n=t.subEntityTraits;return n.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),t.writeDouble(38,this.elevation),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}};vr.typeName="Trace";let Oi=vr;const kr=class kr extends rt{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new Tt}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,s=0,n=-1,r=-1){const a=n<0?void 0:n,o=r<0?void 0:r,l={x:e.x,y:e.y,bulge:s,startWidth:a,endWidth:o};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 w(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new C({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 t}subGetOsnapPoints(t,e,s,n){const r=new Array;for(let a=0;a<this.numberOfVertices;++a)r.push(this.getPoint3dAt(a));switch(t){case z.EndPoint:n.push(...r);break}}transformBy(t){const e=t.determinant()<0;let s=this._elevation;return this._geo.vertices.forEach(n=>{const r=new w(n.x,n.y,this._elevation).applyMatrix4(t);n.x=r.x,n.y=r.y,s=r.z,e&&n.bulge!=null&&(n.bulge=-n.bulge)}),this._elevation=s,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),s=this.createWidthProfile();if(s!=null){const r=sc(s,this.closed);if(r!=null){const a=t.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(r)}}const n=[];return e.forEach(r=>n.push(new w().set(r.x,r.y,this.elevation))),t.lines(n)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0),t.writeDouble(38,this.elevation);for(let e=0;e<this.numberOfVertices;++e)t.writePoint2d(10,this.getPoint2dAt(e));return this}createWidthProfile(){const t=this._geo.vertices,e=t.length;if(e<2)return null;const s=this.closed?e:e-1,n=[];let r=!1;for(let a=0;a<s;a++){const o=t[a],l=t[(a+1)%e],c=Math.max(0,o.startWidth??0),u=Math.max(0,o.endWidth??0);(c>Mt||u>Mt)&&(r=!0);const d=this.sampleSegment(o,l),g=d.length-1;for(let p=0;p<=g;p++){if(p===0&&n.length>0||this.closed&&a===s-1&&p===g)continue;const m=g>0?p/g:0;n.push({x:d[p].x,y:d[p].y,width:ac(c,u,m)})}}return r&&n.length>=2?n:null}sampleSegment(t,e){if(t.bulge&&Math.abs(t.bulge)>Mt){const n=new ye(t,e,t.bulge).getPoints(32);if(n.length>1)return n.map(r=>new k(r.x,r.y))}return[new k(t.x,t.y),new k(e.x,e.y)]}};kr.typeName="Polyline";let Ni=kr;const Mt=1e-6,ha=4;function sc(i,t){if(i.length<2)return null;const e=nc(i,t);if(e.length<2)return null;const{left:s,right:n}=ic(e,t);if(s.length<2||n.length<2)return null;const r=new ts;if(t){if(!cn(s)||!cn(n))return null;const o=Math.abs(On(s)),l=Math.abs(On(n)),[c,u]=o>=l?[s,n]:[n,s];return r.add(new Tt(c,!0)),r.add(new Tt(u,!0)),r}const a=[...s,...n.reverse()];return cn(a)?(r.add(new Tt(a,!0)),r):null}function ic(i,t){const e=[],s=[];for(let n=0;n<i.length;n++){const r=i[n],a=Math.max(0,r.width)/2;if(a<=Mt)continue;const o=rc(i,n,t);o!=null&&(e.push({x:r.x+o.x*a,y:r.y+o.y*a}),s.push({x:r.x-o.x*a,y:r.y-o.y*a}))}return{left:e,right:s}}function nc(i,t){const e=[];if(i.forEach(s=>{const n=e[e.length-1];(!n||Math.abs(n.x-s.x)>Mt||Math.abs(n.y-s.y)>Mt||Math.abs(n.width-s.width)>Mt)&&e.push(s)}),t&&e.length>1){const s=e[0],n=e[e.length-1];Math.abs(s.x-n.x)<=Mt&&Math.abs(s.y-n.y)<=Mt&&e.pop()}return e}function rc(i,t,e){const s=i.length,n=i[t],r=i[(t-1+s)%s],a=i[(t+1)%s];let o=la(n.x-r.x,n.y-r.y),l=la(a.x-n.x,a.y-n.y);if(e||(t===0&&(o=l),t===s-1&&(l=o)),o==null&&l==null)return null;if(o==null)return hi(l);if(l==null)return hi(o);const c=hi(o),u=hi(l),d=c.x+u.x,g=c.y+u.y,p=Math.hypot(d,g);if(p<=Mt)return u;const m={x:d/p,y:g/p},y=Math.abs(m.x*u.x+m.y*u.y),x=y<=Mt?ha:Math.min(1/y,ha);return{x:m.x*x,y:m.y*x}}function la(i,t){const e=Math.hypot(i,t);return e<=Mt?null:{x:i/e,y:t/e}}function hi(i){return{x:-i.y,y:i.x}}function On(i){let t=0;const e=i.length;for(let s=0;s<e;s++){const n=i[s],r=i[(s+1)%e];t+=n.x*r.y-r.x*n.y}return t/2}function cn(i){return i.length>=3&&Math.abs(On(i))>Mt}function ac(i,t,e){return i+(t-i)*e}const Lr=class Lr extends gt{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new w}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new C().expandByPoint(this._geo)}subGetOsnapPoints(t,e,s,n){z.Node===t&&n.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}};Lr.typeName="Point";let Ci=Lr;var Ao=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(Ao||{}),Mo=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(Mo||{});const Or=class Or extends gt{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new w,this._scale=new X(1,1),this._rotation=0,this._imageSize=new k,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 C;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()}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,s=this._height*this._scale.y,n=new b(e*Math.cos(this._rotation),e*Math.sin(this._rotation),0),r=new b(-s*Math.sin(this._rotation),s*Math.cos(this._rotation),0),a=this._position.clone(),o=this._position.clone().add(n),l=this._position.clone().add(r);a.applyMatrix4(t),o.applyMatrix4(t),l.applyMatrix4(t);const c=new b(o).sub(a),u=new b(l).sub(a);return this._position.copy(a),this._rotation=Math.atan2(c.y,c.x),this._width=c.length(),this._height=u.length(),this._scale.set(1,1),this}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,s=this._height,n=new pt;n.setFromPoints(this._clipBoundary);const r=new k;r.setX(this._position.x-n.min.x*e),r.setY(this._position.y-n.min.y*s),this._clipBoundary.forEach(a=>{const o=a.x*e+r.x,l=a.y*s+r.y;t.push(new w(o,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){ca.copy(t[1]);for(let e=1;e<4;e++)li.copy(t[e]),li.rotateAround(ca,this._rotation),t[e].setX(li.x),t[e].setY(li.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,s=this.height*this.scale.y,n=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:s},r=n.x>0?e/n.x:e,a=n.y>0?s/n.y:s,o=Math.cos(this._rotation),l=Math.sin(this._rotation);t.writePoint3d(11,{x:r*o,y:r*l,z:0}),t.writePoint3d(12,{x:-a*l,y:a*o,z:0}),t.writePoint2d(13,n),t.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,c),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 u of this.clipBoundary)t.writePoint2d(14,u)}return this}};Or.typeName="RasterImage";let js=Or;const ca=new k,li=new k,Nr=class Nr extends rt{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new w,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 geometricExtents(){const t=new C;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}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(this.basePoint);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}};Nr.typeName="Ray";let Bi=Nr;const Cr=class Cr extends gt{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new w,this._height=0,this._width=0,this._viewCenter=new w,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(){return new C}transformBy(t){const e=this._centerPoint.clone(),s=this._centerPoint.clone().add(new b(this._width,0,0)),n=this._centerPoint.clone().add(new b(0,this._height,0));e.applyMatrix4(t),s.applyMatrix4(t),n.applyMatrix4(t);const r=new b(s).sub(e),a=new b(n).sub(e),o=this._height!==0?a.length()/this._height:1;return this._centerPoint.copy(e),this._width=r.length(),this._height=a.length(),this._viewHeight*=o,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 wo;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 s=[];return s.push(e.lines([new w(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new w(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),s.push(e.lines([new w(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new w(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),s.push(e.lines([new w(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new w(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),s.push(e.lines([new w(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new w(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),s}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}};Cr.typeName="Viewport";let Fi=Cr;const Br=class Br extends js{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),s=new ts;return s.add(new Tt(e)),t.area(s)}dxfOutFields(t){return super.dxfOutFields(t),this}};Br.typeName="Wipeout";let Ri=Br;const Fr=class Fr extends rt{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new w,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 geometricExtents(){const t=new C;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}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}};Fr.typeName="Xline";let zi=Fr;class To{constructor(t){this.position=new w(t.x,t.y,t.z||0)}}const Rr=class Rr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,s,n=!1,r=!1){super(),this._mCount=t,this._nCount=e,this._closedM=n,this._closedN=r,this._vertices=s.map(a=>new To(a))}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}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 s=t*this._nCount+e;return this.getVertexAt(s)}get geometricExtents(){if(this._vertices.length===0)return new C(new w(0,0,0),new w(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,s=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{t=Math.min(t,o.position.x),e=Math.min(e,o.position.y),s=Math.min(s,o.position.z),n=Math.max(n,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new C(new w(t,e,s),new w(n,r,a))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:this._vertices.forEach(r=>{n.push(r.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 s=0;s<this._mCount;s++)for(let n=0;n<this._nCount;n++){const r=this.getVertexAtMN(s,n);let a=n+1;if(a>=this._nCount)if(this._closedN)a=0;else continue;const o=this.getVertexAtMN(s,a);e.push(r.position),e.push(o.position)}for(let s=0;s<this._nCount;s++)for(let n=0;n<this._mCount;n++){const r=this.getVertexAtMN(n,s);let a=n+1;if(a>=this._mCount)if(this._closedM)a=0;else continue;const o=this.getVertexAtMN(a,s);e.push(r.position),e.push(o.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 s=0;s<this.numberOfVertices;s++){const n=this.getVertexAt(s);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,n.position),t.writeInt16(70,16)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}};Rr.typeName="PolygonMesh";let Vi=Rr;class vo{constructor(t){this.position=new w(t.x,t.y,t.z||0)}}class ko{constructor(t){this.vertexIndices=t}}const zr=class zr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e){super(),this._vertices=t.map(s=>new vo(s)),this._faces=e.map(s=>new ko(s))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}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 C(new w(0,0,0),new w(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,s=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{t=Math.min(t,o.position.x),e=Math.min(e,o.position.y),s=Math.min(s,o.position.z),n=Math.max(n,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new C(new w(t,e,s),new w(n,r,a))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:this._vertices.forEach(r=>{n.push(r.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(s=>{const n=[];if(s.vertexIndices.forEach(r=>{const a=Math.abs(r)-1;a>=0&&a<this._vertices.length&&n.push(this._vertices[a].position)}),n.length>=3)for(let r=0;r<n.length;r++){const a=n[r],o=n[(r+1)%n.length];e.push(a),e.push(o)}}),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 s=0;s<this.numberOfVertices;s++){const n=this.getVertexAt(s);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,n.position),t.writeInt16(70,64)}for(let s=0;s<this.numberOfFaces;s++){const n=this.getFaceAt(s);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),n.vertexIndices.forEach((r,a)=>{t.writeInt32(10+a,r)})}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}};zr.typeName="PolyFaceMesh";let Di=zr;var ji=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(ji||{});const Vr=class Vr extends gt{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new w,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new w,this._textRotation=0,this._normal=new b(0,0,1)}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 He),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(),s=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),e.applyMatrix4(t),s.applyMatrix4(t);const n=new b(s).sub(e);return n.lengthSq()>0&&(this._textRotation=Math.atan2(n.y,n.x)),this.subTransformBy(t),this}subGetOsnapPoints(t,e,s,n,r){const a=this.getDimBlockTableRecord();if(!a)return;const o=this.getFullDimBlockTransform(),l=new w(e).applyMatrix4(o.clone().invert()),c=new w(s).applyMatrix4(o.clone().invert()),u=(d,g)=>{const p=[];d.subGetOsnapPoints(t,l,c,p,g,o),d instanceof Ge?p.forEach(m=>n.push(m.clone())):p.forEach(m=>n.push(new w(m).applyMatrix4(o)))};if(r){const d=a.getIdAt(r);if(d&&(u(d,r),n.length>0))return}for(const d of a.newIterator())u(d)}subWorldDraw(t){const e=this.getDimBlockTableRecord();if(e){const n=this.computeDimBlockTransform();return ss.instance.draw(t,e,this.rgbColor,[],!1,n,this._normal)}return t.group([])}getDimBlockGeometricExtents(){const t=new C,e=this.getDimBlockTableRecord();if(!e)return t;for(const s of e.newIterator())t.union(s.geometricExtents);return t.applyMatrix4(this.getFullDimBlockTransform()),t}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:ji[1],value:1},{label:ji[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(t,e,s,n,r){return{name:t,type:e,editable:n!=null,options:r,accessor:n?{get:s,set:n}:{get:s}}}createPoint3dProperties(t,e){return[this.createProperty(`${t}X`,"float",()=>e().x,s=>{e().x=s}),this.createProperty(`${t}Y`,"float",()=>e().y,s=>{e().y=s}),this.createProperty(`${t}Z`,"float",()=>e().z,s=>{e().z=s})]}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 G().setFromExtrusionDirection(this._normal);return new G().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}getLineArrowStyle(t){}findPointOnLine1(t,e,s){const n=new w().subVectors(e,t).normalize();return new w(e).addScaledVector(n,s)}findPointOnLine2(t,e,s){const n=t.x+s*Math.cos(e),r=t.y+s*Math.sin(e);return{x:n,y:r}}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():Jn.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??w.ORIGIN,s=new G().makeTranslation(-e.x,-e.y,-e.z),n=new G().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new G().multiplyMatrices(n,s)}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}};Vr.typeName="Dimension";let oe=Vr;const Dr=class Dr extends oe{constructor(t,e,s,n,r=null,a=null){super(),this._centerPoint=new w().copy(t),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(s),this._arcPoint=new w().copy(n),this.dimensionText=r,this.dimensionStyleName=a}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)]}]}}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return new C}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}};Dr.typeName="3PointAngularDimension";let Wi=Dr;const jr=class jr extends oe{constructor(t,e,s,n=null,r=null){super(),this._dimLinePoint=new w().copy(s),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),n?this.dimensionText=n:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=r}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})]}]}}subTransformBy(t){this._dimLinePoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t),this.calculateRotation()}get geometricExtents(){return this.getDimBlockGeometricExtents()}get isAppendArrow(){return!1}createDimBlock(t){const e=new K;e.name=t;const s=this.createLines();s.forEach(o=>e.appendEntity(new zs(o.startPoint,o.endPoint))),this.createArrows(s[0]).forEach(o=>e.appendEntity(o));const r=s[0].midPoint,a=this.createMText(r,this._rotation);return a&&e.appendEntity(a),e}createMText(t,e){const s=n=>({x:Math.cos(n),y:Math.sin(n),z:0});if(this.dimensionText){const n=new Vs;return n.attachmentPoint=ot.MiddleLeft,n.layer="0",n.color=new tt(E.ByBlock),n.location=t,n.contents=this.dimensionText??"",n.height=10,n.direction=s(e),n.styleName=this.dimensionStyle.dimtxsty,n}}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,s){const n="_CAXARROW",r=new Ge(n);return r.position=t,r.rotation=e,r.scaleFactors={x:s,y:s,z:s},r}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),n=this.findIntersectionPoint(e,this._dimLinePoint),r=this.findIntersectionPoint(s,this._dimLinePoint),a=new _e(n,r);return t.push(a),e.endPoint=n,this.adjustExtensionLine(e),t.push(e),s.endPoint=r,this.adjustExtensionLine(s),t.push(s),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,s=this.findPointOnLine2(t,e,100);return new _e(t,{...s,z:t.z})}findIntersectionPoint(t,e){const s=t.startPoint,n=t.endPoint,r=new b().subVectors(n,s).normalize(),o=new b().subVectors(e,s).dot(r),l=new b().copy(r).multiplyScalar(o);return new b().addVectors(s,l)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,s=e.x-t.x,n=e.y-t.y;this._rotation=Math.atan2(n,s)}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}};jr.typeName="AlignedDimension";let Ws=jr;const Wr=class Wr extends oe{constructor(t,e,s,n,r=null,a=null){super(),this._arcPoint=new w().copy(n),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(s),this._centerPoint=new w().copy(t),this.dimensionText=r,this.dimensionStyleName=a}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)]}]}}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return new C}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}};Wr.typeName="ArcDimension";let Nn=Wr;const Gr=class Gr extends oe{constructor(t,e,s=0,n=null,r=null){super(),this._chordPoint=new w().copy(t),this._farChordPoint=new w().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=n,this.dimensionStyleName=r}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})]}]}}subTransformBy(t){this._chordPoint.applyMatrix4(t),this._farChordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){return new C}drawLines(t,e){const s=[],n=e.length;return n==1?s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):n==3?(this.sortLines(e),s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(t,e[1])),s.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(r=>{s.push(this.drawLine(t,r))}),s}drawLine(t,e,s){if(s){const n=[e.startPoint,e.endPoint];return t.lines(n)}else return e.worldDraw(t)}sortLines(t){const e=(s,n)=>s.x!==n.x?s.x-n.x:s.y!==n.y?s.y-n.y:s.z-n.z;t.sort((s,n)=>{const r=e(s.startPoint,n.startPoint);return r!==0?r:e(s.endPoint,n.endPoint)})}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}};Gr.typeName="DiametricDimension";let Gi=Gr;const Hr=class Hr extends oe{constructor(t,e,s=null,n=null){super(),this._definingPoint=new w().copy(t),this._leaderEndPoint=new w().copy(e),this.dimensionText=s,this.dimensionStyleName=n}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)]}]}}subTransformBy(t){this._definingPoint.applyMatrix4(t),this._leaderEndPoint.applyMatrix4(t)}get geometricExtents(){return new C}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};Hr.typeName="OrdinateDimension";let Hi=Hr;const Ur=class Ur extends oe{constructor(t,e,s,n=null,r=null){super(),this._center=new w().copy(t),this._chordPoint=new w().copy(e),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=n,this.dimensionStyleName=r}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})]}]}}subTransformBy(t){this._center.applyMatrix4(t),this._chordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){return new C}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}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}};Ur.typeName="RadialDimension";let Ui=Ur;const Xr=class Xr extends Ws{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};Xr.typeName="RotatedDimension";let Xi=Xr;var Lo=(i=>(i[i.kInches=0]="kInches",i[i.kMillimeters=1]="kMillimeters",i[i.kPixels=2]="kPixels",i))(Lo||{}),Oo=(i=>(i[i.k0degrees=0]="k0degrees",i[i.k90degrees=1]="k90degrees",i[i.k180degrees=2]="k180degrees",i[i.k270degrees=3]="k270degrees",i))(Oo||{}),No=(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))(No||{}),pe=(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))(pe||{}),qe=(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))(qe||{}),Co=(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))(Co||{});const oc={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 Bo extends he{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new k,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new k,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new pt,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 oc[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 qs extends Bo{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new pt,this._extents=new C,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 Zs{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){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 ks extends he{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,s=>this.hasId(s)),this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,n)=>{s===e&&(this._recordsByName.delete(n),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:n}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new Zs(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,s]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,s.objectId);return this}}class Fo extends ks{getBtrIdAt(t){for(const[e,s]of this._recordsByName)if(s.blockTableRecordId==t)return s}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class xe extends he{constructor(t,e){t=t||{},Hs(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var Ro=(i=>(i[i.Any=0]="Any",i[i.Uniform=1]="Uniform",i))(Ro||{});const ge=class ge extends xe{static isModelSapceName(t){return t.toLowerCase()==ge.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(ge.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new w,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return ge.isModelSapceName(this.name)}get isPaperSapce(){return ge.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(t){this._blockInsertUnits=t}get explodability(){return this._explodability}set explodability(t){this._explodability=t}get blockScaling(){return this._blockScaling}set blockScaling(t){this._blockScaling=t}get bmpPreview(){return this._bmpPreview}set bmpPreview(t){this._bmpPreview=t}appendEntity(t){const e=s=>{s.database=this.database,s.ownerId=this.objectId,this.database.commitObjectHandle(s,n=>this._entities.has(n)),s.resolveEffectiveProperties(),this._entities.set(s.objectId,s)};if(Array.isArray(t))for(let s=0;s<t.length;++s)e(t[s]);else e(t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],s=[];return e.forEach(n=>{const r=this._entities.get(n);r&&s.push(r),this._entities.delete(n)}),s.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:s}),s.length>0}newIterator(){return new Zs(this._entities)}getIdAt(t){return this._entities.get(t)}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,0),t.writePoint3d(10,this.origin),t.writeString(3,this.name),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}};ge.MODEL_SPACE_NAME="*Model_Space",ge.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let K=ge;class zo{constructor(){this.events={layoutCreated:new Z,layoutRemoved:new Z,layoutRenamed:new Z,layoutSwitched:new Z}}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 s=this.getWorkingDatabase(e),n=s.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(n,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),n=s.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(n,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),n=s.objects.layout.getAt(t);return this.setCurrentLayoutInternal(n,s)}renameLayout(t,e,s){const r=this.getWorkingDatabase(s).objects.layout.getAt(t);return r?(r.layoutName=e,this.events.layoutRenamed.dispatch({layout:r,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const s=this.getWorkingDatabase(e).objects.layout,n=s.getAt(t);let r=!1;return n&&(r=s.remove(t),r&&this.events.layoutRemoved.dispatch({layout:n})),r}createLayout(t,e){const s=this.getWorkingDatabase(e),n=new qs;n.layoutName=t,n.tabOrder=s.objects.layout.maxTabOrder;const r=new K;return r.name=`*Paper_Space${n.tabOrder}`,s.tables.blockTable.add(r),s.objects.layout.setAt(t,n),this.events.layoutCreated.dispatch({layout:n}),{layout:n,btr:r}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||Rn().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}Oa(()=>new zo);class Vo extends he{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 Do=(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))(Do||{});class hc extends he{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 jo{constructor(t){this.db=t}createDefaultLayer(){const t=new tt;return t.colorIndex=7,this.db.tables.layerTable.add(new Ji({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new me({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new me({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new me({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new tn({name:J,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new He({name:J,dimtxsty:J}))}createDefaultLayout(){const t=new qs;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 Rs;e.patternName="SOLID";const s=new Fs;s.add(new Vt({x:0,y:0},{x:-1,y:.125})),s.add(new Vt({x:-1,y:.125},{x:-1,y:-.125})),s.add(new Vt({x:-1,y:-.125},{x:0,y:0})),e.add(s);const n=new K;n.name="_CAXARROW",n.appendEntity(e),this.db.tables.blockTable.add(n)}}}var Wo=(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))(Wo||{}),ir=(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))(ir||{});function lc(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function cc(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}class le extends he{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,s=>this.hasId(s));const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),s=this._recordsByName.get(e);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(e),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(this.normalizeName(e.name)),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new Zs(this._recordsByName)}normalizeName(t){return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.numEntries),this}}class Go extends le{constructor(t){super(t)}get modelSpace(){let t=this.getAt(K.MODEL_SPACE_NAME);return t||(t=new K,t.name=K.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const s=e.getIdAt(t);if(s)return s}}removeEntity(t){let e=!1;for(const s of this.database.tables.blockTable.newIterator())if(s.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(K.isModelSapceName(t))e=K.MODEL_SPACE_NAME;else if(K.isPaperSapceName(t)){const s=K.PAPER_SPACE_NAME_PREFIX,n=t.substring(s.length);e=s+n}return e}}class Ho extends le{constructor(t){super(t)}}var Uo=(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))(Uo||{}),Xo=(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))(Xo||{}),Yo=(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))(Yo||{}),$o=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))($o||{}),qo=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(qo||{});const qi=class qi extends xe{constructor(t,e){t=t||{},Hs(t,qi.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),s=this.database.tables.blockTable.getAt(this.dimldrblk),n=this.database.tables.blockTable.getAt(this.dimblk),r=this.database.tables.blockTable.getAt(this.dimblk1),a=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,s==null?void 0:s.objectId),t.writeObjectId(342,n==null?void 0:n.objectId),t.writeObjectId(343,r==null?void 0:r.objectId),t.writeObjectId(344,a==null?void 0:a.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};qi.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:J,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let He=qi;class Zo extends le{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class Ji extends xe{constructor(t,e){t=t||{},Hs(t,{color:new tt,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new Ki,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}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 Ko extends le{constructor(t){super(t)}}class me extends xe{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}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._linetype.pattern[t].elementLength}toPreviewSvgString(t){const e=Math.max((t==null?void 0:t.width)??220,1),s=Math.max((t==null?void 0:t.height)??36,1),n=Math.min(Math.max((t==null?void 0:t.padding)??8,0),Math.floor(e/2)),r=Math.max((t==null?void 0:t.strokeWidth)??2,.5),a=this.escapeSvgAttribute((t==null?void 0:t.stroke)??"currentColor"),o=Math.max((t==null?void 0:t.repeats)??4,1),l=s/2,c=n,u=Math.max(e-n,c+1),d=u-c,g=this._linetype.pattern??[];if(g.length===0||this.patternLength<=0||!g.some(I=>I.elementLength!==0))return this.buildSvgString({width:e,height:s,stroke:a,strokeWidth:r,lineSegments:[[c,u]],dots:[],y:l});const p=[],m=[],y=d/(this.patternLength*o),x=.5,f=Math.max(r*2,2);let P=c;for(;P<u;)for(const I of g){if(P>=u)break;const T=I.elementLength;if(T===0){m.push(P),P=Math.min(P+f,u);continue}const A=Math.max(Math.abs(T)*y,x),j=Math.min(P+A,u);T>0&&j>P&&p.push([P,j]),P=j}return this.buildSvgString({width:e,height:s,stroke:a,strokeWidth:r,lineSegments:p,dots:m,y:l})}buildSvgString(t){const{width:e,height:s,stroke:n,strokeWidth:r,lineSegments:a,dots:o,y:l}=t,c=a.map(([d,g])=>`<line x1="${d.toFixed(2)}" y1="${l.toFixed(2)}" x2="${g.toFixed(2)}" y2="${l.toFixed(2)}" stroke="${n}" stroke-width="${r.toFixed(2)}" stroke-linecap="round" />`).join(""),u=o.map(d=>`<circle cx="${d.toFixed(2)}" cy="${l.toFixed(2)}" r="${(r/2).toFixed(2)}" fill="${n}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${s}" viewBox="0 0 ${e} ${s}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${c}${u}</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.linetype.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.linetype.pattern??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class Qo extends le{constructor(t){super(t)}get fonts(){const t=new Set,e=n=>{if(n){const r=n.lastIndexOf(".");if(r>=0){const a=n.substring(0,r).toLowerCase();t.add(a)}else t.add(n.toLowerCase())}},s=this.newIterator();for(const n of s)e(n.fileName),e(n.bigFontFileName);return Array.from(t)}}class tn extends xe{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.textStyle.standardFlag),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),t.writeDouble(42,this.priorSize),t.writeString(3,this.fileName),t.writeString(4,this.bigFontFileName),this}}class Jo extends le{constructor(t){super(t)}}class th extends le{constructor(t){super(t)}}const dc=()=>({center:new k,viewDirectionFromTarget:new w(0,0,1),viewTarget:new w(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:tr.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new w(0,0,0),ucsXAxis:new w(1,0,0),ucsYAxis:new w(0,1,0),orthographicType:er.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:sr.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class nr extends xe{constructor(){super(),this._gsView=dc(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.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}}class rr extends nr{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new k(0,0),this._upperRightCorner=new k(1,1),this._snapBase=new k(0,0),this._snapAngle=0,this._snapSpacing=new k(0,0),this._standardFlag=0,this._gridSpacing=new k,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),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 eh extends le{constructor(t){super(t)}}class Cn extends xe{constructor(t){super(),this.name=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}const R={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",CECOLOR:"CECOLOR",CELTYPE:"CELTYPE",CELTSCALE:"CELTSCALE",CELWEIGHT:"CELWEIGHT",CLAYER:"CLAYER",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LWDISPLAY:"LWDISPLAY",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",OSMODE:"OSMODE",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",WHITEBKCOLOR:"WHITEBKCOLOR"},uc=Object.freeze(Object.values(R)),Zi=class Zi{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new Z},this.registerVar({name:R.CECOLOR,type:"color",isDbVar:!0,defaultValue:new tt(E.ByLayer)}),this.registerVar({name:R.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:R.CELTYPE,type:"string",isDbVar:!0,defaultValue:At}),this.registerVar({name:R.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:We.ByLayer}),this.registerVar({name:R.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:R.COLORTHEME,type:"number",isDbVar:!1,defaultValue:"0"}),this.registerVar({name:R.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:R.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:R.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:R.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new tt(E.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:R.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:R.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:R.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:R.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:J}),this.registerVar({name:R.WHITEBKCOLOR,type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new Zi),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 s=this.getDescriptor(t);if(!s)throw new Error(`System variable ${t} not found!`);if(s.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}setVar(t,e,s){t=this.normalizeName(t);const n=this.getDescriptor(t);if(n){const r=this.getVar(t,s);if(n.type!=="string"&&(typeof e=="string"||e instanceof String)){if(n.type==="number"){const a=Number(e);if(Number.isNaN(a))throw new Error("Invalid number input!");e=a}else if(n.type==="boolean")e=this.parseBoolean(e);else if(n.type==="color"){const a=tt.fromString(e);if(a==null)throw new Error("Invalid color value!");e=a}}n.isDbVar?s[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(r,e)&&this.events.sysVarChanged.dispatch({database:s,name:t,newVal:e,oldVal:r}))}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(),s=new Set(["true","t","1","yes","y"]),n=new Set(["false","f","0","no","n"]);return s.has(e)?!0:(n.has(e),!1)}hasValueChanged(t,e){return t instanceof tt&&e instanceof tt?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};Zi._instance=null;let Gs=Zi;class pc extends he{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new Z,dictObjectErased:new Z,entityAppended:new Z,entityModified:new Z,entityErased:new Z,layerAppended:new Z,layerModified:new Z,layerErased:new Z,openProgress:new Z},this._version=new vt("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Dn.DecimalDegrees,this._celtscale=1,this._cecolor=new tt,this._celtype=At,this._celweight=We.ByLayer,this._clayer="0",this._textstyle=J,this._extents=new C,this._insunits=ir.Millimeters,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._maxHandle=0,this._tables={appIdTable:new eh(this),blockTable:new Go(this),dimStyleTable:new Ho(this),linetypeTable:new Ko(this),textStyleTable:new Qo(this),viewTable:new Jo(this),layerTable:new Zo(this),viewportTable:new th(this)},this._objects={dictionary:new ks(this),imageDefinition:new ks(this),layout:new Fo(this),xrecord:new ks(this)}}get tables(){return this._tables}get objects(){return this._objects}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const s=t.getAttrWithoutException("objectId");!s||t.isTemp||e&&e(s)?t.objectId=this.generateHandle():this.updateMaxHandle(s)}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(R.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get version(){return this._version}set version(t){this.updateSysVar(R.ACADVER,this._version,new vt(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(R.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(R.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}set lwdisplay(t){this.updateSysVar(R.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(R.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(R.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celtype(){return this._celtype}set celtype(t){const e=this.normalizeLinetypeName(t??At);this.updateSysVar(R.CELTYPE,this._celtype,e,s=>{this._celtype=s})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(R.CELWEIGHT,this._celweight,t??We.ByLayer,e=>{this._celweight=e})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(R.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(R.TEXTSTYLE,this._textstyle,t??J,e=>{this._textstyle=e})}get angBase(){return this._angBase}set angBase(t){this.updateSysVar(R.ANGBASE,this._angBase,t??0,e=>{this._angBase=e})}get angDir(){return this._angDir}set angDir(t){this.updateSysVar(R.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(R.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(R.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(R.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(R.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(R.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}async read(t,e,s=Es.DXF){const n=Rt.instance.get(s);if(n==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await n.read(t,this,e&&e.minimumChunkSize||10,async(r,a,o,l)=>{if(this.events.openProgress.dispatch({database:this,percentage:r,stage:"CONVERSION",subStage:a,subStageStatus:o,data:l}),e&&e.fontLoader&&a=="FONT"&&o=="END"){const c=l||this.tables.textStyleTable.fonts;await e.fontLoader.load(c)}},e==null?void 0:e.timeout,e==null?void 0:e.sysVars),this.ensureDatabaseDefaults()}async openUri(t,e){var p;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const s=await fetch(t);if(!s.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 '${s.status}'!`);const n=s.headers.get("content-length"),r=n?parseInt(n,10):null;let a=0;const o=(p=s.body)==null?void 0:p.getReader();if(!o)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:m,value:y}=await o.read();if(m)break;if(l.push(y),a+=y.length,r!==null){const x=Math.round(a/r*100);this.events.openProgress.dispatch({database:this,percentage:x,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(a);let u=0;for(const m of l)c.set(m,u),u+=m.length;const g=this.getFileNameFromUri(t).toLowerCase().split(".").pop();g==="dwg"?await this.read(c.buffer,e,Es.DWG):g==="dxf"?await this.read(c.buffer,e,Es.DXF):await this.read(c.buffer,e,g),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,s=this.version.name,n=!1){this.ensureDatabaseDefaults();const r=s instanceof vt?s:new vt(s),a=new xa({database:this,precision:e,version:r});return this.writeDxfHeaderSection(a),this.writeDxfTablesSection(a,r),this.writeDxfBlocksSection(a),this.writeDxfEntitiesSection(a),this.writeDxfObjectsSection(a),a.writeStart("EOF"),a.toString()}async regen(){await new Il(this).read(null,this,500,async(e,s,n,r)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:s,subStageStatus:n,data:r})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new jo(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new tt;e.colorIndex=7,this.tables.layerTable.add(new Ji({name:"0",standardFlags:0,linetype:Ke,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(Qe)||this.tables.linetypeTable.add(new me({name:Qe,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(At)||this.tables.linetypeTable.add(new me({name:At,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Ke)||this.tables.linetypeTable.add(new me({name:Ke,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.tables.textStyleTable.has(J)||this.tables.textStyleTable.add(new tn({name:J,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"})),this.tables.dimStyleTable.has(J)||this.tables.dimStyleTable.add(new He({name:J,dimtxsty:J})),!this.tables.viewportTable.has("*Active")){const e=new rr;e.name="*Active",this.tables.viewportTable.add(e)}const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new qs;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(In)||this.tables.appIdTable.add(new Cn(In)),this.tables.appIdTable.has(bn)||this.tables.appIdTable.add(new Cn(bn))}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,"$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),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,"$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.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(),"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 s of e.newIterator())this.writeDxfEntity(t,s);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 s of e.newIterator())this.writeDxfEntity(t,s);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const s=a=>{t.writeStart("DICTIONARY"),a.dxfOut(t)},n=(a,o)=>{e.getAt(a)!==o&&e.setAt(a,o)},r=a=>{e.getAt(a)&&e.remove(a)};n("ACAD_LAYOUT",this.objects.layout),this.objects.imageDefinition.numEntries>0?n("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):r("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?n("MLIGHT_XRECORD",this.objects.xrecord):r("MLIGHT_XRECORD"),s(e),s(this.objects.layout),this.objects.imageDefinition.numEntries>0&&s(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&s(this.objects.xrecord);for(const[a,o]of this.objects.layout.entries())t.writeStart("LAYOUT"),o.dxfOut(t);for(const[a,o]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),o.dxfOut(t);for(const[a,o]of this.objects.xrecord.entries())t.writeStart("XRECORD"),o.dxfOut(t);t.endSection()}writeDxfTable(t,e,s,n,r){const a=[...n];t.startTable(e),s.dxfOut(t);for(const o of a){if(r==="BLOCK_RECORD"&&o instanceof K){o.dxfOutBlockRecord(t);continue}t.writeStart(r),o.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){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._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,s,n){this.hasSysVarValueChanged(e,s)&&(n(s),this.triggerSysVarChangedEvent(t,e,s))}hasSysVarValueChanged(t,e){return t instanceof tt&&e instanceof tt?!t.equals(e):t instanceof vt&&e instanceof vt?t.value!==e.value:!Object.is(t,e)}normalizeLinetypeName(t){const e=t.trim();return e.toUpperCase()==="BYLAYER"?At:e.toUpperCase()==="BYBLOCK"?Qe:e}triggerSysVarChangedEvent(t,e,s){const n=Gs.instance(),r=t.toLowerCase();n.getDescriptor(r)!=null&&n.events.sysVarChanged.dispatch({database:this,name:r,oldVal:e,newVal:s})}getFileNameFromUri(t){try{const s=new URL(t).pathname.split("/");return s[s.length-1]||""}catch{return""}}}const sh="Load Database",da=3e4,gc=12e4,mc=1024*1024;class mt extends Aa{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Fn.getInstance().getEntry(sh),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const n=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",n?n.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()-s),n}}class ar{constructor(t={}){this.config=t}async read(t,e,s,n,r,a){const o={name:sh,data:{total:0},format(){let d="";return Object.keys(this.data).forEach(g=>{g!=="total"&&(d+=`- ${g}: ${this.data[g]} ms
|
|
4
|
-
`)}),d+=`- total: ${this.data.total} ms`,d}};Fn.getInstance().collect(o),this.progress=n;const l={value:0},c=new Ma;c.setCompleteCallback(()=>this.onFinished()),c.setErrorCallback(d=>this.onError(d)),c.addTask(new mt({stage:"START",step:1,progress:l,task:async d=>d},n)),c.addTask(new mt({stage:"PARSE",step:5,progress:l,task:async d=>await this.parse(d,r)},n)),c.addTask(new mt({stage:"FONT",step:5,progress:l,task:async d=>{const g=this.getFonts(d.model);return{model:d.model,data:g}}},n)),c.addTask(new mt({stage:"LTYPE",step:1,progress:l,task:async d=>(this.processLineTypes(d.model,e),d)},n)),c.addTask(new mt({stage:"STYLE",step:1,progress:l,task:async d=>(this.processTextStyles(d.model,e),d)},n)),c.addTask(new mt({stage:"DIMSTYLE",step:1,progress:l,task:async d=>(this.processDimStyles(d.model,e),d)},n)),c.addTask(new mt({stage:"LAYER",step:1,progress:l,task:async d=>(this.processLayers(d.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),d)},n)),c.addTask(new mt({stage:"VPORT",step:1,progress:l,task:async d=>(this.processViewports(d.model,e),d)},n)),c.addTask(new mt({stage:"HEADER",step:1,progress:l,task:async d=>{if(this.processHeader(d.model,e),a){const g=Gs.instance();for(const[p,m]of Object.entries(a))g.setVar(p,m,e)}return d}},n)),c.addTask(new mt({stage:"BLOCK_RECORD",step:5,progress:l,task:async d=>(this.processBlockTables(d.model,e),d)},n)),c.addTask(new mt({stage:"OBJECT",step:5,progress:l,task:async d=>(this.processObjects(d.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),d)},n)),c.addTask(new mt({stage:"BLOCK",step:5,progress:l,task:async d=>(await this.processBlocks(d.model,e),d)},n)),c.addTask(new mt({stage:"ENTITY",step:100,progress:l,task:async d=>(await this.processEntities(d.model,e,s,l,n),d)},n)),c.addTask(new mt({stage:"END",step:0,progress:l,task:async d=>d},n));const u=Date.now();await c.run(t),o.data.total=Date.now()-u}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"),ss.instance.clear())}getParserWorkerTimeout(t,e){const s=e??this.config.timeout;if(s!=null)return s;const n=Math.ceil(t.byteLength/mc),r=da+n*1e3;return Math.min(gc,Math.max(da,r))}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!")}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,s,n,r){throw new Error("Not impelemented yet!")}}class yc extends nr{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(t){this._standardFlags=t}get viewWidth(){return this._viewWidth}set viewWidth(t){this._viewWidth=t}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(t){this._ucsAssociated=t}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(t){this._cameraPlottable=t}get ucsElevation(){return this._ucsElevation}set ucsElevation(t){this._ucsElevation=t}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(t){this._ucsObjectId=t}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(t){this._ucsBaseObjectId=t}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(t){this._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}}var st,ns,Y,q,rs,Lt,Pe,Gt,ht,Ht,Ot,Se,Ee,Ae,wt,Ut,as,os,Me,Te,hs,ls,cs,xt,Xt,H,ve,ds,L,lt,us,ct,ps,Yt,D,gs,$t,ke,dn,un,Nt,ms,Le,ft,qt,Zt,Kt,ys,_s,Qt,Oe,Ne,pn,ws,Ce,Jt,Be,it,te,bt,gn,nt,mn,ee,It,Fe,xs,Re,Pt,se,St,ie,yn,ze,Et;(st={})[st.None=0]="None",st[st.Anonymous=1]="Anonymous",st[st.NonConstant=2]="NonConstant",st[st.Xref=4]="Xref",st[st.XrefOverlay=8]="XrefOverlay",st[st.ExternallyDependent=16]="ExternallyDependent",st[st.ResolvedOrDependent=32]="ResolvedOrDependent",st[st.ReferencedXref=64]="ReferencedXref";(ns={})[ns.BYBLOCK=0]="BYBLOCK",ns[ns.BYLAYER=256]="BYLAYER";(Y={})[Y.Rotated=0]="Rotated",Y[Y.Aligned=1]="Aligned",Y[Y.Angular=2]="Angular",Y[Y.Diameter=3]="Diameter",Y[Y.Radius=4]="Radius",Y[Y.Angular3Point=5]="Angular3Point",Y[Y.Ordinate=6]="Ordinate",Y[Y.ReferenceIsExclusive=32]="ReferenceIsExclusive",Y[Y.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Y[Y.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(q={})[q.TopLeft=1]="TopLeft",q[q.TopCenter=2]="TopCenter",q[q.TopRight=3]="TopRight",q[q.MiddleLeft=4]="MiddleLeft",q[q.MiddleCenter=5]="MiddleCenter",q[q.MiddleRight=6]="MiddleRight",q[q.BottomLeft=7]="BottomLeft",q[q.BottomCenter=8]="BottomCenter",q[q.BottomRight=9]="BottomRight";(rs={})[rs.AtLeast=1]="AtLeast",rs[rs.Exact=2]="Exact";var ua=((Lt={})[Lt.Center=0]="Center",Lt[Lt.Above=1]="Above",Lt[Lt.Outside=2]="Outside",Lt[Lt.JIS=3]="JIS",Lt[Lt.Below=4]="Below",Lt);(Pe={})[Pe.WithDimension=0]="WithDimension",Pe[Pe.AddLeader=1]="AddLeader",Pe[Pe.Independent=2]="Independent";(Gt={})[Gt.BothOutside=0]="BothOutside",Gt[Gt.ArrowFirst=1]="ArrowFirst",Gt[Gt.TextFirst=2]="TextFirst",Gt[Gt.Auto=3]="Auto";var Ye=((ht={})[ht.Feet=0]="Feet",ht[ht.None=1]="None",ht[ht.Inch=2]="Inch",ht[ht.FeetAndInch=3]="FeetAndInch",ht[ht.Leading=4]="Leading",ht[ht.Trailing=8]="Trailing",ht[ht.LeadingAndTrailing=12]="LeadingAndTrailing",ht),_c=((Ht={})[Ht.None=0]="None",Ht[Ht.Leading=1]="Leading",Ht[Ht.Trailing=2]="Trailing",Ht[Ht.LeadingAndTrailing=3]="LeadingAndTrailing",Ht),wc=((Ot={})[Ot.Center=0]="Center",Ot[Ot.First=1]="First",Ot[Ot.Second=2]="Second",Ot[Ot.OverFirst=3]="OverFirst",Ot[Ot.OverSecond=4]="OverSecond",Ot),xc=((Se={})[Se.Bottom=0]="Bottom",Se[Se.Center=1]="Center",Se[Se.Top=2]="Top",Se);(Ee={})[Ee.None=0]="None",Ee[Ee.UseDrawingBackground=1]="UseDrawingBackground",Ee[Ee.Custom=2]="Custom";(Ae={})[Ae.Horizontal=0]="Horizontal",Ae[Ae.Diagonal=1]="Diagonal",Ae[Ae.NotStacked=2]="NotStacked";(wt={})[wt.Scientific=1]="Scientific",wt[wt.Decimal=2]="Decimal",wt[wt.Engineering=3]="Engineering",wt[wt.Architectural=4]="Architectural",wt[wt.Fractional=5]="Fractional",wt[wt.WindowDesktop=6]="WindowDesktop";(Ut={})[Ut.Decimal=0]="Decimal",Ut[Ut.DegreesMinutesSecond=1]="DegreesMinutesSecond",Ut[Ut.Gradian=2]="Gradian",Ut[Ut.Radian=3]="Radian";var fc=((as={})[as.PatternFill=0]="PatternFill",as[as.SolidFill=1]="SolidFill",as);(os={})[os.NonAssociative=0]="NonAssociative",os[os.Associative=1]="Associative";(Me={})[Me.Normal=0]="Normal",Me[Me.Outer=1]="Outer",Me[Me.Ignore=2]="Ignore";(Te={})[Te.UserDefined=0]="UserDefined",Te[Te.Predefined=1]="Predefined",Te[Te.Custom=2]="Custom";(hs={})[hs.NotAnnotated=0]="NotAnnotated",hs[hs.Annotated=1]="Annotated";(ls={})[ls.Solid=0]="Solid",ls[ls.Gradient=1]="Gradient";(cs={})[cs.TwoColor=0]="TwoColor",cs[cs.OneColor=1]="OneColor";var bc=((xt={})[xt.Default=0]="Default",xt[xt.External=1]="External",xt[xt.Polyline=2]="Polyline",xt[xt.Derived=4]="Derived",xt[xt.Textbox=8]="Textbox",xt[xt.Outermost=16]="Outermost",xt),ci=((Xt={})[Xt.Line=1]="Line",Xt[Xt.Circular=2]="Circular",Xt[Xt.Elliptic=3]="Elliptic",Xt[Xt.Spline=4]="Spline",Xt),Ic=((H={})[H.Off=0]="Off",H[H.Solid=1]="Solid",H[H.Dashed=2]="Dashed",H[H.Dotted=3]="Dotted",H[H.ShotDash=4]="ShotDash",H[H.MediumDash=5]="MediumDash",H[H.LongDash=6]="LongDash",H[H.DoubleShortDash=7]="DoubleShortDash",H[H.DoubleMediumDash=8]="DoubleMediumDash",H[H.DoubleLongDash=9]="DoubleLongDash",H[H.DoubleMediumLongDash=10]="DoubleMediumLongDash",H[H.SparseDot=11]="SparseDot",H);Ic.Off;(ve={})[ve.Standard=-3]="Standard",ve[ve.ByLayer=-2]="ByLayer",ve[ve.ByBlock=-1]="ByBlock";(ds={})[ds.English=0]="English",ds[ds.Metric=1]="Metric";(L={})[L.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",L[L.FRONT_CLIPPING=2]="FRONT_CLIPPING",L[L.BACK_CLIPPING=4]="BACK_CLIPPING",L[L.UCS_FOLLOW=8]="UCS_FOLLOW",L[L.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",L[L.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",L[L.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",L[L.FAST_ZOOM=128]="FAST_ZOOM",L[L.SNAP_MODE=256]="SNAP_MODE",L[L.GRID_MODE=512]="GRID_MODE",L[L.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",L[L.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",L[L.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",L[L.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",L[L.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",L[L.UNUSED=32768]="UNUSED",L[L.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",L[L.VIEWPORT_OFF=131072]="VIEWPORT_OFF",L[L.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",L[L.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",L[L.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",L[L.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(lt={})[lt.OPTIMIZED_2D=0]="OPTIMIZED_2D",lt[lt.WIREFRAME=1]="WIREFRAME",lt[lt.HIDDEN_LINE=2]="HIDDEN_LINE",lt[lt.FLAT_SHADED=3]="FLAT_SHADED",lt[lt.GOURAUD_SHADED=4]="GOURAUD_SHADED",lt[lt.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",lt[lt.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(us={})[us.UCS_UNCHANGED=0]="UCS_UNCHANGED",us[us.HAS_OWN_UCS=1]="HAS_OWN_UCS";(ct={})[ct.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",ct[ct.TOP=1]="TOP",ct[ct.BOTTOM=2]="BOTTOM",ct[ct.FRONT=3]="FRONT",ct[ct.BACK=4]="BACK",ct[ct.LEFT=5]="LEFT",ct[ct.RIGHT=6]="RIGHT";(ps={})[ps.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",ps[ps.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(Yt={})[Yt.ByLayer=0]="ByLayer",Yt[Yt.ByBlock=1]="ByBlock",Yt[Yt.ByDictionaryDefault=2]="ByDictionaryDefault",Yt[Yt.ByObject=3]="ByObject";(D={})[D.NotAllowed=0]="NotAllowed",D[D.AllowErase=1]="AllowErase",D[D.AllowTransform=2]="AllowTransform",D[D.AllowChangeColor=4]="AllowChangeColor",D[D.AllowChangeLayer=8]="AllowChangeLayer",D[D.AllowChangeLinetype=16]="AllowChangeLinetype",D[D.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",D[D.AllowChangeVisibility=64]="AllowChangeVisibility",D[D.AllowClone=128]="AllowClone",D[D.AllowChangeLineweight=256]="AllowChangeLineweight",D[D.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",D[D.AllowAllExceptClone=895]="AllowAllExceptClone",D[D.AllowAll=1023]="AllowAll",D[D.DisableProxyWarning=1024]="DisableProxyWarning",D[D.R13FormatProxy=32768]="R13FormatProxy";function N(i,t,e){return i.code===t&&(e==null||i.value===e)}function we(i){let t={};i.rewind();let e=i.next(),s=e.code;if(t.x=e.value,(e=i.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=i.next()).code!==s+20?i.rewind():t.z=e.value,t}let Ks=Symbol();function S(i,t){return(e,s,n)=>{let r=function(l,c=!1){return l.reduce((u,d)=>{d.pushContext&&u.push({});let g=u[u.length-1];for(let p of typeof d.code=="number"?[d.code]:d.code){let m=g[p]??(g[p]=[]);d.isMultiple&&m.length,m.push(d)}return u},[{}])}(i,s.debug),a=!1,o=r.length-1;for(;!N(e,0,"EOF");){let l=function(x,f,P){return x.find((I,T)=>{var A;return T>=P&&((A=I[f])==null?void 0:A.length)})}(r,e.code,o),c=l==null?void 0:l[e.code],u=c==null?void 0:c[c.length-1];if(!l||!u){s.rewind();break}u.isMultiple||l[e.code].pop();let{name:d,parser:g,isMultiple:p,isReducible:m}=u,y=g==null?void 0:g(e,s,n);if(y===Ks){s.rewind();break}if(d){let[x,f]=Pc(n,d);p&&!m?(Object.prototype.hasOwnProperty.call(x,f)||(x[f]=[]),x[f].push(y)):x[f]=y}u.pushContext&&(o-=1),a=!0,e=s.next()}return t&&Object.setPrototypeOf(n,t),a}}function Pc(i,t){let e=t.split(".");if(!e.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let s=i;for(let n=0;n<e.length-1;++n){let r=_n(e[n]),a=_n(e[n+1]);Object.prototype.hasOwnProperty.call(s,r)||(typeof a=="number"?s[r]=[]:s[r]={}),s=s[r]}return[s,_n(e[e.length-1])]}function _n(i){let t=Number.parseInt(i);return Number.isNaN(t)?i:t}function h({value:i}){return i}function _(i,t){return we(t)}function O({value:i}){return!!i}function Sc({value:i}){return i.trim()}let Ec=[{code:281,name:"isEntity",parser:O},{code:280,name:"wasProxy",parser:O},{code:91,name:"instanceCount",parser:h},{code:90,name:"proxyFlag",parser:h},{code:3,name:"appName",parser:h},{code:2,name:"cppClassName",parser:h},{code:1,name:"name",parser:h}],Ac=S(Ec),Mc=[{code:0,name:"classes",isMultiple:!0,parser(i,t){if(i.value!=="CLASS")return Ks;i=t.next();let e={};return Ac(i,t,e),e}}],Tc=S(Mc);(gs={})[gs.RayTrace=0]="RayTrace",gs[gs.ShadowMap=1]="ShadowMap";function jt(i,t,e){for(;N(i,102);){var s;let n=i.value;if(i=t.next(),!n.startsWith("{")){t.debug,function(a,o){for(;!N(a,102)&&!N(a,0,"EOF");)a=o.next()}(i,t),i=t.next();continue}let r=n.slice(1).trim();e.extensions??(e.extensions={}),(s=e.extensions)[r]??(s[r]=[]),function(a,o,l){for(;!N(a,102,"}")&&!N(a,0,"EOF");)l.push(a),a=o.next()}(i,t,e.extensions[r]),i=t.next()}t.rewind()}let vc=[{code:1001,name:"xdata",isMultiple:!0,parser:ih}],kc=new Set([1010,1011,1012,1013]);function ih(i,t){var n;if(!N(i,1001))throw Error("XData must starts with code 1001");let e={appName:i.value,value:[]};i=t.next();let s=[e.value];for(;!N(i,0,"EOF")&&!N(i,1001)&&i.code>=1e3;){let r=s[s.length-1];if(i.code===1002){i.value==="{"?s.push([]):(s.pop(),(n=s[s.length-1])==null||n.push(r)),i=t.next();continue}kc.has(i.code)?r.push(we(t)):r.push(i.value),i=t.next()}return t.rewind(),e}($t={})[$t.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",$t[$t.CAST=1]="CAST",$t[$t.RECEIVE=2]="RECEIVE",$t[$t.IGNORE=3]="IGNORE";let V=[...vc,{code:284,name:"shadowMode",parser:h},{code:390,name:"plotStyleHardId",parser:h},{code:380,name:"plotStyleType",parser:h},{code:440,name:"transparency",parser:h},{code:430,name:"colorName",parser:h},{code:420,name:"color",parser:h},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(i,t,e)=>(e.proxyEntity??"")+i.value},{code:[92,160],name:"proxyByte",parser:h},{code:60,name:"isVisible",parser:O},{code:48,name:"lineTypeScale",parser:h},{code:370,name:"lineweight",parser:h},{code:62,name:"colorIndex",parser:h},{code:347,name:"materialObjectHardId",parser:h},{code:6,name:"lineType",parser:h},{code:8,name:"layer",parser:h},{code:410,name:"layoutTabName",parser:h},{code:67,name:"isInPaperSpace",parser:O},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:h},{code:102,parser:jt},{code:102,parser:jt},{code:102,parser:jt},{code:5,name:"handle",parser:h}];function en(i){return[{code:3,name:i,parser:(t,e,s)=>(s._code3text=(s._code3text??"")+t.value,s._code3text+(s._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:i,parser:(t,e,s)=>(s._code1text=t.value,(s._code3text??"")+s._code1text)}]}function nh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Lc={extrusionDirection:{x:0,y:0,z:1}},Oc=[{code:210,name:"extrusionDirection",parser:_},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:100,name:"subclassMarker",parser:h},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_},{code:39,name:"thickness",parser:h},{code:100},...V];class rh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nh(this,"parser",S(Oc,Lc))}}nh(rh,"ForEntityName","ARC");(ke={})[ke.BeforeText=0]="BeforeText",ke[ke.AboveText=1]="AboveText",ke[ke.None=2]="None";let or=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4,defaultValue:""},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMFXL",code:49,defaultValue:1},{name:"DIMJOGANG",code:50,defaultValue:45},{name:"DIMTFILL",code:69,defaultValue:0},{name:"DIMTFILLCLR",code:70,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:ua.Above,defaultValueImperial:ua.Center},{name:"DIMZIN",code:78,defaultValue:Ye.Trailing,defaultValueImperial:Ye.Feet},{name:"DIMAZIN",code:79,defaultValue:_c.None},{name:"DIMARCSYM",code:90,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179,defaultValue:0},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:3,defaultValueImperial:2},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:44,defaultValueImperial:46},{name:"DIMTMOVE",code:279,defaultValue:0},{name:"DIMJUST",code:280,defaultValue:wc.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:xc.Center},{name:"DIMTZIN",code:284,defaultValue:Ye.Trailing,defaultValueImperial:Ye.Feet},{name:"DIMALTZ",code:285,defaultValue:Ye.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Ye.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMFXLON",code:290,defaultValue:0},{name:"DIMTXTDIRECTION",code:294,defaultValue:0},{name:"DIMTXSTY",code:340,defaultValue:"Standard"},{name:"DIMLDRBLK",code:341,defaultValue:""},{name:"DIMBLK",code:342,defaultValue:""},{name:"DIMBLK1",code:343,defaultValue:""},{name:"DIMBLK2",code:344,defaultValue:""},{name:"DIMLTYPE",code:345,defaultValue:""},{name:"DIMLTEX1",code:346,defaultValue:""},{name:"DIMLTEX2",code:347,defaultValue:""},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWE",code:372,defaultValue:-2}],ah=[{code:3,name:"styleName",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:51,name:"ocsRotation",parser:h},{code:53,name:"textRotation",parser:h},{code:1,name:"text",parser:h},{code:42,name:"measurement",parser:h},{code:72,name:"textLineSpacingStyle",parser:h},{code:71,name:"attachmentPoint",parser:h},{code:70,name:"dimensionType",parser:h},{code:11,name:"textPoint",parser:_},{code:10,name:"definitionPoint",parser:_},{code:2,name:"name",parser:h},{code:280,name:"version",parser:h},{code:100}],Nc=[{code:100},{code:52,name:"obliqueAngle",parser:h},{code:50,name:"rotationAngle",parser:h},{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:12,name:"insertionPoint",parser:_},{code:100,name:"subclassMarker",parser:h}],Cc=[{code:16,name:"arcPoint",parser:_},{code:15,name:"centerPoint",parser:_},{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:100,name:"subclassMarker",parser:h}],Bc=[{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:100,name:"subclassMarker",parser:h}],Fc=[{code:40,name:"leaderLength",parser:h},{code:15,name:"subDefinitionPoint",parser:_},{code:100,name:"subclassMarker",parser:h}],Rc=[{code:100,parser(i,t,e){let s=function(n){switch(n){case"AcDbAlignedDimension":return S(Nc);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return S(Cc);case"AcDbOrdinateDimension":return S(Bc);case"AcDbRadialDimension":case"AcDbDiametricDimension":return S(Fc)}return null}(i.value);if(!s)return Ks;s(i,t,e)},pushContext:!0},...or.map(i=>({...i,parser:h})),...ah,...V];class mi{parseEntity(t,e){let s={};return S(Rc)(e,t,s),s}}(dn="ForEntityName")in mi?Object.defineProperty(mi,dn,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):mi[dn]="DIMENSION";let zc=[{code:73},{code:17,name:"leaderEnd",parser:_},{code:16,name:"leaderStart",parser:_},{code:71,name:"hasLeader",parser:O},{code:41,name:"endAngle",parser:h},{code:40,name:"startAngle",parser:h},{code:70,name:"isPartial",parser:O},{code:15,name:"centerPoint",parser:_},{code:14,name:"xline2Point",parser:_},{code:13,name:"xline1Point",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...or.map(i=>({...i,parser:h})),...ah,...V];class yi{parseEntity(t,e){let s={};return S(zc)(e,t,s),s}}(un="ForEntityName")in yi?Object.defineProperty(yi,un,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):yi[un]="ARC_DIMENSION";(Nt={})[Nt.NONE=0]="NONE",Nt[Nt.INVISIBLE=1]="INVISIBLE",Nt[Nt.CONSTANT=2]="CONSTANT",Nt[Nt.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Nt[Nt.PRESET=8]="PRESET";(ms={})[ms.MULTILINE=2]="MULTILINE",ms[ms.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(Le={})[Le.NONE=0]="NONE",Le[Le.MIRRORED_X=2]="MIRRORED_X",Le[Le.MIRRORED_Y=4]="MIRRORED_Y";var Vc=((ft={})[ft.LEFT=0]="LEFT",ft[ft.CENTER=1]="CENTER",ft[ft.RIGHT=2]="RIGHT",ft[ft.ALIGNED=3]="ALIGNED",ft[ft.MIDDLE=4]="MIDDLE",ft[ft.FIT=5]="FIT",ft),Dc=((qt={})[qt.BASELINE=0]="BASELINE",qt[qt.BOTTOM=1]="BOTTOM",qt[qt.MIDDLE=2]="MIDDLE",qt[qt.TOP=3]="TOP",qt);function oh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let hh={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Vc.LEFT,valign:Dc.BASELINE,extrusionDirection:{x:0,y:0,z:1}},lh=[{code:73,name:"valign",parser:h},{code:100},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"endPoint",parser:_},{code:72,name:"valign",parser:h},{code:72,name:"halign",parser:h},{code:71,name:"generationFlag",parser:h},{code:7,name:"styleName",parser:h},{code:51,name:"obliqueAngle",parser:h},{code:41,name:"xScale",parser:h},{code:50,name:"rotation",parser:h},{code:1,name:"text",parser:h},{code:40,name:"textHeight",parser:h},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class ch{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){oh(this,"parser",S(lh,hh))}}function dh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}oh(ch,"ForEntityName","TEXT");let jc={...hh},Wc=[{code:2},{code:40,name:"annotationScale",parser:h},{code:10,name:"alignmentPoint",parser:_},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:h},{code:70,name:"numberOfSecondaryAttributes",parser:h},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:h},{code:280,name:"isDuplicatedRecord",parser:O},{code:100},{code:280,name:"isLocked",parser:O},{code:74,name:"valign",parser:h},{code:73},{code:70,name:"attributeFlag",parser:h},{code:2,name:"tag",parser:h},{code:3,name:"prompt",parser:h},{code:280},{code:100,name:"subclassMarker",parser:h},...lh.slice(2)];class uh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){dh(this,"parser",S(Wc,jc))}}function Gc(i,t){let e={};for(let s of i){let n=t(s);n!=null&&(e[n]??(e[n]=[]),e[n].push(s))}return e}function*Yi(i,t=1/0,e=1){for(let s=i;s!==t;s+=e)yield s}function pa(i){return{x:i.x??0,y:i.y??0,z:i.z??0}}dh(uh,"ForEntityName","ATTDEF");var Hc=[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];function Uc(i){return Hc[i]}function Xc(i){i.rewind();let t=i.next();if(t.code!==101)throw Error("Bad call for skipEmbeddedObject()");do t=i.next();while(t.code!==0);i.rewind()}function Yc(i,t,e){if(N(t,102))return jt(t,e,i),!0;switch(t.code){case 0:i.type=t.value;break;case 5:i.handle=t.value;break;case 330:i.ownerBlockRecordSoftId=t.value;break;case 67:i.isInPaperSpace=!!t.value;break;case 8:i.layer=t.value;break;case 6:i.lineType=t.value;break;case 347:i.materialObjectHardId=t.value;break;case 62:i.colorIndex=t.value,i.color=Uc(Math.abs(t.value));break;case 370:i.lineweight=t.value;break;case 48:i.lineTypeScale=t.value;break;case 60:i.isVisible=!!t.value;break;case 92:i.proxyByte=t.value;break;case 310:i.proxyEntity=t.value;break;case 100:break;case 420:i.color=t.value;break;case 430:i.transparency=t.value;break;case 390:i.plotStyleHardId=t.value;break;case 284:i.shadowMode=t.value;break;case 1001:(i.xdata??(i.xdata=[])).push(ih(t,e));break;default:return!1}return!0}function ph(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let $c={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},_i=[{code:46,name:"annotationHeight",parser:h},{code:101,parser(i,t){Xc(t)}},{code:50,name:"columnHeight",parser:h},{code:49,name:"columnGutter",parser:h},{code:48,name:"columnWidth",parser:h},{code:79,name:"columnAutoHeight",parser:h},{code:78,name:"columnFlowReversed",parser:h},{code:76,name:"columnCount",parser:h},{code:75,name:"columnType",parser:h},{code:441,name:"backgroundFillTransparency",parser:h},{code:63,name:"backgroundFillColor",parser:h},{code:45,name:"fillBoxScale",parser:h},{code:[...Yi(430,440)],name:"backgroundColor",parser:h},{code:[...Yi(420,430)],name:"backgroundColor",parser:h},{code:90,name:"backgroundFill",parser:h},{code:44,name:"lineSpacing",parser:h},{code:73,name:"lineSpacingStyle",parser:h},{code:50,name:"rotation",parser:h},{code:43},{code:42},{code:11,name:"direction",parser:_},{code:210,name:"extrusionDirection",parser:_},{code:7,name:"styleName",parser:h},...en("text"),{code:72,name:"drawingDirection",parser:h},{code:71,name:"attachmentPoint",parser:h},{code:41,name:"width",parser:h},{code:40,name:"height",parser:h},{code:10,name:"insertionPoint",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class gh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ph(this,"parser",S(_i,$c))}}function mh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}ph(gh,"ForEntityName","MTEXT");let qc={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},Zc=[..._i.slice(_i.findIndex(({name:i})=>i==="columnType"),_i.findIndex(({name:i})=>i==="subclassMarker")+1),{code:100},{code:0,parser(i){if(!N(i,0,"MTEXT"))return Ks}},{code:2,name:"definitionTag",parser:h},{code:40,name:"annotationScale",parser:h},{code:10,name:"alignmentPoint",parser:_},{code:340,name:"secondaryAttributesHardId",parser:h},{code:70,name:"numberOfSecondaryAttributes",parser:h},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:h},{code:280,name:"isDuplicatedEntriesKeep",parser:O},{code:100},{code:280,name:"lockPositionFlag",parser:O},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"alignmentPoint",parser:_},{code:74,name:"verticalJustification",parser:h},{code:72,name:"horizontalJustification",parser:h},{code:71,name:"textGenerationFlag",parser:h},{code:7,name:"textStyle",parser:h},{code:51,name:"obliqueAngle",parser:h},{code:41,name:"scale",parser:h},{code:50,name:"rotation",parser:h},{code:73},{code:70,name:"attributeFlag",parser:h},{code:2,name:"tag",parser:h},{code:280},{code:100,name:"subclassMarker",parser:h},{code:1,name:"text",parser:h},{code:40,name:"textHeight",parser:h},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100},...V];class yh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){mh(this,"parser",S(Zc,qc))}}function _h(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}mh(yh,"ForEntityName","ATTRIB");let Kc=[...en("data"),{code:70,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class wh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){_h(this,"parser",S(Kc))}}function xh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}_h(wh,"ForEntityName","BODY");let Qc={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Jc=[{code:210,name:"extrusionDirection",parser:_},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class fh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){xh(this,"parser",S(Jc,Qc))}}function bh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}xh(fh,"ForEntityName","CIRCLE");let td={extrusionDirection:{x:0,y:0,z:1}},ed=[{code:42,name:"endAngle",parser:h},{code:41,name:"startAngle",parser:h},{code:40,name:"axisRatio",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"majorAxisEndPoint",parser:_},{code:10,name:"center",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Ih{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){bh(this,"parser",S(ed,td))}}function Ph(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}bh(Ih,"ForEntityName","ELLIPSE");let sd=[{code:13,name:"vertices.3",parser:_},{code:12,name:"vertices.2",parser:_},{code:11,name:"vertices.1",parser:_},{code:10,name:"vertices.0",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Sh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ph(this,"parser",S(sd))}}Ph(Sh,"ForEntityName","3DFACE");(Zt={})[Zt.First=1]="First",Zt[Zt.Second=2]="Second",Zt[Zt.Third=4]="Third",Zt[Zt.Fourth=8]="Fourth";let Eh=[{code:330,name:"sourceBoundaryObjects",parser:h,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:h}],id=[{code:11,name:"end",parser:_},{code:10,name:"start",parser:_}],nd=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_}],rd=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:40,name:"lengthOfMinorAxis",parser:h},{code:11,name:"end",parser:_},{code:10,name:"center",parser:_}],ad=[{code:13,name:"endTangent",parser:_},{code:12,name:"startTangent",parser:_},{code:11,name:"fitDatum",isMultiple:!0,parser:_},{code:97,name:"numberOfFitData",parser:h},{code:10,name:"controlPoints",isMultiple:!0,parser(i,t){let e={...we(t),weight:1};return(i=t.next()).code===42?e.weight=i.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:h},{code:96,name:"numberOfControlPoints",parser:h},{code:95,name:"numberOfKnots",parser:h},{code:74,name:"isPeriodic",parser:O},{code:73,name:"splineFlag",parser:h},{code:94,name:"degree",parser:h}],od={[ci.Line]:id,[ci.Circular]:nd,[ci.Elliptic]:rd,[ci.Spline]:ad},hd=[...Eh,{code:72,name:"edges",parser(i,t){let e={type:i.value},s=S(od[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(i=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:h}],ld=[...Eh,{code:10,name:"vertices",parser(i,t){let e={...we(t),bulge:0};return(i=t.next()).code===42?e.bulge=i.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:h},{code:73,name:"isClosed",parser:O},{code:72,name:"hasBulge",parser:O}];function cd(i,t){let e={boundaryPathTypeFlag:i.value},s=e.boundaryPathTypeFlag&bc.Polyline;return i=t.next(),s?S(ld)(i,t,e):S(hd)(i,t,e),e}let dd=[{code:49,name:"dashLengths",parser:h,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:h},{code:45,name:"offset",parser:ga},{code:43,name:"base",parser:ga},{code:53,name:"angle",parser:h}];function ga(i,t){let e=i.code+1,s={x:i.value,y:1};return(i=t.next()).code===e?s.y=i.value:t.rewind(),s}function ud(i,t){let e={};return S(dd)(i,t,e),e}function Ah(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let pd={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},gd=[{code:470},{code:463},{code:462,name:"colorTint",parser:h},{code:461,name:"gradientDefinition",parser:h},{code:460,name:"gradientRotation",parser:h},{code:453,name:"numberOfColors",parser:h},{code:452,name:"gradientColorFlag",parser:h},{code:451},{code:450,name:"gradientFlag",parser:h},{code:10,name:"seedPoints",parser:_,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:_},{code:98,name:"numberOfSeedPoints",parser:h},{code:47,name:"pixelSize",parser:h},{code:53,name:"definitionLines",parser:ud,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:h},{code:77,name:"isDouble",parser:O},{code:73,name:"isAnnotated",parser:O},{code:41,name:"patternScale",parser:h},{code:52,name:"patternAngle",parser:h},{code:76,name:"patternType",parser:h},{code:75,name:"hatchStyle",parser:h},{code:92,name:"boundaryPaths",parser:cd,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:h},{code:71,name:"associativity",parser:h},{code:63,name:"patternFillColor",parser:h},{code:70,name:"solidFill",parser:h},{code:2,name:"patternName",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:10,name:"elevationPoint",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V];class Mh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ah(this,"parser",S(gd,pd))}}function Th(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Ah(Mh,"ForEntityName","HATCH");let md={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},yd=[{code:290,name:"clipMode",parser:h},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:_},{code:91,name:"countBoundaryPoints",parser:h},{code:71,name:"clippingBoundaryType",parser:h},{code:360,name:"imageDefReactorHandle",parser:h},{code:283,name:"fade",parser:h},{code:282,name:"contrast",parser:h},{code:281,name:"brightness",parser:h},{code:280,name:"isClipped",parser:O},{code:70,name:"flags",parser:h},{code:340,name:"imageDefHandle",parser:h},{code:13,name:"imageSize",parser:_},{code:12,name:"vPixel",parser:_},{code:11,name:"uPixel",parser:_},{code:10,name:"position",parser:_},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class vh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Th(this,"parser",S(yd,md))}}Th(vh,"ForEntityName","IMAGE");(Kt={})[Kt.ShowImage=1]="ShowImage",Kt[Kt.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Kt[Kt.UseClippingBoundary=4]="UseClippingBoundary",Kt[Kt.TransparencyIsOn=8]="TransparencyIsOn";(ys={})[ys.Rectangular=1]="Rectangular",ys[ys.Polygonal=2]="Polygonal";(_s={})[_s.Outside=0]="Outside",_s[_s.Inside=1]="Inside";function kh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let _d={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},wd=[{code:210,name:"extrusionDirection",parser:_},{code:45,name:"rowSpacing",parser:h},{code:44,name:"columnSpacing",parser:h},{code:71,name:"rowCount",parser:h},{code:70,name:"columnCount",parser:h},{code:50,name:"rotation",parser:h},{code:43,name:"zScale",parser:h},{code:42,name:"yScale",parser:h},{code:41,name:"xScale",parser:h},{code:10,name:"insertionPoint",parser:_},{code:2,name:"name",parser:h},{code:66,name:"isVariableAttributes",parser:O},{code:100,name:"subclassMarker",parser:h},...V];class Lh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){kh(this,"parser",S(wd,_d))}}function Oh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}kh(Lh,"ForEntityName","INSERT");let xd={isArrowheadEnabled:!0},fd=[{code:213,name:"offsetFromAnnotation",parser:_},{code:212,name:"offsetFromBlock",parser:_},{code:211,name:"horizontalDirection",parser:_},{code:210,name:"normal",parser:_},{code:340,name:"associatedAnnotation",parser:h},{code:77,name:"byBlockColor",parser:h},{code:10,name:"vertices",parser:_,isMultiple:!0},{code:76,name:"numberOfVertices",parser:h},{code:41,name:"textWidth",parser:h},{code:40,name:"textHeight",parser:h},{code:75,name:"isHooklineExists",parser:O},{code:74,name:"isHooklineSameDirection",parser:O},{code:73,name:"leaderCreationFlag",parser:h},{code:72,name:"isSpline",parser:O},{code:71,name:"isArrowheadEnabled",parser:O},{code:3,name:"styleName",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Nh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Oh(this,"parser",S(fd,xd))}}Oh(Nh,"ForEntityName","LEADER");(Qt={})[Qt.TextAnnotation=0]="TextAnnotation",Qt[Qt.ToleranceAnnotation=1]="ToleranceAnnotation",Qt[Qt.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Qt[Qt.NoAnnotation=3]="NoAnnotation";function Ch(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let bd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Id=[{code:210,name:"extrusionDirection",parser:_},{code:11,name:"endPoint",parser:_},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Bh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ch(this,"parser",S(Id,bd))}}function Fh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Ch(Bh,"ForEntityName","LINE");let Pd=[{code:280,name:"shadowMapSoftness",parser:h},{code:91,name:"shadowMapSize",parser:h},{code:73,name:"shadowType",parser:h},{code:293,name:"isShadowCast",parser:O},{code:51,name:"falloffAngle",parser:h},{code:50,name:"hotspotAngle",parser:h},{code:42,name:"limitEnd",parser:h},{code:41,name:"limitStart",parser:h},{code:292,name:"isAttenuationLimited",parser:O},{code:72,name:"attenuationType",parser:h},{code:11,name:"target",parser:_},{code:10,name:"position",parser:_},{code:40,name:"intensity",parser:h},{code:291,name:"isPlotGlyph",parser:O},{code:290,name:"isOn",parser:O},{code:421,name:"lightColorInstance",parser:h},{code:63,name:"lightColorIndex",parser:h},{code:70,name:"lightType",parser:h},{code:1,name:"name",parser:h},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Rh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Fh(this,"parser",S(Pd))}}Fh(Rh,"ForEntityName","LIGHT");(Oe={})[Oe.Distant=1]="Distant",Oe[Oe.Point=2]="Point",Oe[Oe.Spot=3]="Spot";(Ne={})[Ne.None=0]="None",Ne[Ne.InverseLinear=1]="InverseLinear",Ne[Ne.InverseSquare=2]="InverseSquare";let Sd={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Ed={bulge:0},Ad=[{code:42,name:"bulge",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:91,name:"id",parser:h},{code:20,name:"y",parser:h},{code:10,name:"x",parser:h}],Md=[{code:210,name:"extrusionDirection",parser:_},{code:10,name:"vertices",isMultiple:!0,parser(i,t){let e={};return S(Ad,Ed)(i,t,e),e}},{code:39,name:"thickness",parser:h},{code:38,name:"elevation",parser:h},{code:43,name:"constantWidth",parser:h},{code:70,name:"flag",parser:h},{code:90,name:"numberOfVertices",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class wi{parseEntity(t,e){let s={};return S(Md,Sd)(e,t,s),s}}(pn="ForEntityName")in wi?Object.defineProperty(wi,pn,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):wi[pn]="LWPOLYLINE";(ws={})[ws.IS_CLOSED=1]="IS_CLOSED",ws[ws.PLINE_GEN=128]="PLINE_GEN";function zh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Td=[{code:90,name:"overridenSubEntityCount",parser:h},{code:140,name:"edgeCreaseWeights",parser:h,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:h},{code:94,parser(i,t,e){e.edgeCount=i.value,e.edgeIndices=[];for(let s=0;s<e.edgeCount;++s){let n=[];i=t.next(),n[0]=i.value,i=t.next(),n[1]=i.value,e.edgeIndices.push(n)}}},{code:93,parser(i,t,e){e.totalFaceIndices=i.value,e.faceIndices=[];let s=[];for(let r=0;r<e.totalFaceIndices&&!N(i,0);++r)i=t.next(),s.push(i.value);let n=0;for(;n<s.length;){let r=s[n++],a=[];for(let o=0;o<r;++o)a.push(s[n++]);e.faceIndices.push(a)}}},{code:10,name:"vertices",parser:_,isMultiple:!0},{code:92,name:"verticesCount",parser:h},{code:91,name:"subdivisionLevel",parser:h},{code:40,name:"blendCrease",parser:h},{code:72,name:"isBlendCreased",parser:O},{code:71,name:"version",parser:h},{code:100,name:"subclassMarker",parser:Sc,pushContext:!0},...V];class Vh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){zh(this,"parser",S(Td))}}function Dh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}zh(Vh,"ForEntityName","MESH");let vd=[{code:42,name:"fillParameters",parser:h,isMultiple:!0},{code:75,name:"fillCount",parser:h},{code:41,name:"parameters",parser:h,isMultiple:!0},{code:74,name:"parameterCount",parser:h}],kd=[{code:[74,41,75,42],name:"elements",parser(i,t){let e=S(vd),s={};return e(i,t,s),s},isMultiple:!0},{code:13,name:"miterDirection",parser:_},{code:12,name:"direction",parser:_},{code:11,name:"position",parser:_}],Ld=[{code:[11,12,13],name:"segments",parser(i,t){let e=S(kd),s={};return e(i,t,s),s},isMultiple:!0},{code:210,name:"extrusionDirection",parser:_},{code:10,name:"startPosition",parser:_},{code:73,name:"styleCount",parser:h},{code:72,name:"vertexCount",parser:h},{code:71,name:"flags",parser:h},{code:70,name:"justification",parser:h},{code:40,name:"scale",parser:h},{code:340,name:"styleObjectHandle",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V];class jh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Dh(this,"parser",S(Ld))}}Dh(jh,"ForEntityName","MLINE");(Ce={})[Ce.Top=0]="Top",Ce[Ce.Zero=1]="Zero",Ce[Ce.Bottom=2]="Bottom";(Jt={})[Jt.HasVertex=1]="HasVertex",Jt[Jt.Closed=2]="Closed",Jt[Jt.SuppressStartCaps=4]="SuppressStartCaps",Jt[Jt.SuppressEndCaps=8]="SuppressEndCaps";(Be={})[Be.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Be[Be.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Be[Be.BY_STYLE=5]="BY_STYLE";function Wh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Od={},Nd=[{code:170,name:"multileaderType",parser:h},{code:291,name:"doglegEnabled",parser:O},{code:40,name:"doglegLength",parser:h},{code:172,name:"contentType",parser:h},{code:3,name:"textContent",parser:h},{code:12,name:"textAnchor",parser:_},{code:344,name:"blockHandle",parser:h},{code:15,name:"blockPosition",parser:_},{code:302,name:"leaderSections",parser:function(i,t,e){let s,n={leaderLines:[]};for(;t.hasNext()&&(s=t.next()).code!==303;)switch(s.code){case 10:n.landingPoint=_(s.value,t);break;case 11:n.doglegVector=_(s.value,t);break;case 40:n.doglegLength=s.value;break;case 304:n.leaderLines.push(function(r){let a,o={vertices:[]};for(;r.hasNext()&&(a=r.next()).code!==305;)a.code===10&&o.vertices.push(_(a.value,r));return o}(t))}return n},isMultiple:!0},...V];class Gh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Wh(this,"parser",S(Nd,Od))}}function Hh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Wh(Gh,"ForEntityName","MULTILEADER");let Cd={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Bd=[{code:50,name:"angle",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:39,name:"thickness",parser:h},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Uh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Hh(this,"parser",S(Bd,Cd))}}function Xh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Hh(Uh,"ForEntityName","POINT");let Fd={startWidth:0,endWidth:0,bulge:0},Rd=[{code:91,name:"id",parser:h},{code:[...Yi(71,75)],name:"faces",isMultiple:!0,parser:h},{code:50,name:"tangentDirection",parser:h},{code:70,name:"flag",parser:h},{code:42,name:"bulge",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:30,name:"z",parser:h},{code:20,name:"y",parser:h},{code:10,name:"x",parser:h},{code:100,name:"subclassMarker",parser:h},{code:100},...V];class hr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xh(this,"parser",S(Rd,Fd))}}function Yh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Xh(hr,"ForEntityName","VERTEX");let zd={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Vd=[{code:0,name:"vertices",isMultiple:!0,parser:(i,t)=>N(i,0,"VERTEX")?(i=t.next(),new hr().parseEntity(t,i)):Ks},{code:210,name:"extrusionDirection",parser:_},{code:75,name:"smoothType",parser:h},{code:74,name:"surfaceNDensity",parser:h},{code:73,name:"surfaceMDensity",parser:h},{code:72,name:"meshNVertexCount",parser:h},{code:71,name:"meshMVertexCount",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:70,name:"flag",parser:h},{code:39,name:"thickness",parser:h},{code:30,name:"elevation",parser:h},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:h},...V];class $h{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Yh(this,"parser",S(Vd,zd))}}Yh($h,"ForEntityName","POLYLINE");(it={})[it.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",it[it.CURVE_FIT=2]="CURVE_FIT",it[it.SPLINE_FIT=4]="SPLINE_FIT",it[it.POLYLINE_3D=8]="POLYLINE_3D",it[it.POLYGON_3D=16]="POLYGON_3D",it[it.CLOSED_POLYGON=32]="CLOSED_POLYGON",it[it.POLYFACE=64]="POLYFACE",it[it.CONTINUOUS=128]="CONTINUOUS";var di=((te={})[te.NONE=0]="NONE",te[te.QUADRATIC=5]="QUADRATIC",te[te.CUBIC=6]="CUBIC",te[te.BEZIER=8]="BEZIER",te);function qh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Dd=[{code:11,name:"direction",parser:_},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Zh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){qh(this,"parser",S(Dd))}}function Kh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}qh(Zh,"ForEntityName","RAY");let jd=[...en("data"),{code:70,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Qh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Kh(this,"parser",S(jd))}}function Jh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Kh(Qh,"ForEntityName","REGION");let Wd={vertices:[],backLineVertices:[]},Gd=[{code:360,name:"geometrySettingHardId",parser:h},{code:12,name:"backLineVertices",isMultiple:!0,parser:_},{code:93,name:"numberOfBackLineVertices",parser:h},{code:11,name:"vertices",isMultiple:!0,parser:_},{code:92,name:"verticesCount",parser:h},{code:[63,411],name:"indicatorColor",parser:h},{code:70,name:"indicatorTransparency",parser:h},{code:41,name:"bottomHeight",parser:h},{code:40,name:"topHeight",parser:h},{code:10,name:"verticalDirection",parser:_},{code:1,name:"name",parser:h},{code:91,name:"flag",parser:h},{code:90,name:"state",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class tl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Jh(this,"parser",S(Gd,Wd))}}function el(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Jh(tl,"ForEntityName","SECTION");let Hd={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ud=[{code:210,name:"extrusionDirection",parser:_},{code:39,name:"thickness",parser:h},{code:[...Yi(10,14)],name:"points",isMultiple:!0,parser:_},{code:100,name:"subclassMarker",parser:h},...V];class sl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){el(this,"parser",S(Ud,Hd))}}function il(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}el(sl,"ForEntityName","SOLID");let Xd=[{code:350,name:"historyObjectSoftId",parser:h},{code:100,name:"subclassMarker",parser:h},...en("data"),{code:70,name:"version",parser:h},{code:100},...V];class nl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){il(this,"parser",S(Xd))}}function rl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}il(nl,"ForEntityName","3DSOLID");let Yd={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},$d=[{code:11,name:"fitPoints",isMultiple:!0,parser:_},{code:10,name:"controlPoints",isMultiple:!0,parser:_},{code:41,name:"weights",isMultiple:!0,parser:h},{code:40,name:"knots",isMultiple:!0,parser:h},{code:13,name:"endTangent",parser:_},{code:12,name:"startTangent",parser:_},{code:44,name:"fitTolerance",parser:h},{code:43,name:"controlTolerance",parser:h},{code:42,name:"knotTolerance",parser:h},{code:74,name:"numberOfFitPoints",parser:h},{code:73,name:"numberOfControlPoints",parser:h},{code:72,name:"numberOfKnots",parser:h},{code:71,name:"degree",parser:h},{code:70,name:"flag",parser:h},{code:210,name:"normal",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class al{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){rl(this,"parser",S($d,Yd))}}rl(al,"ForEntityName","SPLINE");(bt={})[bt.NONE=0]="NONE",bt[bt.CLOSED=1]="CLOSED",bt[bt.PERIODIC=2]="PERIODIC",bt[bt.RATIONAL=4]="RATIONAL",bt[bt.PLANAR=8]="PLANAR",bt[bt.LINEAR=16]="LINEAR";function ol(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let qd=[{code:280,name:"shadowMapSoftness",parser:h},{code:71,name:"shadowMapSize",parser:h},{code:70,name:"shadowType",parser:h},{code:292,name:"isSummerTime",parser:O},{code:92,name:"time",parser:h},{code:91,name:"julianDay",parser:h},{code:291,name:"hasShadow",parser:O},{code:40,name:"intensity",parser:h},{code:421,name:"lightColorInstance",parser:h},{code:63,name:"lightColorIndex",parser:h},{code:290,name:"isOn",parser:O},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V.filter(i=>i.code!==100)];class hl{parseEntity(t,e){let s={layer:""};return this.parser(e,t,s),s}constructor(){ol(this,"parser",S(qd))}}ol(hl,"ForEntityName","SUN");class xi{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=pa(we(t)),e=t.lastReadGroup;break;case 11:s.directionVector=pa(we(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerDictionaryId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(n,r){let a=!1,o=!1,l={};for(;!n.isEOF()&&r.code!==0&&!o;)switch(r.code){case 171:if(a){o=!0;continue}l.cellType=r.value,a=!0,r=n.next();break;case 172:l.flagValue=r.value,r=n.next();break;case 173:l.mergedValue=r.value,r=n.next();break;case 174:l.autoFit=r.value,r=n.next();break;case 175:l.borderWidth=r.value,r=n.next();break;case 176:l.borderHeight=r.value,r=n.next();break;case 91:l.overrideFlag=r.value,r=n.next();break;case 178:l.virtualEdgeFlag=r.value,r=n.next();break;case 145:l.rotation=r.value,r=n.next();break;case 345:l.fieldObjetId=r.value,r=n.next();break;case 340:l.blockTableRecordId=r.value,r=n.next();break;case 146:l.blockScale=r.value,r=n.next();break;case 177:l.blockAttrNum=r.value,r=n.next();break;case 7:l.textStyle=r.value,r=n.next();break;case 140:l.textHeight=r.value,r=n.next();break;case 170:l.attachmentPoint=r.value,r=n.next();break;case 92:l.extendedCellFlags=r.value,r=n.next();break;case 285:l.rightBorderVisibility=!!(r.value??!0),r=n.next();break;case 286:l.bottomBorderVisibility=!!(r.value??!0),r=n.next();break;case 288:l.leftBorderVisibility=!!(r.value??!0),r=n.next();break;case 289:l.topBorderVisibility=!!(r.value??!0),r=n.next();break;case 301:(function(c,u,d){for(;d.code!==304;)switch(d.code){case 301:case 93:case 90:case 94:d=u.next();break;case 1:c.text=d.value,d=u.next();break;case 300:c.attrText=d.value,d=u.next();break;case 302:c.text=d.value?d.value:c.text,d=u.next();break;default:d=u.next()}})(l,n,r),r=n.next();break;default:return l}return a=!1,o=!1,l}(t,e)),e=t.lastReadGroup;break;default:Yc(s,e,t),e=t.next()}}return s}}function ll(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}(gn="ForEntityName")in xi?Object.defineProperty(xi,gn,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):xi[gn]="ACAD_TABLE";let Zd=[{code:11,name:"xAxisDirection",parser:_},{code:210,name:"extrusionDirection",parser:_},{code:1,name:"text",parser:h},{code:10,name:"position",parser:_},{code:3,name:"styleName",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class cl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ll(this,"parser",S(Zd))}}ll(cl,"ForEntityName","TOLERANCE");var Kd=((nt={})[nt.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",nt[nt.TANGENT_DEFINED=2]="TANGENT_DEFINED",nt[nt.NOT_USED=4]="NOT_USED",nt[nt.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",nt[nt.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",nt[nt.FOR_POLYLINE=32]="FOR_POLYLINE",nt[nt.FOR_POLYGON=64]="FOR_POLYGON",nt[nt.POLYFACE=128]="POLYFACE",nt);let Qd=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:h},{code:361,name:"sunId",parser:h},{code:431,name:"ambientLightColorName",parser:h},{code:421,name:"ambientLightColorInstance",parser:h},{code:63,name:"ambientLightColorIndex",parser:h},{code:142,name:"contrast",parser:h},{code:141,name:"brightness",parser:h},{code:282,name:"defaultLightingType",parser:h},{code:292,name:"isDefaultLighting",parser:O},{code:348,name:"visualStyleId",parser:h},{code:333,name:"shadePlotId",parser:h},{code:332,name:"backgroundId",parser:h},{code:61,name:"majorGridFrequency",parser:h},{code:170,name:"shadePlotMode",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:346,name:"ucsBaseId",parser:h},{code:345,name:"ucsId",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:74,name:"iconFlag",parser:h},{code:71,name:"ucsPerViewport",parser:h},{code:281,name:"renderMode",parser:h},{code:1,name:"sheetName",parser:h},{code:340,name:"clippingBoundaryId",parser:h},{code:90,name:"statusBitFlags",parser:h},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:h},{code:72,name:"circleZoomPercent",parser:h},{code:51,name:"viewTwistAngle",parser:h},{code:50,name:"snapAngle",parser:h},{code:45,name:"viewHeight",parser:h},{code:44,name:"backClipZ",parser:h},{code:43,name:"frontClipZ",parser:h},{code:42,name:"perspectiveLensLength",parser:h},{code:17,name:"targetPoint",parser:_},{code:16,name:"viewDirection",parser:_},{code:15,name:"gridSpacing",parser:_},{code:14,name:"snapSpacing",parser:_},{code:13,name:"snapBase",parser:_},{code:12,name:"displayCenter",parser:_},{code:69,name:"viewportId",parser:h},{code:68,name:"status",parser:h},{code:41,name:"height",parser:h},{code:40,name:"width",parser:h},{code:10,name:"viewportCenter",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V];class fi{parseEntity(t,e){let s={};return S(Qd)(e,t,s),s}}function dl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}(mn="ForEntityName")in fi?Object.defineProperty(fi,mn,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):fi[mn]="VIEWPORT";let Jd={brightness:50,constrast:50,fade:0},tu=[{code:14,name:"boundary",isMultiple:!0,parser:_},{code:91,name:"numberOfVertices",parser:h},{code:71,name:"boundaryType",parser:h},{code:360,name:"imageDefReactorHardId",parser:h},{code:283,name:"fade",parser:h},{code:282,name:"contrast",parser:h},{code:281,name:"brightness",parser:h},{code:280,name:"isClipping",parser:O},{code:70,name:"displayFlag",parser:h},{code:340,name:"imageDefHardId",parser:h},{code:13,name:"imageSize",parser:_},{code:12,name:"vDirection",parser:_},{code:11,name:"uDirection",parser:_},{code:10,name:"position",parser:_},{code:90,name:"classVersion",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class ul{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){dl(this,"parser",S(tu,Jd))}}dl(ul,"ForEntityName","WIPEOUT");(ee={})[ee.ShowImage=1]="ShowImage",ee[ee.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",ee[ee.UseClippingBoundary=4]="UseClippingBoundary",ee[ee.Transparency=8]="Transparency";function pl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let eu=[{code:11,name:"direction",parser:_},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class gl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){pl(this,"parser",S(eu))}}pl(gl,"ForEntityName","XLINE");let su=0;function ml(i){if(!i)throw TypeError("entity cannot be undefined or null");i.handle||(i.handle=su++)}let iu=Object.fromEntries([rh,yi,uh,yh,wh,fh,mi,Ih,Sh,vh,Lh,Nh,Bh,Rh,wi,Vh,jh,gh,Gh,Uh,$h,Zh,Qh,tl,sl,nl,al,hl,xi,ch,cl,Mh,hr,fi,ul,gl].map(i=>[i.ForEntityName,new i]));function yl(i,t){let e=[];for(;!N(i,0,"EOF");){if(i.code===0){if(i.value==="ENDBLK"||i.value==="ENDSEC"){t.rewind();break}let s=iu[i.value];if(s){let n=i.value;i=t.next();let r=s.parseEntity(t,i);r.type=n,ml(r),e.push(r)}else t.debug}i=t.next()}return e}function fs(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class ma{next(){if(!this.hasNext())return this._eof?this.debug:this.debug,{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=ya(t,this._data[this._pointer++],this.debug),s={code:t,value:e};return N(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=ya(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){fs(this,"_data",void 0),fs(this,"debug",void 0),fs(this,"_pointer",void 0),fs(this,"_eof",void 0),fs(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function ya(i,t,e=!1){return i<=9?t:i>=10&&i<=59?parseFloat(t.trim()):i>=60&&i<=99?parseInt(t.trim()):i>=100&&i<=109?t:i>=110&&i<=149?parseFloat(t.trim()):i>=160&&i<=179?parseInt(t.trim()):i>=210&&i<=239?parseFloat(t.trim()):i>=270&&i<=289?parseInt(t.trim()):i>=290&&i<=299?function(s){if(s==="0")return!1;if(s==="1")return!0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(t.trim()):i>=300&&i<=369?t:i>=370&&i<=389?parseInt(t.trim()):i>=390&&i<=399?t:i>=400&&i<=409?parseInt(t.trim()):i>=410&&i<=419?t:i>=420&&i<=429?parseInt(t.trim()):i>=430&&i<=439?t:i>=440&&i<=459?parseInt(t.trim()):i>=460&&i<=469?parseFloat(t.trim()):i>=470&&i<=481||i===999||i>=1e3&&i<=1009?t:i>=1010&&i<=1059?parseFloat(t.trim()):i>=1060&&i<=1071?parseInt(t.trim()):t}function nu(i,t){let e=null,s={};for(;!N(i,0,"EOF")&&!N(i,0,"ENDSEC");)i.code===9?e=i.value:i.code===10?s[e]=we(t):s[e]=i.value,i=t.next();return s}let ce=[{code:100,name:"subclassMarker",parser:h},{code:330,name:"ownerObjectId",parser:h},{code:102,isMultiple:!0,parser(i,t){for(;!N(i,0,"EOF")&&!N(i,102,"}");)i=t.next()}},{code:5,name:"handle",parser:h}],ru=[{code:70,name:"flag",parser:h},{code:2,name:"appName",parser:h},{code:100,name:"subclassMarker",parser:h},...ce],au=S(ru),ou=S([{code:310,name:"bmpPreview",parser:h},{code:281,name:"scalability",parser:h},{code:280,name:"explodability",parser:h},{code:70,name:"insertionUnits",parser:h},{code:340,name:"layoutObjects",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),hu=S([...or.map(i=>({...i,parser:h})),{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},{code:105,name:"handle",parser:h},...ce.filter(i=>i.code!==5)]),lu=S([{code:347,name:"materialObjectId",parser:h},{code:390,name:"plotStyleNameObjectId",parser:h},{code:370,name:"lineweight",parser:h},{code:290,name:"isPlotting",parser:O},{code:6,name:"lineType",parser:h},{code:62,name:"colorIndex",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),cu=S([{code:9,name:"text",parser:h},{code:45,name:"offsetY",parser:h},{code:44,name:"offsetX",parser:h},{code:50,name:"rotation",parser:h},{code:46,name:"scale",parser:h},{code:340,name:"styleObjectId",parser:h},{code:75,name:"shapeNumber",parser:h},{code:74,name:"elementTypeFlag",parser:h},{code:49,name:"elementLength",parser:h}],{elementTypeFlag:0,elementLength:0}),du=S([{code:49,name:"pattern",parser(i,t){let e={};return cu(i,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:h},{code:73,name:"numberOfLineTypes",parser:h},{code:72,parser:h},{code:3,name:"description",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),uu=S([{code:1e3,name:"extendedFont",parser:h},{code:1001},{code:4,name:"bigFont",parser:h},{code:3,name:"font",parser:h},{code:42,name:"lastHeight",parser:h},{code:71,name:"textGenerationFlag",parser:h},{code:50,name:"obliqueAngle",parser:h},{code:41,name:"widthFactor",parser:h},{code:40,name:"fixedTextHeight",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),pu=[{code:13,name:"orthographicOrigin",parser:_},{code:71,name:"orthographicType",parser:h},{code:346,name:"baseUcsHandle",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"isOrthographic",parser:O},{code:12,name:"yAxis",parser:_},{code:11,name:"xAxis",parser:_},{code:10,name:"origin",parser:_},{code:70,name:"flag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce],gu=S(pu),mu=[{code:346,name:"baseUcsId",parser:h},{code:345,name:"ucsId",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:361,name:"sunHardId",parser:h},{code:348,name:"styleHardId",parser:h},{code:334,name:"liveSectionSoftId",parser:h},{code:332,name:"backgroundSoftId",parser:h},{code:73,name:"isPlottable",parser:O},{code:72,name:"isUcsAssociated",parser:O},{code:281,name:"renderMode",parser:h},{code:71,name:"viewMode",parser:h},{code:50,name:"twistAngle",parser:h},{code:44,name:"backClippingPlane",parser:h},{code:43,name:"frontClippingPlane",parser:h},{code:42,name:"lensLength",parser:h},{code:12,name:"target",parser:_},{code:11,name:"direction",parser:_},{code:10,name:"center",parser:_},{code:41,name:"width",parser:h},{code:40,name:"height",parser:h},{code:70,name:"flag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce],yu=S(mu),_u=S([{code:[63,421,431],name:"ambientColor",parser:h},{code:142,name:"contrast",parser:h},{code:141,name:"brightness",parser:h},{code:282,name:"defaultLightingType",parser:h},{code:292,name:"isDefaultLightingOn",parser:O},{code:348,name:"visualStyleObjectId",parser:h},{code:333,name:"shadePlotObjectId",parser:h},{code:332,name:"backgroundObjectId",parser:h},{code:61,name:"majorGridLines",parser:h},{code:170,name:"shadePlotSetting",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:74,name:"ucsIconSetting",parser:h},{code:71,name:"viewMode",parser:h},{code:281,name:"renderMode",parser:h},{code:1,name:"styleSheet",parser:h},{code:[331,441],name:"frozenLayers",parser:h,isMultiple:!0},{code:72,name:"circleSides",parser:h},{code:51,name:"viewTwistAngle",parser:h},{code:50,name:"snapRotationAngle",parser:h},{code:45,name:"viewHeight",parser:h},{code:44,name:"backClippingPlane",parser:h},{code:43,name:"frontClippingPlane",parser:h},{code:42,name:"lensLength",parser:h},{code:17,name:"viewTarget",parser:_},{code:16,name:"viewDirectionFromTarget",parser:_},{code:15,name:"gridSpacing",parser:_},{code:14,name:"snapSpacing",parser:_},{code:13,name:"snapBasePoint",parser:_},{code:12,name:"center",parser:_},{code:11,name:"upperRightCorner",parser:_},{code:10,name:"lowerLeftCorner",parser:_},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),wu={APPID:au,BLOCK_RECORD:ou,DIMSTYLE:hu,LAYER:lu,LTYPE:du,STYLE:uu,UCS:gu,VIEW:yu,VPORT:_u},xu=S([{code:70,name:"maxNumberOfEntries",parser:h},{code:100,name:"subclassMarker",parser:h},{code:330,name:"ownerObjectId",parser:h},{code:102,parser:jt},{code:102,parser:jt},{code:102,parser:jt},{code:360,isMultiple:!0},{code:5,name:"handle",parser:h},{code:2,name:"name",parser:h}]);function fu(i,t){var s;let e={};for(;!N(i,0,"EOF")&&!N(i,0,"ENDSEC");){if(N(i,0,"TABLE")){i=t.next();let n={entries:[]};xu(i,t,n),e[n.name]=n}if(N(i,0)&&!N(i,0,"ENDTAB")){let n=i.value;i=t.next();let r=wu[n];if(!r){t.debug,i=t.next();continue}let a={};r(i,t,a),(s=e[n])==null||s.entries.push(a)}i=t.next()}return e}function bu(i,t){let e={};for(;!N(i,0,"EOF")&&!N(i,0,"ENDSEC");){if(N(i,0,"BLOCK")){let s=Iu(i=t.next(),t);ml(s),s.name&&(e[s.name]=s)}i=t.next()}return e}function Iu(i,t){let e={};for(;!N(i,0,"EOF");){if(N(i,0,"ENDBLK")){for(i=t.next();!N(i,0,"EOF");){if(N(i,100,"AcDbBlockEnd"))return e;i=t.next()}break}switch(i.code){case 1:e.xrefPath=i.value;break;case 2:e.name=i.value;break;case 3:e.name2=i.value;break;case 5:e.handle=i.value;break;case 8:e.layer=i.value;break;case 10:e.position=we(t);break;case 67:e.paperSpace=!!i.value&&i.value==1;break;case 70:i.value!==0&&(e.type=i.value);break;case 100:break;case 330:e.ownerHandle=i.value;break;case 0:e.entities=yl(i,t)}i=t.next()}return e}let lr=[{code:330,name:"ownerObjectId",parser:h},{code:102,parser:jt},{code:102,parser:jt},{code:102,parser:jt},{code:5,name:"handle",parser:h}],_l=[{code:333,name:"shadePlotId",parser:h},{code:149,name:"imageOriginY",parser:h},{code:148,name:"imageOriginX",parser:h},{code:147,name:"scaleFactor",parser:h},{code:78,name:"shadePlotCustomDPI",parser:h},{code:77,name:"shadePlotResolution",parser:h},{code:76,name:"shadePlotMode",parser:h},{code:75,name:"standardScaleType",parser:h},{code:7,name:"currentStyleSheet",parser:h},{code:74,name:"plotType",parser:h},{code:73,name:"plotRotation",parser:h},{code:72,name:"plotPaperUnit",parser:h},{code:70,name:"layoutFlag",parser:h},{code:143,name:"printScaleDenominator",parser:h},{code:142,name:"printScaleNumerator",parser:h},{code:141,name:"windowAreaYMax",parser:h},{code:140,name:"windowAreaXMax",parser:h},{code:49,name:"windowAreaYMin",parser:h},{code:48,name:"windowAreaXMin",parser:h},{code:47,name:"plotOriginY",parser:h},{code:46,name:"plotOriginX",parser:h},{code:45,name:"paperHeight",parser:h},{code:44,name:"paperWidth",parser:h},{code:43,name:"marginTop",parser:h},{code:42,name:"marginRight",parser:h},{code:41,name:"marginBottom",parser:h},{code:40,name:"marginLeft",parser:h},{code:6,name:"plotViewName",parser:h},{code:4,name:"paperSize",parser:h},{code:2,name:"configName",parser:h},{code:1,name:"pageSetupName",parser:h},{code:100,name:"subclassMarker",parser:h},...lr],Pu=[{code:346,name:"orthographicUcsId",parser:h},{code:345,name:"namedUcsId",parser:h},{code:331,name:"viewportId",parser:h},{code:330,name:"paperSpaceTableId",parser:h},{code:76,name:"orthographicType",parser:h},{code:17,name:"ucsYAxis",parser:_},{code:16,name:"ucsXAxis",parser:_},{code:13,name:"ucsOrigin",parser:_},{code:146,name:"elevation",parser:h},{code:15,name:"maxExtent",parser:_},{code:14,name:"minExtent",parser:_},{code:12,name:"insertionPoint",parser:_},{code:11,name:"maxLimit",parser:_},{code:10,name:"minLimit",parser:_},{code:71,name:"tabOrder",parser:h},{code:70,name:"controlFlag",parser:h},{code:1,name:"layoutName",parser:h},{code:100,name:"subclassMarker",parser:h},..._l],Su=[{code:3,name:"entries",parser:(i,t)=>{let e={name:i.value};return(i=t.next()).code===350?e.objectSoftId=i.value:i.code===360?e.objectHardId=i.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:h},{code:280,name:"isHardOwned",parser:O},{code:100,name:"subclassMarker",parser:h},...lr],Eu=[{code:40,name:"wcsToOCSTransform",parser:_a},{code:40,name:"ocsToWCSTransform",parser:_a},{code:41,name:"backClippingDistance",parser:h},{code:73,name:"isBackClipping",parser:O,pushContext:!0},{code:40,name:"frontClippingDistance",parser:h},{code:72,name:"isFrontClipping",parser:O,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:O},{code:11,name:"position",parser:_},{code:210,name:"normal",parser:_},{code:10,name:"boundaryVertices",parser:_,isMultiple:!0},{code:70,name:"boundaryCount",parser:h},{code:100,name:"subclassMarker",parser:h},{code:100},...lr];function _a(i,t){let e=[];for(let s=0;s<3&&N(i,40);++s){let n=[];for(let r=0;r<4&&N(i,40);++r)n.push(i.value),i=t.next();e.push(n)}return t.rewind(),e}let Au=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:h},{code:90,name:"version",parser:h},{code:1,name:"fileName",parser:h},{code:10,name:"size",parser:_},{code:11,name:"sizeOfOnePixel",parser:_},{code:280,name:"isLoaded",parser:h},{code:281,name:"resolutionUnits",parser:h},{code:100,name:"subclassMarker",parser:h}],Mu={LAYOUT:Pu,PLOTSETTINGS:_l,DICTIONARY:Su,SPATIAL_FILTER:Eu,IMAGEDEF:Au};function Tu(i,t){let e=[];for(;i.code!==0||!["EOF","ENDSEC"].includes(i.value);){let s=i.value,n=Mu[s];if(i.code===0&&(n!=null&&n.length)){let r=S(n),a={name:s};r(i=t.next(),t,a)?(e.push(a),i=t.peek()):i=t.next()}else i=t.next()}return{byName:Gc(e,({name:s})=>s)}}function Ls(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class vu{constructor(){Ls(this,"encoding","utf-8"),Ls(this,"encodingFailureFatal",!1),Ls(this,"thumbnailImageFormat","base64")}}class ku extends EventTarget{parseSync(t,e=!1){let s=new ma(t.split(/\r\n|\r|\n/g),e);if(!s.hasNext())throw Error("Empty file");return this.parseAll(s)}parseStream(t){let e="",s=this;return new Promise((n,r)=>{t.on("data",a=>{e+=a}),t.on("end",()=>{try{let a=e.split(/\r\n|\r|\n/g),o=new ma(a);if(!o.hasNext())throw Error("Empty file");n(s.parseAll(o))}catch(a){r(a)}}),t.on("error",a=>{r(a)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let n=s.body.getReader(),r="";for(;;){let{done:a,value:o}=await n.read();if(a){r+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}r+=this._decoder.decode(o,{stream:!0})}return this.parseSync(r)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!N(s,0,"EOF");)N(s,0,"SECTION")&&(N(s=t.next(),2,"HEADER")?e.header=nu(s=t.next(),t):N(s,2,"CLASSES")?Tc(s=t.next(),t,e):N(s,2,"BLOCKS")?e.blocks=bu(s=t.next(),t):N(s,2,"ENTITIES")?e.entities=yl(s=t.next(),t):N(s,2,"TABLES")?e.tables=fu(s=t.next(),t):N(s,2,"OBJECTS")?e.objects=Tu(s=t.next(),t):N(s,2,"THUMBNAILIMAGE")&&(e.thumbnailImage=function(n,r,a="base64"){let o,l="",c=0;for(;!N(n,0,"EOF")&&!N(n,0,"ENDSEC");)n.code===90?c=n.value:n.code===310&&(l+=n.value),n=r.next();if(a==="hex")o=l;else{let u=function(d){let g=d.length/2,p=new Uint8Array(g);for(let m=0;m<g;m++)p[m]=parseInt(d.substr(2*m,2),16);return p}(l);o=a==="buffer"?u:function(d){let g="";for(let p=0;p<d.length;p++)g+=String.fromCharCode(d[p]);return btoa(g)}(u)}return{size:c,data:o}}(s=t.next(),t,this._options.thumbnailImageFormat))),s=t.next();return e}constructor(t={}){super(),Ls(this,"_decoder",void 0),Ls(this,"_options",void 0);let e=new vu;this._options=Object.assign(e,t),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(It={})[It.NOT_APPLICABLE=0]="NOT_APPLICABLE",It[It.KEEP_EXISTING=1]="KEEP_EXISTING",It[It.USE_CLONE=2]="USE_CLONE",It[It.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",It[It.VALUE_NAME=4]="VALUE_NAME",It[It.UNMANGLE_NAME=5]="UNMANGLE_NAME";(Fe={})[Fe.NOUNIT=0]="NOUNIT",Fe[Fe.CENTIMETERS=2]="CENTIMETERS",Fe[Fe.INCH=5]="INCH";(xs={})[xs.PSLTSCALE=1]="PSLTSCALE",xs[xs.LIMCHECK=2]="LIMCHECK";(Re={})[Re.INCHES=0]="INCHES",Re[Re.MILLIMETERS=1]="MILLIMETERS",Re[Re.PIXELS=2]="PIXELS";(Pt={})[Pt.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Pt[Pt.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Pt[Pt.DRAWING_LIMITS=2]="DRAWING_LIMITS",Pt[Pt.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Pt[Pt.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Pt[Pt.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(se={})[se.AS_DISPLAYED=0]="AS_DISPLAYED",se[se.WIREFRAME=1]="WIREFRAME",se[se.HIDDEN=2]="HIDDEN",se[se.RENDERED=3]="RENDERED";(St={})[St.DRAFT=0]="DRAFT",St[St.PREVIEW=1]="PREVIEW",St[St.NORMAL=2]="NORMAL",St[St.PRESENTATION=3]="PRESENTATION",St[St.MAXIMUM=4]="MAXIMUM",St[St.CUSTOM=5]="CUSTOM";(ie={})[ie.NONE=0]="NONE",ie[ie.AbsoluteRotation=1]="AbsoluteRotation",ie[ie.TextEmbedded=2]="TextEmbedded",ie[ie.ShapeEmbedded=4]="ShapeEmbedded";(yn={})[yn.PaperSpace=1]="PaperSpace";(ze={})[ze.XrefDependent=16]="XrefDependent",ze[ze.XrefResolved=32]="XrefResolved",ze[ze.Referenced=64]="Referenced";(Et={})[Et.Off=0]="Off",Et[Et.Perspective=1]="Perspective",Et[Et.ClipFront=2]="ClipFront",Et[Et.ClipBack=4]="ClipBack",Et[Et.UcsFollow=8]="UcsFollow",Et[Et.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class Lu{parse(t){const e=new ku,s=this.getDxfInfoFromBuffer(t);let n="";return s.version&&s.version.value<=23&&s.encoding?n=new TextDecoder(s.encoding).decode(t):n=new TextDecoder().decode(t),e.parseSync(n)}getDxfInfoFromBuffer(t){var c,u,d;const s=new TextDecoder("utf-8");let n=0,r="",a=null,o=null,l=!1;for(;n<t.byteLength;){const g=Math.min(n+65536,t.byteLength),p=t.slice(n,g);n=g;const y=(r+s.decode(p,{stream:!0})).split(/\r?\n/);r=y.pop()??"";for(let x=0;x<y.length;x++){const f=y[x].trim();if(f==="SECTION"&&((c=y[x+2])==null?void 0:c.trim())==="HEADER")l=!0;else if(f==="ENDSEC"&&l)return{version:a,encoding:o};if(l&&f==="$ACADVER"){const P=(u=y[x+2])==null?void 0:u.trim();P&&(a=new vt(P))}else if(l&&f==="$DWGCODEPAGE"){const P=(d=y[x+2])==null?void 0:d.trim();if(P){const I=jn[P];o=Ca(I)}}if(a&&o)return{version:a,encoding:o}}}return{version:a,encoding:o}}}class wa{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="ATTDEF"?this.convertAttributeDefinition(t):t.type=="ATTRIB"?this.convertAttribute(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new vi;return t.vertices.forEach((s,n)=>e.setVertexAt(n,s)),e}convertArc(t){const e=t.extrusionDirection??b.Z_AXIS;return new Si(Mn(t.center,e),t.radius,v.degToRad(t.startAngle),v.degToRad(t.endAngle),e)}convertAttributeCommon(t,e){e.textString=t.text,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=t.rotation,e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.tag=t.tag,e.fieldLength=0,e.isInvisible=(t.attributeFlag&Q.Invisible)!==0,e.isConst=(t.attributeFlag&Q.Const)!==0,e.isVerifiable=(t.attributeFlag&Q.Verifiable)!==0,e.isPreset=(t.attributeFlag&Q.Preset)!==0,e.isReallyLocked=!!t.isReallyLocked,e.isMTextAttribute=(t.mtextFlag&zt.MultiLine)!==0,e.isConstMTextAttribute=(t.mtextFlag&zt.ConstMultiLine)!==0}convertAttribute(t){const e=new Ai;return this.convertAttributeCommon(t,e),e.styleName=t.textStyle,e.horizontalMode=t.horizontalJustification,e.verticalMode=t.verticalJustification,e.widthFactor=t.scale??1,e.lockPositionInBlock=t.lockPositionFlag,e}convertAttributeDefinition(t){const e=new Ei;return this.convertAttributeCommon(t,e),e.styleName=t.styleName,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e.prompt=t.prompt,e}convertCirle(t){const e=t.extrusionDirection??b.Z_AXIS;return new Mi(Mn(t.center,e),t.radius,e)}convertEllipse(t){const e=new b(t.majorAxisEndPoint),s=e.length();return new Ti(t.center,t.extrusionDirection??b.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new zs(new w(e.x,e.y,e.z||0),new w(s.x,s.y,s.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new Ds(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0)return new Ds(t.fitPoints,"Uniform",t.degree,!!(t.flag&1))}catch{}return null}convertPoint(t){const e=new Ci;return e.position=t.position,e}convertSolid(t){const e=new Oi;return t.points.forEach((s,n)=>e.setPointAt(n,s)),e.thickness=t.thickness,e}convertPolyline(t){var u;const e=!!(t.flag&1),s=!!(t.flag&8),n=!!(t.flag&16),r=!!(t.flag&64),a=!!(t.flag&32),o=[],l=[],c=[];if((u=t.vertices)==null||u.map(d=>{d.flag&Kd.SPLINE_CONTROL_POINT||(r&&d.flag&128?d.flag&64?(o.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)):d.faces&&d.faces.length>=3&&c.push([...d.faces]):(o.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)))}),n){const d=t.meshMVertexCount,g=t.meshNVertexCount;return new Vi(d,g,o,e,a)}else{if(r)return new Di(o,c);if(s){let d=Ts.SimplePoly;return t.flag&4&&(t.smoothType==di.CUBIC?d=Ts.CubicSplinePoly:t.smoothType==di.QUADRATIC&&(d=Ts.QuadSplinePoly)),new Pi(d,o,e)}else{let d=$e.SimplePoly;return t.flag&2?d=$e.FitCurvePoly:t.flag&4&&(t.smoothType==di.CUBIC?d=$e.CubicSplinePoly:t.smoothType==di.QUADRATIC&&(d=$e.QuadSplinePoly)),new Ii(d,o,0,e,t.startWidth,t.endWidth,l)}}}convertLWPolyline(t){var n;const e=new Ni;e.closed=!!(t.flag&1);const s=t.constantWidth??-1;return(n=t.vertices)==null||n.forEach((r,a)=>{e.addVertexAt(a,new k(r.x,r.y),r.bulge,r.startWidth??s,r.endWidth??s)}),e}convertHatch(t){var n;const e=new Rs;return(n=t.definitionLines)==null||n.forEach(r=>{e.definitionLines.push({angle:v.degToRad(r.angle||0),base:r.base,offset:r.offset,dashLengths:r.numberOfDashLengths>0?r.dashLengths:[]})}),e.isSolidFill=t.solidFill==fc.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:v.degToRad(t.patternAngle),e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(r=>{if(r.boundaryPathTypeFlag&2){const o=r,l=new Tt;l.closed=o.isClosed,o.vertices.forEach((c,u)=>{l.addVertexAt(u,{x:c.x,y:c.y,bulge:c.bulge})}),e.add(l)}else{const o=r,l=[];o.edges.forEach(u=>{if(u.type==1){const d=u;l.push(new Vt(d.start,d.end))}else if(u.type==2){const d=u;l.push(new ye(d.center,d.radius,v.degToRad(d.startAngle||0),v.degToRad(d.endAngle||0),!d.isCCW))}else if(u.type==3){const d=u;new X().subVectors(d.end,d.center);const p=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),m=p*d.lengthOfMinorAxis;let y=v.degToRad(d.startAngle||0),x=v.degToRad(d.endAngle||0);const f=Math.atan2(d.end.y,d.end.x);d.isCCW||(y=Math.PI*2-y,x=Math.PI*2-x),l.push(new Bs({...d.center,z:0},p,m,y,x,!d.isCCW,f))}else if(u.type==4){const d=u;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const g=d.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let p=!0;const m=d.controlPoints.map(y=>(y.weight==null&&(p=!1),y.weight||1));l.push(new Dt(g,d.knots,p?m:void 0))}else if(d.numberOfFitData>0){const g=d.fitDatum.map(p=>({x:p.x,y:p.y,z:0}));l.push(new Dt(g,"Uniform"))}}});const c=Fs.buildFromEdges(l);c.length==0&&l.length>0?e.add(new Fs(l)):c.forEach(u=>e.add(u))}}),e}convertTable(t){const e=new Li(t.name,t.rowCount,t.columnCount);return e.tableDataVersion=t.version,e.tableStyleId=t.tableStyleId,e.owningBlockRecordId=t.blockRecordHandle,t.directionVector&&(e.horizontalDirection=new b(t.directionVector)),e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),e.tableValueFlag=t.tableValue,e.tableOverrideFlag=t.overrideFlag,e.borderColorOverrideFlag=t.borderColorOverrideFlag,e.borderLineweightOverrideFlag=t.borderLineWeightOverrideFlag,e.borderVisibilityOverrideFlag=t.borderVisibilityOverrideFlag,t.columnWidthArr.forEach((s,n)=>e.setColumnWidth(n,s)),t.rowHeightArr.forEach((s,n)=>e.setRowHeight(n,s)),t.cells.forEach((s,n)=>{e.setCell(n,s)}),e}convertText(t){const e=new es;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=v.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Vs;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=v.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new b(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new ki;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"){const e=t,s=new Ws(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(s.dimBlockPosition={...e.insertionPoint,z:0}),s.rotation=v.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new Xi(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(s.dimBlockPosition={...e.insertionPoint,z:0}),s.rotation=v.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new Wi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new Hi(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new Ui(e.definitionPoint,e.subDefinitionPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new Gi(e.definitionPoint,e.subDefinitionPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new k(s))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new js;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(s=>{e.clipBoundary.push(new k(s))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new Ri;return this.processWipeout(t,e),e}convertViewport(t){const e=new Fi;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Bi;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new zi;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new Ge(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?v.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle.toString()),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=!t.isVisible),t.transparency!=null&&(e.transparency=Ki.deserialize(t.transparency))}}class Ou{convertLayout(t,e){var r,a;const s=new qs;s.layoutName=t.layoutName,s.tabOrder=t.tabOrder,s.plotSettingsName=t.pageSetupName,s.plotCfgName=t.configName,s.canonicalMediaName=t.paperSize,s.plotViewName=t.plotViewName,s.currentStyleSheet=t.currentStyleSheet,s.plotPaperMargins={left:t.marginLeft,right:t.marginRight,top:t.marginTop,bottom:t.marginBottom},s.plotPaperSize.copy({x:t.paperWidth,y:t.paperHeight}),s.plotOrigin.copy({x:t.plotOriginX,y:t.plotOriginY}),s.plotWindowArea.min.copy({x:t.windowAreaXMin,y:t.windowAreaYMin}),s.plotWindowArea.max.copy({x:t.windowAreaXMax,y:t.windowAreaYMax}),s.customPrintScale={numerator:t.printScaleNumerator,denominator:t.printScaleDenominator},s.plotPaperUnits=t.plotPaperUnit,s.plotRotation=t.plotRotation,s.plotType=t.plotType,s.stdScaleType=t.standardScaleType,s.shadePlot=(()=>{switch(t.shadePlotMode){case 1:return qe.kWireframe;case 2:return qe.kHidden;case 3:return qe.kRendered;default:return qe.kAsDisplayed}})(),s.shadePlotResLevel=(()=>{switch(t.shadePlotResolution){case 1:return pe.kPreview;case 2:return pe.kNormal;case 3:return pe.kPresentation;case 4:return pe.kMaximum;case 5:return pe.kCustom;default:return pe.kDraft}})(),t.shadePlotCustomDPI!=null&&(s.shadePlotCustomDPI=t.shadePlotCustomDPI),t.shadePlotId&&(s.shadePlotId=t.shadePlotId);const n=t.layoutFlag??0;if(s.plotViewportBorders=(n&1)!==0,s.showPlotStyles=(n&2)!==0,s.plotCentered=(n&4)!==0,s.plotHidden=(n&8)!==0,s.useStandardScale=(n&16)!==0,s.plotPlotStyles=(n&32)!==0,s.scaleLineweights=(n&64)!==0,s.printLineweights=(n&128)!==0,s.drawViewportsFirst=(n&512)!==0,s.modelType=(n&1024)!==0,t.viewportId&&s.viewportArray.push(t.viewportId),t.layoutName==="Model"){const o=K.MODEL_SPACE_NAME.toUpperCase();(r=e.tables.BLOCK_RECORD)==null||r.entries.some(l=>l.name.toUpperCase()===o?(s.blockTableRecordId=l.handle,!0):!1)}else(a=e.tables.BLOCK_RECORD)==null||a.entries.some(o=>o.layoutObjects===t.handle?(s.blockTableRecordId=o.handle,!0):!1),s.blockTableRecordId||(s.blockTableRecordId=t.paperSpaceTableId);return t.minLimit&&s.limits.min.copy(t.minLimit),t.maxLimit&&s.limits.max.copy(t.maxLimit),t.minExtent&&s.extents.min.copy(t.minExtent),t.maxExtent&&s.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,s),s}convertImageDef(t){const e=new Vo;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,t.ownerObjectId!=null&&(e.ownerId=t.ownerObjectId)}}class wl{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 s=Date.now(),n=this.generateTaskId();try{return await this.executeInWorker(n,t,e||this.config.workerUrl)}catch(r){const a=Date.now()-s;return{success:!1,error:r instanceof Error?r.message:String(r),duration:a}}}async executeInWorker(t,e,s){const n=Date.now();return new Promise((r,a)=>{const o=this.getAvailableWorker(s),l=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(o),a(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:d=>{clearTimeout(l),this.releaseWorker(o),r(d)},reject:d=>{clearTimeout(l),this.releaseWorker(o),a(d)},timeout:l});const c=d=>{const{id:g,success:p,data:m,error:y}=d.data;if(g!==t)return;this.cleanupTask(t);const x=Date.now()-n;r(p?{success:!0,data:m,duration:x}:{success:!1,error:y,duration:x})},u=d=>{this.cleanupTask(t),a(new Error(`Worker error: ${d.message}`))};o.addEventListener("message",c),o.addEventListener("error",u),o.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[s,n]of this.workers)if(!n.isBusy)return n.isBusy=!0,n.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(t,{type:"module"}),n=this.generateWorkerId(),r={worker:s,isBusy:!0,id:n,createdAt:new Date};return this.workers.set(n,r),s}const e=Array.from(this.workers.values()).sort((s,n)=>s.createdAt.getTime()-n.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,s]of this.workers)if(s.worker===t){s.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 xl{constructor(t){this.framework=new wl(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function fl(i){return new xl(i)}class Nu{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:s}=t.data;try{const n=await this.executeTask(s);this.sendResponse(e,!0,n)}catch(n){this.sendResponse(e,!1,void 0,n instanceof Error?n.message:String(n))}}}sendResponse(t,e,s,n){const r={id:t,success:e,data:s,error:n};self.postMessage(r)}}class bl extends ar{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t,e){const s=this.config,n=this.getParserWorkerTimeout(t,e);if(s.useWorker&&s.parserWorkerUrl){const r=fl({workerUrl:s.parserWorkerUrl,timeout:n,maxConcurrentWorkers:1}),a=await r.execute(t);if(r.destroy(),a.success)return{model:a.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${a.error}'`)}else return{model:new Lu().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var r;const e=new Map,s=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(r=t.tables.STYLE)==null||r.entries.forEach(a=>{const o=[];if(a.font){const l=s(a.font);l&&o.push(l)}if(a.bigFont){const l=s(a.bigFont);l&&o.push(l)}if(a.extendedFont){const l=s(a.extendedFont);l&&o.push(l)}e.set(a.name,o)});const n=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,n),Array.from(n)}getFontsInBlock(t,e,s,n){const r=/\\f(.*?)\|/g;t.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.matchAll(r)].forEach(u=>{n.add(u[1].toLowerCase())});const c=s.get(o.styleName);c==null||c.forEach(u=>n.add(u))}else if(a.type=="TEXT"){const o=a,l=s.get(o.styleName);l==null||l.forEach(c=>n.add(c))}else if(a.type=="INSERT"){const l=e[a.name];l&&l.entities&&this.getFontsInBlock(l.entities,e,s,n)}})}async processEntities(t,e,s,n,r){const a=new wa;let o=t.entities;const l=o.length,c=new Vn(l,100-n.value,s);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const u=new Map;for(let g=0;g<l;g++){const p=o[g];if(p.type==="ATTRIB"){const m=a.convert(p);if(m&&m.ownerId&&m.ownerId!=="0"){let y=u.get(m==null?void 0:m.ownerId);y==null&&(y=[],u.set(m.ownerId,y)),y.push(m)}}}const d=e.tables.blockTable.modelSpace;await c.processChunk(async(g,p)=>{let m=[],y=g<p?o[g].type:"";for(let f=g;f<p;f++){const P=o[f];if(!(P.ownerBlockRecordSoftId&&P.ownerBlockRecordSoftId!==d.objectId)&&P.type!=="ATTRIB"){const I=a.convert(P);if(I){if(this.config.convertByEntityType&&P.type!==y&&(d.appendEntity(m),m=[],y=P.type),P.type==="INSERT"){const T=u.get(I.objectId);T&&T.length>0&&T.forEach(A=>{I.appendAttributes(A)})}m.push(I)}}}d.appendEntity(m);let x=n.value+p/l*(100-n.value);x>100&&(x=100),r&&await r(x,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(t,e,s=!1){const n=new wa,r=t.length,a=[],o=e.objectId,l=[];for(let c=0;c<r;c++){const u=t[c],d=n.convert(u);d&&(u.type==="ATTRIB"?l.push(d):(!s||u.ownerBlockRecordSoftId===o)&&a.push(d))}l.forEach(c=>{const u=e.getIdAt(c.ownerId);u&&u.appendAttributes(c)}),e.appendEntity(a)}processBlocks(t,e){const s=t.blocks;for(const[n,r]of Object.entries(s)){let a=e.tables.blockTable.getAt(r.name);a||(a=new K,a.objectId=r.handle,a.name=n,a.origin.copy(r.position),e.tables.blockTable.add(a)),r.entities?this.processEntitiesInBlock(r.entities,a):a.isPaperSapce&&this.processEntitiesInBlock(t.entities,a,!0)}}processHeader(t,e){const s=t.header;s.$ACADVER&&(e.version=s.$ACADVER),e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,s.$AUNITS!=null&&(e.aunits=s.$AUNITS),e.celtype=s.$CELTYPE||At,e.celtscale=s.$CELTSCALE||1,e.ltscale=s.$LTSCALE||1,s.$EXTMAX&&(e.extmax=s.$EXTMAX),s.$EXTMIN&&(e.extmin=s.$EXTMIN),s.$INSUNITS!=null&&(e.insunits=s.$INSUNITS),e.osmode=s.$OSMODE||0,e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0,e.textstyle=s.$TEXTSTYLE||J}processBlockTables(t,e){var n;const s=(n=t.tables.BLOCK_RECORD)==null?void 0:n.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(r=>{const a=new K;a.objectId=r.handle,a.name=r.name,a.layoutId=r.layoutObjects,a.blockInsertUnits=r.insertionUnits,a.explodability=r.explodability,a.blockScaling=r.scalability,r.bmpPreview&&(a.bmpPreview=r.bmpPreview),e.tables.blockTable.add(a)}))}processObjects(t,e){const s=t.objects.byName,n=new Ou;if("LAYOUT"in s){const r=e.objects.layout;s.LAYOUT.forEach(a=>{const o=n.convertLayout(a,t);r.setAt(o.layoutName,o)})}if("IMAGEDEF"in s){const r=e.objects.imageDefinition;s.IMAGEDEF.forEach(a=>{const o=n.convertImageDef(a);r.setAt(o.objectId,o)})}}processViewports(t,e){var n;const s=(n=t.tables)==null?void 0:n.VPORT;if(s){this.processCommonTableAttrs(s,e.tables.viewportTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new rr;this.processCommonTableEntryAttrs(a,o),a.circleSides&&(o.circleSides=a.circleSides),o.standardFlag=a.standardFlag,o.center.copy(a.center),o.lowerLeftCorner.copy(a.lowerLeftCorner),o.upperRightCorner.copy(a.upperRightCorner),a.snapBasePoint&&o.snapBase.copy(a.snapBasePoint),a.snapRotationAngle&&(o.snapAngle=a.snapRotationAngle),a.snapSpacing&&o.snapIncrements.copy(a.snapSpacing),a.majorGridLines&&(o.gridMajor=a.majorGridLines),a.gridSpacing&&o.gridIncrements.copy(a.gridSpacing),a.backgroundObjectId&&(o.backgroundObjectId=a.backgroundObjectId),o.gsView.center.copy(a.center),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget),o.gsView.viewTarget.copy(a.viewTarget),a.lensLength&&(o.gsView.lensLength=a.lensLength),a.frontClippingPlane&&(o.gsView.frontClippingPlane=a.frontClippingPlane),a.backClippingPlane&&(o.gsView.backClippingPlane=a.backClippingPlane),a.viewHeight&&(o.gsView.viewHeight=a.viewHeight),a.viewTwistAngle&&(o.gsView.viewTwistAngle=a.viewTwistAngle),a.frozenLayers&&(o.gsView.frozenLayers=a.frozenLayers),a.styleSheet&&(o.gsView.styleSheet=a.styleSheet),a.renderMode&&(o.gsView.renderMode=a.renderMode),a.viewMode&&(o.gsView.viewMode=a.viewMode),a.ucsIconSetting&&(o.gsView.ucsIconSetting=a.ucsIconSetting),a.ucsOrigin&&o.gsView.ucsOrigin.copy(a.ucsOrigin),a.ucsXAxis&&o.gsView.ucsXAxis.copy(a.ucsXAxis),a.ucsYAxis&&o.gsView.ucsYAxis.copy(a.ucsYAxis),a.orthographicType&&(o.gsView.orthographicType=a.orthographicType),a.shadePlotSetting&&(o.gsView.shadePlotSetting=a.shadePlotSetting),a.shadePlotObjectId&&(o.gsView.shadePlotObjectId=a.shadePlotObjectId),a.visualStyleObjectId&&(o.gsView.visualStyleObjectId=a.visualStyleObjectId),a.isDefaultLightingOn&&(o.gsView.isDefaultLightingOn=a.isDefaultLightingOn),a.defaultLightingType&&(o.gsView.defaultLightingType=a.defaultLightingType),a.brightness&&(o.gsView.brightness=a.brightness),a.contrast&&(o.gsView.contrast=a.contrast),a.ambientColor&&(o.gsView.ambientColor=a.ambientColor),e.tables.viewportTable.add(o)})}}processLayers(t,e){var n;const s=(n=t.tables)==null?void 0:n.LAYER;if(s){this.processCommonTableAttrs(s,e.tables.layerTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new tt;o.colorIndex=a.colorIndex;const l=new Ji({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,l),e.tables.layerTable.add(l)})}}processLineTypes(t,e){var n;const s=(n=t.tables)==null?void 0:n.LTYPE;if(s){this.processCommonTableAttrs(s,e.tables.linetypeTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new me(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,e.tables.linetypeTable.add(o)})}}processTextStyles(t,e){var n;const s=(n=t.tables)==null?void 0:n.STYLE;if(s){this.processCommonTableAttrs(s,e.tables.textStyleTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new tn(a);this.processCommonTableEntryAttrs(a,o),e.tables.textStyleTable.add(o)})}}processDimStyles(t,e){var n;const s=(n=t.tables)==null?void 0:n.DIMSTYLE;if(s){this.processCommonTableAttrs(s,e.tables.dimStyleTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o={name:a.name,ownerId:a.ownerObjectId,dimpost:a.DIMPOST||"",dimapost:a.DIMAPOST||"",dimscale:a.DIMSCALE,dimasz:a.DIMASZ,dimexo:a.DIMEXO,dimdli:a.DIMDLI,dimexe:a.DIMEXE,dimrnd:a.DIMRND,dimdle:a.DIMDLE,dimtp:a.DIMTP,dimtm:a.DIMTM,dimtxt:a.DIMTXT,dimcen:a.DIMCEN,dimtsz:a.DIMTSZ,dimaltf:a.DIMALTF,dimlfac:a.DIMLFAC,dimtvp:a.DIMTVP,dimtfac:a.DIMTFAC,dimgap:a.DIMGAP,dimaltrnd:a.DIMALTRND,dimtol:a.DIMTOL==null||a.DIMTOL==0?0:1,dimlim:a.DIMLIM==null||a.DIMLIM==0?0:1,dimtih:a.DIMTIH==null||a.DIMTIH==0?0:1,dimtoh:a.DIMTOH==null||a.DIMTOH==0?0:1,dimse1:a.DIMSE1==null||a.DIMSE1==0?0:1,dimse2:a.DIMSE2==null||a.DIMSE2==0?0:1,dimtad:a.DIMTAD,dimzin:a.DIMZIN,dimazin:a.DIMAZIN,dimalt:a.DIMALT,dimaltd:a.DIMALTD,dimtofl:a.DIMTOFL,dimsah:a.DIMSAH,dimtix:a.DIMTIX,dimsoxd:a.DIMSOXD,dimclrd:a.DIMCLRD,dimclre:a.DIMCLRE,dimclrt:a.DIMCLRT,dimadec:a.DIMADEC||0,dimunit:a.DIMUNIT||2,dimdec:a.DIMDEC,dimtdec:a.DIMTDEC,dimaltu:a.DIMALTU,dimalttd:a.DIMALTTD,dimaunit:a.DIMAUNIT,dimfrac:a.DIMFRAC,dimlunit:a.DIMLUNIT,dimdsep:a.DIMDSEP?a.DIMDSEP.toString():".",dimtmove:a.DIMTMOVE||0,dimjust:a.DIMJUST,dimsd1:a.DIMSD1,dimsd2:a.DIMSD2,dimtolj:a.DIMTOLJ,dimtzin:a.DIMTZIN,dimaltz:a.DIMALTZ,dimalttz:a.DIMALTTZ,dimfit:a.DIMFIT||0,dimupt:a.DIMUPT,dimatfit:a.DIMATFIT,dimtxsty:a.DIMTXSTY||J,dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},l=new He(o);this.processCommonTableEntryAttrs(a,l),e.tables.dimStyleTable.add(l)})}}processCommonTableAttrs(t,e){t.handle!=null&&(e.objectId=t.handle),t.ownerObjectId!=null&&(e.ownerId=t.ownerObjectId)}processCommonTableEntryAttrs(t,e){e.name="name"in t?t.name:"",t.handle!=null&&(e.objectId=t.handle),t.ownerObjectId!=null&&(e.ownerId=t.ownerObjectId)}groupAndFlattenByType(t){const e={},s=[];for(const n of t)e[n.type]||(e[n.type]=[],s.push(n.type)),e[n.type].push(n);return s.flatMap(n=>e[n])}}class Il extends ar{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,s,n,r){let a=t.tables.blockTable.modelSpace.newIterator().toArray();const o=a.length,l=new Vn(o,100-n.value,s);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const c=e.tables.blockTable.modelSpace;await l.processChunk(async(u,d)=>{let g=[],p=u<d?a[u].type:"";for(let m=u;m<d;m++){const y=a[m];this.config.convertByEntityType&&y.type!==p&&(this.triggerEvents(c,g),g=[],p=y.type),g.push(y)}if(this.triggerEvents(c,g),r){let m=n.value+d/o*(100-n.value);m>100&&(m=100),await r(m,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const s=e.newIterator().toArray();this.triggerEvents(e,s)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const s of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const s of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.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={},s=[];for(const n of t)e[n.type]||(e[n.type]=[],s.push(n.type)),e[n.type].push(n);return s.flatMap(n=>e[n])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}exports.ACAD_APPID=In;exports.AC_DB_SYSTEM_VARIABLE_NAMES=uc;exports.AcCmColor=tt;exports.AcCmColorMethod=E;exports.AcCmColorUtil=ue;exports.AcCmEntityColor=Sl;exports.AcCmErrors=yt;exports.AcCmEventDispatcher=El;exports.AcCmEventManager=Z;exports.AcCmLoader=Nl;exports.AcCmLoadingManager=Ta;exports.AcCmObject=Sa;exports.AcCmPerformanceCollector=Fn;exports.AcCmTask=Aa;exports.AcCmTaskScheduler=Ma;exports.AcCmTransparency=Ki;exports.AcCmTransparencyMethod=ut;exports.AcDb2dPolyline=Ii;exports.AcDb2dVertex=kn;exports.AcDb2dVertexType=fo;exports.AcDb3PointAngularDimension=Wi;exports.AcDb3dPolyline=Pi;exports.AcDb3dVertex=Ln;exports.AcDb3dVertexType=bo;exports.AcDbAbstractViewTableRecord=nr;exports.AcDbAlignedDimension=Ws;exports.AcDbAngleUnits=Dn;exports.AcDbArc=Si;exports.AcDbArcDimension=Nn;exports.AcDbAttribute=Ai;exports.AcDbAttributeDefinition=Ei;exports.AcDbAttributeFlags=Q;exports.AcDbAttributeMTextFlag=zt;exports.AcDbBaseWorker=Nu;exports.AcDbBatchProcessing=Vn;exports.AcDbBlockReference=Ge;exports.AcDbBlockScaling=Ro;exports.AcDbBlockTable=Go;exports.AcDbBlockTableRecord=K;exports.AcDbCircle=Mi;exports.AcDbCodePage=jn;exports.AcDbCurve=rt;exports.AcDbDataGenerator=jo;exports.AcDbDatabase=pc;exports.AcDbDatabaseConverter=ar;exports.AcDbDatabaseConverterManager=Rt;exports.AcDbDiametricDimension=Gi;exports.AcDbDictionary=ks;exports.AcDbDimArrowType=Wo;exports.AcDbDimStyleTable=Ho;exports.AcDbDimStyleTableRecord=He;exports.AcDbDimTextHorizontal=Uo;exports.AcDbDimTextVertical=Xo;exports.AcDbDimVerticalJustification=qo;exports.AcDbDimZeroSuppression=Yo;exports.AcDbDimZeroSuppressionAngular=$o;exports.AcDbDimension=oe;exports.AcDbDuplicateRecordCloning=Do;exports.AcDbDwgVersion=vt;exports.AcDbDxfCode=Bn;exports.AcDbDxfConverter=bl;exports.AcDbDxfFiler=xa;exports.AcDbEllipse=Ti;exports.AcDbEntity=gt;exports.AcDbFace=vi;exports.AcDbFileType=Es;exports.AcDbHatch=Rs;exports.AcDbHatchPatternType=vs;exports.AcDbHatchStyle=So;exports.AcDbHostApplicationServices=bi;exports.AcDbLayerTable=Zo;exports.AcDbLayerTableRecord=Ji;exports.AcDbLayout=qs;exports.AcDbLayoutDictionary=Fo;exports.AcDbLayoutManager=zo;exports.AcDbLeader=ki;exports.AcDbLeaderAnnotationType=Eo;exports.AcDbLine=zs;exports.AcDbLineSpacingStyle=ji;exports.AcDbLinetypeTable=Ko;exports.AcDbLinetypeTableRecord=me;exports.AcDbMText=Vs;exports.AcDbObject=he;exports.AcDbObjectIterator=Zs;exports.AcDbOpenMode=Na;exports.AcDbOrdinateDimension=Hi;exports.AcDbOsnapMode=z;exports.AcDbPlotPaperUnits=Lo;exports.AcDbPlotRotation=Oo;exports.AcDbPlotSettings=Bo;exports.AcDbPlotShadePlotResLevel=pe;exports.AcDbPlotShadePlotType=qe;exports.AcDbPlotStdScaleType=Co;exports.AcDbPlotType=No;exports.AcDbPoint=Ci;exports.AcDbPoly2dType=$e;exports.AcDbPoly3dType=Ts;exports.AcDbPolyFaceMesh=Di;exports.AcDbPolyFaceMeshFace=ko;exports.AcDbPolyFaceMeshVertex=vo;exports.AcDbPolygonMesh=Vi;exports.AcDbPolygonMeshVertex=To;exports.AcDbPolyline=Ni;exports.AcDbRadialDimension=Ui;exports.AcDbRasterImage=js;exports.AcDbRasterImageClipBoundaryType=Ao;exports.AcDbRasterImageDef=Vo;exports.AcDbRasterImageImageDisplayOpt=Mo;exports.AcDbRay=Bi;exports.AcDbRegAppTable=eh;exports.AcDbRegAppTableRecord=Cn;exports.AcDbRegenerator=Il;exports.AcDbRenderingCache=ss;exports.AcDbResultBuffer=zn;exports.AcDbRotatedDimension=Xi;exports.AcDbSpline=Ds;exports.AcDbSymbolTable=le;exports.AcDbSymbolTableRecord=xe;exports.AcDbSysVarManager=Gs;exports.AcDbSystemVariables=R;exports.AcDbTable=Li;exports.AcDbText=es;exports.AcDbTextHorizontalMode=Io;exports.AcDbTextStyleTable=Qo;exports.AcDbTextStyleTableRecord=tn;exports.AcDbTextVerticalMode=Po;exports.AcDbTrace=Oi;exports.AcDbUnitsValue=ir;exports.AcDbViewTable=Jo;exports.AcDbViewTableRecord=yc;exports.AcDbViewport=Fi;exports.AcDbViewportTable=th;exports.AcDbViewportTableRecord=rr;exports.AcDbWipeout=Ri;exports.AcDbWorkerApi=xl;exports.AcDbWorkerManager=wl;exports.AcDbXline=zi;exports.AcDbXrecord=hc;exports.AcGeArea2d=ts;exports.AcGeBox2d=pt;exports.AcGeBox3d=C;exports.AcGeCatmullRomCurve3d=Qi;exports.AcGeCircArc2d=ye;exports.AcGeCircArc3d=je;exports.AcGeCurve2d=is;exports.AcGeEllipseArc2d=Bs;exports.AcGeEllipseArc3d=Je;exports.AcGeEuler=jl;exports.AcGeGeometryUtil=co;exports.AcGeLine2d=Vt;exports.AcGeLine3d=_e;exports.AcGeLoop2d=Fs;exports.AcGeMathUtil=v;exports.AcGeMatrix2d=Us;exports.AcGeMatrix3d=G;exports.AcGeNurbsCurve=Bt;exports.AcGePlane=Ys;exports.AcGePoint2d=k;exports.AcGePoint3d=w;exports.AcGePolyline2d=Tt;exports.AcGeQuaternion=Ue;exports.AcGeShape2d=Qn;exports.AcGeSpline3d=Dt;exports.AcGeTol=Xs;exports.AcGeVector2d=X;exports.AcGeVector3d=b;exports.AcGiArrowType=Jn;exports.AcGiDefaultLightingType=sr;exports.AcGiLineWeight=We;exports.AcGiMTextAttachmentPoint=ot;exports.AcGiMTextFlowDirection=ae;exports.AcGiOrthographicType=er;exports.AcGiRenderMode=tr;exports.AcGiViewport=wo;exports.AcTrStringUtil=Ol;exports.ByBlock=Qe;exports.ByLayer=At;exports.DEBUG_MODE=kl;exports.DEFAULT_LINE_TYPE=Ke;exports.DEFAULT_TEXT_STYLE=J;exports.DEFAULT_TOL=$n;exports.DEG2RAD=Wn;exports.DefaultLoadingManager=va;exports.FLOAT_TOL=Ve;exports.MLIGHTCAD_APPID=bn;exports.ORIGIN_POINT_2D=Fl;exports.ORIGIN_POINT_3D=Yn;exports.RAD2DEG=Gn;exports.TAU=W;exports.TEMP_OBJECT_ID_PREFIX=ui;exports.acdbDisableOsnapMode=tc;exports.acdbEnableOsnapMode=Jl;exports.acdbHasOsnapMode=Ql;exports.acdbHostApplicationServices=Rn;exports.acdbMaskToOsnapModes=Zl;exports.acdbOsnapModesToMask=ql;exports.acdbToggleOsnapMode=Kl;exports.basisFunction=Ns;exports.calculateCurveLength=go;exports.ceilPowerOfTwo=qa;exports.clamp=re;exports.clone=bs;exports.computeParameterValues=uo;exports.createWorkerApi=fl;exports.damp=za;exports.deepClone=wn;exports.defaults=Hs;exports.degToRad=Xa;exports.dwgCodePageToEncoding=Ca;exports.euclideanModulo=Hn;exports.evaluateNurbsPoint=Ms;exports.floorPowerOfTwo=Za;exports.generateAveragedKnots=po;exports.generateChordKnots=Gl;exports.generateSqrtChordKnots=Hl;exports.generateUUID=Ba;exports.generateUniformKnots=Wl;exports.getOcsAngle=Tn;exports.getOcsReferenceVector=Kn;exports.has=fa;exports.intPartLength=Xn;exports.interpolateControlPoints=Ul;exports.interpolateNurbsCurve=Zn;exports.inverseLerp=Ra;exports.isBetween=Ka;exports.isBetweenAngle=Qa;exports.isEmpty=ba;exports.isEqual=Ze;exports.isImperialUnits=cc;exports.isMetricUnits=lc;exports.isPointInPolygon=qn;exports.isPolygonIntersect=lo;exports.isPowerOfTwo=$a;exports.lerp=Un;exports.log=Ss;exports.mapLinear=Fa;exports.normalizeAngle=As;exports.pingpong=Va;exports.radToDeg=Ya;exports.randFloat=Ga;exports.randFloatSpread=Ha;exports.randInt=Wa;exports.relativeEps=Ja;exports.seededRandom=Ua;exports.setAcDbHostApplicationServicesProvider=La;exports.setAcDbLayoutManagerFactory=Oa;exports.setLogLevel=Ll;exports.smootherstep=ja;exports.smoothstep=Da;exports.transformOcsPointToWcs=Mn;exports.transformWcsPointToOcs=Cs;
|
|
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 s=this.formatValue(e);return this._lines.push(s===""?"0":s),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 s=this.resolveHandle(e);return s?this.writeString(t,s):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,s=420){if(!t)return this;const n=t.colorIndex;n!=null&&this.writeInt16(e,n);const r=t.RGB;return r!=null&&t.colorIndex==null&&this.writeInt32(s,r),this}writeTransparency(t,e=440){return t?this.writeInt32(e,t.serialize()):this}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 s=t.toFixed(this._precision).replace(/\.?0+$/,"");return s===""||s==="-"?"0":s}return String(t)}sanitizeStringForDxfLine(t){return t.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}function Al(i,t){for(var e=0;e<t.length;e++){const s=t[e];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in i)){const r=Object.getOwnPropertyDescriptor(s,n);r&&Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var E=(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",i))(E||{});const Zr={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},nn=[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];let ue=class{static getColorByIndex(t){return nn[t]}static getIndexByColor(t){const e=nn.length-1;for(let s=1;s<e;++s)if(nn[s]===t)return s}static getColorByName(t){return Zr[t.toLowerCase()]}static getNameByColor(t){for(const[e,s]of Object.entries(Zr))if(s===t)return e}static getNameByIndex(t){const e=this.getColorByIndex(t);return this.getNameByColor(e)}},Q=class ne{constructor(t=E.ByLayer,e){this._colorMethod=t,this._colorMethod==E.ByColor&&e==null?this._value=16777215:this._colorMethod==E.ByACI?e==null?this._value=8:e===0?this._colorMethod=E.ByBlock:e===256?this._colorMethod=E.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}get colorMethod(){return this._colorMethod}set colorMethod(t){this._colorMethod=t}get red(){const t=this.RGB;return t!=null?t>>16&255:void 0}get green(){const t=this.RGB;return t!=null?t>>8&255:void 0}get blue(){const t=this.RGB;return t!=null?t&255:void 0}get RGB(){switch(this._colorMethod){case E.ByColor:case E.ByBlock:case E.ByLayer:return this._value;case E.ByACI:return this._value?ue.getColorByIndex(this._value):this._value;default:return}}setRGB(t,e,s){const n=Math.max(0,Math.min(255,Math.round(t))),r=Math.max(0,Math.min(255,Math.round(e))),a=Math.max(0,Math.min(255,Math.round(s)));return this._value=n<<16|r<<8|a,this._colorMethod=E.ByColor,this}setRGBValue(t){return t==null||!Number.isFinite(t)?this:(this._value=t&16777215,this._colorMethod=E.ByColor,this)}setRGBFromCss(t){if(!t)return this;const e=t.trim().toLowerCase();if(e.startsWith("#")){let r=0,a=0,o=0;if(e.length===7)r=parseInt(e.substr(1,2),16),a=parseInt(e.substr(3,2),16),o=parseInt(e.substr(5,2),16);else if(e.length===4)r=parseInt(e[1]+e[1],16),a=parseInt(e[2]+e[2],16),o=parseInt(e[3]+e[3],16);else return this;return this.setRGB(r,a,o)}const s=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(s){const r=parseInt(s[1],10),a=parseInt(s[2],10),o=parseInt(s[3],10);return this.setRGB(r,a,o)}const n=ue.getColorByName(t);return n!==void 0?this.setRGBValue(n):this}setScalar(t){return this.setRGB(t,t,t)}get hexColor(){const t=this.RGB;return t==null?void 0:"0x"+t.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const t=this.RGB;if(t!=null)return`rgb(${t>>16&255},${t>>8&255},${t&255})`}cssColorAlpha(t){const e=this.RGB;if(e!=null)return`rgba(${e>>16&255},${e>>8&255},${e&255},${t})`}get colorIndex(){return this._colorMethod===E.ByACI?this._value:this._colorMethod===E.ByLayer?256:this._colorMethod===E.ByBlock?0:void 0}set colorIndex(t){if(t==null)return;const e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=E.ByBlock,this._value=void 0):e===256?(this._colorMethod=E.ByLayer,this._value=void 0):(this._colorMethod=E.ByACI,this._value=e)}get isByColor(){return this._colorMethod===E.ByColor}get isByACI(){return this._colorMethod===E.ByACI}get isForeground(){return this._colorMethod===E.ByACI&&this._value===7}setForeground(){return this._colorMethod=E.ByACI,this._value=7,this}get isByLayer(){return this._colorMethod===E.ByLayer}setByLayer(t){return this._colorMethod=E.ByLayer,t==null?this._value=256:this._value=t,this}get isByBlock(){return this._colorMethod===E.ByBlock}setByBlock(t){return this._colorMethod=E.ByBlock,t==null?this._value=0:this._value=t,this}get colorName(){switch(this._colorMethod){case E.ByLayer:return"ByLayer";case E.ByBlock:return"ByBlock";case E.ByColor:return this._value?ue.getNameByColor(this._value):"";case E.ByACI:return this._value?ue.getNameByIndex(this._value):"";default:return}}set colorName(t){if(!t)return;const e=ue.getColorByName(t);e!==void 0&&(this._value=e,this._colorMethod=E.ByColor)}clone(){const t=new ne;return t._colorMethod=this._colorMethod,t._value=this._value,t}copy(t){return this._colorMethod=t._colorMethod,this._value=t._value,this}equals(t){return this._colorMethod===t._colorMethod&&this._value===t._value}toString(){switch(this._colorMethod){case E.ByLayer:return"ByLayer";case E.ByBlock:return"ByBlock";case E.ByACI:return this._value!==void 0?String(this._value):"";case E.ByColor:return this._value?`${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(t){if(!t)return;const e=t.trim();if(/^bylayer$/i.test(e))return new ne(E.ByLayer);if(/^byblock$/i.test(e))return new ne(E.ByBlock);const s=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(s){const r=Number(s[1]),a=Number(s[2]),o=Number(s[3]),l=new ne(E.ByColor);return l.setRGB(r,a,o),l}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){const[r,a,o]=e.split(",").map(Number),l=new ne(E.ByColor);return l.setRGB(r,a,o),l}if(/^\d+$/.test(e)){const r=parseInt(e,10);return new ne(E.ByACI,r)}if(/^book\$/i.test(e)){const r=e.substring(e.indexOf("$")+1),a=ue.getColorByName(r);return a!=null?new ne(E.ByColor,a):void 0}const n=ue.getColorByName(e);if(n!=null)return new ne(E.ByColor,n)}};class Tl{constructor(t=E.ByColor,e=0){this._colorMethod=t,this._value=e}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(t){this._colorMethod=E.ByColor,this._value=this._value&65535|(t&255)<<16}get green(){return this._value>>8&255}set green(t){this._colorMethod=E.ByColor,this._value=this._value&16711935|(t&255)<<8}get blue(){return this._value&255}set blue(t){this._colorMethod=E.ByColor,this._value=this._value&16776960|t&255}setRGB(t,e,s){this._colorMethod=E.ByColor,this._value=(t&255)<<16|(e&255)<<8|s&255}get colorIndex(){return this._value}set colorIndex(t){this._colorMethod=E.ByACI,this._value=t}get layerIndex(){return this._value}set layerIndex(t){this._colorMethod=E.ByLayer,this._value=t}isByColor(){return this._colorMethod===E.ByColor}isByLayer(){return this._colorMethod===E.ByLayer}isByBlock(){return this._colorMethod===E.ByBlock}isByACI(){return this._colorMethod===E.ByACI}isNone(){return this._colorMethod===E.None}get rawValue(){return this._value}set rawValue(t){this._value=t}}const yt={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")}};let Ml=class{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let n=0,r=s.length;n<r;n++)s[n].call(this,t)}}},Z=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const s of this.listeners)s.call(null,t,...e)}};function bs(i){return i===null||typeof i!="object"?i:Array.isArray(i)?[...i]:{...i}}function xn(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(xn);const t={};for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=xn(i[e]));return t}function Hs(i,...t){for(const e of t)if(e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&i[s]===void 0&&(i[s]=e[s]);return i}function Ia(i,t){return i!=null&&Object.prototype.hasOwnProperty.call(i,t)}function Pa(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 Ze(i,t){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(let n=0;n<i.length;n++)if(!Ze(i[n],t[n]))return!1;return!0}const e=Object.keys(i),s=Object.keys(t);if(e.length!==s.length)return!1;for(const n of e)if(!Object.prototype.hasOwnProperty.call(t,n)||!Ze(i[n],t[n]))return!1;return!0}var vl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Sa={exports:{}};(function(i){(function(t,e){i.exports?i.exports=e():t.log=e()})(vl,function(){var t=function(){},e="undefined",s=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],r={},a=null;function o(y,x){var f=y[x];if(typeof f.bind=="function")return f.bind(y);try{return Function.prototype.bind.call(f,y)}catch{return function(){return Function.prototype.apply.apply(f,[y,arguments])}}}function l(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function c(y){return y==="debug"&&(y="log"),typeof console===e?!1:y==="trace"&&s?l:console[y]!==void 0?o(console,y):console.log!==void 0?o(console,"log"):t}function u(){for(var y=this.getLevel(),x=0;x<n.length;x++){var f=n[x];this[f]=x<y?t:this.methodFactory(f,y,this.name)}if(this.log=this.debug,typeof console===e&&y<this.levels.SILENT)return"No console available for logging"}function d(y){return function(){typeof console!==e&&(u.call(this),this[y].apply(this,arguments))}}function g(y,x,f){return c(y)||d.apply(this,arguments)}function p(y,x){var f=this,P,I,M,A="loglevel";typeof y=="string"?A+=":"+y:typeof y=="symbol"&&(A=void 0);function j(F){var U=(n[F]||"silent").toUpperCase();if(!(typeof window===e||!A)){try{window.localStorage[A]=U;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+U+";"}catch{}}}function T(){var F;if(!(typeof window===e||!A)){try{F=window.localStorage[A]}catch{}if(typeof F===e)try{var U=window.document.cookie,fe=encodeURIComponent(A),be=U.indexOf(fe+"=");be!==-1&&(F=/^([^;]+)/.exec(U.slice(be+fe.length+1))[1])}catch{}return f.levels[F]===void 0&&(F=void 0),F}}function X(){if(!(typeof window===e||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function B(F){var U=F;if(typeof U=="string"&&f.levels[U.toUpperCase()]!==void 0&&(U=f.levels[U.toUpperCase()]),typeof U=="number"&&U>=0&&U<=f.levels.SILENT)return U;throw new TypeError("log.setLevel() called with invalid level: "+F)}f.name=y,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=x||g,f.getLevel=function(){return M??I??P},f.setLevel=function(F,U){return M=B(F),U!==!1&&j(M),u.call(f)},f.setDefaultLevel=function(F){I=B(F),T()||f.setLevel(F,!1)},f.resetLevel=function(){M=null,X(),u.call(f)},f.enableAll=function(F){f.setLevel(f.levels.TRACE,F)},f.disableAll=function(F){f.setLevel(f.levels.SILENT,F)},f.rebuild=function(){if(a!==f&&(P=B(a.getLevel())),u.call(f),a===f)for(var F in r)r[F].rebuild()},P=B(a?a.getLevel():"WARN");var et=T();et!=null&&(M=B(et)),u.call(f)}a=new p,a.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var x=r[y];return x||(x=r[y]=new p(y,a.methodFactory)),x};var m=typeof window!==e?window.log:void 0;return a.noConflict=function(){return typeof window!==e&&window.log===a&&(window.log=m),a},a.getLoggers=function(){return r},a.default=a,a})})(Sa);var Ea=Sa.exports;const Ll=kl(Ea),Ol=Al({__proto__:null,default:Ll},[Ea]),Nl=!0,Ss=Ol;Ss.setLevel("debug");const Cl=i=>{try{Ss.setLevel(i)}catch(t){Ss.setLevel("error"),Ss.error(t)}};let Aa=class Ta{constructor(t,e){this.events={attrChanged:new Z,modelChanged:new Z},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=t||{};e&&Hs(s,e),this.attributes=s,this.changed={}}get(t){return this.attributes[t]}set(t,e,s){if(t==null)return this;let n;typeof t=="object"?(n=t,s=e):(n={},n[t]=e),s||(s={});const r=s.unset,a=s.silent,o=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=bs(this.attributes),this.changed={});const c=this.attributes,u=this.changed,d=this._previousAttributes;for(const g in n)e=n[g],Ze(c[g],e)||o.push(g),Ze(d[g],e)?delete u[g]:u[g]=e,r?delete c[g]:c[g]=e;if(!a){o.length&&(this._pending=s);for(let g=0;g<o.length;g++)this.events.attrChanged.dispatch({object:this,attrName:o[g],attrValue:c[o[g]],options:s})}if(l)return this;if(!a)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!Pa(this.changed):Ia(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?bs(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,s={};for(const n in t){const r=t[n];Ze(e[n],r)||(s[n]=r)}return s}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return bs(this._previousAttributes)}clone(){const t=bs(this.attributes);return new Ta(t)}},Rn=class Is{constructor(){this.entries=new Map}static getInstance(){return Is.instance||(Is.instance=new Is),Is.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries);}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class Bl{static formatBytes(t,e=2){if(t===0)return"0 B";const s=1024,n=Math.max(0,e),r=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(s)),o=t/Math.pow(s,a);return`${parseFloat(o.toFixed(n))} ${r[a]}`}}var ut=(i=>(i[i.ByLayer=0]="ByLayer",i[i.ByBlock=1]="ByBlock",i[i.ByAlpha=2]="ByAlpha",i[i.ErrorValue=3]="ErrorValue",i))(ut||{});let Qi=class Ft{constructor(t){t!==void 0?(this._method=ut.ByAlpha,this._alpha=Ft.clampAlpha(t)):(this._method=ut.ByLayer,this._alpha=255)}get method(){return this._method}set method(t){this._method=t}get alpha(){return this._alpha}set alpha(t){this._alpha=Ft.clampAlpha(t),this._method=ut.ByAlpha}get percentage(){if(this._method===ut.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(t){const e=Math.max(0,Math.min(100,t)),s=Math.round(255*(1-e/100));this.alpha=s}static clampAlpha(t){return Math.max(0,Math.min(255,Math.floor(t)))}get isByAlpha(){return this._method===ut.ByAlpha}get isByBlock(){return this._method===ut.ByBlock}get isByLayer(){return this._method===ut.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===ut.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const t=new Ft;return t._method=this._method,t._alpha=this._alpha,t}equals(t){return this._method===t._method&&this._alpha===t._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(t){const e=t.trim();if(/^bylayer$/i.test(e)){const r=new Ft;return r._method=ut.ByLayer,r}if(/^byblock$/i.test(e)){const r=new Ft;return r._method=ut.ByBlock,r}const s=Number(e);if(Number.isInteger(s)&&s>=0&&s<=255)return new Ft(s);const n=new Ft;return n._method=ut.ErrorValue,n}static deserialize(t){const e=t>>>24&255,s=t&255,n=Object.values(ut)[e]??ut.ErrorValue,r=new Ft;return r._method=n,r._alpha=Ft.clampAlpha(s),r}};class Ma{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class va{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(t){return new Promise((e,s)=>{const n=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(n):setTimeout(n,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let s=t;for(let n=0;n<e;n++){const r=this.tasks[n];try{s=await this.scheduleTask(async()=>{const a=await r.run(s);return this.onProgress((n+1)/e,r),a})}catch(a){if(this.onError({error:a,taskIndex:n,task:r}))return Promise.reject(a)}}this.onComplete(s)}}let ka=class{constructor(t,e,s){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=s}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(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())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,s=this.handlers.length;e<s;e+=2){const n=this.handlers[e],r=this.handlers[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}};const La=new ka;class Fl{constructor(t){this.manager=t!==void 0?t:La,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((s,n)=>{this.load(t,s,e,n)})}parse(t){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}var De=256,Oa=[],Kr=256,ri;for(;De--;)Oa[De]=(De+256).toString(16).substring(1);function Rl(i){var t=0,e=11;if(!ri||De+e>Kr*2)for(ri="",De=0;t<Kr;t++)ri+=Oa[Math.random()*256|0];return ri.substring(De,De+++e)}const pi="TEMP_";let fn;function Na(i){fn=i}class he{constructor(t,e){if(t=t||{},this._attrs=new Aa(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 pi+Rl()}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(pi)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(pi)}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(fn)return fn().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Fn.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}clone(){const t=Object.create(Object.getPrototypeOf(this)),e=this,s=t;for(const n of Object.keys(e))n!=="_database"&&(s[n]=this.cloneValue(e[n]));return t.objectId=this.generateTemporaryHandle(),t}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(n=>this.cloneValue(n));if(t instanceof Map){const n=new Map;for(const[r,a]of t.entries())n.set(this.cloneValue(r),this.cloneValue(a));return n}if(t instanceof Set){const n=new Set;for(const r of t.values())n.add(this.cloneValue(r));return n}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));const n=t.constructor;return new n(t)}if(t instanceof ArrayBuffer)return t.slice(0);if("clone"in t&&typeof t.clone=="function")return t.clone();const e=Object.create(Object.getPrototypeOf(t)),s=t;for(const n of Object.keys(s))e[n]=this.cloneValue(s[n]);return e}dxfOut(...t){const[e,s=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),s)for(const n of this._xDataMap.values())e.writeResultBuffer(n);return this}dxfOutFields(t){return this}}let bn;function Ca(i){bn=i}function zn(){return Ii.instance}const qi=class qi{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(){if(!this._layoutManager){if(!bn)throw new Error("The layout manager factory must be registered before using it!");this._layoutManager=bn()}return this._layoutManager}};qi.instance=new qi;let Ii=qi;Na(zn);var Ba=(i=>(i.kForRead="kForRead",i.kForWrite="kForWrite",i))(Ba||{});class Vn{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 Vn(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Dn{constructor(t,e,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=s,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,s)=>{const n=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(n):setTimeout(n,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let s=0;const n=async()=>{const r=s,a=Math.min(s+this._chunkSize,this._count);await t(r,a),s=a,s<this._count&&await this.scheduleTask(n)};await n(),await(e==null?void 0:e())}}var Es=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Es||{});class Rt{constructor(){this.events={registered:new Z,unregistered:new Z},this._converters=new Map,this.register("dxf",new Sl)}static createInstance(){return Rt._instance==null&&(Rt._instance=new Rt),this._instance}static get instance(){return Rt._instance||(Rt._instance=new Rt),Rt._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 jn=(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))(jn||{});class ss{static get instance(){return this._instance||(this._instance=new ss),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}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,s,n=[],r=!0,a,o){const l=[];if(e!=null){const c=this.createKey(e.name,s);let u;if(this.has(c))u=this.get(c);else{const d=e.newIterator();for(const g of d)g.color.isByBlock&&s?(Qr.copy(g.color),g.color.setRGBValue(s),this.addEntity(g,l,t),g.color.copy(Qr)):this.addEntity(g,l,t);u=t.group(l),u&&r&&K.name&&!K.name.startsWith("*U")&&this.set(c,u)}return u&&a&&(u.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),u.applyMatrix(a))),u&&n&&n.length>0&&(u.bakeTransformToChildren(),n.forEach(d=>u.addChild(d))),u}else return t.group(l)}addEntity(t,e,s){const n=t.worldDraw(s);n&&(this.attachEntityInfo(n,t),e.push(n))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const Qr=new Q;var Wn=(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))(Wn||{});const zl=["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"],Fa=i=>zl[i],Ke="Continuous",tt="Standard",At="ByLayer",Qe="ByBlock",In="mlightcad",Pn="ACAD",at=["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"];let Jr=1234567;const Gn=Math.PI/180,Hn=180/Math.PI;function Ra(){const i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(at[i&255]+at[i>>8&255]+at[i>>16&255]+at[i>>24&255]+"-"+at[t&255]+at[t>>8&255]+"-"+at[t>>16&15|64]+at[t>>24&255]+"-"+at[e&63|128]+at[e>>8&255]+"-"+at[e>>16&255]+at[e>>24&255]+at[s&255]+at[s>>8&255]+at[s>>16&255]+at[s>>24&255]).toLowerCase()}function re(i,t,e){return Math.max(t,Math.min(e,i))}function Un(i,t){return(i%t+t)%t}function za(i,t,e,s,n){return s+(i-t)*(n-s)/(e-t)}function Va(i,t,e){return i!==t?(e-i)/(t-i):0}function Xn(i,t,e){return(1-e)*i+e*t}function Da(i,t,e,s){return Xn(i,t,1-Math.exp(-e*s))}function ja(i,t=1){return t-Math.abs(Un(i,t*2)-t)}function Wa(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Ga(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Ha(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Ua(i,t){return i+Math.random()*(t-i)}function Xa(i){return i*(.5-Math.random())}function Ya(i){i!==void 0&&(Jr=i);let t=Jr+=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 $a(i){return i*Gn}function qa(i){return i*Hn}function Za(i){return(i&i-1)===0&&i!==0}function Ka(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Qa(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function As(i){const t=Math.PI*2;return(i%t+t)%t}function Ja(i,t,e){return i>t&&i<e||i>e&&i<t}function to(i,t,e,s=!1){return i=As(i),t=As(t),e=As(e),s?t>e?i<=t&&i>=e:i<=t||i>=e:t<e?i>=t&&i<=e:i>=t||i<=e}function Yn(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function eo(i,t=1e-7){const e=Yn(i);return Math.max(Math.pow(10,e)*t,t)}const v={DEG2RAD:Gn,RAD2DEG:Hn,generateUUID:Ra,clamp:re,euclideanModulo:Un,mapLinear:za,inverseLerp:Va,lerp:Xn,damp:Da,pingpong:ja,smoothstep:Wa,smootherstep:Ga,randInt:Ha,randFloat:Ua,randFloatSpread:Xa,seededRandom:Ya,degToRad:$a,radToDeg:qa,isPowerOfTwo:Za,ceilPowerOfTwo:Ka,floorPowerOfTwo:Qa,normalizeAngle:As,isBetween:Ja,isBetweenAngle:to,intPartLength:Yn,relativeEps:eo},Sn=class so{constructor(t,e){this.x=0,this.y=0;const s=+(t!==void 0)+ +(e!==void 0);if(s!==0){if(s===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(s===1){const{x:n,y:r}=t;this.x=n,this.y=r;return}if(s===2){this.x=t,this.y=e;return}throw yt.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(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}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new so(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const e=this.x,s=this.y,n=t.elements;return this.x=n[0]*e+n[3]*s+n[6],this.y=n[1]*e+n[4]*s+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(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}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const s=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*s-a*n+t.x,this.y=r*n+a*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(v.relativeEps(this.x,t),v.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};Sn.EMPTY=Object.freeze(new Sn(0,0));let Y=Sn;const En=class io{constructor(t,e,s,n,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&s!=null&&n!=null&&r!=null&&a!=null&&o!=null&&l!=null&&c!=null&&this.set(t,e,s,n,r,a,o,l,c)}set(t,e,s,n,r,a,o,l,c){const u=this.elements;return u[0]=t,u[1]=n,u[2]=o,u[3]=e,u[4]=r,u[5]=l,u[6]=s,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const 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}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,n=e.elements,r=this.elements,a=s[0],o=s[3],l=s[6],c=s[1],u=s[4],d=s[7],g=s[2],p=s[5],m=s[8],y=n[0],x=n[3],f=n[6],P=n[1],I=n[4],M=n[7],A=n[2],j=n[5],T=n[8];return r[0]=a*y+o*P+l*A,r[3]=a*x+o*I+l*j,r[6]=a*f+o*M+l*T,r[1]=c*y+u*P+d*A,r[4]=c*x+u*I+d*j,r[7]=c*f+u*M+d*T,r[2]=g*y+p*P+m*A,r[5]=g*x+p*I+m*j,r[8]=g*f+p*M+m*T,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],s=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],u=t[8];return e*a*u-e*o*c-s*r*u+s*o*l+n*r*c-n*a*l}invert(){const t=this.elements,e=t[0],s=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],u=t[8],d=u*a-o*c,g=o*l-u*r,p=c*r-a*l,m=e*d+s*g+n*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return t[0]=d*y,t[1]=(n*c-u*s)*y,t[2]=(o*s-n*a)*y,t[3]=g*y,t[4]=(u*e-n*l)*y,t[5]=(n*r-o*e)*y,t[6]=p*y,t[7]=(s*l-c*e)*y,t[8]=(a*e-s*r)*y,this}transpose(){let t;const 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}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const 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}setUvTransform(t,e,s,n,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(s*l,s*c,-s*(l*a+c*o)+a+t,-n*c,n*l,-n*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(rn.makeScale(t,e)),this}rotate(t){return this.premultiply(rn.makeRotation(-t)),this}translate(t,e){return this.premultiply(rn.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof Y?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}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let n=0;n<9;n++)if(e[n]!==s[n])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new io().fromArray(this.elements)}};En.IDENTITY=Object.freeze(new En);let Us=En;const rn=new Us,Ve=1e-6,W=2*Math.PI,Vl={x:0,y:0},$n={x:0,y:0,z:0};class Xs{constructor(){this.equalPointTol=Ve,this.equalVectorTol=Ve}clone(){const t=new Xs;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t}equalPoint2d(t,e){return new Y(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new b(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Ve){return t<e&&t>-e}static equal(t,e,s=Ve){return Math.abs(t-e)<s}static great(t,e,s=Ve){return t-e>s}static less(t,e,s=Ve){return t-e<s}}const qn=new Xs;class Ue{constructor(t=0,e=0,s=0,n=1){this._x=t,this._y=e,this._z=s,this._w=n}static slerpFlat(t,e,s,n,r,a,o){let l=s[n+0],c=s[n+1],u=s[n+2],d=s[n+3];const g=r[a+0],p=r[a+1],m=r[a+2],y=r[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=u,t[e+3]=d;return}if(o===1){t[e+0]=g,t[e+1]=p,t[e+2]=m,t[e+3]=y;return}if(d!==y||l!==g||c!==p||u!==m){let x=1-o;const f=l*g+c*p+u*m+d*y,P=f>=0?1:-1,I=1-f*f;if(I>Number.EPSILON){const A=Math.sqrt(I),j=Math.atan2(A,f*P);x=Math.sin(x*j)/A,o=Math.sin(o*j)/A}const M=o*P;if(l=l*x+g*M,c=c*x+p*M,u=u*x+m*M,d=d*x+y*M,x===1-o){const A=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=A,c*=A,u*=A,d*=A}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=d}static multiplyQuaternionsFlat(t,e,s,n,r,a){const o=s[n],l=s[n+1],c=s[n+2],u=s[n+3],d=r[a],g=r[a+1],p=r[a+2],m=r[a+3];return t[e]=o*m+u*d+l*p-c*g,t[e+1]=l*m+u*g+c*d-o*p,t[e+2]=c*m+u*p+o*g-l*d,t[e+3]=u*m-o*d-l*g-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,n){return this._x=t,this._y=e,this._z=s,this._w=n,this._onChangeCallback(),this}clone(){return new Ue(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t.x,n=t.y,r=t.z,a=t.order,o=Math.cos,l=Math.sin,c=o(s/2),u=o(n/2),d=o(r/2),g=l(s/2),p=l(n/2),m=l(r/2);switch(a){case"XYZ":this._x=g*u*d+c*p*m,this._y=c*p*d-g*u*m,this._z=c*u*m+g*p*d,this._w=c*u*d-g*p*m;break;case"YXZ":this._x=g*u*d+c*p*m,this._y=c*p*d-g*u*m,this._z=c*u*m-g*p*d,this._w=c*u*d+g*p*m;break;case"ZXY":this._x=g*u*d-c*p*m,this._y=c*p*d+g*u*m,this._z=c*u*m+g*p*d,this._w=c*u*d-g*p*m;break;case"ZYX":this._x=g*u*d-c*p*m,this._y=c*p*d+g*u*m,this._z=c*u*m-g*p*d,this._w=c*u*d+g*p*m;break;case"YZX":this._x=g*u*d+c*p*m,this._y=c*p*d+g*u*m,this._z=c*u*m-g*p*d,this._w=c*u*d-g*p*m;break;case"XZY":this._x=g*u*d-c*p*m,this._y=c*p*d-g*u*m,this._z=c*u*m+g*p*d,this._w=c*u*d+g*p*m;break}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,n=Math.sin(s);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],n=e[4],r=e[8],a=e[1],o=e[5],l=e[9],c=e[2],u=e[6],d=e[10],g=s+o+d;if(g>0){const p=.5/Math.sqrt(g+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(a-n)*p}else if(s>o&&s>d){const p=2*Math.sqrt(1+s-o-d);this._w=(u-l)/p,this._x=.25*p,this._y=(n+a)/p,this._z=(r+c)/p}else if(o>d){const p=2*Math.sqrt(1+o-s-d);this._w=(r-c)/p,this._x=(n+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+d-s-o);this._w=(a-n)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(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=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(re(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const n=Math.min(1,e/s);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,n=t._y,r=t._z,a=t._w,o=e._x,l=e._y,c=e._z,u=e._w;return this._x=s*u+a*o+n*c-r*l,this._y=n*u+a*l+r*o-s*c,this._z=r*u+a*c+s*l-n*o,this._w=a*u-s*o-n*l-r*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,n=this._y,r=this._z,a=this._w;let o=a*t._w+s*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=s,this._y=n,this._z=r,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-e;return this._w=p*a+e*this._w,this._x=p*s+e*this._x,this._y=p*n+e*this._y,this._z=p*r+e*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-e)*u)/c,g=Math.sin(e*u)/c;return this._w=a*d+this._w*g,this._x=s*d+this._x*g,this._y=n*d+this._y*g,this._z=r*d+this._z*g,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),n=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(n*Math.sin(t),n*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const dt=class no{constructor(t,e,s){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:r,y:a,z:o}=t;this.x=r,this.y=a,this.z=o||0;return}if(n===3){this.x=t,this.y=e,this.z=s;return}throw yt.ILLEGAL_PARAMETERS}}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(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}getComponent(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)}}clone(){return new no(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ta.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ta.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*n,this.y=r[1]*e+r[4]*s+r[7]*n,this.z=r[2]*e+r[5]*s+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*s+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*s+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*s+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,s=this.y,n=this.z,r=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*n-o*s),u=2*(o*e-r*n),d=2*(r*s-a*e);return this.x=e+l*c+a*d-o*u,this.y=s+l*u+o*c-r*d,this.z=n+l*d+r*u-a*c,this}transformDirection(t){const e=this.x,s=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*n,this.y=r[1]*e+r[5]*s+r[9]*n,this.z=r[2]*e+r[6]*s+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(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}max(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}clamp(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}clampScalar(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}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const e=this.dot(t),s=this.length(),n=t.length();return Math.abs(e)===s*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,n=t.y,r=t.z,a=e.x,o=e.y,l=e.z;return this.x=n*l-r*o,this.y=r*a-s*l,this.z=s*o-n*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return an.copy(this).projectOnVector(t),this.sub(an)}reflect(t){return this.sub(an.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,n=this.z-t.z;return e*e+s*s+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};dt.ORIGIN=Object.freeze(new dt(0,0,0)),dt.X_AXIS=Object.freeze(new dt(1,0,0)),dt.NEGATIVE_X_AXIS=Object.freeze(new dt(-1,0,0)),dt.Y_AXIS=Object.freeze(new dt(0,1,0)),dt.NEGATIVE_Y_AXIS=Object.freeze(new dt(0,-1,0)),dt.Z_AXIS=Object.freeze(new dt(0,0,1)),dt.NEGATIVE_Z_AXIS=Object.freeze(new dt(0,0,-1));let b=dt;const an=new b,ta=new Ue,An=class ro{constructor(t,e,s,n,r,a,o,l,c,u,d,g,p,m,y,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&s!=null&&n!=null&&r!=null&&a!=null&&o!=null&&l!=null&&c!=null&&u!=null&&d!=null&&g!=null&&p!=null&&m!=null&&y!=null&&x!=null&&this.set(t,e,s,n,r,a,o,l,c,u,d,g,p,m,y,x)}set(t,e,s,n,r,a,o,l,c,u,d,g,p,m,y,x){const f=this.elements;return f[0]=t,f[4]=e,f[8]=s,f[12]=n,f[1]=r,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=u,f[10]=d,f[14]=g,f[3]=p,f[7]=m,f[11]=y,f[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ro().fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const 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}setFromExtrusionDirection(t){if(qn.equalPoint3d(t,b.Z_AXIS))this.identity();else{const e=new b(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(b.Y_AXIS,t).normalize():e.crossVectors(b.Z_AXIS,t).normalize();const s=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,s.x,s.y,s.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,n=1/Xe.setFromMatrixColumn(t,0).length(),r=1/Xe.setFromMatrixColumn(t,1).length(),a=1/Xe.setFromMatrixColumn(t,2).length();return e[0]=s[0]*n,e[1]=s[1]*n,e[2]=s[2]*n,e[3]=0,e[4]=s[4]*r,e[5]=s[5]*r,e[6]=s[6]*r,e[7]=0,e[8]=s[8]*a,e[9]=s[9]*a,e[10]=s[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Dl,t,jl)}lookAt(t,e,s){const n=this.elements;return _t.subVectors(t,e),_t.lengthSq()===0&&(_t.z=1),_t.normalize(),de.crossVectors(s,_t),de.lengthSq()===0&&(Math.abs(s.z)===1?_t.x+=1e-4:_t.z+=1e-4,_t.normalize(),de.crossVectors(s,_t)),de.normalize(),ai.crossVectors(_t,de),n[0]=de.x,n[4]=ai.x,n[8]=_t.x,n[1]=de.y,n[5]=ai.y,n[9]=_t.y,n[2]=de.z,n[6]=ai.z,n[10]=_t.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,n=e.elements,r=this.elements,a=s[0],o=s[4],l=s[8],c=s[12],u=s[1],d=s[5],g=s[9],p=s[13],m=s[2],y=s[6],x=s[10],f=s[14],P=s[3],I=s[7],M=s[11],A=s[15],j=n[0],T=n[4],X=n[8],B=n[12],et=n[1],F=n[5],U=n[9],fe=n[13],be=n[2],Qs=n[6],Js=n[10],ti=n[14],ei=n[3],si=n[7],ii=n[11],ni=n[15];return r[0]=a*j+o*et+l*be+c*ei,r[4]=a*T+o*F+l*Qs+c*si,r[8]=a*X+o*U+l*Js+c*ii,r[12]=a*B+o*fe+l*ti+c*ni,r[1]=u*j+d*et+g*be+p*ei,r[5]=u*T+d*F+g*Qs+p*si,r[9]=u*X+d*U+g*Js+p*ii,r[13]=u*B+d*fe+g*ti+p*ni,r[2]=m*j+y*et+x*be+f*ei,r[6]=m*T+y*F+x*Qs+f*si,r[10]=m*X+y*U+x*Js+f*ii,r[14]=m*B+y*fe+x*ti+f*ni,r[3]=P*j+I*et+M*be+A*ei,r[7]=P*T+I*F+M*Qs+A*si,r[11]=P*X+I*U+M*Js+A*ii,r[15]=P*B+I*fe+M*ti+A*ni,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],s=t[4],n=t[8],r=t[12],a=t[1],o=t[5],l=t[9],c=t[13],u=t[2],d=t[6],g=t[10],p=t[14],m=t[3],y=t[7],x=t[11],f=t[15];return m*(+r*l*d-n*c*d-r*o*g+s*c*g+n*o*p-s*l*p)+y*(+e*l*p-e*c*g+r*a*g-n*a*p+n*c*u-r*l*u)+x*(+e*c*d-e*o*p-r*a*d+s*a*p+r*o*u-s*c*u)+f*(-n*o*u-e*l*d+e*o*g+n*a*d-s*a*g+s*l*u)}transpose(){const t=this.elements;let 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}setPosition(t,e,s){const n=this.elements;return t instanceof b?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],u=t[8],d=t[9],g=t[10],p=t[11],m=t[12],y=t[13],x=t[14],f=t[15],P=d*x*c-y*g*c+y*l*p-o*x*p-d*l*f+o*g*f,I=m*g*c-u*x*c-m*l*p+a*x*p+u*l*f-a*g*f,M=u*y*c-m*d*c+m*o*p-a*y*p-u*o*f+a*d*f,A=m*d*l-u*y*l-m*o*g+a*y*g+u*o*x-a*d*x,j=e*P+s*I+n*M+r*A;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/j;return t[0]=P*T,t[1]=(y*g*r-d*x*r-y*n*p+s*x*p+d*n*f-s*g*f)*T,t[2]=(o*x*r-y*l*r+y*n*c-s*x*c-o*n*f+s*l*f)*T,t[3]=(d*l*r-o*g*r-d*n*c+s*g*c+o*n*p-s*l*p)*T,t[4]=I*T,t[5]=(u*x*r-m*g*r+m*n*p-e*x*p-u*n*f+e*g*f)*T,t[6]=(m*l*r-a*x*r-m*n*c+e*x*c+a*n*f-e*l*f)*T,t[7]=(a*g*r-u*l*r+u*n*c-e*g*c-a*n*p+e*l*p)*T,t[8]=M*T,t[9]=(m*d*r-u*y*r-m*s*p+e*y*p+u*s*f-e*d*f)*T,t[10]=(a*y*r-m*o*r+m*s*c-e*y*c-a*s*f+e*o*f)*T,t[11]=(u*o*r-a*d*r-u*s*c+e*d*c+a*s*p-e*o*p)*T,t[12]=A*T,t[13]=(u*y*n-m*d*n+m*s*g-e*y*g-u*s*x+e*d*x)*T,t[14]=(m*o*n-a*y*n-m*s*l+e*y*l+a*s*x-e*o*x)*T,t[15]=(a*d*n-u*o*n+u*s*l-e*d*l-a*s*g+e*o*g)*T,this}scale(t){const e=this.elements,s=t.x,n=t.y,r=t.z;return e[0]*=s,e[4]*=n,e[8]*=r,e[1]*=s,e[5]*=n,e[9]*=r,e[2]*=s,e[6]*=n,e[10]*=r,e[3]*=s,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,n))}makeTranslation(t,e,s){return t instanceof b?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),n=Math.sin(e),r=1-s,a=t.x,o=t.y,l=t.z,c=r*a,u=r*o;return this.set(c*a+s,c*o-n*l,c*l+n*o,0,c*o+n*l,u*o+s,u*l-n*a,0,c*l-n*o,u*l+n*a,r*l*l+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,n,r,a){return this.set(1,s,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,s){const n=this.elements,r=e.x,a=e.y,o=e.z,l=e.w,c=r+r,u=a+a,d=o+o,g=r*c,p=r*u,m=r*d,y=a*u,x=a*d,f=o*d,P=l*c,I=l*u,M=l*d,A=s.x,j=s.y,T=s.z;return n[0]=(1-(y+f))*A,n[1]=(p+M)*A,n[2]=(m-I)*A,n[3]=0,n[4]=(p-M)*j,n[5]=(1-(g+f))*j,n[6]=(x+P)*j,n[7]=0,n[8]=(m+I)*T,n[9]=(x-P)*T,n[10]=(1-(g+y))*T,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,s){const n=this.elements;let r=Xe.set(n[0],n[1],n[2]).length();const a=Xe.set(n[4],n[5],n[6]).length(),o=Xe.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],kt.copy(this);const l=1/r,c=1/a,u=1/o;return kt.elements[0]*=l,kt.elements[1]*=l,kt.elements[2]*=l,kt.elements[4]*=c,kt.elements[5]*=c,kt.elements[6]*=c,kt.elements[8]*=u,kt.elements[9]*=u,kt.elements[10]*=u,e.setFromRotationMatrix(kt),s.x=r,s.y=a,s.z=o,this}equals(t){const e=this.elements,s=t.elements;for(let n=0;n<16;n++)if(e[n]!==s[n])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};An.IDENTITY=Object.freeze(new An);let G=An;const Xe=new b,kt=new G,Dl=new b(0,0,0),jl=new b(1,1,1),de=new b,ai=new b,_t=new b;let C=class ao{constructor(t=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)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(on.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=on.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new ao().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new b(0,0,0):new b(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(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)}containsBox(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}getParameter(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))}intersectsBox(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)}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,on).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Wt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Wt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Wt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Wt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Wt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Wt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Wt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Wt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Wt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const Wt=[new b,new b,new b,new b,new b,new b,new b,new b],on=new b,ea=new Y;let pt=class oo{constructor(t=void 0,e=void 0){this.min=t==null?new Y(1/0,1/0):new Y(t.x,t.y),this.max=e==null?new Y(-1/0,-1/0):new Y(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=ea.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new oo().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Y(0,0):new Y(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Y(0,0):new Y(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(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}getParameter(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))}intersectsBox(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)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ea).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const sa=new b,Wl=new b,Gl=new Us;class Ys{constructor(t=new b(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,n){return this.normal.set(t,e,s),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const n=sa.subVectors(s,e).cross(Wl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||Gl.getNormalMatrix(t),n=this.coplanarPoint(sa).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new Ys().copy(this)}}let k=class ho extends Y{clone(){return new ho(this.x,this.y)}static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((s,n)=>{s.toArray(e,n*2)}),e}},w=class lo extends b{clone(){return new lo(this.x,this.y,this.z)}static pointArrayToNumberArray(t,e=!0){const s=e?3:2,n=new Array(t.length*s);return t.forEach((r,a)=>{r.toArray(n,a*s)}),n}};const ia=new G,na=new Ue,co=class Tn{constructor(t=0,e=0,s=0,n=Tn.DEFAULT_ORDER){this._x=t,this._y=e,this._z=s,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,n=this._order){return this._x=t,this._y=e,this._z=s,this._order=n,this._onChangeCallback(),this}clone(){return new Tn(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const n=t.elements,r=n[0],a=n[4],o=n[8],l=n[1],c=n[5],u=n[9],d=n[2],g=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(re(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-re(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(re(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-re(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(g,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(re(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-re(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,p),this._y=0);break}return this._order=e,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,s=!0){return ia.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ia,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return na.setFromEuler(this),this.setFromQuaternion(na,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(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}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};co.DEFAULT_ORDER="XYZ";let Hl=co;function Zn(i,t,e=!1){const s=i.x,n=i.y;let r=!1;const a=t.length;for(let o=0,l=a-1;o<a;l=o++){const c=t[o].x,u=t[o].y,d=t[l].x,g=t[l].y;let p=u>n!=g>n;e&&(p=u>=n!=g>=n),p&&s<(d-c)*(n-u)/(g-u)+c&&(r=!r)}return r}function uo(i,t){if(i.length===0||t.length===0)return!1;const e=new pt().setFromPoints(i),s=new pt().setFromPoints(t);if(!e.intersectsBox(s))return!1;for(let n=0;n<i.length;){if(Zn(i[n],t,!0))return!0;n<i.length-1&&qn.equalPoint2d(i[n+1],i[n])&&++n,++n}return!1}const po={isPointInPolygon:Zn,isPolygonIntersect:uo};function Ul(i,t){const e=[],s=t-1,n=i;for(let r=0;r<=n;r++)e.push(0);for(let r=1;r<=s-n;r++)e.push(r);for(let r=0;r<=n;r++)e.push(s-n+1);return e}function Xl(i,t){const e=t.length-1,s=i,n=[0];let r=0;for(let o=1;o<=e;o++){const l=t[o][0]-t[o-1][0],c=t[o][1]-t[o-1][1],u=t[o][2]-t[o-1][2],d=Math.sqrt(l*l+c*c+u*u);r+=d,n.push(r)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=e-s;o++){const l=n[o]/r;a.push(l*(e-s+1))}for(let o=0;o<=s;o++)a.push(e-s+1);return a}function go(i,t="Uniform"){const e=i.length;if(e===0)return[];if(e===1)return[0];const s=e-1;if(t==="Uniform")return new Array(e).fill(0).map((a,o)=>o/s);const n=[0];let r=0;for(let a=1;a<=s;a++){const o=i[a][0]-i[a-1][0],l=i[a][1]-i[a-1][1],c=i[a][2]-i[a-1][2],u=Math.sqrt(o*o+l*l+c*c),d=t==="SqrtChord"?Math.sqrt(u):u;r+=d,n.push(r)}return r<1e-12?new Array(e).fill(0).map((a,o)=>o/s):n.map(a=>a/r)}function mo(i,t){const e=t.length-1,s=i,n=e+s+1,r=new Array(n+1).fill(0),a=t[t.length-1];for(let o=n-s;o<=n;o++)r[o]=a;for(let o=1;o<=e-s;o++){let l=0;for(let c=o;c<o+s;c++)l+=t[c];r[o+s]=l/s}return r}function Yl(i,t){const e=t.length-1,s=i,n=[0];let r=0;for(let o=1;o<=e;o++){const l=t[o][0]-t[o-1][0],c=t[o][1]-t[o-1][1],u=t[o][2]-t[o-1][2],d=Math.sqrt(l*l+c*c+u*u),g=Math.sqrt(d);r+=g,n.push(r)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=e-s;o++){const l=n[o]/r;a.push(l*(e-s+1))}for(let o=0;o<=s;o++)a.push(e-s+1);return a}function hn(i,t){const e=i.length,s=i.map(a=>a.slice()),n=t.slice();for(let a=0;a<e;a++){let o=a,l=Math.abs(s[a][a]);for(let c=a+1;c<e;c++){const u=Math.abs(s[c][a]);u>l&&(l=u,o=c)}if(l<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==a){const c=s[a];s[a]=s[o],s[o]=c;const u=n[a];n[a]=n[o],n[o]=u}for(let c=a+1;c<e;c++){const u=s[c][a]/s[a][a];if(!(Math.abs(u)<1e-14)){for(let d=a;d<e;d++)s[c][d]-=u*s[a][d];n[c]-=u*n[a]}}}const r=new Array(e).fill(0);for(let a=e-1;a>=0;a--){let o=n[a];for(let l=a+1;l<e;l++)o-=s[a][l]*r[l];r[a]=o/s[a][a]}return r}function Kn(i,t,e="Uniform",s,n){if(i.length===0)return{controlPoints:[],knots:[],weights:[]};const r=i.map(B=>[B[0],B[1],B[2]??0]),a=!!s,o=!!n,l=(a?1:0)+(o?1:0),c=r.length-1,u=c+l;if(u<t)throw new Error("Not enough points to interpolate a curve of this degree.");const d=go(r,e),g=d.slice();a&&g.unshift(d[0]),o&&g.push(d[d.length-1]);const p=mo(t,g),m=u+1,y=new Array(m),x=new Array(m),f=new Array(m),P=new Array(m);let I=0;y[I]=new Array(m).fill(0),y[I][0]=1,x[I]=r[0][0],f[I]=r[0][1],P[I]=r[0][2],I++;for(let B=1;B<=c-1;B++){const et=d[B];y[I]=new Array(m).fill(0);for(let F=0;F<=u;F++)y[I][F]=Ns(F,t,et,p);x[I]=r[B][0],f[I]=r[B][1],P[I]=r[B][2],I++}if(y[I]=new Array(m).fill(0),y[I][u]=1,x[I]=r[c][0],f[I]=r[c][1],P[I]=r[c][2],I++,a){const B=p[t+1]-p[0],et=B!==0?t/B:0;y[I]=new Array(m).fill(0),y[I][0]=-et,y[I][1]=et,x[I]=(s==null?void 0:s[0])??0,f[I]=(s==null?void 0:s[1])??0,P[I]=(s==null?void 0:s[2])??0,I++}if(o){const B=p[u+t+1]-p[u],et=B!==0?t/B:0;y[I]=new Array(m).fill(0),y[I][u-1]=-et,y[I][u]=et,x[I]=(n==null?void 0:n[0])??0,f[I]=(n==null?void 0:n[1])??0,P[I]=(n==null?void 0:n[2])??0,I++}const M=hn(y,x),A=hn(y,f),j=hn(y,P),T=new Array(m);for(let B=0;B<m;B++)T[B]=[M[B],A[B],j[B]];const X=new Array(m).fill(1);return{controlPoints:T,knots:p,weights:X}}function Ns(i,t,e,s){if(t===0)return e>=s[i]&&e<s[i+1]?1:0;const n=s[i+t]-s[i],r=s[i+t+1]-s[i+1],a=n>1e-10?(e-s[i])/n:0,o=r>1e-10?(s[i+t+1]-e)/r:0;return a*Ns(i,t-1,e,s)+o*Ns(i+1,t-1,e,s)}function Ts(i,t,e,s,n){const r=s.length-1,a=t;if(i=Math.max(e[a],Math.min(e[r+1],i)),Math.abs(i-e[r+1])<1e-8)return[...s[r]];if(Math.abs(i-e[a])<1e-8)return[...s[0]];const o=[0,0,0];let l=0;for(let c=0;c<=r;c++){const u=Ns(c,a,i,e),d=n[c]*u;o[0]+=s[c][0]*d,o[1]+=s[c][1]*d,o[2]+=s[c][2]*d,l+=d}if(Math.abs(l)<1e-10){const c=e[e.length-a-1];if(Math.abs(i-c)<1e-8)return[...s[r]];if(Math.abs(i-e[a])<1e-8)return[...s[0]]}return Math.abs(l)>=1e-10&&(o[0]/=l,o[1]/=l,o[2]/=l),o}function yo(i,t,e,s){const n=i,r=t[n],a=t[t.length-n-1];let o=0;const l=1e3,c=(a-r)/l;let u=Ts(r,i,t,e,s);for(let y=1;y<=l;y++){const x=r+y*c,f=Ts(x,i,t,e,s),P=f[0]-u[0],I=f[1]-u[1],M=f[2]-u[2];o+=Math.sqrt(P*P+I*I+M*M),u=f}const d=Ts(a,i,t,e,s),g=d[0]-u[0],p=d[1]-u[1],m=d[2]-u[2];return o+=Math.sqrt(g*g+p*p+m*m),o}function $l(i,t=3,e="Uniform",s,n){return i.length===0?[]:Kn(i,t,e,s,n).controlPoints}const ra=new G,aa=new b,ql=new b,Zl=new b,ln=new w;function _o(i){return new G().setFromExtrusionDirection(new b(i.x,i.y,i.z))}function Qn(i){return ra.setFromExtrusionDirection(new b(i.x,i.y,i.z)),ra.extractBasis(aa,ql,Zl),aa.clone()}function Mn(i,t){return new w(i.x,i.y,i.z??0).applyMatrix4(_o(t))}function Cs(i,t){return new w(i.x,i.y,i.z??0).applyMatrix4(_o(t).invert())}function vn(i,t,e){const s=Cs(i,e),n=Cs(t,e);return ln.set(n.x-s.x,n.y-s.y,(n.z??0)-(s.z??0)),v.normalizeAngle(Math.atan2(ln.y,ln.x))}class wo{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Jn extends wo{translate(t){return this.transform(new Us().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}let ts=class xo extends Jn{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new pt}transform(t){return this._loops.forEach(e=>{e.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){const t=new xo;return this._loops.forEach(e=>{t.add(e.clone())}),t}getPoints(t){const e=[];for(let s=0;s<this.loops.length;++s){const n=this.loops[s].getPoints(t);e.push(n)}return e}buildHierarchy(){var t;const e=this.getPoints(100),s=this.calculateBoundaryBoxes(e),n=this.sortBoundaryBoxesByAreas(s),r=new Map,a=n.length;for(let l=0;l<a;l++)r.set(n[l],{index:n[l],children:[]});const o={index:-1,children:[]};for(let l=0;l<a;l++){const c=n[l],u=e[c],d=s[c];let g=l+1;for(;g<a;g++){const p=n[g],m=e[p];if(s[p].containsBox(d)&&po.isPointInPolygon(u[v.randInt(0,u.length-1)],m)){(t=r.get(p))==null||t.children.push(r.get(c));break}}g===a&&o.children.push(r.get(c))}return o}get area(){if(this._loops.length===0)return 0;let t=0;for(let e=0;e<this._loops.length;e++){const s=this._loops[e].getPoints(128),n=this.polygonArea(s);e===0?t+=Math.abs(n):t-=Math.abs(n)}return t}polygonArea(t){const e=t.length;if(e<3)return 0;let s=0;for(let n=0,r=e-1;n<e;r=n++){const a=t[r],o=t[n];s+=a.x*o.y-o.x*a.y}return s*.5}calculateBoundaryBoxes(t){const e=[];return t.forEach(s=>{e.push(new pt().setFromPoints(s))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((n,r)=>{const a=n.size,o=a.width*a.height;e.push({area:o,index:r})}),e.sort((n,r)=>n.area-r.area);const s=[];return e.forEach(n=>{s.push(n.index)}),s}},is=class extends Jn{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let s,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)s=this.getPoint(a/t),r+=s.distanceTo(n),e.push(r),n=s;return e}getUtoTmapping(t,e){const s=this.getLengths();let n=0;const r=s.length;let a;e?a=e:a=t*s[r-1];let o=0,l=r-1,c;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),c=s[n]-a,c<0)o=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,s[n]===a)return n/(r-1);const u=s[n],d=s[n+1]-u,g=(a-u)/d;return(n+g)/(r-1)}getTangent(t){let e=t-1e-4,s=t+1e-4;e<0&&(e=0),s>1&&(s=1);const n=this.getPoint(e),r=this.getPoint(s),a=new k;return a.copy(r).sub(n).normalize(),a}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}},ye=class kn extends is{constructor(t,e,s,n,r){super();const a=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(n!==void 0)+ +(r!==void 0);if(a==3)typeof t=="object"&&typeof e=="object"&&typeof s=="object"?this.createByThreePoints(t,e,s):this.createByStartEndPointsAndBulge(t,e,s);else if(a==5){const o=t;this.center=new k(o.x,o.y),this.radius=e,this._clockwise=r,this._startAngle=this._clockwise?this._mirrorAngle(v.normalizeAngle(s)):v.normalizeAngle(s),this._endAngle=this._clockwise?this._mirrorAngle(v.normalizeAngle(n)):v.normalizeAngle(n)}else throw yt.ILLEGAL_PARAMETERS}createByThreePoints(t,e,s){const n=(T,X)=>({x:(T.x+X.x)/2,y:(T.y+X.y)/2}),r=(T,X)=>(X.y-T.y)/(X.x-T.x),a=T=>-1/T,o=n(t,e),l=n(e,s),c=r(t,e),u=r(e,s),d=a(c),g=a(u),p=(T,X,B,et)=>{const F=(et-X)/(T-B),U=T*F+X;return{x:F,y:U}},m=o.y-d*o.x,y=l.y-g*l.x,x=p(d,m,g,y),f=Math.sqrt(Math.pow(t.x-x.x,2)+Math.pow(t.y-x.y,2)),P=(T,X)=>Math.atan2(T.y-X.y,T.x-X.x),I=P(t,x),M=P(e,x),A=P(s,x),j=A>I&&A<M||I>A&&I<M||M>A&&M<I;this.center=x,this.radius=f,this._clockwise=!j,this._startAngle=I,this._endAngle=A}createByStartEndPointsAndBulge(t,e,s){let n,r,a;s<0?(n=Math.atan(-s)*4,r=new Y(t),a=new Y(e)):(n=Math.atan(s)*4,r=new Y(e),a=new Y(t));const o=new Y().subVectors(a,r),l=o.length(),c=new Y().addVectors(r,o.multiplyScalar(.5)),u=Math.abs(l/2/Math.tan(n/2)),d=o.normalize(),g=s<0?-Math.PI/2:Math.PI/2,p=new Y(d.x*Math.cos(g)-d.y*Math.sin(g),d.y*Math.cos(g)+d.x*Math.sin(g));let m;n<Math.PI?s<0?m=c.add(p.multiplyScalar(u)):m=c.add(p.multiplyScalar(-u)):s<0?m=c.add(p.multiplyScalar(-u)):m=c.add(p.multiplyScalar(u)),s<0?(this._startAngle=Math.atan2(r.y-m.y,r.x-m.x),this._endAngle=Math.atan2(a.y-m.y,a.x-m.x)):(this._startAngle=Math.atan2(a.y-m.y,a.x-m.x),this._endAngle=Math.atan2(r.y-m.y,r.x-m.x)),this._clockwise=s<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(t){this._center=new k(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(v.normalizeAngle(t)):v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const e=this.startAngle==0&&t==W?t:v.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(e):e,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return this.clockwise?v.normalizeAngle(t-e):v.normalizeAngle(e-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),e=this._clockwise?v.normalizeAngle(t-this.deltaAngle/2):v.normalizeAngle(t+this.deltaAngle/2),s=this._clockwise?this._mirrorAngle(e):e;return this.getPointAtAngle(s)}get closed(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return Math.abs(e-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const r of e){const a=this._getInternalAngle(r);v.isBetweenAngle(a,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(r))}const s=t.map(r=>r.x),n=t.map(r=>r.y);return new pt(new k(Math.min(...s),Math.min(...n)),new k(Math.max(...s),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){const e=t,s=this.center.clone().applyMatrix2d(e),n=this.startPoint.clone().applyMatrix2d(e);if(this.closed)return this.center=s,this.radius=s.distanceTo(n),this._startAngle=Math.atan2(n.y-s.y,n.x-s.x),this._endAngle=this._startAngle,this._clockwise=e.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;const r=this.midPoint.clone().applyMatrix2d(e),a=this.endPoint.clone().applyMatrix2d(e),o=new kn(n,r,a),l=e.determinant()<0?!this.clockwise:this.clockwise,c=u=>{const d=v.normalizeAngle(u);return l?this._mirrorAngle(d):d};return this.center=o.center,this.radius=o.radius,this.clockwise=l,this.startAngle=c(Math.atan2(n.y-o.center.y,n.x-o.center.x)),this.endAngle=c(Math.atan2(a.y-o.center.y,a.x-o.center.x)),this._boundingBoxNeedsUpdate=!0,this}clone(){return new kn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const e=this._getInternalAngle(t),s=this.center.x+this.radius*Math.cos(e),n=this.center.y+this.radius*Math.sin(e);return new k(s,n)}getPoints(t=100){const e=[];let s=this.deltaAngle,n=this._getInternalAngle(this.startAngle);if(this.closed&&(s=W,n=0),this.clockwise)for(let r=0;r<=t;r++){const a=n-s*(r/t),o=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(o);e.push(new k(l.x,l.y))}else for(let r=0;r<=t;r++){const a=n+s*(r/t),o=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(o);e.push(new k(l.x,l.y))}return e}};class Kl extends wo{translate(t){return this.transform(new G().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class $s extends Kl{}class _e extends $s{constructor(t,e){super(),this._start=new w(t),this._end=new w(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new b().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new w((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const s=this.delta(Ie).normalize();return new w(this._start).addScaledVector(s,t)}else{const s=this.delta(Ie).normalize();return new w(this._end).addScaledVector(s,t)}}extend(t,e=!1){if(e){const s=Ie.subVectors(this._start,this._end).normalize();this._start=new w(this._start).addScaledVector(s,t)}else{const s=this.delta(Ie).normalize();this._end=new w(this._end).addScaledVector(s,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){oa.subVectors(t,this._start),oi.subVectors(this.endPoint,this.startPoint);const s=oi.dot(oi);let n=oi.dot(oa)/s;return e&&(n=v.clamp(n,0,1)),n}closestPointToPoint(t,e,s){const n=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,s=Ie.subVectors(t,this.startPoint).dot(e);return new w().copy(e).multiplyScalar(s).add(this.startPoint)}perpPoint(t){const e=this.direction,s=this.startPoint,n=Ie.subVectors(t,s).dot(e),r=Ie.copy(e).multiplyScalar(n);return new w().addVectors(s,r)}calculateBoundingBox(){const t=new w(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),e=new w(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 C(t,e)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new _e(this._start.clone(),this._end.clone())}}const Ie=new b,oa=new b,oi=new b;class je extends $s{static computeCenterPoint(t,e,s){const n=new b().addVectors(t,e).multiplyScalar(.5),r=new b().addVectors(t,s).multiplyScalar(.5),a=new b().subVectors(e,t),o=new b().subVectors(s,t),l=new b().crossVectors(a,o).normalize();if(l.lengthSq()===0)return null;const c=new b().crossVectors(a,l).normalize(),u=new b().crossVectors(o,l).normalize(),d=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),g=u.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new _e(n,n.clone().add(d)),m=new _e(r,r.clone().add(g)),y=new b;return p.closestPointToPoint(m.startPoint,!0,y)?y:null}static createByThreePoints(t,e,s){const n=je.computeCenterPoint(t,e,s);if(n){const r=n.distanceTo(t),a=new b().subVectors(t,n),o=new b().subVectors(e,n),l=Math.atan2(a.y,a.x),c=Math.atan2(o.y,o.x);return new je(n,r,l,c,b.Z_AXIS)}}constructor(t,e,s,n,r,a=b.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=s,this.endAngle=n,this.normal=r,this.refVec=a,(n-s)%W==0?(this.startAngle=0,this.endAngle=W):(this.startAngle=s,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new w(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==W?t:v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return v.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new b(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new b(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;this.closed&&(t=0,e=W);const s=t+e*.5;return this.getPointAtAngle(s)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const e=new b(t.x,t.y,t.z||0),s=this.center,n=this.normal,r=e.clone().sub(s).dot(n),a=e.clone().sub(n.clone().multiplyScalar(r)).clone().sub(s);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const o=s.clone().add(a),l=this.getAngle(o.clone()),c=this.startAngle,u=this.deltaAngle;let d=v.normalizeAngle(l-c);d<0&&(d=0),d>u&&(d=u);const g=this.getPointAtAngle(c+d),p=g.distanceTo(e),m=this.startPoint.distanceTo(e),y=this.endPoint.distanceTo(e);return m<p&&m<=y?this.startPoint.clone():y<p&&y<m?this.endPoint.clone():g}tangentPoints(t){const e=[],s=new b(t.x,t.y,t.z||0),n=this.center,r=this.normal,a=this.radius,o=s.clone().sub(n).dot(r),l=s.clone().sub(r.clone().multiplyScalar(o)),c=n.clone(),u=l.clone().sub(c).length();if(u<a)return e;const d=Math.acos(a/u),g=this.getAngle(l.clone()),p=[g+d,g-d];for(const m of p){const y=v.normalizeAngle(m-this.startAngle);y>=0&&y<=this.deltaAngle&&e.push(this.getPointAtAngle(this.startAngle+y))}return e}nearestTangentPoint(t){const e=this.tangentPoints(t);if(e.length===0)return null;const s=new w(t.x,t.y,t.z||0);return e.length===1||e[0].distanceTo(s)<e[1].distanceTo(s)?e[0]:e[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let l=0;l<2*Math.PI;l+=Math.PI/2)v.isBetweenAngle(l,this.startAngle,this.endAngle)&&t.push(l);let e=1/0,s=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(const l of t){const c=this.getPointAtAngle(l);c.x<e&&(e=c.x),c.y<s&&(s=c.y),c.z<n&&(n=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new C({x:e,y:s,z:n},{x:r,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let s=this.deltaAngle,n=this.startAngle;this.closed&&(s=W,n=0);for(let r=0;r<=t;r++){const a=n+s*(r/t),o=this.getPointAtAngle(a);e.push(o)}return e}transform(t){const e=this.center.clone().applyMatrix4(t),s=this.startPoint.clone().applyMatrix4(t),n=this.endPoint.clone().applyMatrix4(t),r=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(t),a=new b(s).sub(e).normalize(),o=e.distanceTo(s);let l=new b().crossVectors(new b(s).sub(e),new b(r).sub(e)).normalize();l.lengthSq()===0&&(l=this.normal.clone().transformDirection(t));const c=u=>{const d=new b(u).sub(e);return Math.atan2(d.dot(ha.crossVectors(l,a)),d.dot(a))};return this.center=e,this.radius=o,this.normal=l,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?W:c(n),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new je(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(ha.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,s=this.refVec,n={x:e.y*s.z-e.z*s.y,y:e.z*s.x-e.x*s.z,z:e.x*s.y-e.y*s.x},r=this.center,a=this.radius;return new w(r.x+a*(s.x*Math.cos(t)+n.x*Math.sin(t)),r.y+a*(s.y*Math.cos(t)+n.y*Math.sin(t)),r.z+a*(s.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new b(this.center).distanceTo($n);return new Ys(this.normal,t)}}const ha=new b;let Bs=class gi extends is{constructor(t,e,s,n=0,r=W,a=!1,o=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=s,(r-n)%W==0?(this.startAngle=0,this.endAngle=W):(this.startAngle=n,this.endAngle=r),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(t){this._center=new w(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==W?t:v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return v.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,s=-1/0,n=-1/0;for(let r=0;r<=100;r++){const a=this.getPoint(r/100);t=Math.min(t,a.x),e=Math.min(e,a.y),s=Math.max(s,a.x),n=Math.max(n,a.y)}return new pt({x:t,y:e},{x:s,y:n})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let s=this.endAngle-this.startAngle;const n=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=e;for(;s>e;)s-=e;s<Number.EPSILON&&(n?s=0:s=e),this.clockwise===!0&&!n&&(s===e?s=-e:s=s-e);const r=this.startAngle+t*s;let a=this.center.x+this.majorAxisRadius*Math.cos(r),o=this.center.y+this.minorAxisRadius*Math.sin(r);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,d=o-this.center.y;a=u*l-d*c+this.center.x,o=u*c+d*l+this.center.y}return new k(a,o)}transform(t){const e=t,s=new k(this.center).applyMatrix2d(e),n=new w(s.x,s.y,this.center.z),r=this.getPointAtAngle(0).clone().applyMatrix2d(e),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(e),o=new k(r).sub(s),l=new k(a).sub(s),c=o.length(),u=l.length(),d=Math.atan2(o.y,o.x),g=o.clone().normalize(),p=l.clone().normalize(),m=f=>{const P=new k(f).sub(s),I=P.dot(g),M=P.dot(p);return v.normalizeAngle(Math.atan2(M/u,I/c))},y=e.determinant()<0?!this.clockwise:this.clockwise,x=this.closed?new gi(n,c,u,0,W,y,d):new gi(n,c,u,m(this.startPoint.clone().applyMatrix2d(e)),m(this.endPoint.clone().applyMatrix2d(e)),y,d);return this.center=x.center,this.majorAxisRadius=x.majorAxisRadius,this.minorAxisRadius=x.minorAxisRadius,this._startAngle=x._startAngle,this._endAngle=x._endAngle,this._clockwise=x._clockwise,this.rotation=x.rotation,this._boundingBoxNeedsUpdate=!0,this}getPointAtAngle(t){return this.getPoint(this.closed?t/W:v.normalizeAngle(t-this.startAngle)/this.deltaAngle)}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new gi(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}};class Je extends $s{constructor(t,e,s,n,r,a=0,o=W){super(),this.center=t,this.normal=e,this.majorAxis=s,this.majorAxisRadius=n,this.minorAxisRadius=r;const l=Math.abs(o-a);Math.abs(l-W)<1e-10||Math.abs(l-2*W)<1e-10?(this.startAngle=0,this.endAngle=W):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new w(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw yt.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==W?t:v.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-W)<1e-10?W:v.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new b(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new b(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new b().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;(this.closed||Math.abs(e-W)<1e-10)&&(t=0,e=W);const s=t+e/2;return this.getPointAtAngle(s)}get isCircular(){return Xs.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let s=0,n=this.getPointAtAngle(this.startAngle);for(let r=1;r<=t;r++){const a=this.startAngle+r*e,o=this.getPointAtAngle(a),l=o.x-n.x,c=o.y-n.y,u=o.z-n.z;s+=Math.sqrt(l*l+c*c+u*u),n=o}return s}get area(){const t=this.majorAxisRadius,e=this.minorAxisRadius,s=this.startAngle,n=s+this.deltaAngle;if(Math.abs(this.deltaAngle-W)<1e-10)return Math.PI*t*e;const r=t*e/2*(n-s-(Math.sin(n)*Math.cos(n)-Math.sin(s)*Math.cos(s)));return Math.abs(r)}calculateBoundingBox(){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)){const t=[this.startAngle,this.endAngle];for(let l=0;l<2*Math.PI;l+=Math.PI/2)v.isBetweenAngle(l,this.startAngle,this.endAngle)&&t.push(l);let e=1/0,s=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(const l of t){const c=this.getPointAtAngle(l);c.x<e&&(e=c.x),c.y<s&&(s=c.y),c.z<n&&(n=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new C({x:e,y:s,z:n},{x:r,y:a,z:o})}else{let t=1/0,e=1/0,s=1/0,n=-1/0,r=-1/0,a=-1/0;for(let o=0;o<=100;o++){const l=this.startAngle+this.deltaAngle*(o/100),c=this.getPointAtAngle(l);t=Math.min(t,c.x),e=Math.min(e,c.y),s=Math.min(s,c.z),n=Math.max(n,c.x),r=Math.max(r,c.y),a=Math.max(a,c.z)}return new C({x:t,y:e,z:s},{x:n,y:r,z:a})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let s=this.deltaAngle,n=this.startAngle;this.closed&&(s=W,n=0);for(let r=0;r<=t;r++){const a=n+s*(r/t),o=this.getPointAtAngle(a);e.push(o)}return e}getPointAtAngle(t){const e=Math.cos(t),s=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),r=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(n);return new w(this.center.x+r.x,this.center.y+r.y,this.center.z+r.z)}contains(t){const e=new b(t).sub(this.center),s=e.dot(this.majorAxis),n=e.dot(this.minorAxis),r=s/this.majorAxisRadius,a=n/this.minorAxisRadius;return r*r+a*a<=1}transform(t){const e=t,s=this.center.clone().applyMatrix4(e),n=this.getPointAtAngle(0).clone().applyMatrix4(e),r=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(e),a=new b(n).sub(s),o=new b(r).sub(s),l=a.length(),c=o.length(),u=a.clone().normalize(),d=new b().crossVectors(a,o).normalize();let g=new b().crossVectors(d,u).normalize();g.dot(o)<0&&(d.negate(),g=new b().crossVectors(d,u).normalize());const p=y=>{const x=new b(y).sub(s),f=x.dot(u),P=x.dot(g);return v.normalizeAngle(Math.atan2(P/c,f/l))},m=this.closed?new Je(s,d,u,l,c,0,W):new Je(s,d,u,l,c,p(this.startPoint.clone().applyMatrix4(e)),p(this.endPoint.clone().applyMatrix4(e)));return this.center=m.center,this.normal=m.normal,this.majorAxis=m.majorAxis,this.majorAxisRadius=m.majorAxisRadius,this.minorAxisRadius=m.minorAxisRadius,this._startAngle=m._startAngle,this._endAngle=m._endAngle,this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Je(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new b(this.center).distanceTo($n);return new Ys(this.normal,t)}}class Mt extends is{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new k(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new k(e.x,e.y)}else{const e=this._vertices[t-1];return new k(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let s=0;s<e;++s){const n=this._vertices[s];let r=null;if(s<e-1?r=this._vertices[s+1]:s==e-1&&this.closed&&(r=this._vertices[0]),r)if(n.bulge){const a=new ye(n,r,n.bulge);t+=a.length}else t+=new k(n.x,n.y).distanceTo(r)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}removeVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error(`Index ${t} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0}reset(t,e){t?e!==void 0&&e>=0&&e<this._vertices.length&&(this._vertices=this._vertices.slice(0,e),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(t){const e=this._vertices[t];return new k(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new pt().setFromPoints(t)}transform(t){const e=t.determinant()<0;return this._vertices.forEach(s=>{const n=new k(s).applyMatrix2d(t);s.x=n.x,s.y=n.y,e&&s.bulge!=null&&(s.bulge=-s.bulge)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Mt(this._vertices.map(t=>({...t})),this._closed)}getPoints3d(t,e){const s=[];return this.getPoints(t).forEach(n=>s.push(new w().set(n.x,n.y,e))),s}getPoints(t){const e=[],s=this._vertices.length;for(let n=0;n<s;++n){const r=this._vertices[n];if(r.bulge){let a=null;if(n<s-1?a=this._vertices[n+1]:n==s-1&&this.closed&&(a=this._vertices[0]),a){const o=new ye(r,a,r.bulge).getPoints(t),l=o.length;for(let c=0;c<l;++c){const u=o[c];e.push(new k(u.x,u.y))}}}else e.push(new k(r.x,r.y)),n==s-1&&this.closed&&e.push(e[0])}return e}}class Vt extends is{constructor(t,e){super(),this._start=new k(t),this._end=new k(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new k(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new k(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new pt(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Vt(this._start.clone(),this._end.clone())}}let Fs=class Ct extends is{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}static buildFromEdges(t,e=.001){if(t.length===0)return[];const s=[...t],n=[],r=e*e,a=(o,l)=>{const c=o.x-l.x,u=o.y-l.y;return c*c+u*u<=r};for(;s.length>0;){const o=[],l=s.shift();o.push(l);const c=Ct.getEdgeStartPoint(l);let u=Ct.getEdgeEndPoint(l);if(!a(c,u))for(;s.length>0;){const d=Ct.findConnectingEdge(s,u,r);if(d.index<0)break;let g=s.splice(d.index,1)[0];if(d.reverse&&(g=Ct.reverseEdge(g)),o.push(g),u=Ct.getEdgeEndPoint(g),a(u,c))break}n.push(new Ct(o))}return n}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new k(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new pt;return e.setFromPoints(t),e}transform(t){const e=new G().set(t.elements[0],t.elements[3],0,t.elements[6],t.elements[1],t.elements[4],0,t.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(s=>{s instanceof Dt?s.transform(e):s.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ct(this._curves.map(t=>t.clone()))}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(s=>{s.getPoints(t).forEach(n=>{e.push(new k(n.x,n.y))})}),e}static findConnectingEdge(t,e,s){let n=-1,r=!1,a=Number.POSITIVE_INFINITY;for(let o=0;o<t.length;o++){const l=t[o],c=Ct.getEdgeStartPoint(l),u=Ct.getEdgeEndPoint(l),d=e.x-c.x,g=e.y-c.y,p=d*d+g*g;p<a&&(a=p,n=o,r=!1);const m=e.x-u.x,y=e.y-u.y,x=m*m+y*y;x<a&&(a=x,n=o,r=!0)}return a>s?{index:-1,reverse:!1}:{index:n,reverse:r}}static getEdgeStartPoint(t){const e=t.startPoint;return new k(e.x,e.y)}static getEdgeEndPoint(t){const e=t.endPoint;return new k(e.x,e.y)}static reverseEdge(t){return t instanceof Vt?new Vt(t.endPoint,t.startPoint):t instanceof ye?new ye(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof Bs?new Bs(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof Dt?Ct.reverseSplineEdge(t):t}static reverseSplineEdge(t){const e=[...t.controlPoints].reverse(),s=t.knots,n=s[0],r=s[s.length-1],a=s.map(c=>n+r-c).reverse(),o=t.weights,l=o.length>0?[...o].reverse():void 0;return new Dt(e,a,l,t.degree,t.closed)}};class cn{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,s,n){this.c0=t,this.c1=s,this.c2=-3*t+3*e-2*s-n,this.c3=2*t-2*e+s+n}initCatmullRom(t,e,s,n,r){this.init(e,s,r*(s-t),r*(n-e))}initNonuniformCatmullRom(t,e,s,n,r,a,o){let l=(e-t)/r-(s-t)/(r+a)+(s-e)/a,c=(s-e)/a-(n-e)/(a+o)+(n-s)/o;l*=a,c*=a,this.init(e,s,l,c)}calc(t){const e=t*t,s=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*s}}class Ji extends $s{constructor(t=[],e=!1,s="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new b,this._px=new cn,this._py=new cn,this._pz=new cn,this._points=t.map(r=>new w(r)),this._closed=e,this._curveType=s,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new w}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new w}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new w){const s=e,n=this._points,r=n.length;if(r===0)return s.set(0,0,0);if(r===1)return s.copy(n[0]);const a=(r-(this._closed?0:1))*t;let o=Math.floor(a),l=a-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,u;this._closed||o>0?c=n[(o-1)%r]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),c=new w(this._tmp.x,this._tmp.y,this._tmp.z));const d=n[o%r],g=n[(o+1)%r];if(this._closed||o+2<r?u=n[(o+2)%r]:(this._tmp.subVectors(n[r-1],n[r-2]).add(n[r-1]),u=new w(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const p=this._curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(d),p),y=Math.pow(d.distanceToSquared(g),p),x=Math.pow(g.distanceToSquared(u),p);y<1e-4&&(y=1),m<1e-4&&(m=y),x<1e-4&&(x=y),this._px.initNonuniformCatmullRom(c.x,d.x,g.x,u.x,m,y,x),this._py.initNonuniformCatmullRom(c.y,d.y,g.y,u.y,m,y,x),this._pz.initNonuniformCatmullRom(c.z,d.z,g.z,u.z,m,y,x)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,d.x,g.x,u.x,this._tension),this._py.initCatmullRom(c.y,d.y,g.y,u.y,this._tension),this._pz.initCatmullRom(c.z,d.z,g.z,u.z,this._tension));return s.set(this._px.calc(l),this._py.calc(l),this._pz.calc(l)),s}getPoints(t){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}setPoints(t){this._points=t.map(e=>new w(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}clone(){return new Ji(this._points.map(t=>t.clone()),this._closed,this._curveType,this._tension)}transform(t){return this._points=this._points.map(e=>{const s=new w;return s.copy(e),s.applyMatrix4(t),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new C;const t=new C;return this._points.forEach(e=>{t.expandByPoint(e)}),t}}let Bt=class Ps{constructor(t,e,s,n){this._degree=t,this._knots=[...e],this._controlPoints=s.map(r=>({x:r.x,y:r.y,z:r.z})),this._weights=n?[...n]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}clone(){return new Ps(this._degree,this._knots,this._controlPoints,this._weights)}point(t){const e=this._controlPoints.map(s=>[s.x,s.y,s.z]);return Ts(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return yo(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,s,n){return new Ps(t,e,s,n)}static byPoints(t,e,s="Uniform",n,r){const a=Kn(t,e,s,n,r),o=a.controlPoints.map(l=>({x:l[0],y:l[1],z:l[2]}));return new Ps(e,a.knots,o,a.weights)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:s,end:n}=this.getParameterRange();for(let r=0;r<=t;r++){const a=s+(n-s)*(r/t);e.push(this.point(a))}return e}isClosed(t=1e-6){const{start:e,end:s}=this.getParameterRange(),n=this.point(e),r=this.point(s),a=n[0]-r[0],o=n[1]-r[1],l=n[2]-r[2];return Math.sqrt(a*a+o*o+l*l)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Ji(t,!0,"centripetal"),s=Math.max(50,t.length*2);return e.getPoints(s)}static createClosedCurve(t,e,s="Chord"){const n=this.createFitPointsForClosedCurve(t).map(r=>[r.x,r.y,r.z]);return Ps.byPoints(n,e,s)}},Dt=class mi extends $s{constructor(t,e,s,n,r,a){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(e)){if(o<2||o>5)throw yt.ILLEGAL_PARAMETERS;this._controlPoints=t;let l,c=3,u=!1;if(o>=3&&(Array.isArray(s)?(l=s,o>=4&&(c=n||3),o>=5&&(u=r)):s!==void 0&&(c=s||3,o>=4&&(u=n))),s===void 0&&o>=4&&(c=n||3,o>=5&&(u=r)),this._degree=c,this._closed=u,this._controlPoints.length<this._degree+1)throw yt.ILLEGAL_PARAMETERS;this._nurbsCurve=Bt.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,l)}else{if(o<2||o>6)throw yt.ILLEGAL_PARAMETERS;this._fitPoints=t,this._knotParameterization=e,o>=3&&(this._degree=s||3);const l=typeof n=="boolean";o>=4&&l&&(this._closed=n),l?(o>=5&&(this._startTangent=r),o>=6&&(this._endTangent=a)):(o>=4&&(this._startTangent=n),o>=5&&(this._endTangent=r)),this._closed&&(this._startTangent=void 0,this._endTangent=void 0);const c=(this._startTangent?1:0)+(this._endTangent?1:0);if(this._fitPoints.length+c<this._degree+1)throw yt.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=Bt.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const u=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Bt.byPoints(u,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(u=>[u.x,u.y,u.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=Bt.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Bt.byPoints(e,this._degree,this._knotParameterization)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Bt.byPoints(t,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(t=>[t.x,t.y,t.z||0]))}else if(this._controlPoints)if(this._closed){const t=Bt.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Bt.byPoints(e,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(s=>[s.x,s.y,s.z||0]))}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._nurbsCurve=Bt.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get fitPoints(){var t;return(t=this._fitPoints)==null?void 0:t.map(e=>({x:e.x,y:e.y,z:e.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[e],n=this._nurbsCurve.point(s);return new w(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[t.length-e-1],n=this._nurbsCurve.point(s);return new w(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,s=t<0||t>=e?e-1:t,n=this._fitPoints[s];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const e=this._controlPoints.length,s=t<0||t>=e?e-1:t;return this._controlPoints[s]}getPoints(t=100){const e=this._nurbsCurve,s=[],n=e.knots(),r=this._nurbsCurve.degree(),a=n[r],o=n[n.length-r-1],l=(o-a)/(t-1);for(let c=0;c<t;c++){const u=c===t-1?o:a+c*l,d=e.point(u);s.push(new w(d[0],d[1],d[2]))}return s}getCurvePoints(t,e){const s=[],n=t.knots(),r=t.degree(),a=n[r],o=(n[n.length-r-1]-a)/(e-1);for(let l=0;l<e;l++){const c=a+l*o;s.push(t.point(c))}return s}calculateBoundingBox(){const t=this.getPoints(100);return new C().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(e=>new w(e).applyMatrix4(t)),this._startTangent&&(this._startTangent=new w(this._startTangent).transformDirection(t)),this._endTangent&&(this._endTangent=new w(this._endTangent).transformDirection(t)),this.buildCurve();else{const e=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(n=>new w(n).applyMatrix4(t)),this._nurbsCurve=Bt.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,s.length>0?s:void 0)}return this._boundingBoxNeedsUpdate=!0,this}clone(){return this._fitPoints&&this._knotParameterization?new mi(this._fitPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._knotParameterization,this._degree,this._closed,this._startTangent?{x:this._startTangent.x,y:this._startTangent.y,z:this._startTangent.z||0}:void 0,this._endTangent?{x:this._endTangent.x,y:this._endTangent.y,z:this._endTangent.z||0}:void 0):new mi(this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((s,n)=>{e[n]=[s.x,s.y,s.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((s,n)=>{e[n]={x:s[0],y:s[1],z:s[2]}}),e}toNurbsPoint(t){return[t.x,t.y,t.z||0]}static createClosedSpline(t,e="Uniform",s=3){if(t.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new mi(t,e,s,!0)}};var tr=(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))(tr||{}),We=(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",i))(We||{}),ae=(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",i))(ae||{}),ot=(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))(ot||{}),er=(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",i))(er||{}),sr=(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",i))(sr||{}),ir=(i=>(i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",i))(ir||{});let fo=class bo{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new w,this._height=0,this._width=0,this._viewCenter=new w,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new pt;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new pt;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new bo;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}copy(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}};const ur=class ur extends he{constructor(){super(...arguments),this._visibility=!0,this._transparency=new Qi}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._color==null&&(this._color=new Q,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}set color(t){this._color==null&&(this._color=new Q),this._color.copy(t)}get resolvedColor(){var e;let t=this.color;if(t.isByLayer){const s=this.getLayerColor();s&&s.RGB!=null&&(t=s)}else if(t.isByBlock){const s=this.database.cecolor;if(s&&(t=s,t.isByLayer)){const n=this.database.clayer||this.layer,r=this.database.tables.layerTable.getAt(n);((e=r==null?void 0:r.color)==null?void 0:e.RGB)!=null&&(t=r.color)}}return t}get rgbColor(){const e=this.resolvedColor.RGB;return e??16777215}get lineType(){var t;return this._lineType==null&&(this._lineType=((t=this.database)==null?void 0:t.celtype)??At),this._lineType}set lineType(t){t?t.toUpperCase()==="BYLAYER"?this._lineType=At:t.toUpperCase()==="BYBLOCK"?this._lineType=Qe:this._lineType=t:this._lineType=At}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??We.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()}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._color=new Q,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??At),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??We.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,s,n,r,a){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){const s=t.subEntityTraits;s.color=this.resolvedColor,s.rgbColor=this.rgbColor,s.lineType=this.lineStyle,s.lineTypeScale=this.linetypeScale,s.lineWeight=this.lineWeight,s.transparency=this.transparency,s.layer=this.layer,s.drawOrder=0,"thickness"in this&&(s.thickness=this.thickness);const n=this.subWorldDraw(t,e);return this.attachEntityInfo(n),n}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}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.copy(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 n;const{type:t,name:e}=this.getLineType(),s=(n=this.database)==null?void 0:n.tables.linetypeTable.getAt(e);return s?{type:t,...s.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==At){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==Qe?{type:"ByBlock",name:Ke}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Ke}}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)}};ur.typeName="Entity";let gt=ur;const pr=class pr extends gt{};pr.typeName="Curve";let rt=pr;var $e=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.FitCurvePoly=1]="FitCurvePoly",i[i.QuadSplinePoly=2]="QuadSplinePoly",i[i.CubicSplinePoly=3]="CubicSplinePoly",i))($e||{});const gr=class gr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,s=0,n=!1,r=0,a=0,o=null){super(),this._polyType=t,this._elevation=s;const l=o&&(o==null?void 0:o.length)===e.length,c=e.map((u,d)=>({x:u.x,y:u.y,bulge:l?o[d]:void 0}));this._geo=new Mt(c,n)}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}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 C({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 s=this._geo.getPointAt(e);t.push(new w(s.x,s.y,0))}return t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r){const a=this._geo.getPointAt(r);n.push(new w(a.x,a.y,0))}break}}transformBy(t){const e=t.determinant()<0;let s=this._elevation;return this._geo.vertices.forEach(n=>{const r=new w(n.x,n.y,this._elevation).applyMatrix4(t);n.x=r.x,n.y=r.y,s=r.z,e&&n.bulge!=null&&(n.bulge=-n.bulge)}),this._elevation=s,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(n=>e.push(new w().set(n.x,n.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let s=0;s<this.numberOfVertices;++s)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(s).x,y:this.getPointAt(s).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(s)),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}};gr.typeName="2dPolyline";let Pi=gr;var Io=(i=>(i[i.Vertex=0]="Vertex",i[i.CurveFitVertex=1]="CurveFitVertex",i[i.SplineFitVertex=8]="SplineFitVertex",i[i.SplineCtlVertex=9]="SplineCtlVertex",i))(Io||{});const mr=class mr extends gt{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new w,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 C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,s,n){n.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}};mr.typeName="2dVertex";let Ln=mr;var Ms=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.QuadSplinePoly=1]="QuadSplinePoly",i[i.CubicSplinePoly=2]="CubicSplinePoly",i))(Ms||{});const yr=class yr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,s=!1){super(),this._polyType=t,this._geo=new Mt(e,s)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){const e=this._geo.vertices[t];return new w(e.x,e.y,e.z||0)}get geometricExtents(){const t=this._geo.vertices.map(e=>new w(e.x,e.y,e.z||0));return new C().setFromPoints(t)}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const s=this._geo.getPointAt(e);t.push(new w(s.x,s.y,0))}return t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r)n.push(this.getPointAt(r));break}}transformBy(t){return this._geo.vertices.forEach(e=>{const s=new w(e.x,e.y,e.z||0).applyMatrix4(t);e.x=s.x,e.y=s.y,e.z=s.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(s=>new w(s.x,s.y,s.z||0));return t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let s=0;s<this.numberOfVertices;++s){const n=this.getPointAt(s);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:n.x,y:n.y,z:n.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}};yr.typeName="3dPolyline";let Si=yr;var Po=(i=>(i[i.SimpleVertex=0]="SimpleVertex",i[i.ControlVertex=1]="ControlVertex",i[i.FitVertex=2]="FitVertex",i))(Po||{});const _r=class _r extends gt{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new w,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 C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,s,n){n.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}};_r.typeName="3dVertex";let On=_r;const wr=class wr extends rt{get dxfTypeName(){return"ARC"}constructor(t,e,s,n,r=b.Z_AXIS){super();const a=Qn(r);this._geo=new je(t,e,s,n,r,a)}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 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:()=>v.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,n){const r=this.startPoint,a=this.endPoint;switch(t){case z.EndPoint:n.push(r),n.push(a);break;case z.MidPoint:n.push(this.midPoint);break;case z.Nearest:{const o=this._geo.nearestPoint(e);n.push(o)}break;case z.Perpendicular:break;case z.Tangent:{const o=this._geo.tangentPoints(e);n.push(...o);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Cs(this.center,this.normal);return t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeAngle(50,vn(this.center,this.startPoint,this.normal)),t.writeAngle(51,vn(this.center,this.endPoint,this.normal)),t.writeVector3d(210,this.normal),this}};wr.typeName="Arc";let Ei=wr;var So=(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))(So||{}),Eo=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(Eo||{});const xr=class xr extends gt{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new w,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 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(){return new C}subGetOsnapPoints(t,e,s,n){z.Insertion===t&&n.push(this._position)}transformBy(t){const e=this._position.clone(),s=this._position.clone().add(new b(Math.cos(this._rotation),Math.sin(this._rotation),0)),n=this._position.clone().add(new b(-Math.sin(this._rotation),Math.cos(this._rotation),0)),r=this._position.clone().add(new b(0,0,1));e.applyMatrix4(t),s.applyMatrix4(t),n.applyMatrix4(t),r.applyMatrix4(t);const a=new b(s).sub(e),o=new b(n).sub(e),l=new b(r).sub(e),c=o.length(),u=a.length(),d=l.length();return this._position.copy(e),u>0&&(this._rotation=Math.atan2(a.y,a.x)),c>0&&(this._height*=c,u>0&&(this._widthFactor*=u/c)),d>0&&(this._thickness*=d),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,e=t.getAt(this.styleName)??t.getAt(this.database.textstyle)??t.getAt(tt);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(t,e){const s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:ae.BOTTOM_TO_TOP,attachmentPoint:ot.BottomLeft};return t.mtext(s,this.getTextStyle(),e)}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.position),this}};xr.typeName="Text";let es=xr;var J=(i=>(i[i.Invisible=1]="Invisible",i[i.Const=2]="Const",i[i.Verifiable=4]="Verifiable",i[i.Preset=8]="Preset",i))(J||{}),zt=(i=>(i[i.MultiLine=2]="MultiLine",i[i.ConstMultiLine=4]="ConstMultiLine",i))(zt||{});const fr=class fr extends es{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}};fr.typeName="AttDef";let Ai=fr;const br=class br extends es{get dxfTypeName(){return"ATTRIB"}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&J.Invisible)!==0}set isInvisible(t){t?this._flags|=J.Invisible:this._flags&=~J.Invisible}get isConst(){return(this._flags&J.Const)!==0}set isConst(t){t?this._flags|=J.Const:this._flags&=~J.Const}get isVerifiable(){return(this._flags&J.Verifiable)!==0}set isVerifiable(t){t?this._flags|=J.Verifiable:this._flags&=~J.Verifiable}get isPreset(){return(this._flags&J.Preset)!==0}set isPreset(t){t?this._flags|=J.Preset:this._flags&=~J.Preset}get isMTextAttribute(){return(this._mtextFlag&zt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=zt.MultiLine:this._mtextFlag&=~zt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&zt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=zt.ConstMultiLine:this._mtextFlag&=~zt.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}};br.typeName="Attrib";let Ti=br;const Os=class Os extends gt{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new w,this._rotation=0,this._normal=new b(0,0,1),this._scaleFactors=new w(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}attributeIterator(){return new Zs(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??w.ORIGIN,s=new G().makeTranslation(-e.x,-e.y,-e.z),n=new G().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),r=new Ue().setFromAxisAngle(b.Z_AXIS,this._rotation),a=new G().makeRotationFromQuaternion(r),o=new G().makeTranslation(this._position.x,this._position.y,this._position.z);return new G().multiplyMatrices(o,a).multiply(n).multiply(s)}subGetOsnapPoints(t,e,s,n,r,a){const o=a??new G;z.Insertion===t?n.push(this.getInsertionPoint(o)):r&&this.subEntityGetOsnapPoints(t,e,s,n,r,o)}transformBy(t){const e=new G().setFromExtrusionDirection(this._normal),s=new G().makeRotationZ(this._rotation),n=new G().multiplyMatrices(e,s),r=this._position.clone(),a=new w(this._scaleFactors.x,0,0).applyMatrix4(n).add(r),o=new w(0,this._scaleFactors.y,0).applyMatrix4(n).add(r),l=new w(0,0,this._scaleFactors.z).applyMatrix4(n).add(r);r.applyMatrix4(t),a.applyMatrix4(t),o.applyMatrix4(t),l.applyMatrix4(t);const c=new b(a).sub(r),u=new b(o).sub(r),d=new b(l).sub(r);let g=new b().crossVectors(c,u);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const m=new G().setFromExtrusionDirection(g).clone().invert(),y=c.clone().applyMatrix4(m);return this._position.copy(r),this._normal.copy(g),this._rotation=Math.atan2(y.y,y.x),this._scaleFactors.set(c.length(),u.length(),d.length()),this._attribs.forEach(x=>x.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(s=>{e.properties.push({name:s.tag,type:"string",editable:!s.isConst,skipTranslation:!0,accessor:{get:()=>s.textString,set:n=>{s.textString=n}}})})}return t}get geometricExtents(){const t=new C,e=this.blockTableRecord;if(e!=null){const n=e.newIterator();for(const r of n)t.union(r.geometricExtents)}const s=this.blockTransform;return t.applyMatrix4(s),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const s=this.blockTransform,n=[];return this._attribs.forEach(a=>{if(!a.isInvisible){const o=a.worldDraw(t);o&&n.push(o)}}),ss.instance.draw(t,e,this.rgbColor,n,!0,s,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let s=!1;for(const n of this.attributeIterator())s=!0,t.writeStart("ATTRIB"),n.dxfOut(t);return s&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}subEntityGetOsnapPoints(t,e,s,n,r,a,o=new Set){if(r===this.objectId||o.has(this.objectId))return!1;o.add(this.objectId);try{const l=this.blockTableRecord;if(l==null)return!1;const c=new G().multiplyMatrices(a,this.getFullInsertionTransform());for(const u of l.newIterator()){if(u.objectId===r){const d=new w(e).applyMatrix4(c.clone().invert()),g=new w(s).applyMatrix4(c.clone().invert()),p=[];return u.subGetOsnapPoints(t,d,g,p,r,c),u instanceof Os?p.forEach(m=>{n.push(m.clone())}):p.forEach(m=>{n.push(new w(m).applyMatrix4(c))}),!0}if(u instanceof Os&&u.subEntityGetOsnapPoints(t,e,s,n,r,c,o))return!0}return!1}finally{o.delete(this.objectId)}}getInsertionPoint(t){var n;const e=((n=this.blockTableRecord)==null?void 0:n.origin)??w.ORIGIN,s=new G().multiplyMatrices(t,this.getFullInsertionTransform());return new w(e).applyMatrix4(s)}getFullInsertionTransform(){const t=new G().setFromExtrusionDirection(this._normal);return new G().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}};Os.typeName="BlockReference";let Ge=Os;const Ir=class Ir extends rt{get dxfTypeName(){return"CIRCLE"}constructor(t,e,s=b.Z_AXIS){super();const n=Qn(s);this._geo=new je(t,e,0,W,s,n)}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}subGetOsnapPoints(t,e,s,n){switch(t){case z.Center:case z.Centroid:n.push(this._geo.center);break;case z.Quadrant:n.push(this._geo.getPointAtAngle(0)),n.push(this._geo.getPointAtAngle(Math.PI/2)),n.push(this._geo.getPointAtAngle(Math.PI)),n.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case z.Nearest:{const r=this._geo.nearestPoint(e);n.push(r)}break;case z.Tangent:{const r=this._geo.tangentPoints(e);n.push(...r);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._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=Cs(this.center,this.normal);return t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}};Ir.typeName="Circle";let Mi=Ir;const Pr=class Pr extends rt{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,s,n,r,a,o){super(),this._geo=new Je(t,e,s,n,r,a,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}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}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:this.closed||(n.push(this._geo.startPoint),n.push(this._geo.endPoint));break;case z.MidPoint:this.closed||n.push(this._geo.midPoint);break;case z.Quadrant:this.closed&&(n.push(this._geo.getPointAtAngle(0)),n.push(this._geo.getPointAtAngle(Math.PI/2)),n.push(this._geo.getPointAtAngle(Math.PI)),n.push(this._geo.getPointAtAngle(Math.PI/2*3)));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._geo.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,s=this.majorAxisRadius;return t.writePoint3d(11,{x:e.x*s,y:e.y*s,z:e.z*s}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}};Pr.typeName="Ellipse";let vi=Pr;const Sr=class Sr extends gt{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new w,new w,new w],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 w),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 C().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(...this._vertices);break}}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._vertices.length,s=new Float32Array(e*3),n=new Uint16Array(e*2);for(let r=0;r<e;r++)s[r*3]=this._vertices[r].x,s[r*3+1]=this._vertices[r].y,s[r*3+2]=this._vertices[r].z,this.isEdgeVisibleAt(r)&&(n[r*2]=r,n[r*2+1]=(r+1)%4);return t.lineSegments(s,3,n)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),s=this.getVertexAt(1),n=this.getVertexAt(2),r=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,s),t.writePoint3d(12,n),t.writePoint3d(13,r);let a=0;for(let o=0;o<4;++o)this.isEdgeVisibleAt(o)||(a|=1<<o);return t.writeInt16(70,a),this}};Sr.typeName="Face";let ki=Sr;var vs=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(vs||{}),Ao=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(Ao||{}),nr=(i=>(i[i.HatchObject=0]="HatchObject",i[i.GradientObject=1]="GradientObject",i))(nr||{}),To=(i=>(i[i.PreDefinedGradient=0]="PreDefinedGradient",i[i.UserDefinedGradient=1]="UserDefinedGradient",i))(To||{});const Er=class Er extends gt{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new ts,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0,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._patternName.toUpperCase()==="SOLID"}set isSolidFill(t){this._isSolidFill=t}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}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._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}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(),s=[],n=(r,a)=>{if(r.index>=0&&a%2===0){const o=new ts;o.add(t[r.index]),r.children.forEach(l=>{l.index>=0&&o.add(t[l.index])}),s.push(o)}r.children.forEach(o=>n(o,a+1))};return e.children.forEach(r=>n(r,0)),s.length>0?s:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,s)=>e+s.area,0)}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new C;const e=new C;return t.forEach(s=>{const n=s.box;e.union(new C({x:n.min.x,y:n.min.y,z:this._elevation},{x:n.max.x,y:n.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:vs[0],value:0},{label:vs[1],value:1},{label:vs[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}}}]},{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.getCalculatedAreaValue()}}]}]}}subWorldDraw(t){const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,definitionLines:this.definitionLines,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 s=this.buildAreasFromLoops();if(s.length===0)return t.area(this._geo);if(s.length===1)return t.area(s[0]);const n=s.map(r=>t.area(r));return t.group(n)}transformBy(t){const e=t.elements,s=new Us(e[0],e[4],e[12],e[1],e[5],e[13],0,0,1);this._geo.transform(s),this._elevation=new w(0,0,this._elevation).applyMatrix4(t).z;const n=new w(1,0,0).applyMatrix4(t),r=new w().applyMatrix4(t),a=new w(n).sub(r);if(a.length()>0){const o=Math.atan2(a.y,a.x);this._patternAngle+=o,this._gradientAngle+=o,this._patternScale*=a.length()}return this}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops;return 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,this.patternName||(this.isSolidFill?"SOLID":"USER")),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,0),t.writeInt16(91,e.length),e.forEach((s,n)=>{const r=n===0;if(s instanceof Mt){const a=s.vertices,o=a.some(c=>(c.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,o?1:0),t.writeInt16(73,s.closed?1:0),t.writeInt16(93,a.length);for(const c of a)t.writePoint2d(10,c),o&&t.writeDouble(42,c.bulge??0);t.writeInt16(97,0);return}if(s instanceof Fs){const a=r?1:0;t.writeInt16(92,a),t.writeInt16(93,s.numberOfEdges);for(const o of s.curves){if(o instanceof Vt){t.writeInt16(72,1),t.writePoint2d(10,o.startPoint),t.writePoint2d(11,o.endPoint);continue}if(o instanceof ye){t.writeInt16(72,2),t.writePoint2d(10,o.center),t.writeDouble(40,o.radius),t.writeAngle(50,o.startAngle),t.writeAngle(51,o.endAngle),t.writeInt16(73,o.clockwise?0:1);continue}if(o instanceof Bs){t.writeInt16(72,3),t.writePoint2d(10,o.center);const l=new k(o.majorAxisRadius*Math.cos(o.rotation),o.majorAxisRadius*Math.sin(o.rotation));t.writePoint2d(11,l);const c=o.majorAxisRadius===0?0:o.minorAxisRadius/o.majorAxisRadius;t.writeDouble(40,c),t.writeAngle(50,o.startAngle),t.writeAngle(51,o.endAngle),t.writeInt16(73,o.clockwise?0:1);continue}if(o instanceof Dt){const l=o.knots,c=o.controlPoints,u=o.weights,d=o.fitPoints,g=u.some(p=>p!==1);t.writeInt16(72,4),t.writeInt16(94,o.degree),t.writeInt16(73,g?1:0),t.writeInt16(74,o.closed?1:0),t.writeInt16(95,l.length),t.writeInt16(96,c.length),l.forEach(p=>t.writeDouble(40,p)),c.forEach((p,m)=>{t.writePoint2d(10,p),g&&t.writeDouble(42,u[m]??1)}),t.writeInt16(97,(d==null?void 0:d.length)??0),d==null||d.forEach(p=>t.writePoint2d(11,p))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,this.patternAngle),t.writeDouble(41,this.patternScale),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(s=>{t.writeAngle(53,s.angle),t.writePoint2d(43,s.base),t.writePoint2d(45,s.offset),t.writeInt16(79,s.dashLengths.length),s.dashLengths.forEach(n=>t.writeDouble(49,n))}),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}};Er.typeName="Hatch";let Rs=Er;var Mo=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(Mo||{});const Ar=class Ar 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._annoType=3}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 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}appendVertex(t){this._vertices.push(new w().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new C().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._splineGeo?(this._splineGeo.transform(t),this._updated=!1):this._updated=!0,this}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Dt(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.annoType),t.writeInt16(73,this.hasHookLine?1:0),t.writeInt16(74,this.isSplined?1:0),t.writeInt16(76,this.numVertices);for(const e of this.vertices)t.writePoint3d(10,e);return this}};Ar.typeName="Leader";let Li=Ar;var z=(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))(z||{});function Ql(i){let t=0;for(const e of i)t|=1<<e-1;return t}function Jl(i){const t=[];for(const e of Object.values(z)){if(typeof e!="number")continue;const s=1<<e-1;i&s&&t.push(e)}return t}function tc(i,t){return i^1<<t-1}function ec(i,t){return(i&1<<t-1)!==0}function sc(i,t){return i|1<<t-1}function ic(i,t){return i&~(1<<t-1)}const Tr=class Tr extends rt{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new _e(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 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}subGetOsnapPoints(t,e,s,n){const r=this.startPoint,a=this.endPoint;switch(t){case z.EndPoint:n.push(r),n.push(a);break;case z.MidPoint:n.push(this.midPoint);break;case z.Nearest:{const o=this._geo.project(e);n.push(o)}break;case z.Perpendicular:{const o=this._geo.perpPoint(e);n.push(o)}break;case z.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,s=this.endPoint,n=[new w(e.x,e.y,0),new w(s.x,s.y,0)];return t.lines(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}};Tr.typeName="Line";let zs=Tr;const Mr=class Mr extends gt{get dxfTypeName(){return"MTEXT"}constructor(){super(),this._contents="",this._height=0,this._width=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 w,this._attachmentPoint=ot.TopLeft,this._direction=new b(1,0,0),this._drawingDirection=ae.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 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(){return new C}subGetOsnapPoints(t,e,s,n){z.Insertion===t&&n.push(this._location)}transformBy(t){const e=this._location.clone(),s=this._direction.lengthSq()>0?this._direction.clone().normalize():new b(Math.cos(this._rotation),Math.sin(this._rotation),0),n=new b(-s.y,s.x,s.z);n.lengthSq()===0&&n.set(0,1,0),n.normalize();const r=e.clone().add(s),a=e.clone().add(n);e.applyMatrix4(t),r.applyMatrix4(t),a.applyMatrix4(t);const o=new b(r).sub(e),l=new b(a).sub(e),c=o.length(),u=l.length();return this._location.copy(e),c>0&&(this._direction.copy(o).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=c),u>0&&(this._height*=u),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:ot[1],value:1},{label:ot[2],value:2},{label:ot[3],value:3},{label:ot[4],value:4},{label:ot[5],value:5},{label:ot[6],value:6},{label:ot[7],value:7},{label:ot[8],value:8},{label:ot[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:ae[1],value:1},{label:ae[2],value:2},{label:ae[3],value:3},{label:ae[4],value:4},{label:ae[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,e=t.getAt(this.styleName)??t.getAt(this.database.textstyle)??t.getAt(tt);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}subWorldDraw(t,e){const s={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(s,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),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}};Mr.typeName="MText";let Vs=Mr;const vr=class vr extends rt{get dxfTypeName(){return"SPLINE"}constructor(t,e,s,n,r){super(),this.rebuild(t,e,s,n,r)}rebuild(t,e,s,n,r){const a=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(n!==void 0)+ +(r!==void 0);if(a<2||a>5)throw yt.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Dt(t,e,s,n):this._geo=new Dt(t,e,s,n,r)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(this._geo.startPoint),n.push(this._geo.endPoint);break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var s;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,((s=e.fitPoints)==null?void 0:s.length)??0);for(const n of e.knots)t.writeDouble(40,n);for(const n of e.weights)t.writeDouble(41,n);for(const n of e.controlPoints)t.writePoint3d(10,n);for(const n of e.fitPoints??[])t.writePoint3d(11,n);return this}};vr.typeName="Spline";let Ds=vr;const nc=new b,kr=class kr extends Ge{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,s){super(t),this._attachmentPoint=ot.TopLeft,this._numColumns=s,this._numRows=e,this._columnWidth=new Array(s),this._rowHeight=new Array(e),this._cells=new Array(e*s)}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,s){var r;const n=t*this._numColumns+e;return(r=this._cells[n])==null?void 0:r.text}setTextString(t,e,s){const n=t*this._numColumns+e;if(!this._cells[n]){this._cells[n]={text:s,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[n].text=s}isEmpty(t,e){var n;const s=t*this._numColumns+e;return!((n=this._cells[s])!=null&&n.text)}get geometricExtents(){return new C}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(!this.hasRenderableCellContent()&&e&&e.newIterator().count>0){const p=this.drawAnonymousTableBlock(t,e);if(p)return p}let s=0,n=0;const r=new Uint16Array(this.numColumns*this.numRows*8),a=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let o=0;for(let p=0;p<=this.numRows;p++){s-=p>0?this.rowHeight(p-1):0,n=0;for(let m=0;m<=this.numColumns;m++)n+=m>0?this.columnWidth(m-1):0,a[o++]=n,a[o++]=s,a[o++]=0}const l=[],c=new Array(this.numRows*this.numColumns).fill(!1);n=0,o=0;let u=0;for(let p=0;p<this.numColumns;p++){n+=p>0?this.columnWidth(p-1):0,s=0;for(let m=0;m<this.numRows;m++){s+=m>0?this.rowHeight(m-1):0;const y=this.cell(m*this.numColumns+p);if(u=m*this.numColumns+p,y&&!c[u]){const x=y.borderWidth??1,f=y.borderHeight??1;this.fillVisited(c,u,this.numColumns,x,f),r[o++]=p+m*(this.numColumns+1),r[o++]=p+m*(this.numColumns+1)+x;const P=a[r[o-1]*3]-n,I=p+(m+f)*(this.numColumns+1)+x;p+x==this.numColumns&&(r[o++]=p+m*(this.numColumns+1)+x,r[o++]=I);const M=-a[I*3+1]-s;if(m+f==this.numRows&&(r[o++]=p+(m+f)*(this.numColumns+1)+f,r[o++]=p+(m+f)*(this.numColumns+1)),r[o++]=p+(m+f)*(this.numColumns+1),r[o++]=p+m*(this.numColumns+1),y.text){const A=y.attachmentPoint||this.attachmentPoint||ot.MiddleCenter,j=this.getTableTextOffset(A,P,M),T={text:y.text,height:this.getCellTextHeight(y,M),width:P,position:nc.set(n,-s,0).clone().add(j),rotation:this.rotation,attachmentPoint:A},X=this.getTextStyle(y);l.push(t.mtext(T,X))}}}}l.push(t.lineSegments(a,3,r));const d=t.group(l),g=new Ue;return g.setFromAxisAngle(b.Z_AXIS,this.rotation),hi.compose(this.position,g,this.scaleFactors),d.applyMatrix(hi),d}hasRenderableCellContent(){return this._cells.some(t=>!!t&&(!!t.text||!!t.blockTableRecordId))}drawAnonymousTableBlock(t,e){const s=[],n=e.newIterator();for(const o of n){let l;o.color.isByBlock&&this.rgbColor?(la.copy(o.color),o.color.setRGBValue(this.rgbColor),l=o.worldDraw(t),o.color.copy(la)):l=o.worldDraw(t),l&&(l.objectId=this.objectId,l.ownerId=this.ownerId,l.layerName=this.layer,l.visible=this.visibility&&o.visibility,s.push(l))}const r=t.group(s);r.applyMatrix(this.blockTransform);const a=this.normal;return a&&(a.x!==0||a.y!==0||a.z!==1)&&(hi.setFromExtrusionDirection(a),r.applyMatrix(hi)),r}fillVisited(t,e,s,n,r){if(r==1&&n==1)t[e]=!0;else for(let a=0;a<n;++a)for(let o=0;o<r;++o)t[e+a+o*s]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable,s=(t.textStyle?e.getAt(t.textStyle):void 0)??e.getAt(this.database.textstyle)??e.getAt(tt);if(!s)throw new Error("No valid text style found in text style table.");return s.textStyle}getTableTextOffset(t,e,s){const n=new b;switch(t){case 1:break;case 2:n.setX(e/2);break;case 3:n.setX(e);break;case 4:n.setY(-s/2);break;case 5:n.set(e/2,-s/2,0);break;case 6:n.set(e,-s/2,0);break;case 7:n.setY(-s);break;case 8:n.set(e/2,-s,0);break;case 9:n.set(e,-s,0);break}return n}getCellTextHeight(t,e){return t.textHeight&&t.textHeight>0?t.textHeight:Math.max(e/2,1)}dxfOutFields(t){var r,a,o,l,c,u,d;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((r=t.database)==null?void 0:r.version)??((a=this.database)==null?void 0:a.version),s=(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 n=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let g=0;g<n;g++){const p=this._cells[g],m=(p==null?void 0:p.cellType)??(p!=null&&p.blockTableRecordId?2:1);if(t.writeInt16(171,m),t.writeInt16(172,(p==null?void 0:p.flagValue)??0),t.writeInt16(173,(p==null?void 0:p.mergedValue)??0),t.writeBoolean(174,p==null?void 0:p.autoFit),t.writeInt16(175,p==null?void 0:p.borderWidth),t.writeInt16(176,p==null?void 0:p.borderHeight),(p==null?void 0:p.overrideFlag)!=null&&(s?t.writeInt32(91,p.overrideFlag):t.writeInt16(177,p.overrideFlag)),t.writeInt16(178,p==null?void 0:p.virtualEdgeFlag),t.writeAngle(145,p==null?void 0:p.rotation),s&&t.writeInt16(92,p==null?void 0:p.extendedCellFlags),m===1)p!=null&&p.fieldObjetId?t.writeObjectId(344,p.fieldObjetId):this.writeCellText(t,(p==null?void 0:p.text)??"",s,p==null?void 0:p.cellValueBlockBegin);else if(m===2){if(t.writeObjectId(340,p==null?void 0:p.blockTableRecordId),t.writeDouble(144,p==null?void 0:p.blockScale),t.writeInt16(179,p==null?void 0:p.blockAttrNum),(o=p==null?void 0:p.attrDefineId)!=null&&o.length)for(const y of p.attrDefineId)t.writeObjectId(331,y);if((p==null?void 0:p.attrText)!=null)if(Array.isArray(p.attrText))for(const y of p.attrText)t.writeString(300,y);else t.writeString(300,p.attrText)}p!=null&&p.textStyle&&t.writeString(7,p.textStyle),(p==null?void 0:p.textHeight)!=null&&t.writeDouble(140,p.textHeight),(p==null?void 0:p.attachmentPoint)!=null&&t.writeInt16(170,p.attachmentPoint),(p==null?void 0:p.topBorderVisibility)!=null&&t.writeInt16(289,p.topBorderVisibility?1:0),(p==null?void 0:p.rightBorderVisibility)!=null&&t.writeInt16(285,p.rightBorderVisibility?1:0),(p==null?void 0:p.bottomBorderVisibility)!=null&&t.writeInt16(286,p.bottomBorderVisibility?1:0),(p==null?void 0:p.leftBorderVisibility)!=null&&t.writeInt16(288,p.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 p=g.borderLineweights;p&&(t.writeInt16(274,p.top),t.writeInt16(275,p.right),t.writeInt16(276,p.bottom),t.writeInt16(277,p.left),t.writeInt16(278,p.insideHorizontal),t.writeInt16(279,p.insideVertical));const m=g.borderVisibility;m&&(t.writeInt16(284,m.top?1:0),t.writeInt16(285,m.right?1:0),t.writeInt16(286,m.bottom?1:0),t.writeInt16(287,m.left?1:0),t.writeInt16(288,m.insideHorizontal?1:0),t.writeInt16(289,m.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)),(c=this.rowDataTypes)!=null&&c.length)for(const g of this.rowDataTypes)t.writeInt16(97,g);if((u=this.rowUnitTypes)!=null&&u.length)for(const g of this.rowUnitTypes)t.writeInt16(98,g);if((d=this.rowFormats)!=null&&d.length)for(const g of this.rowFormats)t.writeString(4,g);return this}writeCellText(t,e,s,n){if(!s){if(e.length<=250){t.writeString(1,e);return}const o=Math.ceil(e.length/250);for(let l=0;l<o;l++){const c=l*250,u=c+250,d=e.slice(c,u);l===o-1?t.writeString(1,d):t.writeString(2,d)}return}if(t.writeString(301,n??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const a=Math.ceil(e.length/250);for(let o=0;o<a;o++){const l=o*250,c=l+250,u=e.slice(l,c);o===a-1?t.writeString(302,u):t.writeString(303,u)}t.writeString(304,"ACVALUE_END")}};kr.typeName="Table";let Oi=kr;const hi=new G,la=new Q,Lr=class Lr extends rt{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new w,new w,new w,new w]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}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 C().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(...this._vertices);break}}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._elevation=this._vertices[0].z,this}subWorldDraw(t){const e=new Mt(this._vertices,!0),s=new ts;s.add(e);const n=t.subEntityTraits;return n.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),t.writeDouble(38,this.elevation),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}};Lr.typeName="Trace";let Ni=Lr;const Or=class Or extends rt{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new Mt}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,s=0,n=-1,r=-1){const a=n<0?void 0:n,o=r<0?void 0:r,l={x:e.x,y:e.y,bulge:s,startWidth:a,endWidth:o};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 w(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new C({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 t}subGetOsnapPoints(t,e,s,n){const r=new Array;for(let a=0;a<this.numberOfVertices;++a)r.push(this.getPoint3dAt(a));switch(t){case z.EndPoint:n.push(...r);break}}transformBy(t){const e=t.determinant()<0;let s=this._elevation;return this._geo.vertices.forEach(n=>{const r=new w(n.x,n.y,this._elevation).applyMatrix4(t);n.x=r.x,n.y=r.y,s=r.z,e&&n.bulge!=null&&(n.bulge=-n.bulge)}),this._elevation=s,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),s=this.createWidthProfile();if(s!=null){const r=rc(s,this.closed);if(r!=null){const a=t.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(r)}}const n=[];return e.forEach(r=>n.push(new w().set(r.x,r.y,this.elevation))),t.lines(n)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0),t.writeDouble(38,this.elevation);for(let e=0;e<this.numberOfVertices;++e)t.writePoint2d(10,this.getPoint2dAt(e));return this}createWidthProfile(){const t=this._geo.vertices,e=t.length;if(e<2)return null;const s=this.closed?e:e-1,n=[];let r=!1;for(let a=0;a<s;a++){const o=t[a],l=t[(a+1)%e],c=Math.max(0,o.startWidth??0),u=Math.max(0,o.endWidth??0);(c>Tt||u>Tt)&&(r=!0);const d=this.sampleSegment(o,l),g=d.length-1;for(let p=0;p<=g;p++){if(p===0&&n.length>0||this.closed&&a===s-1&&p===g)continue;const m=g>0?p/g:0;n.push({x:d[p].x,y:d[p].y,width:lc(c,u,m)})}}return r&&n.length>=2?n:null}sampleSegment(t,e){if(t.bulge&&Math.abs(t.bulge)>Tt){const n=new ye(t,e,t.bulge).getPoints(32);if(n.length>1)return n.map(r=>new k(r.x,r.y))}return[new k(t.x,t.y),new k(e.x,e.y)]}};Or.typeName="Polyline";let Ci=Or;const Tt=1e-6,ca=4;function rc(i,t){if(i.length<2)return null;const e=oc(i,t);if(e.length<2)return null;const{left:s,right:n}=ac(e,t);if(s.length<2||n.length<2)return null;const r=new ts;if(t){if(!dn(s)||!dn(n))return null;const o=Math.abs(Nn(s)),l=Math.abs(Nn(n)),[c,u]=o>=l?[s,n]:[n,s];return r.add(new Mt(c,!0)),r.add(new Mt(u,!0)),r}const a=[...s,...n.reverse()];return dn(a)?(r.add(new Mt(a,!0)),r):null}function ac(i,t){const e=[],s=[];for(let n=0;n<i.length;n++){const r=i[n],a=Math.max(0,r.width)/2;if(a<=Tt)continue;const o=hc(i,n,t);o!=null&&(e.push({x:r.x+o.x*a,y:r.y+o.y*a}),s.push({x:r.x-o.x*a,y:r.y-o.y*a}))}return{left:e,right:s}}function oc(i,t){const e=[];if(i.forEach(s=>{const n=e[e.length-1];(!n||Math.abs(n.x-s.x)>Tt||Math.abs(n.y-s.y)>Tt||Math.abs(n.width-s.width)>Tt)&&e.push(s)}),t&&e.length>1){const s=e[0],n=e[e.length-1];Math.abs(s.x-n.x)<=Tt&&Math.abs(s.y-n.y)<=Tt&&e.pop()}return e}function hc(i,t,e){const s=i.length,n=i[t],r=i[(t-1+s)%s],a=i[(t+1)%s];let o=da(n.x-r.x,n.y-r.y),l=da(a.x-n.x,a.y-n.y);if(e||(t===0&&(o=l),t===s-1&&(l=o)),o==null&&l==null)return null;if(o==null)return li(l);if(l==null)return li(o);const c=li(o),u=li(l),d=c.x+u.x,g=c.y+u.y,p=Math.hypot(d,g);if(p<=Tt)return u;const m={x:d/p,y:g/p},y=Math.abs(m.x*u.x+m.y*u.y),x=y<=Tt?ca:Math.min(1/y,ca);return{x:m.x*x,y:m.y*x}}function da(i,t){const e=Math.hypot(i,t);return e<=Tt?null:{x:i/e,y:t/e}}function li(i){return{x:-i.y,y:i.x}}function Nn(i){let t=0;const e=i.length;for(let s=0;s<e;s++){const n=i[s],r=i[(s+1)%e];t+=n.x*r.y-r.x*n.y}return t/2}function dn(i){return i.length>=3&&Math.abs(Nn(i))>Tt}function lc(i,t,e){return i+(t-i)*e}const Nr=class Nr extends gt{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new w}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new C().expandByPoint(this._geo)}subGetOsnapPoints(t,e,s,n){z.Node===t&&n.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}};Nr.typeName="Point";let Bi=Nr;var vo=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(vo||{}),ko=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(ko||{});const Cr=class Cr extends gt{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new w,this._scale=new Y(1,1),this._rotation=0,this._imageSize=new k,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 C;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()}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,s=this._height*this._scale.y,n=new b(e*Math.cos(this._rotation),e*Math.sin(this._rotation),0),r=new b(-s*Math.sin(this._rotation),s*Math.cos(this._rotation),0),a=this._position.clone(),o=this._position.clone().add(n),l=this._position.clone().add(r);a.applyMatrix4(t),o.applyMatrix4(t),l.applyMatrix4(t);const c=new b(o).sub(a),u=new b(l).sub(a);return this._position.copy(a),this._rotation=Math.atan2(c.y,c.x),this._width=c.length(),this._height=u.length(),this._scale.set(1,1),this}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,s=this._height,n=new pt;n.setFromPoints(this._clipBoundary);const r=new k;r.setX(this._position.x-n.min.x*e),r.setY(this._position.y-n.min.y*s),this._clipBoundary.forEach(a=>{const o=a.x*e+r.x,l=a.y*s+r.y;t.push(new w(o,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){ua.copy(t[1]);for(let e=1;e<4;e++)ci.copy(t[e]),ci.rotateAround(ua,this._rotation),t[e].setX(ci.x),t[e].setY(ci.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,s=this.height*this.scale.y,n=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:s},r=n.x>0?e/n.x:e,a=n.y>0?s/n.y:s,o=Math.cos(this._rotation),l=Math.sin(this._rotation);t.writePoint3d(11,{x:r*o,y:r*l,z:0}),t.writePoint3d(12,{x:-a*l,y:a*o,z:0}),t.writePoint2d(13,n),t.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,c),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 u of this.clipBoundary)t.writePoint2d(14,u)}return this}};Cr.typeName="RasterImage";let js=Cr;const ua=new k,ci=new k,Br=class Br extends rt{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new w,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 geometricExtents(){const t=new C;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}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:n.push(this.basePoint);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}};Br.typeName="Ray";let Fi=Br;const Fr=class Fr extends gt{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new w,this._height=0,this._width=0,this._viewCenter=new w,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(){return new C}transformBy(t){const e=this._centerPoint.clone(),s=this._centerPoint.clone().add(new b(this._width,0,0)),n=this._centerPoint.clone().add(new b(0,this._height,0));e.applyMatrix4(t),s.applyMatrix4(t),n.applyMatrix4(t);const r=new b(s).sub(e),a=new b(n).sub(e),o=this._height!==0?a.length()/this._height:1;return this._centerPoint.copy(e),this._width=r.length(),this._height=a.length(),this._viewHeight*=o,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 fo;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 s=[];return s.push(e.lines([new w(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new w(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),s.push(e.lines([new w(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new w(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),s.push(e.lines([new w(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new w(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),s.push(e.lines([new w(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new w(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),s}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}};Fr.typeName="Viewport";let Ri=Fr;const Rr=class Rr extends js{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),s=new ts;return s.add(new Mt(e)),t.area(s)}dxfOutFields(t){return super.dxfOutFields(t),this}};Rr.typeName="Wipeout";let zi=Rr;const zr=class zr extends rt{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new w,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 geometricExtents(){const t=new C;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}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}};zr.typeName="Xline";let Vi=zr;class Lo{constructor(t){this.position=new w(t.x,t.y,t.z||0)}}const Vr=class Vr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,s,n=!1,r=!1){super(),this._mCount=t,this._nCount=e,this._closedM=n,this._closedN=r,this._vertices=s.map(a=>new Lo(a))}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}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 s=t*this._nCount+e;return this.getVertexAt(s)}get geometricExtents(){if(this._vertices.length===0)return new C(new w(0,0,0),new w(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,s=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{t=Math.min(t,o.position.x),e=Math.min(e,o.position.y),s=Math.min(s,o.position.z),n=Math.max(n,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new C(new w(t,e,s),new w(n,r,a))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:this._vertices.forEach(r=>{n.push(r.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 s=0;s<this._mCount;s++)for(let n=0;n<this._nCount;n++){const r=this.getVertexAtMN(s,n);let a=n+1;if(a>=this._nCount)if(this._closedN)a=0;else continue;const o=this.getVertexAtMN(s,a);e.push(r.position),e.push(o.position)}for(let s=0;s<this._nCount;s++)for(let n=0;n<this._mCount;n++){const r=this.getVertexAtMN(n,s);let a=n+1;if(a>=this._mCount)if(this._closedM)a=0;else continue;const o=this.getVertexAtMN(a,s);e.push(r.position),e.push(o.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 s=0;s<this.numberOfVertices;s++){const n=this.getVertexAt(s);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,n.position),t.writeInt16(70,16)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}};Vr.typeName="PolygonMesh";let Di=Vr;class Oo{constructor(t){this.position=new w(t.x,t.y,t.z||0)}}class No{constructor(t){this.vertexIndices=t}}const Dr=class Dr extends rt{get dxfTypeName(){return"POLYLINE"}constructor(t,e){super(),this._vertices=t.map(s=>new Oo(s)),this._faces=e.map(s=>new No(s))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}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 C(new w(0,0,0),new w(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,s=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{t=Math.min(t,o.position.x),e=Math.min(e,o.position.y),s=Math.min(s,o.position.z),n=Math.max(n,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new C(new w(t,e,s),new w(n,r,a))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subGetOsnapPoints(t,e,s,n){switch(t){case z.EndPoint:this._vertices.forEach(r=>{n.push(r.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(s=>{const n=[];if(s.vertexIndices.forEach(r=>{const a=Math.abs(r)-1;a>=0&&a<this._vertices.length&&n.push(this._vertices[a].position)}),n.length>=3)for(let r=0;r<n.length;r++){const a=n[r],o=n[(r+1)%n.length];e.push(a),e.push(o)}}),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 s=0;s<this.numberOfVertices;s++){const n=this.getVertexAt(s);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,n.position),t.writeInt16(70,64)}for(let s=0;s<this.numberOfFaces;s++){const n=this.getFaceAt(s);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),n.vertexIndices.forEach((r,a)=>{t.writeInt32(10+a,r)})}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}};Dr.typeName="PolyFaceMesh";let ji=Dr;var Wi=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(Wi||{});const jr=class jr extends gt{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new w,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new w,this._textRotation=0,this._normal=new b(0,0,1)}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 He),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(),s=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),e.applyMatrix4(t),s.applyMatrix4(t);const n=new b(s).sub(e);return n.lengthSq()>0&&(this._textRotation=Math.atan2(n.y,n.x)),this.subTransformBy(t),this}subGetOsnapPoints(t,e,s,n,r){const a=this.getDimBlockTableRecord();if(!a)return;const o=this.getFullDimBlockTransform(),l=new w(e).applyMatrix4(o.clone().invert()),c=new w(s).applyMatrix4(o.clone().invert()),u=(d,g)=>{const p=[];d.subGetOsnapPoints(t,l,c,p,g,o),d instanceof Ge?p.forEach(m=>n.push(m.clone())):p.forEach(m=>n.push(new w(m).applyMatrix4(o)))};if(r){const d=a.getIdAt(r);if(d&&(u(d,r),n.length>0))return}for(const d of a.newIterator())u(d)}subWorldDraw(t){const e=this.getDimBlockTableRecord();if(e){const n=this.computeDimBlockTransform();return ss.instance.draw(t,e,this.rgbColor,[],!1,n,this._normal)}return t.group([])}getDimBlockGeometricExtents(){const t=new C,e=this.getDimBlockTableRecord();if(!e)return t;for(const s of e.newIterator())t.union(s.geometricExtents);return t.applyMatrix4(this.getFullDimBlockTransform()),t}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:Wi[1],value:1},{label:Wi[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(t,e,s,n,r){return{name:t,type:e,editable:n!=null,options:r,accessor:n?{get:s,set:n}:{get:s}}}createPoint3dProperties(t,e){return[this.createProperty(`${t}X`,"float",()=>e().x,s=>{e().x=s}),this.createProperty(`${t}Y`,"float",()=>e().y,s=>{e().y=s}),this.createProperty(`${t}Z`,"float",()=>e().z,s=>{e().z=s})]}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 G().setFromExtrusionDirection(this._normal);return new G().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}getLineArrowStyle(t){}findPointOnLine1(t,e,s){const n=new w().subVectors(e,t).normalize();return new w(e).addScaledVector(n,s)}findPointOnLine2(t,e,s){const n=t.x+s*Math.cos(e),r=t.y+s*Math.sin(e);return{x:n,y:r}}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():tr.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??w.ORIGIN,s=new G().makeTranslation(-e.x,-e.y,-e.z),n=new G().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new G().multiplyMatrices(n,s)}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}};jr.typeName="Dimension";let oe=jr;const Wr=class Wr extends oe{constructor(t,e,s,n,r=null,a=null){super(),this._centerPoint=new w().copy(t),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(s),this._arcPoint=new w().copy(n),this.dimensionText=r,this.dimensionStyleName=a}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)]}]}}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return new C}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}};Wr.typeName="3PointAngularDimension";let Gi=Wr;const Gr=class Gr extends oe{constructor(t,e,s,n=null,r=null){super(),this._dimLinePoint=new w().copy(s),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),n?this.dimensionText=n:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=r}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})]}]}}subTransformBy(t){this._dimLinePoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t),this.calculateRotation()}get geometricExtents(){return this.getDimBlockGeometricExtents()}get isAppendArrow(){return!1}createDimBlock(t){const e=new K;e.name=t;const s=this.createLines();s.forEach(o=>e.appendEntity(new zs(o.startPoint,o.endPoint))),this.createArrows(s[0]).forEach(o=>e.appendEntity(o));const r=s[0].midPoint,a=this.createMText(r,this._rotation);return a&&e.appendEntity(a),e}createMText(t,e){const s=n=>({x:Math.cos(n),y:Math.sin(n),z:0});if(this.dimensionText){const n=new Vs;return n.attachmentPoint=ot.MiddleLeft,n.layer="0",n.color=new Q(E.ByBlock),n.location=t,n.contents=this.dimensionText??"",n.height=10,n.direction=s(e),n.styleName=this.dimensionStyle.dimtxsty,n}}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,s){const n="_CAXARROW",r=new Ge(n);return r.position=t,r.rotation=e,r.scaleFactors={x:s,y:s,z:s},r}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),n=this.findIntersectionPoint(e,this._dimLinePoint),r=this.findIntersectionPoint(s,this._dimLinePoint),a=new _e(n,r);return t.push(a),e.endPoint=n,this.adjustExtensionLine(e),t.push(e),s.endPoint=r,this.adjustExtensionLine(s),t.push(s),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,s=this.findPointOnLine2(t,e,100);return new _e(t,{...s,z:t.z})}findIntersectionPoint(t,e){const s=t.startPoint,n=t.endPoint,r=new b().subVectors(n,s).normalize(),o=new b().subVectors(e,s).dot(r),l=new b().copy(r).multiplyScalar(o);return new b().addVectors(s,l)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,s=e.x-t.x,n=e.y-t.y;this._rotation=Math.atan2(n,s)}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}};Gr.typeName="AlignedDimension";let Ws=Gr;const Hr=class Hr extends oe{constructor(t,e,s,n,r=null,a=null){super(),this._arcPoint=new w().copy(n),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(s),this._centerPoint=new w().copy(t),this.dimensionText=r,this.dimensionStyleName=a}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)]}]}}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return new C}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}};Hr.typeName="ArcDimension";let Cn=Hr;const Ur=class Ur extends oe{constructor(t,e,s=0,n=null,r=null){super(),this._chordPoint=new w().copy(t),this._farChordPoint=new w().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=n,this.dimensionStyleName=r}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})]}]}}subTransformBy(t){this._chordPoint.applyMatrix4(t),this._farChordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){return new C}drawLines(t,e){const s=[],n=e.length;return n==1?s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):n==3?(this.sortLines(e),s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(t,e[1])),s.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(r=>{s.push(this.drawLine(t,r))}),s}drawLine(t,e,s){if(s){const n=[e.startPoint,e.endPoint];return t.lines(n)}else return e.worldDraw(t)}sortLines(t){const e=(s,n)=>s.x!==n.x?s.x-n.x:s.y!==n.y?s.y-n.y:s.z-n.z;t.sort((s,n)=>{const r=e(s.startPoint,n.startPoint);return r!==0?r:e(s.endPoint,n.endPoint)})}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}};Ur.typeName="DiametricDimension";let Hi=Ur;const Xr=class Xr extends oe{constructor(t,e,s=null,n=null){super(),this._definingPoint=new w().copy(t),this._leaderEndPoint=new w().copy(e),this.dimensionText=s,this.dimensionStyleName=n}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)]}]}}subTransformBy(t){this._definingPoint.applyMatrix4(t),this._leaderEndPoint.applyMatrix4(t)}get geometricExtents(){return new C}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};Xr.typeName="OrdinateDimension";let Ui=Xr;const Yr=class Yr extends oe{constructor(t,e,s,n=null,r=null){super(),this._center=new w().copy(t),this._chordPoint=new w().copy(e),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=n,this.dimensionStyleName=r}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})]}]}}subTransformBy(t){this._center.applyMatrix4(t),this._chordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){return new C}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}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}};Yr.typeName="RadialDimension";let Xi=Yr;const $r=class $r extends Ws{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};$r.typeName="RotatedDimension";let Yi=$r;var Co=(i=>(i[i.kInches=0]="kInches",i[i.kMillimeters=1]="kMillimeters",i[i.kPixels=2]="kPixels",i))(Co||{}),Bo=(i=>(i[i.k0degrees=0]="k0degrees",i[i.k90degrees=1]="k90degrees",i[i.k180degrees=2]="k180degrees",i[i.k270degrees=3]="k270degrees",i))(Bo||{}),Fo=(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))(Fo||{}),pe=(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))(pe||{}),qe=(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))(qe||{}),Ro=(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))(Ro||{});const cc={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 zo extends he{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new k,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new k,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new pt,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 cc[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 qs extends zo{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new pt,this._extents=new C,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 Zs{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){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 ks extends he{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,s=>this.hasId(s)),this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,n)=>{s===e&&(this._recordsByName.delete(n),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:n}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new Zs(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,s]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,s.objectId);return this}}class Vo extends ks{getBtrIdAt(t){for(const[e,s]of this._recordsByName)if(s.blockTableRecordId==t)return s}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class xe extends he{constructor(t,e){t=t||{},Hs(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var Do=(i=>(i[i.Any=0]="Any",i[i.Uniform=1]="Uniform",i))(Do||{});const ge=class ge extends xe{static isModelSapceName(t){return t.toLowerCase()==ge.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(ge.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new w,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return ge.isModelSapceName(this.name)}get isPaperSapce(){return ge.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(t){this._blockInsertUnits=t}get explodability(){return this._explodability}set explodability(t){this._explodability=t}get blockScaling(){return this._blockScaling}set blockScaling(t){this._blockScaling=t}get bmpPreview(){return this._bmpPreview}set bmpPreview(t){this._bmpPreview=t}appendEntity(t){const e=s=>{s.database=this.database,s.ownerId=this.objectId,this.database.commitObjectHandle(s,n=>this._entities.has(n)),s.resolveEffectiveProperties(),this._entities.set(s.objectId,s)};if(Array.isArray(t))for(let s=0;s<t.length;++s)e(t[s]);else e(t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],s=[];return e.forEach(n=>{const r=this._entities.get(n);r&&s.push(r),this._entities.delete(n)}),s.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:s}),s.length>0}newIterator(){return new Zs(this._entities)}getIdAt(t){return this._entities.get(t)}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,0),t.writePoint3d(10,this.origin),t.writeString(3,this.name),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}};ge.MODEL_SPACE_NAME="*Model_Space",ge.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let K=ge;class jo{constructor(){this.events={layoutCreated:new Z,layoutRemoved:new Z,layoutRenamed:new Z,layoutSwitched:new Z}}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 s=this.getWorkingDatabase(e),n=s.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(n,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),n=s.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(n,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),n=s.objects.layout.getAt(t);return this.setCurrentLayoutInternal(n,s)}renameLayout(t,e,s){const r=this.getWorkingDatabase(s).objects.layout.getAt(t);return r?(r.layoutName=e,this.events.layoutRenamed.dispatch({layout:r,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const s=this.getWorkingDatabase(e).objects.layout,n=s.getAt(t);let r=!1;return n&&(r=s.remove(t),r&&this.events.layoutRemoved.dispatch({layout:n})),r}createLayout(t,e){const s=this.getWorkingDatabase(e),n=new qs;n.layoutName=t,n.tabOrder=s.objects.layout.maxTabOrder;const r=new K;return r.name=`*Paper_Space${n.tabOrder}`,s.tables.blockTable.add(r),s.objects.layout.setAt(t,n),this.events.layoutCreated.dispatch({layout:n}),{layout:n,btr:r}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||zn().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}Ca(()=>new jo);class Wo extends he{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 Go=(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))(Go||{});class dc extends he{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 Ho{constructor(t){this.db=t}createDefaultLayer(){const t=new Q;return t.colorIndex=7,this.db.tables.layerTable.add(new tn({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new me({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new me({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new me({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new en({name:tt,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new He({name:tt,dimtxsty:tt}))}createDefaultLayout(){const t=new qs;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 Rs;e.patternName="SOLID";const s=new Fs;s.add(new Vt({x:0,y:0},{x:-1,y:.125})),s.add(new Vt({x:-1,y:.125},{x:-1,y:-.125})),s.add(new Vt({x:-1,y:-.125},{x:0,y:0})),e.add(s);const n=new K;n.name="_CAXARROW",n.appendEntity(e),this.db.tables.blockTable.add(n)}}}var Uo=(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))(Uo||{}),rr=(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))(rr||{});function uc(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function pc(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}class le extends he{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,s=>this.hasId(s));const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),s=this._recordsByName.get(e);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(e),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(this.normalizeName(e.name)),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new Zs(this._recordsByName)}normalizeName(t){return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.numEntries),this}}class Xo extends le{constructor(t){super(t)}get modelSpace(){let t=this.getAt(K.MODEL_SPACE_NAME);return t||(t=new K,t.name=K.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const s=e.getIdAt(t);if(s)return s}}removeEntity(t){let e=!1;for(const s of this.database.tables.blockTable.newIterator())if(s.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(K.isModelSapceName(t))e=K.MODEL_SPACE_NAME;else if(K.isPaperSapceName(t)){const s=K.PAPER_SPACE_NAME_PREFIX,n=t.substring(s.length);e=s+n}return e}}class Yo extends le{constructor(t){super(t)}}var $o=(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))($o||{}),qo=(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))(qo||{}),Zo=(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))(Zo||{}),Ko=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(Ko||{}),Qo=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(Qo||{});const Zi=class Zi extends xe{constructor(t,e){t=t||{},Hs(t,Zi.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),s=this.database.tables.blockTable.getAt(this.dimldrblk),n=this.database.tables.blockTable.getAt(this.dimblk),r=this.database.tables.blockTable.getAt(this.dimblk1),a=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,s==null?void 0:s.objectId),t.writeObjectId(342,n==null?void 0:n.objectId),t.writeObjectId(343,r==null?void 0:r.objectId),t.writeObjectId(344,a==null?void 0:a.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};Zi.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:tt,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let He=Zi;class Jo extends le{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class tn extends xe{constructor(t,e){t=t||{},Hs(t,{color:new Q,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new Qi,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}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 th extends le{constructor(t){super(t)}}class me extends xe{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}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._linetype.pattern[t].elementLength}toPreviewSvgString(t){const e=Math.max((t==null?void 0:t.width)??220,1),s=Math.max((t==null?void 0:t.height)??36,1),n=Math.min(Math.max((t==null?void 0:t.padding)??8,0),Math.floor(e/2)),r=Math.max((t==null?void 0:t.strokeWidth)??2,.5),a=this.escapeSvgAttribute((t==null?void 0:t.stroke)??"currentColor"),o=Math.max((t==null?void 0:t.repeats)??4,1),l=s/2,c=n,u=Math.max(e-n,c+1),d=u-c,g=this._linetype.pattern??[];if(g.length===0||this.patternLength<=0||!g.some(I=>I.elementLength!==0))return this.buildSvgString({width:e,height:s,stroke:a,strokeWidth:r,lineSegments:[[c,u]],dots:[],y:l});const p=[],m=[],y=d/(this.patternLength*o),x=.5,f=Math.max(r*2,2);let P=c;for(;P<u;)for(const I of g){if(P>=u)break;const M=I.elementLength;if(M===0){m.push(P),P=Math.min(P+f,u);continue}const A=Math.max(Math.abs(M)*y,x),j=Math.min(P+A,u);M>0&&j>P&&p.push([P,j]),P=j}return this.buildSvgString({width:e,height:s,stroke:a,strokeWidth:r,lineSegments:p,dots:m,y:l})}buildSvgString(t){const{width:e,height:s,stroke:n,strokeWidth:r,lineSegments:a,dots:o,y:l}=t,c=a.map(([d,g])=>`<line x1="${d.toFixed(2)}" y1="${l.toFixed(2)}" x2="${g.toFixed(2)}" y2="${l.toFixed(2)}" stroke="${n}" stroke-width="${r.toFixed(2)}" stroke-linecap="round" />`).join(""),u=o.map(d=>`<circle cx="${d.toFixed(2)}" cy="${l.toFixed(2)}" r="${(r/2).toFixed(2)}" fill="${n}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${s}" viewBox="0 0 ${e} ${s}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${c}${u}</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.linetype.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.linetype.pattern??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class eh extends le{constructor(t){super(t)}get fonts(){const t=new Set,e=n=>{if(n){const r=n.lastIndexOf(".");if(r>=0){const a=n.substring(0,r).toLowerCase();t.add(a)}else t.add(n.toLowerCase())}},s=this.newIterator();for(const n of s)e(n.fileName),e(n.bigFontFileName);return Array.from(t)}}class en extends xe{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.textStyle.standardFlag),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),t.writeDouble(42,this.priorSize),t.writeString(3,this.fileName),t.writeString(4,this.bigFontFileName),this}}class sh extends le{constructor(t){super(t)}}class ih extends le{constructor(t){super(t)}}const gc=()=>({center:new k,viewDirectionFromTarget:new w(0,0,1),viewTarget:new w(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:er.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new w(0,0,0),ucsXAxis:new w(1,0,0),ucsYAxis:new w(0,1,0),orthographicType:sr.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:ir.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class ar extends xe{constructor(){super(),this._gsView=gc(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.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}}class or extends ar{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new k(0,0),this._upperRightCorner=new k(1,1),this._snapBase=new k(0,0),this._snapAngle=0,this._snapSpacing=new k(0,0),this._standardFlag=0,this._gridSpacing=new k,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),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 nh extends le{constructor(t){super(t)}}class Bn extends xe{constructor(t){super(),this.name=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}const R={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",CECOLOR:"CECOLOR",CELTYPE:"CELTYPE",CELTSCALE:"CELTSCALE",CELWEIGHT:"CELWEIGHT",CLAYER:"CLAYER",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LWDISPLAY:"LWDISPLAY",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",OSMODE:"OSMODE",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",WHITEBKCOLOR:"WHITEBKCOLOR"},mc=Object.freeze(Object.values(R)),Ki=class Ki{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new Z},this.registerVar({name:R.CECOLOR,type:"color",isDbVar:!0,defaultValue:new Q(E.ByLayer)}),this.registerVar({name:R.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:R.CELTYPE,type:"string",isDbVar:!0,defaultValue:At}),this.registerVar({name:R.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:We.ByLayer}),this.registerVar({name:R.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:R.COLORTHEME,type:"number",isDbVar:!1,defaultValue:"0"}),this.registerVar({name:R.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:R.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:R.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:R.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new Q(E.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:R.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:R.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:R.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:R.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:tt}),this.registerVar({name:R.WHITEBKCOLOR,type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new Ki),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 s=this.getDescriptor(t);if(!s)throw new Error(`System variable ${t} not found!`);if(s.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}setVar(t,e,s){t=this.normalizeName(t);const n=this.getDescriptor(t);if(n){const r=this.getVar(t,s);if(n.type!=="string"&&(typeof e=="string"||e instanceof String)){if(n.type==="number"){const a=Number(e);if(Number.isNaN(a))throw new Error("Invalid number input!");e=a}else if(n.type==="boolean")e=this.parseBoolean(e);else if(n.type==="color"){const a=Q.fromString(e);if(a==null)throw new Error("Invalid color value!");e=a}}n.isDbVar?s[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(r,e)&&this.events.sysVarChanged.dispatch({database:s,name:t,newVal:e,oldVal:r}))}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(),s=new Set(["true","t","1","yes","y"]),n=new Set(["false","f","0","no","n"]);return s.has(e)?!0:(n.has(e),!1)}hasValueChanged(t,e){return t instanceof Q&&e instanceof Q?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};Ki._instance=null;let Gs=Ki;class yc extends he{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new Z,dictObjectErased:new Z,entityAppended:new Z,entityModified:new Z,entityErased:new Z,layerAppended:new Z,layerModified:new Z,layerErased:new Z,openProgress:new Z},this._version=new vt("AC1014"),this._angBase=0,this._angDir=0,this._aunits=jn.DecimalDegrees,this._celtscale=1,this._cecolor=new Q,this._celtype=At,this._celweight=We.ByLayer,this._clayer="0",this._textstyle=tt,this._extents=new C,this._insunits=rr.Millimeters,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._maxHandle=0,this._tables={appIdTable:new nh(this),blockTable:new Xo(this),dimStyleTable:new Yo(this),linetypeTable:new th(this),textStyleTable:new eh(this),viewTable:new sh(this),layerTable:new Jo(this),viewportTable:new ih(this)},this._objects={dictionary:new ks(this),imageDefinition:new ks(this),layout:new Vo(this),xrecord:new ks(this)}}get tables(){return this._tables}get objects(){return this._objects}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const s=t.getAttrWithoutException("objectId");!s||t.isTemp||e&&e(s)?t.objectId=this.generateHandle():this.updateMaxHandle(s)}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(R.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get version(){return this._version}set version(t){this.updateSysVar(R.ACADVER,this._version,new vt(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(R.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(R.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}set lwdisplay(t){this.updateSysVar(R.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(R.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(R.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celtype(){return this._celtype}set celtype(t){const e=this.normalizeLinetypeName(t??At);this.updateSysVar(R.CELTYPE,this._celtype,e,s=>{this._celtype=s})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(R.CELWEIGHT,this._celweight,t??We.ByLayer,e=>{this._celweight=e})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(R.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(R.TEXTSTYLE,this._textstyle,t??tt,e=>{this._textstyle=e})}get angBase(){return this._angBase}set angBase(t){this.updateSysVar(R.ANGBASE,this._angBase,t??0,e=>{this._angBase=e})}get angDir(){return this._angDir}set angDir(t){this.updateSysVar(R.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(R.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(R.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(R.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(R.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(R.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}async read(t,e,s=Es.DXF){const n=Rt.instance.get(s);if(n==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await n.read(t,this,e&&e.minimumChunkSize||10,async(r,a,o,l)=>{if(this.events.openProgress.dispatch({database:this,percentage:r,stage:"CONVERSION",subStage:a,subStageStatus:o,data:l}),e&&e.fontLoader&&a=="FONT"&&o=="END"){const c=l||this.tables.textStyleTable.fonts;await e.fontLoader.load(c)}},e==null?void 0:e.timeout,e==null?void 0:e.sysVars),this.ensureDatabaseDefaults()}async openUri(t,e){var p;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const s=await fetch(t);if(!s.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 '${s.status}'!`);const n=s.headers.get("content-length"),r=n?parseInt(n,10):null;let a=0;const o=(p=s.body)==null?void 0:p.getReader();if(!o)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:m,value:y}=await o.read();if(m)break;if(l.push(y),a+=y.length,r!==null){const x=Math.round(a/r*100);this.events.openProgress.dispatch({database:this,percentage:x,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(a);let u=0;for(const m of l)c.set(m,u),u+=m.length;const g=this.getFileNameFromUri(t).toLowerCase().split(".").pop();g==="dwg"?await this.read(c.buffer,e,Es.DWG):g==="dxf"?await this.read(c.buffer,e,Es.DXF):await this.read(c.buffer,e,g),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,s=this.version.name,n=!1){this.ensureDatabaseDefaults();const r=s instanceof vt?s:new vt(s),a=new ba({database:this,precision:e,version:r});return this.writeDxfHeaderSection(a),this.writeDxfTablesSection(a,r),this.writeDxfBlocksSection(a),this.writeDxfEntitiesSection(a),this.writeDxfObjectsSection(a),a.writeStart("EOF"),a.toString()}async regen(){await new El(this).read(null,this,500,async(e,s,n,r)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:s,subStageStatus:n,data:r})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Ho(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new Q;e.colorIndex=7,this.tables.layerTable.add(new tn({name:"0",standardFlags:0,linetype:Ke,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(Qe)||this.tables.linetypeTable.add(new me({name:Qe,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(At)||this.tables.linetypeTable.add(new me({name:At,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Ke)||this.tables.linetypeTable.add(new me({name:Ke,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.tables.textStyleTable.has(tt)||this.tables.textStyleTable.add(new en({name:tt,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"})),this.tables.dimStyleTable.has(tt)||this.tables.dimStyleTable.add(new He({name:tt,dimtxsty:tt})),!this.tables.viewportTable.has("*Active")){const e=new or;e.name="*Active",this.tables.viewportTable.add(e)}const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new qs;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(Pn)||this.tables.appIdTable.add(new Bn(Pn)),this.tables.appIdTable.has(In)||this.tables.appIdTable.add(new Bn(In))}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,"$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),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,"$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.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(),"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 s of e.newIterator())this.writeDxfEntity(t,s);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 s of e.newIterator())this.writeDxfEntity(t,s);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const s=a=>{t.writeStart("DICTIONARY"),a.dxfOut(t)},n=(a,o)=>{e.getAt(a)!==o&&e.setAt(a,o)},r=a=>{e.getAt(a)&&e.remove(a)};n("ACAD_LAYOUT",this.objects.layout),this.objects.imageDefinition.numEntries>0?n("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):r("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?n("MLIGHT_XRECORD",this.objects.xrecord):r("MLIGHT_XRECORD"),s(e),s(this.objects.layout),this.objects.imageDefinition.numEntries>0&&s(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&s(this.objects.xrecord);for(const[a,o]of this.objects.layout.entries())t.writeStart("LAYOUT"),o.dxfOut(t);for(const[a,o]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),o.dxfOut(t);for(const[a,o]of this.objects.xrecord.entries())t.writeStart("XRECORD"),o.dxfOut(t);t.endSection()}writeDxfTable(t,e,s,n,r){const a=[...n];t.startTable(e),s.dxfOut(t);for(const o of a){if(r==="BLOCK_RECORD"&&o instanceof K){o.dxfOutBlockRecord(t);continue}t.writeStart(r),o.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){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._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,s,n){this.hasSysVarValueChanged(e,s)&&(n(s),this.triggerSysVarChangedEvent(t,e,s))}hasSysVarValueChanged(t,e){return t instanceof Q&&e instanceof Q?!t.equals(e):t instanceof vt&&e instanceof vt?t.value!==e.value:!Object.is(t,e)}normalizeLinetypeName(t){const e=t.trim();return e.toUpperCase()==="BYLAYER"?At:e.toUpperCase()==="BYBLOCK"?Qe:e}triggerSysVarChangedEvent(t,e,s){const n=Gs.instance(),r=t.toLowerCase();n.getDescriptor(r)!=null&&n.events.sysVarChanged.dispatch({database:this,name:r,oldVal:e,newVal:s})}getFileNameFromUri(t){try{const s=new URL(t).pathname.split("/");return s[s.length-1]||""}catch{return""}}}const rh="Load Database",pa=3e4,_c=12e4,wc=1024*1024;class mt extends Ma{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Rn.getInstance().getEntry(rh),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const n=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",n?n.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()-s),n}}class hr{constructor(t={}){this.config=t}async read(t,e,s,n,r,a){const o={name:rh,data:{total:0},format(){let d="";return Object.keys(this.data).forEach(g=>{g!=="total"&&(d+=`- ${g}: ${this.data[g]} ms
|
|
4
|
+
`)}),d+=`- total: ${this.data.total} ms`,d}};Rn.getInstance().collect(o),this.progress=n;const l={value:0},c=new va;c.setCompleteCallback(()=>this.onFinished()),c.setErrorCallback(d=>this.onError(d)),c.addTask(new mt({stage:"START",step:1,progress:l,task:async d=>d},n)),c.addTask(new mt({stage:"PARSE",step:5,progress:l,task:async d=>await this.parse(d,r)},n)),c.addTask(new mt({stage:"FONT",step:5,progress:l,task:async d=>{const g=this.getFonts(d.model);return{model:d.model,data:g}}},n)),c.addTask(new mt({stage:"LTYPE",step:1,progress:l,task:async d=>(this.processLineTypes(d.model,e),d)},n)),c.addTask(new mt({stage:"STYLE",step:1,progress:l,task:async d=>(this.processTextStyles(d.model,e),d)},n)),c.addTask(new mt({stage:"DIMSTYLE",step:1,progress:l,task:async d=>(this.processDimStyles(d.model,e),d)},n)),c.addTask(new mt({stage:"LAYER",step:1,progress:l,task:async d=>(this.processLayers(d.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),d)},n)),c.addTask(new mt({stage:"VPORT",step:1,progress:l,task:async d=>(this.processViewports(d.model,e),d)},n)),c.addTask(new mt({stage:"HEADER",step:1,progress:l,task:async d=>{if(this.processHeader(d.model,e),a){const g=Gs.instance();for(const[p,m]of Object.entries(a))g.setVar(p,m,e)}return d}},n)),c.addTask(new mt({stage:"BLOCK_RECORD",step:5,progress:l,task:async d=>(this.processBlockTables(d.model,e),d)},n)),c.addTask(new mt({stage:"OBJECT",step:5,progress:l,task:async d=>(this.processObjects(d.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),d)},n)),c.addTask(new mt({stage:"BLOCK",step:5,progress:l,task:async d=>(await this.processBlocks(d.model,e),d)},n)),c.addTask(new mt({stage:"ENTITY",step:100,progress:l,task:async d=>(await this.processEntities(d.model,e,s,l,n),d)},n)),c.addTask(new mt({stage:"END",step:0,progress:l,task:async d=>d},n));const u=Date.now();await c.run(t),o.data.total=Date.now()-u}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"),ss.instance.clear())}getParserWorkerTimeout(t,e){const s=e??this.config.timeout;if(s!=null)return s;const n=Math.ceil(t.byteLength/wc),r=pa+n*1e3;return Math.min(_c,Math.max(pa,r))}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!")}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,s,n,r){throw new Error("Not impelemented yet!")}}class xc extends ar{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(t){this._standardFlags=t}get viewWidth(){return this._viewWidth}set viewWidth(t){this._viewWidth=t}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(t){this._ucsAssociated=t}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(t){this._cameraPlottable=t}get ucsElevation(){return this._ucsElevation}set ucsElevation(t){this._ucsElevation=t}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(t){this._ucsObjectId=t}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(t){this._ucsBaseObjectId=t}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(t){this._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}}var st,ns,$,q,rs,Lt,Pe,Gt,ht,Ht,Ot,Se,Ee,Ae,wt,Ut,as,os,Te,Me,hs,ls,cs,xt,Xt,H,ve,ds,L,lt,us,ct,ps,Yt,D,gs,$t,ke,un,pn,Nt,ms,Le,ft,qt,Zt,Kt,ys,_s,Qt,Oe,Ne,gn,ws,Ce,Jt,Be,it,te,bt,mn,nt,yn,ee,It,Fe,xs,Re,Pt,se,St,ie,_n,ze,Et;(st={})[st.None=0]="None",st[st.Anonymous=1]="Anonymous",st[st.NonConstant=2]="NonConstant",st[st.Xref=4]="Xref",st[st.XrefOverlay=8]="XrefOverlay",st[st.ExternallyDependent=16]="ExternallyDependent",st[st.ResolvedOrDependent=32]="ResolvedOrDependent",st[st.ReferencedXref=64]="ReferencedXref";(ns={})[ns.BYBLOCK=0]="BYBLOCK",ns[ns.BYLAYER=256]="BYLAYER";($={})[$.Rotated=0]="Rotated",$[$.Aligned=1]="Aligned",$[$.Angular=2]="Angular",$[$.Diameter=3]="Diameter",$[$.Radius=4]="Radius",$[$.Angular3Point=5]="Angular3Point",$[$.Ordinate=6]="Ordinate",$[$.ReferenceIsExclusive=32]="ReferenceIsExclusive",$[$.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",$[$.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(q={})[q.TopLeft=1]="TopLeft",q[q.TopCenter=2]="TopCenter",q[q.TopRight=3]="TopRight",q[q.MiddleLeft=4]="MiddleLeft",q[q.MiddleCenter=5]="MiddleCenter",q[q.MiddleRight=6]="MiddleRight",q[q.BottomLeft=7]="BottomLeft",q[q.BottomCenter=8]="BottomCenter",q[q.BottomRight=9]="BottomRight";(rs={})[rs.AtLeast=1]="AtLeast",rs[rs.Exact=2]="Exact";var ga=((Lt={})[Lt.Center=0]="Center",Lt[Lt.Above=1]="Above",Lt[Lt.Outside=2]="Outside",Lt[Lt.JIS=3]="JIS",Lt[Lt.Below=4]="Below",Lt);(Pe={})[Pe.WithDimension=0]="WithDimension",Pe[Pe.AddLeader=1]="AddLeader",Pe[Pe.Independent=2]="Independent";(Gt={})[Gt.BothOutside=0]="BothOutside",Gt[Gt.ArrowFirst=1]="ArrowFirst",Gt[Gt.TextFirst=2]="TextFirst",Gt[Gt.Auto=3]="Auto";var Ye=((ht={})[ht.Feet=0]="Feet",ht[ht.None=1]="None",ht[ht.Inch=2]="Inch",ht[ht.FeetAndInch=3]="FeetAndInch",ht[ht.Leading=4]="Leading",ht[ht.Trailing=8]="Trailing",ht[ht.LeadingAndTrailing=12]="LeadingAndTrailing",ht),fc=((Ht={})[Ht.None=0]="None",Ht[Ht.Leading=1]="Leading",Ht[Ht.Trailing=2]="Trailing",Ht[Ht.LeadingAndTrailing=3]="LeadingAndTrailing",Ht),bc=((Ot={})[Ot.Center=0]="Center",Ot[Ot.First=1]="First",Ot[Ot.Second=2]="Second",Ot[Ot.OverFirst=3]="OverFirst",Ot[Ot.OverSecond=4]="OverSecond",Ot),Ic=((Se={})[Se.Bottom=0]="Bottom",Se[Se.Center=1]="Center",Se[Se.Top=2]="Top",Se);(Ee={})[Ee.None=0]="None",Ee[Ee.UseDrawingBackground=1]="UseDrawingBackground",Ee[Ee.Custom=2]="Custom";(Ae={})[Ae.Horizontal=0]="Horizontal",Ae[Ae.Diagonal=1]="Diagonal",Ae[Ae.NotStacked=2]="NotStacked";(wt={})[wt.Scientific=1]="Scientific",wt[wt.Decimal=2]="Decimal",wt[wt.Engineering=3]="Engineering",wt[wt.Architectural=4]="Architectural",wt[wt.Fractional=5]="Fractional",wt[wt.WindowDesktop=6]="WindowDesktop";(Ut={})[Ut.Decimal=0]="Decimal",Ut[Ut.DegreesMinutesSecond=1]="DegreesMinutesSecond",Ut[Ut.Gradian=2]="Gradian",Ut[Ut.Radian=3]="Radian";var Pc=((as={})[as.PatternFill=0]="PatternFill",as[as.SolidFill=1]="SolidFill",as);(os={})[os.NonAssociative=0]="NonAssociative",os[os.Associative=1]="Associative";(Te={})[Te.Normal=0]="Normal",Te[Te.Outer=1]="Outer",Te[Te.Ignore=2]="Ignore";(Me={})[Me.UserDefined=0]="UserDefined",Me[Me.Predefined=1]="Predefined",Me[Me.Custom=2]="Custom";(hs={})[hs.NotAnnotated=0]="NotAnnotated",hs[hs.Annotated=1]="Annotated";(ls={})[ls.Solid=0]="Solid",ls[ls.Gradient=1]="Gradient";(cs={})[cs.TwoColor=0]="TwoColor",cs[cs.OneColor=1]="OneColor";var Sc=((xt={})[xt.Default=0]="Default",xt[xt.External=1]="External",xt[xt.Polyline=2]="Polyline",xt[xt.Derived=4]="Derived",xt[xt.Textbox=8]="Textbox",xt[xt.Outermost=16]="Outermost",xt),di=((Xt={})[Xt.Line=1]="Line",Xt[Xt.Circular=2]="Circular",Xt[Xt.Elliptic=3]="Elliptic",Xt[Xt.Spline=4]="Spline",Xt),Ec=((H={})[H.Off=0]="Off",H[H.Solid=1]="Solid",H[H.Dashed=2]="Dashed",H[H.Dotted=3]="Dotted",H[H.ShotDash=4]="ShotDash",H[H.MediumDash=5]="MediumDash",H[H.LongDash=6]="LongDash",H[H.DoubleShortDash=7]="DoubleShortDash",H[H.DoubleMediumDash=8]="DoubleMediumDash",H[H.DoubleLongDash=9]="DoubleLongDash",H[H.DoubleMediumLongDash=10]="DoubleMediumLongDash",H[H.SparseDot=11]="SparseDot",H);Ec.Off;(ve={})[ve.Standard=-3]="Standard",ve[ve.ByLayer=-2]="ByLayer",ve[ve.ByBlock=-1]="ByBlock";(ds={})[ds.English=0]="English",ds[ds.Metric=1]="Metric";(L={})[L.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",L[L.FRONT_CLIPPING=2]="FRONT_CLIPPING",L[L.BACK_CLIPPING=4]="BACK_CLIPPING",L[L.UCS_FOLLOW=8]="UCS_FOLLOW",L[L.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",L[L.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",L[L.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",L[L.FAST_ZOOM=128]="FAST_ZOOM",L[L.SNAP_MODE=256]="SNAP_MODE",L[L.GRID_MODE=512]="GRID_MODE",L[L.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",L[L.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",L[L.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",L[L.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",L[L.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",L[L.UNUSED=32768]="UNUSED",L[L.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",L[L.VIEWPORT_OFF=131072]="VIEWPORT_OFF",L[L.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",L[L.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",L[L.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",L[L.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(lt={})[lt.OPTIMIZED_2D=0]="OPTIMIZED_2D",lt[lt.WIREFRAME=1]="WIREFRAME",lt[lt.HIDDEN_LINE=2]="HIDDEN_LINE",lt[lt.FLAT_SHADED=3]="FLAT_SHADED",lt[lt.GOURAUD_SHADED=4]="GOURAUD_SHADED",lt[lt.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",lt[lt.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(us={})[us.UCS_UNCHANGED=0]="UCS_UNCHANGED",us[us.HAS_OWN_UCS=1]="HAS_OWN_UCS";(ct={})[ct.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",ct[ct.TOP=1]="TOP",ct[ct.BOTTOM=2]="BOTTOM",ct[ct.FRONT=3]="FRONT",ct[ct.BACK=4]="BACK",ct[ct.LEFT=5]="LEFT",ct[ct.RIGHT=6]="RIGHT";(ps={})[ps.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",ps[ps.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(Yt={})[Yt.ByLayer=0]="ByLayer",Yt[Yt.ByBlock=1]="ByBlock",Yt[Yt.ByDictionaryDefault=2]="ByDictionaryDefault",Yt[Yt.ByObject=3]="ByObject";(D={})[D.NotAllowed=0]="NotAllowed",D[D.AllowErase=1]="AllowErase",D[D.AllowTransform=2]="AllowTransform",D[D.AllowChangeColor=4]="AllowChangeColor",D[D.AllowChangeLayer=8]="AllowChangeLayer",D[D.AllowChangeLinetype=16]="AllowChangeLinetype",D[D.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",D[D.AllowChangeVisibility=64]="AllowChangeVisibility",D[D.AllowClone=128]="AllowClone",D[D.AllowChangeLineweight=256]="AllowChangeLineweight",D[D.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",D[D.AllowAllExceptClone=895]="AllowAllExceptClone",D[D.AllowAll=1023]="AllowAll",D[D.DisableProxyWarning=1024]="DisableProxyWarning",D[D.R13FormatProxy=32768]="R13FormatProxy";function N(i,t,e){return i.code===t&&(e==null||i.value===e)}function we(i){let t={};i.rewind();let e=i.next(),s=e.code;if(t.x=e.value,(e=i.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=i.next()).code!==s+20?i.rewind():t.z=e.value,t}let Ks=Symbol();function S(i,t){return(e,s,n)=>{let r=function(l,c=!1){return l.reduce((u,d)=>{d.pushContext&&u.push({});let g=u[u.length-1];for(let p of typeof d.code=="number"?[d.code]:d.code){let m=g[p]??(g[p]=[]);d.isMultiple&&m.length,m.push(d)}return u},[{}])}(i,s.debug),a=!1,o=r.length-1;for(;!N(e,0,"EOF");){let l=function(x,f,P){return x.find((I,M)=>{var A;return M>=P&&((A=I[f])==null?void 0:A.length)})}(r,e.code,o),c=l==null?void 0:l[e.code],u=c==null?void 0:c[c.length-1];if(!l||!u){s.rewind();break}u.isMultiple||l[e.code].pop();let{name:d,parser:g,isMultiple:p,isReducible:m}=u,y=g==null?void 0:g(e,s,n);if(y===Ks){s.rewind();break}if(d){let[x,f]=Ac(n,d);p&&!m?(Object.prototype.hasOwnProperty.call(x,f)||(x[f]=[]),x[f].push(y)):x[f]=y}u.pushContext&&(o-=1),a=!0,e=s.next()}return t&&Object.setPrototypeOf(n,t),a}}function Ac(i,t){let e=t.split(".");if(!e.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let s=i;for(let n=0;n<e.length-1;++n){let r=wn(e[n]),a=wn(e[n+1]);Object.prototype.hasOwnProperty.call(s,r)||(typeof a=="number"?s[r]=[]:s[r]={}),s=s[r]}return[s,wn(e[e.length-1])]}function wn(i){let t=Number.parseInt(i);return Number.isNaN(t)?i:t}function h({value:i}){return i}function _(i,t){return we(t)}function O({value:i}){return!!i}function Tc({value:i}){return i.trim()}let Mc=[{code:281,name:"isEntity",parser:O},{code:280,name:"wasProxy",parser:O},{code:91,name:"instanceCount",parser:h},{code:90,name:"proxyFlag",parser:h},{code:3,name:"appName",parser:h},{code:2,name:"cppClassName",parser:h},{code:1,name:"name",parser:h}],vc=S(Mc),kc=[{code:0,name:"classes",isMultiple:!0,parser(i,t){if(i.value!=="CLASS")return Ks;i=t.next();let e={};return vc(i,t,e),e}}],Lc=S(kc);(gs={})[gs.RayTrace=0]="RayTrace",gs[gs.ShadowMap=1]="ShadowMap";function jt(i,t,e){for(;N(i,102);){var s;let n=i.value;if(i=t.next(),!n.startsWith("{")){t.debug,function(a,o){for(;!N(a,102)&&!N(a,0,"EOF");)a=o.next()}(i,t),i=t.next();continue}let r=n.slice(1).trim();e.extensions??(e.extensions={}),(s=e.extensions)[r]??(s[r]=[]),function(a,o,l){for(;!N(a,102,"}")&&!N(a,0,"EOF");)l.push(a),a=o.next()}(i,t,e.extensions[r]),i=t.next()}t.rewind()}let Oc=[{code:1001,name:"xdata",isMultiple:!0,parser:ah}],Nc=new Set([1010,1011,1012,1013]);function ah(i,t){var n;if(!N(i,1001))throw Error("XData must starts with code 1001");let e={appName:i.value,value:[]};i=t.next();let s=[e.value];for(;!N(i,0,"EOF")&&!N(i,1001)&&i.code>=1e3;){let r=s[s.length-1];if(i.code===1002){i.value==="{"?s.push([]):(s.pop(),(n=s[s.length-1])==null||n.push(r)),i=t.next();continue}Nc.has(i.code)?r.push(we(t)):r.push(i.value),i=t.next()}return t.rewind(),e}($t={})[$t.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",$t[$t.CAST=1]="CAST",$t[$t.RECEIVE=2]="RECEIVE",$t[$t.IGNORE=3]="IGNORE";let V=[...Oc,{code:284,name:"shadowMode",parser:h},{code:390,name:"plotStyleHardId",parser:h},{code:380,name:"plotStyleType",parser:h},{code:440,name:"transparency",parser:h},{code:430,name:"colorName",parser:h},{code:420,name:"color",parser:h},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(i,t,e)=>(e.proxyEntity??"")+i.value},{code:[92,160],name:"proxyByte",parser:h},{code:60,name:"isVisible",parser:O},{code:48,name:"lineTypeScale",parser:h},{code:370,name:"lineweight",parser:h},{code:62,name:"colorIndex",parser:h},{code:347,name:"materialObjectHardId",parser:h},{code:6,name:"lineType",parser:h},{code:8,name:"layer",parser:h},{code:410,name:"layoutTabName",parser:h},{code:67,name:"isInPaperSpace",parser:O},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:h},{code:102,parser:jt},{code:102,parser:jt},{code:102,parser:jt},{code:5,name:"handle",parser:h}];function sn(i){return[{code:3,name:i,parser:(t,e,s)=>(s._code3text=(s._code3text??"")+t.value,s._code3text+(s._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:i,parser:(t,e,s)=>(s._code1text=t.value,(s._code3text??"")+s._code1text)}]}function oh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Cc={extrusionDirection:{x:0,y:0,z:1}},Bc=[{code:210,name:"extrusionDirection",parser:_},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:100,name:"subclassMarker",parser:h},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_},{code:39,name:"thickness",parser:h},{code:100},...V];class hh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){oh(this,"parser",S(Bc,Cc))}}oh(hh,"ForEntityName","ARC");(ke={})[ke.BeforeText=0]="BeforeText",ke[ke.AboveText=1]="AboveText",ke[ke.None=2]="None";let lr=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4,defaultValue:""},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMFXL",code:49,defaultValue:1},{name:"DIMJOGANG",code:50,defaultValue:45},{name:"DIMTFILL",code:69,defaultValue:0},{name:"DIMTFILLCLR",code:70,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:ga.Above,defaultValueImperial:ga.Center},{name:"DIMZIN",code:78,defaultValue:Ye.Trailing,defaultValueImperial:Ye.Feet},{name:"DIMAZIN",code:79,defaultValue:fc.None},{name:"DIMARCSYM",code:90,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179,defaultValue:0},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:3,defaultValueImperial:2},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:44,defaultValueImperial:46},{name:"DIMTMOVE",code:279,defaultValue:0},{name:"DIMJUST",code:280,defaultValue:bc.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Ic.Center},{name:"DIMTZIN",code:284,defaultValue:Ye.Trailing,defaultValueImperial:Ye.Feet},{name:"DIMALTZ",code:285,defaultValue:Ye.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Ye.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMFXLON",code:290,defaultValue:0},{name:"DIMTXTDIRECTION",code:294,defaultValue:0},{name:"DIMTXSTY",code:340,defaultValue:"Standard"},{name:"DIMLDRBLK",code:341,defaultValue:""},{name:"DIMBLK",code:342,defaultValue:""},{name:"DIMBLK1",code:343,defaultValue:""},{name:"DIMBLK2",code:344,defaultValue:""},{name:"DIMLTYPE",code:345,defaultValue:""},{name:"DIMLTEX1",code:346,defaultValue:""},{name:"DIMLTEX2",code:347,defaultValue:""},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWE",code:372,defaultValue:-2}],lh=[{code:3,name:"styleName",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:51,name:"ocsRotation",parser:h},{code:53,name:"textRotation",parser:h},{code:1,name:"text",parser:h},{code:42,name:"measurement",parser:h},{code:72,name:"textLineSpacingStyle",parser:h},{code:71,name:"attachmentPoint",parser:h},{code:70,name:"dimensionType",parser:h},{code:11,name:"textPoint",parser:_},{code:10,name:"definitionPoint",parser:_},{code:2,name:"name",parser:h},{code:280,name:"version",parser:h},{code:100}],Fc=[{code:100},{code:52,name:"obliqueAngle",parser:h},{code:50,name:"rotationAngle",parser:h},{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:12,name:"insertionPoint",parser:_},{code:100,name:"subclassMarker",parser:h}],Rc=[{code:16,name:"arcPoint",parser:_},{code:15,name:"centerPoint",parser:_},{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:100,name:"subclassMarker",parser:h}],zc=[{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:100,name:"subclassMarker",parser:h}],Vc=[{code:40,name:"leaderLength",parser:h},{code:15,name:"subDefinitionPoint",parser:_},{code:100,name:"subclassMarker",parser:h}],Dc=[{code:100,parser(i,t,e){let s=function(n){switch(n){case"AcDbAlignedDimension":return S(Fc);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return S(Rc);case"AcDbOrdinateDimension":return S(zc);case"AcDbRadialDimension":case"AcDbDiametricDimension":return S(Vc)}return null}(i.value);if(!s)return Ks;s(i,t,e)},pushContext:!0},...lr.map(i=>({...i,parser:h})),...lh,...V];class yi{parseEntity(t,e){let s={};return S(Dc)(e,t,s),s}}(un="ForEntityName")in yi?Object.defineProperty(yi,un,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):yi[un]="DIMENSION";let jc=[{code:73},{code:17,name:"leaderEnd",parser:_},{code:16,name:"leaderStart",parser:_},{code:71,name:"hasLeader",parser:O},{code:41,name:"endAngle",parser:h},{code:40,name:"startAngle",parser:h},{code:70,name:"isPartial",parser:O},{code:15,name:"centerPoint",parser:_},{code:14,name:"xline2Point",parser:_},{code:13,name:"xline1Point",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...lr.map(i=>({...i,parser:h})),...lh,...V];class _i{parseEntity(t,e){let s={};return S(jc)(e,t,s),s}}(pn="ForEntityName")in _i?Object.defineProperty(_i,pn,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):_i[pn]="ARC_DIMENSION";(Nt={})[Nt.NONE=0]="NONE",Nt[Nt.INVISIBLE=1]="INVISIBLE",Nt[Nt.CONSTANT=2]="CONSTANT",Nt[Nt.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Nt[Nt.PRESET=8]="PRESET";(ms={})[ms.MULTILINE=2]="MULTILINE",ms[ms.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(Le={})[Le.NONE=0]="NONE",Le[Le.MIRRORED_X=2]="MIRRORED_X",Le[Le.MIRRORED_Y=4]="MIRRORED_Y";var Wc=((ft={})[ft.LEFT=0]="LEFT",ft[ft.CENTER=1]="CENTER",ft[ft.RIGHT=2]="RIGHT",ft[ft.ALIGNED=3]="ALIGNED",ft[ft.MIDDLE=4]="MIDDLE",ft[ft.FIT=5]="FIT",ft),Gc=((qt={})[qt.BASELINE=0]="BASELINE",qt[qt.BOTTOM=1]="BOTTOM",qt[qt.MIDDLE=2]="MIDDLE",qt[qt.TOP=3]="TOP",qt);function ch(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let dh={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Wc.LEFT,valign:Gc.BASELINE,extrusionDirection:{x:0,y:0,z:1}},uh=[{code:73,name:"valign",parser:h},{code:100},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"endPoint",parser:_},{code:72,name:"valign",parser:h},{code:72,name:"halign",parser:h},{code:71,name:"generationFlag",parser:h},{code:7,name:"styleName",parser:h},{code:51,name:"obliqueAngle",parser:h},{code:41,name:"xScale",parser:h},{code:50,name:"rotation",parser:h},{code:1,name:"text",parser:h},{code:40,name:"textHeight",parser:h},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class ph{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ch(this,"parser",S(uh,dh))}}function gh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}ch(ph,"ForEntityName","TEXT");let Hc={...dh},Uc=[{code:2},{code:40,name:"annotationScale",parser:h},{code:10,name:"alignmentPoint",parser:_},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:h},{code:70,name:"numberOfSecondaryAttributes",parser:h},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:h},{code:280,name:"isDuplicatedRecord",parser:O},{code:100},{code:280,name:"isLocked",parser:O},{code:74,name:"valign",parser:h},{code:73},{code:70,name:"attributeFlag",parser:h},{code:2,name:"tag",parser:h},{code:3,name:"prompt",parser:h},{code:280},{code:100,name:"subclassMarker",parser:h},...uh.slice(2)];class mh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){gh(this,"parser",S(Uc,Hc))}}function Xc(i,t){let e={};for(let s of i){let n=t(s);n!=null&&(e[n]??(e[n]=[]),e[n].push(s))}return e}function*$i(i,t=1/0,e=1){for(let s=i;s!==t;s+=e)yield s}function ma(i){return{x:i.x??0,y:i.y??0,z:i.z??0}}gh(mh,"ForEntityName","ATTDEF");var Yc=[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];function $c(i){return Yc[i]}function qc(i){i.rewind();let t=i.next();if(t.code!==101)throw Error("Bad call for skipEmbeddedObject()");do t=i.next();while(t.code!==0);i.rewind()}function Zc(i,t,e){if(N(t,102))return jt(t,e,i),!0;switch(t.code){case 0:i.type=t.value;break;case 5:i.handle=t.value;break;case 330:i.ownerBlockRecordSoftId=t.value;break;case 67:i.isInPaperSpace=!!t.value;break;case 8:i.layer=t.value;break;case 6:i.lineType=t.value;break;case 347:i.materialObjectHardId=t.value;break;case 62:i.colorIndex=t.value,i.color=$c(Math.abs(t.value));break;case 370:i.lineweight=t.value;break;case 48:i.lineTypeScale=t.value;break;case 60:i.isVisible=!!t.value;break;case 92:i.proxyByte=t.value;break;case 310:i.proxyEntity=t.value;break;case 100:break;case 420:i.color=t.value;break;case 430:i.transparency=t.value;break;case 390:i.plotStyleHardId=t.value;break;case 284:i.shadowMode=t.value;break;case 1001:(i.xdata??(i.xdata=[])).push(ah(t,e));break;default:return!1}return!0}function yh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Kc={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},wi=[{code:46,name:"annotationHeight",parser:h},{code:101,parser(i,t){qc(t)}},{code:50,name:"columnHeight",parser:h},{code:49,name:"columnGutter",parser:h},{code:48,name:"columnWidth",parser:h},{code:79,name:"columnAutoHeight",parser:h},{code:78,name:"columnFlowReversed",parser:h},{code:76,name:"columnCount",parser:h},{code:75,name:"columnType",parser:h},{code:441,name:"backgroundFillTransparency",parser:h},{code:63,name:"backgroundFillColor",parser:h},{code:45,name:"fillBoxScale",parser:h},{code:[...$i(430,440)],name:"backgroundColor",parser:h},{code:[...$i(420,430)],name:"backgroundColor",parser:h},{code:90,name:"backgroundFill",parser:h},{code:44,name:"lineSpacing",parser:h},{code:73,name:"lineSpacingStyle",parser:h},{code:50,name:"rotation",parser:h},{code:43},{code:42},{code:11,name:"direction",parser:_},{code:210,name:"extrusionDirection",parser:_},{code:7,name:"styleName",parser:h},...sn("text"),{code:72,name:"drawingDirection",parser:h},{code:71,name:"attachmentPoint",parser:h},{code:41,name:"width",parser:h},{code:40,name:"height",parser:h},{code:10,name:"insertionPoint",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class _h{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){yh(this,"parser",S(wi,Kc))}}function wh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}yh(_h,"ForEntityName","MTEXT");let Qc={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},Jc=[...wi.slice(wi.findIndex(({name:i})=>i==="columnType"),wi.findIndex(({name:i})=>i==="subclassMarker")+1),{code:100},{code:0,parser(i){if(!N(i,0,"MTEXT"))return Ks}},{code:2,name:"definitionTag",parser:h},{code:40,name:"annotationScale",parser:h},{code:10,name:"alignmentPoint",parser:_},{code:340,name:"secondaryAttributesHardId",parser:h},{code:70,name:"numberOfSecondaryAttributes",parser:h},{code:70,name:"isReallyLocked",parser:O},{code:70,name:"mtextFlag",parser:h},{code:280,name:"isDuplicatedEntriesKeep",parser:O},{code:100},{code:280,name:"lockPositionFlag",parser:O},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"alignmentPoint",parser:_},{code:74,name:"verticalJustification",parser:h},{code:72,name:"horizontalJustification",parser:h},{code:71,name:"textGenerationFlag",parser:h},{code:7,name:"textStyle",parser:h},{code:51,name:"obliqueAngle",parser:h},{code:41,name:"scale",parser:h},{code:50,name:"rotation",parser:h},{code:73},{code:70,name:"attributeFlag",parser:h},{code:2,name:"tag",parser:h},{code:280},{code:100,name:"subclassMarker",parser:h},{code:1,name:"text",parser:h},{code:40,name:"textHeight",parser:h},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100},...V];class xh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){wh(this,"parser",S(Jc,Qc))}}function fh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}wh(xh,"ForEntityName","ATTRIB");let td=[...sn("data"),{code:70,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class bh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){fh(this,"parser",S(td))}}function Ih(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}fh(bh,"ForEntityName","BODY");let ed={thickness:0,extrusionDirection:{x:0,y:0,z:1}},sd=[{code:210,name:"extrusionDirection",parser:_},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Ph{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ih(this,"parser",S(sd,ed))}}function Sh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Ih(Ph,"ForEntityName","CIRCLE");let id={extrusionDirection:{x:0,y:0,z:1}},nd=[{code:42,name:"endAngle",parser:h},{code:41,name:"startAngle",parser:h},{code:40,name:"axisRatio",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"majorAxisEndPoint",parser:_},{code:10,name:"center",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Eh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Sh(this,"parser",S(nd,id))}}function Ah(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Sh(Eh,"ForEntityName","ELLIPSE");let rd=[{code:13,name:"vertices.3",parser:_},{code:12,name:"vertices.2",parser:_},{code:11,name:"vertices.1",parser:_},{code:10,name:"vertices.0",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Th{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ah(this,"parser",S(rd))}}Ah(Th,"ForEntityName","3DFACE");(Zt={})[Zt.First=1]="First",Zt[Zt.Second=2]="Second",Zt[Zt.Third=4]="Third",Zt[Zt.Fourth=8]="Fourth";let Mh=[{code:330,name:"sourceBoundaryObjects",parser:h,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:h}],ad=[{code:11,name:"end",parser:_},{code:10,name:"start",parser:_}],od=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_}],hd=[{code:73,name:"isCCW",parser:O},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:40,name:"lengthOfMinorAxis",parser:h},{code:11,name:"end",parser:_},{code:10,name:"center",parser:_}],ld=[{code:13,name:"endTangent",parser:_},{code:12,name:"startTangent",parser:_},{code:11,name:"fitDatum",isMultiple:!0,parser:_},{code:97,name:"numberOfFitData",parser:h},{code:10,name:"controlPoints",isMultiple:!0,parser(i,t){let e={...we(t),weight:1};return(i=t.next()).code===42?e.weight=i.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:h},{code:96,name:"numberOfControlPoints",parser:h},{code:95,name:"numberOfKnots",parser:h},{code:74,name:"isPeriodic",parser:O},{code:73,name:"splineFlag",parser:h},{code:94,name:"degree",parser:h}],cd={[di.Line]:ad,[di.Circular]:od,[di.Elliptic]:hd,[di.Spline]:ld},dd=[...Mh,{code:72,name:"edges",parser(i,t){let e={type:i.value},s=S(cd[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(i=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:h}],ud=[...Mh,{code:10,name:"vertices",parser(i,t){let e={...we(t),bulge:0};return(i=t.next()).code===42?e.bulge=i.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:h},{code:73,name:"isClosed",parser:O},{code:72,name:"hasBulge",parser:O}];function pd(i,t){let e={boundaryPathTypeFlag:i.value},s=e.boundaryPathTypeFlag&Sc.Polyline;return i=t.next(),s?S(ud)(i,t,e):S(dd)(i,t,e),e}let gd=[{code:49,name:"dashLengths",parser:h,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:h},{code:45,name:"offset",parser:ya},{code:43,name:"base",parser:ya},{code:53,name:"angle",parser:h}];function ya(i,t){let e=i.code+1,s={x:i.value,y:1};return(i=t.next()).code===e?s.y=i.value:t.rewind(),s}function md(i,t){let e={};return S(gd)(i,t,e),e}function yd(i,t){let e=[];for(;i.code===463;){let s={reservedField:i.value};if((i=t.next()).code===63&&(s.colorIndex=i.value,i=t.next()),i.code===421)s.rgb=i.value,e.push(s),i=t.next();else{t.rewind();break}}return i.code!==463&&e.length>0&&t.rewind(),e}function vh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let _d={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},wd=[{code:470,name:"gradientName",parser:h},{code:463,name:"gradientColors",parser:yd},{code:462,name:"colorTint",parser:h},{code:461,name:"gradientDefinition",parser:h},{code:460,name:"gradientRotation",parser:h},{code:453,name:"numberOfColors",parser:h},{code:452,name:"gradientColorFlag",parser:h},{code:451},{code:450,name:"gradientFlag",parser:h},{code:10,name:"seedPoints",parser:_,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:_},{code:98,name:"numberOfSeedPoints",parser:h},{code:47,name:"pixelSize",parser:h},{code:53,name:"definitionLines",parser:md,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:h},{code:77,name:"isDouble",parser:O},{code:73,name:"isAnnotated",parser:O},{code:41,name:"patternScale",parser:h},{code:52,name:"patternAngle",parser:h},{code:76,name:"patternType",parser:h},{code:75,name:"hatchStyle",parser:h},{code:92,name:"boundaryPaths",parser:pd,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:h},{code:71,name:"associativity",parser:h},{code:63,name:"patternFillColor",parser:h},{code:70,name:"solidFill",parser:h},{code:2,name:"patternName",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:10,name:"elevationPoint",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V];class kh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){vh(this,"parser",S(wd,_d))}}function Lh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}vh(kh,"ForEntityName","HATCH");let xd={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},fd=[{code:290,name:"clipMode",parser:h},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:_},{code:91,name:"countBoundaryPoints",parser:h},{code:71,name:"clippingBoundaryType",parser:h},{code:360,name:"imageDefReactorHandle",parser:h},{code:283,name:"fade",parser:h},{code:282,name:"contrast",parser:h},{code:281,name:"brightness",parser:h},{code:280,name:"isClipped",parser:O},{code:70,name:"flags",parser:h},{code:340,name:"imageDefHandle",parser:h},{code:13,name:"imageSize",parser:_},{code:12,name:"vPixel",parser:_},{code:11,name:"uPixel",parser:_},{code:10,name:"position",parser:_},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Oh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Lh(this,"parser",S(fd,xd))}}Lh(Oh,"ForEntityName","IMAGE");(Kt={})[Kt.ShowImage=1]="ShowImage",Kt[Kt.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Kt[Kt.UseClippingBoundary=4]="UseClippingBoundary",Kt[Kt.TransparencyIsOn=8]="TransparencyIsOn";(ys={})[ys.Rectangular=1]="Rectangular",ys[ys.Polygonal=2]="Polygonal";(_s={})[_s.Outside=0]="Outside",_s[_s.Inside=1]="Inside";function Nh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let bd={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Id=[{code:210,name:"extrusionDirection",parser:_},{code:45,name:"rowSpacing",parser:h},{code:44,name:"columnSpacing",parser:h},{code:71,name:"rowCount",parser:h},{code:70,name:"columnCount",parser:h},{code:50,name:"rotation",parser:h},{code:43,name:"zScale",parser:h},{code:42,name:"yScale",parser:h},{code:41,name:"xScale",parser:h},{code:10,name:"insertionPoint",parser:_},{code:2,name:"name",parser:h},{code:66,name:"isVariableAttributes",parser:O},{code:100,name:"subclassMarker",parser:h},...V];class Ch{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Nh(this,"parser",S(Id,bd))}}function Bh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Nh(Ch,"ForEntityName","INSERT");let Pd={isArrowheadEnabled:!0},Sd=[{code:213,name:"offsetFromAnnotation",parser:_},{code:212,name:"offsetFromBlock",parser:_},{code:211,name:"horizontalDirection",parser:_},{code:210,name:"normal",parser:_},{code:340,name:"associatedAnnotation",parser:h},{code:77,name:"byBlockColor",parser:h},{code:10,name:"vertices",parser:_,isMultiple:!0},{code:76,name:"numberOfVertices",parser:h},{code:41,name:"textWidth",parser:h},{code:40,name:"textHeight",parser:h},{code:75,name:"isHooklineExists",parser:O},{code:74,name:"isHooklineSameDirection",parser:O},{code:73,name:"leaderCreationFlag",parser:h},{code:72,name:"isSpline",parser:O},{code:71,name:"isArrowheadEnabled",parser:O},{code:3,name:"styleName",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Fh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Bh(this,"parser",S(Sd,Pd))}}Bh(Fh,"ForEntityName","LEADER");(Qt={})[Qt.TextAnnotation=0]="TextAnnotation",Qt[Qt.ToleranceAnnotation=1]="ToleranceAnnotation",Qt[Qt.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Qt[Qt.NoAnnotation=3]="NoAnnotation";function Rh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Ed={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ad=[{code:210,name:"extrusionDirection",parser:_},{code:11,name:"endPoint",parser:_},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class zh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Rh(this,"parser",S(Ad,Ed))}}function Vh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Rh(zh,"ForEntityName","LINE");let Td=[{code:280,name:"shadowMapSoftness",parser:h},{code:91,name:"shadowMapSize",parser:h},{code:73,name:"shadowType",parser:h},{code:293,name:"isShadowCast",parser:O},{code:51,name:"falloffAngle",parser:h},{code:50,name:"hotspotAngle",parser:h},{code:42,name:"limitEnd",parser:h},{code:41,name:"limitStart",parser:h},{code:292,name:"isAttenuationLimited",parser:O},{code:72,name:"attenuationType",parser:h},{code:11,name:"target",parser:_},{code:10,name:"position",parser:_},{code:40,name:"intensity",parser:h},{code:291,name:"isPlotGlyph",parser:O},{code:290,name:"isOn",parser:O},{code:421,name:"lightColorInstance",parser:h},{code:63,name:"lightColorIndex",parser:h},{code:70,name:"lightType",parser:h},{code:1,name:"name",parser:h},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class Dh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Vh(this,"parser",S(Td))}}Vh(Dh,"ForEntityName","LIGHT");(Oe={})[Oe.Distant=1]="Distant",Oe[Oe.Point=2]="Point",Oe[Oe.Spot=3]="Spot";(Ne={})[Ne.None=0]="None",Ne[Ne.InverseLinear=1]="InverseLinear",Ne[Ne.InverseSquare=2]="InverseSquare";let Md={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},vd={bulge:0},kd=[{code:42,name:"bulge",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:91,name:"id",parser:h},{code:20,name:"y",parser:h},{code:10,name:"x",parser:h}],Ld=[{code:210,name:"extrusionDirection",parser:_},{code:10,name:"vertices",isMultiple:!0,parser(i,t){let e={};return S(kd,vd)(i,t,e),e}},{code:39,name:"thickness",parser:h},{code:38,name:"elevation",parser:h},{code:43,name:"constantWidth",parser:h},{code:70,name:"flag",parser:h},{code:90,name:"numberOfVertices",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class xi{parseEntity(t,e){let s={};return S(Ld,Md)(e,t,s),s}}(gn="ForEntityName")in xi?Object.defineProperty(xi,gn,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):xi[gn]="LWPOLYLINE";(ws={})[ws.IS_CLOSED=1]="IS_CLOSED",ws[ws.PLINE_GEN=128]="PLINE_GEN";function jh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Od=[{code:90,name:"overridenSubEntityCount",parser:h},{code:140,name:"edgeCreaseWeights",parser:h,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:h},{code:94,parser(i,t,e){e.edgeCount=i.value,e.edgeIndices=[];for(let s=0;s<e.edgeCount;++s){let n=[];i=t.next(),n[0]=i.value,i=t.next(),n[1]=i.value,e.edgeIndices.push(n)}}},{code:93,parser(i,t,e){e.totalFaceIndices=i.value,e.faceIndices=[];let s=[];for(let r=0;r<e.totalFaceIndices&&!N(i,0);++r)i=t.next(),s.push(i.value);let n=0;for(;n<s.length;){let r=s[n++],a=[];for(let o=0;o<r;++o)a.push(s[n++]);e.faceIndices.push(a)}}},{code:10,name:"vertices",parser:_,isMultiple:!0},{code:92,name:"verticesCount",parser:h},{code:91,name:"subdivisionLevel",parser:h},{code:40,name:"blendCrease",parser:h},{code:72,name:"isBlendCreased",parser:O},{code:71,name:"version",parser:h},{code:100,name:"subclassMarker",parser:Tc,pushContext:!0},...V];class Wh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){jh(this,"parser",S(Od))}}function Gh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}jh(Wh,"ForEntityName","MESH");let Nd=[{code:42,name:"fillParameters",parser:h,isMultiple:!0},{code:75,name:"fillCount",parser:h},{code:41,name:"parameters",parser:h,isMultiple:!0},{code:74,name:"parameterCount",parser:h}],Cd=[{code:[74,41,75,42],name:"elements",parser(i,t){let e=S(Nd),s={};return e(i,t,s),s},isMultiple:!0},{code:13,name:"miterDirection",parser:_},{code:12,name:"direction",parser:_},{code:11,name:"position",parser:_}],Bd=[{code:[11,12,13],name:"segments",parser(i,t){let e=S(Cd),s={};return e(i,t,s),s},isMultiple:!0},{code:210,name:"extrusionDirection",parser:_},{code:10,name:"startPosition",parser:_},{code:73,name:"styleCount",parser:h},{code:72,name:"vertexCount",parser:h},{code:71,name:"flags",parser:h},{code:70,name:"justification",parser:h},{code:40,name:"scale",parser:h},{code:340,name:"styleObjectHandle",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V];class Hh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Gh(this,"parser",S(Bd))}}Gh(Hh,"ForEntityName","MLINE");(Ce={})[Ce.Top=0]="Top",Ce[Ce.Zero=1]="Zero",Ce[Ce.Bottom=2]="Bottom";(Jt={})[Jt.HasVertex=1]="HasVertex",Jt[Jt.Closed=2]="Closed",Jt[Jt.SuppressStartCaps=4]="SuppressStartCaps",Jt[Jt.SuppressEndCaps=8]="SuppressEndCaps";(Be={})[Be.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Be[Be.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Be[Be.BY_STYLE=5]="BY_STYLE";function Uh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Fd={},Rd=[{code:170,name:"multileaderType",parser:h},{code:291,name:"doglegEnabled",parser:O},{code:40,name:"doglegLength",parser:h},{code:172,name:"contentType",parser:h},{code:3,name:"textContent",parser:h},{code:12,name:"textAnchor",parser:_},{code:344,name:"blockHandle",parser:h},{code:15,name:"blockPosition",parser:_},{code:302,name:"leaderSections",parser:function(i,t,e){let s,n={leaderLines:[]};for(;t.hasNext()&&(s=t.next()).code!==303;)switch(s.code){case 10:n.landingPoint=_(s.value,t);break;case 11:n.doglegVector=_(s.value,t);break;case 40:n.doglegLength=s.value;break;case 304:n.leaderLines.push(function(r,a,o){let l,c={vertices:[]};for(;a.hasNext()&&(l=a.next()).code!==305;)l.code===10&&c.vertices.push(_(l.value,a));return c}(0,t))}return n},isMultiple:!0},...V];class Xh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Uh(this,"parser",S(Rd,Fd))}}function Yh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Uh(Xh,"ForEntityName","MULTILEADER");let zd={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Vd=[{code:50,name:"angle",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:39,name:"thickness",parser:h},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class $h{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Yh(this,"parser",S(Vd,zd))}}function qh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Yh($h,"ForEntityName","POINT");let Dd={startWidth:0,endWidth:0,bulge:0},jd=[{code:91,name:"id",parser:h},{code:[...$i(71,75)],name:"faces",isMultiple:!0,parser:h},{code:50,name:"tangentDirection",parser:h},{code:70,name:"flag",parser:h},{code:42,name:"bulge",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:30,name:"z",parser:h},{code:20,name:"y",parser:h},{code:10,name:"x",parser:h},{code:100,name:"subclassMarker",parser:h},{code:100},...V];class cr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){qh(this,"parser",S(jd,Dd))}}function Zh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}qh(cr,"ForEntityName","VERTEX");let Wd={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Gd=[{code:0,name:"vertices",isMultiple:!0,parser:(i,t)=>N(i,0,"VERTEX")?(i=t.next(),new cr().parseEntity(t,i)):Ks},{code:210,name:"extrusionDirection",parser:_},{code:75,name:"smoothType",parser:h},{code:74,name:"surfaceNDensity",parser:h},{code:73,name:"surfaceMDensity",parser:h},{code:72,name:"meshNVertexCount",parser:h},{code:71,name:"meshMVertexCount",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:70,name:"flag",parser:h},{code:39,name:"thickness",parser:h},{code:30,name:"elevation",parser:h},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:h},...V];class Kh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Zh(this,"parser",S(Gd,Wd))}}Zh(Kh,"ForEntityName","POLYLINE");(it={})[it.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",it[it.CURVE_FIT=2]="CURVE_FIT",it[it.SPLINE_FIT=4]="SPLINE_FIT",it[it.POLYLINE_3D=8]="POLYLINE_3D",it[it.POLYGON_3D=16]="POLYGON_3D",it[it.CLOSED_POLYGON=32]="CLOSED_POLYGON",it[it.POLYFACE=64]="POLYFACE",it[it.CONTINUOUS=128]="CONTINUOUS";var ui=((te={})[te.NONE=0]="NONE",te[te.QUADRATIC=5]="QUADRATIC",te[te.CUBIC=6]="CUBIC",te[te.BEZIER=8]="BEZIER",te);function Qh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Hd=[{code:11,name:"direction",parser:_},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class Jh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Qh(this,"parser",S(Hd))}}function tl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Qh(Jh,"ForEntityName","RAY");let Ud=[...sn("data"),{code:70,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class el{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){tl(this,"parser",S(Ud))}}function sl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}tl(el,"ForEntityName","REGION");let Xd={vertices:[],backLineVertices:[]},Yd=[{code:360,name:"geometrySettingHardId",parser:h},{code:12,name:"backLineVertices",isMultiple:!0,parser:_},{code:93,name:"numberOfBackLineVertices",parser:h},{code:11,name:"vertices",isMultiple:!0,parser:_},{code:92,name:"verticesCount",parser:h},{code:[63,411],name:"indicatorColor",parser:h},{code:70,name:"indicatorTransparency",parser:h},{code:41,name:"bottomHeight",parser:h},{code:40,name:"topHeight",parser:h},{code:10,name:"verticalDirection",parser:_},{code:1,name:"name",parser:h},{code:91,name:"flag",parser:h},{code:90,name:"state",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class il{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){sl(this,"parser",S(Yd,Xd))}}function nl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}sl(il,"ForEntityName","SECTION");let $d={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},qd=[{code:210,name:"extrusionDirection",parser:_},{code:39,name:"thickness",parser:h},{code:[...$i(10,14)],name:"points",isMultiple:!0,parser:_},{code:100,name:"subclassMarker",parser:h},...V];class rl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nl(this,"parser",S(qd,$d))}}function al(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}nl(rl,"ForEntityName","SOLID");let Zd=[{code:350,name:"historyObjectSoftId",parser:h},{code:100,name:"subclassMarker",parser:h},...sn("data"),{code:70,name:"version",parser:h},{code:100},...V];class ol{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){al(this,"parser",S(Zd))}}function hl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}al(ol,"ForEntityName","3DSOLID");let Kd={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Qd=[{code:11,name:"fitPoints",isMultiple:!0,parser:_},{code:10,name:"controlPoints",isMultiple:!0,parser:_},{code:41,name:"weights",isMultiple:!0,parser:h},{code:40,name:"knots",isMultiple:!0,parser:h},{code:13,name:"endTangent",parser:_},{code:12,name:"startTangent",parser:_},{code:44,name:"fitTolerance",parser:h},{code:43,name:"controlTolerance",parser:h},{code:42,name:"knotTolerance",parser:h},{code:74,name:"numberOfFitPoints",parser:h},{code:73,name:"numberOfControlPoints",parser:h},{code:72,name:"numberOfKnots",parser:h},{code:71,name:"degree",parser:h},{code:70,name:"flag",parser:h},{code:210,name:"normal",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class ll{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){hl(this,"parser",S(Qd,Kd))}}hl(ll,"ForEntityName","SPLINE");(bt={})[bt.NONE=0]="NONE",bt[bt.CLOSED=1]="CLOSED",bt[bt.PERIODIC=2]="PERIODIC",bt[bt.RATIONAL=4]="RATIONAL",bt[bt.PLANAR=8]="PLANAR",bt[bt.LINEAR=16]="LINEAR";function cl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Jd=[{code:280,name:"shadowMapSoftness",parser:h},{code:71,name:"shadowMapSize",parser:h},{code:70,name:"shadowType",parser:h},{code:292,name:"isSummerTime",parser:O},{code:92,name:"time",parser:h},{code:91,name:"julianDay",parser:h},{code:291,name:"hasShadow",parser:O},{code:40,name:"intensity",parser:h},{code:421,name:"lightColorInstance",parser:h},{code:63,name:"lightColorIndex",parser:h},{code:290,name:"isOn",parser:O},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V.filter(i=>i.code!==100)];class dl{parseEntity(t,e){let s={layer:""};return this.parser(e,t,s),s}constructor(){cl(this,"parser",S(Jd))}}cl(dl,"ForEntityName","SUN");class fi{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=ma(we(t)),e=t.lastReadGroup;break;case 11:s.directionVector=ma(we(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerBlockRecordSoftId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(n,r){let a=!1,o=!1,l={};for(;!n.isEOF()&&r.code!==0&&!o;)switch(r.code){case 171:if(a){o=!0;continue}l.cellType=r.value,a=!0,r=n.next();break;case 172:l.flagValue=r.value,r=n.next();break;case 173:l.mergedValue=r.value,r=n.next();break;case 174:l.autoFit=r.value,r=n.next();break;case 175:l.borderWidth=r.value,r=n.next();break;case 176:l.borderHeight=r.value,r=n.next();break;case 91:l.overrideFlag=r.value,r=n.next();break;case 178:l.virtualEdgeFlag=r.value,r=n.next();break;case 145:l.rotation=r.value,r=n.next();break;case 345:l.fieldObjetId=r.value,r=n.next();break;case 340:l.blockTableRecordId=r.value,r=n.next();break;case 146:l.blockScale=r.value,r=n.next();break;case 177:l.blockAttrNum=r.value,r=n.next();break;case 7:l.textStyle=r.value,r=n.next();break;case 140:l.textHeight=r.value,r=n.next();break;case 170:l.attachmentPoint=r.value,r=n.next();break;case 92:l.extendedCellFlags=r.value,r=n.next();break;case 285:l.rightBorderVisibility=!!(r.value??!0),r=n.next();break;case 286:l.bottomBorderVisibility=!!(r.value??!0),r=n.next();break;case 288:l.leftBorderVisibility=!!(r.value??!0),r=n.next();break;case 289:l.topBorderVisibility=!!(r.value??!0),r=n.next();break;case 301:(function(c,u,d){for(;d.code!==304;)switch(d.code){case 301:case 93:case 90:case 94:d=u.next();break;case 1:c.text=d.value,d=u.next();break;case 300:c.attrText=d.value,d=u.next();break;case 302:c.text=d.value?d.value:c.text,d=u.next();break;default:d=u.next()}})(l,n,r),r=n.next();break;default:return l}return a=!1,o=!1,l}(t,e)),e=t.lastReadGroup;break;default:Zc(s,e,t),e=t.next()}}return s}}function ul(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}(mn="ForEntityName")in fi?Object.defineProperty(fi,mn,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):fi[mn]="ACAD_TABLE";let tu=[{code:11,name:"xAxisDirection",parser:_},{code:210,name:"extrusionDirection",parser:_},{code:1,name:"text",parser:h},{code:10,name:"position",parser:_},{code:3,name:"styleName",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class pl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ul(this,"parser",S(tu))}}ul(pl,"ForEntityName","TOLERANCE");var eu=((nt={})[nt.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",nt[nt.TANGENT_DEFINED=2]="TANGENT_DEFINED",nt[nt.NOT_USED=4]="NOT_USED",nt[nt.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",nt[nt.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",nt[nt.FOR_POLYLINE=32]="FOR_POLYLINE",nt[nt.FOR_POLYGON=64]="FOR_POLYGON",nt[nt.POLYFACE=128]="POLYFACE",nt);let su=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:h},{code:361,name:"sunId",parser:h},{code:431,name:"ambientLightColorName",parser:h},{code:421,name:"ambientLightColorInstance",parser:h},{code:63,name:"ambientLightColorIndex",parser:h},{code:142,name:"contrast",parser:h},{code:141,name:"brightness",parser:h},{code:282,name:"defaultLightingType",parser:h},{code:292,name:"isDefaultLighting",parser:O},{code:348,name:"visualStyleId",parser:h},{code:333,name:"shadePlotId",parser:h},{code:332,name:"backgroundId",parser:h},{code:61,name:"majorGridFrequency",parser:h},{code:170,name:"shadePlotMode",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:346,name:"ucsBaseId",parser:h},{code:345,name:"ucsId",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:74,name:"iconFlag",parser:h},{code:71,name:"ucsPerViewport",parser:h},{code:281,name:"renderMode",parser:h},{code:1,name:"sheetName",parser:h},{code:340,name:"clippingBoundaryId",parser:h},{code:90,name:"statusBitFlags",parser:h},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:h},{code:72,name:"circleZoomPercent",parser:h},{code:51,name:"viewTwistAngle",parser:h},{code:50,name:"snapAngle",parser:h},{code:45,name:"viewHeight",parser:h},{code:44,name:"backClipZ",parser:h},{code:43,name:"frontClipZ",parser:h},{code:42,name:"perspectiveLensLength",parser:h},{code:17,name:"targetPoint",parser:_},{code:16,name:"viewDirection",parser:_},{code:15,name:"gridSpacing",parser:_},{code:14,name:"snapSpacing",parser:_},{code:13,name:"snapBase",parser:_},{code:12,name:"displayCenter",parser:_},{code:69,name:"viewportId",parser:h},{code:68,name:"status",parser:h},{code:41,name:"height",parser:h},{code:40,name:"width",parser:h},{code:10,name:"viewportCenter",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...V];class bi{parseEntity(t,e){let s={};return S(su)(e,t,s),s}}function gl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}(yn="ForEntityName")in bi?Object.defineProperty(bi,yn,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):bi[yn]="VIEWPORT";let iu={brightness:50,constrast:50,fade:0},nu=[{code:14,name:"boundary",isMultiple:!0,parser:_},{code:91,name:"numberOfVertices",parser:h},{code:71,name:"boundaryType",parser:h},{code:360,name:"imageDefReactorHardId",parser:h},{code:283,name:"fade",parser:h},{code:282,name:"contrast",parser:h},{code:281,name:"brightness",parser:h},{code:280,name:"isClipping",parser:O},{code:70,name:"displayFlag",parser:h},{code:340,name:"imageDefHardId",parser:h},{code:13,name:"imageSize",parser:_},{code:12,name:"vDirection",parser:_},{code:11,name:"uDirection",parser:_},{code:10,name:"position",parser:_},{code:90,name:"classVersion",parser:h},{code:100,name:"subclassMarker",parser:h},...V];class ml{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){gl(this,"parser",S(nu,iu))}}gl(ml,"ForEntityName","WIPEOUT");(ee={})[ee.ShowImage=1]="ShowImage",ee[ee.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",ee[ee.UseClippingBoundary=4]="UseClippingBoundary",ee[ee.Transparency=8]="Transparency";function yl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let ru=[{code:11,name:"direction",parser:_},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...V];class _l{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){yl(this,"parser",S(ru))}}yl(_l,"ForEntityName","XLINE");let au=0;function wl(i){if(!i)throw TypeError("entity cannot be undefined or null");i.handle||(i.handle=au++)}let ou=Object.fromEntries([hh,_i,mh,xh,bh,Ph,yi,Eh,Th,Oh,Ch,Fh,zh,Dh,xi,Wh,Hh,_h,Xh,$h,Kh,Jh,el,il,rl,ol,ll,dl,fi,ph,pl,kh,cr,bi,ml,_l].map(i=>[i.ForEntityName,new i]));function xl(i,t){let e=[];for(;!N(i,0,"EOF");){if(i.code===0){if(i.value==="ENDBLK"||i.value==="ENDSEC"){t.rewind();break}let s=ou[i.value];if(s){let n=i.value;i=t.next();let r=s.parseEntity(t,i);r.type=n,wl(r),e.push(r)}else t.debug}i=t.next()}return e}function fs(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class _a{next(){if(!this.hasNext())return this._eof?this.debug:this.debug,{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=wa(t,this._data[this._pointer++],this.debug),s={code:t,value:e};return N(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=wa(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){fs(this,"_data",void 0),fs(this,"debug",void 0),fs(this,"_pointer",void 0),fs(this,"_eof",void 0),fs(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function wa(i,t,e=!1){return i<=9?t:i>=10&&i<=59?parseFloat(t.trim()):i>=60&&i<=99?parseInt(t.trim()):i>=100&&i<=109?t:i>=110&&i<=149?parseFloat(t.trim()):i>=160&&i<=179?parseInt(t.trim()):i>=210&&i<=239?parseFloat(t.trim()):i>=270&&i<=289?parseInt(t.trim()):i>=290&&i<=299?function(s){if(s==="0")return!1;if(s==="1")return!0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(t.trim()):i>=300&&i<=369?t:i>=370&&i<=389?parseInt(t.trim()):i>=390&&i<=399?t:i>=400&&i<=409?parseInt(t.trim()):i>=410&&i<=419?t:i>=420&&i<=429?parseInt(t.trim()):i>=430&&i<=439?t:i>=440&&i<=459?parseInt(t.trim()):i>=460&&i<=469?parseFloat(t.trim()):i>=470&&i<=481||i===999||i>=1e3&&i<=1009?t:i>=1010&&i<=1059?parseFloat(t.trim()):i>=1060&&i<=1071?parseInt(t.trim()):t}function hu(i,t){let e=null,s={};for(;!N(i,0,"EOF")&&!N(i,0,"ENDSEC");)i.code===9?e=i.value:i.code===10?s[e]=we(t):s[e]=i.value,i=t.next();return s}let ce=[{code:100,name:"subclassMarker",parser:h},{code:330,name:"ownerObjectId",parser:h},{code:102,isMultiple:!0,parser(i,t){for(;!N(i,0,"EOF")&&!N(i,102,"}");)i=t.next()}},{code:5,name:"handle",parser:h}],lu=[{code:70,name:"flag",parser:h},{code:2,name:"appName",parser:h},{code:100,name:"subclassMarker",parser:h},...ce],cu=S(lu),du=S([{code:310,name:"bmpPreview",parser:h},{code:281,name:"scalability",parser:h},{code:280,name:"explodability",parser:h},{code:70,name:"insertionUnits",parser:h},{code:340,name:"layoutObjects",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),uu=S([...lr.map(i=>({...i,parser:h})),{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},{code:105,name:"handle",parser:h},...ce.filter(i=>i.code!==5)]),pu=S([{code:347,name:"materialObjectId",parser:h},{code:390,name:"plotStyleNameObjectId",parser:h},{code:370,name:"lineweight",parser:h},{code:290,name:"isPlotting",parser:O},{code:6,name:"lineType",parser:h},{code:62,name:"colorIndex",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),gu=S([{code:9,name:"text",parser:h},{code:45,name:"offsetY",parser:h},{code:44,name:"offsetX",parser:h},{code:50,name:"rotation",parser:h},{code:46,name:"scale",parser:h},{code:340,name:"styleObjectId",parser:h},{code:75,name:"shapeNumber",parser:h},{code:74,name:"elementTypeFlag",parser:h},{code:49,name:"elementLength",parser:h}],{elementTypeFlag:0,elementLength:0}),mu=S([{code:49,name:"pattern",parser(i,t){let e={};return gu(i,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:h},{code:73,name:"numberOfLineTypes",parser:h},{code:72,parser:h},{code:3,name:"description",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),yu=S([{code:1e3,name:"extendedFont",parser:h},{code:1001},{code:4,name:"bigFont",parser:h},{code:3,name:"font",parser:h},{code:42,name:"lastHeight",parser:h},{code:71,name:"textGenerationFlag",parser:h},{code:50,name:"obliqueAngle",parser:h},{code:41,name:"widthFactor",parser:h},{code:40,name:"fixedTextHeight",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),_u=[{code:13,name:"orthographicOrigin",parser:_},{code:71,name:"orthographicType",parser:h},{code:346,name:"baseUcsHandle",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"isOrthographic",parser:O},{code:12,name:"yAxis",parser:_},{code:11,name:"xAxis",parser:_},{code:10,name:"origin",parser:_},{code:70,name:"flag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce],wu=S(_u),xu=[{code:346,name:"baseUcsId",parser:h},{code:345,name:"ucsId",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:361,name:"sunHardId",parser:h},{code:348,name:"styleHardId",parser:h},{code:334,name:"liveSectionSoftId",parser:h},{code:332,name:"backgroundSoftId",parser:h},{code:73,name:"isPlottable",parser:O},{code:72,name:"isUcsAssociated",parser:O},{code:281,name:"renderMode",parser:h},{code:71,name:"viewMode",parser:h},{code:50,name:"twistAngle",parser:h},{code:44,name:"backClippingPlane",parser:h},{code:43,name:"frontClippingPlane",parser:h},{code:42,name:"lensLength",parser:h},{code:12,name:"target",parser:_},{code:11,name:"direction",parser:_},{code:10,name:"center",parser:_},{code:41,name:"width",parser:h},{code:40,name:"height",parser:h},{code:70,name:"flag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce],fu=S(xu),bu=S([{code:[63,421,431],name:"ambientColor",parser:h},{code:142,name:"contrast",parser:h},{code:141,name:"brightness",parser:h},{code:282,name:"defaultLightingType",parser:h},{code:292,name:"isDefaultLightingOn",parser:O},{code:348,name:"visualStyleObjectId",parser:h},{code:333,name:"shadePlotObjectId",parser:h},{code:332,name:"backgroundObjectId",parser:h},{code:61,name:"majorGridLines",parser:h},{code:170,name:"shadePlotSetting",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:74,name:"ucsIconSetting",parser:h},{code:71,name:"viewMode",parser:h},{code:281,name:"renderMode",parser:h},{code:1,name:"styleSheet",parser:h},{code:[331,441],name:"frozenLayers",parser:h,isMultiple:!0},{code:72,name:"circleSides",parser:h},{code:51,name:"viewTwistAngle",parser:h},{code:50,name:"snapRotationAngle",parser:h},{code:45,name:"viewHeight",parser:h},{code:44,name:"backClippingPlane",parser:h},{code:43,name:"frontClippingPlane",parser:h},{code:42,name:"lensLength",parser:h},{code:17,name:"viewTarget",parser:_},{code:16,name:"viewDirectionFromTarget",parser:_},{code:15,name:"gridSpacing",parser:_},{code:14,name:"snapSpacing",parser:_},{code:13,name:"snapBasePoint",parser:_},{code:12,name:"center",parser:_},{code:11,name:"upperRightCorner",parser:_},{code:10,name:"lowerLeftCorner",parser:_},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ce]),Iu={APPID:cu,BLOCK_RECORD:du,DIMSTYLE:uu,LAYER:pu,LTYPE:mu,STYLE:yu,UCS:wu,VIEW:fu,VPORT:bu},Pu=S([{code:70,name:"maxNumberOfEntries",parser:h},{code:100,name:"subclassMarker",parser:h},{code:330,name:"ownerObjectId",parser:h},{code:102,parser:jt},{code:102,parser:jt},{code:102,parser:jt},{code:360,isMultiple:!0},{code:5,name:"handle",parser:h},{code:2,name:"name",parser:h}]);function Su(i,t){var s;let e={};for(;!N(i,0,"EOF")&&!N(i,0,"ENDSEC");){if(N(i,0,"TABLE")){i=t.next();let n={entries:[]};Pu(i,t,n),e[n.name]=n}if(N(i,0)&&!N(i,0,"ENDTAB")){let n=i.value;i=t.next();let r=Iu[n];if(!r){t.debug,i=t.next();continue}let a={};r(i,t,a),(s=e[n])==null||s.entries.push(a)}i=t.next()}return e}function Eu(i,t){let e={};for(;!N(i,0,"EOF")&&!N(i,0,"ENDSEC");){if(N(i,0,"BLOCK")){let s=Au(i=t.next(),t);wl(s),s.name&&(e[s.name]=s)}i=t.next()}return e}function Au(i,t){let e={};for(;!N(i,0,"EOF");){if(N(i,0,"ENDBLK")){for(i=t.next();!N(i,0,"EOF");){if(N(i,100,"AcDbBlockEnd"))return e;i=t.next()}break}switch(i.code){case 1:e.xrefPath=i.value;break;case 2:e.name=i.value;break;case 3:e.name2=i.value;break;case 5:e.handle=i.value;break;case 8:e.layer=i.value;break;case 10:e.position=we(t);break;case 67:e.paperSpace=!!i.value&&i.value==1;break;case 70:i.value!==0&&(e.type=i.value);break;case 100:break;case 330:e.ownerHandle=i.value;break;case 0:e.entities=xl(i,t)}i=t.next()}return e}let dr=[{code:330,name:"ownerObjectId",parser:h},{code:102,parser:jt},{code:102,parser:jt},{code:102,parser:jt},{code:5,name:"handle",parser:h}],fl=[{code:333,name:"shadePlotId",parser:h},{code:149,name:"imageOriginY",parser:h},{code:148,name:"imageOriginX",parser:h},{code:147,name:"scaleFactor",parser:h},{code:78,name:"shadePlotCustomDPI",parser:h},{code:77,name:"shadePlotResolution",parser:h},{code:76,name:"shadePlotMode",parser:h},{code:75,name:"standardScaleType",parser:h},{code:7,name:"currentStyleSheet",parser:h},{code:74,name:"plotType",parser:h},{code:73,name:"plotRotation",parser:h},{code:72,name:"plotPaperUnit",parser:h},{code:70,name:"layoutFlag",parser:h},{code:143,name:"printScaleDenominator",parser:h},{code:142,name:"printScaleNumerator",parser:h},{code:141,name:"windowAreaYMax",parser:h},{code:140,name:"windowAreaXMax",parser:h},{code:49,name:"windowAreaYMin",parser:h},{code:48,name:"windowAreaXMin",parser:h},{code:47,name:"plotOriginY",parser:h},{code:46,name:"plotOriginX",parser:h},{code:45,name:"paperHeight",parser:h},{code:44,name:"paperWidth",parser:h},{code:43,name:"marginTop",parser:h},{code:42,name:"marginRight",parser:h},{code:41,name:"marginBottom",parser:h},{code:40,name:"marginLeft",parser:h},{code:6,name:"plotViewName",parser:h},{code:4,name:"paperSize",parser:h},{code:2,name:"configName",parser:h},{code:1,name:"pageSetupName",parser:h},{code:100,name:"subclassMarker",parser:h},...dr],Tu=[{code:346,name:"orthographicUcsId",parser:h},{code:345,name:"namedUcsId",parser:h},{code:331,name:"viewportId",parser:h},{code:330,name:"paperSpaceTableId",parser:h},{code:76,name:"orthographicType",parser:h},{code:17,name:"ucsYAxis",parser:_},{code:16,name:"ucsXAxis",parser:_},{code:13,name:"ucsOrigin",parser:_},{code:146,name:"elevation",parser:h},{code:15,name:"maxExtent",parser:_},{code:14,name:"minExtent",parser:_},{code:12,name:"insertionPoint",parser:_},{code:11,name:"maxLimit",parser:_},{code:10,name:"minLimit",parser:_},{code:71,name:"tabOrder",parser:h},{code:70,name:"controlFlag",parser:h},{code:1,name:"layoutName",parser:h},{code:100,name:"subclassMarker",parser:h},...fl],Mu=[{code:3,name:"entries",parser:(i,t)=>{let e={name:i.value};return(i=t.next()).code===350?e.objectSoftId=i.value:i.code===360?e.objectHardId=i.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:h},{code:280,name:"isHardOwned",parser:O},{code:100,name:"subclassMarker",parser:h},...dr],vu=[{code:40,name:"wcsToOCSTransform",parser:xa},{code:40,name:"ocsToWCSTransform",parser:xa},{code:41,name:"backClippingDistance",parser:h},{code:73,name:"isBackClipping",parser:O,pushContext:!0},{code:40,name:"frontClippingDistance",parser:h},{code:72,name:"isFrontClipping",parser:O,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:O},{code:11,name:"position",parser:_},{code:210,name:"normal",parser:_},{code:10,name:"boundaryVertices",parser:_,isMultiple:!0},{code:70,name:"boundaryCount",parser:h},{code:100,name:"subclassMarker",parser:h},{code:100},...dr];function xa(i,t){let e=[];for(let s=0;s<3&&N(i,40);++s){let n=[];for(let r=0;r<4&&N(i,40);++r)n.push(i.value),i=t.next();e.push(n)}return t.rewind(),e}let ku=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:h},{code:90,name:"version",parser:h},{code:1,name:"fileName",parser:h},{code:10,name:"size",parser:_},{code:11,name:"sizeOfOnePixel",parser:_},{code:280,name:"isLoaded",parser:h},{code:281,name:"resolutionUnits",parser:h},{code:100,name:"subclassMarker",parser:h}],Lu={LAYOUT:Tu,PLOTSETTINGS:fl,DICTIONARY:Mu,SPATIAL_FILTER:vu,IMAGEDEF:ku};function Ou(i,t){let e=[];for(;i.code!==0||!["EOF","ENDSEC"].includes(i.value);){let s=i.value,n=Lu[s];if(i.code===0&&(n!=null&&n.length)){let r=S(n),a={name:s};r(i=t.next(),t,a)?(e.push(a),i=t.peek()):i=t.next()}else i=t.next()}return{byName:Xc(e,({name:s})=>s)}}function Ls(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class Nu{constructor(){Ls(this,"encoding","utf-8"),Ls(this,"encodingFailureFatal",!1),Ls(this,"thumbnailImageFormat","base64")}}class Cu extends EventTarget{parseSync(t,e=!1){let s=new _a(t.split(/\r\n|\r|\n/g),e);if(!s.hasNext())throw Error("Empty file");return this.parseAll(s)}parseStream(t){let e="",s=this;return new Promise((n,r)=>{t.on("data",a=>{e+=a}),t.on("end",()=>{try{let a=e.split(/\r\n|\r|\n/g),o=new _a(a);if(!o.hasNext())throw Error("Empty file");n(s.parseAll(o))}catch(a){r(a)}}),t.on("error",a=>{r(a)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let n=s.body.getReader(),r="";for(;;){let{done:a,value:o}=await n.read();if(a){r+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}r+=this._decoder.decode(o,{stream:!0})}return this.parseSync(r)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!N(s,0,"EOF");)N(s,0,"SECTION")&&(N(s=t.next(),2,"HEADER")?e.header=hu(s=t.next(),t):N(s,2,"CLASSES")?Lc(s=t.next(),t,e):N(s,2,"BLOCKS")?e.blocks=Eu(s=t.next(),t):N(s,2,"ENTITIES")?e.entities=xl(s=t.next(),t):N(s,2,"TABLES")?e.tables=Su(s=t.next(),t):N(s,2,"OBJECTS")?e.objects=Ou(s=t.next(),t):N(s,2,"THUMBNAILIMAGE")&&(e.thumbnailImage=function(n,r,a="base64"){let o,l="",c=0;for(;!N(n,0,"EOF")&&!N(n,0,"ENDSEC");)n.code===90?c=n.value:n.code===310&&(l+=n.value),n=r.next();if(a==="hex")o=l;else{let u=function(d){let g=d.length/2,p=new Uint8Array(g);for(let m=0;m<g;m++)p[m]=parseInt(d.substr(2*m,2),16);return p}(l);o=a==="buffer"?u:function(d){let g="";for(let p=0;p<d.length;p++)g+=String.fromCharCode(d[p]);return btoa(g)}(u)}return{size:c,data:o}}(s=t.next(),t,this._options.thumbnailImageFormat))),s=t.next();return e}constructor(t={}){super(),Ls(this,"_decoder",void 0),Ls(this,"_options",void 0);let e=new Nu;this._options=Object.assign(e,t),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(It={})[It.NOT_APPLICABLE=0]="NOT_APPLICABLE",It[It.KEEP_EXISTING=1]="KEEP_EXISTING",It[It.USE_CLONE=2]="USE_CLONE",It[It.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",It[It.VALUE_NAME=4]="VALUE_NAME",It[It.UNMANGLE_NAME=5]="UNMANGLE_NAME";(Fe={})[Fe.NOUNIT=0]="NOUNIT",Fe[Fe.CENTIMETERS=2]="CENTIMETERS",Fe[Fe.INCH=5]="INCH";(xs={})[xs.PSLTSCALE=1]="PSLTSCALE",xs[xs.LIMCHECK=2]="LIMCHECK";(Re={})[Re.INCHES=0]="INCHES",Re[Re.MILLIMETERS=1]="MILLIMETERS",Re[Re.PIXELS=2]="PIXELS";(Pt={})[Pt.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Pt[Pt.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Pt[Pt.DRAWING_LIMITS=2]="DRAWING_LIMITS",Pt[Pt.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Pt[Pt.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Pt[Pt.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(se={})[se.AS_DISPLAYED=0]="AS_DISPLAYED",se[se.WIREFRAME=1]="WIREFRAME",se[se.HIDDEN=2]="HIDDEN",se[se.RENDERED=3]="RENDERED";(St={})[St.DRAFT=0]="DRAFT",St[St.PREVIEW=1]="PREVIEW",St[St.NORMAL=2]="NORMAL",St[St.PRESENTATION=3]="PRESENTATION",St[St.MAXIMUM=4]="MAXIMUM",St[St.CUSTOM=5]="CUSTOM";(ie={})[ie.NONE=0]="NONE",ie[ie.AbsoluteRotation=1]="AbsoluteRotation",ie[ie.TextEmbedded=2]="TextEmbedded",ie[ie.ShapeEmbedded=4]="ShapeEmbedded";(_n={})[_n.PaperSpace=1]="PaperSpace";(ze={})[ze.XrefDependent=16]="XrefDependent",ze[ze.XrefResolved=32]="XrefResolved",ze[ze.Referenced=64]="Referenced";(Et={})[Et.Off=0]="Off",Et[Et.Perspective=1]="Perspective",Et[Et.ClipFront=2]="ClipFront",Et[Et.ClipBack=4]="ClipBack",Et[Et.UcsFollow=8]="UcsFollow",Et[Et.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class Bu{parse(t){const e=new Cu,s=this.getDxfInfoFromBuffer(t);let n="";return s.version&&s.version.value<=23&&s.encoding?n=new TextDecoder(s.encoding).decode(t):n=new TextDecoder().decode(t),e.parseSync(n)}getDxfInfoFromBuffer(t){var c,u,d;const s=new TextDecoder("utf-8");let n=0,r="",a=null,o=null,l=!1;for(;n<t.byteLength;){const g=Math.min(n+65536,t.byteLength),p=t.slice(n,g);n=g;const y=(r+s.decode(p,{stream:!0})).split(/\r?\n/);r=y.pop()??"";for(let x=0;x<y.length;x++){const f=y[x].trim();if(f==="SECTION"&&((c=y[x+2])==null?void 0:c.trim())==="HEADER")l=!0;else if(f==="ENDSEC"&&l)return{version:a,encoding:o};if(l&&f==="$ACADVER"){const P=(u=y[x+2])==null?void 0:u.trim();P&&(a=new vt(P))}else if(l&&f==="$DWGCODEPAGE"){const P=(d=y[x+2])==null?void 0:d.trim();if(P){const I=Wn[P];o=Fa(I)}}if(a&&o)return{version:a,encoding:o}}}return{version:a,encoding:o}}}class fa{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="ATTDEF"?this.convertAttributeDefinition(t):t.type=="ATTRIB"?this.convertAttribute(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new ki;return t.vertices.forEach((s,n)=>e.setVertexAt(n,s)),e}convertArc(t){const e=t.extrusionDirection??b.Z_AXIS;return new Ei(Mn(t.center,e),t.radius,v.degToRad(t.startAngle),v.degToRad(t.endAngle),e)}convertAttributeCommon(t,e){e.textString=t.text,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=t.rotation,e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.tag=t.tag,e.fieldLength=0,e.isInvisible=(t.attributeFlag&J.Invisible)!==0,e.isConst=(t.attributeFlag&J.Const)!==0,e.isVerifiable=(t.attributeFlag&J.Verifiable)!==0,e.isPreset=(t.attributeFlag&J.Preset)!==0,e.isReallyLocked=!!t.isReallyLocked,e.isMTextAttribute=(t.mtextFlag&zt.MultiLine)!==0,e.isConstMTextAttribute=(t.mtextFlag&zt.ConstMultiLine)!==0}convertAttribute(t){const e=new Ti;return this.convertAttributeCommon(t,e),e.styleName=t.textStyle,e.horizontalMode=t.horizontalJustification,e.verticalMode=t.verticalJustification,e.widthFactor=t.scale??1,e.lockPositionInBlock=t.lockPositionFlag,e}convertAttributeDefinition(t){const e=new Ai;return this.convertAttributeCommon(t,e),e.styleName=t.styleName,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e.prompt=t.prompt,e}convertCirle(t){const e=t.extrusionDirection??b.Z_AXIS;return new Mi(Mn(t.center,e),t.radius,e)}convertEllipse(t){const e=new b(t.majorAxisEndPoint),s=e.length();return new vi(t.center,t.extrusionDirection??b.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new zs(new w(e.x,e.y,e.z||0),new w(s.x,s.y,s.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new Ds(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0)return new Ds(t.fitPoints,"Uniform",t.degree,!!(t.flag&1))}catch{}return null}convertPoint(t){const e=new Bi;return e.position=t.position,e}convertSolid(t){const e=new Ni;return t.points.forEach((s,n)=>e.setPointAt(n,s)),e.thickness=t.thickness,e}convertPolyline(t){var u;const e=!!(t.flag&1),s=!!(t.flag&8),n=!!(t.flag&16),r=!!(t.flag&64),a=!!(t.flag&32),o=[],l=[],c=[];if((u=t.vertices)==null||u.map(d=>{d.flag&eu.SPLINE_CONTROL_POINT||(r&&d.flag&128?d.flag&64?(o.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)):d.faces&&d.faces.length>=3&&c.push([...d.faces]):(o.push({x:d.x,y:d.y,z:d.z}),l.push(d.bulge??0)))}),n){const d=t.meshMVertexCount,g=t.meshNVertexCount;return new Di(d,g,o,e,a)}else{if(r)return new ji(o,c);if(s){let d=Ms.SimplePoly;return t.flag&4&&(t.smoothType==ui.CUBIC?d=Ms.CubicSplinePoly:t.smoothType==ui.QUADRATIC&&(d=Ms.QuadSplinePoly)),new Si(d,o,e)}else{let d=$e.SimplePoly;return t.flag&2?d=$e.FitCurvePoly:t.flag&4&&(t.smoothType==ui.CUBIC?d=$e.CubicSplinePoly:t.smoothType==ui.QUADRATIC&&(d=$e.QuadSplinePoly)),new Pi(d,o,0,e,t.startWidth,t.endWidth,l)}}}convertLWPolyline(t){var n;const e=new Ci;e.closed=!!(t.flag&1);const s=t.constantWidth??-1;return(n=t.vertices)==null||n.forEach((r,a)=>{e.addVertexAt(a,new k(r.x,r.y),r.bulge,r.startWidth??s,r.endWidth??s)}),e}convertHatch(t){var n;const e=new Rs;if((n=t.definitionLines)==null||n.forEach(r=>{e.definitionLines.push({angle:v.degToRad(r.angle||0),base:r.base,offset:r.offset,dashLengths:r.numberOfDashLengths>0?r.dashLengths:[]})}),e.isSolidFill=t.solidFill==Pc.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:v.degToRad(t.patternAngle),e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(r=>{if(r.boundaryPathTypeFlag&2){const o=r,l=new Mt;l.closed=o.isClosed,o.vertices.forEach((c,u)=>{l.addVertexAt(u,{x:c.x,y:c.y,bulge:c.bulge})}),e.add(l)}else{const o=r,l=[];o.edges.forEach(u=>{if(u.type==1){const d=u;l.push(new Vt(d.start,d.end))}else if(u.type==2){const d=u;l.push(new ye(d.center,d.radius,v.degToRad(d.startAngle||0),v.degToRad(d.endAngle||0),!d.isCCW))}else if(u.type==3){const d=u;new Y().subVectors(d.end,d.center);const p=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),m=p*d.lengthOfMinorAxis;let y=v.degToRad(d.startAngle||0),x=v.degToRad(d.endAngle||0);const f=Math.atan2(d.end.y,d.end.x);d.isCCW||(y=Math.PI*2-y,x=Math.PI*2-x),l.push(new Bs({...d.center,z:0},p,m,y,x,!d.isCCW,f))}else if(u.type==4){const d=u;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const g=d.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let p=!0;const m=d.controlPoints.map(y=>(y.weight==null&&(p=!1),y.weight||1));l.push(new Dt(g,d.knots,p?m:void 0))}else if(d.numberOfFitData>0){const g=d.fitDatum.map(p=>({x:p.x,y:p.y,z:0}));l.push(new Dt(g,"Uniform"))}}});const c=Fs.buildFromEdges(l);c.length==0&&l.length>0?e.add(new Fs(l)):c.forEach(u=>e.add(u))}}),t.gradientFlag){const r=t;if(e.hatchObjectType=nr.GradientObject,e.gradientName=r.gradientName,e.gradientAngle=r.gradientRotation??0,e.gradientShift=r.gradientDefinition??0,e.gradientOneColorMode=r.gradientColorFlag==1,e.shadeTintValue=r.colorTint??0,r.gradientColors){const a=r.gradientColors.length;a>1?(e.gradientStartColor=r.gradientColors[0].rgb,e.gradientEndColor=r.gradientColors[1].rgb):a>0&&(e.gradientStartColor=r.gradientColors[0].rgb)}}return e}convertTable(t){const e=new Oi(t.name,t.rowCount,t.columnCount);return e.tableDataVersion=t.version,e.tableStyleId=t.tableStyleId,e.owningBlockRecordId=t.blockRecordHandle,t.directionVector&&(e.horizontalDirection=new b(t.directionVector)),e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),e.tableValueFlag=t.tableValue,e.tableOverrideFlag=t.overrideFlag,e.borderColorOverrideFlag=t.borderColorOverrideFlag,e.borderLineweightOverrideFlag=t.borderLineWeightOverrideFlag,e.borderVisibilityOverrideFlag=t.borderVisibilityOverrideFlag,t.columnWidthArr.forEach((s,n)=>e.setColumnWidth(n,s)),t.rowHeightArr.forEach((s,n)=>e.setRowHeight(n,s)),t.cells.forEach((s,n)=>{e.setCell(n,s)}),e}convertText(t){const e=new es;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=v.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Vs;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=v.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new b(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new Li;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"){const e=t,s=new Ws(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(s.dimBlockPosition={...e.insertionPoint,z:0}),s.rotation=v.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new Yi(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(s.dimBlockPosition={...e.insertionPoint,z:0}),s.rotation=v.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new Gi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new Ui(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new Xi(e.definitionPoint,e.subDefinitionPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new Hi(e.definitionPoint,e.subDefinitionPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new k(s))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new js;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(s=>{e.clipBoundary.push(new k(s))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new zi;return this.processWipeout(t,e),e}convertViewport(t){const e=new Ri;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Fi;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new Vi;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new Ge(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?v.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle.toString()),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=!t.isVisible),t.transparency!=null&&(e.transparency=Qi.deserialize(t.transparency))}}class Fu{convertLayout(t,e){var r,a;const s=new qs;s.layoutName=t.layoutName,s.tabOrder=t.tabOrder,s.plotSettingsName=t.pageSetupName,s.plotCfgName=t.configName,s.canonicalMediaName=t.paperSize,s.plotViewName=t.plotViewName,s.currentStyleSheet=t.currentStyleSheet,s.plotPaperMargins={left:t.marginLeft,right:t.marginRight,top:t.marginTop,bottom:t.marginBottom},s.plotPaperSize.copy({x:t.paperWidth,y:t.paperHeight}),s.plotOrigin.copy({x:t.plotOriginX,y:t.plotOriginY}),s.plotWindowArea.min.copy({x:t.windowAreaXMin,y:t.windowAreaYMin}),s.plotWindowArea.max.copy({x:t.windowAreaXMax,y:t.windowAreaYMax}),s.customPrintScale={numerator:t.printScaleNumerator,denominator:t.printScaleDenominator},s.plotPaperUnits=t.plotPaperUnit,s.plotRotation=t.plotRotation,s.plotType=t.plotType,s.stdScaleType=t.standardScaleType,s.shadePlot=(()=>{switch(t.shadePlotMode){case 1:return qe.kWireframe;case 2:return qe.kHidden;case 3:return qe.kRendered;default:return qe.kAsDisplayed}})(),s.shadePlotResLevel=(()=>{switch(t.shadePlotResolution){case 1:return pe.kPreview;case 2:return pe.kNormal;case 3:return pe.kPresentation;case 4:return pe.kMaximum;case 5:return pe.kCustom;default:return pe.kDraft}})(),t.shadePlotCustomDPI!=null&&(s.shadePlotCustomDPI=t.shadePlotCustomDPI),t.shadePlotId&&(s.shadePlotId=t.shadePlotId);const n=t.layoutFlag??0;if(s.plotViewportBorders=(n&1)!==0,s.showPlotStyles=(n&2)!==0,s.plotCentered=(n&4)!==0,s.plotHidden=(n&8)!==0,s.useStandardScale=(n&16)!==0,s.plotPlotStyles=(n&32)!==0,s.scaleLineweights=(n&64)!==0,s.printLineweights=(n&128)!==0,s.drawViewportsFirst=(n&512)!==0,s.modelType=(n&1024)!==0,t.viewportId&&s.viewportArray.push(t.viewportId),t.layoutName==="Model"){const o=K.MODEL_SPACE_NAME.toUpperCase();(r=e.tables.BLOCK_RECORD)==null||r.entries.some(l=>l.name.toUpperCase()===o?(s.blockTableRecordId=l.handle,!0):!1)}else(a=e.tables.BLOCK_RECORD)==null||a.entries.some(o=>o.layoutObjects===t.handle?(s.blockTableRecordId=o.handle,!0):!1),s.blockTableRecordId||(s.blockTableRecordId=t.paperSpaceTableId);return t.minLimit&&s.limits.min.copy(t.minLimit),t.maxLimit&&s.limits.max.copy(t.maxLimit),t.minExtent&&s.extents.min.copy(t.minExtent),t.maxExtent&&s.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,s),s}convertImageDef(t){const e=new Wo;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,t.ownerObjectId!=null&&(e.ownerId=t.ownerObjectId)}}class bl{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 s=Date.now(),n=this.generateTaskId();try{return await this.executeInWorker(n,t,e||this.config.workerUrl)}catch(r){const a=Date.now()-s;return{success:!1,error:r instanceof Error?r.message:String(r),duration:a}}}async executeInWorker(t,e,s){const n=Date.now();return new Promise((r,a)=>{const o=this.getAvailableWorker(s),l=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(o),a(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:d=>{clearTimeout(l),this.releaseWorker(o),r(d)},reject:d=>{clearTimeout(l),this.releaseWorker(o),a(d)},timeout:l});const c=d=>{const{id:g,success:p,data:m,error:y}=d.data;if(g!==t)return;this.cleanupTask(t);const x=Date.now()-n;r(p?{success:!0,data:m,duration:x}:{success:!1,error:y,duration:x})},u=d=>{this.cleanupTask(t),a(new Error(`Worker error: ${d.message}`))};o.addEventListener("message",c),o.addEventListener("error",u),o.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[s,n]of this.workers)if(!n.isBusy)return n.isBusy=!0,n.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(t,{type:"module"}),n=this.generateWorkerId(),r={worker:s,isBusy:!0,id:n,createdAt:new Date};return this.workers.set(n,r),s}const e=Array.from(this.workers.values()).sort((s,n)=>s.createdAt.getTime()-n.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,s]of this.workers)if(s.worker===t){s.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 Il{constructor(t){this.framework=new bl(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Pl(i){return new Il(i)}class Ru{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:s}=t.data;try{const n=await this.executeTask(s);this.sendResponse(e,!0,n)}catch(n){this.sendResponse(e,!1,void 0,n instanceof Error?n.message:String(n))}}}sendResponse(t,e,s,n){const r={id:t,success:e,data:s,error:n};self.postMessage(r)}}class Sl extends hr{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t,e){const s=this.config,n=this.getParserWorkerTimeout(t,e);if(s.useWorker&&s.parserWorkerUrl){const r=Pl({workerUrl:s.parserWorkerUrl,timeout:n,maxConcurrentWorkers:1}),a=await r.execute(t);if(r.destroy(),a.success)return{model:a.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${a.error}'`)}else return{model:new Bu().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var r;const e=new Map,s=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(r=t.tables.STYLE)==null||r.entries.forEach(a=>{const o=[];if(a.font){const l=s(a.font);l&&o.push(l)}if(a.bigFont){const l=s(a.bigFont);l&&o.push(l)}if(a.extendedFont){const l=s(a.extendedFont);l&&o.push(l)}e.set(a.name,o)});const n=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,n),Array.from(n)}getFontsInBlock(t,e,s,n){const r=/\\f(.*?)\|/g;t.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.matchAll(r)].forEach(u=>{n.add(u[1].toLowerCase())});const c=s.get(o.styleName);c==null||c.forEach(u=>n.add(u))}else if(a.type=="TEXT"){const o=a,l=s.get(o.styleName);l==null||l.forEach(c=>n.add(c))}else if(a.type=="INSERT"){const l=e[a.name];l&&l.entities&&this.getFontsInBlock(l.entities,e,s,n)}})}async processEntities(t,e,s,n,r){const a=new fa;let o=t.entities;const l=o.length,c=new Dn(l,100-n.value,s);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const u=new Map;for(let g=0;g<l;g++){const p=o[g];if(p.type==="ATTRIB"){const m=a.convert(p);if(m&&m.ownerId&&m.ownerId!=="0"){let y=u.get(m==null?void 0:m.ownerId);y==null&&(y=[],u.set(m.ownerId,y)),y.push(m)}}}const d=e.tables.blockTable.modelSpace;await c.processChunk(async(g,p)=>{let m=[],y=g<p?o[g].type:"";for(let f=g;f<p;f++){const P=o[f];if(!(P.ownerBlockRecordSoftId&&P.ownerBlockRecordSoftId!==d.objectId)&&P.type!=="ATTRIB"){const I=a.convert(P);if(I){if(this.config.convertByEntityType&&P.type!==y&&(d.appendEntity(m),m=[],y=P.type),P.type==="INSERT"){const M=u.get(I.objectId);M&&M.length>0&&M.forEach(A=>{I.appendAttributes(A)})}m.push(I)}}}d.appendEntity(m);let x=n.value+p/l*(100-n.value);x>100&&(x=100),r&&await r(x,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(t,e,s=!1){const n=new fa,r=t.length,a=[],o=e.objectId,l=[];for(let c=0;c<r;c++){const u=t[c],d=n.convert(u);d&&(u.type==="ATTRIB"?l.push(d):(!s||u.ownerBlockRecordSoftId===o)&&a.push(d))}e.appendEntity(a),l.forEach(c=>{const u=e.getIdAt(c.ownerId);u&&u.appendAttributes(c)})}processBlocks(t,e){const s=t.blocks;for(const[n,r]of Object.entries(s)){let a=e.tables.blockTable.getAt(r.name);a||(a=new K,a.objectId=r.handle,a.name=n,a.origin.copy(r.position),e.tables.blockTable.add(a)),r.entities?this.processEntitiesInBlock(r.entities,a):a.isPaperSapce&&this.processEntitiesInBlock(t.entities,a,!0)}}processHeader(t,e){const s=t.header;s.$ACADVER&&(e.version=s.$ACADVER),e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,s.$AUNITS!=null&&(e.aunits=s.$AUNITS),e.celtype=s.$CELTYPE||At,e.celtscale=s.$CELTSCALE||1,e.ltscale=s.$LTSCALE||1,s.$EXTMAX&&(e.extmax=s.$EXTMAX),s.$EXTMIN&&(e.extmin=s.$EXTMIN),s.$INSUNITS!=null&&(e.insunits=s.$INSUNITS),e.osmode=s.$OSMODE||0,e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0,e.textstyle=s.$TEXTSTYLE||tt}processBlockTables(t,e){var n;const s=(n=t.tables.BLOCK_RECORD)==null?void 0:n.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(r=>{const a=new K;a.objectId=r.handle,a.name=r.name,a.layoutId=r.layoutObjects,a.blockInsertUnits=r.insertionUnits,a.explodability=r.explodability,a.blockScaling=r.scalability,r.bmpPreview&&(a.bmpPreview=r.bmpPreview),e.tables.blockTable.add(a)}))}processObjects(t,e){const s=t.objects.byName,n=new Fu;if("LAYOUT"in s){const r=e.objects.layout;s.LAYOUT.forEach(a=>{const o=n.convertLayout(a,t);r.setAt(o.layoutName,o)})}if("IMAGEDEF"in s){const r=e.objects.imageDefinition;s.IMAGEDEF.forEach(a=>{const o=n.convertImageDef(a);r.setAt(o.objectId,o)})}}processViewports(t,e){var n;const s=(n=t.tables)==null?void 0:n.VPORT;if(s){this.processCommonTableAttrs(s,e.tables.viewportTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new or;this.processCommonTableEntryAttrs(a,o),a.circleSides&&(o.circleSides=a.circleSides),o.standardFlag=a.standardFlag,o.center.copy(a.center),o.lowerLeftCorner.copy(a.lowerLeftCorner),o.upperRightCorner.copy(a.upperRightCorner),a.snapBasePoint&&o.snapBase.copy(a.snapBasePoint),a.snapRotationAngle&&(o.snapAngle=a.snapRotationAngle),a.snapSpacing&&o.snapIncrements.copy(a.snapSpacing),a.majorGridLines&&(o.gridMajor=a.majorGridLines),a.gridSpacing&&o.gridIncrements.copy(a.gridSpacing),a.backgroundObjectId&&(o.backgroundObjectId=a.backgroundObjectId),o.gsView.center.copy(a.center),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget),o.gsView.viewTarget.copy(a.viewTarget),a.lensLength&&(o.gsView.lensLength=a.lensLength),a.frontClippingPlane&&(o.gsView.frontClippingPlane=a.frontClippingPlane),a.backClippingPlane&&(o.gsView.backClippingPlane=a.backClippingPlane),a.viewHeight&&(o.gsView.viewHeight=a.viewHeight),a.viewTwistAngle&&(o.gsView.viewTwistAngle=a.viewTwistAngle),a.frozenLayers&&(o.gsView.frozenLayers=a.frozenLayers),a.styleSheet&&(o.gsView.styleSheet=a.styleSheet),a.renderMode&&(o.gsView.renderMode=a.renderMode),a.viewMode&&(o.gsView.viewMode=a.viewMode),a.ucsIconSetting&&(o.gsView.ucsIconSetting=a.ucsIconSetting),a.ucsOrigin&&o.gsView.ucsOrigin.copy(a.ucsOrigin),a.ucsXAxis&&o.gsView.ucsXAxis.copy(a.ucsXAxis),a.ucsYAxis&&o.gsView.ucsYAxis.copy(a.ucsYAxis),a.orthographicType&&(o.gsView.orthographicType=a.orthographicType),a.shadePlotSetting&&(o.gsView.shadePlotSetting=a.shadePlotSetting),a.shadePlotObjectId&&(o.gsView.shadePlotObjectId=a.shadePlotObjectId),a.visualStyleObjectId&&(o.gsView.visualStyleObjectId=a.visualStyleObjectId),a.isDefaultLightingOn&&(o.gsView.isDefaultLightingOn=a.isDefaultLightingOn),a.defaultLightingType&&(o.gsView.defaultLightingType=a.defaultLightingType),a.brightness&&(o.gsView.brightness=a.brightness),a.contrast&&(o.gsView.contrast=a.contrast),a.ambientColor&&(o.gsView.ambientColor=a.ambientColor),e.tables.viewportTable.add(o)})}}processLayers(t,e){var n;const s=(n=t.tables)==null?void 0:n.LAYER;if(s){this.processCommonTableAttrs(s,e.tables.layerTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new Q;o.colorIndex=a.colorIndex;const l=new tn({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,l),e.tables.layerTable.add(l)})}}processLineTypes(t,e){var n;const s=(n=t.tables)==null?void 0:n.LTYPE;if(s){this.processCommonTableAttrs(s,e.tables.linetypeTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new me(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,e.tables.linetypeTable.add(o)})}}processTextStyles(t,e){var n;const s=(n=t.tables)==null?void 0:n.STYLE;if(s){this.processCommonTableAttrs(s,e.tables.textStyleTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o=new en(a);this.processCommonTableEntryAttrs(a,o),e.tables.textStyleTable.add(o)})}}processDimStyles(t,e){var n;const s=(n=t.tables)==null?void 0:n.DIMSTYLE;if(s){this.processCommonTableAttrs(s,e.tables.dimStyleTable);const r=s.entries;r&&r.length>0&&r.forEach(a=>{const o={name:a.name,ownerId:a.ownerObjectId,dimpost:a.DIMPOST||"",dimapost:a.DIMAPOST||"",dimscale:a.DIMSCALE,dimasz:a.DIMASZ,dimexo:a.DIMEXO,dimdli:a.DIMDLI,dimexe:a.DIMEXE,dimrnd:a.DIMRND,dimdle:a.DIMDLE,dimtp:a.DIMTP,dimtm:a.DIMTM,dimtxt:a.DIMTXT,dimcen:a.DIMCEN,dimtsz:a.DIMTSZ,dimaltf:a.DIMALTF,dimlfac:a.DIMLFAC,dimtvp:a.DIMTVP,dimtfac:a.DIMTFAC,dimgap:a.DIMGAP,dimaltrnd:a.DIMALTRND,dimtol:a.DIMTOL==null||a.DIMTOL==0?0:1,dimlim:a.DIMLIM==null||a.DIMLIM==0?0:1,dimtih:a.DIMTIH==null||a.DIMTIH==0?0:1,dimtoh:a.DIMTOH==null||a.DIMTOH==0?0:1,dimse1:a.DIMSE1==null||a.DIMSE1==0?0:1,dimse2:a.DIMSE2==null||a.DIMSE2==0?0:1,dimtad:a.DIMTAD,dimzin:a.DIMZIN,dimazin:a.DIMAZIN,dimalt:a.DIMALT,dimaltd:a.DIMALTD,dimtofl:a.DIMTOFL,dimsah:a.DIMSAH,dimtix:a.DIMTIX,dimsoxd:a.DIMSOXD,dimclrd:a.DIMCLRD,dimclre:a.DIMCLRE,dimclrt:a.DIMCLRT,dimadec:a.DIMADEC||0,dimunit:a.DIMUNIT||2,dimdec:a.DIMDEC,dimtdec:a.DIMTDEC,dimaltu:a.DIMALTU,dimalttd:a.DIMALTTD,dimaunit:a.DIMAUNIT,dimfrac:a.DIMFRAC,dimlunit:a.DIMLUNIT,dimdsep:a.DIMDSEP?a.DIMDSEP.toString():".",dimtmove:a.DIMTMOVE||0,dimjust:a.DIMJUST,dimsd1:a.DIMSD1,dimsd2:a.DIMSD2,dimtolj:a.DIMTOLJ,dimtzin:a.DIMTZIN,dimaltz:a.DIMALTZ,dimalttz:a.DIMALTTZ,dimfit:a.DIMFIT||0,dimupt:a.DIMUPT,dimatfit:a.DIMATFIT,dimtxsty:a.DIMTXSTY||tt,dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},l=new He(o);this.processCommonTableEntryAttrs(a,l),e.tables.dimStyleTable.add(l)})}}processCommonTableAttrs(t,e){t.handle!=null&&(e.objectId=t.handle),t.ownerObjectId!=null&&(e.ownerId=t.ownerObjectId)}processCommonTableEntryAttrs(t,e){e.name="name"in t?t.name:"",t.handle!=null&&(e.objectId=t.handle),t.ownerObjectId!=null&&(e.ownerId=t.ownerObjectId)}groupAndFlattenByType(t){const e={},s=[];for(const n of t)e[n.type]||(e[n.type]=[],s.push(n.type)),e[n.type].push(n);return s.flatMap(n=>e[n])}}class El extends hr{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,s,n,r){let a=t.tables.blockTable.modelSpace.newIterator().toArray();const o=a.length,l=new Dn(o,100-n.value,s);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const c=e.tables.blockTable.modelSpace;await l.processChunk(async(u,d)=>{let g=[],p=u<d?a[u].type:"";for(let m=u;m<d;m++){const y=a[m];this.config.convertByEntityType&&y.type!==p&&(this.triggerEvents(c,g),g=[],p=y.type),g.push(y)}if(this.triggerEvents(c,g),r){let m=n.value+d/o*(100-n.value);m>100&&(m=100),await r(m,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const s=e.newIterator().toArray();this.triggerEvents(e,s)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const s of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const s of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.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={},s=[];for(const n of t)e[n.type]||(e[n.type]=[],s.push(n.type)),e[n.type].push(n);return s.flatMap(n=>e[n])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}exports.ACAD_APPID=Pn;exports.AC_DB_SYSTEM_VARIABLE_NAMES=mc;exports.AcCmColor=Q;exports.AcCmColorMethod=E;exports.AcCmColorUtil=ue;exports.AcCmEntityColor=Tl;exports.AcCmErrors=yt;exports.AcCmEventDispatcher=Ml;exports.AcCmEventManager=Z;exports.AcCmLoader=Fl;exports.AcCmLoadingManager=ka;exports.AcCmObject=Aa;exports.AcCmPerformanceCollector=Rn;exports.AcCmTask=Ma;exports.AcCmTaskScheduler=va;exports.AcCmTransparency=Qi;exports.AcCmTransparencyMethod=ut;exports.AcDb2dPolyline=Pi;exports.AcDb2dVertex=Ln;exports.AcDb2dVertexType=Io;exports.AcDb3PointAngularDimension=Gi;exports.AcDb3dPolyline=Si;exports.AcDb3dVertex=On;exports.AcDb3dVertexType=Po;exports.AcDbAbstractViewTableRecord=ar;exports.AcDbAlignedDimension=Ws;exports.AcDbAngleUnits=jn;exports.AcDbArc=Ei;exports.AcDbArcDimension=Cn;exports.AcDbAttribute=Ti;exports.AcDbAttributeDefinition=Ai;exports.AcDbAttributeFlags=J;exports.AcDbAttributeMTextFlag=zt;exports.AcDbBaseWorker=Ru;exports.AcDbBatchProcessing=Dn;exports.AcDbBlockReference=Ge;exports.AcDbBlockScaling=Do;exports.AcDbBlockTable=Xo;exports.AcDbBlockTableRecord=K;exports.AcDbCircle=Mi;exports.AcDbCodePage=Wn;exports.AcDbCurve=rt;exports.AcDbDataGenerator=Ho;exports.AcDbDatabase=yc;exports.AcDbDatabaseConverter=hr;exports.AcDbDatabaseConverterManager=Rt;exports.AcDbDiametricDimension=Hi;exports.AcDbDictionary=ks;exports.AcDbDimArrowType=Uo;exports.AcDbDimStyleTable=Yo;exports.AcDbDimStyleTableRecord=He;exports.AcDbDimTextHorizontal=$o;exports.AcDbDimTextVertical=qo;exports.AcDbDimVerticalJustification=Qo;exports.AcDbDimZeroSuppression=Zo;exports.AcDbDimZeroSuppressionAngular=Ko;exports.AcDbDimension=oe;exports.AcDbDuplicateRecordCloning=Go;exports.AcDbDwgVersion=vt;exports.AcDbDxfCode=Fn;exports.AcDbDxfConverter=Sl;exports.AcDbDxfFiler=ba;exports.AcDbEllipse=vi;exports.AcDbEntity=gt;exports.AcDbFace=ki;exports.AcDbFileType=Es;exports.AcDbGradientPatternType=To;exports.AcDbHatch=Rs;exports.AcDbHatchObjectType=nr;exports.AcDbHatchPatternType=vs;exports.AcDbHatchStyle=Ao;exports.AcDbHostApplicationServices=Ii;exports.AcDbLayerTable=Jo;exports.AcDbLayerTableRecord=tn;exports.AcDbLayout=qs;exports.AcDbLayoutDictionary=Vo;exports.AcDbLayoutManager=jo;exports.AcDbLeader=Li;exports.AcDbLeaderAnnotationType=Mo;exports.AcDbLine=zs;exports.AcDbLineSpacingStyle=Wi;exports.AcDbLinetypeTable=th;exports.AcDbLinetypeTableRecord=me;exports.AcDbMText=Vs;exports.AcDbObject=he;exports.AcDbObjectIterator=Zs;exports.AcDbOpenMode=Ba;exports.AcDbOrdinateDimension=Ui;exports.AcDbOsnapMode=z;exports.AcDbPlotPaperUnits=Co;exports.AcDbPlotRotation=Bo;exports.AcDbPlotSettings=zo;exports.AcDbPlotShadePlotResLevel=pe;exports.AcDbPlotShadePlotType=qe;exports.AcDbPlotStdScaleType=Ro;exports.AcDbPlotType=Fo;exports.AcDbPoint=Bi;exports.AcDbPoly2dType=$e;exports.AcDbPoly3dType=Ms;exports.AcDbPolyFaceMesh=ji;exports.AcDbPolyFaceMeshFace=No;exports.AcDbPolyFaceMeshVertex=Oo;exports.AcDbPolygonMesh=Di;exports.AcDbPolygonMeshVertex=Lo;exports.AcDbPolyline=Ci;exports.AcDbRadialDimension=Xi;exports.AcDbRasterImage=js;exports.AcDbRasterImageClipBoundaryType=vo;exports.AcDbRasterImageDef=Wo;exports.AcDbRasterImageImageDisplayOpt=ko;exports.AcDbRay=Fi;exports.AcDbRegAppTable=nh;exports.AcDbRegAppTableRecord=Bn;exports.AcDbRegenerator=El;exports.AcDbRenderingCache=ss;exports.AcDbResultBuffer=Vn;exports.AcDbRotatedDimension=Yi;exports.AcDbSpline=Ds;exports.AcDbSymbolTable=le;exports.AcDbSymbolTableRecord=xe;exports.AcDbSysVarManager=Gs;exports.AcDbSystemVariables=R;exports.AcDbTable=Oi;exports.AcDbText=es;exports.AcDbTextHorizontalMode=So;exports.AcDbTextStyleTable=eh;exports.AcDbTextStyleTableRecord=en;exports.AcDbTextVerticalMode=Eo;exports.AcDbTrace=Ni;exports.AcDbUnitsValue=rr;exports.AcDbViewTable=sh;exports.AcDbViewTableRecord=xc;exports.AcDbViewport=Ri;exports.AcDbViewportTable=ih;exports.AcDbViewportTableRecord=or;exports.AcDbWipeout=zi;exports.AcDbWorkerApi=Il;exports.AcDbWorkerManager=bl;exports.AcDbXline=Vi;exports.AcDbXrecord=dc;exports.AcGeArea2d=ts;exports.AcGeBox2d=pt;exports.AcGeBox3d=C;exports.AcGeCatmullRomCurve3d=Ji;exports.AcGeCircArc2d=ye;exports.AcGeCircArc3d=je;exports.AcGeCurve2d=is;exports.AcGeEllipseArc2d=Bs;exports.AcGeEllipseArc3d=Je;exports.AcGeEuler=Hl;exports.AcGeGeometryUtil=po;exports.AcGeLine2d=Vt;exports.AcGeLine3d=_e;exports.AcGeLoop2d=Fs;exports.AcGeMathUtil=v;exports.AcGeMatrix2d=Us;exports.AcGeMatrix3d=G;exports.AcGeNurbsCurve=Bt;exports.AcGePlane=Ys;exports.AcGePoint2d=k;exports.AcGePoint3d=w;exports.AcGePolyline2d=Mt;exports.AcGeQuaternion=Ue;exports.AcGeShape2d=Jn;exports.AcGeSpline3d=Dt;exports.AcGeTol=Xs;exports.AcGeVector2d=Y;exports.AcGeVector3d=b;exports.AcGiArrowType=tr;exports.AcGiDefaultLightingType=ir;exports.AcGiLineWeight=We;exports.AcGiMTextAttachmentPoint=ot;exports.AcGiMTextFlowDirection=ae;exports.AcGiOrthographicType=sr;exports.AcGiRenderMode=er;exports.AcGiViewport=fo;exports.AcTrStringUtil=Bl;exports.ByBlock=Qe;exports.ByLayer=At;exports.DEBUG_MODE=Nl;exports.DEFAULT_LINE_TYPE=Ke;exports.DEFAULT_TEXT_STYLE=tt;exports.DEFAULT_TOL=qn;exports.DEG2RAD=Gn;exports.DefaultLoadingManager=La;exports.FLOAT_TOL=Ve;exports.MLIGHTCAD_APPID=In;exports.ORIGIN_POINT_2D=Vl;exports.ORIGIN_POINT_3D=$n;exports.RAD2DEG=Hn;exports.TAU=W;exports.TEMP_OBJECT_ID_PREFIX=pi;exports.acdbDisableOsnapMode=ic;exports.acdbEnableOsnapMode=sc;exports.acdbHasOsnapMode=ec;exports.acdbHostApplicationServices=zn;exports.acdbMaskToOsnapModes=Jl;exports.acdbOsnapModesToMask=Ql;exports.acdbToggleOsnapMode=tc;exports.basisFunction=Ns;exports.calculateCurveLength=yo;exports.ceilPowerOfTwo=Ka;exports.clamp=re;exports.clone=bs;exports.computeParameterValues=go;exports.createWorkerApi=Pl;exports.damp=Da;exports.deepClone=xn;exports.defaults=Hs;exports.degToRad=$a;exports.dwgCodePageToEncoding=Fa;exports.euclideanModulo=Un;exports.evaluateNurbsPoint=Ts;exports.floorPowerOfTwo=Qa;exports.generateAveragedKnots=mo;exports.generateChordKnots=Xl;exports.generateSqrtChordKnots=Yl;exports.generateUUID=Ra;exports.generateUniformKnots=Ul;exports.getOcsAngle=vn;exports.getOcsReferenceVector=Qn;exports.has=Ia;exports.intPartLength=Yn;exports.interpolateControlPoints=$l;exports.interpolateNurbsCurve=Kn;exports.inverseLerp=Va;exports.isBetween=Ja;exports.isBetweenAngle=to;exports.isEmpty=Pa;exports.isEqual=Ze;exports.isImperialUnits=pc;exports.isMetricUnits=uc;exports.isPointInPolygon=Zn;exports.isPolygonIntersect=uo;exports.isPowerOfTwo=Za;exports.lerp=Xn;exports.log=Ss;exports.mapLinear=za;exports.normalizeAngle=As;exports.pingpong=ja;exports.radToDeg=qa;exports.randFloat=Ua;exports.randFloatSpread=Xa;exports.randInt=Ha;exports.relativeEps=eo;exports.seededRandom=Ya;exports.setAcDbHostApplicationServicesProvider=Na;exports.setAcDbLayoutManagerFactory=Ca;exports.setLogLevel=Cl;exports.smootherstep=Ga;exports.smoothstep=Wa;exports.transformOcsPointToWcs=Mn;exports.transformWcsPointToOcs=Cs;
|