@mlightcad/data-model 1.7.33 → 1.7.35

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.
Files changed (34) hide show
  1. package/dist/data-model.cjs +6 -6
  2. package/dist/data-model.js +1391 -1307
  3. package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
  4. package/lib/converter/AcDbDxfConverter.js +16 -9
  5. package/lib/converter/AcDbDxfConverter.js.map +1 -1
  6. package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
  7. package/lib/converter/AcDbEntitiyConverter.js +22 -13
  8. package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
  9. package/lib/database/AcDbDatabase.d.ts +91 -11
  10. package/lib/database/AcDbDatabase.d.ts.map +1 -1
  11. package/lib/database/AcDbDatabase.js +136 -18
  12. package/lib/database/AcDbDatabase.js.map +1 -1
  13. package/lib/database/AcDbSysVarManager.d.ts.map +1 -1
  14. package/lib/database/AcDbSysVarManager.js +84 -1
  15. package/lib/database/AcDbSysVarManager.js.map +1 -1
  16. package/lib/database/AcDbSystemVariables.d.ts +7 -1
  17. package/lib/database/AcDbSystemVariables.d.ts.map +1 -1
  18. package/lib/database/AcDbSystemVariables.js +6 -0
  19. package/lib/database/AcDbSystemVariables.js.map +1 -1
  20. package/lib/misc/AcDbConstants.d.ts +26 -0
  21. package/lib/misc/AcDbConstants.d.ts.map +1 -1
  22. package/lib/misc/AcDbConstants.js +9 -0
  23. package/lib/misc/AcDbConstants.js.map +1 -1
  24. package/lib/misc/AcDbLinearUnits.d.ts +21 -0
  25. package/lib/misc/AcDbLinearUnits.d.ts.map +1 -0
  26. package/lib/misc/AcDbLinearUnits.js +22 -0
  27. package/lib/misc/AcDbLinearUnits.js.map +1 -0
  28. package/lib/misc/index.d.ts +1 -0
  29. package/lib/misc/index.d.ts.map +1 -1
  30. package/lib/misc/index.js +1 -0
  31. package/lib/misc/index.js.map +1 -1
  32. package/lib/misc/pat/AcDbPatSvgRenderer.d.ts.map +1 -1
  33. package/lib/misc/pat/AcDbPatSvgRenderer.js.map +1 -1
  34. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var tr=(n=>(n[n.Invalid=-9999]="Invalid",n[n.Start=0]="Start",n[n.Text=1]="Text",n[n.AttributeTag=2]="AttributeTag",n[n.BlockName=2]="BlockName",n[n.ShapeName=2]="ShapeName",n[n.SymbolTableName=2]="SymbolTableName",n[n.SymbolTableRecordName=2]="SymbolTableRecordName",n[n.MlineStyleName=2]="MlineStyleName",n[n.AttributePrompt=3]="AttributePrompt",n[n.Description=3]="Description",n[n.DimPostString=3]="DimPostString",n[n.DimStyleName=3]="DimStyleName",n[n.LinetypeProse=3]="LinetypeProse",n[n.TextFontFile=3]="TextFontFile",n[n.CLShapeName=4]="CLShapeName",n[n.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",n[n.SymbolTableRecordComments=4]="SymbolTableRecordComments",n[n.TextBigFontFile=4]="TextBigFontFile",n[n.Handle=5]="Handle",n[n.DimensionBlock=5]="DimensionBlock",n[n.LinetypeName=6]="LinetypeName",n[n.DimBlk1=6]="DimBlk1",n[n.TextStyleName=7]="TextStyleName",n[n.DimBlk2=7]="DimBlk2",n[n.LayerName=8]="LayerName",n[n.CLShapeText=9]="CLShapeText",n[n.XCoordinate=10]="XCoordinate",n[n.YCoordinate=20]="YCoordinate",n[n.ZCoordinate=30]="ZCoordinate",n[n.Real=40]="Real",n[n.TxtSize=40]="TxtSize",n[n.ViewportHeight=40]="ViewportHeight",n[n.Angle=50]="Angle",n[n.ViewportSnapAngle=50]="ViewportSnapAngle",n[n.Visibility=60]="Visibility",n[n.Int16=70]="Int16",n[n.Int32=90]="Int32",n[n.Int64=160]="Int64",n[n.Int8=280]="Int8",n[n.Thickness=39]="Thickness",n[n.Elevation=38]="Elevation",n[n.LinetypeScale=48]="LinetypeScale",n[n.DashLength=49]="DashLength",n[n.MlineOffset=49]="MlineOffset",n[n.LinetypeElement=49]="LinetypeElement",n[n.NormalX=210]="NormalX",n[n.NormalY=220]="NormalY",n[n.NormalZ=230]="NormalZ",n[n.UcsOrg=110]="UcsOrg",n[n.UcsOrientationX=111]="UcsOrientationX",n[n.UcsOrientationY=112]="UcsOrientationY",n[n.ViewHeight=45]="ViewHeight",n[n.ViewWidth=41]="ViewWidth",n[n.ViewLensLength=42]="ViewLensLength",n[n.ViewFrontClip=43]="ViewFrontClip",n[n.ViewBackClip=44]="ViewBackClip",n[n.ViewBrightness=141]="ViewBrightness",n[n.ViewContrast=142]="ViewContrast",n[n.ViewMode=71]="ViewMode",n[n.ViewportActive=68]="ViewportActive",n[n.ViewportAspect=41]="ViewportAspect",n[n.ViewportGrid=76]="ViewportGrid",n[n.ViewportIcon=74]="ViewportIcon",n[n.ViewportNumber=69]="ViewportNumber",n[n.ViewportSnap=75]="ViewportSnap",n[n.ViewportSnapPair=78]="ViewportSnapPair",n[n.ViewportSnapStyle=77]="ViewportSnapStyle",n[n.ViewportTwist=51]="ViewportTwist",n[n.ViewportVisibility=67]="ViewportVisibility",n[n.ViewportZoom=73]="ViewportZoom",n[n.Color=62]="Color",n[n.ColorRgb=420]="ColorRgb",n[n.ColorName=430]="ColorName",n[n.LineWeight=370]="LineWeight",n[n.PlotStyleNameType=380]="PlotStyleNameType",n[n.PlotStyleNameId=390]="PlotStyleNameId",n[n.GradientObjType=450]="GradientObjType",n[n.GradientAngle=460]="GradientAngle",n[n.GradientName=470]="GradientName",n[n.GradientColCount=453]="GradientColCount",n[n.GradientPatType=451]="GradientPatType",n[n.GradientTintType=452]="GradientTintType",n[n.GradientShift=461]="GradientShift",n[n.GradientColVal=463]="GradientColVal",n[n.GradientTintVal=462]="GradientTintVal",n[n.SoftPointerId=330]="SoftPointerId",n[n.HardPointerId=340]="HardPointerId",n[n.SoftOwnershipId=350]="SoftOwnershipId",n[n.HardOwnershipId=360]="HardOwnershipId",n[n.ArbitraryHandle=320]="ArbitraryHandle",n[n.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",n[n.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",n[n.ExtendedDataControlString=1002]="ExtendedDataControlString",n[n.ExtendedDataLayerName=1003]="ExtendedDataLayerName",n[n.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",n[n.ExtendedDataHandle=1005]="ExtendedDataHandle",n[n.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",n[n.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",n[n.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",n[n.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",n[n.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",n[n.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",n[n.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",n[n.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",n[n.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",n[n.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",n[n.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",n[n.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",n[n.ExtendedDataReal=1040]="ExtendedDataReal",n[n.ExtendedDataDist=1041]="ExtendedDataDist",n[n.ExtendedDataScale=1042]="ExtendedDataScale",n[n.ExtendedDataInteger16=1070]="ExtendedDataInteger16",n[n.ExtendedDataInteger32=1071]="ExtendedDataInteger32",n[n.XTextString=300]="XTextString",n[n.XReal=140]="XReal",n[n.XInt16=170]="XInt16",n[n.XXInt16=270]="XXInt16",n[n.Subclass=100]="Subclass",n[n.ControlString=102]="ControlString",n[n.EmbeddedObjectStart=101]="EmbeddedObjectStart",n[n.End=-1]="End",n[n.FirstEntityId=-2]="FirstEntityId",n[n.HeaderId=-2]="HeaderId",n[n.XDataStart=-3]="XDataStart",n[n.Operator=-4]="Operator",n[n.PReactors=-5]="PReactors",n[n.XDictionary=-6]="XDictionary",n))(tr||{});function ac(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const r=Object.getOwnPropertyDescriptor(i,s);r&&Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var P=(n=>(n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None",n))(P||{});const ba={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},ws=[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 bt=class{static getColorByIndex(e){return ws[e]}static getIndexByColor(e){const t=ws.length-1;for(let i=1;i<t;++i)if(ws[i]===e)return i}static getColorByName(e){return ba[e.toLowerCase()]}static getNameByColor(e){for(const[t,i]of Object.entries(ba))if(i===e)return t}static getNameByIndex(e){const t=this.getColorByIndex(e);return this.getNameByColor(t)}},X=class Ve{constructor(e=P.ByLayer,t){this._colorMethod=e,this._colorMethod==P.ByColor&&t==null?this._value=16777215:this._colorMethod==P.ByACI?t==null?this._value=8:t===0?this._colorMethod=P.ByBlock:t===256?this._colorMethod=P.ByLayer:this._value=Math.max(0,Math.min(t,256)):this._value=t}get colorMethod(){return this._colorMethod}set colorMethod(e){this._colorMethod=e}get red(){const e=this.RGB;return e!=null?e>>16&255:void 0}get green(){const e=this.RGB;return e!=null?e>>8&255:void 0}get blue(){const e=this.RGB;return e!=null?e&255:void 0}get RGB(){switch(this._colorMethod){case P.ByColor:case P.ByBlock:case P.ByLayer:return this._value;case P.ByACI:return this._value?bt.getColorByIndex(this._value):this._value;default:return}}setRGB(e,t,i){const s=Math.max(0,Math.min(255,Math.round(e))),r=Math.max(0,Math.min(255,Math.round(t))),a=Math.max(0,Math.min(255,Math.round(i)));return this._value=s<<16|r<<8|a,this._colorMethod=P.ByColor,this}setRGBValue(e){return e==null||!Number.isFinite(e)?this:(this._value=e&16777215,this._colorMethod=P.ByColor,this)}setRGBFromCss(e){if(!e)return this;const t=e.trim().toLowerCase();if(t.startsWith("#")){let r=0,a=0,o=0;if(t.length===7)r=parseInt(t.substr(1,2),16),a=parseInt(t.substr(3,2),16),o=parseInt(t.substr(5,2),16);else if(t.length===4)r=parseInt(t[1]+t[1],16),a=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16);else return this;return this.setRGB(r,a,o)}const i=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(i){const r=parseInt(i[1],10),a=parseInt(i[2],10),o=parseInt(i[3],10);return this.setRGB(r,a,o)}const s=bt.getColorByName(e);return s!==void 0?this.setRGBValue(s):this}setScalar(e){return this.setRGB(e,e,e)}get hexColor(){const e=this.RGB;return e==null?void 0:"0x"+e.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const e=this.RGB;if(e!=null)return`rgb(${e>>16&255},${e>>8&255},${e&255})`}cssColorAlpha(e){const t=this.RGB;if(t!=null)return`rgba(${t>>16&255},${t>>8&255},${t&255},${e})`}get colorIndex(){return this._colorMethod===P.ByACI?this._value:this._colorMethod===P.ByLayer?256:this._colorMethod===P.ByBlock?0:void 0}set colorIndex(e){if(e==null)return;const t=Math.max(0,Math.min(256,Math.round(e)));t===0?(this._colorMethod=P.ByBlock,this._value=void 0):t===256?(this._colorMethod=P.ByLayer,this._value=void 0):(this._colorMethod=P.ByACI,this._value=t)}get isByColor(){return this._colorMethod===P.ByColor}get isByACI(){return this._colorMethod===P.ByACI}get isForeground(){return this._colorMethod===P.ByACI&&this._value===7}setForeground(){return this._colorMethod=P.ByACI,this._value=7,this}get isByLayer(){return this._colorMethod===P.ByLayer}setByLayer(e){return this._colorMethod=P.ByLayer,e==null?this._value=256:this._value=e,this}get isByBlock(){return this._colorMethod===P.ByBlock}setByBlock(e){return this._colorMethod=P.ByBlock,e==null?this._value=0:this._value=e,this}get colorName(){switch(this._colorMethod){case P.ByLayer:return"ByLayer";case P.ByBlock:return"ByBlock";case P.ByColor:return this._value?bt.getNameByColor(this._value):"";case P.ByACI:return this._value?bt.getNameByIndex(this._value):"";default:return}}set colorName(e){if(!e)return;const t=bt.getColorByName(e);t!==void 0&&(this._value=t,this._colorMethod=P.ByColor)}clone(){const e=new Ve;return e._colorMethod=this._colorMethod,e._value=this._value,e}copy(e){return this._colorMethod=e._colorMethod,this._value=e._value,this}equals(e){return this._colorMethod===e._colorMethod&&this._value===e._value}toString(){switch(this._colorMethod){case P.None:return"None";case P.ByLayer:return"ByLayer";case P.ByBlock:return"ByBlock";case P.ByACI:return this._value!==void 0?String(this._value):"";case P.ByColor:return this._value?`RGB:${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(e){if(!e)return;const t=e.trim();if(/^none$/i.test(t))return new Ve(P.None);if(/^bylayer$/i.test(t))return new Ve(P.ByLayer);if(/^byblock$/i.test(t))return new Ve(P.ByBlock);const i=t.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){const r=Number(i[1]),a=Number(i[2]),o=Number(i[3]),h=new Ve(P.ByColor);return h.setRGB(r,a,o),h}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(t)){const[r,a,o]=t.split(",").map(Number),h=new Ve(P.ByColor);return h.setRGB(r,a,o),h}if(/^\d+$/.test(t)){const r=parseInt(t,10);return new Ve(P.ByACI,r)}if(/^book\$/i.test(t)){const r=t.substring(t.indexOf("$")+1),a=bt.getColorByName(r);return a!=null?new Ve(P.ByColor,a):void 0}const s=bt.getColorByName(t);if(s!=null)return new Ve(P.ByColor,s)}};class oc{constructor(e=P.ByColor,t=0){this._colorMethod=e,this._value=t}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(e){this._colorMethod=P.ByColor,this._value=this._value&65535|(e&255)<<16}get green(){return this._value>>8&255}set green(e){this._colorMethod=P.ByColor,this._value=this._value&16711935|(e&255)<<8}get blue(){return this._value&255}set blue(e){this._colorMethod=P.ByColor,this._value=this._value&16776960|e&255}setRGB(e,t,i){this._colorMethod=P.ByColor,this._value=(e&255)<<16|(t&255)<<8|i&255}get colorIndex(){return this._value}set colorIndex(e){this._colorMethod=P.ByACI,this._value=e}get layerIndex(){return this._value}set layerIndex(e){this._colorMethod=P.ByLayer,this._value=e}isByColor(){return this._colorMethod===P.ByColor}isByLayer(){return this._colorMethod===P.ByLayer}isByBlock(){return this._colorMethod===P.ByBlock}isByACI(){return this._colorMethod===P.ByACI}isNone(){return this._colorMethod===P.None}get rawValue(){return this._value}set rawValue(e){this._value=e}}const be={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 lc=class{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const i=t.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e)}}},te=class{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const i of this.listeners)i.call(null,e,...t)}};function Ni(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function Xs(n){if(n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(Array.isArray(n))return n.map(Xs);const e={};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=Xs(n[t]));return e}function tn(n,...e){for(const t of e)if(t)for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&n[i]===void 0&&(n[i]=t[i]);return n}function Ga(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function Ua(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function di(n,e){if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(let s=0;s<n.length;s++)if(!di(n[s],e[s]))return!1;return!0}const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const s of t)if(!Object.prototype.hasOwnProperty.call(e,s)||!di(n[s],e[s]))return!1;return!0}var hc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var $a={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(hc,function(){var e=function(){},t="undefined",i=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"],r={},a=null;function o(y,_){var f=y[_];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 h(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function c(y){return y==="debug"&&(y="log"),typeof console===t?!1:y==="trace"&&i?h:console[y]!==void 0?o(console,y):console.log!==void 0?o(console,"log"):e}function d(){for(var y=this.getLevel(),_=0;_<s.length;_++){var f=s[_];this[f]=_<y?e:this.methodFactory(f,y,this.name)}if(this.log=this.debug,typeof console===t&&y<this.levels.SILENT)return"No console available for logging"}function u(y){return function(){typeof console!==t&&(d.call(this),this[y].apply(this,arguments))}}function p(y,_,f){return c(y)||u.apply(this,arguments)}function g(y,_){var f=this,S,L,M,I="loglevel";typeof y=="string"?I+=":"+y:typeof y=="symbol"&&(I=void 0);function W(B){var $=(s[B]||"silent").toUpperCase();if(!(typeof window===t||!I)){try{window.localStorage[I]=$;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+$+";"}catch{}}}function C(){var B;if(!(typeof window===t||!I)){try{B=window.localStorage[I]}catch{}if(typeof B===t)try{var $=window.document.cookie,Nt=encodeURIComponent(I),Ot=$.indexOf(Nt+"=");Ot!==-1&&(B=/^([^;]+)/.exec($.slice(Ot+Nt.length+1))[1])}catch{}return f.levels[B]===void 0&&(B=void 0),B}}function q(){if(!(typeof window===t||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function R(B){var $=B;if(typeof $=="string"&&f.levels[$.toUpperCase()]!==void 0&&($=f.levels[$.toUpperCase()]),typeof $=="number"&&$>=0&&$<=f.levels.SILENT)return $;throw new TypeError("log.setLevel() called with invalid level: "+B)}f.name=y,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=_||p,f.getLevel=function(){return M??L??S},f.setLevel=function(B,$){return M=R(B),$!==!1&&W(M),d.call(f)},f.setDefaultLevel=function(B){L=R(B),C()||f.setLevel(B,!1)},f.resetLevel=function(){M=null,q(),d.call(f)},f.enableAll=function(B){f.setLevel(f.levels.TRACE,B)},f.disableAll=function(B){f.setLevel(f.levels.SILENT,B)},f.rebuild=function(){if(a!==f&&(S=R(a.getLevel())),d.call(f),a===f)for(var B in r)r[B].rebuild()},S=R(a?a.getLevel():"WARN");var se=C();se!=null&&(M=R(se)),d.call(f)}a=new g,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 _=r[y];return _||(_=r[y]=new g(y,a.methodFactory)),_};var m=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=m),a},a.getLoggers=function(){return r},a.default=a,a})})($a);var qa=$a.exports;const dc=cc(qa),uc=ac({__proto__:null,default:dc},[qa]),gc=!0,Xi=uc;Xi.setLevel("debug");const pc=n=>{try{Xi.setLevel(n)}catch(e){Xi.setLevel("error"),Xi.error(e)}};let Ka=class Za{constructor(e,t){this.events={attrChanged:new te,modelChanged:new te},this._changing=!1,this._previousAttributes={},this._pending=!1;const i=e||{};t&&tn(i,t),this.attributes=i,this.changed={}}get(e){return this.attributes[e]}set(e,t,i){if(e==null)return this;let s;typeof e=="object"?(s=e,i=t):(s={},s[e]=t),i||(i={});const r=i.unset,a=i.silent,o=[],h=this._changing;this._changing=!0,h||(this._previousAttributes=Ni(this.attributes),this.changed={});const c=this.attributes,d=this.changed,u=this._previousAttributes;for(const p in s)t=s[p],di(c[p],t)||o.push(p),di(u[p],t)?delete d[p]:d[p]=t,r?delete c[p]:c[p]=t;if(!a){o.length&&(this._pending=i);for(let p=0;p<o.length;p++)this.events.attrChanged.dispatch({object:this,attrName:o[p],attrValue:c[o[p]],options:i})}if(h)return this;if(!a)for(;this._pending;)i=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!Ua(this.changed):Ga(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?Ni(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,i={};for(const s in e){const r=e[s];di(t[s],r)||(i[s]=r)}return i}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return Ni(this._previousAttributes)}clone(){const e=Ni(this.attributes);return new Za(e)}},ir=class Oi{constructor(){this.entries=new Map}static getInstance(){return Oi.instance||(Oi.instance=new Oi),Oi.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries);}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}};class mc{static formatBytes(e,t=2){if(e===0)return"0 B";const i=1024,s=Math.max(0,t),r=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(i)),o=e/Math.pow(i,a);return`${parseFloat(o.toFixed(s))} ${r[a]}`}}var he=(n=>(n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue",n))(he||{});let J=class ze{constructor(e){e!==void 0?(this._method=he.ByAlpha,this._alpha=ze.clampAlpha(e)):(this._method=he.ByLayer,this._alpha=255)}get method(){return this._method}set method(e){this._method=e}get alpha(){return this._alpha}set alpha(e){this._alpha=ze.clampAlpha(e),this._method=he.ByAlpha}get percentage(){if(this._method===he.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(e){const t=Math.max(0,Math.min(100,e)),i=Math.round(255*(1-t/100));this.alpha=i}static clampAlpha(e){return Math.max(0,Math.min(255,Math.floor(e)))}get isByAlpha(){return this._method===he.ByAlpha}get isByBlock(){return this._method===he.ByBlock}get isByLayer(){return this._method===he.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===he.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const e=new ze;return e._method=this._method,e._alpha=this._alpha,e}equals(e){return this._method===e._method&&this._alpha===e._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(e){const t=e.trim(),i=t.toLowerCase();if(i===""||i==="."||i==="use current"||i==="bylayer"){const a=new ze;return a._method=he.ByLayer,a}if(i==="byblock"){const a=new ze;return a._method=he.ByBlock,a}const s=Number(t);if(Number.isInteger(s)&&s>=0&&s<=255){const a=new ze;return s<=90?a.percentage=s:a.alpha=s,a}const r=new ze;return r._method=he.ErrorValue,r}static deserialize(e){const t=e>>>24&255,i=e&255,s=t>=he.ByLayer&&t<=he.ErrorValue?t:he.ErrorValue,r=new ze;return r._method=s,r._alpha=ze.clampAlpha(i),r}};class Qa{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class Ja{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(e){return new Promise((t,i)=>{const s=()=>{Promise.resolve(e()).then(t).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(s):setTimeout(s,0)})}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let i=e;for(let s=0;s<t;s++){const r=this.tasks[s];try{i=await this.scheduleTask(async()=>{const a=await r.run(i);return this.onProgress((s+1)/t,r),a})}catch(a){if(this.onError({error:a,taskIndex:s,task:r}))return Promise.reject(a)}}this.onComplete(i)}}let eo=class{constructor(e,t,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,i=this.handlers.length;t<i;t+=2){const s=this.handlers[t],r=this.handlers[t+1];if(s.global&&(s.lastIndex=0),s.test(e))return r}return null}};const to=new eo;class yc{constructor(e){this.manager=e!==void 0?e:to,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((i,s)=>{this.load(e,i,t,s)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const La=[{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 ve{constructor(e){if(typeof e=="string"){const t=La.find(i=>i.name===e);if(!t)throw new Error(`Unknown DWG version name: ${e}`);this.name=t.name,this.value=t.value;return}if(typeof e=="number"){const t=La.find(i=>i.value===e);if(!t)throw new Error(`Unknown DWG version value: ${e}`);this.name=t.name,this.value=t.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class io{constructor(e={}){this._database=e.database,this._precision=Math.max(0,Math.min(16,e.precision??16)),this._version=e.version instanceof ve?e.version:e.version!=null?new ve(e.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(e){this._database=e}get precision(){return this._precision}setPrecision(e){return this._precision=Math.max(0,Math.min(16,e)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(e){return this._version=e instanceof ve?e:new ve(e),this}toString(){return this._lines.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var rr=(n=>(n[n.Invalid=-9999]="Invalid",n[n.Start=0]="Start",n[n.Text=1]="Text",n[n.AttributeTag=2]="AttributeTag",n[n.BlockName=2]="BlockName",n[n.ShapeName=2]="ShapeName",n[n.SymbolTableName=2]="SymbolTableName",n[n.SymbolTableRecordName=2]="SymbolTableRecordName",n[n.MlineStyleName=2]="MlineStyleName",n[n.AttributePrompt=3]="AttributePrompt",n[n.Description=3]="Description",n[n.DimPostString=3]="DimPostString",n[n.DimStyleName=3]="DimStyleName",n[n.LinetypeProse=3]="LinetypeProse",n[n.TextFontFile=3]="TextFontFile",n[n.CLShapeName=4]="CLShapeName",n[n.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",n[n.SymbolTableRecordComments=4]="SymbolTableRecordComments",n[n.TextBigFontFile=4]="TextBigFontFile",n[n.Handle=5]="Handle",n[n.DimensionBlock=5]="DimensionBlock",n[n.LinetypeName=6]="LinetypeName",n[n.DimBlk1=6]="DimBlk1",n[n.TextStyleName=7]="TextStyleName",n[n.DimBlk2=7]="DimBlk2",n[n.LayerName=8]="LayerName",n[n.CLShapeText=9]="CLShapeText",n[n.XCoordinate=10]="XCoordinate",n[n.YCoordinate=20]="YCoordinate",n[n.ZCoordinate=30]="ZCoordinate",n[n.Real=40]="Real",n[n.TxtSize=40]="TxtSize",n[n.ViewportHeight=40]="ViewportHeight",n[n.Angle=50]="Angle",n[n.ViewportSnapAngle=50]="ViewportSnapAngle",n[n.Visibility=60]="Visibility",n[n.Int16=70]="Int16",n[n.Int32=90]="Int32",n[n.Int64=160]="Int64",n[n.Int8=280]="Int8",n[n.Thickness=39]="Thickness",n[n.Elevation=38]="Elevation",n[n.LinetypeScale=48]="LinetypeScale",n[n.DashLength=49]="DashLength",n[n.MlineOffset=49]="MlineOffset",n[n.LinetypeElement=49]="LinetypeElement",n[n.NormalX=210]="NormalX",n[n.NormalY=220]="NormalY",n[n.NormalZ=230]="NormalZ",n[n.UcsOrg=110]="UcsOrg",n[n.UcsOrientationX=111]="UcsOrientationX",n[n.UcsOrientationY=112]="UcsOrientationY",n[n.ViewHeight=45]="ViewHeight",n[n.ViewWidth=41]="ViewWidth",n[n.ViewLensLength=42]="ViewLensLength",n[n.ViewFrontClip=43]="ViewFrontClip",n[n.ViewBackClip=44]="ViewBackClip",n[n.ViewBrightness=141]="ViewBrightness",n[n.ViewContrast=142]="ViewContrast",n[n.ViewMode=71]="ViewMode",n[n.ViewportActive=68]="ViewportActive",n[n.ViewportAspect=41]="ViewportAspect",n[n.ViewportGrid=76]="ViewportGrid",n[n.ViewportIcon=74]="ViewportIcon",n[n.ViewportNumber=69]="ViewportNumber",n[n.ViewportSnap=75]="ViewportSnap",n[n.ViewportSnapPair=78]="ViewportSnapPair",n[n.ViewportSnapStyle=77]="ViewportSnapStyle",n[n.ViewportTwist=51]="ViewportTwist",n[n.ViewportVisibility=67]="ViewportVisibility",n[n.ViewportZoom=73]="ViewportZoom",n[n.Color=62]="Color",n[n.ColorRgb=420]="ColorRgb",n[n.ColorName=430]="ColorName",n[n.LineWeight=370]="LineWeight",n[n.PlotStyleNameType=380]="PlotStyleNameType",n[n.PlotStyleNameId=390]="PlotStyleNameId",n[n.GradientObjType=450]="GradientObjType",n[n.GradientAngle=460]="GradientAngle",n[n.GradientName=470]="GradientName",n[n.GradientColCount=453]="GradientColCount",n[n.GradientPatType=451]="GradientPatType",n[n.GradientTintType=452]="GradientTintType",n[n.GradientShift=461]="GradientShift",n[n.GradientColVal=463]="GradientColVal",n[n.GradientTintVal=462]="GradientTintVal",n[n.SoftPointerId=330]="SoftPointerId",n[n.HardPointerId=340]="HardPointerId",n[n.SoftOwnershipId=350]="SoftOwnershipId",n[n.HardOwnershipId=360]="HardOwnershipId",n[n.ArbitraryHandle=320]="ArbitraryHandle",n[n.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",n[n.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",n[n.ExtendedDataControlString=1002]="ExtendedDataControlString",n[n.ExtendedDataLayerName=1003]="ExtendedDataLayerName",n[n.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",n[n.ExtendedDataHandle=1005]="ExtendedDataHandle",n[n.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",n[n.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",n[n.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",n[n.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",n[n.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",n[n.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",n[n.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",n[n.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",n[n.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",n[n.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",n[n.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",n[n.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",n[n.ExtendedDataReal=1040]="ExtendedDataReal",n[n.ExtendedDataDist=1041]="ExtendedDataDist",n[n.ExtendedDataScale=1042]="ExtendedDataScale",n[n.ExtendedDataInteger16=1070]="ExtendedDataInteger16",n[n.ExtendedDataInteger32=1071]="ExtendedDataInteger32",n[n.XTextString=300]="XTextString",n[n.XReal=140]="XReal",n[n.XInt16=170]="XInt16",n[n.XXInt16=270]="XXInt16",n[n.Subclass=100]="Subclass",n[n.ControlString=102]="ControlString",n[n.EmbeddedObjectStart=101]="EmbeddedObjectStart",n[n.End=-1]="End",n[n.FirstEntityId=-2]="FirstEntityId",n[n.HeaderId=-2]="HeaderId",n[n.XDataStart=-3]="XDataStart",n[n.Operator=-4]="Operator",n[n.PReactors=-5]="PReactors",n[n.XDictionary=-6]="XDictionary",n))(rr||{});function uc(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const r=Object.getOwnPropertyDescriptor(i,s);r&&Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var P=(n=>(n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None",n))(P||{});const Sa={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},Ss=[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 bt=class{static getColorByIndex(e){return Ss[e]}static getIndexByColor(e){const t=Ss.length-1;for(let i=1;i<t;++i)if(Ss[i]===e)return i}static getColorByName(e){return Sa[e.toLowerCase()]}static getNameByColor(e){for(const[t,i]of Object.entries(Sa))if(i===e)return t}static getNameByIndex(e){const t=this.getColorByIndex(e);return this.getNameByColor(t)}},X=class Ve{constructor(e=P.ByLayer,t){this._colorMethod=e,this._colorMethod==P.ByColor&&t==null?this._value=16777215:this._colorMethod==P.ByACI?t==null?this._value=8:t===0?this._colorMethod=P.ByBlock:t===256?this._colorMethod=P.ByLayer:this._value=Math.max(0,Math.min(t,256)):this._value=t}get colorMethod(){return this._colorMethod}set colorMethod(e){this._colorMethod=e}get red(){const e=this.RGB;return e!=null?e>>16&255:void 0}get green(){const e=this.RGB;return e!=null?e>>8&255:void 0}get blue(){const e=this.RGB;return e!=null?e&255:void 0}get RGB(){switch(this._colorMethod){case P.ByColor:case P.ByBlock:case P.ByLayer:return this._value;case P.ByACI:return this._value?bt.getColorByIndex(this._value):this._value;default:return}}setRGB(e,t,i){const s=Math.max(0,Math.min(255,Math.round(e))),r=Math.max(0,Math.min(255,Math.round(t))),a=Math.max(0,Math.min(255,Math.round(i)));return this._value=s<<16|r<<8|a,this._colorMethod=P.ByColor,this}setRGBValue(e){return e==null||!Number.isFinite(e)?this:(this._value=e&16777215,this._colorMethod=P.ByColor,this)}setRGBFromCss(e){if(!e)return this;const t=e.trim().toLowerCase();if(t.startsWith("#")){let r=0,a=0,o=0;if(t.length===7)r=parseInt(t.substr(1,2),16),a=parseInt(t.substr(3,2),16),o=parseInt(t.substr(5,2),16);else if(t.length===4)r=parseInt(t[1]+t[1],16),a=parseInt(t[2]+t[2],16),o=parseInt(t[3]+t[3],16);else return this;return this.setRGB(r,a,o)}const i=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(i){const r=parseInt(i[1],10),a=parseInt(i[2],10),o=parseInt(i[3],10);return this.setRGB(r,a,o)}const s=bt.getColorByName(e);return s!==void 0?this.setRGBValue(s):this}setScalar(e){return this.setRGB(e,e,e)}get hexColor(){const e=this.RGB;return e==null?void 0:"0x"+e.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const e=this.RGB;if(e!=null)return`rgb(${e>>16&255},${e>>8&255},${e&255})`}cssColorAlpha(e){const t=this.RGB;if(t!=null)return`rgba(${t>>16&255},${t>>8&255},${t&255},${e})`}get colorIndex(){return this._colorMethod===P.ByACI?this._value:this._colorMethod===P.ByLayer?256:this._colorMethod===P.ByBlock?0:void 0}set colorIndex(e){if(e==null)return;const t=Math.max(0,Math.min(256,Math.round(e)));t===0?(this._colorMethod=P.ByBlock,this._value=void 0):t===256?(this._colorMethod=P.ByLayer,this._value=void 0):(this._colorMethod=P.ByACI,this._value=t)}get isByColor(){return this._colorMethod===P.ByColor}get isByACI(){return this._colorMethod===P.ByACI}get isForeground(){return this._colorMethod===P.ByACI&&this._value===7}setForeground(){return this._colorMethod=P.ByACI,this._value=7,this}get isByLayer(){return this._colorMethod===P.ByLayer}setByLayer(e){return this._colorMethod=P.ByLayer,e==null?this._value=256:this._value=e,this}get isByBlock(){return this._colorMethod===P.ByBlock}setByBlock(e){return this._colorMethod=P.ByBlock,e==null?this._value=0:this._value=e,this}get colorName(){switch(this._colorMethod){case P.ByLayer:return"ByLayer";case P.ByBlock:return"ByBlock";case P.ByColor:return this._value?bt.getNameByColor(this._value):"";case P.ByACI:return this._value?bt.getNameByIndex(this._value):"";default:return}}set colorName(e){if(!e)return;const t=bt.getColorByName(e);t!==void 0&&(this._value=t,this._colorMethod=P.ByColor)}clone(){const e=new Ve;return e._colorMethod=this._colorMethod,e._value=this._value,e}copy(e){return this._colorMethod=e._colorMethod,this._value=e._value,this}equals(e){return this._colorMethod===e._colorMethod&&this._value===e._value}toString(){switch(this._colorMethod){case P.None:return"None";case P.ByLayer:return"ByLayer";case P.ByBlock:return"ByBlock";case P.ByACI:return this._value!==void 0?String(this._value):"";case P.ByColor:return this._value?`RGB:${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(e){if(!e)return;const t=e.trim();if(/^none$/i.test(t))return new Ve(P.None);if(/^bylayer$/i.test(t))return new Ve(P.ByLayer);if(/^byblock$/i.test(t))return new Ve(P.ByBlock);const i=t.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){const r=Number(i[1]),a=Number(i[2]),o=Number(i[3]),h=new Ve(P.ByColor);return h.setRGB(r,a,o),h}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(t)){const[r,a,o]=t.split(",").map(Number),h=new Ve(P.ByColor);return h.setRGB(r,a,o),h}if(/^\d+$/.test(t)){const r=parseInt(t,10);return new Ve(P.ByACI,r)}if(/^book\$/i.test(t)){const r=t.substring(t.indexOf("$")+1),a=bt.getColorByName(r);return a!=null?new Ve(P.ByColor,a):void 0}const s=bt.getColorByName(t);if(s!=null)return new Ve(P.ByColor,s)}};class gc{constructor(e=P.ByColor,t=0){this._colorMethod=e,this._value=t}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(e){this._colorMethod=P.ByColor,this._value=this._value&65535|(e&255)<<16}get green(){return this._value>>8&255}set green(e){this._colorMethod=P.ByColor,this._value=this._value&16711935|(e&255)<<8}get blue(){return this._value&255}set blue(e){this._colorMethod=P.ByColor,this._value=this._value&16776960|e&255}setRGB(e,t,i){this._colorMethod=P.ByColor,this._value=(e&255)<<16|(t&255)<<8|i&255}get colorIndex(){return this._value}set colorIndex(e){this._colorMethod=P.ByACI,this._value=e}get layerIndex(){return this._value}set layerIndex(e){this._colorMethod=P.ByLayer,this._value=e}isByColor(){return this._colorMethod===P.ByColor}isByLayer(){return this._colorMethod===P.ByLayer}isByBlock(){return this._colorMethod===P.ByBlock}isByACI(){return this._colorMethod===P.ByACI}isNone(){return this._colorMethod===P.None}get rawValue(){return this._value}set rawValue(e){this._value=e}}const be={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 pc=class{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const i=t.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e)}}},te=class{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const i of this.listeners)i.call(null,e,...t)}};function Ni(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function Fs(n){if(n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(Array.isArray(n))return n.map(Fs);const e={};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=Fs(n[t]));return e}function nn(n,...e){for(const t of e)if(t)for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&n[i]===void 0&&(n[i]=t[i]);return n}function $a(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function qa(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function di(n,e){if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(let s=0;s<n.length;s++)if(!di(n[s],e[s]))return!1;return!0}const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const s of t)if(!Object.prototype.hasOwnProperty.call(e,s)||!di(n[s],e[s]))return!1;return!0}var mc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ka={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(mc,function(){var e=function(){},t="undefined",i=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"],r={},a=null;function o(y,_){var f=y[_];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 h(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function c(y){return y==="debug"&&(y="log"),typeof console===t?!1:y==="trace"&&i?h:console[y]!==void 0?o(console,y):console.log!==void 0?o(console,"log"):e}function d(){for(var y=this.getLevel(),_=0;_<s.length;_++){var f=s[_];this[f]=_<y?e:this.methodFactory(f,y,this.name)}if(this.log=this.debug,typeof console===t&&y<this.levels.SILENT)return"No console available for logging"}function u(y){return function(){typeof console!==t&&(d.call(this),this[y].apply(this,arguments))}}function p(y,_,f){return c(y)||u.apply(this,arguments)}function g(y,_){var f=this,S,L,M,I="loglevel";typeof y=="string"?I+=":"+y:typeof y=="symbol"&&(I=void 0);function W(B){var $=(s[B]||"silent").toUpperCase();if(!(typeof window===t||!I)){try{window.localStorage[I]=$;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+$+";"}catch{}}}function C(){var B;if(!(typeof window===t||!I)){try{B=window.localStorage[I]}catch{}if(typeof B===t)try{var $=window.document.cookie,Nt=encodeURIComponent(I),Ot=$.indexOf(Nt+"=");Ot!==-1&&(B=/^([^;]+)/.exec($.slice(Ot+Nt.length+1))[1])}catch{}return f.levels[B]===void 0&&(B=void 0),B}}function q(){if(!(typeof window===t||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function R(B){var $=B;if(typeof $=="string"&&f.levels[$.toUpperCase()]!==void 0&&($=f.levels[$.toUpperCase()]),typeof $=="number"&&$>=0&&$<=f.levels.SILENT)return $;throw new TypeError("log.setLevel() called with invalid level: "+B)}f.name=y,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=_||p,f.getLevel=function(){return M??L??S},f.setLevel=function(B,$){return M=R(B),$!==!1&&W(M),d.call(f)},f.setDefaultLevel=function(B){L=R(B),C()||f.setLevel(B,!1)},f.resetLevel=function(){M=null,q(),d.call(f)},f.enableAll=function(B){f.setLevel(f.levels.TRACE,B)},f.disableAll=function(B){f.setLevel(f.levels.SILENT,B)},f.rebuild=function(){if(a!==f&&(S=R(a.getLevel())),d.call(f),a===f)for(var B in r)r[B].rebuild()},S=R(a?a.getLevel():"WARN");var se=C();se!=null&&(M=R(se)),d.call(f)}a=new g,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 _=r[y];return _||(_=r[y]=new g(y,a.methodFactory)),_};var m=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=m),a},a.getLoggers=function(){return r},a.default=a,a})})(Ka);var Za=Ka.exports;const _c=yc(Za),fc=uc({__proto__:null,default:_c},[Za]),xc=!0,Xi=fc;Xi.setLevel("debug");const wc=n=>{try{Xi.setLevel(n)}catch(e){Xi.setLevel("error"),Xi.error(e)}};let Qa=class Ja{constructor(e,t){this.events={attrChanged:new te,modelChanged:new te},this._changing=!1,this._previousAttributes={},this._pending=!1;const i=e||{};t&&nn(i,t),this.attributes=i,this.changed={}}get(e){return this.attributes[e]}set(e,t,i){if(e==null)return this;let s;typeof e=="object"?(s=e,i=t):(s={},s[e]=t),i||(i={});const r=i.unset,a=i.silent,o=[],h=this._changing;this._changing=!0,h||(this._previousAttributes=Ni(this.attributes),this.changed={});const c=this.attributes,d=this.changed,u=this._previousAttributes;for(const p in s)t=s[p],di(c[p],t)||o.push(p),di(u[p],t)?delete d[p]:d[p]=t,r?delete c[p]:c[p]=t;if(!a){o.length&&(this._pending=i);for(let p=0;p<o.length;p++)this.events.attrChanged.dispatch({object:this,attrName:o[p],attrValue:c[o[p]],options:i})}if(h)return this;if(!a)for(;this._pending;)i=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!qa(this.changed):$a(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?Ni(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,i={};for(const s in e){const r=e[s];di(t[s],r)||(i[s]=r)}return i}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return Ni(this._previousAttributes)}clone(){const e=Ni(this.attributes);return new Ja(e)}},ar=class Oi{constructor(){this.entries=new Map}static getInstance(){return Oi.instance||(Oi.instance=new Oi),Oi.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries);}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}};class bc{static formatBytes(e,t=2){if(e===0)return"0 B";const i=1024,s=Math.max(0,t),r=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(i)),o=e/Math.pow(i,a);return`${parseFloat(o.toFixed(s))} ${r[a]}`}}var he=(n=>(n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue",n))(he||{});let J=class ze{constructor(e){e!==void 0?(this._method=he.ByAlpha,this._alpha=ze.clampAlpha(e)):(this._method=he.ByLayer,this._alpha=255)}get method(){return this._method}set method(e){this._method=e}get alpha(){return this._alpha}set alpha(e){this._alpha=ze.clampAlpha(e),this._method=he.ByAlpha}get percentage(){if(this._method===he.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(e){const t=Math.max(0,Math.min(100,e)),i=Math.round(255*(1-t/100));this.alpha=i}static clampAlpha(e){return Math.max(0,Math.min(255,Math.floor(e)))}get isByAlpha(){return this._method===he.ByAlpha}get isByBlock(){return this._method===he.ByBlock}get isByLayer(){return this._method===he.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===he.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const e=new ze;return e._method=this._method,e._alpha=this._alpha,e}equals(e){return this._method===e._method&&this._alpha===e._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(e){const t=e.trim(),i=t.toLowerCase();if(i===""||i==="."||i==="use current"||i==="bylayer"){const a=new ze;return a._method=he.ByLayer,a}if(i==="byblock"){const a=new ze;return a._method=he.ByBlock,a}const s=Number(t);if(Number.isInteger(s)&&s>=0&&s<=255){const a=new ze;return s<=90?a.percentage=s:a.alpha=s,a}const r=new ze;return r._method=he.ErrorValue,r}static deserialize(e){const t=e>>>24&255,i=e&255,s=t>=he.ByLayer&&t<=he.ErrorValue?t:he.ErrorValue,r=new ze;return r._method=s,r._alpha=ze.clampAlpha(i),r}};class eo{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class to{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(e){return new Promise((t,i)=>{const s=()=>{Promise.resolve(e()).then(t).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(s):setTimeout(s,0)})}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let i=e;for(let s=0;s<t;s++){const r=this.tasks[s];try{i=await this.scheduleTask(async()=>{const a=await r.run(i);return this.onProgress((s+1)/t,r),a})}catch(a){if(this.onError({error:a,taskIndex:s,task:r}))return Promise.reject(a)}}this.onComplete(i)}}let io=class{constructor(e,t,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,i=this.handlers.length;t<i;t+=2){const s=this.handlers[t],r=this.handlers[t+1];if(s.global&&(s.lastIndex=0),s.test(e))return r}return null}};const no=new io;class Lc{constructor(e){this.manager=e!==void 0?e:no,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((i,s)=>{this.load(e,i,t,s)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const Aa=[{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 ve{constructor(e){if(typeof e=="string"){const t=Aa.find(i=>i.name===e);if(!t)throw new Error(`Unknown DWG version name: ${e}`);this.name=t.name,this.value=t.value;return}if(typeof e=="number"){const t=Aa.find(i=>i.value===e);if(!t)throw new Error(`Unknown DWG version value: ${e}`);this.name=t.name,this.value=t.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class so{constructor(e={}){this._database=e.database,this._precision=Math.max(0,Math.min(16,e.precision??16)),this._version=e.version instanceof ve?e.version:e.version!=null?new ve(e.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(e){this._database=e}get precision(){return this._precision}setPrecision(e){return this._precision=Math.max(0,Math.min(16,e)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(e){return this._version=e instanceof ve?e:new ve(e),this}toString(){return this._lines.join(`
2
2
  `)+`
3
- `}registerHandle(e){return this._handleMap.has(e)||(/^[0-9A-F]+$/i.test(e)?this._handleMap.set(e,e.toUpperCase()):(this._handleMap.set(e,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(e)}resolveHandle(e){if(e)return this.registerHandle(e)}writeGroup(e,t){if(t==null)return this;this._lines.push(String(Math.trunc(e)));const i=this.formatValue(t);return this._lines.push(i===""?"0":i),this}writeStart(e){return this.writeString(0,e)}writeSubclassMarker(e){return this.writeString(100,e)}writeString(e,t){return!t&&t!==""?this:this.writeGroup(e,t)}writeInt8(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt16(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt32(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt64(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeUInt16(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeUInt32(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeBoolean(e,t){return t==null?this:this.writeGroup(e,t?1:0)}writeBool(e,t){return this.writeBoolean(e,t)}writeDouble(e,t){return t==null||!Number.isFinite(t)?this:this.writeGroup(e,t)}writeAngle(e,t){return t==null||!Number.isFinite(t)?this:this.writeDouble(e,t*180/Math.PI)}writeHandle(e,t){const i=this.resolveHandle(t);return i?this.writeString(e,i):this}writeObjectId(e,t){return this.writeHandle(e,t)}writePoint2d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this):this}writePoint3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeVector3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeCmColor(e,t=62,i=420){if(!e)return this;const s=e.colorIndex;s!=null&&this.writeInt16(t,s);const r=e.RGB;return r!=null&&e.colorIndex==null&&this.writeInt32(i,r),this}writeTransparency(e,t=440){return!e||e.method===he.ErrorValue?this:this.writeInt32(t,e.serialize())}writeResultBuffer(e){if(!e)return this;for(const t of e)this.writeGroup(t.code,t.value);return this}startSection(e){return this.writeStart("SECTION"),this.writeString(2,e),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(e){return this.writeStart("TABLE"),this.writeString(2,e),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(e){if(typeof e=="string")return this.sanitizeStringForDxfLine(e);if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number"){if(!Number.isFinite(e))return"0";if(Number.isInteger(e))return String(e);const i=e.toFixed(this._precision).replace(/\.?0+$/,"");return i===""||i==="-"?"0":i}return String(e)}sanitizeStringForDxfLine(e){return e.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var ei=256,no=[],Sa=256,_n;for(;ei--;)no[ei]=(ei+256).toString(16).substring(1);function _c(n){var e=0,t=11;if(!_n||ei+t>Sa*2)for(_n="",ei=0;e<Sa;e++)_n+=no[Math.random()*256|0];return _n.substring(ei,ei+++t)}const En="TEMP_";let Rs;function so(n){Rs=n}class De{constructor(e,t){if(e=e||{},this._attrs=new Ka(e,t),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 En+_c()}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e),e&&!e.startsWith(En)&&this.database.updateMaxHandle(e)}get isTemp(){const e=this.getAttrWithoutException("objectId");return!!e&&e.startsWith(En)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(e){this._attrs.set("extensionDictionary",e)}get database(){if(this._database)return this._database;if(Rs)return Rs().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(e){this._database=e}getXData(e){return this._xDataMap.get(e)}setXData(e){for(const t of e)t.code===tr.ExtendedDataRegAppName&&this._xDataMap.set(t.value,e)}removeXData(e){this._xDataMap.delete(e)}createExtensionDictionary(){}close(){}clone(){const e=Object.create(Object.getPrototypeOf(this)),t=this,i=e;for(const s of Object.keys(t))s!=="_database"&&(i[s]=this.cloneValue(t[s]));return e.objectId=this.generateTemporaryHandle(),e}cloneValue(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e))return e.map(s=>this.cloneValue(s));if(e instanceof Map){const s=new Map;for(const[r,a]of e.entries())s.set(this.cloneValue(r),this.cloneValue(a));return s}if(e instanceof Set){const s=new Set;for(const r of e.values())s.add(this.cloneValue(r));return s}if(ArrayBuffer.isView(e)){if(e instanceof DataView)return new DataView(e.buffer.slice(0));const s=e.constructor;return new s(e)}if(e instanceof ArrayBuffer)return e.slice(0);if("clone"in e&&typeof e.clone=="function")return e.clone();const t=Object.create(Object.getPrototypeOf(e)),i=e;for(const s of Object.keys(i))t[s]=this.cloneValue(i[s]);return t}dxfOut(...e){const[t,i=!1]=e;if(t.writeHandle(5,this.objectId),t.writeObjectId(330,this.ownerId),t.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(t),i)for(const s of this._xDataMap.values())t.writeResultBuffer(s);return this}dxfOutFields(e){return this}}let Bs;function ro(n){Bs=n}function nr(){return Rn.instance}const gs=class gs{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(e){this._workingDatabase=e}get layoutManager(){if(!this._layoutManager){if(!Bs)throw new Error("The layout manager factory must be registered before using it!");this._layoutManager=Bs()}return this._layoutManager}};gs.instance=new gs;let Rn=gs;so(nr);var ao=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(ao||{});class sr{constructor(e){if(this._values=[],e)for(const t of e)this._values.push({...t})}get length(){return this._values.length}at(e){return this._values[e]}add(e){this._values.push(e)}addRange(e){for(const t of e)this._values.push(t)}clear(){this._values.length=0}toArray(){return this._values.map(e=>({...e}))}clone(){return new sr(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class rr{constructor(e,t,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=i,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,i)=>{const s=()=>{Promise.resolve(e()).then(t).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(s):setTimeout(s,0)})}async processChunk(e,t){if(this._count<=0){await(t==null?void 0:t());return}let i=0;const s=async()=>{const r=i,a=Math.min(i+this._chunkSize,this._count);await e(r,a),i=a,i<this._count&&await this.scheduleTask(s)};await s(),await(t==null?void 0:t())}}var Ri=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Ri||{});class He{constructor(){this.events={registered:new te,unregistered:new te},this._converters=new Map,this.register("dxf",new sc)}static createInstance(){return He._instance==null&&(He._instance=new He),this._instance}static get instance(){return He._instance||(He._instance=new He),He._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}var ar=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(ar||{});class ri{static get instance(){return this._instance||(this._instance=new ri),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,i,s=[],r=!0,a,o){const h=[];if(t!=null){const c=this.createKey(t.name,i);let d;if(this.has(c))d=this.get(c);else{const u=t.newIterator();for(const p of u)p.color.isByBlock&&i?(Aa.copy(p.color),p.color.setRGBValue(i),this.addEntity(p,h,e),p.color.copy(Aa)):this.addEntity(p,h,e);d=e.group(h),d&&r&&ie.name&&!ie.name.startsWith("*U")&&this.set(c,d)}return d&&a&&(d.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),d.applyMatrix(a))),d&&s&&s.length>0&&(d.bakeTransformToChildren(),s.forEach(u=>d.addChild(u))),d}else return e.group(h)}addEntity(e,t,i){const s=e.worldDraw(i);s&&(this.attachEntityInfo(s,e),t.push(s))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const Aa=new X;var or=(n=>(n[n.UTF8=0]="UTF8",n[n.US_ASCII=1]="US_ASCII",n[n.ISO_8859_1=2]="ISO_8859_1",n[n.ISO_8859_2=3]="ISO_8859_2",n[n.ISO_8859_3=4]="ISO_8859_3",n[n.ISO_8859_4=5]="ISO_8859_4",n[n.ISO_8859_5=6]="ISO_8859_5",n[n.ISO_8859_6=7]="ISO_8859_6",n[n.ISO_8859_7=8]="ISO_8859_7",n[n.ISO_8859_8=9]="ISO_8859_8",n[n.ISO_8859_9=10]="ISO_8859_9",n[n.CP437=11]="CP437",n[n.CP850=12]="CP850",n[n.CP852=13]="CP852",n[n.CP855=14]="CP855",n[n.CP857=15]="CP857",n[n.CP860=16]="CP860",n[n.CP861=17]="CP861",n[n.CP863=18]="CP863",n[n.CP864=19]="CP864",n[n.CP865=20]="CP865",n[n.CP869=21]="CP869",n[n.CP932=22]="CP932",n[n.MACINTOSH=23]="MACINTOSH",n[n.BIG5=24]="BIG5",n[n.CP949=25]="CP949",n[n.JOHAB=26]="JOHAB",n[n.CP866=27]="CP866",n[n.ANSI_1250=28]="ANSI_1250",n[n.ANSI_1251=29]="ANSI_1251",n[n.ANSI_1252=30]="ANSI_1252",n[n.GB2312=31]="GB2312",n[n.ANSI_1253=32]="ANSI_1253",n[n.ANSI_1254=33]="ANSI_1254",n[n.ANSI_1255=34]="ANSI_1255",n[n.ANSI_1256=35]="ANSI_1256",n[n.ANSI_1257=36]="ANSI_1257",n[n.ANSI_874=37]="ANSI_874",n[n.ANSI_932=38]="ANSI_932",n[n.ANSI_936=39]="ANSI_936",n[n.ANSI_949=40]="ANSI_949",n[n.ANSI_950=41]="ANSI_950",n[n.ANSI_1361=42]="ANSI_1361",n[n.UTF16=43]="UTF16",n[n.ANSI_1258=44]="ANSI_1258",n[n.UNDEFINED=255]="UNDEFINED",n))(or||{});const fc=["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"],oo=n=>fc[n],It="Continuous",Q="Standard",gt="Standard",pt="Standard",xc="ANSI31",lo="ANGLE",ti="SOLID",ho="USER",co="LINEAR",pe="ByLayer",At="ByBlock",Fs="mlightcad",Ds="ACAD",ge=["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 Ia=1234567;const lr=Math.PI/180,hr=180/Math.PI;function uo(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ge[n&255]+ge[n>>8&255]+ge[n>>16&255]+ge[n>>24&255]+"-"+ge[e&255]+ge[e>>8&255]+"-"+ge[e>>16&15|64]+ge[e>>24&255]+"-"+ge[t&63|128]+ge[t>>8&255]+"-"+ge[t>>16&255]+ge[t>>24&255]+ge[i&255]+ge[i>>8&255]+ge[i>>16&255]+ge[i>>24&255]).toLowerCase()}function ut(n,e,t){return Math.max(e,Math.min(t,n))}function cr(n,e){return(n%e+e)%e}function go(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function po(n,e,t){return n!==e?(t-n)/(e-n):0}function dr(n,e,t){return(1-t)*n+t*e}function mo(n,e,t,i){return dr(n,e,1-Math.exp(-t*i))}function yo(n,e=1){return e-Math.abs(cr(n,e*2)-e)}function _o(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function fo(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function xo(n,e){return n+Math.floor(Math.random()*(e-n+1))}function wo(n,e){return n+Math.random()*(e-n)}function bo(n){return n*(.5-Math.random())}function Lo(n){n!==void 0&&(Ia=n);let e=Ia+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function So(n){return n*lr}function Ao(n){return n*hr}function Io(n){return(n&n-1)===0&&n!==0}function Po(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Eo(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Bi(n){const e=Math.PI*2;return(n%e+e)%e}function To(n,e,t){return n>e&&n<t||n>t&&n<e}function Mo(n,e,t,i=!1){return n=Bi(n),e=Bi(e),t=Bi(t),i?e>t?n<=e&&n>=t:n<=e||n>=t:e<t?n>=e&&n<=t:n>=e||n<=t}function ur(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function ko(n,e=1e-7){const t=ur(n);return Math.max(Math.pow(10,t)*e,e)}const k={DEG2RAD:lr,RAD2DEG:hr,generateUUID:uo,clamp:ut,euclideanModulo:cr,mapLinear:go,inverseLerp:po,lerp:dr,damp:mo,pingpong:yo,smoothstep:_o,smootherstep:fo,randInt:xo,randFloat:wo,randFloatSpread:bo,seededRandom:Lo,degToRad:So,radToDeg:Ao,isPowerOfTwo:Io,ceilPowerOfTwo:Po,floorPowerOfTwo:Eo,normalizeAngle:Bi,isBetween:To,isBetweenAngle:Mo,intPartLength:ur,relativeEps:ko},Vs=class Co{constructor(e,t){this.x=0,this.y=0;const i=+(e!==void 0)+ +(t!==void 0);if(i!==0){if(i===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(i===1){const{x:s,y:r}=e;this.x=s,this.y=r;return}if(i===2){this.x=e,this.y=t;return}throw be.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new Co(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix2d(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*s+e.x,this.y=r*s+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(k.relativeEps(this.x,e),k.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};Vs.EMPTY=Object.freeze(new Vs(0,0));let K=Vs;const zs=class vo{constructor(e,t,i,s,r,a,o,h,c){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&i!=null&&s!=null&&r!=null&&a!=null&&o!=null&&h!=null&&c!=null&&this.set(e,t,i,s,r,a,o,h,c)}set(e,t,i,s,r,a,o,h,c){const d=this.elements;return d[0]=e,d[1]=s,d[2]=o,d[3]=t,d[4]=r,d[5]=h,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,a=i[0],o=i[3],h=i[6],c=i[1],d=i[4],u=i[7],p=i[2],g=i[5],m=i[8],y=s[0],_=s[3],f=s[6],S=s[1],L=s[4],M=s[7],I=s[2],W=s[5],C=s[8];return r[0]=a*y+o*S+h*I,r[3]=a*_+o*L+h*W,r[6]=a*f+o*M+h*C,r[1]=c*y+d*S+u*I,r[4]=c*_+d*L+u*W,r[7]=c*f+d*M+u*C,r[2]=p*y+g*S+m*I,r[5]=p*_+g*L+m*W,r[8]=p*f+g*M+m*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*r*d+i*o*h+s*r*c-s*a*h}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8],u=d*a-o*c,p=o*h-d*r,g=c*r-a*h,m=t*u+i*p+s*g;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=u*y,e[1]=(s*c-d*i)*y,e[2]=(o*i-s*a)*y,e[3]=p*y,e[4]=(d*t-s*h)*y,e[5]=(s*r-o*t)*y,e[6]=g*y,e[7]=(i*h-c*t)*y,e[8]=(a*t-i*r)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this}setUvTransform(e,t,i,s,r,a,o){const h=Math.cos(r),c=Math.sin(r);return this.set(i*h,i*c,-i*(h*a+c*o)+a+e,-s*c,s*h,-s*(-c*a+h*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(bs.makeScale(e,t)),this}rotate(e){return this.premultiply(bs.makeRotation(-e)),this}translate(e,t){return this.premultiply(bs.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof K?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new vo().fromArray(this.elements)}};zs.IDENTITY=Object.freeze(new zs);let nn=zs;const bs=new nn,Qt=1e-6,G=2*Math.PI,wc={x:0,y:0},gr={x:0,y:0,z:0};class sn{constructor(){this.equalPointTol=Qt,this.equalVectorTol=Qt}clone(){const e=new sn;return e.equalPointTol=this.equalPointTol,e.equalVectorTol=this.equalVectorTol,e}equalPoint2d(e,t){return new K(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new x(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=Qt){return e<t&&e>-t}static equal(e,t,i=Qt){return Math.abs(e-t)<i}static great(e,t,i=Qt){return e-t>i}static less(e,t,i=Qt){return e-t<i}}const pr=new sn;class ai{constructor(e=0,t=0,i=0,s=1){this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,a,o){let h=i[s+0],c=i[s+1],d=i[s+2],u=i[s+3];const p=r[a+0],g=r[a+1],m=r[a+2],y=r[a+3];if(o===0){e[t+0]=h,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(o===1){e[t+0]=p,e[t+1]=g,e[t+2]=m,e[t+3]=y;return}if(u!==y||h!==p||c!==g||d!==m){let _=1-o;const f=h*p+c*g+d*m+u*y,S=f>=0?1:-1,L=1-f*f;if(L>Number.EPSILON){const I=Math.sqrt(L),W=Math.atan2(I,f*S);_=Math.sin(_*W)/I,o=Math.sin(o*W)/I}const M=o*S;if(h=h*_+p*M,c=c*_+g*M,d=d*_+m*M,u=u*_+y*M,_===1-o){const I=1/Math.sqrt(h*h+c*c+d*d+u*u);h*=I,c*=I,d*=I,u*=I}}e[t]=h,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,s,r,a){const o=i[s],h=i[s+1],c=i[s+2],d=i[s+3],u=r[a],p=r[a+1],g=r[a+2],m=r[a+3];return e[t]=o*m+d*u+h*g-c*p,e[t+1]=h*m+d*p+c*u-o*g,e[t+2]=c*m+d*g+o*p-h*u,e[t+3]=d*m-o*u-h*p-c*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new ai(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e.x,s=e.y,r=e.z,a=e.order,o=Math.cos,h=Math.sin,c=o(i/2),d=o(s/2),u=o(r/2),p=h(i/2),g=h(s/2),m=h(r/2);switch(a){case"XYZ":this._x=p*d*u+c*g*m,this._y=c*g*u-p*d*m,this._z=c*d*m+p*g*u,this._w=c*d*u-p*g*m;break;case"YXZ":this._x=p*d*u+c*g*m,this._y=c*g*u-p*d*m,this._z=c*d*m-p*g*u,this._w=c*d*u+p*g*m;break;case"ZXY":this._x=p*d*u-c*g*m,this._y=c*g*u+p*d*m,this._z=c*d*m+p*g*u,this._w=c*d*u-p*g*m;break;case"ZYX":this._x=p*d*u-c*g*m,this._y=c*g*u+p*d*m,this._z=c*d*m-p*g*u,this._w=c*d*u+p*g*m;break;case"YZX":this._x=p*d*u+c*g*m,this._y=c*g*u+p*d*m,this._z=c*d*m-p*g*u,this._w=c*d*u-p*g*m;break;case"XZY":this._x=p*d*u-c*g*m,this._y=c*g*u-p*d*m,this._z=c*d*m+p*g*u,this._w=c*d*u+p*g*m;break}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],a=t[1],o=t[5],h=t[9],c=t[2],d=t[6],u=t[10],p=i+o+u;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(d-h)*g,this._y=(r-c)*g,this._z=(a-s)*g}else if(i>o&&i>u){const g=2*Math.sqrt(1+i-o-u);this._w=(d-h)/g,this._x=.25*g,this._y=(s+a)/g,this._z=(r+c)/g}else if(o>u){const g=2*Math.sqrt(1+o-i-u);this._w=(r-c)/g,this._x=(s+a)/g,this._y=.25*g,this._z=(h+d)/g}else{const g=2*Math.sqrt(1+u-i-o);this._w=(a-s)/g,this._x=(r+c)/g,this._y=(h+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ut(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,a=e._w,o=t._x,h=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+s*c-r*h,this._y=s*d+a*h+r*o-i*c,this._z=r*d+a*c+i*h-s*o,this._w=a*d-i*o-s*h-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,a=this._w;let o=a*e._w+i*e._x+s*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=s,this._z=r,this;const h=1-o*o;if(h<=Number.EPSILON){const g=1-t;return this._w=g*a+t*this._w,this._x=g*i+t*this._x,this._y=g*s+t*this._y,this._z=g*r+t*this._z,this.normalize(),this}const c=Math.sqrt(h),d=Math.atan2(c,o),u=Math.sin((1-t)*d)/c,p=Math.sin(t*d)/c;return this._w=a*u+this._w*p,this._x=i*u+this._x*p,this._y=s*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const fe=class No{constructor(e,t,i){this.x=0,this.y=0,this.z=0;const s=+(e!==void 0)+ +(t!==void 0)+ +(i!==void 0);if(s!==0){if(s===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(s===1){const{x:r,y:a,z:o}=e;this.x=r,this.y=a,this.z=o||0;return}if(s===3){this.x=e,this.y=t,this.z=i;return}throw be.ILLEGAL_PARAMETERS}}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new No(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Pa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Pa.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,a=e.y,o=e.z,h=e.w,c=2*(a*s-o*i),d=2*(o*t-r*s),u=2*(r*i-a*t);return this.x=t+h*c+a*u-o*d,this.y=i+h*d+o*c-r*u,this.z=s+h*u+r*d-a*c,this}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),i=this.length(),s=e.length();return Math.abs(t)===i*s}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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,a=t.x,o=t.y,h=t.z;return this.x=s*h-r*o,this.y=r*a-i*h,this.z=i*o-s*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ls.copy(this).projectOnVector(e),this.sub(Ls)}reflect(e){return this.sub(Ls.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};fe.ORIGIN=Object.freeze(new fe(0,0,0)),fe.X_AXIS=Object.freeze(new fe(1,0,0)),fe.NEGATIVE_X_AXIS=Object.freeze(new fe(-1,0,0)),fe.Y_AXIS=Object.freeze(new fe(0,1,0)),fe.NEGATIVE_Y_AXIS=Object.freeze(new fe(0,-1,0)),fe.Z_AXIS=Object.freeze(new fe(0,0,1)),fe.NEGATIVE_Z_AXIS=Object.freeze(new fe(0,0,-1));let x=fe;const Ls=new x,Pa=new ai,Hs=class Oo{constructor(e,t,i,s,r,a,o,h,c,d,u,p,g,m,y,_){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&i!=null&&s!=null&&r!=null&&a!=null&&o!=null&&h!=null&&c!=null&&d!=null&&u!=null&&p!=null&&g!=null&&m!=null&&y!=null&&_!=null&&this.set(e,t,i,s,r,a,o,h,c,d,u,p,g,m,y,_)}set(e,t,i,s,r,a,o,h,c,d,u,p,g,m,y,_){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=s,f[1]=r,f[5]=a,f[9]=o,f[13]=h,f[2]=c,f[6]=d,f[10]=u,f[14]=p,f[3]=g,f[7]=m,f[11]=y,f[15]=_,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 Oo().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(pr.equalPoint3d(e,x.Z_AXIS))this.identity();else{const t=new x(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(x.Y_AXIS,e).normalize():t.crossVectors(x.Z_AXIS,e).normalize();const i=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,i.x,i.y,i.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/oi.setFromMatrixColumn(e,0).length(),r=1/oi.setFromMatrixColumn(e,1).length(),a=1/oi.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(bc,e,Lc)}lookAt(e,t,i){const s=this.elements;return Le.subVectors(e,t),Le.lengthSq()===0&&(Le.z=1),Le.normalize(),wt.crossVectors(i,Le),wt.lengthSq()===0&&(Math.abs(i.z)===1?Le.x+=1e-4:Le.z+=1e-4,Le.normalize(),wt.crossVectors(i,Le)),wt.normalize(),fn.crossVectors(Le,wt),s[0]=wt.x,s[4]=fn.x,s[8]=Le.x,s[1]=wt.y,s[5]=fn.y,s[9]=Le.y,s[2]=wt.z,s[6]=fn.z,s[10]=Le.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,a=i[0],o=i[4],h=i[8],c=i[12],d=i[1],u=i[5],p=i[9],g=i[13],m=i[2],y=i[6],_=i[10],f=i[14],S=i[3],L=i[7],M=i[11],I=i[15],W=s[0],C=s[4],q=s[8],R=s[12],se=s[1],B=s[5],$=s[9],Nt=s[13],Ot=s[2],cn=s[6],dn=s[10],un=s[14],gn=s[3],pn=s[7],mn=s[11],yn=s[15];return r[0]=a*W+o*se+h*Ot+c*gn,r[4]=a*C+o*B+h*cn+c*pn,r[8]=a*q+o*$+h*dn+c*mn,r[12]=a*R+o*Nt+h*un+c*yn,r[1]=d*W+u*se+p*Ot+g*gn,r[5]=d*C+u*B+p*cn+g*pn,r[9]=d*q+u*$+p*dn+g*mn,r[13]=d*R+u*Nt+p*un+g*yn,r[2]=m*W+y*se+_*Ot+f*gn,r[6]=m*C+y*B+_*cn+f*pn,r[10]=m*q+y*$+_*dn+f*mn,r[14]=m*R+y*Nt+_*un+f*yn,r[3]=S*W+L*se+M*Ot+I*gn,r[7]=S*C+L*B+M*cn+I*pn,r[11]=S*q+L*$+M*dn+I*mn,r[15]=S*R+L*Nt+M*un+I*yn,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],a=e[1],o=e[5],h=e[9],c=e[13],d=e[2],u=e[6],p=e[10],g=e[14],m=e[3],y=e[7],_=e[11],f=e[15];return m*(+r*h*u-s*c*u-r*o*p+i*c*p+s*o*g-i*h*g)+y*(+t*h*g-t*c*p+r*a*p-s*a*g+s*c*d-r*h*d)+_*(+t*c*u-t*o*g-r*a*u+i*a*g+r*o*d-i*c*d)+f*(-s*o*d-t*h*u+t*o*p+s*a*u-i*a*p+i*h*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e instanceof x?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],y=e[13],_=e[14],f=e[15],S=u*_*c-y*p*c+y*h*g-o*_*g-u*h*f+o*p*f,L=m*p*c-d*_*c-m*h*g+a*_*g+d*h*f-a*p*f,M=d*y*c-m*u*c+m*o*g-a*y*g-d*o*f+a*u*f,I=m*u*h-d*y*h-m*o*p+a*y*p+d*o*_-a*u*_,W=t*S+i*L+s*M+r*I;if(W===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/W;return e[0]=S*C,e[1]=(y*p*r-u*_*r-y*s*g+i*_*g+u*s*f-i*p*f)*C,e[2]=(o*_*r-y*h*r+y*s*c-i*_*c-o*s*f+i*h*f)*C,e[3]=(u*h*r-o*p*r-u*s*c+i*p*c+o*s*g-i*h*g)*C,e[4]=L*C,e[5]=(d*_*r-m*p*r+m*s*g-t*_*g-d*s*f+t*p*f)*C,e[6]=(m*h*r-a*_*r-m*s*c+t*_*c+a*s*f-t*h*f)*C,e[7]=(a*p*r-d*h*r+d*s*c-t*p*c-a*s*g+t*h*g)*C,e[8]=M*C,e[9]=(m*u*r-d*y*r-m*i*g+t*y*g+d*i*f-t*u*f)*C,e[10]=(a*y*r-m*o*r+m*i*c-t*y*c-a*i*f+t*o*f)*C,e[11]=(d*o*r-a*u*r-d*i*c+t*u*c+a*i*g-t*o*g)*C,e[12]=I*C,e[13]=(d*y*s-m*u*s+m*i*p-t*y*p-d*i*_+t*u*_)*C,e[14]=(m*o*s-a*y*s-m*i*h+t*y*h+a*i*_-t*o*_)*C,e[15]=(a*u*s-d*o*s+d*i*h-t*u*h-a*i*p+t*o*p)*C,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e instanceof x?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,a=e.x,o=e.y,h=e.z,c=r*a,d=r*o;return this.set(c*a+i,c*o-s*h,c*h+s*o,0,c*o+s*h,d*o+i,d*h-s*a,0,c*h-s*o,d*h+s*a,r*h*h+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,a){return this.set(1,i,r,0,e,1,a,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t.x,a=t.y,o=t.z,h=t.w,c=r+r,d=a+a,u=o+o,p=r*c,g=r*d,m=r*u,y=a*d,_=a*u,f=o*u,S=h*c,L=h*d,M=h*u,I=i.x,W=i.y,C=i.z;return s[0]=(1-(y+f))*I,s[1]=(g+M)*I,s[2]=(m-L)*I,s[3]=0,s[4]=(g-M)*W,s[5]=(1-(p+f))*W,s[6]=(_+S)*W,s[7]=0,s[8]=(m+L)*C,s[9]=(_-S)*C,s[10]=(1-(p+y))*C,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=oi.set(s[0],s[1],s[2]).length();const a=oi.set(s[4],s[5],s[6]).length(),o=oi.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Oe.copy(this);const h=1/r,c=1/a,d=1/o;return Oe.elements[0]*=h,Oe.elements[1]*=h,Oe.elements[2]*=h,Oe.elements[4]*=c,Oe.elements[5]*=c,Oe.elements[6]*=c,Oe.elements[8]*=d,Oe.elements[9]*=d,Oe.elements[10]*=d,t.setFromRotationMatrix(Oe),i.x=r,i.y=a,i.z=o,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Hs.IDENTITY=Object.freeze(new Hs);let H=Hs;const oi=new x,Oe=new H,bc=new x(0,0,0),Lc=new x(1,1,1),wt=new x,fn=new x,Le=new x;let Y=class Yo{constructor(e=void 0,t=void 0){this.min=e==null?new x(1/0,1/0,1/0):new x(e.x,e.y,e.z),this.max=t==null?new x(-1/0,-1/0,-1/0):new x(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Ss.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Ss.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new Yo().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ss).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qe),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};const qe=[new x,new x,new x,new x,new x,new x,new x,new x],Ss=new x,Ea=new K;let xe=class Xo{constructor(e=void 0,t=void 0){this.min=e==null?new K(1/0,1/0):new K(e.x,e.y),this.max=t==null?new K(-1/0,-1/0):new K(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Ea.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new Xo().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new K(0,0):new K(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new K(0,0):new K(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ea).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};const Ta=new x,Sc=new x,Ac=new nn;class rn{constructor(e=new x(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=Ta.subVectors(i,t).cross(Sc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectsBox(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Ac.getNormalMatrix(e),s=this.coplanarPoint(Ta).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new rn().copy(this)}}let v=class Ro extends K{clone(){return new Ro(this.x,this.y)}static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((i,s)=>{i.toArray(t,s*2)}),t}},w=class Bo extends x{clone(){return new Bo(this.x,this.y,this.z)}static pointArrayToNumberArray(e,t=!0){const i=t?3:2,s=new Array(e.length*i);return e.forEach((r,a)=>{r.toArray(s,a*i)}),s}};const Ma=new H,ka=new ai,Fo=class js{constructor(e=0,t=0,i=0,s=js.DEFAULT_ORDER){this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new js(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],a=s[4],o=s[8],h=s[1],c=s[5],d=s[9],u=s[2],p=s[6],g=s[10];switch(t){case"XYZ":this._y=Math.asin(ut(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ut(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(h,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(ut(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,g),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-ut(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ut(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-ut(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,g),this._y=0);break}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i=!0){return Ma.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ma,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ka.setFromEuler(this),this.setFromQuaternion(ka,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Fo.DEFAULT_ORDER="XYZ";let Ic=Fo;function mr(n,e,t=!1){const i=n.x,s=n.y;let r=!1;const a=e.length;for(let o=0,h=a-1;o<a;h=o++){const c=e[o].x,d=e[o].y,u=e[h].x,p=e[h].y;let g=d>s!=p>s;t&&(g=d>=s!=p>=s),g&&i<(u-c)*(s-d)/(p-d)+c&&(r=!r)}return r}function Do(n,e){if(n.length===0||e.length===0)return!1;const t=new xe().setFromPoints(n),i=new xe().setFromPoints(e);if(!t.intersectsBox(i))return!1;for(let s=0;s<n.length;){if(mr(n[s],e,!0))return!0;s<n.length-1&&pr.equalPoint2d(n[s+1],n[s])&&++s,++s}return!1}const Vo={isPointInPolygon:mr,isPolygonIntersect:Do};function Pc(n,e){const t=[],i=e-1,s=n;for(let r=0;r<=s;r++)t.push(0);for(let r=1;r<=i-s;r++)t.push(r);for(let r=0;r<=s;r++)t.push(i-s+1);return t}function Ec(n,e){const t=e.length-1,i=n,s=[0];let r=0;for(let o=1;o<=t;o++){const h=e[o][0]-e[o-1][0],c=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(h*h+c*c+d*d);r+=u,s.push(r)}const a=[];for(let o=0;o<=i;o++)a.push(0);for(let o=1;o<=t-i;o++){const h=s[o]/r;a.push(h*(t-i+1))}for(let o=0;o<=i;o++)a.push(t-i+1);return a}function zo(n,e="Uniform"){const t=n.length;if(t===0)return[];if(t===1)return[0];const i=t-1;if(e==="Uniform")return new Array(t).fill(0).map((a,o)=>o/i);const s=[0];let r=0;for(let a=1;a<=i;a++){const o=n[a][0]-n[a-1][0],h=n[a][1]-n[a-1][1],c=n[a][2]-n[a-1][2],d=Math.sqrt(o*o+h*h+c*c),u=e==="SqrtChord"?Math.sqrt(d):d;r+=u,s.push(r)}return r<1e-12?new Array(t).fill(0).map((a,o)=>o/i):s.map(a=>a/r)}function Ho(n,e){const t=e.length-1,i=n,s=t+i+1,r=new Array(s+1).fill(0),a=e[e.length-1];for(let o=s-i;o<=s;o++)r[o]=a;for(let o=1;o<=t-i;o++){let h=0;for(let c=o;c<o+i;c++)h+=e[c];r[o+i]=h/i}return r}function Tc(n,e){const t=e.length-1,i=n,s=[0];let r=0;for(let o=1;o<=t;o++){const h=e[o][0]-e[o-1][0],c=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(h*h+c*c+d*d),p=Math.sqrt(u);r+=p,s.push(r)}const a=[];for(let o=0;o<=i;o++)a.push(0);for(let o=1;o<=t-i;o++){const h=s[o]/r;a.push(h*(t-i+1))}for(let o=0;o<=i;o++)a.push(t-i+1);return a}function As(n,e){const t=n.length,i=n.map(a=>a.slice()),s=e.slice();for(let a=0;a<t;a++){let o=a,h=Math.abs(i[a][a]);for(let c=a+1;c<t;c++){const d=Math.abs(i[c][a]);d>h&&(h=d,o=c)}if(h<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==a){const c=i[a];i[a]=i[o],i[o]=c;const d=s[a];s[a]=s[o],s[o]=d}for(let c=a+1;c<t;c++){const d=i[c][a]/i[a][a];if(!(Math.abs(d)<1e-14)){for(let u=a;u<t;u++)i[c][u]-=d*i[a][u];s[c]-=d*s[a]}}}const r=new Array(t).fill(0);for(let a=t-1;a>=0;a--){let o=s[a];for(let h=a+1;h<t;h++)o-=i[a][h]*r[h];r[a]=o/i[a][a]}return r}function yr(n,e,t="Uniform",i,s){if(n.length===0)return{controlPoints:[],knots:[],weights:[]};const r=n.map(R=>[R[0],R[1],R[2]??0]),a=!!i,o=!!s,h=(a?1:0)+(o?1:0),c=r.length-1,d=c+h;if(d<e)throw new Error("Not enough points to interpolate a curve of this degree.");const u=zo(r,t),p=u.slice();a&&p.unshift(u[0]),o&&p.push(u[u.length-1]);const g=Ho(e,p),m=d+1,y=new Array(m),_=new Array(m),f=new Array(m),S=new Array(m);let L=0;y[L]=new Array(m).fill(0),y[L][0]=1,_[L]=r[0][0],f[L]=r[0][1],S[L]=r[0][2],L++;for(let R=1;R<=c-1;R++){const se=u[R];y[L]=new Array(m).fill(0);for(let B=0;B<=d;B++)y[L][B]=Wi(B,e,se,g);_[L]=r[R][0],f[L]=r[R][1],S[L]=r[R][2],L++}if(y[L]=new Array(m).fill(0),y[L][d]=1,_[L]=r[c][0],f[L]=r[c][1],S[L]=r[c][2],L++,a){const R=g[e+1]-g[0],se=R!==0?e/R:0;y[L]=new Array(m).fill(0),y[L][0]=-se,y[L][1]=se,_[L]=(i==null?void 0:i[0])??0,f[L]=(i==null?void 0:i[1])??0,S[L]=(i==null?void 0:i[2])??0,L++}if(o){const R=g[d+e+1]-g[d],se=R!==0?e/R:0;y[L]=new Array(m).fill(0),y[L][d-1]=-se,y[L][d]=se,_[L]=(s==null?void 0:s[0])??0,f[L]=(s==null?void 0:s[1])??0,S[L]=(s==null?void 0:s[2])??0,L++}const M=As(y,_),I=As(y,f),W=As(y,S),C=new Array(m);for(let R=0;R<m;R++)C[R]=[M[R],I[R],W[R]];const q=new Array(m).fill(1);return{controlPoints:C,knots:g,weights:q}}function Wi(n,e,t,i){if(e===0)return t>=i[n]&&t<i[n+1]?1:0;const s=i[n+e]-i[n],r=i[n+e+1]-i[n+1],a=s>1e-10?(t-i[n])/s:0,o=r>1e-10?(i[n+e+1]-t)/r:0;return a*Wi(n,e-1,t,i)+o*Wi(n+1,e-1,t,i)}function Fi(n,e,t,i,s){const r=i.length-1,a=e;if(n=Math.max(t[a],Math.min(t[r+1],n)),Math.abs(n-t[r+1])<1e-8)return[...i[r]];if(Math.abs(n-t[a])<1e-8)return[...i[0]];const o=[0,0,0];let h=0;for(let c=0;c<=r;c++){const d=Wi(c,a,n,t),u=s[c]*d;o[0]+=i[c][0]*u,o[1]+=i[c][1]*u,o[2]+=i[c][2]*u,h+=u}if(Math.abs(h)<1e-10){const c=t[t.length-a-1];if(Math.abs(n-c)<1e-8)return[...i[r]];if(Math.abs(n-t[a])<1e-8)return[...i[0]]}return Math.abs(h)>=1e-10&&(o[0]/=h,o[1]/=h,o[2]/=h),o}function jo(n,e,t,i){const s=n,r=e[s],a=e[e.length-s-1];let o=0;const h=1e3,c=(a-r)/h;let d=Fi(r,n,e,t,i);for(let y=1;y<=h;y++){const _=r+y*c,f=Fi(_,n,e,t,i),S=f[0]-d[0],L=f[1]-d[1],M=f[2]-d[2];o+=Math.sqrt(S*S+L*L+M*M),d=f}const u=Fi(a,n,e,t,i),p=u[0]-d[0],g=u[1]-d[1],m=u[2]-d[2];return o+=Math.sqrt(p*p+g*g+m*m),o}function Mc(n,e=3,t="Uniform",i,s){return n.length===0?[]:yr(n,e,t,i,s).controlPoints}const Ca=new H,va=new x,kc=new x,Cc=new x,Is=new w;function Wo(n){return new H().setFromExtrusionDirection(new x(n.x,n.y,n.z))}function _r(n){return Ca.setFromExtrusionDirection(new x(n.x,n.y,n.z)),Ca.extractBasis(va,kc,Cc),va.clone()}function Ws(n,e){return new w(n.x,n.y,n.z??0).applyMatrix4(Wo(e))}function Gi(n,e){return new w(n.x,n.y,n.z??0).applyMatrix4(Wo(e).invert())}function Gs(n,e,t){const i=Gi(n,t),s=Gi(e,t);return Is.set(s.x-i.x,s.y-i.y,(s.z??0)-(i.z??0)),k.normalizeAngle(Math.atan2(Is.y,Is.x))}class Go{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class fr extends Go{translate(e){return this.transform(new nn().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}let Tt=class Uo extends fr{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new xe}transform(e){return this._loops.forEach(t=>{t.transform(e)}),this._boundingBoxNeedsUpdate=!0,this}clone(){const e=new Uo;return this._loops.forEach(t=>{e.add(t.clone())}),e}getPoints(e){const t=[];for(let i=0;i<this.loops.length;++i){const s=this.loops[i].getPoints(e);t.push(s)}return t}buildHierarchy(){var e;const t=this.getPoints(100),i=this.calculateBoundaryBoxes(t),s=this.sortBoundaryBoxesByAreas(i),r=new Map,a=s.length;for(let h=0;h<a;h++)r.set(s[h],{index:s[h],children:[]});const o={index:-1,children:[]};for(let h=0;h<a;h++){const c=s[h],d=t[c],u=i[c];let p=h+1;for(;p<a;p++){const g=s[p],m=t[g];if(i[g].containsBox(u)&&Vo.isPointInPolygon(d[k.randInt(0,d.length-1)],m)){(e=r.get(g))==null||e.children.push(r.get(c));break}}p===a&&o.children.push(r.get(c))}return o}get area(){if(this._loops.length===0)return 0;let e=0;for(let t=0;t<this._loops.length;t++){const i=this._loops[t].getPoints(128),s=this.polygonArea(i);t===0?e+=Math.abs(s):e-=Math.abs(s)}return e}polygonArea(e){const t=e.length;if(t<3)return 0;let i=0;for(let s=0,r=t-1;s<t;r=s++){const a=e[r],o=e[s];i+=a.x*o.y-o.x*a.y}return i*.5}calculateBoundaryBoxes(e){const t=[];return e.forEach(i=>{t.push(new xe().setFromPoints(i))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((s,r)=>{const a=s.size,o=a.width*a.height;t.push({area:o,index:r})}),t.sort((s,r)=>s.area-r.area);const i=[];return t.forEach(s=>{i.push(s.index)}),i}},mi=class extends fr{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const t=this.getUtoTmapping(e);return this.getPoint(t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let i,s=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),r+=i.distanceTo(s),t.push(r),s=i;return t}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let a;t?a=t:a=e*i[r-1];let o=0,h=r-1,c;for(;o<=h;)if(s=Math.floor(o+(h-o)/2),c=i[s]-a,c<0)o=s+1;else if(c>0)h=s-1;else{h=s;break}if(s=h,i[s]===a)return s/(r-1);const d=i[s],u=i[s+1]-d,p=(a-d)/u;return(s+p)/(r-1)}getTangent(e){let t=e-1e-4,i=e+1e-4;t<0&&(t=0),i>1&&(i=1);const s=this.getPoint(t),r=this.getPoint(i),a=new v;return a.copy(r).sub(s).normalize(),a}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}},Mt=class Us extends mi{constructor(e,t,i,s,r){super();const a=+(e!==void 0)+ +(t!==void 0)+ +(i!==void 0)+ +(s!==void 0)+ +(r!==void 0);if(a==3)typeof e=="object"&&typeof t=="object"&&typeof i=="object"?this.createByThreePoints(e,t,i):this.createByStartEndPointsAndBulge(e,t,i);else if(a==5){const o=e;this.center=new v(o.x,o.y),this.radius=t,this._clockwise=r,this._startAngle=this._clockwise?this._mirrorAngle(k.normalizeAngle(i)):k.normalizeAngle(i),this._endAngle=this._clockwise?this._mirrorAngle(k.normalizeAngle(s)):k.normalizeAngle(s)}else throw be.ILLEGAL_PARAMETERS}createByThreePoints(e,t,i){const s=(C,q)=>({x:(C.x+q.x)/2,y:(C.y+q.y)/2}),r=(C,q)=>(q.y-C.y)/(q.x-C.x),a=C=>-1/C,o=s(e,t),h=s(t,i),c=r(e,t),d=r(t,i),u=a(c),p=a(d),g=(C,q,R,se)=>{const B=(se-q)/(C-R),$=C*B+q;return{x:B,y:$}},m=o.y-u*o.x,y=h.y-p*h.x,_=g(u,m,p,y),f=Math.sqrt(Math.pow(e.x-_.x,2)+Math.pow(e.y-_.y,2)),S=(C,q)=>Math.atan2(C.y-q.y,C.x-q.x),L=S(e,_),M=S(t,_),I=S(i,_),W=I>L&&I<M||L>I&&L<M||M>I&&M<L;this.center=_,this.radius=f,this._clockwise=!W,this._startAngle=L,this._endAngle=I}createByStartEndPointsAndBulge(e,t,i){let s,r,a;i<0?(s=Math.atan(-i)*4,r=new K(e),a=new K(t)):(s=Math.atan(i)*4,r=new K(t),a=new K(e));const o=new K().subVectors(a,r),h=o.length(),c=new K().addVectors(r,o.multiplyScalar(.5)),d=Math.abs(h/2/Math.tan(s/2)),u=o.normalize(),p=i<0?-Math.PI/2:Math.PI/2,g=new K(u.x*Math.cos(p)-u.y*Math.sin(p),u.y*Math.cos(p)+u.x*Math.sin(p));let m;s<Math.PI?i<0?m=c.add(g.multiplyScalar(d)):m=c.add(g.multiplyScalar(-d)):i<0?m=c.add(g.multiplyScalar(-d)):m=c.add(g.multiplyScalar(d)),i<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=i<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(e){this._center=new v(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(e){this._startAngle=this._clockwise?this._mirrorAngle(k.normalizeAngle(e)):k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(e){const t=this.startAngle==0&&e==G?e:k.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(t):t,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(e){return(360-e*180/Math.PI)%360*Math.PI/180}_getInternalAngle(e){return this._clockwise?this._mirrorAngle(e):e}get deltaAngle(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return this.clockwise?k.normalizeAngle(e-t):k.normalizeAngle(t-e)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=this._getInternalAngle(this.startAngle),t=this._clockwise?k.normalizeAngle(e-this.deltaAngle/2):k.normalizeAngle(e+this.deltaAngle/2),i=this._clockwise?this._mirrorAngle(t):t;return this.getPointAtAngle(i)}get closed(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return Math.abs(t-e)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const r of t){const a=this._getInternalAngle(r);k.isBetweenAngle(a,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&e.push(this.getPointAtAngle(r))}const i=e.map(r=>r.x),s=e.map(r=>r.y);return new xe(new v(Math.min(...i),Math.min(...s)),new v(Math.max(...i),Math.max(...s)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){const t=e,i=this.center.clone().applyMatrix2d(t),s=this.startPoint.clone().applyMatrix2d(t);if(this.closed)return this.center=i,this.radius=i.distanceTo(s),this._startAngle=Math.atan2(s.y-i.y,s.x-i.x),this._endAngle=this._startAngle,this._clockwise=t.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;const r=this.midPoint.clone().applyMatrix2d(t),a=this.endPoint.clone().applyMatrix2d(t),o=new Us(s,r,a),h=t.determinant()<0?!this.clockwise:this.clockwise,c=d=>{const u=k.normalizeAngle(d);return h?this._mirrorAngle(u):u};return this.center=o.center,this.radius=o.radius,this.clockwise=h,this.startAngle=c(Math.atan2(s.y-o.center.y,s.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 Us(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(e){const t=this._getInternalAngle(e),i=this.center.x+this.radius*Math.cos(t),s=this.center.y+this.radius*Math.sin(t);return new v(i,s)}getPoints(e=100){const t=[];let i=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(i=G,s=0),this.clockwise)for(let r=0;r<=e;r++){const a=s-i*(r/e),o=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(o);t.push(new v(h.x,h.y))}else for(let r=0;r<=e;r++){const a=s+i*(r/e),o=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(o);t.push(new v(h.x,h.y))}return t}};class vc extends Go{translate(e){return this.transform(new H().makeTranslation(e.x,e.y,e.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class an extends vc{}class kt extends an{constructor(e,t){super(),this._start=new w(e),this._end=new w(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new x().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(e){return this.project(e)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(e){return this.project(e).distanceTo(e)<1e-6}at(e,t){return this.delta(t).multiplyScalar(e).add(this._start)}atLength(e,t=!1){if(t){const i=this.delta(Yt).normalize();return new w(this._start).addScaledVector(i,e)}else{const i=this.delta(Yt).normalize();return new w(this._end).addScaledVector(i,e)}}extend(e,t=!1){if(t){const i=Yt.subVectors(this._start,this._end).normalize();this._start=new w(this._start).addScaledVector(i,e)}else{const i=this.delta(Yt).normalize();this._end=new w(this._end).addScaledVector(i,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){Na.subVectors(e,this._start),xn.subVectors(this.endPoint,this.startPoint);const i=xn.dot(xn);let s=xn.dot(Na)/i;return t&&(s=k.clamp(s,0,1)),s}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this._start)}delta(e){return e.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(e){const t=this.direction,i=Yt.subVectors(e,this.startPoint).dot(t);return new w().copy(t).multiplyScalar(i).add(this.startPoint)}perpPoint(e){const t=this.direction,i=this.startPoint,s=Yt.subVectors(e,i).dot(t),r=Yt.copy(t).multiplyScalar(s);return new w().addVectors(i,r)}calculateBoundingBox(){const e=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)),t=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 Y(e,t)}transform(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new kt(this._start.clone(),this._end.clone())}}const Yt=new x,Na=new x,xn=new x;class Pt extends an{static computeCenterPoint(e,t,i){const s=new x().addVectors(e,t).multiplyScalar(.5),r=new x().addVectors(e,i).multiplyScalar(.5),a=new x().subVectors(t,e),o=new x().subVectors(i,e),h=new x().crossVectors(a,o).normalize();if(h.lengthSq()===0)return null;const c=new x().crossVectors(a,h).normalize(),d=new x().crossVectors(o,h).normalize(),u=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),g=new kt(s,s.clone().add(u)),m=new kt(r,r.clone().add(p)),y=new x;return g.closestPointToPoint(m.startPoint,!0,y)?y:null}static createByThreePoints(e,t,i){const s=Pt.computeCenterPoint(e,t,i);if(s){const r=s.distanceTo(e),a=new x().subVectors(e,s),o=new x().subVectors(t,s),h=Math.atan2(a.y,a.x),c=Math.atan2(o.y,o.x);return new Pt(s,r,h,c,x.Z_AXIS)}}constructor(e,t,i,s,r,a=x.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=i,this.endAngle=s,this.normal=r,this.refVec=a,(s-i)%G==0?(this.startAngle=0,this.endAngle=G):(this.startAngle=i,this.endAngle=s)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==G?e:k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return k.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(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new x(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let e=this.startAngle,t=this.deltaAngle;this.closed&&(e=0,t=G);const i=e+t*.5;return this.getPointAtAngle(i)}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(e){const t=new x(e.x,e.y,e.z||0),i=this.center,s=this.normal,r=t.clone().sub(i).dot(s),a=t.clone().sub(s.clone().multiplyScalar(r)).clone().sub(i);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const o=i.clone().add(a),h=this.getAngle(o.clone()),c=this.startAngle,d=this.deltaAngle;let u=k.normalizeAngle(h-c);u<0&&(u=0),u>d&&(u=d);const p=this.getPointAtAngle(c+u),g=p.distanceTo(t),m=this.startPoint.distanceTo(t),y=this.endPoint.distanceTo(t);return m<g&&m<=y?this.startPoint.clone():y<g&&y<m?this.endPoint.clone():p}tangentPoints(e){const t=[],i=new x(e.x,e.y,e.z||0),s=this.center,r=this.normal,a=this.radius,o=i.clone().sub(s).dot(r),h=i.clone().sub(r.clone().multiplyScalar(o)),c=s.clone(),d=h.clone().sub(c).length();if(d<a)return t;const u=Math.acos(a/d),p=this.getAngle(h.clone()),g=[p+u,p-u];for(const m of g){const y=k.normalizeAngle(m-this.startAngle);y>=0&&y<=this.deltaAngle&&t.push(this.getPointAtAngle(this.startAngle+y))}return t}nearestTangentPoint(e){const t=this.tangentPoints(e);if(t.length===0)return null;const i=new w(e.x,e.y,e.z||0);return t.length===1||t[0].distanceTo(i)<t[1].distanceTo(i)?t[0]:t[1]}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let h=0;h<2*Math.PI;h+=Math.PI/2)k.isBetweenAngle(h,this.startAngle,this.endAngle)&&e.push(h);let t=1/0,i=1/0,s=1/0,r=-1/0,a=-1/0,o=-1/0;for(const h of e){const c=this.getPointAtAngle(h);c.x<t&&(t=c.x),c.y<i&&(i=c.y),c.z<s&&(s=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new Y({x:t,y:i,z:s},{x:r,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(let r=0;r<=e;r++){const a=s+i*(r/e),o=this.getPointAtAngle(a);t.push(o)}return t}transform(e){const t=this.center.clone().applyMatrix4(e),i=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),r=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new x(i).sub(t).normalize(),o=t.distanceTo(i);let h=new x().crossVectors(new x(i).sub(t),new x(r).sub(t)).normalize();h.lengthSq()===0&&(h=this.normal.clone().transformDirection(e));const c=d=>{const u=new x(d).sub(t);return Math.atan2(u.dot(Oa.crossVectors(h,a)),u.dot(a))};return this.center=t,this.radius=o,this.normal=h,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?G:c(s),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Pt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(Oa.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,i=this.refVec,s={x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x},r=this.center,a=this.radius;return new w(r.x+a*(i.x*Math.cos(e)+s.x*Math.sin(e)),r.y+a*(i.y*Math.cos(e)+s.y*Math.sin(e)),r.z+a*(i.z*Math.cos(e)+s.z*Math.sin(e)))}get plane(){const e=new x(this.center).distanceTo(gr);return new rn(this.normal,e)}}const Oa=new x;let Ui=class Tn extends mi{constructor(e,t,i,s=0,r=G,a=!1,o=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=i,(r-s)%G==0?(this.startAngle=0,this.endAngle=G):(this.startAngle=s,this.endAngle=r),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==G?e:k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return k.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,i=-1/0,s=-1/0;for(let r=0;r<=100;r++){const a=this.getPoint(r/100);e=Math.min(e,a.x),t=Math.min(t,a.y),i=Math.max(i,a.x),s=Math.max(s,a.y)}return new xe({x:e,y:t},{x:i,y:s})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let i=this.endAngle-this.startAngle;const s=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=t;for(;i>t;)i-=t;i<Number.EPSILON&&(s?i=0:i=t),this.clockwise===!0&&!s&&(i===t?i=-t:i=i-t);const r=this.startAngle+e*i;let a=this.center.x+this.majorAxisRadius*Math.cos(r),o=this.center.y+this.minorAxisRadius*Math.sin(r);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),d=a-this.center.x,u=o-this.center.y;a=d*h-u*c+this.center.x,o=d*c+u*h+this.center.y}return new v(a,o)}transform(e){const t=e,i=new v(this.center).applyMatrix2d(t),s=new w(i.x,i.y,this.center.z),r=this.getPointAtAngle(0).clone().applyMatrix2d(t),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(t),o=new v(r).sub(i),h=new v(a).sub(i),c=o.length(),d=h.length(),u=Math.atan2(o.y,o.x),p=o.clone().normalize(),g=h.clone().normalize(),m=f=>{const S=new v(f).sub(i),L=S.dot(p),M=S.dot(g);return k.normalizeAngle(Math.atan2(M/d,L/c))},y=t.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new Tn(s,c,d,0,G,y,u):new Tn(s,c,d,m(this.startPoint.clone().applyMatrix2d(t)),m(this.endPoint.clone().applyMatrix2d(t)),y,u);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this}getPointAtAngle(e){return this.getPoint(this.closed?e/G:k.normalizeAngle(e-this.startAngle)/this.deltaAngle)}copy(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}clone(){return new Tn(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}};class ui extends an{constructor(e,t,i,s,r,a=0,o=G){super(),this.center=e,this.normal=t,this.majorAxis=i,this.majorAxisRadius=s,this.minorAxisRadius=r;const h=Math.abs(o-a);Math.abs(h-G)<1e-10||Math.abs(h-2*G)<1e-10?(this.startAngle=0,this.endAngle=G):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==G?e:k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-G)<1e-10?G:k.normalizeAngle(e)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new x(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new x().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let e=this.startAngle,t=this.deltaAngle;(this.closed||Math.abs(t-G)<1e-10)&&(e=0,t=G);const i=e+t/2;return this.getPointAtAngle(i)}get isCircular(){return sn.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const e=1e3,t=this.deltaAngle/e;let i=0,s=this.getPointAtAngle(this.startAngle);for(let r=1;r<=e;r++){const a=this.startAngle+r*t,o=this.getPointAtAngle(a),h=o.x-s.x,c=o.y-s.y,d=o.z-s.z;i+=Math.sqrt(h*h+c*c+d*d),s=o}return i}get area(){const e=this.majorAxisRadius,t=this.minorAxisRadius,i=this.startAngle,s=i+this.deltaAngle;if(Math.abs(this.deltaAngle-G)<1e-10)return Math.PI*e*t;const r=e*t/2*(s-i-(Math.sin(s)*Math.cos(s)-Math.sin(i)*Math.cos(i)));return Math.abs(r)}calculateBoundingBox(){if(this.majorAxis.equals(x.X_AXIS)||this.majorAxis.equals(x.Y_AXIS)||this.majorAxis.isParallelTo(x.X_AXIS)||this.majorAxis.isParallelTo(x.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let h=0;h<2*Math.PI;h+=Math.PI/2)k.isBetweenAngle(h,this.startAngle,this.endAngle)&&e.push(h);let t=1/0,i=1/0,s=1/0,r=-1/0,a=-1/0,o=-1/0;for(const h of e){const c=this.getPointAtAngle(h);c.x<t&&(t=c.x),c.y<i&&(i=c.y),c.z<s&&(s=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new Y({x:t,y:i,z:s},{x:r,y:a,z:o})}else{let e=1/0,t=1/0,i=1/0,s=-1/0,r=-1/0,a=-1/0;for(let o=0;o<=100;o++){const h=this.startAngle+this.deltaAngle*(o/100),c=this.getPointAtAngle(h);e=Math.min(e,c.x),t=Math.min(t,c.y),i=Math.min(i,c.z),s=Math.max(s,c.x),r=Math.max(r,c.y),a=Math.max(a,c.z)}return new Y({x:e,y:t,z:i},{x:s,y:r,z:a})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(let r=0;r<=e;r++){const a=s+i*(r/e),o=this.getPointAtAngle(a);t.push(o)}return t}getPointAtAngle(e){const t=Math.cos(e),i=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),r=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(s);return new w(this.center.x+r.x,this.center.y+r.y,this.center.z+r.z)}contains(e){const t=new x(e).sub(this.center),i=t.dot(this.majorAxis),s=t.dot(this.minorAxis),r=i/this.majorAxisRadius,a=s/this.minorAxisRadius;return r*r+a*a<=1}transform(e){const t=e,i=this.center.clone().applyMatrix4(t),s=this.getPointAtAngle(0).clone().applyMatrix4(t),r=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(t),a=new x(s).sub(i),o=new x(r).sub(i),h=a.length(),c=o.length(),d=a.clone().normalize(),u=new x().crossVectors(a,o).normalize();let p=new x().crossVectors(u,d).normalize();p.dot(o)<0&&(u.negate(),p=new x().crossVectors(u,d).normalize());const g=y=>{const _=new x(y).sub(i),f=_.dot(d),S=_.dot(p);return k.normalizeAngle(Math.atan2(S/c,f/h))},m=this.closed?new ui(i,u,d,h,c,0,G):new ui(i,u,d,h,c,g(this.startPoint.clone().applyMatrix4(t)),g(this.endPoint.clone().applyMatrix4(t)));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(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ui(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new x(this.center).distanceTo(gr);return new rn(this.normal,e)}}class ce extends mi{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new v(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new v(t.x,t.y)}else{const t=this._vertices[e-1];return new v(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let i=0;i<t;++i){const s=this._vertices[i];let r=null;if(i<t-1?r=this._vertices[i+1]:i==t-1&&this.closed&&(r=this._vertices[0]),r)if(s.bulge){const a=new Mt(s,r,s.bulge);e+=a.length}else e+=new v(s.x,s.y).distanceTo(r)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}removeVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error(`Index ${e} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(e,1),this._boundingBoxNeedsUpdate=!0}reset(e,t){e?t!==void 0&&t>=0&&t<this._vertices.length&&(this._vertices=this._vertices.slice(0,t),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(e){const t=this._vertices[e];return new v(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new xe().setFromPoints(e)}transform(e){const t=e.determinant()<0;return this._vertices.forEach(i=>{const s=new v(i).applyMatrix2d(e);i.x=s.x,i.y=s.y,t&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new ce(this._vertices.map(e=>({...e})),this._closed)}getPoints3d(e,t){const i=[];return this.getPoints(e).forEach(s=>i.push(new w().set(s.x,s.y,t))),i}getPoints(e){const t=[],i=this._vertices.length;for(let s=0;s<i;++s){const r=this._vertices[s];if(r.bulge){let a=null;if(s<i-1?a=this._vertices[s+1]:s==i-1&&this.closed&&(a=this._vertices[0]),a){const o=new Mt(r,a,r.bulge).getPoints(e),h=o.length;for(let c=0;c<h;++c){const d=o[c];t.push(new v(d.x,d.y))}}}else t.push(new v(r.x,r.y)),s==i-1&&this.closed&&t.push(t[0])}return t}}class Ge extends mi{constructor(e,t){super(),this._start=new v(e),this._end=new v(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new v(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new v(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new xe(e,t)}transform(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ge(this._start.clone(),this._end.clone())}}let $i=class Be extends mi{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}static buildFromEdges(e,t=.001){if(e.length===0)return[];const i=[...e],s=[],r=t*t,a=(o,h)=>{const c=o.x-h.x,d=o.y-h.y;return c*c+d*d<=r};for(;i.length>0;){const o=[],h=i.shift();o.push(h);const c=Be.getEdgeStartPoint(h);let d=Be.getEdgeEndPoint(h);if(!a(c,d))for(;i.length>0;){const u=Be.findConnectingEdge(i,d,r);if(u.index<0)break;let p=i.splice(u.index,1)[0];if(u.reverse&&(p=Be.reverseEdge(p)),o.push(p),d=Be.getEdgeEndPoint(p),a(d,c))break}s.push(new Be(o))}return s}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new v(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new xe;return t.setFromPoints(e),t}transform(e){const t=new H().set(e.elements[0],e.elements[3],0,e.elements[6],e.elements[1],e.elements[4],0,e.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(i=>{i instanceof Ue?i.transform(t):i.transform(e)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Be(this._curves.map(e=>e.clone()))}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(i=>{i.getPoints(e).forEach(s=>{t.push(new v(s.x,s.y))})}),t}static findConnectingEdge(e,t,i){let s=-1,r=!1,a=Number.POSITIVE_INFINITY;for(let o=0;o<e.length;o++){const h=e[o],c=Be.getEdgeStartPoint(h),d=Be.getEdgeEndPoint(h),u=t.x-c.x,p=t.y-c.y,g=u*u+p*p;g<a&&(a=g,s=o,r=!1);const m=t.x-d.x,y=t.y-d.y,_=m*m+y*y;_<a&&(a=_,s=o,r=!0)}return a>i?{index:-1,reverse:!1}:{index:s,reverse:r}}static getEdgeStartPoint(e){const t=e.startPoint;return new v(t.x,t.y)}static getEdgeEndPoint(e){const t=e.endPoint;return new v(t.x,t.y)}static reverseEdge(e){return e instanceof Ge?new Ge(e.endPoint,e.startPoint):e instanceof Mt?new Mt(e.center,e.radius,e.endAngle,e.startAngle,!e.clockwise):e instanceof Ui?new Ui(e.center,e.majorAxisRadius,e.minorAxisRadius,e.endAngle,e.startAngle,!e.clockwise,e.rotation):e instanceof Ue?Be.reverseSplineEdge(e):e}static reverseSplineEdge(e){const t=[...e.controlPoints].reverse(),i=e.knots,s=i[0],r=i[i.length-1],a=i.map(c=>s+r-c).reverse(),o=e.weights,h=o.length>0?[...o].reverse():void 0;return new Ue(t,a,h,e.degree,e.closed)}};class Ps{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(e,t,i,s){this.c0=e,this.c1=i,this.c2=-3*e+3*t-2*i-s,this.c3=2*e-2*t+i+s}initCatmullRom(e,t,i,s,r){this.init(t,i,r*(i-e),r*(s-t))}initNonuniformCatmullRom(e,t,i,s,r,a,o){let h=(t-e)/r-(i-e)/(r+a)+(i-t)/a,c=(i-t)/a-(s-t)/(a+o)+(s-i)/o;h*=a,c*=a,this.init(t,i,h,c)}calc(e){const t=e*e,i=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*i}}class ys extends an{constructor(e=[],t=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new x,this._px=new Ps,this._py=new Ps,this._pz=new Ps,this._points=e.map(r=>new w(r)),this._closed=t,this._curveType=i,this._tension=s}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 e=0;for(let t=1;t<this._points.length;t++)e+=this._points[t-1].distanceTo(this._points[t]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e}getPoint(e,t=new w){const i=t,s=this._points,r=s.length;if(r===0)return i.set(0,0,0);if(r===1)return i.copy(s[0]);const a=(r-(this._closed?0:1))*e;let o=Math.floor(a),h=a-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:h===0&&o===r-1&&(o=r-2,h=1);let c,d;this._closed||o>0?c=s[(o-1)%r]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),c=new w(this._tmp.x,this._tmp.y,this._tmp.z));const u=s[o%r],p=s[(o+1)%r];if(this._closed||o+2<r?d=s[(o+2)%r]:(this._tmp.subVectors(s[r-1],s[r-2]).add(s[r-1]),d=new w(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const g=this._curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),g),y=Math.pow(u.distanceToSquared(p),g),_=Math.pow(p.distanceToSquared(d),g);y<1e-4&&(y=1),m<1e-4&&(m=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(c.x,u.x,p.x,d.x,m,y,_),this._py.initNonuniformCatmullRom(c.y,u.y,p.y,d.y,m,y,_),this._pz.initNonuniformCatmullRom(c.z,u.z,p.z,d.z,m,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,u.x,p.x,d.x,this._tension),this._py.initCatmullRom(c.y,u.y,p.y,d.y,this._tension),this._pz.initCatmullRom(c.z,u.z,p.z,d.z,this._tension));return i.set(this._px.calc(h),this._py.calc(h),this._pz.calc(h)),i}getPoints(e){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}setPoints(e){this._points=e.map(t=>new w(t)),this._boundingBoxNeedsUpdate=!0}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)}setCurveType(e){this._curveType=e}setTension(e){this._tension=e}clone(){return new ys(this._points.map(e=>e.clone()),this._closed,this._curveType,this._tension)}transform(e){return this._points=this._points.map(t=>{const i=new w;return i.copy(t),i.applyMatrix4(e),i}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Y;const e=new Y;return this._points.forEach(t=>{e.expandByPoint(t)}),e}}let Fe=class Yi{constructor(e,t,i,s){this._degree=e,this._knots=[...t],this._controlPoints=i.map(r=>({x:r.x,y:r.y,z:r.z})),this._weights=s?[...s]:new Array(i.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z}))}weights(){return[...this._weights]}clone(){return new Yi(this._degree,this._knots,this._controlPoints,this._weights)}point(e){const t=this._controlPoints.map(i=>[i.x,i.y,i.z]);return Fi(e,this._degree,this._knots,t,this._weights)}length(){const e=this._controlPoints.map(t=>[t.x,t.y,t.z]);return jo(this._degree,this._knots,e,this._weights)}static byKnotsControlPointsWeights(e,t,i,s){return new Yi(e,t,i,s)}static byPoints(e,t,i="Uniform",s,r){const a=yr(e,t,i,s,r),o=a.controlPoints.map(h=>({x:h[0],y:h[1],z:h[2]}));return new Yi(t,a.knots,o,a.weights)}getParameterRange(){const e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}}getPoints(e){const t=[],{start:i,end:s}=this.getParameterRange();for(let r=0;r<=e;r++){const a=i+(s-i)*(r/e);t.push(this.point(a))}return t}isClosed(e=1e-6){const{start:t,end:i}=this.getParameterRange(),s=this.point(t),r=this.point(i),a=s[0]-r[0],o=s[1]-r[1],h=s[2]-r[2];return Math.sqrt(a*a+o*o+h*h)<e}static createFitPointsForClosedCurve(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const t=new ys(e,!0,"centripetal"),i=Math.max(50,e.length*2);return t.getPoints(i)}static createClosedCurve(e,t,i="Chord"){const s=this.createFitPointsForClosedCurve(e).map(r=>[r.x,r.y,r.z]);return Yi.byPoints(s,t,i)}},Ue=class Mn extends an{constructor(e,t,i,s,r,a){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(t)){if(o<2||o>5)throw be.ILLEGAL_PARAMETERS;this._controlPoints=e;let h,c=3,d=!1;if(o>=3&&(Array.isArray(i)?(h=i,o>=4&&(c=s||3),o>=5&&(d=r)):i!==void 0&&(c=i||3,o>=4&&(d=s))),i===void 0&&o>=4&&(c=s||3,o>=5&&(d=r)),this._degree=c,this._closed=d,this._controlPoints.length<this._degree+1)throw be.ILLEGAL_PARAMETERS;this._nurbsCurve=Fe.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,h)}else{if(o<2||o>6)throw be.ILLEGAL_PARAMETERS;this._fitPoints=e,this._knotParameterization=t,o>=3&&(this._degree=i||3);const h=typeof s=="boolean";o>=4&&h&&(this._closed=s),h?(o>=5&&(this._startTangent=r),o>=6&&(this._endTangent=a)):(o>=4&&(this._startTangent=s),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 be.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=Fe.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const d=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Fe.byPoints(d,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(d=>[d.x,d.y,d.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const e=Fe.createFitPointsForClosedCurve(this._fitPoints),t=this.toNurbsPoints(e);this._nurbsCurve=Fe.byPoints(t,this._degree,this._knotParameterization)}else{const e=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Fe.byPoints(e,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(e=>[e.x,e.y,e.z||0]))}else if(this._controlPoints)if(this._closed){const e=Fe.createFitPointsForClosedCurve(this._controlPoints),t=this.toNurbsPoints(e);this._nurbsCurve=Fe.byPoints(t,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(i=>[i.x,i.y,i.z||0]))}else{const e=this._nurbsCurve.knots(),t=this._nurbsCurve.weights();this._nurbsCurve=Fe.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,t)}}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z||0}))}get fitPoints(){var e;return(e=this._fitPoints)==null?void 0:e.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),i=e[t],s=this._nurbsCurve.point(i);return new w(s[0],s[1],s[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),i=e[e.length-t-1],s=this._nurbsCurve.point(i);return new w(s[0],s[1],s[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(e){if(!this._fitPoints)throw new Error("No fit points in this spline");const t=this._fitPoints.length,i=e<0||e>=t?t-1:e,s=this._fitPoints[i];return{x:s.x,y:s.y,z:s.z||0}}getControlPointAt(e){const t=this._controlPoints.length,i=e<0||e>=t?t-1:e;return this._controlPoints[i]}getPoints(e=100){const t=this._nurbsCurve,i=[],s=t.knots(),r=this._nurbsCurve.degree(),a=s[r],o=s[s.length-r-1],h=(o-a)/(e-1);for(let c=0;c<e;c++){const d=c===e-1?o:a+c*h,u=t.point(d);i.push(new w(u[0],u[1],u[2]))}return i}getCurvePoints(e,t){const i=[],s=e.knots(),r=e.degree(),a=s[r],o=(s[s.length-r-1]-a)/(t-1);for(let h=0;h<t;h++){const c=a+h*o;i.push(e.point(c))}return i}calculateBoundingBox(){const e=this.getPoints(100);return new Y().setFromPoints(e)}get closed(){return this._closed}set closed(e){this.setClosed(e)}transform(e){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(t=>new w(t).applyMatrix4(e)),this._startTangent&&(this._startTangent=new w(this._startTangent).transformDirection(e)),this._endTangent&&(this._endTangent=new w(this._endTangent).transformDirection(e)),this.buildCurve();else{const t=this._nurbsCurve.knots(),i=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(s=>new w(s).applyMatrix4(e)),this._nurbsCurve=Fe.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,i.length>0?i:void 0)}return this._boundingBoxNeedsUpdate=!0,this}clone(){return this._fitPoints&&this._knotParameterization?new Mn(this._fitPoints.map(e=>({x:e.x,y:e.y,z:e.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 Mn(this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z||0})),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)}toNurbsPoints(e){const t=new Array(e.length);return e.forEach((i,s)=>{t[s]=[i.x,i.y,i.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((i,s)=>{t[s]={x:i[0],y:i[1],z:i[2]}}),t}toNurbsPoint(e){return[e.x,e.y,e.z||0]}static createClosedSpline(e,t="Uniform",i=3){if(e.length<i+1)throw new Error(`At least ${i+1} points are required for a degree ${i} closed spline`);return new Mn(e,t,i,!0)}};var xr=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(xr||{}),ii=(n=>(n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211",n))(ii||{}),je=(n=>(n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE",n))(je||{}),z=(n=>(n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n[n.BaselineLeft=10]="BaselineLeft",n[n.BaselineCenter=11]="BaselineCenter",n[n.BaselineRight=12]="BaselineRight",n))(z||{}),wr=(n=>(n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",n))(wr||{}),br=(n=>(n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT",n))(br||{}),Lr=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(Lr||{});let $o=class qo{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(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new xe;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter.copy(e)}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const e=new xe;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new qo;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e}copy(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this}};const Xr=class Xr extends De{constructor(){super(...arguments),this._visibility=!0,this._transparency=new J,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(e){this._layer=e}get color(){return this.getEntityColor()}set color(e){this.setEntityColor(e)}get resolvedColor(){var t;let e=this.color;if(e.isByLayer){const i=this.getLayerColor();i&&i.RGB!=null&&(e=i)}else if(e.isByBlock){const i=this.database.cecolor;if(i&&(e=i,e.isByLayer)){const s=this.database.clayer||this.layer,r=this.database.tables.layerTable.getAt(s);((t=r==null?void 0:r.color)==null?void 0:t.RGB)!=null&&(e=r.color)}}return e}get rgbColor(){const t=this.resolvedColor.RGB;return t??16777215}get lineType(){var e;return this._lineType==null&&(this._lineType=((e=this.database)==null?void 0:e.celtype)??pe),this._lineType}set lineType(e){e?e.toUpperCase()==="BYLAYER"?this._lineType=pe:e.toUpperCase()==="BYBLOCK"?this._lineType=At:this._lineType=e:this._lineType=pe}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??ii.ByLayer),this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new X,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(e){this._color==null&&(this._color=new X),this._color.copy(e)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(e){e.writeSubclassMarker("AcDbEntity"),e.writeString(8,this.layer),e.writeString(6,this.lineType),e.writeDouble(48,this.linetypeScale),e.writeInt16(60,this.visibility?0:1),e.writeCmColor(this.color),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency);const t=this.database.tables.blockTable.getIdAt(this.ownerId);return t!=null&&t.isPaperSapce&&e.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new X,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??pe),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??ii.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,i,s,r,a){}transformBy(e){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(e,t){const i=e.subEntityTraits;i.color=this.resolvedColor,i.rgbColor=this.rgbColor,i.lineType=this.lineStyle,i.lineTypeScale=this.linetypeScale,i.lineWeight=this.lineWeight,i.transparency=this.transparency,i.layer=this.layer,i.drawOrder=0,"thickness"in this&&(i.thickness=this.thickness);const s=this.subWorldDraw(e,t);return this.attachEntityInfo(s),s}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:e=>{this.color=e}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:e=>{this.layer=e}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:e=>{this.lineType=e}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:e=>{this.linetypeScale=e}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:e=>{this.lineWeight=e}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:e=>{this.transparency=e}}}]}}get lineStyle(){var s;const{type:e,name:t}=this.getLineType(),i=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(t);return i?{type:e,...i.linetype}:{type:e,name:t,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==pe){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==At?{type:"ByBlock",name:It}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:It}}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);return e!=null?e.color:null}attachEntityInfo(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)}};Xr.typeName="Entity";let de=Xr;const Rr=class Rr extends de{};Rr.typeName="Curve";let ue=Rr;var hi=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(hi||{});const Br=class Br extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t,i=0,s=!1,r=0,a=0,o=null){super(),this._polyType=e,this._elevation=i;const h=o&&(o==null?void 0:o.length)===t.length,c=t.map((d,u)=>({x:d.x,y:d.y,bulge:h?o[u]:void 0}));this._geo=new ce(c,s)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){return this._geo.getPointAt(e)}getBulgeAt(e){const t=this._geo.vertices[e];return(t==null?void 0:t.bulge)||0}get geometricExtents(){const e=this._geo.box;return new Y({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t){const i=this._geo.getPointAt(t);e.push(new w(i.x,i.y,0))}return e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r){const a=this._geo.getPointAt(r);s.push(new w(a.x,a.y,0))}break}}transformBy(e){const t=e.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(s=>{const r=new w(s.x,s.y,this._elevation).applyMatrix4(e);s.x=r.x,s.y=r.y,i=r.z,t&&s.bulge!=null&&(s.bulge=-s.bulge)}),this._elevation=i,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:e=>{this.elevation=e}}},{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:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=[];return this._geo.getPoints(100).forEach(s=>t.push(new w().set(s.x,s.y,this.elevation))),e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;++i)e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint3d(10,{x:this.getPointAt(i).x,y:this.getPointAt(i).y,z:this.elevation}),e.writeDouble(42,this.getBulgeAt(i)),e.writeInt16(70,0);return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb2dPolyline");let t=this.closed?1:0;return this.polyType===1&&(t|=2),this.polyType===2&&(t|=4),this.polyType===3&&(t|=8),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),e.writeDouble(10,0),e.writeDouble(20,0),e.writeDouble(30,this.elevation),this}};Br.typeName="2dPolyline";let Bn=Br;var Ko=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(Ko||{});const Fr=class Fr extends de{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(e){this._position.copy(e)}get bulge(){return this._bulge}set bulge(e){this._bulge=e}get startWidth(){return this._startWidth}set startWidth(e){this._startWidth=e}get endWidth(){return this._endWidth}set endWidth(e){this._endWidth=e}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new Y().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,i,s){s.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint2d(10,this.position),e.writeDouble(40,this.startWidth),e.writeDouble(41,this.endWidth),e.writeDouble(42,this.bulge),e.writeInt16(70,this.vertexType),this}};Fr.typeName="2dVertex";let $s=Fr;var Di=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(Di||{});const Dr=class Dr extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t,i=!1){super(),this._polyType=e,this._geo=new ce(t,i)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){const t=this._geo.vertices[e];return new w(t.x,t.y,t.z||0)}get geometricExtents(){const e=this._geo.vertices.map(t=>new w(t.x,t.y,t.z||0));return new Y().setFromPoints(e)}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t){const i=this._geo.getPointAt(t);e.push(new w(i.x,i.y,0))}return e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r)s.push(this.getPointAt(r));break}}transformBy(e){return this._geo.vertices.forEach(t=>{const i=new w(t.x,t.y,t.z||0).applyMatrix4(e);t.x=i.x,t.y=i.y,t.z=i.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:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.vertices.map(i=>new w(i.x,i.y,i.z||0));return e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;++i){const s=this.getPointAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,{x:s.x,y:s.y,z:s.z}),e.writeInt16(70,32)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb3dPolyline");let t=this.closed?1:0;return t|=8,this.polyType===1&&(t|=16),this.polyType===2&&(t|=32),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),this}};Dr.typeName="3dPolyline";let Fn=Dr;var Zo=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(Zo||{});const Vr=class Vr extends de{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new w,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new Y().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,i,s){s.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,this.position),e.writeInt16(70,this.vertexType|32),this}};Vr.typeName="3dVertex";let qs=Vr;const zr=class zr extends ue{get dxfTypeName(){return"ARC"}constructor(e,t,i,s,r=x.Z_AXIS){super();const a=_r(r);this._geo=new Pt(e,t,i,s,r,a)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}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:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=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}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>k.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,i,s){const r=this.startPoint,a=this.endPoint;switch(e){case D.EndPoint:s.push(r),s.push(a);break;case D.MidPoint:s.push(this.midPoint);break;case D.Nearest:{const o=this._geo.nearestPoint(t);s.push(o)}break;case D.Perpendicular:break;case D.Tangent:{const o=this._geo.tangentPoints(t);s.push(...o);break}}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=Gi(this.center,this.normal);return e.writeSubclassMarker("AcDbArc"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeAngle(50,Gs(this.center,this.startPoint,this.normal)),e.writeAngle(51,Gs(this.center,this.endPoint,this.normal)),e.writeVector3d(210,this.normal),this}};zr.typeName="Arc";let Dn=zr;var Qo=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(Qo||{}),Jo=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Jo||{});const Hr=class Hr extends de{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new w,this._alignmentPoint=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(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(e){this._alignmentPoint.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new Y}subGetOsnapPoints(e,t,i,s){D.Insertion===e&&s.push(this._position)}transformBy(e){const t=this._position.clone(),i=this._position.clone().add(new x(Math.cos(this._rotation),Math.sin(this._rotation),0)),s=this._position.clone().add(new x(-Math.sin(this._rotation),Math.cos(this._rotation),0)),r=this._position.clone().add(new x(0,0,1));t.applyMatrix4(e),i.applyMatrix4(e),s.applyMatrix4(e),r.applyMatrix4(e);const a=new x(i).sub(t),o=new x(s).sub(t),h=new x(r).sub(t),c=o.length(),d=a.length(),u=h.length();return this._position.copy(t),d>0&&(this._rotation=Math.atan2(a.y,a.x)),c>0&&(this._height*=c,d>0&&(this._widthFactor*=d/c)),u>0&&(this._thickness*=u),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:e=>{this.textString=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}}]},{groupName:"geometry",properties:[{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}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable,t=e.getAt(this.styleName)??e.getAt(this.database.textstyle)??e.getAt(Q);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(e,t){let i=this.resolveAttachmentPoint(),s;if(i===z.BaselineLeft)s=this._position;else{const a=this._alignmentPoint;a.x===0&&a.y===0&&a.z===0||a.x===this._position.x&&a.y===this._position.y&&a.z===this._position.z?(i=z.BaselineLeft,s=this._position):s=a}const r={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:s,rotation:this.rotation,drawingDirection:je.BOTTOM_TO_TOP,attachmentPoint:i};return e.mtext(r,this.getTextStyle(),t)}resolveAttachmentPoint(){const e=this._horizontalMode,t=this._verticalModel;if(e===4)return z.MiddleCenter;if(e===3||e===5)return z.BaselineLeft;switch(t){case 3:return e===1?z.TopCenter:e===2?z.TopRight:z.TopLeft;case 2:return e===1?z.MiddleCenter:e===2?z.MiddleRight:z.MiddleLeft;case 1:return e===1?z.BottomCenter:e===2?z.BottomRight:z.BottomLeft;case 0:default:return e===1?z.BaselineCenter:e===2?z.BaselineRight:z.BaselineLeft}}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbText"),e.writePoint3d(10,this.position),e.writeDouble(39,this.thickness),e.writeDouble(40,this.height),e.writeString(1,this.textString),e.writeAngle(50,this.rotation),e.writeDouble(41,this.widthFactor),e.writeAngle(51,this.oblique),e.writeString(7,this.styleName),e.writeInt16(72,this.horizontalMode),e.writeInt16(73,this.verticalMode),e.writePoint3d(11,this.alignmentPoint),this}};Hr.typeName="Text";let pi=Hr;var ne=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(ne||{}),We=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(We||{});const jr=class jr extends pi{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(e){e?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(e){this._prompt=e}get isConst(){return(this._flags&2)!==0}set isConst(e){e?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(e){e?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(e){e?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(e){e?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttributeDefinition"),e.writeString(3,this.prompt),e.writeString(2,this.tag),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeInt16(74,this.isReallyLocked?1:0),this}};jr.typeName="AttDef";let Vn=jr;const Wr=class Wr extends pi{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&ne.Invisible)!==0}set isInvisible(e){e?this._flags|=ne.Invisible:this._flags&=~ne.Invisible}get isConst(){return(this._flags&ne.Const)!==0}set isConst(e){e?this._flags|=ne.Const:this._flags&=~ne.Const}get isVerifiable(){return(this._flags&ne.Verifiable)!==0}set isVerifiable(e){e?this._flags|=ne.Verifiable:this._flags&=~ne.Verifiable}get isPreset(){return(this._flags&ne.Preset)!==0}set isPreset(e){e?this._flags|=ne.Preset:this._flags&=~ne.Preset}get isMTextAttribute(){return(this._mtextFlag&We.MultiLine)!==0}set isMTextAttribute(e){e?this._mtextFlag|=We.MultiLine:this._mtextFlag&=~We.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&We.ConstMultiLine)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=We.ConstMultiLine:this._mtextFlag&=~We.ConstMultiLine}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttribute"),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeString(2,this.tag),e.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&e.writeInt16(71,this.isMTextAttribute?1:0),this}};Wr.typeName="Attrib";let zn=Wr;const ji=class ji extends de{get dxfTypeName(){return"INSERT"}constructor(e){super(),this._blockName=e,this._position=new w,this._rotation=0,this._normal=new x(0,0,1),this._scaleFactors=new w(1,1,1),this._attribs=new Map}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(e){this._attribs.set(e.objectId,e),e.ownerId=this.objectId}attributeIterator(){return new ln(this._attribs)}get blockTransform(){const e=this.blockTableRecord,t=(e==null?void 0:e.origin)??w.ORIGIN,i=new H().makeTranslation(-t.x,-t.y,-t.z),s=new H().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),r=new ai().setFromAxisAngle(x.Z_AXIS,this._rotation),a=new H().makeRotationFromQuaternion(r),o=new H().makeTranslation(this._position.x,this._position.y,this._position.z);return new H().multiplyMatrices(o,a).multiply(s).multiply(i)}subGetOsnapPoints(e,t,i,s,r,a){const o=a??new H;D.Insertion===e?s.push(this.getInsertionPoint(o)):r&&this.subEntityGetOsnapPoints(e,t,i,s,r,o)}transformBy(e){const t=new H().setFromExtrusionDirection(this._normal),i=new H().makeRotationZ(this._rotation),s=new H().multiplyMatrices(t,i),r=this._position.clone(),a=new w(this._scaleFactors.x,0,0).applyMatrix4(s).add(r),o=new w(0,this._scaleFactors.y,0).applyMatrix4(s).add(r),h=new w(0,0,this._scaleFactors.z).applyMatrix4(s).add(r);r.applyMatrix4(e),a.applyMatrix4(e),o.applyMatrix4(e),h.applyMatrix4(e);const c=new x(a).sub(r),d=new x(o).sub(r),u=new x(h).sub(r);let p=new x().crossVectors(c,d);p.lengthSq()===0?p=this._normal.clone().transformDirection(e):p.normalize();const m=new H().setFromExtrusionDirection(p).clone().invert(),y=c.clone().applyMatrix4(m);return this._position.copy(r),this._normal.copy(p),this._rotation=Math.atan2(y.y,y.x),this._scaleFactors.set(c.length(),d.length(),u.length()),this._attribs.forEach(_=>_.transformBy(e)),this}get properties(){const e={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: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}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:t=>{this.scaleFactors.x=t}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:t=>{this.scaleFactors.y=t}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:t=>{this.scaleFactors.z=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}}}]}]};if(this._attribs.size>0){const t={groupName:"attribute",properties:[]};e.groups.push(t),this._attribs.forEach(i=>{t.properties.push({name:i.tag,type:"string",editable:!i.isConst,skipTranslation:!0,accessor:{get:()=>i.textString,set:s=>{i.textString=s}}})})}return e}get geometricExtents(){const e=new Y,t=this.blockTableRecord;if(t!=null){const s=t.newIterator();for(const r of s)e.union(r.geometricExtents)}const i=this.blockTransform;return e.applyMatrix4(i),e}subWorldDraw(e){const t=this.blockTableRecord;if(t!=null){const i=this.blockTransform,s=[];return this._attribs.forEach(a=>{if(!a.isInvisible){const o=a.worldDraw(e);o&&s.push(o)}}),ri.instance.draw(e,t,this.rgbColor,s,!0,i,this._normal)}else return e.group([])}dxfOut(e,t=!1){super.dxfOut(e,t);let i=!1;for(const s of this.attributeIterator())i=!0,e.writeStart("ATTRIB"),s.dxfOut(e);return i&&(e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity")),this}subEntityGetOsnapPoints(e,t,i,s,r,a,o=new Set){if(r===this.objectId||o.has(this.objectId))return!1;o.add(this.objectId);try{const h=this.blockTableRecord;if(h==null)return!1;const c=new H().multiplyMatrices(a,this.getFullInsertionTransform());for(const d of h.newIterator()){if(d.objectId===r){const u=new w(t).applyMatrix4(c.clone().invert()),p=new w(i).applyMatrix4(c.clone().invert()),g=[];return d.subGetOsnapPoints(e,u,p,g,r,c),d instanceof ji?g.forEach(m=>{s.push(m.clone())}):g.forEach(m=>{s.push(new w(m).applyMatrix4(c))}),!0}if(d instanceof ji&&d.subEntityGetOsnapPoints(e,t,i,s,r,c,o))return!0}return!1}finally{o.delete(this.objectId)}}getInsertionPoint(e){var s;const t=((s=this.blockTableRecord)==null?void 0:s.origin)??w.ORIGIN,i=new H().multiplyMatrices(e,this.getFullInsertionTransform());return new w(t).applyMatrix4(i)}getFullInsertionTransform(){const e=new H().setFromExtrusionDirection(this._normal);return new H().multiplyMatrices(e,this.blockTransform)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockReference"),e.writePoint3d(10,this.position),e.writeString(2,this.blockName),e.writeDouble(41,this.scaleFactors.x),e.writeDouble(42,this.scaleFactors.y),e.writeDouble(43,this.scaleFactors.z),e.writeAngle(50,this.rotation),e.writeVector3d(210,this.normal),this}};ji.typeName="BlockReference";let ni=ji;const Gr=class Gr extends ue{get dxfTypeName(){return"CIRCLE"}constructor(e,t,i=x.Z_AXIS){super();const s=_r(i);this._geo=new Pt(e,t,0,G,i,s)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(e,t,i,s){switch(e){case D.Center:case D.Centroid:s.push(this._geo.center);break;case D.Quadrant:s.push(this._geo.getPointAtAngle(0)),s.push(this._geo.getPointAtAngle(Math.PI/2)),s.push(this._geo.getPointAtAngle(Math.PI)),s.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case D.Nearest:{const r=this._geo.nearestPoint(t);s.push(r)}break;case D.Tangent:{const r=this._geo.tangentPoints(t);s.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:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=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}}},{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 e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=Gi(this.center,this.normal);return e.writeSubclassMarker("AcDbCircle"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeVector3d(210,this.normal),this}};Gr.typeName="Circle";let Hn=Gr;const Ur=class Ur extends ue{get dxfTypeName(){return"ELLIPSE"}constructor(e,t,i,s,r,a,o){super(),this._geo=new ui(e,t,i,s,r,a,o)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:this.closed||(s.push(this._geo.startPoint),s.push(this._geo.endPoint));break;case D.MidPoint:this.closed||s.push(this._geo.midPoint);break;case D.Quadrant:this.closed&&(s.push(this._geo.getPointAtAngle(0)),s.push(this._geo.getPointAtAngle(Math.PI/2)),s.push(this._geo.getPointAtAngle(Math.PI)),s.push(this._geo.getPointAtAngle(Math.PI/2*3)));break}}transformBy(e){return this._geo.transform(e),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:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:e=>{this.center.x=e}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:e=>{this.minorAxisRadius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=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}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(e){return e.ellipticalArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbEllipse"),e.writePoint3d(10,this.center);const t=this._geo.majorAxis,i=this.majorAxisRadius;return e.writePoint3d(11,{x:t.x*i,y:t.y*i,z:t.z*i}),e.writeVector3d(210,this.normal),e.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),e.writeDouble(41,this.startAngle),e.writeDouble(42,this.endAngle),this}};Ur.typeName="Ellipse";let jn=Ur;const $r=class $r extends de{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new w,new w,new w],this._edgeInvisibilities=0}getVertexAt(e){return e<0?this._vertices[0]:e>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[e]}setVertexAt(e,t){if(e<0&&this._vertices[0].copy(t),e>=3)return this._vertices.length===3&&this._vertices.push(new w),this._vertices[3].copy(t);this._vertices[e].copy(t)}setEdgeInvisibilities(e){this._edgeInvisibilities=e}isEdgeVisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<e)===0}makeEdgeInvisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<e}get geometricExtents(){return new Y().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(...this._vertices);break}}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this}subWorldDraw(e){const t=this._vertices.length,i=new Float32Array(t*3),s=new Uint16Array(t*2);for(let r=0;r<t;r++)i[r*3]=this._vertices[r].x,i[r*3+1]=this._vertices[r].y,i[r*3+2]=this._vertices[r].z,this.isEdgeVisibleAt(r)&&(s[r*2]=r,s[r*2+1]=(r+1)%4);return e.lineSegments(i,3,s)}dxfOutFields(e){super.dxfOutFields(e);const t=this.getVertexAt(0),i=this.getVertexAt(1),s=this.getVertexAt(2),r=this.getVertexAt(3);e.writeSubclassMarker("AcDbFace"),e.writePoint3d(10,t),e.writePoint3d(11,i),e.writePoint3d(12,s),e.writePoint3d(13,r);let a=0;for(let o=0;o<4;++o)this.isEdgeVisibleAt(o)||(a|=1<<o);return e.writeInt16(70,a),this}};$r.typeName="Face";let Wn=$r;const A={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",CECOLOR:"CECOLOR",CELTYPE:"CELTYPE",CELTSCALE:"CELTSCALE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLSTYLE:"CMLSTYLE",CMLSCALE:"CMLSCALE",CMLEADERSTYLE:"CMLEADERSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",HPASSOC:"HPASSOC",HPANG:"HPANG",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LWDISPLAY:"LWDISPLAY",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",OSMODE:"OSMODE",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",WHITEBKCOLOR:"WHITEBKCOLOR"},Nc=Object.freeze(Object.values(A)),ps=class ps{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new te},this.registerVar({name:A.CECOLOR,type:"color",isDbVar:!0,defaultValue:new X(P.ByLayer)}),this.registerVar({name:A.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:A.CELTYPE,type:"string",isDbVar:!0,defaultValue:pe}),this.registerVar({name:A.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:ii.ByLayer}),this.registerVar({name:A.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new J}),this.registerVar({name:A.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:A.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:gt}),this.registerVar({name:A.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:A.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:pt}),this.registerVar({name:A.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:A.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:A.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:A.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new X(P.None)}),this.registerVar({name:A.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new X(P.ByLayer)}),this.registerVar({name:A.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:A.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:A.HPNAME,type:"string",isDbVar:!1,defaultValue:lo}),this.registerVar({name:A.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:A.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new J}),this.registerVar({name:A.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:A.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new X(P.ByColor);return e.setRGB(96,165,250),e})()}),this.registerVar({name:A.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:A.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:A.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:Q}),this.registerVar({name:A.WHITEBKCOLOR,type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new ps),this._instance}registerVar(e){const t=this.normalizeName(e.name);this.registry.set(t,{...e,name:t}),e.isDbVar||this.cache.set(t,e.defaultValue)}registerMany(e){e.forEach(t=>this.registerVar(t))}getVar(e,t){e=this.normalizeName(e);const i=this.getDescriptor(e);if(!i)throw new Error(`System variable ${e} not found!`);if(i.isDbVar)return t[e.toLowerCase()];if(this.cache.has(e))return this.cache.get(e)}getDefaultValue(e){e=this.normalizeName(e);const t=this.getDescriptor(e);if(!t)throw new Error(`System variable ${e} not found!`);return t.defaultValue}setVar(e,t,i){e=this.normalizeName(e);const s=this.getDescriptor(e);if(s){const r=this.getVar(e,i);if(s.type==="transparency"){const a=this.parseTransparency(t);if(a==null||a.isInvalid)throw new Error("Invalid transparency value!");t=a}else if(s.type!=="string"&&(typeof t=="string"||t instanceof String)){if(s.type==="number"){const a=Number(t);if(Number.isNaN(a))throw new Error("Invalid number input!");t=a}else if(s.type==="boolean")t=this.parseBoolean(t);else if(s.type==="color"){const a=this.parseColorSysVar(e,t,i);if(a==null)throw new Error("Invalid color value!");t=a}}s.isDbVar?i[e.toLowerCase()]=t:(this.cache.set(e,t),this.hasValueChanged(r,t)&&this.events.sysVarChanged.dispatch({database:i,name:e,newVal:t,oldVal:r}))}else throw new Error(`System variable ${e} not found!`)}getDescriptor(e){return this.registry.get(this.normalizeName(e))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(e){if(e==null)return!1;const t=String(e).trim().toLowerCase(),i=new Set(["true","t","1","yes","y"]),s=new Set(["false","f","0","no","n"]);return i.has(t)?!0:(s.has(t),!1)}parseColorSysVar(e,t,i){const s=t.trim().toLowerCase();return e===A.HPCOLOR.toLowerCase()&&(s==="."||s==="use current")?i.cecolor.clone():e===A.HPBACKGROUNDCOLOR.toLowerCase()&&(s===""||s==="."||s==="none")?new X(P.None):X.fromString(t)}parseTransparency(e){if(e instanceof J)return e;if(typeof e=="number")return J.deserialize(e);if(!(typeof e!="string"&&!(e instanceof String)))return J.fromString(String(e))}hasValueChanged(e,t){return e instanceof X&&t instanceof X||e instanceof J&&t instanceof J?!e.equals(t):!Object.is(e,t)}normalizeName(e){return e.toLowerCase()}};ps._instance=null;let Ne=ps;const Oc={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:23},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:24}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:26}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:28},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:29}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:31},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:32}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:34},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:35},{angle:45,originX:.353553391,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:36},{angle:45,originX:.530330086,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:37}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:39},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.3125,-.0625,0,-.0625],sourceLine:40}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:.21875,deltaY:.125,dashes:[.3125,-.0625,0,-.0625],sourceLine:42}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:45}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:47},{angle:135,originX:0,originY:0,deltaX:.25,deltaY:.125,dashes:[.3125,-.1875],sourceLine:48}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:54},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[8,-8],sourceLine:55}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:57},{angle:0,originX:-8,originY:.375,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:58},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:59},{angle:90,originX:-.375,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:60}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:62},{angle:90,originX:0,originY:0,deltaX:8,deltaY:4,dashes:[8,-8],sourceLine:63}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:65},{angle:0,originX:0,originY:2.25,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:66},{angle:0,originX:2,originY:2.667,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:67},{angle:0,originX:2,originY:4.917,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:68},{angle:90,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:69},{angle:90,originX:-.375,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:70},{angle:90,originX:2,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:71},{angle:90,originX:1.625,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:72}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:2.667,dashes:[],sourceLine:74},{angle:90,originX:0,originY:0,deltaX:2.667,deltaY:4,dashes:[2.667,-2.667],sourceLine:75}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:77},{angle:355,originX:0,originY:0,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:78},{angle:100.45144446,originX:.59771681,originY:-.05229344,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.63740192,-7.01142112],sourceLine:79},{angle:46.1842,originX:0,originY:2,deltaX:6.19462554,deltaY:-8.84684596,dashes:[1.125,-12.375],sourceLine:80},{angle:96.63563549,originX:.88936745,originY:1.86206693,deltaX:8.59588239,deltaY:-10.40964966,dashes:[.95610342,-10.5171376],sourceLine:81},{angle:351.18416399,originX:0,originY:2,deltaX:7.74327494,deltaY:11.05855746,dashes:[.9,-9.90000001],sourceLine:82},{angle:21,originX:1,originY:1.5,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:83},{angle:326,originX:1,originY:1.5,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:84},{angle:71.45144474,originX:1.49742254,originY:1.16448426,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.6374019,-7.01142112],sourceLine:85},{angle:37.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-6.52,0,-6.7,0,-6.625],sourceLine:86},{angle:7.5,originX:0,originY:0,deltaX:3.123,deltaY:3.567,dashes:[0,-3.82,0,-6.37,0,-2.525],sourceLine:87},{angle:-32.5,originX:-2.23,originY:0,deltaX:4.6234,deltaY:2.678,dashes:[0,-2.5,0,-7.8,0,-10.35],sourceLine:88},{angle:-42.5,originX:-3.23,originY:0,deltaX:3.6234,deltaY:4.678,dashes:[0,-3.25,0,-5.18,0,-7.35],sourceLine:89}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:4,deltaY:4,dashes:[12,-4],sourceLine:91},{angle:135,originX:2.828427125,originY:2.828427125,deltaX:4,deltaY:-4,dashes:[12,-4],sourceLine:92}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:94},{angle:90,originX:2,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:95},{angle:90,originX:4,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:96},{angle:90,originX:6,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:97},{angle:90,originX:8,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:98},{angle:90,originX:10,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:99},{angle:90,originX:12,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:100},{angle:0,originX:0,originY:12,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:101},{angle:0,originX:0,originY:14,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:102},{angle:0,originX:0,originY:16,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:103},{angle:0,originX:0,originY:18,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:104},{angle:0,originX:0,originY:20,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:105},{angle:0,originX:0,originY:22,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:106},{angle:0,originX:0,originY:24,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:107}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:2.2,deltaY:1,dashes:[15,-2,5,-1],sourceLine:109},{angle:0,originX:1.33,originY:.5,deltaX:-1,deltaY:1.33,dashes:[3,-.33,6,-.75],sourceLine:110},{angle:0,originX:.5,originY:.85,deltaX:5.2,deltaY:.67,dashes:[8,-1.4,4,-1],sourceLine:111}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:25.5,deltaY:12,dashes:[6,-5,7,-3,9,-4],sourceLine:113},{angle:0,originX:6,originY:.5,deltaX:25.5,deltaY:12,dashes:[5,-19,4,-6],sourceLine:114},{angle:0,originX:18,originY:-.75,deltaX:25.5,deltaY:12,dashes:[3,-31],sourceLine:115},{angle:90,originX:0,originY:0,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:116},{angle:90,originX:6,originY:0,deltaX:12,deltaY:8.5,dashes:[11.25,-36.75],sourceLine:117},{angle:90,originX:11,originY:0,deltaX:12,deltaY:8.5,dashes:[10.5,-37.5],sourceLine:118},{angle:90,originX:18,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:119},{angle:90,originX:21,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:120},{angle:90,originX:30,originY:0,deltaX:12,deltaY:8.5,dashes:[11,-37],sourceLine:121}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:1.123,deltaY:1.567,dashes:[0,-1.52,0,-1.7,0,-1.625],sourceLine:123},{angle:7.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-.82,0,-1.37,0,-.525],sourceLine:124},{angle:-32.5,originX:-1.23,originY:0,deltaX:2.6234,deltaY:1.678,dashes:[0,-.5,0,-1.8,0,-2.35],sourceLine:125},{angle:-42.5,originX:-1.23,originY:0,deltaX:1.6234,deltaY:2.678,dashes:[0,-.25,0,-1.18,0,-1.35],sourceLine:126}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:128},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:129},{angle:0,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:130},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:131},{angle:0,originX:0,originY:.5,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:132},{angle:0,originX:0,originY:.75,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:133},{angle:90,originX:.5,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:134},{angle:90,originX:.75,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:135}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:137},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:138}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:140},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.5,dashes:[.25,-.25],sourceLine:141},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:.5,dashes:[-.25,.25],sourceLine:142}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.33,dashes:[],sourceLine:144},{angle:90,originX:.9,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:145},{angle:90,originX:.8,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:146},{angle:0,originX:.9,originY:.055,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:147},{angle:0,originX:.9,originY:.11,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:148},{angle:0,originX:.9,originY:.165,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:149},{angle:0,originX:.9,originY:.22,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:150},{angle:0,originX:.9,originY:.275,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:151}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.1875,dashes:[],sourceLine:153},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.1875,dashes:[],sourceLine:154},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.1875,dashes:[],sourceLine:155},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.1875,dashes:[.1875,-.125],sourceLine:156}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:158},{angle:135,originX:.0625,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:159},{angle:135,originX:.09375,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:160},{angle:135,originX:.125,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:161}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:163},{angle:90,originX:.0625,originY:-.0625,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:164}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:166}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:168},{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[.3535533905932738,-.7071067811865476],sourceLine:169}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.03125,deltaY:.0625,dashes:[0,-.0625],sourceLine:171}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:173},{angle:0,originX:0,originY:.09375,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:174},{angle:0,originX:0,originY:.1875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:175},{angle:90,originX:.03125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:176},{angle:90,originX:.125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:177},{angle:90,originX:.21875,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:178}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:180},{angle:180,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:181},{angle:300,originX:0,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:182},{angle:60,originX:.1,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:183},{angle:300,originX:.1,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:184},{angle:60,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:185},{angle:180,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:186},{angle:300,originX:-.05,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:187},{angle:180,originX:-.05,originY:-.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:188},{angle:60,originX:-.4,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:189},{angle:300,originX:-.4,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:190},{angle:60,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:191},{angle:180,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:192},{angle:300,originX:.2,originY:.346410161,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:193},{angle:180,originX:.2,originY:.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:194},{angle:0,originX:.2,originY:.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:195},{angle:0,originX:.2,originY:-.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:196},{angle:120,originX:.05,originY:.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:197},{angle:120,originX:-.25,originY:.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:198},{angle:240,originX:-.25,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:199},{angle:240,originX:.05,originY:-.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:200}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[.25,-.25],sourceLine:202},{angle:45,originX:.25,originY:0,deltaX:.176776695296,deltaY:.176776695296,dashes:[.0625,-.2285533906,.0625,-.353553390593],sourceLine:203}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:205},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:206},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:207}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:209},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:210},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:211}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:213},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:214},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:215}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:.707106781,deltaY:.707106781,dashes:[.1875,-1.226713563],sourceLine:217},{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:218},{angle:135,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:219}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.03125,dashes:[],sourceLine:221},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:222}]},{name:"GRAVEL",description:"",lines:[{angle:228.012787504,originX:.72,originY:1,deltaX:12.0413651692039,deltaY:.0743294146632,dashes:[.134536,-13.3190880470737],sourceLine:224},{angle:184.969740728,originX:.63,originY:.9,deltaX:-12.0415166747131,deltaY:.0433148081592,dashes:[.230868,-22.85592476123],sourceLine:225},{angle:132.510447078,originX:.4,originY:.88,deltaX:-14.8659418273816,deltaY:.061429511683,dashes:[.162788,-16.1160325960997],sourceLine:226},{angle:267.273689006,originX:.01,originY:.63,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:227},{angle:292.833654178,originX:0,originY:.42,deltaX:-12.9999095019474,deltaY:.048507125026,dashes:[.206155,-20.4093731280883],sourceLine:228},{angle:357.273689006,originX:.08,originY:.23,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:229},{angle:37.6942404667,originX:.29,originY:.22,deltaX:-16.4011800288558,deltaY:.0359675000664,dashes:[.278029,-27.524848548916],sourceLine:230},{angle:72.2553283749,originX:.51,originY:.39,deltaX:23.0867613281116,deltaY:.0380969659053,dashes:[.262488,-25.9863214968134],sourceLine:231},{angle:121.429565615,originX:.59,originY:.64,deltaX:15.2642639131074,deltaY:.047404546271,dashes:[.21095,-20.884073109729],sourceLine:232},{angle:175.236358309,originX:.48,originY:.82,deltaX:-11.0450488205478,deltaY:.083045479801,dashes:[.240832,-11.8007625787923],sourceLine:233},{angle:222.397437798,originX:.24,originY:.84,deltaX:16.2787889313724,deltaY:.0321080648114,dashes:[.311448,-30.8333750047949],sourceLine:234},{angle:138.814074834,originX:1,originY:.62,deltaX:9.2190645101588,deltaY:.0940720868851,dashes:[.106301,-10.5238448127347],sourceLine:235},{angle:171.46923439,originX:.92,originY:.69,deltaX:-13.1528534931484,deltaY:.0494468176315,dashes:[.202237,-20.021511416157],sourceLine:236},{angle:225,originX:.72,originY:.72,deltaX:.7071067811865,deltaY:.7071067811865,dashes:[.141421,-1.2727925623731],sourceLine:237},{angle:203.198590514,originX:.65,originY:.84,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.076158,-7.5396151058639],sourceLine:238},{angle:291.801409486,originX:.58,originY:.81,deltaX:-3.156820749011,deltaY:.185695338158,dashes:[.107703,-5.2774618071345],sourceLine:239},{angle:30.9637565321,originX:.62,originY:.71,deltaX:3.6014702879928,deltaY:.1714985851408,dashes:[.174929,-5.6560228948453],sourceLine:240},{angle:161.565051177,originX:.77,originY:.8,deltaX:-2.2135943621183,deltaY:.3162277660138,dashes:[.126491,-3.0357866601684],sourceLine:241},{angle:16.389540334,originX:0,originY:.81,deltaX:10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.5428451466694],sourceLine:242},{angle:70.3461759419,originX:.17,originY:.86,deltaX:-11.7045066155395,deltaY:.0672672793901,dashes:[.148661,-14.717407747319],sourceLine:243},{angle:293.198590514,originX:.77,originY:1,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.152315,-7.4634581058639],sourceLine:244},{angle:343.610459666,originX:.83,originY:.86,deltaX:-10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.542845146669],sourceLine:245},{angle:339.44395478,originX:0,originY:.19,deltaX:-5.3838927710229,deltaY:.117041147157,dashes:[.17088,-8.3731237453175],sourceLine:246},{angle:294.775140569,originX:.16,originY:.13,deltaX:-12.0828441168135,deltaY:.0698430296124,dashes:[.143178,-14.174643063276],sourceLine:247},{angle:66.8014094864,originX:.78,originY:0,deltaX:5.3835637472487,deltaY:.1313064328552,dashes:[.152315,-7.4634581058639],sourceLine:248},{angle:17.3540246363,originX:.84,originY:.14,deltaX:-13.6013396869991,deltaY:.0596549986364,dashes:[.167631,-16.59542361424],sourceLine:249},{angle:69.4439547804,originX:.29,originY:0,deltaX:-5.383892771022,deltaY:.1170411471946,dashes:[.08544,-8.4585637453175],sourceLine:250},{angle:101.309932474,originX:.72,originY:0,deltaX:4.1184388379018,deltaY:.1961161351396,dashes:[.05099,-5.0480295135928],sourceLine:251},{angle:165.963756532,originX:.71,originY:.05,deltaX:-3.1529631254726,deltaY:.2425356250323,dashes:[.206155,-3.9169506256177],sourceLine:252},{angle:186.009005957,originX:.51,originY:.1,deltaX:-10.0497393137326,deltaY:.0523423921723,dashes:[.19105,-18.9139231745428],sourceLine:253},{angle:303.690067526,originX:.62,originY:.62,deltaX:-2.2188007849008,deltaY:.2773500981134,dashes:[.144222,-3.461329275464],sourceLine:254},{angle:353.157226587,originX:.7,originY:.5,deltaX:17.1171966955143,deltaY:.0397150736497,dashes:[.251794,-24.9275626240283],sourceLine:255},{angle:60.9453959009,originX:.95,originY:.47,deltaX:-8.0616726575653,deltaY:.0971285862325,dashes:[.102956,-10.192674140987],sourceLine:256},{angle:90,originX:1,originY:.56,deltaX:1,deltaY:1,dashes:[.06,-.94],sourceLine:257},{angle:120.256437164,originX:.49,originY:.13,deltaX:-8.0619364083848,deltaY:.0719815751411,dashes:[.138924,-13.7535199894498],sourceLine:258},{angle:48.0127875042,originX:.42,originY:.25,deltaX:12.0413651692041,deltaY:.0743294146212,dashes:[.269072,-13.1845520470737],sourceLine:259},{angle:0,originX:.6,originY:.45,deltaX:1,deltaY:1,dashes:[.26,-.74],sourceLine:260},{angle:325.304846469,originX:.86,originY:.45,deltaX:12.2063917682497,deltaY:-.063245553253,dashes:[.158114,-15.653274300842],sourceLine:261},{angle:254.054604099,originX:.99,originY:.36,deltaX:4.1208169184605,deltaY:.1373605639542,dashes:[.145602,-7.1345078892805],sourceLine:262},{angle:207.645975364,originX:.95,originY:.22,deltaX:21.4708691170287,deltaY:.0421824539631,dashes:[.237065,-23.4694741822594],sourceLine:263},{angle:175.42607874,originX:.74,originY:.11,deltaX:13.0383438432524,deltaY:.039872611164,dashes:[.250799,-24.8290734079689],sourceLine:264}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:266},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:267},{angle:60,originX:.125,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:268}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:270},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:271},{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[-.25,.125],sourceLine:272}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.0625,dashes:[1,-.5],sourceLine:274},{angle:90,originX:0,originY:0,deltaX:-.25,deltaY:.0625,dashes:[1,-.5],sourceLine:275}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:277},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:278},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:279}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:292}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:294}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:296}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:298}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:300},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:301}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:303}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:305}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:307}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:309}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:311}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:313}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:315},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:316}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:318},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:319}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:321},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:322}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:327}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.25,dashes:[.25,-.25,0,-.25,0,-.25],sourceLine:329}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:331},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:332}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:334},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:335},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:336}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:338},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:339},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:340}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:342},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:343},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:344},{angle:0,originX:0,originY:.15625,deltaX:0,deltaY:.25,dashes:[],sourceLine:345}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.09375,dashes:[],sourceLine:347},{angle:45,originX:.066291261,originY:0,deltaX:0,deltaY:.09375,dashes:[0,-.09375],sourceLine:348}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:350},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:351}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:353},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:354},{angle:120,originX:.0625,originY:.108253176,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:355}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:357},{angle:45,originX:0,originY:.0625,deltaX:0,deltaY:.125,dashes:[],sourceLine:358}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.125,-.875],sourceLine:360},{angle:90,originX:.0625,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.0625,-1.669550806],sourceLine:361},{angle:90,originX:.078125,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:362},{angle:90,originX:.046875,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:363},{angle:60,originX:.09375,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:364},{angle:120,originX:.03125,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:365}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:367},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.125],sourceLine:368}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:370},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:371},{angle:0,originX:-.09375,originY:.162379763,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:372}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:374},{angle:90,originX:.125,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:375}]}],issues:[]},el={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:20},{angle:90,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:21}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:23}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:25},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:26}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:28},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:29}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:31},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:32},{angle:45,originX:8.98026,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:33},{angle:45,originX:13.4704,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:34}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:36},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:37}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:5.55625,deltaY:3.175,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:39}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:41},{angle:135,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:42}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:6.35,deltaY:3.175,dashes:[7.9375,-4.7625],sourceLine:45}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:47},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[203.2,-203.2],sourceLine:48}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:50},{angle:0,originX:-203.2,originY:9.525,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:51},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:52},{angle:90,originX:-9.525,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:53}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:55},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:101.6,dashes:[203.2,-203.2],sourceLine:56}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:58},{angle:0,originX:0,originY:57.15,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:59},{angle:0,originX:50.8,originY:67.7418,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:60},{angle:0,originX:50.8,originY:124.892,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:61},{angle:90,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:62},{angle:90,originX:-9.525,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:63},{angle:90,originX:50.8,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:64},{angle:90,originX:41.275,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:65}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:67.7418,dashes:[],sourceLine:67},{angle:90,originX:0,originY:0,deltaX:67.7418,deltaY:101.6,dashes:[67.7418,-67.7418],sourceLine:68}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:104.896,deltaY:-149.807,dashes:[19.05,-209.55],sourceLine:70},{angle:355,originX:0,originY:0,deltaX:-51.76101082,deltaY:187.25814969,dashes:[15.24,-167.64058417],sourceLine:71},{angle:100.4514447,originX:15.182007,originY:-1.3282535,deltaX:145.5569059,deltaY:-176.270089,dashes:[16.1900088,-178.0902446],sourceLine:72},{angle:46.1842,originX:0,originY:50.8,deltaX:157.343,deltaY:-224.71,dashes:[28.575,-314.325],sourceLine:73},{angle:96.63555761,originX:22.5899,originY:47.2965,deltaX:218.33577212,deltaY:-264.40480444,dashes:[24.28502314,-267.13560816],sourceLine:74},{angle:351.18415117,originX:0,originY:50.8,deltaX:196.67912063,deltaY:280.88740361,dashes:[22.85996707,-251.45973192],sourceLine:75},{angle:21,originX:25.4,originY:38.1,deltaX:104.89565868,deltaY:-149.80652586,dashes:[19.05,-209.55],sourceLine:76},{angle:326,originX:25.4,originY:38.1,deltaX:-51.7604,deltaY:187.258,dashes:[15.24,-167.64],sourceLine:77},{angle:71.451445,originX:38.0345326,originY:29.5779001,deltaX:145.5567546,deltaY:-176.2700748,dashes:[16.1900088,-178.0899376],sourceLine:78},{angle:37.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-165.608,0,-170.18,0,-168.275],sourceLine:79},{angle:7.5,originX:0,originY:0,deltaX:79.3242,deltaY:90.6018,dashes:[0,-97.028,0,-161.798,0,-64.135],sourceLine:80},{angle:-32.5,originX:-56.642,originY:0,deltaX:117.434,deltaY:68.0212,dashes:[0,-63.5,0,-198.12,0,-262.89],sourceLine:81},{angle:-42.5,originX:-82.042,originY:0,deltaX:92.0344,deltaY:118.821,dashes:[0,-82.55,0,-131.572,0,-186.69],sourceLine:82}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:101.6,deltaY:101.6,dashes:[304.8,-101.6],sourceLine:84},{angle:135,originX:71.842,originY:71.842,deltaX:101.6,deltaY:-101.6,dashes:[304.8,-101.6],sourceLine:85}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:87},{angle:90,originX:50.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:88},{angle:90,originX:101.6,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:89},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:90},{angle:90,originX:203.2,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:91},{angle:90,originX:254,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:92},{angle:90,originX:304.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:93},{angle:0,originX:0,originY:304.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:94},{angle:0,originX:0,originY:355.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:95},{angle:0,originX:0,originY:406.4,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:96},{angle:0,originX:0,originY:457.2,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:97},{angle:0,originX:0,originY:508,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:98},{angle:0,originX:0,originY:558.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:99},{angle:0,originX:0,originY:609.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:100}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:55.88,deltaY:25.4,dashes:[381,-50.8,127,-25.4],sourceLine:102},{angle:0,originX:33.782,originY:12.7,deltaX:-25.4,deltaY:33.782,dashes:[76.2,-8.382,152.4,-19.05],sourceLine:103},{angle:0,originX:12.7,originY:21.59,deltaX:132.08,deltaY:17.018,dashes:[203.2,-35.56,101.6,-25.4],sourceLine:104}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:647.7,deltaY:304.8,dashes:[152.4,-127,177.8,-76.2,228.6,-101.6],sourceLine:106},{angle:0,originX:152.4,originY:12.7,deltaX:647.7,deltaY:304.8,dashes:[127,-482.6,101.6,-152.4],sourceLine:107},{angle:0,originX:457.2,originY:-19.05,deltaX:647.7,deltaY:304.8,dashes:[76.2,-787.4],sourceLine:108},{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:109},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[285.75,-933.45],sourceLine:110},{angle:90,originX:279.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[266.7,-952.5],sourceLine:111},{angle:90,originX:457.2,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:112},{angle:90,originX:533.4,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:113},{angle:90,originX:762,originY:0,deltaX:304.8,deltaY:215.9,dashes:[279.4,-939.8],sourceLine:114}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:28.5242,deltaY:39.8018,dashes:[0,-38.608,0,-43.18,0,-41.275],sourceLine:116},{angle:7.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-20.828,0,-34.798,0,-13.335],sourceLine:117},{angle:-32.5,originX:-31.242,originY:0,deltaX:66.6344,deltaY:42.6212,dashes:[0,-12.7,0,-45.72,0,-59.69],sourceLine:118},{angle:-42.5,originX:-31.242,originY:0,deltaX:41.2344,deltaY:68.0212,dashes:[0,-6.35,0,-29.972,0,-34.29],sourceLine:119}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:121},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:122},{angle:0,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:123},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:124},{angle:0,originX:0,originY:12.7,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:125},{angle:0,originX:0,originY:19.05,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:126},{angle:90,originX:12.7,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:127},{angle:90,originX:19.05,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:128}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:130},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:131}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:133},{angle:90,originX:0,originY:0,deltaX:0,deltaY:12.7,dashes:[6.35,-6.35],sourceLine:134},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:12.7,dashes:[-6.35,6.35],sourceLine:135}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8.382,dashes:[],sourceLine:137},{angle:90,originX:22.86,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:138},{angle:90,originX:20.32,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:139},{angle:0,originX:22.86,originY:1.397,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:140},{angle:0,originX:22.86,originY:2.794,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:141},{angle:0,originX:22.86,originY:4.191,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:142},{angle:0,originX:22.86,originY:5.588,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:143},{angle:0,originX:22.86,originY:6.985,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:144}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:146},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:147},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:148},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:4.7625,dashes:[4.7625,-3.175],sourceLine:149}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:151},{angle:135,originX:1.5875,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:152},{angle:135,originX:2.38125,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:153},{angle:135,originX:3.175,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:154}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:156},{angle:90,originX:1.5875,originY:-1.5875,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:157}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:159}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:161},{angle:45,originX:0,originY:0,deltaX:0,deltaY:17.9605,dashes:[8.980256121069154,-17.960512242138307],sourceLine:162}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.79375,deltaY:1.5875,dashes:[0,-1.5875],sourceLine:164}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:166},{angle:0,originX:0,originY:2.38125,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:167},{angle:0,originX:0,originY:4.7625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:168},{angle:90,originX:.79375,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:169},{angle:90,originX:3.175,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:170},{angle:90,originX:5.55625,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:171}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:173},{angle:180,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:174},{angle:300,originX:0,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:175},{angle:60,originX:2.54,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:176},{angle:300,originX:2.54,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:177},{angle:60,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:178},{angle:180,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:179},{angle:300,originX:-1.27,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:180},{angle:180,originX:-1.27,originY:-2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:181},{angle:60,originX:-10.16,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:182},{angle:300,originX:-10.16,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:183},{angle:60,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:184},{angle:180,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:185},{angle:300,originX:5.08,originY:8.7988180894,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:186},{angle:180,originX:5.08,originY:8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:187},{angle:0,originX:5.08,originY:4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:188},{angle:0,originX:5.08,originY:-4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:189},{angle:120,originX:1.27,originY:6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:190},{angle:120,originX:-6.35,originY:2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:191},{angle:240,originX:-6.35,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:192},{angle:240,originX:1.27,originY:-6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:193}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:195},{angle:45,originX:6.35,originY:0,deltaX:4.490128053,deltaY:4.490128053,dashes:[1.5875,-5.8052561314,1.5875,-8.9802561314],sourceLine:196}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:198},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:199},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:200}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:202},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:203},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:204}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:206},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:207},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:208}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:17.96051224,deltaY:17.96051224,dashes:[4.7625,-31.15852448],sourceLine:210},{angle:45,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:211},{angle:135,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:212}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.79375,dashes:[],sourceLine:214},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:215}]},{name:"GRAVEL",description:"",lines:[{angle:228.0127875,originX:18.288,originY:25.4,deltaX:305.85067529778,deltaY:1.88796713245,dashes:[3.4172144,-338.30483639565],sourceLine:217},{angle:184.969741,originX:16.002,originY:22.86,deltaX:-305.8545235377,deltaY:1.10019612724,dashes:[5.8640472,-580.54048893524],sourceLine:218},{angle:132.5104471,originX:10.16,originY:22.352,deltaX:-377.59492241548,deltaY:1.56030959675,dashes:[4.1348152,-409.347227941],sourceLine:219},{angle:267.273689,originX:.254,originY:16.002,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:220},{angle:292.83365418,originX:0,originY:10.668,deltaX:-330.19770134945,deltaY:1.23208097566,dashes:[5.236337,-518.39807745344],sourceLine:221},{angle:357.273689,originX:2.032,originY:5.842,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:222},{angle:37.69424047,originX:7.366,originY:5.588,deltaX:-416.58997273292,deltaY:.91357450169,dashes:[7.0619366,-699.13115314247],sourceLine:223},{angle:72.25532837,originX:12.954,originY:9.906,deltaX:586.40373773403,deltaY:.96766293399,dashes:[6.6671952,-660.05256601905],sourceLine:224},{angle:121.42956562,originX:14.986,originY:16.256,deltaX:387.71230339293,deltaY:1.2040754753,dashes:[5.35813,-530.45545698712],sourceLine:225},{angle:175.2363583,originX:12.192,originY:20.828,deltaX:-280.5442400419,deltaY:2.10935518695,dashes:[6.1171328,-299.7393695],sourceLine:226},{angle:222.3974378,originX:6.096,originY:21.336,deltaX:413.48123885686,deltaY:.81554484621,dashes:[7.9107792,-783.16772512177],sourceLine:227},{angle:138.81407483,originX:25.4,originY:15.748,deltaX:234.164238558,deltaY:2.38943100688,dashes:[2.7000454,-267.30565824344],sourceLine:228},{angle:171.4692344,originX:23.368,originY:17.526,deltaX:-334.082478726,deltaY:1.25594916784,dashes:[5.1368198,-508.5463899704],sourceLine:229},{angle:225,originX:18.288,originY:18.288,deltaX:17.96051224214,deltaY:17.96051224214,dashes:[3.5920934,-32.32893108428],sourceLine:230},{angle:203.19859051,originX:16.51,originY:21.336,deltaX:-136.74251918,deltaY:3.33518339548,dashes:[1.9344132,-191.50622368894],sourceLine:231},{angle:291.80140949,originX:14.732,originY:20.574,deltaX:-80.18324702488,deltaY:4.71666158921,dashes:[2.7356562,-134.0475299],sourceLine:232},{angle:30.96375653,originX:15.748,originY:18.034,deltaX:91.47734531502,deltaY:4.35606406258,dashes:[4.4431966,-143.6629815291],sourceLine:233},{angle:161.56505118,originX:19.558,originY:20.32,deltaX:-56.2252967978,deltaY:8.03218525675,dashes:[3.2128714,-77.10898116828],sourceLine:234},{angle:16.389540334,originX:0,originY:20.574,deltaX:265.17991128726,deltaY:1.43340492604,dashes:[4.50088,-445.58826672539],sourceLine:235},{angle:70.34617594,originX:4.318,originY:21.844,deltaX:-297.29446803469,deltaY:1.70858889651,dashes:[3.7759894,-373.822156782],sourceLine:236},{angle:293.19859051,originX:19.558,originY:25.4,deltaX:-136.7425191801,deltaY:3.33518339548,dashes:[3.868801,-189.57183588894],sourceLine:237},{angle:343.61045967,originX:21.082,originY:21.844,deltaX:-265.17991128725,deltaY:1.433404926,dashes:[4.50088,-445.5882667254],sourceLine:238},{angle:339.44395478,originX:0,originY:4.826,deltaX:-136.75087638398,deltaY:2.97284513779,dashes:[4.340352,-212.67734313106],sourceLine:239},{angle:294.7751406,originX:4.064,originY:3.302,deltaX:-306.90424056705,deltaY:1.77401295215,dashes:[3.6367212,-360.0359338072],sourceLine:240},{angle:66.80140949,originX:19.812,originY:0,deltaX:136.74251918012,deltaY:3.33518339452,dashes:[3.868801,-189.57183588894],sourceLine:241},{angle:17.35402464,originX:21.336,originY:3.556,deltaX:-345.47402804977,deltaY:1.51523696536,dashes:[4.2578274,-421.523759802],sourceLine:242},{angle:69.44395478,originX:7.366,originY:0,deltaX:-136.75087638396,deltaY:2.97284513874,dashes:[2.170176,-214.84751913106],sourceLine:243},{angle:101.309932474,originX:18.288,originY:0,deltaX:104.60834648271,deltaY:4.98134983255,dashes:[1.295146,-128.21994964526],sourceLine:244},{angle:165.963756532,originX:18.034,originY:1.27,deltaX:-80.085263387,deltaY:6.16040487582,dashes:[5.236337,-99.49054589069],sourceLine:245},{angle:186.00900596,originX:12.954,originY:2.54,deltaX:-255.26337856879,deltaY:1.32949676118,dashes:[4.85267,-480.41364863337],sourceLine:246},{angle:303.69006753,originX:15.748,originY:15.748,deltaX:-56.35753993648,deltaY:7.0446924921,dashes:[3.6632388,-87.9177635968],sourceLine:247},{angle:353.15722659,originX:17.78,originY:12.7,deltaX:434.77679606606,deltaY:1.0087628707,dashes:[6.3955676,-633.16009065031],sourceLine:248},{angle:60.9453959,originX:24.13,originY:11.938,deltaX:-204.76648550216,deltaY:2.46706609031,dashes:[2.6150824,-258.8939231811],sourceLine:249},{angle:90,originX:25.4,originY:14.224,deltaX:25.4,deltaY:25.4,dashes:[1.524,-23.876],sourceLine:250},{angle:120.25643716,originX:12.446,originY:3.302,deltaX:-204.77318477297,deltaY:1.8283320086,dashes:[3.5286696,-349.339407732],sourceLine:251},{angle:48.0127875,originX:10.668,originY:6.35,deltaX:305.85067529778,deltaY:1.88796713138,dashes:[6.8344288,-334.88762199565],sourceLine:252},{angle:0,originX:15.24,originY:11.43,deltaX:25.4,deltaY:25.4,dashes:[6.604,-18.796],sourceLine:253},{angle:325.3048465,originX:21.844,originY:11.43,deltaX:310.04235091354,deltaY:-1.6064370526,dashes:[4.0160956,-397.5931672414],sourceLine:254},{angle:254.0546041,originX:25.146,originY:9.144,deltaX:104.6687497289,deltaY:3.48895832444,dashes:[3.6982908,-181.21650038772],sourceLine:255},{angle:207.64597536,originX:24.13,originY:5.588,deltaX:545.36007557253,deltaY:1.07143433066,dashes:[6.021451,-596.12464422938],sourceLine:256},{angle:175.42607874,originX:18.796,originY:2.794,deltaX:331.1739336186,deltaY:1.01276432357,dashes:[6.3702946,-630.6584645624],sourceLine:257}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:259},{angle:120,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:260},{angle:60,originX:3.175,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:261}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:263},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:264},{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[-6.35,3.175],sourceLine:265}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:267},{angle:90,originX:0,originY:0,deltaX:-6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:268}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:270},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:271},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:272}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:285}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:287}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:289}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:291}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:293},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:294}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:296}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:298}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:300}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:302}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:304}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:306}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:308},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:309}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:311},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:312}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:314},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:315}]},{name:"JIS_LC_20",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:322},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:323}]},{name:"JIS_LC_20A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:325},{angle:45,originX:1,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:326}]},{name:"JIS_LC_8",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:328},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:329}]},{name:"JIS_LC_8A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:331},{angle:45,originX:1,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:332}]},{name:"JIS_RC_10",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:334},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:335},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:336}]},{name:"JIS_RC_15",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:338},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:339},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:340}]},{name:"JIS_RC_18",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:342},{angle:45,originX:1,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:343},{angle:45,originX:2,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:344}]},{name:"JIS_RC_30",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:346},{angle:45,originX:1,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:347},{angle:45,originX:2,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:348}]},{name:"JIS_STN_1E",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:350},{angle:45,originX:.705,originY:0,deltaX:0,deltaY:1,dashes:[1,-.5],sourceLine:351}]},{name:"JIS_STN_2.5",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.5,dashes:[],sourceLine:353},{angle:45,originX:1.765,originY:0,deltaX:0,deltaY:2.5,dashes:[1.2,-.5],sourceLine:354}]},{name:"JIS_WOOD",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[],sourceLine:356}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:359}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:6.35,dashes:[6.35,-6.35,0,-6.35,0,-6.35],sourceLine:361}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:363},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:364}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:366},{angle:60,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:367},{angle:120,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:368}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:370},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:371},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:372}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:374},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:375},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:376},{angle:0,originX:0,originY:3.96875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:377}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.38125,dashes:[],sourceLine:379},{angle:45,originX:1.6838,originY:0,deltaX:0,deltaY:2.38125,dashes:[0,-2.38125],sourceLine:380}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:382},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:383}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:385},{angle:60,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:386},{angle:120,originX:1.5875,originY:2.7496306704,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:387}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:389},{angle:45,originX:0,originY:1.5875,deltaX:0,deltaY:3.175,dashes:[],sourceLine:390}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[3.175,-22.225],sourceLine:392},{angle:90,originX:1.5875,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.5875,-42.4065904724],sourceLine:393},{angle:90,originX:1.984375,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:394},{angle:90,originX:1.190625,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:395},{angle:60,originX:2.38125,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:396},{angle:120,originX:.79375,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:397}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:399},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-3.175],sourceLine:400}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:402},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:403},{angle:0,originX:-2.38125,originY:4.1244459802,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:404}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:406},{angle:90,originX:3.175,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:407}]}],issues:[]};var Vi=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Vi||{}),tl=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(tl||{}),Sr=(n=>(n[n.HatchObject=0]="HatchObject",n[n.GradientObject=1]="GradientObject",n))(Sr||{}),il=(n=>(n[n.PreDefinedGradient=0]="PreDefinedGradient",n[n.UserDefinedGradient=1]="UserDefinedGradient",n))(il||{});const qr=class qr extends de{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new Tt,this._isSolidFill=!1,this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1,this._patternName="",this._patternNameSet=!1,this._patternType=1,this._patternAngle=0,this._patternAngleSet=!1,this._patternScale=1,this._patternScaleSet=!1,this._associative=!1,this._associativeSet=!1,this._backgroundColor=void 0,this._backgroundColorSet=!1,this._patternDouble=!1,this._patternDoubleSet=!1,this._hatchStyle=0,this._hatchStyleSet=!1,this._hatchObjectType=0,this._gradientAngle=0,this._gradientShift=0,this._shadeTintValue=0,this._gradientStartColor=void 0,this._gradientEndColor=void 0,this._gradientType=0,this._gradientName="",this._gradientOneColorMode=!1}get dxfTypeName(){return"HATCH"}get isGradient(){return this._hatchObjectType===1}get isHatch(){return this._hatchObjectType===0}get isSolidFill(){return this._isSolidFill||this.getEffectivePatternName().trim().toUpperCase()===ti}set isSolidFill(e){this._isSolidFill=e}get color(){if(this.hasExplicitColor())return this.getEntityColor();const e=this.database,t=Ne.instance().getVar(A.HPCOLOR,e);return t instanceof X&&t.colorMethod!==P.None?t.clone():e.cecolor.clone()}set color(e){this.setEntityColor(e)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e??"",this._isSolidFill=this._patternName.trim().toUpperCase()===ti,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(e){this._patternType=e,e!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(e){this._associative=!!e,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e==null?void 0:e.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(e){this._patternDouble=!!e,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(e){this._hatchObjectType=e}get gradientAngle(){return this._gradientAngle}set gradientAngle(e){this._gradientAngle=e}get gradientShift(){return this._gradientShift}set gradientShift(e){this._gradientShift=e}get gradientType(){return this._gradientType}set gradientType(e){this._gradientType=e}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?co:this._gradientName}set gradientName(e){this._gradientName=e??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(e){this._gradientOneColorMode=e}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(e){this._shadeTintValue=e}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(e){this._gradientStartColor=e==null||!Number.isFinite(e)?void 0:e&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(e){this._gradientEndColor=e==null||!Number.isFinite(e)?void 0:e&16777215}applyPatternDefaultsFromSysVars(e){const t=Ne.instance();if(!this.hasExplicitLayer()){const i=t.getVar(A.HPLAYER,e);this.shouldUseSysVarOverride(i)&&(this.layer=i)}if(!this.hasExplicitTransparency()){const i=this.parseHpTransparency(t.getVar(A.HPTRANSPARENCY,e));i&&(this.transparency=i)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(t.getVar(A.HPBACKGROUNDCOLOR,e)),this._backgroundColorSet=!0),!this._patternNameSet){const i=t.getVar(A.HPNAME,e);this._patternName=typeof i=="string"?i:"",this._patternNameSet=!0}if(!this._patternAngleSet){const i=t.getVar(A.HPANG,e);this._patternAngle=typeof i=="number"&&Number.isFinite(i)?i:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(t.getVar(A.HPSCALE,e)),this._patternScaleSet=!0),!this._associativeSet){const i=t.getVar(A.HPASSOC,e);this._associative=typeof i=="number"?i!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(t.getVar(A.HPISLANDDETECTION,e)),this._hatchStyleSet=!0),!this._patternDoubleSet){const i=t.getVar(A.HPDOUBLE,e);this._patternDouble=typeof i=="number"?i!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const e=this.database,t=Ne.instance().getVar(A.HPNAME,e);return typeof t=="string"?t:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const e=this.database,t=Ne.instance().getVar(A.HPANG,e);return typeof t=="number"&&Number.isFinite(t)?t:this._patternAngle}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const e=this.database;return this.normalizePatternScale(Ne.instance().getVar(A.HPSCALE,e))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const e=this.database,t=Ne.instance().getVar(A.HPASSOC,e);return typeof t=="number"?t!==0:this._associative}normalizePatternScale(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:1}normalizeHatchStyle(e){return typeof e!="number"||!Number.isFinite(e)?1:e===0?0:e===2?2:1}shouldUseSysVarOverride(e){if(typeof e!="string")return!1;const t=e.trim().toLowerCase();return t!==""&&t!=="."&&t!=="use current"}parseHpBackgroundColor(e){if(e instanceof X)return e.colorMethod===P.None?void 0:e.clone();if(typeof e!="string")return;const t=e.trim().toLowerCase();if(!(!t||t==="."||t==="none"))return X.fromString(e)}parseHpTransparency(e){if(e instanceof J)return e.clone();if(!this.shouldUseSysVarOverride(e))return;const t=e.trim();if(/^bylayer$/i.test(t)||/^byblock$/i.test(t))return J.fromString(t);const i=Number(t);if(Number.isInteger(i)&&i>=0&&i<=90){const s=new J;return s.percentage=i,s}}updatePredefinedPatternDefinitionLines(e=this.getEffectivePatternName(),t=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const s=e.trim().toUpperCase();if(!s||s===ti){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const r=this.normalizePatternScale(t);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===s&&this._definitionLinesPatternScale===r)return;const a=el.patterns.find(o=>o.name.trim().toUpperCase()===s);if(!a){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=a.lines.map(o=>({angle:o.angle*Math.PI/180,base:{x:o.originX*r,y:o.originY*r},offset:{x:o.deltaX*r,y:o.deltaY*r},dashLengths:o.dashes.map(h=>h*r)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=s,this._definitionLinesPatternScale=r}add(e){this._geo.add(e)}buildAreasFromLoops(){const e=this._geo.loops;if(e.length===0)return[];if(e.length===1)return[this._geo];const t=this._geo.buildHierarchy(),i=[],s=(r,a)=>{if(r.index>=0&&a%2===0){const o=new Tt;o.add(e[r.index]),r.children.forEach(h=>{h.index>=0&&o.add(e[h.index])}),i.push(o)}r.children.forEach(o=>s(o,a+1))};return t.children.forEach(r=>s(r,0)),i.length>0?i:[this._geo]}getCalculatedAreaValue(){const e=this.buildAreasFromLoops();return e.length===0?0:e.reduce((t,i)=>t+i.area,0)}get geometricExtents(){const e=this.buildAreasFromLoops();if(e.length===0)return new Y;const t=new Y;return e.forEach(i=>{const s=i.box;t.union(new Y({x:s.min.x,y:s.min.y,z:this._elevation},{x:s.max.x,y:s.max.y,z:this._elevation}))}),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Vi[0],value:0},{label:Vi[1],value:1},{label:Vi[2],value:2}],accessor:{get:()=>this.patternType,set:e=>{this.patternType=e}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:e=>{this.patternName=e}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:e=>{this.patternAngle=e}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:e=>{this.patternScale=e}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:e=>{this.associative=e}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:e=>{this.backgroundColor=e}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:e=>{this.patternDouble=e}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.getCalculatedAreaValue()}}]}]}}subWorldDraw(e){var r;this.updatePredefinedPatternDefinitionLines();const t=e.subEntityTraits;t.fillType={solidFill:this.isSolidFill,patternAngle:this.getEffectivePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(r=this.backgroundColor)==null?void 0:r.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},t.drawOrder=-1;const i=this.buildAreasFromLoops();if(i.length===0)return e.area(this._geo);if(i.length===1)return e.area(i[0]);const s=i.map(a=>e.area(a));return e.group(s)}transformBy(e){const t=e.elements,i=new nn(t[0],t[4],t[12],t[1],t[5],t[13],0,0,1);this._geo.transform(i),this._elevation=new w(0,0,this._elevation).applyMatrix4(e).z;const s=new w(1,0,0).applyMatrix4(e),r=new w().applyMatrix4(e),a=new w(s).sub(r);if(a.length()>0){const o=Math.atan2(a.y,a.x);this._patternAngle=this.getEffectivePatternAngle()+o,this._gradientAngle+=o,this._patternScale=this.getEffectivePatternScale()*a.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(e){super.dxfOutFields(e);const t=this._geo.loops,i=this.getEffectivePatternName(),s=this.getEffectivePatternAngle(),r=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(i,r),e.writeSubclassMarker("AcDbHatch"),e.writePoint3d(10,{x:0,y:0,z:this.elevation}),e.writeVector3d(210,{x:0,y:0,z:1}),e.writeString(2,i||(this.isSolidFill?ti:ho)),e.writeInt16(70,this.isSolidFill?1:0),e.writeInt16(71,this.getEffectiveAssociative()?1:0),e.writeInt16(91,t.length),t.forEach((a,o)=>{const h=o===0;if(a instanceof ce){const c=a.vertices,d=c.some(p=>(p.bulge??0)!==0);e.writeInt16(92,2),e.writeInt16(72,d?1:0),e.writeInt16(73,a.closed?1:0),e.writeInt16(93,c.length);for(const p of c)e.writePoint2d(10,p),d&&e.writeDouble(42,p.bulge??0);e.writeInt16(97,0);return}if(a instanceof $i){const c=h?1:0;e.writeInt16(92,c),e.writeInt16(93,a.numberOfEdges);for(const d of a.curves){if(d instanceof Ge){e.writeInt16(72,1),e.writePoint2d(10,d.startPoint),e.writePoint2d(11,d.endPoint);continue}if(d instanceof Mt){e.writeInt16(72,2),e.writePoint2d(10,d.center),e.writeDouble(40,d.radius),e.writeAngle(50,d.startAngle),e.writeAngle(51,d.endAngle),e.writeInt16(73,d.clockwise?0:1);continue}if(d instanceof Ui){e.writeInt16(72,3),e.writePoint2d(10,d.center);const u=new v(d.majorAxisRadius*Math.cos(d.rotation),d.majorAxisRadius*Math.sin(d.rotation));e.writePoint2d(11,u);const p=d.majorAxisRadius===0?0:d.minorAxisRadius/d.majorAxisRadius;e.writeDouble(40,p),e.writeAngle(50,d.startAngle),e.writeAngle(51,d.endAngle),e.writeInt16(73,d.clockwise?0:1);continue}if(d instanceof Ue){const u=d.knots,p=d.controlPoints,g=d.weights,m=d.fitPoints,y=g.some(_=>_!==1);e.writeInt16(72,4),e.writeInt16(94,d.degree),e.writeInt16(73,y?1:0),e.writeInt16(74,d.closed?1:0),e.writeInt16(95,u.length),e.writeInt16(96,p.length),u.forEach(_=>e.writeDouble(40,_)),p.forEach((_,f)=>{e.writePoint2d(10,_),y&&e.writeDouble(42,g[f]??1)}),e.writeInt16(97,(m==null?void 0:m.length)??0),m==null||m.forEach(_=>e.writePoint2d(11,_))}}e.writeInt16(97,0)}}),e.writeInt16(75,this.hatchStyle),e.writeInt16(76,this.patternType),e.writeAngle(52,s),e.writeDouble(41,r),e.writeInt16(77,0),e.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(a=>{e.writeAngle(53,a.angle),e.writePoint2d(43,a.base),e.writePoint2d(45,a.offset),e.writeInt16(79,a.dashLengths.length),a.dashLengths.forEach(o=>e.writeDouble(49,o))}),this.isGradient&&(e.writeInt16(450,this._hatchObjectType),e.writeInt16(451,0),e.writeInt16(452,this._gradientOneColorMode?1:0),e.writeAngle(460,this._gradientAngle),e.writeDouble(461,this._gradientShift),e.writeString(470,this.gradientName)),e.writeInt16(98,0),this}};qr.typeName="Hatch";let qi=qr;var nl=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(nl||{});const Kr=class Kr extends ue{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._isHookLineSameDirection=!1,this._annoType=3,this._textHeight=0,this._textWidth=0,this._associatedAnnotation="",this._normal=new x(0,0,1),this._horizontalDirection=new x(1,0,0)}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(e){this._isHookLineSameDirection=e}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(e=>e.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get byBlockColor(){return this._byBlockColor}set byBlockColor(e){this._byBlockColor=e}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(e){this._associatedAnnotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(e){this._horizontalDirection.copy(e)}get offsetFromBlock(){var e;return(e=this._offsetFromBlock)==null?void 0:e.clone()}set offsetFromBlock(e){this._offsetFromBlock=e?new x(e):void 0}get offsetFromAnnotation(){var e;return(e=this._offsetFromAnnotation)==null?void 0:e.clone()}set offsetFromAnnotation(e){this._offsetFromAnnotation=e?new x(e):void 0}appendVertex(e){this._vertices.push(new w().copy(e)),this._updated=!0}setVertexAt(e,t){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].copy(t),this._updated=!0,this}vertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].clone()}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Y().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this.transformVector(this._normal,e),this.transformVector(this._horizontalDirection,e),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,e),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,e),this._splineGeo?(this._splineGeo.transform(e),this._updated=!1):this._updated=!0,this}subWorldDraw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t)}else return e.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Ue(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLeader"),e.writeString(3,this.dimensionStyle),e.writeInt16(71,this.hasArrowHead?1:0),e.writeInt16(72,this.isSplined?1:0),e.writeInt16(73,this.annoType),e.writeInt16(74,this.isHookLineSameDirection?1:0),e.writeInt16(75,this.hasHookLine?1:0),e.writeInt16(76,this.numVertices),this.textHeight!==0&&e.writeDouble(40,this.textHeight),this.textWidth!==0&&e.writeDouble(41,this.textWidth),this.byBlockColor!=null&&e.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&e.writeHandle(340,this.associatedAnnotation);for(const t of this.vertices)e.writePoint3d(10,t);return e.writeVector3d(210,this.normal),e.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&e.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&e.writeVector3d(213,this._offsetFromAnnotation),this}transformVector(e,t){const i=new w,s=new w(e.x,e.y,e.z);i.applyMatrix4(t),s.applyMatrix4(t),e.set(s.x-i.x,s.y-i.y,s.z-i.z)}};Kr.typeName="Leader";let Gn=Kr;var D=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(D||{});function Yc(n){let e=0;for(const t of n)e|=1<<t-1;return e}function Xc(n){const e=[];for(const t of Object.values(D)){if(typeof t!="number")continue;const i=1<<t-1;n&i&&e.push(t)}return e}function Rc(n,e){return n^1<<e-1}function Bc(n,e){return(n&1<<e-1)!==0}function Fc(n,e){return n|1<<e-1}function Dc(n,e){return n&~(1<<e-1)}const Zr=class Zr extends ue{get dxfTypeName(){return"LINE"}constructor(e,t){super(),this._geo=new kt(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}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:e=>{this.startPoint.x=e}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:e=>{this.startPoint.y=e}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:e=>{this.startPoint.z=e}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:e=>{this.endPoint.x=e}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:e=>{this.endPoint.y=e}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:e=>{this.endPoint.z=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,i,s){const r=this.startPoint,a=this.endPoint;switch(e){case D.EndPoint:s.push(r),s.push(a);break;case D.MidPoint:s.push(this.midPoint);break;case D.Nearest:{const o=this._geo.project(t);s.push(o)}break;case D.Perpendicular:{const o=this._geo.perpPoint(t);s.push(o)}break;case D.Tangent:break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this.startPoint,i=this.endPoint,s=[new w(t.x,t.y,0),new w(i.x,i.y,0)];return e.lines(s)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLine"),e.writePoint3d(10,this.startPoint),e.writePoint3d(11,this.endPoint),this}};Zr.typeName="Line";let Ki=Zr;var sl=(n=>(n[n.Top=0]="Top",n[n.Zero=1]="Zero",n[n.Bottom=2]="Bottom",n))(sl||{}),rl=(n=>(n[n.HasVertex=1]="HasVertex",n[n.Closed=2]="Closed",n[n.SuppressStartCaps=4]="SuppressStartCaps",n[n.SuppressEndCaps=8]="SuppressEndCaps",n))(rl||{});const Qr=class Qr extends de{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new w,this._normal=new x(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(e){this._styleName=e}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(e){this._styleObjectHandle=e}get scale(){return this._scale}set scale(e){this._scale=e}get justification(){return this._justification}set justification(e){this._justification=e}get flags(){return this._flags}set flags(e){this._flags=e}get styleCount(){return this._styleCount}set styleCount(e){this._styleCount=Math.max(0,e)}get startPosition(){return this._startPosition}set startPosition(e){this._startPosition.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get segments(){return this._segments.map(e=>this.cloneSegment(e))}set segments(e){this._segments=e.map(t=>this.createSegment(t)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(e){this.setFlag(2,e)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(e){this.setFlag(4,e)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(e){this.setFlag(8,e)}appendSegment(e){this._segments.push(this.createSegment(e)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const e=this.collectGeometryPoints();return new Y().setFromPoints(e)}transformBy(e){return this._startPosition.applyMatrix4(e),this._segments.forEach(t=>{t.position.applyMatrix4(e),this.transformVector(t.direction,e),this.transformVector(t.miterDirection,e)}),this.transformVector(this._normal,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:e=>{this.scale=e}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:e=>{this.justification=e}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subWorldDraw(e){if(this._segments.length===0)return;const t=[],i=this.getMLineStyle(),s=this.getRenderableElementCount(i),r=e.subEntityTraits,a=r.color,o=r.rgbColor,h=r.lineType,c=r.fillType,d=r.drawOrder,u=this.createFillArea(i,s);if(u&&(r.color=a,r.rgbColor=o,this.applyFillTraits(i,r),r.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},r.drawOrder=-1,t.push(e.area(u)),r.fillType=c,r.drawOrder=d),s<=0){const p=this.getReferencePath();p.length>=2&&t.push(e.lines(p))}else{for(let p=0;p<s;p++){r.color=a,r.rgbColor=o,r.lineType=h,this.applyStyleElementTraits(i,p,r);const g=this.getElementPath(p,i);g.length>=2&&t.push(e.lines(g))}this.appendStyleDrivenJointAndCapEntities(e,t,i,s,a,o,h)}if(r.color=a,r.rgbColor=o,r.lineType=h,r.fillType=c,r.drawOrder=d,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMline"),e.writeString(2,this.styleName),e.writeHandle(340,this._styleObjectHandle),e.writeDouble(40,this._scale),e.writeInt16(70,this._justification),e.writeInt16(71,this._flags),e.writeInt16(72,this.vertexCount),e.writeInt16(73,this._styleCount),e.writePoint3d(10,this._startPosition),e.writeVector3d(210,this._normal),this._segments.forEach(t=>{e.writePoint3d(11,t.position),e.writeVector3d(12,t.direction),e.writeVector3d(13,t.miterDirection),t.elements.forEach(i=>{e.writeInt16(74,i.parameterCount),i.parameters.forEach(s=>e.writeDouble(41,s)),e.writeInt16(75,i.fillCount),i.fillParameters.forEach(s=>e.writeDouble(42,s))})}),this}setFlag(e,t){t?this._flags|=e:this._flags&=~e}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}createSegment(e){var t;return{position:new w().copy(e.position),direction:new x().copy(e.direction),miterDirection:new x().copy(e.miterDirection),elements:((t=e.elements)==null?void 0:t.map(i=>this.createElement(i)))??[]}}createElement(e){const t=e.parameters?[...e.parameters]:[],i=e.fillParameters?[...e.fillParameters]:[];return{parameterCount:e.parameterCount??t.length,parameters:t,fillCount:e.fillCount??i.length,fillParameters:i}}cloneSegment(e){return{position:e.position.clone(),direction:e.direction.clone(),miterDirection:e.miterDirection.clone(),elements:e.elements.map(t=>({parameterCount:t.parameterCount,parameters:[...t.parameters],fillCount:t.fillCount,fillParameters:[...t.fillParameters]}))}}collectGeometryPoints(){const e=[this._startPosition];if(this._segments.length===0)return e;const t=this.getMLineStyle(),i=this.getRenderableElementCount(t);if(i<=0)return this._segments.forEach(s=>e.push(s.position)),e;for(let s=0;s<i;s++)e.push(...this.getElementPath(s,t));return e}getRenderableElementCount(e){const t=(e==null?void 0:e.elementCount)??0;return Math.max(this._styleCount,t,...this._segments.map(i=>i.elements.length),0)}getReferencePath(){const e=[this._startPosition.clone(),...this._segments.map(t=>t.position.clone())];return this.closePathIfNeeded(e)}getElementPath(e,t){const i=[],s=this._segments[0];return i.push(this.getElementBoundaryPoint("start",s,e,t)),this._segments.forEach(r=>{i.push(this.offsetPoint(r.position,r.miterDirection,this.getElementMiterOffset(r,e,t)))}),i[i.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],e,t),this.closePathIfNeeded(i)}getElementMiterOffset(e,t,i){var r;const s=e.elements[t];return(r=s==null?void 0:s.parameters)!=null&&r.length?s.parameters[0]:this.getStyleElementOffset(t,i)}getElementBoundaryPoint(e,t,i,s){const r=this.getElementMiterOffset(t,i,s),a=e==="start"?this._startPosition:t.position,o=this.offsetPoint(a,t.miterDirection,r);if(!this.shouldApplyCapCutAtSide(e,s))return o;const h=e==="start"?s==null?void 0:s.startAngle:s==null?void 0:s.endAngle,c=this.computeCapCutDistance(r,h,e);if(c===0)return o;const d=e==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return d.lengthSq()===0?o:o.add(d.multiplyScalar(c))}shouldApplyCapCutAtSide(e,t){return!t||this.closed?!1:e==="start"?this.suppressStartCaps?!1:(t.flags&112)!==0:this.suppressEndCaps?!1:(t.flags&1792)!==0}computeCapCutDistance(e,t,i){const s=this.normalizeCapAngle(t),r=Math.tan(s);if(Math.abs(r)<1e-6)return 0;const a=e/r;return a}normalizeCapAngle(e){if(e==null||!Number.isFinite(e))return Math.PI/2;let t=e%180;return t<0&&(t+=180),(t<1||t>179)&&(t=90),t*Math.PI/180}getStartSegmentDirection(){const e=this._segments[0],t=new x;return e&&(t.subVectors(e.position,this._startPosition),t.lengthSq()===0&&t.copy(e.direction)),t.lengthSq()>0&&t.normalize(),t}getEndSegmentDirection(){const e=this._segments[this._segments.length-1];if(!e)return new x;const t=new x,i=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return t.subVectors(e.position,i),t.lengthSq()===0&&t.copy(e.direction),t.lengthSq()>0&&t.normalize(),t}createFillArea(e,t){if(!e||!(e.flags&1)||t<2)return;const i=this.getFillBoundaryElementIndices(t,e);if(!i)return;const s=this.getElementPath(i.outerIndex,e),r=this.getElementPath(i.innerIndex,e),a=this.stripClosingPoint(s),o=this.stripClosingPoint(r);if(a.length<2||o.length<2)return;const h=new Tt;if(this.closed){if(a.length<3||o.length<3)return;h.add(new ce(a.map(c=>({x:c.x,y:c.y})),!0)),h.add(new ce(o.map(c=>({x:c.x,y:c.y})),!0))}else{const c=[...a,...o.slice().reverse()].map(d=>({x:d.x,y:d.y}));if(c.length<3)return;h.add(new ce(c,!0))}return h}getFillBoundaryElementIndices(e,t){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=-1,a=-1;for(let o=0;o<e;o++){const h=this.getElementReferenceOffset(o,t);h<i&&(i=h,r=o),h>s&&(s=h,a=o)}if(!(r<0||a<0||r===a))return{outerIndex:a,innerIndex:r}}getElementReferenceOffset(e,t){var s;const i=this._segments[0];if(i){const r=i.elements[e];if((s=r==null?void 0:r.parameters)!=null&&s.length)return r.parameters[0]}return this.getStyleElementOffset(e,t)}getStyleElementOffset(e,t){const i=t==null?void 0:t.elements[e];if(!i)return 0;const s=this.getStyleJustificationShift(t);return(i.offset+s)*this._scale}getStyleJustificationShift(e){const t=(e==null?void 0:e.elements)??[];if(t.length<=0)return 0;let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const r of t){const a=r.offset;a<i&&(i=a),a>s&&(s=a)}return this._justification===0?-s:this._justification===2?-i:0}stripClosingPoint(e){if(e.length<2)return e;const t=e[0],i=e[e.length-1],s=1e-9;return Math.abs(t.x-i.x)<=s&&Math.abs(t.y-i.y)<=s&&Math.abs(t.z-i.z)<=s?e.slice(0,-1):e}offsetPoint(e,t,i){if(i===0||t.lengthSq()===0)return e.clone();const s=t.clone().normalize().multiplyScalar(i);return e.clone().add(s)}closePathIfNeeded(e){if(!this.closed||e.length<2)return e;const t=e[0],i=e[e.length-1],s=1e-9;return Math.abs(t.x-i.x)<=s&&Math.abs(t.y-i.y)<=s&&Math.abs(t.z-i.z)<=s||e.push(t.clone()),e}appendStyleDrivenJointAndCapEntities(e,t,i,s,r,a,o){!i||s<2||(t.push(...this.drawMiterJointEntities(e,i,s,r,a,o)),t.push(...this.drawCapEntities(e,i,s,r,a,o)))}drawMiterJointEntities(e,t,i,s,r,a){if(this.closed||this._segments.length<2||!(t.flags&2))return[];const o=[],h=e.subEntityTraits;for(let c=0;c<this._segments.length-1;c++){const d=this._segments[c],u=Array.from({length:i},(p,g)=>{const m=this.getElementMiterOffset(d,g,t);return{elementIndex:g,offset:m,point:this.offsetPoint(d.position,d.miterDirection,m)}}).sort((p,g)=>g.offset-p.offset);for(let p=0;p<u.length-1;p++)this.applyElementDrawTraits(h,s,r,a,t,u[p].elementIndex),o.push(e.lines([u[p].point,u[p+1].point]))}return o}drawCapEntities(e,t,i,s,r,a){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(e,"start",t,i,s,r,a)),o.push(...this.drawCapEntitiesForSide(e,"end",t,i,s,r,a)),o}drawCapEntitiesForSide(e,t,i,s,r,a,o){if(t==="start"&&this.suppressStartCaps)return[];if(t==="end"&&this.suppressEndCaps)return[];const h=i.flags,c=t==="start",d=c?(h&16)!==0:(h&256)!==0,u=c?(h&64)!==0:(h&1024)!==0,p=c?(h&32)!==0:(h&512)!==0;if(!d&&!u&&!p)return[];const g=this.getCapElementPoints(t,s,i);if(g.length<2)return[];const m=[],y=e.subEntityTraits;if(d)for(let f=0;f<g.length-1;f++)this.applyElementDrawTraits(y,r,a,o,i,g[f].elementIndex),m.push(e.lines([g[f].point,g[f+1].point]));const _=c?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(u){const f=this.drawCapArcBetweenElements(e,t,g[0],g[g.length-1],_,y,r,a,o,i);f&&m.push(f)}if(p)for(let f=1;f<Math.floor(g.length/2);f++){const S=g[f],L=g[g.length-1-f];if(!S||!L||S===L)continue;const M=this.drawCapArcBetweenElements(e,t,S,L,_,y,r,a,o,i);M&&m.push(M)}return m}getCapElementPoints(e,t,i){const s=e==="start"?this._segments[0]:this._segments[this._segments.length-1];return s?Array.from({length:t},(r,a)=>({elementIndex:a,offset:this.getElementMiterOffset(s,a,i),point:this.getElementBoundaryPoint(e,s,a,i)})).sort((r,a)=>a.offset-r.offset):[]}drawCapArcBetweenElements(e,t,i,s,r,a,o,h,c,d){const u=t==="end"?s.point:i.point,p=t==="end"?i.point:s.point,g=u.distanceTo(p);if(g<=1e-9||r.lengthSq()===0)return;const y=u.clone().add(new x().subVectors(p,u).multiplyScalar(.5)).add(r.clone().normalize().multiplyScalar(g/2)),_=Pt.createByThreePoints(u,p,y);if(_)return this.applyElementDrawTraits(a,o,h,c,d,t==="end"?s.elementIndex:i.elementIndex),e.circularArc(_)}applyElementDrawTraits(e,t,i,s,r,a){e.color=t,e.rgbColor=i,e.lineType=s,this.applyStyleElementTraits(r,a,e)}transformVector(e,t){const i=new w,s=new w(e.x,e.y,e.z);i.applyMatrix4(t),s.applyMatrix4(t),e.set(s.x-i.x,s.y-i.y,s.z-i.z)}getMLineStyle(){var r;const e=this.database.objects.mlineStyle,t=this.styleObjectHandle?e.getIdAt(this.styleObjectHandle):void 0;if(t)return t;const i=this.styleName?e.getAt(this.styleName):void 0;if(i)return i;const s=(r=this.styleName)==null?void 0:r.toUpperCase();if(s)for(const[a,o]of e.entries()){const h=(o.styleName||a).toUpperCase();if(a.toUpperCase()===s||h===s)return o}}applyStyleElementTraits(e,t,i){const s=e==null?void 0:e.elements[t];if(!s)return;const r=this.resolveStyleElementLineType(s.lineType);r&&(i.lineType=r),!(s.color.isByBlock||s.color.isByLayer)&&(i.color=s.color.clone(),i.rgbColor=s.color.RGB??this.rgbColor)}applyFillTraits(e,t){const i=e==null?void 0:e.fillColor;!i||i.isByBlock||i.isByLayer||(t.color=i.clone(),t.rgbColor=i.RGB??this.rgbColor)}resolveStyleElementLineType(e){var c;const t=e==null?void 0:e.trim();if(!t)return;const i=t.toUpperCase(),s=pe.toUpperCase(),r=At.toUpperCase();let a="UserSpecified",o=t;if(i===s){a="ByLayer";const d=(c=this.database.tables.layerTable.getAt(this.layer))==null?void 0:c.linetype;o=d&&d.toUpperCase()!==s&&d.toUpperCase()!==r?d:It}else i===r&&(a="ByBlock",o=It);const h=this.database.tables.linetypeTable.getAt(o);return h?{type:a,...h.linetype}:{type:a,name:o,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||gt}catch{return gt}}};Qr.typeName="MLine";let Un=Qr;var gi=(n=>(n[n.InvisibleLeader=0]="InvisibleLeader",n[n.StraightLeader=1]="StraightLeader",n[n.SplineLeader=2]="SplineLeader",n))(gi||{}),mt=(n=>(n[n.NoneContent=0]="NoneContent",n[n.BlockContent=1]="BlockContent",n[n.MTextContent=2]="MTextContent",n[n.ToleranceContent=3]="ToleranceContent",n))(mt||{}),al=(n=>(n[n.Horizontal=0]="Horizontal",n[n.Vertical=1]="Vertical",n))(al||{}),ol=(n=>(n[n.Unknown=0]="Unknown",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Top=3]="Top",n[n.Bottom=4]="Bottom",n))(ol||{});const Vc=1,zc=2,Hc=4,jc=8,Wc=64,Gc=128,Uc=32768,Jr=class Jr extends de{get dxfTypeName(){return"MULTILEADER"}constructor(){super(),this._leaders=[],this._leaderLineType=1,this._contentType=0,this._doglegEnabled=!1,this._doglegLength=0,this._doglegVector=new x(1,0,0),this._normal=new x(0,0,1),this._mleaderStyleId="",this._textHeight=2.5,this._textWidth=0,this._textRotation=0,this._textDirection=new x(1,0,0),this._textStyleName="",this._textAttachmentPoint=z.MiddleLeft,this._textDrawingDirection=je.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(e=>this.cloneLeader(e))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(e){this._doglegEnabled=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get doglegVector(){return this._doglegVector}set doglegVector(e){this._doglegVector.copy(e)}get landingPoint(){return this._landingPoint}set landingPoint(e){this._landingPoint=e?this.createPoint(e):void 0}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(e){this._mleaderStyleId=e}get version(){return this._version}set version(e){this._version=e}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(e){this._leaderStyleId=e}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(e){this._propertyOverrideFlag=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor=e}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get landingEnabled(){return this._landingEnabled}set landingEnabled(e){this._landingEnabled=e}get arrowheadId(){return this._arrowheadId}set arrowheadId(e){this._arrowheadId=e}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(e){this._arrowheadSize=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor=e}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(e){this._textFrameEnabled=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get textAttachment(){return this._textAttachment}set textAttachment(e){this._textAttachment=e}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(e){this._textFlowDirection=e}get blockContentId(){return this._blockContentId}set blockContentId(e){this._blockContentId=e}get blockContentColor(){return this._blockContentColor}set blockContentColor(e){this._blockContentColor=e}get blockContentScale(){return this._blockContentScale}set blockContentScale(e){this._blockContentScale=e}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(e){this._blockContentRotation=e}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(e){this._blockContentConnectionType=e}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(e){this._annotativeScaleEnabled=e}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(e){this._arrowheadOverrides=e}get blockAttributes(){return this._blockAttributes}set blockAttributes(e){this._blockAttributes=e}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(e){this._textDirectionNegative=e}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(e){this._textAlignInIPE=e}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(e){this._bottomTextAttachmentDirection=e}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(e){this._topTextAttachmentDirection=e}get contentScale(){return this._contentScale}set contentScale(e){this._contentScale=e}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(e){this._contentBasePosition=e}get textAnchor(){return this._textAnchor}set textAnchor(e){this._textAnchor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(e){this._textBackgroundColor=e}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(e){this._textBackgroundScaleFactor=e}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(e){this._textBackgroundTransparency=e}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(e){this._textBackgroundColorOn=e}get textFillOn(){return this._textFillOn}set textFillOn(e){this._textFillOn=e}get textColumnType(){return this._textColumnType}set textColumnType(e){this._textColumnType=e}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(e){this._textUseAutoHeight=e}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(e){this._textColumnWidth=e}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(e){this._textColumnGutterWidth=e}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(e){this._textColumnFlowReversed=e}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(e){this._textColumnHeight=e}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(e){this._textUseWordBreak=e}get hasMText(){return this._hasMText}set hasMText(e){this._hasMText=e}get hasBlock(){return this._hasBlock}set hasBlock(e){this._hasBlock=e}get planeOrigin(){return this._planeOrigin}set planeOrigin(e){this._planeOrigin=e}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(e){this._planeXAxisDirection=e}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(e){this._planeYAxisDirection=e}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(e){this._planeNormalReversed=e}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(e){if(!e){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:e.text,anchorPoint:this.createPoint(e.anchorPoint)},this._contentType=2}get contents(){var e;return((e=this._mtextContent)==null?void 0:e.text)??""}set contents(e){this._mtextContent?this._mtextContent.text=e:this._mtextContent={text:e,anchorPoint:new w},this._contentType=2}get textLocation(){var e;return(e=this._mtextContent)==null?void 0:e.anchorPoint}set textLocation(e){if(!e){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(e):this._mtextContent={text:"",anchorPoint:this.createPoint(e)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get textDirection(){return this._textDirection}set textDirection(e){this._textDirection.copy(e)}get textStyleName(){return this._textStyleName}set textStyleName(e){this._textStyleName=e}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(e){this._textAttachmentPoint=e}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(e){this._textDrawingDirection=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get blockContent(){var e,t;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(e=this._blockContent.normal)==null?void 0:e.clone(),position:(t=this._blockContent.position)==null?void 0:t.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:this._blockContent.color,transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(e){if(!e){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:e.blockContentId??e.blockHandle,blockHandle:e.blockHandle,normal:e.normal?new x(e.normal):void 0,position:e.position?this.createPoint(e.position):void 0,scale:new x(e.scale??{x:1,y:1,z:1}),rotation:e.rotation??0,color:e.color,transformationMatrix:e.transformationMatrix?[...e.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(e={}){var i,s;const t={lastLeaderLinePoint:e.lastLeaderLinePoint?this.createPoint(e.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:e.landingPoint?this.createPoint(e.landingPoint):void 0,doglegVector:e.doglegVector?new x(e.doglegVector):void 0,doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:((i=e.breaks)==null?void 0:i.map(r=>({index:r.index,start:this.createPoint(r.start),end:this.createPoint(r.end)})))??[],leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:[]};return(s=e.leaderLines)==null||s.forEach(r=>{t.leaderLines.push(this.createLeaderLine(r))}),this._leaders.push(t),this._leaders.length-1}removeLeader(e){return this.checkLeaderIndex(e),this._leaders.splice(e,1),this}addLeaderLine(e,t=[]){return this.checkLeaderIndex(e),this._leaders[e].leaderLines.push(this.createLeaderLine({vertices:t})),this._leaders[e].leaderLines.length-1}appendVertex(e,t,i){return this.getMutableLeaderLine(e,t).vertices.push(this.createPoint(i)),this}setLeaderLineVertices(e,t,i){return this.getMutableLeaderLine(e,t).vertices=i.map(s=>this.createPoint(s)),this}getLeaderLineVertices(e,t){return this.getMutableLeaderLine(e,t).vertices.map(i=>i.clone())}addBreak(e,t,i,s){return this.getMutableLeaderLine(e,t).breaks.push({start:this.createPoint(i),end:this.createPoint(s)}),this}setLandingPoint(e,t){return this.checkLeaderIndex(e),this._leaders[e].landingPoint=t?this.createPoint(t):void 0,this}setDoglegDirection(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegVector=new x(t),this}setDoglegLength(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegLength=t,this}get geometricExtents(){const e=this.collectGeometryPoints();return e.length>0?new Y().setFromPoints(e):new Y}subGetGripPoints(){return this.collectGeometryPoints().map(e=>e.clone())}transformBy(e){var t,i,s,r,a,o,h,c;return this._leaders.forEach(d=>{var u,p;(u=d.lastLeaderLinePoint)==null||u.applyMatrix4(e),(p=d.landingPoint)==null||p.applyMatrix4(e),d.doglegVector&&this.transformVector(d.doglegVector,e),d.breaks.forEach(g=>{g.start.applyMatrix4(e),g.end.applyMatrix4(e)}),d.leaderLines.forEach(g=>{g.vertices.forEach(m=>m.applyMatrix4(e)),g.breaks.forEach(m=>{m.start.applyMatrix4(e),m.end.applyMatrix4(e)})})}),(t=this._landingPoint)==null||t.applyMatrix4(e),(i=this.contentBasePosition)==null||i.applyMatrix4(e),this.transformVector(this._doglegVector,e),this.transformVector(this._normal,e),(s=this.textAnchor)==null||s.applyMatrix4(e),(r=this._mtextContent)==null||r.anchorPoint.applyMatrix4(e),this.transformVector(this._textDirection,e),(o=(a=this._blockContent)==null?void 0:a.position)==null||o.applyMatrix4(e),(h=this._blockContent)!=null&&h.normal&&this.transformVector(this._blockContent.normal,e),this.blockContentScale&&this.transformVector(this.blockContentScale,e),(c=this.planeOrigin)==null||c.applyMatrix4(e),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,e),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:mt[0],value:0},{label:mt[1],value:1},{label:mt[2],value:2},{label:mt[3],value:3}],accessor:{get:()=>this.contentType,set:e=>{this.contentType=e}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:gi[0],value:0},{label:gi[1],value:1},{label:gi[2],value:2}],accessor:{get:()=>this.leaderLineType,set:e=>{this.leaderLineType=e}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:e=>{this.doglegEnabled=e}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:e=>{this.doglegLength=e}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:e=>{this.textHeight=e}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:e=>{this.textWidth=e}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:e=>{this.textStyleName=e}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const e=this.getDefaultMLeaderStyle();e&&(this._mleaderStyleId=e.objectId)}subWorldDraw(e){const t=[],i=e.subEntityTraits,s=i.color,r=i.rgbColor,a=i.lineType,o=i.lineWeight,h=this.getResolvedLeaderLineColor(),c=this.getResolvedLeaderLineStyle(),d=this.getResolvedLeaderLineWeight(),u=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(i,h,s,r),this.applyLineTraits(i,c,d),this._leaders.forEach(g=>{g.leaderLines.forEach(y=>{const _=this.getLeaderLineDrawPoints(g,y);if(_.length>0){const f=this.drawLeaderLine(e,_);f&&t.push(f)}});const m=this.getDoglegPoints(g);m&&t.push(e.lines(m))}));const p=this.getRenderableMTextContent();if(this.contentType===2&&p){this.applyColorTraits(i,u,s,r);const g=this.getResolvedTextHeight(),m={text:p.text,height:g,width:this.getMTextRenderWidth(p.text,g),position:p.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};t.push(e.mtext(m,this.getTextStyle(),!1))}if(i.color=s,i.rgbColor=r,i.lineType=a,i.lineWeight=o,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeader"),e.writeInt16(170,this.leaderLineType),e.writeBoolean(290,this.doglegEnabled),e.writeDouble(41,this.doglegLength),e.writeInt16(172,this.contentType),e.writeVector3d(210,this.normal),e.writeHandle(340,this.mleaderStyleId),this._landingPoint&&e.writePoint3d(10,this._landingPoint),e.writeVector3d(11,this.doglegVector),this._mtextContent&&(e.writeString(1,this._mtextContent.text),e.writePoint3d(12,this._mtextContent.anchorPoint),e.writeDouble(40,this.textHeight),e.writeDouble(42,this.textWidth),e.writeAngle(50,this.textRotation),e.writeString(7,this.textStyleName)),this._blockContent&&(e.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&e.writePoint3d(15,this._blockContent.position),e.writeVector3d(16,this._blockContent.scale),e.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(t=>{t.landingPoint&&e.writePoint3d(110,t.landingPoint),t.doglegVector&&e.writeVector3d(111,t.doglegVector),e.writeDouble(140,t.doglegLength),e.writeInt16(171,t.leaderLines.length),t.leaderLines.forEach(i=>{e.writeInt16(90,i.vertices.length),i.vertices.forEach(s=>e.writePoint3d(10,s))})}),this}createPoint(e){return new w().copy(e)}createLeaderLine(e){var t,i;return{vertices:((t=e.vertices)==null?void 0:t.map(s=>this.createPoint(s)))??[],breakPointIndexes:e.breakPointIndexes?[...e.breakPointIndexes]:[],leaderLineIndex:e.leaderLineIndex,breaks:((i=e.breaks)==null?void 0:i.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[]}}cloneLeader(e){var t,i,s;return{lastLeaderLinePoint:(t=e.lastLeaderLinePoint)==null?void 0:t.clone(),lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:(i=e.landingPoint)==null?void 0:i.clone(),doglegVector:(s=e.doglegVector)==null?void 0:s.clone(),doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:e.breaks.map(r=>({index:r.index,start:r.start.clone(),end:r.end.clone()})),leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:e.leaderLines.map(r=>({vertices:r.vertices.map(a=>a.clone()),breakPointIndexes:[...r.breakPointIndexes],leaderLineIndex:r.leaderLineIndex,breaks:r.breaks.map(a=>({index:a.index,start:a.start.clone(),end:a.end.clone()}))}))}}checkLeaderIndex(e){if(e<0||e>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(e,t){this.checkLeaderIndex(e);const i=this._leaders[e].leaderLines[t];if(!i)throw new Error("The leader line index is out of range!");return i}collectGeometryPoints(){var t;const e=[];return this._leaders.forEach(i=>{i.lastLeaderLinePoint&&e.push(i.lastLeaderLinePoint),i.landingPoint&&e.push(i.landingPoint),i.breaks.forEach(r=>e.push(r.start,r.end)),i.leaderLines.forEach(r=>{e.push(...r.vertices),r.breaks.forEach(a=>e.push(a.start,a.end))});const s=this.getDoglegPoints(i);s&&e.push(...s),i.leaderLines.forEach(r=>{const a=this.getArrowheadPoints(this.getLeaderLineDrawPoints(i,r));a&&e.push(...a)})}),this._landingPoint&&e.push(this._landingPoint),this.contentBasePosition&&e.push(this.contentBasePosition),this.textAnchor&&e.push(this.textAnchor),this._mtextContent&&e.push(this._mtextContent.anchorPoint),(t=this._blockContent)!=null&&t.position&&e.push(this._blockContent.position),this.planeOrigin&&e.push(this.planeOrigin),e}getLeaderLineDrawPoints(e,t){if(t.vertices.length>=2)return t.vertices;if(t.vertices.length===0)return[];const i=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint??this.contentBasePosition;return!i||t.vertices[0].equals(i)?t.vertices:[t.vertices[0],i]}getDoglegPoints(e){if(!this.getResolvedDoglegEnabled())return;const t=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint,i=e.doglegVector??this._doglegVector,s=e.doglegLength??this.getResolvedDoglegLength();if(!t||s==null||s===0||i.lengthSq()===0)return;const r=t.clone().add(i.clone().normalize().multiplyScalar(s));return[t,r]}getArrowheadPoints(e){if(!this.isArrowheadVisible()||e.length<2)return;const t=this.getArrowheadFrame(e);if(!t)return;const i=this.getResolvedArrowheadSize(),{tip:s,unit:r}=t,a=s.clone().add(r.clone().multiplyScalar(i)),o=i/6,h=new x(-r.y,r.x,0),c=a.clone().add(h.clone().multiplyScalar(o)),d=a.clone().add(h.clone().multiplyScalar(-o));return[s,c,d,s]}isArrowheadVisible(){const e=this.getResolvedArrowheadId();return(e==null?void 0:e.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(e,t){const i=[],s=this.getLeaderLinePointsForDraw(t);s.length>=2&&i.push(e.lines(s));const r=this.drawArrowhead(e,t);if(r&&i.push(r),i.length!==0)return i.length===1?i[0]:e.group(i)}getLeaderLinePointsForDraw(e){const t=this.getArrowheadLeaderLineTrimDistance();return t<=0?e:this.trimPolylineStart(e,t)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const e=this.getResolvedArrowheadBlockTableRecord();if(!e)return 0;const t=this.getResolvedArrowheadSize();if(t<=0)return 0;const i=e.origin??w.ORIGIN;let s=i.x;for(const r of e.newIterator()){const a=r.geometricExtents;a.isEmpty()||a.max.x>s&&(s=a.max.x)}return Math.max(0,(s-i.x)*t)}trimPolylineStart(e,t){if(e.length<2||t<=0)return e;let i=t;for(let s=0;s<e.length-1;s++){const r=e[s],a=e[s+1],o=a.distanceTo(r);if(!(o<=0)){if(i<o){const h=new x().subVectors(a,r);return[r.clone().add(h.multiplyScalar(i/o)),...e.slice(s+1)]}i-=o}}return[e[e.length-1]]}drawArrowhead(e,t){if(!this.isArrowheadVisible())return;const i=this.drawArrowheadBlock(e,t);if(i)return i;const s=this.getArrowheadPoints(t);if(!s)return;const r=new Tt;r.add(new ce(s,!0));const a=e.subEntityTraits,o=a.fillType;a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const h=e.area(r);return a.fillType=o,h}drawArrowheadBlock(e,t){const i=this.getResolvedArrowheadBlockTableRecord();if(!i)return;const s=this.getArrowheadFrame(t);if(!s)return;const{tip:r,unit:a}=s,o=this.getResolvedArrowheadSize(),h=Math.atan2(a.y,a.x),c=i.origin??w.ORIGIN,d=new H().makeTranslation(-c.x,-c.y,-c.z),u=new H().makeScale(o,o,o),p=new H().makeRotationZ(h),g=new H().makeTranslation(r.x,r.y,r.z),m=new H().multiplyMatrices(g,p).multiply(u).multiply(d);return ri.instance.draw(e,i,this.rgbColor,[],!0,m,new x(this.normal))}getArrowheadFrame(e){if(e.length<2)return;const t=e[0],i=e.find(r=>!r.equals(t));if(!i)return;const s=new x().subVectors(i,t);if(s.lengthSq()!==0)return{tip:t,unit:s.normalize()}}getResolvedArrowheadId(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.arrowSymbolId;return this.arrowheadId??e}getResolvedArrowheadBlockTableRecord(){const e=this.getResolvedArrowheadId();if(e)return this.database.tables.blockTable.getIdAt(e)}getResolvedArrowheadSize(){const e=this.getMLeaderStyle(),t=(e==null?void 0:e.arrowSize)??(e==null?void 0:e.scale);return this.arrowheadSize??this.contentScale??t??this.getResolvedTextHeight()}getResolvedTextHeight(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.textHeight;return this.textHeight>0?this.textHeight:e!=null&&e>0?e:2.5}getRenderableMTextContent(){var i;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const e=(i=this.getMLeaderStyle())==null?void 0:i.defaultMTextContents,t=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!e||!t))return{text:e,anchorPoint:t}}getMTextRenderWidth(e,t){if(this._textWidth>0)return this._textWidth;if(!e)return this._textWidth;const i=e.replace(/\\[PpNn]/g,`
4
- `).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),s=Math.max(...i.split(/\r\n|\r|\n/g).map(r=>r.length),1);return Math.max(t,s*t)}transformVector(e,t){const i=new w,s=new w(e.x,e.y,e.z);i.applyMatrix4(t),s.applyMatrix4(t),e.set(s.x-i.x,s.y-i.y,s.z-i.z)}getMLeaderStyle(){const e=this.database.objects.mleaderStyle,t=this.mleaderStyleId||this.leaderStyleId;if(t){const i=e.getIdAt(t);if(i)return i}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const e=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return e||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(e){const t=e==null?void 0:e.trim();if(!t)return;const i=this.database.objects.mleaderStyle,s=i.getAt(t);if(s)return s;const r=i.getIdAt(t);if(r)return r;const a=t.toUpperCase();for(const[o,h]of i.entries())if(o.toUpperCase()===a)return h}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||pt}catch{return pt}}getResolvedTextStyleName(){var r,a;const e=this.database.tables.textStyleTable,t=(r=this.getMLeaderStyle())==null?void 0:r.textStyleId,i=t?(a=e.getIdAt(t))==null?void 0:a.name:void 0;if(this.textStyleName)return this.textStyleName;const s=this.textStyleId?e.getIdAt(this.textStyleId):void 0;return s!=null&&s.name?s.name:i}getTextStyle(){const e=this.database.tables.textStyleTable,t=this.getResolvedTextStyleName(),i=(t?e.getAt(t):void 0)??e.getAt(this.database.textstyle)??e.getAt(Q);if(!i)throw new Error("No valid text style found in text style table.");return i.textStyle}getResolvedLeaderLineColor(){var e;return this.getResolvedComponentColor(this.leaderLineColor,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineColor,zc)}getResolvedLeaderLineType(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,e,Vc)}getResolvedLeaderLineTypeId(){var e;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineTypeId,Hc)}getResolvedLeaderLineStyle(){const e=this.getResolvedLeaderLineTypeId();if(!e)return;const t=this.database.tables.linetypeTable.getIdAt(e);if(t)return{type:"UserSpecified",...t.linetype}}getResolvedLeaderLineWeight(){var i;const e=(i=this.getMLeaderStyle())==null?void 0:i.leaderLineWeight,t=this.getResolvedStyleDrivenValue(this.leaderLineWeight,e,jc);if(t!=null)return t}getResolvedDoglegEnabled(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,e,Wc)}getResolvedDoglegLength(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,e,Gc)}getResolvedTextColor(){var e;return this.getResolvedComponentColor(this.textColor,(e=this.getMLeaderStyle())==null?void 0:e.textColor,Uc)}getResolvedComponentColor(e,t,i){const s=e!=null?zi(e):void 0;if(!s)return t;const r=this.isPropertyOverrideEnabled(i);return r===!0?s:r===!1?t??s:!s.isByBlock&&!s.isByLayer?s:t??s}getResolvedStyleDrivenValue(e,t,i){const s=this.isPropertyOverrideEnabled(i);return s===!0?e??t:t??e}isPropertyOverrideEnabled(e){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&e)!==0}applyColorTraits(e,t,i,s){e.color=i,e.rgbColor=s,t&&(e.color=t,e.rgbColor=this.resolveColorToRgb(t))}applyLineTraits(e,t,i){t&&(e.lineType=t),i!=null&&(e.lineWeight=i)}resolveColorToRgb(e){if(e.isByLayer){const t=this.getLayerColor();return(t==null?void 0:t.RGB)!=null?t.RGB:this.rgbColor}return e.isByBlock?this.rgbColor:e.RGB??this.rgbColor}};Jr.typeName="MLeader";let $n=Jr;const ea=class ea extends de{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=z.TopLeft,this._direction=new x(1,0,0),this._drawingDirection=je.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new Y}subGetOsnapPoints(e,t,i,s){D.Insertion===e&&s.push(this._location)}transformBy(e){const t=this._location.clone(),i=this._direction.lengthSq()>0?this._direction.clone().normalize():new x(Math.cos(this._rotation),Math.sin(this._rotation),0),s=new x(-i.y,i.x,i.z);s.lengthSq()===0&&s.set(0,1,0),s.normalize();const r=t.clone().add(i),a=t.clone().add(s);t.applyMatrix4(e),r.applyMatrix4(e),a.applyMatrix4(e);const o=new x(r).sub(t),h=new x(a).sub(t),c=o.length(),d=h.length();return this._location.copy(t),c>0&&(this._direction.copy(o).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=c),d>0&&(this._height*=d),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:z[1],value:1},{label:z[2],value:2},{label:z[3],value:3},{label:z[4],value:4},{label:z[5],value:5},{label:z[6],value:6},{label:z[7],value:7},{label:z[8],value:8},{label:z[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:e=>{this.attachmentPoint=e}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:je[1],value:1},{label:je[2],value:2},{label:je[3],value:3},{label:je[4],value:4},{label:je[5],value:5}],accessor:{get:()=>this.drawingDirection,set:e=>{this.drawingDirection=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:e=>{this.lineSpacingFactor=e}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:e=>{this.width=e}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:e=>{this.direction.x=e}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:e=>{this.direction.y=e}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:e=>{this.direction.z=e}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:e=>{this.location.x=e}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:e=>{this.location.y=e}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:e=>{this.location.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable,t=e.getAt(this.styleName)??e.getAt(this.database.textstyle)??e.getAt(Q);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(e,t){const i={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 e.mtext(i,this.getTextStyle(),t)}encodeMTextContentsForDxf(e){return e.replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMText"),e.writePoint3d(10,this.location),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writeString(1,this.encodeMTextContentsForDxf(this.contents)),e.writeString(7,this.styleName),e.writeAngle(50,this.rotation),e.writeVector3d(11,this.direction),e.writeInt16(71,this.attachmentPoint),e.writeInt16(72,this.drawingDirection),e.writeInt16(73,this.lineSpacingStyle),e.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(e.writeInt16(90,1),e.writeInt32(63,this.backgroundFillColor),e.writeInt32(441,this.backgroundFillTransparency),e.writeDouble(45,this.backgroundScaleFactor)),this}};ea.typeName="MText";let Zi=ea;const ta=class ta extends ue{get dxfTypeName(){return"SPLINE"}constructor(e,t,i,s,r){super(),this.rebuild(e,t,i,s,r)}rebuild(e,t,i,s,r){const a=+(e!==void 0)+ +(t!==void 0)+ +(i!==void 0)+ +(s!==void 0)+ +(r!==void 0);if(a<2||a>5)throw be.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new Ue(e,t,i,s):this._geo=new Ue(e,t,i,s,r)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(this._geo.startPoint),s.push(this._geo.endPoint);break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this._geo.getPoints(100);return e.lines(t)}dxfOutFields(e){var i;const t=this._geo;super.dxfOutFields(e),e.writeSubclassMarker("AcDbSpline"),e.writeInt16(70,this.closed?1:0),e.writeInt16(71,t.degree),e.writeInt16(72,t.knots.length),e.writeInt16(73,t.controlPoints.length),e.writeInt16(74,((i=t.fitPoints)==null?void 0:i.length)??0);for(const s of t.knots)e.writeDouble(40,s);for(const s of t.weights)e.writeDouble(41,s);for(const s of t.controlPoints)e.writePoint3d(10,s);for(const s of t.fitPoints??[])e.writePoint3d(11,s);return this}};ta.typeName="Spline";let Qi=ta;const $c=new x,ia=class ia extends ni{get dxfTypeName(){return"ACAD_TABLE"}constructor(e,t,i){super(e),this._attachmentPoint=z.TopLeft,this._numColumns=i,this._numRows=t,this._columnWidth=new Array(i),this._rowHeight=new Array(t),this._cells=new Array(t*i)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,i){var r;const s=e*this._numColumns+t;return(r=this._cells[s])==null?void 0:r.text}setTextString(e,t,i){const s=e*this._numColumns+t;if(!this._cells[s]){this._cells[s]={text:i,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[s].text=i}isEmpty(e,t){var s;const i=e*this._numColumns+t;return!((s=this._cells[i])!=null&&s.text)}get geometricExtents(){return new Y}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:e=>{this.numRows=e}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:e=>{this.numColumns=e}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((e,t)=>e+t,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((e,t)=>e+t,0)}}]},{groupName:"geometry",properties:[{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}}}]}]}}subWorldDraw(e){const t=this.blockTableRecord;if(t&&t.newIterator().count>0){const g=this.drawAnonymousTableBlock(e,t);if(g)return g}let i=0,s=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 g=0;g<=this.numRows;g++){i-=g>0?this.rowHeight(g-1):0,s=0;for(let m=0;m<=this.numColumns;m++)s+=m>0?this.columnWidth(m-1):0,a[o++]=s,a[o++]=i,a[o++]=0}const h=[],c=new Array(this.numRows*this.numColumns).fill(!1);s=0,o=0;let d=0;for(let g=0;g<this.numColumns;g++){s+=g>0?this.columnWidth(g-1):0,i=0;for(let m=0;m<this.numRows;m++){i+=m>0?this.rowHeight(m-1):0;const y=this.cell(m*this.numColumns+g);if(d=m*this.numColumns+g,y&&!c[d]){const _=y.borderWidth??1,f=y.borderHeight??1;this.fillVisited(c,d,this.numColumns,_,f),r[o++]=g+m*(this.numColumns+1),r[o++]=g+m*(this.numColumns+1)+_;const S=a[r[o-1]*3]-s,L=g+(m+f)*(this.numColumns+1)+_;g+_==this.numColumns&&(r[o++]=g+m*(this.numColumns+1)+_,r[o++]=L);const M=-a[L*3+1]-i;if(m+f==this.numRows&&(r[o++]=g+(m+f)*(this.numColumns+1)+f,r[o++]=g+(m+f)*(this.numColumns+1)),r[o++]=g+(m+f)*(this.numColumns+1),r[o++]=g+m*(this.numColumns+1),y.text){const I=y.attachmentPoint||this.attachmentPoint||z.MiddleCenter,W=this.getTableTextOffset(I,S,M),C={text:y.text,height:this.getCellTextHeight(y,M),width:S,position:$c.set(s,-i,0).clone().add(W),rotation:this.rotation,attachmentPoint:I},q=this.getTextStyle(y);h.push(e.mtext(C,q))}}}}h.push(e.lineSegments(a,3,r));const u=e.group(h),p=new ai;return p.setFromAxisAngle(x.Z_AXIS,this.rotation),wn.compose(this.position,p,this.scaleFactors),u.applyMatrix(wn),u}drawAnonymousTableBlock(e,t){const i=[],s=t.newIterator();for(const o of s){let h;o.color.isByBlock&&this.rgbColor?(Ya.copy(o.color),o.color.setRGBValue(this.rgbColor),h=o.worldDraw(e),o.color.copy(Ya)):h=o.worldDraw(e),h&&(h.objectId=this.objectId,h.ownerId=this.ownerId,h.layerName=this.layer,h.visible=this.visibility&&o.visibility,i.push(h))}const r=e.group(i);r.applyMatrix(this.blockTransform);const a=this.normal;return a&&(a.x!==0||a.y!==0||a.z!==1)&&(wn.setFromExtrusionDirection(a),r.applyMatrix(wn)),r}fillVisited(e,t,i,s,r){if(r==1&&s==1)e[t]=!0;else for(let a=0;a<s;++a)for(let o=0;o<r;++o)e[t+a+o*i]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable,i=(e.textStyle?t.getAt(e.textStyle):void 0)??t.getAt(this.database.textstyle)??t.getAt(Q);if(!i)throw new Error("No valid text style found in text style table.");return i.textStyle}getTableTextOffset(e,t,i){const s=new x;switch(e){case 1:break;case 2:s.setX(t/2);break;case 3:s.setX(t);break;case 4:s.setY(-i/2);break;case 5:s.set(t/2,-i/2,0);break;case 6:s.set(t,-i/2,0);break;case 7:s.setY(-i);break;case 8:s.set(t/2,-i,0);break;case 9:s.set(t,-i,0);break}return s}getCellTextHeight(e,t){return e.textHeight&&e.textHeight>0?e.textHeight:Math.max(t/2,1)}dxfOutFields(e){var r,a,o,h,c,d,u;super.dxfOutFields(e),e.writeSubclassMarker("AcDbTable");const t=e.version??((r=e.database)==null?void 0:r.version)??((a=this.database)==null?void 0:a.version),i=(t==null?void 0:t.value)!=null?t.value>=27:!1;e.writeInt16(280,this.tableDataVersion),e.writeObjectId(342,this.tableStyleId),e.writeObjectId(343,this.owningBlockRecordId),e.writeVector3d(11,this.horizontalDirection),e.writeUInt32(90,this.tableValueFlag),e.writeUInt32(93,this.tableOverrideFlag),e.writeUInt32(94,this.borderColorOverrideFlag),e.writeUInt32(95,this.borderLineweightOverrideFlag),e.writeUInt32(96,this.borderVisibilityOverrideFlag),e.writeInt16(71,this.attachmentPoint),e.writeInt32(91,this.numRows),e.writeInt32(92,this.numColumns);for(let p=0;p<this.numRows;++p)e.writeDouble(141,this.rowHeight(p));for(let p=0;p<this.numColumns;++p)e.writeDouble(142,this.columnWidth(p));const s=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let p=0;p<s;p++){const g=this._cells[p],m=(g==null?void 0:g.cellType)??(g!=null&&g.blockTableRecordId?2:1);if(e.writeInt16(171,m),e.writeInt16(172,(g==null?void 0:g.flagValue)??0),e.writeInt16(173,(g==null?void 0:g.mergedValue)??0),e.writeBoolean(174,g==null?void 0:g.autoFit),e.writeInt16(175,g==null?void 0:g.borderWidth),e.writeInt16(176,g==null?void 0:g.borderHeight),(g==null?void 0:g.overrideFlag)!=null&&(i?e.writeInt32(91,g.overrideFlag):e.writeInt16(177,g.overrideFlag)),e.writeInt16(178,g==null?void 0:g.virtualEdgeFlag),e.writeAngle(145,g==null?void 0:g.rotation),i&&e.writeInt16(92,g==null?void 0:g.extendedCellFlags),m===1)g!=null&&g.fieldObjetId?e.writeObjectId(344,g.fieldObjetId):this.writeCellText(e,(g==null?void 0:g.text)??"",i,g==null?void 0:g.cellValueBlockBegin);else if(m===2){if(e.writeObjectId(340,g==null?void 0:g.blockTableRecordId),e.writeDouble(144,g==null?void 0:g.blockScale),e.writeInt16(179,g==null?void 0:g.blockAttrNum),(o=g==null?void 0:g.attrDefineId)!=null&&o.length)for(const y of g.attrDefineId)e.writeObjectId(331,y);if((g==null?void 0:g.attrText)!=null)if(Array.isArray(g.attrText))for(const y of g.attrText)e.writeString(300,y);else e.writeString(300,g.attrText)}g!=null&&g.textStyle&&e.writeString(7,g.textStyle),(g==null?void 0:g.textHeight)!=null&&e.writeDouble(140,g.textHeight),(g==null?void 0:g.attachmentPoint)!=null&&e.writeInt16(170,g.attachmentPoint),(g==null?void 0:g.topBorderVisibility)!=null&&e.writeInt16(289,g.topBorderVisibility?1:0),(g==null?void 0:g.rightBorderVisibility)!=null&&e.writeInt16(285,g.rightBorderVisibility?1:0),(g==null?void 0:g.bottomBorderVisibility)!=null&&e.writeInt16(286,g.bottomBorderVisibility?1:0),(g==null?void 0:g.leftBorderVisibility)!=null&&e.writeInt16(288,g.leftBorderVisibility?1:0)}if(e.writeInt16(70,this.flowDirection),e.writeDouble(40,this.horizontalCellMargin),e.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&e.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&e.writeInt16(281,this.suppressHeader?1:0),(h=this.cellTypeOverrides)!=null&&h.length)for(const p of this.cellTypeOverrides){e.writeString(7,p.textStyle),e.writeDouble(140,p.textHeight),e.writeInt16(170,p.alignment),e.writeInt16(63,p.backgroundColor),e.writeInt16(64,p.contentColor),p.backgroundColorEnabled!=null&&e.writeInt16(283,p.backgroundColorEnabled?1:0);const g=p.borderLineweights;g&&(e.writeInt16(274,g.top),e.writeInt16(275,g.right),e.writeInt16(276,g.bottom),e.writeInt16(277,g.left),e.writeInt16(278,g.insideHorizontal),e.writeInt16(279,g.insideVertical));const m=p.borderVisibility;m&&(e.writeInt16(284,m.top?1:0),e.writeInt16(285,m.right?1:0),e.writeInt16(286,m.bottom?1:0),e.writeInt16(287,m.left?1:0),e.writeInt16(288,m.insideHorizontal?1:0),e.writeInt16(289,m.insideVertical?1:0))}if(this.tableBorderColors&&(e.writeInt16(63,this.tableBorderColors.left),e.writeInt16(64,this.tableBorderColors.top),e.writeInt16(65,this.tableBorderColors.insideHorizontal),e.writeInt16(66,this.tableBorderColors.bottom),e.writeInt16(68,this.tableBorderColors.insideVertical),e.writeInt16(69,this.tableBorderColors.right)),(c=this.rowDataTypes)!=null&&c.length)for(const p of this.rowDataTypes)e.writeInt16(97,p);if((d=this.rowUnitTypes)!=null&&d.length)for(const p of this.rowUnitTypes)e.writeInt16(98,p);if((u=this.rowFormats)!=null&&u.length)for(const p of this.rowFormats)e.writeString(4,p);return this}writeCellText(e,t,i,s){if(!i){if(t.length<=250){e.writeString(1,t);return}const o=Math.ceil(t.length/250);for(let h=0;h<o;h++){const c=h*250,d=c+250,u=t.slice(c,d);h===o-1?e.writeString(1,u):e.writeString(2,u)}return}if(e.writeString(301,s??"CELL_VALUE"),t.length<=250){e.writeString(302,t),e.writeString(304,"ACVALUE_END");return}const a=Math.ceil(t.length/250);for(let o=0;o<a;o++){const h=o*250,c=h+250,d=t.slice(h,c);o===a-1?e.writeString(302,d):e.writeString(303,d)}e.writeString(304,"ACVALUE_END")}};ia.typeName="Table";let qn=ia;const wn=new H,Ya=new X,na=class na extends ue{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(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new Y().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(...this._vertices);break}}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this._elevation=this._vertices[0].z,this}subWorldDraw(e){const t=new ce(this._vertices,!0),i=new Tt;i.add(t);const s=e.subEntityTraits;return s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(i)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTrace"),e.writeDouble(38,this.elevation),e.writeDouble(39,this.thickness),e.writePoint3d(10,this.getPointAt(0)),e.writePoint3d(11,this.getPointAt(1)),e.writePoint3d(12,this.getPointAt(2)),e.writePoint3d(13,this.getPointAt(3)),this}};na.typeName="Trace";let Kn=na;const sa=class sa extends ue{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new ce}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,i=0,s=-1,r=-1){const a=s<0?void 0:s,o=r<0?void 0:r,h={x:t.x,y:t.y,bulge:i,startWidth:a,endWidth:o};this._geo.addVertexAt(e,h)}removeVertexAt(e){this._geo.removeVertexAt(e)}reset(e,t){this._geo.reset(e,t)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new w(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new Y({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}subGetOsnapPoints(e,t,i,s){const r=new Array;for(let a=0;a<this.numberOfVertices;++a)r.push(this.getPoint3dAt(a));switch(e){case D.EndPoint:s.push(...r);break}}transformBy(e){const t=e.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(s=>{const r=new w(s.x,s.y,this._elevation).applyMatrix4(e);s.x=r.x,s.y=r.y,i=r.z,t&&s.bulge!=null&&(s.bulge=-s.bulge)}),this._elevation=i,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:e=>{this.elevation=e}}},{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:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.getPoints(100),i=this.createWidthProfile();if(i!=null){const r=qc(i,this.closed);if(r!=null){const a=e.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(r)}}const s=[];return t.forEach(r=>s.push(new w().set(r.x,r.y,this.elevation))),e.lines(s)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyline"),e.writeInt32(90,this.numberOfVertices),e.writeInt16(70,this.closed?1:0),e.writeDouble(38,this.elevation);for(let t=0;t<this.numberOfVertices;++t)e.writePoint2d(10,this.getPoint2dAt(t));return this}createWidthProfile(){const e=this._geo.vertices,t=e.length;if(t<2)return null;const i=this.closed?t:t-1,s=[];let r=!1;for(let a=0;a<i;a++){const o=e[a],h=e[(a+1)%t],c=Math.max(0,o.startWidth??0),d=Math.max(0,o.endWidth??0);(c>Ce||d>Ce)&&(r=!0);const u=this.sampleSegment(o,h),p=u.length-1;for(let g=0;g<=p;g++){if(g===0&&s.length>0||this.closed&&a===i-1&&g===p)continue;const m=p>0?g/p:0;s.push({x:u[g].x,y:u[g].y,width:Jc(c,d,m)})}}return r&&s.length>=2?s:null}sampleSegment(e,t){if(e.bulge&&Math.abs(e.bulge)>Ce){const s=new Mt(e,t,e.bulge).getPoints(32);if(s.length>1)return s.map(r=>new v(r.x,r.y))}return[new v(e.x,e.y),new v(t.x,t.y)]}};sa.typeName="Polyline";let Zn=sa;const Ce=1e-6,Xa=4;function qc(n,e){if(n.length<2)return null;const t=Zc(n,e);if(t.length<2)return null;const{left:i,right:s}=Kc(t,e);if(i.length<2||s.length<2)return null;const r=new Tt;if(e){if(!Es(i)||!Es(s))return null;const o=Math.abs(Ks(i)),h=Math.abs(Ks(s)),[c,d]=o>=h?[i,s]:[s,i];return r.add(new ce(c,!0)),r.add(new ce(d,!0)),r}const a=[...i,...s.reverse()];return Es(a)?(r.add(new ce(a,!0)),r):null}function Kc(n,e){const t=[],i=[];for(let s=0;s<n.length;s++){const r=n[s],a=Math.max(0,r.width)/2;if(a<=Ce)continue;const o=Qc(n,s,e);o!=null&&(t.push({x:r.x+o.x*a,y:r.y+o.y*a}),i.push({x:r.x-o.x*a,y:r.y-o.y*a}))}return{left:t,right:i}}function Zc(n,e){const t=[];if(n.forEach(i=>{const s=t[t.length-1];(!s||Math.abs(s.x-i.x)>Ce||Math.abs(s.y-i.y)>Ce||Math.abs(s.width-i.width)>Ce)&&t.push(i)}),e&&t.length>1){const i=t[0],s=t[t.length-1];Math.abs(i.x-s.x)<=Ce&&Math.abs(i.y-s.y)<=Ce&&t.pop()}return t}function Qc(n,e,t){const i=n.length,s=n[e],r=n[(e-1+i)%i],a=n[(e+1)%i];let o=Ra(s.x-r.x,s.y-r.y),h=Ra(a.x-s.x,a.y-s.y);if(t||(e===0&&(o=h),e===i-1&&(h=o)),o==null&&h==null)return null;if(o==null)return bn(h);if(h==null)return bn(o);const c=bn(o),d=bn(h),u=c.x+d.x,p=c.y+d.y,g=Math.hypot(u,p);if(g<=Ce)return d;const m={x:u/g,y:p/g},y=Math.abs(m.x*d.x+m.y*d.y),_=y<=Ce?Xa:Math.min(1/y,Xa);return{x:m.x*_,y:m.y*_}}function Ra(n,e){const t=Math.hypot(n,e);return t<=Ce?null:{x:n/t,y:e/t}}function bn(n){return{x:-n.y,y:n.x}}function Ks(n){let e=0;const t=n.length;for(let i=0;i<t;i++){const s=n[i],r=n[(i+1)%t];e+=s.x*r.y-r.x*s.y}return e/2}function Es(n){return n.length>=3&&Math.abs(Ks(n))>Ce}function Jc(n,e,t){return n+(e-n)*t}const ra=class ra extends de{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new w}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new Y().expandByPoint(this._geo)}subGetOsnapPoints(e,t,i,s){D.Node===e&&s.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: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}}}]}]}}transformBy(e){return this._geo.applyMatrix4(e),this}subWorldDraw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbPoint"),e.writePoint3d(10,this.position),this}};ra.typeName="Point";let Qn=ra;var ll=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(ll||{}),hl=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(hl||{});const aa=class aa extends de{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 K(1,1),this._rotation=0,this._imageSize=new v,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(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get imageSize(){return this._imageSize}set imageSize(e){this._imageSize.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new Y;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}subWorldDraw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t)}transformBy(e){const t=this._width*this._scale.x,i=this._height*this._scale.y,s=new x(t*Math.cos(this._rotation),t*Math.sin(this._rotation),0),r=new x(-i*Math.sin(this._rotation),i*Math.cos(this._rotation),0),a=this._position.clone(),o=this._position.clone().add(s),h=this._position.clone().add(r);a.applyMatrix4(e),o.applyMatrix4(e),h.applyMatrix4(e);const c=new x(o).sub(a),d=new x(h).sub(a);return this._position.copy(a),this._rotation=Math.atan2(c.y,c.x),this._width=c.length(),this._height=d.length(),this._scale.set(1,1),this}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,i=this._height,s=new xe;s.setFromPoints(this._clipBoundary);const r=new v;r.setX(this._position.x-s.min.x*t),r.setY(this._position.y-s.min.y*i),this._clipBoundary.forEach(a=>{const o=a.x*t+r.x,h=a.y*i+r.y;e.push(new w(o,h,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Ba.copy(e[1]);for(let t=1;t<4;t++)Ln.copy(e[t]),Ln.rotateAround(Ba,this._rotation),e[t].setX(Ln.x),e[t].setY(Ln.y)}e.push(e[0])}return e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImage"),e.writePoint3d(10,this.position);const t=this.width*this.scale.x,i=this.height*this.scale.y,s=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:t,y:i},r=s.x>0?t/s.x:t,a=s.y>0?i/s.y:i,o=Math.cos(this._rotation),h=Math.sin(this._rotation);e.writePoint3d(11,{x:r*o,y:r*h,z:0}),e.writePoint3d(12,{x:-a*h,y:a*o,z:0}),e.writePoint2d(13,s),e.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(e.writeInt16(70,c),e.writeInt16(280,this.isClipped?1:0),e.writeInt16(281,this.brightness),e.writeInt16(282,this.contrast),e.writeInt16(283,this.fade),e.writeInt16(71,this.clipBoundaryType),this.isClipped){e.writeInt16(91,this.clipBoundary.length);for(const d of this.clipBoundary)e.writePoint2d(14,d)}return this}};aa.typeName="RasterImage";let Ji=aa;const Ba=new v,Ln=new v,oa=class oa extends ue{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new w,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Y;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(this.basePoint);break}}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRay"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}};oa.typeName="Ray";let Jn=oa;const la=class la extends de{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(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new Y}transformBy(e){const t=this._centerPoint.clone(),i=this._centerPoint.clone().add(new x(this._width,0,0)),s=this._centerPoint.clone().add(new x(0,this._height,0));t.applyMatrix4(e),i.applyMatrix4(e),s.applyMatrix4(e);const r=new x(i).sub(t),a=new x(s).sub(t),o=this._height!==0?a.length()/this._height:1;return this._centerPoint.copy(t),this._width=r.length(),this._height=a.length(),this._viewHeight*=o,this}subWorldDraw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new $o;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const i=[];return i.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)])),i.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)])),i.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)])),i.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)])),i}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewport"),e.writePoint3d(10,this.centerPoint),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writePoint3d(12,this.viewCenter),e.writeDouble(45,this.viewHeight),e.writeInt32(69,this.number),this}};la.typeName="Viewport";let es=la;const ha=class ha extends Ji{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(e){const t=this.boundaryPath(),i=new Tt;return i.add(new ce(t)),e.area(i)}dxfOutFields(e){return super.dxfOutFields(e),this}};ha.typeName="Wipeout";let ts=ha;const ca=class ca extends ue{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new w,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Y;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXline"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}};ca.typeName="Xline";let is=ca;class cl{constructor(e){this.position=new w(e.x,e.y,e.z||0)}}const da=class da extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t,i,s=!1,r=!1){super(),this._mCount=e,this._nCount=t,this._closedM=s,this._closedN=r,this._vertices=i.map(a=>new cl(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(e){this._closedM=e}get numberOfVertices(){return this._vertices.length}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getVertexAtMN(e,t){const i=e*this._nCount+t;return this.getVertexAt(i)}get geometricExtents(){if(this._vertices.length===0)return new Y(new w(0,0,0),new w(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,i=Number.MAX_VALUE,s=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{e=Math.min(e,o.position.x),t=Math.min(t,o.position.y),i=Math.min(i,o.position.z),s=Math.max(s,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new Y(new w(e,t,i),new w(s,r,a))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:this._vertices.forEach(r=>{s.push(r.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),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(e=>({x:e.position.x,y:e.position.y,z:e.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:e=>{this._closedM=e}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:e=>{this._closedN=e}}}]}]}}subWorldDraw(e){const t=[];for(let i=0;i<this._mCount;i++)for(let s=0;s<this._nCount;s++){const r=this.getVertexAtMN(i,s);let a=s+1;if(a>=this._nCount)if(this._closedN)a=0;else continue;const o=this.getVertexAtMN(i,a);t.push(r.position),t.push(o.position)}for(let i=0;i<this._nCount;i++)for(let s=0;s<this._mCount;s++){const r=this.getVertexAtMN(s,i);let a=s+1;if(a>=this._mCount)if(this._closedM)a=0;else continue;const o=this.getVertexAtMN(a,i);t.push(r.position),t.push(o.position)}return e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolygonMesh");let t=16;return this._closedM&&(t|=1),this._closedN&&(t|=32),e.writeInt16(66,1),e.writeInt16(70,t),e.writeInt32(71,this._mCount),e.writeInt32(72,this._nCount),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;i++){const s=this.getVertexAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolygonMeshVertex"),e.writePoint3d(10,s.position),e.writeInt16(70,16)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}};da.typeName="PolygonMesh";let ns=da;class dl{constructor(e){this.position=new w(e.x,e.y,e.z||0)}}class ul{constructor(e){this.vertexIndices=e}}const ua=class ua extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t){super(),this._vertices=e.map(i=>new dl(i)),this._faces=t.map(i=>new ul(i))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}set closed(e){}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getFaceAt(e){if(e<0||e>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[e]}get geometricExtents(){if(this._vertices.length===0)return new Y(new w(0,0,0),new w(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,i=Number.MAX_VALUE,s=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{e=Math.min(e,o.position.x),t=Math.min(t,o.position.y),i=Math.min(i,o.position.z),s=Math.max(s,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new Y(new w(e,t,i),new w(s,r,a))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:this._vertices.forEach(r=>{s.push(r.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),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(e=>({x:e.position.x,y:e.position.y,z:e.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(e=>({vertexIndices:e.vertexIndices}))}}]}]}}subWorldDraw(e){const t=[];return this._faces.forEach(i=>{const s=[];if(i.vertexIndices.forEach(r=>{const a=Math.abs(r)-1;a>=0&&a<this._vertices.length&&s.push(this._vertices[a].position)}),s.length>=3)for(let r=0;r<s.length;r++){const a=s[r],o=s[(r+1)%s.length];t.push(a),t.push(o)}}),e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyFaceMesh");const t=64;return e.writeInt16(66,1),e.writeInt16(70,t),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;i++){const s=this.getVertexAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writePoint3d(10,s.position),e.writeInt16(70,64)}for(let i=0;i<this.numberOfFaces;i++){const s=this.getFaceAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writeInt16(70,128),s.vertexIndices.forEach((r,a)=>{e.writeInt32(10+a,r)})}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}};ua.typeName="PolyFaceMesh";let ss=ua;var rs=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(rs||{});const ga=class ga extends de{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 x(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(e){this._dimBlockPosition.copy(e)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new si),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(e){const t=this._textPosition.clone(),i=this._textPosition.clone().add(new x(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(e),this._textPosition.applyMatrix4(e),this._normal.transformDirection(e),t.applyMatrix4(e),i.applyMatrix4(e);const s=new x(i).sub(t);return s.lengthSq()>0&&(this._textRotation=Math.atan2(s.y,s.x)),this.subTransformBy(e),this}subGetOsnapPoints(e,t,i,s,r){const a=this.getDimBlockTableRecord();if(!a)return;const o=this.getFullDimBlockTransform(),h=new w(t).applyMatrix4(o.clone().invert()),c=new w(i).applyMatrix4(o.clone().invert()),d=(u,p)=>{const g=[];u.subGetOsnapPoints(e,h,c,g,p,o),u instanceof ni?g.forEach(m=>s.push(m.clone())):g.forEach(m=>s.push(new w(m).applyMatrix4(o)))};if(r){const u=a.getIdAt(r);if(u&&(d(u,r),s.length>0))return}for(const u of a.newIterator())d(u)}subWorldDraw(e){const t=this.getDimBlockTableRecord();if(t){const s=this.computeDimBlockTransform();return ri.instance.draw(e,t,this.rgbColor,[],!1,s,this._normal)}return e.group([])}getDimBlockGeometricExtents(){const e=new Y,t=this.getDimBlockTableRecord();if(!t)return e;for(const i of t.newIterator())e.union(i.geometricExtents);return e.applyMatrix4(this.getFullDimBlockTransform()),e}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",e=>{this.dimensionStyleName=e.trim()===""?null:e}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",e=>{this.dimensionText=e}),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,e=>{this.textRotation=e}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,e=>{this.textLineSpacingFactor=e}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,e=>{this.textLineSpacingStyle=e},[{label:rs[1],value:1},{label:rs[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(e,t,i,s,r){return{name:e,type:t,editable:s!=null,options:r,accessor:s?{get:i,set:s}:{get:i}}}createPoint3dProperties(e,t){return[this.createProperty(`${e}X`,"float",()=>t().x,i=>{t().x=i}),this.createProperty(`${e}Y`,"float",()=>t().y,i=>{t().y=i}),this.createProperty(`${e}Z`,"float",()=>t().z,i=>{t().z=i})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const e=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return e;const t=new H().setFromExtrusionDirection(this._normal);return new H().multiplyMatrices(t,e)}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 e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}findPointOnLine1(e,t,i){const s=new w().subVectors(t,e).normalize();return new w(t).addScaledVector(s,i)}findPointOnLine2(e,t,i){const s=e.x+i*Math.cos(t),r=e.y+i*Math.sin(t);return{x:s,y:r}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():xr.Closed}computeDimBlockTransform(){const e=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,t=(e==null?void 0:e.origin)??w.ORIGIN,i=new H().makeTranslation(-t.x,-t.y,-t.z),s=new H().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new H().multiplyMatrices(s,i)}subTransformBy(e){}dxfOutFields(e){super.dxfOutFields(e);const t=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return e.writeSubclassMarker("AcDbDimension"),e.writeInt16(280,0),e.writeString(2,this.dimBlockId??void 0),e.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),e.writePoint3d(10,this.dimBlockPosition),e.writeString(1,this.dimensionText??""),e.writeAngle(53,this.textRotation),e.writePoint3d(11,this.textPosition),e.writeInt16(70,0),e.writeInt16(72,this.textLineSpacingStyle),e.writeDouble(41,this.textLineSpacingFactor),e.writeDouble(42,this.measurement),e.writeVector3d(210,this.normal),e.writeObjectId(340,t==null?void 0:t.objectId),this}};ga.typeName="Dimension";let yt=ga;const pa=class pa extends yt{constructor(e,t,i,s,r=null,a=null){super(),this._centerPoint=new w().copy(e),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(i),this._arcPoint=new w().copy(s),this.dimensionText=r,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.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(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDb3PointAngularDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};pa.typeName="3PointAngularDimension";let as=pa;const ma=class ma extends yt{constructor(e,t,i,s=null,r=null){super(),this._dimLinePoint=new w().copy(i),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(t),this._oblique=0,this._rotation=0,this.calculateRotation(),s?this.dimensionText=s:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=r}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.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,t=>{this.rotation=t}),this.createProperty("oblique","float",()=>this.oblique,t=>{this.oblique=t})]}]}}subTransformBy(e){this._dimLinePoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e),this.calculateRotation()}get geometricExtents(){return this.getDimBlockGeometricExtents()}get isAppendArrow(){return!1}createDimBlock(e){const t=new ie;t.name=e;const i=this.createLines();i.forEach(o=>t.appendEntity(new Ki(o.startPoint,o.endPoint))),this.createArrows(i[0]).forEach(o=>t.appendEntity(o));const r=i[0].midPoint,a=this.createMText(r,this._rotation);return a&&t.appendEntity(a),t}createMText(e,t){const i=s=>({x:Math.cos(s),y:Math.sin(s),z:0});if(this.dimensionText){const s=new Zi;return s.attachmentPoint=z.MiddleLeft,s.layer="0",s.color=new X(P.ByBlock),s.location=e,s.contents=this.dimensionText??"",s.height=10,s.direction=i(t),s.styleName=this.dimensionStyle.dimtxsty,s}}createArrows(e){const t=[];return t.push(this.createArrow(e.startPoint,this.rotation+Math.PI,10)),t.push(this.createArrow(e.endPoint,this.rotation,10)),t}createArrow(e,t,i){const s="_CAXARROW",r=new ni(s);return r.position=e,r.rotation=t,r.scaleFactors={x:i,y:i,z:i},r}createLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),i=this.createExtensionLine(this._xLine2Point),s=this.findIntersectionPoint(t,this._dimLinePoint),r=this.findIntersectionPoint(i,this._dimLinePoint),a=new kt(s,r);return e.push(a),t.endPoint=s,this.adjustExtensionLine(t),e.push(t),i.endPoint=r,this.adjustExtensionLine(i),e.push(i),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,i=this.findPointOnLine2(e,t,100);return new kt(e,{...i,z:e.z})}findIntersectionPoint(e,t){const i=e.startPoint,s=e.endPoint,r=new x().subVectors(s,i).normalize(),o=new x().subVectors(t,i).dot(r),h=new x().copy(r).multiplyScalar(o);return new x().addVectors(i,h)}calculateRotation(){const e=this._xLine1Point,t=this._xLine2Point,i=t.x-e.x,s=t.y-e.y;this._rotation=Math.atan2(s,i)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker(this.dxfSubclassMarker),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.dimLinePoint),e.writeAngle(50,this.rotation),e.writeAngle(52,this.oblique),this}};ma.typeName="AlignedDimension";let en=ma;const ya=class ya extends yt{constructor(e,t,i,s,r=null,a=null){super(),this._arcPoint=new w().copy(s),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(i),this._centerPoint=new w().copy(e),this.dimensionText=r,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.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(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbArcDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};ya.typeName="ArcDimension";let Zs=ya;const _a=class _a extends yt{constructor(e,t,i=0,s=null,r=null){super(),this._chordPoint=new w().copy(e),this._farChordPoint=new w().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=i,this.dimensionText=s,this.dimensionStyleName=r}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._chordPoint.applyMatrix4(e),this._farChordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbDiametricDimension"),e.writePoint3d(15,this.chordPoint),e.writePoint3d(16,this.farChordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};_a.typeName="DiametricDimension";let os=_a;const fa=class fa extends yt{constructor(e,t,i=null,s=null){super(),this._definingPoint=new w().copy(e),this._leaderEndPoint=new w().copy(t),this.dimensionText=i,this.dimensionStyleName=s}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}subTransformBy(e){this._definingPoint.applyMatrix4(e),this._leaderEndPoint.applyMatrix4(e)}get geometricExtents(){return new Y}get arrowLineCount(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbOrdinateDimension"),e.writePoint3d(13,this.definingPoint),e.writePoint3d(14,this.leaderEndPoint),this}};fa.typeName="OrdinateDimension";let ls=fa;const xa=class xa extends yt{constructor(e,t,i,s=null,r=null){super(),this._center=new w().copy(e),this._chordPoint=new w().copy(t),this._leaderLength=i,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=s,this.dimensionStyleName=r}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}set leaderLenght(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._center.applyMatrix4(e),this._chordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRadialDimension"),e.writePoint3d(15,this.center),e.writePoint3d(13,this.chordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};xa.typeName="RadialDimension";let hs=xa;const wa=class wa extends en{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};wa.typeName="RotatedDimension";let cs=wa;var gl=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(gl||{}),pl=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(pl||{}),ml=(n=>(n[n.kDisplay=0]="kDisplay",n[n.kExtents=1]="kExtents",n[n.kLimits=2]="kLimits",n[n.kView=3]="kView",n[n.kWindow=4]="kWindow",n[n.kLayout=5]="kLayout",n))(ml||{}),Lt=(n=>(n[n.kDraft=0]="kDraft",n[n.kPreview=1]="kPreview",n[n.kNormal=2]="kNormal",n[n.kPresentation=3]="kPresentation",n[n.kMaximum=4]="kMaximum",n[n.kCustom=5]="kCustom",n))(Lt||{}),ci=(n=>(n[n.kAsDisplayed=0]="kAsDisplayed",n[n.kWireframe=1]="kWireframe",n[n.kHidden=2]="kHidden",n[n.kRendered=3]="kRendered",n[n.kVisualStyle=4]="kVisualStyle",n[n.kRenderPreset=5]="kRenderPreset",n))(ci||{}),yl=(n=>(n[n.kScaleToFit=0]="kScaleToFit",n[n.k1_128in_1ft=1]="k1_128in_1ft",n[n.k1_64in_1ft=2]="k1_64in_1ft",n[n.k1_32in_1ft=3]="k1_32in_1ft",n[n.k1_16in_1ft=4]="k1_16in_1ft",n[n.k3_32in_1ft=5]="k3_32in_1ft",n[n.k1_8in_1ft=6]="k1_8in_1ft",n[n.k3_16in_1ft=7]="k3_16in_1ft",n[n.k1_4in_1ft=8]="k1_4in_1ft",n[n.k3_8in_1ft=9]="k3_8in_1ft",n[n.k1_2in_1ft=10]="k1_2in_1ft",n[n.k3_4in_1ft=11]="k3_4in_1ft",n[n.k1in_1ft=12]="k1in_1ft",n[n.k3in_1ft=13]="k3in_1ft",n[n.k6in_1ft=14]="k6in_1ft",n[n.k1ft_1ft=15]="k1ft_1ft",n[n.k1_1=16]="k1_1",n[n.k1_2=17]="k1_2",n[n.k1_4=18]="k1_4",n[n.k1_5=19]="k1_5",n[n.k1_8=20]="k1_8",n[n.k1_10=21]="k1_10",n[n.k1_16=22]="k1_16",n[n.k1_20=23]="k1_20",n[n.k1_30=24]="k1_30",n[n.k1_40=25]="k1_40",n[n.k1_50=26]="k1_50",n[n.k1_100=27]="k1_100",n[n.k2_1=28]="k2_1",n[n.k4_1=29]="k4_1",n[n.k8_1=30]="k8_1",n[n.k10_1=31]="k10_1",n[n.k100_1=32]="k100_1",n[n.k1000_1=33]="k1000_1",n[n.k1and1_2in_1ft=34]="k1and1_2in_1ft",n))(yl||{});const ed={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 _l extends De{constructor(e=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new v,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new v,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new xe,this._modelType=e,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(e){this._plotSettingsName=e}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(e){this._plotSettingsName=e}get plotCfgName(){return this._plotCfgName}set plotCfgName(e){this._plotCfgName=e}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(e){this._canonicalMediaName=e}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(e){this._currentStyleSheet=e}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(e){this._plotOrigin=e}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(e){this._customPrintScale=e}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(e){this._plotPaperSize=e}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(e){this._plotPaperMargins=e}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(e){this._plotViewName=e}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(e){this._plotWindowArea=e}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(e){this._modelType=e}getModelType(){return this._modelType}setModelType(e){this._modelType=e}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(e){this._drawViewportsFirst=e}setDrawViewportsFirst(e){this._drawViewportsFirst=e}get plotCentered(){return this._plotCentered}set plotCentered(e){this._plotCentered=e}setPlotCentered(e){this._plotCentered=e}get plotHidden(){return this._plotHidden}set plotHidden(e){this._plotHidden=e}setPlotHidden(e){this._plotHidden=e}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(e){this._plotPaperUnits=e}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(e){this._plotPlotStyles=e}setPlotPlotStyles(e){this._plotPlotStyles=e}get plotRotation(){return this._plotRotation}set plotRotation(e){this._plotRotation=e}get plotType(){return this._plotType}set plotType(e){this._plotType=e}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(e){this._plotViewportBorders=e}setPlotViewportBorders(e){this._plotViewportBorders=e}get printLineweights(){return this._printLineweights}set printLineweights(e){this._printLineweights=e}setPrintLineweights(e){this._printLineweights=e}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(e){this._scaleLineweights=e}setScaleLineweights(e){this._scaleLineweights=e}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(e){this._showPlotStyles=e}setShowPlotStyles(e){this._showPlotStyles=e}get shadePlot(){return this._shadePlotType}set shadePlot(e){this._shadePlotType=e}setShadePlot(e){this._shadePlotType=e}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(e){this._shadePlotResLevel=e}setShadePlotResLevel(e){this._shadePlotResLevel=e}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(e){this._shadePlotCustomDpi=e}setShadePlotCustomDPI(e){this._shadePlotCustomDpi=e}get shadePlotId(){return this._shadePlotId}set shadePlotId(e){this._shadePlotId=e}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(e){this._stdScaleType=e}get stdScale(){return ed[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(e){this._useStandardScale=e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPlotSettings"),e.writeString(1,this.plotSettingsName),e.writeString(2,this.plotCfgName),e.writeString(4,this.canonicalMediaName),e.writeString(6,this.plotViewName),e.writeDouble(40,this.plotPaperMargins.left),e.writeDouble(41,this.plotPaperMargins.bottom),e.writeDouble(42,this.plotPaperMargins.right),e.writeDouble(43,this.plotPaperMargins.top),e.writeDouble(44,this.plotPaperSize.x),e.writeDouble(45,this.plotPaperSize.y),e.writeDouble(46,this.plotOrigin.x),e.writeDouble(47,this.plotOrigin.y),e.writeDouble(48,this.plotWindowArea.min.x),e.writeDouble(49,this.plotWindowArea.min.y),e.writeDouble(140,this.plotWindowArea.max.x),e.writeDouble(141,this.plotWindowArea.max.y),e.writeDouble(142,this.customPrintScale.numerator),e.writeDouble(143,this.customPrintScale.denominator);let t=0;return this.plotViewportBorders&&(t|=1),this.showPlotStyles&&(t|=2),this.plotCentered&&(t|=4),this.plotHidden&&(t|=8),this.useStandardScale&&(t|=16),this.plotPlotStyles&&(t|=32),this.scaleLineweights&&(t|=64),this.printLineweights&&(t|=128),this.drawViewportsFirst&&(t|=512),this.modelType&&(t|=1024),e.writeInt16(70,t),e.writeInt16(72,this.plotPaperUnits),e.writeInt16(73,this.plotRotation),e.writeInt16(74,this.plotType),e.writeString(7,this.currentStyleSheet),e.writeInt16(75,this.stdScaleType),e.writeInt16(76,this.shadePlot),e.writeInt16(77,this.shadePlotResLevel),e.writeInt16(78,this.shadePlotCustomDPI),e.writeDouble(147,this.stdScale),e.writeObjectId(333,this.shadePlotId),this}}class on extends _l{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new xe,this._extents=new Y,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}get viewportArray(){return this._viewportArray}set viewportArray(e){this._viewportArray=e.slice()}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayout"),e.writeString(1,this.layoutName),e.writeInt16(70,this.tabSelected?1:0),e.writeInt16(71,this.tabOrder),e.writeObjectId(330,this.blockTableRecordId),e.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),e.writePoint2d(10,this.limits.min),e.writePoint2d(11,this.limits.max),e.writePoint3d(14,this.extents.min),e.writePoint3d(15,this.extents.max),this}}class ln{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.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 e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}class Jt extends De{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,i=>this.hasId(i)),this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((i,s)=>{i===t&&(this._recordsByName.delete(s),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:s}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new ln(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbDictionary"),e.writeInt16(280,1),e.writeInt16(281,1);for(const[t,i]of this._recordsByName)e.writeString(3,t),e.writeObjectId(350,i.objectId);return this}}class fl extends Jt{getBtrIdAt(e){for(const[t,i]of this._recordsByName)if(i.blockTableRecordId==e)return i}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class vt extends De{constructor(e,t){e=e||{},tn(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var xl=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(xl||{});const St=class St extends vt{static isModelSapceName(e){return e.toLowerCase()==St.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(St.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 St.isModelSapceName(this.name)}get isPaperSapce(){return St.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(e){this._blockInsertUnits=e}get explodability(){return this._explodability}set explodability(e){this._explodability=e}get blockScaling(){return this._blockScaling}set blockScaling(e){this._blockScaling=e}get bmpPreview(){return this._bmpPreview}set bmpPreview(e){this._bmpPreview=e}appendEntity(e){const t=i=>{i.database=this.database,i.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(i),this.database.commitObjectHandle(i,s=>this._entities.has(s)),i.resolveEffectiveProperties(),this._entities.set(i.objectId,i)};if(Array.isArray(e))for(let i=0;i<e.length;++i)t(e[i]);else t(e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}removeEntity(e){const t=Array.isArray(e)?e:[e],i=[];return t.forEach(s=>{const r=this._entities.get(s);r&&i.push(r),this._entities.delete(s)}),i.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:i}),i.length>0}newIterator(){return new ln(this._entities)}getIdAt(e){return this._entities.get(e)}dxfOutBlockRecord(e){return e.writeStart("BLOCK_RECORD"),this.dxfOut(e),this}dxfOutBlockBegin(e){return e.writeStart("BLOCK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeString(8,"0"),e.writeSubclassMarker("AcDbBlockBegin"),e.writeString(2,this.name),e.writeInt16(70,0),e.writePoint3d(10,this.origin),e.writeString(3,this.name),this}dxfOutBlockEnd(e){return e.writeStart("ENDBLK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.blockInsertUnits),e.writeInt16(280,this.explodability),e.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&e.writeObjectId(340,this.layoutId),this}};St.MODEL_SPACE_NAME="*Model_Space",St.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let ie=St;class wl{constructor(){this.events={layoutCreated:new te,layoutRemoved:new te,layoutRenamed:new te,layoutSwitched:new te}}countLayouts(e){return this.getWorkingDatabase(e).objects.layout.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).objects.layout.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const i=this.getWorkingDatabase(t),s=i.objects.layout.getIdAt(e);return this.setCurrentLayoutInternal(s,i)}setCurrentLayoutBtrId(e,t){const i=this.getWorkingDatabase(t),s=i.objects.layout.getBtrIdAt(e);return this.setCurrentLayoutInternal(s,i)}setCurrentLayout(e,t){const i=this.getWorkingDatabase(t),s=i.objects.layout.getAt(e);return this.setCurrentLayoutInternal(s,i)}renameLayout(e,t,i){const r=this.getWorkingDatabase(i).objects.layout.getAt(e);return r?(r.layoutName=t,this.events.layoutRenamed.dispatch({layout:r,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).objects.layout.has(e)}deleteLayout(e,t){const i=this.getWorkingDatabase(t).objects.layout,s=i.getAt(e);let r=!1;return s&&(r=i.remove(e),r&&this.events.layoutRemoved.dispatch({layout:s})),r}createLayout(e,t){const i=this.getWorkingDatabase(t),s=new on;s.layoutName=e,s.tabOrder=i.objects.layout.maxTabOrder;const r=new ie;return r.name=`*Paper_Space${s.tabOrder}`,i.tables.blockTable.add(r),i.objects.layout.setAt(e,s),this.events.layoutCreated.dispatch({layout:s}),{layout:s,btr:r}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.objects.layout.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||nr().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}ro(()=>new wl);class Ar extends De{constructor(){super(),this._contentType=2,this._drawMLeaderOrderType=1,this._drawLeaderOrderType=0,this._bitFlags=0,this._maxLeaderSegmentsPoints=-1,this._firstSegmentAngleConstraint=0,this._secondSegmentAngleConstraint=0,this._leaderLineType=1,this._leaderLineColor=new X(P.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new X(P.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new X(P.ByBlock),this._blockScale=new x(1,1,1),this._enableBlockScale=!0,this._blockRotation=0,this._enableBlockRotation=!1,this._blockConnectionType=0,this._scale=1,this._overwritePropChanged=!1,this._annotative=!1,this._breakSize=0,this._textAttachmentDirection=0,this._bottomTextAttachmentType=9,this._topTextAttachmentType=9,this._extendLeaderToText=!1}get unknown1(){return this._unknown1}set unknown1(e){this._unknown1=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(e){this._drawMLeaderOrderType=e}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(e){this._drawLeaderOrderType=e}get bitFlags(){return this._bitFlags}set bitFlags(e){this._bitFlags=e}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(e){this._maxLeaderSegmentsPoints=e}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(e){this.maxLeaderSegmentsPoints=e}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(e){this._firstSegmentAngleConstraint=e}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(e){this._secondSegmentAngleConstraint=e}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor.copy(e)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get enableLanding(){return this._enableLanding}set enableLanding(e){this._enableLanding=e}get landingEnabled(){return this.enableLanding}set landingEnabled(e){this.enableLanding=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get enableDogleg(){return this._enableDogleg}set enableDogleg(e){this._enableDogleg=e}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(e){this.enableDogleg=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get description(){return this._description}set description(e){this._description=e}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(e){this._arrowSymbolId=e}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(e){this.arrowSymbolId=e}get arrowSize(){return this._arrowSize}set arrowSize(e){this._arrowSize=e}get arrowheadSize(){return this.arrowSize}set arrowheadSize(e){this.arrowSize=e}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(e){this._defaultMTextContents=e}get defaultMText(){return this.defaultMTextContents}set defaultMText(e){this.defaultMTextContents=e}get textString(){return this.defaultMTextContents}set textString(e){this.defaultMTextContents=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textStyle(){return this.textStyleId}set textStyle(e){this.textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor.copy(e)}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get enableFrameText(){return this._enableFrameText}set enableFrameText(e){this._enableFrameText=e}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(e){this.enableFrameText=e}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(e){this._textAlignAlwaysLeft=e}get alignSpace(){return this._alignSpace}set alignSpace(e){this._alignSpace=e}get blockId(){return this._blockId}set blockId(e){this._blockId=e}get blockContentId(){return this.blockId}set blockContentId(e){this.blockId=e}get blockColor(){return this._blockColor}set blockColor(e){this._blockColor.copy(e)}get blockContentColor(){return this.blockColor}set blockContentColor(e){this.blockColor=e}get blockScale(){return this._blockScale.clone()}set blockScale(e){this._blockScale.copy(e)}get blockContentScale(){return this.blockScale}set blockContentScale(e){this.blockScale=e}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(e){this._enableBlockScale=e}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(e){this.enableBlockScale=e}get blockRotation(){return this._blockRotation}set blockRotation(e){this._blockRotation=e}get blockContentRotation(){return this.blockRotation}set blockContentRotation(e){this.blockRotation=e}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(e){this._enableBlockRotation=e}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(e){this.enableBlockRotation=e}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(e){this._blockConnectionType=e}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(e){this.blockConnectionType=e}get scale(){return this._scale}set scale(e){this._scale=e}get scaleFactor(){return this.scale}set scaleFactor(e){this.scale=e}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(e){this._overwritePropChanged=e}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(e){this.overwritePropChanged=e}get annotative(){return this._annotative}set annotative(e){this._annotative=e}get breakSize(){return this._breakSize}set breakSize(e){this._breakSize=e}get breakGapSize(){return this.breakSize}set breakGapSize(e){this.breakSize=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(e){this._bottomTextAttachmentType=e}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(e){this.bottomTextAttachmentType=e}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(e){this._topTextAttachmentType=e}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(e){this.topTextAttachmentType=e}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(e){this._extendLeaderToText=e}get unknown2(){return this._unknown2}set unknown2(e){this._unknown2=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeaderStyle"),e.writeInt16(179,this.unknown1),e.writeInt16(170,this.contentType),e.writeInt16(171,this.drawMLeaderOrderType),e.writeInt16(172,this.drawLeaderOrderType),e.writeInt32(90,this.maxLeaderSegmentsPoints),e.writeDouble(40,this.firstSegmentAngleConstraint),e.writeDouble(41,this.secondSegmentAngleConstraint),e.writeInt16(173,this.leaderLineType),e.writeInt32(91,kn(this.leaderLineColor)),e.writeHandle(340,this.leaderLineTypeId),e.writeInt32(92,this.leaderLineWeight),e.writeBoolean(290,this.enableLanding),e.writeDouble(42,this.landingGap),e.writeBoolean(291,this.enableDogleg),e.writeDouble(43,this.doglegLength),e.writeString(3,this.description),e.writeHandle(341,this.arrowSymbolId),e.writeDouble(44,this.arrowSize),e.writeString(300,this.defaultMTextContents),e.writeHandle(342,this.textStyleId),e.writeInt16(174,this.textLeftAttachmentType),e.writeInt16(175,this.textAngleType),e.writeInt16(176,this.textAlignmentType),e.writeInt16(178,this.textRightAttachmentType),e.writeInt32(93,kn(this.textColor)),e.writeDouble(45,this.textHeight),e.writeBoolean(292,this.enableFrameText),e.writeBoolean(297,this.textAlignAlwaysLeft),e.writeDouble(46,this.alignSpace),e.writeHandle(343,this.blockId),e.writeInt32(94,kn(this.blockColor)),e.writeDouble(47,this._blockScale.x),e.writeDouble(49,this._blockScale.y),e.writeDouble(140,this._blockScale.z),e.writeBoolean(293,this.enableBlockScale),e.writeDouble(141,this.blockRotation),e.writeBoolean(294,this.enableBlockRotation),e.writeInt16(177,this.blockConnectionType),e.writeDouble(142,this.scale),e.writeBoolean(295,this.overwritePropChanged),e.writeBoolean(296,this.annotative),e.writeDouble(143,this.breakSize),e.writeInt16(271,this.textAttachmentDirection),e.writeInt16(272,this.bottomTextAttachmentType),e.writeInt16(273,this.topTextAttachmentType),e.writeBoolean(298,this.unknown2),this}}class Ir extends De{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new X,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get flags(){return this._flags}set flags(e){this._flags=e}get description(){return this._description}set description(e){this._description=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor.copy(e)}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=e}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=e}get elementCount(){return this._elements.length}get elements(){return this._elements.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}set elements(e){this._elements=e.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}addElement(e){this._elements.push({offset:e.offset,color:e.color.clone(),lineType:e.lineType})}removeElementAt(e){if(e<0||e>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(e,1)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMlineStyle"),e.writeString(2,this.styleName),e.writeInt16(70,this.flags),e.writeString(3,this.description),e.writeCmColor(this.fillColor),e.writeDouble(51,this.startAngle),e.writeDouble(52,this.endAngle),e.writeInt16(71,this.elementCount),this._elements.forEach(t=>{e.writeDouble(49,t.offset),e.writeCmColor(t.color),e.writeString(6,t.lineType)}),this}}class bl extends De{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImageDef"),e.writeString(1,this.sourceFileName),e.writeInt16(280,1),e.writeInt16(281,0),this}}var Ll=(n=>(n[n.NotApplicable=0]="NotApplicable",n[n.Ignore=1]="Ignore",n[n.Replace=2]="Replace",n[n.XrefMangleName=3]="XrefMangleName",n[n.MangleName=4]="MangleName",n))(Ll||{});class td extends De{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(e){this._data=e}clear(){var e;(e=this._data)==null||e.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXrecord"),e.writeInt16(280,1),e.writeResultBuffer(this.data),this}}class Sl{constructor(e){this.db=e}createDefaultLayer(){const e=new X;return e.colorIndex=7,this.db.tables.layerTable.add(new _s({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new Et({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Et({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Et({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new fs({name:Q,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new si({name:Q,dimtxsty:Q}))}createDefaultLayout(){const e=new on;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=this.db.tables.blockTable.modelSpace.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.db.objects.layout.setAt(e.layoutName,e),this.db.tables.blockTable.modelSpace.layoutId=e.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const t=new qi;t.patternName=ti;const i=new $i;i.add(new Ge({x:0,y:0},{x:-1,y:.125})),i.add(new Ge({x:-1,y:.125},{x:-1,y:-.125})),i.add(new Ge({x:-1,y:-.125},{x:0,y:0})),t.add(i);const s=new ie;s.name="_CAXARROW",s.appendEntity(t),this.db.tables.blockTable.add(s)}}}var Al=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(Al||{});const Pr=192,ds=193,Er=194,Tr=195,Il=200;function kn(n){if(n.isByBlock)return ds<<24>>0;if(n.isByLayer)return Pr<<24>>0;const e=n.colorIndex;if(e!=null&&e>0&&e<256)return(Tr<<24|e&255)>>0;const t=n.RGB;return t!=null?(Er<<24|t&16777215)>>0:ds<<24>>0}function zi(n){const e=new X(P.ByBlock);switch(n>>>24&255){case Pr:e.setByLayer();break;case ds:case Il:e.setByBlock();break;case Tr:e.colorIndex=n&255;break;case Er:e.setRGBValue(n&16777215);break;default:n>=0&&n<=256&&(e.colorIndex=n);break}return e}var Mr=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(Mr||{});function id(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function nd(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}class kr{parse(e){const i=this.normalizeLineEndings(e).split(`
5
- `),s=[],r=[];let a=null;return i.forEach((o,h)=>{const c=h+1,d=this.stripInlineComment(o).trim();if(!d)return;if(d.startsWith("*")){this.flushCurrentPattern(a,s,r);const p=this.parseHeader(d.slice(1));if(!p){r.push({line:c,message:"Invalid pattern header.",source:o}),a=null;return}a={pattern:{name:p.name,description:p.description,lines:[]},headerLine:c};return}if(!a){r.push({line:c,message:"Line descriptor appears before any pattern header.",source:o});return}const u=this.parseLineDescriptor(d,c);if(!u){r.push({line:c,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:o});return}a.pattern.lines.push(u)}),this.flushCurrentPattern(a,s,r),{patterns:s,issues:r}}static parse(e){return new kr().parse(e)}normalizeLineEndings(e){return e.replace(/\r\n/g,`
3
+ `}registerHandle(e){return this._handleMap.has(e)||(/^[0-9A-F]+$/i.test(e)?this._handleMap.set(e,e.toUpperCase()):(this._handleMap.set(e,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(e)}resolveHandle(e){if(e)return this.registerHandle(e)}writeGroup(e,t){if(t==null)return this;this._lines.push(String(Math.trunc(e)));const i=this.formatValue(t);return this._lines.push(i===""?"0":i),this}writeStart(e){return this.writeString(0,e)}writeSubclassMarker(e){return this.writeString(100,e)}writeString(e,t){return!t&&t!==""?this:this.writeGroup(e,t)}writeInt8(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt16(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt32(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeInt64(e,t){return t==null?this:this.writeGroup(e,Math.trunc(t))}writeUInt16(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeUInt32(e,t){return t==null?this:this.writeGroup(e,Math.max(0,t))}writeBoolean(e,t){return t==null?this:this.writeGroup(e,t?1:0)}writeBool(e,t){return this.writeBoolean(e,t)}writeDouble(e,t){return t==null||!Number.isFinite(t)?this:this.writeGroup(e,t)}writeAngle(e,t){return t==null||!Number.isFinite(t)?this:this.writeDouble(e,t*180/Math.PI)}writeHandle(e,t){const i=this.resolveHandle(t);return i?this.writeString(e,i):this}writeObjectId(e,t){return this.writeHandle(e,t)}writePoint2d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this):this}writePoint3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeVector3d(e,t){return t?(this.writeDouble(e,t.x),this.writeDouble(e+10,t.y),this.writeDouble(e+20,t.z??0),this):this}writeCmColor(e,t=62,i=420){if(!e)return this;const s=e.colorIndex;s!=null&&this.writeInt16(t,s);const r=e.RGB;return r!=null&&e.colorIndex==null&&this.writeInt32(i,r),this}writeTransparency(e,t=440){return!e||e.method===he.ErrorValue?this:this.writeInt32(t,e.serialize())}writeResultBuffer(e){if(!e)return this;for(const t of e)this.writeGroup(t.code,t.value);return this}startSection(e){return this.writeStart("SECTION"),this.writeString(2,e),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(e){return this.writeStart("TABLE"),this.writeString(2,e),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(e){if(typeof e=="string")return this.sanitizeStringForDxfLine(e);if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number"){if(!Number.isFinite(e))return"0";if(Number.isInteger(e))return String(e);const i=e.toFixed(this._precision).replace(/\.?0+$/,"");return i===""||i==="-"?"0":i}return String(e)}sanitizeStringForDxfLine(e){return e.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var ei=256,ro=[],Ia=256,fn;for(;ei--;)ro[ei]=(ei+256).toString(16).substring(1);function Sc(n){var e=0,t=11;if(!fn||ei+t>Ia*2)for(fn="",ei=0;e<Ia;e++)fn+=ro[Math.random()*256|0];return fn.substring(ei,ei+++t)}const Tn="TEMP_";let Ds;function ao(n){Ds=n}class De{constructor(e,t){if(e=e||{},this._attrs=new Qa(e,t),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 Tn+Sc()}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e),e&&!e.startsWith(Tn)&&this.database.updateMaxHandle(e)}get isTemp(){const e=this.getAttrWithoutException("objectId");return!!e&&e.startsWith(Tn)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(e){this._attrs.set("extensionDictionary",e)}get database(){if(this._database)return this._database;if(Ds)return Ds().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(e){this._database=e}getXData(e){return this._xDataMap.get(e)}setXData(e){for(const t of e)t.code===rr.ExtendedDataRegAppName&&this._xDataMap.set(t.value,e)}removeXData(e){this._xDataMap.delete(e)}createExtensionDictionary(){}close(){}clone(){const e=Object.create(Object.getPrototypeOf(this)),t=this,i=e;for(const s of Object.keys(t))s!=="_database"&&(i[s]=this.cloneValue(t[s]));return e.objectId=this.generateTemporaryHandle(),e}cloneValue(e){if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(Array.isArray(e))return e.map(s=>this.cloneValue(s));if(e instanceof Map){const s=new Map;for(const[r,a]of e.entries())s.set(this.cloneValue(r),this.cloneValue(a));return s}if(e instanceof Set){const s=new Set;for(const r of e.values())s.add(this.cloneValue(r));return s}if(ArrayBuffer.isView(e)){if(e instanceof DataView)return new DataView(e.buffer.slice(0));const s=e.constructor;return new s(e)}if(e instanceof ArrayBuffer)return e.slice(0);if("clone"in e&&typeof e.clone=="function")return e.clone();const t=Object.create(Object.getPrototypeOf(e)),i=e;for(const s of Object.keys(i))t[s]=this.cloneValue(i[s]);return t}dxfOut(...e){const[t,i=!1]=e;if(t.writeHandle(5,this.objectId),t.writeObjectId(330,this.ownerId),t.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(t),i)for(const s of this._xDataMap.values())t.writeResultBuffer(s);return this}dxfOutFields(e){return this}}let Vs;function oo(n){Vs=n}function or(){return Bn.instance}const ps=class ps{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(e){this._workingDatabase=e}get layoutManager(){if(!this._layoutManager){if(!Vs)throw new Error("The layout manager factory must be registered before using it!");this._layoutManager=Vs()}return this._layoutManager}};ps.instance=new ps;let Bn=ps;ao(or);var lo=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(lo||{});class lr{constructor(e){if(this._values=[],e)for(const t of e)this._values.push({...t})}get length(){return this._values.length}at(e){return this._values[e]}add(e){this._values.push(e)}addRange(e){for(const t of e)this._values.push(t)}clear(){this._values.length=0}toArray(){return this._values.map(e=>({...e}))}clone(){return new lr(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class hr{constructor(e,t,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=i,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,i)=>{const s=()=>{Promise.resolve(e()).then(t).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(s):setTimeout(s,0)})}async processChunk(e,t){if(this._count<=0){await(t==null?void 0:t());return}let i=0;const s=async()=>{const r=i,a=Math.min(i+this._chunkSize,this._count);await e(r,a),i=a,i<this._count&&await this.scheduleTask(s)};await s(),await(t==null?void 0:t())}}var Ri=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Ri||{});class je{constructor(){this.events={registered:new te,unregistered:new te},this._converters=new Map,this.register("dxf",new cc)}static createInstance(){return je._instance==null&&(je._instance=new je),this._instance}static get instance(){return je._instance||(je._instance=new je),je._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}var _s=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(_s||{}),Wi=(n=>(n[n.Scientific=1]="Scientific",n[n.Decimal=2]="Decimal",n[n.Engineering=3]="Engineering",n[n.Architectural=4]="Architectural",n[n.Fractional=5]="Fractional",n[n.WindowsDesktop=6]="WindowsDesktop",n))(Wi||{});class ri{static get instance(){return this._instance||(this._instance=new ri),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,i,s=[],r=!0,a,o){const h=[];if(t!=null){const c=this.createKey(t.name,i);let d;if(this.has(c))d=this.get(c);else{const u=t.newIterator();for(const p of u)p.color.isByBlock&&i?(Pa.copy(p.color),p.color.setRGBValue(i),this.addEntity(p,h,e),p.color.copy(Pa)):this.addEntity(p,h,e);d=e.group(h),d&&r&&ie.name&&!ie.name.startsWith("*U")&&this.set(c,d)}return d&&a&&(d.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),d.applyMatrix(a))),d&&s&&s.length>0&&(d.bakeTransformToChildren(),s.forEach(u=>d.addChild(u))),d}else return e.group(h)}addEntity(e,t,i){const s=e.worldDraw(i);s&&(this.attachEntityInfo(s,e),t.push(s))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const Pa=new X;var cr=(n=>(n[n.UTF8=0]="UTF8",n[n.US_ASCII=1]="US_ASCII",n[n.ISO_8859_1=2]="ISO_8859_1",n[n.ISO_8859_2=3]="ISO_8859_2",n[n.ISO_8859_3=4]="ISO_8859_3",n[n.ISO_8859_4=5]="ISO_8859_4",n[n.ISO_8859_5=6]="ISO_8859_5",n[n.ISO_8859_6=7]="ISO_8859_6",n[n.ISO_8859_7=8]="ISO_8859_7",n[n.ISO_8859_8=9]="ISO_8859_8",n[n.ISO_8859_9=10]="ISO_8859_9",n[n.CP437=11]="CP437",n[n.CP850=12]="CP850",n[n.CP852=13]="CP852",n[n.CP855=14]="CP855",n[n.CP857=15]="CP857",n[n.CP860=16]="CP860",n[n.CP861=17]="CP861",n[n.CP863=18]="CP863",n[n.CP864=19]="CP864",n[n.CP865=20]="CP865",n[n.CP869=21]="CP869",n[n.CP932=22]="CP932",n[n.MACINTOSH=23]="MACINTOSH",n[n.BIG5=24]="BIG5",n[n.CP949=25]="CP949",n[n.JOHAB=26]="JOHAB",n[n.CP866=27]="CP866",n[n.ANSI_1250=28]="ANSI_1250",n[n.ANSI_1251=29]="ANSI_1251",n[n.ANSI_1252=30]="ANSI_1252",n[n.GB2312=31]="GB2312",n[n.ANSI_1253=32]="ANSI_1253",n[n.ANSI_1254=33]="ANSI_1254",n[n.ANSI_1255=34]="ANSI_1255",n[n.ANSI_1256=35]="ANSI_1256",n[n.ANSI_1257=36]="ANSI_1257",n[n.ANSI_874=37]="ANSI_874",n[n.ANSI_932=38]="ANSI_932",n[n.ANSI_936=39]="ANSI_936",n[n.ANSI_949=40]="ANSI_949",n[n.ANSI_950=41]="ANSI_950",n[n.ANSI_1361=42]="ANSI_1361",n[n.UTF16=43]="UTF16",n[n.ANSI_1258=44]="ANSI_1258",n[n.UNDEFINED=255]="UNDEFINED",n))(cr||{});const Ac=["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"],ho=n=>Ac[n],It="Continuous",Q="Standard",gt="Standard",pt="Standard",Ic="ANSI31",co="ANGLE",ti="SOLID",uo="USER",go="LINEAR",pe="ByLayer",At="ByBlock",zs="mlightcad",js="ACAD",Hs=Object.freeze({x:0,y:0}),po=Object.freeze({x:0,y:0}),mo=Object.freeze({x:1,y:1}),yo=Object.freeze({x:0,y:0,z:1}),_o=Object.freeze({x:0,y:0,z:0}),ge=["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 Ea=1234567;const dr=Math.PI/180,ur=180/Math.PI;function fo(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(ge[n&255]+ge[n>>8&255]+ge[n>>16&255]+ge[n>>24&255]+"-"+ge[e&255]+ge[e>>8&255]+"-"+ge[e>>16&15|64]+ge[e>>24&255]+"-"+ge[t&63|128]+ge[t>>8&255]+"-"+ge[t>>16&255]+ge[t>>24&255]+ge[i&255]+ge[i>>8&255]+ge[i>>16&255]+ge[i>>24&255]).toLowerCase()}function ut(n,e,t){return Math.max(e,Math.min(t,n))}function gr(n,e){return(n%e+e)%e}function xo(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function wo(n,e,t){return n!==e?(t-n)/(e-n):0}function pr(n,e,t){return(1-t)*n+t*e}function bo(n,e,t,i){return pr(n,e,1-Math.exp(-t*i))}function Lo(n,e=1){return e-Math.abs(gr(n,e*2)-e)}function So(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Ao(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Io(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Po(n,e){return n+Math.random()*(e-n)}function Eo(n){return n*(.5-Math.random())}function To(n){n!==void 0&&(Ea=n);let e=Ea+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Mo(n){return n*dr}function ko(n){return n*ur}function Co(n){return(n&n-1)===0&&n!==0}function vo(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function No(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Bi(n){const e=Math.PI*2;return(n%e+e)%e}function Oo(n,e,t){return n>e&&n<t||n>t&&n<e}function Yo(n,e,t,i=!1){return n=Bi(n),e=Bi(e),t=Bi(t),i?e>t?n<=e&&n>=t:n<=e||n>=t:e<t?n>=e&&n<=t:n>=e||n<=t}function mr(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Xo(n,e=1e-7){const t=mr(n);return Math.max(Math.pow(10,t)*e,e)}const k={DEG2RAD:dr,RAD2DEG:ur,generateUUID:fo,clamp:ut,euclideanModulo:gr,mapLinear:xo,inverseLerp:wo,lerp:pr,damp:bo,pingpong:Lo,smoothstep:So,smootherstep:Ao,randInt:Io,randFloat:Po,randFloatSpread:Eo,seededRandom:To,degToRad:Mo,radToDeg:ko,isPowerOfTwo:Co,ceilPowerOfTwo:vo,floorPowerOfTwo:No,normalizeAngle:Bi,isBetween:Oo,isBetweenAngle:Yo,intPartLength:mr,relativeEps:Xo},Ws=class Ro{constructor(e,t){this.x=0,this.y=0;const i=+(e!==void 0)+ +(t!==void 0);if(i!==0){if(i===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(i===1){const{x:s,y:r}=e;this.x=s,this.y=r;return}if(i===2){this.x=e,this.y=t;return}throw be.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new Ro(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix2d(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*s+e.x,this.y=r*s+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(k.relativeEps(this.x,e),k.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};Ws.EMPTY=Object.freeze(new Ws(0,0));let K=Ws;const Gs=class Bo{constructor(e,t,i,s,r,a,o,h,c){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&i!=null&&s!=null&&r!=null&&a!=null&&o!=null&&h!=null&&c!=null&&this.set(e,t,i,s,r,a,o,h,c)}set(e,t,i,s,r,a,o,h,c){const d=this.elements;return d[0]=e,d[1]=s,d[2]=o,d[3]=t,d[4]=r,d[5]=h,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,a=i[0],o=i[3],h=i[6],c=i[1],d=i[4],u=i[7],p=i[2],g=i[5],m=i[8],y=s[0],_=s[3],f=s[6],S=s[1],L=s[4],M=s[7],I=s[2],W=s[5],C=s[8];return r[0]=a*y+o*S+h*I,r[3]=a*_+o*L+h*W,r[6]=a*f+o*M+h*C,r[1]=c*y+d*S+u*I,r[4]=c*_+d*L+u*W,r[7]=c*f+d*M+u*C,r[2]=p*y+g*S+m*I,r[5]=p*_+g*L+m*W,r[8]=p*f+g*M+m*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*r*d+i*o*h+s*r*c-s*a*h}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8],u=d*a-o*c,p=o*h-d*r,g=c*r-a*h,m=t*u+i*p+s*g;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=u*y,e[1]=(s*c-d*i)*y,e[2]=(o*i-s*a)*y,e[3]=p*y,e[4]=(d*t-s*h)*y,e[5]=(s*r-o*t)*y,e[6]=g*y,e[7]=(i*h-c*t)*y,e[8]=(a*t-i*r)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this}setUvTransform(e,t,i,s,r,a,o){const h=Math.cos(r),c=Math.sin(r);return this.set(i*h,i*c,-i*(h*a+c*o)+a+e,-s*c,s*h,-s*(-c*a+h*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(As.makeScale(e,t)),this}rotate(e){return this.premultiply(As.makeRotation(-e)),this}translate(e,t){return this.premultiply(As.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof K?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new Bo().fromArray(this.elements)}};Gs.IDENTITY=Object.freeze(new Gs);let sn=Gs;const As=new sn,Qt=1e-6,G=2*Math.PI,Pc={x:0,y:0},yr={x:0,y:0,z:0};class rn{constructor(){this.equalPointTol=Qt,this.equalVectorTol=Qt}clone(){const e=new rn;return e.equalPointTol=this.equalPointTol,e.equalVectorTol=this.equalVectorTol,e}equalPoint2d(e,t){return new K(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new x(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=Qt){return e<t&&e>-t}static equal(e,t,i=Qt){return Math.abs(e-t)<i}static great(e,t,i=Qt){return e-t>i}static less(e,t,i=Qt){return e-t<i}}const _r=new rn;class ai{constructor(e=0,t=0,i=0,s=1){this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,a,o){let h=i[s+0],c=i[s+1],d=i[s+2],u=i[s+3];const p=r[a+0],g=r[a+1],m=r[a+2],y=r[a+3];if(o===0){e[t+0]=h,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(o===1){e[t+0]=p,e[t+1]=g,e[t+2]=m,e[t+3]=y;return}if(u!==y||h!==p||c!==g||d!==m){let _=1-o;const f=h*p+c*g+d*m+u*y,S=f>=0?1:-1,L=1-f*f;if(L>Number.EPSILON){const I=Math.sqrt(L),W=Math.atan2(I,f*S);_=Math.sin(_*W)/I,o=Math.sin(o*W)/I}const M=o*S;if(h=h*_+p*M,c=c*_+g*M,d=d*_+m*M,u=u*_+y*M,_===1-o){const I=1/Math.sqrt(h*h+c*c+d*d+u*u);h*=I,c*=I,d*=I,u*=I}}e[t]=h,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,s,r,a){const o=i[s],h=i[s+1],c=i[s+2],d=i[s+3],u=r[a],p=r[a+1],g=r[a+2],m=r[a+3];return e[t]=o*m+d*u+h*g-c*p,e[t+1]=h*m+d*p+c*u-o*g,e[t+2]=c*m+d*g+o*p-h*u,e[t+3]=d*m-o*u-h*p-c*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new ai(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e.x,s=e.y,r=e.z,a=e.order,o=Math.cos,h=Math.sin,c=o(i/2),d=o(s/2),u=o(r/2),p=h(i/2),g=h(s/2),m=h(r/2);switch(a){case"XYZ":this._x=p*d*u+c*g*m,this._y=c*g*u-p*d*m,this._z=c*d*m+p*g*u,this._w=c*d*u-p*g*m;break;case"YXZ":this._x=p*d*u+c*g*m,this._y=c*g*u-p*d*m,this._z=c*d*m-p*g*u,this._w=c*d*u+p*g*m;break;case"ZXY":this._x=p*d*u-c*g*m,this._y=c*g*u+p*d*m,this._z=c*d*m+p*g*u,this._w=c*d*u-p*g*m;break;case"ZYX":this._x=p*d*u-c*g*m,this._y=c*g*u+p*d*m,this._z=c*d*m-p*g*u,this._w=c*d*u+p*g*m;break;case"YZX":this._x=p*d*u+c*g*m,this._y=c*g*u+p*d*m,this._z=c*d*m-p*g*u,this._w=c*d*u-p*g*m;break;case"XZY":this._x=p*d*u-c*g*m,this._y=c*g*u-p*d*m,this._z=c*d*m+p*g*u,this._w=c*d*u+p*g*m;break}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],a=t[1],o=t[5],h=t[9],c=t[2],d=t[6],u=t[10],p=i+o+u;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(d-h)*g,this._y=(r-c)*g,this._z=(a-s)*g}else if(i>o&&i>u){const g=2*Math.sqrt(1+i-o-u);this._w=(d-h)/g,this._x=.25*g,this._y=(s+a)/g,this._z=(r+c)/g}else if(o>u){const g=2*Math.sqrt(1+o-i-u);this._w=(r-c)/g,this._x=(s+a)/g,this._y=.25*g,this._z=(h+d)/g}else{const g=2*Math.sqrt(1+u-i-o);this._w=(a-s)/g,this._x=(r+c)/g,this._y=(h+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ut(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,a=e._w,o=t._x,h=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+s*c-r*h,this._y=s*d+a*h+r*o-i*c,this._z=r*d+a*c+i*h-s*o,this._w=a*d-i*o-s*h-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,a=this._w;let o=a*e._w+i*e._x+s*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=s,this._z=r,this;const h=1-o*o;if(h<=Number.EPSILON){const g=1-t;return this._w=g*a+t*this._w,this._x=g*i+t*this._x,this._y=g*s+t*this._y,this._z=g*r+t*this._z,this.normalize(),this}const c=Math.sqrt(h),d=Math.atan2(c,o),u=Math.sin((1-t)*d)/c,p=Math.sin(t*d)/c;return this._w=a*u+this._w*p,this._x=i*u+this._x*p,this._y=s*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const fe=class Fo{constructor(e,t,i){this.x=0,this.y=0,this.z=0;const s=+(e!==void 0)+ +(t!==void 0)+ +(i!==void 0);if(s!==0){if(s===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(s===1){const{x:r,y:a,z:o}=e;this.x=r,this.y=a,this.z=o||0;return}if(s===3){this.x=e,this.y=t,this.z=i;return}throw be.ILLEGAL_PARAMETERS}}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new Fo(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ta.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ta.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,a=e.y,o=e.z,h=e.w,c=2*(a*s-o*i),d=2*(o*t-r*s),u=2*(r*i-a*t);return this.x=t+h*c+a*u-o*d,this.y=i+h*d+o*c-r*u,this.z=s+h*u+r*d-a*c,this}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),i=this.length(),s=e.length();return Math.abs(t)===i*s}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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,a=t.x,o=t.y,h=t.z;return this.x=s*h-r*o,this.y=r*a-i*h,this.z=i*o-s*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Is.copy(this).projectOnVector(e),this.sub(Is)}reflect(e){return this.sub(Is.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};fe.ORIGIN=Object.freeze(new fe(0,0,0)),fe.X_AXIS=Object.freeze(new fe(1,0,0)),fe.NEGATIVE_X_AXIS=Object.freeze(new fe(-1,0,0)),fe.Y_AXIS=Object.freeze(new fe(0,1,0)),fe.NEGATIVE_Y_AXIS=Object.freeze(new fe(0,-1,0)),fe.Z_AXIS=Object.freeze(new fe(0,0,1)),fe.NEGATIVE_Z_AXIS=Object.freeze(new fe(0,0,-1));let x=fe;const Is=new x,Ta=new ai,Us=class Do{constructor(e,t,i,s,r,a,o,h,c,d,u,p,g,m,y,_){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&i!=null&&s!=null&&r!=null&&a!=null&&o!=null&&h!=null&&c!=null&&d!=null&&u!=null&&p!=null&&g!=null&&m!=null&&y!=null&&_!=null&&this.set(e,t,i,s,r,a,o,h,c,d,u,p,g,m,y,_)}set(e,t,i,s,r,a,o,h,c,d,u,p,g,m,y,_){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=s,f[1]=r,f[5]=a,f[9]=o,f[13]=h,f[2]=c,f[6]=d,f[10]=u,f[14]=p,f[3]=g,f[7]=m,f[11]=y,f[15]=_,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 Do().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(_r.equalPoint3d(e,x.Z_AXIS))this.identity();else{const t=new x(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(x.Y_AXIS,e).normalize():t.crossVectors(x.Z_AXIS,e).normalize();const i=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,i.x,i.y,i.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/oi.setFromMatrixColumn(e,0).length(),r=1/oi.setFromMatrixColumn(e,1).length(),a=1/oi.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ec,e,Tc)}lookAt(e,t,i){const s=this.elements;return Le.subVectors(e,t),Le.lengthSq()===0&&(Le.z=1),Le.normalize(),wt.crossVectors(i,Le),wt.lengthSq()===0&&(Math.abs(i.z)===1?Le.x+=1e-4:Le.z+=1e-4,Le.normalize(),wt.crossVectors(i,Le)),wt.normalize(),xn.crossVectors(Le,wt),s[0]=wt.x,s[4]=xn.x,s[8]=Le.x,s[1]=wt.y,s[5]=xn.y,s[9]=Le.y,s[2]=wt.z,s[6]=xn.z,s[10]=Le.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,a=i[0],o=i[4],h=i[8],c=i[12],d=i[1],u=i[5],p=i[9],g=i[13],m=i[2],y=i[6],_=i[10],f=i[14],S=i[3],L=i[7],M=i[11],I=i[15],W=s[0],C=s[4],q=s[8],R=s[12],se=s[1],B=s[5],$=s[9],Nt=s[13],Ot=s[2],dn=s[6],un=s[10],gn=s[14],pn=s[3],mn=s[7],yn=s[11],_n=s[15];return r[0]=a*W+o*se+h*Ot+c*pn,r[4]=a*C+o*B+h*dn+c*mn,r[8]=a*q+o*$+h*un+c*yn,r[12]=a*R+o*Nt+h*gn+c*_n,r[1]=d*W+u*se+p*Ot+g*pn,r[5]=d*C+u*B+p*dn+g*mn,r[9]=d*q+u*$+p*un+g*yn,r[13]=d*R+u*Nt+p*gn+g*_n,r[2]=m*W+y*se+_*Ot+f*pn,r[6]=m*C+y*B+_*dn+f*mn,r[10]=m*q+y*$+_*un+f*yn,r[14]=m*R+y*Nt+_*gn+f*_n,r[3]=S*W+L*se+M*Ot+I*pn,r[7]=S*C+L*B+M*dn+I*mn,r[11]=S*q+L*$+M*un+I*yn,r[15]=S*R+L*Nt+M*gn+I*_n,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],a=e[1],o=e[5],h=e[9],c=e[13],d=e[2],u=e[6],p=e[10],g=e[14],m=e[3],y=e[7],_=e[11],f=e[15];return m*(+r*h*u-s*c*u-r*o*p+i*c*p+s*o*g-i*h*g)+y*(+t*h*g-t*c*p+r*a*p-s*a*g+s*c*d-r*h*d)+_*(+t*c*u-t*o*g-r*a*u+i*a*g+r*o*d-i*c*d)+f*(-s*o*d-t*h*u+t*o*p+s*a*u-i*a*p+i*h*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e instanceof x?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],y=e[13],_=e[14],f=e[15],S=u*_*c-y*p*c+y*h*g-o*_*g-u*h*f+o*p*f,L=m*p*c-d*_*c-m*h*g+a*_*g+d*h*f-a*p*f,M=d*y*c-m*u*c+m*o*g-a*y*g-d*o*f+a*u*f,I=m*u*h-d*y*h-m*o*p+a*y*p+d*o*_-a*u*_,W=t*S+i*L+s*M+r*I;if(W===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/W;return e[0]=S*C,e[1]=(y*p*r-u*_*r-y*s*g+i*_*g+u*s*f-i*p*f)*C,e[2]=(o*_*r-y*h*r+y*s*c-i*_*c-o*s*f+i*h*f)*C,e[3]=(u*h*r-o*p*r-u*s*c+i*p*c+o*s*g-i*h*g)*C,e[4]=L*C,e[5]=(d*_*r-m*p*r+m*s*g-t*_*g-d*s*f+t*p*f)*C,e[6]=(m*h*r-a*_*r-m*s*c+t*_*c+a*s*f-t*h*f)*C,e[7]=(a*p*r-d*h*r+d*s*c-t*p*c-a*s*g+t*h*g)*C,e[8]=M*C,e[9]=(m*u*r-d*y*r-m*i*g+t*y*g+d*i*f-t*u*f)*C,e[10]=(a*y*r-m*o*r+m*i*c-t*y*c-a*i*f+t*o*f)*C,e[11]=(d*o*r-a*u*r-d*i*c+t*u*c+a*i*g-t*o*g)*C,e[12]=I*C,e[13]=(d*y*s-m*u*s+m*i*p-t*y*p-d*i*_+t*u*_)*C,e[14]=(m*o*s-a*y*s-m*i*h+t*y*h+a*i*_-t*o*_)*C,e[15]=(a*u*s-d*o*s+d*i*h-t*u*h-a*i*p+t*o*p)*C,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e instanceof x?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,a=e.x,o=e.y,h=e.z,c=r*a,d=r*o;return this.set(c*a+i,c*o-s*h,c*h+s*o,0,c*o+s*h,d*o+i,d*h-s*a,0,c*h-s*o,d*h+s*a,r*h*h+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,a){return this.set(1,i,r,0,e,1,a,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t.x,a=t.y,o=t.z,h=t.w,c=r+r,d=a+a,u=o+o,p=r*c,g=r*d,m=r*u,y=a*d,_=a*u,f=o*u,S=h*c,L=h*d,M=h*u,I=i.x,W=i.y,C=i.z;return s[0]=(1-(y+f))*I,s[1]=(g+M)*I,s[2]=(m-L)*I,s[3]=0,s[4]=(g-M)*W,s[5]=(1-(p+f))*W,s[6]=(_+S)*W,s[7]=0,s[8]=(m+L)*C,s[9]=(_-S)*C,s[10]=(1-(p+y))*C,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=oi.set(s[0],s[1],s[2]).length();const a=oi.set(s[4],s[5],s[6]).length(),o=oi.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Oe.copy(this);const h=1/r,c=1/a,d=1/o;return Oe.elements[0]*=h,Oe.elements[1]*=h,Oe.elements[2]*=h,Oe.elements[4]*=c,Oe.elements[5]*=c,Oe.elements[6]*=c,Oe.elements[8]*=d,Oe.elements[9]*=d,Oe.elements[10]*=d,t.setFromRotationMatrix(Oe),i.x=r,i.y=a,i.z=o,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Us.IDENTITY=Object.freeze(new Us);let j=Us;const oi=new x,Oe=new j,Ec=new x(0,0,0),Tc=new x(1,1,1),wt=new x,xn=new x,Le=new x;let Y=class Vo{constructor(e=void 0,t=void 0){this.min=e==null?new x(1/0,1/0,1/0):new x(e.x,e.y,e.z),this.max=t==null?new x(-1/0,-1/0,-1/0):new x(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Ps.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Ps.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new Vo().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ps).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qe),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};const qe=[new x,new x,new x,new x,new x,new x,new x,new x],Ps=new x,Ma=new K;let xe=class zo{constructor(e=void 0,t=void 0){this.min=e==null?new K(1/0,1/0):new K(e.x,e.y),this.max=t==null?new K(-1/0,-1/0):new K(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Ma.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new zo().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new K(0,0):new K(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new K(0,0):new K(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ma).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};const ka=new x,Mc=new x,kc=new sn;class an{constructor(e=new x(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=ka.subVectors(i,t).cross(Mc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectsBox(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||kc.getNormalMatrix(e),s=this.coplanarPoint(ka).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new an().copy(this)}}let v=class jo extends K{clone(){return new jo(this.x,this.y)}static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((i,s)=>{i.toArray(t,s*2)}),t}},w=class Ho extends x{clone(){return new Ho(this.x,this.y,this.z)}static pointArrayToNumberArray(e,t=!0){const i=t?3:2,s=new Array(e.length*i);return e.forEach((r,a)=>{r.toArray(s,a*i)}),s}};const Ca=new j,va=new ai,Wo=class $s{constructor(e=0,t=0,i=0,s=$s.DEFAULT_ORDER){this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new $s(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],a=s[4],o=s[8],h=s[1],c=s[5],d=s[9],u=s[2],p=s[6],g=s[10];switch(t){case"XYZ":this._y=Math.asin(ut(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ut(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(h,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(ut(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,g),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-ut(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ut(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-ut(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,g),this._y=0);break}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i=!0){return Ca.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ca,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return va.setFromEuler(this),this.setFromQuaternion(va,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Wo.DEFAULT_ORDER="XYZ";let Cc=Wo;function fr(n,e,t=!1){const i=n.x,s=n.y;let r=!1;const a=e.length;for(let o=0,h=a-1;o<a;h=o++){const c=e[o].x,d=e[o].y,u=e[h].x,p=e[h].y;let g=d>s!=p>s;t&&(g=d>=s!=p>=s),g&&i<(u-c)*(s-d)/(p-d)+c&&(r=!r)}return r}function Go(n,e){if(n.length===0||e.length===0)return!1;const t=new xe().setFromPoints(n),i=new xe().setFromPoints(e);if(!t.intersectsBox(i))return!1;for(let s=0;s<n.length;){if(fr(n[s],e,!0))return!0;s<n.length-1&&_r.equalPoint2d(n[s+1],n[s])&&++s,++s}return!1}const Uo={isPointInPolygon:fr,isPolygonIntersect:Go};function vc(n,e){const t=[],i=e-1,s=n;for(let r=0;r<=s;r++)t.push(0);for(let r=1;r<=i-s;r++)t.push(r);for(let r=0;r<=s;r++)t.push(i-s+1);return t}function Nc(n,e){const t=e.length-1,i=n,s=[0];let r=0;for(let o=1;o<=t;o++){const h=e[o][0]-e[o-1][0],c=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(h*h+c*c+d*d);r+=u,s.push(r)}const a=[];for(let o=0;o<=i;o++)a.push(0);for(let o=1;o<=t-i;o++){const h=s[o]/r;a.push(h*(t-i+1))}for(let o=0;o<=i;o++)a.push(t-i+1);return a}function $o(n,e="Uniform"){const t=n.length;if(t===0)return[];if(t===1)return[0];const i=t-1;if(e==="Uniform")return new Array(t).fill(0).map((a,o)=>o/i);const s=[0];let r=0;for(let a=1;a<=i;a++){const o=n[a][0]-n[a-1][0],h=n[a][1]-n[a-1][1],c=n[a][2]-n[a-1][2],d=Math.sqrt(o*o+h*h+c*c),u=e==="SqrtChord"?Math.sqrt(d):d;r+=u,s.push(r)}return r<1e-12?new Array(t).fill(0).map((a,o)=>o/i):s.map(a=>a/r)}function qo(n,e){const t=e.length-1,i=n,s=t+i+1,r=new Array(s+1).fill(0),a=e[e.length-1];for(let o=s-i;o<=s;o++)r[o]=a;for(let o=1;o<=t-i;o++){let h=0;for(let c=o;c<o+i;c++)h+=e[c];r[o+i]=h/i}return r}function Oc(n,e){const t=e.length-1,i=n,s=[0];let r=0;for(let o=1;o<=t;o++){const h=e[o][0]-e[o-1][0],c=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(h*h+c*c+d*d),p=Math.sqrt(u);r+=p,s.push(r)}const a=[];for(let o=0;o<=i;o++)a.push(0);for(let o=1;o<=t-i;o++){const h=s[o]/r;a.push(h*(t-i+1))}for(let o=0;o<=i;o++)a.push(t-i+1);return a}function Es(n,e){const t=n.length,i=n.map(a=>a.slice()),s=e.slice();for(let a=0;a<t;a++){let o=a,h=Math.abs(i[a][a]);for(let c=a+1;c<t;c++){const d=Math.abs(i[c][a]);d>h&&(h=d,o=c)}if(h<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==a){const c=i[a];i[a]=i[o],i[o]=c;const d=s[a];s[a]=s[o],s[o]=d}for(let c=a+1;c<t;c++){const d=i[c][a]/i[a][a];if(!(Math.abs(d)<1e-14)){for(let u=a;u<t;u++)i[c][u]-=d*i[a][u];s[c]-=d*s[a]}}}const r=new Array(t).fill(0);for(let a=t-1;a>=0;a--){let o=s[a];for(let h=a+1;h<t;h++)o-=i[a][h]*r[h];r[a]=o/i[a][a]}return r}function xr(n,e,t="Uniform",i,s){if(n.length===0)return{controlPoints:[],knots:[],weights:[]};const r=n.map(R=>[R[0],R[1],R[2]??0]),a=!!i,o=!!s,h=(a?1:0)+(o?1:0),c=r.length-1,d=c+h;if(d<e)throw new Error("Not enough points to interpolate a curve of this degree.");const u=$o(r,t),p=u.slice();a&&p.unshift(u[0]),o&&p.push(u[u.length-1]);const g=qo(e,p),m=d+1,y=new Array(m),_=new Array(m),f=new Array(m),S=new Array(m);let L=0;y[L]=new Array(m).fill(0),y[L][0]=1,_[L]=r[0][0],f[L]=r[0][1],S[L]=r[0][2],L++;for(let R=1;R<=c-1;R++){const se=u[R];y[L]=new Array(m).fill(0);for(let B=0;B<=d;B++)y[L][B]=Gi(B,e,se,g);_[L]=r[R][0],f[L]=r[R][1],S[L]=r[R][2],L++}if(y[L]=new Array(m).fill(0),y[L][d]=1,_[L]=r[c][0],f[L]=r[c][1],S[L]=r[c][2],L++,a){const R=g[e+1]-g[0],se=R!==0?e/R:0;y[L]=new Array(m).fill(0),y[L][0]=-se,y[L][1]=se,_[L]=(i==null?void 0:i[0])??0,f[L]=(i==null?void 0:i[1])??0,S[L]=(i==null?void 0:i[2])??0,L++}if(o){const R=g[d+e+1]-g[d],se=R!==0?e/R:0;y[L]=new Array(m).fill(0),y[L][d-1]=-se,y[L][d]=se,_[L]=(s==null?void 0:s[0])??0,f[L]=(s==null?void 0:s[1])??0,S[L]=(s==null?void 0:s[2])??0,L++}const M=Es(y,_),I=Es(y,f),W=Es(y,S),C=new Array(m);for(let R=0;R<m;R++)C[R]=[M[R],I[R],W[R]];const q=new Array(m).fill(1);return{controlPoints:C,knots:g,weights:q}}function Gi(n,e,t,i){if(e===0)return t>=i[n]&&t<i[n+1]?1:0;const s=i[n+e]-i[n],r=i[n+e+1]-i[n+1],a=s>1e-10?(t-i[n])/s:0,o=r>1e-10?(i[n+e+1]-t)/r:0;return a*Gi(n,e-1,t,i)+o*Gi(n+1,e-1,t,i)}function Fi(n,e,t,i,s){const r=i.length-1,a=e;if(n=Math.max(t[a],Math.min(t[r+1],n)),Math.abs(n-t[r+1])<1e-8)return[...i[r]];if(Math.abs(n-t[a])<1e-8)return[...i[0]];const o=[0,0,0];let h=0;for(let c=0;c<=r;c++){const d=Gi(c,a,n,t),u=s[c]*d;o[0]+=i[c][0]*u,o[1]+=i[c][1]*u,o[2]+=i[c][2]*u,h+=u}if(Math.abs(h)<1e-10){const c=t[t.length-a-1];if(Math.abs(n-c)<1e-8)return[...i[r]];if(Math.abs(n-t[a])<1e-8)return[...i[0]]}return Math.abs(h)>=1e-10&&(o[0]/=h,o[1]/=h,o[2]/=h),o}function Ko(n,e,t,i){const s=n,r=e[s],a=e[e.length-s-1];let o=0;const h=1e3,c=(a-r)/h;let d=Fi(r,n,e,t,i);for(let y=1;y<=h;y++){const _=r+y*c,f=Fi(_,n,e,t,i),S=f[0]-d[0],L=f[1]-d[1],M=f[2]-d[2];o+=Math.sqrt(S*S+L*L+M*M),d=f}const u=Fi(a,n,e,t,i),p=u[0]-d[0],g=u[1]-d[1],m=u[2]-d[2];return o+=Math.sqrt(p*p+g*g+m*m),o}function Yc(n,e=3,t="Uniform",i,s){return n.length===0?[]:xr(n,e,t,i,s).controlPoints}const Na=new j,Oa=new x,Xc=new x,Rc=new x,Ts=new w;function Zo(n){return new j().setFromExtrusionDirection(new x(n.x,n.y,n.z))}function wr(n){return Na.setFromExtrusionDirection(new x(n.x,n.y,n.z)),Na.extractBasis(Oa,Xc,Rc),Oa.clone()}function qs(n,e){return new w(n.x,n.y,n.z??0).applyMatrix4(Zo(e))}function Ui(n,e){return new w(n.x,n.y,n.z??0).applyMatrix4(Zo(e).invert())}function Ks(n,e,t){const i=Ui(n,t),s=Ui(e,t);return Ts.set(s.x-i.x,s.y-i.y,(s.z??0)-(i.z??0)),k.normalizeAngle(Math.atan2(Ts.y,Ts.x))}class Qo{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class br extends Qo{translate(e){return this.transform(new sn().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}let Tt=class Jo extends br{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new xe}transform(e){return this._loops.forEach(t=>{t.transform(e)}),this._boundingBoxNeedsUpdate=!0,this}clone(){const e=new Jo;return this._loops.forEach(t=>{e.add(t.clone())}),e}getPoints(e){const t=[];for(let i=0;i<this.loops.length;++i){const s=this.loops[i].getPoints(e);t.push(s)}return t}buildHierarchy(){var e;const t=this.getPoints(100),i=this.calculateBoundaryBoxes(t),s=this.sortBoundaryBoxesByAreas(i),r=new Map,a=s.length;for(let h=0;h<a;h++)r.set(s[h],{index:s[h],children:[]});const o={index:-1,children:[]};for(let h=0;h<a;h++){const c=s[h],d=t[c],u=i[c];let p=h+1;for(;p<a;p++){const g=s[p],m=t[g];if(i[g].containsBox(u)&&Uo.isPointInPolygon(d[k.randInt(0,d.length-1)],m)){(e=r.get(g))==null||e.children.push(r.get(c));break}}p===a&&o.children.push(r.get(c))}return o}get area(){if(this._loops.length===0)return 0;let e=0;for(let t=0;t<this._loops.length;t++){const i=this._loops[t].getPoints(128),s=this.polygonArea(i);t===0?e+=Math.abs(s):e-=Math.abs(s)}return e}polygonArea(e){const t=e.length;if(t<3)return 0;let i=0;for(let s=0,r=t-1;s<t;r=s++){const a=e[r],o=e[s];i+=a.x*o.y-o.x*a.y}return i*.5}calculateBoundaryBoxes(e){const t=[];return e.forEach(i=>{t.push(new xe().setFromPoints(i))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((s,r)=>{const a=s.size,o=a.width*a.height;t.push({area:o,index:r})}),t.sort((s,r)=>s.area-r.area);const i=[];return t.forEach(s=>{i.push(s.index)}),i}},mi=class extends br{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const t=this.getUtoTmapping(e);return this.getPoint(t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let i,s=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),r+=i.distanceTo(s),t.push(r),s=i;return t}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let a;t?a=t:a=e*i[r-1];let o=0,h=r-1,c;for(;o<=h;)if(s=Math.floor(o+(h-o)/2),c=i[s]-a,c<0)o=s+1;else if(c>0)h=s-1;else{h=s;break}if(s=h,i[s]===a)return s/(r-1);const d=i[s],u=i[s+1]-d,p=(a-d)/u;return(s+p)/(r-1)}getTangent(e){let t=e-1e-4,i=e+1e-4;t<0&&(t=0),i>1&&(i=1);const s=this.getPoint(t),r=this.getPoint(i),a=new v;return a.copy(r).sub(s).normalize(),a}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}},Mt=class Zs extends mi{constructor(e,t,i,s,r){super();const a=+(e!==void 0)+ +(t!==void 0)+ +(i!==void 0)+ +(s!==void 0)+ +(r!==void 0);if(a==3)typeof e=="object"&&typeof t=="object"&&typeof i=="object"?this.createByThreePoints(e,t,i):this.createByStartEndPointsAndBulge(e,t,i);else if(a==5){const o=e;this.center=new v(o.x,o.y),this.radius=t,this._clockwise=r,this._startAngle=this._clockwise?this._mirrorAngle(k.normalizeAngle(i)):k.normalizeAngle(i),this._endAngle=this._clockwise?this._mirrorAngle(k.normalizeAngle(s)):k.normalizeAngle(s)}else throw be.ILLEGAL_PARAMETERS}createByThreePoints(e,t,i){const s=(C,q)=>({x:(C.x+q.x)/2,y:(C.y+q.y)/2}),r=(C,q)=>(q.y-C.y)/(q.x-C.x),a=C=>-1/C,o=s(e,t),h=s(t,i),c=r(e,t),d=r(t,i),u=a(c),p=a(d),g=(C,q,R,se)=>{const B=(se-q)/(C-R),$=C*B+q;return{x:B,y:$}},m=o.y-u*o.x,y=h.y-p*h.x,_=g(u,m,p,y),f=Math.sqrt(Math.pow(e.x-_.x,2)+Math.pow(e.y-_.y,2)),S=(C,q)=>Math.atan2(C.y-q.y,C.x-q.x),L=S(e,_),M=S(t,_),I=S(i,_),W=I>L&&I<M||L>I&&L<M||M>I&&M<L;this.center=_,this.radius=f,this._clockwise=!W,this._startAngle=L,this._endAngle=I}createByStartEndPointsAndBulge(e,t,i){let s,r,a;i<0?(s=Math.atan(-i)*4,r=new K(e),a=new K(t)):(s=Math.atan(i)*4,r=new K(t),a=new K(e));const o=new K().subVectors(a,r),h=o.length(),c=new K().addVectors(r,o.multiplyScalar(.5)),d=Math.abs(h/2/Math.tan(s/2)),u=o.normalize(),p=i<0?-Math.PI/2:Math.PI/2,g=new K(u.x*Math.cos(p)-u.y*Math.sin(p),u.y*Math.cos(p)+u.x*Math.sin(p));let m;s<Math.PI?i<0?m=c.add(g.multiplyScalar(d)):m=c.add(g.multiplyScalar(-d)):i<0?m=c.add(g.multiplyScalar(-d)):m=c.add(g.multiplyScalar(d)),i<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=i<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(e){this._center=new v(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(e){this._startAngle=this._clockwise?this._mirrorAngle(k.normalizeAngle(e)):k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(e){const t=this.startAngle==0&&e==G?e:k.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(t):t,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(e){return(360-e*180/Math.PI)%360*Math.PI/180}_getInternalAngle(e){return this._clockwise?this._mirrorAngle(e):e}get deltaAngle(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return this.clockwise?k.normalizeAngle(e-t):k.normalizeAngle(t-e)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=this._getInternalAngle(this.startAngle),t=this._clockwise?k.normalizeAngle(e-this.deltaAngle/2):k.normalizeAngle(e+this.deltaAngle/2),i=this._clockwise?this._mirrorAngle(t):t;return this.getPointAtAngle(i)}get closed(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return Math.abs(t-e)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const r of t){const a=this._getInternalAngle(r);k.isBetweenAngle(a,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&e.push(this.getPointAtAngle(r))}const i=e.map(r=>r.x),s=e.map(r=>r.y);return new xe(new v(Math.min(...i),Math.min(...s)),new v(Math.max(...i),Math.max(...s)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){const t=e,i=this.center.clone().applyMatrix2d(t),s=this.startPoint.clone().applyMatrix2d(t);if(this.closed)return this.center=i,this.radius=i.distanceTo(s),this._startAngle=Math.atan2(s.y-i.y,s.x-i.x),this._endAngle=this._startAngle,this._clockwise=t.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;const r=this.midPoint.clone().applyMatrix2d(t),a=this.endPoint.clone().applyMatrix2d(t),o=new Zs(s,r,a),h=t.determinant()<0?!this.clockwise:this.clockwise,c=d=>{const u=k.normalizeAngle(d);return h?this._mirrorAngle(u):u};return this.center=o.center,this.radius=o.radius,this.clockwise=h,this.startAngle=c(Math.atan2(s.y-o.center.y,s.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 Zs(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(e){const t=this._getInternalAngle(e),i=this.center.x+this.radius*Math.cos(t),s=this.center.y+this.radius*Math.sin(t);return new v(i,s)}getPoints(e=100){const t=[];let i=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(i=G,s=0),this.clockwise)for(let r=0;r<=e;r++){const a=s-i*(r/e),o=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(o);t.push(new v(h.x,h.y))}else for(let r=0;r<=e;r++){const a=s+i*(r/e),o=this._clockwise?this._mirrorAngle(a):a,h=this.getPointAtAngle(o);t.push(new v(h.x,h.y))}return t}};class Bc extends Qo{translate(e){return this.transform(new j().makeTranslation(e.x,e.y,e.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class on extends Bc{}class kt extends on{constructor(e,t){super(),this._start=new w(e),this._end=new w(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new x().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(e){return this.project(e)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(e){return this.project(e).distanceTo(e)<1e-6}at(e,t){return this.delta(t).multiplyScalar(e).add(this._start)}atLength(e,t=!1){if(t){const i=this.delta(Yt).normalize();return new w(this._start).addScaledVector(i,e)}else{const i=this.delta(Yt).normalize();return new w(this._end).addScaledVector(i,e)}}extend(e,t=!1){if(t){const i=Yt.subVectors(this._start,this._end).normalize();this._start=new w(this._start).addScaledVector(i,e)}else{const i=this.delta(Yt).normalize();this._end=new w(this._end).addScaledVector(i,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){Ya.subVectors(e,this._start),wn.subVectors(this.endPoint,this.startPoint);const i=wn.dot(wn);let s=wn.dot(Ya)/i;return t&&(s=k.clamp(s,0,1)),s}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this._start)}delta(e){return e.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(e){const t=this.direction,i=Yt.subVectors(e,this.startPoint).dot(t);return new w().copy(t).multiplyScalar(i).add(this.startPoint)}perpPoint(e){const t=this.direction,i=this.startPoint,s=Yt.subVectors(e,i).dot(t),r=Yt.copy(t).multiplyScalar(s);return new w().addVectors(i,r)}calculateBoundingBox(){const e=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)),t=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 Y(e,t)}transform(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new kt(this._start.clone(),this._end.clone())}}const Yt=new x,Ya=new x,wn=new x;class Pt extends on{static computeCenterPoint(e,t,i){const s=new x().addVectors(e,t).multiplyScalar(.5),r=new x().addVectors(e,i).multiplyScalar(.5),a=new x().subVectors(t,e),o=new x().subVectors(i,e),h=new x().crossVectors(a,o).normalize();if(h.lengthSq()===0)return null;const c=new x().crossVectors(a,h).normalize(),d=new x().crossVectors(o,h).normalize(),u=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),g=new kt(s,s.clone().add(u)),m=new kt(r,r.clone().add(p)),y=new x;return g.closestPointToPoint(m.startPoint,!0,y)?y:null}static createByThreePoints(e,t,i){const s=Pt.computeCenterPoint(e,t,i);if(s){const r=s.distanceTo(e),a=new x().subVectors(e,s),o=new x().subVectors(t,s),h=Math.atan2(a.y,a.x),c=Math.atan2(o.y,o.x);return new Pt(s,r,h,c,x.Z_AXIS)}}constructor(e,t,i,s,r,a=x.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=i,this.endAngle=s,this.normal=r,this.refVec=a,(s-i)%G==0?(this.startAngle=0,this.endAngle=G):(this.startAngle=i,this.endAngle=s)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==G?e:k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return k.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(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new x(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let e=this.startAngle,t=this.deltaAngle;this.closed&&(e=0,t=G);const i=e+t*.5;return this.getPointAtAngle(i)}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(e){const t=new x(e.x,e.y,e.z||0),i=this.center,s=this.normal,r=t.clone().sub(i).dot(s),a=t.clone().sub(s.clone().multiplyScalar(r)).clone().sub(i);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const o=i.clone().add(a),h=this.getAngle(o.clone()),c=this.startAngle,d=this.deltaAngle;let u=k.normalizeAngle(h-c);u<0&&(u=0),u>d&&(u=d);const p=this.getPointAtAngle(c+u),g=p.distanceTo(t),m=this.startPoint.distanceTo(t),y=this.endPoint.distanceTo(t);return m<g&&m<=y?this.startPoint.clone():y<g&&y<m?this.endPoint.clone():p}tangentPoints(e){const t=[],i=new x(e.x,e.y,e.z||0),s=this.center,r=this.normal,a=this.radius,o=i.clone().sub(s).dot(r),h=i.clone().sub(r.clone().multiplyScalar(o)),c=s.clone(),d=h.clone().sub(c).length();if(d<a)return t;const u=Math.acos(a/d),p=this.getAngle(h.clone()),g=[p+u,p-u];for(const m of g){const y=k.normalizeAngle(m-this.startAngle);y>=0&&y<=this.deltaAngle&&t.push(this.getPointAtAngle(this.startAngle+y))}return t}nearestTangentPoint(e){const t=this.tangentPoints(e);if(t.length===0)return null;const i=new w(e.x,e.y,e.z||0);return t.length===1||t[0].distanceTo(i)<t[1].distanceTo(i)?t[0]:t[1]}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let h=0;h<2*Math.PI;h+=Math.PI/2)k.isBetweenAngle(h,this.startAngle,this.endAngle)&&e.push(h);let t=1/0,i=1/0,s=1/0,r=-1/0,a=-1/0,o=-1/0;for(const h of e){const c=this.getPointAtAngle(h);c.x<t&&(t=c.x),c.y<i&&(i=c.y),c.z<s&&(s=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new Y({x:t,y:i,z:s},{x:r,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(let r=0;r<=e;r++){const a=s+i*(r/e),o=this.getPointAtAngle(a);t.push(o)}return t}transform(e){const t=this.center.clone().applyMatrix4(e),i=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),r=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new x(i).sub(t).normalize(),o=t.distanceTo(i);let h=new x().crossVectors(new x(i).sub(t),new x(r).sub(t)).normalize();h.lengthSq()===0&&(h=this.normal.clone().transformDirection(e));const c=d=>{const u=new x(d).sub(t);return Math.atan2(u.dot(Xa.crossVectors(h,a)),u.dot(a))};return this.center=t,this.radius=o,this.normal=h,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?G:c(s),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Pt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(Xa.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,i=this.refVec,s={x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x},r=this.center,a=this.radius;return new w(r.x+a*(i.x*Math.cos(e)+s.x*Math.sin(e)),r.y+a*(i.y*Math.cos(e)+s.y*Math.sin(e)),r.z+a*(i.z*Math.cos(e)+s.z*Math.sin(e)))}get plane(){const e=new x(this.center).distanceTo(yr);return new an(this.normal,e)}}const Xa=new x;let $i=class Mn extends mi{constructor(e,t,i,s=0,r=G,a=!1,o=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=i,(r-s)%G==0?(this.startAngle=0,this.endAngle=G):(this.startAngle=s,this.endAngle=r),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==G?e:k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return k.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,i=-1/0,s=-1/0;for(let r=0;r<=100;r++){const a=this.getPoint(r/100);e=Math.min(e,a.x),t=Math.min(t,a.y),i=Math.max(i,a.x),s=Math.max(s,a.y)}return new xe({x:e,y:t},{x:i,y:s})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let i=this.endAngle-this.startAngle;const s=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=t;for(;i>t;)i-=t;i<Number.EPSILON&&(s?i=0:i=t),this.clockwise===!0&&!s&&(i===t?i=-t:i=i-t);const r=this.startAngle+e*i;let a=this.center.x+this.majorAxisRadius*Math.cos(r),o=this.center.y+this.minorAxisRadius*Math.sin(r);if(this.rotation!==0){const h=Math.cos(this.rotation),c=Math.sin(this.rotation),d=a-this.center.x,u=o-this.center.y;a=d*h-u*c+this.center.x,o=d*c+u*h+this.center.y}return new v(a,o)}transform(e){const t=e,i=new v(this.center).applyMatrix2d(t),s=new w(i.x,i.y,this.center.z),r=this.getPointAtAngle(0).clone().applyMatrix2d(t),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(t),o=new v(r).sub(i),h=new v(a).sub(i),c=o.length(),d=h.length(),u=Math.atan2(o.y,o.x),p=o.clone().normalize(),g=h.clone().normalize(),m=f=>{const S=new v(f).sub(i),L=S.dot(p),M=S.dot(g);return k.normalizeAngle(Math.atan2(M/d,L/c))},y=t.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new Mn(s,c,d,0,G,y,u):new Mn(s,c,d,m(this.startPoint.clone().applyMatrix2d(t)),m(this.endPoint.clone().applyMatrix2d(t)),y,u);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this}getPointAtAngle(e){return this.getPoint(this.closed?e/G:k.normalizeAngle(e-this.startAngle)/this.deltaAngle)}copy(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}clone(){return new Mn(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}};class ui extends on{constructor(e,t,i,s,r,a=0,o=G){super(),this.center=e,this.normal=t,this.majorAxis=i,this.majorAxisRadius=s,this.minorAxisRadius=r;const h=Math.abs(o-a);Math.abs(h-G)<1e-10||Math.abs(h-2*G)<1e-10?(this.startAngle=0,this.endAngle=G):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw be.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==G?e:k.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-G)<1e-10?G:k.normalizeAngle(e)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new x(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new x().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let e=this.startAngle,t=this.deltaAngle;(this.closed||Math.abs(t-G)<1e-10)&&(e=0,t=G);const i=e+t/2;return this.getPointAtAngle(i)}get isCircular(){return rn.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const e=1e3,t=this.deltaAngle/e;let i=0,s=this.getPointAtAngle(this.startAngle);for(let r=1;r<=e;r++){const a=this.startAngle+r*t,o=this.getPointAtAngle(a),h=o.x-s.x,c=o.y-s.y,d=o.z-s.z;i+=Math.sqrt(h*h+c*c+d*d),s=o}return i}get area(){const e=this.majorAxisRadius,t=this.minorAxisRadius,i=this.startAngle,s=i+this.deltaAngle;if(Math.abs(this.deltaAngle-G)<1e-10)return Math.PI*e*t;const r=e*t/2*(s-i-(Math.sin(s)*Math.cos(s)-Math.sin(i)*Math.cos(i)));return Math.abs(r)}calculateBoundingBox(){if(this.majorAxis.equals(x.X_AXIS)||this.majorAxis.equals(x.Y_AXIS)||this.majorAxis.isParallelTo(x.X_AXIS)||this.majorAxis.isParallelTo(x.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let h=0;h<2*Math.PI;h+=Math.PI/2)k.isBetweenAngle(h,this.startAngle,this.endAngle)&&e.push(h);let t=1/0,i=1/0,s=1/0,r=-1/0,a=-1/0,o=-1/0;for(const h of e){const c=this.getPointAtAngle(h);c.x<t&&(t=c.x),c.y<i&&(i=c.y),c.z<s&&(s=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new Y({x:t,y:i,z:s},{x:r,y:a,z:o})}else{let e=1/0,t=1/0,i=1/0,s=-1/0,r=-1/0,a=-1/0;for(let o=0;o<=100;o++){const h=this.startAngle+this.deltaAngle*(o/100),c=this.getPointAtAngle(h);e=Math.min(e,c.x),t=Math.min(t,c.y),i=Math.min(i,c.z),s=Math.max(s,c.x),r=Math.max(r,c.y),a=Math.max(a,c.z)}return new Y({x:e,y:t,z:i},{x:s,y:r,z:a})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let i=this.deltaAngle,s=this.startAngle;this.closed&&(i=G,s=0);for(let r=0;r<=e;r++){const a=s+i*(r/e),o=this.getPointAtAngle(a);t.push(o)}return t}getPointAtAngle(e){const t=Math.cos(e),i=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),r=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(s);return new w(this.center.x+r.x,this.center.y+r.y,this.center.z+r.z)}contains(e){const t=new x(e).sub(this.center),i=t.dot(this.majorAxis),s=t.dot(this.minorAxis),r=i/this.majorAxisRadius,a=s/this.minorAxisRadius;return r*r+a*a<=1}transform(e){const t=e,i=this.center.clone().applyMatrix4(t),s=this.getPointAtAngle(0).clone().applyMatrix4(t),r=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(t),a=new x(s).sub(i),o=new x(r).sub(i),h=a.length(),c=o.length(),d=a.clone().normalize(),u=new x().crossVectors(a,o).normalize();let p=new x().crossVectors(u,d).normalize();p.dot(o)<0&&(u.negate(),p=new x().crossVectors(u,d).normalize());const g=y=>{const _=new x(y).sub(i),f=_.dot(d),S=_.dot(p);return k.normalizeAngle(Math.atan2(S/c,f/h))},m=this.closed?new ui(i,u,d,h,c,0,G):new ui(i,u,d,h,c,g(this.startPoint.clone().applyMatrix4(t)),g(this.endPoint.clone().applyMatrix4(t)));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(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ui(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new x(this.center).distanceTo(yr);return new an(this.normal,e)}}class ce extends mi{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new v(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new v(t.x,t.y)}else{const t=this._vertices[e-1];return new v(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let i=0;i<t;++i){const s=this._vertices[i];let r=null;if(i<t-1?r=this._vertices[i+1]:i==t-1&&this.closed&&(r=this._vertices[0]),r)if(s.bulge){const a=new Mt(s,r,s.bulge);e+=a.length}else e+=new v(s.x,s.y).distanceTo(r)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}removeVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error(`Index ${e} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(e,1),this._boundingBoxNeedsUpdate=!0}reset(e,t){e?t!==void 0&&t>=0&&t<this._vertices.length&&(this._vertices=this._vertices.slice(0,t),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(e){const t=this._vertices[e];return new v(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new xe().setFromPoints(e)}transform(e){const t=e.determinant()<0;return this._vertices.forEach(i=>{const s=new v(i).applyMatrix2d(e);i.x=s.x,i.y=s.y,t&&i.bulge!=null&&(i.bulge=-i.bulge)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new ce(this._vertices.map(e=>({...e})),this._closed)}getPoints3d(e,t){const i=[];return this.getPoints(e).forEach(s=>i.push(new w().set(s.x,s.y,t))),i}getPoints(e){const t=[],i=this._vertices.length;for(let s=0;s<i;++s){const r=this._vertices[s];if(r.bulge){let a=null;if(s<i-1?a=this._vertices[s+1]:s==i-1&&this.closed&&(a=this._vertices[0]),a){const o=new Mt(r,a,r.bulge).getPoints(e),h=o.length;for(let c=0;c<h;++c){const d=o[c];t.push(new v(d.x,d.y))}}}else t.push(new v(r.x,r.y)),s==i-1&&this.closed&&t.push(t[0])}return t}}class Ge extends mi{constructor(e,t){super(),this._start=new v(e),this._end=new v(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new v(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new v(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new xe(e,t)}transform(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ge(this._start.clone(),this._end.clone())}}let qi=class Be extends mi{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}static buildFromEdges(e,t=.001){if(e.length===0)return[];const i=[...e],s=[],r=t*t,a=(o,h)=>{const c=o.x-h.x,d=o.y-h.y;return c*c+d*d<=r};for(;i.length>0;){const o=[],h=i.shift();o.push(h);const c=Be.getEdgeStartPoint(h);let d=Be.getEdgeEndPoint(h);if(!a(c,d))for(;i.length>0;){const u=Be.findConnectingEdge(i,d,r);if(u.index<0)break;let p=i.splice(u.index,1)[0];if(u.reverse&&(p=Be.reverseEdge(p)),o.push(p),d=Be.getEdgeEndPoint(p),a(d,c))break}s.push(new Be(o))}return s}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new v(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new xe;return t.setFromPoints(e),t}transform(e){const t=new j().set(e.elements[0],e.elements[3],0,e.elements[6],e.elements[1],e.elements[4],0,e.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(i=>{i instanceof Ue?i.transform(t):i.transform(e)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Be(this._curves.map(e=>e.clone()))}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(i=>{i.getPoints(e).forEach(s=>{t.push(new v(s.x,s.y))})}),t}static findConnectingEdge(e,t,i){let s=-1,r=!1,a=Number.POSITIVE_INFINITY;for(let o=0;o<e.length;o++){const h=e[o],c=Be.getEdgeStartPoint(h),d=Be.getEdgeEndPoint(h),u=t.x-c.x,p=t.y-c.y,g=u*u+p*p;g<a&&(a=g,s=o,r=!1);const m=t.x-d.x,y=t.y-d.y,_=m*m+y*y;_<a&&(a=_,s=o,r=!0)}return a>i?{index:-1,reverse:!1}:{index:s,reverse:r}}static getEdgeStartPoint(e){const t=e.startPoint;return new v(t.x,t.y)}static getEdgeEndPoint(e){const t=e.endPoint;return new v(t.x,t.y)}static reverseEdge(e){return e instanceof Ge?new Ge(e.endPoint,e.startPoint):e instanceof Mt?new Mt(e.center,e.radius,e.endAngle,e.startAngle,!e.clockwise):e instanceof $i?new $i(e.center,e.majorAxisRadius,e.minorAxisRadius,e.endAngle,e.startAngle,!e.clockwise,e.rotation):e instanceof Ue?Be.reverseSplineEdge(e):e}static reverseSplineEdge(e){const t=[...e.controlPoints].reverse(),i=e.knots,s=i[0],r=i[i.length-1],a=i.map(c=>s+r-c).reverse(),o=e.weights,h=o.length>0?[...o].reverse():void 0;return new Ue(t,a,h,e.degree,e.closed)}};class Ms{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(e,t,i,s){this.c0=e,this.c1=i,this.c2=-3*e+3*t-2*i-s,this.c3=2*e-2*t+i+s}initCatmullRom(e,t,i,s,r){this.init(t,i,r*(i-e),r*(s-t))}initNonuniformCatmullRom(e,t,i,s,r,a,o){let h=(t-e)/r-(i-e)/(r+a)+(i-t)/a,c=(i-t)/a-(s-t)/(a+o)+(s-i)/o;h*=a,c*=a,this.init(t,i,h,c)}calc(e){const t=e*e,i=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*i}}class fs extends on{constructor(e=[],t=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new x,this._px=new Ms,this._py=new Ms,this._pz=new Ms,this._points=e.map(r=>new w(r)),this._closed=t,this._curveType=i,this._tension=s}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 e=0;for(let t=1;t<this._points.length;t++)e+=this._points[t-1].distanceTo(this._points[t]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e}getPoint(e,t=new w){const i=t,s=this._points,r=s.length;if(r===0)return i.set(0,0,0);if(r===1)return i.copy(s[0]);const a=(r-(this._closed?0:1))*e;let o=Math.floor(a),h=a-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:h===0&&o===r-1&&(o=r-2,h=1);let c,d;this._closed||o>0?c=s[(o-1)%r]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),c=new w(this._tmp.x,this._tmp.y,this._tmp.z));const u=s[o%r],p=s[(o+1)%r];if(this._closed||o+2<r?d=s[(o+2)%r]:(this._tmp.subVectors(s[r-1],s[r-2]).add(s[r-1]),d=new w(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const g=this._curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),g),y=Math.pow(u.distanceToSquared(p),g),_=Math.pow(p.distanceToSquared(d),g);y<1e-4&&(y=1),m<1e-4&&(m=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(c.x,u.x,p.x,d.x,m,y,_),this._py.initNonuniformCatmullRom(c.y,u.y,p.y,d.y,m,y,_),this._pz.initNonuniformCatmullRom(c.z,u.z,p.z,d.z,m,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,u.x,p.x,d.x,this._tension),this._py.initCatmullRom(c.y,u.y,p.y,d.y,this._tension),this._pz.initCatmullRom(c.z,u.z,p.z,d.z,this._tension));return i.set(this._px.calc(h),this._py.calc(h),this._pz.calc(h)),i}getPoints(e){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}setPoints(e){this._points=e.map(t=>new w(t)),this._boundingBoxNeedsUpdate=!0}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)}setCurveType(e){this._curveType=e}setTension(e){this._tension=e}clone(){return new fs(this._points.map(e=>e.clone()),this._closed,this._curveType,this._tension)}transform(e){return this._points=this._points.map(t=>{const i=new w;return i.copy(t),i.applyMatrix4(e),i}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Y;const e=new Y;return this._points.forEach(t=>{e.expandByPoint(t)}),e}}let Fe=class Yi{constructor(e,t,i,s){this._degree=e,this._knots=[...t],this._controlPoints=i.map(r=>({x:r.x,y:r.y,z:r.z})),this._weights=s?[...s]:new Array(i.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z}))}weights(){return[...this._weights]}clone(){return new Yi(this._degree,this._knots,this._controlPoints,this._weights)}point(e){const t=this._controlPoints.map(i=>[i.x,i.y,i.z]);return Fi(e,this._degree,this._knots,t,this._weights)}length(){const e=this._controlPoints.map(t=>[t.x,t.y,t.z]);return Ko(this._degree,this._knots,e,this._weights)}static byKnotsControlPointsWeights(e,t,i,s){return new Yi(e,t,i,s)}static byPoints(e,t,i="Uniform",s,r){const a=xr(e,t,i,s,r),o=a.controlPoints.map(h=>({x:h[0],y:h[1],z:h[2]}));return new Yi(t,a.knots,o,a.weights)}getParameterRange(){const e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}}getPoints(e){const t=[],{start:i,end:s}=this.getParameterRange();for(let r=0;r<=e;r++){const a=i+(s-i)*(r/e);t.push(this.point(a))}return t}isClosed(e=1e-6){const{start:t,end:i}=this.getParameterRange(),s=this.point(t),r=this.point(i),a=s[0]-r[0],o=s[1]-r[1],h=s[2]-r[2];return Math.sqrt(a*a+o*o+h*h)<e}static createFitPointsForClosedCurve(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const t=new fs(e,!0,"centripetal"),i=Math.max(50,e.length*2);return t.getPoints(i)}static createClosedCurve(e,t,i="Chord"){const s=this.createFitPointsForClosedCurve(e).map(r=>[r.x,r.y,r.z]);return Yi.byPoints(s,t,i)}},Ue=class kn extends on{constructor(e,t,i,s,r,a){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(t)){if(o<2||o>5)throw be.ILLEGAL_PARAMETERS;this._controlPoints=e;let h,c=3,d=!1;if(o>=3&&(Array.isArray(i)?(h=i,o>=4&&(c=s||3),o>=5&&(d=r)):i!==void 0&&(c=i||3,o>=4&&(d=s))),i===void 0&&o>=4&&(c=s||3,o>=5&&(d=r)),this._degree=c,this._closed=d,this._controlPoints.length<this._degree+1)throw be.ILLEGAL_PARAMETERS;this._nurbsCurve=Fe.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,h)}else{if(o<2||o>6)throw be.ILLEGAL_PARAMETERS;this._fitPoints=e,this._knotParameterization=t,o>=3&&(this._degree=i||3);const h=typeof s=="boolean";o>=4&&h&&(this._closed=s),h?(o>=5&&(this._startTangent=r),o>=6&&(this._endTangent=a)):(o>=4&&(this._startTangent=s),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 be.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=Fe.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const d=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Fe.byPoints(d,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(d=>[d.x,d.y,d.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const e=Fe.createFitPointsForClosedCurve(this._fitPoints),t=this.toNurbsPoints(e);this._nurbsCurve=Fe.byPoints(t,this._degree,this._knotParameterization)}else{const e=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Fe.byPoints(e,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(e=>[e.x,e.y,e.z||0]))}else if(this._controlPoints)if(this._closed){const e=Fe.createFitPointsForClosedCurve(this._controlPoints),t=this.toNurbsPoints(e);this._nurbsCurve=Fe.byPoints(t,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(i=>[i.x,i.y,i.z||0]))}else{const e=this._nurbsCurve.knots(),t=this._nurbsCurve.weights();this._nurbsCurve=Fe.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,t)}}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z||0}))}get fitPoints(){var e;return(e=this._fitPoints)==null?void 0:e.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),i=e[t],s=this._nurbsCurve.point(i);return new w(s[0],s[1],s[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),i=e[e.length-t-1],s=this._nurbsCurve.point(i);return new w(s[0],s[1],s[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(e){if(!this._fitPoints)throw new Error("No fit points in this spline");const t=this._fitPoints.length,i=e<0||e>=t?t-1:e,s=this._fitPoints[i];return{x:s.x,y:s.y,z:s.z||0}}getControlPointAt(e){const t=this._controlPoints.length,i=e<0||e>=t?t-1:e;return this._controlPoints[i]}getPoints(e=100){const t=this._nurbsCurve,i=[],s=t.knots(),r=this._nurbsCurve.degree(),a=s[r],o=s[s.length-r-1],h=(o-a)/(e-1);for(let c=0;c<e;c++){const d=c===e-1?o:a+c*h,u=t.point(d);i.push(new w(u[0],u[1],u[2]))}return i}getCurvePoints(e,t){const i=[],s=e.knots(),r=e.degree(),a=s[r],o=(s[s.length-r-1]-a)/(t-1);for(let h=0;h<t;h++){const c=a+h*o;i.push(e.point(c))}return i}calculateBoundingBox(){const e=this.getPoints(100);return new Y().setFromPoints(e)}get closed(){return this._closed}set closed(e){this.setClosed(e)}transform(e){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(t=>new w(t).applyMatrix4(e)),this._startTangent&&(this._startTangent=new w(this._startTangent).transformDirection(e)),this._endTangent&&(this._endTangent=new w(this._endTangent).transformDirection(e)),this.buildCurve();else{const t=this._nurbsCurve.knots(),i=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(s=>new w(s).applyMatrix4(e)),this._nurbsCurve=Fe.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,i.length>0?i:void 0)}return this._boundingBoxNeedsUpdate=!0,this}clone(){return this._fitPoints&&this._knotParameterization?new kn(this._fitPoints.map(e=>({x:e.x,y:e.y,z:e.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 kn(this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z||0})),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)}toNurbsPoints(e){const t=new Array(e.length);return e.forEach((i,s)=>{t[s]=[i.x,i.y,i.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((i,s)=>{t[s]={x:i[0],y:i[1],z:i[2]}}),t}toNurbsPoint(e){return[e.x,e.y,e.z||0]}static createClosedSpline(e,t="Uniform",i=3){if(e.length<i+1)throw new Error(`At least ${i+1} points are required for a degree ${i} closed spline`);return new kn(e,t,i,!0)}};var Lr=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(Lr||{}),ii=(n=>(n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211",n))(ii||{}),He=(n=>(n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE",n))(He||{}),z=(n=>(n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n[n.BaselineLeft=10]="BaselineLeft",n[n.BaselineCenter=11]="BaselineCenter",n[n.BaselineRight=12]="BaselineRight",n))(z||{}),Sr=(n=>(n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",n))(Sr||{}),Ar=(n=>(n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT",n))(Ar||{}),Ir=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(Ir||{});let el=class tl{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(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new xe;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter.copy(e)}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const e=new xe;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new tl;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e}copy(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this}};const Br=class Br extends De{constructor(){super(...arguments),this._visibility=!0,this._transparency=new J,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(e){this._layer=e}get color(){return this.getEntityColor()}set color(e){this.setEntityColor(e)}get resolvedColor(){var t;let e=this.color;if(e.isByLayer){const i=this.getLayerColor();i&&i.RGB!=null&&(e=i)}else if(e.isByBlock){const i=this.database.cecolor;if(i&&(e=i,e.isByLayer)){const s=this.database.clayer||this.layer,r=this.database.tables.layerTable.getAt(s);((t=r==null?void 0:r.color)==null?void 0:t.RGB)!=null&&(e=r.color)}}return e}get rgbColor(){const t=this.resolvedColor.RGB;return t??16777215}get lineType(){var e;return this._lineType==null&&(this._lineType=((e=this.database)==null?void 0:e.celtype)??pe),this._lineType}set lineType(e){e?e.toUpperCase()==="BYLAYER"?this._lineType=pe:e.toUpperCase()==="BYBLOCK"?this._lineType=At:this._lineType=e:this._lineType=pe}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??ii.ByLayer),this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new X,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(e){this._color==null&&(this._color=new X),this._color.copy(e)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(e){e.writeSubclassMarker("AcDbEntity"),e.writeString(8,this.layer),e.writeString(6,this.lineType),e.writeDouble(48,this.linetypeScale),e.writeInt16(60,this.visibility?0:1),e.writeCmColor(this.color),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency);const t=this.database.tables.blockTable.getIdAt(this.ownerId);return t!=null&&t.isPaperSapce&&e.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new X,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??pe),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??ii.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,i,s,r,a){}transformBy(e){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(e,t){const i=e.subEntityTraits;i.color=this.resolvedColor,i.rgbColor=this.rgbColor,i.lineType=this.lineStyle,i.lineTypeScale=this.linetypeScale,i.lineWeight=this.lineWeight,i.transparency=this.transparency,i.layer=this.layer,i.drawOrder=0,"thickness"in this&&(i.thickness=this.thickness);const s=this.subWorldDraw(e,t);return this.attachEntityInfo(s),s}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:e=>{this.color=e}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:e=>{this.layer=e}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:e=>{this.lineType=e}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:e=>{this.linetypeScale=e}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:e=>{this.lineWeight=e}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:e=>{this.transparency=e}}}]}}get lineStyle(){var s;const{type:e,name:t}=this.getLineType(),i=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(t);return i?{type:e,...i.linetype}:{type:e,name:t,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==pe){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==At?{type:"ByBlock",name:It}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:It}}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);return e!=null?e.color:null}attachEntityInfo(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)}};Br.typeName="Entity";let de=Br;const Fr=class Fr extends de{};Fr.typeName="Curve";let ue=Fr;var hi=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(hi||{});const Dr=class Dr extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t,i=0,s=!1,r=0,a=0,o=null){super(),this._polyType=e,this._elevation=i;const h=o&&(o==null?void 0:o.length)===t.length,c=t.map((d,u)=>({x:d.x,y:d.y,bulge:h?o[u]:void 0}));this._geo=new ce(c,s)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){return this._geo.getPointAt(e)}getBulgeAt(e){const t=this._geo.vertices[e];return(t==null?void 0:t.bulge)||0}get geometricExtents(){const e=this._geo.box;return new Y({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t){const i=this._geo.getPointAt(t);e.push(new w(i.x,i.y,0))}return e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r){const a=this._geo.getPointAt(r);s.push(new w(a.x,a.y,0))}break}}transformBy(e){const t=e.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(s=>{const r=new w(s.x,s.y,this._elevation).applyMatrix4(e);s.x=r.x,s.y=r.y,i=r.z,t&&s.bulge!=null&&(s.bulge=-s.bulge)}),this._elevation=i,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:e=>{this.elevation=e}}},{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:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=[];return this._geo.getPoints(100).forEach(s=>t.push(new w().set(s.x,s.y,this.elevation))),e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;++i)e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint3d(10,{x:this.getPointAt(i).x,y:this.getPointAt(i).y,z:this.elevation}),e.writeDouble(42,this.getBulgeAt(i)),e.writeInt16(70,0);return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb2dPolyline");let t=this.closed?1:0;return this.polyType===1&&(t|=2),this.polyType===2&&(t|=4),this.polyType===3&&(t|=8),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),e.writeDouble(10,0),e.writeDouble(20,0),e.writeDouble(30,this.elevation),this}};Dr.typeName="2dPolyline";let Fn=Dr;var il=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(il||{});const Vr=class Vr extends de{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(e){this._position.copy(e)}get bulge(){return this._bulge}set bulge(e){this._bulge=e}get startWidth(){return this._startWidth}set startWidth(e){this._startWidth=e}get endWidth(){return this._endWidth}set endWidth(e){this._endWidth=e}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new Y().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,i,s){s.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb2dVertex"),e.writePoint2d(10,this.position),e.writeDouble(40,this.startWidth),e.writeDouble(41,this.endWidth),e.writeDouble(42,this.bulge),e.writeInt16(70,this.vertexType),this}};Vr.typeName="2dVertex";let Qs=Vr;var Di=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(Di||{});const zr=class zr extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t,i=!1){super(),this._polyType=e,this._geo=new ce(t,i)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(e){const t=this._geo.vertices[e];return new w(t.x,t.y,t.z||0)}get geometricExtents(){const e=this._geo.vertices.map(t=>new w(t.x,t.y,t.z||0));return new Y().setFromPoints(e)}subGetGripPoints(){const e=new Array;for(let t=0;t<this._geo.numberOfVertices;++t){const i=this._geo.getPointAt(t);e.push(new w(i.x,i.y,0))}return e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r)s.push(this.getPointAt(r));break}}transformBy(e){return this._geo.vertices.forEach(t=>{const i=new w(t.x,t.y,t.z||0).applyMatrix4(e);t.x=i.x,t.y=i.y,t.z=i.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:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.vertices.map(i=>new w(i.x,i.y,i.z||0));return e.lines(t)}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;++i){const s=this.getPointAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,{x:s.x,y:s.y,z:s.z}),e.writeInt16(70,32)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDb3dPolyline");let t=this.closed?1:0;return t|=8,this.polyType===1&&(t|=16),this.polyType===2&&(t|=32),e.writeInt16(66,this.numberOfVertices>0?1:0),e.writeInt16(70,t),this}};zr.typeName="3dPolyline";let Dn=zr;var nl=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(nl||{});const jr=class jr extends de{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new w,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new Y().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}subGetOsnapPoints(e,t,i,s){s.push(this._position)}transformBy(e){return this._position.applyMatrix4(e),this}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDb3dPolylineVertex"),e.writePoint3d(10,this.position),e.writeInt16(70,this.vertexType|32),this}};jr.typeName="3dVertex";let Js=jr;const Hr=class Hr extends ue{get dxfTypeName(){return"ARC"}constructor(e,t,i,s,r=x.Z_AXIS){super();const a=wr(r);this._geo=new Pt(e,t,i,s,r,a)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}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:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=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}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>k.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,i,s){const r=this.startPoint,a=this.endPoint;switch(e){case D.EndPoint:s.push(r),s.push(a);break;case D.MidPoint:s.push(this.midPoint);break;case D.Nearest:{const o=this._geo.nearestPoint(t);s.push(o)}break;case D.Perpendicular:break;case D.Tangent:{const o=this._geo.tangentPoints(t);s.push(...o);break}}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=Ui(this.center,this.normal);return e.writeSubclassMarker("AcDbArc"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeAngle(50,Ks(this.center,this.startPoint,this.normal)),e.writeAngle(51,Ks(this.center,this.endPoint,this.normal)),e.writeVector3d(210,this.normal),this}};Hr.typeName="Arc";let Vn=Hr;var sl=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(sl||{}),rl=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(rl||{});const Wr=class Wr extends de{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new w,this._alignmentPoint=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(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(e){this._alignmentPoint.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new Y}subGetOsnapPoints(e,t,i,s){D.Insertion===e&&s.push(this._position)}transformBy(e){const t=this._position.clone(),i=this._position.clone().add(new x(Math.cos(this._rotation),Math.sin(this._rotation),0)),s=this._position.clone().add(new x(-Math.sin(this._rotation),Math.cos(this._rotation),0)),r=this._position.clone().add(new x(0,0,1));t.applyMatrix4(e),i.applyMatrix4(e),s.applyMatrix4(e),r.applyMatrix4(e);const a=new x(i).sub(t),o=new x(s).sub(t),h=new x(r).sub(t),c=o.length(),d=a.length(),u=h.length();return this._position.copy(t),d>0&&(this._rotation=Math.atan2(a.y,a.x)),c>0&&(this._height*=c,d>0&&(this._widthFactor*=d/c)),u>0&&(this._thickness*=u),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:e=>{this.textString=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}}]},{groupName:"geometry",properties:[{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}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable,t=e.getAt(this.styleName)??e.getAt(this.database.textstyle)??e.getAt(Q);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(e,t){let i=this.resolveAttachmentPoint(),s;if(i===z.BaselineLeft)s=this._position;else{const a=this._alignmentPoint;a.x===0&&a.y===0&&a.z===0||a.x===this._position.x&&a.y===this._position.y&&a.z===this._position.z?(i=z.BaselineLeft,s=this._position):s=a}const r={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:s,rotation:this.rotation,drawingDirection:He.BOTTOM_TO_TOP,attachmentPoint:i};return e.mtext(r,this.getTextStyle(),t)}resolveAttachmentPoint(){const e=this._horizontalMode,t=this._verticalModel;if(e===4)return z.MiddleCenter;if(e===3||e===5)return z.BaselineLeft;switch(t){case 3:return e===1?z.TopCenter:e===2?z.TopRight:z.TopLeft;case 2:return e===1?z.MiddleCenter:e===2?z.MiddleRight:z.MiddleLeft;case 1:return e===1?z.BottomCenter:e===2?z.BottomRight:z.BottomLeft;case 0:default:return e===1?z.BaselineCenter:e===2?z.BaselineRight:z.BaselineLeft}}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbText"),e.writePoint3d(10,this.position),e.writeDouble(39,this.thickness),e.writeDouble(40,this.height),e.writeString(1,this.textString),e.writeAngle(50,this.rotation),e.writeDouble(41,this.widthFactor),e.writeAngle(51,this.oblique),e.writeString(7,this.styleName),e.writeInt16(72,this.horizontalMode),e.writeInt16(73,this.verticalMode),e.writePoint3d(11,this.alignmentPoint),this}};Wr.typeName="Text";let pi=Wr;var ne=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(ne||{}),We=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(We||{});const Gr=class Gr extends pi{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(e){e?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(e){this._prompt=e}get isConst(){return(this._flags&2)!==0}set isConst(e){e?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(e){e?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(e){e?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(e){e?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}subWorldDraw(e){}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttributeDefinition"),e.writeString(3,this.prompt),e.writeString(2,this.tag),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeInt16(74,this.isReallyLocked?1:0),this}};Gr.typeName="AttDef";let zn=Gr;const Ur=class Ur extends pi{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&ne.Invisible)!==0}set isInvisible(e){e?this._flags|=ne.Invisible:this._flags&=~ne.Invisible}get isConst(){return(this._flags&ne.Const)!==0}set isConst(e){e?this._flags|=ne.Const:this._flags&=~ne.Const}get isVerifiable(){return(this._flags&ne.Verifiable)!==0}set isVerifiable(e){e?this._flags|=ne.Verifiable:this._flags&=~ne.Verifiable}get isPreset(){return(this._flags&ne.Preset)!==0}set isPreset(e){e?this._flags|=ne.Preset:this._flags&=~ne.Preset}get isMTextAttribute(){return(this._mtextFlag&We.MultiLine)!==0}set isMTextAttribute(e){e?this._mtextFlag|=We.MultiLine:this._mtextFlag&=~We.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&We.ConstMultiLine)!==0}set isConstMTextAttribute(e){e?this._mtextFlag|=We.ConstMultiLine:this._mtextFlag&=~We.ConstMultiLine}get tag(){return this._tag}set tag(e){this._tag=e}get fieldLength(){return this._fieldLength}set fieldLength(e){this._fieldLength=e}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(e){this._lockPositionInBlock=e}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(e){this._isReallyLocked=e}get mtext(){return this._mtext}set mtext(e){this._mtext=e,this.isMTextAttribute=e!=null}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbAttribute"),e.writeInt16(70,this.isInvisible?1:0),e.writeInt16(73,this.fieldLength),e.writeString(2,this.tag),e.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&e.writeInt16(71,this.isMTextAttribute?1:0),this}};Ur.typeName="Attrib";let jn=Ur;const Hi=class Hi extends de{get dxfTypeName(){return"INSERT"}constructor(e){super(),this._blockName=e,this._position=new w,this._rotation=0,this._normal=new x(0,0,1),this._scaleFactors=new w(1,1,1),this._attribs=new Map}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(e){this._attribs.set(e.objectId,e),e.ownerId=this.objectId}attributeIterator(){return new hn(this._attribs)}get blockTransform(){const e=this.blockTableRecord,t=(e==null?void 0:e.origin)??w.ORIGIN,i=new j().makeTranslation(-t.x,-t.y,-t.z),s=new j().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),r=new ai().setFromAxisAngle(x.Z_AXIS,this._rotation),a=new j().makeRotationFromQuaternion(r),o=new j().makeTranslation(this._position.x,this._position.y,this._position.z);return new j().multiplyMatrices(o,a).multiply(s).multiply(i)}subGetOsnapPoints(e,t,i,s,r,a){const o=a??new j;D.Insertion===e?s.push(this.getInsertionPoint(o)):r&&this.subEntityGetOsnapPoints(e,t,i,s,r,o)}transformBy(e){const t=new j().setFromExtrusionDirection(this._normal),i=new j().makeRotationZ(this._rotation),s=new j().multiplyMatrices(t,i),r=this._position.clone(),a=new w(this._scaleFactors.x,0,0).applyMatrix4(s).add(r),o=new w(0,this._scaleFactors.y,0).applyMatrix4(s).add(r),h=new w(0,0,this._scaleFactors.z).applyMatrix4(s).add(r);r.applyMatrix4(e),a.applyMatrix4(e),o.applyMatrix4(e),h.applyMatrix4(e);const c=new x(a).sub(r),d=new x(o).sub(r),u=new x(h).sub(r);let p=new x().crossVectors(c,d);p.lengthSq()===0?p=this._normal.clone().transformDirection(e):p.normalize();const m=new j().setFromExtrusionDirection(p).clone().invert(),y=c.clone().applyMatrix4(m);return this._position.copy(r),this._normal.copy(p),this._rotation=Math.atan2(y.y,y.x),this._scaleFactors.set(c.length(),d.length(),u.length()),this._attribs.forEach(_=>_.transformBy(e)),this}get properties(){const e={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: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}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:t=>{this.scaleFactors.x=t}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:t=>{this.scaleFactors.y=t}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:t=>{this.scaleFactors.z=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}}}]}]};if(this._attribs.size>0){const t={groupName:"attribute",properties:[]};e.groups.push(t),this._attribs.forEach(i=>{t.properties.push({name:i.tag,type:"string",editable:!i.isConst,skipTranslation:!0,accessor:{get:()=>i.textString,set:s=>{i.textString=s}}})})}return e}get geometricExtents(){const e=new Y,t=this.blockTableRecord;if(t!=null){const s=t.newIterator();for(const r of s)e.union(r.geometricExtents)}const i=this.blockTransform;return e.applyMatrix4(i),e}subWorldDraw(e){const t=this.blockTableRecord;if(t!=null){const i=this.blockTransform,s=[];return this._attribs.forEach(a=>{if(!a.isInvisible){const o=a.worldDraw(e);o&&s.push(o)}}),ri.instance.draw(e,t,this.rgbColor,s,!0,i,this._normal)}else return e.group([])}dxfOut(e,t=!1){super.dxfOut(e,t);let i=!1;for(const s of this.attributeIterator())i=!0,e.writeStart("ATTRIB"),s.dxfOut(e);return i&&(e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity")),this}subEntityGetOsnapPoints(e,t,i,s,r,a,o=new Set){if(r===this.objectId||o.has(this.objectId))return!1;o.add(this.objectId);try{const h=this.blockTableRecord;if(h==null)return!1;const c=new j().multiplyMatrices(a,this.getFullInsertionTransform());for(const d of h.newIterator()){if(d.objectId===r){const u=new w(t).applyMatrix4(c.clone().invert()),p=new w(i).applyMatrix4(c.clone().invert()),g=[];return d.subGetOsnapPoints(e,u,p,g,r,c),d instanceof Hi?g.forEach(m=>{s.push(m.clone())}):g.forEach(m=>{s.push(new w(m).applyMatrix4(c))}),!0}if(d instanceof Hi&&d.subEntityGetOsnapPoints(e,t,i,s,r,c,o))return!0}return!1}finally{o.delete(this.objectId)}}getInsertionPoint(e){var s;const t=((s=this.blockTableRecord)==null?void 0:s.origin)??w.ORIGIN,i=new j().multiplyMatrices(e,this.getFullInsertionTransform());return new w(t).applyMatrix4(i)}getFullInsertionTransform(){const e=new j().setFromExtrusionDirection(this._normal);return new j().multiplyMatrices(e,this.blockTransform)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockReference"),e.writePoint3d(10,this.position),e.writeString(2,this.blockName),e.writeDouble(41,this.scaleFactors.x),e.writeDouble(42,this.scaleFactors.y),e.writeDouble(43,this.scaleFactors.z),e.writeAngle(50,this.rotation),e.writeVector3d(210,this.normal),this}};Hi.typeName="BlockReference";let ni=Hi;const $r=class $r extends ue{get dxfTypeName(){return"CIRCLE"}constructor(e,t,i=x.Z_AXIS){super();const s=wr(i);this._geo=new Pt(e,t,0,G,i,s)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(e,t,i,s){switch(e){case D.Center:case D.Centroid:s.push(this._geo.center);break;case D.Quadrant:s.push(this._geo.getPointAtAngle(0)),s.push(this._geo.getPointAtAngle(Math.PI/2)),s.push(this._geo.getPointAtAngle(Math.PI)),s.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case D.Nearest:{const r=this._geo.nearestPoint(t);s.push(r)}break;case D.Tangent:{const r=this._geo.tangentPoints(t);s.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:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=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}}},{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 e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){return e.circularArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e);const t=Ui(this.center,this.normal);return e.writeSubclassMarker("AcDbCircle"),e.writePoint3d(10,t),e.writeDouble(40,this.radius),e.writeVector3d(210,this.normal),this}};$r.typeName="Circle";let Hn=$r;const qr=class qr extends ue{get dxfTypeName(){return"ELLIPSE"}constructor(e,t,i,s,r,a,o){super(),this._geo=new ui(e,t,i,s,r,a,o)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:this.closed||(s.push(this._geo.startPoint),s.push(this._geo.endPoint));break;case D.MidPoint:this.closed||s.push(this._geo.midPoint);break;case D.Quadrant:this.closed&&(s.push(this._geo.getPointAtAngle(0)),s.push(this._geo.getPointAtAngle(Math.PI/2)),s.push(this._geo.getPointAtAngle(Math.PI)),s.push(this._geo.getPointAtAngle(Math.PI/2*3)));break}}transformBy(e){return this._geo.transform(e),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:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:e=>{this.center.x=e}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:e=>{this.minorAxisRadius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=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}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(e){return e.ellipticalArc(this._geo)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbEllipse"),e.writePoint3d(10,this.center);const t=this._geo.majorAxis,i=this.majorAxisRadius;return e.writePoint3d(11,{x:t.x*i,y:t.y*i,z:t.z*i}),e.writeVector3d(210,this.normal),e.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),e.writeDouble(41,this.startAngle),e.writeDouble(42,this.endAngle),this}};qr.typeName="Ellipse";let Wn=qr;const Kr=class Kr extends de{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new w,new w,new w],this._edgeInvisibilities=0}getVertexAt(e){return e<0?this._vertices[0]:e>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[e]}setVertexAt(e,t){if(e<0&&this._vertices[0].copy(t),e>=3)return this._vertices.length===3&&this._vertices.push(new w),this._vertices[3].copy(t);this._vertices[e].copy(t)}setEdgeInvisibilities(e){this._edgeInvisibilities=e}isEdgeVisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<e)===0}makeEdgeInvisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<e}get geometricExtents(){return new Y().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(...this._vertices);break}}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this}subWorldDraw(e){const t=this._vertices.length,i=new Float32Array(t*3),s=new Uint16Array(t*2);for(let r=0;r<t;r++)i[r*3]=this._vertices[r].x,i[r*3+1]=this._vertices[r].y,i[r*3+2]=this._vertices[r].z,this.isEdgeVisibleAt(r)&&(s[r*2]=r,s[r*2+1]=(r+1)%4);return e.lineSegments(i,3,s)}dxfOutFields(e){super.dxfOutFields(e);const t=this.getVertexAt(0),i=this.getVertexAt(1),s=this.getVertexAt(2),r=this.getVertexAt(3);e.writeSubclassMarker("AcDbFace"),e.writePoint3d(10,t),e.writePoint3d(11,i),e.writePoint3d(12,s),e.writePoint3d(13,r);let a=0;for(let o=0;o<4;++o)this.isEdgeVisibleAt(o)||(a|=1<<o);return e.writeInt16(70,a),this}};Kr.typeName="Face";let Gn=Kr;const A={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTYPE:"CELTYPE",CELTSCALE:"CELTSCALE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLSTYLE:"CMLSTYLE",CMLSCALE:"CMLSCALE",CMLEADERSTYLE:"CMLEADERSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",HPASSOC:"HPASSOC",HPANG:"HPANG",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",OSMODE:"OSMODE",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",WHITEBKCOLOR:"WHITEBKCOLOR"},Fc=Object.freeze(Object.values(A)),ms=class ms{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new te},this.registerVar({name:A.CECOLOR,type:"color",isDbVar:!0,defaultValue:new X(P.ByLayer)}),this.registerVar({name:A.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:A.CELTYPE,type:"string",isDbVar:!0,defaultValue:pe}),this.registerVar({name:A.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:ii.ByLayer}),this.registerVar({name:A.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new J}),this.registerVar({name:A.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:A.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:gt}),this.registerVar({name:A.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:A.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:pt}),this.registerVar({name:A.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:A.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:A.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:A.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new X(P.None)}),this.registerVar({name:A.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new X(P.ByLayer)}),this.registerVar({name:A.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:A.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:A.HPNAME,type:"string",isDbVar:!1,defaultValue:co}),this.registerVar({name:A.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:A.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new J}),this.registerVar({name:A.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:A.AUNITS,type:"number",isDbVar:!0,defaultValue:_s.DecimalDegrees}),this.registerVar({name:A.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:A.LUNITS,type:"number",isDbVar:!0,defaultValue:Wi.Decimal}),this.registerVar({name:A.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:A.INSUNITS,type:"number",isDbVar:!0,defaultValue:xs.Millimeters}),this.registerVar({name:A.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:A.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const e=new X(P.ByColor);return e.setRGB(96,165,250),e})()}),this.registerVar({name:A.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:A.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:A.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:A.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:Q}),this.registerVar({name:A.WHITEBKCOLOR,type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new ms),this._instance}registerVar(e){const t=this.normalizeName(e.name);this.registry.set(t,{...e,name:t}),e.isDbVar||this.cache.set(t,e.defaultValue)}registerMany(e){e.forEach(t=>this.registerVar(t))}getVar(e,t){e=this.normalizeName(e);const i=this.getDescriptor(e);if(!i)throw new Error(`System variable ${e} not found!`);if(i.isDbVar)return t[e.toLowerCase()];if(this.cache.has(e))return this.cache.get(e)}getDefaultValue(e){e=this.normalizeName(e);const t=this.getDescriptor(e);if(!t)throw new Error(`System variable ${e} not found!`);return t.defaultValue}setVar(e,t,i){e=this.normalizeName(e);const s=this.getDescriptor(e);if(s){const r=this.getVar(e,i);if(s.type==="transparency"){const a=this.parseTransparency(t);if(a==null||a.isInvalid)throw new Error("Invalid transparency value!");t=a}else if(s.type!=="string"&&(typeof t=="string"||t instanceof String)){if(s.type==="number"){const a=Number(t);if(Number.isNaN(a))throw new Error("Invalid number input!");t=a}else if(s.type==="boolean")t=this.parseBoolean(t);else if(s.type==="color"){const a=this.parseColorSysVar(e,t,i);if(a==null)throw new Error("Invalid color value!");t=a}}s.isDbVar?i[e.toLowerCase()]=t:(this.cache.set(e,t),this.hasValueChanged(r,t)&&this.events.sysVarChanged.dispatch({database:i,name:e,newVal:t,oldVal:r}))}else throw new Error(`System variable ${e} not found!`)}getDescriptor(e){return this.registry.get(this.normalizeName(e))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(e){if(e==null)return!1;const t=String(e).trim().toLowerCase(),i=new Set(["true","t","1","yes","y"]),s=new Set(["false","f","0","no","n"]);return i.has(t)?!0:(s.has(t),!1)}parseColorSysVar(e,t,i){const s=t.trim().toLowerCase();return e===A.HPCOLOR.toLowerCase()&&(s==="."||s==="use current")?i.cecolor.clone():e===A.HPBACKGROUNDCOLOR.toLowerCase()&&(s===""||s==="."||s==="none")?new X(P.None):X.fromString(t)}parseTransparency(e){if(e instanceof J)return e;if(typeof e=="number")return J.deserialize(e);if(!(typeof e!="string"&&!(e instanceof String)))return J.fromString(String(e))}hasValueChanged(e,t){return e instanceof X&&t instanceof X||e instanceof J&&t instanceof J?!e.equals(t):!Object.is(e,t)}normalizeName(e){return e.toLowerCase()}};ms._instance=null;let Ne=ms;const Dc={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:23},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.275,dashes:[.2,-.075],sourceLine:24}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:26}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:28},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:29}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:31},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:32}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:34},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:35},{angle:45,originX:.353553391,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:36},{angle:45,originX:.530330086,originY:0,deltaX:0,deltaY:.75,dashes:[],sourceLine:37}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:39},{angle:45,originX:.176776695,originY:0,deltaX:0,deltaY:.25,dashes:[.3125,-.0625,0,-.0625],sourceLine:40}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:.21875,deltaY:.125,dashes:[.3125,-.0625,0,-.0625],sourceLine:42}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:45}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:47},{angle:135,originX:0,originY:0,deltaX:.25,deltaY:.125,dashes:[.3125,-.1875],sourceLine:48}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:54},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[8,-8],sourceLine:55}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:57},{angle:0,originX:-8,originY:.375,deltaX:8,deltaY:8,dashes:[15.625,-.375],sourceLine:58},{angle:90,originX:0,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:59},{angle:90,originX:-.375,originY:0,deltaX:8,deltaY:8,dashes:[-8.375,7.625],sourceLine:60}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[],sourceLine:62},{angle:90,originX:0,originY:0,deltaX:8,deltaY:4,dashes:[8,-8],sourceLine:63}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:65},{angle:0,originX:0,originY:2.25,deltaX:0,deltaY:5.334,dashes:[7.625,-.375],sourceLine:66},{angle:0,originX:2,originY:2.667,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:67},{angle:0,originX:2,originY:4.917,deltaX:0,deltaY:5.334,dashes:[3.625,-.375],sourceLine:68},{angle:90,originX:0,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:69},{angle:90,originX:-.375,originY:0,deltaX:0,deltaY:8,dashes:[2.25,-3.084],sourceLine:70},{angle:90,originX:2,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:71},{angle:90,originX:1.625,originY:2.667,deltaX:0,deltaY:4,dashes:[2.25,-3.084],sourceLine:72}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:2.667,dashes:[],sourceLine:74},{angle:90,originX:0,originY:0,deltaX:2.667,deltaY:4,dashes:[2.667,-2.667],sourceLine:75}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:77},{angle:355,originX:0,originY:0,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:78},{angle:100.45144446,originX:.59771681,originY:-.05229344,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.63740192,-7.01142112],sourceLine:79},{angle:46.1842,originX:0,originY:2,deltaX:6.19462554,deltaY:-8.84684596,dashes:[1.125,-12.375],sourceLine:80},{angle:96.63563549,originX:.88936745,originY:1.86206693,deltaX:8.59588239,deltaY:-10.40964966,dashes:[.95610342,-10.5171376],sourceLine:81},{angle:351.18416399,originX:0,originY:2,deltaX:7.74327494,deltaY:11.05855746,dashes:[.9,-9.90000001],sourceLine:82},{angle:21,originX:1,originY:1.5,deltaX:4.12975034,deltaY:-5.89789472,dashes:[.75,-8.25],sourceLine:83},{angle:326,originX:1,originY:1.5,deltaX:-2.03781207,deltaY:7.3723684,dashes:[.6,-6.6],sourceLine:84},{angle:71.45144474,originX:1.49742254,originY:1.16448426,deltaX:5.7305871,deltaY:-6.9397673,dashes:[.6374019,-7.01142112],sourceLine:85},{angle:37.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-6.52,0,-6.7,0,-6.625],sourceLine:86},{angle:7.5,originX:0,originY:0,deltaX:3.123,deltaY:3.567,dashes:[0,-3.82,0,-6.37,0,-2.525],sourceLine:87},{angle:-32.5,originX:-2.23,originY:0,deltaX:4.6234,deltaY:2.678,dashes:[0,-2.5,0,-7.8,0,-10.35],sourceLine:88},{angle:-42.5,originX:-3.23,originY:0,deltaX:3.6234,deltaY:4.678,dashes:[0,-3.25,0,-5.18,0,-7.35],sourceLine:89}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:4,deltaY:4,dashes:[12,-4],sourceLine:91},{angle:135,originX:2.828427125,originY:2.828427125,deltaX:4,deltaY:-4,dashes:[12,-4],sourceLine:92}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:94},{angle:90,originX:2,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:95},{angle:90,originX:4,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:96},{angle:90,originX:6,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:97},{angle:90,originX:8,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:98},{angle:90,originX:10,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:99},{angle:90,originX:12,originY:0,deltaX:12,deltaY:12,dashes:[12,-12],sourceLine:100},{angle:0,originX:0,originY:12,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:101},{angle:0,originX:0,originY:14,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:102},{angle:0,originX:0,originY:16,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:103},{angle:0,originX:0,originY:18,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:104},{angle:0,originX:0,originY:20,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:105},{angle:0,originX:0,originY:22,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:106},{angle:0,originX:0,originY:24,deltaX:12,deltaY:-12,dashes:[12,-12],sourceLine:107}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:2.2,deltaY:1,dashes:[15,-2,5,-1],sourceLine:109},{angle:0,originX:1.33,originY:.5,deltaX:-1,deltaY:1.33,dashes:[3,-.33,6,-.75],sourceLine:110},{angle:0,originX:.5,originY:.85,deltaX:5.2,deltaY:.67,dashes:[8,-1.4,4,-1],sourceLine:111}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:25.5,deltaY:12,dashes:[6,-5,7,-3,9,-4],sourceLine:113},{angle:0,originX:6,originY:.5,deltaX:25.5,deltaY:12,dashes:[5,-19,4,-6],sourceLine:114},{angle:0,originX:18,originY:-.75,deltaX:25.5,deltaY:12,dashes:[3,-31],sourceLine:115},{angle:90,originX:0,originY:0,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:116},{angle:90,originX:6,originY:0,deltaX:12,deltaY:8.5,dashes:[11.25,-36.75],sourceLine:117},{angle:90,originX:11,originY:0,deltaX:12,deltaY:8.5,dashes:[10.5,-37.5],sourceLine:118},{angle:90,originX:18,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:119},{angle:90,originX:21,originY:-.75,deltaX:12,deltaY:8.5,dashes:[11.5,-36.5],sourceLine:120},{angle:90,originX:30,originY:0,deltaX:12,deltaY:8.5,dashes:[11,-37],sourceLine:121}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:1.123,deltaY:1.567,dashes:[0,-1.52,0,-1.7,0,-1.625],sourceLine:123},{angle:7.5,originX:0,originY:0,deltaX:2.123,deltaY:2.567,dashes:[0,-.82,0,-1.37,0,-.525],sourceLine:124},{angle:-32.5,originX:-1.23,originY:0,deltaX:2.6234,deltaY:1.678,dashes:[0,-.5,0,-1.8,0,-2.35],sourceLine:125},{angle:-42.5,originX:-1.23,originY:0,deltaX:1.6234,deltaY:2.678,dashes:[0,-.25,0,-1.18,0,-1.35],sourceLine:126}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:128},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:129},{angle:0,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:130},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:1,dashes:[-.25,.25],sourceLine:131},{angle:0,originX:0,originY:.5,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:132},{angle:0,originX:0,originY:.75,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:133},{angle:90,originX:.5,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:134},{angle:90,originX:.75,originY:0,deltaX:0,deltaY:1,dashes:[.25,-.25],sourceLine:135}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:137},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.0625],sourceLine:138}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:140},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.5,dashes:[.25,-.25],sourceLine:141},{angle:90,originX:.25,originY:0,deltaX:0,deltaY:.5,dashes:[-.25,.25],sourceLine:142}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.33,dashes:[],sourceLine:144},{angle:90,originX:.9,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:145},{angle:90,originX:.8,originY:0,deltaX:.33,deltaY:.5,dashes:[.33,-.33],sourceLine:146},{angle:0,originX:.9,originY:.055,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:147},{angle:0,originX:.9,originY:.11,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:148},{angle:0,originX:.9,originY:.165,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:149},{angle:0,originX:.9,originY:.22,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:150},{angle:0,originX:.9,originY:.275,deltaX:.5,deltaY:.33,dashes:[-.9,.1],sourceLine:151}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.1875,dashes:[],sourceLine:153},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.1875,dashes:[],sourceLine:154},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.1875,dashes:[],sourceLine:155},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.1875,dashes:[.1875,-.125],sourceLine:156}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:158},{angle:135,originX:.0625,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:159},{angle:135,originX:.09375,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:160},{angle:135,originX:.125,originY:-.0625,deltaX:0,deltaY:.35355339,dashes:[.176776696,-.176776696],sourceLine:161}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:163},{angle:90,originX:.0625,originY:-.0625,deltaX:.25,deltaY:.25,dashes:[.125,-.375],sourceLine:164}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:166}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:168},{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[.3535533905932738,-.7071067811865476],sourceLine:169}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.03125,deltaY:.0625,dashes:[0,-.0625],sourceLine:171}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:173},{angle:0,originX:0,originY:.09375,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:174},{angle:0,originX:0,originY:.1875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:175},{angle:90,originX:.03125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:176},{angle:90,originX:.125,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:177},{angle:90,originX:.21875,originY:.21875,deltaX:.25,deltaY:.25,dashes:[.25,-.25],sourceLine:178}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:180},{angle:180,originX:0,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:181},{angle:300,originX:0,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[1.1,-.1],sourceLine:182},{angle:60,originX:.1,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:183},{angle:300,originX:.1,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:184},{angle:60,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:185},{angle:180,originX:-.05,originY:.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:186},{angle:300,originX:-.05,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:187},{angle:180,originX:-.05,originY:-.08660254,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:188},{angle:60,originX:-.4,originY:0,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:189},{angle:300,originX:-.4,originY:0,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:190},{angle:60,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:191},{angle:180,originX:.2,originY:-.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:192},{angle:300,originX:.2,originY:.346410161,deltaX:.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:193},{angle:180,originX:.2,originY:.346410161,deltaX:-.6,deltaY:1.039230484,dashes:[.2,-1],sourceLine:194},{angle:0,originX:.2,originY:.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:195},{angle:0,originX:.2,originY:-.173205081,deltaX:-.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:196},{angle:120,originX:.05,originY:.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:197},{angle:120,originX:-.25,originY:.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:198},{angle:240,originX:-.25,originY:-.08660254,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:199},{angle:240,originX:.05,originY:-.259807621,deltaX:.6,deltaY:1.039230484,dashes:[.7,-.5],sourceLine:200}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[.25,-.25],sourceLine:202},{angle:45,originX:.25,originY:0,deltaX:.176776695296,deltaY:.176776695296,dashes:[.0625,-.2285533906,.0625,-.353553390593],sourceLine:203}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:205},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:206},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:207}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:209},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:210},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:211}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:213},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:214},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:215}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:.707106781,deltaY:.707106781,dashes:[.1875,-1.226713563],sourceLine:217},{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:218},{angle:135,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[.1875,-.8125],sourceLine:219}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.03125,dashes:[],sourceLine:221},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:222}]},{name:"GRAVEL",description:"",lines:[{angle:228.012787504,originX:.72,originY:1,deltaX:12.0413651692039,deltaY:.0743294146632,dashes:[.134536,-13.3190880470737],sourceLine:224},{angle:184.969740728,originX:.63,originY:.9,deltaX:-12.0415166747131,deltaY:.0433148081592,dashes:[.230868,-22.85592476123],sourceLine:225},{angle:132.510447078,originX:.4,originY:.88,deltaX:-14.8659418273816,deltaY:.061429511683,dashes:[.162788,-16.1160325960997],sourceLine:226},{angle:267.273689006,originX:.01,originY:.63,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:227},{angle:292.833654178,originX:0,originY:.42,deltaX:-12.9999095019474,deltaY:.048507125026,dashes:[.206155,-20.4093731280883],sourceLine:228},{angle:357.273689006,originX:.08,originY:.23,deltaX:-20.0249279039043,deltaY:.0475651493827,dashes:[.210238,-20.813558041629],sourceLine:229},{angle:37.6942404667,originX:.29,originY:.22,deltaX:-16.4011800288558,deltaY:.0359675000664,dashes:[.278029,-27.524848548916],sourceLine:230},{angle:72.2553283749,originX:.51,originY:.39,deltaX:23.0867613281116,deltaY:.0380969659053,dashes:[.262488,-25.9863214968134],sourceLine:231},{angle:121.429565615,originX:.59,originY:.64,deltaX:15.2642639131074,deltaY:.047404546271,dashes:[.21095,-20.884073109729],sourceLine:232},{angle:175.236358309,originX:.48,originY:.82,deltaX:-11.0450488205478,deltaY:.083045479801,dashes:[.240832,-11.8007625787923],sourceLine:233},{angle:222.397437798,originX:.24,originY:.84,deltaX:16.2787889313724,deltaY:.0321080648114,dashes:[.311448,-30.8333750047949],sourceLine:234},{angle:138.814074834,originX:1,originY:.62,deltaX:9.2190645101588,deltaY:.0940720868851,dashes:[.106301,-10.5238448127347],sourceLine:235},{angle:171.46923439,originX:.92,originY:.69,deltaX:-13.1528534931484,deltaY:.0494468176315,dashes:[.202237,-20.021511416157],sourceLine:236},{angle:225,originX:.72,originY:.72,deltaX:.7071067811865,deltaY:.7071067811865,dashes:[.141421,-1.2727925623731],sourceLine:237},{angle:203.198590514,originX:.65,originY:.84,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.076158,-7.5396151058639],sourceLine:238},{angle:291.801409486,originX:.58,originY:.81,deltaX:-3.156820749011,deltaY:.185695338158,dashes:[.107703,-5.2774618071345],sourceLine:239},{angle:30.9637565321,originX:.62,originY:.71,deltaX:3.6014702879928,deltaY:.1714985851408,dashes:[.174929,-5.6560228948453],sourceLine:240},{angle:161.565051177,originX:.77,originY:.8,deltaX:-2.2135943621183,deltaY:.3162277660138,dashes:[.126491,-3.0357866601684],sourceLine:241},{angle:16.389540334,originX:0,originY:.81,deltaX:10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.5428451466694],sourceLine:242},{angle:70.3461759419,originX:.17,originY:.86,deltaX:-11.7045066155395,deltaY:.0672672793901,dashes:[.148661,-14.717407747319],sourceLine:243},{angle:293.198590514,originX:.77,originY:1,deltaX:-5.3835637472478,deltaY:.1313064328928,dashes:[.152315,-7.4634581058639],sourceLine:244},{angle:343.610459666,originX:.83,originY:.86,deltaX:-10.4401539876873,deltaY:.0564332648047,dashes:[.1772,-17.542845146669],sourceLine:245},{angle:339.44395478,originX:0,originY:.19,deltaX:-5.3838927710229,deltaY:.117041147157,dashes:[.17088,-8.3731237453175],sourceLine:246},{angle:294.775140569,originX:.16,originY:.13,deltaX:-12.0828441168135,deltaY:.0698430296124,dashes:[.143178,-14.174643063276],sourceLine:247},{angle:66.8014094864,originX:.78,originY:0,deltaX:5.3835637472487,deltaY:.1313064328552,dashes:[.152315,-7.4634581058639],sourceLine:248},{angle:17.3540246363,originX:.84,originY:.14,deltaX:-13.6013396869991,deltaY:.0596549986364,dashes:[.167631,-16.59542361424],sourceLine:249},{angle:69.4439547804,originX:.29,originY:0,deltaX:-5.383892771022,deltaY:.1170411471946,dashes:[.08544,-8.4585637453175],sourceLine:250},{angle:101.309932474,originX:.72,originY:0,deltaX:4.1184388379018,deltaY:.1961161351396,dashes:[.05099,-5.0480295135928],sourceLine:251},{angle:165.963756532,originX:.71,originY:.05,deltaX:-3.1529631254726,deltaY:.2425356250323,dashes:[.206155,-3.9169506256177],sourceLine:252},{angle:186.009005957,originX:.51,originY:.1,deltaX:-10.0497393137326,deltaY:.0523423921723,dashes:[.19105,-18.9139231745428],sourceLine:253},{angle:303.690067526,originX:.62,originY:.62,deltaX:-2.2188007849008,deltaY:.2773500981134,dashes:[.144222,-3.461329275464],sourceLine:254},{angle:353.157226587,originX:.7,originY:.5,deltaX:17.1171966955143,deltaY:.0397150736497,dashes:[.251794,-24.9275626240283],sourceLine:255},{angle:60.9453959009,originX:.95,originY:.47,deltaX:-8.0616726575653,deltaY:.0971285862325,dashes:[.102956,-10.192674140987],sourceLine:256},{angle:90,originX:1,originY:.56,deltaX:1,deltaY:1,dashes:[.06,-.94],sourceLine:257},{angle:120.256437164,originX:.49,originY:.13,deltaX:-8.0619364083848,deltaY:.0719815751411,dashes:[.138924,-13.7535199894498],sourceLine:258},{angle:48.0127875042,originX:.42,originY:.25,deltaX:12.0413651692041,deltaY:.0743294146212,dashes:[.269072,-13.1845520470737],sourceLine:259},{angle:0,originX:.6,originY:.45,deltaX:1,deltaY:1,dashes:[.26,-.74],sourceLine:260},{angle:325.304846469,originX:.86,originY:.45,deltaX:12.2063917682497,deltaY:-.063245553253,dashes:[.158114,-15.653274300842],sourceLine:261},{angle:254.054604099,originX:.99,originY:.36,deltaX:4.1208169184605,deltaY:.1373605639542,dashes:[.145602,-7.1345078892805],sourceLine:262},{angle:207.645975364,originX:.95,originY:.22,deltaX:21.4708691170287,deltaY:.0421824539631,dashes:[.237065,-23.4694741822594],sourceLine:263},{angle:175.42607874,originX:.74,originY:.11,deltaX:13.0383438432524,deltaY:.039872611164,dashes:[.250799,-24.8290734079689],sourceLine:264}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:266},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:267},{angle:60,originX:.125,originY:0,deltaX:0,deltaY:.21650635094610965,dashes:[.125,-.25],sourceLine:268}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:270},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[.125,-.25],sourceLine:271},{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.10825317547305482,dashes:[-.25,.125],sourceLine:272}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.25,deltaY:.0625,dashes:[1,-.5],sourceLine:274},{angle:90,originX:0,originY:0,deltaX:-.25,deltaY:.0625,dashes:[1,-.5],sourceLine:275}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.375,dashes:[],sourceLine:277},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:278},{angle:0,originX:0,originY:.25,deltaX:0,deltaY:.375,dashes:[.125,-.125],sourceLine:279}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:292}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:294}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:296}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:298}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:300},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:301}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:303}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:305}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:307}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:309}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:311}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:313}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:315},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:316}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:318},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:319}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:321},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:322}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:327}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.25,dashes:[.25,-.25,0,-.25,0,-.25],sourceLine:329}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:331},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:332}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:334},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:335},{angle:120,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:336}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:338},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:339},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:340}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:342},{angle:0,originX:0,originY:.03125,deltaX:0,deltaY:.25,dashes:[],sourceLine:343},{angle:0,originX:0,originY:.0625,deltaX:0,deltaY:.25,dashes:[],sourceLine:344},{angle:0,originX:0,originY:.15625,deltaX:0,deltaY:.25,dashes:[],sourceLine:345}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.09375,dashes:[],sourceLine:347},{angle:45,originX:.066291261,originY:0,deltaX:0,deltaY:.09375,dashes:[0,-.09375],sourceLine:348}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:350},{angle:90,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[.125,-.125],sourceLine:351}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:353},{angle:60,originX:0,originY:0,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:354},{angle:120,originX:.0625,originY:.108253176,deltaX:0,deltaY:.216506351,dashes:[.125,-.125],sourceLine:355}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.125,dashes:[],sourceLine:357},{angle:45,originX:0,originY:.0625,deltaX:0,deltaY:.125,dashes:[],sourceLine:358}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.125,-.875],sourceLine:360},{angle:90,originX:.0625,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.0625,-1.669550806],sourceLine:361},{angle:90,originX:.078125,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:362},{angle:90,originX:.046875,originY:0,deltaX:.866025403,deltaY:.5,dashes:[.05,-1.682050806],sourceLine:363},{angle:60,originX:.09375,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:364},{angle:120,originX:.03125,originY:0,deltaX:.5,deltaY:.866025403,dashes:[.04,-.96],sourceLine:365}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.25,dashes:[],sourceLine:367},{angle:0,originX:0,originY:.125,deltaX:0,deltaY:.25,dashes:[.125,-.125],sourceLine:368}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:370},{angle:120,originX:0,originY:0,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:371},{angle:0,originX:-.09375,originY:.162379763,deltaX:.1875,deltaY:.324759526,dashes:[.1875,-.1875],sourceLine:372}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:374},{angle:90,originX:.125,originY:0,deltaX:.125,deltaY:.125,dashes:[.125,-.125],sourceLine:375}]}],issues:[]},al={patterns:[{name:"SOLID",description:"",lines:[]},{name:"ANGLE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:20},{angle:90,originX:0,originY:0,deltaX:0,deltaY:6.985,dashes:[5.08,-1.905],sourceLine:21}]},{name:"ANSI31",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:23}]},{name:"ANSI32",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:25},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:26}]},{name:"ANSI33",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:28},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:29}]},{name:"ANSI34",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:31},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:32},{angle:45,originX:8.98026,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:33},{angle:45,originX:13.4704,originY:0,deltaX:0,deltaY:19.05,dashes:[],sourceLine:34}]},{name:"ANSI35",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:36},{angle:45,originX:4.49013,originY:0,deltaX:0,deltaY:6.35,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:37}]},{name:"ANSI36",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:5.55625,deltaY:3.175,dashes:[7.9375,-1.5875,0,-1.5875],sourceLine:39}]},{name:"ANSI37",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:41},{angle:135,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:42}]},{name:"ANSI38",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:44},{angle:135,originX:0,originY:0,deltaX:6.35,deltaY:3.175,dashes:[7.9375,-4.7625],sourceLine:45}]},{name:"AR-B816",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:47},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[203.2,-203.2],sourceLine:48}]},{name:"AR-B816C",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:50},{angle:0,originX:-203.2,originY:9.525,deltaX:203.2,deltaY:203.2,dashes:[396.875,-9.525],sourceLine:51},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:52},{angle:90,originX:-9.525,originY:0,deltaX:203.2,deltaY:203.2,dashes:[-212.725,193.675],sourceLine:53}]},{name:"AR-B88",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[],sourceLine:55},{angle:90,originX:0,originY:0,deltaX:203.2,deltaY:101.6,dashes:[203.2,-203.2],sourceLine:56}]},{name:"AR-BRELM",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:58},{angle:0,originX:0,originY:57.15,deltaX:0,deltaY:135.484,dashes:[193.675,-9.525],sourceLine:59},{angle:0,originX:50.8,originY:67.7418,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:60},{angle:0,originX:50.8,originY:124.892,deltaX:0,deltaY:135.484,dashes:[92.075,-9.525],sourceLine:61},{angle:90,originX:0,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:62},{angle:90,originX:-9.525,originY:0,deltaX:0,deltaY:203.2,dashes:[57.15,-78.334],sourceLine:63},{angle:90,originX:50.8,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:64},{angle:90,originX:41.275,originY:67.7418,deltaX:0,deltaY:101.6,dashes:[57.15,-78.334],sourceLine:65}]},{name:"AR-BRSTD",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:67.7418,dashes:[],sourceLine:67},{angle:90,originX:0,originY:0,deltaX:67.7418,deltaY:101.6,dashes:[67.7418,-67.7418],sourceLine:68}]},{name:"AR-CONC",description:"",lines:[{angle:50,originX:0,originY:0,deltaX:104.896,deltaY:-149.807,dashes:[19.05,-209.55],sourceLine:70},{angle:355,originX:0,originY:0,deltaX:-51.76101082,deltaY:187.25814969,dashes:[15.24,-167.64058417],sourceLine:71},{angle:100.4514447,originX:15.182007,originY:-1.3282535,deltaX:145.5569059,deltaY:-176.270089,dashes:[16.1900088,-178.0902446],sourceLine:72},{angle:46.1842,originX:0,originY:50.8,deltaX:157.343,deltaY:-224.71,dashes:[28.575,-314.325],sourceLine:73},{angle:96.63555761,originX:22.5899,originY:47.2965,deltaX:218.33577212,deltaY:-264.40480444,dashes:[24.28502314,-267.13560816],sourceLine:74},{angle:351.18415117,originX:0,originY:50.8,deltaX:196.67912063,deltaY:280.88740361,dashes:[22.85996707,-251.45973192],sourceLine:75},{angle:21,originX:25.4,originY:38.1,deltaX:104.89565868,deltaY:-149.80652586,dashes:[19.05,-209.55],sourceLine:76},{angle:326,originX:25.4,originY:38.1,deltaX:-51.7604,deltaY:187.258,dashes:[15.24,-167.64],sourceLine:77},{angle:71.451445,originX:38.0345326,originY:29.5779001,deltaX:145.5567546,deltaY:-176.2700748,dashes:[16.1900088,-178.0899376],sourceLine:78},{angle:37.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-165.608,0,-170.18,0,-168.275],sourceLine:79},{angle:7.5,originX:0,originY:0,deltaX:79.3242,deltaY:90.6018,dashes:[0,-97.028,0,-161.798,0,-64.135],sourceLine:80},{angle:-32.5,originX:-56.642,originY:0,deltaX:117.434,deltaY:68.0212,dashes:[0,-63.5,0,-198.12,0,-262.89],sourceLine:81},{angle:-42.5,originX:-82.042,originY:0,deltaX:92.0344,deltaY:118.821,dashes:[0,-82.55,0,-131.572,0,-186.69],sourceLine:82}]},{name:"AR-HBONE",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:101.6,deltaY:101.6,dashes:[304.8,-101.6],sourceLine:84},{angle:135,originX:71.842,originY:71.842,deltaX:101.6,deltaY:-101.6,dashes:[304.8,-101.6],sourceLine:85}]},{name:"AR-PARQ1",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:87},{angle:90,originX:50.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:88},{angle:90,originX:101.6,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:89},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:90},{angle:90,originX:203.2,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:91},{angle:90,originX:254,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:92},{angle:90,originX:304.8,originY:0,deltaX:304.8,deltaY:304.8,dashes:[304.8,-304.8],sourceLine:93},{angle:0,originX:0,originY:304.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:94},{angle:0,originX:0,originY:355.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:95},{angle:0,originX:0,originY:406.4,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:96},{angle:0,originX:0,originY:457.2,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:97},{angle:0,originX:0,originY:508,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:98},{angle:0,originX:0,originY:558.8,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:99},{angle:0,originX:0,originY:609.6,deltaX:304.8,deltaY:-304.8,dashes:[304.8,-304.8],sourceLine:100}]},{name:"AR-RROOF",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:55.88,deltaY:25.4,dashes:[381,-50.8,127,-25.4],sourceLine:102},{angle:0,originX:33.782,originY:12.7,deltaX:-25.4,deltaY:33.782,dashes:[76.2,-8.382,152.4,-19.05],sourceLine:103},{angle:0,originX:12.7,originY:21.59,deltaX:132.08,deltaY:17.018,dashes:[203.2,-35.56,101.6,-25.4],sourceLine:104}]},{name:"AR-RSHKE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:647.7,deltaY:304.8,dashes:[152.4,-127,177.8,-76.2,228.6,-101.6],sourceLine:106},{angle:0,originX:152.4,originY:12.7,deltaX:647.7,deltaY:304.8,dashes:[127,-482.6,101.6,-152.4],sourceLine:107},{angle:0,originX:457.2,originY:-19.05,deltaX:647.7,deltaY:304.8,dashes:[76.2,-787.4],sourceLine:108},{angle:90,originX:0,originY:0,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:109},{angle:90,originX:152.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[285.75,-933.45],sourceLine:110},{angle:90,originX:279.4,originY:0,deltaX:304.8,deltaY:215.9,dashes:[266.7,-952.5],sourceLine:111},{angle:90,originX:457.2,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:112},{angle:90,originX:533.4,originY:-19.05,deltaX:304.8,deltaY:215.9,dashes:[292.1,-927.1],sourceLine:113},{angle:90,originX:762,originY:0,deltaX:304.8,deltaY:215.9,dashes:[279.4,-939.8],sourceLine:114}]},{name:"AR-SAND",description:"",lines:[{angle:37.5,originX:0,originY:0,deltaX:28.5242,deltaY:39.8018,dashes:[0,-38.608,0,-43.18,0,-41.275],sourceLine:116},{angle:7.5,originX:0,originY:0,deltaX:53.9242,deltaY:65.2018,dashes:[0,-20.828,0,-34.798,0,-13.335],sourceLine:117},{angle:-32.5,originX:-31.242,originY:0,deltaX:66.6344,deltaY:42.6212,dashes:[0,-12.7,0,-45.72,0,-59.69],sourceLine:118},{angle:-42.5,originX:-31.242,originY:0,deltaX:41.2344,deltaY:68.0212,dashes:[0,-6.35,0,-29.972,0,-34.29],sourceLine:119}]},{name:"BOX",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:121},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:25.4,dashes:[],sourceLine:122},{angle:0,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:123},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:25.4,dashes:[-6.35,6.35],sourceLine:124},{angle:0,originX:0,originY:12.7,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:125},{angle:0,originX:0,originY:19.05,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:126},{angle:90,originX:12.7,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:127},{angle:90,originX:19.05,originY:0,deltaX:0,deltaY:25.4,dashes:[6.35,-6.35],sourceLine:128}]},{name:"BRASS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:130},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-1.5875],sourceLine:131}]},{name:"BRICK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:133},{angle:90,originX:0,originY:0,deltaX:0,deltaY:12.7,dashes:[6.35,-6.35],sourceLine:134},{angle:90,originX:6.35,originY:0,deltaX:0,deltaY:12.7,dashes:[-6.35,6.35],sourceLine:135}]},{name:"BRSTONE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:8.382,dashes:[],sourceLine:137},{angle:90,originX:22.86,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:138},{angle:90,originX:20.32,originY:0,deltaX:8.382,deltaY:12.7,dashes:[8.382,-8.382],sourceLine:139},{angle:0,originX:22.86,originY:1.397,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:140},{angle:0,originX:22.86,originY:2.794,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:141},{angle:0,originX:22.86,originY:4.191,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:142},{angle:0,originX:22.86,originY:5.588,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:143},{angle:0,originX:22.86,originY:6.985,deltaX:12.7,deltaY:8.382,dashes:[-22.86,2.54],sourceLine:144}]},{name:"CLAY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:146},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:147},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:4.7625,dashes:[],sourceLine:148},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:4.7625,dashes:[4.7625,-3.175],sourceLine:149}]},{name:"CORK",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:151},{angle:135,originX:1.5875,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:152},{angle:135,originX:2.38125,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:153},{angle:135,originX:3.175,originY:-1.5875,deltaX:0,deltaY:8.98026,dashes:[4.49013,-4.49013],sourceLine:154}]},{name:"CROSS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:156},{angle:90,originX:1.5875,originY:-1.5875,deltaX:6.35,deltaY:6.35,dashes:[3.175,-9.525],sourceLine:157}]},{name:"DASH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:159}]},{name:"DOLMIT",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:161},{angle:45,originX:0,originY:0,deltaX:0,deltaY:17.9605,dashes:[8.980256121069154,-17.960512242138307],sourceLine:162}]},{name:"DOTS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:.79375,deltaY:1.5875,dashes:[0,-1.5875],sourceLine:164}]},{name:"EARTH",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:166},{angle:0,originX:0,originY:2.38125,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:167},{angle:0,originX:0,originY:4.7625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:168},{angle:90,originX:.79375,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:169},{angle:90,originX:3.175,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:170},{angle:90,originX:5.55625,originY:5.55625,deltaX:6.35,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:171}]},{name:"ESCHER",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:173},{angle:180,originX:0,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:174},{angle:300,originX:0,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[27.94,-2.54],sourceLine:175},{angle:60,originX:2.54,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:176},{angle:300,originX:2.54,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:177},{angle:60,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:178},{angle:180,originX:-1.27,originY:2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:179},{angle:300,originX:-1.27,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:180},{angle:180,originX:-1.27,originY:-2.199704516,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:181},{angle:60,originX:-10.16,originY:0,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:182},{angle:300,originX:-10.16,originY:0,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:183},{angle:60,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:184},{angle:180,originX:5.08,originY:-8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:185},{angle:300,originX:5.08,originY:8.7988180894,deltaX:15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:186},{angle:180,originX:5.08,originY:8.7988180894,deltaX:-15.24,deltaY:26.3964542936,dashes:[5.08,-25.4],sourceLine:187},{angle:0,originX:5.08,originY:4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:188},{angle:0,originX:5.08,originY:-4.3994090574,deltaX:-15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:189},{angle:120,originX:1.27,originY:6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:190},{angle:120,originX:-6.35,originY:2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:191},{angle:240,originX:-6.35,originY:-2.199704516,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:192},{angle:240,originX:1.27,originY:-6.5991135734,deltaX:15.24,deltaY:26.3964542936,dashes:[17.78,-12.7],sourceLine:193}]},{name:"FLEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[6.35,-6.35],sourceLine:195},{angle:45,originX:6.35,originY:0,deltaX:4.490128053,deltaY:4.490128053,dashes:[1.5875,-5.8052561314,1.5875,-8.9802561314],sourceLine:196}]},{name:"GOST_GLASS",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:6,deltaY:-6,dashes:[5,-7],sourceLine:198},{angle:45,originX:2.12132,originY:0,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:199},{angle:45,originX:0,originY:2.12132,deltaX:6,deltaY:-6,dashes:[2,-10],sourceLine:200}]},{name:"GOST_WOOD",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:202},{angle:90,originX:2,originY:-2,deltaX:0,deltaY:-6,dashes:[6,-1.5,3,-1.5],sourceLine:203},{angle:90,originX:4,originY:-5,deltaX:0,deltaY:-6,dashes:[10,-2],sourceLine:204}]},{name:"GOST_GROUND",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:206},{angle:45,originX:3,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:207},{angle:45,originX:6,originY:0,deltaX:10,deltaY:-10,dashes:[20],sourceLine:208}]},{name:"GRASS",description:"",lines:[{angle:90,originX:0,originY:0,deltaX:17.96051224,deltaY:17.96051224,dashes:[4.7625,-31.15852448],sourceLine:210},{angle:45,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:211},{angle:135,originX:0,originY:0,deltaX:0,deltaY:25.4,dashes:[4.7625,-20.6375],sourceLine:212}]},{name:"GRATE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:.79375,dashes:[],sourceLine:214},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:215}]},{name:"GRAVEL",description:"",lines:[{angle:228.0127875,originX:18.288,originY:25.4,deltaX:305.85067529778,deltaY:1.88796713245,dashes:[3.4172144,-338.30483639565],sourceLine:217},{angle:184.969741,originX:16.002,originY:22.86,deltaX:-305.8545235377,deltaY:1.10019612724,dashes:[5.8640472,-580.54048893524],sourceLine:218},{angle:132.5104471,originX:10.16,originY:22.352,deltaX:-377.59492241548,deltaY:1.56030959675,dashes:[4.1348152,-409.347227941],sourceLine:219},{angle:267.273689,originX:.254,originY:16.002,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:220},{angle:292.83365418,originX:0,originY:10.668,deltaX:-330.19770134945,deltaY:1.23208097566,dashes:[5.236337,-518.39807745344],sourceLine:221},{angle:357.273689,originX:2.032,originY:5.842,deltaX:-508.63316875916,deltaY:1.20815479432,dashes:[5.3400452,-528.66437425738],sourceLine:222},{angle:37.69424047,originX:7.366,originY:5.588,deltaX:-416.58997273292,deltaY:.91357450169,dashes:[7.0619366,-699.13115314247],sourceLine:223},{angle:72.25532837,originX:12.954,originY:9.906,deltaX:586.40373773403,deltaY:.96766293399,dashes:[6.6671952,-660.05256601905],sourceLine:224},{angle:121.42956562,originX:14.986,originY:16.256,deltaX:387.71230339293,deltaY:1.2040754753,dashes:[5.35813,-530.45545698712],sourceLine:225},{angle:175.2363583,originX:12.192,originY:20.828,deltaX:-280.5442400419,deltaY:2.10935518695,dashes:[6.1171328,-299.7393695],sourceLine:226},{angle:222.3974378,originX:6.096,originY:21.336,deltaX:413.48123885686,deltaY:.81554484621,dashes:[7.9107792,-783.16772512177],sourceLine:227},{angle:138.81407483,originX:25.4,originY:15.748,deltaX:234.164238558,deltaY:2.38943100688,dashes:[2.7000454,-267.30565824344],sourceLine:228},{angle:171.4692344,originX:23.368,originY:17.526,deltaX:-334.082478726,deltaY:1.25594916784,dashes:[5.1368198,-508.5463899704],sourceLine:229},{angle:225,originX:18.288,originY:18.288,deltaX:17.96051224214,deltaY:17.96051224214,dashes:[3.5920934,-32.32893108428],sourceLine:230},{angle:203.19859051,originX:16.51,originY:21.336,deltaX:-136.74251918,deltaY:3.33518339548,dashes:[1.9344132,-191.50622368894],sourceLine:231},{angle:291.80140949,originX:14.732,originY:20.574,deltaX:-80.18324702488,deltaY:4.71666158921,dashes:[2.7356562,-134.0475299],sourceLine:232},{angle:30.96375653,originX:15.748,originY:18.034,deltaX:91.47734531502,deltaY:4.35606406258,dashes:[4.4431966,-143.6629815291],sourceLine:233},{angle:161.56505118,originX:19.558,originY:20.32,deltaX:-56.2252967978,deltaY:8.03218525675,dashes:[3.2128714,-77.10898116828],sourceLine:234},{angle:16.389540334,originX:0,originY:20.574,deltaX:265.17991128726,deltaY:1.43340492604,dashes:[4.50088,-445.58826672539],sourceLine:235},{angle:70.34617594,originX:4.318,originY:21.844,deltaX:-297.29446803469,deltaY:1.70858889651,dashes:[3.7759894,-373.822156782],sourceLine:236},{angle:293.19859051,originX:19.558,originY:25.4,deltaX:-136.7425191801,deltaY:3.33518339548,dashes:[3.868801,-189.57183588894],sourceLine:237},{angle:343.61045967,originX:21.082,originY:21.844,deltaX:-265.17991128725,deltaY:1.433404926,dashes:[4.50088,-445.5882667254],sourceLine:238},{angle:339.44395478,originX:0,originY:4.826,deltaX:-136.75087638398,deltaY:2.97284513779,dashes:[4.340352,-212.67734313106],sourceLine:239},{angle:294.7751406,originX:4.064,originY:3.302,deltaX:-306.90424056705,deltaY:1.77401295215,dashes:[3.6367212,-360.0359338072],sourceLine:240},{angle:66.80140949,originX:19.812,originY:0,deltaX:136.74251918012,deltaY:3.33518339452,dashes:[3.868801,-189.57183588894],sourceLine:241},{angle:17.35402464,originX:21.336,originY:3.556,deltaX:-345.47402804977,deltaY:1.51523696536,dashes:[4.2578274,-421.523759802],sourceLine:242},{angle:69.44395478,originX:7.366,originY:0,deltaX:-136.75087638396,deltaY:2.97284513874,dashes:[2.170176,-214.84751913106],sourceLine:243},{angle:101.309932474,originX:18.288,originY:0,deltaX:104.60834648271,deltaY:4.98134983255,dashes:[1.295146,-128.21994964526],sourceLine:244},{angle:165.963756532,originX:18.034,originY:1.27,deltaX:-80.085263387,deltaY:6.16040487582,dashes:[5.236337,-99.49054589069],sourceLine:245},{angle:186.00900596,originX:12.954,originY:2.54,deltaX:-255.26337856879,deltaY:1.32949676118,dashes:[4.85267,-480.41364863337],sourceLine:246},{angle:303.69006753,originX:15.748,originY:15.748,deltaX:-56.35753993648,deltaY:7.0446924921,dashes:[3.6632388,-87.9177635968],sourceLine:247},{angle:353.15722659,originX:17.78,originY:12.7,deltaX:434.77679606606,deltaY:1.0087628707,dashes:[6.3955676,-633.16009065031],sourceLine:248},{angle:60.9453959,originX:24.13,originY:11.938,deltaX:-204.76648550216,deltaY:2.46706609031,dashes:[2.6150824,-258.8939231811],sourceLine:249},{angle:90,originX:25.4,originY:14.224,deltaX:25.4,deltaY:25.4,dashes:[1.524,-23.876],sourceLine:250},{angle:120.25643716,originX:12.446,originY:3.302,deltaX:-204.77318477297,deltaY:1.8283320086,dashes:[3.5286696,-349.339407732],sourceLine:251},{angle:48.0127875,originX:10.668,originY:6.35,deltaX:305.85067529778,deltaY:1.88796713138,dashes:[6.8344288,-334.88762199565],sourceLine:252},{angle:0,originX:15.24,originY:11.43,deltaX:25.4,deltaY:25.4,dashes:[6.604,-18.796],sourceLine:253},{angle:325.3048465,originX:21.844,originY:11.43,deltaX:310.04235091354,deltaY:-1.6064370526,dashes:[4.0160956,-397.5931672414],sourceLine:254},{angle:254.0546041,originX:25.146,originY:9.144,deltaX:104.6687497289,deltaY:3.48895832444,dashes:[3.6982908,-181.21650038772],sourceLine:255},{angle:207.64597536,originX:24.13,originY:5.588,deltaX:545.36007557253,deltaY:1.07143433066,dashes:[6.021451,-596.12464422938],sourceLine:256},{angle:175.42607874,originX:18.796,originY:2.794,deltaX:331.1739336186,deltaY:1.01276432357,dashes:[6.3702946,-630.6584645624],sourceLine:257}]},{name:"HEX",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:259},{angle:120,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:260},{angle:60,originX:3.175,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-6.35],sourceLine:261}]},{name:"HONEY",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:263},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[3.175,-6.35],sourceLine:264},{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:2.749630645,dashes:[-6.35,3.175],sourceLine:265}]},{name:"HOUND",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:267},{angle:90,originX:0,originY:0,deltaX:-6.35,deltaY:1.5875,dashes:[25.4,-12.7],sourceLine:268}]},{name:"INSUL",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:9.525,dashes:[],sourceLine:270},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:271},{angle:0,originX:0,originY:6.35,deltaX:0,deltaY:9.525,dashes:[3.175,-3.175],sourceLine:272}]},{name:"ACAD_ISO02W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3],sourceLine:285}]},{name:"ACAD_ISO03W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-18],sourceLine:287}]},{name:"ACAD_ISO04W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3],sourceLine:289}]},{name:"ACAD_ISO05W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-3],sourceLine:291}]},{name:"ACAD_ISO06W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,.5,-3,.5,-6.5],sourceLine:293},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-34,.5,-3],sourceLine:294}]},{name:"ACAD_ISO07W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[.5,-3],sourceLine:296}]},{name:"ACAD_ISO08W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3],sourceLine:298}]},{name:"ACAD_ISO09W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[24,-3,6,-3,6,-3],sourceLine:300}]},{name:"ACAD_ISO10W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3],sourceLine:302}]},{name:"ACAD_ISO11W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-3],sourceLine:304}]},{name:"ACAD_ISO12W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-3],sourceLine:306}]},{name:"ACAD_ISO13W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-6.5],sourceLine:308},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3],sourceLine:309}]},{name:"ACAD_ISO14W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,.5,-3,.5,-6.5],sourceLine:311},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-22,.5,-3],sourceLine:312}]},{name:"ACAD_ISO15W100",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[12,-3,12,-3,.5,-10],sourceLine:314},{angle:0,originX:0,originY:0,deltaX:0,deltaY:5,dashes:[-33.5,.5,-3,.5,-3],sourceLine:315}]},{name:"JIS_LC_20",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:322},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:323}]},{name:"JIS_LC_20A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:325},{angle:45,originX:1,originY:0,deltaX:0,deltaY:20,dashes:[],sourceLine:326}]},{name:"JIS_LC_8",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:328},{angle:45,originX:.4,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:329}]},{name:"JIS_LC_8A",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:331},{angle:45,originX:1,originY:0,deltaX:0,deltaY:7.8,dashes:[],sourceLine:332}]},{name:"JIS_RC_10",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:334},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:335},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:10,dashes:[],sourceLine:336}]},{name:"JIS_RC_15",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:338},{angle:45,originX:.725,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:339},{angle:45,originX:1.45,originY:0,deltaX:0,deltaY:15,dashes:[],sourceLine:340}]},{name:"JIS_RC_18",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:342},{angle:45,originX:1,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:343},{angle:45,originX:2,originY:0,deltaX:0,deltaY:18,dashes:[],sourceLine:344}]},{name:"JIS_RC_30",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:346},{angle:45,originX:1,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:347},{angle:45,originX:2,originY:0,deltaX:0,deltaY:30,dashes:[],sourceLine:348}]},{name:"JIS_STN_1E",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:1,dashes:[],sourceLine:350},{angle:45,originX:.705,originY:0,deltaX:0,deltaY:1,dashes:[1,-.5],sourceLine:351}]},{name:"JIS_STN_2.5",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.5,dashes:[],sourceLine:353},{angle:45,originX:1.765,originY:0,deltaX:0,deltaY:2.5,dashes:[1.2,-.5],sourceLine:354}]},{name:"JIS_WOOD",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:.70710678,dashes:[],sourceLine:356}]},{name:"LINE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:359}]},{name:"MUDST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:6.35,dashes:[6.35,-6.35,0,-6.35,0,-6.35],sourceLine:361}]},{name:"NET",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:363},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:364}]},{name:"NET3",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:366},{angle:60,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:367},{angle:120,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:368}]},{name:"PLAST",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:370},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:371},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:372}]},{name:"PLASTI",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:374},{angle:0,originX:0,originY:.79375,deltaX:0,deltaY:6.35,dashes:[],sourceLine:375},{angle:0,originX:0,originY:1.5875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:376},{angle:0,originX:0,originY:3.96875,deltaX:0,deltaY:6.35,dashes:[],sourceLine:377}]},{name:"SACNCR",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:2.38125,dashes:[],sourceLine:379},{angle:45,originX:1.6838,originY:0,deltaX:0,deltaY:2.38125,dashes:[0,-2.38125],sourceLine:380}]},{name:"SQUARE",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:382},{angle:90,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:383}]},{name:"STARS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:385},{angle:60,originX:0,originY:0,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:386},{angle:120,originX:1.5875,originY:2.7496306704,deltaX:0,deltaY:5.4992613154,dashes:[3.175,-3.175],sourceLine:387}]},{name:"STEEL",description:"",lines:[{angle:45,originX:0,originY:0,deltaX:0,deltaY:3.175,dashes:[],sourceLine:389},{angle:45,originX:0,originY:1.5875,deltaX:0,deltaY:3.175,dashes:[],sourceLine:390}]},{name:"SWAMP",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[3.175,-22.225],sourceLine:392},{angle:90,originX:1.5875,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.5875,-42.4065904724],sourceLine:393},{angle:90,originX:1.984375,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:394},{angle:90,originX:1.190625,originY:0,deltaX:21.9970452362,deltaY:12.7,dashes:[1.27,-42.7240904724],sourceLine:395},{angle:60,originX:2.38125,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:396},{angle:120,originX:.79375,originY:0,deltaX:12.7,deltaY:21.9970452362,dashes:[1.016,-24.384],sourceLine:397}]},{name:"TRANS",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:0,deltaY:6.35,dashes:[],sourceLine:399},{angle:0,originX:0,originY:3.175,deltaX:0,deltaY:6.35,dashes:[3.175,-3.175],sourceLine:400}]},{name:"TRIANG",description:"",lines:[{angle:60,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:402},{angle:120,originX:0,originY:0,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:403},{angle:0,originX:-2.38125,originY:4.1244459802,deltaX:4.7625,deltaY:8.2488919604,dashes:[4.7625,-4.7625],sourceLine:404}]},{name:"ZIGZAG",description:"",lines:[{angle:0,originX:0,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:406},{angle:90,originX:3.175,originY:0,deltaX:3.175,deltaY:3.175,dashes:[3.175,-3.175],sourceLine:407}]}],issues:[]};var Vi=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Vi||{}),ol=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(ol||{}),Pr=(n=>(n[n.HatchObject=0]="HatchObject",n[n.GradientObject=1]="GradientObject",n))(Pr||{}),ll=(n=>(n[n.PreDefinedGradient=0]="PreDefinedGradient",n[n.UserDefinedGradient=1]="UserDefinedGradient",n))(ll||{});const Zr=class Zr extends de{constructor(){super(),this._gradientAngle=0,this._elevation=0,this._geo=new Tt,this._isSolidFill=!1,this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1,this._patternName="",this._patternNameSet=!1,this._patternType=1,this._patternAngle=0,this._patternAngleSet=!1,this._patternScale=1,this._patternScaleSet=!1,this._associative=!1,this._associativeSet=!1,this._backgroundColor=void 0,this._backgroundColorSet=!1,this._patternDouble=!1,this._patternDoubleSet=!1,this._hatchStyle=0,this._hatchStyleSet=!1,this._hatchObjectType=0,this._gradientAngle=0,this._gradientShift=0,this._shadeTintValue=0,this._gradientStartColor=void 0,this._gradientEndColor=void 0,this._gradientType=0,this._gradientName="",this._gradientOneColorMode=!1}get dxfTypeName(){return"HATCH"}get isGradient(){return this._hatchObjectType===1}get isHatch(){return this._hatchObjectType===0}get isSolidFill(){return this._isSolidFill||this.getEffectivePatternName().trim().toUpperCase()===ti}set isSolidFill(e){this._isSolidFill=e}get color(){if(this.hasExplicitColor())return this.getEntityColor();const e=this.database,t=Ne.instance().getVar(A.HPCOLOR,e);return t instanceof X&&t.colorMethod!==P.None?t.clone():e.cecolor.clone()}set color(e){this.setEntityColor(e)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e??"",this._isSolidFill=this._patternName.trim().toUpperCase()===ti,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(e){this._patternType=e,e!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(e){this._associative=!!e,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e==null?void 0:e.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(e){this._patternDouble=!!e,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(e){this._hatchObjectType=e}get gradientAngle(){return this._gradientAngle}set gradientAngle(e){this._gradientAngle=e}get gradientShift(){return this._gradientShift}set gradientShift(e){this._gradientShift=e}get gradientType(){return this._gradientType}set gradientType(e){this._gradientType=e}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?go:this._gradientName}set gradientName(e){this._gradientName=e??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(e){this._gradientOneColorMode=e}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(e){this._shadeTintValue=e}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(e){this._gradientStartColor=e==null||!Number.isFinite(e)?void 0:e&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(e){this._gradientEndColor=e==null||!Number.isFinite(e)?void 0:e&16777215}applyPatternDefaultsFromSysVars(e){const t=Ne.instance();if(!this.hasExplicitLayer()){const i=t.getVar(A.HPLAYER,e);this.shouldUseSysVarOverride(i)&&(this.layer=i)}if(!this.hasExplicitTransparency()){const i=this.parseHpTransparency(t.getVar(A.HPTRANSPARENCY,e));i&&(this.transparency=i)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(t.getVar(A.HPBACKGROUNDCOLOR,e)),this._backgroundColorSet=!0),!this._patternNameSet){const i=t.getVar(A.HPNAME,e);this._patternName=typeof i=="string"?i:"",this._patternNameSet=!0}if(!this._patternAngleSet){const i=t.getVar(A.HPANG,e);this._patternAngle=typeof i=="number"&&Number.isFinite(i)?i:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(t.getVar(A.HPSCALE,e)),this._patternScaleSet=!0),!this._associativeSet){const i=t.getVar(A.HPASSOC,e);this._associative=typeof i=="number"?i!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(t.getVar(A.HPISLANDDETECTION,e)),this._hatchStyleSet=!0),!this._patternDoubleSet){const i=t.getVar(A.HPDOUBLE,e);this._patternDouble=typeof i=="number"?i!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const e=this.database,t=Ne.instance().getVar(A.HPNAME,e);return typeof t=="string"?t:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const e=this.database,t=Ne.instance().getVar(A.HPANG,e);return typeof t=="number"&&Number.isFinite(t)?t:this._patternAngle}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const e=this.database;return this.normalizePatternScale(Ne.instance().getVar(A.HPSCALE,e))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const e=this.database,t=Ne.instance().getVar(A.HPASSOC,e);return typeof t=="number"?t!==0:this._associative}normalizePatternScale(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:1}normalizeHatchStyle(e){return typeof e!="number"||!Number.isFinite(e)?1:e===0?0:e===2?2:1}shouldUseSysVarOverride(e){if(typeof e!="string")return!1;const t=e.trim().toLowerCase();return t!==""&&t!=="."&&t!=="use current"}parseHpBackgroundColor(e){if(e instanceof X)return e.colorMethod===P.None?void 0:e.clone();if(typeof e!="string")return;const t=e.trim().toLowerCase();if(!(!t||t==="."||t==="none"))return X.fromString(e)}parseHpTransparency(e){if(e instanceof J)return e.clone();if(!this.shouldUseSysVarOverride(e))return;const t=e.trim();if(/^bylayer$/i.test(t)||/^byblock$/i.test(t))return J.fromString(t);const i=Number(t);if(Number.isInteger(i)&&i>=0&&i<=90){const s=new J;return s.percentage=i,s}}updatePredefinedPatternDefinitionLines(e=this.getEffectivePatternName(),t=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const s=e.trim().toUpperCase();if(!s||s===ti){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const r=this.normalizePatternScale(t);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===s&&this._definitionLinesPatternScale===r)return;const a=al.patterns.find(o=>o.name.trim().toUpperCase()===s);if(!a){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=a.lines.map(o=>({angle:o.angle*Math.PI/180,base:{x:o.originX*r,y:o.originY*r},offset:{x:o.deltaX*r,y:o.deltaY*r},dashLengths:o.dashes.map(h=>h*r)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=s,this._definitionLinesPatternScale=r}add(e){this._geo.add(e)}buildAreasFromLoops(){const e=this._geo.loops;if(e.length===0)return[];if(e.length===1)return[this._geo];const t=this._geo.buildHierarchy(),i=[],s=(r,a)=>{if(r.index>=0&&a%2===0){const o=new Tt;o.add(e[r.index]),r.children.forEach(h=>{h.index>=0&&o.add(e[h.index])}),i.push(o)}r.children.forEach(o=>s(o,a+1))};return t.children.forEach(r=>s(r,0)),i.length>0?i:[this._geo]}getCalculatedAreaValue(){const e=this.buildAreasFromLoops();return e.length===0?0:e.reduce((t,i)=>t+i.area,0)}get geometricExtents(){const e=this.buildAreasFromLoops();if(e.length===0)return new Y;const t=new Y;return e.forEach(i=>{const s=i.box;t.union(new Y({x:s.min.x,y:s.min.y,z:this._elevation},{x:s.max.x,y:s.max.y,z:this._elevation}))}),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Vi[0],value:0},{label:Vi[1],value:1},{label:Vi[2],value:2}],accessor:{get:()=>this.patternType,set:e=>{this.patternType=e}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:e=>{this.patternName=e}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:e=>{this.patternAngle=e}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:e=>{this.patternScale=e}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:e=>{this.associative=e}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:e=>{this.backgroundColor=e}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:e=>{this.patternDouble=e}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:e=>{this.elevation=e}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.getCalculatedAreaValue()}}]}]}}subWorldDraw(e){var r;this.updatePredefinedPatternDefinitionLines();const t=e.subEntityTraits;t.fillType={solidFill:this.isSolidFill,patternAngle:this.getEffectivePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(r=this.backgroundColor)==null?void 0:r.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},t.drawOrder=-1;const i=this.buildAreasFromLoops();if(i.length===0)return e.area(this._geo);if(i.length===1)return e.area(i[0]);const s=i.map(a=>e.area(a));return e.group(s)}transformBy(e){const t=e.elements,i=new sn(t[0],t[4],t[12],t[1],t[5],t[13],0,0,1);this._geo.transform(i),this._elevation=new w(0,0,this._elevation).applyMatrix4(e).z;const s=new w(1,0,0).applyMatrix4(e),r=new w().applyMatrix4(e),a=new w(s).sub(r);if(a.length()>0){const o=Math.atan2(a.y,a.x);this._patternAngle=this.getEffectivePatternAngle()+o,this._gradientAngle+=o,this._patternScale=this.getEffectivePatternScale()*a.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(e){super.dxfOutFields(e);const t=this._geo.loops,i=this.getEffectivePatternName(),s=this.getEffectivePatternAngle(),r=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(i,r),e.writeSubclassMarker("AcDbHatch"),e.writePoint3d(10,{x:0,y:0,z:this.elevation}),e.writeVector3d(210,{x:0,y:0,z:1}),e.writeString(2,i||(this.isSolidFill?ti:uo)),e.writeInt16(70,this.isSolidFill?1:0),e.writeInt16(71,this.getEffectiveAssociative()?1:0),e.writeInt16(91,t.length),t.forEach((a,o)=>{const h=o===0;if(a instanceof ce){const c=a.vertices,d=c.some(p=>(p.bulge??0)!==0);e.writeInt16(92,2),e.writeInt16(72,d?1:0),e.writeInt16(73,a.closed?1:0),e.writeInt16(93,c.length);for(const p of c)e.writePoint2d(10,p),d&&e.writeDouble(42,p.bulge??0);e.writeInt16(97,0);return}if(a instanceof qi){const c=h?1:0;e.writeInt16(92,c),e.writeInt16(93,a.numberOfEdges);for(const d of a.curves){if(d instanceof Ge){e.writeInt16(72,1),e.writePoint2d(10,d.startPoint),e.writePoint2d(11,d.endPoint);continue}if(d instanceof Mt){e.writeInt16(72,2),e.writePoint2d(10,d.center),e.writeDouble(40,d.radius),e.writeAngle(50,d.startAngle),e.writeAngle(51,d.endAngle),e.writeInt16(73,d.clockwise?0:1);continue}if(d instanceof $i){e.writeInt16(72,3),e.writePoint2d(10,d.center);const u=new v(d.majorAxisRadius*Math.cos(d.rotation),d.majorAxisRadius*Math.sin(d.rotation));e.writePoint2d(11,u);const p=d.majorAxisRadius===0?0:d.minorAxisRadius/d.majorAxisRadius;e.writeDouble(40,p),e.writeAngle(50,d.startAngle),e.writeAngle(51,d.endAngle),e.writeInt16(73,d.clockwise?0:1);continue}if(d instanceof Ue){const u=d.knots,p=d.controlPoints,g=d.weights,m=d.fitPoints,y=g.some(_=>_!==1);e.writeInt16(72,4),e.writeInt16(94,d.degree),e.writeInt16(73,y?1:0),e.writeInt16(74,d.closed?1:0),e.writeInt16(95,u.length),e.writeInt16(96,p.length),u.forEach(_=>e.writeDouble(40,_)),p.forEach((_,f)=>{e.writePoint2d(10,_),y&&e.writeDouble(42,g[f]??1)}),e.writeInt16(97,(m==null?void 0:m.length)??0),m==null||m.forEach(_=>e.writePoint2d(11,_))}}e.writeInt16(97,0)}}),e.writeInt16(75,this.hatchStyle),e.writeInt16(76,this.patternType),e.writeAngle(52,s),e.writeDouble(41,r),e.writeInt16(77,0),e.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(a=>{e.writeAngle(53,a.angle),e.writePoint2d(43,a.base),e.writePoint2d(45,a.offset),e.writeInt16(79,a.dashLengths.length),a.dashLengths.forEach(o=>e.writeDouble(49,o))}),this.isGradient&&(e.writeInt16(450,this._hatchObjectType),e.writeInt16(451,0),e.writeInt16(452,this._gradientOneColorMode?1:0),e.writeAngle(460,this._gradientAngle),e.writeDouble(461,this._gradientShift),e.writeString(470,this.gradientName)),e.writeInt16(98,0),this}};Zr.typeName="Hatch";let Ki=Zr;var hl=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(hl||{});const Qr=class Qr extends ue{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._isHookLineSameDirection=!1,this._annoType=3,this._textHeight=0,this._textWidth=0,this._associatedAnnotation="",this._normal=new x(0,0,1),this._horizontalDirection=new x(1,0,0)}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(e){this._isHookLineSameDirection=e}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(e=>e.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get byBlockColor(){return this._byBlockColor}set byBlockColor(e){this._byBlockColor=e}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(e){this._associatedAnnotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(e){this._horizontalDirection.copy(e)}get offsetFromBlock(){var e;return(e=this._offsetFromBlock)==null?void 0:e.clone()}set offsetFromBlock(e){this._offsetFromBlock=e?new x(e):void 0}get offsetFromAnnotation(){var e;return(e=this._offsetFromAnnotation)==null?void 0:e.clone()}set offsetFromAnnotation(e){this._offsetFromAnnotation=e?new x(e):void 0}appendVertex(e){this._vertices.push(new w().copy(e)),this._updated=!0}setVertexAt(e,t){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].copy(t),this._updated=!0,this}vertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[e].clone()}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Y().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this.transformVector(this._normal,e),this.transformVector(this._horizontalDirection,e),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,e),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,e),this._splineGeo?(this._splineGeo.transform(e),this._updated=!1):this._updated=!0,this}subWorldDraw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t)}else return e.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Ue(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLeader"),e.writeString(3,this.dimensionStyle),e.writeInt16(71,this.hasArrowHead?1:0),e.writeInt16(72,this.isSplined?1:0),e.writeInt16(73,this.annoType),e.writeInt16(74,this.isHookLineSameDirection?1:0),e.writeInt16(75,this.hasHookLine?1:0),e.writeInt16(76,this.numVertices),this.textHeight!==0&&e.writeDouble(40,this.textHeight),this.textWidth!==0&&e.writeDouble(41,this.textWidth),this.byBlockColor!=null&&e.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&e.writeHandle(340,this.associatedAnnotation);for(const t of this.vertices)e.writePoint3d(10,t);return e.writeVector3d(210,this.normal),e.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&e.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&e.writeVector3d(213,this._offsetFromAnnotation),this}transformVector(e,t){const i=new w,s=new w(e.x,e.y,e.z);i.applyMatrix4(t),s.applyMatrix4(t),e.set(s.x-i.x,s.y-i.y,s.z-i.z)}};Qr.typeName="Leader";let Un=Qr;var D=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(D||{});function Vc(n){let e=0;for(const t of n)e|=1<<t-1;return e}function zc(n){const e=[];for(const t of Object.values(D)){if(typeof t!="number")continue;const i=1<<t-1;n&i&&e.push(t)}return e}function jc(n,e){return n^1<<e-1}function Hc(n,e){return(n&1<<e-1)!==0}function Wc(n,e){return n|1<<e-1}function Gc(n,e){return n&~(1<<e-1)}const Jr=class Jr extends ue{get dxfTypeName(){return"LINE"}constructor(e,t){super(),this._geo=new kt(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}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:e=>{this.startPoint.x=e}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:e=>{this.startPoint.y=e}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:e=>{this.startPoint.z=e}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:e=>{this.endPoint.x=e}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:e=>{this.endPoint.y=e}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:e=>{this.endPoint.z=e}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,i,s){const r=this.startPoint,a=this.endPoint;switch(e){case D.EndPoint:s.push(r),s.push(a);break;case D.MidPoint:s.push(this.midPoint);break;case D.Nearest:{const o=this._geo.project(t);s.push(o)}break;case D.Perpendicular:{const o=this._geo.perpPoint(t);s.push(o)}break;case D.Tangent:break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this.startPoint,i=this.endPoint,s=[new w(t.x,t.y,0),new w(i.x,i.y,0)];return e.lines(s)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLine"),e.writePoint3d(10,this.startPoint),e.writePoint3d(11,this.endPoint),this}};Jr.typeName="Line";let Zi=Jr;var cl=(n=>(n[n.Top=0]="Top",n[n.Zero=1]="Zero",n[n.Bottom=2]="Bottom",n))(cl||{}),dl=(n=>(n[n.HasVertex=1]="HasVertex",n[n.Closed=2]="Closed",n[n.SuppressStartCaps=4]="SuppressStartCaps",n[n.SuppressEndCaps=8]="SuppressEndCaps",n))(dl||{});const ea=class ea extends de{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new w,this._normal=new x(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(e){this._styleName=e}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(e){this._styleObjectHandle=e}get scale(){return this._scale}set scale(e){this._scale=e}get justification(){return this._justification}set justification(e){this._justification=e}get flags(){return this._flags}set flags(e){this._flags=e}get styleCount(){return this._styleCount}set styleCount(e){this._styleCount=Math.max(0,e)}get startPosition(){return this._startPosition}set startPosition(e){this._startPosition.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get segments(){return this._segments.map(e=>this.cloneSegment(e))}set segments(e){this._segments=e.map(t=>this.createSegment(t)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(e){this.setFlag(2,e)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(e){this.setFlag(4,e)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(e){this.setFlag(8,e)}appendSegment(e){this._segments.push(this.createSegment(e)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const e=this.collectGeometryPoints();return new Y().setFromPoints(e)}transformBy(e){return this._startPosition.applyMatrix4(e),this._segments.forEach(t=>{t.position.applyMatrix4(e),this.transformVector(t.direction,e),this.transformVector(t.miterDirection,e)}),this.transformVector(this._normal,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:e=>{this.scale=e}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:e=>{this.justification=e}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:e=>{this.closed=e}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subWorldDraw(e){if(this._segments.length===0)return;const t=[],i=this.getMLineStyle(),s=this.getRenderableElementCount(i),r=e.subEntityTraits,a=r.color,o=r.rgbColor,h=r.lineType,c=r.fillType,d=r.drawOrder,u=this.createFillArea(i,s);if(u&&(r.color=a,r.rgbColor=o,this.applyFillTraits(i,r),r.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},r.drawOrder=-1,t.push(e.area(u)),r.fillType=c,r.drawOrder=d),s<=0){const p=this.getReferencePath();p.length>=2&&t.push(e.lines(p))}else{for(let p=0;p<s;p++){r.color=a,r.rgbColor=o,r.lineType=h,this.applyStyleElementTraits(i,p,r);const g=this.getElementPath(p,i);g.length>=2&&t.push(e.lines(g))}this.appendStyleDrivenJointAndCapEntities(e,t,i,s,a,o,h)}if(r.color=a,r.rgbColor=o,r.lineType=h,r.fillType=c,r.drawOrder=d,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMline"),e.writeString(2,this.styleName),e.writeHandle(340,this._styleObjectHandle),e.writeDouble(40,this._scale),e.writeInt16(70,this._justification),e.writeInt16(71,this._flags),e.writeInt16(72,this.vertexCount),e.writeInt16(73,this._styleCount),e.writePoint3d(10,this._startPosition),e.writeVector3d(210,this._normal),this._segments.forEach(t=>{e.writePoint3d(11,t.position),e.writeVector3d(12,t.direction),e.writeVector3d(13,t.miterDirection),t.elements.forEach(i=>{e.writeInt16(74,i.parameterCount),i.parameters.forEach(s=>e.writeDouble(41,s)),e.writeInt16(75,i.fillCount),i.fillParameters.forEach(s=>e.writeDouble(42,s))})}),this}setFlag(e,t){t?this._flags|=e:this._flags&=~e}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}createSegment(e){var t;return{position:new w().copy(e.position),direction:new x().copy(e.direction),miterDirection:new x().copy(e.miterDirection),elements:((t=e.elements)==null?void 0:t.map(i=>this.createElement(i)))??[]}}createElement(e){const t=e.parameters?[...e.parameters]:[],i=e.fillParameters?[...e.fillParameters]:[];return{parameterCount:e.parameterCount??t.length,parameters:t,fillCount:e.fillCount??i.length,fillParameters:i}}cloneSegment(e){return{position:e.position.clone(),direction:e.direction.clone(),miterDirection:e.miterDirection.clone(),elements:e.elements.map(t=>({parameterCount:t.parameterCount,parameters:[...t.parameters],fillCount:t.fillCount,fillParameters:[...t.fillParameters]}))}}collectGeometryPoints(){const e=[this._startPosition];if(this._segments.length===0)return e;const t=this.getMLineStyle(),i=this.getRenderableElementCount(t);if(i<=0)return this._segments.forEach(s=>e.push(s.position)),e;for(let s=0;s<i;s++)e.push(...this.getElementPath(s,t));return e}getRenderableElementCount(e){const t=(e==null?void 0:e.elementCount)??0;return Math.max(this._styleCount,t,...this._segments.map(i=>i.elements.length),0)}getReferencePath(){const e=[this._startPosition.clone(),...this._segments.map(t=>t.position.clone())];return this.closePathIfNeeded(e)}getElementPath(e,t){const i=[],s=this._segments[0];return i.push(this.getElementBoundaryPoint("start",s,e,t)),this._segments.forEach(r=>{i.push(this.offsetPoint(r.position,r.miterDirection,this.getElementMiterOffset(r,e,t)))}),i[i.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],e,t),this.closePathIfNeeded(i)}getElementMiterOffset(e,t,i){var r;const s=e.elements[t];return(r=s==null?void 0:s.parameters)!=null&&r.length?s.parameters[0]:this.getStyleElementOffset(t,i)}getElementBoundaryPoint(e,t,i,s){const r=this.getElementMiterOffset(t,i,s),a=e==="start"?this._startPosition:t.position,o=this.offsetPoint(a,t.miterDirection,r);if(!this.shouldApplyCapCutAtSide(e,s))return o;const h=e==="start"?s==null?void 0:s.startAngle:s==null?void 0:s.endAngle,c=this.computeCapCutDistance(r,h,e);if(c===0)return o;const d=e==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return d.lengthSq()===0?o:o.add(d.multiplyScalar(c))}shouldApplyCapCutAtSide(e,t){return!t||this.closed?!1:e==="start"?this.suppressStartCaps?!1:(t.flags&112)!==0:this.suppressEndCaps?!1:(t.flags&1792)!==0}computeCapCutDistance(e,t,i){const s=this.normalizeCapAngle(t),r=Math.tan(s);if(Math.abs(r)<1e-6)return 0;const a=e/r;return a}normalizeCapAngle(e){if(e==null||!Number.isFinite(e))return Math.PI/2;let t=e%180;return t<0&&(t+=180),(t<1||t>179)&&(t=90),t*Math.PI/180}getStartSegmentDirection(){const e=this._segments[0],t=new x;return e&&(t.subVectors(e.position,this._startPosition),t.lengthSq()===0&&t.copy(e.direction)),t.lengthSq()>0&&t.normalize(),t}getEndSegmentDirection(){const e=this._segments[this._segments.length-1];if(!e)return new x;const t=new x,i=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return t.subVectors(e.position,i),t.lengthSq()===0&&t.copy(e.direction),t.lengthSq()>0&&t.normalize(),t}createFillArea(e,t){if(!e||!(e.flags&1)||t<2)return;const i=this.getFillBoundaryElementIndices(t,e);if(!i)return;const s=this.getElementPath(i.outerIndex,e),r=this.getElementPath(i.innerIndex,e),a=this.stripClosingPoint(s),o=this.stripClosingPoint(r);if(a.length<2||o.length<2)return;const h=new Tt;if(this.closed){if(a.length<3||o.length<3)return;h.add(new ce(a.map(c=>({x:c.x,y:c.y})),!0)),h.add(new ce(o.map(c=>({x:c.x,y:c.y})),!0))}else{const c=[...a,...o.slice().reverse()].map(d=>({x:d.x,y:d.y}));if(c.length<3)return;h.add(new ce(c,!0))}return h}getFillBoundaryElementIndices(e,t){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,r=-1,a=-1;for(let o=0;o<e;o++){const h=this.getElementReferenceOffset(o,t);h<i&&(i=h,r=o),h>s&&(s=h,a=o)}if(!(r<0||a<0||r===a))return{outerIndex:a,innerIndex:r}}getElementReferenceOffset(e,t){var s;const i=this._segments[0];if(i){const r=i.elements[e];if((s=r==null?void 0:r.parameters)!=null&&s.length)return r.parameters[0]}return this.getStyleElementOffset(e,t)}getStyleElementOffset(e,t){const i=t==null?void 0:t.elements[e];if(!i)return 0;const s=this.getStyleJustificationShift(t);return(i.offset+s)*this._scale}getStyleJustificationShift(e){const t=(e==null?void 0:e.elements)??[];if(t.length<=0)return 0;let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const r of t){const a=r.offset;a<i&&(i=a),a>s&&(s=a)}return this._justification===0?-s:this._justification===2?-i:0}stripClosingPoint(e){if(e.length<2)return e;const t=e[0],i=e[e.length-1],s=1e-9;return Math.abs(t.x-i.x)<=s&&Math.abs(t.y-i.y)<=s&&Math.abs(t.z-i.z)<=s?e.slice(0,-1):e}offsetPoint(e,t,i){if(i===0||t.lengthSq()===0)return e.clone();const s=t.clone().normalize().multiplyScalar(i);return e.clone().add(s)}closePathIfNeeded(e){if(!this.closed||e.length<2)return e;const t=e[0],i=e[e.length-1],s=1e-9;return Math.abs(t.x-i.x)<=s&&Math.abs(t.y-i.y)<=s&&Math.abs(t.z-i.z)<=s||e.push(t.clone()),e}appendStyleDrivenJointAndCapEntities(e,t,i,s,r,a,o){!i||s<2||(t.push(...this.drawMiterJointEntities(e,i,s,r,a,o)),t.push(...this.drawCapEntities(e,i,s,r,a,o)))}drawMiterJointEntities(e,t,i,s,r,a){if(this.closed||this._segments.length<2||!(t.flags&2))return[];const o=[],h=e.subEntityTraits;for(let c=0;c<this._segments.length-1;c++){const d=this._segments[c],u=Array.from({length:i},(p,g)=>{const m=this.getElementMiterOffset(d,g,t);return{elementIndex:g,offset:m,point:this.offsetPoint(d.position,d.miterDirection,m)}}).sort((p,g)=>g.offset-p.offset);for(let p=0;p<u.length-1;p++)this.applyElementDrawTraits(h,s,r,a,t,u[p].elementIndex),o.push(e.lines([u[p].point,u[p+1].point]))}return o}drawCapEntities(e,t,i,s,r,a){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(e,"start",t,i,s,r,a)),o.push(...this.drawCapEntitiesForSide(e,"end",t,i,s,r,a)),o}drawCapEntitiesForSide(e,t,i,s,r,a,o){if(t==="start"&&this.suppressStartCaps)return[];if(t==="end"&&this.suppressEndCaps)return[];const h=i.flags,c=t==="start",d=c?(h&16)!==0:(h&256)!==0,u=c?(h&64)!==0:(h&1024)!==0,p=c?(h&32)!==0:(h&512)!==0;if(!d&&!u&&!p)return[];const g=this.getCapElementPoints(t,s,i);if(g.length<2)return[];const m=[],y=e.subEntityTraits;if(d)for(let f=0;f<g.length-1;f++)this.applyElementDrawTraits(y,r,a,o,i,g[f].elementIndex),m.push(e.lines([g[f].point,g[f+1].point]));const _=c?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(u){const f=this.drawCapArcBetweenElements(e,t,g[0],g[g.length-1],_,y,r,a,o,i);f&&m.push(f)}if(p)for(let f=1;f<Math.floor(g.length/2);f++){const S=g[f],L=g[g.length-1-f];if(!S||!L||S===L)continue;const M=this.drawCapArcBetweenElements(e,t,S,L,_,y,r,a,o,i);M&&m.push(M)}return m}getCapElementPoints(e,t,i){const s=e==="start"?this._segments[0]:this._segments[this._segments.length-1];return s?Array.from({length:t},(r,a)=>({elementIndex:a,offset:this.getElementMiterOffset(s,a,i),point:this.getElementBoundaryPoint(e,s,a,i)})).sort((r,a)=>a.offset-r.offset):[]}drawCapArcBetweenElements(e,t,i,s,r,a,o,h,c,d){const u=t==="end"?s.point:i.point,p=t==="end"?i.point:s.point,g=u.distanceTo(p);if(g<=1e-9||r.lengthSq()===0)return;const y=u.clone().add(new x().subVectors(p,u).multiplyScalar(.5)).add(r.clone().normalize().multiplyScalar(g/2)),_=Pt.createByThreePoints(u,p,y);if(_)return this.applyElementDrawTraits(a,o,h,c,d,t==="end"?s.elementIndex:i.elementIndex),e.circularArc(_)}applyElementDrawTraits(e,t,i,s,r,a){e.color=t,e.rgbColor=i,e.lineType=s,this.applyStyleElementTraits(r,a,e)}transformVector(e,t){const i=new w,s=new w(e.x,e.y,e.z);i.applyMatrix4(t),s.applyMatrix4(t),e.set(s.x-i.x,s.y-i.y,s.z-i.z)}getMLineStyle(){var r;const e=this.database.objects.mlineStyle,t=this.styleObjectHandle?e.getIdAt(this.styleObjectHandle):void 0;if(t)return t;const i=this.styleName?e.getAt(this.styleName):void 0;if(i)return i;const s=(r=this.styleName)==null?void 0:r.toUpperCase();if(s)for(const[a,o]of e.entries()){const h=(o.styleName||a).toUpperCase();if(a.toUpperCase()===s||h===s)return o}}applyStyleElementTraits(e,t,i){const s=e==null?void 0:e.elements[t];if(!s)return;const r=this.resolveStyleElementLineType(s.lineType);r&&(i.lineType=r),!(s.color.isByBlock||s.color.isByLayer)&&(i.color=s.color.clone(),i.rgbColor=s.color.RGB??this.rgbColor)}applyFillTraits(e,t){const i=e==null?void 0:e.fillColor;!i||i.isByBlock||i.isByLayer||(t.color=i.clone(),t.rgbColor=i.RGB??this.rgbColor)}resolveStyleElementLineType(e){var c;const t=e==null?void 0:e.trim();if(!t)return;const i=t.toUpperCase(),s=pe.toUpperCase(),r=At.toUpperCase();let a="UserSpecified",o=t;if(i===s){a="ByLayer";const d=(c=this.database.tables.layerTable.getAt(this.layer))==null?void 0:c.linetype;o=d&&d.toUpperCase()!==s&&d.toUpperCase()!==r?d:It}else i===r&&(a="ByBlock",o=It);const h=this.database.tables.linetypeTable.getAt(o);return h?{type:a,...h.linetype}:{type:a,name:o,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||gt}catch{return gt}}};ea.typeName="MLine";let $n=ea;var gi=(n=>(n[n.InvisibleLeader=0]="InvisibleLeader",n[n.StraightLeader=1]="StraightLeader",n[n.SplineLeader=2]="SplineLeader",n))(gi||{}),mt=(n=>(n[n.NoneContent=0]="NoneContent",n[n.BlockContent=1]="BlockContent",n[n.MTextContent=2]="MTextContent",n[n.ToleranceContent=3]="ToleranceContent",n))(mt||{}),ul=(n=>(n[n.Horizontal=0]="Horizontal",n[n.Vertical=1]="Vertical",n))(ul||{}),gl=(n=>(n[n.Unknown=0]="Unknown",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Top=3]="Top",n[n.Bottom=4]="Bottom",n))(gl||{});const Uc=1,$c=2,qc=4,Kc=8,Zc=64,Qc=128,Jc=32768,ta=class ta extends de{get dxfTypeName(){return"MULTILEADER"}constructor(){super(),this._leaders=[],this._leaderLineType=1,this._contentType=0,this._doglegEnabled=!1,this._doglegLength=0,this._doglegVector=new x(1,0,0),this._normal=new x(0,0,1),this._mleaderStyleId="",this._textHeight=2.5,this._textWidth=0,this._textRotation=0,this._textDirection=new x(1,0,0),this._textStyleName="",this._textAttachmentPoint=z.MiddleLeft,this._textDrawingDirection=He.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(e=>this.cloneLeader(e))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(e){this._doglegEnabled=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get doglegVector(){return this._doglegVector}set doglegVector(e){this._doglegVector.copy(e)}get landingPoint(){return this._landingPoint}set landingPoint(e){this._landingPoint=e?this.createPoint(e):void 0}get normal(){return this._normal}set normal(e){this._normal.copy(e)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(e){this._mleaderStyleId=e}get version(){return this._version}set version(e){this._version=e}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(e){this._leaderStyleId=e}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(e){this._propertyOverrideFlag=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor=e}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get landingEnabled(){return this._landingEnabled}set landingEnabled(e){this._landingEnabled=e}get arrowheadId(){return this._arrowheadId}set arrowheadId(e){this._arrowheadId=e}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(e){this._arrowheadSize=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor=e}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(e){this._textFrameEnabled=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get textAttachment(){return this._textAttachment}set textAttachment(e){this._textAttachment=e}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(e){this._textFlowDirection=e}get blockContentId(){return this._blockContentId}set blockContentId(e){this._blockContentId=e}get blockContentColor(){return this._blockContentColor}set blockContentColor(e){this._blockContentColor=e}get blockContentScale(){return this._blockContentScale}set blockContentScale(e){this._blockContentScale=e}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(e){this._blockContentRotation=e}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(e){this._blockContentConnectionType=e}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(e){this._annotativeScaleEnabled=e}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(e){this._arrowheadOverrides=e}get blockAttributes(){return this._blockAttributes}set blockAttributes(e){this._blockAttributes=e}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(e){this._textDirectionNegative=e}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(e){this._textAlignInIPE=e}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(e){this._bottomTextAttachmentDirection=e}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(e){this._topTextAttachmentDirection=e}get contentScale(){return this._contentScale}set contentScale(e){this._contentScale=e}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(e){this._contentBasePosition=e}get textAnchor(){return this._textAnchor}set textAnchor(e){this._textAnchor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(e){this._textBackgroundColor=e}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(e){this._textBackgroundScaleFactor=e}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(e){this._textBackgroundTransparency=e}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(e){this._textBackgroundColorOn=e}get textFillOn(){return this._textFillOn}set textFillOn(e){this._textFillOn=e}get textColumnType(){return this._textColumnType}set textColumnType(e){this._textColumnType=e}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(e){this._textUseAutoHeight=e}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(e){this._textColumnWidth=e}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(e){this._textColumnGutterWidth=e}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(e){this._textColumnFlowReversed=e}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(e){this._textColumnHeight=e}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(e){this._textUseWordBreak=e}get hasMText(){return this._hasMText}set hasMText(e){this._hasMText=e}get hasBlock(){return this._hasBlock}set hasBlock(e){this._hasBlock=e}get planeOrigin(){return this._planeOrigin}set planeOrigin(e){this._planeOrigin=e}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(e){this._planeXAxisDirection=e}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(e){this._planeYAxisDirection=e}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(e){this._planeNormalReversed=e}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(e){if(!e){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:e.text,anchorPoint:this.createPoint(e.anchorPoint)},this._contentType=2}get contents(){var e;return((e=this._mtextContent)==null?void 0:e.text)??""}set contents(e){this._mtextContent?this._mtextContent.text=e:this._mtextContent={text:e,anchorPoint:new w},this._contentType=2}get textLocation(){var e;return(e=this._mtextContent)==null?void 0:e.anchorPoint}set textLocation(e){if(!e){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(e):this._mtextContent={text:"",anchorPoint:this.createPoint(e)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get textWidth(){return this._textWidth}set textWidth(e){this._textWidth=e}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get textDirection(){return this._textDirection}set textDirection(e){this._textDirection.copy(e)}get textStyleName(){return this._textStyleName}set textStyleName(e){this._textStyleName=e}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(e){this._textAttachmentPoint=e}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(e){this._textDrawingDirection=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get blockContent(){var e,t;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(e=this._blockContent.normal)==null?void 0:e.clone(),position:(t=this._blockContent.position)==null?void 0:t.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:this._blockContent.color,transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(e){if(!e){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:e.blockContentId??e.blockHandle,blockHandle:e.blockHandle,normal:e.normal?new x(e.normal):void 0,position:e.position?this.createPoint(e.position):void 0,scale:new x(e.scale??{x:1,y:1,z:1}),rotation:e.rotation??0,color:e.color,transformationMatrix:e.transformationMatrix?[...e.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(e={}){var i,s;const t={lastLeaderLinePoint:e.lastLeaderLinePoint?this.createPoint(e.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:e.landingPoint?this.createPoint(e.landingPoint):void 0,doglegVector:e.doglegVector?new x(e.doglegVector):void 0,doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:((i=e.breaks)==null?void 0:i.map(r=>({index:r.index,start:this.createPoint(r.start),end:this.createPoint(r.end)})))??[],leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:[]};return(s=e.leaderLines)==null||s.forEach(r=>{t.leaderLines.push(this.createLeaderLine(r))}),this._leaders.push(t),this._leaders.length-1}removeLeader(e){return this.checkLeaderIndex(e),this._leaders.splice(e,1),this}addLeaderLine(e,t=[]){return this.checkLeaderIndex(e),this._leaders[e].leaderLines.push(this.createLeaderLine({vertices:t})),this._leaders[e].leaderLines.length-1}appendVertex(e,t,i){return this.getMutableLeaderLine(e,t).vertices.push(this.createPoint(i)),this}setLeaderLineVertices(e,t,i){return this.getMutableLeaderLine(e,t).vertices=i.map(s=>this.createPoint(s)),this}getLeaderLineVertices(e,t){return this.getMutableLeaderLine(e,t).vertices.map(i=>i.clone())}addBreak(e,t,i,s){return this.getMutableLeaderLine(e,t).breaks.push({start:this.createPoint(i),end:this.createPoint(s)}),this}setLandingPoint(e,t){return this.checkLeaderIndex(e),this._leaders[e].landingPoint=t?this.createPoint(t):void 0,this}setDoglegDirection(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegVector=new x(t),this}setDoglegLength(e,t){return this.checkLeaderIndex(e),this._leaders[e].doglegLength=t,this}get geometricExtents(){const e=this.collectGeometryPoints();return e.length>0?new Y().setFromPoints(e):new Y}subGetGripPoints(){return this.collectGeometryPoints().map(e=>e.clone())}transformBy(e){var t,i,s,r,a,o,h,c;return this._leaders.forEach(d=>{var u,p;(u=d.lastLeaderLinePoint)==null||u.applyMatrix4(e),(p=d.landingPoint)==null||p.applyMatrix4(e),d.doglegVector&&this.transformVector(d.doglegVector,e),d.breaks.forEach(g=>{g.start.applyMatrix4(e),g.end.applyMatrix4(e)}),d.leaderLines.forEach(g=>{g.vertices.forEach(m=>m.applyMatrix4(e)),g.breaks.forEach(m=>{m.start.applyMatrix4(e),m.end.applyMatrix4(e)})})}),(t=this._landingPoint)==null||t.applyMatrix4(e),(i=this.contentBasePosition)==null||i.applyMatrix4(e),this.transformVector(this._doglegVector,e),this.transformVector(this._normal,e),(s=this.textAnchor)==null||s.applyMatrix4(e),(r=this._mtextContent)==null||r.anchorPoint.applyMatrix4(e),this.transformVector(this._textDirection,e),(o=(a=this._blockContent)==null?void 0:a.position)==null||o.applyMatrix4(e),(h=this._blockContent)!=null&&h.normal&&this.transformVector(this._blockContent.normal,e),this.blockContentScale&&this.transformVector(this.blockContentScale,e),(c=this.planeOrigin)==null||c.applyMatrix4(e),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,e),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,e),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:mt[0],value:0},{label:mt[1],value:1},{label:mt[2],value:2},{label:mt[3],value:3}],accessor:{get:()=>this.contentType,set:e=>{this.contentType=e}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:gi[0],value:0},{label:gi[1],value:1},{label:gi[2],value:2}],accessor:{get:()=>this.leaderLineType,set:e=>{this.leaderLineType=e}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:e=>{this.doglegEnabled=e}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:e=>{this.doglegLength=e}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:e=>{this.textHeight=e}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:e=>{this.textWidth=e}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:e=>{this.textStyleName=e}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const e=this.getDefaultMLeaderStyle();e&&(this._mleaderStyleId=e.objectId)}subWorldDraw(e){const t=[],i=e.subEntityTraits,s=i.color,r=i.rgbColor,a=i.lineType,o=i.lineWeight,h=this.getResolvedLeaderLineColor(),c=this.getResolvedLeaderLineStyle(),d=this.getResolvedLeaderLineWeight(),u=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(i,h,s,r),this.applyLineTraits(i,c,d),this._leaders.forEach(g=>{g.leaderLines.forEach(y=>{const _=this.getLeaderLineDrawPoints(g,y);if(_.length>0){const f=this.drawLeaderLine(e,_);f&&t.push(f)}});const m=this.getDoglegPoints(g);m&&t.push(e.lines(m))}));const p=this.getRenderableMTextContent();if(this.contentType===2&&p){this.applyColorTraits(i,u,s,r);const g=this.getResolvedTextHeight(),m={text:p.text,height:g,width:this.getMTextRenderWidth(p.text,g),position:p.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};t.push(e.mtext(m,this.getTextStyle(),!1))}if(i.color=s,i.rgbColor=r,i.lineType=a,i.lineWeight=o,t.length!==0)return t.length===1?t[0]:e.group(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeader"),e.writeInt16(170,this.leaderLineType),e.writeBoolean(290,this.doglegEnabled),e.writeDouble(41,this.doglegLength),e.writeInt16(172,this.contentType),e.writeVector3d(210,this.normal),e.writeHandle(340,this.mleaderStyleId),this._landingPoint&&e.writePoint3d(10,this._landingPoint),e.writeVector3d(11,this.doglegVector),this._mtextContent&&(e.writeString(1,this._mtextContent.text),e.writePoint3d(12,this._mtextContent.anchorPoint),e.writeDouble(40,this.textHeight),e.writeDouble(42,this.textWidth),e.writeAngle(50,this.textRotation),e.writeString(7,this.textStyleName)),this._blockContent&&(e.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&e.writePoint3d(15,this._blockContent.position),e.writeVector3d(16,this._blockContent.scale),e.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(t=>{t.landingPoint&&e.writePoint3d(110,t.landingPoint),t.doglegVector&&e.writeVector3d(111,t.doglegVector),e.writeDouble(140,t.doglegLength),e.writeInt16(171,t.leaderLines.length),t.leaderLines.forEach(i=>{e.writeInt16(90,i.vertices.length),i.vertices.forEach(s=>e.writePoint3d(10,s))})}),this}createPoint(e){return new w().copy(e)}createLeaderLine(e){var t,i;return{vertices:((t=e.vertices)==null?void 0:t.map(s=>this.createPoint(s)))??[],breakPointIndexes:e.breakPointIndexes?[...e.breakPointIndexes]:[],leaderLineIndex:e.leaderLineIndex,breaks:((i=e.breaks)==null?void 0:i.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[]}}cloneLeader(e){var t,i,s;return{lastLeaderLinePoint:(t=e.lastLeaderLinePoint)==null?void 0:t.clone(),lastLeaderLinePointSet:e.lastLeaderLinePointSet,landingPoint:(i=e.landingPoint)==null?void 0:i.clone(),doglegVector:(s=e.doglegVector)==null?void 0:s.clone(),doglegVectorSet:e.doglegVectorSet,doglegLength:e.doglegLength,breaks:e.breaks.map(r=>({index:r.index,start:r.start.clone(),end:r.end.clone()})),leaderBranchIndex:e.leaderBranchIndex,directionType:e.directionType,leaderLines:e.leaderLines.map(r=>({vertices:r.vertices.map(a=>a.clone()),breakPointIndexes:[...r.breakPointIndexes],leaderLineIndex:r.leaderLineIndex,breaks:r.breaks.map(a=>({index:a.index,start:a.start.clone(),end:a.end.clone()}))}))}}checkLeaderIndex(e){if(e<0||e>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(e,t){this.checkLeaderIndex(e);const i=this._leaders[e].leaderLines[t];if(!i)throw new Error("The leader line index is out of range!");return i}collectGeometryPoints(){var t;const e=[];return this._leaders.forEach(i=>{i.lastLeaderLinePoint&&e.push(i.lastLeaderLinePoint),i.landingPoint&&e.push(i.landingPoint),i.breaks.forEach(r=>e.push(r.start,r.end)),i.leaderLines.forEach(r=>{e.push(...r.vertices),r.breaks.forEach(a=>e.push(a.start,a.end))});const s=this.getDoglegPoints(i);s&&e.push(...s),i.leaderLines.forEach(r=>{const a=this.getArrowheadPoints(this.getLeaderLineDrawPoints(i,r));a&&e.push(...a)})}),this._landingPoint&&e.push(this._landingPoint),this.contentBasePosition&&e.push(this.contentBasePosition),this.textAnchor&&e.push(this.textAnchor),this._mtextContent&&e.push(this._mtextContent.anchorPoint),(t=this._blockContent)!=null&&t.position&&e.push(this._blockContent.position),this.planeOrigin&&e.push(this.planeOrigin),e}getLeaderLineDrawPoints(e,t){if(t.vertices.length>=2)return t.vertices;if(t.vertices.length===0)return[];const i=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint??this.contentBasePosition;return!i||t.vertices[0].equals(i)?t.vertices:[t.vertices[0],i]}getDoglegPoints(e){if(!this.getResolvedDoglegEnabled())return;const t=e.lastLeaderLinePoint??e.landingPoint??this._landingPoint,i=e.doglegVector??this._doglegVector,s=e.doglegLength??this.getResolvedDoglegLength();if(!t||s==null||s===0||i.lengthSq()===0)return;const r=t.clone().add(i.clone().normalize().multiplyScalar(s));return[t,r]}getArrowheadPoints(e){if(!this.isArrowheadVisible()||e.length<2)return;const t=this.getArrowheadFrame(e);if(!t)return;const i=this.getResolvedArrowheadSize(),{tip:s,unit:r}=t,a=s.clone().add(r.clone().multiplyScalar(i)),o=i/6,h=new x(-r.y,r.x,0),c=a.clone().add(h.clone().multiplyScalar(o)),d=a.clone().add(h.clone().multiplyScalar(-o));return[s,c,d,s]}isArrowheadVisible(){const e=this.getResolvedArrowheadId();return(e==null?void 0:e.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(e,t){const i=[],s=this.getLeaderLinePointsForDraw(t);s.length>=2&&i.push(e.lines(s));const r=this.drawArrowhead(e,t);if(r&&i.push(r),i.length!==0)return i.length===1?i[0]:e.group(i)}getLeaderLinePointsForDraw(e){const t=this.getArrowheadLeaderLineTrimDistance();return t<=0?e:this.trimPolylineStart(e,t)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const e=this.getResolvedArrowheadBlockTableRecord();if(!e)return 0;const t=this.getResolvedArrowheadSize();if(t<=0)return 0;const i=e.origin??w.ORIGIN;let s=i.x;for(const r of e.newIterator()){const a=r.geometricExtents;a.isEmpty()||a.max.x>s&&(s=a.max.x)}return Math.max(0,(s-i.x)*t)}trimPolylineStart(e,t){if(e.length<2||t<=0)return e;let i=t;for(let s=0;s<e.length-1;s++){const r=e[s],a=e[s+1],o=a.distanceTo(r);if(!(o<=0)){if(i<o){const h=new x().subVectors(a,r);return[r.clone().add(h.multiplyScalar(i/o)),...e.slice(s+1)]}i-=o}}return[e[e.length-1]]}drawArrowhead(e,t){if(!this.isArrowheadVisible())return;const i=this.drawArrowheadBlock(e,t);if(i)return i;const s=this.getArrowheadPoints(t);if(!s)return;const r=new Tt;r.add(new ce(s,!0));const a=e.subEntityTraits,o=a.fillType;a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const h=e.area(r);return a.fillType=o,h}drawArrowheadBlock(e,t){const i=this.getResolvedArrowheadBlockTableRecord();if(!i)return;const s=this.getArrowheadFrame(t);if(!s)return;const{tip:r,unit:a}=s,o=this.getResolvedArrowheadSize(),h=Math.atan2(a.y,a.x),c=i.origin??w.ORIGIN,d=new j().makeTranslation(-c.x,-c.y,-c.z),u=new j().makeScale(o,o,o),p=new j().makeRotationZ(h),g=new j().makeTranslation(r.x,r.y,r.z),m=new j().multiplyMatrices(g,p).multiply(u).multiply(d);return ri.instance.draw(e,i,this.rgbColor,[],!0,m,new x(this.normal))}getArrowheadFrame(e){if(e.length<2)return;const t=e[0],i=e.find(r=>!r.equals(t));if(!i)return;const s=new x().subVectors(i,t);if(s.lengthSq()!==0)return{tip:t,unit:s.normalize()}}getResolvedArrowheadId(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.arrowSymbolId;return this.arrowheadId??e}getResolvedArrowheadBlockTableRecord(){const e=this.getResolvedArrowheadId();if(e)return this.database.tables.blockTable.getIdAt(e)}getResolvedArrowheadSize(){const e=this.getMLeaderStyle(),t=(e==null?void 0:e.arrowSize)??(e==null?void 0:e.scale);return this.arrowheadSize??this.contentScale??t??this.getResolvedTextHeight()}getResolvedTextHeight(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.textHeight;return this.textHeight>0?this.textHeight:e!=null&&e>0?e:2.5}getRenderableMTextContent(){var i;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const e=(i=this.getMLeaderStyle())==null?void 0:i.defaultMTextContents,t=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!e||!t))return{text:e,anchorPoint:t}}getMTextRenderWidth(e,t){if(this._textWidth>0)return this._textWidth;if(!e)return this._textWidth;const i=e.replace(/\\[PpNn]/g,`
4
+ `).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),s=Math.max(...i.split(/\r\n|\r|\n/g).map(r=>r.length),1);return Math.max(t,s*t)}transformVector(e,t){const i=new w,s=new w(e.x,e.y,e.z);i.applyMatrix4(t),s.applyMatrix4(t),e.set(s.x-i.x,s.y-i.y,s.z-i.z)}getMLeaderStyle(){const e=this.database.objects.mleaderStyle,t=this.mleaderStyleId||this.leaderStyleId;if(t){const i=e.getIdAt(t);if(i)return i}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const e=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return e||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(e){const t=e==null?void 0:e.trim();if(!t)return;const i=this.database.objects.mleaderStyle,s=i.getAt(t);if(s)return s;const r=i.getIdAt(t);if(r)return r;const a=t.toUpperCase();for(const[o,h]of i.entries())if(o.toUpperCase()===a)return h}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||pt}catch{return pt}}getResolvedTextStyleName(){var r,a;const e=this.database.tables.textStyleTable,t=(r=this.getMLeaderStyle())==null?void 0:r.textStyleId,i=t?(a=e.getIdAt(t))==null?void 0:a.name:void 0;if(this.textStyleName)return this.textStyleName;const s=this.textStyleId?e.getIdAt(this.textStyleId):void 0;return s!=null&&s.name?s.name:i}getTextStyle(){const e=this.database.tables.textStyleTable,t=this.getResolvedTextStyleName(),i=(t?e.getAt(t):void 0)??e.getAt(this.database.textstyle)??e.getAt(Q);if(!i)throw new Error("No valid text style found in text style table.");return i.textStyle}getResolvedLeaderLineColor(){var e;return this.getResolvedComponentColor(this.leaderLineColor,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineColor,$c)}getResolvedLeaderLineType(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,e,Uc)}getResolvedLeaderLineTypeId(){var e;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(e=this.getMLeaderStyle())==null?void 0:e.leaderLineTypeId,qc)}getResolvedLeaderLineStyle(){const e=this.getResolvedLeaderLineTypeId();if(!e)return;const t=this.database.tables.linetypeTable.getIdAt(e);if(t)return{type:"UserSpecified",...t.linetype}}getResolvedLeaderLineWeight(){var i;const e=(i=this.getMLeaderStyle())==null?void 0:i.leaderLineWeight,t=this.getResolvedStyleDrivenValue(this.leaderLineWeight,e,Kc);if(t!=null)return t}getResolvedDoglegEnabled(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,e,Zc)}getResolvedDoglegLength(){var t;const e=(t=this.getMLeaderStyle())==null?void 0:t.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,e,Qc)}getResolvedTextColor(){var e;return this.getResolvedComponentColor(this.textColor,(e=this.getMLeaderStyle())==null?void 0:e.textColor,Jc)}getResolvedComponentColor(e,t,i){const s=e!=null?zi(e):void 0;if(!s)return t;const r=this.isPropertyOverrideEnabled(i);return r===!0?s:r===!1?t??s:!s.isByBlock&&!s.isByLayer?s:t??s}getResolvedStyleDrivenValue(e,t,i){const s=this.isPropertyOverrideEnabled(i);return s===!0?e??t:t??e}isPropertyOverrideEnabled(e){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&e)!==0}applyColorTraits(e,t,i,s){e.color=i,e.rgbColor=s,t&&(e.color=t,e.rgbColor=this.resolveColorToRgb(t))}applyLineTraits(e,t,i){t&&(e.lineType=t),i!=null&&(e.lineWeight=i)}resolveColorToRgb(e){if(e.isByLayer){const t=this.getLayerColor();return(t==null?void 0:t.RGB)!=null?t.RGB:this.rgbColor}return e.isByBlock?this.rgbColor:e.RGB??this.rgbColor}};ta.typeName="MLeader";let qn=ta;const ia=class ia extends de{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=z.TopLeft,this._direction=new x(1,0,0),this._drawingDirection=He.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new Y}subGetOsnapPoints(e,t,i,s){D.Insertion===e&&s.push(this._location)}transformBy(e){const t=this._location.clone(),i=this._direction.lengthSq()>0?this._direction.clone().normalize():new x(Math.cos(this._rotation),Math.sin(this._rotation),0),s=new x(-i.y,i.x,i.z);s.lengthSq()===0&&s.set(0,1,0),s.normalize();const r=t.clone().add(i),a=t.clone().add(s);t.applyMatrix4(e),r.applyMatrix4(e),a.applyMatrix4(e);const o=new x(r).sub(t),h=new x(a).sub(t),c=o.length(),d=h.length();return this._location.copy(t),c>0&&(this._direction.copy(o).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=c),d>0&&(this._height*=d),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:z[1],value:1},{label:z[2],value:2},{label:z[3],value:3},{label:z[4],value:4},{label:z[5],value:5},{label:z[6],value:6},{label:z[7],value:7},{label:z[8],value:8},{label:z[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:e=>{this.attachmentPoint=e}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:He[1],value:1},{label:He[2],value:2},{label:He[3],value:3},{label:He[4],value:4},{label:He[5],value:5}],accessor:{get:()=>this.drawingDirection,set:e=>{this.drawingDirection=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:e=>{this.lineSpacingFactor=e}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:e=>{this.width=e}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:e=>{this.direction.x=e}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:e=>{this.direction.y=e}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:e=>{this.direction.z=e}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:e=>{this.location.x=e}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:e=>{this.location.y=e}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:e=>{this.location.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable,t=e.getAt(this.styleName)??e.getAt(this.database.textstyle)??e.getAt(Q);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(e,t){const i={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 e.mtext(i,this.getTextStyle(),t)}encodeMTextContentsForDxf(e){return e.replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMText"),e.writePoint3d(10,this.location),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writeString(1,this.encodeMTextContentsForDxf(this.contents)),e.writeString(7,this.styleName),e.writeAngle(50,this.rotation),e.writeVector3d(11,this.direction),e.writeInt16(71,this.attachmentPoint),e.writeInt16(72,this.drawingDirection),e.writeInt16(73,this.lineSpacingStyle),e.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(e.writeInt16(90,1),e.writeInt32(63,this.backgroundFillColor),e.writeInt32(441,this.backgroundFillTransparency),e.writeDouble(45,this.backgroundScaleFactor)),this}};ia.typeName="MText";let Qi=ia;const na=class na extends ue{get dxfTypeName(){return"SPLINE"}constructor(e,t,i,s,r){super(),this.rebuild(e,t,i,s,r)}rebuild(e,t,i,s,r){const a=+(e!==void 0)+ +(t!==void 0)+ +(i!==void 0)+ +(s!==void 0)+ +(r!==void 0);if(a<2||a>5)throw be.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new Ue(e,t,i,s):this._geo=new Ue(e,t,i,s,r)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(this._geo.startPoint),s.push(this._geo.endPoint);break}}transformBy(e){return this._geo.transform(e),this}subWorldDraw(e){const t=this._geo.getPoints(100);return e.lines(t)}dxfOutFields(e){var i;const t=this._geo;super.dxfOutFields(e),e.writeSubclassMarker("AcDbSpline"),e.writeInt16(70,this.closed?1:0),e.writeInt16(71,t.degree),e.writeInt16(72,t.knots.length),e.writeInt16(73,t.controlPoints.length),e.writeInt16(74,((i=t.fitPoints)==null?void 0:i.length)??0);for(const s of t.knots)e.writeDouble(40,s);for(const s of t.weights)e.writeDouble(41,s);for(const s of t.controlPoints)e.writePoint3d(10,s);for(const s of t.fitPoints??[])e.writePoint3d(11,s);return this}};na.typeName="Spline";let Ji=na;const ed=new x,sa=class sa extends ni{get dxfTypeName(){return"ACAD_TABLE"}constructor(e,t,i){super(e),this._attachmentPoint=z.TopLeft,this._numColumns=i,this._numRows=t,this._columnWidth=new Array(i),this._rowHeight=new Array(t),this._cells=new Array(t*i)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,i){var r;const s=e*this._numColumns+t;return(r=this._cells[s])==null?void 0:r.text}setTextString(e,t,i){const s=e*this._numColumns+t;if(!this._cells[s]){this._cells[s]={text:i,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[s].text=i}isEmpty(e,t){var s;const i=e*this._numColumns+t;return!((s=this._cells[i])!=null&&s.text)}get geometricExtents(){return new Y}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:e=>{this.numRows=e}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:e=>{this.numColumns=e}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((e,t)=>e+t,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((e,t)=>e+t,0)}}]},{groupName:"geometry",properties:[{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}}}]}]}}subWorldDraw(e){const t=this.blockTableRecord;if(t&&t.newIterator().count>0){const g=this.drawAnonymousTableBlock(e,t);if(g)return g}let i=0,s=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 g=0;g<=this.numRows;g++){i-=g>0?this.rowHeight(g-1):0,s=0;for(let m=0;m<=this.numColumns;m++)s+=m>0?this.columnWidth(m-1):0,a[o++]=s,a[o++]=i,a[o++]=0}const h=[],c=new Array(this.numRows*this.numColumns).fill(!1);s=0,o=0;let d=0;for(let g=0;g<this.numColumns;g++){s+=g>0?this.columnWidth(g-1):0,i=0;for(let m=0;m<this.numRows;m++){i+=m>0?this.rowHeight(m-1):0;const y=this.cell(m*this.numColumns+g);if(d=m*this.numColumns+g,y&&!c[d]){const _=y.borderWidth??1,f=y.borderHeight??1;this.fillVisited(c,d,this.numColumns,_,f),r[o++]=g+m*(this.numColumns+1),r[o++]=g+m*(this.numColumns+1)+_;const S=a[r[o-1]*3]-s,L=g+(m+f)*(this.numColumns+1)+_;g+_==this.numColumns&&(r[o++]=g+m*(this.numColumns+1)+_,r[o++]=L);const M=-a[L*3+1]-i;if(m+f==this.numRows&&(r[o++]=g+(m+f)*(this.numColumns+1)+f,r[o++]=g+(m+f)*(this.numColumns+1)),r[o++]=g+(m+f)*(this.numColumns+1),r[o++]=g+m*(this.numColumns+1),y.text){const I=y.attachmentPoint||this.attachmentPoint||z.MiddleCenter,W=this.getTableTextOffset(I,S,M),C={text:y.text,height:this.getCellTextHeight(y,M),width:S,position:ed.set(s,-i,0).clone().add(W),rotation:this.rotation,attachmentPoint:I},q=this.getTextStyle(y);h.push(e.mtext(C,q))}}}}h.push(e.lineSegments(a,3,r));const u=e.group(h),p=new ai;return p.setFromAxisAngle(x.Z_AXIS,this.rotation),bn.compose(this.position,p,this.scaleFactors),u.applyMatrix(bn),u}drawAnonymousTableBlock(e,t){const i=[],s=t.newIterator();for(const o of s){let h;o.color.isByBlock&&this.rgbColor?(Ra.copy(o.color),o.color.setRGBValue(this.rgbColor),h=o.worldDraw(e),o.color.copy(Ra)):h=o.worldDraw(e),h&&(h.objectId=this.objectId,h.ownerId=this.ownerId,h.layerName=this.layer,h.visible=this.visibility&&o.visibility,i.push(h))}const r=e.group(i);r.applyMatrix(this.blockTransform);const a=this.normal;return a&&(a.x!==0||a.y!==0||a.z!==1)&&(bn.setFromExtrusionDirection(a),r.applyMatrix(bn)),r}fillVisited(e,t,i,s,r){if(r==1&&s==1)e[t]=!0;else for(let a=0;a<s;++a)for(let o=0;o<r;++o)e[t+a+o*i]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable,i=(e.textStyle?t.getAt(e.textStyle):void 0)??t.getAt(this.database.textstyle)??t.getAt(Q);if(!i)throw new Error("No valid text style found in text style table.");return i.textStyle}getTableTextOffset(e,t,i){const s=new x;switch(e){case 1:break;case 2:s.setX(t/2);break;case 3:s.setX(t);break;case 4:s.setY(-i/2);break;case 5:s.set(t/2,-i/2,0);break;case 6:s.set(t,-i/2,0);break;case 7:s.setY(-i);break;case 8:s.set(t/2,-i,0);break;case 9:s.set(t,-i,0);break}return s}getCellTextHeight(e,t){return e.textHeight&&e.textHeight>0?e.textHeight:Math.max(t/2,1)}dxfOutFields(e){var r,a,o,h,c,d,u;super.dxfOutFields(e),e.writeSubclassMarker("AcDbTable");const t=e.version??((r=e.database)==null?void 0:r.version)??((a=this.database)==null?void 0:a.version),i=(t==null?void 0:t.value)!=null?t.value>=27:!1;e.writeInt16(280,this.tableDataVersion),e.writeObjectId(342,this.tableStyleId),e.writeObjectId(343,this.owningBlockRecordId),e.writeVector3d(11,this.horizontalDirection),e.writeUInt32(90,this.tableValueFlag),e.writeUInt32(93,this.tableOverrideFlag),e.writeUInt32(94,this.borderColorOverrideFlag),e.writeUInt32(95,this.borderLineweightOverrideFlag),e.writeUInt32(96,this.borderVisibilityOverrideFlag),e.writeInt16(71,this.attachmentPoint),e.writeInt32(91,this.numRows),e.writeInt32(92,this.numColumns);for(let p=0;p<this.numRows;++p)e.writeDouble(141,this.rowHeight(p));for(let p=0;p<this.numColumns;++p)e.writeDouble(142,this.columnWidth(p));const s=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let p=0;p<s;p++){const g=this._cells[p],m=(g==null?void 0:g.cellType)??(g!=null&&g.blockTableRecordId?2:1);if(e.writeInt16(171,m),e.writeInt16(172,(g==null?void 0:g.flagValue)??0),e.writeInt16(173,(g==null?void 0:g.mergedValue)??0),e.writeBoolean(174,g==null?void 0:g.autoFit),e.writeInt16(175,g==null?void 0:g.borderWidth),e.writeInt16(176,g==null?void 0:g.borderHeight),(g==null?void 0:g.overrideFlag)!=null&&(i?e.writeInt32(91,g.overrideFlag):e.writeInt16(177,g.overrideFlag)),e.writeInt16(178,g==null?void 0:g.virtualEdgeFlag),e.writeAngle(145,g==null?void 0:g.rotation),i&&e.writeInt16(92,g==null?void 0:g.extendedCellFlags),m===1)g!=null&&g.fieldObjetId?e.writeObjectId(344,g.fieldObjetId):this.writeCellText(e,(g==null?void 0:g.text)??"",i,g==null?void 0:g.cellValueBlockBegin);else if(m===2){if(e.writeObjectId(340,g==null?void 0:g.blockTableRecordId),e.writeDouble(144,g==null?void 0:g.blockScale),e.writeInt16(179,g==null?void 0:g.blockAttrNum),(o=g==null?void 0:g.attrDefineId)!=null&&o.length)for(const y of g.attrDefineId)e.writeObjectId(331,y);if((g==null?void 0:g.attrText)!=null)if(Array.isArray(g.attrText))for(const y of g.attrText)e.writeString(300,y);else e.writeString(300,g.attrText)}g!=null&&g.textStyle&&e.writeString(7,g.textStyle),(g==null?void 0:g.textHeight)!=null&&e.writeDouble(140,g.textHeight),(g==null?void 0:g.attachmentPoint)!=null&&e.writeInt16(170,g.attachmentPoint),(g==null?void 0:g.topBorderVisibility)!=null&&e.writeInt16(289,g.topBorderVisibility?1:0),(g==null?void 0:g.rightBorderVisibility)!=null&&e.writeInt16(285,g.rightBorderVisibility?1:0),(g==null?void 0:g.bottomBorderVisibility)!=null&&e.writeInt16(286,g.bottomBorderVisibility?1:0),(g==null?void 0:g.leftBorderVisibility)!=null&&e.writeInt16(288,g.leftBorderVisibility?1:0)}if(e.writeInt16(70,this.flowDirection),e.writeDouble(40,this.horizontalCellMargin),e.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&e.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&e.writeInt16(281,this.suppressHeader?1:0),(h=this.cellTypeOverrides)!=null&&h.length)for(const p of this.cellTypeOverrides){e.writeString(7,p.textStyle),e.writeDouble(140,p.textHeight),e.writeInt16(170,p.alignment),e.writeInt16(63,p.backgroundColor),e.writeInt16(64,p.contentColor),p.backgroundColorEnabled!=null&&e.writeInt16(283,p.backgroundColorEnabled?1:0);const g=p.borderLineweights;g&&(e.writeInt16(274,g.top),e.writeInt16(275,g.right),e.writeInt16(276,g.bottom),e.writeInt16(277,g.left),e.writeInt16(278,g.insideHorizontal),e.writeInt16(279,g.insideVertical));const m=p.borderVisibility;m&&(e.writeInt16(284,m.top?1:0),e.writeInt16(285,m.right?1:0),e.writeInt16(286,m.bottom?1:0),e.writeInt16(287,m.left?1:0),e.writeInt16(288,m.insideHorizontal?1:0),e.writeInt16(289,m.insideVertical?1:0))}if(this.tableBorderColors&&(e.writeInt16(63,this.tableBorderColors.left),e.writeInt16(64,this.tableBorderColors.top),e.writeInt16(65,this.tableBorderColors.insideHorizontal),e.writeInt16(66,this.tableBorderColors.bottom),e.writeInt16(68,this.tableBorderColors.insideVertical),e.writeInt16(69,this.tableBorderColors.right)),(c=this.rowDataTypes)!=null&&c.length)for(const p of this.rowDataTypes)e.writeInt16(97,p);if((d=this.rowUnitTypes)!=null&&d.length)for(const p of this.rowUnitTypes)e.writeInt16(98,p);if((u=this.rowFormats)!=null&&u.length)for(const p of this.rowFormats)e.writeString(4,p);return this}writeCellText(e,t,i,s){if(!i){if(t.length<=250){e.writeString(1,t);return}const o=Math.ceil(t.length/250);for(let h=0;h<o;h++){const c=h*250,d=c+250,u=t.slice(c,d);h===o-1?e.writeString(1,u):e.writeString(2,u)}return}if(e.writeString(301,s??"CELL_VALUE"),t.length<=250){e.writeString(302,t),e.writeString(304,"ACVALUE_END");return}const a=Math.ceil(t.length/250);for(let o=0;o<a;o++){const h=o*250,c=h+250,d=t.slice(h,c);o===a-1?e.writeString(302,d):e.writeString(303,d)}e.writeString(304,"ACVALUE_END")}};sa.typeName="Table";let Kn=sa;const bn=new j,Ra=new X,ra=class ra extends ue{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(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new Y().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;return e.push(...this._vertices),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(...this._vertices);break}}transformBy(e){return this._vertices.forEach(t=>t.applyMatrix4(e)),this._elevation=this._vertices[0].z,this}subWorldDraw(e){const t=new ce(this._vertices,!0),i=new Tt;i.add(t);const s=e.subEntityTraits;return s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(i)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTrace"),e.writeDouble(38,this.elevation),e.writeDouble(39,this.thickness),e.writePoint3d(10,this.getPointAt(0)),e.writePoint3d(11,this.getPointAt(1)),e.writePoint3d(12,this.getPointAt(2)),e.writePoint3d(13,this.getPointAt(3)),this}};ra.typeName="Trace";let Zn=ra;const aa=class aa extends ue{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new ce}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,i=0,s=-1,r=-1){const a=s<0?void 0:s,o=r<0?void 0:r,h={x:t.x,y:t.y,bulge:i,startWidth:a,endWidth:o};this._geo.addVertexAt(e,h)}removeVertexAt(e){this._geo.removeVertexAt(e)}reset(e,t){this._geo.reset(e,t)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new w(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new Y({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}subGetOsnapPoints(e,t,i,s){const r=new Array;for(let a=0;a<this.numberOfVertices;++a)r.push(this.getPoint3dAt(a));switch(e){case D.EndPoint:s.push(...r);break}}transformBy(e){const t=e.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(s=>{const r=new w(s.x,s.y,this._elevation).applyMatrix4(e);s.x=r.x,s.y=r.y,i=r.z,t&&s.bulge!=null&&(s.bulge=-s.bulge)}),this._elevation=i,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:e=>{this.elevation=e}}},{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:e=>{this.closed=e}}}]}]}}subWorldDraw(e){const t=this._geo.getPoints(100),i=this.createWidthProfile();if(i!=null){const r=td(i,this.closed);if(r!=null){const a=e.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},e.area(r)}}const s=[];return t.forEach(r=>s.push(new w().set(r.x,r.y,this.elevation))),e.lines(s)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyline"),e.writeInt32(90,this.numberOfVertices),e.writeInt16(70,this.closed?1:0),e.writeDouble(38,this.elevation);for(let t=0;t<this.numberOfVertices;++t)e.writePoint2d(10,this.getPoint2dAt(t));return this}createWidthProfile(){const e=this._geo.vertices,t=e.length;if(t<2)return null;const i=this.closed?t:t-1,s=[];let r=!1;for(let a=0;a<i;a++){const o=e[a],h=e[(a+1)%t],c=Math.max(0,o.startWidth??0),d=Math.max(0,o.endWidth??0);(c>Ce||d>Ce)&&(r=!0);const u=this.sampleSegment(o,h),p=u.length-1;for(let g=0;g<=p;g++){if(g===0&&s.length>0||this.closed&&a===i-1&&g===p)continue;const m=p>0?g/p:0;s.push({x:u[g].x,y:u[g].y,width:rd(c,d,m)})}}return r&&s.length>=2?s:null}sampleSegment(e,t){if(e.bulge&&Math.abs(e.bulge)>Ce){const s=new Mt(e,t,e.bulge).getPoints(32);if(s.length>1)return s.map(r=>new v(r.x,r.y))}return[new v(e.x,e.y),new v(t.x,t.y)]}};aa.typeName="Polyline";let Qn=aa;const Ce=1e-6,Ba=4;function td(n,e){if(n.length<2)return null;const t=nd(n,e);if(t.length<2)return null;const{left:i,right:s}=id(t,e);if(i.length<2||s.length<2)return null;const r=new Tt;if(e){if(!ks(i)||!ks(s))return null;const o=Math.abs(er(i)),h=Math.abs(er(s)),[c,d]=o>=h?[i,s]:[s,i];return r.add(new ce(c,!0)),r.add(new ce(d,!0)),r}const a=[...i,...s.reverse()];return ks(a)?(r.add(new ce(a,!0)),r):null}function id(n,e){const t=[],i=[];for(let s=0;s<n.length;s++){const r=n[s],a=Math.max(0,r.width)/2;if(a<=Ce)continue;const o=sd(n,s,e);o!=null&&(t.push({x:r.x+o.x*a,y:r.y+o.y*a}),i.push({x:r.x-o.x*a,y:r.y-o.y*a}))}return{left:t,right:i}}function nd(n,e){const t=[];if(n.forEach(i=>{const s=t[t.length-1];(!s||Math.abs(s.x-i.x)>Ce||Math.abs(s.y-i.y)>Ce||Math.abs(s.width-i.width)>Ce)&&t.push(i)}),e&&t.length>1){const i=t[0],s=t[t.length-1];Math.abs(i.x-s.x)<=Ce&&Math.abs(i.y-s.y)<=Ce&&t.pop()}return t}function sd(n,e,t){const i=n.length,s=n[e],r=n[(e-1+i)%i],a=n[(e+1)%i];let o=Fa(s.x-r.x,s.y-r.y),h=Fa(a.x-s.x,a.y-s.y);if(t||(e===0&&(o=h),e===i-1&&(h=o)),o==null&&h==null)return null;if(o==null)return Ln(h);if(h==null)return Ln(o);const c=Ln(o),d=Ln(h),u=c.x+d.x,p=c.y+d.y,g=Math.hypot(u,p);if(g<=Ce)return d;const m={x:u/g,y:p/g},y=Math.abs(m.x*d.x+m.y*d.y),_=y<=Ce?Ba:Math.min(1/y,Ba);return{x:m.x*_,y:m.y*_}}function Fa(n,e){const t=Math.hypot(n,e);return t<=Ce?null:{x:n/t,y:e/t}}function Ln(n){return{x:-n.y,y:n.x}}function er(n){let e=0;const t=n.length;for(let i=0;i<t;i++){const s=n[i],r=n[(i+1)%t];e+=s.x*r.y-r.x*s.y}return e/2}function ks(n){return n.length>=3&&Math.abs(er(n))>Ce}function rd(n,e,t){return n+(e-n)*t}const oa=class oa extends de{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new w}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new Y().expandByPoint(this._geo)}subGetOsnapPoints(e,t,i,s){D.Node===e&&s.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: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}}}]}]}}transformBy(e){return this._geo.applyMatrix4(e),this}subWorldDraw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbPoint"),e.writePoint3d(10,this.position),this}};oa.typeName="Point";let Jn=oa;var pl=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(pl||{}),ml=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(ml||{});const la=class la extends de{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 K(1,1),this._rotation=0,this._imageSize=new v,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(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get imageSize(){return this._imageSize}set imageSize(e){this._imageSize.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new Y;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}subWorldDraw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t)}transformBy(e){const t=this._width*this._scale.x,i=this._height*this._scale.y,s=new x(t*Math.cos(this._rotation),t*Math.sin(this._rotation),0),r=new x(-i*Math.sin(this._rotation),i*Math.cos(this._rotation),0),a=this._position.clone(),o=this._position.clone().add(s),h=this._position.clone().add(r);a.applyMatrix4(e),o.applyMatrix4(e),h.applyMatrix4(e);const c=new x(o).sub(a),d=new x(h).sub(a);return this._position.copy(a),this._rotation=Math.atan2(c.y,c.x),this._width=c.length(),this._height=d.length(),this._scale.set(1,1),this}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,i=this._height,s=new xe;s.setFromPoints(this._clipBoundary);const r=new v;r.setX(this._position.x-s.min.x*t),r.setY(this._position.y-s.min.y*i),this._clipBoundary.forEach(a=>{const o=a.x*t+r.x,h=a.y*i+r.y;e.push(new w(o,h,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Da.copy(e[1]);for(let t=1;t<4;t++)Sn.copy(e[t]),Sn.rotateAround(Da,this._rotation),e[t].setX(Sn.x),e[t].setY(Sn.y)}e.push(e[0])}return e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImage"),e.writePoint3d(10,this.position);const t=this.width*this.scale.x,i=this.height*this.scale.y,s=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:t,y:i},r=s.x>0?t/s.x:t,a=s.y>0?i/s.y:i,o=Math.cos(this._rotation),h=Math.sin(this._rotation);e.writePoint3d(11,{x:r*o,y:r*h,z:0}),e.writePoint3d(12,{x:-a*h,y:a*o,z:0}),e.writePoint2d(13,s),e.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(e.writeInt16(70,c),e.writeInt16(280,this.isClipped?1:0),e.writeInt16(281,this.brightness),e.writeInt16(282,this.contrast),e.writeInt16(283,this.fade),e.writeInt16(71,this.clipBoundaryType),this.isClipped){e.writeInt16(91,this.clipBoundary.length);for(const d of this.clipBoundary)e.writePoint2d(14,d)}return this}};la.typeName="RasterImage";let en=la;const Da=new v,Sn=new v,ha=class ha extends ue{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new w,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Y;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:s.push(this.basePoint);break}}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRay"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}};ha.typeName="Ray";let es=ha;const ca=class ca extends de{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(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new Y}transformBy(e){const t=this._centerPoint.clone(),i=this._centerPoint.clone().add(new x(this._width,0,0)),s=this._centerPoint.clone().add(new x(0,this._height,0));t.applyMatrix4(e),i.applyMatrix4(e),s.applyMatrix4(e);const r=new x(i).sub(t),a=new x(s).sub(t),o=this._height!==0?a.length()/this._height:1;return this._centerPoint.copy(t),this._width=r.length(),this._height=a.length(),this._viewHeight*=o,this}subWorldDraw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new el;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const i=[];return i.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)])),i.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)])),i.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)])),i.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)])),i}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewport"),e.writePoint3d(10,this.centerPoint),e.writeDouble(40,this.height),e.writeDouble(41,this.width),e.writePoint3d(12,this.viewCenter),e.writeDouble(45,this.viewHeight),e.writeInt32(69,this.number),this}};ca.typeName="Viewport";let ts=ca;const da=class da extends en{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(e){const t=this.boundaryPath(),i=new Tt;return i.add(new ce(t)),e.area(i)}dxfOutFields(e){return super.dxfOutFields(e),this}};da.typeName="Wipeout";let is=da;const ua=class ua extends ue{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new w,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Y;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}transformBy(e){return this._basePoint.applyMatrix4(e),this._unitDir.transformDirection(e),this}subWorldDraw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXline"),e.writePoint3d(10,this.basePoint),e.writeVector3d(11,this.unitDir),this}};ua.typeName="Xline";let ns=ua;class yl{constructor(e){this.position=new w(e.x,e.y,e.z||0)}}const ga=class ga extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t,i,s=!1,r=!1){super(),this._mCount=e,this._nCount=t,this._closedM=s,this._closedN=r,this._vertices=i.map(a=>new yl(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(e){this._closedM=e}get numberOfVertices(){return this._vertices.length}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getVertexAtMN(e,t){const i=e*this._nCount+t;return this.getVertexAt(i)}get geometricExtents(){if(this._vertices.length===0)return new Y(new w(0,0,0),new w(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,i=Number.MAX_VALUE,s=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{e=Math.min(e,o.position.x),t=Math.min(t,o.position.y),i=Math.min(i,o.position.z),s=Math.max(s,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new Y(new w(e,t,i),new w(s,r,a))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:this._vertices.forEach(r=>{s.push(r.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),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(e=>({x:e.position.x,y:e.position.y,z:e.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:e=>{this._closedM=e}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:e=>{this._closedN=e}}}]}]}}subWorldDraw(e){const t=[];for(let i=0;i<this._mCount;i++)for(let s=0;s<this._nCount;s++){const r=this.getVertexAtMN(i,s);let a=s+1;if(a>=this._nCount)if(this._closedN)a=0;else continue;const o=this.getVertexAtMN(i,a);t.push(r.position),t.push(o.position)}for(let i=0;i<this._nCount;i++)for(let s=0;s<this._mCount;s++){const r=this.getVertexAtMN(s,i);let a=s+1;if(a>=this._mCount)if(this._closedM)a=0;else continue;const o=this.getVertexAtMN(a,i);t.push(r.position),t.push(o.position)}return e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolygonMesh");let t=16;return this._closedM&&(t|=1),this._closedN&&(t|=32),e.writeInt16(66,1),e.writeInt16(70,t),e.writeInt32(71,this._mCount),e.writeInt32(72,this._nCount),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;i++){const s=this.getVertexAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolygonMeshVertex"),e.writePoint3d(10,s.position),e.writeInt16(70,16)}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}};ga.typeName="PolygonMesh";let ss=ga;class _l{constructor(e){this.position=new w(e.x,e.y,e.z||0)}}class fl{constructor(e){this.vertexIndices=e}}const pa=class pa extends ue{get dxfTypeName(){return"POLYLINE"}constructor(e,t){super(),this._vertices=e.map(i=>new _l(i)),this._faces=t.map(i=>new fl(i))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}set closed(e){}getVertexAt(e){if(e<0||e>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[e]}getFaceAt(e){if(e<0||e>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[e]}get geometricExtents(){if(this._vertices.length===0)return new Y(new w(0,0,0),new w(0,0,0));let e=Number.MAX_VALUE,t=Number.MAX_VALUE,i=Number.MAX_VALUE,s=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=-Number.MAX_VALUE;return this._vertices.forEach(o=>{e=Math.min(e,o.position.x),t=Math.min(t,o.position.y),i=Math.min(i,o.position.z),s=Math.max(s,o.position.x),r=Math.max(r,o.position.y),a=Math.max(a,o.position.z)}),new Y(new w(e,t,i),new w(s,r,a))}subGetGripPoints(){const e=new Array;return this._vertices.forEach(t=>{e.push(t.position)}),e}subGetOsnapPoints(e,t,i,s){switch(e){case D.EndPoint:this._vertices.forEach(r=>{s.push(r.position)});break}}transformBy(e){return this._vertices.forEach(t=>{t.position.applyMatrix4(e)}),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(e=>({x:e.position.x,y:e.position.y,z:e.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(e=>({vertexIndices:e.vertexIndices}))}}]}]}}subWorldDraw(e){const t=[];return this._faces.forEach(i=>{const s=[];if(i.vertexIndices.forEach(r=>{const a=Math.abs(r)-1;a>=0&&a<this._vertices.length&&s.push(this._vertices[a].position)}),s.length>=3)for(let r=0;r<s.length;r++){const a=s[r],o=s[(r+1)%s.length];t.push(a),t.push(o)}}),e.lines(t)}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPolyFaceMesh");const t=64;return e.writeInt16(66,1),e.writeInt16(70,t),this}dxfOut(e,t=!1){super.dxfOut(e,t);for(let i=0;i<this.numberOfVertices;i++){const s=this.getVertexAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writePoint3d(10,s.position),e.writeInt16(70,64)}for(let i=0;i<this.numberOfFaces;i++){const s=this.getFaceAt(i);e.writeStart("VERTEX"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbVertex"),e.writeSubclassMarker("AcDbPolyFaceMeshVertex"),e.writeInt16(70,128),s.vertexIndices.forEach((r,a)=>{e.writeInt32(10+a,r)})}return e.writeStart("SEQEND"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),this}};pa.typeName="PolyFaceMesh";let rs=pa;var as=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(as||{});const ma=class ma extends de{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 x(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(e){this._dimBlockPosition.copy(e)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new si),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(e){const t=this._textPosition.clone(),i=this._textPosition.clone().add(new x(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(e),this._textPosition.applyMatrix4(e),this._normal.transformDirection(e),t.applyMatrix4(e),i.applyMatrix4(e);const s=new x(i).sub(t);return s.lengthSq()>0&&(this._textRotation=Math.atan2(s.y,s.x)),this.subTransformBy(e),this}subGetOsnapPoints(e,t,i,s,r){const a=this.getDimBlockTableRecord();if(!a)return;const o=this.getFullDimBlockTransform(),h=new w(t).applyMatrix4(o.clone().invert()),c=new w(i).applyMatrix4(o.clone().invert()),d=(u,p)=>{const g=[];u.subGetOsnapPoints(e,h,c,g,p,o),u instanceof ni?g.forEach(m=>s.push(m.clone())):g.forEach(m=>s.push(new w(m).applyMatrix4(o)))};if(r){const u=a.getIdAt(r);if(u&&(d(u,r),s.length>0))return}for(const u of a.newIterator())d(u)}subWorldDraw(e){const t=this.getDimBlockTableRecord();if(t){const s=this.computeDimBlockTransform();return ri.instance.draw(e,t,this.rgbColor,[],!1,s,this._normal)}return e.group([])}getDimBlockGeometricExtents(){const e=new Y,t=this.getDimBlockTableRecord();if(!t)return e;for(const i of t.newIterator())e.union(i.geometricExtents);return e.applyMatrix4(this.getFullDimBlockTransform()),e}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",e=>{this.dimensionStyleName=e.trim()===""?null:e}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",e=>{this.dimensionText=e}),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,e=>{this.textRotation=e}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,e=>{this.textLineSpacingFactor=e}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,e=>{this.textLineSpacingStyle=e},[{label:as[1],value:1},{label:as[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(e,t,i,s,r){return{name:e,type:t,editable:s!=null,options:r,accessor:s?{get:i,set:s}:{get:i}}}createPoint3dProperties(e,t){return[this.createProperty(`${e}X`,"float",()=>t().x,i=>{t().x=i}),this.createProperty(`${e}Y`,"float",()=>t().y,i=>{t().y=i}),this.createProperty(`${e}Z`,"float",()=>t().z,i=>{t().z=i})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const e=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return e;const t=new j().setFromExtrusionDirection(this._normal);return new j().multiplyMatrices(t,e)}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 e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}findPointOnLine1(e,t,i){const s=new w().subVectors(t,e).normalize();return new w(t).addScaledVector(s,i)}findPointOnLine2(e,t,i){const s=e.x+i*Math.cos(t),r=e.y+i*Math.sin(t);return{x:s,y:r}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():Lr.Closed}computeDimBlockTransform(){const e=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,t=(e==null?void 0:e.origin)??w.ORIGIN,i=new j().makeTranslation(-t.x,-t.y,-t.z),s=new j().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new j().multiplyMatrices(s,i)}subTransformBy(e){}dxfOutFields(e){super.dxfOutFields(e);const t=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return e.writeSubclassMarker("AcDbDimension"),e.writeInt16(280,0),e.writeString(2,this.dimBlockId??void 0),e.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),e.writePoint3d(10,this.dimBlockPosition),e.writeString(1,this.dimensionText??""),e.writeAngle(53,this.textRotation),e.writePoint3d(11,this.textPosition),e.writeInt16(70,0),e.writeInt16(72,this.textLineSpacingStyle),e.writeDouble(41,this.textLineSpacingFactor),e.writeDouble(42,this.measurement),e.writeVector3d(210,this.normal),e.writeObjectId(340,t==null?void 0:t.objectId),this}};ma.typeName="Dimension";let yt=ma;const ya=class ya extends yt{constructor(e,t,i,s,r=null,a=null){super(),this._centerPoint=new w().copy(e),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(i),this._arcPoint=new w().copy(s),this.dimensionText=r,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.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(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDb3PointAngularDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};ya.typeName="3PointAngularDimension";let os=ya;const _a=class _a extends yt{constructor(e,t,i,s=null,r=null){super(),this._dimLinePoint=new w().copy(i),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(t),this._oblique=0,this._rotation=0,this.calculateRotation(),s?this.dimensionText=s:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=r}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.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,t=>{this.rotation=t}),this.createProperty("oblique","float",()=>this.oblique,t=>{this.oblique=t})]}]}}subTransformBy(e){this._dimLinePoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e),this.calculateRotation()}get geometricExtents(){return this.getDimBlockGeometricExtents()}get isAppendArrow(){return!1}createDimBlock(e){const t=new ie;t.name=e;const i=this.createLines();i.forEach(o=>t.appendEntity(new Zi(o.startPoint,o.endPoint))),this.createArrows(i[0]).forEach(o=>t.appendEntity(o));const r=i[0].midPoint,a=this.createMText(r,this._rotation);return a&&t.appendEntity(a),t}createMText(e,t){const i=s=>({x:Math.cos(s),y:Math.sin(s),z:0});if(this.dimensionText){const s=new Qi;return s.attachmentPoint=z.MiddleLeft,s.layer="0",s.color=new X(P.ByBlock),s.location=e,s.contents=this.dimensionText??"",s.height=10,s.direction=i(t),s.styleName=this.dimensionStyle.dimtxsty,s}}createArrows(e){const t=[];return t.push(this.createArrow(e.startPoint,this.rotation+Math.PI,10)),t.push(this.createArrow(e.endPoint,this.rotation,10)),t}createArrow(e,t,i){const s="_CAXARROW",r=new ni(s);return r.position=e,r.rotation=t,r.scaleFactors={x:i,y:i,z:i},r}createLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),i=this.createExtensionLine(this._xLine2Point),s=this.findIntersectionPoint(t,this._dimLinePoint),r=this.findIntersectionPoint(i,this._dimLinePoint),a=new kt(s,r);return e.push(a),t.endPoint=s,this.adjustExtensionLine(t),e.push(t),i.endPoint=r,this.adjustExtensionLine(i),e.push(i),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,i=this.findPointOnLine2(e,t,100);return new kt(e,{...i,z:e.z})}findIntersectionPoint(e,t){const i=e.startPoint,s=e.endPoint,r=new x().subVectors(s,i).normalize(),o=new x().subVectors(t,i).dot(r),h=new x().copy(r).multiplyScalar(o);return new x().addVectors(i,h)}calculateRotation(){const e=this._xLine1Point,t=this._xLine2Point,i=t.x-e.x,s=t.y-e.y;this._rotation=Math.atan2(s,i)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker(this.dxfSubclassMarker),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.dimLinePoint),e.writeAngle(50,this.rotation),e.writeAngle(52,this.oblique),this}};_a.typeName="AlignedDimension";let tn=_a;const fa=class fa extends yt{constructor(e,t,i,s,r=null,a=null){super(),this._arcPoint=new w().copy(s),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(i),this._centerPoint=new w().copy(e),this.dimensionText=r,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.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(e){this._arcPoint.applyMatrix4(e),this._centerPoint.applyMatrix4(e),this._xLine1Point.applyMatrix4(e),this._xLine2Point.applyMatrix4(e)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbArcDimension"),e.writePoint3d(13,this.xLine1Point),e.writePoint3d(14,this.xLine2Point),e.writePoint3d(15,this.centerPoint),e.writePoint3d(16,this.arcPoint),this}};fa.typeName="ArcDimension";let tr=fa;const xa=class xa extends yt{constructor(e,t,i=0,s=null,r=null){super(),this._chordPoint=new w().copy(e),this._farChordPoint=new w().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=i,this.dimensionText=s,this.dimensionStyleName=r}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._chordPoint.applyMatrix4(e),this._farChordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbDiametricDimension"),e.writePoint3d(15,this.chordPoint),e.writePoint3d(16,this.farChordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};xa.typeName="DiametricDimension";let ls=xa;const wa=class wa extends yt{constructor(e,t,i=null,s=null){super(),this._definingPoint=new w().copy(e),this._leaderEndPoint=new w().copy(t),this.dimensionText=i,this.dimensionStyleName=s}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}subTransformBy(e){this._definingPoint.applyMatrix4(e),this._leaderEndPoint.applyMatrix4(e)}get geometricExtents(){return new Y}get arrowLineCount(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbOrdinateDimension"),e.writePoint3d(13,this.definingPoint),e.writePoint3d(14,this.leaderEndPoint),this}};wa.typeName="OrdinateDimension";let hs=wa;const ba=class ba extends yt{constructor(e,t,i,s=null,r=null){super(),this._center=new w().copy(e),this._chordPoint=new w().copy(t),this._leaderLength=i,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=s,this.dimensionStyleName=r}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLength(e){this._leaderLength=e}set leaderLenght(e){this._leaderLength=e}get properties(){const e=this.getBaseProperties();return{type:this.type,groups:[...e.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,t=>{this.leaderLength=t}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,t=>{this.extArcStartAngle=t}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,t=>{this.extArcEndAngle=t})]}]}}subTransformBy(e){this._center.applyMatrix4(e),this._chordPoint.applyMatrix4(e)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){return new Y}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRadialDimension"),e.writePoint3d(15,this.center),e.writePoint3d(13,this.chordPoint),e.writeDouble(40,this.leaderLength),e.writeAngle(52,this.extArcStartAngle),e.writeAngle(53,this.extArcEndAngle),this}};ba.typeName="RadialDimension";let cs=ba;const La=class La extends tn{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};La.typeName="RotatedDimension";let ds=La;var xl=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(xl||{}),wl=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(wl||{}),bl=(n=>(n[n.kDisplay=0]="kDisplay",n[n.kExtents=1]="kExtents",n[n.kLimits=2]="kLimits",n[n.kView=3]="kView",n[n.kWindow=4]="kWindow",n[n.kLayout=5]="kLayout",n))(bl||{}),Lt=(n=>(n[n.kDraft=0]="kDraft",n[n.kPreview=1]="kPreview",n[n.kNormal=2]="kNormal",n[n.kPresentation=3]="kPresentation",n[n.kMaximum=4]="kMaximum",n[n.kCustom=5]="kCustom",n))(Lt||{}),ci=(n=>(n[n.kAsDisplayed=0]="kAsDisplayed",n[n.kWireframe=1]="kWireframe",n[n.kHidden=2]="kHidden",n[n.kRendered=3]="kRendered",n[n.kVisualStyle=4]="kVisualStyle",n[n.kRenderPreset=5]="kRenderPreset",n))(ci||{}),Ll=(n=>(n[n.kScaleToFit=0]="kScaleToFit",n[n.k1_128in_1ft=1]="k1_128in_1ft",n[n.k1_64in_1ft=2]="k1_64in_1ft",n[n.k1_32in_1ft=3]="k1_32in_1ft",n[n.k1_16in_1ft=4]="k1_16in_1ft",n[n.k3_32in_1ft=5]="k3_32in_1ft",n[n.k1_8in_1ft=6]="k1_8in_1ft",n[n.k3_16in_1ft=7]="k3_16in_1ft",n[n.k1_4in_1ft=8]="k1_4in_1ft",n[n.k3_8in_1ft=9]="k3_8in_1ft",n[n.k1_2in_1ft=10]="k1_2in_1ft",n[n.k3_4in_1ft=11]="k3_4in_1ft",n[n.k1in_1ft=12]="k1in_1ft",n[n.k3in_1ft=13]="k3in_1ft",n[n.k6in_1ft=14]="k6in_1ft",n[n.k1ft_1ft=15]="k1ft_1ft",n[n.k1_1=16]="k1_1",n[n.k1_2=17]="k1_2",n[n.k1_4=18]="k1_4",n[n.k1_5=19]="k1_5",n[n.k1_8=20]="k1_8",n[n.k1_10=21]="k1_10",n[n.k1_16=22]="k1_16",n[n.k1_20=23]="k1_20",n[n.k1_30=24]="k1_30",n[n.k1_40=25]="k1_40",n[n.k1_50=26]="k1_50",n[n.k1_100=27]="k1_100",n[n.k2_1=28]="k2_1",n[n.k4_1=29]="k4_1",n[n.k8_1=30]="k8_1",n[n.k10_1=31]="k10_1",n[n.k100_1=32]="k100_1",n[n.k1000_1=33]="k1000_1",n[n.k1and1_2in_1ft=34]="k1and1_2in_1ft",n))(Ll||{});const ad={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 Sl extends De{constructor(e=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new v,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new v,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new xe,this._modelType=e,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(e){this._plotSettingsName=e}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(e){this._plotSettingsName=e}get plotCfgName(){return this._plotCfgName}set plotCfgName(e){this._plotCfgName=e}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(e){this._canonicalMediaName=e}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(e){this._currentStyleSheet=e}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(e){this._plotOrigin=e}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(e){this._customPrintScale=e}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(e){this._plotPaperSize=e}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(e){this._plotPaperMargins=e}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(e){this._plotViewName=e}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(e){this._plotWindowArea=e}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(e){this._modelType=e}getModelType(){return this._modelType}setModelType(e){this._modelType=e}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(e){this._drawViewportsFirst=e}setDrawViewportsFirst(e){this._drawViewportsFirst=e}get plotCentered(){return this._plotCentered}set plotCentered(e){this._plotCentered=e}setPlotCentered(e){this._plotCentered=e}get plotHidden(){return this._plotHidden}set plotHidden(e){this._plotHidden=e}setPlotHidden(e){this._plotHidden=e}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(e){this._plotPaperUnits=e}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(e){this._plotPlotStyles=e}setPlotPlotStyles(e){this._plotPlotStyles=e}get plotRotation(){return this._plotRotation}set plotRotation(e){this._plotRotation=e}get plotType(){return this._plotType}set plotType(e){this._plotType=e}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(e){this._plotViewportBorders=e}setPlotViewportBorders(e){this._plotViewportBorders=e}get printLineweights(){return this._printLineweights}set printLineweights(e){this._printLineweights=e}setPrintLineweights(e){this._printLineweights=e}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(e){this._scaleLineweights=e}setScaleLineweights(e){this._scaleLineweights=e}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(e){this._showPlotStyles=e}setShowPlotStyles(e){this._showPlotStyles=e}get shadePlot(){return this._shadePlotType}set shadePlot(e){this._shadePlotType=e}setShadePlot(e){this._shadePlotType=e}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(e){this._shadePlotResLevel=e}setShadePlotResLevel(e){this._shadePlotResLevel=e}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(e){this._shadePlotCustomDpi=e}setShadePlotCustomDPI(e){this._shadePlotCustomDpi=e}get shadePlotId(){return this._shadePlotId}set shadePlotId(e){this._shadePlotId=e}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(e){this._stdScaleType=e}get stdScale(){return ad[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(e){this._useStandardScale=e}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbPlotSettings"),e.writeString(1,this.plotSettingsName),e.writeString(2,this.plotCfgName),e.writeString(4,this.canonicalMediaName),e.writeString(6,this.plotViewName),e.writeDouble(40,this.plotPaperMargins.left),e.writeDouble(41,this.plotPaperMargins.bottom),e.writeDouble(42,this.plotPaperMargins.right),e.writeDouble(43,this.plotPaperMargins.top),e.writeDouble(44,this.plotPaperSize.x),e.writeDouble(45,this.plotPaperSize.y),e.writeDouble(46,this.plotOrigin.x),e.writeDouble(47,this.plotOrigin.y),e.writeDouble(48,this.plotWindowArea.min.x),e.writeDouble(49,this.plotWindowArea.min.y),e.writeDouble(140,this.plotWindowArea.max.x),e.writeDouble(141,this.plotWindowArea.max.y),e.writeDouble(142,this.customPrintScale.numerator),e.writeDouble(143,this.customPrintScale.denominator);let t=0;return this.plotViewportBorders&&(t|=1),this.showPlotStyles&&(t|=2),this.plotCentered&&(t|=4),this.plotHidden&&(t|=8),this.useStandardScale&&(t|=16),this.plotPlotStyles&&(t|=32),this.scaleLineweights&&(t|=64),this.printLineweights&&(t|=128),this.drawViewportsFirst&&(t|=512),this.modelType&&(t|=1024),e.writeInt16(70,t),e.writeInt16(72,this.plotPaperUnits),e.writeInt16(73,this.plotRotation),e.writeInt16(74,this.plotType),e.writeString(7,this.currentStyleSheet),e.writeInt16(75,this.stdScaleType),e.writeInt16(76,this.shadePlot),e.writeInt16(77,this.shadePlotResLevel),e.writeInt16(78,this.shadePlotCustomDPI),e.writeDouble(147,this.stdScale),e.writeObjectId(333,this.shadePlotId),this}}class ln extends Sl{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new xe,this._extents=new Y,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}get viewportArray(){return this._viewportArray}set viewportArray(e){this._viewportArray=e.slice()}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayout"),e.writeString(1,this.layoutName),e.writeInt16(70,this.tabSelected?1:0),e.writeInt16(71,this.tabOrder),e.writeObjectId(330,this.blockTableRecordId),e.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),e.writePoint2d(10,this.limits.min),e.writePoint2d(11,this.limits.max),e.writePoint3d(14,this.extents.min),e.writePoint3d(15,this.extents.max),this}}class hn{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.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 e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}class Jt extends De{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,i=>this.hasId(i)),this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((i,s)=>{i===t&&(this._recordsByName.delete(s),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:s}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new hn(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbDictionary"),e.writeInt16(280,1),e.writeInt16(281,1);for(const[t,i]of this._recordsByName)e.writeString(3,t),e.writeObjectId(350,i.objectId);return this}}class Al extends Jt{getBtrIdAt(e){for(const[t,i]of this._recordsByName)if(i.blockTableRecordId==e)return i}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class vt extends De{constructor(e,t){e=e||{},nn(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var Il=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(Il||{});const St=class St extends vt{static isModelSapceName(e){return e.toLowerCase()==St.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(St.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 St.isModelSapceName(this.name)}get isPaperSapce(){return St.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(e){this._blockInsertUnits=e}get explodability(){return this._explodability}set explodability(e){this._explodability=e}get blockScaling(){return this._blockScaling}set blockScaling(e){this._blockScaling=e}get bmpPreview(){return this._bmpPreview}set bmpPreview(e){this._bmpPreview=e}appendEntity(e){const t=i=>{i.database=this.database,i.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(i),this.database.commitObjectHandle(i,s=>this._entities.has(s)),i.resolveEffectiveProperties(),this._entities.set(i.objectId,i)};if(Array.isArray(e))for(let i=0;i<e.length;++i)t(e[i]);else t(e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}removeEntity(e){const t=Array.isArray(e)?e:[e],i=[];return t.forEach(s=>{const r=this._entities.get(s);r&&i.push(r),this._entities.delete(s)}),i.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:i}),i.length>0}newIterator(){return new hn(this._entities)}getIdAt(e){return this._entities.get(e)}dxfOutBlockRecord(e){return e.writeStart("BLOCK_RECORD"),this.dxfOut(e),this}dxfOutBlockBegin(e){return e.writeStart("BLOCK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeString(8,"0"),e.writeSubclassMarker("AcDbBlockBegin"),e.writeString(2,this.name),e.writeInt16(70,0),e.writePoint3d(10,this.origin),e.writeString(3,this.name),this}dxfOutBlockEnd(e){return e.writeStart("ENDBLK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbBlockTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.blockInsertUnits),e.writeInt16(280,this.explodability),e.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&e.writeObjectId(340,this.layoutId),this}};St.MODEL_SPACE_NAME="*Model_Space",St.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let ie=St;class Pl{constructor(){this.events={layoutCreated:new te,layoutRemoved:new te,layoutRenamed:new te,layoutSwitched:new te}}countLayouts(e){return this.getWorkingDatabase(e).objects.layout.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).objects.layout.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const i=this.getWorkingDatabase(t),s=i.objects.layout.getIdAt(e);return this.setCurrentLayoutInternal(s,i)}setCurrentLayoutBtrId(e,t){const i=this.getWorkingDatabase(t),s=i.objects.layout.getBtrIdAt(e);return this.setCurrentLayoutInternal(s,i)}setCurrentLayout(e,t){const i=this.getWorkingDatabase(t),s=i.objects.layout.getAt(e);return this.setCurrentLayoutInternal(s,i)}renameLayout(e,t,i){const r=this.getWorkingDatabase(i).objects.layout.getAt(e);return r?(r.layoutName=t,this.events.layoutRenamed.dispatch({layout:r,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).objects.layout.has(e)}deleteLayout(e,t){const i=this.getWorkingDatabase(t).objects.layout,s=i.getAt(e);let r=!1;return s&&(r=i.remove(e),r&&this.events.layoutRemoved.dispatch({layout:s})),r}createLayout(e,t){const i=this.getWorkingDatabase(t),s=new ln;s.layoutName=e,s.tabOrder=i.objects.layout.maxTabOrder;const r=new ie;return r.name=`*Paper_Space${s.tabOrder}`,i.tables.blockTable.add(r),i.objects.layout.setAt(e,s),this.events.layoutCreated.dispatch({layout:s}),{layout:s,btr:r}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.objects.layout.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||or().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}oo(()=>new Pl);class Er extends De{constructor(){super(),this._contentType=2,this._drawMLeaderOrderType=1,this._drawLeaderOrderType=0,this._bitFlags=0,this._maxLeaderSegmentsPoints=-1,this._firstSegmentAngleConstraint=0,this._secondSegmentAngleConstraint=0,this._leaderLineType=1,this._leaderLineColor=new X(P.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new X(P.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new X(P.ByBlock),this._blockScale=new x(1,1,1),this._enableBlockScale=!0,this._blockRotation=0,this._enableBlockRotation=!1,this._blockConnectionType=0,this._scale=1,this._overwritePropChanged=!1,this._annotative=!1,this._breakSize=0,this._textAttachmentDirection=0,this._bottomTextAttachmentType=9,this._topTextAttachmentType=9,this._extendLeaderToText=!1}get unknown1(){return this._unknown1}set unknown1(e){this._unknown1=e}get contentType(){return this._contentType}set contentType(e){this._contentType=e}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(e){this._drawMLeaderOrderType=e}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(e){this._drawLeaderOrderType=e}get bitFlags(){return this._bitFlags}set bitFlags(e){this._bitFlags=e}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(e){this._maxLeaderSegmentsPoints=e}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(e){this.maxLeaderSegmentsPoints=e}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(e){this._firstSegmentAngleConstraint=e}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(e){this._secondSegmentAngleConstraint=e}get leaderLineType(){return this._leaderLineType}set leaderLineType(e){this._leaderLineType=e}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(e){this._leaderLineColor.copy(e)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(e){this._leaderLineTypeId=e}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(e){this._leaderLineWeight=e}get enableLanding(){return this._enableLanding}set enableLanding(e){this._enableLanding=e}get landingEnabled(){return this.enableLanding}set landingEnabled(e){this.enableLanding=e}get landingGap(){return this._landingGap}set landingGap(e){this._landingGap=e}get enableDogleg(){return this._enableDogleg}set enableDogleg(e){this._enableDogleg=e}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(e){this.enableDogleg=e}get doglegLength(){return this._doglegLength}set doglegLength(e){this._doglegLength=e}get description(){return this._description}set description(e){this._description=e}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(e){this._arrowSymbolId=e}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(e){this.arrowSymbolId=e}get arrowSize(){return this._arrowSize}set arrowSize(e){this._arrowSize=e}get arrowheadSize(){return this.arrowSize}set arrowheadSize(e){this.arrowSize=e}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(e){this._defaultMTextContents=e}get defaultMText(){return this.defaultMTextContents}set defaultMText(e){this.defaultMTextContents=e}get textString(){return this.defaultMTextContents}set textString(e){this.defaultMTextContents=e}get textStyleId(){return this._textStyleId}set textStyleId(e){this._textStyleId=e}get textStyle(){return this.textStyleId}set textStyle(e){this.textStyleId=e}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(e){this._textLeftAttachmentType=e}get textAngleType(){return this._textAngleType}set textAngleType(e){this._textAngleType=e}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(e){this._textAlignmentType=e}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(e){this._textRightAttachmentType=e}get textColor(){return this._textColor}set textColor(e){this._textColor.copy(e)}get textHeight(){return this._textHeight}set textHeight(e){this._textHeight=e}get enableFrameText(){return this._enableFrameText}set enableFrameText(e){this._enableFrameText=e}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(e){this.enableFrameText=e}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(e){this._textAlignAlwaysLeft=e}get alignSpace(){return this._alignSpace}set alignSpace(e){this._alignSpace=e}get blockId(){return this._blockId}set blockId(e){this._blockId=e}get blockContentId(){return this.blockId}set blockContentId(e){this.blockId=e}get blockColor(){return this._blockColor}set blockColor(e){this._blockColor.copy(e)}get blockContentColor(){return this.blockColor}set blockContentColor(e){this.blockColor=e}get blockScale(){return this._blockScale.clone()}set blockScale(e){this._blockScale.copy(e)}get blockContentScale(){return this.blockScale}set blockContentScale(e){this.blockScale=e}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(e){this._enableBlockScale=e}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(e){this.enableBlockScale=e}get blockRotation(){return this._blockRotation}set blockRotation(e){this._blockRotation=e}get blockContentRotation(){return this.blockRotation}set blockContentRotation(e){this.blockRotation=e}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(e){this._enableBlockRotation=e}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(e){this.enableBlockRotation=e}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(e){this._blockConnectionType=e}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(e){this.blockConnectionType=e}get scale(){return this._scale}set scale(e){this._scale=e}get scaleFactor(){return this.scale}set scaleFactor(e){this.scale=e}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(e){this._overwritePropChanged=e}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(e){this.overwritePropChanged=e}get annotative(){return this._annotative}set annotative(e){this._annotative=e}get breakSize(){return this._breakSize}set breakSize(e){this._breakSize=e}get breakGapSize(){return this.breakSize}set breakGapSize(e){this.breakSize=e}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(e){this._textAttachmentDirection=e}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(e){this._bottomTextAttachmentType=e}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(e){this.bottomTextAttachmentType=e}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(e){this._topTextAttachmentType=e}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(e){this.topTextAttachmentType=e}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(e){this._extendLeaderToText=e}get unknown2(){return this._unknown2}set unknown2(e){this._unknown2=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMLeaderStyle"),e.writeInt16(179,this.unknown1),e.writeInt16(170,this.contentType),e.writeInt16(171,this.drawMLeaderOrderType),e.writeInt16(172,this.drawLeaderOrderType),e.writeInt32(90,this.maxLeaderSegmentsPoints),e.writeDouble(40,this.firstSegmentAngleConstraint),e.writeDouble(41,this.secondSegmentAngleConstraint),e.writeInt16(173,this.leaderLineType),e.writeInt32(91,Cn(this.leaderLineColor)),e.writeHandle(340,this.leaderLineTypeId),e.writeInt32(92,this.leaderLineWeight),e.writeBoolean(290,this.enableLanding),e.writeDouble(42,this.landingGap),e.writeBoolean(291,this.enableDogleg),e.writeDouble(43,this.doglegLength),e.writeString(3,this.description),e.writeHandle(341,this.arrowSymbolId),e.writeDouble(44,this.arrowSize),e.writeString(300,this.defaultMTextContents),e.writeHandle(342,this.textStyleId),e.writeInt16(174,this.textLeftAttachmentType),e.writeInt16(175,this.textAngleType),e.writeInt16(176,this.textAlignmentType),e.writeInt16(178,this.textRightAttachmentType),e.writeInt32(93,Cn(this.textColor)),e.writeDouble(45,this.textHeight),e.writeBoolean(292,this.enableFrameText),e.writeBoolean(297,this.textAlignAlwaysLeft),e.writeDouble(46,this.alignSpace),e.writeHandle(343,this.blockId),e.writeInt32(94,Cn(this.blockColor)),e.writeDouble(47,this._blockScale.x),e.writeDouble(49,this._blockScale.y),e.writeDouble(140,this._blockScale.z),e.writeBoolean(293,this.enableBlockScale),e.writeDouble(141,this.blockRotation),e.writeBoolean(294,this.enableBlockRotation),e.writeInt16(177,this.blockConnectionType),e.writeDouble(142,this.scale),e.writeBoolean(295,this.overwritePropChanged),e.writeBoolean(296,this.annotative),e.writeDouble(143,this.breakSize),e.writeInt16(271,this.textAttachmentDirection),e.writeInt16(272,this.bottomTextAttachmentType),e.writeInt16(273,this.topTextAttachmentType),e.writeBoolean(298,this.unknown2),this}}class Tr extends De{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new X,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get flags(){return this._flags}set flags(e){this._flags=e}get description(){return this._description}set description(e){this._description=e}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor.copy(e)}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=e}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=e}get elementCount(){return this._elements.length}get elements(){return this._elements.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}set elements(e){this._elements=e.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}addElement(e){this._elements.push({offset:e.offset,color:e.color.clone(),lineType:e.lineType})}removeElementAt(e){if(e<0||e>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(e,1)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbMlineStyle"),e.writeString(2,this.styleName),e.writeInt16(70,this.flags),e.writeString(3,this.description),e.writeCmColor(this.fillColor),e.writeDouble(51,this.startAngle),e.writeDouble(52,this.endAngle),e.writeInt16(71,this.elementCount),this._elements.forEach(t=>{e.writeDouble(49,t.offset),e.writeCmColor(t.color),e.writeString(6,t.lineType)}),this}}class El extends De{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRasterImageDef"),e.writeString(1,this.sourceFileName),e.writeInt16(280,1),e.writeInt16(281,0),this}}var Tl=(n=>(n[n.NotApplicable=0]="NotApplicable",n[n.Ignore=1]="Ignore",n[n.Replace=2]="Replace",n[n.XrefMangleName=3]="XrefMangleName",n[n.MangleName=4]="MangleName",n))(Tl||{});class od extends De{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(e){this._data=e}clear(){var e;(e=this._data)==null||e.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbXrecord"),e.writeInt16(280,1),e.writeResultBuffer(this.data),this}}class Ml{constructor(e){this.db=e}createDefaultLayer(){const e=new X;return e.colorIndex=7,this.db.tables.layerTable.add(new ws({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new Et({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Et({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Et({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new bs({name:Q,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new si({name:Q,dimtxsty:Q}))}createDefaultLayout(){const e=new ln;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=this.db.tables.blockTable.modelSpace.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.db.objects.layout.setAt(e.layoutName,e),this.db.tables.blockTable.modelSpace.layoutId=e.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const t=new Ki;t.patternName=ti;const i=new qi;i.add(new Ge({x:0,y:0},{x:-1,y:.125})),i.add(new Ge({x:-1,y:.125},{x:-1,y:-.125})),i.add(new Ge({x:-1,y:-.125},{x:0,y:0})),t.add(i);const s=new ie;s.name="_CAXARROW",s.appendEntity(t),this.db.tables.blockTable.add(s)}}}var kl=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(kl||{});const Mr=192,us=193,kr=194,Cr=195,Cl=200;function Cn(n){if(n.isByBlock)return us<<24>>0;if(n.isByLayer)return Mr<<24>>0;const e=n.colorIndex;if(e!=null&&e>0&&e<256)return(Cr<<24|e&255)>>0;const t=n.RGB;return t!=null?(kr<<24|t&16777215)>>0:us<<24>>0}function zi(n){const e=new X(P.ByBlock);switch(n>>>24&255){case Mr:e.setByLayer();break;case us:case Cl:e.setByBlock();break;case Cr:e.colorIndex=n&255;break;case kr:e.setRGBValue(n&16777215);break;default:n>=0&&n<=256&&(e.colorIndex=n);break}return e}var xs=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(xs||{});function ld(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function hd(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}class vr{parse(e){const i=this.normalizeLineEndings(e).split(`
5
+ `),s=[],r=[];let a=null;return i.forEach((o,h)=>{const c=h+1,d=this.stripInlineComment(o).trim();if(!d)return;if(d.startsWith("*")){this.flushCurrentPattern(a,s,r);const p=this.parseHeader(d.slice(1));if(!p){r.push({line:c,message:"Invalid pattern header.",source:o}),a=null;return}a={pattern:{name:p.name,description:p.description,lines:[]},headerLine:c};return}if(!a){r.push({line:c,message:"Line descriptor appears before any pattern header.",source:o});return}const u=this.parseLineDescriptor(d,c);if(!u){r.push({line:c,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:o});return}a.pattern.lines.push(u)}),this.flushCurrentPattern(a,s,r),{patterns:s,issues:r}}static parse(e){return new vr().parse(e)}normalizeLineEndings(e){return e.replace(/\r\n/g,`
6
6
  `).replace(/\r/g,`
7
- `)}stripInlineComment(e){const t=e.indexOf(";");return t<0?e:e.slice(0,t)}parseHeader(e){const t=e.indexOf(",");if(t<0){const r=e.trim();return r?{name:r,description:""}:null}const i=e.slice(0,t).trim(),s=e.slice(t+1).trim();return i?{name:i,description:s}:null}parseNumber(e){const t=Number(e.trim());return Number.isFinite(t)?t:null}parseLineDescriptor(e,t){const i=e.split(",").map(u=>u.trim()).filter(u=>u.length>0);if(i.length<5)return null;const s=this.parseNumber(i[0]),r=this.parseNumber(i[1]),a=this.parseNumber(i[2]),o=this.parseNumber(i[3]),h=this.parseNumber(i[4]);if(s==null||r==null||a==null||o==null||h==null)return null;const c=i.slice(5),d=[];for(const u of c){const p=this.parseNumber(u);if(p==null)return null;d.push(p)}return{angle:s,originX:r,originY:a,deltaX:o,deltaY:h,dashes:d,sourceLine:t}}flushCurrentPattern(e,t,i){e&&(e.pattern.lines.length===0&&i.push({line:e.headerLine,message:`Pattern "${e.pattern.name}" has no line descriptor.`,source:""}),t.push(e.pattern))}}const F=class F{static nextGradientId(e){return F.gradientIdCounter+=1,`acdb-pat-gradient-${e.toLowerCase()}-${F.gradientIdCounter}`}static packedRgbToCss(e){return`#${(e&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(e,t){return typeof e=="number"?F.packedRgbToCss(e):e??t}static applyShadeTint(e,t){const i=k.clamp(t,0,1),s=i<.5?0:16777215,r=i<.5?1-i*2:i*2-1,a=e>>16&255,o=e>>8&255,h=e&255,c=s>>16&255,d=s>>8&255,u=s&255;return Math.round(a+(c-a)*r)*65536+Math.round(o+(d-o)*r)*256+Math.round(h+(u-h)*r)}static resolveGradientColors(e){const t="#2563eb",i="#f8fafc",s=F.gradientColorToCss(e.startColor,t);if(e.oneColorMode&&e.endColor==null){if(typeof e.startColor=="number"){const r=F.applyShadeTint(e.startColor,e.shadeTintValue??.5);return{start:s,end:F.packedRgbToCss(r)}}return{start:s,end:(e.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:s,end:F.gradientColorToCss(e.endColor,i)}}static renderGradientStops(e){return e.map(t=>`<stop offset="${(k.clamp(t.offset,0,1)*100).toFixed(2)}%" stop-color="${t.color}" />`).join("")}static getGradientVector(e){return{x:Math.cos(e),y:-Math.sin(e)}}static isSolidPattern(e){return e.name.trim().toUpperCase()===ti}static renderBackground(e,t,i){return`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" fill="${i}" />`}static estimateUnitScale(e){const t=[];for(const r of e.lines){t.push(Math.abs(r.deltaX),Math.abs(r.deltaY));for(const a of r.dashes)t.push(Math.abs(a))}const i=t.filter(r=>r>F.EPSILON);if(i.length===0)return 1;const s=i.sort((r,a)=>r-a);return s[Math.floor(s.length/2)]||1}static segmentToSvgPath(e){return`M ${e.x1.toFixed(2)} ${(-e.y1).toFixed(2)} L ${e.x2.toFixed(2)} ${(-e.y2).toFixed(2)}`}static buildDashSegments(e,t,i,s,r,a,o){const h=e.dashes;if(h.length===0)return[{x1:s+a*t,y1:r+o*t,x2:s+a*i,y2:r+o*i}];const c=h.reduce((g,m)=>g+Math.abs(m),0);if(c<=F.EPSILON)return[{x1:s+a*t,y1:r+o*t,x2:s+a*i,y2:r+o*i}];const d=[],u=Math.ceil((i-t)/c)+2;let p=t-c;for(let g=0;g<u;g++){let m=p;for(const y of h){const _=Math.abs(y),f=m+_;if(y>0||y===0){const S=k.clamp(m,t,i),L=k.clamp(f,t,i);L>S?d.push({x1:s+a*S,y1:r+o*S,x2:s+a*L,y2:r+o*L}):y===0&&S>=t&&S<=i&&d.push({x1:s+a*(S-.35),y1:r+o*(S-.35),x2:s+a*(S+.35),y2:r+o*(S+.35)})}m=f}p+=c}return d}static renderFamily(e,t){const i=k.degToRad(e.angle),s=Math.cos(i),r=Math.sin(i),a=-r,o=s,h=s*e.deltaX+a*e.deltaY,c=r*e.deltaX+o*e.deltaY,d=Math.hypot(h,c),u=d<=F.EPSILON?1:Math.max(1,Math.ceil(t*2/d)+1),p=Math.floor(u/2),g=-t*1.5,m=t*1.5,y=[];for(let _=-p;_<=p;_++){const f=e.originX+h*_,S=e.originY+c*_,L=F.buildDashSegments(e,g,m,f,S,s,r);for(const M of L)y.push(F.segmentToSvgPath(M))}return`<path d="${y.join(" ")}" fill="none" />`}static renderLinearGradientDef(e,t,i,s,r){const a=F.getGradientVector(t),o=k.clamp(i,-1,1)*s*.5,h=a.x*o,c=a.y*o;return[`<linearGradient id="${e}" gradientUnits="userSpaceOnUse"`,` x1="${(-a.x*s+h).toFixed(2)}"`,` y1="${(-a.y*s+c).toFixed(2)}"`,` x2="${(a.x*s+h).toFixed(2)}"`,` y2="${(a.y*s+c).toFixed(2)}">`,F.renderGradientStops(r),"</linearGradient>"].join("")}static renderRadialGradientDef(e,t,i,s,r){return[`<radialGradient id="${e}" gradientUnits="userSpaceOnUse"`,` cx="${t.toFixed(2)}" cy="${i.toFixed(2)}" r="${s.toFixed(2)}"`,` fx="${t.toFixed(2)}" fy="${i.toFixed(2)}">`,F.renderGradientStops(r),"</radialGradient>"].join("")}static renderGradientDef(e,t,i,s,r,a,o){const h=t.toUpperCase(),c=h.startsWith("INV"),d=h.replace(/^INV/,""),u=c?i.end:i.start,p=c?i.start:i.end,g=Math.hypot(a,o)/2,m=F.getGradientVector(s),y=k.clamp(r,-1,1),_=m.x*y*a*.25,f=m.y*y*o*.25;switch(d){case"CYLINDER":{const S=k.clamp(.5+y*.45,.05,.95);return F.renderLinearGradientDef(e,s,0,g,[{offset:0,color:u},{offset:S,color:p},{offset:1,color:u}])}case"SPHERICAL":return F.renderRadialGradientDef(e,_,f,g,[{offset:0,color:p},{offset:1,color:u}]);case"HEMISPHERICAL":return F.renderRadialGradientDef(e,_+m.x*a*.18,f+m.y*o*.18,g*.92,[{offset:0,color:p},{offset:.72,color:u},{offset:1,color:u}]);case"CURVED":return F.renderRadialGradientDef(e,-m.x*a*.95+_,-m.y*o*.95+f,g*1.65,[{offset:0,color:u},{offset:.55,color:u},{offset:1,color:p}]);case"LINEAR":default:return F.renderLinearGradientDef(e,s,r,g,[{offset:0,color:u},{offset:1,color:p}])}}renderPattern(e,t={}){const i=t.width??260,s=t.height??160,r=t.stroke??"#1f2937",a=t.strokeWidth??1.3,o=t.background??"#ffffff",h=`${-i/2} ${-s/2} ${i} ${s}`;if(F.isSolidPattern(e))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${s}">`,F.renderBackground(i,s,o),`<rect x="${-i/2}" y="${-s/2}" width="${i}" height="${s}" fill="${r}" />`,"</svg>"].join("");const c=F.estimateUnitScale(e),u=Math.min(i,s)*.18/Math.max(c,F.EPSILON),p={...e,lines:e.lines.map(y=>({...y,originX:y.originX*u,originY:y.originY*u,deltaX:y.deltaX*u,deltaY:y.deltaY*u,dashes:y.dashes.map(_=>_*u)}))},g=Math.hypot(i,s)*.75,m=p.lines.map(y=>F.renderFamily(y,g)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${s}">`,F.renderBackground(i,s,o),`<g stroke="${r}" stroke-width="${a.toFixed(2)}" stroke-linecap="round">`,m,"</g>","</svg>"].join("")}renderGradient(e,t={}){const i=t.width??260,s=t.height??160,r=t.background??"#ffffff",a=t.angle??0,o=t.shift??0,h=`${-i/2} ${-s/2} ${i} ${s}`,c=F.nextGradientId(e),d=F.resolveGradientColors(t),u=F.renderGradientDef(c,e,d,a,o,i,s);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${s}">`,F.renderBackground(i,s,r),"<defs>",u,"</defs>",`<rect x="${-i/2}" y="${-s/2}" width="${i}" height="${s}" fill="url(#${c})" />`,"</svg>"].join("")}};F.EPSILON=1e-9,F.gradientIdCounter=0;let Qs=F;class _t extends De{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this.ownerId=e.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,i=>this.hasId(i));const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),i=this._recordsByName.get(t);return i?(this._recordsById.delete(i.objectId),this._recordsByName.delete(t),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(this.normalizeName(t.name)),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new ln(this._recordsByName)}normalizeName(e){return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTable"),e.writeInt16(70,this.numEntries),this}}class Pl extends _t{constructor(e){super(e)}get modelSpace(){let e=this.getAt(ie.MODEL_SPACE_NAME);return e||(e=new ie,e.name=ie.MODEL_SPACE_NAME,this.add(e)),e}getEntityById(e){for(const t of this.database.tables.blockTable.newIterator()){const i=t.getIdAt(e);if(i)return i}}removeEntity(e){let t=!1;for(const i of this.database.tables.blockTable.newIterator())if(i.removeEntity(e)){t=!0;break}return t}normalizeName(e){let t=e;if(ie.isModelSapceName(e))t=ie.MODEL_SPACE_NAME;else if(ie.isPaperSapceName(e)){const i=ie.PAPER_SPACE_NAME_PREFIX,s=e.substring(i.length);t=i+s}return t}}class El extends _t{constructor(e){super(e)}}var Tl=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(Tl||{}),Ml=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(Ml||{}),kl=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(kl||{}),Cl=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(Cl||{}),vl=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(vl||{});const ms=class ms extends vt{constructor(e,t){e=e||{},tn(e,ms.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}dxfOutFields(e){super.dxfOutFields(e);const t=this.database.tables.textStyleTable.getAt(this.dimtxsty),i=this.database.tables.blockTable.getAt(this.dimldrblk),s=this.database.tables.blockTable.getAt(this.dimblk),r=this.database.tables.blockTable.getAt(this.dimblk1),a=this.database.tables.blockTable.getAt(this.dimblk2);return e.writeSubclassMarker("AcDbDimStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),e.writeString(3,this.dimpost),e.writeString(4,this.dimapost),e.writeDouble(40,this.dimscale),e.writeDouble(41,this.dimasz),e.writeDouble(42,this.dimexo),e.writeDouble(43,this.dimdli),e.writeDouble(44,this.dimexe),e.writeDouble(140,this.dimtxt),e.writeDouble(147,this.dimgap),e.writeInt16(170,this.dimalt),e.writeInt16(171,this.dimtol),e.writeInt16(172,this.dimlim),e.writeInt16(173,this.dimtih),e.writeInt16(174,this.dimtoh),e.writeObjectId(340,t==null?void 0:t.objectId),e.writeObjectId(341,i==null?void 0:i.objectId),e.writeObjectId(342,s==null?void 0:s.objectId),e.writeObjectId(343,r==null?void 0:r.objectId),e.writeObjectId(344,a==null?void 0:a.objectId),e.writeInt16(371,this.dimlwd),e.writeInt16(372,this.dimlwe),this}};ms.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:Q,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let si=ms;class Nl extends _t{constructor(e){super(e)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class _s extends vt{constructor(e,t){e=e||{},tn(e,{color:new X,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new J,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(i=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:i.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e.clone())}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineStyle(){var t;const e=(t=this.database)==null?void 0:t.tables.linetypeTable.getAt(this.linetype);if(e)return{type:"UserSpecified",...e.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayerTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeCmColor(this.color),e.writeString(6,this.linetype),e.writeInt16(290,this.isPlottable?1:0),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency),this.description&&e.writeString(4,this.description),this}}class Ol extends _t{constructor(e){super(e)}}class Et extends vt{constructor(e){super(),this.name=e.name,this._linetype=e}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(e){if(e<0||e>=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[e].elementLength}toPreviewSvgString(e){const t=Math.max((e==null?void 0:e.width)??220,1),i=Math.max((e==null?void 0:e.height)??36,1),s=Math.min(Math.max((e==null?void 0:e.padding)??8,0),Math.floor(t/2)),r=Math.max((e==null?void 0:e.strokeWidth)??2,.5),a=this.escapeSvgAttribute((e==null?void 0:e.stroke)??"currentColor"),o=Math.max((e==null?void 0:e.repeats)??4,1),h=i/2,c=s,d=Math.max(t-s,c+1),u=d-c,p=this._linetype.pattern??[];if(p.length===0||this.patternLength<=0||!p.some(L=>L.elementLength!==0))return this.buildSvgString({width:t,height:i,stroke:a,strokeWidth:r,lineSegments:[[c,d]],dots:[],y:h});const g=[],m=[],y=u/(this.patternLength*o),_=.5,f=Math.max(r*2,2);let S=c;for(;S<d;)for(const L of p){if(S>=d)break;const M=L.elementLength;if(M===0){m.push(S),S=Math.min(S+f,d);continue}const I=Math.max(Math.abs(M)*y,_),W=Math.min(S+I,d);M>0&&W>S&&g.push([S,W]),S=W}return this.buildSvgString({width:t,height:i,stroke:a,strokeWidth:r,lineSegments:g,dots:m,y:h})}buildSvgString(e){const{width:t,height:i,stroke:s,strokeWidth:r,lineSegments:a,dots:o,y:h}=e,c=a.map(([u,p])=>`<line x1="${u.toFixed(2)}" y1="${h.toFixed(2)}" x2="${p.toFixed(2)}" y2="${h.toFixed(2)}" stroke="${s}" stroke-width="${r.toFixed(2)}" stroke-linecap="round" />`).join(""),d=o.map(u=>`<circle cx="${u.toFixed(2)}" cy="${h.toFixed(2)}" r="${(r/2).toFixed(2)}" fill="${s}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${i}" viewBox="0 0 ${t} ${i}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${c}${d}</svg>`}escapeSvgAttribute(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;")}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLinetypeTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.linetype.standardFlag),e.writeString(3,this.comments),e.writeInt16(72,65),e.writeInt16(73,this.numDashes),e.writeDouble(40,this.patternLength);for(const t of this.linetype.pattern??[])e.writeDouble(49,t.elementLength),e.writeInt16(74,t.elementTypeFlag);return this}}class Yl extends _t{constructor(e){super(e)}get fonts(){const e=new Set,t=s=>{if(s){const r=s.lastIndexOf(".");if(r>=0){const a=s.substring(0,r).toLowerCase();e.add(a)}else e.add(s.toLowerCase())}},i=this.newIterator();for(const s of i)t(s.fileName),t(s.bigFontFileName);return Array.from(e)}}class fs extends vt{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const i=t.lastIndexOf(".");return i===-1?t:t.substring(0,i)}return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTextStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.textStyle.standardFlag),e.writeDouble(40,this.textSize),e.writeDouble(41,this.xScale),e.writeAngle(50,this.obliquingAngle),e.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),e.writeDouble(42,this.priorSize),e.writeString(3,this.fileName),e.writeString(4,this.bigFontFileName),this}}class Xl extends _t{constructor(e){super(e)}}class Rl extends _t{constructor(e){super(e)}}const sd=()=>({center:new v,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:wr.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:br.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Lr.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class Cr extends vt{constructor(){super(),this._gsView=sd(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(e){this._gsView.viewDirectionFromTarget.copy(e)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(e){this._gsView.viewTarget.copy(e)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(e){this._gsView.viewHeight=e}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(e){this._gsView.viewTwistAngle=e}get lensLength(){return this._gsView.lensLength}set lensLength(e){this._gsView.lensLength=e}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(e){this._gsView.frontClippingPlane=e}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(e){this._gsView.backClippingPlane=e}get renderMode(){return this._gsView.renderMode}set renderMode(e){this._gsView.renderMode=e}get viewMode(){return this._gsView.viewMode}set viewMode(e){this._gsView.viewMode=e}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(e){this._gsView.ucsIconSetting=e}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(e){this._gsView.ucsOrigin.copy(e)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(e){this._gsView.ucsXAxis.copy(e)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(e){this._gsView.ucsYAxis.copy(e)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(e){this._gsView.orthographicType=e}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(e){this._gsView.shadePlotSetting=e}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(e){this._gsView.shadePlotObjectId=e}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(e){this._gsView.visualStyleObjectId=e}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(e){this._gsView.isDefaultLightingOn=e}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(e){this._gsView.defaultLightingType=e}get brightness(){return this._gsView.brightness}set brightness(e){this._gsView.brightness=e}get contrast(){return this._gsView.contrast}set contrast(e){this._gsView.contrast=e}get ambientColor(){return this._gsView.ambientColor}set ambientColor(e){this._gsView.ambientColor=e}}class vr extends Cr{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new v(0,0),this._upperRightCorner=new v(1,1),this._snapBase=new v(0,0),this._snapAngle=0,this._snapSpacing=new v(0,0),this._standardFlag=0,this._gridSpacing=new v,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this.centerPoint}set center(e){this.centerPoint=e}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewportTableRecord"),e.writeString(2,this.name),e.writeDouble(45,this.gsView.viewHeight),e.writePoint2d(10,this.lowerLeftCorner),e.writePoint2d(11,this.upperRightCorner),e.writePoint2d(12,this.center),e.writePoint2d(13,this.snapBase),e.writePoint2d(14,this.snapIncrements),e.writePoint2d(15,this.gridIncrements),e.writeInt16(70,this.standardFlag),e.writeInt16(71,this.circleSides),e.writeDouble(42,this.gsView.lensLength),e.writePoint3d(16,this.gsView.viewDirectionFromTarget),e.writePoint3d(17,this.gsView.viewTarget),e.writeAngle(50,this.snapAngle),e.writeAngle(51,this.gsView.viewTwistAngle),e.writeInt16(61,this.gridMajor),e.writeInt16(281,this.backgroundObjectId?1:0),e.writeObjectId(332,this.backgroundObjectId),this}}class Bl extends _t{constructor(e){super(e)}}class Js extends vt{constructor(e){super(),this.name=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRegAppTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),this}}class rd extends De{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new te,dictObjectErased:new te,entityAppended:new te,entityModified:new te,entityErased:new te,layerAppended:new te,layerModified:new te,layerErased:new te,openProgress:new te},this._version=new ve("AC1014"),this._angBase=0,this._angDir=0,this._aunits=ar.DecimalDegrees,this._celtscale=1,this._cecolor=new X,this._celtype=pe,this._celweight=ii.ByLayer,this._cetransparency=new J,this._clayer="0",this._cmlstyle=gt,this._cmlscale=1,this._cmleaderstyle=pt,this._hpbackgroundcolor=new X(P.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new J,this._textstyle=Q,this._extents=new Y,this._insunits=Mr.Millimeters,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._maxHandle=0,this._tables={appIdTable:new Bl(this),blockTable:new Pl(this),dimStyleTable:new El(this),linetypeTable:new Ol(this),textStyleTable:new Yl(this),viewTable:new Xl(this),layerTable:new Nl(this),viewportTable:new Rl(this)},this._objects={dictionary:new Jt(this),imageDefinition:new Jt(this),layout:new fl(this),mleaderStyle:new Jt(this),mlineStyle:new Jt(this),xrecord:new Jt(this)}}get tables(){return this._tables}get objects(){return this._objects}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(e){const t=parseInt(e,16);!isNaN(t)&&t>this._maxHandle&&(this._maxHandle=t)}commitObjectHandle(e,t){const i=e.getAttrWithoutException("objectId");!i||e.isTemp||t&&t(i)?e.objectId=this.generateHandle():this.updateMaxHandle(i)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this.updateSysVar(A.AUNITS,this._aunits,e??0,t=>{this._aunits=t})}get version(){return this._version}set version(e){this.updateSysVar(A.ACADVER,this._version,new ve(e),t=>{this._version=t})}get insunits(){return this._insunits}set insunits(e){this.updateSysVar(A.INSUNITS,this._insunits,e??4,t=>{this._insunits=t})}get ltscale(){return this._ltscale}set ltscale(e){this.updateSysVar(A.LTSCALE,this._ltscale,e??1,t=>{this._ltscale=t})}get lwdisplay(){return this._lwdisplay}set lwdisplay(e){this.updateSysVar(A.LWDISPLAY,this._lwdisplay,e??!1,t=>{this._lwdisplay=t})}get cecolor(){return this._cecolor}set cecolor(e){this.updateSysVar(A.CECOLOR,this._cecolor,e||0,t=>{this._cecolor=t.clone()})}get celtscale(){return this._celtscale}set celtscale(e){this.updateSysVar(A.CELTSCALE,this._celtscale,e??1,t=>{this._celtscale=t})}get celtype(){return this._celtype}set celtype(e){const t=this.normalizeLinetypeName(e??pe);this.updateSysVar(A.CELTYPE,this._celtype,t,i=>{this._celtype=i})}get celweight(){return this._celweight}set celweight(e){this.updateSysVar(A.CELWEIGHT,this._celweight,e??ii.ByLayer,t=>{this._celweight=t})}get cetransparency(){return this._cetransparency}set cetransparency(e){this.updateSysVar(A.CETRANSPARENCY,this._cetransparency,e??new J,t=>{this._cetransparency=t.clone()})}get clayer(){return this._clayer}set clayer(e){this.updateSysVar(A.CLAYER,this._clayer,e??"0",t=>{this._clayer=t})}get cmlstyle(){return this._cmlstyle}set cmlstyle(e){this.updateSysVar(A.CMLSTYLE,this._cmlstyle,e??gt,t=>{this._cmlstyle=t})}get cmlscale(){return this._cmlscale}set cmlscale(e){this.updateSysVar(A.CMLSCALE,this._cmlscale,e??1,t=>{this._cmlscale=t})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(e){this.updateSysVar(A.CMLEADERSTYLE,this._cmleaderstyle,e??pt,t=>{this._cmleaderstyle=t})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(e){this.updateSysVar(A.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,e??new X(P.None),t=>{this._hpbackgroundcolor=t.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(e){this.updateSysVar(A.HPCOLOR,this._hpcolor,e??this._cecolor,t=>{this._hpcolor=t.clone()})}get hplayer(){return this._hplayer}set hplayer(e){this.updateSysVar(A.HPLAYER,this._hplayer,e??".",t=>{this._hplayer=t})}get hptransparency(){return this._hptransparency}set hptransparency(e){this.updateSysVar(A.HPTRANSPARENCY,this._hptransparency,e??new J,t=>{this._hptransparency=t.clone()})}get textstyle(){return this._textstyle}set textstyle(e){this.updateSysVar(A.TEXTSTYLE,this._textstyle,e??Q,t=>{this._textstyle=t})}get angBase(){return this._angBase}set angBase(e){this.updateSysVar(A.ANGBASE,this._angBase,e??0,t=>{this._angBase=t})}get angDir(){return this._angDir}set angDir(e){this.updateSysVar(A.ANGDIR,this._angDir,e??0,t=>{this._angDir=t})}get extmax(){return this._extents.max}set extmax(e){if(e){const t=this._extents.max.clone();this._extents.expandByPoint(e),this._extents.max.equals(t)||this.triggerSysVarChangedEvent(A.EXTMAX,t,this._extents.max)}}get extmin(){return this._extents.min}set extmin(e){if(e){const t=this._extents.min.clone();this._extents.expandByPoint(e),this._extents.min.equals(t)||this.triggerSysVarChangedEvent(A.EXTMIN,t,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(e){this.updateSysVar(A.PDMODE,this._pdmode,e??0,t=>{this._pdmode=t})}get pdsize(){return this._pdsize}set pdsize(e){this.updateSysVar(A.PDSIZE,this._pdsize,e??0,t=>{this._pdsize=t})}get osmode(){return this._osmode}set osmode(e){this.updateSysVar(A.OSMODE,this._osmode,e??0,t=>{this._osmode=t})}async read(e,t,i=Ri.DXF){const s=He.instance.get(i);if(s==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),await s.read(e,this,t&&t.minimumChunkSize||10,async(r,a,o,h)=>{if(this.events.openProgress.dispatch({database:this,percentage:r,stage:"CONVERSION",subStage:a,subStageStatus:o,data:h}),t&&t.fontLoader&&a=="FONT"&&o=="END"){const c=h||this.tables.textStyleTable.fonts;await t.fontLoader.load(c)}},t==null?void 0:t.timeout,t==null?void 0:t.sysVars),this.ensureDatabaseDefaults()}async openUri(e,t){var g;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const i=await fetch(e);if(!i.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${i.status}'!`);const s=i.headers.get("content-length"),r=s?parseInt(s,10):null;let a=0;const o=(g=i.body)==null?void 0:g.getReader();if(!o)throw new Error("Failed to get response reader");const h=[];for(;;){const{done:m,value:y}=await o.read();if(m)break;if(h.push(y),a+=y.length,r!==null){const _=Math.round(a/r*100);this.events.openProgress.dispatch({database:this,percentage:_,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(a);let d=0;for(const m of h)c.set(m,d),d+=m.length;const p=this.getFileNameFromUri(e).toLowerCase().split(".").pop();p==="dwg"?await this.read(c.buffer,t,Ri.DWG):p==="dxf"?await this.read(c.buffer,t,Ri.DXF):await this.read(c.buffer,t,p),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(e,t=16,i=this.version.name,s=!1){this.ensureDatabaseDefaults();const r=i instanceof ve?i:new ve(i),a=new io({database:this,precision:t,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 rc(this).read(null,this,500,async(t,i,s,r)=>{this.events.openProgress.dispatch({database:this,percentage:t,stage:"CONVERSION",subStage:i,subStageStatus:s,data:r})})}createDefaultData(e={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const t=new Sl(this);e.layer&&t.createDefaultLayer(),e.lineType&&t.createDefaultLineType(),e.textStyle&&t.createDefaultTextStyle(),e.dimStyle&&t.createDefaultDimStyle(),e.layout&&t.createDefaultLayout()}ensureEntityStyleDefaults(e){var t;if(e.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||gt);return}if(e.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||pt);return}if(e.dxfTypeName==="HATCH"){const i=e;(t=i.applyPatternDefaultsFromSysVars)==null||t.call(i,this)}}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const t=new X;t.colorIndex=7,this.tables.layerTable.add(new _s({name:"0",standardFlags:0,linetype:It,lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}if(this.tables.linetypeTable.has(At)||this.tables.linetypeTable.add(new Et({name:At,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(pe)||this.tables.linetypeTable.add(new Et({name:pe,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(It)||this.tables.linetypeTable.add(new Et({name:It,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.tables.textStyleTable.has(Q)||this.tables.textStyleTable.add(new fs({name:Q,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"})),this.tables.dimStyleTable.has(Q)||this.tables.dimStyleTable.add(new si({name:Q,dimtxsty:Q})),!this.tables.viewportTable.has("*Active")){const t=new vr;t.name="*Active",this.tables.viewportTable.add(t)}this.ensureMLineStyle(this._cmlstyle||gt),this.ensureMLeaderStyle(this._cmleaderstyle||pt);const e=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const t=new on;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=e.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.objects.layout.setAt(t.layoutName,t),e.layoutId=t.objectId}this.tables.appIdTable.has(Ds)||this.tables.appIdTable.add(new Js(Ds)),this.tables.appIdTable.has(Fs)||this.tables.appIdTable.add(new Js(Fs))}ensureMLineStyle(e){const t=this.objects.mlineStyle,i=e.trim();if(!i||t.getAt(i))return;for(const[r,a]of t.entries())if(r.toUpperCase()===i.toUpperCase()||a.styleName.toUpperCase()===i.toUpperCase())return;const s=new Ir;s.styleName=i,s.elements=[{offset:.5,color:new X().setByLayer(),lineType:pe},{offset:-.5,color:new X().setByLayer(),lineType:pe}],t.setAt(i,s)}ensureMLeaderStyle(e){const t=this.objects.mleaderStyle,i=e.trim();if(!i||t.getAt(i))return;for(const[o]of t.entries())if(o.toUpperCase()===i.toUpperCase())return;const s=new Ar;s.unknown1=2,s.maxLeaderSegmentsPoints=2,s.leaderLineColor=new X().setByBlock(),s.textColor=new X().setByBlock(),s.blockColor=new X().setByBlock(),s.alignSpace=4,s.breakSize=3.75,s.enableBlockRotation=!0,s.unknown2=!1;const r=this.tables.linetypeTable.getAt(At);s.leaderLineTypeId=r==null?void 0:r.objectId;const a=this.tables.textStyleTable.getAt(Q);s.textStyleId=a==null?void 0:a.objectId,t.setAt(i,s)}writeDxfHeaderSection(e){var t;e.startSection("HEADER"),e.writeString(9,"$ACADVER"),e.writeString(1,((t=e.version)==null?void 0:t.name)??this.version.name),e.writeString(9,"$HANDSEED"),e.writeString(5,e.nextHandle.toString(16).toUpperCase()),e.version!=null&&e.version.value>=27&&(e.writeString(9,"$DWGCODEPAGE"),e.writeString(3,"UTF-8")),e.writeString(9,"$INSUNITS"),e.writeInt16(70,this.insunits),e.writeString(9,"$LTSCALE"),e.writeDouble(40,this.ltscale),e.writeString(9,"$LWDISPLAY"),e.writeInt16(70,this.lwdisplay?1:0),e.writeString(9,"$CLAYER"),e.writeString(8,this.clayer),e.writeString(9,"$CELTYPE"),e.writeString(6,this.celtype),this.cetransparency.isInvalid||(e.writeString(9,"$CETRANSPARENCY"),e.writeTransparency(this.cetransparency)),e.writeString(9,"$CMLSTYLE"),e.writeString(2,this.cmlstyle),e.writeString(9,"$CMLSCALE"),e.writeDouble(40,this.cmlscale),e.writeString(9,"$CMLEADERSTYLE"),e.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==P.None&&(e.writeString(9,"$HPCOLOR"),e.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==P.None&&(e.writeString(9,"$HPBACKGROUNDCOLOR"),e.writeCmColor(this.hpbackgroundcolor,2)),e.writeString(9,"$HPLAYER"),e.writeString(8,this.hplayer),this.hptransparency.isInvalid||(e.writeString(9,"$HPTRANSPARENCY"),e.writeTransparency(this.hptransparency)),e.writeString(9,"$TEXTSTYLE"),e.writeString(7,this.textstyle),e.writeString(9,"$ANGBASE"),e.writeAngle(50,this.angBase),e.writeString(9,"$ANGDIR"),e.writeInt16(70,this.angDir),e.writeString(9,"$EXTMIN"),e.writePoint3d(10,this.extmin),e.writeString(9,"$EXTMAX"),e.writePoint3d(10,this.extmax),e.writeString(9,"$PDMODE"),e.writeInt32(70,this.pdmode),e.writeString(9,"$PDSIZE"),e.writeDouble(40,this.pdsize),e.writeString(9,"$OSMODE"),e.writeInt32(70,this.osmode),e.endSection()}writeDxfTablesSection(e,t){e.startSection("TABLES"),this.writeDxfTable(e,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(e,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(e,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(e,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(e,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(),"STYLE"),this.writeDxfTable(e,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(e,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),t.value>=19&&this.writeDxfTable(e,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),e.endSection()}writeDxfBlocksSection(e){e.startSection("BLOCKS");for(const t of this.tables.blockTable.newIterator()){if(t.dxfOutBlockBegin(e),!t.isModelSapce&&!t.isPaperSapce)for(const i of t.newIterator())this.writeDxfEntity(e,i);t.dxfOutBlockEnd(e)}e.endSection()}writeDxfEntitiesSection(e){e.startSection("ENTITIES");for(const t of this.tables.blockTable.newIterator())if(!(!t.isModelSapce&&!t.isPaperSapce))for(const i of t.newIterator())this.writeDxfEntity(e,i);e.endSection()}writeDxfObjectsSection(e){e.startSection("OBJECTS");const t=this.objects.dictionary;t.ownerId="0";const i=a=>{e.writeStart("DICTIONARY"),a.dxfOut(e)},s=(a,o)=>{t.getAt(a)!==o&&t.setAt(a,o)},r=a=>{t.getAt(a)&&t.remove(a)};s("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?s("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):r("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?s("ACAD_MLINESTYLE",this.objects.mlineStyle):r("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?s("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):r("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?s("MLIGHT_XRECORD",this.objects.xrecord):r("MLIGHT_XRECORD"),i(t),i(this.objects.layout),this.objects.mleaderStyle.numEntries>0&&i(this.objects.mleaderStyle),this.objects.mlineStyle.numEntries>0&&i(this.objects.mlineStyle),this.objects.imageDefinition.numEntries>0&&i(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&i(this.objects.xrecord);for(const[a,o]of this.objects.layout.entries())e.writeStart("LAYOUT"),o.dxfOut(e);for(const[a,o]of this.objects.imageDefinition.entries())e.writeStart("IMAGEDEF"),o.dxfOut(e);for(const[a,o]of this.objects.mleaderStyle.entries())e.writeStart("MLEADERSTYLE"),o.dxfOut(e);for(const[a,o]of this.objects.mlineStyle.entries())e.writeStart("MLINESTYLE"),o.dxfOut(e);for(const[a,o]of this.objects.xrecord.entries())e.writeStart("XRECORD"),o.dxfOut(e);e.endSection()}writeDxfTable(e,t,i,s,r){const a=[...s];e.startTable(t),i.dxfOut(e);for(const o of a){if(r==="BLOCK_RECORD"&&o instanceof ie){o.dxfOutBlockRecord(e);continue}e.writeStart(r),o.dxfOut(e)}e.endTable()}writeDxfEntity(e,t){e.writeStart(t.dxfTypeName),t.dxfOut(e)}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._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(e,t,i,s){this.hasSysVarValueChanged(t,i)&&(s(i),this.triggerSysVarChangedEvent(e,t,i))}hasSysVarValueChanged(e,t){return e instanceof X&&t instanceof X||e instanceof J&&t instanceof J?!e.equals(t):e instanceof ve&&t instanceof ve?e.value!==t.value:!Object.is(e,t)}normalizeLinetypeName(e){const t=e.trim();return t.toUpperCase()==="BYLAYER"?pe:t.toUpperCase()==="BYBLOCK"?At:t}triggerSysVarChangedEvent(e,t,i){const s=Ne.instance(),r=e.toLowerCase();s.getDescriptor(r)!=null&&s.events.sysVarChanged.dispatch({database:this,name:r,oldVal:t,newVal:i})}getFileNameFromUri(e){try{const i=new URL(e).pathname.split("/");return i[i.length-1]||""}catch{return""}}}const Fl="Load Database",Fa=3e4,ad=12e4,od=1024*1024;class we extends Qa{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=ir.getInstance().getEntry(Fl),i=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const s=await this.data.task(e);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",s?s.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),t&&(t.data[this.name]=Date.now()-i),s}}class Nr{constructor(e={}){this.config=e}async read(e,t,i,s,r,a){const o={name:Fl,data:{total:0},format(){let u="";return Object.keys(this.data).forEach(p=>{p!=="total"&&(u+=`- ${p}: ${this.data[p]} ms
8
- `)}),u+=`- total: ${this.data.total} ms`,u}};ir.getInstance().collect(o),this.progress=s;const h={value:0},c=new Ja;c.setCompleteCallback(()=>this.onFinished()),c.setErrorCallback(u=>this.onError(u)),c.addTask(new we({stage:"START",step:1,progress:h,task:async u=>u},s)),c.addTask(new we({stage:"PARSE",step:5,progress:h,task:async u=>await this.parse(u,r)},s)),c.addTask(new we({stage:"FONT",step:5,progress:h,task:async u=>{const p=this.getFonts(u.model);return{model:u.model,data:p}}},s)),c.addTask(new we({stage:"LTYPE",step:1,progress:h,task:async u=>(this.processLineTypes(u.model,t),u)},s)),c.addTask(new we({stage:"STYLE",step:1,progress:h,task:async u=>(this.processTextStyles(u.model,t),u)},s)),c.addTask(new we({stage:"DIMSTYLE",step:1,progress:h,task:async u=>(this.processDimStyles(u.model,t),u)},s)),c.addTask(new we({stage:"LAYER",step:1,progress:h,task:async u=>(this.processLayers(u.model,t),t.tables.layerTable.numEntries===0&&t.createDefaultData({layer:!0}),u)},s)),c.addTask(new we({stage:"VPORT",step:1,progress:h,task:async u=>(this.processViewports(u.model,t),u)},s)),c.addTask(new we({stage:"HEADER",step:1,progress:h,task:async u=>{if(this.processHeader(u.model,t),a){const p=Ne.instance();for(const[g,m]of Object.entries(a))p.setVar(g,m,t)}return u}},s)),c.addTask(new we({stage:"BLOCK_RECORD",step:5,progress:h,task:async u=>(this.processBlockTables(u.model,t),u)},s)),c.addTask(new we({stage:"OBJECT",step:5,progress:h,task:async u=>(this.processObjects(u.model,t),t.objects.layout.numEntries===0&&t.createDefaultData({layout:!0}),u)},s)),c.addTask(new we({stage:"BLOCK",step:5,progress:h,task:async u=>(await this.processBlocks(u.model,t),u)},s)),c.addTask(new we({stage:"ENTITY",step:100,progress:h,task:async u=>(await this.processEntities(u.model,t,i,h,s),u)},s)),c.addTask(new we({stage:"END",step:0,progress:h,task:async u=>u},s));const d=Date.now();await c.run(e),o.data.total=Date.now()-d}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}return e.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),ri.instance.clear())}getParserWorkerTimeout(e,t){const i=t??this.config.timeout;if(i!=null)return i;const s=Math.ceil(e.byteLength/od),r=Fa+s*1e3;return Math.min(ad,Math.max(Fa,r))}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,i,s,r){throw new Error("Not impelemented yet!")}}class ld extends Cr{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(e){this._standardFlags=e}get viewWidth(){return this._viewWidth}set viewWidth(e){this._viewWidth=e}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(e){this._ucsAssociated=e}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(e){this._cameraPlottable=e}get ucsElevation(){return this._ucsElevation}set ucsElevation(e){this._ucsElevation=e}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(e){this._ucsObjectId=e}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(e){this._ucsBaseObjectId=e}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(e){this._liveSectionObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeDouble(40,this.gsView.viewHeight),e.writePoint2d(10,this.centerPoint),e.writeDouble(41,this.viewWidth),e.writePoint3d(11,this.gsView.viewDirectionFromTarget),e.writePoint3d(12,this.gsView.viewTarget),e.writeDouble(42,this.gsView.lensLength),e.writeDouble(43,this.gsView.frontClippingPlane),e.writeDouble(44,this.gsView.backClippingPlane),e.writeAngle(50,this.gsView.viewTwistAngle),e.writeInt16(71,this.gsView.viewMode),e.writeInt16(281,this.gsView.renderMode),e.writeInt16(72,this.ucsAssociated?1:0),e.writeInt16(73,this.cameraPlottable?1:0),e.writeObjectId(332,this.backgroundObjectId),e.writeObjectId(334,this.liveSectionObjectId),e.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(e.writePoint3d(110,this.gsView.ucsOrigin),e.writePoint3d(111,this.gsView.ucsXAxis),e.writePoint3d(112,this.gsView.ucsYAxis),e.writeInt16(79,this.gsView.orthographicType),e.writeDouble(146,this.ucsElevation),e.writeObjectId(345,this.ucsObjectId),e.writeObjectId(346,this.ucsBaseObjectId)),this}}var re,yi,Z,ee,_i,Ye,Xt,Ke,me,Ze,Xe,Rt,Bt,Ft,Se,Qe,fi,xi,Dt,Vt,wi,bi,Li,Ae,Je,U,zt,Si,N,ye,Ai,_e,Ii,et,j,Pi,tt,Ht,Ts,Ms,Re,Ei,jt,Ie,it,nt,st,Ti,Mi,rt,Wt,Gt,ks,ki,Ut,at,$t,ae,ot,Pe,Cs,oe,vs,lt,Ee,qt,Ci,Kt,Te,ht,Me,ct,Ns,Zt,ke;(re={})[re.None=0]="None",re[re.Anonymous=1]="Anonymous",re[re.NonConstant=2]="NonConstant",re[re.Xref=4]="Xref",re[re.XrefOverlay=8]="XrefOverlay",re[re.ExternallyDependent=16]="ExternallyDependent",re[re.ResolvedOrDependent=32]="ResolvedOrDependent",re[re.ReferencedXref=64]="ReferencedXref";(yi={})[yi.BYBLOCK=0]="BYBLOCK",yi[yi.BYLAYER=256]="BYLAYER";(Z={})[Z.Rotated=0]="Rotated",Z[Z.Aligned=1]="Aligned",Z[Z.Angular=2]="Angular",Z[Z.Diameter=3]="Diameter",Z[Z.Radius=4]="Radius",Z[Z.Angular3Point=5]="Angular3Point",Z[Z.Ordinate=6]="Ordinate",Z[Z.ReferenceIsExclusive=32]="ReferenceIsExclusive",Z[Z.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Z[Z.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(ee={})[ee.TopLeft=1]="TopLeft",ee[ee.TopCenter=2]="TopCenter",ee[ee.TopRight=3]="TopRight",ee[ee.MiddleLeft=4]="MiddleLeft",ee[ee.MiddleCenter=5]="MiddleCenter",ee[ee.MiddleRight=6]="MiddleRight",ee[ee.BottomLeft=7]="BottomLeft",ee[ee.BottomCenter=8]="BottomCenter",ee[ee.BottomRight=9]="BottomRight";(_i={})[_i.AtLeast=1]="AtLeast",_i[_i.Exact=2]="Exact";var Da=((Ye={})[Ye.Center=0]="Center",Ye[Ye.Above=1]="Above",Ye[Ye.Outside=2]="Outside",Ye[Ye.JIS=3]="JIS",Ye[Ye.Below=4]="Below",Ye);(Xt={})[Xt.WithDimension=0]="WithDimension",Xt[Xt.AddLeader=1]="AddLeader",Xt[Xt.Independent=2]="Independent";(Ke={})[Ke.BothOutside=0]="BothOutside",Ke[Ke.ArrowFirst=1]="ArrowFirst",Ke[Ke.TextFirst=2]="TextFirst",Ke[Ke.Auto=3]="Auto";var li=((me={})[me.Feet=0]="Feet",me[me.None=1]="None",me[me.Inch=2]="Inch",me[me.FeetAndInch=3]="FeetAndInch",me[me.Leading=4]="Leading",me[me.Trailing=8]="Trailing",me[me.LeadingAndTrailing=12]="LeadingAndTrailing",me),hd=((Ze={})[Ze.None=0]="None",Ze[Ze.Leading=1]="Leading",Ze[Ze.Trailing=2]="Trailing",Ze[Ze.LeadingAndTrailing=3]="LeadingAndTrailing",Ze),cd=((Xe={})[Xe.Center=0]="Center",Xe[Xe.First=1]="First",Xe[Xe.Second=2]="Second",Xe[Xe.OverFirst=3]="OverFirst",Xe[Xe.OverSecond=4]="OverSecond",Xe),dd=((Rt={})[Rt.Bottom=0]="Bottom",Rt[Rt.Center=1]="Center",Rt[Rt.Top=2]="Top",Rt);(Bt={})[Bt.None=0]="None",Bt[Bt.UseDrawingBackground=1]="UseDrawingBackground",Bt[Bt.Custom=2]="Custom";(Ft={})[Ft.Horizontal=0]="Horizontal",Ft[Ft.Diagonal=1]="Diagonal",Ft[Ft.NotStacked=2]="NotStacked";(Se={})[Se.Scientific=1]="Scientific",Se[Se.Decimal=2]="Decimal",Se[Se.Engineering=3]="Engineering",Se[Se.Architectural=4]="Architectural",Se[Se.Fractional=5]="Fractional",Se[Se.WindowDesktop=6]="WindowDesktop";(Qe={})[Qe.Decimal=0]="Decimal",Qe[Qe.DegreesMinutesSecond=1]="DegreesMinutesSecond",Qe[Qe.Gradian=2]="Gradian",Qe[Qe.Radian=3]="Radian";var ud=((fi={})[fi.PatternFill=0]="PatternFill",fi[fi.SolidFill=1]="SolidFill",fi);(xi={})[xi.NonAssociative=0]="NonAssociative",xi[xi.Associative=1]="Associative";(Dt={})[Dt.Normal=0]="Normal",Dt[Dt.Outer=1]="Outer",Dt[Dt.Ignore=2]="Ignore";(Vt={})[Vt.UserDefined=0]="UserDefined",Vt[Vt.Predefined=1]="Predefined",Vt[Vt.Custom=2]="Custom";(wi={})[wi.NotAnnotated=0]="NotAnnotated",wi[wi.Annotated=1]="Annotated";(bi={})[bi.Solid=0]="Solid",bi[bi.Gradient=1]="Gradient";(Li={})[Li.TwoColor=0]="TwoColor",Li[Li.OneColor=1]="OneColor";var gd=((Ae={})[Ae.Default=0]="Default",Ae[Ae.External=1]="External",Ae[Ae.Polyline=2]="Polyline",Ae[Ae.Derived=4]="Derived",Ae[Ae.Textbox=8]="Textbox",Ae[Ae.Outermost=16]="Outermost",Ae),Sn=((Je={})[Je.Line=1]="Line",Je[Je.Circular=2]="Circular",Je[Je.Elliptic=3]="Elliptic",Je[Je.Spline=4]="Spline",Je),pd=((U={})[U.Off=0]="Off",U[U.Solid=1]="Solid",U[U.Dashed=2]="Dashed",U[U.Dotted=3]="Dotted",U[U.ShotDash=4]="ShotDash",U[U.MediumDash=5]="MediumDash",U[U.LongDash=6]="LongDash",U[U.DoubleShortDash=7]="DoubleShortDash",U[U.DoubleMediumDash=8]="DoubleMediumDash",U[U.DoubleLongDash=9]="DoubleLongDash",U[U.DoubleMediumLongDash=10]="DoubleMediumLongDash",U[U.SparseDot=11]="SparseDot",U);pd.Off;(zt={})[zt.Standard=-3]="Standard",zt[zt.ByLayer=-2]="ByLayer",zt[zt.ByBlock=-1]="ByBlock";(Si={})[Si.English=0]="English",Si[Si.Metric=1]="Metric";(N={})[N.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",N[N.FRONT_CLIPPING=2]="FRONT_CLIPPING",N[N.BACK_CLIPPING=4]="BACK_CLIPPING",N[N.UCS_FOLLOW=8]="UCS_FOLLOW",N[N.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",N[N.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",N[N.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",N[N.FAST_ZOOM=128]="FAST_ZOOM",N[N.SNAP_MODE=256]="SNAP_MODE",N[N.GRID_MODE=512]="GRID_MODE",N[N.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",N[N.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",N[N.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",N[N.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",N[N.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",N[N.UNUSED=32768]="UNUSED",N[N.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",N[N.VIEWPORT_OFF=131072]="VIEWPORT_OFF",N[N.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",N[N.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",N[N.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",N[N.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(ye={})[ye.OPTIMIZED_2D=0]="OPTIMIZED_2D",ye[ye.WIREFRAME=1]="WIREFRAME",ye[ye.HIDDEN_LINE=2]="HIDDEN_LINE",ye[ye.FLAT_SHADED=3]="FLAT_SHADED",ye[ye.GOURAUD_SHADED=4]="GOURAUD_SHADED",ye[ye.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",ye[ye.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(Ai={})[Ai.UCS_UNCHANGED=0]="UCS_UNCHANGED",Ai[Ai.HAS_OWN_UCS=1]="HAS_OWN_UCS";(_e={})[_e.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",_e[_e.TOP=1]="TOP",_e[_e.BOTTOM=2]="BOTTOM",_e[_e.FRONT=3]="FRONT",_e[_e.BACK=4]="BACK",_e[_e.LEFT=5]="LEFT",_e[_e.RIGHT=6]="RIGHT";(Ii={})[Ii.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ii[Ii.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(et={})[et.ByLayer=0]="ByLayer",et[et.ByBlock=1]="ByBlock",et[et.ByDictionaryDefault=2]="ByDictionaryDefault",et[et.ByObject=3]="ByObject";(j={})[j.NotAllowed=0]="NotAllowed",j[j.AllowErase=1]="AllowErase",j[j.AllowTransform=2]="AllowTransform",j[j.AllowChangeColor=4]="AllowChangeColor",j[j.AllowChangeLayer=8]="AllowChangeLayer",j[j.AllowChangeLinetype=16]="AllowChangeLinetype",j[j.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",j[j.AllowChangeVisibility=64]="AllowChangeVisibility",j[j.AllowClone=128]="AllowClone",j[j.AllowChangeLineweight=256]="AllowChangeLineweight",j[j.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",j[j.AllowAllExceptClone=895]="AllowAllExceptClone",j[j.AllowAll=1023]="AllowAll",j[j.DisableProxyWarning=1024]="DisableProxyWarning",j[j.R13FormatProxy=32768]="R13FormatProxy";function O(n,e,t){return n.code===e&&(t==null||n.value===t)}function Ct(n){let e={};n.rewind();let t=n.next(),i=t.code;if(e.x=t.value,(t=n.next()).code!==i+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=n.next()).code!==i+20?n.rewind():e.z=t.value,e}let hn=Symbol();function T(n,e){return(t,i,s)=>{let r=function(h,c=!1){return h.reduce((d,u)=>{u.pushContext&&d.push({});let p=d[d.length-1];for(let g of typeof u.code=="number"?[u.code]:u.code){let m=p[g]??(p[g]=[]);u.isMultiple&&m.length,m.push(u)}return d},[{}])}(n,i.debug),a=!1,o=r.length-1;for(;!O(t,0,"EOF");){let h=function(_,f,S){return _.find((L,M)=>{var I;return M>=S&&((I=L[f])==null?void 0:I.length)})}(r,t.code,o),c=h==null?void 0:h[t.code],d=c==null?void 0:c[c.length-1];if(!h||!d){i.rewind();break}d.isMultiple||h[t.code].pop();let{name:u,parser:p,isMultiple:g,isReducible:m}=d,y=p==null?void 0:p(t,i,s);if(y===hn){i.rewind();break}if(u){let[_,f]=md(s,u);g&&!m?(Object.prototype.hasOwnProperty.call(_,f)||(_[f]=[]),_[f].push(y)):_[f]=y}d.pushContext&&(o-=1),a=!0,t=i.next()}return e&&Object.setPrototypeOf(s,e),a}}function md(n,e){let t=e.split(".");if(!t.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let i=n;for(let s=0;s<t.length-1;++s){let r=Os(t[s]),a=Os(t[s+1]);Object.prototype.hasOwnProperty.call(i,r)||(typeof a=="number"?i[r]=[]:i[r]={}),i=i[r]}return[i,Os(t[t.length-1])]}function Os(n){let e=Number.parseInt(n);return Number.isNaN(e)?n:e}function l({value:n}){return n}function b(n,e){return Ct(e)}function E({value:n}){return!!n}function yd({value:n}){return n.trim()}let _d=[{code:281,name:"isEntity",parser:E},{code:280,name:"wasProxy",parser:E},{code:91,name:"instanceCount",parser:l},{code:90,name:"proxyFlag",parser:l},{code:3,name:"appName",parser:l},{code:2,name:"cppClassName",parser:l},{code:1,name:"name",parser:l}],fd=T(_d),xd=[{code:0,name:"classes",isMultiple:!0,parser(n,e){if(n.value!=="CLASS")return hn;n=e.next();let t={};return fd(n,e,t),t}}],wd=T(xd);(Pi={})[Pi.RayTrace=0]="RayTrace",Pi[Pi.ShadowMap=1]="ShadowMap";function $e(n,e,t){for(;O(n,102);){var i;let s=n.value;if(n=e.next(),!s.startsWith("{")){e.debug,function(a,o){for(;!O(a,102)&&!O(a,0,"EOF");)a=o.next()}(n,e),n=e.next();continue}let r=s.slice(1).trim();t.extensions??(t.extensions={}),(i=t.extensions)[r]??(i[r]=[]),function(a,o,h){for(;!O(a,102,"}")&&!O(a,0,"EOF");)h.push(a),a=o.next()}(n,e,t.extensions[r]),n=e.next()}e.rewind()}let bd=[{code:1001,name:"xdata",isMultiple:!0,parser:Dl}],Ld=new Set([1010,1011,1012,1013]);function Dl(n,e){var s;if(!O(n,1001))throw Error("XData must starts with code 1001");let t={appName:n.value,value:[]};n=e.next();let i=[t.value];for(;!O(n,0,"EOF")&&!O(n,1001)&&n.code>=1e3;){let r=i[i.length-1];if(n.code===1002){n.value==="{"?i.push([]):(i.pop(),(s=i[i.length-1])==null||s.push(r)),n=e.next();continue}Ld.has(n.code)?r.push(Ct(e)):r.push(n.value),n=e.next()}return e.rewind(),t}(tt={})[tt.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",tt[tt.CAST=1]="CAST",tt[tt.RECEIVE=2]="RECEIVE",tt[tt.IGNORE=3]="IGNORE";let V=[...bd,{code:284,name:"shadowMode",parser:l},{code:390,name:"plotStyleHardId",parser:l},{code:380,name:"plotStyleType",parser:l},{code:440,name:"transparency",parser:l},{code:430,name:"colorName",parser:l},{code:420,name:"color",parser:l},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(n,e,t)=>(t.proxyEntity??"")+n.value},{code:[92,160],name:"proxyByte",parser:l},{code:60,name:"isVisible",parser:E},{code:48,name:"lineTypeScale",parser:l},{code:370,name:"lineweight",parser:l},{code:62,name:"colorIndex",parser:l},{code:347,name:"materialObjectHardId",parser:l},{code:6,name:"lineType",parser:l},{code:8,name:"layer",parser:l},{code:410,name:"layoutTabName",parser:l},{code:67,name:"isInPaperSpace",parser:E},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:l},{code:102,parser:$e},{code:102,parser:$e},{code:102,parser:$e},{code:5,name:"handle",parser:l}];function xs(n){return[{code:3,name:n,parser:(e,t,i)=>(i._code3text=(i._code3text??"")+e.value,i._code3text+(i._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(e,t,i)=>(i._code1text=e.value,(i._code3text??"")+i._code1text)}]}function Vl(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Sd={extrusionDirection:{x:0,y:0,z:1}},Ad=[{code:210,name:"extrusionDirection",parser:b},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:100,name:"subclassMarker",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100},...V];class zl{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Vl(this,"parser",T(Ad,Sd))}}Vl(zl,"ForEntityName","ARC");(Ht={})[Ht.BeforeText=0]="BeforeText",Ht[Ht.AboveText=1]="AboveText",Ht[Ht.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:Da.Above,defaultValueImperial:Da.Center},{name:"DIMZIN",code:78,defaultValue:li.Trailing,defaultValueImperial:li.Feet},{name:"DIMAZIN",code:79,defaultValue:hd.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:cd.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:dd.Center},{name:"DIMTZIN",code:284,defaultValue:li.Trailing,defaultValueImperial:li.Feet},{name:"DIMALTZ",code:285,defaultValue:li.Trailing},{name:"DIMALTTZ",code:286,defaultValue:li.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}],Hl=[{code:3,name:"styleName",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:51,name:"ocsRotation",parser:l},{code:53,name:"textRotation",parser:l},{code:1,name:"text",parser:l},{code:42,name:"measurement",parser:l},{code:72,name:"textLineSpacingStyle",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:70,name:"dimensionType",parser:l},{code:11,name:"textPoint",parser:b},{code:10,name:"definitionPoint",parser:b},{code:2,name:"name",parser:l},{code:280,name:"version",parser:l},{code:100}],Id=[{code:100},{code:52,name:"obliqueAngle",parser:l},{code:50,name:"rotationAngle",parser:l},{code:14,name:"subDefinitionPoint2",parser:b},{code:13,name:"subDefinitionPoint1",parser:b},{code:12,name:"insertionPoint",parser:b},{code:100,name:"subclassMarker",parser:l}],Pd=[{code:16,name:"arcPoint",parser:b},{code:15,name:"centerPoint",parser:b},{code:14,name:"subDefinitionPoint2",parser:b},{code:13,name:"subDefinitionPoint1",parser:b},{code:100,name:"subclassMarker",parser:l}],Ed=[{code:14,name:"subDefinitionPoint2",parser:b},{code:13,name:"subDefinitionPoint1",parser:b},{code:100,name:"subclassMarker",parser:l}],Td=[{code:40,name:"leaderLength",parser:l},{code:15,name:"subDefinitionPoint",parser:b},{code:100,name:"subclassMarker",parser:l}],Md=[{code:100,parser(n,e,t){let i=function(s){switch(s){case"AcDbAlignedDimension":return T(Id);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return T(Pd);case"AcDbOrdinateDimension":return T(Ed);case"AcDbRadialDimension":case"AcDbDiametricDimension":return T(Td)}return null}(n.value);if(!i)return hn;i(n,e,t)},pushContext:!0},...Or.map(n=>({...n,parser:l})),...Hl,...V];class Cn{parseEntity(e,t){let i={};return T(Md)(t,e,i),i}}(Ts="ForEntityName")in Cn?Object.defineProperty(Cn,Ts,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):Cn[Ts]="DIMENSION";let kd=[{code:73},{code:17,name:"leaderEnd",parser:b},{code:16,name:"leaderStart",parser:b},{code:71,name:"hasLeader",parser:E},{code:41,name:"endAngle",parser:l},{code:40,name:"startAngle",parser:l},{code:70,name:"isPartial",parser:E},{code:15,name:"centerPoint",parser:b},{code:14,name:"xline2Point",parser:b},{code:13,name:"xline1Point",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...Or.map(n=>({...n,parser:l})),...Hl,...V];class vn{parseEntity(e,t){let i={};return T(kd)(t,e,i),i}}(Ms="ForEntityName")in vn?Object.defineProperty(vn,Ms,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):vn[Ms]="ARC_DIMENSION";(Re={})[Re.NONE=0]="NONE",Re[Re.INVISIBLE=1]="INVISIBLE",Re[Re.CONSTANT=2]="CONSTANT",Re[Re.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Re[Re.PRESET=8]="PRESET";(Ei={})[Ei.MULTILINE=2]="MULTILINE",Ei[Ei.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(jt={})[jt.NONE=0]="NONE",jt[jt.MIRRORED_X=2]="MIRRORED_X",jt[jt.MIRRORED_Y=4]="MIRRORED_Y";var Cd=((Ie={})[Ie.LEFT=0]="LEFT",Ie[Ie.CENTER=1]="CENTER",Ie[Ie.RIGHT=2]="RIGHT",Ie[Ie.ALIGNED=3]="ALIGNED",Ie[Ie.MIDDLE=4]="MIDDLE",Ie[Ie.FIT=5]="FIT",Ie),vd=((it={})[it.BASELINE=0]="BASELINE",it[it.BOTTOM=1]="BOTTOM",it[it.MIDDLE=2]="MIDDLE",it[it.TOP=3]="TOP",it);function jl(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Wl={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Cd.LEFT,valign:vd.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Gl=[{code:73,name:"valign",parser:l},{code:100},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:72,name:"valign",parser:l},{code:72,name:"halign",parser:l},{code:71,name:"generationFlag",parser:l},{code:7,name:"styleName",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"xScale",parser:l},{code:50,name:"rotation",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Ul{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){jl(this,"parser",T(Gl,Wl))}}function $l(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}jl(Ul,"ForEntityName","TEXT");let Nd={...Wl},Od=[{code:2},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:E},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedRecord",parser:E},{code:100},{code:280,name:"isLocked",parser:E},{code:74,name:"valign",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:3,name:"prompt",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},...Gl.slice(2)];class ql{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){$l(this,"parser",T(Od,Nd))}}function Yd(n,e){let t={};for(let i of n){let s=e(i);s!=null&&(t[s]??(t[s]=[]),t[s].push(i))}return t}function*us(n,e=1/0,t=1){for(let i=n;i!==e;i+=t)yield i}function er(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}$l(ql,"ForEntityName","ATTDEF");var Xd=[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 Rd(n){return Xd[n]}function Bd(n){n.rewind();let e=n.next();if(e.code!==101)throw Error("Bad call for skipEmbeddedObject()");do e=n.next();while(e.code!==0);n.rewind()}function Fd(n,e,t){if(O(e,102))return $e(e,t,n),!0;switch(e.code){case 0:n.type=e.value;break;case 5:n.handle=e.value;break;case 330:n.ownerBlockRecordSoftId=e.value;break;case 67:n.isInPaperSpace=!!e.value;break;case 8:n.layer=e.value;break;case 6:n.lineType=e.value;break;case 347:n.materialObjectHardId=e.value;break;case 62:n.colorIndex=e.value,n.color=Rd(Math.abs(e.value));break;case 370:n.lineweight=e.value;break;case 48:n.lineTypeScale=e.value;break;case 60:n.isVisible=!!e.value;break;case 92:n.proxyByte=e.value;break;case 310:n.proxyEntity=e.value;break;case 100:break;case 420:n.color=e.value;break;case 430:n.transparency=e.value;break;case 390:n.plotStyleHardId=e.value;break;case 284:n.shadowMode=e.value;break;case 1001:(n.xdata??(n.xdata=[])).push(Dl(e,t));break;default:return!1}return!0}function Kl(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Dd={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Nn=[{code:46,name:"annotationHeight",parser:l},{code:101,parser(n,e){Bd(e)}},{code:50,name:"columnHeight",parser:l},{code:49,name:"columnGutter",parser:l},{code:48,name:"columnWidth",parser:l},{code:79,name:"columnAutoHeight",parser:l},{code:78,name:"columnFlowReversed",parser:l},{code:76,name:"columnCount",parser:l},{code:75,name:"columnType",parser:l},{code:441,name:"backgroundFillTransparency",parser:l},{code:63,name:"backgroundFillColor",parser:l},{code:45,name:"fillBoxScale",parser:l},{code:[...us(430,440)],name:"backgroundColor",parser:l},{code:[...us(420,430)],name:"backgroundColor",parser:l},{code:90,name:"backgroundFill",parser:l},{code:44,name:"lineSpacing",parser:l},{code:73,name:"lineSpacingStyle",parser:l},{code:50,name:"rotation",parser:l},{code:43},{code:42},{code:11,name:"direction",parser:b},{code:210,name:"extrusionDirection",parser:b},{code:7,name:"styleName",parser:l},...xs("text"),{code:72,name:"drawingDirection",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:10,name:"insertionPoint",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Zl{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Kl(this,"parser",T(Nn,Dd))}}function Ql(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Kl(Zl,"ForEntityName","MTEXT");let Vd={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},zd=[...Nn.slice(Nn.findIndex(({name:n})=>n==="columnType"),Nn.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!O(n,0,"MTEXT"))return hn}},{code:2,name:"definitionTag",parser:l},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardId",parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:E},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedEntriesKeep",parser:E},{code:100},{code:280,name:"lockPositionFlag",parser:E},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"alignmentPoint",parser:b},{code:74,name:"verticalJustification",parser:l},{code:72,name:"horizontalJustification",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:7,name:"textStyle",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"scale",parser:l},{code:50,name:"rotation",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100},...V];class Jl{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Ql(this,"parser",T(zd,Vd))}}function eh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ql(Jl,"ForEntityName","ATTRIB");let Hd=[...xs("data"),{code:70,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class th{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){eh(this,"parser",T(Hd))}}function ih(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}eh(th,"ForEntityName","BODY");let jd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Wd=[{code:210,name:"extrusionDirection",parser:b},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class nh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ih(this,"parser",T(Wd,jd))}}function sh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ih(nh,"ForEntityName","CIRCLE");let Gd={extrusionDirection:{x:0,y:0,z:1}},Ud=[{code:42,name:"endAngle",parser:l},{code:41,name:"startAngle",parser:l},{code:40,name:"axisRatio",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"majorAxisEndPoint",parser:b},{code:10,name:"center",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class rh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){sh(this,"parser",T(Ud,Gd))}}function ah(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}sh(rh,"ForEntityName","ELLIPSE");let $d=[{code:13,name:"vertices.3",parser:b},{code:12,name:"vertices.2",parser:b},{code:11,name:"vertices.1",parser:b},{code:10,name:"vertices.0",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class oh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ah(this,"parser",T($d))}}ah(oh,"ForEntityName","3DFACE");(nt={})[nt.First=1]="First",nt[nt.Second=2]="Second",nt[nt.Third=4]="Third",nt[nt.Fourth=8]="Fourth";let lh=[{code:330,name:"sourceBoundaryObjects",parser:l,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:l}],qd=[{code:11,name:"end",parser:b},{code:10,name:"start",parser:b}],Kd=[{code:73,name:"isCCW",parser:E},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b}],Zd=[{code:73,name:"isCCW",parser:E},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"lengthOfMinorAxis",parser:l},{code:11,name:"end",parser:b},{code:10,name:"center",parser:b}],Qd=[{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:11,name:"fitDatum",isMultiple:!0,parser:b},{code:97,name:"numberOfFitData",parser:l},{code:10,name:"controlPoints",isMultiple:!0,parser(n,e){let t={...Ct(e),weight:1};return(n=e.next()).code===42?t.weight=n.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:l},{code:96,name:"numberOfControlPoints",parser:l},{code:95,name:"numberOfKnots",parser:l},{code:74,name:"isPeriodic",parser:E},{code:73,name:"splineFlag",parser:l},{code:94,name:"degree",parser:l}],Jd={[Sn.Line]:qd,[Sn.Circular]:Kd,[Sn.Elliptic]:Zd,[Sn.Spline]:Qd},eu=[...lh,{code:72,name:"edges",parser(n,e){let t={type:n.value},i=T(Jd[t.type]);if(!i)throw Error(`Invalid edge type ${t.type}`);return i(n=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:l}],tu=[...lh,{code:10,name:"vertices",parser(n,e){let t={...Ct(e),bulge:0};return(n=e.next()).code===42?t.bulge=n.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:l},{code:73,name:"isClosed",parser:E},{code:72,name:"hasBulge",parser:E}];function iu(n,e){let t={boundaryPathTypeFlag:n.value},i=t.boundaryPathTypeFlag&gd.Polyline;return n=e.next(),i?T(tu)(n,e,t):T(eu)(n,e,t),t}let nu=[{code:49,name:"dashLengths",parser:l,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:l},{code:45,name:"offset",parser:Va},{code:43,name:"base",parser:Va},{code:53,name:"angle",parser:l}];function Va(n,e){let t=n.code+1,i={x:n.value,y:1};return(n=e.next()).code===t?i.y=n.value:e.rewind(),i}function su(n,e){let t={};return T(nu)(n,e,t),t}function ru(n,e){let t=[];for(;n.code===463;){let i={reservedField:n.value};if((n=e.next()).code===63&&(i.colorIndex=n.value,n=e.next()),n.code===421)i.rgb=n.value,t.push(i),n=e.next();else{e.rewind();break}}return n.code!==463&&t.length>0&&e.rewind(),t}function hh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let au={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},ou=[{code:470,name:"gradientName",parser:l},{code:463,name:"gradientColors",parser:ru},{code:462,name:"colorTint",parser:l},{code:461,name:"gradientDefinition",parser:l},{code:460,name:"gradientRotation",parser:l},{code:453,name:"numberOfColors",parser:l},{code:452,name:"gradientColorFlag",parser:l},{code:451},{code:450,name:"gradientFlag",parser:l},{code:10,name:"seedPoints",parser:b,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:b},{code:98,name:"numberOfSeedPoints",parser:l},{code:47,name:"pixelSize",parser:l},{code:53,name:"definitionLines",parser:su,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:l},{code:77,name:"isDouble",parser:E},{code:73,name:"isAnnotated",parser:E},{code:41,name:"patternScale",parser:l},{code:52,name:"patternAngle",parser:l},{code:76,name:"patternType",parser:l},{code:75,name:"hatchStyle",parser:l},{code:92,name:"boundaryPaths",parser:iu,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:l},{code:71,name:"associativity",parser:l},{code:63,name:"patternFillColor",parser:l},{code:70,name:"solidFill",parser:l},{code:2,name:"patternName",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:10,name:"elevationPoint",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V];class ch{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){hh(this,"parser",T(ou,au))}}function dh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}hh(ch,"ForEntityName","HATCH");let lu={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},hu=[{code:290,name:"clipMode",parser:l},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:b},{code:91,name:"countBoundaryPoints",parser:l},{code:71,name:"clippingBoundaryType",parser:l},{code:360,name:"imageDefReactorHandle",parser:l},{code:283,name:"fade",parser:l},{code:282,name:"contrast",parser:l},{code:281,name:"brightness",parser:l},{code:280,name:"isClipped",parser:E},{code:70,name:"flags",parser:l},{code:340,name:"imageDefHandle",parser:l},{code:13,name:"imageSize",parser:b},{code:12,name:"vPixel",parser:b},{code:11,name:"uPixel",parser:b},{code:10,name:"position",parser:b},{code:90,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class uh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){dh(this,"parser",T(hu,lu))}}dh(uh,"ForEntityName","IMAGE");(st={})[st.ShowImage=1]="ShowImage",st[st.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",st[st.UseClippingBoundary=4]="UseClippingBoundary",st[st.TransparencyIsOn=8]="TransparencyIsOn";(Ti={})[Ti.Rectangular=1]="Rectangular",Ti[Ti.Polygonal=2]="Polygonal";(Mi={})[Mi.Outside=0]="Outside",Mi[Mi.Inside=1]="Inside";function gh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let cu={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},du=[{code:210,name:"extrusionDirection",parser:b},{code:45,name:"rowSpacing",parser:l},{code:44,name:"columnSpacing",parser:l},{code:71,name:"rowCount",parser:l},{code:70,name:"columnCount",parser:l},{code:50,name:"rotation",parser:l},{code:43,name:"zScale",parser:l},{code:42,name:"yScale",parser:l},{code:41,name:"xScale",parser:l},{code:10,name:"insertionPoint",parser:b},{code:2,name:"name",parser:l},{code:66,name:"isVariableAttributes",parser:E},{code:100,name:"subclassMarker",parser:l},...V];class ph{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){gh(this,"parser",T(du,cu))}}function mh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}gh(ph,"ForEntityName","INSERT");let uu={isArrowheadEnabled:!0},gu=[{code:213,name:"offsetFromAnnotation",parser:b},{code:212,name:"offsetFromBlock",parser:b},{code:211,name:"horizontalDirection",parser:b},{code:210,name:"normal",parser:b},{code:340,name:"associatedAnnotation",parser:l},{code:77,name:"byBlockColor",parser:l},{code:10,name:"vertices",parser:b,isMultiple:!0},{code:76,name:"numberOfVertices",parser:l},{code:41,name:"textWidth",parser:l},{code:40,name:"textHeight",parser:l},{code:75,name:"isHooklineExists",parser:E},{code:74,name:"isHooklineSameDirection",parser:E},{code:73,name:"leaderCreationFlag",parser:l},{code:72,name:"isSpline",parser:E},{code:71,name:"isArrowheadEnabled",parser:E},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class yh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){mh(this,"parser",T(gu,uu))}}mh(yh,"ForEntityName","LEADER");(rt={})[rt.TextAnnotation=0]="TextAnnotation",rt[rt.ToleranceAnnotation=1]="ToleranceAnnotation",rt[rt.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",rt[rt.NoAnnotation=3]="NoAnnotation";function _h(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let pu={thickness:0,extrusionDirection:{x:0,y:0,z:1}},mu=[{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class fh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){_h(this,"parser",T(mu,pu))}}function xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}_h(fh,"ForEntityName","LINE");let yu=[{code:280,name:"shadowMapSoftness",parser:l},{code:91,name:"shadowMapSize",parser:l},{code:73,name:"shadowType",parser:l},{code:293,name:"isShadowCast",parser:E},{code:51,name:"falloffAngle",parser:l},{code:50,name:"hotspotAngle",parser:l},{code:42,name:"limitEnd",parser:l},{code:41,name:"limitStart",parser:l},{code:292,name:"isAttenuationLimited",parser:E},{code:72,name:"attenuationType",parser:l},{code:11,name:"target",parser:b},{code:10,name:"position",parser:b},{code:40,name:"intensity",parser:l},{code:291,name:"isPlotGlyph",parser:E},{code:290,name:"isOn",parser:E},{code:421,name:"lightColorInstance",parser:l},{code:63,name:"lightColorIndex",parser:l},{code:70,name:"lightType",parser:l},{code:1,name:"name",parser:l},{code:90,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class wh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){xh(this,"parser",T(yu))}}xh(wh,"ForEntityName","LIGHT");(Wt={})[Wt.Distant=1]="Distant",Wt[Wt.Point=2]="Point",Wt[Wt.Spot=3]="Spot";(Gt={})[Gt.None=0]="None",Gt[Gt.InverseLinear=1]="InverseLinear",Gt[Gt.InverseSquare=2]="InverseSquare";let _u={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},fu={bulge:0},xu=[{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:91,name:"id",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l}],wu=[{code:210,name:"extrusionDirection",parser:b},{code:10,name:"vertices",isMultiple:!0,parser(n,e){let t={};return T(xu,fu)(n,e,t),t}},{code:39,name:"thickness",parser:l},{code:38,name:"elevation",parser:l},{code:43,name:"constantWidth",parser:l},{code:70,name:"flag",parser:l},{code:90,name:"numberOfVertices",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class On{parseEntity(e,t){let i={};return T(wu,_u)(t,e,i),i}}(ks="ForEntityName")in On?Object.defineProperty(On,ks,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):On[ks]="LWPOLYLINE";(ki={})[ki.IS_CLOSED=1]="IS_CLOSED",ki[ki.PLINE_GEN=128]="PLINE_GEN";function bh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let bu=[{code:90,name:"overridenSubEntityCount",parser:l},{code:140,name:"edgeCreaseWeights",parser:l,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:l},{code:94,parser(n,e,t){t.edgeCount=n.value,t.edgeIndices=[];for(let i=0;i<t.edgeCount;++i){let s=[];n=e.next(),s[0]=n.value,n=e.next(),s[1]=n.value,t.edgeIndices.push(s)}}},{code:93,parser(n,e,t){t.totalFaceIndices=n.value,t.faceIndices=[];let i=[];for(let r=0;r<t.totalFaceIndices&&!O(n,0);++r)n=e.next(),i.push(n.value);let s=0;for(;s<i.length;){let r=i[s++],a=[];for(let o=0;o<r;++o)a.push(i[s++]);t.faceIndices.push(a)}}},{code:10,name:"vertices",parser:b,isMultiple:!0},{code:92,name:"verticesCount",parser:l},{code:91,name:"subdivisionLevel",parser:l},{code:40,name:"blendCrease",parser:l},{code:72,name:"isBlendCreased",parser:E},{code:71,name:"version",parser:l},{code:100,name:"subclassMarker",parser:yd,pushContext:!0},...V];class Lh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){bh(this,"parser",T(bu))}}function Sh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}bh(Lh,"ForEntityName","MESH");let Lu=[{code:42,name:"fillParameters",parser:l,isMultiple:!0},{code:75,name:"fillCount",parser:l},{code:41,name:"parameters",parser:l,isMultiple:!0},{code:74,name:"parameterCount",parser:l}],Su=[{code:[74,41,75,42],name:"elements",parser(n,e){let t=T(Lu),i={};return t(n,e,i),i},isMultiple:!0},{code:13,name:"miterDirection",parser:b},{code:12,name:"direction",parser:b},{code:11,name:"position",parser:b}],Au=[{code:[11,12,13],name:"segments",parser(n,e){let t=T(Su),i={};return t(n,e,i),i},isMultiple:!0},{code:210,name:"extrusionDirection",parser:b},{code:10,name:"startPosition",parser:b},{code:73,name:"styleCount",parser:l},{code:72,name:"vertexCount",parser:l},{code:71,name:"flags",parser:l},{code:70,name:"justification",parser:l},{code:40,name:"scale",parser:l},{code:340,name:"styleObjectHandle",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V];class Ah{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Sh(this,"parser",T(Au))}}Sh(Ah,"ForEntityName","MLINE");(Ut={})[Ut.Top=0]="Top",Ut[Ut.Zero=1]="Zero",Ut[Ut.Bottom=2]="Bottom";(at={})[at.HasVertex=1]="HasVertex",at[at.Closed=2]="Closed",at[at.SuppressStartCaps=4]="SuppressStartCaps",at[at.SuppressEndCaps=8]="SuppressEndCaps";($t={})[$t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",$t[$t.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",$t[$t.BY_STYLE=5]="BY_STYLE";function Ih(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Iu={},Pu=[{code:300,parser:function(n,e,t){var r;let i;if(n.value==="CONTEXT_DATA{")for(;e.hasNext();){var s;if((i=e.next()).code===301)break;switch(i.code){case 10:t.contentBasePosition=le(i,e);break;case 11:t.normal=le(i,e);break;case 12:t.textAnchor=le(i,e);break;case 13:t.textDirection=le(i,e);break;case 14:dt(t).normal=le(i,e);break;case 15:dt(t).position=le(i,e);break;case 16:dt(t).scale=le(i,e);break;case 40:t.contentScale=i.value;break;case 41:case 44:t.textHeight=i.value;break;case 42:t.textRotation=i.value;break;case 43:t.textWidth=i.value;break;case 45:t.textLineSpacingFactor=i.value;break;case 46:dt(t).rotation=i.value;break;case 47:(s=dt(t)).transformationMatrix??(s.transformationMatrix=[]),(r=dt(t).transformationMatrix)==null||r.push(i.value);break;case 90:t.textColor=i.value;break;case 91:t.textBackgroundColor=i.value;break;case 92:t.textBackgroundTransparency=i.value;break;case 93:dt(t).color=i.value;break;case 110:t.planeOrigin=le(i,e);break;case 111:t.planeXAxisDirection=le(i,e);break;case 112:t.planeYAxisDirection=le(i,e);break;case 140:t.arrowheadSize=i.value;break;case 141:t.textBackgroundScaleFactor=i.value;break;case 142:t.textColumnWidth=i.value;break;case 143:t.textColumnGutterWidth=i.value;break;case 144:t.textColumnHeight=i.value;break;case 145:t.landingGap=i.value;break;case 170:t.textLineSpacingStyle=i.value;break;case 171:t.textAttachment=i.value;break;case 172:t.textFlowDirection=i.value;break;case 173:t.textColumnType=i.value;break;case 290:t.hasMText=i.value;break;case 291:t.textBackgroundColorOn=i.value;break;case 292:t.textFillOn=i.value;break;case 293:t.textUseAutoHeight=i.value;break;case 294:t.textColumnFlowReversed=i.value;break;case 295:t.textUseWordBreak=i.value;break;case 296:t.hasBlock=i.value;break;case 297:t.planeNormalReversed=i.value;break;case 302:i.value==="LEADER{"&&(t.leaderSections??(t.leaderSections=[]),t.leaderSections.push(function(a,o){let h,c;if(a.value!=="LEADER{")return{leaderLines:[]};let d={leaderLines:[]};for(;o.hasNext();){if((c=o.next()).code===303){An(d,h);break}switch(c.code){case 290:d.lastLeaderLinePointSet=c.value;break;case 291:d.doglegVectorSet=c.value;break;case 10:d.lastLeaderLinePoint=le(c,o);break;case 11:d.doglegVector=le(c,o);break;case 12:h??(h={}),h.start=le(c,o);break;case 13:h??(h={}),h.end=le(c,o),An(d,h),h=void 0;break;case 90:d.leaderBranchIndex=c.value;break;case 40:d.doglegLength=c.value;break;case 304:c.value==="LEADER_LINE{"&&d.leaderLines.push(function(u,p){let g,m;if(u.value!=="LEADER_LINE{")return{vertices:[]};let y={vertices:[]};for(;p.hasNext();){if((m=p.next()).code===305){An(y,g);break}switch(m.code){case 10:y.vertices.push(le(m,p));break;case 11:g??(g={}),g.start=le(m,p);break;case 12:g??(g={}),g.end=le(m,p),An(y,g),g=void 0;break;case 90:y.breakPointIndexes??(y.breakPointIndexes=[]),y.breakPointIndexes.push(m.value),g??(g={}),g.index=m.value;break;case 91:y.leaderLineIndex=m.value}}return y}(c,o))}}return d}(i,e)));break;case 304:i.value!=="LEADER_LINE{"&&(t.textContent=i.value,t.contentType??(t.contentType=2));break;case 340:t.textStyleId=i.value;break;case 341:t.blockContentId=i.value,dt(t).blockContentId=i.value}}}},{code:270,name:"version",parser:l},{code:340,name:"leaderStyleId",parser:l},{code:90,name:"propertyOverrideFlag",parser:l},{code:170,name:"leaderLineType",parser:l},{code:91,name:"leaderLineColor",parser:l},{code:341,name:"leaderLineTypeId",parser:l},{code:171,name:"leaderLineWeight",parser:l},{code:290,name:"landingEnabled",parser:E},{code:291,name:"doglegEnabled",parser:E},{code:[40,41],name:"doglegLength",parser:l},{code:342,name:"arrowheadId",parser:l},{code:42,name:"arrowheadSize",parser:l},{code:172,name:"contentType",parser:l},{code:343,name:"textStyleId",parser:l},{code:173,name:"textLeftAttachmentType",parser:l},{code:95,name:"textRightAttachmentType",parser:l},{code:174,name:"textAngleType",parser:l},{code:175,name:"textAlignmentType",parser:l},{code:92,name:"textColor",parser:l},{code:292,name:"textFrameEnabled",parser:E},{code:344,parser:function(n,e,t){t.blockContentId=n.value,dt(t).blockContentId=n.value}},{code:93,name:"blockContentColor",parser:l},{code:10,name:"blockContentScale",parser:b},{code:43,name:"blockContentRotation",parser:l},{code:176,name:"blockContentConnectionType",parser:l},{code:293,name:"annotativeScaleEnabled",parser:E},{code:94,parser:function(n,e,t){t.arrowheadOverrides??(t.arrowheadOverrides=[]),t.arrowheadOverrides.push({index:n.value})},isMultiple:!0},{code:345,parser:function(n,e,t){var i;((i=t).arrowheadOverrides??(i.arrowheadOverrides=[]),i.arrowheadOverrides.length||i.arrowheadOverrides.push({}),i.arrowheadOverrides[i.arrowheadOverrides.length-1]).handle=n.value},isMultiple:!0},{code:330,parser:function(n,e,t){t.blockAttributes??(t.blockAttributes=[]),t.blockAttributes.push({id:n.value})},isMultiple:!0},{code:177,parser:function(n,e,t){Ys(t).index=n.value},isMultiple:!0},{code:44,parser:function(n,e,t){Ys(t).width=n.value},isMultiple:!0},{code:302,parser:function(n,e,t){Ys(t).text=n.value},isMultiple:!0},{code:294,name:"textDirectionNegative",parser:E},{code:178,name:"textAlignInIPE",parser:l},{code:179,name:"textAttachmentPoint",parser:l},{code:271,name:"textAttachmentDirection",parser:l},{code:272,name:"bottomTextAttachmentDirection",parser:l},{code:273,name:"topTextAttachmentDirection",parser:l},{code:100,name:"subclassMarker",parser:l},...V];function le(n,e){return er(b(n,e))}function An(n,e){(e!=null&&e.start||e!=null&&e.end)&&(n.breaks??(n.breaks=[]),n.breaks.push(e))}function dt(n){return n.blockContent??(n.blockContent={})}function Ys(n){return n.blockAttributes??(n.blockAttributes=[]),n.blockAttributes.length||n.blockAttributes.push({}),n.blockAttributes[n.blockAttributes.length-1]}class Ph{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Ih(this,"parser",T(Pu,Iu))}}function Eh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ih(Ph,"ForEntityName","MULTILEADER");let Eu={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Tu=[{code:50,name:"angle",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Th{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Eh(this,"parser",T(Tu,Eu))}}function Mh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Eh(Th,"ForEntityName","POINT");let Mu={startWidth:0,endWidth:0,bulge:0},ku=[{code:91,name:"id",parser:l},{code:[...us(71,75)],name:"faces",isMultiple:!0,parser:l},{code:50,name:"tangentDirection",parser:l},{code:70,name:"flag",parser:l},{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:30,name:"z",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...V];class Yr{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Mh(this,"parser",T(ku,Mu))}}function kh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Mh(Yr,"ForEntityName","VERTEX");let Cu={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:[]},vu=[{code:0,name:"vertices",isMultiple:!0,parser:(n,e)=>O(n,0,"VERTEX")?(n=e.next(),new Yr().parseEntity(e,n)):hn},{code:210,name:"extrusionDirection",parser:b},{code:75,name:"smoothType",parser:l},{code:74,name:"surfaceNDensity",parser:l},{code:73,name:"surfaceMDensity",parser:l},{code:72,name:"meshNVertexCount",parser:l},{code:71,name:"meshMVertexCount",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:70,name:"flag",parser:l},{code:39,name:"thickness",parser:l},{code:30,name:"elevation",parser:l},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:l},...V];class Ch{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){kh(this,"parser",T(vu,Cu))}}kh(Ch,"ForEntityName","POLYLINE");(ae={})[ae.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",ae[ae.CURVE_FIT=2]="CURVE_FIT",ae[ae.SPLINE_FIT=4]="SPLINE_FIT",ae[ae.POLYLINE_3D=8]="POLYLINE_3D",ae[ae.POLYGON_3D=16]="POLYGON_3D",ae[ae.CLOSED_POLYGON=32]="CLOSED_POLYGON",ae[ae.POLYFACE=64]="POLYFACE",ae[ae.CONTINUOUS=128]="CONTINUOUS";var In=((ot={})[ot.NONE=0]="NONE",ot[ot.QUADRATIC=5]="QUADRATIC",ot[ot.CUBIC=6]="CUBIC",ot[ot.BEZIER=8]="BEZIER",ot);function vh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Nu=[{code:11,name:"direction",parser:b},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Nh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){vh(this,"parser",T(Nu))}}function Oh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}vh(Nh,"ForEntityName","RAY");let Ou=[...xs("data"),{code:70,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Yh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Oh(this,"parser",T(Ou))}}function Xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Oh(Yh,"ForEntityName","REGION");let Yu={vertices:[],backLineVertices:[]},Xu=[{code:360,name:"geometrySettingHardId",parser:l},{code:12,name:"backLineVertices",isMultiple:!0,parser:b},{code:93,name:"numberOfBackLineVertices",parser:l},{code:11,name:"vertices",isMultiple:!0,parser:b},{code:92,name:"verticesCount",parser:l},{code:[63,411],name:"indicatorColor",parser:l},{code:70,name:"indicatorTransparency",parser:l},{code:41,name:"bottomHeight",parser:l},{code:40,name:"topHeight",parser:l},{code:10,name:"verticalDirection",parser:b},{code:1,name:"name",parser:l},{code:91,name:"flag",parser:l},{code:90,name:"state",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Rh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Xh(this,"parser",T(Xu,Yu))}}function Bh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Xh(Rh,"ForEntityName","SECTION");let Ru={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Bu=[{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:[...us(10,14)],name:"points",isMultiple:!0,parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Fh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Bh(this,"parser",T(Bu,Ru))}}function Dh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Bh(Fh,"ForEntityName","SOLID");let Fu=[{code:350,name:"historyObjectSoftId",parser:l},{code:100,name:"subclassMarker",parser:l},...xs("data"),{code:70,name:"version",parser:l},{code:100},...V];class Vh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Dh(this,"parser",T(Fu))}}function zh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Dh(Vh,"ForEntityName","3DSOLID");let Du={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Vu=[{code:11,name:"fitPoints",isMultiple:!0,parser:b},{code:10,name:"controlPoints",isMultiple:!0,parser:b},{code:41,name:"weights",isMultiple:!0,parser:l},{code:40,name:"knots",isMultiple:!0,parser:l},{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:44,name:"fitTolerance",parser:l},{code:43,name:"controlTolerance",parser:l},{code:42,name:"knotTolerance",parser:l},{code:74,name:"numberOfFitPoints",parser:l},{code:73,name:"numberOfControlPoints",parser:l},{code:72,name:"numberOfKnots",parser:l},{code:71,name:"degree",parser:l},{code:70,name:"flag",parser:l},{code:210,name:"normal",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Hh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){zh(this,"parser",T(Vu,Du))}}zh(Hh,"ForEntityName","SPLINE");(Pe={})[Pe.NONE=0]="NONE",Pe[Pe.CLOSED=1]="CLOSED",Pe[Pe.PERIODIC=2]="PERIODIC",Pe[Pe.RATIONAL=4]="RATIONAL",Pe[Pe.PLANAR=8]="PLANAR",Pe[Pe.LINEAR=16]="LINEAR";function jh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let zu=[{code:280,name:"shadowMapSoftness",parser:l},{code:71,name:"shadowMapSize",parser:l},{code:70,name:"shadowType",parser:l},{code:292,name:"isSummerTime",parser:E},{code:92,name:"time",parser:l},{code:91,name:"julianDay",parser:l},{code:291,name:"hasShadow",parser:E},{code:40,name:"intensity",parser:l},{code:421,name:"lightColorInstance",parser:l},{code:63,name:"lightColorIndex",parser:l},{code:290,name:"isOn",parser:E},{code:90,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V.filter(n=>n.code!==100)];class Wh{parseEntity(e,t){let i={layer:""};return this.parser(t,e,i),i}constructor(){jh(this,"parser",T(zu))}}jh(Wh,"ForEntityName","SUN");class Yn{parseEntity(e,t){let i={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:i.subclassMarker=t.value,t=e.next();break;case 2:i.name=t.value,t=e.next();break;case 5:i.handle=t.value,t=e.next();break;case 10:i.startPoint=er(Ct(e)),t=e.lastReadGroup;break;case 11:i.directionVector=er(Ct(e)),t=e.lastReadGroup;break;case 90:i.tableValue=t.value,t=e.next();break;case 91:i.rowCount=t.value,t=e.next();break;case 92:i.columnCount=t.value,t=e.next();break;case 93:i.overrideFlag=t.value,t=e.next();break;case 94:i.borderColorOverrideFlag=t.value,t=e.next();break;case 95:i.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:i.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:i.rowHeightArr??(i.rowHeightArr=[]),i.rowHeightArr.push(t.value),t=e.next();break;case 142:i.columnWidthArr??(i.columnWidthArr=[]),i.columnWidthArr.push(t.value),t=e.next();break;case 280:i.version=t.value,t=e.next();break;case 310:i.bmpPreview??(i.bmpPreview=""),i.bmpPreview+=t.value,t=e.next();break;case 330:i.ownerBlockRecordSoftId=t.value,t=e.next();break;case 342:i.tableStyleId=t.value,t=e.next();break;case 343:i.blockRecordHandle=t.value,t=e.next();break;case 170:i.attachmentPoint=t.value,t=e.next();break;case 171:i.cells??(i.cells=[]),i.cells.push(function(s,r){let a=!1,o=!1,h={};for(;!s.isEOF()&&r.code!==0&&!o;)switch(r.code){case 171:if(a){o=!0;continue}h.cellType=r.value,a=!0,r=s.next();break;case 172:h.flagValue=r.value,r=s.next();break;case 173:h.mergedValue=r.value,r=s.next();break;case 174:h.autoFit=r.value,r=s.next();break;case 175:h.borderWidth=r.value,r=s.next();break;case 176:h.borderHeight=r.value,r=s.next();break;case 91:h.overrideFlag=r.value,r=s.next();break;case 178:h.virtualEdgeFlag=r.value,r=s.next();break;case 145:h.rotation=r.value,r=s.next();break;case 345:h.fieldObjetId=r.value,r=s.next();break;case 340:h.blockTableRecordId=r.value,r=s.next();break;case 146:h.blockScale=r.value,r=s.next();break;case 177:h.blockAttrNum=r.value,r=s.next();break;case 7:h.textStyle=r.value,r=s.next();break;case 140:h.textHeight=r.value,r=s.next();break;case 170:h.attachmentPoint=r.value,r=s.next();break;case 92:h.extendedCellFlags=r.value,r=s.next();break;case 285:h.rightBorderVisibility=!!(r.value??!0),r=s.next();break;case 286:h.bottomBorderVisibility=!!(r.value??!0),r=s.next();break;case 288:h.leftBorderVisibility=!!(r.value??!0),r=s.next();break;case 289:h.topBorderVisibility=!!(r.value??!0),r=s.next();break;case 301:(function(c,d,u){for(;u.code!==304;)switch(u.code){case 301:case 93:case 90:case 94:u=d.next();break;case 1:c.text=u.value,u=d.next();break;case 300:c.attrText=u.value,u=d.next();break;case 302:c.text=u.value?u.value:c.text,u=d.next();break;default:u=d.next()}})(h,s,r),r=s.next();break;default:return h}return a=!1,o=!1,h}(e,t)),t=e.lastReadGroup;break;default:Fd(i,t,e),t=e.next()}}return i}}function Gh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(Cs="ForEntityName")in Yn?Object.defineProperty(Yn,Cs,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):Yn[Cs]="ACAD_TABLE";let Hu=[{code:11,name:"xAxisDirection",parser:b},{code:210,name:"extrusionDirection",parser:b},{code:1,name:"text",parser:l},{code:10,name:"position",parser:b},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Uh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Gh(this,"parser",T(Hu))}}Gh(Uh,"ForEntityName","TOLERANCE");var ju=((oe={})[oe.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",oe[oe.TANGENT_DEFINED=2]="TANGENT_DEFINED",oe[oe.NOT_USED=4]="NOT_USED",oe[oe.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",oe[oe.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",oe[oe.FOR_POLYLINE=32]="FOR_POLYLINE",oe[oe.FOR_POLYGON=64]="FOR_POLYGON",oe[oe.POLYFACE=128]="POLYFACE",oe);let Wu=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:l},{code:361,name:"sunId",parser:l},{code:431,name:"ambientLightColorName",parser:l},{code:421,name:"ambientLightColorInstance",parser:l},{code:63,name:"ambientLightColorIndex",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLighting",parser:E},{code:348,name:"visualStyleId",parser:l},{code:333,name:"shadePlotId",parser:l},{code:332,name:"backgroundId",parser:l},{code:61,name:"majorGridFrequency",parser:l},{code:170,name:"shadePlotMode",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:346,name:"ucsBaseId",parser:l},{code:345,name:"ucsId",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:74,name:"iconFlag",parser:l},{code:71,name:"ucsPerViewport",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"sheetName",parser:l},{code:340,name:"clippingBoundaryId",parser:l},{code:90,name:"statusBitFlags",parser:l},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:l},{code:72,name:"circleZoomPercent",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClipZ",parser:l},{code:43,name:"frontClipZ",parser:l},{code:42,name:"perspectiveLensLength",parser:l},{code:17,name:"targetPoint",parser:b},{code:16,name:"viewDirection",parser:b},{code:15,name:"gridSpacing",parser:b},{code:14,name:"snapSpacing",parser:b},{code:13,name:"snapBase",parser:b},{code:12,name:"displayCenter",parser:b},{code:69,name:"viewportId",parser:l},{code:68,name:"status",parser:l},{code:41,name:"height",parser:l},{code:40,name:"width",parser:l},{code:10,name:"viewportCenter",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V];class Xn{parseEntity(e,t){let i={};return T(Wu)(t,e,i),i}}function $h(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(vs="ForEntityName")in Xn?Object.defineProperty(Xn,vs,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):Xn[vs]="VIEWPORT";let Gu={brightness:50,constrast:50,fade:0},Uu=[{code:14,name:"boundary",isMultiple:!0,parser:b},{code:91,name:"numberOfVertices",parser:l},{code:71,name:"boundaryType",parser:l},{code:360,name:"imageDefReactorHardId",parser:l},{code:283,name:"fade",parser:l},{code:282,name:"contrast",parser:l},{code:281,name:"brightness",parser:l},{code:280,name:"isClipping",parser:E},{code:70,name:"displayFlag",parser:l},{code:340,name:"imageDefHardId",parser:l},{code:13,name:"imageSize",parser:b},{code:12,name:"vDirection",parser:b},{code:11,name:"uDirection",parser:b},{code:10,name:"position",parser:b},{code:90,name:"classVersion",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class qh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){$h(this,"parser",T(Uu,Gu))}}$h(qh,"ForEntityName","WIPEOUT");(lt={})[lt.ShowImage=1]="ShowImage",lt[lt.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",lt[lt.UseClippingBoundary=4]="UseClippingBoundary",lt[lt.Transparency=8]="Transparency";function Kh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let $u=[{code:11,name:"direction",parser:b},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Zh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Kh(this,"parser",T($u))}}Kh(Zh,"ForEntityName","XLINE");let qu=0;function Qh(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=qu++)}let Ku=Object.fromEntries([zl,vn,ql,Jl,th,nh,Cn,rh,oh,uh,ph,yh,fh,wh,On,Lh,Ah,Zl,Ph,Th,Ch,Nh,Yh,Rh,Fh,Vh,Hh,Wh,Yn,Ul,Uh,ch,Yr,Xn,qh,Zh].map(n=>[n.ForEntityName,new n]));function Jh(n,e){let t=[];for(;!O(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){e.rewind();break}let i=Ku[n.value];if(i){let s=n.value;n=e.next();let r=i.parseEntity(e,n);r.type=s,Qh(r),t.push(r)}else e.debug}n=e.next()}return t}function vi(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class za{next(){if(!this.hasNext())return this._eof?this.debug:this.debug,{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=Ha(e,this._data[this._pointer++],this.debug),i={code:e,value:t};return O(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}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 e={code:parseInt(this._data[this._pointer]),value:0};return e.value=Ha(e.code,this._data[this._pointer+1],this.debug),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){vi(this,"_data",void 0),vi(this,"debug",void 0),vi(this,"_pointer",void 0),vi(this,"_eof",void 0),vi(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Ha(n,e,t=!1){var i;let s=(i=e).endsWith("\r")?i.slice(0,-1):i;return n<=9?s:n>=10&&n<=59?parseFloat(e.trim()):n>=60&&n<=99?parseInt(e.trim()):n>=100&&n<=109?s:n>=110&&n<=149?parseFloat(e.trim()):n>=160&&n<=179?parseInt(e.trim()):n>=210&&n<=239?parseFloat(e.trim()):n>=270&&n<=289?parseInt(e.trim()):n>=290&&n<=299?function(r){if(r==="0")return!1;if(r==="1")return!0;throw TypeError("String '"+r+"' cannot be cast to Boolean type")}(e.trim()):n>=300&&n<=369?s:n>=370&&n<=389?parseInt(e.trim()):n>=390&&n<=399?s:n>=400&&n<=409?parseInt(e.trim()):n>=410&&n<=419?s:n>=420&&n<=429?parseInt(e.trim()):n>=430&&n<=439?s:n>=440&&n<=459?parseInt(e.trim()):n>=460&&n<=469?parseFloat(e.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?s:n>=1010&&n<=1059?parseFloat(e.trim()):n>=1060&&n<=1071?parseInt(e.trim()):s}function Zu(n,e){let t=null,i={};for(;!O(n,0,"EOF")&&!O(n,0,"ENDSEC");)n.code===9?t=typeof n.value=="string"?n.value:null:t!=null&&(n.code===10?i[t]=Ct(e):i[t]=n.value),n=e.next();return i}let ft=[{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,isMultiple:!0,parser(n,e){for(;!O(n,0,"EOF")&&!O(n,102,"}");)n=e.next()}},{code:5,name:"handle",parser:l}],Qu=[{code:70,name:"flag",parser:l},{code:2,name:"appName",parser:l},{code:100,name:"subclassMarker",parser:l},...ft],Ju=T(Qu),eg=T([{code:310,name:"bmpPreview",parser:l},{code:281,name:"scalability",parser:l},{code:280,name:"explodability",parser:l},{code:70,name:"insertionUnits",parser:l},{code:340,name:"layoutObjects",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),tg=T([...Or.map(n=>({...n,parser:l})),{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},{code:105,name:"handle",parser:l},...ft.filter(n=>n.code!==5)]),ig=T([{code:347,name:"materialObjectId",parser:l},{code:390,name:"plotStyleNameObjectId",parser:l},{code:370,name:"lineweight",parser:l},{code:290,name:"isPlotting",parser:E},{code:6,name:"lineType",parser:l},{code:62,name:"colorIndex",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),ng=T([{code:9,name:"text",parser:l},{code:45,name:"offsetY",parser:l},{code:44,name:"offsetX",parser:l},{code:50,name:"rotation",parser:l},{code:46,name:"scale",parser:l},{code:340,name:"styleObjectId",parser:l},{code:75,name:"shapeNumber",parser:l},{code:74,name:"elementTypeFlag",parser:l},{code:49,name:"elementLength",parser:l}],{elementTypeFlag:0,elementLength:0}),sg=T([{code:49,name:"pattern",parser(n,e){let t={};return ng(n,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:l},{code:73,name:"numberOfLineTypes",parser:l},{code:72,parser:l},{code:3,name:"description",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),rg=T([{code:1e3,name:"extendedFont",parser:l},{code:1001},{code:4,name:"bigFont",parser:l},{code:3,name:"font",parser:l},{code:42,name:"lastHeight",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:50,name:"obliqueAngle",parser:l},{code:41,name:"widthFactor",parser:l},{code:40,name:"fixedTextHeight",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),ag=[{code:13,name:"orthographicOrigin",parser:b},{code:71,name:"orthographicType",parser:l},{code:346,name:"baseUcsHandle",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"isOrthographic",parser:E},{code:12,name:"yAxis",parser:b},{code:11,name:"xAxis",parser:b},{code:10,name:"origin",parser:b},{code:70,name:"flag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft],og=T(ag),lg=[{code:346,name:"baseUcsId",parser:l},{code:345,name:"ucsId",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:361,name:"sunHardId",parser:l},{code:348,name:"styleHardId",parser:l},{code:334,name:"liveSectionSoftId",parser:l},{code:332,name:"backgroundSoftId",parser:l},{code:73,name:"isPlottable",parser:E},{code:72,name:"isUcsAssociated",parser:E},{code:281,name:"renderMode",parser:l},{code:71,name:"viewMode",parser:l},{code:50,name:"twistAngle",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:12,name:"target",parser:b},{code:11,name:"direction",parser:b},{code:10,name:"center",parser:b},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:70,name:"flag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft],hg=T(lg),cg=T([{code:[63,421,431],name:"ambientColor",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLightingOn",parser:E},{code:348,name:"visualStyleObjectId",parser:l},{code:333,name:"shadePlotObjectId",parser:l},{code:332,name:"backgroundObjectId",parser:l},{code:61,name:"majorGridLines",parser:l},{code:170,name:"shadePlotSetting",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:74,name:"ucsIconSetting",parser:l},{code:71,name:"viewMode",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"styleSheet",parser:l},{code:[331,441],name:"frozenLayers",parser:l,isMultiple:!0},{code:72,name:"circleSides",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapRotationAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:17,name:"viewTarget",parser:b},{code:16,name:"viewDirectionFromTarget",parser:b},{code:15,name:"gridSpacing",parser:b},{code:14,name:"snapSpacing",parser:b},{code:13,name:"snapBasePoint",parser:b},{code:12,name:"center",parser:b},{code:11,name:"upperRightCorner",parser:b},{code:10,name:"lowerLeftCorner",parser:b},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),dg={APPID:Ju,BLOCK_RECORD:eg,DIMSTYLE:tg,LAYER:ig,LTYPE:sg,STYLE:rg,UCS:og,VIEW:hg,VPORT:cg},ug=T([{code:70,name:"maxNumberOfEntries",parser:l},{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,parser:$e},{code:102,parser:$e},{code:102,parser:$e},{code:360,isMultiple:!0},{code:5,name:"handle",parser:l},{code:2,name:"name",parser:l}]);function gg(n,e){var i;let t={};for(;!O(n,0,"EOF")&&!O(n,0,"ENDSEC");){if(O(n,0,"TABLE")){n=e.next();let s={entries:[]};ug(n,e,s),t[s.name]=s}if(O(n,0)&&!O(n,0,"ENDTAB")){let s=n.value;n=e.next();let r=dg[s];if(!r){e.debug,n=e.next();continue}let a={};r(n,e,a),(i=t[s])==null||i.entries.push(a)}n=e.next()}return t}function pg(n,e){let t={};for(;!O(n,0,"EOF")&&!O(n,0,"ENDSEC");){if(O(n,0,"BLOCK")){let i=mg(n=e.next(),e);Qh(i),i.name&&(t[i.name]=i)}n=e.next()}return t}function mg(n,e){let t={};for(;!O(n,0,"EOF");){if(O(n,0,"ENDBLK")){for(n=e.next();!O(n,0,"EOF");){if(O(n,100,"AcDbBlockEnd"))return t;n=e.next()}break}switch(n.code){case 1:t.xrefPath=n.value;break;case 2:t.name=n.value;break;case 3:t.name2=n.value;break;case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 10:t.position=Ct(e);break;case 67:t.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(t.type=n.value);break;case 100:break;case 330:t.ownerHandle=n.value;break;case 0:t.entities=Jh(n,e)}n=e.next()}return t}let xt=[{code:330,name:"ownerObjectId",parser:l},{code:102,parser:$e},{code:102,parser:$e},{code:102,parser:$e},{code:5,name:"handle",parser:l}],ec=[{code:333,name:"shadePlotId",parser:l},{code:149,name:"imageOriginY",parser:l},{code:148,name:"imageOriginX",parser:l},{code:147,name:"scaleFactor",parser:l},{code:78,name:"shadePlotCustomDPI",parser:l},{code:77,name:"shadePlotResolution",parser:l},{code:76,name:"shadePlotMode",parser:l},{code:75,name:"standardScaleType",parser:l},{code:7,name:"currentStyleSheet",parser:l},{code:74,name:"plotType",parser:l},{code:73,name:"plotRotation",parser:l},{code:72,name:"plotPaperUnit",parser:l},{code:70,name:"layoutFlag",parser:l},{code:143,name:"printScaleDenominator",parser:l},{code:142,name:"printScaleNumerator",parser:l},{code:141,name:"windowAreaYMax",parser:l},{code:140,name:"windowAreaXMax",parser:l},{code:49,name:"windowAreaYMin",parser:l},{code:48,name:"windowAreaXMin",parser:l},{code:47,name:"plotOriginY",parser:l},{code:46,name:"plotOriginX",parser:l},{code:45,name:"paperHeight",parser:l},{code:44,name:"paperWidth",parser:l},{code:43,name:"marginTop",parser:l},{code:42,name:"marginRight",parser:l},{code:41,name:"marginBottom",parser:l},{code:40,name:"marginLeft",parser:l},{code:6,name:"plotViewName",parser:l},{code:4,name:"paperSize",parser:l},{code:2,name:"configName",parser:l},{code:1,name:"pageSetupName",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],yg=[{code:346,name:"orthographicUcsId",parser:l},{code:345,name:"namedUcsId",parser:l},{code:331,name:"viewportId",parser:l},{code:330,name:"paperSpaceTableId",parser:l},{code:76,name:"orthographicType",parser:l},{code:17,name:"ucsYAxis",parser:b},{code:16,name:"ucsXAxis",parser:b},{code:13,name:"ucsOrigin",parser:b},{code:146,name:"elevation",parser:l},{code:15,name:"maxExtent",parser:b},{code:14,name:"minExtent",parser:b},{code:12,name:"insertionPoint",parser:b},{code:11,name:"maxLimit",parser:b},{code:10,name:"minLimit",parser:b},{code:71,name:"tabOrder",parser:l},{code:70,name:"controlFlag",parser:l},{code:1,name:"layoutName",parser:l},{code:100,name:"subclassMarker",parser:l},...ec],_g=[{code:3,name:"entries",parser:(n,e)=>{let t={name:n.value};return(n=e.next()).code===350?t.objectSoftId=n.value:n.code===360?t.objectHardId=n.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:l},{code:280,name:"isHardOwned",parser:E},{code:100,name:"subclassMarker",parser:l},...xt],fg=[{code:40,name:"wcsToOCSTransform",parser:ja},{code:40,name:"ocsToWCSTransform",parser:ja},{code:41,name:"backClippingDistance",parser:l},{code:73,name:"isBackClipping",parser:E,pushContext:!0},{code:40,name:"frontClippingDistance",parser:l},{code:72,name:"isFrontClipping",parser:E,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:E},{code:11,name:"position",parser:b},{code:210,name:"normal",parser:b},{code:10,name:"boundaryVertices",parser:b,isMultiple:!0},{code:70,name:"boundaryCount",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...xt];function ja(n,e){let t=[];for(let i=0;i<3&&O(n,40);++i){let s=[];for(let r=0;r<4&&O(n,40);++r)s.push(n.value),n=e.next();t.push(s)}return e.rewind(),t}let xg=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:l},{code:90,name:"version",parser:l},{code:1,name:"fileName",parser:l},{code:10,name:"size",parser:b},{code:11,name:"sizeOfOnePixel",parser:b},{code:280,name:"isLoaded",parser:l},{code:281,name:"resolutionUnits",parser:l},{code:100,name:"subclassMarker",parser:l}],wg=[{code:179,name:"unknown1",parser:l},{code:170,name:"contentType",parser:l},{code:171,name:"drawMLeaderOrderType",parser:l},{code:172,name:"drawLeaderOrderType",parser:l},{code:90,name:"maxLeaderSegmentPoints",parser:l},{code:40,name:"firstSegmentAngleConstraint",parser:l},{code:41,name:"secondSegmentAngleConstraint",parser:l},{code:173,name:"leaderLineType",parser:l},{code:91,name:"leaderLineColor",parser:l},{code:340,name:"leaderLineTypeId",parser:l},{code:92,name:"leaderLineWeight",parser:l},{code:290,name:"landingEnabled",parser:E},{code:42,name:"landingGap",parser:l},{code:291,name:"doglegEnabled",parser:E},{code:43,name:"doglegLength",parser:l},{code:3,name:"description",parser:l},{code:341,name:"arrowheadId",parser:l},{code:44,name:"arrowheadSize",parser:l},{code:300,name:"defaultMTextContents",parser:l},{code:342,name:"textStyleId",parser:l},{code:174,name:"textLeftAttachmentType",parser:l},{code:175,name:"textAngleType",parser:l},{code:176,name:"textAlignmentType",parser:l},{code:178,name:"textRightAttachmentType",parser:l},{code:93,name:"textColor",parser:l},{code:45,name:"textHeight",parser:l},{code:292,name:"textFrameEnabled",parser:E},{code:297,name:"textAlignAlwaysLeft",parser:E},{code:46,name:"alignSpace",parser:l},{code:343,name:"blockContentId",parser:l},{code:94,name:"blockContentColor",parser:l},{code:47,name:"blockContentScale.x",parser:l},{code:49,name:"blockContentScale.y",parser:l},{code:140,name:"blockContentScale.z",parser:l},{code:293,name:"blockContentScaleEnabled",parser:E},{code:141,name:"blockContentRotation",parser:l},{code:294,name:"blockContentRotationEnabled",parser:E},{code:177,name:"blockContentConnectionType",parser:l},{code:142,name:"scale",parser:l},{code:295,name:"overwritePropertyValue",parser:E},{code:296,name:"annotative",parser:E},{code:143,name:"breakGapSize",parser:l},{code:271,name:"textAttachmentDirection",parser:l},{code:272,name:"bottomTextAttachmentDirection",parser:l},{code:273,name:"topTextAttachmentDirection",parser:l},{code:298,name:"unknown2",parser:l},{code:100,name:"subclassMarker",parser:l},...xt];function Pn(n,e,t){n.elements||(n.elements=[]);let i=n.elements.find(s=>s[e]===void 0);if(i){i[e]=t;return}n.elements.push({[e]:t})}let bg=[{code:6,parser:function({value:n},e,t){Pn(t,"lineType",n)},isMultiple:!0},{code:62,parser:function({value:n},e,t){var i;if(t.fillColorIndex===void 0&&!((i=t.elements)!=null&&i.length)){t.fillColorIndex=n;return}Pn(t,"colorIndex",n)},isMultiple:!0},{code:420,parser:function({value:n},e,t){var i;if(t.fillColor===void 0&&!((i=t.elements)!=null&&i.length)){t.fillColor=n;return}Pn(t,"color",n)},isMultiple:!0},{code:49,parser:function({value:n},e,t){Pn(t,"offset",n)},isMultiple:!0},{code:71,name:"elementCount",parser:l},{code:52,name:"endAngle",parser:l},{code:51,name:"startAngle",parser:l},{code:3,name:"description",parser:l},{code:70,name:"flags",parser:l},{code:2,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],Lg=[{code:340,name:"entityIds",parser:l,isMultiple:!0},{code:71,name:"isSelectable",parser:E},{code:70,name:"isUnnamed",parser:E},{code:300,name:"description",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],Sg=[{code:8,name:"layerNames",parser:l,isMultiple:!0},{code:100,name:"subclassMarker",parser:l},{code:100,name:"filterSubclassMarker",parser:l},...xt],Ag=[{code:90,name:"idBufferEntryCounts",parser:l,isMultiple:!0},{code:360,name:"idBufferIds",parser:l,isMultiple:!0},{code:8,name:"layerNames",parser:l,isMultiple:!0},{code:100,name:"subclassMarker",parser:l},{code:40,name:"timeStamp",parser:l},{code:100,name:"indexSubclassMarker",parser:l},...xt],Ig=[{code:75,name:"hasLastPointRef",parser:E},{code:1,name:"pointRefs",parser:function(n,e){let t={className:n.value};for(;;)switch((n=e.next()).code){case 72:t.objectOsnapType=n.value;continue;case 331:t.mainObjectId=n.value;continue;case 73:t.mainObjectSubentityType=n.value;continue;case 91:t.mainObjectGsMarker=n.value;continue;case 301:t.mainObjectXrefHandle=n.value;continue;case 40:t.nearOsnapGeometryParameter=n.value;continue;case 10:{let i=b(n,e);t.osnapPoint="z"in i?i:{...i,z:0}}continue;case 332:t.intersectionObjectId=n.value;continue;case 74:t.intersectionObjectSubentityType=n.value;continue;case 92:t.intersectionObjectGsMarker=n.value;continue;case 302:t.intersectionObjectXrefHandle=n.value;continue;default:return e.rewind(),t}},isMultiple:!0},{code:71,name:"rotatedDimensionType",parser:l},{code:70,name:"transSpaceFlag",parser:E},{code:90,name:"associativityFlag",parser:l},{code:330,name:"dimensionObjectId",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],Pg={LAYOUT:yg,PLOTSETTINGS:ec,DICTIONARY:_g,SPATIAL_FILTER:fg,IMAGEDEF:xg,MLEADERSTYLE:wg,MLINESTYLE:bg,GROUP:Lg,LAYER_FILTER:Sg,LAYER_INDEX:Ag,DIMASSOC:Ig};function Eg(n,e){let t=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let i=n.value,s=Pg[i];if(n.code===0&&(s!=null&&s.length)){let r=T(s),a={name:i};r(n=e.next(),e,a)?(t.push(a),n=e.peek()):n=e.next()}else n=e.next()}return{byName:Yd(t,({name:i})=>i)}}function Hi(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class Tg{constructor(){Hi(this,"encoding","utf-8"),Hi(this,"encodingFailureFatal",!1),Hi(this,"thumbnailImageFormat","base64")}}class Mg extends EventTarget{parseSync(e,t=!1){let i=new za(e.split(/\r\n|\r|\n/g),t);if(!i.hasNext())throw Error("Empty file");return this.parseAll(i)}parseStream(e){let t="",i=this;return new Promise((s,r)=>{e.on("data",a=>{t+=a}),e.on("end",()=>{try{let a=t.split(/\r\n|\r|\n/g),o=new za(a);if(!o.hasNext())throw Error("Empty file");s(i.parseAll(o))}catch(a){r(a)}}),e.on("error",a=>{r(a)})})}async parseFromUrl(e,t){let i=await fetch(e,t);if(!i.body)return null;let s=i.body.getReader(),r="";for(;;){let{done:a,value:o}=await s.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(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},i=e.next();for(;!O(i,0,"EOF");)O(i,0,"SECTION")&&(O(i=e.next(),2,"HEADER")?t.header=Zu(i=e.next(),e):O(i,2,"CLASSES")?wd(i=e.next(),e,t):O(i,2,"BLOCKS")?t.blocks=pg(i=e.next(),e):O(i,2,"ENTITIES")?t.entities=Jh(i=e.next(),e):O(i,2,"TABLES")?t.tables=gg(i=e.next(),e):O(i,2,"OBJECTS")?t.objects=Eg(i=e.next(),e):O(i,2,"THUMBNAILIMAGE")&&(t.thumbnailImage=function(s,r,a="base64"){let o,h="",c=0;for(;!O(s,0,"EOF")&&!O(s,0,"ENDSEC");)s.code===90?c=s.value:s.code===310&&(h+=s.value),s=r.next();if(a==="hex")o=h;else{let d=function(u){let p=u.length/2,g=new Uint8Array(p);for(let m=0;m<p;m++)g[m]=parseInt(u.substr(2*m,2),16);return g}(h);o=a==="buffer"?d:function(u){let p="";for(let g=0;g<u.length;g++)p+=String.fromCharCode(u[g]);return btoa(p)}(d)}return{size:c,data:o}}(i=e.next(),e,this._options.thumbnailImageFormat))),i=e.next();return t}constructor(e={}){super(),Hi(this,"_decoder",void 0),Hi(this,"_options",void 0);let t=new Tg;this._options=Object.assign(t,e),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(Ee={})[Ee.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ee[Ee.KEEP_EXISTING=1]="KEEP_EXISTING",Ee[Ee.USE_CLONE=2]="USE_CLONE",Ee[Ee.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ee[Ee.VALUE_NAME=4]="VALUE_NAME",Ee[Ee.UNMANGLE_NAME=5]="UNMANGLE_NAME";(qt={})[qt.NOUNIT=0]="NOUNIT",qt[qt.CENTIMETERS=2]="CENTIMETERS",qt[qt.INCH=5]="INCH";(Ci={})[Ci.PSLTSCALE=1]="PSLTSCALE",Ci[Ci.LIMCHECK=2]="LIMCHECK";(Kt={})[Kt.INCHES=0]="INCHES",Kt[Kt.MILLIMETERS=1]="MILLIMETERS",Kt[Kt.PIXELS=2]="PIXELS";(Te={})[Te.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Te[Te.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Te[Te.DRAWING_LIMITS=2]="DRAWING_LIMITS",Te[Te.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Te[Te.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Te[Te.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(ht={})[ht.AS_DISPLAYED=0]="AS_DISPLAYED",ht[ht.WIREFRAME=1]="WIREFRAME",ht[ht.HIDDEN=2]="HIDDEN",ht[ht.RENDERED=3]="RENDERED";(Me={})[Me.DRAFT=0]="DRAFT",Me[Me.PREVIEW=1]="PREVIEW",Me[Me.NORMAL=2]="NORMAL",Me[Me.PRESENTATION=3]="PRESENTATION",Me[Me.MAXIMUM=4]="MAXIMUM",Me[Me.CUSTOM=5]="CUSTOM";(ct={})[ct.NONE=0]="NONE",ct[ct.AbsoluteRotation=1]="AbsoluteRotation",ct[ct.TextEmbedded=2]="TextEmbedded",ct[ct.ShapeEmbedded=4]="ShapeEmbedded";(Ns={})[Ns.PaperSpace=1]="PaperSpace";(Zt={})[Zt.XrefDependent=16]="XrefDependent",Zt[Zt.XrefResolved=32]="XrefResolved",Zt[Zt.Referenced=64]="Referenced";(ke={})[ke.Off=0]="Off",ke[ke.Perspective=1]="Perspective",ke[ke.ClipFront=2]="ClipFront",ke[ke.ClipBack=4]="ClipBack",ke[ke.UcsFollow=8]="UcsFollow",ke[ke.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class kg{parse(e){const t=new Mg,i=this.getDxfInfoFromBuffer(e);let s="";return i.version&&i.version.value<=23&&i.encoding?s=new TextDecoder(i.encoding).decode(e):s=new TextDecoder().decode(e),t.parseSync(s)}getDxfInfoFromBuffer(e){var c,d,u;const i=new TextDecoder("utf-8");let s=0,r="",a=null,o=null,h=!1;for(;s<e.byteLength;){const p=Math.min(s+65536,e.byteLength),g=e.slice(s,p);s=p;const y=(r+i.decode(g,{stream:!0})).split(/\r?\n/);r=y.pop()??"";for(let _=0;_<y.length;_++){const f=y[_].trim();if(f==="SECTION"&&((c=y[_+2])==null?void 0:c.trim())==="HEADER")h=!0;else if(f==="ENDSEC"&&h)return{version:a,encoding:o};if(h&&f==="$ACADVER"){const S=(d=y[_+2])==null?void 0:d.trim();S&&(a=new ve(S))}else if(h&&f==="$DWGCODEPAGE"){const S=(u=y[_+2])==null?void 0:u.trim();if(S){const L=or[S];o=oo(L)}}if(a&&o)return{version:a,encoding:o}}}return{version:a,encoding:o}}}class Wa{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="3DFACE"?this.convertFace(e):e.type=="ARC"?this.convertArc(e):e.type=="ATTDEF"?this.convertAttributeDefinition(e):e.type=="ATTRIB"?this.convertAttribute(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="LWPOLYLINE"?this.convertLWPolyline(e):e.type=="MTEXT"?this.convertMText(e):e.type=="MLINE"?this.convertMLine(e):e.type=="MULTILEADER"||e.type=="MLEADER"?this.convertMLeader(e):e.type=="POLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertFace(e){const t=new Wn;return e.vertices.forEach((i,s)=>t.setVertexAt(s,i)),t}convertArc(e){const t=e.extrusionDirection??x.Z_AXIS;return new Dn(Ws(e.center,t),e.radius,k.degToRad(e.startAngle),k.degToRad(e.endAngle),t)}convertAttributeCommon(e,t){t.textString=e.text,t.height=e.textHeight,t.position.copy(e.startPoint);const i=e.alignmentPoint,s=!i||i.x===0&&i.y===0&&(i.z??0)===0;i&&!s?t.alignmentPoint.copy(i):t.alignmentPoint.copy(e.startPoint),t.rotation=e.rotation,t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.tag=e.tag,t.fieldLength=0,t.isInvisible=(e.attributeFlag&ne.Invisible)!==0,t.isConst=(e.attributeFlag&ne.Const)!==0,t.isVerifiable=(e.attributeFlag&ne.Verifiable)!==0,t.isPreset=(e.attributeFlag&ne.Preset)!==0,t.isReallyLocked=!!e.isReallyLocked,t.isMTextAttribute=(e.mtextFlag&We.MultiLine)!==0,t.isConstMTextAttribute=(e.mtextFlag&We.ConstMultiLine)!==0}convertAttribute(e){const t=new zn;return this.convertAttributeCommon(e,t),t.styleName=e.textStyle,t.horizontalMode=e.horizontalJustification,t.verticalMode=e.verticalJustification,t.widthFactor=e.scale??1,t.lockPositionInBlock=e.lockPositionFlag,t}convertAttributeDefinition(e){const t=new Vn;return this.convertAttributeCommon(e,t),t.styleName=e.styleName,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t.prompt=e.prompt,t}convertCirle(e){const t=e.extrusionDirection??x.Z_AXIS;return new Hn(Ws(e.center,t),e.radius,t)}convertEllipse(e){const t=new x(e.majorAxisEndPoint),i=t.length();return new jn(e.center,e.extrusionDirection??x.Z_AXIS,t,i,i*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,i=e.endPoint;return new Ki(new w(t.x,t.y,t.z||0),new w(i.x,i.y,i.z||0))}convertSpline(e){try{if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new Qi(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0)return new Qi(e.fitPoints,"Uniform",e.degree,!!(e.flag&1))}catch{}return null}convertPoint(e){const t=new Qn;return t.position=e.position,t}convertSolid(e){const t=new Kn;return e.points.forEach((i,s)=>t.setPointAt(s,i)),t.thickness=e.thickness,t}convertPolyline(e){var d;const t=!!(e.flag&1),i=!!(e.flag&8),s=!!(e.flag&16),r=!!(e.flag&64),a=!!(e.flag&32),o=[],h=[],c=[];if((d=e.vertices)==null||d.map(u=>{u.flag&ju.SPLINE_CONTROL_POINT||(r&&u.flag&128?u.flag&64?(o.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0)):u.faces&&u.faces.length>=3&&c.push([...u.faces]):(o.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0)))}),s){const u=e.meshMVertexCount,p=e.meshNVertexCount;return new ns(u,p,o,t,a)}else{if(r)return new ss(o,c);if(i){let u=Di.SimplePoly;return e.flag&4&&(e.smoothType==In.CUBIC?u=Di.CubicSplinePoly:e.smoothType==In.QUADRATIC&&(u=Di.QuadSplinePoly)),new Fn(u,o,t)}else{let u=hi.SimplePoly;return e.flag&2?u=hi.FitCurvePoly:e.flag&4&&(e.smoothType==In.CUBIC?u=hi.CubicSplinePoly:e.smoothType==In.QUADRATIC&&(u=hi.QuadSplinePoly)),new Bn(u,o,0,t,e.startWidth,e.endWidth,h)}}}convertLWPolyline(e){var s;const t=new Zn;t.closed=!!(e.flag&1);const i=e.constantWidth??-1;return(s=e.vertices)==null||s.forEach((r,a)=>{t.addVertexAt(a,new v(r.x,r.y),r.bulge,r.startWidth??i,r.endWidth??i)}),t}convertHatch(e){var s;const t=new qi;if((s=e.definitionLines)==null||s.forEach(r=>{t.definitionLines.push({angle:k.degToRad(r.angle||0),base:r.base,offset:r.offset,dashLengths:r.numberOfDashLengths>0?r.dashLengths:[]})}),t.isSolidFill=e.solidFill==ud.SolidFill,t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:k.degToRad(e.patternAngle),t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(r=>{if(r.boundaryPathTypeFlag&2){const o=r,h=new ce;h.closed=o.isClosed,o.vertices.forEach((c,d)=>{h.addVertexAt(d,{x:c.x,y:c.y,bulge:c.bulge})}),t.add(h)}else{const o=r,h=[];o.edges.forEach(d=>{if(d.type==1){const u=d;h.push(new Ge(u.start,u.end))}else if(d.type==2){const u=d;h.push(new Mt(u.center,u.radius,k.degToRad(u.startAngle||0),k.degToRad(u.endAngle||0),!u.isCCW))}else if(d.type==3){const u=d;new K().subVectors(u.end,u.center);const g=Math.sqrt(Math.pow(u.end.x,2)+Math.pow(u.end.y,2)),m=g*u.lengthOfMinorAxis;let y=k.degToRad(u.startAngle||0),_=k.degToRad(u.endAngle||0);const f=Math.atan2(u.end.y,u.end.x);u.isCCW||(y=Math.PI*2-y,_=Math.PI*2-_),h.push(new Ui({...u.center,z:0},g,m,y,_,!u.isCCW,f))}else if(d.type==4){const u=d;if(u.numberOfControlPoints>0&&u.numberOfKnots>0){const p=u.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let g=!0;const m=u.controlPoints.map(y=>(y.weight==null&&(g=!1),y.weight||1));h.push(new Ue(p,u.knots,g?m:void 0))}else if(u.numberOfFitData>0){const p=u.fitDatum.map(g=>({x:g.x,y:g.y,z:0}));h.push(new Ue(p,"Uniform"))}}});const c=$i.buildFromEdges(h);c.length==0&&h.length>0?t.add(new $i(h)):c.forEach(d=>t.add(d))}}),e.gradientFlag){const r=e;if(t.hatchObjectType=Sr.GradientObject,t.gradientName=r.gradientName,t.gradientAngle=r.gradientRotation??0,t.gradientShift=r.gradientDefinition??0,t.gradientOneColorMode=r.gradientColorFlag==1,t.shadeTintValue=r.colorTint??0,r.gradientColors){const a=r.gradientColors.length;a>1?(t.gradientStartColor=r.gradientColors[0].rgb,t.gradientEndColor=r.gradientColors[1].rgb):a>0&&(t.gradientStartColor=r.gradientColors[0].rgb)}}return t}convertTable(e){const t=new qn(e.name,e.rowCount,e.columnCount);return t.tableDataVersion=e.version,t.tableStyleId=e.tableStyleId,t.owningBlockRecordId=e.blockRecordHandle,e.directionVector&&(t.horizontalDirection=new x(e.directionVector)),t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),t.tableValueFlag=e.tableValue,t.tableOverrideFlag=e.overrideFlag,t.borderColorOverrideFlag=e.borderColorOverrideFlag,t.borderLineweightOverrideFlag=e.borderLineWeightOverrideFlag,t.borderVisibilityOverrideFlag=e.borderVisibilityOverrideFlag,e.columnWidthArr.forEach((i,s)=>t.setColumnWidth(s,i)),e.rowHeightArr.forEach((i,s)=>t.setRowHeight(s,i)),e.cells.forEach((i,s)=>{t.setCell(s,i)}),t}convertText(e){const t=new pi;t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint);const i=e.endPoint,s=!i||i.x===0&&i.y===0&&(i.z??0)===0;return i&&!s?t.alignmentPoint.copy(i):t.alignmentPoint.copy(e.startPoint),t.rotation=k.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new Zi;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=k.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new x(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){var i;const t=new Gn;return(i=e.vertices)==null||i.forEach(s=>{t.appendVertex(s)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isHookLineSameDirection=e.isHooklineSameDirection,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName??"",t.annoType=e.leaderCreationFlag,t.textHeight=e.textHeight??0,t.textWidth=e.textWidth??0,t.byBlockColor=e.byBlockColor,t.associatedAnnotation=e.associatedAnnotation??"",e.normal&&(t.normal=e.normal),e.horizontalDirection&&(t.horizontalDirection=e.horizontalDirection),e.offsetFromBlock&&(t.offsetFromBlock=e.offsetFromBlock),e.offsetFromAnnotation&&(t.offsetFromAnnotation=e.offsetFromAnnotation),t}convertMLine(e){const t=new Un;return t.styleName=e.name||"STANDARD",t.styleObjectHandle=e.styleObjectHandle,t.scale=e.scale,t.justification=e.justification,t.flags=e.flags,t.styleCount=e.styleCount,t.startPosition=e.startPosition,t.normal=e.extrusionDirection??x.Z_AXIS,t.segments=(e.segments??[]).map(i=>{var s;return{position:i.position,direction:i.direction,miterDirection:i.miterDirection,elements:((s=i.elements)==null?void 0:s.map(r=>({parameterCount:r.parameterCount,parameters:r.parameters??[],fillCount:r.fillCount,fillParameters:r.fillParameters??[]})))??[]}}),t}convertMLeader(e){var L,M;const t=new $n,i=e;t.version=e.version,t.leaderStyleId=e.leaderStyleId,e.leaderStyleId&&(t.mleaderStyleId=e.leaderStyleId),t.propertyOverrideFlag=e.propertyOverrideFlag,t.leaderLineType=e.leaderLineType??gi.StraightLeader,t.leaderLineColor=e.leaderLineColor,t.leaderLineTypeId=e.leaderLineTypeId,t.leaderLineWeight=e.leaderLineWeight,t.landingEnabled=e.landingEnabled,t.doglegEnabled=e.doglegEnabled??!1,t.doglegLength=e.doglegLength??0,t.arrowheadId=e.arrowheadId,t.arrowheadSize=e.arrowheadSize,t.textStyleId=e.textStyleId,t.textLeftAttachmentType=e.textLeftAttachmentType,t.textRightAttachmentType=e.textRightAttachmentType,t.textAngleType=e.textAngleType,t.textAlignmentType=e.textAlignmentType,t.textColor=e.textColor,t.textFrameEnabled=e.textFrameEnabled,t.landingGap=e.landingGap,t.textAttachment=e.textAttachment,t.textFlowDirection=e.textFlowDirection,t.blockContentId=e.blockContentId,t.blockContentColor=e.blockContentColor,t.blockContentRotation=e.blockContentRotation,t.blockContentConnectionType=e.blockContentConnectionType,t.annotativeScaleEnabled=e.annotativeScaleEnabled,t.arrowheadOverrides=e.arrowheadOverrides?e.arrowheadOverrides.map(I=>({...I})):[],t.blockAttributes=e.blockAttributes?e.blockAttributes.map(I=>({...I})):[],t.textDirectionNegative=e.textDirectionNegative,t.textAlignInIPE=e.textAlignInIPE,t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection,t.topTextAttachmentDirection=e.topTextAttachmentDirection,t.contentScale=e.contentScale,t.textLineSpacingStyle=e.textLineSpacingStyle,t.textBackgroundColor=e.textBackgroundColor,t.textBackgroundScaleFactor=e.textBackgroundScaleFactor,t.textBackgroundTransparency=e.textBackgroundTransparency,t.textBackgroundColorOn=e.textBackgroundColorOn,t.textFillOn=e.textFillOn,t.textColumnType=e.textColumnType,t.textUseAutoHeight=e.textUseAutoHeight,t.textColumnWidth=e.textColumnWidth,t.textColumnGutterWidth=e.textColumnGutterWidth,t.textColumnFlowReversed=e.textColumnFlowReversed,t.textColumnHeight=e.textColumnHeight,t.textUseWordBreak=e.textUseWordBreak,t.hasMText=e.hasMText,t.hasBlock=e.hasBlock,t.planeNormalReversed=e.planeNormalReversed,e.blockContentScale&&(t.blockContentScale=new x(e.blockContentScale)),e.contentBasePosition&&(t.contentBasePosition=new w().copy(e.contentBasePosition)),e.textAnchor&&(t.textAnchor=new w().copy(e.textAnchor)),e.planeOrigin&&(t.planeOrigin=new w().copy(e.planeOrigin)),e.planeXAxisDirection&&(t.planeXAxisDirection=new x(e.planeXAxisDirection)),e.planeYAxisDirection&&(t.planeYAxisDirection=new x(e.planeYAxisDirection));const s=i.textContent,r=s&&typeof s=="object"?s:void 0,a=typeof s=="string"&&s.length>0||this.readString(r??{},["text","contents"])!=null||this.readString(i,["text","contents","mtext"])!=null,o=e.contentType??(a?mt.MTextContent:e.blockContent?mt.BlockContent:mt.NoneContent);t.contentType=o;const h=this.readPoint(i,["normal","extrusionDirection"]);h&&(t.normal=h);const c=this.readString(r??{},["styleName","textStyleName","textStyle"])??this.readString(i,["textStyleName","textStyle","styleName","textStyleId"]);c&&(t.textStyleName=c);const d=this.readPositiveNumber(r??{},["textHeight","height"])??this.readPositiveNumber(i,["textHeight","mtextHeight","textContentHeight"])??this.readPositiveNumber(i,["arrowheadSize","contentScale"]);d!=null&&(t.textHeight=d);const u=this.readPositiveNumber(r??{},["textWidth","width"])??this.readPositiveNumber(i,["textWidth","mtextWidth","textContentWidth"]);u!=null&&(t.textWidth=u),t.textLineSpacingFactor=this.readNumber(r??{},["lineSpacingFactor","textLineSpacingFactor"])??this.readNumber(i,["textLineSpacingFactor"])??t.textLineSpacingFactor;const p=this.readNumber(r??{},["textRotation","rotation"])??this.readNumber(i,["textRotation","mtextRotation","textContentRotation"]);p!=null&&(t.textRotation=k.degToRad(p));const g=this.readPoint(i,["textDirection","mtextDirection","textDirectionVector"]);g&&(t.textDirection=g);const m=this.readNumber(i,["textAttachmentPoint","attachmentPoint"]);m!=null&&(t.textAttachmentPoint=m);const y=e.textAttachmentDirection;y!=null&&(t.textAttachmentDirection=y);const _=this.readNumber(i,["textDrawingDirection","drawingDirection"]);_!=null&&(t.textDrawingDirection=_);const f=typeof s=="string"?s:this.readString(r??{},["text","contents"])??this.readString(i,["text","contents","mtext"]),S=this.readPoint(r??{},["anchorPoint","textAnchor","textLocation","textPosition","textAnchorPoint"])??this.readPoint(i,["textAnchor","textLocation","textPosition","textAnchorPoint","contentBasePosition"]);if(f!=null&&S&&(t.mtextContent={text:f,anchorPoint:S}),e.blockContent){const I=e.blockContent;t.blockContent={blockContentId:e.blockContent.blockContentId,normal:this.readPoint(I,["normal"]),position:e.blockContent.position,scale:this.readPoint(I,["scale"]),rotation:this.readNumber(I,["rotation"]),color:this.readNumber(I,["color"]),transformationMatrix:Array.isArray(e.blockContent.transformationMatrix)?e.blockContent.transformationMatrix:[]}}else e.blockContentId&&(t.blockContent={blockContentId:e.blockContentId,scale:e.blockContentScale,rotation:e.blockContentRotation,color:e.blockContentColor,transformationMatrix:[]});return(L=this.readMLeaderLeaders(i))==null||L.forEach(I=>{t.addLeader({lastLeaderLinePoint:I.lastLeaderLinePoint,lastLeaderLinePointSet:I.lastLeaderLinePointSet,doglegVector:I.doglegVector,doglegVectorSet:I.doglegVectorSet,doglegLength:I.doglegLength??e.doglegLength,breaks:I.breaks,leaderBranchIndex:I.leaderBranchIndex,leaderLines:I.leaderLines})}),t.numberOfLeaders===0&&((M=this.readLeaderLineArray(i))==null||M.forEach(I=>{t.addLeader({doglegLength:e.doglegLength}),t.addLeaderLine(t.numberOfLeaders-1,I)})),t.numberOfLeaders===0&&e.contentBasePosition&&t.addLeader({lastLeaderLinePoint:e.contentBasePosition,lastLeaderLinePointSet:!0,doglegLength:e.doglegLength}),t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"){const t=e,i=new en(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(i.dimBlockPosition={...t.insertionPoint,z:0}),i.rotation=k.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbRotatedDimension"){const t=e,i=new cs(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(i.dimBlockPosition={...t.insertionPoint,z:0}),i.rotation=k.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,i=new as(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,i=new ls(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,i=new hs(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,i=new os(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,i),i}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(i=>{t.clipBoundary.push(new v(i))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new Ji;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(i=>{t.clipBoundary.push(new v(i))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new ts;return this.processWipeout(e,t),t}convertViewport(e){const t=new es;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new Jn;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new is;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new ni(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?k.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(e,t){t.layer=e.layer||"0",e.handle&&(t.objectId=e.handle.toString()),t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null&&t.color.setRGBValue(e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=!e.isVisible),e.transparency!=null&&(t.transparency=J.deserialize(e.transparency))}readNumber(e,t){for(const i of t){const s=e[i];if(typeof s=="number"&&Number.isFinite(s))return s}}readPositiveNumber(e,t){const i=this.readNumber(e,t);return i!=null&&i>0?i:void 0}readString(e,t){for(const i of t){const s=e[i];if(typeof s=="string")return s}}readBoolean(e,t){for(const i of t){const s=e[i];if(typeof s=="boolean")return s;if(typeof s=="number")return s!==0}}readPoint(e,t){for(const i of t){const s=e[i];if(this.isPointLike(s))return s;if(Array.isArray(s)&&typeof s[0]=="number"&&typeof s[1]=="number")return{x:s[0],y:s[1],z:s[2]??0}}}readLeaderLineArray(e){const t=e.leaderLines;if(Array.isArray(t))return t.map(s=>{if(!s||typeof s!="object")return;const r=s.vertices;return Array.isArray(r)?r.filter(a=>this.isPointLike(a)):void 0}).filter(s=>!!s&&s.length>0);const i=e.vertices;if(Array.isArray(i)){const s=i.filter(r=>this.isPointLike(r));return s.length>0?[s]:void 0}}readMLeaderLeaders(e){const t=e.leaderSections;if(!Array.isArray(t))return;const i=[];return t.forEach(s=>{if(!s||typeof s!="object")return;const r=s,a=r.leaderLines,o=Array.isArray(a)?a.reduce((m,y)=>{const _=this.readMLeaderLine(y);return _&&m.push(_),m},[]):void 0,h={},c=this.readPoint(r,["lastLeaderLinePoint"]),d=this.readPoint(r,["doglegVector"]),u=this.readNumber(r,["doglegLength"]),p=this.readMLeaderBreaks(r.breaks),g=this.readNumber(r,["leaderBranchIndex"]);c&&(h.lastLeaderLinePoint=c),r.lastLeaderLinePointSet!=null&&(h.lastLeaderLinePointSet=this.readBoolean(r,["lastLeaderLinePointSet"])),d&&(h.doglegVector=d),r.doglegVectorSet!=null&&(h.doglegVectorSet=this.readBoolean(r,["doglegVectorSet"])),u!=null&&(h.doglegLength=u),p&&(h.breaks=p),g!=null&&(h.leaderBranchIndex=g),o&&(h.leaderLines=o),i.push(h)}),i}readMLeaderLine(e){if(!e||typeof e!="object")return;const t=e,i=t.vertices,s=Array.isArray(i)?i.filter(h=>this.isPointLike(h)):[],r=this.readMLeaderBreaks(t.breaks),a=Array.isArray(t.breakPointIndexes)?t.breakPointIndexes.filter(h=>typeof h=="number"):void 0,o=this.readNumber(t,["leaderLineIndex"]);return s.length>0||r&&r.length>0?{vertices:s,breakPointIndexes:a,leaderLineIndex:o,breaks:r}:void 0}readMLeaderBreaks(e){if(!Array.isArray(e))return;const t=e.map(i=>{if(!i||typeof i!="object")return;const s=i,r=this.readPoint(s,["start"]),a=this.readPoint(s,["end"]),o=this.readNumber(s,["index"]);if(!r||!a)return;const h={start:r,end:a};return o!=null&&(h.index=o),h}).filter(i=>!!i);return t.length>0?t:void 0}isPointLike(e){return!!e&&typeof e=="object"&&typeof e.x=="number"&&typeof e.y=="number"}}class Cg{convertLayout(e,t){var r,a;const i=new on;i.layoutName=e.layoutName,i.tabOrder=e.tabOrder,i.plotSettingsName=e.pageSetupName,i.plotCfgName=e.configName,i.canonicalMediaName=e.paperSize,i.plotViewName=e.plotViewName,i.currentStyleSheet=e.currentStyleSheet,i.plotPaperMargins={left:e.marginLeft,right:e.marginRight,top:e.marginTop,bottom:e.marginBottom},i.plotPaperSize.copy({x:e.paperWidth,y:e.paperHeight}),i.plotOrigin.copy({x:e.plotOriginX,y:e.plotOriginY}),i.plotWindowArea.min.copy({x:e.windowAreaXMin,y:e.windowAreaYMin}),i.plotWindowArea.max.copy({x:e.windowAreaXMax,y:e.windowAreaYMax}),i.customPrintScale={numerator:e.printScaleNumerator,denominator:e.printScaleDenominator},i.plotPaperUnits=e.plotPaperUnit,i.plotRotation=e.plotRotation,i.plotType=e.plotType,i.stdScaleType=e.standardScaleType,i.shadePlot=(()=>{switch(e.shadePlotMode){case 1:return ci.kWireframe;case 2:return ci.kHidden;case 3:return ci.kRendered;default:return ci.kAsDisplayed}})(),i.shadePlotResLevel=(()=>{switch(e.shadePlotResolution){case 1:return Lt.kPreview;case 2:return Lt.kNormal;case 3:return Lt.kPresentation;case 4:return Lt.kMaximum;case 5:return Lt.kCustom;default:return Lt.kDraft}})(),e.shadePlotCustomDPI!=null&&(i.shadePlotCustomDPI=e.shadePlotCustomDPI),e.shadePlotId&&(i.shadePlotId=e.shadePlotId);const s=e.layoutFlag??0;if(i.plotViewportBorders=(s&1)!==0,i.showPlotStyles=(s&2)!==0,i.plotCentered=(s&4)!==0,i.plotHidden=(s&8)!==0,i.useStandardScale=(s&16)!==0,i.plotPlotStyles=(s&32)!==0,i.scaleLineweights=(s&64)!==0,i.printLineweights=(s&128)!==0,i.drawViewportsFirst=(s&512)!==0,i.modelType=(s&1024)!==0,e.viewportId&&i.viewportArray.push(e.viewportId),e.layoutName==="Model"){const o=ie.MODEL_SPACE_NAME.toUpperCase();(r=t.tables.BLOCK_RECORD)==null||r.entries.some(h=>h.name.toUpperCase()===o?(i.blockTableRecordId=h.handle,!0):!1)}else(a=t.tables.BLOCK_RECORD)==null||a.entries.some(o=>o.layoutObjects===e.handle?(i.blockTableRecordId=o.handle,!0):!1),i.blockTableRecordId||(i.blockTableRecordId=e.paperSpaceTableId);return e.minLimit&&i.limits.min.copy(e.minLimit),e.maxLimit&&i.limits.max.copy(e.maxLimit),e.minExtent&&i.extents.min.copy(e.minExtent),e.maxExtent&&i.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,i),i}convertImageDef(e){const t=new bl;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}convertMLeaderStyle(e){const t=new Ar;return t.unknown1=e.unknown1,e.contentType!=null&&(t.contentType=e.contentType),e.drawMLeaderOrderType!=null&&(t.drawMLeaderOrderType=e.drawMLeaderOrderType),e.drawLeaderOrderType!=null&&(t.drawLeaderOrderType=e.drawLeaderOrderType),e.maxLeaderSegmentPoints!=null&&(t.maxLeaderSegmentPoints=e.maxLeaderSegmentPoints),e.firstSegmentAngleConstraint!=null&&(t.firstSegmentAngleConstraint=e.firstSegmentAngleConstraint),e.secondSegmentAngleConstraint!=null&&(t.secondSegmentAngleConstraint=e.secondSegmentAngleConstraint),e.leaderLineType!=null&&(t.leaderLineType=e.leaderLineType),e.leaderLineColor!=null&&(t.leaderLineColor=zi(e.leaderLineColor)),t.leaderLineTypeId=e.leaderLineTypeId,e.leaderLineWeight!=null&&(t.leaderLineWeight=e.leaderLineWeight),e.landingEnabled!=null&&(t.landingEnabled=e.landingEnabled),e.landingGap!=null&&(t.landingGap=e.landingGap),e.doglegEnabled!=null&&(t.doglegEnabled=e.doglegEnabled),e.doglegLength!=null&&(t.doglegLength=e.doglegLength),e.description!=null&&(t.description=e.description),t.arrowheadId=e.arrowheadId,e.arrowheadSize!=null&&(t.arrowheadSize=e.arrowheadSize),e.defaultMTextContents!=null&&(t.defaultMTextContents=e.defaultMTextContents),t.textStyleId=e.textStyleId,e.textLeftAttachmentType!=null&&(t.textLeftAttachmentType=e.textLeftAttachmentType),e.textAngleType!=null&&(t.textAngleType=e.textAngleType),e.textAlignmentType!=null&&(t.textAlignmentType=e.textAlignmentType),e.textRightAttachmentType!=null&&(t.textRightAttachmentType=e.textRightAttachmentType),e.textColor!=null&&(t.textColor=zi(e.textColor)),e.textHeight!=null&&(t.textHeight=e.textHeight),e.textFrameEnabled!=null&&(t.textFrameEnabled=e.textFrameEnabled),e.textAlignAlwaysLeft!=null&&(t.textAlignAlwaysLeft=e.textAlignAlwaysLeft),e.alignSpace!=null&&(t.alignSpace=e.alignSpace),t.blockContentId=e.blockContentId,e.blockContentColor!=null&&(t.blockContentColor=zi(e.blockContentColor)),e.blockContentScale&&(t.blockContentScale={x:e.blockContentScale.x,y:e.blockContentScale.y,z:e.blockContentScale.z??1}),e.blockContentScaleEnabled!=null&&(t.blockContentScaleEnabled=e.blockContentScaleEnabled),e.blockContentRotation!=null&&(t.blockContentRotation=e.blockContentRotation),e.blockContentRotationEnabled!=null&&(t.blockContentRotationEnabled=e.blockContentRotationEnabled),e.blockContentConnectionType!=null&&(t.blockContentConnectionType=e.blockContentConnectionType),e.scale!=null&&(t.scale=e.scale),e.overwritePropertyValue!=null&&(t.overwritePropertyValue=e.overwritePropertyValue),e.annotative!=null&&(t.annotative=e.annotative),e.breakGapSize!=null&&(t.breakGapSize=e.breakGapSize),e.textAttachmentDirection!=null&&(t.textAttachmentDirection=e.textAttachmentDirection),e.bottomTextAttachmentDirection!=null&&(t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection),e.topTextAttachmentDirection!=null&&(t.topTextAttachmentDirection=e.topTextAttachmentDirection),t.unknown2=e.unknown2,this.processCommonAttrs(e,t),t}convertMLineStyle(e){var s;const t=new Ir;if(e.styleName!=null&&(t.styleName=e.styleName),e.flags!=null&&(t.flags=e.flags),e.description!=null&&(t.description=e.description),e.fillColor!=null)t.fillColor=new X().setRGBValue(e.fillColor);else if(e.fillColorIndex!=null){const r=new X;r.colorIndex=e.fillColorIndex,t.fillColor=r}e.startAngle!=null&&(t.startAngle=e.startAngle),e.endAngle!=null&&(t.endAngle=e.endAngle);const i=Math.max(e.elementCount??0,((s=e.elements)==null?void 0:s.length)??0);return i>0&&(t.elements=Array.from({length:i},(r,a)=>{var o,h,c,d;return{offset:((h=(o=e.elements)==null?void 0:o[a])==null?void 0:h.offset)??0,color:(()=>{var p,g,m,y;const u=new X;return((g=(p=e.elements)==null?void 0:p[a])==null?void 0:g.color)!=null?u.setRGBValue(e.elements[a].color):u.colorIndex=((y=(m=e.elements)==null?void 0:m[a])==null?void 0:y.colorIndex)??256,u})(),lineType:((d=(c=e.elements)==null?void 0:c[a])==null?void 0:d.lineType)??"BYLAYER"}})),this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}}class tc{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const i=Date.now(),s=this.generateTaskId();try{return await this.executeInWorker(s,e,t||this.config.workerUrl)}catch(r){const a=Date.now()-i;return{success:!1,error:r instanceof Error?r.message:String(r),duration:a}}}async executeInWorker(e,t,i){const s=Date.now();return new Promise((r,a)=>{const o=this.getAvailableWorker(i),h=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(o),a(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:u=>{clearTimeout(h),this.releaseWorker(o),r(u)},reject:u=>{clearTimeout(h),this.releaseWorker(o),a(u)},timeout:h});const c=u=>{const{id:p,success:g,data:m,error:y}=u.data;if(p!==e)return;this.cleanupTask(e);const _=Date.now()-s;r(g?{success:!0,data:m,duration:_}:{success:!1,error:y,duration:_})},d=u=>{this.cleanupTask(e),a(new Error(`Worker error: ${u.message}`))};o.addEventListener("message",c),o.addEventListener("error",d),o.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[i,s]of this.workers)if(!s.isBusy)return s.isBusy=!0,s.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const i=new Worker(e,{type:"module"}),s=this.generateWorkerId(),r={worker:i,isBusy:!0,id:s,createdAt:new Date};return this.workers.set(s,r),i}const t=Array.from(this.workers.values()).sort((i,s)=>i.createdAt.getTime()-s.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,i]of this.workers)if(i.worker===e){i.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(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class ic{constructor(e){this.framework=new tc(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function nc(n){return new ic(n)}class vg{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:i}=e.data;try{const s=await this.executeTask(i);this.sendResponse(t,!0,s)}catch(s){this.sendResponse(t,!1,void 0,s instanceof Error?s.message:String(s))}}}sendResponse(e,t,i,s){const r={id:e,success:t,data:i,error:s};self.postMessage(r)}}class sc extends Nr{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e,t){const i=this.config,s=this.getParserWorkerTimeout(e,t);if(i.useWorker&&i.parserWorkerUrl){const r=nc({workerUrl:i.parserWorkerUrl,timeout:s,maxConcurrentWorkers:1}),a=await r.execute(e);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 kg().parse(e),data:{unknownEntityCount:0}}}getFonts(e){var r;const t=new Map,i=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(r=e.tables.STYLE)==null||r.entries.forEach(a=>{const o=[];if(a.font){const h=i(a.font);h&&o.push(h)}if(a.bigFont){const h=i(a.bigFont);h&&o.push(h)}if(a.extendedFont){const h=i(a.extendedFont);h&&o.push(h)}t.set(a.name,o)});const s=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,s),Array.from(s)}getFontsInBlock(e,t,i,s){const r=/\\f(.*?)\|/g;e.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.matchAll(r)].forEach(d=>{s.add(d[1].toLowerCase())});const c=i.get(o.styleName);c==null||c.forEach(d=>s.add(d))}else if(a.type=="TEXT"){const o=a,h=i.get(o.styleName);h==null||h.forEach(c=>s.add(c))}else if(a.type=="MULTILEADER"||a.type=="MLEADER"){const o=a;[...(typeof o.textContent=="string"?o.textContent:"").matchAll(r)].forEach(u=>{s.add(u[1].toLowerCase())});const c=typeof o.textStyleName=="string"?o.textStyleName:typeof o.styleName=="string"?o.styleName:void 0,d=c?i.get(c):void 0;d==null||d.forEach(u=>s.add(u))}else if(a.type=="INSERT"){const h=t[a.name];h&&h.entities&&this.getFontsInBlock(h.entities,t,i,s)}})}async processEntities(e,t,i,s,r){const a=new Wa;let o=e.entities;const h=o.length,c=new rr(h,100-s.value,i);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const d=new Map;for(let p=0;p<h;p++){const g=o[p];if(g.type==="ATTRIB"){const m=a.convert(g);if(m&&m.ownerId&&m.ownerId!=="0"){let y=d.get(m==null?void 0:m.ownerId);y==null&&(y=[],d.set(m.ownerId,y)),y.push(m)}}}const u=t.tables.blockTable.modelSpace;await c.processChunk(async(p,g)=>{let m=[],y=p<g?o[p].type:"";for(let f=p;f<g;f++){const S=o[f];if(!(S.ownerBlockRecordSoftId&&S.ownerBlockRecordSoftId!==u.objectId)&&S.type!=="ATTRIB"){const L=a.convert(S);if(L){if(this.config.convertByEntityType&&S.type!==y&&(u.appendEntity(m),m=[],y=S.type),S.type==="INSERT"){const M=d.get(L.objectId);M&&M.length>0&&M.forEach(I=>{L.appendAttributes(I)})}m.push(L)}}}u.appendEntity(m);let _=s.value+g/h*(100-s.value);_>100&&(_=100),r&&await r(_,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(e,t,i=!1){const s=new Wa,r=e.length,a=[],o=t.objectId,h=[];for(let c=0;c<r;c++){const d=e[c],u=s.convert(d);u&&(d.type==="ATTRIB"?h.push(u):(!i||d.ownerBlockRecordSoftId===o)&&a.push(u))}t.appendEntity(a),h.forEach(c=>{const d=t.getIdAt(c.ownerId);d&&d.appendAttributes(c)})}processBlocks(e,t){const i=e.blocks;for(const[s,r]of Object.entries(i)){let a=t.tables.blockTable.getAt(r.name);a||(a=new ie,a.objectId=r.handle,a.name=s,a.origin.copy(r.position),t.tables.blockTable.add(a)),r.entities?this.processEntitiesInBlock(r.entities,a):a.isPaperSapce&&this.processEntitiesInBlock(e.entities,a,!0)}}processHeader(e,t){const i=e.header;i.$ACADVER&&(t.version=i.$ACADVER),t.cecolor.colorIndex=i.$CECOLOR||256,t.angBase=i.$ANGBASE||0,t.angDir=i.$ANGDIR||0,i.$AUNITS!=null&&(t.aunits=i.$AUNITS),t.celtype=i.$CELTYPE||pe,Ne.instance().setVar(A.CETRANSPARENCY,i.$CETRANSPARENCY||"ByLayer",t),t.celtscale=i.$CELTSCALE||1;const s=this.normalizeHeaderStringValue(i.$CMLSTYLE)||this.normalizeHeaderStringValue(i.CMLSTYLE)||gt;t.cmlstyle=s;const r=i.$CMLSCALE??i.CMLSCALE;typeof r=="number"&&Number.isFinite(r)&&(t.cmlscale=r);const a=this.normalizeHeaderStringValue(i.$CMLEADERSTYLE)||this.normalizeHeaderStringValue(i.CMLEADERSTYLE)||pt;t.cmleaderstyle=a,t.hplayer=this.normalizeHeaderStringValue(i.$HPLAYER)||this.normalizeHeaderStringValue(i.HPLAYER)||".",t.ltscale=i.$LTSCALE||1,i.$EXTMAX&&(t.extmax=i.$EXTMAX),i.$EXTMIN&&(t.extmin=i.$EXTMIN),i.$INSUNITS!=null&&(t.insunits=i.$INSUNITS),t.osmode=i.$OSMODE||0,t.pdmode=i.$PDMODE||0,t.pdsize=i.$PDSIZE||0,t.textstyle=i.$TEXTSTYLE||Q}processBlockTables(e,t){var s;const i=(s=e.tables.BLOCK_RECORD)==null?void 0:s.entries;i&&i.length>0&&(t.tables.blockTable.removeAll(),i.forEach(r=>{const a=new ie;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),t.tables.blockTable.add(a)}))}processObjects(e,t){const i=e.objects.byName,s=new Cg;if("LAYOUT"in i){const r=t.objects.layout;i.LAYOUT.forEach(a=>{const o=s.convertLayout(a,e);r.setAt(o.layoutName,o)})}if("IMAGEDEF"in i){const r=t.objects.imageDefinition;i.IMAGEDEF.forEach(a=>{const o=s.convertImageDef(a);r.setAt(o.objectId,o)})}if("MLEADERSTYLE"in i){const r=t.objects.mleaderStyle;i.MLEADERSTYLE.forEach(a=>{const o=s.convertMLeaderStyle(a);r.setAt(o.objectId,o)})}if("MLINESTYLE"in i){const r=t.objects.mlineStyle;i.MLINESTYLE.forEach(a=>{const o=s.convertMLineStyle(a);r.setAt(o.styleName||o.objectId,o)})}}processViewports(e,t){var s;const i=(s=e.tables)==null?void 0:s.VPORT;if(i){this.processCommonTableAttrs(i,t.tables.viewportTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new vr;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),t.tables.viewportTable.add(o)})}}processLayers(e,t){var s;const i=(s=e.tables)==null?void 0:s.LAYER;if(i){this.processCommonTableAttrs(i,t.tables.layerTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new X;o.colorIndex=a.colorIndex;const h=new _s({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,h),t.tables.layerTable.add(h)})}}processLineTypes(e,t){var s;const i=(s=e.tables)==null?void 0:s.LTYPE;if(i){this.processCommonTableAttrs(i,t.tables.linetypeTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new Et(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,t.tables.linetypeTable.add(o)})}}processTextStyles(e,t){var s;const i=(s=e.tables)==null?void 0:s.STYLE;if(i){this.processCommonTableAttrs(i,t.tables.textStyleTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new fs(a);this.processCommonTableEntryAttrs(a,o),t.tables.textStyleTable.add(o)})}}processDimStyles(e,t){var s;const i=(s=e.tables)==null?void 0:s.DIMSTYLE;if(i){this.processCommonTableAttrs(i,t.tables.dimStyleTable);const r=i.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||Q,dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},h=new si(o);this.processCommonTableEntryAttrs(a,h),t.tables.dimStyleTable.add(h)})}}processCommonTableAttrs(e,t){e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}processCommonTableEntryAttrs(e,t){t.name="name"in e?e.name:"",e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}groupAndFlattenByType(e){const t={},i=[];for(const s of e)t[s.type]||(t[s.type]=[],i.push(s.type)),t[s.type].push(s);return i.flatMap(s=>t[s])}normalizeHeaderStringValue(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}}class rc extends Nr{constructor(e){super({}),this._database=e}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(e,t,i,s,r){let a=e.tables.blockTable.modelSpace.newIterator().toArray();const o=a.length,h=new rr(o,100-s.value,i);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const c=t.tables.blockTable.modelSpace;await h.processChunk(async(d,u)=>{let p=[],g=d<u?a[d].type:"";for(let m=d;m<u;m++){const y=a[m];this.config.convertByEntityType&&y.type!==g&&(this.triggerEvents(c,p),p=[],g=y.type),p.push(y)}if(this.triggerEvents(c,p),r){let m=s.value+u/o*(100-s.value);m>100&&(m=100),await r(m,"ENTITY","IN-PROGRESS")}})}processBlocks(){const e=this._database.tables.blockTable.newIterator();for(const t of e){const i=t.newIterator().toArray();this.triggerEvents(t,i)}}processHeader(){}processBlockTables(){}processObjects(){const e=this._database.objects.layout.newIterator();for(const s of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.layoutName});const t=this._database.objects.imageDefinition.newIterator();for(const s of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.objectId});const i=this._database.objects.mleaderStyle.newIterator();for(const s of i)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(t=>{this._database.events.layerAppended.dispatch({database:this._database,layer:t})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(e){const t={},i=[];for(const s of e)t[s.type]||(t[s.type]=[],i.push(s.type)),t[s.type].push(s);return i.flatMap(s=>t[s])}triggerEvents(e,t){(e.isModelSapce||e.isPaperSapce)&&e.database.events.entityAppended.dispatch({database:e.database,entity:t})}}exports.ACAD_APPID=Ds;exports.AC_DB_SYSTEM_VARIABLE_NAMES=Nc;exports.AcCmColor=X;exports.AcCmColorMethod=P;exports.AcCmColorUtil=bt;exports.AcCmEntityColor=oc;exports.AcCmErrors=be;exports.AcCmEventDispatcher=lc;exports.AcCmEventManager=te;exports.AcCmLoader=yc;exports.AcCmLoadingManager=eo;exports.AcCmObject=Ka;exports.AcCmPerformanceCollector=ir;exports.AcCmTask=Qa;exports.AcCmTaskScheduler=Ja;exports.AcCmTransparency=J;exports.AcCmTransparencyMethod=he;exports.AcDb2dPolyline=Bn;exports.AcDb2dVertex=$s;exports.AcDb2dVertexType=Ko;exports.AcDb3PointAngularDimension=as;exports.AcDb3dPolyline=Fn;exports.AcDb3dVertex=qs;exports.AcDb3dVertexType=Zo;exports.AcDbAbstractViewTableRecord=Cr;exports.AcDbAlignedDimension=en;exports.AcDbAngleUnits=ar;exports.AcDbArc=Dn;exports.AcDbArcDimension=Zs;exports.AcDbAttribute=zn;exports.AcDbAttributeDefinition=Vn;exports.AcDbAttributeFlags=ne;exports.AcDbAttributeMTextFlag=We;exports.AcDbBaseWorker=vg;exports.AcDbBatchProcessing=rr;exports.AcDbBlockReference=ni;exports.AcDbBlockScaling=xl;exports.AcDbBlockTable=Pl;exports.AcDbBlockTableRecord=ie;exports.AcDbCircle=Hn;exports.AcDbCodePage=or;exports.AcDbCurve=ue;exports.AcDbDataGenerator=Sl;exports.AcDbDatabase=rd;exports.AcDbDatabaseConverter=Nr;exports.AcDbDatabaseConverterManager=He;exports.AcDbDiametricDimension=os;exports.AcDbDictionary=Jt;exports.AcDbDimArrowType=Al;exports.AcDbDimStyleTable=El;exports.AcDbDimStyleTableRecord=si;exports.AcDbDimTextHorizontal=Tl;exports.AcDbDimTextVertical=Ml;exports.AcDbDimVerticalJustification=vl;exports.AcDbDimZeroSuppression=kl;exports.AcDbDimZeroSuppressionAngular=Cl;exports.AcDbDimension=yt;exports.AcDbDuplicateRecordCloning=Ll;exports.AcDbDwgVersion=ve;exports.AcDbDxfCode=tr;exports.AcDbDxfConverter=sc;exports.AcDbDxfFiler=io;exports.AcDbEllipse=jn;exports.AcDbEntity=de;exports.AcDbFace=Wn;exports.AcDbFileType=Ri;exports.AcDbGradientPatternType=il;exports.AcDbHatch=qi;exports.AcDbHatchObjectType=Sr;exports.AcDbHatchPatternType=Vi;exports.AcDbHatchStyle=tl;exports.AcDbHostApplicationServices=Rn;exports.AcDbLayerTable=Nl;exports.AcDbLayerTableRecord=_s;exports.AcDbLayout=on;exports.AcDbLayoutDictionary=fl;exports.AcDbLayoutManager=wl;exports.AcDbLeader=Gn;exports.AcDbLeaderAnnotationType=nl;exports.AcDbLine=Ki;exports.AcDbLineSpacingStyle=rs;exports.AcDbLinetypeTable=Ol;exports.AcDbLinetypeTableRecord=Et;exports.AcDbMLeader=$n;exports.AcDbMLeaderContentType=mt;exports.AcDbMLeaderDirectionType=ol;exports.AcDbMLeaderLineType=gi;exports.AcDbMLeaderStyle=Ar;exports.AcDbMLeaderTextAttachmentDirection=al;exports.AcDbMLine=Un;exports.AcDbMLineFlags=rl;exports.AcDbMLineJustification=sl;exports.AcDbMText=Zi;exports.AcDbMlineStyle=Ir;exports.AcDbObject=De;exports.AcDbObjectIterator=ln;exports.AcDbOpenMode=ao;exports.AcDbOrdinateDimension=ls;exports.AcDbOsnapMode=D;exports.AcDbPatParser=kr;exports.AcDbPatSvgRenderer=Qs;exports.AcDbPlotPaperUnits=gl;exports.AcDbPlotRotation=pl;exports.AcDbPlotSettings=_l;exports.AcDbPlotShadePlotResLevel=Lt;exports.AcDbPlotShadePlotType=ci;exports.AcDbPlotStdScaleType=yl;exports.AcDbPlotType=ml;exports.AcDbPoint=Qn;exports.AcDbPoly2dType=hi;exports.AcDbPoly3dType=Di;exports.AcDbPolyFaceMesh=ss;exports.AcDbPolyFaceMeshFace=ul;exports.AcDbPolyFaceMeshVertex=dl;exports.AcDbPolygonMesh=ns;exports.AcDbPolygonMeshVertex=cl;exports.AcDbPolyline=Zn;exports.AcDbPredefinedAcadIsoPat=el;exports.AcDbPredefinedAcadPat=Oc;exports.AcDbRadialDimension=hs;exports.AcDbRasterImage=Ji;exports.AcDbRasterImageClipBoundaryType=ll;exports.AcDbRasterImageDef=bl;exports.AcDbRasterImageImageDisplayOpt=hl;exports.AcDbRay=Jn;exports.AcDbRegAppTable=Bl;exports.AcDbRegAppTableRecord=Js;exports.AcDbRegenerator=rc;exports.AcDbRenderingCache=ri;exports.AcDbResultBuffer=sr;exports.AcDbRotatedDimension=cs;exports.AcDbSpline=Qi;exports.AcDbSymbolTable=_t;exports.AcDbSymbolTableRecord=vt;exports.AcDbSysVarManager=Ne;exports.AcDbSystemVariables=A;exports.AcDbTable=qn;exports.AcDbText=pi;exports.AcDbTextHorizontalMode=Qo;exports.AcDbTextStyleTable=Yl;exports.AcDbTextStyleTableRecord=fs;exports.AcDbTextVerticalMode=Jo;exports.AcDbTrace=Kn;exports.AcDbUnitsValue=Mr;exports.AcDbViewTable=Xl;exports.AcDbViewTableRecord=ld;exports.AcDbViewport=es;exports.AcDbViewportTable=Rl;exports.AcDbViewportTableRecord=vr;exports.AcDbWipeout=ts;exports.AcDbWorkerApi=ic;exports.AcDbWorkerManager=tc;exports.AcDbXline=is;exports.AcDbXrecord=td;exports.AcGeArea2d=Tt;exports.AcGeBox2d=xe;exports.AcGeBox3d=Y;exports.AcGeCatmullRomCurve3d=ys;exports.AcGeCircArc2d=Mt;exports.AcGeCircArc3d=Pt;exports.AcGeCurve2d=mi;exports.AcGeEllipseArc2d=Ui;exports.AcGeEllipseArc3d=ui;exports.AcGeEuler=Ic;exports.AcGeGeometryUtil=Vo;exports.AcGeLine2d=Ge;exports.AcGeLine3d=kt;exports.AcGeLoop2d=$i;exports.AcGeMathUtil=k;exports.AcGeMatrix2d=nn;exports.AcGeMatrix3d=H;exports.AcGeNurbsCurve=Fe;exports.AcGePlane=rn;exports.AcGePoint2d=v;exports.AcGePoint3d=w;exports.AcGePolyline2d=ce;exports.AcGeQuaternion=ai;exports.AcGeShape2d=fr;exports.AcGeSpline3d=Ue;exports.AcGeTol=sn;exports.AcGeVector2d=K;exports.AcGeVector3d=x;exports.AcGiArrowType=xr;exports.AcGiDefaultLightingType=Lr;exports.AcGiLineWeight=ii;exports.AcGiMTextAttachmentPoint=z;exports.AcGiMTextFlowDirection=je;exports.AcGiOrthographicType=br;exports.AcGiRenderMode=wr;exports.AcGiViewport=$o;exports.AcTrStringUtil=mc;exports.ByBlock=At;exports.ByLayer=pe;exports.DEBUG_MODE=gc;exports.DEFAULT_GRADIENT_HATCH_NAME=co;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=xc;exports.DEFAULT_HATCH_PATTERN_METRIC=lo;exports.DEFAULT_LINE_TYPE=It;exports.DEFAULT_MLEADER_STYLE=pt;exports.DEFAULT_MLINE_STYLE=gt;exports.DEFAULT_TEXT_STYLE=Q;exports.DEFAULT_TOL=pr;exports.DEG2RAD=lr;exports.DefaultLoadingManager=to;exports.FLOAT_TOL=Qt;exports.HATCH_PATTERN_SOLID=ti;exports.HATCH_PATTERN_USER=ho;exports.MLIGHTCAD_APPID=Fs;exports.ORIGIN_POINT_2D=wc;exports.ORIGIN_POINT_3D=gr;exports.RAD2DEG=hr;exports.RAW_COLOR_TYPE_ACI=Tr;exports.RAW_COLOR_TYPE_BY_BLOCK=ds;exports.RAW_COLOR_TYPE_BY_LAYER=Pr;exports.RAW_COLOR_TYPE_RGB=Er;exports.RAW_COLOR_TYPE_WINDOW_BG=Il;exports.TAU=G;exports.TEMP_OBJECT_ID_PREFIX=En;exports.acdbDisableOsnapMode=Dc;exports.acdbEnableOsnapMode=Fc;exports.acdbHasOsnapMode=Bc;exports.acdbHostApplicationServices=nr;exports.acdbMaskToOsnapModes=Xc;exports.acdbOsnapModesToMask=Yc;exports.acdbToggleOsnapMode=Rc;exports.basisFunction=Wi;exports.calculateCurveLength=jo;exports.ceilPowerOfTwo=Po;exports.clamp=ut;exports.clone=Ni;exports.computeParameterValues=zo;exports.createWorkerApi=nc;exports.damp=mo;exports.decodeMLeaderStyleRawColor=zi;exports.deepClone=Xs;exports.defaults=tn;exports.degToRad=So;exports.dwgCodePageToEncoding=oo;exports.encodeMLeaderStyleRawColor=kn;exports.euclideanModulo=cr;exports.evaluateNurbsPoint=Fi;exports.floorPowerOfTwo=Eo;exports.generateAveragedKnots=Ho;exports.generateChordKnots=Ec;exports.generateSqrtChordKnots=Tc;exports.generateUUID=uo;exports.generateUniformKnots=Pc;exports.getOcsAngle=Gs;exports.getOcsReferenceVector=_r;exports.has=Ga;exports.intPartLength=ur;exports.interpolateControlPoints=Mc;exports.interpolateNurbsCurve=yr;exports.inverseLerp=po;exports.isBetween=To;exports.isBetweenAngle=Mo;exports.isEmpty=Ua;exports.isEqual=di;exports.isImperialUnits=nd;exports.isMetricUnits=id;exports.isPointInPolygon=mr;exports.isPolygonIntersect=Do;exports.isPowerOfTwo=Io;exports.lerp=dr;exports.log=Xi;exports.mapLinear=go;exports.normalizeAngle=Bi;exports.pingpong=yo;exports.radToDeg=Ao;exports.randFloat=wo;exports.randFloatSpread=bo;exports.randInt=xo;exports.relativeEps=ko;exports.seededRandom=Lo;exports.setAcDbHostApplicationServicesProvider=so;exports.setAcDbLayoutManagerFactory=ro;exports.setLogLevel=pc;exports.smootherstep=fo;exports.smoothstep=_o;exports.transformOcsPointToWcs=Ws;exports.transformWcsPointToOcs=Gi;
7
+ `)}stripInlineComment(e){const t=e.indexOf(";");return t<0?e:e.slice(0,t)}parseHeader(e){const t=e.indexOf(",");if(t<0){const r=e.trim();return r?{name:r,description:""}:null}const i=e.slice(0,t).trim(),s=e.slice(t+1).trim();return i?{name:i,description:s}:null}parseNumber(e){const t=Number(e.trim());return Number.isFinite(t)?t:null}parseLineDescriptor(e,t){const i=e.split(",").map(u=>u.trim()).filter(u=>u.length>0);if(i.length<5)return null;const s=this.parseNumber(i[0]),r=this.parseNumber(i[1]),a=this.parseNumber(i[2]),o=this.parseNumber(i[3]),h=this.parseNumber(i[4]);if(s==null||r==null||a==null||o==null||h==null)return null;const c=i.slice(5),d=[];for(const u of c){const p=this.parseNumber(u);if(p==null)return null;d.push(p)}return{angle:s,originX:r,originY:a,deltaX:o,deltaY:h,dashes:d,sourceLine:t}}flushCurrentPattern(e,t,i){e&&(e.pattern.lines.length===0&&i.push({line:e.headerLine,message:`Pattern "${e.pattern.name}" has no line descriptor.`,source:""}),t.push(e.pattern))}}const F=class F{static nextGradientId(e){return F.gradientIdCounter+=1,`acdb-pat-gradient-${e.toLowerCase()}-${F.gradientIdCounter}`}static packedRgbToCss(e){return`#${(e&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(e,t){return typeof e=="number"?F.packedRgbToCss(e):e??t}static applyShadeTint(e,t){const i=k.clamp(t,0,1),s=i<.5?0:16777215,r=i<.5?1-i*2:i*2-1,a=e>>16&255,o=e>>8&255,h=e&255,c=s>>16&255,d=s>>8&255,u=s&255;return Math.round(a+(c-a)*r)*65536+Math.round(o+(d-o)*r)*256+Math.round(h+(u-h)*r)}static resolveGradientColors(e){const t="#2563eb",i="#f8fafc",s=F.gradientColorToCss(e.startColor,t);if(e.oneColorMode&&e.endColor==null){if(typeof e.startColor=="number"){const r=F.applyShadeTint(e.startColor,e.shadeTintValue??.5);return{start:s,end:F.packedRgbToCss(r)}}return{start:s,end:(e.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:s,end:F.gradientColorToCss(e.endColor,i)}}static renderGradientStops(e){return e.map(t=>`<stop offset="${(k.clamp(t.offset,0,1)*100).toFixed(2)}%" stop-color="${t.color}" />`).join("")}static getGradientVector(e){return{x:Math.cos(e),y:-Math.sin(e)}}static isSolidPattern(e){return e.name.trim().toUpperCase()===ti}static renderBackground(e,t,i){return`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" fill="${i}" />`}static estimateUnitScale(e){const t=[];for(const r of e.lines){t.push(Math.abs(r.deltaX),Math.abs(r.deltaY));for(const a of r.dashes)t.push(Math.abs(a))}const i=t.filter(r=>r>F.EPSILON);if(i.length===0)return 1;const s=i.sort((r,a)=>r-a);return s[Math.floor(s.length/2)]||1}static segmentToSvgPath(e){return`M ${e.x1.toFixed(2)} ${(-e.y1).toFixed(2)} L ${e.x2.toFixed(2)} ${(-e.y2).toFixed(2)}`}static buildDashSegments(e,t,i,s,r,a,o){const h=e.dashes;if(h.length===0)return[{x1:s+a*t,y1:r+o*t,x2:s+a*i,y2:r+o*i}];const c=h.reduce((g,m)=>g+Math.abs(m),0);if(c<=F.EPSILON)return[{x1:s+a*t,y1:r+o*t,x2:s+a*i,y2:r+o*i}];const d=[],u=Math.ceil((i-t)/c)+2;let p=t-c;for(let g=0;g<u;g++){let m=p;for(const y of h){const _=Math.abs(y),f=m+_;if(y>0||y===0){const S=k.clamp(m,t,i),L=k.clamp(f,t,i);L>S?d.push({x1:s+a*S,y1:r+o*S,x2:s+a*L,y2:r+o*L}):y===0&&S>=t&&S<=i&&d.push({x1:s+a*(S-.35),y1:r+o*(S-.35),x2:s+a*(S+.35),y2:r+o*(S+.35)})}m=f}p+=c}return d}static renderFamily(e,t){const i=k.degToRad(e.angle),s=Math.cos(i),r=Math.sin(i),a=-r,o=s,h=s*e.deltaX+a*e.deltaY,c=r*e.deltaX+o*e.deltaY,d=Math.hypot(h,c),u=d<=F.EPSILON?1:Math.max(1,Math.ceil(t*2/d)+1),p=Math.floor(u/2),g=-t*1.5,m=t*1.5,y=[];for(let _=-p;_<=p;_++){const f=e.originX+h*_,S=e.originY+c*_,L=F.buildDashSegments(e,g,m,f,S,s,r);for(const M of L)y.push(F.segmentToSvgPath(M))}return`<path d="${y.join(" ")}" fill="none" />`}static renderLinearGradientDef(e,t,i,s,r){const a=F.getGradientVector(t),o=k.clamp(i,-1,1)*s*.5,h=a.x*o,c=a.y*o;return[`<linearGradient id="${e}" gradientUnits="userSpaceOnUse"`,` x1="${(-a.x*s+h).toFixed(2)}"`,` y1="${(-a.y*s+c).toFixed(2)}"`,` x2="${(a.x*s+h).toFixed(2)}"`,` y2="${(a.y*s+c).toFixed(2)}">`,F.renderGradientStops(r),"</linearGradient>"].join("")}static renderRadialGradientDef(e,t,i,s,r){return[`<radialGradient id="${e}" gradientUnits="userSpaceOnUse"`,` cx="${t.toFixed(2)}" cy="${i.toFixed(2)}" r="${s.toFixed(2)}"`,` fx="${t.toFixed(2)}" fy="${i.toFixed(2)}">`,F.renderGradientStops(r),"</radialGradient>"].join("")}static renderGradientDef(e,t,i,s,r,a,o){const h=t.toUpperCase(),c=h.startsWith("INV"),d=h.replace(/^INV/,""),u=c?i.end:i.start,p=c?i.start:i.end,g=Math.hypot(a,o)/2,m=F.getGradientVector(s),y=k.clamp(r,-1,1),_=m.x*y*a*.25,f=m.y*y*o*.25;switch(d){case"CYLINDER":{const S=k.clamp(.5+y*.45,.05,.95);return F.renderLinearGradientDef(e,s,0,g,[{offset:0,color:u},{offset:S,color:p},{offset:1,color:u}])}case"SPHERICAL":return F.renderRadialGradientDef(e,_,f,g,[{offset:0,color:p},{offset:1,color:u}]);case"HEMISPHERICAL":return F.renderRadialGradientDef(e,_+m.x*a*.18,f+m.y*o*.18,g*.92,[{offset:0,color:p},{offset:.72,color:u},{offset:1,color:u}]);case"CURVED":return F.renderRadialGradientDef(e,-m.x*a*.95+_,-m.y*o*.95+f,g*1.65,[{offset:0,color:u},{offset:.55,color:u},{offset:1,color:p}]);case"LINEAR":default:return F.renderLinearGradientDef(e,s,r,g,[{offset:0,color:u},{offset:1,color:p}])}}renderPattern(e,t={}){const i=t.width??260,s=t.height??160,r=t.stroke??"#1f2937",a=t.strokeWidth??1.3,o=t.background??"#ffffff",h=`${-i/2} ${-s/2} ${i} ${s}`;if(F.isSolidPattern(e))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${s}">`,F.renderBackground(i,s,o),`<rect x="${-i/2}" y="${-s/2}" width="${i}" height="${s}" fill="${r}" />`,"</svg>"].join("");const c=F.estimateUnitScale(e),u=Math.min(i,s)*.18/Math.max(c,F.EPSILON),p={...e,lines:e.lines.map(y=>({...y,originX:y.originX*u,originY:y.originY*u,deltaX:y.deltaX*u,deltaY:y.deltaY*u,dashes:y.dashes.map(_=>_*u)}))},g=Math.hypot(i,s)*.75,m=p.lines.map(y=>F.renderFamily(y,g)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${s}">`,F.renderBackground(i,s,o),`<g stroke="${r}" stroke-width="${a.toFixed(2)}" stroke-linecap="round">`,m,"</g>","</svg>"].join("")}renderGradient(e,t={}){const i=t.width??260,s=t.height??160,r=t.background??"#ffffff",a=t.angle??0,o=t.shift??0,h=`${-i/2} ${-s/2} ${i} ${s}`,c=F.nextGradientId(e),d=F.resolveGradientColors(t),u=F.renderGradientDef(c,e,d,a,o,i,s);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${s}">`,F.renderBackground(i,s,r),"<defs>",u,"</defs>",`<rect x="${-i/2}" y="${-s/2}" width="${i}" height="${s}" fill="url(#${c})" />`,"</svg>"].join("")}};F.EPSILON=1e-9,F.gradientIdCounter=0;let ir=F;class _t extends De{constructor(e){super(),this.database=e,this.objectId=e.generateHandle(),this.ownerId=e.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,i=>this.hasId(i));const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),i=this._recordsByName.get(t);return i?(this._recordsById.delete(i.objectId),this._recordsByName.delete(t),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(this.normalizeName(t.name)),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new hn(this._recordsByName)}normalizeName(e){return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbSymbolTable"),e.writeInt16(70,this.numEntries),this}}class vl extends _t{constructor(e){super(e)}get modelSpace(){let e=this.getAt(ie.MODEL_SPACE_NAME);return e||(e=new ie,e.name=ie.MODEL_SPACE_NAME,this.add(e)),e}getEntityById(e){for(const t of this.database.tables.blockTable.newIterator()){const i=t.getIdAt(e);if(i)return i}}removeEntity(e){let t=!1;for(const i of this.database.tables.blockTable.newIterator())if(i.removeEntity(e)){t=!0;break}return t}normalizeName(e){let t=e;if(ie.isModelSapceName(e))t=ie.MODEL_SPACE_NAME;else if(ie.isPaperSapceName(e)){const i=ie.PAPER_SPACE_NAME_PREFIX,s=e.substring(i.length);t=i+s}return t}}class Nl extends _t{constructor(e){super(e)}}var Ol=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(Ol||{}),Yl=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(Yl||{}),Xl=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(Xl||{}),Rl=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(Rl||{}),Bl=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(Bl||{});const ys=class ys extends vt{constructor(e,t){e=e||{},nn(e,ys.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}dxfOutFields(e){super.dxfOutFields(e);const t=this.database.tables.textStyleTable.getAt(this.dimtxsty),i=this.database.tables.blockTable.getAt(this.dimldrblk),s=this.database.tables.blockTable.getAt(this.dimblk),r=this.database.tables.blockTable.getAt(this.dimblk1),a=this.database.tables.blockTable.getAt(this.dimblk2);return e.writeSubclassMarker("AcDbDimStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),e.writeString(3,this.dimpost),e.writeString(4,this.dimapost),e.writeDouble(40,this.dimscale),e.writeDouble(41,this.dimasz),e.writeDouble(42,this.dimexo),e.writeDouble(43,this.dimdli),e.writeDouble(44,this.dimexe),e.writeDouble(140,this.dimtxt),e.writeDouble(147,this.dimgap),e.writeInt16(170,this.dimalt),e.writeInt16(171,this.dimtol),e.writeInt16(172,this.dimlim),e.writeInt16(173,this.dimtih),e.writeInt16(174,this.dimtoh),e.writeObjectId(340,t==null?void 0:t.objectId),e.writeObjectId(341,i==null?void 0:i.objectId),e.writeObjectId(342,s==null?void 0:s.objectId),e.writeObjectId(343,r==null?void 0:r.objectId),e.writeObjectId(344,a==null?void 0:a.objectId),e.writeInt16(371,this.dimlwd),e.writeInt16(372,this.dimlwe),this}};ys.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:Q,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let si=ys;class Fl extends _t{constructor(e){super(e)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class ws extends vt{constructor(e,t){e=e||{},nn(e,{color:new X,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new J,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(i=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:i.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e.clone())}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineStyle(){var t;const e=(t=this.database)==null?void 0:t.tables.linetypeTable.getAt(this.linetype);if(e)return{type:"UserSpecified",...e.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbLayerTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeCmColor(this.color),e.writeString(6,this.linetype),e.writeInt16(290,this.isPlottable?1:0),e.writeInt16(370,this.lineWeight),e.writeTransparency(this.transparency),this.description&&e.writeString(4,this.description),this}}class Dl extends _t{constructor(e){super(e)}}class Et extends vt{constructor(e){super(),this.name=e.name,this._linetype=e}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(e){if(e<0||e>=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[e].elementLength}toPreviewSvgString(e){const t=Math.max((e==null?void 0:e.width)??220,1),i=Math.max((e==null?void 0:e.height)??36,1),s=Math.min(Math.max((e==null?void 0:e.padding)??8,0),Math.floor(t/2)),r=Math.max((e==null?void 0:e.strokeWidth)??2,.5),a=this.escapeSvgAttribute((e==null?void 0:e.stroke)??"currentColor"),o=Math.max((e==null?void 0:e.repeats)??4,1),h=i/2,c=s,d=Math.max(t-s,c+1),u=d-c,p=this._linetype.pattern??[];if(p.length===0||this.patternLength<=0||!p.some(L=>L.elementLength!==0))return this.buildSvgString({width:t,height:i,stroke:a,strokeWidth:r,lineSegments:[[c,d]],dots:[],y:h});const g=[],m=[],y=u/(this.patternLength*o),_=.5,f=Math.max(r*2,2);let S=c;for(;S<d;)for(const L of p){if(S>=d)break;const M=L.elementLength;if(M===0){m.push(S),S=Math.min(S+f,d);continue}const I=Math.max(Math.abs(M)*y,_),W=Math.min(S+I,d);M>0&&W>S&&g.push([S,W]),S=W}return this.buildSvgString({width:t,height:i,stroke:a,strokeWidth:r,lineSegments:g,dots:m,y:h})}buildSvgString(e){const{width:t,height:i,stroke:s,strokeWidth:r,lineSegments:a,dots:o,y:h}=e,c=a.map(([u,p])=>`<line x1="${u.toFixed(2)}" y1="${h.toFixed(2)}" x2="${p.toFixed(2)}" y2="${h.toFixed(2)}" stroke="${s}" stroke-width="${r.toFixed(2)}" stroke-linecap="round" />`).join(""),d=o.map(u=>`<circle cx="${u.toFixed(2)}" cy="${h.toFixed(2)}" r="${(r/2).toFixed(2)}" fill="${s}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${i}" viewBox="0 0 ${t} ${i}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${c}${d}</svg>`}escapeSvgAttribute(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;")}dxfOutFields(e){super.dxfOutFields(e),e.writeSubclassMarker("AcDbLinetypeTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.linetype.standardFlag),e.writeString(3,this.comments),e.writeInt16(72,65),e.writeInt16(73,this.numDashes),e.writeDouble(40,this.patternLength);for(const t of this.linetype.pattern??[])e.writeDouble(49,t.elementLength),e.writeInt16(74,t.elementTypeFlag);return this}}class Vl extends _t{constructor(e){super(e)}get fonts(){const e=new Set,t=s=>{if(s){const r=s.lastIndexOf(".");if(r>=0){const a=s.substring(0,r).toLowerCase();e.add(a)}else e.add(s.toLowerCase())}},i=this.newIterator();for(const s of i)t(s.fileName),t(s.bigFontFileName);return Array.from(e)}}class bs extends vt{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const i=t.lastIndexOf(".");return i===-1?t:t.substring(0,i)}return e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbTextStyleTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.textStyle.standardFlag),e.writeDouble(40,this.textSize),e.writeDouble(41,this.xScale),e.writeAngle(50,this.obliquingAngle),e.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),e.writeDouble(42,this.priorSize),e.writeString(3,this.fileName),e.writeString(4,this.bigFontFileName),this}}class zl extends _t{constructor(e){super(e)}}class jl extends _t{constructor(e){super(e)}}const cd=()=>({center:new v,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:Sr.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:Ar.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Ir.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class Nr extends vt{constructor(){super(),this._gsView=cd(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(e){this._gsView.viewDirectionFromTarget.copy(e)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(e){this._gsView.viewTarget.copy(e)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(e){this._gsView.viewHeight=e}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(e){this._gsView.viewTwistAngle=e}get lensLength(){return this._gsView.lensLength}set lensLength(e){this._gsView.lensLength=e}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(e){this._gsView.frontClippingPlane=e}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(e){this._gsView.backClippingPlane=e}get renderMode(){return this._gsView.renderMode}set renderMode(e){this._gsView.renderMode=e}get viewMode(){return this._gsView.viewMode}set viewMode(e){this._gsView.viewMode=e}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(e){this._gsView.ucsIconSetting=e}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(e){this._gsView.ucsOrigin.copy(e)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(e){this._gsView.ucsXAxis.copy(e)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(e){this._gsView.ucsYAxis.copy(e)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(e){this._gsView.orthographicType=e}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(e){this._gsView.shadePlotSetting=e}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(e){this._gsView.shadePlotObjectId=e}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(e){this._gsView.visualStyleObjectId=e}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(e){this._gsView.isDefaultLightingOn=e}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(e){this._gsView.defaultLightingType=e}get brightness(){return this._gsView.brightness}set brightness(e){this._gsView.brightness=e}get contrast(){return this._gsView.contrast}set contrast(e){this._gsView.contrast=e}get ambientColor(){return this._gsView.ambientColor}set ambientColor(e){this._gsView.ambientColor=e}}class Or extends Nr{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new v(0,0),this._upperRightCorner=new v(1,1),this._snapBase=new v(0,0),this._snapAngle=0,this._snapSpacing=new v(0,0),this._standardFlag=0,this._gridSpacing=new v,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this.centerPoint}set center(e){this.centerPoint=e}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewportTableRecord"),e.writeString(2,this.name),e.writeDouble(45,this.gsView.viewHeight),e.writePoint2d(10,this.lowerLeftCorner),e.writePoint2d(11,this.upperRightCorner),e.writePoint2d(12,this.center),e.writePoint2d(13,this.snapBase),e.writePoint2d(14,this.snapIncrements),e.writePoint2d(15,this.gridIncrements),e.writeInt16(70,this.standardFlag),e.writeInt16(71,this.circleSides),e.writeDouble(42,this.gsView.lensLength),e.writePoint3d(16,this.gsView.viewDirectionFromTarget),e.writePoint3d(17,this.gsView.viewTarget),e.writeAngle(50,this.snapAngle),e.writeAngle(51,this.gsView.viewTwistAngle),e.writeInt16(61,this.gridMajor),e.writeInt16(281,this.backgroundObjectId?1:0),e.writeObjectId(332,this.backgroundObjectId),this}}class Hl extends _t{constructor(e){super(e)}}class nr extends vt{constructor(e){super(),this.name=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbRegAppTableRecord"),e.writeString(2,this.name),e.writeInt16(70,0),this}}class dd extends De{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new te,dictObjectErased:new te,entityAppended:new te,entityModified:new te,entityErased:new te,layerAppended:new te,layerModified:new te,layerErased:new te,openProgress:new te},this._version=new ve("AC1014"),this._angbase=0,this._angdir=0,this._aunits=_s.DecimalDegrees,this._auprec=0,this._lunits=Wi.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new X,this._celtype=pe,this._celweight=ii.ByLayer,this._cetransparency=new J,this._clayer="0",this._cmlstyle=gt,this._cmlscale=1,this._cmleaderstyle=pt,this._hpbackgroundcolor=new X(P.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new J,this._textstyle=Q,this._extents=new Y,this._insunits=xs.Millimeters,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._maxHandle=0,this._tables={appIdTable:new Hl(this),blockTable:new vl(this),dimStyleTable:new Nl(this),linetypeTable:new Dl(this),textStyleTable:new Vl(this),viewTable:new zl(this),layerTable:new Fl(this),viewportTable:new jl(this)},this._objects={dictionary:new Jt(this),imageDefinition:new Jt(this),layout:new Al(this),mleaderStyle:new Jt(this),mlineStyle:new Jt(this),xrecord:new Jt(this)}}get tables(){return this._tables}get objects(){return this._objects}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(e){const t=parseInt(e,16);!isNaN(t)&&t>this._maxHandle&&(this._maxHandle=t)}commitObjectHandle(e,t){const i=e.getAttrWithoutException("objectId");!i||e.isTemp||t&&t(i)?e.objectId=this.generateHandle():this.updateMaxHandle(i)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this.updateSysVar(A.AUNITS,this._aunits,e??0,t=>{this._aunits=t})}get auprec(){return this._auprec}set auprec(e){this.updateSysVar(A.AUPREC,this._auprec,e??0,t=>{this._auprec=t})}get lunits(){return this._lunits}set lunits(e){this.updateSysVar(A.LUNITS,this._lunits,e??Wi.Decimal,t=>{this._lunits=t})}get luprec(){return this._luprec}set luprec(e){this.updateSysVar(A.LUPREC,this._luprec,e??4,t=>{this._luprec=t})}get version(){return this._version}set version(e){this.updateSysVar(A.ACADVER,this._version,new ve(e),t=>{this._version=t})}get insunits(){return this._insunits}set insunits(e){this.updateSysVar(A.INSUNITS,this._insunits,e??4,t=>{this._insunits=t})}get ltscale(){return this._ltscale}set ltscale(e){this.updateSysVar(A.LTSCALE,this._ltscale,e??1,t=>{this._ltscale=t})}get lwdisplay(){return this._lwdisplay}set lwdisplay(e){this.updateSysVar(A.LWDISPLAY,this._lwdisplay,e??!1,t=>{this._lwdisplay=t})}get cecolor(){return this._cecolor}set cecolor(e){this.updateSysVar(A.CECOLOR,this._cecolor,e||0,t=>{this._cecolor=t.clone()})}get celtscale(){return this._celtscale}set celtscale(e){this.updateSysVar(A.CELTSCALE,this._celtscale,e??1,t=>{this._celtscale=t})}get celtype(){return this._celtype}set celtype(e){const t=this.normalizeLinetypeName(e??pe);this.updateSysVar(A.CELTYPE,this._celtype,t,i=>{this._celtype=i})}get celweight(){return this._celweight}set celweight(e){this.updateSysVar(A.CELWEIGHT,this._celweight,e??ii.ByLayer,t=>{this._celweight=t})}get cetransparency(){return this._cetransparency}set cetransparency(e){this.updateSysVar(A.CETRANSPARENCY,this._cetransparency,e??new J,t=>{this._cetransparency=t.clone()})}get clayer(){return this._clayer}set clayer(e){this.updateSysVar(A.CLAYER,this._clayer,e??"0",t=>{this._clayer=t})}get cmlstyle(){return this._cmlstyle}set cmlstyle(e){this.updateSysVar(A.CMLSTYLE,this._cmlstyle,e??gt,t=>{this._cmlstyle=t})}get cmlscale(){return this._cmlscale}set cmlscale(e){this.updateSysVar(A.CMLSCALE,this._cmlscale,e??1,t=>{this._cmlscale=t})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(e){this.updateSysVar(A.CMLEADERSTYLE,this._cmleaderstyle,e??pt,t=>{this._cmleaderstyle=t})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(e){this.updateSysVar(A.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,e??new X(P.None),t=>{this._hpbackgroundcolor=t.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(e){this.updateSysVar(A.HPCOLOR,this._hpcolor,e??this._cecolor,t=>{this._hpcolor=t.clone()})}get hplayer(){return this._hplayer}set hplayer(e){this.updateSysVar(A.HPLAYER,this._hplayer,e??".",t=>{this._hplayer=t})}get hptransparency(){return this._hptransparency}set hptransparency(e){this.updateSysVar(A.HPTRANSPARENCY,this._hptransparency,e??new J,t=>{this._hptransparency=t.clone()})}get textstyle(){return this._textstyle}set textstyle(e){this.updateSysVar(A.TEXTSTYLE,this._textstyle,e??Q,t=>{this._textstyle=t})}get angbase(){return this._angbase}set angbase(e){this.updateSysVar(A.ANGBASE,this._angbase,e??0,t=>{this._angbase=t})}get angdir(){return this._angdir}set angdir(e){this.updateSysVar(A.ANGDIR,this._angdir,e??0,t=>{this._angdir=t})}get extmax(){return this._extents.max}set extmax(e){if(e){const t=this._extents.max.clone();this._extents.expandByPoint(e),this._extents.max.equals(t)||this.triggerSysVarChangedEvent(A.EXTMAX,t,this._extents.max)}}get extmin(){return this._extents.min}set extmin(e){if(e){const t=this._extents.min.clone();this._extents.expandByPoint(e),this._extents.min.equals(t)||this.triggerSysVarChangedEvent(A.EXTMIN,t,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(e){this.updateSysVar(A.PDMODE,this._pdmode,e??0,t=>{this._pdmode=t})}get pdsize(){return this._pdsize}set pdsize(e){this.updateSysVar(A.PDSIZE,this._pdsize,e??0,t=>{this._pdsize=t})}get osmode(){return this._osmode}set osmode(e){this.updateSysVar(A.OSMODE,this._osmode,e??0,t=>{this._osmode=t})}async read(e,t,i=Ri.DXF){const s=je.instance.get(i);if(s==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),await s.read(e,this,t&&t.minimumChunkSize||10,async(r,a,o,h)=>{if(this.events.openProgress.dispatch({database:this,percentage:r,stage:"CONVERSION",subStage:a,subStageStatus:o,data:h}),t&&t.fontLoader&&a=="FONT"&&o=="END"){const c=h||this.tables.textStyleTable.fonts;await t.fontLoader.load(c)}},t==null?void 0:t.timeout,t==null?void 0:t.sysVars),this.ensureDatabaseDefaults()}async openUri(e,t){var g;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const i=await fetch(e);if(!i.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${i.status}'!`);const s=i.headers.get("content-length"),r=s?parseInt(s,10):null;let a=0;const o=(g=i.body)==null?void 0:g.getReader();if(!o)throw new Error("Failed to get response reader");const h=[];for(;;){const{done:m,value:y}=await o.read();if(m)break;if(h.push(y),a+=y.length,r!==null){const _=Math.round(a/r*100);this.events.openProgress.dispatch({database:this,percentage:_,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(a);let d=0;for(const m of h)c.set(m,d),d+=m.length;const p=this.getFileNameFromUri(e).toLowerCase().split(".").pop();p==="dwg"?await this.read(c.buffer,t,Ri.DWG):p==="dxf"?await this.read(c.buffer,t,Ri.DXF):await this.read(c.buffer,t,p),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(e,t=16,i=this.version.name,s=!1){this.ensureDatabaseDefaults();const r=i instanceof ve?i:new ve(i),a=new so({database:this,precision:t,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 dc(this).read(null,this,500,async(t,i,s,r)=>{this.events.openProgress.dispatch({database:this,percentage:t,stage:"CONVERSION",subStage:i,subStageStatus:s,data:r})})}createDefaultData(e={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const t=new Ml(this);e.layer&&t.createDefaultLayer(),e.lineType&&t.createDefaultLineType(),e.textStyle&&t.createDefaultTextStyle(),e.dimStyle&&t.createDefaultDimStyle(),e.layout&&t.createDefaultLayout()}ensureEntityStyleDefaults(e){var t;if(e.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||gt);return}if(e.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||pt);return}if(e.dxfTypeName==="HATCH"){const i=e;(t=i.applyPatternDefaultsFromSysVars)==null||t.call(i,this)}}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const t=new X;t.colorIndex=7,this.tables.layerTable.add(new ws({name:"0",standardFlags:0,linetype:It,lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}if(this.tables.linetypeTable.has(At)||this.tables.linetypeTable.add(new Et({name:At,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(pe)||this.tables.linetypeTable.add(new Et({name:pe,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(It)||this.tables.linetypeTable.add(new Et({name:It,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.tables.textStyleTable.has(Q)||this.tables.textStyleTable.add(new bs({name:Q,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"})),this.tables.dimStyleTable.has(Q)||this.tables.dimStyleTable.add(new si({name:Q,dimtxsty:Q})),!this.tables.viewportTable.has("*Active")){const t=new Or;t.name="*Active",this.tables.viewportTable.add(t)}this.ensureMLineStyle(this._cmlstyle||gt),this.ensureMLeaderStyle(this._cmleaderstyle||pt);const e=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const t=new ln;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=e.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.objects.layout.setAt(t.layoutName,t),e.layoutId=t.objectId}this.tables.appIdTable.has(js)||this.tables.appIdTable.add(new nr(js)),this.tables.appIdTable.has(zs)||this.tables.appIdTable.add(new nr(zs))}ensureMLineStyle(e){const t=this.objects.mlineStyle,i=e.trim();if(!i||t.getAt(i))return;for(const[r,a]of t.entries())if(r.toUpperCase()===i.toUpperCase()||a.styleName.toUpperCase()===i.toUpperCase())return;const s=new Tr;s.styleName=i,s.elements=[{offset:.5,color:new X().setByLayer(),lineType:pe},{offset:-.5,color:new X().setByLayer(),lineType:pe}],t.setAt(i,s)}ensureMLeaderStyle(e){const t=this.objects.mleaderStyle,i=e.trim();if(!i||t.getAt(i))return;for(const[o]of t.entries())if(o.toUpperCase()===i.toUpperCase())return;const s=new Er;s.unknown1=2,s.maxLeaderSegmentsPoints=2,s.leaderLineColor=new X().setByBlock(),s.textColor=new X().setByBlock(),s.blockColor=new X().setByBlock(),s.alignSpace=4,s.breakSize=3.75,s.enableBlockRotation=!0,s.unknown2=!1;const r=this.tables.linetypeTable.getAt(At);s.leaderLineTypeId=r==null?void 0:r.objectId;const a=this.tables.textStyleTable.getAt(Q);s.textStyleId=a==null?void 0:a.objectId,t.setAt(i,s)}writeDxfHeaderSection(e){var t;e.startSection("HEADER"),e.writeString(9,"$ACADVER"),e.writeString(1,((t=e.version)==null?void 0:t.name)??this.version.name),e.writeString(9,"$HANDSEED"),e.writeString(5,e.nextHandle.toString(16).toUpperCase()),e.version!=null&&e.version.value>=27&&(e.writeString(9,"$DWGCODEPAGE"),e.writeString(3,"UTF-8")),e.writeString(9,"$INSUNITS"),e.writeInt16(70,this.insunits),e.writeString(9,"$LUNITS"),e.writeInt16(70,this.lunits),e.writeString(9,"$LUPREC"),e.writeInt16(70,this.luprec),e.writeString(9,"$LTSCALE"),e.writeDouble(40,this.ltscale),e.writeString(9,"$LWDISPLAY"),e.writeInt16(70,this.lwdisplay?1:0),e.writeString(9,"$CLAYER"),e.writeString(8,this.clayer),e.writeString(9,"$CELTYPE"),e.writeString(6,this.celtype),this.cetransparency.isInvalid||(e.writeString(9,"$CETRANSPARENCY"),e.writeTransparency(this.cetransparency)),e.writeString(9,"$CMLSTYLE"),e.writeString(2,this.cmlstyle),e.writeString(9,"$CMLSCALE"),e.writeDouble(40,this.cmlscale),e.writeString(9,"$CMLEADERSTYLE"),e.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==P.None&&(e.writeString(9,"$HPCOLOR"),e.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==P.None&&(e.writeString(9,"$HPBACKGROUNDCOLOR"),e.writeCmColor(this.hpbackgroundcolor,2)),e.writeString(9,"$HPLAYER"),e.writeString(8,this.hplayer),this.hptransparency.isInvalid||(e.writeString(9,"$HPTRANSPARENCY"),e.writeTransparency(this.hptransparency)),e.writeString(9,"$TEXTSTYLE"),e.writeString(7,this.textstyle),e.writeString(9,"$ANGBASE"),e.writeAngle(50,this.angbase),e.writeString(9,"$ANGDIR"),e.writeInt16(70,this.angdir),e.writeString(9,"$AUNITS"),e.writeInt16(70,this.aunits),e.writeString(9,"$AUPREC"),e.writeInt16(70,this.auprec),e.writeString(9,"$EXTMIN"),e.writePoint3d(10,this.extmin),e.writeString(9,"$EXTMAX"),e.writePoint3d(10,this.extmax),e.writeString(9,"$PDMODE"),e.writeInt32(70,this.pdmode),e.writeString(9,"$PDSIZE"),e.writeDouble(40,this.pdsize),e.writeString(9,"$OSMODE"),e.writeInt32(70,this.osmode),e.endSection()}writeDxfTablesSection(e,t){e.startSection("TABLES"),this.writeDxfTable(e,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(e,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(e,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(e,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(e,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(),"STYLE"),this.writeDxfTable(e,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(e,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),t.value>=19&&this.writeDxfTable(e,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),e.endSection()}writeDxfBlocksSection(e){e.startSection("BLOCKS");for(const t of this.tables.blockTable.newIterator()){if(t.dxfOutBlockBegin(e),!t.isModelSapce&&!t.isPaperSapce)for(const i of t.newIterator())this.writeDxfEntity(e,i);t.dxfOutBlockEnd(e)}e.endSection()}writeDxfEntitiesSection(e){e.startSection("ENTITIES");for(const t of this.tables.blockTable.newIterator())if(!(!t.isModelSapce&&!t.isPaperSapce))for(const i of t.newIterator())this.writeDxfEntity(e,i);e.endSection()}writeDxfObjectsSection(e){e.startSection("OBJECTS");const t=this.objects.dictionary;t.ownerId="0";const i=a=>{e.writeStart("DICTIONARY"),a.dxfOut(e)},s=(a,o)=>{t.getAt(a)!==o&&t.setAt(a,o)},r=a=>{t.getAt(a)&&t.remove(a)};s("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?s("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):r("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?s("ACAD_MLINESTYLE",this.objects.mlineStyle):r("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?s("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):r("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?s("MLIGHT_XRECORD",this.objects.xrecord):r("MLIGHT_XRECORD"),i(t),i(this.objects.layout),this.objects.mleaderStyle.numEntries>0&&i(this.objects.mleaderStyle),this.objects.mlineStyle.numEntries>0&&i(this.objects.mlineStyle),this.objects.imageDefinition.numEntries>0&&i(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&i(this.objects.xrecord);for(const[a,o]of this.objects.layout.entries())e.writeStart("LAYOUT"),o.dxfOut(e);for(const[a,o]of this.objects.imageDefinition.entries())e.writeStart("IMAGEDEF"),o.dxfOut(e);for(const[a,o]of this.objects.mleaderStyle.entries())e.writeStart("MLEADERSTYLE"),o.dxfOut(e);for(const[a,o]of this.objects.mlineStyle.entries())e.writeStart("MLINESTYLE"),o.dxfOut(e);for(const[a,o]of this.objects.xrecord.entries())e.writeStart("XRECORD"),o.dxfOut(e);e.endSection()}writeDxfTable(e,t,i,s,r){const a=[...s];e.startTable(t),i.dxfOut(e);for(const o of a){if(r==="BLOCK_RECORD"&&o instanceof ie){o.dxfOutBlockRecord(e);continue}e.writeStart(r),o.dxfOut(e)}e.endTable()}writeDxfEntity(e,t){e.writeStart(t.dxfTypeName),t.dxfOut(e)}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._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(e,t,i,s){this.hasSysVarValueChanged(t,i)&&(s(i),this.triggerSysVarChangedEvent(e,t,i))}hasSysVarValueChanged(e,t){return e instanceof X&&t instanceof X||e instanceof J&&t instanceof J?!e.equals(t):e instanceof ve&&t instanceof ve?e.value!==t.value:!Object.is(e,t)}normalizeLinetypeName(e){const t=e.trim();return t.toUpperCase()==="BYLAYER"?pe:t.toUpperCase()==="BYBLOCK"?At:t}triggerSysVarChangedEvent(e,t,i){const s=Ne.instance(),r=e.toLowerCase();s.getDescriptor(r)!=null&&s.events.sysVarChanged.dispatch({database:this,name:r,oldVal:t,newVal:i})}getFileNameFromUri(e){try{const i=new URL(e).pathname.split("/");return i[i.length-1]||""}catch{return""}}}const Wl="Load Database",Va=3e4,ud=12e4,gd=1024*1024;class we extends eo{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=ar.getInstance().getEntry(Wl),i=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const s=await this.data.task(e);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",s?s.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),t&&(t.data[this.name]=Date.now()-i),s}}class Yr{constructor(e={}){this.config=e}async read(e,t,i,s,r,a){const o={name:Wl,data:{total:0},format(){let u="";return Object.keys(this.data).forEach(p=>{p!=="total"&&(u+=`- ${p}: ${this.data[p]} ms
8
+ `)}),u+=`- total: ${this.data.total} ms`,u}};ar.getInstance().collect(o),this.progress=s;const h={value:0},c=new to;c.setCompleteCallback(()=>this.onFinished()),c.setErrorCallback(u=>this.onError(u)),c.addTask(new we({stage:"START",step:1,progress:h,task:async u=>u},s)),c.addTask(new we({stage:"PARSE",step:5,progress:h,task:async u=>await this.parse(u,r)},s)),c.addTask(new we({stage:"FONT",step:5,progress:h,task:async u=>{const p=this.getFonts(u.model);return{model:u.model,data:p}}},s)),c.addTask(new we({stage:"LTYPE",step:1,progress:h,task:async u=>(this.processLineTypes(u.model,t),u)},s)),c.addTask(new we({stage:"STYLE",step:1,progress:h,task:async u=>(this.processTextStyles(u.model,t),u)},s)),c.addTask(new we({stage:"DIMSTYLE",step:1,progress:h,task:async u=>(this.processDimStyles(u.model,t),u)},s)),c.addTask(new we({stage:"LAYER",step:1,progress:h,task:async u=>(this.processLayers(u.model,t),t.tables.layerTable.numEntries===0&&t.createDefaultData({layer:!0}),u)},s)),c.addTask(new we({stage:"VPORT",step:1,progress:h,task:async u=>(this.processViewports(u.model,t),u)},s)),c.addTask(new we({stage:"HEADER",step:1,progress:h,task:async u=>{if(this.processHeader(u.model,t),a){const p=Ne.instance();for(const[g,m]of Object.entries(a))p.setVar(g,m,t)}return u}},s)),c.addTask(new we({stage:"BLOCK_RECORD",step:5,progress:h,task:async u=>(this.processBlockTables(u.model,t),u)},s)),c.addTask(new we({stage:"OBJECT",step:5,progress:h,task:async u=>(this.processObjects(u.model,t),t.objects.layout.numEntries===0&&t.createDefaultData({layout:!0}),u)},s)),c.addTask(new we({stage:"BLOCK",step:5,progress:h,task:async u=>(await this.processBlocks(u.model,t),u)},s)),c.addTask(new we({stage:"ENTITY",step:100,progress:h,task:async u=>(await this.processEntities(u.model,t,i,h,s),u)},s)),c.addTask(new we({stage:"END",step:0,progress:h,task:async u=>u},s));const d=Date.now();await c.run(e),o.data.total=Date.now()-d}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}return e.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),ri.instance.clear())}getParserWorkerTimeout(e,t){const i=t??this.config.timeout;if(i!=null)return i;const s=Math.ceil(e.byteLength/gd),r=Va+s*1e3;return Math.min(ud,Math.max(Va,r))}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,i,s,r){throw new Error("Not impelemented yet!")}}class pd 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(e){this._standardFlags=e}get viewWidth(){return this._viewWidth}set viewWidth(e){this._viewWidth=e}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(e){this._ucsAssociated=e}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(e){this._cameraPlottable=e}get ucsElevation(){return this._ucsElevation}set ucsElevation(e){this._ucsElevation=e}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(e){this._ucsObjectId=e}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(e){this._ucsBaseObjectId=e}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(e){this._liveSectionObjectId=e}dxfOutFields(e){return super.dxfOutFields(e),e.writeSubclassMarker("AcDbViewTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.standardFlags),e.writeDouble(40,this.gsView.viewHeight),e.writePoint2d(10,this.centerPoint),e.writeDouble(41,this.viewWidth),e.writePoint3d(11,this.gsView.viewDirectionFromTarget),e.writePoint3d(12,this.gsView.viewTarget),e.writeDouble(42,this.gsView.lensLength),e.writeDouble(43,this.gsView.frontClippingPlane),e.writeDouble(44,this.gsView.backClippingPlane),e.writeAngle(50,this.gsView.viewTwistAngle),e.writeInt16(71,this.gsView.viewMode),e.writeInt16(281,this.gsView.renderMode),e.writeInt16(72,this.ucsAssociated?1:0),e.writeInt16(73,this.cameraPlottable?1:0),e.writeObjectId(332,this.backgroundObjectId),e.writeObjectId(334,this.liveSectionObjectId),e.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(e.writePoint3d(110,this.gsView.ucsOrigin),e.writePoint3d(111,this.gsView.ucsXAxis),e.writePoint3d(112,this.gsView.ucsYAxis),e.writeInt16(79,this.gsView.orthographicType),e.writeDouble(146,this.ucsElevation),e.writeObjectId(345,this.ucsObjectId),e.writeObjectId(346,this.ucsBaseObjectId)),this}}var re,yi,Z,ee,_i,Ye,Xt,Ke,me,Ze,Xe,Rt,Bt,Ft,Se,Qe,fi,xi,Dt,Vt,wi,bi,Li,Ae,Je,U,zt,Si,N,ye,Ai,_e,Ii,et,H,Pi,tt,jt,Cs,vs,Re,Ei,Ht,Ie,it,nt,st,Ti,Mi,rt,Wt,Gt,Ns,ki,Ut,at,$t,ae,ot,Pe,Os,oe,Ys,lt,Ee,qt,Ci,Kt,Te,ht,Me,ct,Xs,Zt,ke;(re={})[re.None=0]="None",re[re.Anonymous=1]="Anonymous",re[re.NonConstant=2]="NonConstant",re[re.Xref=4]="Xref",re[re.XrefOverlay=8]="XrefOverlay",re[re.ExternallyDependent=16]="ExternallyDependent",re[re.ResolvedOrDependent=32]="ResolvedOrDependent",re[re.ReferencedXref=64]="ReferencedXref";(yi={})[yi.BYBLOCK=0]="BYBLOCK",yi[yi.BYLAYER=256]="BYLAYER";(Z={})[Z.Rotated=0]="Rotated",Z[Z.Aligned=1]="Aligned",Z[Z.Angular=2]="Angular",Z[Z.Diameter=3]="Diameter",Z[Z.Radius=4]="Radius",Z[Z.Angular3Point=5]="Angular3Point",Z[Z.Ordinate=6]="Ordinate",Z[Z.ReferenceIsExclusive=32]="ReferenceIsExclusive",Z[Z.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Z[Z.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(ee={})[ee.TopLeft=1]="TopLeft",ee[ee.TopCenter=2]="TopCenter",ee[ee.TopRight=3]="TopRight",ee[ee.MiddleLeft=4]="MiddleLeft",ee[ee.MiddleCenter=5]="MiddleCenter",ee[ee.MiddleRight=6]="MiddleRight",ee[ee.BottomLeft=7]="BottomLeft",ee[ee.BottomCenter=8]="BottomCenter",ee[ee.BottomRight=9]="BottomRight";(_i={})[_i.AtLeast=1]="AtLeast",_i[_i.Exact=2]="Exact";var za=((Ye={})[Ye.Center=0]="Center",Ye[Ye.Above=1]="Above",Ye[Ye.Outside=2]="Outside",Ye[Ye.JIS=3]="JIS",Ye[Ye.Below=4]="Below",Ye);(Xt={})[Xt.WithDimension=0]="WithDimension",Xt[Xt.AddLeader=1]="AddLeader",Xt[Xt.Independent=2]="Independent";(Ke={})[Ke.BothOutside=0]="BothOutside",Ke[Ke.ArrowFirst=1]="ArrowFirst",Ke[Ke.TextFirst=2]="TextFirst",Ke[Ke.Auto=3]="Auto";var li=((me={})[me.Feet=0]="Feet",me[me.None=1]="None",me[me.Inch=2]="Inch",me[me.FeetAndInch=3]="FeetAndInch",me[me.Leading=4]="Leading",me[me.Trailing=8]="Trailing",me[me.LeadingAndTrailing=12]="LeadingAndTrailing",me),md=((Ze={})[Ze.None=0]="None",Ze[Ze.Leading=1]="Leading",Ze[Ze.Trailing=2]="Trailing",Ze[Ze.LeadingAndTrailing=3]="LeadingAndTrailing",Ze),yd=((Xe={})[Xe.Center=0]="Center",Xe[Xe.First=1]="First",Xe[Xe.Second=2]="Second",Xe[Xe.OverFirst=3]="OverFirst",Xe[Xe.OverSecond=4]="OverSecond",Xe),_d=((Rt={})[Rt.Bottom=0]="Bottom",Rt[Rt.Center=1]="Center",Rt[Rt.Top=2]="Top",Rt);(Bt={})[Bt.None=0]="None",Bt[Bt.UseDrawingBackground=1]="UseDrawingBackground",Bt[Bt.Custom=2]="Custom";(Ft={})[Ft.Horizontal=0]="Horizontal",Ft[Ft.Diagonal=1]="Diagonal",Ft[Ft.NotStacked=2]="NotStacked";(Se={})[Se.Scientific=1]="Scientific",Se[Se.Decimal=2]="Decimal",Se[Se.Engineering=3]="Engineering",Se[Se.Architectural=4]="Architectural",Se[Se.Fractional=5]="Fractional",Se[Se.WindowDesktop=6]="WindowDesktop";(Qe={})[Qe.Decimal=0]="Decimal",Qe[Qe.DegreesMinutesSecond=1]="DegreesMinutesSecond",Qe[Qe.Gradian=2]="Gradian",Qe[Qe.Radian=3]="Radian";var fd=((fi={})[fi.PatternFill=0]="PatternFill",fi[fi.SolidFill=1]="SolidFill",fi);(xi={})[xi.NonAssociative=0]="NonAssociative",xi[xi.Associative=1]="Associative";(Dt={})[Dt.Normal=0]="Normal",Dt[Dt.Outer=1]="Outer",Dt[Dt.Ignore=2]="Ignore";(Vt={})[Vt.UserDefined=0]="UserDefined",Vt[Vt.Predefined=1]="Predefined",Vt[Vt.Custom=2]="Custom";(wi={})[wi.NotAnnotated=0]="NotAnnotated",wi[wi.Annotated=1]="Annotated";(bi={})[bi.Solid=0]="Solid",bi[bi.Gradient=1]="Gradient";(Li={})[Li.TwoColor=0]="TwoColor",Li[Li.OneColor=1]="OneColor";var xd=((Ae={})[Ae.Default=0]="Default",Ae[Ae.External=1]="External",Ae[Ae.Polyline=2]="Polyline",Ae[Ae.Derived=4]="Derived",Ae[Ae.Textbox=8]="Textbox",Ae[Ae.Outermost=16]="Outermost",Ae),An=((Je={})[Je.Line=1]="Line",Je[Je.Circular=2]="Circular",Je[Je.Elliptic=3]="Elliptic",Je[Je.Spline=4]="Spline",Je),wd=((U={})[U.Off=0]="Off",U[U.Solid=1]="Solid",U[U.Dashed=2]="Dashed",U[U.Dotted=3]="Dotted",U[U.ShotDash=4]="ShotDash",U[U.MediumDash=5]="MediumDash",U[U.LongDash=6]="LongDash",U[U.DoubleShortDash=7]="DoubleShortDash",U[U.DoubleMediumDash=8]="DoubleMediumDash",U[U.DoubleLongDash=9]="DoubleLongDash",U[U.DoubleMediumLongDash=10]="DoubleMediumLongDash",U[U.SparseDot=11]="SparseDot",U);wd.Off;(zt={})[zt.Standard=-3]="Standard",zt[zt.ByLayer=-2]="ByLayer",zt[zt.ByBlock=-1]="ByBlock";(Si={})[Si.English=0]="English",Si[Si.Metric=1]="Metric";(N={})[N.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",N[N.FRONT_CLIPPING=2]="FRONT_CLIPPING",N[N.BACK_CLIPPING=4]="BACK_CLIPPING",N[N.UCS_FOLLOW=8]="UCS_FOLLOW",N[N.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",N[N.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",N[N.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",N[N.FAST_ZOOM=128]="FAST_ZOOM",N[N.SNAP_MODE=256]="SNAP_MODE",N[N.GRID_MODE=512]="GRID_MODE",N[N.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",N[N.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",N[N.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",N[N.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",N[N.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",N[N.UNUSED=32768]="UNUSED",N[N.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",N[N.VIEWPORT_OFF=131072]="VIEWPORT_OFF",N[N.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",N[N.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",N[N.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",N[N.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(ye={})[ye.OPTIMIZED_2D=0]="OPTIMIZED_2D",ye[ye.WIREFRAME=1]="WIREFRAME",ye[ye.HIDDEN_LINE=2]="HIDDEN_LINE",ye[ye.FLAT_SHADED=3]="FLAT_SHADED",ye[ye.GOURAUD_SHADED=4]="GOURAUD_SHADED",ye[ye.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",ye[ye.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(Ai={})[Ai.UCS_UNCHANGED=0]="UCS_UNCHANGED",Ai[Ai.HAS_OWN_UCS=1]="HAS_OWN_UCS";(_e={})[_e.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",_e[_e.TOP=1]="TOP",_e[_e.BOTTOM=2]="BOTTOM",_e[_e.FRONT=3]="FRONT",_e[_e.BACK=4]="BACK",_e[_e.LEFT=5]="LEFT",_e[_e.RIGHT=6]="RIGHT";(Ii={})[Ii.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ii[Ii.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(et={})[et.ByLayer=0]="ByLayer",et[et.ByBlock=1]="ByBlock",et[et.ByDictionaryDefault=2]="ByDictionaryDefault",et[et.ByObject=3]="ByObject";(H={})[H.NotAllowed=0]="NotAllowed",H[H.AllowErase=1]="AllowErase",H[H.AllowTransform=2]="AllowTransform",H[H.AllowChangeColor=4]="AllowChangeColor",H[H.AllowChangeLayer=8]="AllowChangeLayer",H[H.AllowChangeLinetype=16]="AllowChangeLinetype",H[H.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",H[H.AllowChangeVisibility=64]="AllowChangeVisibility",H[H.AllowClone=128]="AllowClone",H[H.AllowChangeLineweight=256]="AllowChangeLineweight",H[H.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",H[H.AllowAllExceptClone=895]="AllowAllExceptClone",H[H.AllowAll=1023]="AllowAll",H[H.DisableProxyWarning=1024]="DisableProxyWarning",H[H.R13FormatProxy=32768]="R13FormatProxy";function O(n,e,t){return n.code===e&&(t==null||n.value===t)}function Ct(n){let e={};n.rewind();let t=n.next(),i=t.code;if(e.x=t.value,(t=n.next()).code!==i+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=n.next()).code!==i+20?n.rewind():e.z=t.value,e}let cn=Symbol();function T(n,e){return(t,i,s)=>{let r=function(h,c=!1){return h.reduce((d,u)=>{u.pushContext&&d.push({});let p=d[d.length-1];for(let g of typeof u.code=="number"?[u.code]:u.code){let m=p[g]??(p[g]=[]);u.isMultiple&&m.length,m.push(u)}return d},[{}])}(n,i.debug),a=!1,o=r.length-1;for(;!O(t,0,"EOF");){let h=function(_,f,S){return _.find((L,M)=>{var I;return M>=S&&((I=L[f])==null?void 0:I.length)})}(r,t.code,o),c=h==null?void 0:h[t.code],d=c==null?void 0:c[c.length-1];if(!h||!d){i.rewind();break}d.isMultiple||h[t.code].pop();let{name:u,parser:p,isMultiple:g,isReducible:m}=d,y=p==null?void 0:p(t,i,s);if(y===cn){i.rewind();break}if(u){let[_,f]=bd(s,u);g&&!m?(Object.prototype.hasOwnProperty.call(_,f)||(_[f]=[]),_[f].push(y)):_[f]=y}d.pushContext&&(o-=1),a=!0,t=i.next()}return e&&Object.setPrototypeOf(s,e),a}}function bd(n,e){let t=e.split(".");if(!t.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let i=n;for(let s=0;s<t.length-1;++s){let r=Rs(t[s]),a=Rs(t[s+1]);Object.prototype.hasOwnProperty.call(i,r)||(typeof a=="number"?i[r]=[]:i[r]={}),i=i[r]}return[i,Rs(t[t.length-1])]}function Rs(n){let e=Number.parseInt(n);return Number.isNaN(e)?n:e}function l({value:n}){return n}function b(n,e){return Ct(e)}function E({value:n}){return!!n}function Ld({value:n}){return n.trim()}let Sd=[{code:281,name:"isEntity",parser:E},{code:280,name:"wasProxy",parser:E},{code:91,name:"instanceCount",parser:l},{code:90,name:"proxyFlag",parser:l},{code:3,name:"appName",parser:l},{code:2,name:"cppClassName",parser:l},{code:1,name:"name",parser:l}],Ad=T(Sd),Id=[{code:0,name:"classes",isMultiple:!0,parser(n,e){if(n.value!=="CLASS")return cn;n=e.next();let t={};return Ad(n,e,t),t}}],Pd=T(Id);(Pi={})[Pi.RayTrace=0]="RayTrace",Pi[Pi.ShadowMap=1]="ShadowMap";function $e(n,e,t){for(;O(n,102);){var i;let s=n.value;if(n=e.next(),!s.startsWith("{")){e.debug,function(a,o){for(;!O(a,102)&&!O(a,0,"EOF");)a=o.next()}(n,e),n=e.next();continue}let r=s.slice(1).trim();t.extensions??(t.extensions={}),(i=t.extensions)[r]??(i[r]=[]),function(a,o,h){for(;!O(a,102,"}")&&!O(a,0,"EOF");)h.push(a),a=o.next()}(n,e,t.extensions[r]),n=e.next()}e.rewind()}let Ed=[{code:1001,name:"xdata",isMultiple:!0,parser:Gl}],Td=new Set([1010,1011,1012,1013]);function Gl(n,e){var s;if(!O(n,1001))throw Error("XData must starts with code 1001");let t={appName:n.value,value:[]};n=e.next();let i=[t.value];for(;!O(n,0,"EOF")&&!O(n,1001)&&n.code>=1e3;){let r=i[i.length-1];if(n.code===1002){n.value==="{"?i.push([]):(i.pop(),(s=i[i.length-1])==null||s.push(r)),n=e.next();continue}Td.has(n.code)?r.push(Ct(e)):r.push(n.value),n=e.next()}return e.rewind(),t}(tt={})[tt.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",tt[tt.CAST=1]="CAST",tt[tt.RECEIVE=2]="RECEIVE",tt[tt.IGNORE=3]="IGNORE";let V=[...Ed,{code:284,name:"shadowMode",parser:l},{code:390,name:"plotStyleHardId",parser:l},{code:380,name:"plotStyleType",parser:l},{code:440,name:"transparency",parser:l},{code:430,name:"colorName",parser:l},{code:420,name:"color",parser:l},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(n,e,t)=>(t.proxyEntity??"")+n.value},{code:[92,160],name:"proxyByte",parser:l},{code:60,name:"isVisible",parser:E},{code:48,name:"lineTypeScale",parser:l},{code:370,name:"lineweight",parser:l},{code:62,name:"colorIndex",parser:l},{code:347,name:"materialObjectHardId",parser:l},{code:6,name:"lineType",parser:l},{code:8,name:"layer",parser:l},{code:410,name:"layoutTabName",parser:l},{code:67,name:"isInPaperSpace",parser:E},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:l},{code:102,parser:$e},{code:102,parser:$e},{code:102,parser:$e},{code:5,name:"handle",parser:l}];function Ls(n){return[{code:3,name:n,parser:(e,t,i)=>(i._code3text=(i._code3text??"")+e.value,i._code3text+(i._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(e,t,i)=>(i._code1text=e.value,(i._code3text??"")+i._code1text)}]}function Ul(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Md={extrusionDirection:{x:0,y:0,z:1}},kd=[{code:210,name:"extrusionDirection",parser:b},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:100,name:"subclassMarker",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100},...V];class $l{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Ul(this,"parser",T(kd,Md))}}Ul($l,"ForEntityName","ARC");(jt={})[jt.BeforeText=0]="BeforeText",jt[jt.AboveText=1]="AboveText",jt[jt.None=2]="None";let Xr=[{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:za.Above,defaultValueImperial:za.Center},{name:"DIMZIN",code:78,defaultValue:li.Trailing,defaultValueImperial:li.Feet},{name:"DIMAZIN",code:79,defaultValue:md.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:yd.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:_d.Center},{name:"DIMTZIN",code:284,defaultValue:li.Trailing,defaultValueImperial:li.Feet},{name:"DIMALTZ",code:285,defaultValue:li.Trailing},{name:"DIMALTTZ",code:286,defaultValue:li.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}],ql=[{code:3,name:"styleName",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:51,name:"ocsRotation",parser:l},{code:53,name:"textRotation",parser:l},{code:1,name:"text",parser:l},{code:42,name:"measurement",parser:l},{code:72,name:"textLineSpacingStyle",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:70,name:"dimensionType",parser:l},{code:11,name:"textPoint",parser:b},{code:10,name:"definitionPoint",parser:b},{code:2,name:"name",parser:l},{code:280,name:"version",parser:l},{code:100}],Cd=[{code:100},{code:52,name:"obliqueAngle",parser:l},{code:50,name:"rotationAngle",parser:l},{code:14,name:"subDefinitionPoint2",parser:b},{code:13,name:"subDefinitionPoint1",parser:b},{code:12,name:"insertionPoint",parser:b},{code:100,name:"subclassMarker",parser:l}],vd=[{code:16,name:"arcPoint",parser:b},{code:15,name:"centerPoint",parser:b},{code:14,name:"subDefinitionPoint2",parser:b},{code:13,name:"subDefinitionPoint1",parser:b},{code:100,name:"subclassMarker",parser:l}],Nd=[{code:14,name:"subDefinitionPoint2",parser:b},{code:13,name:"subDefinitionPoint1",parser:b},{code:100,name:"subclassMarker",parser:l}],Od=[{code:40,name:"leaderLength",parser:l},{code:15,name:"subDefinitionPoint",parser:b},{code:100,name:"subclassMarker",parser:l}],Yd=[{code:100,parser(n,e,t){let i=function(s){switch(s){case"AcDbAlignedDimension":return T(Cd);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return T(vd);case"AcDbOrdinateDimension":return T(Nd);case"AcDbRadialDimension":case"AcDbDiametricDimension":return T(Od)}return null}(n.value);if(!i)return cn;i(n,e,t)},pushContext:!0},...Xr.map(n=>({...n,parser:l})),...ql,...V];class vn{parseEntity(e,t){let i={};return T(Yd)(t,e,i),i}}(Cs="ForEntityName")in vn?Object.defineProperty(vn,Cs,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):vn[Cs]="DIMENSION";let Xd=[{code:73},{code:17,name:"leaderEnd",parser:b},{code:16,name:"leaderStart",parser:b},{code:71,name:"hasLeader",parser:E},{code:41,name:"endAngle",parser:l},{code:40,name:"startAngle",parser:l},{code:70,name:"isPartial",parser:E},{code:15,name:"centerPoint",parser:b},{code:14,name:"xline2Point",parser:b},{code:13,name:"xline1Point",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...Xr.map(n=>({...n,parser:l})),...ql,...V];class Nn{parseEntity(e,t){let i={};return T(Xd)(t,e,i),i}}(vs="ForEntityName")in Nn?Object.defineProperty(Nn,vs,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):Nn[vs]="ARC_DIMENSION";(Re={})[Re.NONE=0]="NONE",Re[Re.INVISIBLE=1]="INVISIBLE",Re[Re.CONSTANT=2]="CONSTANT",Re[Re.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Re[Re.PRESET=8]="PRESET";(Ei={})[Ei.MULTILINE=2]="MULTILINE",Ei[Ei.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(Ht={})[Ht.NONE=0]="NONE",Ht[Ht.MIRRORED_X=2]="MIRRORED_X",Ht[Ht.MIRRORED_Y=4]="MIRRORED_Y";var Rd=((Ie={})[Ie.LEFT=0]="LEFT",Ie[Ie.CENTER=1]="CENTER",Ie[Ie.RIGHT=2]="RIGHT",Ie[Ie.ALIGNED=3]="ALIGNED",Ie[Ie.MIDDLE=4]="MIDDLE",Ie[Ie.FIT=5]="FIT",Ie),Bd=((it={})[it.BASELINE=0]="BASELINE",it[it.BOTTOM=1]="BOTTOM",it[it.MIDDLE=2]="MIDDLE",it[it.TOP=3]="TOP",it);function Kl(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Zl={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Rd.LEFT,valign:Bd.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Ql=[{code:73,name:"valign",parser:l},{code:100},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:72,name:"valign",parser:l},{code:72,name:"halign",parser:l},{code:71,name:"generationFlag",parser:l},{code:7,name:"styleName",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"xScale",parser:l},{code:50,name:"rotation",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Jl{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Kl(this,"parser",T(Ql,Zl))}}function eh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Kl(Jl,"ForEntityName","TEXT");let Fd={...Zl},Dd=[{code:2},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:E},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedRecord",parser:E},{code:100},{code:280,name:"isLocked",parser:E},{code:74,name:"valign",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:3,name:"prompt",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},...Ql.slice(2)];class th{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){eh(this,"parser",T(Dd,Fd))}}function Vd(n,e){let t={};for(let i of n){let s=e(i);s!=null&&(t[s]??(t[s]=[]),t[s].push(i))}return t}function*gs(n,e=1/0,t=1){for(let i=n;i!==e;i+=t)yield i}function sr(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}eh(th,"ForEntityName","ATTDEF");var zd=[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 jd(n){return zd[n]}function Hd(n){n.rewind();let e=n.next();if(e.code!==101)throw Error("Bad call for skipEmbeddedObject()");do e=n.next();while(e.code!==0);n.rewind()}function Wd(n,e,t){if(O(e,102))return $e(e,t,n),!0;switch(e.code){case 0:n.type=e.value;break;case 5:n.handle=e.value;break;case 330:n.ownerBlockRecordSoftId=e.value;break;case 67:n.isInPaperSpace=!!e.value;break;case 8:n.layer=e.value;break;case 6:n.lineType=e.value;break;case 347:n.materialObjectHardId=e.value;break;case 62:n.colorIndex=e.value,n.color=jd(Math.abs(e.value));break;case 370:n.lineweight=e.value;break;case 48:n.lineTypeScale=e.value;break;case 60:n.isVisible=!!e.value;break;case 92:n.proxyByte=e.value;break;case 310:n.proxyEntity=e.value;break;case 100:break;case 420:n.color=e.value;break;case 430:n.transparency=e.value;break;case 390:n.plotStyleHardId=e.value;break;case 284:n.shadowMode=e.value;break;case 1001:(n.xdata??(n.xdata=[])).push(Gl(e,t));break;default:return!1}return!0}function ih(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Gd={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},On=[{code:46,name:"annotationHeight",parser:l},{code:101,parser(n,e){Hd(e)}},{code:50,name:"columnHeight",parser:l},{code:49,name:"columnGutter",parser:l},{code:48,name:"columnWidth",parser:l},{code:79,name:"columnAutoHeight",parser:l},{code:78,name:"columnFlowReversed",parser:l},{code:76,name:"columnCount",parser:l},{code:75,name:"columnType",parser:l},{code:441,name:"backgroundFillTransparency",parser:l},{code:63,name:"backgroundFillColor",parser:l},{code:45,name:"fillBoxScale",parser:l},{code:[...gs(430,440)],name:"backgroundColor",parser:l},{code:[...gs(420,430)],name:"backgroundColor",parser:l},{code:90,name:"backgroundFill",parser:l},{code:44,name:"lineSpacing",parser:l},{code:73,name:"lineSpacingStyle",parser:l},{code:50,name:"rotation",parser:l},{code:43},{code:42},{code:11,name:"direction",parser:b},{code:210,name:"extrusionDirection",parser:b},{code:7,name:"styleName",parser:l},...Ls("text"),{code:72,name:"drawingDirection",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:10,name:"insertionPoint",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class nh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ih(this,"parser",T(On,Gd))}}function sh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ih(nh,"ForEntityName","MTEXT");let Ud={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},$d=[...On.slice(On.findIndex(({name:n})=>n==="columnType"),On.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!O(n,0,"MTEXT"))return cn}},{code:2,name:"definitionTag",parser:l},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardId",parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:E},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedEntriesKeep",parser:E},{code:100},{code:280,name:"lockPositionFlag",parser:E},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"alignmentPoint",parser:b},{code:74,name:"verticalJustification",parser:l},{code:72,name:"horizontalJustification",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:7,name:"textStyle",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"scale",parser:l},{code:50,name:"rotation",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100},...V];class rh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){sh(this,"parser",T($d,Ud))}}function ah(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}sh(rh,"ForEntityName","ATTRIB");let qd=[...Ls("data"),{code:70,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class oh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ah(this,"parser",T(qd))}}function lh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ah(oh,"ForEntityName","BODY");let Kd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Zd=[{code:210,name:"extrusionDirection",parser:b},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class hh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){lh(this,"parser",T(Zd,Kd))}}function ch(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}lh(hh,"ForEntityName","CIRCLE");let Qd={extrusionDirection:{x:0,y:0,z:1}},Jd=[{code:42,name:"endAngle",parser:l},{code:41,name:"startAngle",parser:l},{code:40,name:"axisRatio",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"majorAxisEndPoint",parser:b},{code:10,name:"center",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class dh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ch(this,"parser",T(Jd,Qd))}}function uh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ch(dh,"ForEntityName","ELLIPSE");let eu=[{code:13,name:"vertices.3",parser:b},{code:12,name:"vertices.2",parser:b},{code:11,name:"vertices.1",parser:b},{code:10,name:"vertices.0",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class gh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){uh(this,"parser",T(eu))}}uh(gh,"ForEntityName","3DFACE");(nt={})[nt.First=1]="First",nt[nt.Second=2]="Second",nt[nt.Third=4]="Third",nt[nt.Fourth=8]="Fourth";let ph=[{code:330,name:"sourceBoundaryObjects",parser:l,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:l}],tu=[{code:11,name:"end",parser:b},{code:10,name:"start",parser:b}],iu=[{code:73,name:"isCCW",parser:E},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b}],nu=[{code:73,name:"isCCW",parser:E},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"lengthOfMinorAxis",parser:l},{code:11,name:"end",parser:b},{code:10,name:"center",parser:b}],su=[{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:11,name:"fitDatum",isMultiple:!0,parser:b},{code:97,name:"numberOfFitData",parser:l},{code:10,name:"controlPoints",isMultiple:!0,parser(n,e){let t={...Ct(e),weight:1};return(n=e.next()).code===42?t.weight=n.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:l},{code:96,name:"numberOfControlPoints",parser:l},{code:95,name:"numberOfKnots",parser:l},{code:74,name:"isPeriodic",parser:E},{code:73,name:"splineFlag",parser:l},{code:94,name:"degree",parser:l}],ru={[An.Line]:tu,[An.Circular]:iu,[An.Elliptic]:nu,[An.Spline]:su},au=[...ph,{code:72,name:"edges",parser(n,e){let t={type:n.value},i=T(ru[t.type]);if(!i)throw Error(`Invalid edge type ${t.type}`);return i(n=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:l}],ou=[...ph,{code:10,name:"vertices",parser(n,e){let t={...Ct(e),bulge:0};return(n=e.next()).code===42?t.bulge=n.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:l},{code:73,name:"isClosed",parser:E},{code:72,name:"hasBulge",parser:E}];function lu(n,e){let t={boundaryPathTypeFlag:n.value},i=t.boundaryPathTypeFlag&xd.Polyline;return n=e.next(),i?T(ou)(n,e,t):T(au)(n,e,t),t}let hu=[{code:49,name:"dashLengths",parser:l,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:l},{code:45,name:"offset",parser:ja},{code:43,name:"base",parser:ja},{code:53,name:"angle",parser:l}];function ja(n,e){let t=n.code+1,i={x:n.value,y:1};return(n=e.next()).code===t?i.y=n.value:e.rewind(),i}function cu(n,e){let t={};return T(hu)(n,e,t),t}function du(n,e){let t=[];for(;n.code===463;){let i={reservedField:n.value};if((n=e.next()).code===63&&(i.colorIndex=n.value,n=e.next()),n.code===421)i.rgb=n.value,t.push(i),n=e.next();else{e.rewind();break}}return n.code!==463&&t.length>0&&e.rewind(),t}function mh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let uu={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},gu=[{code:470,name:"gradientName",parser:l},{code:463,name:"gradientColors",parser:du},{code:462,name:"colorTint",parser:l},{code:461,name:"gradientDefinition",parser:l},{code:460,name:"gradientRotation",parser:l},{code:453,name:"numberOfColors",parser:l},{code:452,name:"gradientColorFlag",parser:l},{code:451},{code:450,name:"gradientFlag",parser:l},{code:10,name:"seedPoints",parser:b,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:b},{code:98,name:"numberOfSeedPoints",parser:l},{code:47,name:"pixelSize",parser:l},{code:53,name:"definitionLines",parser:cu,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:l},{code:77,name:"isDouble",parser:E},{code:73,name:"isAnnotated",parser:E},{code:41,name:"patternScale",parser:l},{code:52,name:"patternAngle",parser:l},{code:76,name:"patternType",parser:l},{code:75,name:"hatchStyle",parser:l},{code:92,name:"boundaryPaths",parser:lu,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:l},{code:71,name:"associativity",parser:l},{code:63,name:"patternFillColor",parser:l},{code:70,name:"solidFill",parser:l},{code:2,name:"patternName",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:10,name:"elevationPoint",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V];class yh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){mh(this,"parser",T(gu,uu))}}function _h(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}mh(yh,"ForEntityName","HATCH");let pu={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},mu=[{code:290,name:"clipMode",parser:l},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:b},{code:91,name:"countBoundaryPoints",parser:l},{code:71,name:"clippingBoundaryType",parser:l},{code:360,name:"imageDefReactorHandle",parser:l},{code:283,name:"fade",parser:l},{code:282,name:"contrast",parser:l},{code:281,name:"brightness",parser:l},{code:280,name:"isClipped",parser:E},{code:70,name:"flags",parser:l},{code:340,name:"imageDefHandle",parser:l},{code:13,name:"imageSize",parser:b},{code:12,name:"vPixel",parser:b},{code:11,name:"uPixel",parser:b},{code:10,name:"position",parser:b},{code:90,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class fh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){_h(this,"parser",T(mu,pu))}}_h(fh,"ForEntityName","IMAGE");(st={})[st.ShowImage=1]="ShowImage",st[st.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",st[st.UseClippingBoundary=4]="UseClippingBoundary",st[st.TransparencyIsOn=8]="TransparencyIsOn";(Ti={})[Ti.Rectangular=1]="Rectangular",Ti[Ti.Polygonal=2]="Polygonal";(Mi={})[Mi.Outside=0]="Outside",Mi[Mi.Inside=1]="Inside";function xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let yu={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},_u=[{code:210,name:"extrusionDirection",parser:b},{code:45,name:"rowSpacing",parser:l},{code:44,name:"columnSpacing",parser:l},{code:71,name:"rowCount",parser:l},{code:70,name:"columnCount",parser:l},{code:50,name:"rotation",parser:l},{code:43,name:"zScale",parser:l},{code:42,name:"yScale",parser:l},{code:41,name:"xScale",parser:l},{code:10,name:"insertionPoint",parser:b},{code:2,name:"name",parser:l},{code:66,name:"isVariableAttributes",parser:E},{code:100,name:"subclassMarker",parser:l},...V];class wh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){xh(this,"parser",T(_u,yu))}}function bh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}xh(wh,"ForEntityName","INSERT");let fu={isArrowheadEnabled:!0},xu=[{code:213,name:"offsetFromAnnotation",parser:b},{code:212,name:"offsetFromBlock",parser:b},{code:211,name:"horizontalDirection",parser:b},{code:210,name:"normal",parser:b},{code:340,name:"associatedAnnotation",parser:l},{code:77,name:"byBlockColor",parser:l},{code:10,name:"vertices",parser:b,isMultiple:!0},{code:76,name:"numberOfVertices",parser:l},{code:41,name:"textWidth",parser:l},{code:40,name:"textHeight",parser:l},{code:75,name:"isHooklineExists",parser:E},{code:74,name:"isHooklineSameDirection",parser:E},{code:73,name:"leaderCreationFlag",parser:l},{code:72,name:"isSpline",parser:E},{code:71,name:"isArrowheadEnabled",parser:E},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Lh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){bh(this,"parser",T(xu,fu))}}bh(Lh,"ForEntityName","LEADER");(rt={})[rt.TextAnnotation=0]="TextAnnotation",rt[rt.ToleranceAnnotation=1]="ToleranceAnnotation",rt[rt.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",rt[rt.NoAnnotation=3]="NoAnnotation";function Sh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let wu={thickness:0,extrusionDirection:{x:0,y:0,z:1}},bu=[{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Ah{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Sh(this,"parser",T(bu,wu))}}function Ih(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Sh(Ah,"ForEntityName","LINE");let Lu=[{code:280,name:"shadowMapSoftness",parser:l},{code:91,name:"shadowMapSize",parser:l},{code:73,name:"shadowType",parser:l},{code:293,name:"isShadowCast",parser:E},{code:51,name:"falloffAngle",parser:l},{code:50,name:"hotspotAngle",parser:l},{code:42,name:"limitEnd",parser:l},{code:41,name:"limitStart",parser:l},{code:292,name:"isAttenuationLimited",parser:E},{code:72,name:"attenuationType",parser:l},{code:11,name:"target",parser:b},{code:10,name:"position",parser:b},{code:40,name:"intensity",parser:l},{code:291,name:"isPlotGlyph",parser:E},{code:290,name:"isOn",parser:E},{code:421,name:"lightColorInstance",parser:l},{code:63,name:"lightColorIndex",parser:l},{code:70,name:"lightType",parser:l},{code:1,name:"name",parser:l},{code:90,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Ph{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Ih(this,"parser",T(Lu))}}Ih(Ph,"ForEntityName","LIGHT");(Wt={})[Wt.Distant=1]="Distant",Wt[Wt.Point=2]="Point",Wt[Wt.Spot=3]="Spot";(Gt={})[Gt.None=0]="None",Gt[Gt.InverseLinear=1]="InverseLinear",Gt[Gt.InverseSquare=2]="InverseSquare";let Su={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Au={bulge:0},Iu=[{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:91,name:"id",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l}],Pu=[{code:210,name:"extrusionDirection",parser:b},{code:10,name:"vertices",isMultiple:!0,parser(n,e){let t={};return T(Iu,Au)(n,e,t),t}},{code:39,name:"thickness",parser:l},{code:38,name:"elevation",parser:l},{code:43,name:"constantWidth",parser:l},{code:70,name:"flag",parser:l},{code:90,name:"numberOfVertices",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Yn{parseEntity(e,t){let i={};return T(Pu,Su)(t,e,i),i}}(Ns="ForEntityName")in Yn?Object.defineProperty(Yn,Ns,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):Yn[Ns]="LWPOLYLINE";(ki={})[ki.IS_CLOSED=1]="IS_CLOSED",ki[ki.PLINE_GEN=128]="PLINE_GEN";function Eh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Eu=[{code:90,name:"overridenSubEntityCount",parser:l},{code:140,name:"edgeCreaseWeights",parser:l,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:l},{code:94,parser(n,e,t){t.edgeCount=n.value,t.edgeIndices=[];for(let i=0;i<t.edgeCount;++i){let s=[];n=e.next(),s[0]=n.value,n=e.next(),s[1]=n.value,t.edgeIndices.push(s)}}},{code:93,parser(n,e,t){t.totalFaceIndices=n.value,t.faceIndices=[];let i=[];for(let r=0;r<t.totalFaceIndices&&!O(n,0);++r)n=e.next(),i.push(n.value);let s=0;for(;s<i.length;){let r=i[s++],a=[];for(let o=0;o<r;++o)a.push(i[s++]);t.faceIndices.push(a)}}},{code:10,name:"vertices",parser:b,isMultiple:!0},{code:92,name:"verticesCount",parser:l},{code:91,name:"subdivisionLevel",parser:l},{code:40,name:"blendCrease",parser:l},{code:72,name:"isBlendCreased",parser:E},{code:71,name:"version",parser:l},{code:100,name:"subclassMarker",parser:Ld,pushContext:!0},...V];class Th{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Eh(this,"parser",T(Eu))}}function Mh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Eh(Th,"ForEntityName","MESH");let Tu=[{code:42,name:"fillParameters",parser:l,isMultiple:!0},{code:75,name:"fillCount",parser:l},{code:41,name:"parameters",parser:l,isMultiple:!0},{code:74,name:"parameterCount",parser:l}],Mu=[{code:[74,41,75,42],name:"elements",parser(n,e){let t=T(Tu),i={};return t(n,e,i),i},isMultiple:!0},{code:13,name:"miterDirection",parser:b},{code:12,name:"direction",parser:b},{code:11,name:"position",parser:b}],ku=[{code:[11,12,13],name:"segments",parser(n,e){let t=T(Mu),i={};return t(n,e,i),i},isMultiple:!0},{code:210,name:"extrusionDirection",parser:b},{code:10,name:"startPosition",parser:b},{code:73,name:"styleCount",parser:l},{code:72,name:"vertexCount",parser:l},{code:71,name:"flags",parser:l},{code:70,name:"justification",parser:l},{code:40,name:"scale",parser:l},{code:340,name:"styleObjectHandle",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V];class kh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Mh(this,"parser",T(ku))}}Mh(kh,"ForEntityName","MLINE");(Ut={})[Ut.Top=0]="Top",Ut[Ut.Zero=1]="Zero",Ut[Ut.Bottom=2]="Bottom";(at={})[at.HasVertex=1]="HasVertex",at[at.Closed=2]="Closed",at[at.SuppressStartCaps=4]="SuppressStartCaps",at[at.SuppressEndCaps=8]="SuppressEndCaps";($t={})[$t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",$t[$t.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",$t[$t.BY_STYLE=5]="BY_STYLE";function Ch(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Cu={},vu=[{code:300,parser:function(n,e,t){var r;let i;if(n.value==="CONTEXT_DATA{")for(;e.hasNext();){var s;if((i=e.next()).code===301)break;switch(i.code){case 10:t.contentBasePosition=le(i,e);break;case 11:t.normal=le(i,e);break;case 12:t.textAnchor=le(i,e);break;case 13:t.textDirection=le(i,e);break;case 14:dt(t).normal=le(i,e);break;case 15:dt(t).position=le(i,e);break;case 16:dt(t).scale=le(i,e);break;case 40:t.contentScale=i.value;break;case 41:case 44:t.textHeight=i.value;break;case 42:t.textRotation=i.value;break;case 43:t.textWidth=i.value;break;case 45:t.textLineSpacingFactor=i.value;break;case 46:dt(t).rotation=i.value;break;case 47:(s=dt(t)).transformationMatrix??(s.transformationMatrix=[]),(r=dt(t).transformationMatrix)==null||r.push(i.value);break;case 90:t.textColor=i.value;break;case 91:t.textBackgroundColor=i.value;break;case 92:t.textBackgroundTransparency=i.value;break;case 93:dt(t).color=i.value;break;case 110:t.planeOrigin=le(i,e);break;case 111:t.planeXAxisDirection=le(i,e);break;case 112:t.planeYAxisDirection=le(i,e);break;case 140:t.arrowheadSize=i.value;break;case 141:t.textBackgroundScaleFactor=i.value;break;case 142:t.textColumnWidth=i.value;break;case 143:t.textColumnGutterWidth=i.value;break;case 144:t.textColumnHeight=i.value;break;case 145:t.landingGap=i.value;break;case 170:t.textLineSpacingStyle=i.value;break;case 171:t.textAttachment=i.value;break;case 172:t.textFlowDirection=i.value;break;case 173:t.textColumnType=i.value;break;case 290:t.hasMText=i.value;break;case 291:t.textBackgroundColorOn=i.value;break;case 292:t.textFillOn=i.value;break;case 293:t.textUseAutoHeight=i.value;break;case 294:t.textColumnFlowReversed=i.value;break;case 295:t.textUseWordBreak=i.value;break;case 296:t.hasBlock=i.value;break;case 297:t.planeNormalReversed=i.value;break;case 302:i.value==="LEADER{"&&(t.leaderSections??(t.leaderSections=[]),t.leaderSections.push(function(a,o){let h,c;if(a.value!=="LEADER{")return{leaderLines:[]};let d={leaderLines:[]};for(;o.hasNext();){if((c=o.next()).code===303){In(d,h);break}switch(c.code){case 290:d.lastLeaderLinePointSet=c.value;break;case 291:d.doglegVectorSet=c.value;break;case 10:d.lastLeaderLinePoint=le(c,o);break;case 11:d.doglegVector=le(c,o);break;case 12:h??(h={}),h.start=le(c,o);break;case 13:h??(h={}),h.end=le(c,o),In(d,h),h=void 0;break;case 90:d.leaderBranchIndex=c.value;break;case 40:d.doglegLength=c.value;break;case 304:c.value==="LEADER_LINE{"&&d.leaderLines.push(function(u,p){let g,m;if(u.value!=="LEADER_LINE{")return{vertices:[]};let y={vertices:[]};for(;p.hasNext();){if((m=p.next()).code===305){In(y,g);break}switch(m.code){case 10:y.vertices.push(le(m,p));break;case 11:g??(g={}),g.start=le(m,p);break;case 12:g??(g={}),g.end=le(m,p),In(y,g),g=void 0;break;case 90:y.breakPointIndexes??(y.breakPointIndexes=[]),y.breakPointIndexes.push(m.value),g??(g={}),g.index=m.value;break;case 91:y.leaderLineIndex=m.value}}return y}(c,o))}}return d}(i,e)));break;case 304:i.value!=="LEADER_LINE{"&&(t.textContent=i.value,t.contentType??(t.contentType=2));break;case 340:t.textStyleId=i.value;break;case 341:t.blockContentId=i.value,dt(t).blockContentId=i.value}}}},{code:270,name:"version",parser:l},{code:340,name:"leaderStyleId",parser:l},{code:90,name:"propertyOverrideFlag",parser:l},{code:170,name:"leaderLineType",parser:l},{code:91,name:"leaderLineColor",parser:l},{code:341,name:"leaderLineTypeId",parser:l},{code:171,name:"leaderLineWeight",parser:l},{code:290,name:"landingEnabled",parser:E},{code:291,name:"doglegEnabled",parser:E},{code:[40,41],name:"doglegLength",parser:l},{code:342,name:"arrowheadId",parser:l},{code:42,name:"arrowheadSize",parser:l},{code:172,name:"contentType",parser:l},{code:343,name:"textStyleId",parser:l},{code:173,name:"textLeftAttachmentType",parser:l},{code:95,name:"textRightAttachmentType",parser:l},{code:174,name:"textAngleType",parser:l},{code:175,name:"textAlignmentType",parser:l},{code:92,name:"textColor",parser:l},{code:292,name:"textFrameEnabled",parser:E},{code:344,parser:function(n,e,t){t.blockContentId=n.value,dt(t).blockContentId=n.value}},{code:93,name:"blockContentColor",parser:l},{code:10,name:"blockContentScale",parser:b},{code:43,name:"blockContentRotation",parser:l},{code:176,name:"blockContentConnectionType",parser:l},{code:293,name:"annotativeScaleEnabled",parser:E},{code:94,parser:function(n,e,t){t.arrowheadOverrides??(t.arrowheadOverrides=[]),t.arrowheadOverrides.push({index:n.value})},isMultiple:!0},{code:345,parser:function(n,e,t){var i;((i=t).arrowheadOverrides??(i.arrowheadOverrides=[]),i.arrowheadOverrides.length||i.arrowheadOverrides.push({}),i.arrowheadOverrides[i.arrowheadOverrides.length-1]).handle=n.value},isMultiple:!0},{code:330,parser:function(n,e,t){t.blockAttributes??(t.blockAttributes=[]),t.blockAttributes.push({id:n.value})},isMultiple:!0},{code:177,parser:function(n,e,t){Bs(t).index=n.value},isMultiple:!0},{code:44,parser:function(n,e,t){Bs(t).width=n.value},isMultiple:!0},{code:302,parser:function(n,e,t){Bs(t).text=n.value},isMultiple:!0},{code:294,name:"textDirectionNegative",parser:E},{code:178,name:"textAlignInIPE",parser:l},{code:179,name:"textAttachmentPoint",parser:l},{code:271,name:"textAttachmentDirection",parser:l},{code:272,name:"bottomTextAttachmentDirection",parser:l},{code:273,name:"topTextAttachmentDirection",parser:l},{code:100,name:"subclassMarker",parser:l},...V];function le(n,e){return sr(b(n,e))}function In(n,e){(e!=null&&e.start||e!=null&&e.end)&&(n.breaks??(n.breaks=[]),n.breaks.push(e))}function dt(n){return n.blockContent??(n.blockContent={})}function Bs(n){return n.blockAttributes??(n.blockAttributes=[]),n.blockAttributes.length||n.blockAttributes.push({}),n.blockAttributes[n.blockAttributes.length-1]}class vh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Ch(this,"parser",T(vu,Cu))}}function Nh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ch(vh,"ForEntityName","MULTILEADER");let Nu={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Ou=[{code:50,name:"angle",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Oh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Nh(this,"parser",T(Ou,Nu))}}function Yh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Nh(Oh,"ForEntityName","POINT");let Yu={startWidth:0,endWidth:0,bulge:0},Xu=[{code:91,name:"id",parser:l},{code:[...gs(71,75)],name:"faces",isMultiple:!0,parser:l},{code:50,name:"tangentDirection",parser:l},{code:70,name:"flag",parser:l},{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:30,name:"z",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...V];class Rr{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Yh(this,"parser",T(Xu,Yu))}}function Xh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Yh(Rr,"ForEntityName","VERTEX");let Ru={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:[]},Bu=[{code:0,name:"vertices",isMultiple:!0,parser:(n,e)=>O(n,0,"VERTEX")?(n=e.next(),new Rr().parseEntity(e,n)):cn},{code:210,name:"extrusionDirection",parser:b},{code:75,name:"smoothType",parser:l},{code:74,name:"surfaceNDensity",parser:l},{code:73,name:"surfaceMDensity",parser:l},{code:72,name:"meshNVertexCount",parser:l},{code:71,name:"meshMVertexCount",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:70,name:"flag",parser:l},{code:39,name:"thickness",parser:l},{code:30,name:"elevation",parser:l},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:l},...V];class Rh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Xh(this,"parser",T(Bu,Ru))}}Xh(Rh,"ForEntityName","POLYLINE");(ae={})[ae.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",ae[ae.CURVE_FIT=2]="CURVE_FIT",ae[ae.SPLINE_FIT=4]="SPLINE_FIT",ae[ae.POLYLINE_3D=8]="POLYLINE_3D",ae[ae.POLYGON_3D=16]="POLYGON_3D",ae[ae.CLOSED_POLYGON=32]="CLOSED_POLYGON",ae[ae.POLYFACE=64]="POLYFACE",ae[ae.CONTINUOUS=128]="CONTINUOUS";var Pn=((ot={})[ot.NONE=0]="NONE",ot[ot.QUADRATIC=5]="QUADRATIC",ot[ot.CUBIC=6]="CUBIC",ot[ot.BEZIER=8]="BEZIER",ot);function Bh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Fu=[{code:11,name:"direction",parser:b},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Fh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Bh(this,"parser",T(Fu))}}function Dh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Bh(Fh,"ForEntityName","RAY");let Du=[...Ls("data"),{code:70,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Vh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Dh(this,"parser",T(Du))}}function zh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Dh(Vh,"ForEntityName","REGION");let Vu={vertices:[],backLineVertices:[]},zu=[{code:360,name:"geometrySettingHardId",parser:l},{code:12,name:"backLineVertices",isMultiple:!0,parser:b},{code:93,name:"numberOfBackLineVertices",parser:l},{code:11,name:"vertices",isMultiple:!0,parser:b},{code:92,name:"verticesCount",parser:l},{code:[63,411],name:"indicatorColor",parser:l},{code:70,name:"indicatorTransparency",parser:l},{code:41,name:"bottomHeight",parser:l},{code:40,name:"topHeight",parser:l},{code:10,name:"verticalDirection",parser:b},{code:1,name:"name",parser:l},{code:91,name:"flag",parser:l},{code:90,name:"state",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class jh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){zh(this,"parser",T(zu,Vu))}}function Hh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}zh(jh,"ForEntityName","SECTION");let ju={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Hu=[{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:[...gs(10,14)],name:"points",isMultiple:!0,parser:b},{code:100,name:"subclassMarker",parser:l},...V];class Wh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Hh(this,"parser",T(Hu,ju))}}function Gh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Hh(Wh,"ForEntityName","SOLID");let Wu=[{code:350,name:"historyObjectSoftId",parser:l},{code:100,name:"subclassMarker",parser:l},...Ls("data"),{code:70,name:"version",parser:l},{code:100},...V];class Uh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Gh(this,"parser",T(Wu))}}function $h(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Gh(Uh,"ForEntityName","3DSOLID");let Gu={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Uu=[{code:11,name:"fitPoints",isMultiple:!0,parser:b},{code:10,name:"controlPoints",isMultiple:!0,parser:b},{code:41,name:"weights",isMultiple:!0,parser:l},{code:40,name:"knots",isMultiple:!0,parser:l},{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:44,name:"fitTolerance",parser:l},{code:43,name:"controlTolerance",parser:l},{code:42,name:"knotTolerance",parser:l},{code:74,name:"numberOfFitPoints",parser:l},{code:73,name:"numberOfControlPoints",parser:l},{code:72,name:"numberOfKnots",parser:l},{code:71,name:"degree",parser:l},{code:70,name:"flag",parser:l},{code:210,name:"normal",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class qh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){$h(this,"parser",T(Uu,Gu))}}$h(qh,"ForEntityName","SPLINE");(Pe={})[Pe.NONE=0]="NONE",Pe[Pe.CLOSED=1]="CLOSED",Pe[Pe.PERIODIC=2]="PERIODIC",Pe[Pe.RATIONAL=4]="RATIONAL",Pe[Pe.PLANAR=8]="PLANAR",Pe[Pe.LINEAR=16]="LINEAR";function Kh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let $u=[{code:280,name:"shadowMapSoftness",parser:l},{code:71,name:"shadowMapSize",parser:l},{code:70,name:"shadowType",parser:l},{code:292,name:"isSummerTime",parser:E},{code:92,name:"time",parser:l},{code:91,name:"julianDay",parser:l},{code:291,name:"hasShadow",parser:E},{code:40,name:"intensity",parser:l},{code:421,name:"lightColorInstance",parser:l},{code:63,name:"lightColorIndex",parser:l},{code:290,name:"isOn",parser:E},{code:90,name:"version",parser:l},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V.filter(n=>n.code!==100)];class Zh{parseEntity(e,t){let i={layer:""};return this.parser(t,e,i),i}constructor(){Kh(this,"parser",T($u))}}Kh(Zh,"ForEntityName","SUN");class Xn{parseEntity(e,t){let i={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:i.subclassMarker=t.value,t=e.next();break;case 2:i.name=t.value,t=e.next();break;case 5:i.handle=t.value,t=e.next();break;case 10:i.startPoint=sr(Ct(e)),t=e.lastReadGroup;break;case 11:i.directionVector=sr(Ct(e)),t=e.lastReadGroup;break;case 90:i.tableValue=t.value,t=e.next();break;case 91:i.rowCount=t.value,t=e.next();break;case 92:i.columnCount=t.value,t=e.next();break;case 93:i.overrideFlag=t.value,t=e.next();break;case 94:i.borderColorOverrideFlag=t.value,t=e.next();break;case 95:i.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:i.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:i.rowHeightArr??(i.rowHeightArr=[]),i.rowHeightArr.push(t.value),t=e.next();break;case 142:i.columnWidthArr??(i.columnWidthArr=[]),i.columnWidthArr.push(t.value),t=e.next();break;case 280:i.version=t.value,t=e.next();break;case 310:i.bmpPreview??(i.bmpPreview=""),i.bmpPreview+=t.value,t=e.next();break;case 330:i.ownerBlockRecordSoftId=t.value,t=e.next();break;case 342:i.tableStyleId=t.value,t=e.next();break;case 343:i.blockRecordHandle=t.value,t=e.next();break;case 170:i.attachmentPoint=t.value,t=e.next();break;case 171:i.cells??(i.cells=[]),i.cells.push(function(s,r){let a=!1,o=!1,h={};for(;!s.isEOF()&&r.code!==0&&!o;)switch(r.code){case 171:if(a){o=!0;continue}h.cellType=r.value,a=!0,r=s.next();break;case 172:h.flagValue=r.value,r=s.next();break;case 173:h.mergedValue=r.value,r=s.next();break;case 174:h.autoFit=r.value,r=s.next();break;case 175:h.borderWidth=r.value,r=s.next();break;case 176:h.borderHeight=r.value,r=s.next();break;case 91:h.overrideFlag=r.value,r=s.next();break;case 178:h.virtualEdgeFlag=r.value,r=s.next();break;case 145:h.rotation=r.value,r=s.next();break;case 345:h.fieldObjetId=r.value,r=s.next();break;case 340:h.blockTableRecordId=r.value,r=s.next();break;case 146:h.blockScale=r.value,r=s.next();break;case 177:h.blockAttrNum=r.value,r=s.next();break;case 7:h.textStyle=r.value,r=s.next();break;case 140:h.textHeight=r.value,r=s.next();break;case 170:h.attachmentPoint=r.value,r=s.next();break;case 92:h.extendedCellFlags=r.value,r=s.next();break;case 285:h.rightBorderVisibility=!!(r.value??!0),r=s.next();break;case 286:h.bottomBorderVisibility=!!(r.value??!0),r=s.next();break;case 288:h.leftBorderVisibility=!!(r.value??!0),r=s.next();break;case 289:h.topBorderVisibility=!!(r.value??!0),r=s.next();break;case 301:(function(c,d,u){for(;u.code!==304;)switch(u.code){case 301:case 93:case 90:case 94:u=d.next();break;case 1:c.text=u.value,u=d.next();break;case 300:c.attrText=u.value,u=d.next();break;case 302:c.text=u.value?u.value:c.text,u=d.next();break;default:u=d.next()}})(h,s,r),r=s.next();break;default:return h}return a=!1,o=!1,h}(e,t)),t=e.lastReadGroup;break;default:Wd(i,t,e),t=e.next()}}return i}}function Qh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(Os="ForEntityName")in Xn?Object.defineProperty(Xn,Os,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):Xn[Os]="ACAD_TABLE";let qu=[{code:11,name:"xAxisDirection",parser:b},{code:210,name:"extrusionDirection",parser:b},{code:1,name:"text",parser:l},{code:10,name:"position",parser:b},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class Jh{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){Qh(this,"parser",T(qu))}}Qh(Jh,"ForEntityName","TOLERANCE");var Ku=((oe={})[oe.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",oe[oe.TANGENT_DEFINED=2]="TANGENT_DEFINED",oe[oe.NOT_USED=4]="NOT_USED",oe[oe.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",oe[oe.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",oe[oe.FOR_POLYLINE=32]="FOR_POLYLINE",oe[oe.FOR_POLYGON=64]="FOR_POLYGON",oe[oe.POLYFACE=128]="POLYFACE",oe);let Zu=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:l},{code:361,name:"sunId",parser:l},{code:431,name:"ambientLightColorName",parser:l},{code:421,name:"ambientLightColorInstance",parser:l},{code:63,name:"ambientLightColorIndex",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLighting",parser:E},{code:348,name:"visualStyleId",parser:l},{code:333,name:"shadePlotId",parser:l},{code:332,name:"backgroundId",parser:l},{code:61,name:"majorGridFrequency",parser:l},{code:170,name:"shadePlotMode",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:346,name:"ucsBaseId",parser:l},{code:345,name:"ucsId",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:74,name:"iconFlag",parser:l},{code:71,name:"ucsPerViewport",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"sheetName",parser:l},{code:340,name:"clippingBoundaryId",parser:l},{code:90,name:"statusBitFlags",parser:l},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:l},{code:72,name:"circleZoomPercent",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClipZ",parser:l},{code:43,name:"frontClipZ",parser:l},{code:42,name:"perspectiveLensLength",parser:l},{code:17,name:"targetPoint",parser:b},{code:16,name:"viewDirection",parser:b},{code:15,name:"gridSpacing",parser:b},{code:14,name:"snapSpacing",parser:b},{code:13,name:"snapBase",parser:b},{code:12,name:"displayCenter",parser:b},{code:69,name:"viewportId",parser:l},{code:68,name:"status",parser:l},{code:41,name:"height",parser:l},{code:40,name:"width",parser:l},{code:10,name:"viewportCenter",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...V];class Rn{parseEntity(e,t){let i={};return T(Zu)(t,e,i),i}}function ec(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}(Ys="ForEntityName")in Rn?Object.defineProperty(Rn,Ys,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):Rn[Ys]="VIEWPORT";let Qu={brightness:50,constrast:50,fade:0},Ju=[{code:14,name:"boundary",isMultiple:!0,parser:b},{code:91,name:"numberOfVertices",parser:l},{code:71,name:"boundaryType",parser:l},{code:360,name:"imageDefReactorHardId",parser:l},{code:283,name:"fade",parser:l},{code:282,name:"contrast",parser:l},{code:281,name:"brightness",parser:l},{code:280,name:"isClipping",parser:E},{code:70,name:"displayFlag",parser:l},{code:340,name:"imageDefHardId",parser:l},{code:13,name:"imageSize",parser:b},{code:12,name:"vDirection",parser:b},{code:11,name:"uDirection",parser:b},{code:10,name:"position",parser:b},{code:90,name:"classVersion",parser:l},{code:100,name:"subclassMarker",parser:l},...V];class tc{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ec(this,"parser",T(Ju,Qu))}}ec(tc,"ForEntityName","WIPEOUT");(lt={})[lt.ShowImage=1]="ShowImage",lt[lt.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",lt[lt.UseClippingBoundary=4]="UseClippingBoundary",lt[lt.Transparency=8]="Transparency";function ic(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let eg=[{code:11,name:"direction",parser:b},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...V];class nc{parseEntity(e,t){let i={};return this.parser(t,e,i),i}constructor(){ic(this,"parser",T(eg))}}ic(nc,"ForEntityName","XLINE");let tg=0;function sc(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=tg++)}let ig=Object.fromEntries([$l,Nn,th,rh,oh,hh,vn,dh,gh,fh,wh,Lh,Ah,Ph,Yn,Th,kh,nh,vh,Oh,Rh,Fh,Vh,jh,Wh,Uh,qh,Zh,Xn,Jl,Jh,yh,Rr,Rn,tc,nc].map(n=>[n.ForEntityName,new n]));function rc(n,e){let t=[];for(;!O(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){e.rewind();break}let i=ig[n.value];if(i){let s=n.value;n=e.next();let r=i.parseEntity(e,n);r.type=s,sc(r),t.push(r)}else e.debug}n=e.next()}return t}function vi(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class Ha{next(){if(!this.hasNext())return this._eof?this.debug:this.debug,{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=Wa(e,this._data[this._pointer++],this.debug),i={code:e,value:t};return O(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}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 e={code:parseInt(this._data[this._pointer]),value:0};return e.value=Wa(e.code,this._data[this._pointer+1],this.debug),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){vi(this,"_data",void 0),vi(this,"debug",void 0),vi(this,"_pointer",void 0),vi(this,"_eof",void 0),vi(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Wa(n,e,t=!1){var i;let s=(i=e).endsWith("\r")?i.slice(0,-1):i;return n<=9?s:n>=10&&n<=59?parseFloat(e.trim()):n>=60&&n<=99?parseInt(e.trim()):n>=100&&n<=109?s:n>=110&&n<=149?parseFloat(e.trim()):n>=160&&n<=179?parseInt(e.trim()):n>=210&&n<=239?parseFloat(e.trim()):n>=270&&n<=289?parseInt(e.trim()):n>=290&&n<=299?function(r){if(r==="0")return!1;if(r==="1")return!0;throw TypeError("String '"+r+"' cannot be cast to Boolean type")}(e.trim()):n>=300&&n<=369?s:n>=370&&n<=389?parseInt(e.trim()):n>=390&&n<=399?s:n>=400&&n<=409?parseInt(e.trim()):n>=410&&n<=419?s:n>=420&&n<=429?parseInt(e.trim()):n>=430&&n<=439?s:n>=440&&n<=459?parseInt(e.trim()):n>=460&&n<=469?parseFloat(e.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?s:n>=1010&&n<=1059?parseFloat(e.trim()):n>=1060&&n<=1071?parseInt(e.trim()):s}function ng(n,e){let t=null,i={};for(;!O(n,0,"EOF")&&!O(n,0,"ENDSEC");)n.code===9?t=typeof n.value=="string"?n.value:null:t!=null&&(n.code===10?i[t]=Ct(e):i[t]=n.value),n=e.next();return i}let ft=[{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,isMultiple:!0,parser(n,e){for(;!O(n,0,"EOF")&&!O(n,102,"}");)n=e.next()}},{code:5,name:"handle",parser:l}],sg=[{code:70,name:"flag",parser:l},{code:2,name:"appName",parser:l},{code:100,name:"subclassMarker",parser:l},...ft],rg=T(sg),ag=T([{code:310,name:"bmpPreview",parser:l},{code:281,name:"scalability",parser:l},{code:280,name:"explodability",parser:l},{code:70,name:"insertionUnits",parser:l},{code:340,name:"layoutObjects",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),og=T([...Xr.map(n=>({...n,parser:l})),{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},{code:105,name:"handle",parser:l},...ft.filter(n=>n.code!==5)]),lg=T([{code:347,name:"materialObjectId",parser:l},{code:390,name:"plotStyleNameObjectId",parser:l},{code:370,name:"lineweight",parser:l},{code:290,name:"isPlotting",parser:E},{code:6,name:"lineType",parser:l},{code:62,name:"colorIndex",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),hg=T([{code:9,name:"text",parser:l},{code:45,name:"offsetY",parser:l},{code:44,name:"offsetX",parser:l},{code:50,name:"rotation",parser:l},{code:46,name:"scale",parser:l},{code:340,name:"styleObjectId",parser:l},{code:75,name:"shapeNumber",parser:l},{code:74,name:"elementTypeFlag",parser:l},{code:49,name:"elementLength",parser:l}],{elementTypeFlag:0,elementLength:0}),cg=T([{code:49,name:"pattern",parser(n,e){let t={};return hg(n,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:l},{code:73,name:"numberOfLineTypes",parser:l},{code:72,parser:l},{code:3,name:"description",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),dg=T([{code:1e3,name:"extendedFont",parser:l},{code:1001},{code:4,name:"bigFont",parser:l},{code:3,name:"font",parser:l},{code:42,name:"lastHeight",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:50,name:"obliqueAngle",parser:l},{code:41,name:"widthFactor",parser:l},{code:40,name:"fixedTextHeight",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),ug=[{code:13,name:"orthographicOrigin",parser:b},{code:71,name:"orthographicType",parser:l},{code:346,name:"baseUcsHandle",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"isOrthographic",parser:E},{code:12,name:"yAxis",parser:b},{code:11,name:"xAxis",parser:b},{code:10,name:"origin",parser:b},{code:70,name:"flag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft],gg=T(ug),pg=[{code:346,name:"baseUcsId",parser:l},{code:345,name:"ucsId",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:361,name:"sunHardId",parser:l},{code:348,name:"styleHardId",parser:l},{code:334,name:"liveSectionSoftId",parser:l},{code:332,name:"backgroundSoftId",parser:l},{code:73,name:"isPlottable",parser:E},{code:72,name:"isUcsAssociated",parser:E},{code:281,name:"renderMode",parser:l},{code:71,name:"viewMode",parser:l},{code:50,name:"twistAngle",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:12,name:"target",parser:b},{code:11,name:"direction",parser:b},{code:10,name:"center",parser:b},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:70,name:"flag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft],mg=T(pg),yg=T([{code:[63,421,431],name:"ambientColor",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLightingOn",parser:E},{code:348,name:"visualStyleObjectId",parser:l},{code:333,name:"shadePlotObjectId",parser:l},{code:332,name:"backgroundObjectId",parser:l},{code:61,name:"majorGridLines",parser:l},{code:170,name:"shadePlotSetting",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:74,name:"ucsIconSetting",parser:l},{code:71,name:"viewMode",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"styleSheet",parser:l},{code:[331,441],name:"frozenLayers",parser:l,isMultiple:!0},{code:72,name:"circleSides",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapRotationAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:17,name:"viewTarget",parser:b},{code:16,name:"viewDirectionFromTarget",parser:b},{code:15,name:"gridSpacing",parser:b},{code:14,name:"snapSpacing",parser:b},{code:13,name:"snapBasePoint",parser:b},{code:12,name:"center",parser:b},{code:11,name:"upperRightCorner",parser:b},{code:10,name:"lowerLeftCorner",parser:b},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...ft]),_g={APPID:rg,BLOCK_RECORD:ag,DIMSTYLE:og,LAYER:lg,LTYPE:cg,STYLE:dg,UCS:gg,VIEW:mg,VPORT:yg},fg=T([{code:70,name:"maxNumberOfEntries",parser:l},{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,parser:$e},{code:102,parser:$e},{code:102,parser:$e},{code:360,isMultiple:!0},{code:5,name:"handle",parser:l},{code:2,name:"name",parser:l}]);function xg(n,e){var i;let t={};for(;!O(n,0,"EOF")&&!O(n,0,"ENDSEC");){if(O(n,0,"TABLE")){n=e.next();let s={entries:[]};fg(n,e,s),t[s.name]=s}if(O(n,0)&&!O(n,0,"ENDTAB")){let s=n.value;n=e.next();let r=_g[s];if(!r){e.debug,n=e.next();continue}let a={};r(n,e,a),(i=t[s])==null||i.entries.push(a)}n=e.next()}return t}function wg(n,e){let t={};for(;!O(n,0,"EOF")&&!O(n,0,"ENDSEC");){if(O(n,0,"BLOCK")){let i=bg(n=e.next(),e);sc(i),i.name&&(t[i.name]=i)}n=e.next()}return t}function bg(n,e){let t={};for(;!O(n,0,"EOF");){if(O(n,0,"ENDBLK")){for(n=e.next();!O(n,0,"EOF");){if(O(n,100,"AcDbBlockEnd"))return t;n=e.next()}break}switch(n.code){case 1:t.xrefPath=n.value;break;case 2:t.name=n.value;break;case 3:t.name2=n.value;break;case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 10:t.position=Ct(e);break;case 67:t.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(t.type=n.value);break;case 100:break;case 330:t.ownerHandle=n.value;break;case 0:t.entities=rc(n,e)}n=e.next()}return t}let xt=[{code:330,name:"ownerObjectId",parser:l},{code:102,parser:$e},{code:102,parser:$e},{code:102,parser:$e},{code:5,name:"handle",parser:l}],ac=[{code:333,name:"shadePlotId",parser:l},{code:149,name:"imageOriginY",parser:l},{code:148,name:"imageOriginX",parser:l},{code:147,name:"scaleFactor",parser:l},{code:78,name:"shadePlotCustomDPI",parser:l},{code:77,name:"shadePlotResolution",parser:l},{code:76,name:"shadePlotMode",parser:l},{code:75,name:"standardScaleType",parser:l},{code:7,name:"currentStyleSheet",parser:l},{code:74,name:"plotType",parser:l},{code:73,name:"plotRotation",parser:l},{code:72,name:"plotPaperUnit",parser:l},{code:70,name:"layoutFlag",parser:l},{code:143,name:"printScaleDenominator",parser:l},{code:142,name:"printScaleNumerator",parser:l},{code:141,name:"windowAreaYMax",parser:l},{code:140,name:"windowAreaXMax",parser:l},{code:49,name:"windowAreaYMin",parser:l},{code:48,name:"windowAreaXMin",parser:l},{code:47,name:"plotOriginY",parser:l},{code:46,name:"plotOriginX",parser:l},{code:45,name:"paperHeight",parser:l},{code:44,name:"paperWidth",parser:l},{code:43,name:"marginTop",parser:l},{code:42,name:"marginRight",parser:l},{code:41,name:"marginBottom",parser:l},{code:40,name:"marginLeft",parser:l},{code:6,name:"plotViewName",parser:l},{code:4,name:"paperSize",parser:l},{code:2,name:"configName",parser:l},{code:1,name:"pageSetupName",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],Lg=[{code:346,name:"orthographicUcsId",parser:l},{code:345,name:"namedUcsId",parser:l},{code:331,name:"viewportId",parser:l},{code:330,name:"paperSpaceTableId",parser:l},{code:76,name:"orthographicType",parser:l},{code:17,name:"ucsYAxis",parser:b},{code:16,name:"ucsXAxis",parser:b},{code:13,name:"ucsOrigin",parser:b},{code:146,name:"elevation",parser:l},{code:15,name:"maxExtent",parser:b},{code:14,name:"minExtent",parser:b},{code:12,name:"insertionPoint",parser:b},{code:11,name:"maxLimit",parser:b},{code:10,name:"minLimit",parser:b},{code:71,name:"tabOrder",parser:l},{code:70,name:"controlFlag",parser:l},{code:1,name:"layoutName",parser:l},{code:100,name:"subclassMarker",parser:l},...ac],Sg=[{code:3,name:"entries",parser:(n,e)=>{let t={name:n.value};return(n=e.next()).code===350?t.objectSoftId=n.value:n.code===360?t.objectHardId=n.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:l},{code:280,name:"isHardOwned",parser:E},{code:100,name:"subclassMarker",parser:l},...xt],Ag=[{code:40,name:"wcsToOCSTransform",parser:Ga},{code:40,name:"ocsToWCSTransform",parser:Ga},{code:41,name:"backClippingDistance",parser:l},{code:73,name:"isBackClipping",parser:E,pushContext:!0},{code:40,name:"frontClippingDistance",parser:l},{code:72,name:"isFrontClipping",parser:E,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:E},{code:11,name:"position",parser:b},{code:210,name:"normal",parser:b},{code:10,name:"boundaryVertices",parser:b,isMultiple:!0},{code:70,name:"boundaryCount",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...xt];function Ga(n,e){let t=[];for(let i=0;i<3&&O(n,40);++i){let s=[];for(let r=0;r<4&&O(n,40);++r)s.push(n.value),n=e.next();t.push(s)}return e.rewind(),t}let Ig=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:l},{code:90,name:"version",parser:l},{code:1,name:"fileName",parser:l},{code:10,name:"size",parser:b},{code:11,name:"sizeOfOnePixel",parser:b},{code:280,name:"isLoaded",parser:l},{code:281,name:"resolutionUnits",parser:l},{code:100,name:"subclassMarker",parser:l}],Pg=[{code:179,name:"unknown1",parser:l},{code:170,name:"contentType",parser:l},{code:171,name:"drawMLeaderOrderType",parser:l},{code:172,name:"drawLeaderOrderType",parser:l},{code:90,name:"maxLeaderSegmentPoints",parser:l},{code:40,name:"firstSegmentAngleConstraint",parser:l},{code:41,name:"secondSegmentAngleConstraint",parser:l},{code:173,name:"leaderLineType",parser:l},{code:91,name:"leaderLineColor",parser:l},{code:340,name:"leaderLineTypeId",parser:l},{code:92,name:"leaderLineWeight",parser:l},{code:290,name:"landingEnabled",parser:E},{code:42,name:"landingGap",parser:l},{code:291,name:"doglegEnabled",parser:E},{code:43,name:"doglegLength",parser:l},{code:3,name:"description",parser:l},{code:341,name:"arrowheadId",parser:l},{code:44,name:"arrowheadSize",parser:l},{code:300,name:"defaultMTextContents",parser:l},{code:342,name:"textStyleId",parser:l},{code:174,name:"textLeftAttachmentType",parser:l},{code:175,name:"textAngleType",parser:l},{code:176,name:"textAlignmentType",parser:l},{code:178,name:"textRightAttachmentType",parser:l},{code:93,name:"textColor",parser:l},{code:45,name:"textHeight",parser:l},{code:292,name:"textFrameEnabled",parser:E},{code:297,name:"textAlignAlwaysLeft",parser:E},{code:46,name:"alignSpace",parser:l},{code:343,name:"blockContentId",parser:l},{code:94,name:"blockContentColor",parser:l},{code:47,name:"blockContentScale.x",parser:l},{code:49,name:"blockContentScale.y",parser:l},{code:140,name:"blockContentScale.z",parser:l},{code:293,name:"blockContentScaleEnabled",parser:E},{code:141,name:"blockContentRotation",parser:l},{code:294,name:"blockContentRotationEnabled",parser:E},{code:177,name:"blockContentConnectionType",parser:l},{code:142,name:"scale",parser:l},{code:295,name:"overwritePropertyValue",parser:E},{code:296,name:"annotative",parser:E},{code:143,name:"breakGapSize",parser:l},{code:271,name:"textAttachmentDirection",parser:l},{code:272,name:"bottomTextAttachmentDirection",parser:l},{code:273,name:"topTextAttachmentDirection",parser:l},{code:298,name:"unknown2",parser:l},{code:100,name:"subclassMarker",parser:l},...xt];function En(n,e,t){n.elements||(n.elements=[]);let i=n.elements.find(s=>s[e]===void 0);if(i){i[e]=t;return}n.elements.push({[e]:t})}let Eg=[{code:6,parser:function({value:n},e,t){En(t,"lineType",n)},isMultiple:!0},{code:62,parser:function({value:n},e,t){var i;if(t.fillColorIndex===void 0&&!((i=t.elements)!=null&&i.length)){t.fillColorIndex=n;return}En(t,"colorIndex",n)},isMultiple:!0},{code:420,parser:function({value:n},e,t){var i;if(t.fillColor===void 0&&!((i=t.elements)!=null&&i.length)){t.fillColor=n;return}En(t,"color",n)},isMultiple:!0},{code:49,parser:function({value:n},e,t){En(t,"offset",n)},isMultiple:!0},{code:71,name:"elementCount",parser:l},{code:52,name:"endAngle",parser:l},{code:51,name:"startAngle",parser:l},{code:3,name:"description",parser:l},{code:70,name:"flags",parser:l},{code:2,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],Tg=[{code:340,name:"entityIds",parser:l,isMultiple:!0},{code:71,name:"isSelectable",parser:E},{code:70,name:"isUnnamed",parser:E},{code:300,name:"description",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],Mg=[{code:8,name:"layerNames",parser:l,isMultiple:!0},{code:100,name:"subclassMarker",parser:l},{code:100,name:"filterSubclassMarker",parser:l},...xt],kg=[{code:90,name:"idBufferEntryCounts",parser:l,isMultiple:!0},{code:360,name:"idBufferIds",parser:l,isMultiple:!0},{code:8,name:"layerNames",parser:l,isMultiple:!0},{code:100,name:"subclassMarker",parser:l},{code:40,name:"timeStamp",parser:l},{code:100,name:"indexSubclassMarker",parser:l},...xt],Cg=[{code:75,name:"hasLastPointRef",parser:E},{code:1,name:"pointRefs",parser:function(n,e){let t={className:n.value};for(;;)switch((n=e.next()).code){case 72:t.objectOsnapType=n.value;continue;case 331:t.mainObjectId=n.value;continue;case 73:t.mainObjectSubentityType=n.value;continue;case 91:t.mainObjectGsMarker=n.value;continue;case 301:t.mainObjectXrefHandle=n.value;continue;case 40:t.nearOsnapGeometryParameter=n.value;continue;case 10:{let i=b(n,e);t.osnapPoint="z"in i?i:{...i,z:0}}continue;case 332:t.intersectionObjectId=n.value;continue;case 74:t.intersectionObjectSubentityType=n.value;continue;case 92:t.intersectionObjectGsMarker=n.value;continue;case 302:t.intersectionObjectXrefHandle=n.value;continue;default:return e.rewind(),t}},isMultiple:!0},{code:71,name:"rotatedDimensionType",parser:l},{code:70,name:"transSpaceFlag",parser:E},{code:90,name:"associativityFlag",parser:l},{code:330,name:"dimensionObjectId",parser:l},{code:100,name:"subclassMarker",parser:l},...xt],vg={LAYOUT:Lg,PLOTSETTINGS:ac,DICTIONARY:Sg,SPATIAL_FILTER:Ag,IMAGEDEF:Ig,MLEADERSTYLE:Pg,MLINESTYLE:Eg,GROUP:Tg,LAYER_FILTER:Mg,LAYER_INDEX:kg,DIMASSOC:Cg};function Ng(n,e){let t=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let i=n.value,s=vg[i];if(n.code===0&&(s!=null&&s.length)){let r=T(s),a={name:i};r(n=e.next(),e,a)?(t.push(a),n=e.peek()):n=e.next()}else n=e.next()}return{byName:Vd(t,({name:i})=>i)}}function ji(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class Og{constructor(){ji(this,"encoding","utf-8"),ji(this,"encodingFailureFatal",!1),ji(this,"thumbnailImageFormat","base64")}}class Yg extends EventTarget{parseSync(e,t=!1){let i=new Ha(e.split(/\r\n|\r|\n/g),t);if(!i.hasNext())throw Error("Empty file");return this.parseAll(i)}parseStream(e){let t="",i=this;return new Promise((s,r)=>{e.on("data",a=>{t+=a}),e.on("end",()=>{try{let a=t.split(/\r\n|\r|\n/g),o=new Ha(a);if(!o.hasNext())throw Error("Empty file");s(i.parseAll(o))}catch(a){r(a)}}),e.on("error",a=>{r(a)})})}async parseFromUrl(e,t){let i=await fetch(e,t);if(!i.body)return null;let s=i.body.getReader(),r="";for(;;){let{done:a,value:o}=await s.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(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},i=e.next();for(;!O(i,0,"EOF");)O(i,0,"SECTION")&&(O(i=e.next(),2,"HEADER")?t.header=ng(i=e.next(),e):O(i,2,"CLASSES")?Pd(i=e.next(),e,t):O(i,2,"BLOCKS")?t.blocks=wg(i=e.next(),e):O(i,2,"ENTITIES")?t.entities=rc(i=e.next(),e):O(i,2,"TABLES")?t.tables=xg(i=e.next(),e):O(i,2,"OBJECTS")?t.objects=Ng(i=e.next(),e):O(i,2,"THUMBNAILIMAGE")&&(t.thumbnailImage=function(s,r,a="base64"){let o,h="",c=0;for(;!O(s,0,"EOF")&&!O(s,0,"ENDSEC");)s.code===90?c=s.value:s.code===310&&(h+=s.value),s=r.next();if(a==="hex")o=h;else{let d=function(u){let p=u.length/2,g=new Uint8Array(p);for(let m=0;m<p;m++)g[m]=parseInt(u.substr(2*m,2),16);return g}(h);o=a==="buffer"?d:function(u){let p="";for(let g=0;g<u.length;g++)p+=String.fromCharCode(u[g]);return btoa(p)}(d)}return{size:c,data:o}}(i=e.next(),e,this._options.thumbnailImageFormat))),i=e.next();return t}constructor(e={}){super(),ji(this,"_decoder",void 0),ji(this,"_options",void 0);let t=new Og;this._options=Object.assign(t,e),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(Ee={})[Ee.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ee[Ee.KEEP_EXISTING=1]="KEEP_EXISTING",Ee[Ee.USE_CLONE=2]="USE_CLONE",Ee[Ee.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ee[Ee.VALUE_NAME=4]="VALUE_NAME",Ee[Ee.UNMANGLE_NAME=5]="UNMANGLE_NAME";(qt={})[qt.NOUNIT=0]="NOUNIT",qt[qt.CENTIMETERS=2]="CENTIMETERS",qt[qt.INCH=5]="INCH";(Ci={})[Ci.PSLTSCALE=1]="PSLTSCALE",Ci[Ci.LIMCHECK=2]="LIMCHECK";(Kt={})[Kt.INCHES=0]="INCHES",Kt[Kt.MILLIMETERS=1]="MILLIMETERS",Kt[Kt.PIXELS=2]="PIXELS";(Te={})[Te.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Te[Te.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Te[Te.DRAWING_LIMITS=2]="DRAWING_LIMITS",Te[Te.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Te[Te.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Te[Te.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(ht={})[ht.AS_DISPLAYED=0]="AS_DISPLAYED",ht[ht.WIREFRAME=1]="WIREFRAME",ht[ht.HIDDEN=2]="HIDDEN",ht[ht.RENDERED=3]="RENDERED";(Me={})[Me.DRAFT=0]="DRAFT",Me[Me.PREVIEW=1]="PREVIEW",Me[Me.NORMAL=2]="NORMAL",Me[Me.PRESENTATION=3]="PRESENTATION",Me[Me.MAXIMUM=4]="MAXIMUM",Me[Me.CUSTOM=5]="CUSTOM";(ct={})[ct.NONE=0]="NONE",ct[ct.AbsoluteRotation=1]="AbsoluteRotation",ct[ct.TextEmbedded=2]="TextEmbedded",ct[ct.ShapeEmbedded=4]="ShapeEmbedded";(Xs={})[Xs.PaperSpace=1]="PaperSpace";(Zt={})[Zt.XrefDependent=16]="XrefDependent",Zt[Zt.XrefResolved=32]="XrefResolved",Zt[Zt.Referenced=64]="Referenced";(ke={})[ke.Off=0]="Off",ke[ke.Perspective=1]="Perspective",ke[ke.ClipFront=2]="ClipFront",ke[ke.ClipBack=4]="ClipBack",ke[ke.UcsFollow=8]="UcsFollow",ke[ke.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class Xg{parse(e){const t=new Yg,i=this.getDxfInfoFromBuffer(e);let s="";return i.version&&i.version.value<=23&&i.encoding?s=new TextDecoder(i.encoding).decode(e):s=new TextDecoder().decode(e),t.parseSync(s)}getDxfInfoFromBuffer(e){var c,d,u;const i=new TextDecoder("utf-8");let s=0,r="",a=null,o=null,h=!1;for(;s<e.byteLength;){const p=Math.min(s+65536,e.byteLength),g=e.slice(s,p);s=p;const y=(r+i.decode(g,{stream:!0})).split(/\r?\n/);r=y.pop()??"";for(let _=0;_<y.length;_++){const f=y[_].trim();if(f==="SECTION"&&((c=y[_+2])==null?void 0:c.trim())==="HEADER")h=!0;else if(f==="ENDSEC"&&h)return{version:a,encoding:o};if(h&&f==="$ACADVER"){const S=(d=y[_+2])==null?void 0:d.trim();S&&(a=new ve(S))}else if(h&&f==="$DWGCODEPAGE"){const S=(u=y[_+2])==null?void 0:u.trim();if(S){const L=cr[S];o=ho(L)}}if(a&&o)return{version:a,encoding:o}}}return{version:a,encoding:o}}}class Ua{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="3DFACE"?this.convertFace(e):e.type=="ARC"?this.convertArc(e):e.type=="ATTDEF"?this.convertAttributeDefinition(e):e.type=="ATTRIB"?this.convertAttribute(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="LWPOLYLINE"?this.convertLWPolyline(e):e.type=="MTEXT"?this.convertMText(e):e.type=="MLINE"?this.convertMLine(e):e.type=="MULTILEADER"||e.type=="MLEADER"?this.convertMLeader(e):e.type=="POLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertFace(e){const t=new Gn;return e.vertices.forEach((i,s)=>t.setVertexAt(s,i)),t}convertArc(e){const t=e.extrusionDirection??x.Z_AXIS;return new Vn(qs(e.center,t),e.radius,k.degToRad(e.startAngle),k.degToRad(e.endAngle),t)}convertAttributeCommon(e,t){t.textString=e.text,t.height=e.textHeight,t.position.copy(e.startPoint);const i=e.alignmentPoint,s=!i||i.x===0&&i.y===0&&(i.z??0)===0;i&&!s?t.alignmentPoint.copy(i):t.alignmentPoint.copy(e.startPoint),t.rotation=e.rotation,t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.tag=e.tag,t.fieldLength=0,t.isInvisible=(e.attributeFlag&ne.Invisible)!==0,t.isConst=(e.attributeFlag&ne.Const)!==0,t.isVerifiable=(e.attributeFlag&ne.Verifiable)!==0,t.isPreset=(e.attributeFlag&ne.Preset)!==0,t.isReallyLocked=!!e.isReallyLocked,t.isMTextAttribute=(e.mtextFlag&We.MultiLine)!==0,t.isConstMTextAttribute=(e.mtextFlag&We.ConstMultiLine)!==0}convertAttribute(e){const t=new jn;return this.convertAttributeCommon(e,t),t.styleName=e.textStyle,t.horizontalMode=e.horizontalJustification,t.verticalMode=e.verticalJustification,t.widthFactor=e.scale??1,t.lockPositionInBlock=e.lockPositionFlag,t}convertAttributeDefinition(e){const t=new zn;return this.convertAttributeCommon(e,t),t.styleName=e.styleName,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t.prompt=e.prompt,t}convertCirle(e){const t=e.extrusionDirection??x.Z_AXIS;return new Hn(qs(e.center,t),e.radius,t)}convertEllipse(e){const t=new x(e.majorAxisEndPoint),i=t.length();return new Wn(e.center,e.extrusionDirection??x.Z_AXIS,t,i,i*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,i=e.endPoint;return new Zi(new w(t.x,t.y,t.z||0),new w(i.x,i.y,i.z||0))}convertSpline(e){try{if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new Ji(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0)return new Ji(e.fitPoints,"Uniform",e.degree,!!(e.flag&1))}catch{}return null}convertPoint(e){const t=new Jn;return t.position=e.position,t}convertSolid(e){const t=new Zn;return e.points.forEach((i,s)=>t.setPointAt(s,i)),t.thickness=e.thickness,t}convertPolyline(e){var d;const t=!!(e.flag&1),i=!!(e.flag&8),s=!!(e.flag&16),r=!!(e.flag&64),a=!!(e.flag&32),o=[],h=[],c=[];if((d=e.vertices)==null||d.map(u=>{u.flag&Ku.SPLINE_CONTROL_POINT||(r&&u.flag&128?u.flag&64?(o.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0)):u.faces&&u.faces.length>=3&&c.push([...u.faces]):(o.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0)))}),s){const u=e.meshMVertexCount,p=e.meshNVertexCount;return new ss(u,p,o,t,a)}else{if(r)return new rs(o,c);if(i){let u=Di.SimplePoly;return e.flag&4&&(e.smoothType==Pn.CUBIC?u=Di.CubicSplinePoly:e.smoothType==Pn.QUADRATIC&&(u=Di.QuadSplinePoly)),new Dn(u,o,t)}else{let u=hi.SimplePoly;return e.flag&2?u=hi.FitCurvePoly:e.flag&4&&(e.smoothType==Pn.CUBIC?u=hi.CubicSplinePoly:e.smoothType==Pn.QUADRATIC&&(u=hi.QuadSplinePoly)),new Fn(u,o,0,t,e.startWidth,e.endWidth,h)}}}convertLWPolyline(e){var s;const t=new Qn;t.closed=!!(e.flag&1);const i=e.constantWidth??-1;return(s=e.vertices)==null||s.forEach((r,a)=>{t.addVertexAt(a,new v(r.x,r.y),r.bulge,r.startWidth??i,r.endWidth??i)}),t}convertHatch(e){var s;const t=new Ki;if((s=e.definitionLines)==null||s.forEach(r=>{t.definitionLines.push({angle:k.degToRad(r.angle||0),base:r.base,offset:r.offset,dashLengths:r.numberOfDashLengths>0?r.dashLengths:[]})}),t.isSolidFill=e.solidFill==fd.SolidFill,t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:k.degToRad(e.patternAngle),t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(r=>{if(r.boundaryPathTypeFlag&2){const o=r,h=new ce;h.closed=o.isClosed,o.vertices.forEach((c,d)=>{h.addVertexAt(d,{x:c.x,y:c.y,bulge:c.bulge})}),t.add(h)}else{const o=r,h=[];o.edges.forEach(d=>{if(d.type==1){const u=d;h.push(new Ge(u.start,u.end))}else if(d.type==2){const u=d;h.push(new Mt(u.center,u.radius,k.degToRad(u.startAngle||0),k.degToRad(u.endAngle||0),!u.isCCW))}else if(d.type==3){const u=d;new K().subVectors(u.end,u.center);const g=Math.sqrt(Math.pow(u.end.x,2)+Math.pow(u.end.y,2)),m=g*u.lengthOfMinorAxis;let y=k.degToRad(u.startAngle||0),_=k.degToRad(u.endAngle||0);const f=Math.atan2(u.end.y,u.end.x);u.isCCW||(y=Math.PI*2-y,_=Math.PI*2-_),h.push(new $i({...u.center,z:0},g,m,y,_,!u.isCCW,f))}else if(d.type==4){const u=d;if(u.numberOfControlPoints>0&&u.numberOfKnots>0){const p=u.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let g=!0;const m=u.controlPoints.map(y=>(y.weight==null&&(g=!1),y.weight||1));h.push(new Ue(p,u.knots,g?m:void 0))}else if(u.numberOfFitData>0){const p=u.fitDatum.map(g=>({x:g.x,y:g.y,z:0}));h.push(new Ue(p,"Uniform"))}}});const c=qi.buildFromEdges(h);c.length==0&&h.length>0?t.add(new qi(h)):c.forEach(d=>t.add(d))}}),e.gradientFlag){const r=e;if(t.hatchObjectType=Pr.GradientObject,t.gradientName=r.gradientName,t.gradientAngle=r.gradientRotation??0,t.gradientShift=r.gradientDefinition??0,t.gradientOneColorMode=r.gradientColorFlag==1,t.shadeTintValue=r.colorTint??0,r.gradientColors){const a=r.gradientColors.length;a>1?(t.gradientStartColor=r.gradientColors[0].rgb,t.gradientEndColor=r.gradientColors[1].rgb):a>0&&(t.gradientStartColor=r.gradientColors[0].rgb)}}return t}convertTable(e){const t=new Kn(e.name,e.rowCount,e.columnCount);return t.tableDataVersion=e.version,t.tableStyleId=e.tableStyleId,t.owningBlockRecordId=e.blockRecordHandle,e.directionVector&&(t.horizontalDirection=new x(e.directionVector)),t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),t.tableValueFlag=e.tableValue,t.tableOverrideFlag=e.overrideFlag,t.borderColorOverrideFlag=e.borderColorOverrideFlag,t.borderLineweightOverrideFlag=e.borderLineWeightOverrideFlag,t.borderVisibilityOverrideFlag=e.borderVisibilityOverrideFlag,e.columnWidthArr.forEach((i,s)=>t.setColumnWidth(s,i)),e.rowHeightArr.forEach((i,s)=>t.setRowHeight(s,i)),e.cells.forEach((i,s)=>{t.setCell(s,i)}),t}convertText(e){const t=new pi;t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint);const i=e.endPoint,s=!i||i.x===0&&i.y===0&&(i.z??0)===0;return i&&!s?t.alignmentPoint.copy(i):t.alignmentPoint.copy(e.startPoint),t.rotation=k.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new Qi;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=k.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new x(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){var i;const t=new Un;return(i=e.vertices)==null||i.forEach(s=>{t.appendVertex(s)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isHookLineSameDirection=e.isHooklineSameDirection,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName??"",t.annoType=e.leaderCreationFlag,t.textHeight=e.textHeight??0,t.textWidth=e.textWidth??0,t.byBlockColor=e.byBlockColor,t.associatedAnnotation=e.associatedAnnotation??"",e.normal&&(t.normal=e.normal),e.horizontalDirection&&(t.horizontalDirection=e.horizontalDirection),e.offsetFromBlock&&(t.offsetFromBlock=e.offsetFromBlock),e.offsetFromAnnotation&&(t.offsetFromAnnotation=e.offsetFromAnnotation),t}convertMLine(e){const t=new $n;return t.styleName=e.name||"STANDARD",t.styleObjectHandle=e.styleObjectHandle,t.scale=e.scale,t.justification=e.justification,t.flags=e.flags,t.styleCount=e.styleCount,t.startPosition=e.startPosition,t.normal=e.extrusionDirection??x.Z_AXIS,t.segments=(e.segments??[]).map(i=>{var s;return{position:i.position,direction:i.direction,miterDirection:i.miterDirection,elements:((s=i.elements)==null?void 0:s.map(r=>({parameterCount:r.parameterCount,parameters:r.parameters??[],fillCount:r.fillCount,fillParameters:r.fillParameters??[]})))??[]}}),t}convertMLeader(e){var L,M;const t=new qn,i=e;t.version=e.version,t.leaderStyleId=e.leaderStyleId,e.leaderStyleId&&(t.mleaderStyleId=e.leaderStyleId),t.propertyOverrideFlag=e.propertyOverrideFlag,t.leaderLineType=e.leaderLineType??gi.StraightLeader,t.leaderLineColor=e.leaderLineColor,t.leaderLineTypeId=e.leaderLineTypeId,t.leaderLineWeight=e.leaderLineWeight,t.landingEnabled=e.landingEnabled,t.doglegEnabled=e.doglegEnabled??!1,t.doglegLength=e.doglegLength??0,t.arrowheadId=e.arrowheadId,t.arrowheadSize=e.arrowheadSize,t.textStyleId=e.textStyleId,t.textLeftAttachmentType=e.textLeftAttachmentType,t.textRightAttachmentType=e.textRightAttachmentType,t.textAngleType=e.textAngleType,t.textAlignmentType=e.textAlignmentType,t.textColor=e.textColor,t.textFrameEnabled=e.textFrameEnabled,t.landingGap=e.landingGap,t.textAttachment=e.textAttachment,t.textFlowDirection=e.textFlowDirection,t.blockContentId=e.blockContentId,t.blockContentColor=e.blockContentColor,t.blockContentRotation=e.blockContentRotation,t.blockContentConnectionType=e.blockContentConnectionType,t.annotativeScaleEnabled=e.annotativeScaleEnabled,t.arrowheadOverrides=e.arrowheadOverrides?e.arrowheadOverrides.map(I=>({...I})):[],t.blockAttributes=e.blockAttributes?e.blockAttributes.map(I=>({...I})):[],t.textDirectionNegative=e.textDirectionNegative,t.textAlignInIPE=e.textAlignInIPE,t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection,t.topTextAttachmentDirection=e.topTextAttachmentDirection,t.contentScale=e.contentScale,t.textLineSpacingStyle=e.textLineSpacingStyle,t.textBackgroundColor=e.textBackgroundColor,t.textBackgroundScaleFactor=e.textBackgroundScaleFactor,t.textBackgroundTransparency=e.textBackgroundTransparency,t.textBackgroundColorOn=e.textBackgroundColorOn,t.textFillOn=e.textFillOn,t.textColumnType=e.textColumnType,t.textUseAutoHeight=e.textUseAutoHeight,t.textColumnWidth=e.textColumnWidth,t.textColumnGutterWidth=e.textColumnGutterWidth,t.textColumnFlowReversed=e.textColumnFlowReversed,t.textColumnHeight=e.textColumnHeight,t.textUseWordBreak=e.textUseWordBreak,t.hasMText=e.hasMText,t.hasBlock=e.hasBlock,t.planeNormalReversed=e.planeNormalReversed,e.blockContentScale&&(t.blockContentScale=new x(e.blockContentScale)),e.contentBasePosition&&(t.contentBasePosition=new w().copy(e.contentBasePosition)),e.textAnchor&&(t.textAnchor=new w().copy(e.textAnchor)),e.planeOrigin&&(t.planeOrigin=new w().copy(e.planeOrigin)),e.planeXAxisDirection&&(t.planeXAxisDirection=new x(e.planeXAxisDirection)),e.planeYAxisDirection&&(t.planeYAxisDirection=new x(e.planeYAxisDirection));const s=i.textContent,r=s&&typeof s=="object"?s:void 0,a=typeof s=="string"&&s.length>0||this.readString(r??{},["text","contents"])!=null||this.readString(i,["text","contents","mtext"])!=null,o=e.contentType??(a?mt.MTextContent:e.blockContent?mt.BlockContent:mt.NoneContent);t.contentType=o;const h=this.readPoint(i,["normal","extrusionDirection"]);h&&(t.normal=h);const c=this.readString(r??{},["styleName","textStyleName","textStyle"])??this.readString(i,["textStyleName","textStyle","styleName","textStyleId"]);c&&(t.textStyleName=c);const d=this.readPositiveNumber(r??{},["textHeight","height"])??this.readPositiveNumber(i,["textHeight","mtextHeight","textContentHeight"])??this.readPositiveNumber(i,["arrowheadSize","contentScale"]);d!=null&&(t.textHeight=d);const u=this.readPositiveNumber(r??{},["textWidth","width"])??this.readPositiveNumber(i,["textWidth","mtextWidth","textContentWidth"]);u!=null&&(t.textWidth=u),t.textLineSpacingFactor=this.readNumber(r??{},["lineSpacingFactor","textLineSpacingFactor"])??this.readNumber(i,["textLineSpacingFactor"])??t.textLineSpacingFactor;const p=this.readNumber(r??{},["textRotation","rotation"])??this.readNumber(i,["textRotation","mtextRotation","textContentRotation"]);p!=null&&(t.textRotation=k.degToRad(p));const g=this.readPoint(i,["textDirection","mtextDirection","textDirectionVector"]);g&&(t.textDirection=g);const m=this.readNumber(i,["textAttachmentPoint","attachmentPoint"]);m!=null&&(t.textAttachmentPoint=m);const y=e.textAttachmentDirection;y!=null&&(t.textAttachmentDirection=y);const _=this.readNumber(i,["textDrawingDirection","drawingDirection"]);_!=null&&(t.textDrawingDirection=_);const f=typeof s=="string"?s:this.readString(r??{},["text","contents"])??this.readString(i,["text","contents","mtext"]),S=this.readPoint(r??{},["anchorPoint","textAnchor","textLocation","textPosition","textAnchorPoint"])??this.readPoint(i,["textAnchor","textLocation","textPosition","textAnchorPoint","contentBasePosition"]);if(f!=null&&S&&(t.mtextContent={text:f,anchorPoint:S}),e.blockContent){const I=e.blockContent;t.blockContent={blockContentId:e.blockContent.blockContentId,normal:this.readPoint(I,["normal"]),position:e.blockContent.position,scale:this.readPoint(I,["scale"]),rotation:this.readNumber(I,["rotation"]),color:this.readNumber(I,["color"]),transformationMatrix:Array.isArray(e.blockContent.transformationMatrix)?e.blockContent.transformationMatrix:[]}}else e.blockContentId&&(t.blockContent={blockContentId:e.blockContentId,scale:e.blockContentScale,rotation:e.blockContentRotation,color:e.blockContentColor,transformationMatrix:[]});return(L=this.readMLeaderLeaders(i))==null||L.forEach(I=>{t.addLeader({lastLeaderLinePoint:I.lastLeaderLinePoint,lastLeaderLinePointSet:I.lastLeaderLinePointSet,doglegVector:I.doglegVector,doglegVectorSet:I.doglegVectorSet,doglegLength:I.doglegLength??e.doglegLength,breaks:I.breaks,leaderBranchIndex:I.leaderBranchIndex,leaderLines:I.leaderLines})}),t.numberOfLeaders===0&&((M=this.readLeaderLineArray(i))==null||M.forEach(I=>{t.addLeader({doglegLength:e.doglegLength}),t.addLeaderLine(t.numberOfLeaders-1,I)})),t.numberOfLeaders===0&&e.contentBasePosition&&t.addLeader({lastLeaderLinePoint:e.contentBasePosition,lastLeaderLinePointSet:!0,doglegLength:e.doglegLength}),t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"){const t=e,i=new tn(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(i.dimBlockPosition={...t.insertionPoint,z:0}),i.rotation=k.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbRotatedDimension"){const t=e,i=new ds(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(i.dimBlockPosition={...t.insertionPoint,z:0}),i.rotation=k.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,i=new os(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,i=new hs(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,i=new cs(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,i),i}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,i=new ls(t.definitionPoint,t.subDefinitionPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,i),i}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(i=>{t.clipBoundary.push(new v(i))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new en;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageSize.copy(e.imageSize),t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(i=>{t.clipBoundary.push(new v(i))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new is;return this.processWipeout(e,t),t}convertViewport(e){const t=new ts;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new es;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new ns;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new ni(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?k.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(e,t){if(t.layer=e.layer||"0",e.handle&&(t.objectId=e.handle.toString()),t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null||e.colorIndex!=null||e.colorName){const i=new X;e.color!=null&&i.setRGBValue(e.color),e.colorIndex!=null&&(i.colorIndex=e.colorIndex),e.colorName&&(i.colorName=e.colorName),t.color=i}e.isVisible!=null&&(t.visibility=!e.isVisible),e.transparency!=null&&(t.transparency=J.deserialize(e.transparency))}readNumber(e,t){for(const i of t){const s=e[i];if(typeof s=="number"&&Number.isFinite(s))return s}}readPositiveNumber(e,t){const i=this.readNumber(e,t);return i!=null&&i>0?i:void 0}readString(e,t){for(const i of t){const s=e[i];if(typeof s=="string")return s}}readBoolean(e,t){for(const i of t){const s=e[i];if(typeof s=="boolean")return s;if(typeof s=="number")return s!==0}}readPoint(e,t){for(const i of t){const s=e[i];if(this.isPointLike(s))return s;if(Array.isArray(s)&&typeof s[0]=="number"&&typeof s[1]=="number")return{x:s[0],y:s[1],z:s[2]??0}}}readLeaderLineArray(e){const t=e.leaderLines;if(Array.isArray(t))return t.map(s=>{if(!s||typeof s!="object")return;const r=s.vertices;return Array.isArray(r)?r.filter(a=>this.isPointLike(a)):void 0}).filter(s=>!!s&&s.length>0);const i=e.vertices;if(Array.isArray(i)){const s=i.filter(r=>this.isPointLike(r));return s.length>0?[s]:void 0}}readMLeaderLeaders(e){const t=e.leaderSections;if(!Array.isArray(t))return;const i=[];return t.forEach(s=>{if(!s||typeof s!="object")return;const r=s,a=r.leaderLines,o=Array.isArray(a)?a.reduce((m,y)=>{const _=this.readMLeaderLine(y);return _&&m.push(_),m},[]):void 0,h={},c=this.readPoint(r,["lastLeaderLinePoint"]),d=this.readPoint(r,["doglegVector"]),u=this.readNumber(r,["doglegLength"]),p=this.readMLeaderBreaks(r.breaks),g=this.readNumber(r,["leaderBranchIndex"]);c&&(h.lastLeaderLinePoint=c),r.lastLeaderLinePointSet!=null&&(h.lastLeaderLinePointSet=this.readBoolean(r,["lastLeaderLinePointSet"])),d&&(h.doglegVector=d),r.doglegVectorSet!=null&&(h.doglegVectorSet=this.readBoolean(r,["doglegVectorSet"])),u!=null&&(h.doglegLength=u),p&&(h.breaks=p),g!=null&&(h.leaderBranchIndex=g),o&&(h.leaderLines=o),i.push(h)}),i}readMLeaderLine(e){if(!e||typeof e!="object")return;const t=e,i=t.vertices,s=Array.isArray(i)?i.filter(h=>this.isPointLike(h)):[],r=this.readMLeaderBreaks(t.breaks),a=Array.isArray(t.breakPointIndexes)?t.breakPointIndexes.filter(h=>typeof h=="number"):void 0,o=this.readNumber(t,["leaderLineIndex"]);return s.length>0||r&&r.length>0?{vertices:s,breakPointIndexes:a,leaderLineIndex:o,breaks:r}:void 0}readMLeaderBreaks(e){if(!Array.isArray(e))return;const t=e.map(i=>{if(!i||typeof i!="object")return;const s=i,r=this.readPoint(s,["start"]),a=this.readPoint(s,["end"]),o=this.readNumber(s,["index"]);if(!r||!a)return;const h={start:r,end:a};return o!=null&&(h.index=o),h}).filter(i=>!!i);return t.length>0?t:void 0}isPointLike(e){return!!e&&typeof e=="object"&&typeof e.x=="number"&&typeof e.y=="number"}}class Rg{convertLayout(e,t){var r,a;const i=new ln;i.layoutName=e.layoutName,i.tabOrder=e.tabOrder,i.plotSettingsName=e.pageSetupName,i.plotCfgName=e.configName,i.canonicalMediaName=e.paperSize,i.plotViewName=e.plotViewName,i.currentStyleSheet=e.currentStyleSheet,i.plotPaperMargins={left:e.marginLeft,right:e.marginRight,top:e.marginTop,bottom:e.marginBottom},i.plotPaperSize.copy({x:e.paperWidth,y:e.paperHeight}),i.plotOrigin.copy({x:e.plotOriginX,y:e.plotOriginY}),i.plotWindowArea.min.copy({x:e.windowAreaXMin,y:e.windowAreaYMin}),i.plotWindowArea.max.copy({x:e.windowAreaXMax,y:e.windowAreaYMax}),i.customPrintScale={numerator:e.printScaleNumerator,denominator:e.printScaleDenominator},i.plotPaperUnits=e.plotPaperUnit,i.plotRotation=e.plotRotation,i.plotType=e.plotType,i.stdScaleType=e.standardScaleType,i.shadePlot=(()=>{switch(e.shadePlotMode){case 1:return ci.kWireframe;case 2:return ci.kHidden;case 3:return ci.kRendered;default:return ci.kAsDisplayed}})(),i.shadePlotResLevel=(()=>{switch(e.shadePlotResolution){case 1:return Lt.kPreview;case 2:return Lt.kNormal;case 3:return Lt.kPresentation;case 4:return Lt.kMaximum;case 5:return Lt.kCustom;default:return Lt.kDraft}})(),e.shadePlotCustomDPI!=null&&(i.shadePlotCustomDPI=e.shadePlotCustomDPI),e.shadePlotId&&(i.shadePlotId=e.shadePlotId);const s=e.layoutFlag??0;if(i.plotViewportBorders=(s&1)!==0,i.showPlotStyles=(s&2)!==0,i.plotCentered=(s&4)!==0,i.plotHidden=(s&8)!==0,i.useStandardScale=(s&16)!==0,i.plotPlotStyles=(s&32)!==0,i.scaleLineweights=(s&64)!==0,i.printLineweights=(s&128)!==0,i.drawViewportsFirst=(s&512)!==0,i.modelType=(s&1024)!==0,e.viewportId&&i.viewportArray.push(e.viewportId),e.layoutName==="Model"){const o=ie.MODEL_SPACE_NAME.toUpperCase();(r=t.tables.BLOCK_RECORD)==null||r.entries.some(h=>h.name.toUpperCase()===o?(i.blockTableRecordId=h.handle,!0):!1)}else(a=t.tables.BLOCK_RECORD)==null||a.entries.some(o=>o.layoutObjects===e.handle?(i.blockTableRecordId=o.handle,!0):!1),i.blockTableRecordId||(i.blockTableRecordId=e.paperSpaceTableId);return e.minLimit&&i.limits.min.copy(e.minLimit),e.maxLimit&&i.limits.max.copy(e.maxLimit),e.minExtent&&i.extents.min.copy(e.minExtent),e.maxExtent&&i.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,i),i}convertImageDef(e){const t=new El;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}convertMLeaderStyle(e){const t=new Er;return t.unknown1=e.unknown1,e.contentType!=null&&(t.contentType=e.contentType),e.drawMLeaderOrderType!=null&&(t.drawMLeaderOrderType=e.drawMLeaderOrderType),e.drawLeaderOrderType!=null&&(t.drawLeaderOrderType=e.drawLeaderOrderType),e.maxLeaderSegmentPoints!=null&&(t.maxLeaderSegmentPoints=e.maxLeaderSegmentPoints),e.firstSegmentAngleConstraint!=null&&(t.firstSegmentAngleConstraint=e.firstSegmentAngleConstraint),e.secondSegmentAngleConstraint!=null&&(t.secondSegmentAngleConstraint=e.secondSegmentAngleConstraint),e.leaderLineType!=null&&(t.leaderLineType=e.leaderLineType),e.leaderLineColor!=null&&(t.leaderLineColor=zi(e.leaderLineColor)),t.leaderLineTypeId=e.leaderLineTypeId,e.leaderLineWeight!=null&&(t.leaderLineWeight=e.leaderLineWeight),e.landingEnabled!=null&&(t.landingEnabled=e.landingEnabled),e.landingGap!=null&&(t.landingGap=e.landingGap),e.doglegEnabled!=null&&(t.doglegEnabled=e.doglegEnabled),e.doglegLength!=null&&(t.doglegLength=e.doglegLength),e.description!=null&&(t.description=e.description),t.arrowheadId=e.arrowheadId,e.arrowheadSize!=null&&(t.arrowheadSize=e.arrowheadSize),e.defaultMTextContents!=null&&(t.defaultMTextContents=e.defaultMTextContents),t.textStyleId=e.textStyleId,e.textLeftAttachmentType!=null&&(t.textLeftAttachmentType=e.textLeftAttachmentType),e.textAngleType!=null&&(t.textAngleType=e.textAngleType),e.textAlignmentType!=null&&(t.textAlignmentType=e.textAlignmentType),e.textRightAttachmentType!=null&&(t.textRightAttachmentType=e.textRightAttachmentType),e.textColor!=null&&(t.textColor=zi(e.textColor)),e.textHeight!=null&&(t.textHeight=e.textHeight),e.textFrameEnabled!=null&&(t.textFrameEnabled=e.textFrameEnabled),e.textAlignAlwaysLeft!=null&&(t.textAlignAlwaysLeft=e.textAlignAlwaysLeft),e.alignSpace!=null&&(t.alignSpace=e.alignSpace),t.blockContentId=e.blockContentId,e.blockContentColor!=null&&(t.blockContentColor=zi(e.blockContentColor)),e.blockContentScale&&(t.blockContentScale={x:e.blockContentScale.x,y:e.blockContentScale.y,z:e.blockContentScale.z??1}),e.blockContentScaleEnabled!=null&&(t.blockContentScaleEnabled=e.blockContentScaleEnabled),e.blockContentRotation!=null&&(t.blockContentRotation=e.blockContentRotation),e.blockContentRotationEnabled!=null&&(t.blockContentRotationEnabled=e.blockContentRotationEnabled),e.blockContentConnectionType!=null&&(t.blockContentConnectionType=e.blockContentConnectionType),e.scale!=null&&(t.scale=e.scale),e.overwritePropertyValue!=null&&(t.overwritePropertyValue=e.overwritePropertyValue),e.annotative!=null&&(t.annotative=e.annotative),e.breakGapSize!=null&&(t.breakGapSize=e.breakGapSize),e.textAttachmentDirection!=null&&(t.textAttachmentDirection=e.textAttachmentDirection),e.bottomTextAttachmentDirection!=null&&(t.bottomTextAttachmentDirection=e.bottomTextAttachmentDirection),e.topTextAttachmentDirection!=null&&(t.topTextAttachmentDirection=e.topTextAttachmentDirection),t.unknown2=e.unknown2,this.processCommonAttrs(e,t),t}convertMLineStyle(e){var s;const t=new Tr;if(e.styleName!=null&&(t.styleName=e.styleName),e.flags!=null&&(t.flags=e.flags),e.description!=null&&(t.description=e.description),e.fillColor!=null)t.fillColor=new X().setRGBValue(e.fillColor);else if(e.fillColorIndex!=null){const r=new X;r.colorIndex=e.fillColorIndex,t.fillColor=r}e.startAngle!=null&&(t.startAngle=e.startAngle),e.endAngle!=null&&(t.endAngle=e.endAngle);const i=Math.max(e.elementCount??0,((s=e.elements)==null?void 0:s.length)??0);return i>0&&(t.elements=Array.from({length:i},(r,a)=>{var o,h,c,d;return{offset:((h=(o=e.elements)==null?void 0:o[a])==null?void 0:h.offset)??0,color:(()=>{var p,g,m,y;const u=new X;return((g=(p=e.elements)==null?void 0:p[a])==null?void 0:g.color)!=null?u.setRGBValue(e.elements[a].color):u.colorIndex=((y=(m=e.elements)==null?void 0:m[a])==null?void 0:y.colorIndex)??256,u})(),lineType:((d=(c=e.elements)==null?void 0:c[a])==null?void 0:d.lineType)??"BYLAYER"}})),this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}}class oc{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const i=Date.now(),s=this.generateTaskId();try{return await this.executeInWorker(s,e,t||this.config.workerUrl)}catch(r){const a=Date.now()-i;return{success:!1,error:r instanceof Error?r.message:String(r),duration:a}}}async executeInWorker(e,t,i){const s=Date.now();return new Promise((r,a)=>{const o=this.getAvailableWorker(i),h=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(o),a(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:u=>{clearTimeout(h),this.releaseWorker(o),r(u)},reject:u=>{clearTimeout(h),this.releaseWorker(o),a(u)},timeout:h});const c=u=>{const{id:p,success:g,data:m,error:y}=u.data;if(p!==e)return;this.cleanupTask(e);const _=Date.now()-s;r(g?{success:!0,data:m,duration:_}:{success:!1,error:y,duration:_})},d=u=>{this.cleanupTask(e),a(new Error(`Worker error: ${u.message}`))};o.addEventListener("message",c),o.addEventListener("error",d),o.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[i,s]of this.workers)if(!s.isBusy)return s.isBusy=!0,s.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const i=new Worker(e,{type:"module"}),s=this.generateWorkerId(),r={worker:i,isBusy:!0,id:s,createdAt:new Date};return this.workers.set(s,r),i}const t=Array.from(this.workers.values()).sort((i,s)=>i.createdAt.getTime()-s.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,i]of this.workers)if(i.worker===e){i.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(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class lc{constructor(e){this.framework=new oc(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function hc(n){return new lc(n)}class Bg{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:i}=e.data;try{const s=await this.executeTask(i);this.sendResponse(t,!0,s)}catch(s){this.sendResponse(t,!1,void 0,s instanceof Error?s.message:String(s))}}}sendResponse(e,t,i,s){const r={id:e,success:t,data:i,error:s};self.postMessage(r)}}class cc extends Yr{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e,t){const i=this.config,s=this.getParserWorkerTimeout(e,t);if(i.useWorker&&i.parserWorkerUrl){const r=hc({workerUrl:i.parserWorkerUrl,timeout:s,maxConcurrentWorkers:1}),a=await r.execute(e);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 Xg().parse(e),data:{unknownEntityCount:0}}}getFonts(e){var r;const t=new Map,i=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(r=e.tables.STYLE)==null||r.entries.forEach(a=>{const o=[];if(a.font){const h=i(a.font);h&&o.push(h)}if(a.bigFont){const h=i(a.bigFont);h&&o.push(h)}if(a.extendedFont){const h=i(a.extendedFont);h&&o.push(h)}t.set(a.name,o)});const s=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,s),Array.from(s)}getFontsInBlock(e,t,i,s){const r=/\\f(.*?)\|/g;e.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.matchAll(r)].forEach(d=>{s.add(d[1].toLowerCase())});const c=i.get(o.styleName);c==null||c.forEach(d=>s.add(d))}else if(a.type=="TEXT"){const o=a,h=i.get(o.styleName);h==null||h.forEach(c=>s.add(c))}else if(a.type=="MULTILEADER"||a.type=="MLEADER"){const o=a;[...(typeof o.textContent=="string"?o.textContent:"").matchAll(r)].forEach(u=>{s.add(u[1].toLowerCase())});const c=typeof o.textStyleName=="string"?o.textStyleName:typeof o.styleName=="string"?o.styleName:void 0,d=c?i.get(c):void 0;d==null||d.forEach(u=>s.add(u))}else if(a.type=="INSERT"){const h=t[a.name];h&&h.entities&&this.getFontsInBlock(h.entities,t,i,s)}})}async processEntities(e,t,i,s,r){const a=new Ua;let o=e.entities;const h=o.length,c=new hr(h,100-s.value,i);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const d=new Map;for(let p=0;p<h;p++){const g=o[p];if(g.type==="ATTRIB"){const m=a.convert(g);if(m&&m.ownerId&&m.ownerId!=="0"){let y=d.get(m==null?void 0:m.ownerId);y==null&&(y=[],d.set(m.ownerId,y)),y.push(m)}}}const u=t.tables.blockTable.modelSpace;await c.processChunk(async(p,g)=>{let m=[],y=p<g?o[p].type:"";for(let f=p;f<g;f++){const S=o[f];if(!(S.ownerBlockRecordSoftId&&S.ownerBlockRecordSoftId!==u.objectId)&&S.type!=="ATTRIB"){const L=a.convert(S);if(L){if(this.config.convertByEntityType&&S.type!==y&&(u.appendEntity(m),m=[],y=S.type),S.type==="INSERT"){const M=d.get(L.objectId);M&&M.length>0&&M.forEach(I=>{L.appendAttributes(I)})}m.push(L)}}}u.appendEntity(m);let _=s.value+g/h*(100-s.value);_>100&&(_=100),r&&await r(_,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(e,t,i=!1){const s=new Ua,r=e.length,a=[],o=t.objectId,h=[];for(let c=0;c<r;c++){const d=e[c],u=s.convert(d);u&&(d.type==="ATTRIB"?h.push(u):(!i||d.ownerBlockRecordSoftId===o)&&a.push(u))}t.appendEntity(a),h.forEach(c=>{const d=t.getIdAt(c.ownerId);d&&d.appendAttributes(c)})}processBlocks(e,t){const i=e.blocks;for(const[s,r]of Object.entries(i)){let a=t.tables.blockTable.getAt(r.name);a||(a=new ie,a.objectId=r.handle,a.name=s,a.origin.copy(r.position),t.tables.blockTable.add(a)),r.entities?this.processEntitiesInBlock(r.entities,a):a.isPaperSapce&&this.processEntitiesInBlock(e.entities,a,!0)}}processHeader(e,t){const i=e.header;i.$ACADVER&&(t.version=i.$ACADVER),t.cecolor.colorIndex=i.$CECOLOR||256,t.angbase=i.$ANGBASE||0,t.angdir=i.$ANGDIR||0,i.$AUNITS!=null&&(t.aunits=i.$AUNITS),i.$AUPREC!=null&&(t.auprec=i.$AUPREC),i.$LUNITS!=null&&(t.lunits=i.$LUNITS),i.$LUPREC!=null&&(t.luprec=i.$LUPREC),t.celtype=i.$CELTYPE||pe,Ne.instance().setVar(A.CETRANSPARENCY,i.$CETRANSPARENCY||"ByLayer",t),t.celtscale=i.$CELTSCALE||1;const s=this.normalizeHeaderStringValue(i.$CMLSTYLE)||this.normalizeHeaderStringValue(i.CMLSTYLE)||gt;t.cmlstyle=s;const r=i.$CMLSCALE??i.CMLSCALE;typeof r=="number"&&Number.isFinite(r)&&(t.cmlscale=r);const a=this.normalizeHeaderStringValue(i.$CMLEADERSTYLE)||this.normalizeHeaderStringValue(i.CMLEADERSTYLE)||pt;t.cmleaderstyle=a,t.hplayer=this.normalizeHeaderStringValue(i.$HPLAYER)||this.normalizeHeaderStringValue(i.HPLAYER)||".",t.ltscale=i.$LTSCALE||1,i.$EXTMAX&&(t.extmax=i.$EXTMAX),i.$EXTMIN&&(t.extmin=i.$EXTMIN),i.$INSUNITS!=null&&(t.insunits=i.$INSUNITS),t.osmode=i.$OSMODE||0,t.pdmode=i.$PDMODE||0,t.pdsize=i.$PDSIZE||0,t.textstyle=i.$TEXTSTYLE||Q}processBlockTables(e,t){var s;const i=(s=e.tables.BLOCK_RECORD)==null?void 0:s.entries;i&&i.length>0&&(t.tables.blockTable.removeAll(),i.forEach(r=>{const a=new ie;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),t.tables.blockTable.add(a)}))}processObjects(e,t){const i=e.objects.byName,s=new Rg;if("LAYOUT"in i){const r=t.objects.layout;i.LAYOUT.forEach(a=>{const o=s.convertLayout(a,e);r.setAt(o.layoutName,o)})}if("IMAGEDEF"in i){const r=t.objects.imageDefinition;i.IMAGEDEF.forEach(a=>{const o=s.convertImageDef(a);r.setAt(o.objectId,o)})}if("MLEADERSTYLE"in i){const r=t.objects.mleaderStyle;i.MLEADERSTYLE.forEach(a=>{const o=s.convertMLeaderStyle(a);r.setAt(o.objectId,o)})}if("MLINESTYLE"in i){const r=t.objects.mlineStyle;i.MLINESTYLE.forEach(a=>{const o=s.convertMLineStyle(a);r.setAt(o.styleName||o.objectId,o)})}}processViewports(e,t){var s;const i=(s=e.tables)==null?void 0:s.VPORT;if(i){this.processCommonTableAttrs(i,t.tables.viewportTable);const r=i.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??Hs),o.lowerLeftCorner.copy(a.lowerLeftCorner??po),o.upperRightCorner.copy(a.upperRightCorner??mo),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??Hs),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget??yo),o.gsView.viewTarget.copy(a.viewTarget??_o),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),t.tables.viewportTable.add(o)})}}processLayers(e,t){var s;const i=(s=e.tables)==null?void 0:s.LAYER;if(i){this.processCommonTableAttrs(i,t.tables.layerTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new X;o.colorIndex=a.colorIndex;const h=new ws({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,h),t.tables.layerTable.add(h)})}}processLineTypes(e,t){var s;const i=(s=e.tables)==null?void 0:s.LTYPE;if(i){this.processCommonTableAttrs(i,t.tables.linetypeTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new Et(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,t.tables.linetypeTable.add(o)})}}processTextStyles(e,t){var s;const i=(s=e.tables)==null?void 0:s.STYLE;if(i){this.processCommonTableAttrs(i,t.tables.textStyleTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new bs(a);this.processCommonTableEntryAttrs(a,o),t.tables.textStyleTable.add(o)})}}processDimStyles(e,t){var s;const i=(s=e.tables)==null?void 0:s.DIMSTYLE;if(i){this.processCommonTableAttrs(i,t.tables.dimStyleTable);const r=i.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||Q,dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},h=new si(o);this.processCommonTableEntryAttrs(a,h),t.tables.dimStyleTable.add(h)})}}processCommonTableAttrs(e,t){e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}processCommonTableEntryAttrs(e,t){t.name="name"in e?e.name:"",e.handle!=null&&(t.objectId=e.handle),e.ownerObjectId!=null&&(t.ownerId=e.ownerObjectId)}groupAndFlattenByType(e){const t={},i=[];for(const s of e)t[s.type]||(t[s.type]=[],i.push(s.type)),t[s.type].push(s);return i.flatMap(s=>t[s])}normalizeHeaderStringValue(e){if(typeof e!="string")return;const t=e.trim();return t.length>0?t:void 0}}class dc extends Yr{constructor(e){super({}),this._database=e}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(e,t,i,s,r){let a=e.tables.blockTable.modelSpace.newIterator().toArray();const o=a.length,h=new hr(o,100-s.value,i);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const c=t.tables.blockTable.modelSpace;await h.processChunk(async(d,u)=>{let p=[],g=d<u?a[d].type:"";for(let m=d;m<u;m++){const y=a[m];this.config.convertByEntityType&&y.type!==g&&(this.triggerEvents(c,p),p=[],g=y.type),p.push(y)}if(this.triggerEvents(c,p),r){let m=s.value+u/o*(100-s.value);m>100&&(m=100),await r(m,"ENTITY","IN-PROGRESS")}})}processBlocks(){const e=this._database.tables.blockTable.newIterator();for(const t of e){const i=t.newIterator().toArray();this.triggerEvents(t,i)}}processHeader(){}processBlockTables(){}processObjects(){const e=this._database.objects.layout.newIterator();for(const s of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.layoutName});const t=this._database.objects.imageDefinition.newIterator();for(const s of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.objectId});const i=this._database.objects.mleaderStyle.newIterator();for(const s of i)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(t=>{this._database.events.layerAppended.dispatch({database:this._database,layer:t})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(e){const t={},i=[];for(const s of e)t[s.type]||(t[s.type]=[],i.push(s.type)),t[s.type].push(s);return i.flatMap(s=>t[s])}triggerEvents(e,t){(e.isModelSapce||e.isPaperSapce)&&e.database.events.entityAppended.dispatch({database:e.database,entity:t})}}exports.ACAD_APPID=js;exports.AC_DB_SYSTEM_VARIABLE_NAMES=Fc;exports.AcCmColor=X;exports.AcCmColorMethod=P;exports.AcCmColorUtil=bt;exports.AcCmEntityColor=gc;exports.AcCmErrors=be;exports.AcCmEventDispatcher=pc;exports.AcCmEventManager=te;exports.AcCmLoader=Lc;exports.AcCmLoadingManager=io;exports.AcCmObject=Qa;exports.AcCmPerformanceCollector=ar;exports.AcCmTask=eo;exports.AcCmTaskScheduler=to;exports.AcCmTransparency=J;exports.AcCmTransparencyMethod=he;exports.AcDb2dPolyline=Fn;exports.AcDb2dVertex=Qs;exports.AcDb2dVertexType=il;exports.AcDb3PointAngularDimension=os;exports.AcDb3dPolyline=Dn;exports.AcDb3dVertex=Js;exports.AcDb3dVertexType=nl;exports.AcDbAbstractViewTableRecord=Nr;exports.AcDbAlignedDimension=tn;exports.AcDbAngleUnits=_s;exports.AcDbArc=Vn;exports.AcDbArcDimension=tr;exports.AcDbAttribute=jn;exports.AcDbAttributeDefinition=zn;exports.AcDbAttributeFlags=ne;exports.AcDbAttributeMTextFlag=We;exports.AcDbBaseWorker=Bg;exports.AcDbBatchProcessing=hr;exports.AcDbBlockReference=ni;exports.AcDbBlockScaling=Il;exports.AcDbBlockTable=vl;exports.AcDbBlockTableRecord=ie;exports.AcDbCircle=Hn;exports.AcDbCodePage=cr;exports.AcDbCurve=ue;exports.AcDbDataGenerator=Ml;exports.AcDbDatabase=dd;exports.AcDbDatabaseConverter=Yr;exports.AcDbDatabaseConverterManager=je;exports.AcDbDiametricDimension=ls;exports.AcDbDictionary=Jt;exports.AcDbDimArrowType=kl;exports.AcDbDimStyleTable=Nl;exports.AcDbDimStyleTableRecord=si;exports.AcDbDimTextHorizontal=Ol;exports.AcDbDimTextVertical=Yl;exports.AcDbDimVerticalJustification=Bl;exports.AcDbDimZeroSuppression=Xl;exports.AcDbDimZeroSuppressionAngular=Rl;exports.AcDbDimension=yt;exports.AcDbDuplicateRecordCloning=Tl;exports.AcDbDwgVersion=ve;exports.AcDbDxfCode=rr;exports.AcDbDxfConverter=cc;exports.AcDbDxfFiler=so;exports.AcDbEllipse=Wn;exports.AcDbEntity=de;exports.AcDbFace=Gn;exports.AcDbFileType=Ri;exports.AcDbGradientPatternType=ll;exports.AcDbHatch=Ki;exports.AcDbHatchObjectType=Pr;exports.AcDbHatchPatternType=Vi;exports.AcDbHatchStyle=ol;exports.AcDbHostApplicationServices=Bn;exports.AcDbLayerTable=Fl;exports.AcDbLayerTableRecord=ws;exports.AcDbLayout=ln;exports.AcDbLayoutDictionary=Al;exports.AcDbLayoutManager=Pl;exports.AcDbLeader=Un;exports.AcDbLeaderAnnotationType=hl;exports.AcDbLine=Zi;exports.AcDbLineSpacingStyle=as;exports.AcDbLinearUnits=Wi;exports.AcDbLinetypeTable=Dl;exports.AcDbLinetypeTableRecord=Et;exports.AcDbMLeader=qn;exports.AcDbMLeaderContentType=mt;exports.AcDbMLeaderDirectionType=gl;exports.AcDbMLeaderLineType=gi;exports.AcDbMLeaderStyle=Er;exports.AcDbMLeaderTextAttachmentDirection=ul;exports.AcDbMLine=$n;exports.AcDbMLineFlags=dl;exports.AcDbMLineJustification=cl;exports.AcDbMText=Qi;exports.AcDbMlineStyle=Tr;exports.AcDbObject=De;exports.AcDbObjectIterator=hn;exports.AcDbOpenMode=lo;exports.AcDbOrdinateDimension=hs;exports.AcDbOsnapMode=D;exports.AcDbPatParser=vr;exports.AcDbPatSvgRenderer=ir;exports.AcDbPlotPaperUnits=xl;exports.AcDbPlotRotation=wl;exports.AcDbPlotSettings=Sl;exports.AcDbPlotShadePlotResLevel=Lt;exports.AcDbPlotShadePlotType=ci;exports.AcDbPlotStdScaleType=Ll;exports.AcDbPlotType=bl;exports.AcDbPoint=Jn;exports.AcDbPoly2dType=hi;exports.AcDbPoly3dType=Di;exports.AcDbPolyFaceMesh=rs;exports.AcDbPolyFaceMeshFace=fl;exports.AcDbPolyFaceMeshVertex=_l;exports.AcDbPolygonMesh=ss;exports.AcDbPolygonMeshVertex=yl;exports.AcDbPolyline=Qn;exports.AcDbPredefinedAcadIsoPat=al;exports.AcDbPredefinedAcadPat=Dc;exports.AcDbRadialDimension=cs;exports.AcDbRasterImage=en;exports.AcDbRasterImageClipBoundaryType=pl;exports.AcDbRasterImageDef=El;exports.AcDbRasterImageImageDisplayOpt=ml;exports.AcDbRay=es;exports.AcDbRegAppTable=Hl;exports.AcDbRegAppTableRecord=nr;exports.AcDbRegenerator=dc;exports.AcDbRenderingCache=ri;exports.AcDbResultBuffer=lr;exports.AcDbRotatedDimension=ds;exports.AcDbSpline=Ji;exports.AcDbSymbolTable=_t;exports.AcDbSymbolTableRecord=vt;exports.AcDbSysVarManager=Ne;exports.AcDbSystemVariables=A;exports.AcDbTable=Kn;exports.AcDbText=pi;exports.AcDbTextHorizontalMode=sl;exports.AcDbTextStyleTable=Vl;exports.AcDbTextStyleTableRecord=bs;exports.AcDbTextVerticalMode=rl;exports.AcDbTrace=Zn;exports.AcDbUnitsValue=xs;exports.AcDbViewTable=zl;exports.AcDbViewTableRecord=pd;exports.AcDbViewport=ts;exports.AcDbViewportTable=jl;exports.AcDbViewportTableRecord=Or;exports.AcDbWipeout=is;exports.AcDbWorkerApi=lc;exports.AcDbWorkerManager=oc;exports.AcDbXline=ns;exports.AcDbXrecord=od;exports.AcGeArea2d=Tt;exports.AcGeBox2d=xe;exports.AcGeBox3d=Y;exports.AcGeCatmullRomCurve3d=fs;exports.AcGeCircArc2d=Mt;exports.AcGeCircArc3d=Pt;exports.AcGeCurve2d=mi;exports.AcGeEllipseArc2d=$i;exports.AcGeEllipseArc3d=ui;exports.AcGeEuler=Cc;exports.AcGeGeometryUtil=Uo;exports.AcGeLine2d=Ge;exports.AcGeLine3d=kt;exports.AcGeLoop2d=qi;exports.AcGeMathUtil=k;exports.AcGeMatrix2d=sn;exports.AcGeMatrix3d=j;exports.AcGeNurbsCurve=Fe;exports.AcGePlane=an;exports.AcGePoint2d=v;exports.AcGePoint3d=w;exports.AcGePolyline2d=ce;exports.AcGeQuaternion=ai;exports.AcGeShape2d=br;exports.AcGeSpline3d=Ue;exports.AcGeTol=rn;exports.AcGeVector2d=K;exports.AcGeVector3d=x;exports.AcGiArrowType=Lr;exports.AcGiDefaultLightingType=Ir;exports.AcGiLineWeight=ii;exports.AcGiMTextAttachmentPoint=z;exports.AcGiMTextFlowDirection=He;exports.AcGiOrthographicType=Ar;exports.AcGiRenderMode=Sr;exports.AcGiViewport=el;exports.AcTrStringUtil=bc;exports.ByBlock=At;exports.ByLayer=pe;exports.DEBUG_MODE=xc;exports.DEFAULT_GRADIENT_HATCH_NAME=go;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=Ic;exports.DEFAULT_HATCH_PATTERN_METRIC=co;exports.DEFAULT_LINE_TYPE=It;exports.DEFAULT_MLEADER_STYLE=pt;exports.DEFAULT_MLINE_STYLE=gt;exports.DEFAULT_TEXT_STYLE=Q;exports.DEFAULT_TOL=_r;exports.DEG2RAD=dr;exports.DefaultLoadingManager=no;exports.FLOAT_TOL=Qt;exports.HATCH_PATTERN_SOLID=ti;exports.HATCH_PATTERN_USER=uo;exports.MLIGHTCAD_APPID=zs;exports.ORIGIN_POINT_2D=Pc;exports.ORIGIN_POINT_3D=yr;exports.RAD2DEG=ur;exports.RAW_COLOR_TYPE_ACI=Cr;exports.RAW_COLOR_TYPE_BY_BLOCK=us;exports.RAW_COLOR_TYPE_BY_LAYER=Mr;exports.RAW_COLOR_TYPE_RGB=kr;exports.RAW_COLOR_TYPE_WINDOW_BG=Cl;exports.TAU=G;exports.TEMP_OBJECT_ID_PREFIX=Tn;exports.VPORT_FALLBACK_CENTER_2D=Hs;exports.VPORT_FALLBACK_LLC=po;exports.VPORT_FALLBACK_URC=mo;exports.VPORT_FALLBACK_VIEW_DIR=yo;exports.VPORT_FALLBACK_VIEW_TARGET=_o;exports.acdbDisableOsnapMode=Gc;exports.acdbEnableOsnapMode=Wc;exports.acdbHasOsnapMode=Hc;exports.acdbHostApplicationServices=or;exports.acdbMaskToOsnapModes=zc;exports.acdbOsnapModesToMask=Vc;exports.acdbToggleOsnapMode=jc;exports.basisFunction=Gi;exports.calculateCurveLength=Ko;exports.ceilPowerOfTwo=vo;exports.clamp=ut;exports.clone=Ni;exports.computeParameterValues=$o;exports.createWorkerApi=hc;exports.damp=bo;exports.decodeMLeaderStyleRawColor=zi;exports.deepClone=Fs;exports.defaults=nn;exports.degToRad=Mo;exports.dwgCodePageToEncoding=ho;exports.encodeMLeaderStyleRawColor=Cn;exports.euclideanModulo=gr;exports.evaluateNurbsPoint=Fi;exports.floorPowerOfTwo=No;exports.generateAveragedKnots=qo;exports.generateChordKnots=Nc;exports.generateSqrtChordKnots=Oc;exports.generateUUID=fo;exports.generateUniformKnots=vc;exports.getOcsAngle=Ks;exports.getOcsReferenceVector=wr;exports.has=$a;exports.intPartLength=mr;exports.interpolateControlPoints=Yc;exports.interpolateNurbsCurve=xr;exports.inverseLerp=wo;exports.isBetween=Oo;exports.isBetweenAngle=Yo;exports.isEmpty=qa;exports.isEqual=di;exports.isImperialUnits=hd;exports.isMetricUnits=ld;exports.isPointInPolygon=fr;exports.isPolygonIntersect=Go;exports.isPowerOfTwo=Co;exports.lerp=pr;exports.log=Xi;exports.mapLinear=xo;exports.normalizeAngle=Bi;exports.pingpong=Lo;exports.radToDeg=ko;exports.randFloat=Po;exports.randFloatSpread=Eo;exports.randInt=Io;exports.relativeEps=Xo;exports.seededRandom=To;exports.setAcDbHostApplicationServicesProvider=ao;exports.setAcDbLayoutManagerFactory=oo;exports.setLogLevel=wc;exports.smootherstep=Ao;exports.smoothstep=So;exports.transformOcsPointToWcs=qs;exports.transformWcsPointToOcs=Ui;