@mlightcad/data-model 1.9.9 → 1.9.10

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.
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Dn=(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))(Dn||{});exports.AcCmColorMethod=void 0;(function(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"})(exports.AcCmColorMethod||(exports.AcCmColorMethod={}));var ja=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ga=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Gr={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},Ni=[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],Rt=function(){function n(){}return n.getColorByIndex=function(t){return Ni[t]},n.getIndexByColor=function(t){for(var e=Ni.length-1,i=1;i<e;++i)if(Ni[i]===t)return i},n.getColorByName=function(t){return Gr[t.toLowerCase()]},n.getNameByColor=function(t){var e,i;try{for(var r=ja(Object.entries(Gr)),s=r.next();!s.done;s=r.next()){var o=Ga(s.value,2),a=o[0],h=o[1];if(h===t)return a}}catch(l){e={error:l}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},n.getNameByIndex=function(t){var e=this.getColorByIndex(t);return this.getNameByColor(e)},n}(),Da=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},k=function(){function n(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByLayer),this._colorMethod=t,this._colorMethod==exports.AcCmColorMethod.ByColor&&e==null?this._value=16777215:this._colorMethod==exports.AcCmColorMethod.ByACI?e==null?this._value=8:e===0?this._colorMethod=exports.AcCmColorMethod.ByBlock:e===256?this._colorMethod=exports.AcCmColorMethod.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}return Object.defineProperty(n.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(t){this._colorMethod=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){var t=this.RGB;return t!=null?t>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){var t=this.RGB;return t!=null?t>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){var t=this.RGB;return t!=null?t&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByColor:case exports.AcCmColorMethod.ByBlock:case exports.AcCmColorMethod.ByLayer:return this._value;case exports.AcCmColorMethod.ByACI:return this._value?Rt.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(t,e,i){var r=Math.max(0,Math.min(255,Math.round(t))),s=Math.max(0,Math.min(255,Math.round(e))),o=Math.max(0,Math.min(255,Math.round(i)));return this._value=r<<16|s<<8|o,this._colorMethod=exports.AcCmColorMethod.ByColor,this},n.prototype.setRGBValue=function(t){return t==null||!Number.isFinite(t)?this:(this._value=t&16777215,this._colorMethod=exports.AcCmColorMethod.ByColor,this)},n.prototype.setRGBFromCss=function(t){if(!t)return this;var e=t.trim().toLowerCase();if(e.startsWith("#")){var i=0,r=0,s=0;if(e.length===7)i=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),s=parseInt(e.substr(5,2),16);else if(e.length===4)i=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),s=parseInt(e[3]+e[3],16);else return this;return this.setRGB(i,r,s)}var o=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var i=parseInt(o[1],10),r=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(i,r,s)}var a=Rt.getColorByName(t);return a!==void 0?this.setRGBValue(a):this},n.prototype.setScalar=function(t){return this.setRGB(t,t,t)},Object.defineProperty(n.prototype,"hexColor",{get:function(){var t=this.RGB;if(t!=null){var e=t.toString(16).padStart(6,"0").toUpperCase();return"0x"+e}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cssColor",{get:function(){var t=this.RGB;if(t!=null)return"rgb(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,")")},enumerable:!1,configurable:!0}),n.prototype.cssColorAlpha=function(t){var e=this.RGB;if(e!=null)return"rgba(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,",").concat(t,")")},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI?this._value:this._colorMethod===exports.AcCmColorMethod.ByLayer?256:this._colorMethod===exports.AcCmColorMethod.ByBlock?0:void 0},set:function(t){if(t!=null){var e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=exports.AcCmColorMethod.ByBlock,this._value=void 0):e===256?(this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=void 0):(this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=e)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByColor",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByACI",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI&&this._value===7},enumerable:!1,configurable:!0}),n.prototype.setForeground=function(){return this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=7,this},Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},enumerable:!1,configurable:!0}),n.prototype.setByLayer=function(t){return this._colorMethod=exports.AcCmColorMethod.ByLayer,t==null?this._value=256:this._value=t,this},Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},enumerable:!1,configurable:!0}),n.prototype.setByBlock=function(t){return this._colorMethod=exports.AcCmColorMethod.ByBlock,t==null?this._value=0:this._value=t,this},Object.defineProperty(n.prototype,"colorName",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByColor:return this._value?Rt.getNameByColor(this._value):"";case exports.AcCmColorMethod.ByACI:return this._value?Rt.getNameByIndex(this._value):"";default:return}},set:function(t){if(t){var e=Rt.getColorByName(t);e!==void 0&&(this._value=e,this._colorMethod=exports.AcCmColorMethod.ByColor)}},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var t=new n;return t._colorMethod=this._colorMethod,t._value=this._value,t},n.prototype.copy=function(t){return this._colorMethod=t._colorMethod,this._value=t._value,this},n.prototype.equals=function(t){return this._colorMethod===t._colorMethod&&this._value===t._value},n.prototype.toString=function(){switch(this._colorMethod){case exports.AcCmColorMethod.None:return"None";case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByACI:return this._value!==void 0?String(this._value):"";case exports.AcCmColorMethod.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},n.fromString=function(t){if(t){var e=t.trim();if(/^none$/i.test(e))return new n(exports.AcCmColorMethod.None);if(/^bylayer$/i.test(e))return new n(exports.AcCmColorMethod.ByLayer);if(/^byblock$/i.test(e))return new n(exports.AcCmColorMethod.ByBlock);var i=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){var r=Number(i[1]),s=Number(i[2]),o=Number(i[3]),a=new n(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){var h=Da(e.split(",").map(Number),3),r=h[0],s=h[1],o=h[2],a=new n(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d+$/.test(e)){var l=parseInt(e,10);return new n(exports.AcCmColorMethod.ByACI,l)}if(/^book\$/i.test(e)){var c=e.substring(e.indexOf("$")+1),u=Rt.getColorByName(c);return u!=null?new n(exports.AcCmColorMethod.ByColor,u):void 0}var g=Rt.getColorByName(e);if(g!=null)return new n(exports.AcCmColorMethod.ByColor,g)}},n}(),Ha=function(){function n(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByColor),e===void 0&&(e=0),this._colorMethod=t,this._value=e}return Object.defineProperty(n.prototype,"colorMethd",{get:function(){return this._colorMethod},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){return this._value>>16&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&65535|(t&255)<<16},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){return this._value>>8&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16711935|(t&255)<<8},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){return this._value&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16776960|t&255},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(t,e,i){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=(t&255)<<16|(e&255)<<8|i&255},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"layerIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=t},enumerable:!1,configurable:!0}),n.prototype.isByColor=function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},n.prototype.isByLayer=function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},n.prototype.isByBlock=function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},n.prototype.isByACI=function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},n.prototype.isNone=function(){return this._colorMethod===exports.AcCmColorMethod.None},Object.defineProperty(n.prototype,"rawValue",{get:function(){return this._value},set:function(t){this._value=t},enumerable:!1,configurable:!0}),n}(),lt={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")}},Ua=function(){function n(){this._listeners={}}return n.prototype.addEventListener=function(t,e){this._listeners===void 0&&(this._listeners={});var i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)},n.prototype.hasEventListener=function(t,e){if(this._listeners===void 0)return!1;var i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1},n.prototype.removeEventListener=function(t,e){if(this._listeners!==void 0){var i=this._listeners,r=i[t];if(r!==void 0){var s=r.indexOf(e);s!==-1&&r.splice(s,1)}}},n.prototype.dispatchEvent=function(t){if(this._listeners!==void 0){var e=this._listeners,i=e[t.type];if(i!==void 0){t.target=this;for(var r=i.slice(0),s=0,o=r.length;s<o;s++)r[s].call(this,t)}}},n}(),Wa=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},$a=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},qa=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},U=function(){function n(){this.listeners=[]}return n.prototype.addEventListener=function(t){this.listeners.push(t)},n.prototype.removeEventListener=function(t){this.listeners=this.listeners.filter(function(e){return e!==t})},n.prototype.replaceEventListener=function(t){this.removeEventListener(t),this.addEventListener(t)},n.prototype.dispatch=function(t){for(var e,i,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];try{for(var o=Wa(this.listeners),a=o.next();!a.done;a=o.next()){var h=a.value,l=h;l.call.apply(l,qa([null,t],$a(r),!1))}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}},n}(),Zi=function(){return Zi=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Zi.apply(this,arguments)},Ka=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Za=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},bs=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Me(n){return n===null||typeof n!="object"?n:Array.isArray(n)?Za([],Ka(n),!1):Zi({},n)}function Qi(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(Qi);var t={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=Qi(n[e]));return t}function je(n){for(var t,e,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];try{for(var s=bs(i),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var h in a)Object.prototype.hasOwnProperty.call(a,h)&&n[h]===void 0&&(n[h]=a[h])}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n}function vs(n,t){return n!=null&&Object.prototype.hasOwnProperty.call(n,t)}function Ps(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 fe(n,t){var e,i;if(n===t)return!0;if(n==null||t==null)return n===t;if(typeof n!=typeof t)return!1;if(typeof n!="object")return n===t;if(Array.isArray(n)!==Array.isArray(t))return!1;if(Array.isArray(n)){if(n.length!==t.length)return!1;for(var r=0;r<n.length;r++)if(!fe(n[r],t[r]))return!1;return!0}var s=Object.keys(n),o=Object.keys(t);if(s.length!==o.length)return!1;try{for(var a=bs(s),h=a.next();!h.done;h=a.next()){var l=h.value;if(!Object.prototype.hasOwnProperty.call(t,l)||!fe(n[l],t[l]))return!1}}catch(c){e={error:c}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return!0}var Qa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ja(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var As={exports:{}};(function(n){(function(t,e){n.exports?n.exports=e():t.log=e()})(Qa,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(f,y){var _=f[y];if(typeof _.bind=="function")return _.bind(f);try{return Function.prototype.bind.call(_,f)}catch{return function(){return Function.prototype.apply.apply(_,[f,arguments])}}}function h(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function l(f){return f==="debug"&&(f="log"),typeof console===e?!1:f==="trace"&&i?h:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):t}function c(){for(var f=this.getLevel(),y=0;y<r.length;y++){var _=r[y];this[_]=y<f?t:this.methodFactory(_,f,this.name)}if(this.log=this.debug,typeof console===e&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==e&&(c.call(this),this[f].apply(this,arguments))}}function g(f,y,_){return l(f)||u.apply(this,arguments)}function d(f,y){var _=this,v,S,A,L="loglevel";typeof f=="string"?L+=":"+f:typeof f=="symbol"&&(L=void 0);function T(Y){var R=(r[Y]||"silent").toUpperCase();if(!(typeof window===e||!L)){try{window.localStorage[L]=R;return}catch{}try{window.document.cookie=encodeURIComponent(L)+"="+R+";"}catch{}}}function I(){var Y;if(!(typeof window===e||!L)){try{Y=window.localStorage[L]}catch{}if(typeof Y===e)try{var R=window.document.cookie,H=encodeURIComponent(L),it=R.indexOf(H+"=");it!==-1&&(Y=/^([^;]+)/.exec(R.slice(it+H.length+1))[1])}catch{}return _.levels[Y]===void 0&&(Y=void 0),Y}}function X(){if(!(typeof window===e||!L)){try{window.localStorage.removeItem(L)}catch{}try{window.document.cookie=encodeURIComponent(L)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function E(Y){var R=Y;if(typeof R=="string"&&_.levels[R.toUpperCase()]!==void 0&&(R=_.levels[R.toUpperCase()]),typeof R=="number"&&R>=0&&R<=_.levels.SILENT)return R;throw new TypeError("log.setLevel() called with invalid level: "+Y)}_.name=f,_.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_.methodFactory=y||g,_.getLevel=function(){return A??S??v},_.setLevel=function(Y,R){return A=E(Y),R!==!1&&T(A),c.call(_)},_.setDefaultLevel=function(Y){S=E(Y),I()||_.setLevel(Y,!1)},_.resetLevel=function(){A=null,X(),c.call(_)},_.enableAll=function(Y){_.setLevel(_.levels.TRACE,Y)},_.disableAll=function(Y){_.setLevel(_.levels.SILENT,Y)},_.rebuild=function(){if(o!==_&&(v=E(o.getLevel())),c.call(_),o===_)for(var Y in s)s[Y].rebuild()},v=E(o?o.getLevel():"WARN");var z=I();z!=null&&(A=E(z)),c.call(_)}o=new d,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var _=s[y];return _||(_=s[y]=new d(y,o.methodFactory)),_};var p=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=p),o},o.getLoggers=function(){return s},o.default=o,o})})(As);var tl=As.exports;const el=Ja(tl);var il=!0,Ie=el;Ie.setLevel("debug");var nl=function(n){try{Ie.setLevel(n)}catch(t){Ie.setLevel("error"),Ie.error(t)}},Ss=function(){function n(t,e){this.events={attrChanged:new U,modelChanged:new U},this._changing=!1,this._previousAttributes={},this._pending=!1;var i=t||{};e&&je(i,e),this.attributes=i,this.changed={}}return n.prototype.get=function(t){return this.attributes[t]},n.prototype.set=function(t,e,i){if(t==null)return this;var r;typeof t=="object"?(r=t,i=e):(r={},r[t]=e),i||(i={});var s=i.unset,o=i.silent,a=[],h=this._changing;this._changing=!0,h||(this._previousAttributes=Me(this.attributes),this.changed={});var l=this.attributes,c=this.changed,u=this._previousAttributes;for(var g in r)e=r[g],fe(l[g],e)||a.push(g),fe(u[g],e)?delete c[g]:c[g]=e,s?delete l[g]:l[g]=e;if(!o){a.length&&(this._pending=i);for(var d=0;d<a.length;d++)this.events.attrChanged.dispatch({object:this,attrName:a[d],attrValue:l[a[d]],options:i})}if(h)return this;if(!o)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},n.prototype.has=function(t){return this.get(t)!=null},n.prototype.hasChanged=function(t){return t==null?!Ps(this.changed):vs(this.changed,t)},n.prototype.changedAttributes=function(t){if(!t)return this.hasChanged()?Me(this.changed):{};var e=this._changing?this._previousAttributes:this.attributes,i={};for(var r in t){var s=t[r];fe(e[r],s)||(i[r]=s)}return i},n.prototype.previous=function(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]},n.prototype.previousAttributes=function(){return Me(this._previousAttributes)},n.prototype.clone=function(){var t=Me(this.attributes);return new n(t)},n}(),rl=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},sl=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Hn=function(){function n(){this.entries=new Map}return n.getInstance=function(){return n.instance||(n.instance=new n),n.instance},n.prototype.collect=function(t){this.entries.set(t.name,t)},n.prototype.printAll=function(){var t,e;try{for(var i=rl(this.entries),r=i.next();!r.done;r=i.next())var s=sl(r.value,2),o=s[0],a=s[1]}catch(h){t={error:h}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},n.prototype.clear=function(){this.entries.clear()},n.prototype.getAll=function(){return Array.from(this.entries.values())},n.prototype.getEntry=function(t){return this.entries.get(t)},n.prototype.remove=function(t){return this.entries.delete(t)},n}(),ol=function(){function n(){}return n.formatBytes=function(t,e){if(e===void 0&&(e=2),t===0)return"0 B";var i=1024,r=Math.max(0,e),s=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(i)),a=t/Math.pow(i,o);return"".concat(parseFloat(a.toFixed(r))," ").concat(s[o])},n}();exports.AcCmTransparencyMethod=void 0;(function(n){n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue"})(exports.AcCmTransparencyMethod||(exports.AcCmTransparencyMethod={}));var $=function(){function n(t){t!==void 0?(this._method=exports.AcCmTransparencyMethod.ByAlpha,this._alpha=n.clampAlpha(t)):(this._method=exports.AcCmTransparencyMethod.ByLayer,this._alpha=255)}return Object.defineProperty(n.prototype,"method",{get:function(){return this._method},set:function(t){this._method=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=n.clampAlpha(t),this._method=exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"percentage",{get:function(){if(this._method===exports.AcCmTransparencyMethod.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(t){var e=Math.max(0,Math.min(100,t)),i=Math.round(255*(1-e/100));this.alpha=i},enumerable:!1,configurable:!0}),n.clampAlpha=function(t){return Math.max(0,Math.min(255,Math.floor(t)))},Object.defineProperty(n.prototype,"isByAlpha",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInvalid",{get:function(){return this._method===exports.AcCmTransparencyMethod.ErrorValue},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){var t=this._method;return t<<24|this._alpha},n.prototype.clone=function(){var t=new n;return t._method=this._method,t._alpha=this._alpha,t},n.prototype.equals=function(t){return this._method===t._method&&this._alpha===t._alpha},n.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},n.fromString=function(t){var e=t.trim(),i=e.toLowerCase();if(i===""||i==="."||i==="use current"||i==="bylayer"){var r=new n;return r._method=exports.AcCmTransparencyMethod.ByLayer,r}if(i==="byblock"){var s=new n;return s._method=exports.AcCmTransparencyMethod.ByBlock,s}var o=Number(e);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new n;return o<=90?a.percentage=o:a.alpha=o,a}var h=new n;return h._method=exports.AcCmTransparencyMethod.ErrorValue,h},n.deserialize=function(t){var e=t>>>24&255,i=t&255,r=e>=exports.AcCmTransparencyMethod.ByLayer&&e<=exports.AcCmTransparencyMethod.ErrorValue?e:exports.AcCmTransparencyMethod.ErrorValue,s=new n;return s._method=r,s._alpha=n.clampAlpha(i),s},n}(),Dr=function(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(c){try{l(i.next(c))}catch(u){o(u)}}function h(c){try{l(i.throw(c))}catch(u){o(u)}}function l(c){c.done?s(c.value):r(c.value).then(a,h)}l((i=i.apply(n,t||[])).next())})},Bi=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Ls=function(){function n(t){this.name=t}return n.prototype.run=function(t){throw new Error("run() must be implemented by subclass")},n}(),Ms=function(){function n(){this.tasks=[],this.onProgress=function(){},this.onComplete=function(){},this.onError=function(){return!1}}return n.prototype.scheduleTask=function(t){return new Promise(function(e,i){var r=function(){Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})},n.prototype.addTask=function(t){this.tasks.push(t)},n.prototype.setProgressCallback=function(t){this.onProgress=t},n.prototype.setCompleteCallback=function(t){this.onComplete=t},n.prototype.setErrorCallback=function(t){this.onError=t},n.prototype.run=function(t){return Dr(this,void 0,void 0,function(){var e,i,r,s,o,a,h=this;return Bi(this,function(l){switch(l.label){case 0:e=this.tasks.length,i=t,r=function(c){var u,g,d;return Bi(this,function(p){switch(p.label){case 0:u=s.tasks[c],p.label=1;case 1:return p.trys.push([1,3,,4]),[4,s.scheduleTask(function(){return Dr(h,void 0,void 0,function(){var f;return Bi(this,function(y){switch(y.label){case 0:return[4,u.run(i)];case 1:return f=y.sent(),this.onProgress((c+1)/e,u),[2,f]}})})})];case 2:return i=p.sent(),[3,4];case 3:return g=p.sent(),d=s.onError({error:g,taskIndex:c,task:u}),d?[2,{value:Promise.reject(g)}]:[3,4];case 4:return[2]}})},s=this,o=0,l.label=1;case 1:return o<e?[5,r(o)]:[3,4];case 2:if(a=l.sent(),typeof a=="object")return[2,a.value];l.label=3;case 3:return o++,[3,1];case 4:return this.onComplete(i),[2]}})})},n}(),Is=function(){function n(t,e,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i}return n.prototype.itemStart=function(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0},n.prototype.itemEnd=function(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())},n.prototype.itemError=function(t){this.onError!==void 0&&this.onError(t)},n.prototype.resolveURL=function(t){return this.urlModifier?this.urlModifier(t):t},n.prototype.setURLModifier=function(t){return this.urlModifier=t,this},n.prototype.addHandler=function(t,e){return this.handlers.push(t,e),this},n.prototype.removeHandler=function(t){var e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this},n.prototype.getHandler=function(t){for(var e=0,i=this.handlers.length;e<i;e+=2){var r=this.handlers[e],s=this.handlers[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return s}return null},n}(),Es=new Is,al=function(){function n(t){this.manager=t!==void 0?t:Es,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return n.prototype.loadAsync=function(t,e){var i=this;return new Promise(function(r,s){i.load(t,r,e,s)})},n.prototype.parse=function(t){},n.prototype.setCrossOrigin=function(t){return this.crossOrigin=t,this},n.prototype.setWithCredentials=function(t){return this.withCredentials=t,this},n.prototype.setPath=function(t){return this.path=t,this},n.prototype.setResourcePath=function(t){return this.resourcePath=t,this},n.prototype.setRequestHeader=function(t){return this.requestHeader=t,this},n}();const Hr=[{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 yt{constructor(t){if(typeof t=="string"){const e=Hr.find(i=>i.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=Hr.find(i=>i.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Ts{constructor(t={}){this._database=t.database,this._precision=Math.max(0,Math.min(16,t.precision??16)),this._version=t.version instanceof yt?t.version:t.version!=null?new yt(t.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(t){this._database=t}get precision(){return this._precision}setPrecision(t){return this._precision=Math.max(0,Math.min(16,t)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(t){return this._version=t instanceof yt?t:new yt(t),this}toString(){return this._lines.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Un=(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))(Un||{});exports.AcCmColorMethod=void 0;(function(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"})(exports.AcCmColorMethod||(exports.AcCmColorMethod={}));var Da=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ha=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Hr={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},Bi=[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],Rt=function(){function n(){}return n.getColorByIndex=function(t){return Bi[t]},n.getIndexByColor=function(t){for(var e=Bi.length-1,i=1;i<e;++i)if(Bi[i]===t)return i},n.getColorByName=function(t){return Hr[t.toLowerCase()]},n.getNameByColor=function(t){var e,i;try{for(var r=Da(Object.entries(Hr)),s=r.next();!s.done;s=r.next()){var o=Ha(s.value,2),a=o[0],h=o[1];if(h===t)return a}}catch(l){e={error:l}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},n.getNameByIndex=function(t){var e=this.getColorByIndex(t);return this.getNameByColor(e)},n}(),Ua=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},k=function(){function n(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByLayer),this._colorMethod=t,this._colorMethod==exports.AcCmColorMethod.ByColor&&e==null?this._value=16777215:this._colorMethod==exports.AcCmColorMethod.ByACI?e==null?this._value=8:e===0?this._colorMethod=exports.AcCmColorMethod.ByBlock:e===256?this._colorMethod=exports.AcCmColorMethod.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}return Object.defineProperty(n.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(t){this._colorMethod=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){var t=this.RGB;return t!=null?t>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){var t=this.RGB;return t!=null?t>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){var t=this.RGB;return t!=null?t&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByColor:case exports.AcCmColorMethod.ByBlock:case exports.AcCmColorMethod.ByLayer:return this._value;case exports.AcCmColorMethod.ByACI:return this._value?Rt.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(t,e,i){var r=Math.max(0,Math.min(255,Math.round(t))),s=Math.max(0,Math.min(255,Math.round(e))),o=Math.max(0,Math.min(255,Math.round(i)));return this._value=r<<16|s<<8|o,this._colorMethod=exports.AcCmColorMethod.ByColor,this},n.prototype.setRGBValue=function(t){return t==null||!Number.isFinite(t)?this:(this._value=t&16777215,this._colorMethod=exports.AcCmColorMethod.ByColor,this)},n.prototype.setRGBFromCss=function(t){if(!t)return this;var e=t.trim().toLowerCase();if(e.startsWith("#")){var i=0,r=0,s=0;if(e.length===7)i=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),s=parseInt(e.substr(5,2),16);else if(e.length===4)i=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),s=parseInt(e[3]+e[3],16);else return this;return this.setRGB(i,r,s)}var o=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var i=parseInt(o[1],10),r=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(i,r,s)}var a=Rt.getColorByName(t);return a!==void 0?this.setRGBValue(a):this},n.prototype.setScalar=function(t){return this.setRGB(t,t,t)},Object.defineProperty(n.prototype,"hexColor",{get:function(){var t=this.RGB;if(t!=null){var e=t.toString(16).padStart(6,"0").toUpperCase();return"0x"+e}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cssColor",{get:function(){var t=this.RGB;if(t!=null)return"rgb(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,")")},enumerable:!1,configurable:!0}),n.prototype.cssColorAlpha=function(t){var e=this.RGB;if(e!=null)return"rgba(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,",").concat(t,")")},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI?this._value:this._colorMethod===exports.AcCmColorMethod.ByLayer?256:this._colorMethod===exports.AcCmColorMethod.ByBlock?0:void 0},set:function(t){if(t!=null){var e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=exports.AcCmColorMethod.ByBlock,this._value=void 0):e===256?(this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=void 0):(this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=e)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByColor",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByACI",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByACI&&this._value===7},enumerable:!1,configurable:!0}),n.prototype.setForeground=function(){return this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=7,this},Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},enumerable:!1,configurable:!0}),n.prototype.setByLayer=function(t){return this._colorMethod=exports.AcCmColorMethod.ByLayer,t==null?this._value=256:this._value=t,this},Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},enumerable:!1,configurable:!0}),n.prototype.setByBlock=function(t){return this._colorMethod=exports.AcCmColorMethod.ByBlock,t==null?this._value=0:this._value=t,this},Object.defineProperty(n.prototype,"colorName",{get:function(){switch(this._colorMethod){case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByColor:return this._value?Rt.getNameByColor(this._value):"";case exports.AcCmColorMethod.ByACI:return this._value?Rt.getNameByIndex(this._value):"";default:return}},set:function(t){if(t){var e=Rt.getColorByName(t);e!==void 0&&(this._value=e,this._colorMethod=exports.AcCmColorMethod.ByColor)}},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var t=new n;return t._colorMethod=this._colorMethod,t._value=this._value,t},n.prototype.copy=function(t){return this._colorMethod=t._colorMethod,this._value=t._value,this},n.prototype.equals=function(t){return this._colorMethod===t._colorMethod&&this._value===t._value},n.prototype.toString=function(){switch(this._colorMethod){case exports.AcCmColorMethod.None:return"None";case exports.AcCmColorMethod.ByLayer:return"ByLayer";case exports.AcCmColorMethod.ByBlock:return"ByBlock";case exports.AcCmColorMethod.ByACI:return this._value!==void 0?String(this._value):"";case exports.AcCmColorMethod.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},n.fromString=function(t){if(t){var e=t.trim();if(/^none$/i.test(e))return new n(exports.AcCmColorMethod.None);if(/^bylayer$/i.test(e))return new n(exports.AcCmColorMethod.ByLayer);if(/^byblock$/i.test(e))return new n(exports.AcCmColorMethod.ByBlock);var i=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){var r=Number(i[1]),s=Number(i[2]),o=Number(i[3]),a=new n(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){var h=Ua(e.split(",").map(Number),3),r=h[0],s=h[1],o=h[2],a=new n(exports.AcCmColorMethod.ByColor);return a.setRGB(r,s,o),a}if(/^\d+$/.test(e)){var l=parseInt(e,10);return new n(exports.AcCmColorMethod.ByACI,l)}if(/^book\$/i.test(e)){var c=e.substring(e.indexOf("$")+1),u=Rt.getColorByName(c);return u!=null?new n(exports.AcCmColorMethod.ByColor,u):void 0}var g=Rt.getColorByName(e);if(g!=null)return new n(exports.AcCmColorMethod.ByColor,g)}},n}(),Wa=function(){function n(t,e){t===void 0&&(t=exports.AcCmColorMethod.ByColor),e===void 0&&(e=0),this._colorMethod=t,this._value=e}return Object.defineProperty(n.prototype,"colorMethd",{get:function(){return this._colorMethod},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){return this._value>>16&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&65535|(t&255)<<16},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){return this._value>>8&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16711935|(t&255)<<8},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){return this._value&255},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=this._value&16776960|t&255},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(t,e,i){this._colorMethod=exports.AcCmColorMethod.ByColor,this._value=(t&255)<<16|(e&255)<<8|i&255},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByACI,this._value=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"layerIndex",{get:function(){return this._value},set:function(t){this._colorMethod=exports.AcCmColorMethod.ByLayer,this._value=t},enumerable:!1,configurable:!0}),n.prototype.isByColor=function(){return this._colorMethod===exports.AcCmColorMethod.ByColor},n.prototype.isByLayer=function(){return this._colorMethod===exports.AcCmColorMethod.ByLayer},n.prototype.isByBlock=function(){return this._colorMethod===exports.AcCmColorMethod.ByBlock},n.prototype.isByACI=function(){return this._colorMethod===exports.AcCmColorMethod.ByACI},n.prototype.isNone=function(){return this._colorMethod===exports.AcCmColorMethod.None},Object.defineProperty(n.prototype,"rawValue",{get:function(){return this._value},set:function(t){this._value=t},enumerable:!1,configurable:!0}),n}(),lt={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")}},$a=function(){function n(){this._listeners={}}return n.prototype.addEventListener=function(t,e){this._listeners===void 0&&(this._listeners={});var i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)},n.prototype.hasEventListener=function(t,e){if(this._listeners===void 0)return!1;var i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1},n.prototype.removeEventListener=function(t,e){if(this._listeners!==void 0){var i=this._listeners,r=i[t];if(r!==void 0){var s=r.indexOf(e);s!==-1&&r.splice(s,1)}}},n.prototype.dispatchEvent=function(t){if(this._listeners!==void 0){var e=this._listeners,i=e[t.type];if(i!==void 0){t.target=this;for(var r=i.slice(0),s=0,o=r.length;s<o;s++)r[s].call(this,t)}}},n}(),qa=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ka=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Za=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},U=function(){function n(){this.listeners=[]}return n.prototype.addEventListener=function(t){this.listeners.push(t)},n.prototype.removeEventListener=function(t){this.listeners=this.listeners.filter(function(e){return e!==t})},n.prototype.replaceEventListener=function(t){this.removeEventListener(t),this.addEventListener(t)},n.prototype.dispatch=function(t){for(var e,i,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];try{for(var o=qa(this.listeners),a=o.next();!a.done;a=o.next()){var h=a.value,l=h;l.call.apply(l,Za([null,t],Ka(r),!1))}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}},n}(),Qi=function(){return Qi=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Qi.apply(this,arguments)},Qa=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Ja=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},Ps=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Me(n){return n===null||typeof n!="object"?n:Array.isArray(n)?Ja([],Qa(n),!1):Qi({},n)}function Ji(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(Ji);var t={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=Ji(n[e]));return t}function Ge(n){for(var t,e,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];try{for(var s=Ps(i),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var h in a)Object.prototype.hasOwnProperty.call(a,h)&&n[h]===void 0&&(n[h]=a[h])}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n}function As(n,t){return n!=null&&Object.prototype.hasOwnProperty.call(n,t)}function Ss(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 fe(n,t){var e,i;if(n===t)return!0;if(n==null||t==null)return n===t;if(typeof n!=typeof t)return!1;if(typeof n!="object")return n===t;if(Array.isArray(n)!==Array.isArray(t))return!1;if(Array.isArray(n)){if(n.length!==t.length)return!1;for(var r=0;r<n.length;r++)if(!fe(n[r],t[r]))return!1;return!0}var s=Object.keys(n),o=Object.keys(t);if(s.length!==o.length)return!1;try{for(var a=Ps(s),h=a.next();!h.done;h=a.next()){var l=h.value;if(!Object.prototype.hasOwnProperty.call(t,l)||!fe(n[l],t[l]))return!1}}catch(c){e={error:c}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return!0}var tl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function el(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ls={exports:{}};(function(n){(function(t,e){n.exports?n.exports=e():t.log=e()})(tl,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],s={},o=null;function a(f,y){var _=f[y];if(typeof _.bind=="function")return _.bind(f);try{return Function.prototype.bind.call(_,f)}catch{return function(){return Function.prototype.apply.apply(_,[f,arguments])}}}function h(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function l(f){return f==="debug"&&(f="log"),typeof console===e?!1:f==="trace"&&i?h:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):t}function c(){for(var f=this.getLevel(),y=0;y<r.length;y++){var _=r[y];this[_]=y<f?t:this.methodFactory(_,f,this.name)}if(this.log=this.debug,typeof console===e&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==e&&(c.call(this),this[f].apply(this,arguments))}}function g(f,y,_){return l(f)||u.apply(this,arguments)}function d(f,y){var _=this,v,S,A,L="loglevel";typeof f=="string"?L+=":"+f:typeof f=="symbol"&&(L=void 0);function T(Y){var R=(r[Y]||"silent").toUpperCase();if(!(typeof window===e||!L)){try{window.localStorage[L]=R;return}catch{}try{window.document.cookie=encodeURIComponent(L)+"="+R+";"}catch{}}}function E(){var Y;if(!(typeof window===e||!L)){try{Y=window.localStorage[L]}catch{}if(typeof Y===e)try{var R=window.document.cookie,H=encodeURIComponent(L),it=R.indexOf(H+"=");it!==-1&&(Y=/^([^;]+)/.exec(R.slice(it+H.length+1))[1])}catch{}return _.levels[Y]===void 0&&(Y=void 0),Y}}function X(){if(!(typeof window===e||!L)){try{window.localStorage.removeItem(L)}catch{}try{window.document.cookie=encodeURIComponent(L)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function I(Y){var R=Y;if(typeof R=="string"&&_.levels[R.toUpperCase()]!==void 0&&(R=_.levels[R.toUpperCase()]),typeof R=="number"&&R>=0&&R<=_.levels.SILENT)return R;throw new TypeError("log.setLevel() called with invalid level: "+Y)}_.name=f,_.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},_.methodFactory=y||g,_.getLevel=function(){return A??S??v},_.setLevel=function(Y,R){return A=I(Y),R!==!1&&T(A),c.call(_)},_.setDefaultLevel=function(Y){S=I(Y),E()||_.setLevel(Y,!1)},_.resetLevel=function(){A=null,X(),c.call(_)},_.enableAll=function(Y){_.setLevel(_.levels.TRACE,Y)},_.disableAll=function(Y){_.setLevel(_.levels.SILENT,Y)},_.rebuild=function(){if(o!==_&&(v=I(o.getLevel())),c.call(_),o===_)for(var Y in s)s[Y].rebuild()},v=I(o?o.getLevel():"WARN");var z=E();z!=null&&(A=I(z)),c.call(_)}o=new d,o.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var _=s[y];return _||(_=s[y]=new d(y,o.methodFactory)),_};var p=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=p),o},o.getLoggers=function(){return s},o.default=o,o})})(Ls);var il=Ls.exports;const nl=el(il);var rl=!0,Ee=nl;Ee.setLevel("debug");var sl=function(n){try{Ee.setLevel(n)}catch(t){Ee.setLevel("error"),Ee.error(t)}},Ms=function(){function n(t,e){this.events={attrChanged:new U,modelChanged:new U},this._changing=!1,this._previousAttributes={},this._pending=!1;var i=t||{};e&&Ge(i,e),this.attributes=i,this.changed={}}return n.prototype.get=function(t){return this.attributes[t]},n.prototype.set=function(t,e,i){if(t==null)return this;var r;typeof t=="object"?(r=t,i=e):(r={},r[t]=e),i||(i={});var s=i.unset,o=i.silent,a=[],h=this._changing;this._changing=!0,h||(this._previousAttributes=Me(this.attributes),this.changed={});var l=this.attributes,c=this.changed,u=this._previousAttributes;for(var g in r)e=r[g],fe(l[g],e)||a.push(g),fe(u[g],e)?delete c[g]:c[g]=e,s?delete l[g]:l[g]=e;if(!o){a.length&&(this._pending=i);for(var d=0;d<a.length;d++)this.events.attrChanged.dispatch({object:this,attrName:a[d],attrValue:l[a[d]],options:i})}if(h)return this;if(!o)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},n.prototype.has=function(t){return this.get(t)!=null},n.prototype.hasChanged=function(t){return t==null?!Ss(this.changed):As(this.changed,t)},n.prototype.changedAttributes=function(t){if(!t)return this.hasChanged()?Me(this.changed):{};var e=this._changing?this._previousAttributes:this.attributes,i={};for(var r in t){var s=t[r];fe(e[r],s)||(i[r]=s)}return i},n.prototype.previous=function(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]},n.prototype.previousAttributes=function(){return Me(this._previousAttributes)},n.prototype.clone=function(){var t=Me(this.attributes);return new n(t)},n}(),ol=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},al=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Wn=function(){function n(){this.entries=new Map}return n.getInstance=function(){return n.instance||(n.instance=new n),n.instance},n.prototype.collect=function(t){this.entries.set(t.name,t)},n.prototype.printAll=function(){var t,e;try{for(var i=ol(this.entries),r=i.next();!r.done;r=i.next())var s=al(r.value,2),o=s[0],a=s[1]}catch(h){t={error:h}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},n.prototype.clear=function(){this.entries.clear()},n.prototype.getAll=function(){return Array.from(this.entries.values())},n.prototype.getEntry=function(t){return this.entries.get(t)},n.prototype.remove=function(t){return this.entries.delete(t)},n}(),ll=function(){function n(){}return n.formatBytes=function(t,e){if(e===void 0&&(e=2),t===0)return"0 B";var i=1024,r=Math.max(0,e),s=["B","KB","MB","GB","TB"],o=Math.floor(Math.log(t)/Math.log(i)),a=t/Math.pow(i,o);return"".concat(parseFloat(a.toFixed(r))," ").concat(s[o])},n}();exports.AcCmTransparencyMethod=void 0;(function(n){n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue"})(exports.AcCmTransparencyMethod||(exports.AcCmTransparencyMethod={}));var $=function(){function n(t){t!==void 0?(this._method=exports.AcCmTransparencyMethod.ByAlpha,this._alpha=n.clampAlpha(t)):(this._method=exports.AcCmTransparencyMethod.ByLayer,this._alpha=255)}return Object.defineProperty(n.prototype,"method",{get:function(){return this._method},set:function(t){this._method=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=n.clampAlpha(t),this._method=exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"percentage",{get:function(){if(this._method===exports.AcCmTransparencyMethod.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(t){var e=Math.max(0,Math.min(100,t)),i=Math.round(255*(1-e/100));this.alpha=i},enumerable:!1,configurable:!0}),n.clampAlpha=function(t){return Math.max(0,Math.min(255,Math.floor(t)))},Object.defineProperty(n.prototype,"isByAlpha",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._method===exports.AcCmTransparencyMethod.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInvalid",{get:function(){return this._method===exports.AcCmTransparencyMethod.ErrorValue},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){var t=this._method;return t<<24|this._alpha},n.prototype.clone=function(){var t=new n;return t._method=this._method,t._alpha=this._alpha,t},n.prototype.equals=function(t){return this._method===t._method&&this._alpha===t._alpha},n.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},n.fromString=function(t){var e=t.trim(),i=e.toLowerCase();if(i===""||i==="."||i==="use current"||i==="bylayer"){var r=new n;return r._method=exports.AcCmTransparencyMethod.ByLayer,r}if(i==="byblock"){var s=new n;return s._method=exports.AcCmTransparencyMethod.ByBlock,s}var o=Number(e);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new n;return o<=90?a.percentage=o:a.alpha=o,a}var h=new n;return h._method=exports.AcCmTransparencyMethod.ErrorValue,h},n.deserialize=function(t){var e=t>>>24&255,i=t&255,r=e>=exports.AcCmTransparencyMethod.ByLayer&&e<=exports.AcCmTransparencyMethod.ErrorValue?e:exports.AcCmTransparencyMethod.ErrorValue,s=new n;return s._method=r,s._alpha=n.clampAlpha(i),s},n}(),Ur=function(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(c){try{l(i.next(c))}catch(u){o(u)}}function h(c){try{l(i.throw(c))}catch(u){o(u)}}function l(c){c.done?s(c.value):r(c.value).then(a,h)}l((i=i.apply(n,t||[])).next())})},Ri=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Es=function(){function n(t){this.name=t}return n.prototype.run=function(t){throw new Error("run() must be implemented by subclass")},n}(),Is=function(){function n(){this.tasks=[],this.onProgress=function(){},this.onComplete=function(){},this.onError=function(){return!1}}return n.prototype.scheduleTask=function(t){return new Promise(function(e,i){var r=function(){Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})},n.prototype.addTask=function(t){this.tasks.push(t)},n.prototype.setProgressCallback=function(t){this.onProgress=t},n.prototype.setCompleteCallback=function(t){this.onComplete=t},n.prototype.setErrorCallback=function(t){this.onError=t},n.prototype.run=function(t){return Ur(this,void 0,void 0,function(){var e,i,r,s,o,a,h=this;return Ri(this,function(l){switch(l.label){case 0:e=this.tasks.length,i=t,r=function(c){var u,g,d;return Ri(this,function(p){switch(p.label){case 0:u=s.tasks[c],p.label=1;case 1:return p.trys.push([1,3,,4]),[4,s.scheduleTask(function(){return Ur(h,void 0,void 0,function(){var f;return Ri(this,function(y){switch(y.label){case 0:return[4,u.run(i)];case 1:return f=y.sent(),this.onProgress((c+1)/e,u),[2,f]}})})})];case 2:return i=p.sent(),[3,4];case 3:return g=p.sent(),d=s.onError({error:g,taskIndex:c,task:u}),d?[2,{value:Promise.reject(g)}]:[3,4];case 4:return[2]}})},s=this,o=0,l.label=1;case 1:return o<e?[5,r(o)]:[3,4];case 2:if(a=l.sent(),typeof a=="object")return[2,a.value];l.label=3;case 3:return o++,[3,1];case 4:return this.onComplete(i),[2]}})})},n}(),Ts=function(){function n(t,e,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i}return n.prototype.itemStart=function(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0},n.prototype.itemEnd=function(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())},n.prototype.itemError=function(t){this.onError!==void 0&&this.onError(t)},n.prototype.resolveURL=function(t){return this.urlModifier?this.urlModifier(t):t},n.prototype.setURLModifier=function(t){return this.urlModifier=t,this},n.prototype.addHandler=function(t,e){return this.handlers.push(t,e),this},n.prototype.removeHandler=function(t){var e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this},n.prototype.getHandler=function(t){for(var e=0,i=this.handlers.length;e<i;e+=2){var r=this.handlers[e],s=this.handlers[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return s}return null},n}(),Cs=new Ts,hl=function(){function n(t){this.manager=t!==void 0?t:Cs,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return n.prototype.loadAsync=function(t,e){var i=this;return new Promise(function(r,s){i.load(t,r,e,s)})},n.prototype.parse=function(t){},n.prototype.setCrossOrigin=function(t){return this.crossOrigin=t,this},n.prototype.setWithCredentials=function(t){return this.withCredentials=t,this},n.prototype.setPath=function(t){return this.path=t,this},n.prototype.setResourcePath=function(t){return this.resourcePath=t,this},n.prototype.setRequestHeader=function(t){return this.requestHeader=t,this},n}();const Wr=[{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 yt{constructor(t){if(typeof t=="string"){const e=Wr.find(i=>i.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=Wr.find(i=>i.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Os{constructor(t={}){this._database=t.database,this._precision=Math.max(0,Math.min(16,t.precision??16)),this._version=t.version instanceof yt?t.version:t.version!=null?new yt(t.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(t){this._database=t}get precision(){return this._precision}setPrecision(t){return this._precision=Math.max(0,Math.min(16,t)),this}get version(){return this._version}get nextHandle(){return this._nextHandle}setVersion(t){return this._version=t instanceof yt?t:new yt(t),this}toString(){return this._lines.join(`
2
2
  `)+`
3
- `}registerHandle(t){return this._handleMap.has(t)||(/^[0-9A-F]+$/i.test(t)?this._handleMap.set(t,t.toUpperCase()):(this._handleMap.set(t,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(t)}resolveHandle(t){if(t)return this.registerHandle(t)}writeGroup(t,e){if(e==null)return this;this._lines.push(String(Math.trunc(t)));const i=this.formatValue(e);return this._lines.push(i===""?"0":i),this}writeStart(t){return this.writeString(0,t)}writeSubclassMarker(t){return this.writeString(100,t)}writeString(t,e){return!e&&e!==""?this:this.writeGroup(t,e)}writeInt8(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt16(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt32(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt64(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeUInt16(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeUInt32(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeBoolean(t,e){return e==null?this:this.writeGroup(t,e?1:0)}writeBool(t,e){return this.writeBoolean(t,e)}writeDouble(t,e){return e==null||!Number.isFinite(e)?this:this.writeGroup(t,e)}writeAngle(t,e){return e==null||!Number.isFinite(e)?this:this.writeDouble(t,e*180/Math.PI)}writeHandle(t,e){const i=this.resolveHandle(e);return i?this.writeString(t,i):this}writeObjectId(t,e){return this.writeHandle(t,e)}writePoint2d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this):this}writePoint3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeVector3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeCmColor(t,e=62,i=420){if(!t)return this;const r=t.colorIndex;r!=null&&this.writeInt16(e,r);const s=t.RGB;return s!=null&&t.colorIndex==null&&this.writeInt32(i,s),this}writeTransparency(t,e=440){return!t||t.method===exports.AcCmTransparencyMethod.ErrorValue?this:this.writeInt32(e,t.serialize())}writeResultBuffer(t){if(!t)return this;for(const e of t)this.writeGroup(e.code,e.value);return this}startSection(t){return this.writeStart("SECTION"),this.writeString(2,t),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(t){return this.writeStart("TABLE"),this.writeString(2,t),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(t){if(typeof t=="string")return this.sanitizeStringForDxfLine(t);if(typeof t=="boolean")return t?"1":"0";if(typeof t=="number"){if(!Number.isFinite(t))return"0";if(Number.isInteger(t))return String(t);const i=t.toFixed(this._precision).replace(/\.?0+$/,"");return i===""||i==="-"?"0":i}return String(t)}sanitizeStringForDxfLine(t){return t.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var Zt=256,Cs=[],Ur=256,Ue;for(;Zt--;)Cs[Zt]=(Zt+256).toString(16).substring(1);function ll(n){var t=0,e=11;if(!Ue||Zt+e>Ur*2)for(Ue="",Zt=0;t<Ur;t++)Ue+=Cs[Math.random()*256|0];return Ue.substring(Zt,Zt+++e)}const ni="TEMP_";let Xe;function Os(n){Xe=n}function hl(){if(Xe)return Xe().workingDatabase;throw new Error("The current working database must be set before using it!")}class _t{constructor(t,e){if(t=t||{},this._attrs=new Ss(t,e),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return ni+ll()}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t),t&&!t.startsWith(ni)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(ni)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){if(this._database)return this._database;if(Xe)return Xe().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this.assignDatabase(t)}assignDatabase(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Dn.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}clone(){const t=Object.create(Object.getPrototypeOf(this)),e=this,i=t;for(const r of Object.keys(e))r!=="_database"&&(i[r]=this.cloneValue(e[r]));return t.objectId=this.generateTemporaryHandle(),t}cloneValue(t){if(t==null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(r=>this.cloneValue(r));if(t instanceof Map){const r=new Map;for(const[s,o]of t.entries())r.set(this.cloneValue(s),this.cloneValue(o));return r}if(t instanceof Set){const r=new Set;for(const s of t.values())r.add(this.cloneValue(s));return r}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));const r=t.constructor;return new r(t)}if(t instanceof ArrayBuffer)return t.slice(0);if("clone"in t&&typeof t.clone=="function")return t.clone();const e=Object.create(Object.getPrototypeOf(t)),i=t;for(const r of Object.keys(i))e[r]=this.cloneValue(i[r]);return e}dxfOut(...t){const[e,i=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),i)for(const r of this._xDataMap.values())e.writeResultBuffer(r);return this}dxfOutFields(t){return this}}var tt=["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"],Wr=1234567,Un=Math.PI/180,Wn=180/Math.PI;function ks(){var n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0,r=tt[n&255]+tt[n>>8&255]+tt[n>>16&255]+tt[n>>24&255]+"-"+tt[t&255]+tt[t>>8&255]+"-"+tt[t>>16&15|64]+tt[t>>24&255]+"-"+tt[e&63|128]+tt[e>>8&255]+"-"+tt[e>>16&255]+tt[e>>24&255]+tt[i&255]+tt[i>>8&255]+tt[i>>16&255]+tt[i>>24&255];return r.toLowerCase()}function It(n,t,e){return Math.max(t,Math.min(e,n))}function $n(n,t){return(n%t+t)%t}function Ys(n,t,e,i,r){return i+(n-t)*(r-i)/(e-t)}function Xs(n,t,e){return n!==t?(e-n)/(t-n):0}function qn(n,t,e){return(1-e)*n+e*t}function Ns(n,t,e,i){return qn(n,t,1-Math.exp(-e*i))}function Bs(n,t){return t===void 0&&(t=1),t-Math.abs($n(n,t*2)-t)}function Rs(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function zs(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function Fs(n,t){return n+Math.floor(Math.random()*(t-n+1))}function Vs(n,t){return n+Math.random()*(t-n)}function js(n){return n*(.5-Math.random())}function Gs(n){n!==void 0&&(Wr=n);var t=Wr+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ds(n){return n*Un}function Hs(n){return n*Wn}function Us(n){return(n&n-1)===0&&n!==0}function Ws(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function $s(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ee(n){var t=Math.PI*2;return(n%t+t)%t}function qs(n,t,e){return n>t&&n<e||n>e&&n<t}function Ks(n,t,e,i){return i===void 0&&(i=!1),n=Ee(n),t=Ee(t),e=Ee(e),i?t>e?n<=t&&n>=e:n<=t||n>=e:t<e?n>=t&&n<=e:n>=t||n<=e}function Kn(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Zs(n,t){t===void 0&&(t=1e-7);var e=Kn(n);return Math.max(Math.pow(10,e)*t,t)}var M={DEG2RAD:Un,RAD2DEG:Wn,generateUUID:ks,clamp:It,euclideanModulo:$n,mapLinear:Ys,inverseLerp:Xs,lerp:qn,damp:Ns,pingpong:Bs,smoothstep:Rs,smootherstep:zs,randInt:Fs,randFloat:Vs,randFloatSpread:js,seededRandom:Gs,degToRad:Ds,radToDeg:Hs,isPowerOfTwo:Us,ceilPowerOfTwo:Ws,floorPowerOfTwo:$s,normalizeAngle:Ee,isBetween:qs,isBetweenAngle:Ks,intPartLength:Kn,relativeEps:Zs},cl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},G=function(){function n(t,e){this.x=0,this.y=0;var i=+(t!==void 0)+ +(e!==void 0);if(i!==0){if(i===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(i===1){var r=t,s=r.x,o=r.y;this.x=s,this.y=o;return}if(i===2){this.x=t,this.y=e;return}throw lt.ILLEGAL_PARAMETERS}}return Object.defineProperty(n.prototype,"width",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e){return this.x=t,this.y=e,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},n.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.applyMatrix2d=function(t){var e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this},n.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},n.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},n.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},n.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y},n.prototype.cross=function(t){return this.x*t.y-this.y*t.x},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},n.prototype.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t},n.prototype.rotateAround=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*i-o*r+t.x,this.y=s*r+o*i+t.y,this},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},n.prototype.relativeEps=function(t){return t===void 0&&(t=1e-7),Math.min(M.relativeEps(this.x,t),M.relativeEps(this.y,t))},n.prototype[Symbol.iterator]=function(){return cl(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[2]}})},n.EMPTY=Object.freeze(new n(0,0)),n}(),Ge=function(){function n(t,e,i,r,s,o,a,h,l){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&h!=null&&l!=null&&this.set(t,e,i,r,s,o,a,h,l)}return n.prototype.set=function(t,e,i,r,s,o,a,h,l){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=s,c[5]=h,c[6]=i,c[7]=o,c[8]=l,this},n.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},n.prototype.copy=function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},n.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[3],h=i[6],l=i[1],c=i[4],u=i[7],g=i[2],d=i[5],p=i[8],f=r[0],y=r[3],_=r[6],v=r[1],S=r[4],A=r[7],L=r[2],T=r[5],I=r[8];return s[0]=o*f+a*v+h*L,s[3]=o*y+a*S+h*T,s[6]=o*_+a*A+h*I,s[1]=l*f+c*v+u*L,s[4]=l*y+c*S+u*T,s[7]=l*_+c*A+u*I,s[2]=g*f+d*v+p*L,s[5]=g*y+d*S+p*T,s[8]=g*_+d*A+p*I,this},n.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8];return e*o*c-e*a*l-i*s*c+i*a*h+r*s*l-r*o*h},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=c*o-a*l,g=a*h-c*s,d=l*s-o*h,p=e*u+i*g+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=u*f,t[1]=(r*l-c*i)*f,t[2]=(a*i-r*o)*f,t[3]=g*f,t[4]=(c*e-r*h)*f,t[5]=(r*s-a*e)*f,t[6]=d*f,t[7]=(i*h-l*e)*f,t[8]=(o*e-i*s)*f,this},n.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},n.prototype.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},n.prototype.transposeIntoArray=function(t){var e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this},n.prototype.setUvTransform=function(t,e,i,r,s,o,a){var h=Math.cos(s),l=Math.sin(s);return this.set(i*h,i*l,-i*(h*o+l*a)+o+t,-r*l,r*h,-r*(-l*o+h*a)+a+e,0,0,1),this},n.prototype.scale=function(t,e){return this.premultiply(Ri.makeScale(t,e)),this},n.prototype.rotate=function(t){return this.premultiply(Ri.makeRotation(-t)),this},n.prototype.translate=function(t,e){return this.premultiply(Ri.makeTranslation(t,e)),this},n.prototype.makeTranslation=function(t,e){return t instanceof G?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this},n.prototype.makeRotation=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this},n.prototype.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.IDENTITY=Object.freeze(new n),n}(),Ri=new Ge,Mt=1e-6,B=2*Math.PI,ul={x:0,y:0},Zn={x:0,y:0,z:0},F=function(){function n(){this.equalPointTol=Mt,this.equalVectorTol=Mt}return n.prototype.clone=function(){var t=new n;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t},n.prototype.equalPoint2d=function(t,e){return new G(t).sub(e).length()<this.equalPointTol},n.prototype.equalPoint3d=function(t,e){return new x(t).sub(e).length()<this.equalPointTol},n.equalToZero=function(t,e){return e===void 0&&(e=Mt),t<e&&t>-e},n.equal=function(t,e,i){return i===void 0&&(i=Mt),Math.abs(t-e)<i},n.great=function(t,e,i){return i===void 0&&(i=Mt),t-e>i},n.less=function(t,e,i){return i===void 0&&(i=Mt),t-e<i},n.isPositive=function(t,e){return e===void 0&&(e=Mt),t>e},n.isNonPositive=function(t,e){return e===void 0&&(e=Mt),t<=e},n}(),Ii=new F,dl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},_e=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this._x=t,this._y=e,this._z=i,this._w=r}return n.slerpFlat=function(t,e,i,r,s,o,a){var h=i[r+0],l=i[r+1],c=i[r+2],u=i[r+3],g=s[o+0],d=s[o+1],p=s[o+2],f=s[o+3];if(a===0){t[e+0]=h,t[e+1]=l,t[e+2]=c,t[e+3]=u;return}if(a===1){t[e+0]=g,t[e+1]=d,t[e+2]=p,t[e+3]=f;return}if(u!==f||h!==g||l!==d||c!==p){var y=1-a,_=h*g+l*d+c*p+u*f,v=_>=0?1:-1,S=1-_*_;if(S>Number.EPSILON){var A=Math.sqrt(S),L=Math.atan2(A,_*v);y=Math.sin(y*L)/A,a=Math.sin(a*L)/A}var T=a*v;if(h=h*y+g*T,l=l*y+d*T,c=c*y+p*T,u=u*y+f*T,y===1-a){var I=1/Math.sqrt(h*h+l*l+c*c+u*u);h*=I,l*=I,c*=I,u*=I}}t[e]=h,t[e+1]=l,t[e+2]=c,t[e+3]=u},n.multiplyQuaternionsFlat=function(t,e,i,r,s,o){var a=i[r],h=i[r+1],l=i[r+2],c=i[r+3],u=s[o],g=s[o+1],d=s[o+2],p=s[o+3];return t[e]=a*p+c*u+h*d-l*g,t[e+1]=h*p+c*g+l*u-a*d,t[e+2]=l*p+c*d+a*g-h*u,t[e+3]=c*p-a*u-h*g-l*d,t},Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},n.prototype.setFromEuler=function(t,e){e===void 0&&(e=!0);var i=t.x,r=t.y,s=t.z,o=t.order,a=Math.cos,h=Math.sin,l=a(i/2),c=a(r/2),u=a(s/2),g=h(i/2),d=h(r/2),p=h(s/2);switch(o){case"XYZ":this._x=g*c*u+l*d*p,this._y=l*d*u-g*c*p,this._z=l*c*p+g*d*u,this._w=l*c*u-g*d*p;break;case"YXZ":this._x=g*c*u+l*d*p,this._y=l*d*u-g*c*p,this._z=l*c*p-g*d*u,this._w=l*c*u+g*d*p;break;case"ZXY":this._x=g*c*u-l*d*p,this._y=l*d*u+g*c*p,this._z=l*c*p+g*d*u,this._w=l*c*u-g*d*p;break;case"ZYX":this._x=g*c*u-l*d*p,this._y=l*d*u+g*c*p,this._z=l*c*p-g*d*u,this._w=l*c*u+g*d*p;break;case"YZX":this._x=g*c*u+l*d*p,this._y=l*d*u+g*c*p,this._z=l*c*p-g*d*u,this._w=l*c*u-g*d*p;break;case"XZY":this._x=g*c*u-l*d*p,this._y=l*d*u-g*c*p,this._z=l*c*p+g*d*u,this._w=l*c*u+g*d*p;break;default:}return e===!0&&this._onChangeCallback(),this},n.prototype.setFromAxisAngle=function(t,e){var i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],s=e[8],o=e[1],a=e[5],h=e[9],l=e[2],c=e[6],u=e[10],g=i+a+u;if(g>0){var d=.5/Math.sqrt(g+1);this._w=.25/d,this._x=(c-h)*d,this._y=(s-l)*d,this._z=(o-r)*d}else if(i>a&&i>u){var d=2*Math.sqrt(1+i-a-u);this._w=(c-h)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+l)/d}else if(a>u){var d=2*Math.sqrt(1+a-i-u);this._w=(s-l)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(h+c)/d}else{var d=2*Math.sqrt(1+u-i-a);this._w=(o-r)/d,this._x=(s+l)/d,this._y=(h+c)/d,this._z=.25*d}return this._onChangeCallback(),this},n.prototype.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},n.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(It(this.dot(t),-1,1)))},n.prototype.rotateTowards=function(t,e){var i=this.angleTo(t);if(i===0)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},n.prototype.identity=function(){return this.set(0,0,0,1)},n.prototype.invert=function(){return this.conjugate()},n.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},n.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},n.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},n.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},n.prototype.multiplyQuaternions=function(t,e){var i=t._x,r=t._y,s=t._z,o=t._w,a=e._x,h=e._y,l=e._z,c=e._w;return this._x=i*c+o*a+r*l-s*h,this._y=r*c+o*h+s*a-i*l,this._z=s*c+o*l+i*h-r*a,this._w=o*c-i*a-r*h-s*l,this._onChangeCallback(),this},n.prototype.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copy(t);var i=this._x,r=this._y,s=this._z,o=this._w,a=o*t._w+i*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;var h=1-a*a;if(h<=Number.EPSILON){var l=1-e;return this._w=l*o+e*this._w,this._x=l*i+e*this._x,this._y=l*r+e*this._y,this._z=l*s+e*this._z,this.normalize(),this}var c=Math.sqrt(h),u=Math.atan2(c,a),g=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*g+this._w*d,this._x=i*g+this._x*d,this._y=r*g+this._y*d,this._z=s*g+this._z*d,this._onChangeCallback(),this},n.prototype.slerpQuaternions=function(t,e,i){return this.copy(t).slerp(e,i)},n.prototype.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))},n.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},n.prototype.toJSON=function(){return this.toArray()},n.prototype._onChange=function(t){return this._onChangeCallback=t,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return dl(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._w];case 4:return t.sent(),[2]}})},n}(),gl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},x=function(){function n(t,e,i){this.x=0,this.y=0,this.z=0;var r=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){var s=t,o=s.x,a=s.y,h=s.z;this.x=o,this.y=a,this.z=h||0;return}if(r===3){this.x=t,this.y=e,this.z=i;return}throw lt.ILLEGAL_PARAMETERS}}return n.prototype.set=function(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setZ=function(t){return this.z=t,this},n.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},n.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},n.prototype.applyEuler=function(t){return this.applyQuaternion($r.setFromEuler(t))},n.prototype.applyAxisAngle=function(t,e){return this.applyQuaternion($r.setFromAxisAngle(t,e))},n.prototype.applyMatrix3=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this},n.prototype.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},n.prototype.applyMatrix4=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*o,this},n.prototype.applyQuaternion=function(t){var e=this.x,i=this.y,r=this.z,s=t.x,o=t.y,a=t.z,h=t.w,l=2*(o*r-a*i),c=2*(a*e-s*r),u=2*(s*i-o*e);return this.x=e+h*l+o*u-a*c,this.y=i+h*c+a*l-s*u,this.z=r+h*u+s*c-o*l,this},n.prototype.transformDirection=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},n.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.isParallelTo=function(t){var e=this.dot(t),i=this.length(),r=t.length();return Math.abs(e)===i*r},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},n.prototype.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},n.prototype.cross=function(t){return this.crossVectors(this,t)},n.prototype.crossVectors=function(t,e){var i=t.x,r=t.y,s=t.z,o=e.x,a=e.y,h=e.z;return this.x=r*h-s*a,this.y=s*o-i*h,this.z=i*a-r*o,this},n.prototype.projectOnVector=function(t){var e=t.lengthSq();if(e===0)return this.set(0,0,0);var i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)},n.prototype.projectOnPlane=function(t){return zi.copy(this).projectOnVector(t),this.sub(zi)},n.prototype.reflect=function(t){return this.sub(zi.copy(t).multiplyScalar(2*this.dot(t)))},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},n.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},n.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this},n.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,e*4)},n.prototype.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,e*3)},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},n.prototype.randomDirection=function(){var t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this},n.prototype[Symbol.iterator]=function(){return gl(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[4,this.z];case 3:return t.sent(),[2]}})},n.ORIGIN=Object.freeze(new n(0,0,0)),n.X_AXIS=Object.freeze(new n(1,0,0)),n.NEGATIVE_X_AXIS=Object.freeze(new n(-1,0,0)),n.Y_AXIS=Object.freeze(new n(0,1,0)),n.NEGATIVE_Y_AXIS=Object.freeze(new n(0,-1,0)),n.Z_AXIS=Object.freeze(new n(0,0,1)),n.NEGATIVE_Z_AXIS=Object.freeze(new n(0,0,-1)),n}(),zi=new x,$r=new _e,O=function(){function n(t,e,i,r,s,o,a,h,l,c,u,g,d,p,f,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&h!=null&&l!=null&&c!=null&&u!=null&&g!=null&&d!=null&&p!=null&&f!=null&&y!=null&&this.set(t,e,i,r,s,o,a,h,l,c,u,g,d,p,f,y)}return n.makeTranslation=function(t,e,i){return new n().makeTranslation(t,e,i)},n.prototype.set=function(t,e,i,r,s,o,a,h,l,c,u,g,d,p,f,y){var _=this.elements;return _[0]=t,_[4]=e,_[8]=i,_[12]=r,_[1]=s,_[5]=o,_[9]=a,_[13]=h,_[2]=l,_[6]=c,_[10]=u,_[14]=g,_[3]=d,_[7]=p,_[11]=f,_[15]=y,this},n.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.prototype.copy=function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},n.prototype.copyPosition=function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},n.prototype.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},n.prototype.setFromExtrusionDirection=function(t){var e=Math.hypot(t.x,t.y,t.z);if(!Number.isFinite(e)||e<1e-12)return this.identity(),this;var i=Math.abs(e-1)>1e-6?t.clone().multiplyScalar(1/e):t;if(Ii.equalPoint3d(i,x.Z_AXIS))this.identity();else{var r=new x(1,0,0);Math.abs(i.x)<1/64&&Math.abs(i.y)<1/64?r.crossVectors(x.Y_AXIS,i).normalize():r.crossVectors(x.Z_AXIS,i).normalize();var s=i.clone().cross(r).normalize();this.set(r.x,r.y,r.z,0,s.x,s.y,s.z,0,i.x,i.y,i.z,0,0,0,0,1)}return this},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},n.prototype.makeBasis=function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},n.prototype.extractRotation=function(t){var e=this.elements,i=t.elements,r=1/oe.setFromMatrixColumn(t,0).length(),s=1/oe.setFromMatrixColumn(t,1).length(),o=1/oe.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},n.prototype.makeRotationFromQuaternion=function(t){return this.compose(pl,t,fl)},n.prototype.lookAt=function(t,e,i){var r=this.elements;return ht.subVectors(t,e),ht.lengthSq()===0&&(ht.z=1),ht.normalize(),Bt.crossVectors(i,ht),Bt.lengthSq()===0&&(Math.abs(i.z)===1?ht.x+=1e-4:ht.z+=1e-4,ht.normalize(),Bt.crossVectors(i,ht)),Bt.normalize(),We.crossVectors(ht,Bt),r[0]=Bt.x,r[4]=We.x,r[8]=ht.x,r[1]=Bt.y,r[5]=We.y,r[9]=ht.y,r[2]=Bt.z,r[6]=We.z,r[10]=ht.z,this},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[4],h=i[8],l=i[12],c=i[1],u=i[5],g=i[9],d=i[13],p=i[2],f=i[6],y=i[10],_=i[14],v=i[3],S=i[7],A=i[11],L=i[15],T=r[0],I=r[4],X=r[8],E=r[12],z=r[1],Y=r[5],R=r[9],H=r[13],it=r[2],xt=r[6],ne=r[10],re=r[14],Wt=r[3],se=r[7],Xt=r[11],Nt=r[15];return s[0]=o*T+a*z+h*it+l*Wt,s[4]=o*I+a*Y+h*xt+l*se,s[8]=o*X+a*R+h*ne+l*Xt,s[12]=o*E+a*H+h*re+l*Nt,s[1]=c*T+u*z+g*it+d*Wt,s[5]=c*I+u*Y+g*xt+d*se,s[9]=c*X+u*R+g*ne+d*Xt,s[13]=c*E+u*H+g*re+d*Nt,s[2]=p*T+f*z+y*it+_*Wt,s[6]=p*I+f*Y+y*xt+_*se,s[10]=p*X+f*R+y*ne+_*Xt,s[14]=p*E+f*H+y*re+_*Nt,s[3]=v*T+S*z+A*it+L*Wt,s[7]=v*I+S*Y+A*xt+L*se,s[11]=v*X+S*R+A*ne+L*Xt,s[15]=v*E+S*H+A*re+L*Nt,this},n.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],o=t[1],a=t[5],h=t[9],l=t[13],c=t[2],u=t[6],g=t[10],d=t[14],p=t[3],f=t[7],y=t[11],_=t[15];return p*(+s*h*u-r*l*u-s*a*g+i*l*g+r*a*d-i*h*d)+f*(+e*h*d-e*l*g+s*o*g-r*o*d+r*l*c-s*h*c)+y*(+e*l*u-e*a*d-s*o*u+i*o*d+s*a*c-i*l*c)+_*(-r*a*c-e*h*u+e*a*g+r*o*u-i*o*g+i*h*c)},n.prototype.transpose=function(){var t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},n.prototype.setPosition=function(t,e,i){var r=this.elements;return t instanceof x?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=t[9],g=t[10],d=t[11],p=t[12],f=t[13],y=t[14],_=t[15],v=u*y*l-f*g*l+f*h*d-a*y*d-u*h*_+a*g*_,S=p*g*l-c*y*l-p*h*d+o*y*d+c*h*_-o*g*_,A=c*f*l-p*u*l+p*a*d-o*f*d-c*a*_+o*u*_,L=p*u*h-c*f*h-p*a*g+o*f*g+c*a*y-o*u*y,T=e*v+i*S+r*A+s*L;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var I=1/T;return t[0]=v*I,t[1]=(f*g*s-u*y*s-f*r*d+i*y*d+u*r*_-i*g*_)*I,t[2]=(a*y*s-f*h*s+f*r*l-i*y*l-a*r*_+i*h*_)*I,t[3]=(u*h*s-a*g*s-u*r*l+i*g*l+a*r*d-i*h*d)*I,t[4]=S*I,t[5]=(c*y*s-p*g*s+p*r*d-e*y*d-c*r*_+e*g*_)*I,t[6]=(p*h*s-o*y*s-p*r*l+e*y*l+o*r*_-e*h*_)*I,t[7]=(o*g*s-c*h*s+c*r*l-e*g*l-o*r*d+e*h*d)*I,t[8]=A*I,t[9]=(p*u*s-c*f*s-p*i*d+e*f*d+c*i*_-e*u*_)*I,t[10]=(o*f*s-p*a*s+p*i*l-e*f*l-o*i*_+e*a*_)*I,t[11]=(c*a*s-o*u*s-c*i*l+e*u*l+o*i*d-e*a*d)*I,t[12]=L*I,t[13]=(c*f*r-p*u*r+p*i*g-e*f*g-c*i*y+e*u*y)*I,t[14]=(p*a*r-o*f*r-p*i*h+e*f*h+o*i*y-e*a*y)*I,t[15]=(o*u*r-c*a*r+c*i*h-e*u*h-o*i*g+e*a*g)*I,this},n.prototype.scale=function(t){var e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this},n.prototype.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))},n.prototype.makeTranslation=function(t,e,i){var r;return typeof t=="object"?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,(r=t.z)!==null&&r!==void 0?r:0,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},n.prototype.makeRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},n.prototype.makeRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},n.prototype.makeRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},n.prototype.makeRotationAxis=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=1-i,o=t.x,a=t.y,h=t.z,l=s*o,c=s*a;return this.set(l*o+i,l*a-r*h,l*h+r*a,0,l*a+r*h,c*a+i,c*h-r*o,0,l*h-r*a,c*h+r*o,s*h*h+i,0,0,0,0,1),this},n.prototype.makeScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},n.prototype.makeShear=function(t,e,i,r,s,o){return this.set(1,i,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this},n.prototype.compose=function(t,e,i){var r=this.elements,s=e.x,o=e.y,a=e.z,h=e.w,l=s+s,c=o+o,u=a+a,g=s*l,d=s*c,p=s*u,f=o*c,y=o*u,_=a*u,v=h*l,S=h*c,A=h*u,L=i.x,T=i.y,I=i.z;return r[0]=(1-(f+_))*L,r[1]=(d+A)*L,r[2]=(p-S)*L,r[3]=0,r[4]=(d-A)*T,r[5]=(1-(g+_))*T,r[6]=(y+v)*T,r[7]=0,r[8]=(p+S)*I,r[9]=(y-v)*I,r[10]=(1-(g+f))*I,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},n.prototype.decompose=function(t,e,i){var r=this.elements,s=oe.set(r[0],r[1],r[2]).length(),o=oe.set(r[4],r[5],r[6]).length(),a=oe.set(r[8],r[9],r[10]).length(),h=this.determinant();h<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],pt.copy(this);var l=1/s,c=1/o,u=1/a;return pt.elements[0]*=l,pt.elements[1]*=l,pt.elements[2]*=l,pt.elements[4]*=c,pt.elements[5]*=c,pt.elements[6]*=c,pt.elements[8]*=u,pt.elements[9]*=u,pt.elements[10]*=u,e.setFromRotationMatrix(pt),i.x=s,i.y=o,i.z=a,this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t},n.IDENTITY=Object.freeze(new n),n}(),oe=new x,pt=new O,pl=new x(0,0,0),fl=new x(1,1,1),Bt=new x,We=new x,ht=new x,C=function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new x(1/0,1/0,1/0):new x(t.x,t.y,t.z),this.max=e==null?new x(-1/0,-1/0,-1/0):new x(e.x,e.y,e.z)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromArray=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e+=3)this.expandByPoint(Fi.fromArray(t,e));return this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Fi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},n.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},n.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},n.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},n.prototype.intersectsPlane=function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Fi).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.applyMatrix4=function(t){return this.isEmpty()?this:(Lt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Lt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Lt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Lt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Lt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Lt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Lt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Lt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Lt),this)},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n}(),Lt=[new x,new x,new x,new x,new x,new x,new x,new x],Fi=new x,qr=new G,Q=function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new G(1/0,1/0):new G(t.x,t.y),this.max=e==null?new G(-1/0,-1/0):new G(e.x,e.y)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=qr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new G(0,0):new G(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new G(0,0):new G(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},n.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},n.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},n.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,qr).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n}(),Kr=new x,yl=new x,ml=new Ge,Qn=function(){function n(t,e){t===void 0&&(t=new x(1,0,0)),e===void 0&&(e=0),this.normal=t,this.constant=e}return n.prototype.set=function(t,e){return this.normal.copy(t),this.constant=e,this},n.prototype.setComponents=function(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this},n.prototype.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},n.prototype.setFromCoplanarPoints=function(t,e,i){var r=Kr.subVectors(i,e).cross(yl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},n.prototype.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},n.prototype.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},n.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},n.prototype.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},n.prototype.projectPoint=function(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},n.prototype.intersectsBox=function(t){return t.intersectsPlane(this)},n.prototype.coplanarPoint=function(t){return t.copy(this.normal).multiplyScalar(-this.constant)},n.prototype.applyMatrix4=function(t,e){var i=e||ml.getNormalMatrix(t),r=this.coplanarPoint(Kr).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this},n.prototype.translate=function(t){return this.constant-=t.dot(this.normal),this},n.prototype.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},n.prototype.clone=function(){return new n().copy(this)},n}(),_l=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),P=function(n){_l(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y)},t.pointArrayToNumberArray=function(e){var i=new Array(e.length*2);return e.forEach(function(r,s){r.toArray(i,s*2)}),i},t}(G),xl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),m=function(n){xl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.pointArrayToNumberArray=function(e,i){i===void 0&&(i=!0);var r=i?3:2,s=new Array(e.length*r);return e.forEach(function(o,a){o.toArray(s,a*r)}),s},t}(x),wl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Zr=new O,Qr=new _e,bl=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=n.DEFAULT_ORDER),this._x=t,this._y=e,this._z=i,this._order=r}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e,i,r){return r===void 0&&(r=this._order),this._x=t,this._y=e,this._z=i,this._order=r,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._order)},n.prototype.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(t,e,i){e===void 0&&(e=this._order),i===void 0&&(i=!0);var r=t.elements,s=r[0],o=r[4],a=r[8],h=r[1],l=r[5],c=r[9],u=r[2],g=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(It(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,l),this._z=0);break;case"YXZ":this._x=Math.asin(-It(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(It(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(h,s));break;case"ZYX":this._y=Math.asin(-It(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,d),this._z=Math.atan2(h,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(It(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-It(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:}return this._order=e,i===!0&&this._onChangeCallback(),this},n.prototype.setFromQuaternion=function(t,e,i){return i===void 0&&(i=!0),Zr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Zr,e,i)},n.prototype.setFromVector3=function(t,e){return e===void 0&&(e=this._order),this.set(t.x,t.y,t.z,e)},n.prototype.reorder=function(t){return Qr.setFromEuler(this),this.setFromQuaternion(Qr,t)},n.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},n.prototype.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},n.prototype._onChange=function(t){return this._onChangeCallback=t,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return wl(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._order];case 4:return t.sent(),[2]}})},n.DEFAULT_ORDER="XYZ",n}();function vl(n){var t,e=n;return{x:n.x,y:n.y,z:(t=e.z)!==null&&t!==void 0?t:0}}function Pl(n,t){var e,i;n.x+=t.x,n.y+=t.y,n.z=((e=n.z)!==null&&e!==void 0?e:0)+((i=t.z)!==null&&i!==void 0?i:0)}function Al(n,t,e){e===void 0&&(e=!1);for(var i=n.x,r=n.y,s=!1,o=t.length,a=0,h=o-1;a<o;h=a++){var l=t[a].x,c=t[a].y,u=t[h].x,g=t[h].y,d=c>r!=g>r;e&&(d=c>=r!=g>=r);var p=d&&i<(u-l)*(r-c)/(g-c)+l;p&&(s=!s)}return s}function Sl(n,t){if(n.length===0||t.length===0)return!1;var e=new Q().setFromPoints(n),i=new Q().setFromPoints(t);if(!e.intersectsBox(i))return!1;for(var r=0;r<n.length;){if(nt.isPointInPolygon(n[r],t,!0))return!0;r<n.length-1&&Ii.equalPoint2d(n[r+1],n[r])&&++r,++r}return!1}var nt={applyOffsetToPoint3d:Pl,isPointInPolygon:Al,isPolygonIntersect:Sl,point2dToPoint3d:vl},$e=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},qe=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function Ll(n,t){for(var e=[],i=t-1,r=n,s=0;s<=r;s++)e.push(0);for(var s=1;s<=i-r;s++)e.push(s);for(var s=0;s<=r;s++)e.push(i-r+1);return e}function Ml(n,t){for(var e=t.length-1,i=n,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],l=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+h*h+l*l);s+=c,r.push(s)}for(var u=[],o=0;o<=i;o++)u.push(0);for(var o=1;o<=e-i;o++){var g=r[o]/s;u.push(g*(e-i+1))}for(var o=0;o<=i;o++)u.push(e-i+1);return u}function Qs(n,t){t===void 0&&(t="Uniform");var e=n.length;if(e===0)return[];if(e===1)return[0];var i=e-1;if(t==="Uniform")return new Array(e).fill(0).map(function(g,d){return d/i});for(var r=[0],s=0,o=1;o<=i;o++){var a=n[o][0]-n[o-1][0],h=n[o][1]-n[o-1][1],l=n[o][2]-n[o-1][2],c=Math.sqrt(a*a+h*h+l*l),u=t==="SqrtChord"?Math.sqrt(c):c;s+=u,r.push(s)}return s<1e-12?new Array(e).fill(0).map(function(g,d){return d/i}):r.map(function(g){return g/s})}function Js(n,t){for(var e=t.length-1,i=n,r=e+i+1,s=new Array(r+1).fill(0),o=t[t.length-1],a=r-i;a<=r;a++)s[a]=o;for(var h=1;h<=e-i;h++){for(var l=0,a=h;a<h+i;a++)l+=t[a];s[h+i]=l/i}return s}function Il(n,t){for(var e=t.length-1,i=n,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],l=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+h*h+l*l),u=Math.sqrt(c);s+=u,r.push(s)}for(var g=[],o=0;o<=i;o++)g.push(0);for(var o=1;o<=e-i;o++){var d=r[o]/s;g.push(d*(e-i+1))}for(var o=0;o<=i;o++)g.push(e-i+1);return g}function Vi(n,t){for(var e=n.length,i=n.map(function(y){return y.slice()}),r=t.slice(),s=0;s<e;s++){for(var o=s,a=Math.abs(i[s][s]),h=s+1;h<e;h++){var l=Math.abs(i[h][s]);l>a&&(a=l,o=h)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==s){var c=i[s];i[s]=i[o],i[o]=c;var u=r[s];r[s]=r[o],r[o]=u}for(var h=s+1;h<e;h++){var g=i[h][s]/i[s][s];if(!(Math.abs(g)<1e-14)){for(var d=s;d<e;d++)i[h][d]-=g*i[s][d];r[h]-=g*r[s]}}}for(var p=new Array(e).fill(0),h=e-1;h>=0;h--){for(var f=r[h],d=h+1;d<e;d++)f-=i[h][d]*p[d];p[h]=f/i[h][h]}return p}function Jn(n,t,e,i,r){var s,o,a,h,l,c;if(e===void 0&&(e="Uniform"),n.length===0)return{controlPoints:[],knots:[],weights:[]};var u=n.map(function(Xt){var Nt;return[Xt[0],Xt[1],(Nt=Xt[2])!==null&&Nt!==void 0?Nt:0]}),g=!!i,d=!!r,p=(g?1:0)+(d?1:0),f=u.length-1,y=f+p;if(y<t)throw new Error("Not enough points to interpolate a curve of this degree.");var _=Qs(u,e),v=_.slice();g&&v.unshift(_[0]),d&&v.push(_[_.length-1]);var S=Js(t,v),A=y+1,L=new Array(A),T=new Array(A),I=new Array(A),X=new Array(A),E=0;L[E]=new Array(A).fill(0),L[E][0]=1,T[E]=u[0][0],I[E]=u[0][1],X[E]=u[0][2],E++;for(var z=1;z<=f-1;z++){var Y=_[z];L[E]=new Array(A).fill(0);for(var R=0;R<=y;R++)L[E][R]=Ht(R,t,Y,S);T[E]=u[z][0],I[E]=u[z][1],X[E]=u[z][2],E++}if(L[E]=new Array(A).fill(0),L[E][y]=1,T[E]=u[f][0],I[E]=u[f][1],X[E]=u[f][2],E++,g){var H=S[t+1]-S[0],it=H!==0?t/H:0;L[E]=new Array(A).fill(0),L[E][0]=-it,L[E][1]=it,T[E]=(s=i==null?void 0:i[0])!==null&&s!==void 0?s:0,I[E]=(o=i==null?void 0:i[1])!==null&&o!==void 0?o:0,X[E]=(a=i==null?void 0:i[2])!==null&&a!==void 0?a:0,E++}if(d){var H=S[y+t+1]-S[y],it=H!==0?t/H:0;L[E]=new Array(A).fill(0),L[E][y-1]=-it,L[E][y]=it,T[E]=(h=r==null?void 0:r[0])!==null&&h!==void 0?h:0,I[E]=(l=r==null?void 0:r[1])!==null&&l!==void 0?l:0,X[E]=(c=r==null?void 0:r[2])!==null&&c!==void 0?c:0,E++}for(var xt=Vi(L,T),ne=Vi(L,I),re=Vi(L,X),Wt=new Array(A),z=0;z<A;z++)Wt[z]=[xt[z],ne[z],re[z]];var se=new Array(A).fill(1);return{controlPoints:Wt,knots:S,weights:se}}function Ht(n,t,e,i){if(t===0)return e>=i[n]&&e<i[n+1]?1:0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=r>1e-10?(e-i[n])/r:0,a=s>1e-10?(i[n+t+1]-e)/s:0;return o*Ht(n,t-1,e,i)+a*Ht(n+1,t-1,e,i)}function Te(n,t,e,i,r){var s=i.length-1,o=t;if(n=Math.max(e[o],Math.min(e[s+1],n)),Math.abs(n-e[s+1])<1e-8)return qe([],$e(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return qe([],$e(i[0]),!1);for(var a=[0,0,0],h=0,l=0;l<=s;l++){var c=Ht(l,o,n,e),u=r[l]*c;a[0]+=i[l][0]*u,a[1]+=i[l][1]*u,a[2]+=i[l][2]*u,h+=u}if(Math.abs(h)<1e-10){var g=e[e.length-o-1];if(Math.abs(n-g)<1e-8)return qe([],$e(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return qe([],$e(i[0]),!1)}return Math.abs(h)>=1e-10&&(a[0]/=h,a[1]/=h,a[2]/=h),a}function Ji(n,t,e,i){if(t===0)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Ht(n,t-1,e,i)),s>1e-10&&(o-=t/s*Ht(n+1,t-1,e,i)),o}function El(n,t,e,i){if(t<=1)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Ji(n,t-1,e,i)),s>1e-10&&(o-=t/s*Ji(n+1,t-1,e,i)),o}function Tl(n,t,e,i,r){var s=i.length-1,o=t,a=e[o],h=e[s+1];n=Math.max(a,Math.min(h,n));for(var l=[0,0,0],c=[0,0,0],u=[0,0,0],g=0,d=0,p=0,f=0;f<=s;f++){var y=Ht(f,o,n,e),_=Ji(f,o,n,e),v=El(f,o,n,e),S=r[f],A=S*y,L=S*_,T=S*v,I=i[f];l[0]+=A*I[0],l[1]+=A*I[1],l[2]+=A*I[2],c[0]+=L*I[0],c[1]+=L*I[1],c[2]+=L*I[2],u[0]+=T*I[0],u[1]+=T*I[1],u[2]+=T*I[2],g+=A,d+=L,p+=T}if(Math.abs(g)<1e-10){var X=Te(n,t,e,i,r);return{point:X,deriv1:[0,0,0],deriv2:[0,0,0]}}var E=g*g,z=[l[0]/g,l[1]/g,l[2]/g],Y=[(c[0]*g-l[0]*d)/E,(c[1]*g-l[1]*d)/E,(c[2]*g-l[2]*d)/E],R=u[0]*g-l[0]*p,H=u[1]*g-l[1]*p,it=u[2]*g-l[2]*p,xt=[R/E-2*d*Y[0]/g,H/E-2*d*Y[1]/g,it/E-2*d*Y[2]/g];return{point:z,deriv1:Y,deriv2:xt}}function Cl(n,t){var e=n[0],i=n[1],r=t[0],s=t[1],o=e*e+i*i;return o<1e-20?0:(e*s-i*r)/Math.pow(o,1.5)}function to(n,t,e,i){for(var r=n,s=t[r],o=t[t.length-r-1],a=0,h=1e3,l=(o-s)/h,c=Te(s,n,t,e,i),u=1;u<=h;u++){var g=s+u*l,d=Te(g,n,t,e,i),p=d[0]-c[0],f=d[1]-c[1],y=d[2]-c[2];a+=Math.sqrt(p*p+f*f+y*y),c=d}var _=Te(o,n,t,e,i),v=_[0]-c[0],S=_[1]-c[1],A=_[2]-c[2];return a+=Math.sqrt(v*v+S*S+A*A),a}function Ol(n,t,e,i,r){return t===void 0&&(t=3),e===void 0&&(e="Uniform"),n.length===0?[]:Jn(n,t,e,i,r).controlPoints}var Jr=new O,ts=new x,kl=new x,Yl=new x,ji=new m;function eo(n){return new O().setFromExtrusionDirection(new x(n.x,n.y,n.z))}function Ne(n){return Jr.setFromExtrusionDirection(new x(n.x,n.y,n.z)),Jr.extractBasis(ts,kl,Yl),ts.clone()}function tn(n,t){var e;return new m(n.x,n.y,(e=n.z)!==null&&e!==void 0?e:0).applyMatrix4(eo(t))}function xe(n,t){var e;return new m(n.x,n.y,(e=n.z)!==null&&e!==void 0?e:0).applyMatrix4(eo(t).invert())}function Et(n,t,e){var i,r,s=xe(n,e),o=xe(t,e);return ji.set(o.x-s.x,o.y-s.y,((i=o.z)!==null&&i!==void 0?i:0)-((r=s.z)!==null&&r!==void 0?r:0)),M.normalizeAngle(Math.atan2(ji.y,ji.x))}function io(n){var t=n.length;if(t<3)return 0;for(var e=0,i=0,r=t-1;i<t;r=i++){var s=n[r],o=n[i];e+=s.x*o.y-o.x*s.y}return e*.5}function Xl(n){return Math.abs(io(n))}function Nl(n){var t,e,i=n.length;if(i<3)return 0;for(var r=0,s=0,o=0,a=0,h=i-1;a<i;h=a++){var l=n[h],c=n[a],u=l.x,g=l.y,d=(t=l.z)!==null&&t!==void 0?t:0,p=c.x,f=c.y,y=(e=c.z)!==null&&e!==void 0?e:0;r+=(d+y)*(g-f),s+=(u+p)*(d-y),o+=(g+f)*(u-p)}return .5*Math.hypot(r,s,o)}function Bl(n){return n.length<3?0:Xl(n)}function no(n){return n.length<3?0:Nl(n)}var ro=function(){function n(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(n.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),n}(),Rl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),tr=function(n){Rl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new Ge().makeTranslation(e.x,e.y))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t}(ro),zl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Pe=function(n){zl(t,n);function t(){var e=n.call(this)||this;return e.arcLengthDivisions=100,e}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},t.prototype.getPointAt=function(e){var i=this.getUtoTmapping(e);return this.getPoint(i)},t.prototype.getPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.getSpacedPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPointAt(r/e));return i},t.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},t.prototype.getLengths=function(e){e===void 0&&(e=this.arcLengthDivisions);var i=[],r,s=this.getPoint(0),o=0;i.push(0);for(var a=1;a<=e;a++)r=this.getPoint(a/e),o+=r.distanceTo(s),i.push(o),s=r;return i},t.prototype.getUtoTmapping=function(e,i){var r=this.getLengths(),s=0,o=r.length,a;i?a=i:a=e*r[o-1];for(var h=0,l=o-1,c;h<=l;)if(s=Math.floor(h+(l-h)/2),c=r[s]-a,c<0)h=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,r[s]===a)return s/(o-1);var u=r[s],g=r[s+1],d=g-u,p=(a-u)/d,f=(s+p)/(o-1);return f},t.prototype.getTangent=function(e){var i=1e-4,r=e-i,s=e+i;r<0&&(r=0),s>1&&(s=1);var o=this.getPoint(r),a=this.getPoint(s),h=new P;return h.copy(a).sub(o).normalize(),h},t.prototype.getTangentAt=function(e){var i=this.getUtoTmapping(e);return this.getTangent(i)},t}(tr),Fl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Ke=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ze=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Qe=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},ot=function(n){Fl(t,n);function t(e,i,r,s,o){var a=n.call(this)||this,h=+(e!==void 0)+ +(i!==void 0)+ +(r!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(h==3)typeof e=="object"&&typeof i=="object"&&typeof r=="object"?a.createByThreePoints(e,i,r):a.createByStartEndPointsAndBulge(e,i,r);else if(h==5){var l=e;a.center=new P(l.x,l.y),a.radius=i,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(M.normalizeAngle(r)):M.normalizeAngle(r),a._endAngle=a._clockwise?a._mirrorAngle(M.normalizeAngle(s)):M.normalizeAngle(s)}else throw lt.ILLEGAL_PARAMETERS;return a}return t.prototype.createByThreePoints=function(e,i,r){var s=function(X,E){return{x:(X.x+E.x)/2,y:(X.y+E.y)/2}},o=function(X,E){return(E.y-X.y)/(E.x-X.x)},a=function(X){return-1/X},h=s(e,i),l=s(i,r),c=o(e,i),u=o(i,r),g=a(c),d=a(u),p=function(X,E,z,Y){var R=(Y-E)/(X-z),H=X*R+E;return{x:R,y:H}},f=h.y-g*h.x,y=l.y-d*l.x,_=p(g,f,d,y),v=Math.sqrt(Math.pow(e.x-_.x,2)+Math.pow(e.y-_.y,2)),S=function(X,E){return Math.atan2(X.y-E.y,X.x-E.x)},A=S(e,_),L=S(i,_),T=S(r,_),I=T>A&&T<L||A>T&&A<L||L>T&&L<A;this.center=_,this.radius=v,this._clockwise=!I,this._startAngle=A,this._endAngle=T},t.prototype.createByStartEndPointsAndBulge=function(e,i,r){var s,o,a;r<0?(s=Math.atan(-r)*4,o=new G(e),a=new G(i)):(s=Math.atan(r)*4,o=new G(i),a=new G(e));var h=new G().subVectors(a,o),l=h.length(),c=new G().addVectors(o,h.multiplyScalar(.5)),u=Math.abs(l/2/Math.tan(s/2)),g=h.normalize(),d=r<0?-Math.PI/2:Math.PI/2,p=new G(g.x*Math.cos(d)-g.y*Math.sin(d),g.y*Math.cos(d)+g.x*Math.sin(d)),f;s<Math.PI?r<0?f=c.add(p.multiplyScalar(u)):f=c.add(p.multiplyScalar(-u)):r<0?f=c.add(p.multiplyScalar(-u)):f=c.add(p.multiplyScalar(u)),r<0?(this._startAngle=Math.atan2(o.y-f.y,o.x-f.x),this._endAngle=Math.atan2(a.y-f.y,a.x-f.x)):(this._startAngle=Math.atan2(a.y-f.y,a.x-f.x),this._endAngle=Math.atan2(o.y-f.y,o.x-f.x)),this._clockwise=r<0,this.center=f,this.radius=a.sub(f).length()},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new P(e.x,e.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(e){this._startAngle=this._clockwise?this._mirrorAngle(M.normalizeAngle(e)):M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(e){var i=this.startAngle==0&&e==B?e:M.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(i):i,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype._mirrorAngle=function(e){var i=e*180/Math.PI,r=(360-i)%360;return r*Math.PI/180},t.prototype._getInternalAngle=function(e){return this._clockwise?this._mirrorAngle(e):e},Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return this.clockwise?M.normalizeAngle(e-i):M.normalizeAngle(i-e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._clockwise?M.normalizeAngle(e-this.deltaAngle/2):M.normalizeAngle(e+this.deltaAngle/2),r=this._clockwise?this._mirrorAngle(i):i;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return Math.abs(i-e)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i,r=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=Ke(s),a=o.next();!a.done;a=o.next()){var h=a.value,l=this._getInternalAngle(h);M.isBetweenAngle(l,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&r.push(this.getPointAtAngle(h))}}catch(g){e={error:g}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}var c=r.map(function(g){return g.x}),u=r.map(function(g){return g.y});return new Q(new P(Math.min.apply(Math,Qe([],Ze(c),!1)),Math.min.apply(Math,Qe([],Ze(u),!1))),new P(Math.max.apply(Math,Qe([],Ze(c),!1)),Math.max.apply(Math,Qe([],Ze(u),!1))))},Object.defineProperty(t.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){var i=this,r=e,s=this.center.clone().applyMatrix2d(r),o=this.startPoint.clone().applyMatrix2d(r);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=r.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(r),h=this.endPoint.clone().applyMatrix2d(r),l=new t(o,a,h),c=r.determinant()<0?!this.clockwise:this.clockwise,u=function(g){var d=M.normalizeAngle(g);return c?i._mirrorAngle(d):d};return this.center=l.center,this.radius=l.radius,this.clockwise=c,this.startAngle=u(Math.atan2(o.y-l.center.y,o.x-l.center.x)),this.endAngle=u(Math.atan2(h.y-l.center.y,h.x-l.center.x)),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},t.prototype.getPointAtAngle=function(e){var i=this._getInternalAngle(e),r=this.center.x+this.radius*Math.cos(i),s=this.center.y+this.radius*Math.sin(i);return new P(r,s)},t.prototype.getQuadrantPoints=function(){var e,i,r=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var h=Ke(a),l=h.next();!l.done;l=h.next()){var c=l.value,u=this._getInternalAngle(c);M.isBetweenAngle(u,s,o,this.clockwise)&&r.push(this.getPointAtAngle(c))}}catch(g){e={error:g}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}return r},t.prototype.nearestPoint=function(e){var i=new P(e.x,e.y),r=i.x-this.center.x,s=i.y-this.center.y,o=Math.hypot(r,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,r),h=this.clockwise?this._mirrorAngle(M.normalizeAngle(a)):M.normalizeAngle(a),l=this._getInternalAngle(h),c=this._getInternalAngle(this.startAngle),u=this._getInternalAngle(this.endAngle);if(M.isBetweenAngle(l,c,u,this.clockwise))return this.getPointAtAngle(h);var g=i.distanceToSquared(this.startPoint),d=i.distanceToSquared(this.endPoint);return g<=d?this.startPoint.clone():this.endPoint.clone()},t.prototype.perpendicularPoints=function(e){var i,r,s=new P(e.x,e.y),o=s.x-this.center.x,a=s.y-this.center.y,h=Math.hypot(o,a);if(h<1e-12)return[];var l=o/h,c=a/h,u=[new P(this.center.x+l*this.radius,this.center.y+c*this.radius),new P(this.center.x-l*this.radius,this.center.y-c*this.radius)],g=[],d=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var f=Ke(u),y=f.next();!y.done;y=f.next()){var _=y.value,v=Math.atan2(_.y-this.center.y,_.x-this.center.x),S=this.clockwise?this._mirrorAngle(M.normalizeAngle(v)):M.normalizeAngle(v),A=this._getInternalAngle(S);(this.closed||M.isBetweenAngle(A,d,p,this.clockwise))&&g.push(_)}}catch(L){i={error:L}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}return g},t.prototype.tangentPoints=function(e){var i,r,s=[],o=e.x-this.center.x,a=e.y-this.center.y,h=Math.hypot(o,a),l=this.radius;if(h<l)return s;var c=Math.acos(l/h),u=Math.atan2(a,o),g=[u+c,u-c],d=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var f=Ke(g),y=f.next();!y.done;y=f.next()){var _=y.value,v=this.clockwise?this._mirrorAngle(M.normalizeAngle(_)):M.normalizeAngle(_),S=this._getInternalAngle(v);(this.closed||M.isBetweenAngle(S,d,p,this.clockwise))&&s.push(this.getPointAtAngle(v))}}catch(A){i={error:A}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}return s},t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(r=B,s=0),this.clockwise)for(var o=0;o<=e;o++){var a=s-r*(o/e),h=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(h);i.push(new P(l.x,l.y))}else for(var o=0;o<=e;o++){var a=s+r*(o/e),h=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(h);i.push(new P(l.x,l.y))}return i},t}(Pe),en=function(){return en=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},en.apply(this,arguments)},Vl=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Je=1e-6;function so(n,t){if(hh(n)){var e=Gl(n,t);return e?[e]:[]}var i=ho(n),r=i.numberOfVertices;if(r<2)return[];var s=uh(i,t);return s?[s]:[]}function jl(n){return ho(n)}function Gl(n,t){var e,i,r=Dl(n);if(r.length===0)return null;var s=[];try{for(var o=Vl(r),a=o.next();!a.done;a=o.next()){var h=a.value,l=Ul(h,t);if(!l)return null;s.push(l)}}catch(d){e={error:d}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}var c=Hl(n),u=Kl(s,c,n.closed,t);if(u.length<2)return null;var g=new V;return u.forEach(function(d,p){g.addVertexAt(p,{x:d.x,y:d.y})}),g.closed=n.closed,g}function Dl(n){for(var t,e=[],i=n.numberOfVertices,r=n.closed?i:i-1,s=0;s<r;s++){var o=n.vertices[s],a=n.vertices[(s+1)%i];F.isPositive(Math.abs((t=o.bulge)!==null&&t!==void 0?t:0))?e.push({kind:"arc",arc:new ot(o,a,o.bulge)}):e.push({kind:"line",start:new P(o.x,o.y),end:new P(a.x,a.y)})}return e}function Hl(n){for(var t=[],e=0;e<n.numberOfVertices;e++)t.push(n.getPointAt(e));return t}function Ul(n,t){if(n.kind==="line"){var e=ql(n.start,n.end,t);return e?en({kind:"line"},e):null}var i=Wl(n.arc,n.arc.startPoint,n.arc.endPoint,t);return i?{kind:"arc",arc:i}:null}function Wl(n,t,e,i){var r=$l(n,t,e,i),s=n.radius+r;return F.isNonPositive(s)?null:new ot(n.center,s,n.startAngle,n.endAngle,n.clockwise)}function $l(n,t,e,i){var r=e.x-t.x,s=e.y-t.y,o=Math.hypot(r,s);if(F.isNonPositive(o))return n.clockwise?-i:i;var a=-s/o,h=r/o,l=n.center.x-(t.x+e.x)/2,c=n.center.y-(t.y+e.y)/2,u=l*a+c*h>0;return u?-i:i}function ql(n,t,e){var i=t.x-n.x,r=t.y-n.y,s=Math.hypot(i,r);if(F.isNonPositive(s))return null;var o=-r/s*e,a=i/s*e;return{start:new P(n.x+o,n.y+a),end:new P(t.x+o,t.y+a),dx:i,dy:r}}function Kl(n,t,e,i){var r,s,o,a=n.length;if(a===0)return[];for(var h=Zl(n,t,e,i),l=[(s=(r=h[0].nextSegmentStart)===null||r===void 0?void 0:r.clone())!==null&&s!==void 0?s:h[0].point.clone()],c=0;c<a;c++){var u=n[c],g=c===a-1&&!e?{point:ih(u)}:h[(c+1)%a];if(c>0&&h[c].filletPoints&&h[c].filletPoints.forEach(function(_){return l.push(_.clone())}),u.kind==="arc")for(var d=(o=h[c].nextSegmentStart)!==null&&o!==void 0?o:h[c].point,p=g.point,f=Ql(u.arc,d,p,Math.max(16,32)),y=1;y<f.length;y++)l.push(f[y]);else l.push(g.point.clone())}return co(l)}function Zl(n,t,e,i){for(var r=n.length,s=[],o=0;o<r;o++)o===0?s.push(e?es(n[r-1],n[0],t[0],i):{point:eh(n[0])}):s.push(es(n[o-1],n[o],t[o],i));return s}function Ql(n,t,e,i){for(var r=n.nearestPoint(t),s=n.nearestPoint(e),o=nn(n,r),a=nn(n,s),h=th(n,o,a),l=[],c=0;c<=i;c++){var u=c/i,g=n.clockwise?o-h*u:o+h*u;l.push(n.getPointAtAngle(Jl(n,g)))}return l}function nn(n,t){return Math.atan2(t.y-n.center.y,t.x-n.center.x)}function Jl(n,t){var e=M.normalizeAngle(t);return n.clockwise?rn(e):e}function rn(n){var t=n*180/Math.PI;return(360-t)%360*(Math.PI/180)}function th(n,t,e){if(n.clockwise){var i=t-e;return F.isNonPositive(i)&&(i+=B),i}var r=e-t;return F.isNonPositive(r)&&(r+=B),r}function eh(n){return n.kind==="line"?n.start.clone():n.arc.startPoint.clone()}function ih(n){return n.kind==="line"?n.end.clone():n.arc.endPoint.clone()}function es(n,t,e,i){return n.kind==="line"&&t.kind==="line"?{point:sn({start:n.start,end:n.end,dx:n.dx,dy:n.dy},{start:t.start,end:t.end,dx:t.dx,dy:t.dy})}:n.kind==="line"&&t.kind==="arc"?is(n,t.arc,e,i,!0):n.kind==="arc"&&t.kind==="line"?is(t,n.arc,e,i,!1):n.kind==="arc"&&t.kind==="arc"?nh(n.arc,t.arc,e,i):{point:e.clone()}}function nh(n,t,e,i){var r=lo(n.endPoint,t.startPoint),s=lh(n,t),o=s.filter(function(c){return oi(n,c)&&oi(t,c)});if(o.length>0)return{point:ao(o,r)};var a=n.endPoint.clone(),h=t.startPoint.clone(),l=oo(e,Math.abs(i),a,h);return{point:a,filletPoints:l,nextSegmentStart:h}}function is(n,t,e,i,r){var s=lo(r?n.end:n.start,r?t.startPoint:t.endPoint),o=ah(n,t,s);if(sh(n,o)&&oi(t,o))return{point:o};var a=rh(n,e,i),h=r?t.startPoint.clone():t.endPoint.clone(),l=oo(e,Math.abs(i),r?a:h,r?h:a);return r?{point:a,filletPoints:l,nextSegmentStart:h}:{point:h,filletPoints:l,nextSegmentStart:a}}function rh(n,t,e){var i=Math.hypot(n.dx,n.dy),r=-n.dy/i*e,s=n.dx/i*e;return new P(t.x+r,t.y+s)}function sh(n,t){var e=Math.hypot(n.dx,n.dy);if(F.isNonPositive(e))return!1;var i=n.dx/e,r=n.dy/e,s=t.x-n.start.x,o=t.y-n.start.y,a=Math.abs(s*r-o*i);return F.equalToZero(a)}function oo(n,t,e,i){var r=Math.atan2(e.y-n.y,e.x-n.x),s=Math.atan2(i.y-n.y,i.x-n.x),o=oh(r,s);if(F.equalToZero(Math.abs(o)))return[];for(var a=[],h=Math.max(2,Math.ceil(Math.abs(o)/Math.PI*16)),l=1;l<h;l++){var c=l/h,u=r+o*c;a.push(new P(n.x+t*Math.cos(u),n.y+t*Math.sin(u)))}return a}function oh(n,t){for(var e=t-n;e>Math.PI;)e-=B;for(;e<=-Math.PI;)e+=B;return e}function ah(n,t,e){var i=Math.hypot(n.dx,n.dy);if(F.isNonPositive(i))return e.clone();var r=n.dx/i,s=n.dy/i,o=n.start.x-t.center.x,a=n.start.y-t.center.y,h=2*(o*r+a*s),l=o*o+a*a-t.radius*t.radius,c=h*h-4*l;if(c<0)return e.clone();var u=Math.sqrt(c),g=[(-h-u)/2,(-h+u)/2].map(function(p){return new P(n.start.x+r*p,n.start.y+s*p)}),d=g.filter(function(p){return oi(t,p)});return ao(d.length>0?d:g,e)}function oi(n,t){var e=Math.abs(Math.hypot(t.x-n.center.x,t.y-n.center.y)-n.radius);if(F.isPositive(e))return!1;var i=nn(n,t),r=n.clockwise?rn(M.normalizeAngle(n.startAngle)):M.normalizeAngle(n.startAngle),s=n.clockwise?rn(M.normalizeAngle(n.endAngle)):M.normalizeAngle(n.endAngle);return M.isBetweenAngle(i,r,s,n.clockwise)}function lh(n,t){var e=t.center.x-n.center.x,i=t.center.y-n.center.y,r=Math.hypot(e,i);if(F.isNonPositive(r))return[];var s=n.radius+t.radius,o=Math.abs(n.radius-t.radius);if(r>s+Je)return[];if(r<o-Je)return[];var a=(n.radius*n.radius-t.radius*t.radius+r*r)/(2*r),h=n.radius*n.radius-a*a;if(h<-Je)return[];var l=n.center.x+a*e/r,c=n.center.y+a*i/r;if(h<=Je)return[new P(l,c)];var u=Math.sqrt(h),g=-i*u/r,d=e*u/r;return[new P(l+g,c+d),new P(l-g,c-d)]}function ao(n,t){for(var e=n[0],i=e.distanceToSquared(t),r=1;r<n.length;r++){var s=n[r].distanceToSquared(t);s<i&&(e=n[r],i=s)}return e.clone()}function lo(n,t){return new P((n.x+t.x)/2,(n.y+t.y)/2)}function hh(n){for(var t,e=n.numberOfVertices,i=n.closed?e:e-1,r=0;r<i;r++){var s=n.vertices[r];if(F.isPositive(Math.abs((t=s.bulge)!==null&&t!==void 0?t:0)))return!0}return!1}function ho(n){var t=ch(n.vertices.map(function(e){return new P(e.x,e.y)}),n.closed);return t.length===n.numberOfVertices?n:new V(t.map(function(e){return{x:e.x,y:e.y}}),n.closed)}function ch(n,t){var e=co(n);if(!t||e.length<2)return e;var i=e[0],r=e[e.length-1];return F.isNonPositive(Math.hypot(i.x-r.x,i.y-r.y))&&e.pop(),e}function co(n){var t=[];return n.forEach(function(e){var i=t[t.length-1];(!i||F.isPositive(Math.hypot(i.x-e.x,i.y-e.y)))&&t.push(new P(e.x,e.y))}),t}function uh(n,t){for(var e=[],i=0;i<n.numberOfVertices;i++)e.push(n.getPointAt(i));var r=dh(e,n.closed,t);if(r.length===0)return null;var s=[];if(n.closed){if(r.length<2)return null;for(var o=r.length,i=0;i<o;i++){var a=r[(i-1+o)%o],h=r[i];s.push(sn(a,h))}}else{s.push(r[0].start);for(var i=1;i<r.length;i++)s.push(sn(r[i-1],r[i]));s.push(r[r.length-1].end)}var l=new V;return s.forEach(function(c,u){l.addVertexAt(u,{x:c.x,y:c.y})}),l.closed=n.closed,l}function dh(n,t,e){for(var i=[],r=t?n.length:n.length-1,s=0;s<r;s++){var o=n[s],a=n[t?(s+1)%n.length:s+1],h=a.x-o.x,l=a.y-o.y,c=Math.hypot(h,l);if(!F.isNonPositive(c)){var u=-l/c*e,g=h/c*e;i.push({start:new P(o.x+u,o.y+g),end:new P(a.x+u,a.y+g),dx:h,dy:l})}}return i}function sn(n,t){var e=n.dx*t.dy-n.dy*t.dx;if(F.equalToZero(e))return new P((n.end.x+t.start.x)/2,(n.end.y+t.start.y)/2);var i=t.start.x-n.start.x,r=t.start.y-n.start.y,s=(i*t.dy-r*t.dx)/e;return new P(n.start.x+s*n.dx,n.start.y+s*n.dy)}var gh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),on=function(){return on=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},on.apply(this,arguments)},V=function(n){gh(t,n);function t(e,i){e===void 0&&(e=null),i===void 0&&(i=!1);var r=n.call(this)||this;return r._vertices=e||new Array,r._closed=i,r}return Object.defineProperty(t.prototype,"vertices",{get:function(){return this._vertices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numberOfVertices",{get:function(){return this._vertices.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this._closed=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this.numberOfVertices>0){var e=this._vertices[0];return new P(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this.numberOfVertices;if(e>0)if(this.closed){var i=this._vertices[0];return new P(i.x,i.y)}else{var i=this._vertices[e-1];return new P(i.x,i.y)}throw new Error("End point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){for(var e=0,i=this._vertices.length,r=0;r<i;++r){var s=this._vertices[r],o=null;if(r<i-1?o=this._vertices[r+1]:r==i-1&&this.closed&&(o=this._vertices[0]),o)if(s.bulge){var a=new ot(s,o,s.bulge);e+=a.length}else e+=new P(s.x,s.y).distanceTo(o)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed||this._vertices.length<3)return 0;var e=this.getPoints(128);return Bl(e)},enumerable:!1,configurable:!0}),t.prototype.addVertexAt=function(e,i){e<=0?this._vertices.unshift(i):this._vertices.splice(e,0,i),this._boundingBoxNeedsUpdate=!0},t.prototype.removeVertexAt=function(e){if(e<0||e>=this._vertices.length)throw new Error("Index ".concat(e," is out of bounds. Valid range is 0 to ").concat(this._vertices.length-1,"."));this._vertices.splice(e,1),this._boundingBoxNeedsUpdate=!0},t.prototype.reset=function(e,i){e?i!==void 0&&i>=0&&i<this._vertices.length&&(this._vertices=this._vertices.slice(0,i),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)},t.prototype.getPointAt=function(e){var i=this._vertices[e];return new P(i.x,i.y)},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new Q().setFromPoints(e)},t.prototype.transform=function(e){var i=e.determinant()<0;return this._vertices.forEach(function(r){var s=new P(r).applyMatrix2d(e);r.x=s.x,r.y=s.y,i&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._vertices.map(function(e){return on({},e)}),this._closed)},t.prototype.getPoints3d=function(e,i){var r=[],s=this.getPoints(e);return s.forEach(function(o){return r.push(new m().set(o.x,o.y,i))}),r},t.prototype.getPoints=function(e){for(var i=[],r=this._vertices.length,s=0;s<r;++s){var o=this._vertices[s];if(o.bulge){var a=null;if(s<r-1?a=this._vertices[s+1]:s==r-1&&this.closed&&(a=this._vertices[0]),a)for(var h=new ot(o,a,o.bulge),l=h.getPoints(e),c=l.length,u=0;u<c;++u){var g=l[u];i.push(new P(g.x,g.y))}}else i.push(new P(o.x,o.y)),s==r-1&&this.closed&&i.push(i[0])}return i},t.prototype.offset=function(e){return so(this,e)},t}(Pe);function uo(n,t,e){var i=Math.hypot(t.x,t.y);if(F.isNonPositive(i))return null;var r=-t.y/i*e,s=t.x/i*e;return new m(n.x+r,n.y+s,n.z)}function ph(n,t,e){var i;if(n.length<2)return null;var r=jl(new V(n.map(function(o){return{x:o.x,y:o.y}}),t)),s=so(r,e);return(i=s[0])!==null&&i!==void 0?i:null}var ai=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},ye=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function fh(n,t,e,i){if(n.length<2||F.equalToZero(e))return null;var r=po(n,i),s=r.points,o=r.tangents;if(s.length<2)return null;var a=o??yh(s,t),h=mh(s,a,e),l=t?xh(h):_h(h);if(l.length<2)return null;var c=new V;return l.forEach(function(u,g){c.addVertexAt(g,{x:u.x,y:u.y})}),c.closed=t,c}function yh(n,t){for(var e=n.length,i=new Array(e),r=0;r<e;r++){var s=0,o=0;if(t){var a=n[(r-1+e)%e],h=n[(r+1)%e];s=h.x-a.x,o=h.y-a.y}else r===0?(s=n[1].x-n[0].x,o=n[1].y-n[0].y):r===e-1?(s=n[e-1].x-n[e-2].x,o=n[e-1].y-n[e-2].y):(s=n[r+1].x-n[r-1].x,o=n[r+1].y-n[r-1].y);var l=Math.hypot(s,o);F.isNonPositive(l)?i[r]=new P(1,0):i[r]=new P(s/l,o/l)}return i}function mh(n,t,e){return n.map(function(i,r){var s=t[r],o=-s.y*e,a=s.x*e;return new P(i.x+o,i.y+a)})}function _h(n){var t=li(n);if(t.length<3)return t;for(;;){var e=go(t,!1);if(!e||(t=li(ye(ye(ye([],ai(t.slice(0,e.segmentA+1)),!1),[e.point],!1),ai(t.slice(e.segmentB+1)),!1)),t.length<2))break}return t}function xh(n){var t=li(n);if(t.length<4)return t;for(;;){var e=go(t,!0);if(!e||(t=li(ye(ye(ye([],ai(t.slice(0,e.segmentA+1)),!1),[e.point],!1),ai(t.slice(e.segmentB+1)),!1)),t.length<3))break}return t}function go(n,t){var e=t?n.length:n.length-1;if(e<2)return null;for(var i=0;i<e;i++)for(var r=n[i],s=n[(i+1)%n.length],o=i+1;o<e;o++)if(!wh(i,o,e,t)){var a=n[o],h=n[(o+1)%n.length],l=bh(r,s,a,h);if(l)return{point:l,segmentA:i,segmentB:o}}return null}function wh(n,t,e,i){return!!(t===n||t===n+1||i&&n===0&&t===e-1)}function bh(n,t,e,i){var r=t.x-n.x,s=t.y-n.y,o=i.x-e.x,a=i.y-e.y,h=r*a-s*o;if(F.equalToZero(h))return null;var l=e.x-n.x,c=e.y-n.y,u=(l*a-c*o)/h,g=(l*s-c*r)/h,d=Ii.equalPointTol;return u<-d||u>1+d||g<-d||g>1+d?null:new P(n.x+u*r,n.y+u*s)}function po(n,t){var e=[],i=[],r=t!=null&&t.length===n.length;return n.forEach(function(s,o){var a=e[e.length-1];if((!a||F.isPositive(Math.hypot(a.x-s.x,a.y-s.y)))&&(e.push(new P(s.x,s.y)),r)){var h=t[o];i.push(new P(h.x,h.y))}}),{points:e,tangents:r?i:void 0}}function li(n){return po(n).points}var vh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Tt=function(n){vh(t,n);function t(){var e=n.call(this)||this;return e._loops=[],e}return t.prototype.add=function(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"loops",{get:function(){return this._loops},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outter",{get:function(){if(this._loops.length>0)return this._loops[0]},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.outter;return e?e.box:new Q},t.prototype.transform=function(e){return this._loops.forEach(function(i){i.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){var e=new t;return this._loops.forEach(function(i){e.add(i.clone())}),e},t.prototype.getPoints=function(e){for(var i=[],r=0;r<this.loops.length;++r){var s=this.loops[r],o=s.getPoints(e);i.push(o)}return i},t.prototype.buildHierarchy=function(){for(var e,i=this.getPoints(100),r=this.calculateBoundaryBoxes(i),s=this.sortBoundaryBoxesByAreas(r),o=new Map,a=s.length,h=0;h<a;h++)o.set(s[h],{index:s[h],children:[]});for(var l={index:-1,children:[]},h=0;h<a;h++){for(var c=s[h],u=i[c],g=r[c],d=h+1;d<a;d++){var p=s[d],f=i[p],y=r[p];if(y.containsBox(g)&&nt.isPointInPolygon(u[M.randInt(0,u.length-1)],f)){(e=o.get(p))===null||e===void 0||e.children.push(o.get(c));break}}d===a&&l.children.push(o.get(c))}return l},Object.defineProperty(t.prototype,"area",{get:function(){if(this._loops.length===0)return 0;for(var e=0,i=0;i<this._loops.length;i++){var r=this._loops[i],s=r.getPoints(128),o=io(s);i===0?e+=Math.abs(o):e-=Math.abs(o)}return e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundaryBoxes=function(e){var i=[];return e.forEach(function(r){i.push(new Q().setFromPoints(r))}),i},t.prototype.sortBoundaryBoxesByAreas=function(e){var i=[];e.forEach(function(s,o){var a=s.size,h=a.width*a.height;i.push({area:h,index:o})}),i.sort(function(s,o){return s.area-o.area});var r=[];return i.forEach(function(s){r.push(s.index)}),r},t}(tr),Ph=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Ah=function(n){Ph(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new O().makeTranslation(e.x,e.y,e.z))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t}(ro),Sh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),De=function(n){Sh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(Ah),Lh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Ct=function(n){Lh(t,n);function t(e,i){var r=n.call(this)||this;return r._start=new m(e),r._end=new m(i),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return new x().subVectors(this.endPoint,this.startPoint).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){return new m((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){return this.project(e)},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.isPointOnLine=function(e){var i=this.project(e),r=1e-6;return i.distanceTo(e)<r},t.prototype.at=function(e,i){return this.delta(i).multiplyScalar(e).add(this._start)},t.prototype.atLength=function(e,i){if(i===void 0&&(i=!1),i){var r=this.delta($t).normalize();return new m(this._start).addScaledVector(r,e)}else{var r=this.delta($t).normalize();return new m(this._end).addScaledVector(r,e)}},t.prototype.extend=function(e,i){if(i===void 0&&(i=!1),i){var r=$t.subVectors(this._start,this._end).normalize();this._start=new m(this._start).addScaledVector(r,e)}else{var r=this.delta($t).normalize();this._end=new m(this._end).addScaledVector(r,e)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.closestPointToPointParameter=function(e,i){ns.subVectors(e,this._start),ti.subVectors(this.endPoint,this.startPoint);var r=ti.dot(ti),s=ti.dot(ns),o=s/r;return i&&(o=M.clamp(o,0,1)),o},t.prototype.closestPointToPoint=function(e,i,r){var s=this.closestPointToPointParameter(e,i);return this.delta(r).multiplyScalar(s).add(this._start)},t.prototype.delta=function(e){return e.subVectors(this._end,this._start)},t.prototype.distanceSq=function(){return this._start.distanceToSquared(this._end)},t.prototype.distance=function(){return this._start.distanceTo(this._end)},t.prototype.project=function(e){var i=this.direction,r=$t.subVectors(e,this.startPoint),s=r.dot(i);return new m().copy(i).multiplyScalar(s).add(this.startPoint)},t.prototype.perpPoint=function(e){var i=this.direction,r=this.startPoint,s=$t.subVectors(e,r),o=s.dot(i),a=$t.copy(i).multiplyScalar(o);return new m().addVectors(r,a)},t.prototype.calculateBoundingBox=function(){var e=new m(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),i=new m(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new C(e,i)},t.prototype.transform=function(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.offset=function(e){var i=this.startPoint,r=this.endPoint,s=Math.hypot(r.x-i.x,r.y-i.y);if(s===0)return this.clone();var o=new x(r.x-i.x,r.y-i.y,0).normalize(),a=new x(-o.y,o.x,0);return new t(new m(i.x+a.x*e,i.y+a.y*e,i.z),new m(r.x+a.x*e,r.y+a.y*e,r.z))},t}(De),$t=new x,ns=new x,ti=new x,Mh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Gi=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},bt=function(n){Mh(t,n);function t(e,i,r,s,o,a){a===void 0&&(a=x.X_AXIS);var h=n.call(this)||this;return h.center=e,h.radius=i,h.startAngle=r,h.endAngle=s,h.normal=o,h.refVec=a,(s-r)%B==0?(h.startAngle=0,h.endAngle=B):(h.startAngle=r,h.endAngle=s),h}return t.computeCenterPoint=function(e,i,r){var s=new x().addVectors(e,i).multiplyScalar(.5),o=new x().addVectors(e,r).multiplyScalar(.5),a=new x().subVectors(i,e),h=new x().subVectors(r,e),l=new x().crossVectors(a,h).normalize();if(l.lengthSq()===0)return null;var c=new x().crossVectors(a,l).normalize(),u=new x().crossVectors(h,l).normalize(),g=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=u.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new Ct(s,s.clone().add(g)),f=new Ct(o,o.clone().add(d)),y=new x,_=p.closestPointToPoint(f.startPoint,!0,y);return _?y:null},t.createByThreePoints=function(e,i,r){var s=t.computeCenterPoint(e,i,r);if(s){var o=s.distanceTo(e),a=new x().subVectors(e,s),h=new x().subVectors(i,s),l=Math.atan2(a.y,a.x),c=Math.atan2(h.y,h.x);return new t(s,o,l,c,x.Z_AXIS)}},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==B?e:M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return M.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refVec",{get:function(){return this._refVec},set:function(e){this._refVec=new x(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;this.closed&&(e=0,i=B);var r=e+i*.5;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:0},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){var i=new x(e.x,e.y,e.z||0),r=this.center,s=this.normal,o=i.clone().sub(r),a=o.dot(s),h=i.clone().sub(s.clone().multiplyScalar(a)),l=h.clone().sub(r);if(l.lengthSq()===0)return this.startPoint.clone();l.normalize().multiplyScalar(this.radius);var c=r.clone().add(l),u=this.getAngle(c.clone()),g=this.startAngle,d=this.deltaAngle,p=M.normalizeAngle(u-g);p<0&&(p=0),p>d&&(p=d);var f=this.getPointAtAngle(g+p),y=f.distanceTo(i),_=this.startPoint.distanceTo(i),v=this.endPoint.distanceTo(i);return _<y&&_<=v?this.startPoint.clone():v<y&&v<_?this.endPoint.clone():f},t.prototype.tangentPoints=function(e){var i,r,s=[],o=new x(e.x,e.y,e.z||0),a=this.center,h=this.normal,l=this.radius,c=o.clone().sub(a),u=c.dot(h),g=o.clone().sub(h.clone().multiplyScalar(u)),d=a.clone(),p=g.clone().sub(d),f=p.length();if(f<l)return s;var y=Math.acos(l/f),_=this.getAngle(g.clone()),v=[_+y,_-y];try{for(var S=Gi(v),A=S.next();!A.done;A=S.next()){var L=A.value,T=M.normalizeAngle(L-this.startAngle);T>=0&&T<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+T))}}catch(I){i={error:I}}finally{try{A&&!A.done&&(r=S.return)&&r.call(S)}finally{if(i)throw i.error}}return s},t.prototype.perpendicularPoints=function(e){var i,r,s=[],o=new x(e.x,e.y,e.z||0),a=this.center,h=this.normal,l=this.radius,c=o.clone().sub(a),u=c.dot(h),g=o.clone().sub(h.clone().multiplyScalar(u)),d=g.clone().sub(a);if(d.lengthSq()<1e-24)return s;d.normalize();var p=[a.clone().add(d.clone().multiplyScalar(l)),a.clone().sub(d.clone().multiplyScalar(l))];try{for(var f=Gi(p),y=f.next();!y.done;y=f.next()){var _=y.value,v=this.getAngle(_.clone()),S=M.normalizeAngle(v-this.startAngle);S>=0&&S<=this.deltaAngle&&s.push(new m(_.x,_.y,_.z||0))}}catch(A){i={error:A}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}return s},t.prototype.nearestTangentPoint=function(e){var i=this.tangentPoints(e);if(i.length===0)return null;var r=new m(e.x,e.y,e.z||0);return i.length===1||i[0].distanceTo(r)<i[1].distanceTo(r)?i[0]:i[1]},t.prototype.calculateBoundingBox=function(){for(var e,i,r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)M.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,h=1/0,l=-1/0,c=-1/0,u=-1/0;try{for(var g=Gi(r),d=g.next();!d.done;d=g.next()){var p=d.value,f=this.getPointAtAngle(p);f.x<o&&(o=f.x),f.y<a&&(a=f.y),f.z<h&&(h=f.z),f.x>l&&(l=f.x),f.y>c&&(c=f.y),f.z>u&&(u=f.z)}}catch(y){e={error:y}}finally{try{d&&!d.done&&(i=g.return)&&i.call(g)}finally{if(e)throw e.error}}return new C({x:o,y:a,z:h},{x:l,y:c,z:u})},Object.defineProperty(t.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=B,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),h=this.getPointAtAngle(a);i.push(h)}return i},t.prototype.transform=function(e){var i=this.center.clone().applyMatrix4(e),r=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new x(r).sub(i).normalize(),h=i.distanceTo(r),l=new x().crossVectors(new x(r).sub(i),new x(o).sub(i)).normalize();l.lengthSq()===0&&(l=this.normal.clone().transformDirection(e));var c=function(u){var g=new x(u).sub(i);return Math.atan2(g.dot(rs.crossVectors(l,a)),g.dot(a))};return this.center=i,this.radius=h,this.normal=l,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?B:c(s),this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},t.prototype.getAngle=function(e){return e.sub(this.center),Math.atan2(e.dot(rs.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))},t.prototype.getPointAtAngle=function(e){var i=this.normal,r=this.refVec,s={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},o=this.center,a=this.radius;return new m(o.x+a*(r.x*Math.cos(e)+s.x*Math.sin(e)),o.y+a*(r.y*Math.cos(e)+s.y*Math.sin(e)),o.z+a*(r.z*Math.cos(e)+s.z*Math.sin(e)))},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new x(this.center).distanceTo(Zn);return new Qn(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.radius+e;return i<=0?null:new t(this.center,i,this.startAngle,this.endAngle,this.normal,this.refVec)},t}(De),rs=new x,Ih=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Qt=function(n){Ih(t,n);function t(e,i,r,s,o,a,h){s===void 0&&(s=0),o===void 0&&(o=B),a===void 0&&(a=!1),h===void 0&&(h=0);var l=n.call(this)||this;return l.center=e,l.majorAxisRadius=i,l.minorAxisRadius=r,(o-s)%B==0?(l.startAngle=0,l.endAngle=B):(l.startAngle=s,l.endAngle=o),l.clockwise=a,l.rotation=h,l}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==B?e:M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return M.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){for(var e=100,i=1/0,r=1/0,s=-1/0,o=-1/0,a=0;a<=e;a++){var h=this.getPoint(a/e);i=Math.min(i,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),o=Math.max(o,h.y)}return new Q({x:i,y:r},{x:s,y:o})},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){for(var i=Math.PI*2,r=this.endAngle-this.startAngle,s=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(s?r=0:r=i),this.clockwise===!0&&!s&&(r===i?r=-i:r=r-i);var o=this.startAngle+e*r,a=this.center.x+this.majorAxisRadius*Math.cos(o),h=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,g=h-this.center.y;a=u*l-g*c+this.center.x,h=u*c+g*l+this.center.y}return new P(a,h)},t.prototype.transform=function(e){var i=e,r=new P(this.center).applyMatrix2d(i),s=new m(r.x,r.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(i),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(i),h=new P(o).sub(r),l=new P(a).sub(r),c=h.length(),u=l.length(),g=Math.atan2(h.y,h.x),d=h.clone().normalize(),p=l.clone().normalize(),f=function(v){var S=new P(v).sub(r),A=S.dot(d),L=S.dot(p);return M.normalizeAngle(Math.atan2(L/u,A/c))},y=i.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new t(s,c,u,0,B,y,g):new t(s,c,u,f(this.startPoint.clone().applyMatrix2d(i)),f(this.endPoint.clone().applyMatrix2d(i)),y,g);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this},t.prototype.getPointAtAngle=function(e){return this.getPoint(this.closed?e/B:M.normalizeAngle(e-this.startAngle)/this.deltaAngle)},t.prototype.copy=function(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this},t.prototype.clone=function(){return new t(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},t.prototype.getFocusPoints=function(){var e=Math.max(this.majorAxisRadius,this.minorAxisRadius),i=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(e-i<1e-9)return[];var r=Math.sqrt(e*e-i*i),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,h=a?s:-o,l=a?o:s;return[new P(this.center.x-r*h,this.center.y-r*l),new P(this.center.x+r*h,this.center.y+r*l)]},t.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},t.prototype.nearestPoint=function(e){for(var i=new P(e.x,e.y),r=this.getPoint(0),s=i.distanceToSquared(r),o=72,a=1;a<=o;a++){var h=this.getPoint(a/o),l=i.distanceToSquared(h);l<s&&(s=l,r=h)}return r},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,h,l){var c=-i.majorAxisRadius*l,u=i.minorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,h,l){var c=i.minorAxisRadius*h,u=i.majorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocal=function(e){var i=e.x-this.center.x,r=e.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:i*s-r*o,y:i*o+r*s}},t.prototype._findSnapAngles=function(e,i,r){r===void 0&&(r=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,h=this.deltaAngle,l=[],c=function(A){var L=Math.cos(A),T=Math.sin(A);return i(s*L,o*T,L,T)},u=a,g=c(u),d=1;d<=r;d++){var p=a+h*d/r,f=c(p);if(Math.abs(g)<1e-10&&l.push(u),g*f<0){for(var y=u,_=p,v=0;v<32;v++){var S=(y+_)/2;c(y)*c(S)<=0?_=S:y=S}l.push((y+_)/2)}u=p,g=f}return l},t}(Pe),Eh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Th=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},er=function(n){Eh(t,n);function t(e,i,r,s,o,a,h){a===void 0&&(a=0),h===void 0&&(h=B);var l=n.call(this)||this;l.center=e,l.normal=i,l.majorAxis=r,l.majorAxisRadius=s,l.minorAxisRadius=o;var c=Math.abs(h-a);return Math.abs(c-B)<1e-10||Math.abs(c-2*B)<1e-10?(l.startAngle=0,l.endAngle=B):(l.startAngle=a,l.endAngle=h),l}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==B?e:M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this.endAngle-this.startAngle;return Math.abs(e-B)<1e-10?B:M.normalizeAngle(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(e){this._majorAxis=new x(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxis",{get:function(){return new x().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;(this.closed||Math.abs(i-B)<1e-10)&&(e=0,i=B);var r=e+i/2;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCircular",{get:function(){return F.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var e=1e3,i=this.deltaAngle/e,r=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=e;o++){var a=this.startAngle+o*i,h=this.getPointAtAngle(a),l=h.x-s.x,c=h.y-s.y,u=h.z-s.z;r+=Math.sqrt(l*l+c*c+u*u),s=h}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return Math.abs(this.deltaAngle-B)>=1e-10?0:Math.PI*this.majorAxisRadius*this.minorAxisRadius},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i;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)){for(var r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)M.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,h=1/0,l=-1/0,c=-1/0,u=-1/0;try{for(var g=Th(r),d=g.next();!d.done;d=g.next()){var p=d.value,f=this.getPointAtAngle(p);f.x<o&&(o=f.x),f.y<a&&(a=f.y),f.z<h&&(h=f.z),f.x>l&&(l=f.x),f.y>c&&(c=f.y),f.z>u&&(u=f.z)}}catch(_){e={error:_}}finally{try{d&&!d.done&&(i=g.return)&&i.call(g)}finally{if(e)throw e.error}}return new C({x:o,y:a,z:h},{x:l,y:c,z:u})}else{for(var y=100,o=1/0,a=1/0,h=1/0,l=-1/0,c=-1/0,u=-1/0,s=0;s<=y;s++){var p=this.startAngle+this.deltaAngle*(s/y),f=this.getPointAtAngle(p);o=Math.min(o,f.x),a=Math.min(a,f.y),h=Math.min(h,f.z),l=Math.max(l,f.x),c=Math.max(c,f.y),u=Math.max(u,f.z)}return new C({x:o,y:a,z:h},{x:l,y:c,z:u})}},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=B,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),h=this.getPointAtAngle(a);i.push(h)}return i},t.prototype.getPointAtAngle=function(e){var i=Math.cos(e),r=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(r),o=this.majorAxis.clone().multiplyScalar(i*this.majorAxisRadius).add(s);return new m(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},t.prototype.nearestPoint=function(e,i){i===void 0&&(i=72);for(var r=new m(e.x,e.y,e.z||0),s=this.getPointAtAngle(this.startAngle),o=r.distanceToSquared(s),a=1;a<=i;a++){var h=this.startAngle+this.deltaAngle*a/i,l=this.getPointAtAngle(h),c=r.distanceToSquared(l);c<o&&(o=c,s=l)}var u=r.distanceToSquared(this.startPoint),g=r.distanceToSquared(this.endPoint);return u<o&&u<=g?this.startPoint.clone():g<o&&g<u?this.endPoint.clone():s.clone()},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,h,l){var c=-i.majorAxisRadius*l,u=i.minorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,h,l){var c=i.minorAxisRadius*h,u=i.majorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocalPlane=function(e){var i=new m(e.x,e.y,e.z||0),r=new x(i).sub(this.center),s=r.dot(this.normal);return r.sub(this.normal.clone().multiplyScalar(s)),{x:r.dot(this.majorAxis),y:r.dot(this.minorAxis)}},t.prototype._findSnapParameterAngles=function(e,i){i===void 0&&(i=144);for(var r=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,h=[],l=function(S){var A=Math.cos(S),L=Math.sin(S);return e(r*A,s*L,A,L)},c=o,u=l(c),g=1;g<=i;g++){var d=o+a*g/i,p=l(d);if(Math.abs(u)<1e-10&&h.push(c),u*p<0){for(var f=c,y=d,_=0;_<32;_++){var v=(f+y)/2;l(f)*l(v)<=0?y=v:f=v}h.push((f+y)/2)}c=d,u=p}return h},t.prototype.contains=function(e){var i=new x(e).sub(this.center),r=i.dot(this.majorAxis),s=i.dot(this.minorAxis),o=r/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},t.prototype.transform=function(e){var i=e,r=this.center.clone().applyMatrix4(i),s=this.getPointAtAngle(0).clone().applyMatrix4(i),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(i),a=new x(s).sub(r),h=new x(o).sub(r),l=a.length(),c=h.length(),u=a.clone().normalize(),g=new x().crossVectors(a,h).normalize(),d=new x().crossVectors(g,u).normalize();d.dot(h)<0&&(g.negate(),d=new x().crossVectors(g,u).normalize());var p=function(y){var _=new x(y).sub(r),v=_.dot(u),S=_.dot(d);return M.normalizeAngle(Math.atan2(S/c,v/l))},f=this.closed?new t(r,g,u,l,c,0,B):new t(r,g,u,l,c,p(this.startPoint.clone().applyMatrix4(i)),p(this.endPoint.clone().applyMatrix4(i)));return this.center=f.center,this.normal=f.normal,this.majorAxis=f.majorAxis,this.majorAxisRadius=f.majorAxisRadius,this.minorAxisRadius=f.minorAxisRadius,this._startAngle=f._startAngle,this._endAngle=f._endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new x(this.center).distanceTo(Zn);return new Qn(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.majorAxisRadius+e,r=this.minorAxisRadius+e;return i<=0||r<=0?null:new t(this.center,this.normal,this.majorAxis,i,r,this.startAngle,this.endAngle)},t}(De),Ch=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Pt=function(n){Ch(t,n);function t(e,i){var r=n.call(this)||this;return r._start=new P(e),r._end=new P(i),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=new P(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),i=new P(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new Q(e,i)},t.prototype.transform=function(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.project=function(e){var i=this._end.x-this._start.x,r=this._end.y-this._start.y,s=i*i+r*r;if(s<1e-18)return this._start.clone();var o=((e.x-this._start.x)*i+(e.y-this._start.y)*r)/s;return o=Math.max(0,Math.min(1,o)),new P(this._start.x+o*i,this._start.y+o*r)},t.prototype.nearestPoint=function(e){return this.project(e)},t}(Pe),Oh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Di=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Hi=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},ir=function(n){Oh(t,n);function t(e){e===void 0&&(e=[]);var i=n.call(this)||this;return i._curves=e,i}return Object.defineProperty(t.prototype,"curves",{get:function(){return this._curves},enumerable:!1,configurable:!0}),t.buildFromEdges=function(e,i){if(i===void 0&&(i=.001),e.length===0)return[];for(var r=Hi([],Di(e),!1),s=[],o=i*i,a=function(p,f){var y=p.x-f.x,_=p.y-f.y;return y*y+_*_<=o};r.length>0;){var h=[],l=r.shift();h.push(l);var c=t.getEdgeStartPoint(l),u=t.getEdgeEndPoint(l);if(!a(c,u))for(;r.length>0;){var g=t.findConnectingEdge(r,u,o);if(g.index<0)break;var d=r.splice(g.index,1)[0];if(g.reverse&&(d=t.reverseEdge(d)),h.push(d),u=t.getEdgeEndPoint(d),a(u,c))break}s.push(new t(h))}return s},t.prototype.add=function(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"numberOfEdges",{get:function(){return this._curves.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this._curves.length>0){var e=this._curves[0].startPoint;return new P(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.startPoint},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){var e=0;return this._curves.forEach(function(i){e+=i.length}),e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100),i=new Q;return i.setFromPoints(e),i},t.prototype.transform=function(e){var i=new O().set(e.elements[0],e.elements[3],0,e.elements[6],e.elements[1],e.elements[4],0,e.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(function(r){r instanceof At?r.transform(i):r.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._curves.map(function(e){return e.clone()}))},Object.defineProperty(t.prototype,"closed",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var i=[];return this.curves.forEach(function(r){r.getPoints(e).forEach(function(s){i.push(new P(s.x,s.y))})}),i},t.findConnectingEdge=function(e,i,r){for(var s=-1,o=!1,a=Number.POSITIVE_INFINITY,h=0;h<e.length;h++){var l=e[h],c=t.getEdgeStartPoint(l),u=t.getEdgeEndPoint(l),g=i.x-c.x,d=i.y-c.y,p=g*g+d*d;p<a&&(a=p,s=h,o=!1);var f=i.x-u.x,y=i.y-u.y,_=f*f+y*y;_<a&&(a=_,s=h,o=!0)}return a>r?{index:-1,reverse:!1}:{index:s,reverse:o}},t.getEdgeStartPoint=function(e){var i=e.startPoint;return new P(i.x,i.y)},t.getEdgeEndPoint=function(e){var i=e.endPoint;return new P(i.x,i.y)},t.reverseEdge=function(e){return e instanceof Pt?new Pt(e.endPoint,e.startPoint):e instanceof ot?new ot(e.center,e.radius,e.endAngle,e.startAngle,!e.clockwise):e instanceof Qt?new Qt(e.center,e.majorAxisRadius,e.minorAxisRadius,e.endAngle,e.startAngle,!e.clockwise,e.rotation):e instanceof At?t.reverseSplineEdge(e):e},t.reverseSplineEdge=function(e){var i=Hi([],Di(e.controlPoints),!1).reverse(),r=e.knots,s=r[0],o=r[r.length-1],a=r.map(function(c){return s+o-c}).reverse(),h=e.weights,l=h.length>0?Hi([],Di(h),!1).reverse():void 0;return new At(i,a,l,e.degree,e.closed)},t}(Pe),kh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Ui=function(){function n(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return n.prototype.init=function(t,e,i,r){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-r,this.c3=2*t-2*e+i+r},n.prototype.initCatmullRom=function(t,e,i,r,s){this.init(e,i,s*(i-t),s*(r-e))},n.prototype.initNonuniformCatmullRom=function(t,e,i,r,s,o,a){var h=(e-t)/s-(i-t)/(s+o)+(i-e)/o,l=(i-e)/o-(r-e)/(o+a)+(r-i)/a;h*=o,l*=o,this.init(e,i,h,l)},n.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},n}(),fo=function(n){kh(t,n);function t(e,i,r,s){e===void 0&&(e=[]),i===void 0&&(i=!1),r===void 0&&(r="centripetal"),s===void 0&&(s=.5);var o=n.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new x,o._px=new Ui,o._py=new Ui,o._pz=new Ui,o._points=e.map(function(a){return new m(a)}),o._closed=i,o._curveType=r,o._tension=s,o}return Object.defineProperty(t.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var e=0,i=1;i<this._points.length;i++)e+=this._points[i-1].distanceTo(this._points[i]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e,i){i===void 0&&(i=new m);var r=i,s=this._points,o=s.length;if(o===0)return r.set(0,0,0);if(o===1)return r.copy(s[0]);var a=(o-(this._closed?0:1))*e,h=Math.floor(a),l=a-h;this._closed?h+=h>0?0:(Math.floor(Math.abs(h)/o)+1)*o:l===0&&h===o-1&&(h=o-2,l=1);var c,u;this._closed||h>0?c=s[(h-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),c=new m(this._tmp.x,this._tmp.y,this._tmp.z));var g=s[h%o],d=s[(h+1)%o];if(this._closed||h+2<o?u=s[(h+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),u=new m(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var p=this._curveType==="chordal"?.5:.25,f=Math.pow(c.distanceToSquared(g),p),y=Math.pow(g.distanceToSquared(d),p),_=Math.pow(d.distanceToSquared(u),p);y<1e-4&&(y=1),f<1e-4&&(f=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(c.x,g.x,d.x,u.x,f,y,_),this._py.initNonuniformCatmullRom(c.y,g.y,d.y,u.y,f,y,_),this._pz.initNonuniformCatmullRom(c.z,g.z,d.z,u.z,f,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,g.x,d.x,u.x,this._tension),this._py.initCatmullRom(c.y,g.y,d.y,u.y,this._tension),this._pz.initCatmullRom(c.z,g.z,d.z,u.z,this._tension));return r.set(this._px.calc(l),this._py.calc(l),this._pz.calc(l)),r},t.prototype.getPoints=function(e){for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.setPoints=function(e){this._points=e.map(function(i){return new m(i)}),this._boundingBoxNeedsUpdate=!0},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)},t.prototype.setCurveType=function(e){this._curveType=e},t.prototype.setTension=function(e){this._tension=e},t.prototype.clone=function(){return new t(this._points.map(function(e){return e.clone()}),this._closed,this._curveType,this._tension)},t.prototype.transform=function(e){return this._points=this._points.map(function(i){var r=new m;return r.copy(i),r.applyMatrix4(e),r}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new C;var e=new C;return this._points.forEach(function(i){e.expandByPoint(i)}),e},t}(De),he=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},ce=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function ss(n,t){var e,i,r=n.x-t[0],s=n.y-t[1],o=((e=n.z)!==null&&e!==void 0?e:0)-((i=t[2])!==null&&i!==void 0?i:0);return r*r+s*s+o*o}var ft=function(){function n(t,e,i,r){this._degree=t,this._knots=ce([],he(e),!1),this._controlPoints=i.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=r?ce([],he(r),!1):new Array(i.length).fill(1)}return n.prototype.degree=function(){return this._degree},n.prototype.knots=function(){return ce([],he(this._knots),!1)},n.prototype.controlPoints=function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z}})},n.prototype.weights=function(){return ce([],he(this._weights),!1)},n.prototype.clone=function(){return new n(this._degree,this._knots,this._controlPoints,this._weights)},n.prototype.point=function(t){return this.evaluate(t).point},n.prototype.evaluate=function(t){var e=this._controlPoints.map(function(i){return[i.x,i.y,i.z]});return Tl(t,this._degree,this._knots,e,this._weights)},n.prototype.signedPlanarCurvatureAt=function(t){var e=this.evaluate(t);return Cl(e.deriv1,e.deriv2)},n.prototype.getOffsetSamplePath2d=function(t,e){var i=this;e===void 0&&(e=512);for(var r=Math.abs(t),s=this.getParameterRange(),o=s.start,a=s.end,h=this.length(),l=Math.max(64,Math.ceil(h/Math.max(r*.2,1e-6))),c=Yh(o,a,Math.min(l,e)),u=0;u<8&&c.length<e;u++){for(var g=[],d=0;d<c.length-1;d++){var p=c[d],f=c[d+1],y=(p+f)/2,_=Math.max(Math.abs(this.signedPlanarCurvatureAt(p)),Math.abs(this.signedPlanarCurvatureAt(f)),Math.abs(this.signedPlanarCurvatureAt(y)));r*_>.85&&g.push(y)}if(g.length===0)break;if(c=Xh(c,g),c.length>e){c=c.slice(0,e);break}}var v=[],S=[];return c.forEach(function(A){var L=i.evaluate(A);v.push(new P(L.point[0],L.point[1]));var T=L.deriv1[0],I=L.deriv1[1],X=Math.hypot(T,I);S.push(X>1e-10?new P(T/X,I/X):new P(1,0))}),{points:v,tangents:S}},n.prototype.length=function(){var t=this._controlPoints.map(function(e){return[e.x,e.y,e.z]});return to(this._degree,this._knots,t,this._weights)},n.byKnotsControlPointsWeights=function(t,e,i,r){return new n(t,e,i,r)},n.byPoints=function(t,e,i,r,s){i===void 0&&(i="Uniform");var o=Jn(t,e,i,r,s),a=o.controlPoints.map(function(h){return{x:h[0],y:h[1],z:h[2]}});return new n(e,o.knots,a,o.weights)},n.prototype.getParameterRange=function(){var t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}},n.prototype.getPoints=function(t){for(var e=[],i=this.getParameterRange(),r=i.start,s=i.end,o=0;o<=t;o++){var a=r+(s-r)*(o/t);e.push(this.point(a))}return e},n.prototype.isClosed=function(t){t===void 0&&(t=1e-6);var e=this.getParameterRange(),i=e.start,r=e.end,s=this.point(i),o=this.point(r),a=s[0]-o[0],h=s[1]-o[1],l=s[2]-o[2];return Math.sqrt(a*a+h*h+l*l)<t},n.createFitPointsForClosedCurve=function(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var e=new fo(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)},n.prototype.nearestPoint=function(t,e){var i;e===void 0&&(e=64);for(var r=this.getParameterRange(),s=r.start,o=r.end,a=this.point(s),h=ss(t,a),l=0;l<=e;l++){var c=s+(o-s)*l/e,u=this.point(c),g=ss(t,u);g<h&&(h=g,a=u)}return{x:a[0],y:a[1],z:(i=a[2])!==null&&i!==void 0?i:0}},n.createClosedCurve=function(t,e,i){i===void 0&&(i="Chord");var r=this.createFitPointsForClosedCurve(t),s=r.map(function(o){return[o.x,o.y,o.z]});return n.byPoints(s,e,i)},n}();function Yh(n,t,e){if(e<2)return[n,t];for(var i=[],r=0;r<e;r++)i.push(r===e-1?t:n+(t-n)*r/(e-1));return i}function Xh(n,t){var e=ce(ce([],he(n),!1),he(t),!1).sort(function(r,s){return r-s}),i=[];return e.forEach(function(r){var s=i[i.length-1];(s===void 0||Math.abs(s-r)>1e-10)&&i.push(r)}),i}function os(n){var t,e,i;if(!n)return!1;var r=(t=n.x)!==null&&t!==void 0?t:0,s=(e=n.y)!==null&&e!==void 0?e:0,o=(i=n.z)!==null&&i!==void 0?i:0;return r*r+s*s+o*o>1e-20}function Nh(n,t,e){var i=n??0;return i<1&&e>0&&t>0&&(i=e-t-1),i<1&&(i=3),i=Math.min(i,t-1),Math.max(1,i)}function Bh(n,t,e){var i=n??0;i<1&&(i=3);var r=t+e-1;return i=Math.min(i,r),Math.max(1,i)}function Rh(n,t){if(!(!n||n.length!==t))return n}var zh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),as=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},ls=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},At=function(n){zh(t,n);function t(e,i,r,s,o,a){var h=n.call(this)||this,l=arguments.length;if(h._degree=3,h._closed=!1,Array.isArray(i)){if(l<2||l>5)throw lt.ILLEGAL_PARAMETERS;h._controlPoints=e;var d=void 0,p=3,f=!1;if(l>=3&&(Array.isArray(r)?(d=r,l>=4&&(p=s||3),l>=5&&(f=o)):r!==void 0&&(p=r||3,l>=4&&(f=s))),r===void 0&&l>=4&&(p=s||3,l>=5&&(f=o)),h._degree=p,h._closed=f,h._controlPoints.length<h._degree+1)throw lt.ILLEGAL_PARAMETERS;h._nurbsCurve=ft.byKnotsControlPointsWeights(h._degree,i,h._controlPoints,d)}else{if(l<2||l>6)throw lt.ILLEGAL_PARAMETERS;h._fitPoints=e,h._knotParameterization=i,l>=3&&(h._degree=r||3);var c=typeof s=="boolean";l>=4&&c&&(h._closed=s),c?(l>=5&&(h._startTangent=o),l>=6&&(h._endTangent=a)):(l>=4&&(h._startTangent=s),l>=5&&(h._endTangent=o)),h._closed&&(h._startTangent=void 0,h._endTangent=void 0);var u=(h._startTangent?1:0)+(h._endTangent?1:0);if(h._fitPoints.length+u<h._degree+1)throw lt.ILLEGAL_PARAMETERS;if(h._closed)h._nurbsCurve=ft.createClosedCurve(h._fitPoints,h._degree,h._knotParameterization);else{var g=h.toNurbsPoints(h._fitPoints);h._nurbsCurve=ft.byPoints(g,h._degree,h._knotParameterization,h._startTangent?h.toNurbsPoint(h._startTangent):void 0,h._endTangent?h.toNurbsPoint(h._endTangent):void 0)}h._controlPoints=h.toGePoints(h._nurbsCurve.controlPoints().map(function(y){return[y.x,y.y,y.z||0]}))}return h}return t.prototype.buildCurve=function(){if(this._fitPoints&&this._knotParameterization){if(this._closed){var e=ft.createFitPointsForClosedCurve(this._fitPoints),i=this.toNurbsPoints(e);this._nurbsCurve=ft.byPoints(i,this._degree,this._knotParameterization)}else{var i=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=ft.byPoints(i,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(o){return[o.x,o.y,o.z||0]}))}else if(this._controlPoints)if(this._closed){var e=ft.createFitPointsForClosedCurve(this._controlPoints),i=this.toNurbsPoints(e);this._nurbsCurve=ft.byPoints(i,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(h){return[h.x,h.y,h.z||0]}))}else{var r=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=ft.byKnotsControlPointsWeights(this._degree,r,this._controlPoints,s)}},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())},Object.defineProperty(t.prototype,"degree",{get:function(){return this._degree},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knotParameterization",{get:function(){return this._knotParameterization},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlPoints",{get:function(){return this._controlPoints.map(nt.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fitPoints",{get:function(){var e;return(e=this._fitPoints)===null||e===void 0?void 0:e.map(nt.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knots",{get:function(){return ls([],as(this._nurbsCurve.knots()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return ls([],as(this._nurbsCurve.weights()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){var e=this._nurbsCurve.knots(),i=this._nurbsCurve.degree(),r=e[i],s=this._nurbsCurve.point(r);return new m(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this._nurbsCurve.knots(),i=this._nurbsCurve.degree(),r=e[e.length-i-1],s=this._nurbsCurve.point(r);return new m(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._nurbsCurve.length()},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e,i){i===void 0&&(i=64);var r=this._nurbsCurve.nearestPoint(e,i);return new m(r.x,r.y,r.z||0)},t.prototype.evaluateAt=function(e){var i=this._nurbsCurve.point(e);return new m(i[0],i[1],i[2])},t.prototype.getFitPointAt=function(e){if(!this._fitPoints)throw new Error("No fit points in this spline");var i=this._fitPoints.length,r=e<0||e>=i?i-1:e,s=this._fitPoints[r];return nt.point2dToPoint3d(s)},t.prototype.getControlPointAt=function(e){var i=this._controlPoints.length,r=e<0||e>=i?i-1:e;return this._controlPoints[r]},t.prototype.getOffsetSamplePath2d=function(e){return this._nurbsCurve.getOffsetSamplePath2d(e)},t.prototype.getPoints=function(e){e===void 0&&(e=100);for(var i=this._nurbsCurve,r=[],s=i.knots(),o=this._nurbsCurve.degree(),a=s[o],h=s[s.length-o-1],l=(h-a)/(e-1),c=0;c<e;c++){var u=c===e-1?h:a+c*l,g=i.point(u);r.push(new m(g[0],g[1],g[2]))}return r},t.prototype.getCurvePoints=function(e,i){for(var r=[],s=e.knots(),o=e.degree(),a=s[o],h=s[s.length-o-1],l=(h-a)/(i-1),c=0;c<i;c++){var u=a+c*l;r.push(e.point(u))}return r},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new C().setFromPoints(e)},Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this.setClosed(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed)return 0;var e=this.getPoints(128);return no(e)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(function(s){return new m(s).applyMatrix4(e)}),this._startTangent&&(this._startTangent=new m(this._startTangent).transformDirection(e)),this._endTangent&&(this._endTangent=new m(this._endTangent).transformDirection(e)),this.buildCurve();else{var i=this._nurbsCurve.knots(),r=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(function(s){return new m(s).applyMatrix4(e)}),this._nurbsCurve=ft.byKnotsControlPointsWeights(this._degree,i,this._controlPoints,r.length>0?r:void 0)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return this._fitPoints&&this._knotParameterization?new t(this._fitPoints.map(nt.point2dToPoint3d),this._knotParameterization,this._degree,this._closed,this._startTangent?nt.point2dToPoint3d(this._startTangent):void 0,this._endTangent?nt.point2dToPoint3d(this._endTangent):void 0):new t(this._controlPoints.map(nt.point2dToPoint3d),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)},t.prototype.toNurbsPoints=function(e){var i=new Array(e.length);return e.forEach(function(r,s){i[s]=[r.x,r.y,r.z||0]}),i},t.prototype.toGePoints=function(e){var i=new Array(e.length);return e.forEach(function(r,s){i[s]={x:r[0],y:r[1],z:r[2]}}),i},t.prototype.toNurbsPoint=function(e){return[e.x,e.y,e.z||0]},t.createClosedSpline=function(e,i,r){if(i===void 0&&(i="Uniform"),r===void 0&&(r=3),e.length<r+1)throw new Error("At least ".concat(r+1," points are required for a degree ").concat(r," closed spline"));return new t(e,i,r,!0)},t.fromControlPoints=function(e,i,r,s,o){if(e.length<2||i.length<2)return null;var a=Nh(s,e.length,i.length);if(e.length<a+1)return null;try{return new t(e,i,Rh(r,e.length),a,o)}catch{return null}},t.fromFitPoints=function(e,i,r,s,o,a){if(e.length<2)return null;var h=os(o),l=os(a),c=(h?1:0)+(l?1:0),u=Bh(r,e.length,c);if(e.length+c<u+1)return null;try{return h||l?new t(e,i,u,s,h?o:void 0,l?a:void 0):new t(e,i,u,s)}catch{return null}},t.fromDwgSplineEdge=function(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){var i=e.controlPoints.map(nt.point2dToPoint3d),r=!0,s=e.controlPoints.map(function(a){return a.weight==null&&(r=!1),a.weight||1});return t.fromControlPoints(i,e.knots,r?s:void 0,e.degree,!1)}if(e.numberOfFitData>0){var o=e.fitDatum.map(nt.point2dToPoint3d);return t.fromFitPoints(o,"Uniform",e.degree,!1,e.startTangent?nt.point2dToPoint3d(e.startTangent):void 0,e.endTangent?nt.point2dToPoint3d(e.endTangent):void 0)}return null},t}(De);class He{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}class Ut extends _t{constructor(t,e){t=t||{},je(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var yo=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(yo||{});const Ft=class Ft extends Ut{static isModelSapceName(t){return t.toLowerCase()==Ft.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Ft.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new m,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return Ft.isModelSapceName(this.name)}get isPaperSapce(){return Ft.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(t){this._blockInsertUnits=t}get explodability(){return this._explodability}set explodability(t){this._explodability=t}get blockScaling(){return this._blockScaling}set blockScaling(t){this._blockScaling=t}get bmpPreview(){return this._bmpPreview}set bmpPreview(t){this._bmpPreview=t}appendEntity(t){const e=i=>{i.database=this.database,i.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(i),this.database.commitObjectHandle(i,r=>this._entities.has(r)),i.resolveEffectiveProperties(),this._entities.set(i.objectId,i),i.dxfTypeName==="INSERT"&&"syncAttributeDatabases"in i&&typeof i.syncAttributeDatabases=="function"&&i.syncAttributeDatabases()};if(Array.isArray(t))for(let i=0;i<t.length;++i)e(t[i]);else e(t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],i=[];return e.forEach(r=>{const s=this._entities.get(r);s&&i.push(s),this._entities.delete(r)}),i.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:i}),i.length>0}newIterator(){return new He(this._entities)}getIdAt(t){return this._entities.get(t)}dxfOutBlockRecord(t){return t.writeStart("BLOCK_RECORD"),this.dxfOut(t),this}dxfOutBlockBegin(t){return t.writeStart("BLOCK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeString(8,"0"),t.writeSubclassMarker("AcDbBlockBegin"),t.writeString(2,this.name),t.writeInt16(70,0),t.writePoint3d(10,this.origin),t.writeString(3,this.name),this}dxfOutBlockEnd(t){return t.writeStart("ENDBLK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.blockInsertUnits),t.writeInt16(280,this.explodability),t.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&t.writeObjectId(340,this.layoutId),this}};Ft.MODEL_SPACE_NAME="*Model_Space",Ft.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let et=Ft;var mo=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(mo||{}),_o=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(_o||{}),xo=(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))(xo||{}),wo=(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))(wo||{}),bo=(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))(bo||{}),vo=(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))(vo||{});const Fh={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 Po extends _t{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new P,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new P,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new Q,this._modelType=t,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(t){this._plotSettingsName=t}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(t){this._plotSettingsName=t}get plotCfgName(){return this._plotCfgName}set plotCfgName(t){this._plotCfgName=t}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(t){this._canonicalMediaName=t}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(t){this._currentStyleSheet=t}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(t){this._plotOrigin=t}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(t){this._customPrintScale=t}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(t){this._plotPaperSize=t}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(t){this._plotPaperMargins=t}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(t){this._plotViewName=t}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(t){this._plotWindowArea=t}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(t){this._modelType=t}getModelType(){return this._modelType}setModelType(t){this._modelType=t}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(t){this._drawViewportsFirst=t}setDrawViewportsFirst(t){this._drawViewportsFirst=t}get plotCentered(){return this._plotCentered}set plotCentered(t){this._plotCentered=t}setPlotCentered(t){this._plotCentered=t}get plotHidden(){return this._plotHidden}set plotHidden(t){this._plotHidden=t}setPlotHidden(t){this._plotHidden=t}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(t){this._plotPaperUnits=t}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(t){this._plotPlotStyles=t}setPlotPlotStyles(t){this._plotPlotStyles=t}get plotRotation(){return this._plotRotation}set plotRotation(t){this._plotRotation=t}get plotType(){return this._plotType}set plotType(t){this._plotType=t}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(t){this._plotViewportBorders=t}setPlotViewportBorders(t){this._plotViewportBorders=t}get printLineweights(){return this._printLineweights}set printLineweights(t){this._printLineweights=t}setPrintLineweights(t){this._printLineweights=t}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(t){this._scaleLineweights=t}setScaleLineweights(t){this._scaleLineweights=t}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(t){this._showPlotStyles=t}setShowPlotStyles(t){this._showPlotStyles=t}get shadePlot(){return this._shadePlotType}set shadePlot(t){this._shadePlotType=t}setShadePlot(t){this._shadePlotType=t}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(t){this._shadePlotResLevel=t}setShadePlotResLevel(t){this._shadePlotResLevel=t}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(t){this._shadePlotCustomDpi=t}setShadePlotCustomDPI(t){this._shadePlotCustomDpi=t}get shadePlotId(){return this._shadePlotId}set shadePlotId(t){this._shadePlotId=t}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(t){this._stdScaleType=t}get stdScale(){return Fh[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(t){this._useStandardScale=t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPlotSettings"),t.writeString(1,this.plotSettingsName),t.writeString(2,this.plotCfgName),t.writeString(4,this.canonicalMediaName),t.writeString(6,this.plotViewName),t.writeDouble(40,this.plotPaperMargins.left),t.writeDouble(41,this.plotPaperMargins.bottom),t.writeDouble(42,this.plotPaperMargins.right),t.writeDouble(43,this.plotPaperMargins.top),t.writeDouble(44,this.plotPaperSize.x),t.writeDouble(45,this.plotPaperSize.y),t.writeDouble(46,this.plotOrigin.x),t.writeDouble(47,this.plotOrigin.y),t.writeDouble(48,this.plotWindowArea.min.x),t.writeDouble(49,this.plotWindowArea.min.y),t.writeDouble(140,this.plotWindowArea.max.x),t.writeDouble(141,this.plotWindowArea.max.y),t.writeDouble(142,this.customPrintScale.numerator),t.writeDouble(143,this.customPrintScale.denominator);let e=0;return this.plotViewportBorders&&(e|=1),this.showPlotStyles&&(e|=2),this.plotCentered&&(e|=4),this.plotHidden&&(e|=8),this.useStandardScale&&(e|=16),this.plotPlotStyles&&(e|=32),this.scaleLineweights&&(e|=64),this.printLineweights&&(e|=128),this.drawViewportsFirst&&(e|=512),this.modelType&&(e|=1024),t.writeInt16(70,e),t.writeInt16(72,this.plotPaperUnits),t.writeInt16(73,this.plotRotation),t.writeInt16(74,this.plotType),t.writeString(7,this.currentStyleSheet),t.writeInt16(75,this.stdScaleType),t.writeInt16(76,this.shadePlot),t.writeInt16(77,this.shadePlotResLevel),t.writeInt16(78,this.shadePlotCustomDPI),t.writeDouble(147,this.stdScale),t.writeObjectId(333,this.shadePlotId),this}}class Ei extends Po{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new Q,this._extents=new C,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}get viewportArray(){return this._viewportArray}set viewportArray(t){this._viewportArray=t.slice()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayout"),t.writeString(1,this.layoutName),t.writeInt16(70,this.tabSelected?1:0),t.writeInt16(71,this.tabOrder),t.writeObjectId(330,this.blockTableRecordId),t.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),t.writePoint2d(10,this.limits.min),t.writePoint2d(11,this.limits.max),t.writePoint3d(14,this.extents.min),t.writePoint3d(15,this.extents.max),this}}class Ao{constructor(){this.events={layoutCreated:new U,layoutRemoved:new U,layoutRenamed:new U,layoutSwitched:new U}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const i=this.getWorkingDatabase(e),r=i.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(r,i)}setCurrentLayoutBtrId(t,e){const i=this.getWorkingDatabase(e),r=i.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(r,i)}setCurrentLayout(t,e){const i=this.getWorkingDatabase(e),r=i.objects.layout.getAt(t);return this.setCurrentLayoutInternal(r,i)}renameLayout(t,e,i){const s=this.getWorkingDatabase(i).objects.layout.getAt(t);return s?(s.layoutName=e,this.events.layoutRenamed.dispatch({layout:s,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const i=this.getWorkingDatabase(e).objects.layout,r=i.getAt(t);let s=!1;return r&&(s=i.remove(t),s&&this.events.layoutRemoved.dispatch({layout:r})),s}createLayout(t,e){const i=this.getWorkingDatabase(e),r=new Ei;r.layoutName=t,r.tabOrder=i.objects.layout.maxTabOrder;const s=new et;return s.name=`*Paper_Space${r.tabOrder}`,i.tables.blockTable.add(s),i.objects.layout.setAt(t,r),this.events.layoutCreated.dispatch({layout:r}),{layout:r,btr:s}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||hl()}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}let ri;function Vh(n){ri=n}function So(){return hi.instance}const _i=class _i{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager||(ri||(ri=()=>new Ao),this._layoutManager=ri()),this._layoutManager}};_i.instance=new _i;let hi=_i;Os(So);var Lo=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(Lo||{});class nr{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new nr(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Mo{constructor(t,e,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=i,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,i)=>{const r=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let i=0;const r=async()=>{const s=i,o=Math.min(i+this._chunkSize,this._count);await t(s,o),i=o,i<this._count&&await this.scheduleTask(r)};await r(),await(e==null?void 0:e())}}const Dt="Continuous",W="Standard",Vt="Standard",jt="Standard",jh="ANSI31",Io="ANGLE",Jt="SOLID",Eo="USER",To="LINEAR",Z="ByLayer",St="ByBlock",we="*Active",an="mlightcad",ln="ACAD",Gh=Object.freeze({x:0,y:0}),Dh=Object.freeze({x:0,y:0}),Hh=Object.freeze({x:1,y:1}),Uh=Object.freeze({x:0,y:0,z:1}),Wh=Object.freeze({x:0,y:0,z:0}),$h=0,qh=32767,Kh=/\\f(.*?)\|/g;class vt{constructor(t){this.styles=t.styles,this.styleMap=vt.buildStyleFontMap(this.styles),this.textStyleVar=t.textStyleVar??W}collect(t,e){const i=new Set;for(const r of vt.collectShapeDefinitionFonts(this.styles))i.add(r);return this.collectFromEntities(t,e,i),Array.from(i)}static normalizeFontFileName(t){if(!t)return;const e=t.lastIndexOf(".");return e>=0?t.substring(0,e).toLowerCase():t.toLowerCase()}collectFromEntities(t,e,i){for(const r of t){const s=e.getEntityFontInfo(r);if(s){if(s.formattedText)for(const o of vt.extractInlineMTextFonts(s.formattedText))i.add(o);if(s.resolveStyle&&this.addResolvedStyleFonts(s.styleName,i),s.blockName&&e.getBlockEntities){const o=e.getBlockEntities(s.blockName);o&&this.collectFromEntities(o,e,i)}}}}resolveStyleFontNames(t){const e=[],i=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};i(t),i(this.textStyleVar),i(W),i("STANDARD");for(const r of e){const s=this.styleMap.get(r);if(s)return s;const o=r.toUpperCase();for(const[a,h]of this.styleMap)if(a.toUpperCase()===o)return h}return this.styleMap.values().next().value}addResolvedStyleFonts(t,e){const i=this.resolveStyleFontNames(t);i==null||i.forEach(r=>e.add(r))}static buildStyleFontMap(t){const e=new Map;for(const i of t)e.set(i.name,vt.collectStyleEntryFontNames(i));return e}static collectStyleEntryFontNames(t){const e=[];for(const i of[t.font,t.bigFont,t.extendedFont]){const r=vt.normalizeFontFileName(i);r&&e.push(r)}return e}static collectShapeDefinitionFonts(t){const e=[];for(const i of t)if(i.standardFlag&&i.standardFlag&1){const r=vt.normalizeFontFileName(i.font);r&&e.push(r)}return e}static extractInlineMTextFonts(t){const e=[];for(const i of t.matchAll(Kh))e.push(i[1].toLowerCase());return e}}class ie{static get instance(){return this._instance||(this._instance=new ie),this._instance}constructor(){this._blocks=new Map}createKey(t,e){let i=e.toString();return!i&&e.isByColor&&(i=`RGB:${e.red},${e.green},${e.blue}`),`${t}_${i}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,i,r=[],s=!0,o,a){const h=[];if(e!=null){const l=i.RGB??0,c=this.createKey(e.name,i);let u;if(this.has(c))u=this.get(c);else{const g=e.newIterator();for(const d of g)d.visibility&&(d.color.isByBlock?(hs.copy(d.color),i.isForeground?d.color.setForeground():d.color.setRGBValue(l),this.addEntity(d,h,t),d.color.copy(hs)):this.addEntity(d,h,t));u=t.group(h),u&&s&&et.name&&!et.name.startsWith("*U")&&this.set(c,u)}return u&&o&&(u.applyMatrix(o),a&&(a.x!=0||a.y!=0||a.z!=1)&&(o.setFromExtrusionDirection(a),u.applyMatrix(o))),u&&r&&r.length>0&&(u.bakeTransformToChildren(),r.forEach(g=>u.addChild(g))),u}else return t.group(h)}addEntity(t,e,i){if(!t.visibility)return;const r=t.worldDraw(i);r&&(this.attachEntityInfo(r,t),e.push(r))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const hs=new k;exports.AcGiArrowType=void 0;(function(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"})(exports.AcGiArrowType||(exports.AcGiArrowType={}));exports.AcGiLineWeight=void 0;(function(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"})(exports.AcGiLineWeight||(exports.AcGiLineWeight={}));var Ti=function(){function n(t){t===void 0&&(t={});var e,i,r,s;this.database=t.database,this.foregroundOnDark=(e=t.foregroundOnDark)!==null&&e!==void 0?e:Be,this.foregroundOnLight=(i=t.foregroundOnLight)!==null&&i!==void 0?i:Re,this.backgroundIsDark=(r=t.backgroundIsDark)!==null&&r!==void 0?r:!0,this.fallbackRgb=(s=t.fallbackRgb)!==null&&s!==void 0?s:16777215}return n.prototype.resolveSubEntityTraitsRgb=function(t){var e,i,r,s=t.color;return s.isForeground?this.backgroundIsDark?this.foregroundOnDark:this.foregroundOnLight:s.isByLayer||s.isByBlock?(e=this.fallbackRgb)!==null&&e!==void 0?e:16777215:(r=(i=s.RGB)!==null&&i!==void 0?i:this.fallbackRgb)!==null&&r!==void 0?r:16777215},n.fromBackgroundColor=function(t,e){return t===void 0&&(t=Co),new n({database:e,foregroundOnDark:Be,foregroundOnLight:Re,backgroundIsDark:!Oo(t),fallbackRgb:16777215})},n}(),Co=0,Be=16777215,Re=0,Zh=16777215,Qh=128,Jh=new Ti({database:void 0,foregroundOnDark:Be,foregroundOnLight:Re,backgroundIsDark:!0,fallbackRgb:16777215});function Oo(n){var t=n>>16&255,e=n>>8&255,i=n&255;return .299*t+.587*e+.114*i>Qh}function tc(n){var t=Ti.fromBackgroundColor(n);return t.backgroundIsDark?t.foregroundOnDark:t.foregroundOnLight}function ec(n){return n?Re:Be}function ic(n,t){return Ti.fromBackgroundColor(t).resolveSubEntityTraitsRgb(n)}exports.AcGiMTextFlowDirection=void 0;(function(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"})(exports.AcGiMTextFlowDirection||(exports.AcGiMTextFlowDirection={}));exports.AcGiMTextAttachmentPoint=void 0;(function(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"})(exports.AcGiMTextAttachmentPoint||(exports.AcGiMTextAttachmentPoint={}));exports.AcGiRenderMode=void 0;(function(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"})(exports.AcGiRenderMode||(exports.AcGiRenderMode={}));exports.AcGiOrthographicType=void 0;(function(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"})(exports.AcGiOrthographicType||(exports.AcGiOrthographicType={}));exports.AcGiDefaultLightingType=void 0;(function(n){n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS"})(exports.AcGiDefaultLightingType||(exports.AcGiDefaultLightingType={}));var ko=function(){function n(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new m,this._height=0,this._width=0,this._viewCenter=new m,this._viewHeight=0}return Object.defineProperty(n.prototype,"number",{get:function(){return this._number},set:function(t){this._number=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"id",{get:function(){return this._id},set:function(t){this._id=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groupId",{get:function(){return this._groupId},set:function(t){this._groupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"centerPoint",{get:function(){return this._centerPoint},set:function(t){this._centerPoint.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"box",{get:function(){var t=new Q;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewCenter",{get:function(){return this._viewCenter},set:function(t){this._viewCenter.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(t){this._viewHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewWidth",{get:function(){return this.viewHeight*(this.width/this.height)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewBox",{get:function(){var t=new Q;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var t=new n;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t},n.prototype.copy=function(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this},n}(),at=(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))(at||{}),D=(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))(D||{}),j=(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))(j||{});function Yo(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Xo(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}const b={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELTYPE:"CELTYPE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLEADERSTYLE:"CMLEADERSTYLE",CMLSCALE:"CMLSCALE",CMLSTYLE:"CMLSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",GRIPOBJLIMIT:"GRIPOBJLIMIT",HPANG:"HPANG",HPASSOC:"HPASSOC",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENT:"MEASUREMENT",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",MODELBKCOLOR:"MODELBKCOLOR",OSMODE:"OSMODE",ORTHOMODE:"ORTHOMODE",PAPERBKCOLOR:"PAPERBKCOLOR",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",POLARADDANG:"POLARADDANG",POLARMODE:"POLARMODE",POLARANG:"POLARANG",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",UNITMODE:"UNITMODE"},nc=Object.freeze(Object.values(b)),xi=class xi{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new U},this.registerVar({name:b.ANGBASE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.AUNITS,type:"number",isDbVar:!0,defaultValue:at.DecimalDegrees}),this.registerVar({name:b.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.CECOLOR,type:"color",isDbVar:!0,defaultValue:new k(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:b.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:b.CELTYPE,type:"string",isDbVar:!0,defaultValue:Z}),this.registerVar({name:b.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:exports.AcGiLineWeight.ByLayer}),this.registerVar({name:b.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new $}),this.registerVar({name:b.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:b.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:jt}),this.registerVar({name:b.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:b.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:Vt}),this.registerVar({name:b.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:b.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:b.GRIPOBJLIMIT,type:"number",isDbVar:!1,defaultValue:100}),this.registerVar({name:b.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:b.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new k(exports.AcCmColorMethod.None)}),this.registerVar({name:b.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new k(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:b.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:b.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:b.HPNAME,type:"string",isDbVar:!1,defaultValue:Io}),this.registerVar({name:b.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:b.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new $}),this.registerVar({name:b.INSUNITS,type:"number",isDbVar:!0,defaultValue:j.Millimeters}),this.registerVar({name:b.LUNITS,type:"number",isDbVar:!0,defaultValue:D.Decimal}),this.registerVar({name:b.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:b.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:b.MEASUREMENT,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:b.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new k(exports.AcCmColorMethod.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:b.MODELBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new k(exports.AcCmColorMethod.ByColor);return t.setRGB(0,0,0),t})()}),this.registerVar({name:b.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.ORTHOMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.PAPERBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new k(exports.AcCmColorMethod.ByColor);return t.setRGB(255,255,255),t})()}),this.registerVar({name:b.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:b.POLARADDANG,type:"string",isDbVar:!1,defaultValue:""}),this.registerVar({name:b.POLARMODE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.POLARANG,type:"number",isDbVar:!1,defaultValue:90}),this.registerVar({name:b.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:W}),this.registerVar({name:b.UNITMODE,type:"number",isDbVar:!0,defaultValue:0})}static instance(){return this._instance||(this._instance=new xi),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const i=this.getDescriptor(t);if(!i)throw new Error(`System variable ${t} not found!`);if(i.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}getDefaultValue(t){t=this.normalizeName(t);const e=this.getDescriptor(t);if(!e)throw new Error(`System variable ${t} not found!`);return e.defaultValue}setVar(t,e,i){t=this.normalizeName(t);const r=this.getDescriptor(t);if(r){const s=this.getVar(t,i);if(r.type==="transparency"){const o=this.parseTransparency(e);if(o==null||o.isInvalid)throw new Error("Invalid transparency value!");e=o}else if(r.type!=="string"&&(typeof e=="string"||e instanceof String)){if(r.type==="number"){const o=Number(e);if(Number.isNaN(o))throw new Error("Invalid number input!");e=o}else if(r.type==="boolean")e=this.parseBoolean(e);else if(r.type==="color"){const o=this.parseColorSysVar(t,e,i);if(o==null)throw new Error("Invalid color value!");e=o}}if(t===b.GRIPOBJLIMIT.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<0||o>32767)throw new Error("Invalid GRIPOBJLIMIT value! Valid range is 0 to 32767.");e=o}r.isDbVar?i[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(s,e)&&this.events.sysVarChanged.dispatch({database:i,name:t,newVal:e,oldVal:s}))}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),i=new Set(["true","t","1","yes","y"]),r=new Set(["false","f","0","no","n"]);return i.has(e)?!0:(r.has(e),!1)}parseColorSysVar(t,e,i){const r=e.trim().toLowerCase();return t===b.HPCOLOR.toLowerCase()&&(r==="."||r==="use current")?i.cecolor.clone():t===b.HPBACKGROUNDCOLOR.toLowerCase()&&(r===""||r==="."||r==="none")?new k(exports.AcCmColorMethod.None):k.fromString(e)}parseTransparency(t){if(t instanceof $)return t;if(typeof t=="number")return $.deserialize(t);if(!(typeof t!="string"&&!(t instanceof String)))return $.fromString(String(t))}hasValueChanged(t,e){return t instanceof k&&e instanceof k||t instanceof $&&e instanceof $?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};xi._instance=null;let mt=xi;const No="Load Database",cs=3e4,rc=12e4,sc=1024*1024;class rt extends Ls{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Hn.getInstance().getEntry(No),i=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",r?r.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-i),r}}class Bo{constructor(t={}){this.config={useWorker:t.useWorker??!0,...t}}async read(t,e,i,r,s,o){const a={name:No,data:{total:0},format(){let u="";return Object.keys(this.data).forEach(g=>{g!=="total"&&(u+=`- ${g}: ${this.data[g]} ms
4
- `)}),u+=`- total: ${this.data.total} ms`,u}};Hn.getInstance().collect(a),this.progress=r;const h={value:0},l=new Ms;l.setCompleteCallback(()=>this.onFinished()),l.setErrorCallback(u=>this.onError(u)),l.addTask(new rt({stage:"START",step:1,progress:h,task:async u=>u},r)),l.addTask(new rt({stage:"PARSE",step:5,progress:h,task:async u=>await this.parse(u,s)},r)),l.addTask(new rt({stage:"FONT",step:5,progress:h,task:async u=>{const g=this.getFonts(u.model);return{model:u.model,data:g}}},r)),l.addTask(new rt({stage:"LTYPE",step:1,progress:h,task:async u=>(this.processLineTypes(u.model,e),u)},r)),l.addTask(new rt({stage:"STYLE",step:1,progress:h,task:async u=>(this.processTextStyles(u.model,e),u)},r)),l.addTask(new rt({stage:"DIMSTYLE",step:1,progress:h,task:async u=>(this.processDimStyles(u.model,e),u)},r)),l.addTask(new rt({stage:"LAYER",step:1,progress:h,task:async u=>(this.processLayers(u.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),u)},r)),l.addTask(new rt({stage:"VPORT",step:1,progress:h,task:async u=>(this.processViewports(u.model,e),u)},r)),l.addTask(new rt({stage:"HEADER",step:1,progress:h,task:async u=>{if(this.processHeader(u.model,e),o){const g=mt.instance();for(const[d,p]of Object.entries(o))g.setVar(d,p,e)}return u}},r)),l.addTask(new rt({stage:"BLOCK_RECORD",step:5,progress:h,task:async u=>(this.processBlockTables(u.model,e),u)},r)),l.addTask(new rt({stage:"OBJECT",step:5,progress:h,task:async u=>(this.processObjects(u.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),u)},r)),l.addTask(new rt({stage:"BLOCK",step:5,progress:h,task:async u=>(await this.processBlocks(u.model,e),u)},r)),l.addTask(new rt({stage:"ENTITY",step:100,progress:h,task:async u=>(await this.processEntities(u.model,e,i,h,r),u)},r)),l.addTask(new rt({stage:"END",step:0,progress:h,task:async u=>u},r));const c=Date.now();await l.run(t),a.data.total=Date.now()-c}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),ie.instance.clear())}getParserWorkerTimeout(t,e){const i=e??this.config.timeout;if(i!=null)return i;const r=Math.ceil(t.byteLength/sc),s=cs+r*1e3;return Math.min(rc,Math.max(cs,s))}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,i,r,s){throw new Error("Not impelemented yet!")}}class Ro extends Bo{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,i,r,s){let o=t.tables.blockTable.modelSpace.newIterator().toArray();const a=o.length,h=new Mo(a,100-r.value,i);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const l=e.tables.blockTable.modelSpace;await h.processChunk(async(c,u)=>{let g=[],d=c<u?o[c].type:"";for(let p=c;p<u;p++){const f=o[p];this.config.convertByEntityType&&f.type!==d&&(this.triggerEvents(l,g),g=[],d=f.type),g.push(f)}if(this.triggerEvents(l,g),s){let p=r.value+u/a*(100-r.value);p>100&&(p=100),await s(p,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const i=e.newIterator().toArray();this.triggerEvents(e,i)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const r of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const r of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.objectId});const i=this._database.objects.mleaderStyle.newIterator();for(const r of i)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},i=[];for(const r of t)e[r.type]||(e[r.type]=[],i.push(r.type)),e[r.type].push(r);return i.flatMap(r=>e[r])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}class zo{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const i=Date.now(),r=this.generateTaskId();try{return await this.executeInWorker(r,t,e||this.config.workerUrl)}catch(s){const o=Date.now()-i;return{success:!1,error:s instanceof Error?s.message:String(s),duration:o}}}async executeInWorker(t,e,i){const r=Date.now();return new Promise((s,o)=>{const a=this.getAvailableWorker(i),h=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(a),o(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:u=>{clearTimeout(h),this.releaseWorker(a),s(u)},reject:u=>{clearTimeout(h),this.releaseWorker(a),o(u)},timeout:h});const l=u=>{const{id:g,success:d,data:p,error:f}=u.data;if(g!==t)return;this.cleanupTask(t);const y=Date.now()-r;s(d?{success:!0,data:p,duration:y}:{success:!1,error:f,duration:y})},c=u=>{this.cleanupTask(t),o(new Error(`Worker error: ${u.message}`))};a.addEventListener("message",l),a.addEventListener("error",c),a.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[i,r]of this.workers)if(!r.isBusy)return r.isBusy=!0,r.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const i=new Worker(t,{type:"module"}),r=this.generateWorkerId(),s={worker:i,isBusy:!0,id:r,createdAt:new Date};return this.workers.set(r,s),i}const e=Array.from(this.workers.values()).sort((i,r)=>i.createdAt.getTime()-r.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,i]of this.workers)if(i.worker===t){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(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Fo{constructor(t){this.framework=new zo(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function oc(n){return new Fo(n)}class ac{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:i}=t.data;try{const r=await this.executeTask(i);this.sendResponse(e,!0,r)}catch(r){this.sendResponse(e,!1,void 0,r instanceof Error?r.message:String(r))}}}sendResponse(t,e,i,r){const s={id:t,success:e,data:i,error:r};self.postMessage(s)}}var Ce=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Ce||{});class wt{constructor(){this.events={registered:new U,unregistered:new U},this._converters=new Map}static createInstance(){return wt._instance==null&&(wt._instance=new wt),this._instance}static get instance(){return wt._instance||(wt._instance=new wt),wt._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}var Vo=(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))(Vo||{}),jo=(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))(jo||{}),Go=(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))(Go||{}),Do=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(Do||{}),Ho=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(Ho||{});const wi=class wi extends Ut{constructor(t,e){t=t||{},je(t,wi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}dxfOutFields(t){super.dxfOutFields(t);const e=this.database.tables.textStyleTable.getAt(this.dimtxsty),i=this.database.tables.blockTable.getAt(this.dimldrblk),r=this.database.tables.blockTable.getAt(this.dimblk),s=this.database.tables.blockTable.getAt(this.dimblk1),o=this.database.tables.blockTable.getAt(this.dimblk2);return t.writeSubclassMarker("AcDbDimStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),t.writeString(3,this.dimpost),t.writeString(4,this.dimapost),t.writeDouble(40,this.dimscale),t.writeDouble(41,this.dimasz),t.writeDouble(42,this.dimexo),t.writeDouble(43,this.dimdli),t.writeDouble(44,this.dimexe),t.writeDouble(140,this.dimtxt),t.writeDouble(147,this.dimgap),t.writeInt16(170,this.dimalt),t.writeInt16(171,this.dimtol),t.writeInt16(172,this.dimlim),t.writeInt16(173,this.dimtih),t.writeInt16(174,this.dimtoh),t.writeObjectId(340,e==null?void 0:e.objectId),t.writeObjectId(341,i==null?void 0:i.objectId),t.writeObjectId(342,r==null?void 0:r.objectId),t.writeObjectId(343,s==null?void 0:s.objectId),t.writeObjectId(344,o==null?void 0:o.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};wi.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:W,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let be=wi;class rr extends Ut{constructor(t,e){t=t||{},je(t,{color:new k,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new $,linetype:"",lineWeight:1,materialId:-1}),super(t,e),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(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeCmColor(this.color),t.writeString(6,this.linetype),t.writeInt16(290,this.isPlottable?1:0),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency),this.description&&t.writeString(4,this.description),this}}class te extends Ut{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[t].elementLength}toPreviewSvgString(t){const e=Math.max((t==null?void 0:t.width)??220,1),i=Math.max((t==null?void 0:t.height)??36,1),r=Math.min(Math.max((t==null?void 0:t.padding)??8,0),Math.floor(e/2)),s=Math.max((t==null?void 0:t.strokeWidth)??2,.5),o=this.escapeSvgAttribute((t==null?void 0:t.stroke)??"currentColor"),a=Math.max((t==null?void 0:t.repeats)??4,1),h=i/2,l=r,c=Math.max(e-r,l+1),u=c-l,g=this._linetype.pattern??[];if(g.length===0||this.patternLength<=0||!g.some(S=>S.elementLength!==0))return this.buildSvgString({width:e,height:i,stroke:o,strokeWidth:s,lineSegments:[[l,c]],dots:[],y:h});const d=[],p=[],f=u/(this.patternLength*a),y=.5,_=Math.max(s*2,2);let v=l;for(;v<c;)for(const S of g){if(v>=c)break;const A=S.elementLength;if(A===0){p.push(v),v=Math.min(v+_,c);continue}const L=Math.max(Math.abs(A)*f,y),T=Math.min(v+L,c);A>0&&T>v&&d.push([v,T]),v=T}return this.buildSvgString({width:e,height:i,stroke:o,strokeWidth:s,lineSegments:d,dots:p,y:h})}buildSvgString(t){const{width:e,height:i,stroke:r,strokeWidth:s,lineSegments:o,dots:a,y:h}=t,l=o.map(([u,g])=>`<line x1="${u.toFixed(2)}" y1="${h.toFixed(2)}" x2="${g.toFixed(2)}" y2="${h.toFixed(2)}" stroke="${r}" stroke-width="${s.toFixed(2)}" stroke-linecap="round" />`).join(""),c=a.map(u=>`<circle cx="${u.toFixed(2)}" cy="${h.toFixed(2)}" r="${(s/2).toFixed(2)}" fill="${r}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}" viewBox="0 0 ${e} ${i}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${l}${c}</svg>`}escapeSvgAttribute(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;")}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLinetypeTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.linetype.standardFlag),t.writeString(3,this.comments),t.writeInt16(72,65),t.writeInt16(73,this.numDashes),t.writeDouble(40,this.patternLength);for(const e of this.linetype.pattern??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class sr extends Ut{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name)}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return(this._textStyle.standardFlag&4)===4}set isVertical(t){t?this._textStyle.standardFlag|=4:this._textStyle.standardFlag&=-5}get isShapeFile(){return(this._textStyle.standardFlag&1)===1}set isShapeFile(t){t?this._textStyle.standardFlag|=1:this._textStyle.standardFlag&=-2}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const i=e.lastIndexOf(".");return i===-1?e:e.substring(0,i)}return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.textStyle.standardFlag),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.textStyle.textGenerationFlag),t.writeDouble(42,this.priorSize),t.writeString(3,this.fileName),t.writeString(4,this.bigFontFileName),this}}var w=(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))(w||{});function lc(n){let t=0;for(const e of n)t|=1<<e-1;return t}function hc(n){const t=[];for(const e of Object.values(w)){if(typeof e!="number")continue;const i=1<<e-1;n&i&&t.push(e)}return t}function cc(n,t){return n^1<<t-1}function uc(n,t){return(n&1<<t-1)!==0}function dc(n,t){return n|1<<t-1}function gc(n,t){return n&~(1<<t-1)}const pc={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:[]},Uo={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:[]},dr=class dr extends _t{constructor(){super(...arguments),this._visibility=!0,this._transparency=new $,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this.getEntityColor()}set color(t){this.setEntityColor(t)}get resolvedColor(){return this.resolveStandardColor()}resolveStandardColor(){var e;let t=this.color;if(t.isByLayer){const i=this.getLayerColor();i&&i.RGB!=null&&(t=i)}else if(t.isByBlock){const i=this.database.cecolor;if(i&&(t=i,t.isByLayer)){const r=this.database.clayer||this.layer,s=this.database.tables.layerTable.getAt(r);((e=s==null?void 0:s.color)==null?void 0:e.RGB)!=null&&(t=s.color)}}return t}get lineType(){var t;return this._lineType==null&&(this._lineType=((t=this.database)==null?void 0:t.celtype)??Z),this._lineType}set lineType(t){t?t.toUpperCase()==="BYLAYER"?this._lineType=Z:t.toUpperCase()==="BYBLOCK"?this._lineType=St:this._lineType=t:this._lineType=Z}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new k,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(t){this._color==null&&(this._color=new k),this._color.copy(t)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(t){t.writeSubclassMarker("AcDbEntity"),t.writeString(8,this.layer),t.writeString(6,this.lineType),t.writeDouble(48,this.linetypeScale),t.writeInt16(60,this.visibility?0:1),t.writeCmColor(this.color),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency);const e=this.database.tables.blockTable.getIdAt(this.ownerId);return e!=null&&e.isPaperSapce&&t.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new k,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??Z),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subMoveGripPointsAt(t,e){return this}subGetOsnapPoints(t,e,i,r,s,o){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){if(!this.database.isLayerDrawable(this.layer))return;const i=t.subEntityTraits;i.color=this.resolvedColor,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),t.context.database=this.database;const r=this.subWorldDraw(t,e);return this.attachEntityInfo(r),r}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color=t}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var r;const{type:t,name:e}=this.getLineType(),i=(r=this.database)==null?void 0:r.tables.linetypeTable.getAt(e);return i?{type:t,...i.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Z){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==St?{type:"ByBlock",name:Dt}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Dt}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);return t!=null?t.color:null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};dr.typeName="Entity";let q=dr;function K(n,t){for(const e of n)Number.isInteger(e)&&e>=0&&t(e)}function kt(n,t,e){K(n,i=>{i===0&&e.add(t)})}function or(n,t,e){const i=n[t];i&&(i.x+=e.x,i.y+=e.y)}function Ci(n,t,e){K(n,i=>{const r=e[i];r&&r.add(t)})}function us(n,t){const e=n.x-t.x,i=n.y-t.y,r=(n.z||0)-(t.z||0);return e*e+i*i+r*r}function gt(n,t){if(t.length===0)return;let e=new m(t[0].x,t[0].y,t[0].z||0),i=us(n,e);for(let r=1;r<t.length;r++){const s=t[r],o=new m(s.x,s.y,s.z||0),a=us(n,o);a<i&&(e=o,i=a)}return e}function Ae(n,t,e,i,r){const s=new m(n.x,n.y,n.z||0),o=new m(t.x,t.y,t.z||0),a=new Ct(s,o);switch(e){case w.EndPoint:r.push(s,o);break;case w.MidPoint:r.push(a.midPoint);break;case w.Nearest:r.push(a.nearestPoint(i));break;case w.Perpendicular:r.push(a.perpPoint(i));break}}function ci(n,t,e,i,r,s,o){if(e){const a=new ot(n,t,e);switch(r){case w.EndPoint:o.push(new m(a.startPoint.x,a.startPoint.y,i),new m(a.endPoint.x,a.endPoint.y,i));break;case w.MidPoint:o.push(new m(a.midPoint.x,a.midPoint.y,i));break;case w.Nearest:{const h=a.nearestPoint({x:s.x,y:s.y});o.push(new m(h.x,h.y,i));break}case w.Perpendicular:{a.perpendicularPoints({x:s.x,y:s.y}).forEach(l=>o.push(new m(l.x,l.y,i)));break}case w.Tangent:{a.tangentPoints({x:s.x,y:s.y}).forEach(l=>o.push(new m(l.x,l.y,i)));break}}return}Ae(new m(n.x,n.y,i),new m(t.x,t.y,i),r,s,o)}function ar(n,t,e,i,r){if(n.length!==0)switch(e){case w.EndPoint:n.forEach(s=>r.push(new m(s.x,s.y,s.z||0)));break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const s=n.length,o=[];for(let a=0;a<s;a++){const h=[];Ae(n[a],n[(a+1)%n.length],e,i,h),o.push(...h)}if(e===w.MidPoint)r.push(...o);else{const a=gt(i,o);a&&r.push(a)}break}}}var Oe=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Oe||{}),Wo=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(Wo||{}),$o=(n=>(n[n.HatchObject=0]="HatchObject",n[n.GradientObject=1]="GradientObject",n))($o||{}),qo=(n=>(n[n.PreDefinedGradient=0]="PreDefinedGradient",n[n.UserDefinedGradient=1]="UserDefinedGradient",n))(qo||{});const gr=class gr extends q{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()===Jt}set isSolidFill(t){this._isSolidFill=t}get color(){if(this.hasExplicitColor())return this.getEntityColor();const t=this.database,e=mt.instance().getVar(b.HPCOLOR,t);return e instanceof k&&e.colorMethod!==exports.AcCmColorMethod.None?e.clone():t.cecolor.clone()}set color(t){this.setEntityColor(t)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t??"",this._isSolidFill=this._patternName.trim().toUpperCase()===Jt,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(t){this._patternType=t,t!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(t){this._associative=!!t,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t==null?void 0:t.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(t){this._patternDouble=!!t,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(t){this._hatchObjectType=t}get gradientAngle(){return this._gradientAngle}set gradientAngle(t){this._gradientAngle=t}get gradientShift(){return this._gradientShift}set gradientShift(t){this._gradientShift=t}get gradientType(){return this._gradientType}set gradientType(t){this._gradientType=t}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?To:this._gradientName}set gradientName(t){this._gradientName=t??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(t){this._gradientOneColorMode=t}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(t){this._shadeTintValue=t}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(t){this._gradientStartColor=t==null||!Number.isFinite(t)?void 0:t&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(t){this._gradientEndColor=t==null||!Number.isFinite(t)?void 0:t&16777215}applyPatternDefaultsFromSysVars(t){const e=mt.instance();if(!this.hasExplicitLayer()){const i=e.getVar(b.HPLAYER,t);this.shouldUseSysVarOverride(i)&&(this.layer=i)}if(!this.hasExplicitTransparency()){const i=this.parseHpTransparency(e.getVar(b.HPTRANSPARENCY,t));i&&(this.transparency=i)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(e.getVar(b.HPBACKGROUNDCOLOR,t)),this._backgroundColorSet=!0),!this._patternNameSet){const i=e.getVar(b.HPNAME,t);this._patternName=typeof i=="string"?i:"",this._patternNameSet=!0}if(!this._patternAngleSet){const i=e.getVar(b.HPANG,t);this._patternAngle=typeof i=="number"&&Number.isFinite(i)?i:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(e.getVar(b.HPSCALE,t)),this._patternScaleSet=!0),!this._associativeSet){const i=e.getVar(b.HPASSOC,t);this._associative=typeof i=="number"?i!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(e.getVar(b.HPISLANDDETECTION,t)),this._hatchStyleSet=!0),!this._patternDoubleSet){const i=e.getVar(b.HPDOUBLE,t);this._patternDouble=typeof i=="number"?i!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const t=this.database,e=mt.instance().getVar(b.HPNAME,t);return typeof e=="string"?e:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const t=this.database,e=mt.instance().getVar(b.HPANG,t);return typeof e=="number"&&Number.isFinite(e)?e:this._patternAngle}getRenderablePatternAngle(){return!this._definitionLinesAutoGenerated&&this._definitionLines.length>0?0:this.getEffectivePatternAngle()}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const t=this.database;return this.normalizePatternScale(mt.instance().getVar(b.HPSCALE,t))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const t=this.database,e=mt.instance().getVar(b.HPASSOC,t);return typeof e=="number"?e!==0:this._associative}normalizePatternScale(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}normalizeHatchStyle(t){return typeof t!="number"||!Number.isFinite(t)?1:t===0?0:t===2?2:1}shouldUseSysVarOverride(t){if(typeof t!="string")return!1;const e=t.trim().toLowerCase();return e!==""&&e!=="."&&e!=="use current"}parseHpBackgroundColor(t){if(t instanceof k)return t.colorMethod===exports.AcCmColorMethod.None?void 0:t.clone();if(typeof t!="string")return;const e=t.trim().toLowerCase();if(!(!e||e==="."||e==="none"))return k.fromString(t)}parseHpTransparency(t){if(t instanceof $)return t.clone();if(!this.shouldUseSysVarOverride(t))return;const e=t.trim();if(/^bylayer$/i.test(e)||/^byblock$/i.test(e))return $.fromString(e);const i=Number(e);if(Number.isInteger(i)&&i>=0&&i<=90){const r=new $;return r.percentage=i,r}}updatePredefinedPatternDefinitionLines(t=this.getEffectivePatternName(),e=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const r=t.trim().toUpperCase();if(!r||r===Jt){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const s=this.normalizePatternScale(e);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===r&&this._definitionLinesPatternScale===s)return;const o=Uo.patterns.find(a=>a.name.trim().toUpperCase()===r);if(!o){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=o.lines.map(a=>({angle:a.angle*Math.PI/180,base:{x:a.originX*s,y:a.originY*s},offset:{x:a.deltaX*s,y:a.deltaY*s},dashLengths:a.dashes.map(h=>h*s)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=r,this._definitionLinesPatternScale=s}add(t){this._geo.add(t)}buildAreasFromLoops(){const t=this._geo.loops;if(t.length===0)return[];if(t.length===1)return[this._geo];const e=this._geo.buildHierarchy(),i=[],r=(s,o)=>{if(s.index>=0&&o%2===0){const a=new Tt;a.add(t[s.index]),s.children.forEach(h=>{h.index>=0&&a.add(t[h.index])}),i.push(a)}s.children.forEach(a=>r(a,o+1))};return e.children.forEach(s=>r(s,0)),i.length>0?i:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,i)=>e+i.area,0)}get area(){return this.getCalculatedAreaValue()}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new C;const e=new C;return t.forEach(i=>{const r=i.box;e.union(new C({x:r.min.x,y:r.min.y,z:this._elevation},{x:r.max.x,y:r.max.y,z:this._elevation}))}),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Oe[0],value:0},{label:Oe[1],value:1},{label:Oe[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:t=>{this.associative=t}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:t=>{this.backgroundColor=t}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:t=>{this.patternDouble=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){return this.associative?[]:this.collectBoundaryGripPoints()}subMoveGripPointsAt(t,e){return this.associative?this:(K(t,i=>{this.moveBoundaryGripPointAt(i,e)}),this)}collectBoundaryGripPoints(){const t=new Array,e=this._elevation,i=new Set,r=s=>{const o=`${s.x},${s.y},${s.z??0}`;i.has(o)||(i.add(o),t.push(new m(s.x,s.y,s.z??e)))};return this._geo.loops.forEach(s=>{if(s instanceof V){const o=s.numberOfVertices;for(let a=0;a<o;a++){const h=s.getPointAt(a);r({x:h.x,y:h.y,z:e})}return}s.curves.forEach(o=>{if(o instanceof Pt)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});else if(o instanceof ot)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e}),r({x:o.midPoint.x,y:o.midPoint.y,z:e});else if(o instanceof Qt){r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});const a=o.getPoint(.5);r({x:a.x,y:a.y,z:e})}})}),t}moveBoundaryGripPointAt(t,e){let i=0;const r=this._elevation,s=new Set,o=(a,h)=>{const l=`${a.x},${a.y},${a.z??0}`;s.has(l)||(s.add(l),i===t&&h(),i++)};this._geo.loops.forEach(a=>{if(a instanceof V){const h=a.numberOfVertices;for(let l=0;l<h;l++){const c=a.vertices[l];c&&o({x:c.x,y:c.y,z:r},()=>{or(a.vertices,l,e)})}return}a.curves.forEach(h=>{if(h instanceof Pt)o({x:h.startPoint.x,y:h.startPoint.y,z:r},()=>{h.startPoint.x+=e.x,h.startPoint.y+=e.y}),o({x:h.endPoint.x,y:h.endPoint.y,z:r},()=>{h.endPoint.x+=e.x,h.endPoint.y+=e.y});else if(h instanceof ot)o({x:h.startPoint.x,y:h.startPoint.y,z:r},()=>this.moveCircArc2dGripPoint(h,"start",e)),o({x:h.endPoint.x,y:h.endPoint.y,z:r},()=>this.moveCircArc2dGripPoint(h,"end",e)),o({x:h.midPoint.x,y:h.midPoint.y,z:r},()=>this.moveCircArc2dGripPoint(h,"mid",e));else if(h instanceof Qt){o({x:h.startPoint.x,y:h.startPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(h,"start",e)),o({x:h.endPoint.x,y:h.endPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(h,"end",e));const l=h.getPoint(.5);o({x:l.x,y:l.y,z:r},()=>this.moveEllipseArc2dGripPoint(h,"mid",e))}})})}moveCircArc2dGripPoint(t,e,i){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"mid":{const s=t.midPoint,o=new ot(t.startPoint,{x:s.x+i.x,y:s.y+i.y},t.endPoint);t.center=o.center,t.radius=o.radius,t.startAngle=o.startAngle,t.endAngle=o.endAngle,t.clockwise=o.clockwise;break}}}moveEllipseArc2dGripPoint(t,e,i){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"mid":{const s=t.getPoint(.5),o=s.x+i.x-t.center.x,a=s.y+i.y-t.center.y,h=Math.hypot(s.x-t.center.x,s.y-t.center.y),l=Math.hypot(o,a);if(h>0&&l>0){const c=l/h;t.majorAxisRadius*=c,t.minorAxisRadius*=c}break}}}subGetOsnapPoints(t,e,i,r){const s=this._elevation,o=[];if(this._geo.loops.forEach(a=>{var h;if(a instanceof V){const l=a,c=l.numberOfVertices;if(c===0)return;switch(t){case w.EndPoint:for(let u=0;u<c;u++){const g=l.getPointAt(u);r.push(new m(g.x,g.y,s))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const u=a.closed?c:c-1;for(let g=0;g<u;g++){const d=[];ci(l.getPointAt(g),l.getPointAt((g+1)%c),(h=l.vertices[g])==null?void 0:h.bulge,s,t,e,d),t===w.MidPoint?r.push(...d):o.push(...d)}break}}return}a.curves.forEach(l=>{if(l instanceof Pt){const c=[];ci(l.startPoint,l.endPoint,void 0,s,t,e,c),t===w.MidPoint?r.push(...c):t===w.Nearest||t===w.Perpendicular||t===w.Tangent?o.push(...c):r.push(...c)}else if(l instanceof ot)switch(t){case w.EndPoint:r.push(new m(l.startPoint.x,l.startPoint.y,s),new m(l.endPoint.x,l.endPoint.y,s));break;case w.MidPoint:r.push(new m(l.midPoint.x,l.midPoint.y,s));break;case w.Nearest:{const c=l.nearestPoint({x:e.x,y:e.y});o.push(new m(c.x,c.y,s));break}case w.Perpendicular:{l.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}case w.Tangent:{l.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}}else if(l instanceof Qt)switch(t){case w.EndPoint:r.push(new m(l.startPoint.x,l.startPoint.y,s),new m(l.endPoint.x,l.endPoint.y,s));break;case w.MidPoint:{const c=l.getPoint(.5);r.push(new m(c.x,c.y,s));break}case w.Nearest:{const c=l.nearestPoint({x:e.x,y:e.y});o.push(new m(c.x,c.y,s));break}case w.Perpendicular:{l.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}case w.Tangent:{l.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}}})}),(t===w.Nearest||t===w.Perpendicular||t===w.Tangent)&&o.length>0){const a=gt(e,o);r.length=0,a&&r.push(a)}}subWorldDraw(t){var s;this.updatePredefinedPatternDefinitionLines();const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.getRenderablePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(s=this.backgroundColor)==null?void 0:s.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},e.drawOrder=-1;const i=this.buildAreasFromLoops();if(i.length===0)return t.area(this._geo);if(i.length===1)return t.area(i[0]);const r=i.map(o=>t.area(o));return t.group(r)}transformBy(t){const e=t.elements,i=new Ge(e[0],e[4],e[12],e[1],e[5],e[13],0,0,1);this._geo.transform(i),this._elevation=new m(0,0,this._elevation).applyMatrix4(t).z;const r=new m(1,0,0).applyMatrix4(t),s=new m().applyMatrix4(t),o=new m(r).sub(s);if(o.length()>0){const a=Math.atan2(o.y,o.x);this._patternAngle=this.getEffectivePatternAngle()+a,this._gradientAngle+=a,this._patternScale=this.getEffectivePatternScale()*o.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops,i=this.getEffectivePatternName(),r=this.getEffectivePatternAngle(),s=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(i,s),t.writeSubclassMarker("AcDbHatch"),t.writePoint3d(10,{x:0,y:0,z:this.elevation}),t.writeVector3d(210,{x:0,y:0,z:1}),t.writeString(2,i||(this.isSolidFill?Jt:Eo)),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,this.getEffectiveAssociative()?1:0),t.writeInt16(91,e.length),e.forEach((o,a)=>{const h=a===0;if(o instanceof V){const l=o.vertices,c=l.some(g=>(g.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,c?1:0),t.writeInt16(73,o.closed?1:0),t.writeInt16(93,l.length);for(const g of l)t.writePoint2d(10,g),c&&t.writeDouble(42,g.bulge??0);t.writeInt16(97,0);return}if(o instanceof ir){const l=h?1:0;t.writeInt16(92,l),t.writeInt16(93,o.numberOfEdges);for(const c of o.curves){if(c instanceof Pt){t.writeInt16(72,1),t.writePoint2d(10,c.startPoint),t.writePoint2d(11,c.endPoint);continue}if(c instanceof ot){t.writeInt16(72,2),t.writePoint2d(10,c.center),t.writeDouble(40,c.radius),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof Qt){t.writeInt16(72,3),t.writePoint2d(10,c.center);const u=new P(c.majorAxisRadius*Math.cos(c.rotation),c.majorAxisRadius*Math.sin(c.rotation));t.writePoint2d(11,u);const g=c.majorAxisRadius===0?0:c.minorAxisRadius/c.majorAxisRadius;t.writeDouble(40,g),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof At){const u=c.knots,g=c.controlPoints,d=c.weights,p=c.fitPoints,f=d.some(y=>y!==1);t.writeInt16(72,4),t.writeInt16(94,c.degree),t.writeInt16(73,f?1:0),t.writeInt16(74,c.closed?1:0),t.writeInt16(95,u.length),t.writeInt16(96,g.length),u.forEach(y=>t.writeDouble(40,y)),g.forEach((y,_)=>{t.writePoint2d(10,y),f&&t.writeDouble(42,d[_]??1)}),t.writeInt16(97,(p==null?void 0:p.length)??0),p==null||p.forEach(y=>t.writePoint2d(11,y))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,r),t.writeDouble(41,s),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(o=>{t.writeAngle(53,o.angle),t.writePoint2d(43,o.base),t.writePoint2d(45,o.offset),t.writeInt16(79,o.dashLengths.length),o.dashLengths.forEach(a=>t.writeDouble(49,a))}),this.isGradient&&(t.writeInt16(450,this._hatchObjectType),t.writeInt16(451,0),t.writeInt16(452,this._gradientOneColorMode?1:0),t.writeAngle(460,this._gradientAngle),t.writeDouble(461,this._gradientShift),t.writeString(470,this.gradientName)),t.writeInt16(98,0),this}};gr.typeName="Hatch";let ui=gr;class Ko{constructor(t){this.db=t}createDefaultLayer(){const t=new k;return t.colorIndex=7,this.db.tables.layerTable.add(new rr({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new te({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new te({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new te({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new sr({name:W,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new be({name:W,dimtxsty:W}))}createDefaultLayout(){const t=new Ei;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new ui;e.patternName=Jt;const i=new ir;i.add(new Pt({x:0,y:0},{x:-1,y:.125})),i.add(new Pt({x:-1,y:.125},{x:-1,y:-.125})),i.add(new Pt({x:-1,y:-.125},{x:0,y:0})),e.add(i);const r=new et;r.name="_CAXARROW",r.appendEntity(e),this.db.tables.blockTable.add(r)}}}const hn=Math.PI/200;class Zo{constructor(t){this.database=t}formatLength(t,e){const i=this.createContext(e);return ae(t,i)}formatPoint2d(t,e){const i=this.createContext(e);return`${ae(t.x,i)}, ${ae(t.y,i)}`}formatPoint3d(t,e){const i=this.createContext(e);return`${ae(t.x,i)}, ${ae(t.y,i)}, ${ae(t.z,i)}`}formatAngle(t,e){const i=this.createContext(e),s=(e==null?void 0:e.applyAngbaseAngdir)??!0?yc(t,this.database.angbase,this.database.angdir):M.normalizeAngle(t);return fc(s,i)}createContext(t){return{lunits:this.database.lunits,luprec:ze(this.database.luprec),insunits:this.database.insunits,unitmode:this.database.unitmode,measurement:this.database.measurement,aunits:this.database.aunits,auprec:ze(this.database.auprec),showUnits:(t==null?void 0:t.showUnits)??!1,showApproximate:(t==null?void 0:t.showApproximate)??!1}}}function ae(n,t){let e;switch(t.lunits){case D.Scientific:e=Wi(Sc(n,t.luprec),t);break;case D.Engineering:e=Lc(n,t);break;case D.Architectural:e=Mc(n,t);break;case D.Fractional:e=Wi(Ic(n,t),t);break;case D.WindowsDesktop:case D.Decimal:default:e=Wi(Le(n,t.luprec),t)}return Qo(e,mc(n,t),t)}function fc(n,t){let e;switch(t.aunits){case at.DegreesMinutesSeconds:e=ea(n,t);break;case at.Gradians:e=Cc(n,t);break;case at.Radians:e=Tc(n,t);break;case at.SurveyorsUnits:e=Oc(n,t);break;case at.DecimalDegrees:default:e=Ec(n,t)}return Qo(e,_c(n,t),t)}function yc(n,t,e){let i=n-t;return e===1&&(i=-i),M.normalizeAngle(i)}function lr(n){const t=n.showUnits?'"':"";return n.unitmode===1?{feetInchSeparator:"",fractionSeparator:"-",inchSuffix:t}:{feetInchSeparator:"-",fractionSeparator:" ",inchSuffix:t}}function ze(n,t=0,e=8){return Number.isFinite(n)?Math.max(t,Math.min(e,Math.round(n))):t}function Se(n){return Object.is(n,-0)?0:n}function Qo(n,t,e){return!e.showApproximate||!t?n:`~ ${n}`}function mc(n,t){if(!Number.isFinite(n))return!1;const e=wc(n,t);return hr(n,e)}function _c(n,t){if(!Number.isFinite(n))return!1;if(t.aunits===at.SurveyorsUnits)return xc(n,t.auprec);const e=bc(n,t);return hr(n,e)}function xc(n,t){const i=((90-M.radToDeg(n))%360+360)%360,r=ia(i),s=Math.min(Math.abs(i-r.base),Math.abs(r.base+90-i)),o=M.degToRad(s),a=Jo(o,t);return hr(o,a)}function wc(n,t){const e=Se(n);switch(t.lunits){case D.Scientific:return vc(e,t.luprec);case D.Engineering:case D.Architectural:case D.Fractional:return Pc(e,t);case D.WindowsDesktop:case D.Decimal:default:return me(e,t.luprec)}}function bc(n,t){const e=Se(n);switch(t.aunits){case at.DegreesMinutesSeconds:return Jo(e,t.auprec);case at.Gradians:return me(e/hn,t.auprec)*hn;case at.Radians:return me(e,t.auprec);case at.DecimalDegrees:default:return M.degToRad(me(M.radToDeg(e),t.auprec))}}function me(n,t){if(!Number.isFinite(n))return 0;const e=10**t;return Math.round(Se(n)*e)/e}function vc(n,t){if(!Number.isFinite(n))return 0;const e=Se(n);if(e===0)return 0;const i=e.toExponential(t);return Number(i)}function Pc(n,t){if(!Number.isFinite(n))return 0;const e=n<0?-1:1,i=Math.abs(n),r=Math.floor(i/12),s=i-r*12;if(t.lunits===D.Architectural||t.lunits===D.Fractional){const o=1<<ze(t.luprec,0,8),a=Ac(s,o);return e*(r*12+a)}return e*(r*12+me(s,t.luprec))}function Ac(n,t){const e=Math.floor(n),i=n-e,r=Math.round(i*t);return r>=t?e+1:e+r/t}function Jo(n,t){const e=M.radToDeg(n),i=e<0?-1:1,r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),h=me((o-a)*60,t),l=s+a/60+h/3600;return M.degToRad(i*l)}function hr(n,t){if(n===t)return!1;const e=Math.max(Math.abs(n),Math.abs(t),1);return Math.abs(n-t)>e*Number.EPSILON*8}function Le(n,t){if(!Number.isFinite(n))return"0";const e=Se(n);if(Number.isInteger(e)&&t===0)return String(e);const r=e.toFixed(t).replace(/\.?0+$/,"");return r===""||r==="-"?"0":r}function Sc(n,t){if(!Number.isFinite(n))return"0";const e=Se(n);if(e===0)return"0";const i=e.toExponential(t).match(/^(.+)e([+-])(\d+)$/i);if(!i)return"0";const[,r,s,o]=i,a=o.length<2?o.padStart(2,"0"):o;return`${r}E${s}${a}`.toUpperCase()}function Lc(n,t){if(!Number.isFinite(n))return"0";const e=lr(t),i=n<0?"-":"",r=Math.abs(n),s=Math.floor(r/12),o=r-s*12,a=Le(o,t.luprec);return s===0?`${i}${a}${e.inchSuffix}`:`${i}${s}'${e.feetInchSeparator}${a}${e.inchSuffix}`}function Mc(n,t){if(!Number.isFinite(n))return"0";const e=lr(t),i=n<0?"-":"",r=Math.abs(n),s=Math.floor(r/12),o=r-s*12,a=1<<ze(t.luprec,0,8),h=ta(o,a,e.fractionSeparator);return s===0?`${i}${h}${e.inchSuffix}`:`${i}${s}'${e.feetInchSeparator}${h}${e.inchSuffix}`}function Ic(n,t){if(!Number.isFinite(n))return"0";const e=lr(t),i=n<0?"-":"",r=Math.abs(n),s=1<<ze(t.luprec,0,8);return`${i}${ta(r,s,e.fractionSeparator)}`}function ta(n,t,e){const i=Math.floor(n),r=n-i;let s=Math.round(r*t);if(s>=t)return String(i+1);if(s===0)return String(i);const o=Nc(s,t);s/=o;const a=t/o,h=`${s}/${a}`;return i===0?h:`${i}${e}${h}`}function Ec(n,t){const e=M.radToDeg(n);return`${Le(e,t.auprec)}${t.showUnits?"°":""}`}function Tc(n,t){return`${Le(n,t.auprec)}${t.showUnits?" rad":""}`}function Cc(n,t){const e=n/hn;return`${Le(e,t.auprec)}${t.showUnits?"g":""}`}function ea(n,t){const e=M.radToDeg(n),i=e<0?"-":"",r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),h=(o-a)*60,l=Le(h,t.auprec),c=t.showUnits?'"':"";return`${i}${s}d${a}'${l}${c}`}function Oc(n,t){const i=((90-M.radToDeg(n))%360+360)%360,r=ia(i),s=Math.min(Math.abs(i-r.base),Math.abs(r.base+90-i)),a=ea(M.degToRad(s),t).replace(/^-/,"");return`${r.prefix} ${a} ${r.suffix}`.trim()}function ia(n){return n<90?{prefix:"N",suffix:"E",base:0}:n<180?{prefix:"S",suffix:"E",base:90}:n<270?{prefix:"S",suffix:"W",base:180}:{prefix:"N",suffix:"W",base:270}}function Wi(n,t){if(!t.showUnits||t.lunits===D.Engineering||t.lunits===D.Architectural)return n;const e=kc(t.insunits,t.measurement);return e?`${n}${e}`:n}function kc(n,t){return n===j.Undefined?t===0?'"':" mm":Yo(n)?Yc(n):Xo(n)?Xc(n):""}function Yc(n){switch(n){case j.Millimeters:return" mm";case j.Centimeters:return" cm";case j.Meters:return" m";case j.Kilometers:return" km";case j.Decimeters:return" dm";case j.Microns:return" µm";case j.Nanometers:return" nm";default:return""}}function Xc(n){switch(n){case j.Inches:case j.Microinches:case j.Mils:case j.USSurveyInch:return'"';case j.Feet:case j.USSurveyFeet:return"'";case j.Miles:case j.USSurveyMile:return" mi";case j.Yards:case j.USSurveyYard:return" yd";default:return""}}function Nc(n,t){let e=Math.abs(n),i=Math.abs(t);for(;i!==0;){const r=i;i=e%i,e=r}return e||1}class Kt extends _t{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,i=>this.hasId(i)),this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((i,r)=>{i===e&&(this._recordsByName.delete(r),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:r}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new He(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const[e,i]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,i.objectId);return this}}const Oi=192,Fe=193,ki=194,Yi=195,na=200;function si(n){if(n.isByBlock)return Fe<<24>>0;if(n.isByLayer)return Oi<<24>>0;const t=n.colorIndex;if(t!=null&&t>0&&t<256)return(Yi<<24|t&255)>>0;const e=n.RGB;return e!=null?(ki<<24|e&16777215)>>0:Fe<<24>>0}function Bc(n){const t=new k(exports.AcCmColorMethod.ByBlock);switch(n>>>24&255){case Oi:t.setByLayer();break;case Fe:case na:t.setByBlock();break;case Yi:t.colorIndex=n&255;break;case ki:t.setRGBValue(n&16777215);break;default:n===256?t.setByLayer():n===0?t.setByBlock():n>0&&n<256&&(t.colorIndex=n);break}return t}class ra extends _t{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 k(exports.AcCmColorMethod.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new k(exports.AcCmColorMethod.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new k(exports.AcCmColorMethod.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(t){this._unknown1=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(t){this._drawMLeaderOrderType=t}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(t){this._drawLeaderOrderType=t}get bitFlags(){return this._bitFlags}set bitFlags(t){this._bitFlags=t}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(t){this._maxLeaderSegmentsPoints=t}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(t){this.maxLeaderSegmentsPoints=t}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(t){this._firstSegmentAngleConstraint=t}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(t){this._secondSegmentAngleConstraint=t}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor.copy(t)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get enableLanding(){return this._enableLanding}set enableLanding(t){this._enableLanding=t}get landingEnabled(){return this.enableLanding}set landingEnabled(t){this.enableLanding=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get enableDogleg(){return this._enableDogleg}set enableDogleg(t){this._enableDogleg=t}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(t){this.enableDogleg=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get description(){return this._description}set description(t){this._description=t}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(t){this._arrowSymbolId=t}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(t){this.arrowSymbolId=t}get arrowSize(){return this._arrowSize}set arrowSize(t){this._arrowSize=t}get arrowheadSize(){return this.arrowSize}set arrowheadSize(t){this.arrowSize=t}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(t){this._defaultMTextContents=t}get defaultMText(){return this.defaultMTextContents}set defaultMText(t){this.defaultMTextContents=t}get textString(){return this.defaultMTextContents}set textString(t){this.defaultMTextContents=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textStyle(){return this.textStyleId}set textStyle(t){this.textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor.copy(t)}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get enableFrameText(){return this._enableFrameText}set enableFrameText(t){this._enableFrameText=t}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(t){this.enableFrameText=t}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(t){this._textAlignAlwaysLeft=t}get alignSpace(){return this._alignSpace}set alignSpace(t){this._alignSpace=t}get blockId(){return this._blockId}set blockId(t){this._blockId=t}get blockContentId(){return this.blockId}set blockContentId(t){this.blockId=t}get blockColor(){return this._blockColor}set blockColor(t){this._blockColor.copy(t)}get blockContentColor(){return this.blockColor}set blockContentColor(t){this.blockColor=t}get blockScale(){return this._blockScale.clone()}set blockScale(t){this._blockScale.copy(t)}get blockContentScale(){return this.blockScale}set blockContentScale(t){this.blockScale=t}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(t){this._enableBlockScale=t}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(t){this.enableBlockScale=t}get blockRotation(){return this._blockRotation}set blockRotation(t){this._blockRotation=t}get blockContentRotation(){return this.blockRotation}set blockContentRotation(t){this.blockRotation=t}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(t){this._enableBlockRotation=t}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(t){this.enableBlockRotation=t}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(t){this._blockConnectionType=t}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(t){this.blockConnectionType=t}get scale(){return this._scale}set scale(t){this._scale=t}get scaleFactor(){return this.scale}set scaleFactor(t){this.scale=t}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(t){this._overwritePropChanged=t}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(t){this.overwritePropChanged=t}get annotative(){return this._annotative}set annotative(t){this._annotative=t}get breakSize(){return this._breakSize}set breakSize(t){this._breakSize=t}get breakGapSize(){return this.breakSize}set breakGapSize(t){this.breakSize=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(t){this._bottomTextAttachmentType=t}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(t){this.bottomTextAttachmentType=t}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(t){this._topTextAttachmentType=t}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(t){this.topTextAttachmentType=t}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(t){this._extendLeaderToText=t}get unknown2(){return this._unknown2}set unknown2(t){this._unknown2=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeaderStyle"),t.writeInt16(179,this.unknown1),t.writeInt16(170,this.contentType),t.writeInt16(171,this.drawMLeaderOrderType),t.writeInt16(172,this.drawLeaderOrderType),t.writeInt32(90,this.maxLeaderSegmentsPoints),t.writeDouble(40,this.firstSegmentAngleConstraint),t.writeDouble(41,this.secondSegmentAngleConstraint),t.writeInt16(173,this.leaderLineType),t.writeInt32(91,si(this.leaderLineColor)),t.writeHandle(340,this.leaderLineTypeId),t.writeInt32(92,this.leaderLineWeight),t.writeBoolean(290,this.enableLanding),t.writeDouble(42,this.landingGap),t.writeBoolean(291,this.enableDogleg),t.writeDouble(43,this.doglegLength),t.writeString(3,this.description),t.writeHandle(341,this.arrowSymbolId),t.writeDouble(44,this.arrowSize),t.writeString(300,this.defaultMTextContents),t.writeHandle(342,this.textStyleId),t.writeInt16(174,this.textLeftAttachmentType),t.writeInt16(175,this.textAngleType),t.writeInt16(176,this.textAlignmentType),t.writeInt16(178,this.textRightAttachmentType),t.writeInt32(93,si(this.textColor)),t.writeDouble(45,this.textHeight),t.writeBoolean(292,this.enableFrameText),t.writeBoolean(297,this.textAlignAlwaysLeft),t.writeDouble(46,this.alignSpace),t.writeHandle(343,this.blockId),t.writeInt32(94,si(this.blockColor)),t.writeDouble(47,this._blockScale.x),t.writeDouble(49,this._blockScale.y),t.writeDouble(140,this._blockScale.z),t.writeBoolean(293,this.enableBlockScale),t.writeDouble(141,this.blockRotation),t.writeBoolean(294,this.enableBlockRotation),t.writeInt16(177,this.blockConnectionType),t.writeDouble(142,this.scale),t.writeBoolean(295,this.overwritePropChanged),t.writeBoolean(296,this.annotative),t.writeDouble(143,this.breakSize),t.writeInt16(271,this.textAttachmentDirection),t.writeInt16(272,this.bottomTextAttachmentType),t.writeInt16(273,this.topTextAttachmentType),t.writeBoolean(298,this.unknown2),this}}class sa extends _t{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new k,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get flags(){return this._flags}set flags(t){this._flags=t}get description(){return this._description}set description(t){this._description=t}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor.copy(t)}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=t}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=t}get elementCount(){return this._elements.length}get elements(){return this._elements.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}set elements(t){this._elements=t.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}addElement(t){this._elements.push({offset:t.offset,color:t.color.clone(),lineType:t.lineType})}removeElementAt(t){if(t<0||t>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(t,1)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMlineStyle"),t.writeString(2,this.styleName),t.writeInt16(70,this.flags),t.writeString(3,this.description),t.writeCmColor(this.fillColor),t.writeDouble(51,this.startAngle),t.writeDouble(52,this.endAngle),t.writeInt16(71,this.elementCount),this._elements.forEach(e=>{t.writeDouble(49,e.offset),t.writeCmColor(e.color),t.writeString(6,e.lineType)}),this}}class Yt extends _t{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,i=>this.hasId(i));const e=this.normalizeName(t.name);e&&this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),i=this._recordsByName.get(e);return i?(this._recordsById.delete(i.objectId),this._recordsByName.delete(e),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(this.normalizeName(e.name)),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(t=!1){return new He(t?this._recordsById:this._recordsByName)}normalizeName(t){return t}get dxfEntryCount(){return this.numEntries}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.dxfEntryCount),this}}class oa extends Yt{constructor(t){super(t)}get modelSpace(){let t=this.getAt(et.MODEL_SPACE_NAME);return t||(t=new et,t.name=et.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const i=e.getIdAt(t);if(i)return i}}removeEntity(t){let e=!1;for(const i of this.database.tables.blockTable.newIterator())if(i.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(et.isModelSapceName(t))e=et.MODEL_SPACE_NAME;else if(et.isPaperSapceName(t)){const i=et.PAPER_SPACE_NAME_PREFIX,r=t.substring(i.length);e=i+r}return e}}class aa extends Yt{constructor(t){super(t)}}class la extends Yt{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class ha extends Yt{constructor(t){super(t)}}class ca extends Yt{constructor(t){super(t)}get dxfEntryCount(){return this._recordsById.size}resolveAt(t){this.database.ensureTextStyleDefaults();const e=[],i=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};i(t),i(this.database.textstyle),i(W),i("STANDARD");for(const r of e){const s=this.getAt(r);if(s)return s;const o=r.toUpperCase();for(const a of this.newIterator())if(a.name.toUpperCase()===o)return a}return this.newIterator().next().value??void 0}get shapeFiles(){return this.newIterator(!0).toArray().filter(t=>t.isShapeFile)}get fonts(){const t=new Set;for(const e of this.newIterator()){const i=vt.normalizeFontFileName(e.fileName);i&&t.add(i);const r=vt.normalizeFontFileName(e.bigFontFileName);r&&t.add(r)}return Array.from(t)}}class ua extends Yt{constructor(t){super(t)}}const Rc=()=>({center:new P,viewDirectionFromTarget:new m(0,0,1),viewTarget:new m(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:exports.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new m(0,0,0),ucsXAxis:new m(1,0,0),ucsYAxis:new m(0,1,0),orthographicType:exports.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:exports.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0,aspectRatio:void 0});class cr extends Ut{constructor(){super(),this._gsView=Rc(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(t){this._gsView.viewDirectionFromTarget.copy(t)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(t){this._gsView.viewTarget.copy(t)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(t){this._gsView.viewHeight=t}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(t){this._gsView.viewTwistAngle=t}get lensLength(){return this._gsView.lensLength}set lensLength(t){this._gsView.lensLength=t}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(t){this._gsView.frontClippingPlane=t}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(t){this._gsView.backClippingPlane=t}get renderMode(){return this._gsView.renderMode}set renderMode(t){this._gsView.renderMode=t}get viewMode(){return this._gsView.viewMode}set viewMode(t){this._gsView.viewMode=t}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(t){this._gsView.ucsIconSetting=t}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(t){this._gsView.ucsOrigin.copy(t)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(t){this._gsView.ucsXAxis.copy(t)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(t){this._gsView.ucsYAxis.copy(t)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(t){this._gsView.orthographicType=t}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(t){this._gsView.shadePlotSetting=t}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(t){this._gsView.shadePlotObjectId=t}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(t){this._gsView.visualStyleObjectId=t}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(t){this._gsView.isDefaultLightingOn=t}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(t){this._gsView.defaultLightingType=t}get brightness(){return this._gsView.brightness}set brightness(t){this._gsView.brightness=t}get contrast(){return this._gsView.contrast}set contrast(t){this._gsView.contrast=t}get ambientColor(){return this._gsView.ambientColor}set ambientColor(t){this._gsView.ambientColor=t}get aspectRatio(){return this._gsView.aspectRatio}set aspectRatio(t){this._gsView.aspectRatio=t}}const ds=2,zc=.45,Fc=1e5;function Vc(n){var i;const t=n,e=t.aspectRatio??((i=t.gsView)==null?void 0:i.aspectRatio);return Number.isFinite(e)?e:void 0}function jc(n,t){if(Number.isFinite(t)&&t>0)return t;const e=Vc(n);return e!=null&&e>0?e:1}function Gc(n,t){const e=Math.max(n.min.x,t.min.x),i=Math.max(n.min.y,t.min.y),r=Math.min(n.max.x,t.max.x),s=Math.min(n.max.y,t.max.y);return e>=r||i>=s?0:(r-e)*(s-i)}function gs(n){return{x:(n.min.x+n.max.x)/2,y:(n.min.y+n.max.y)/2}}function Dc(n){if(!n||n.isEmpty())return!1;const t=n.max.x-n.min.x,e=n.max.y-n.min.y;return t>0&&e>0}class ee extends cr{static isActiveVportName(t){return t.toLowerCase()===we.toLowerCase()}constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new P(0,0),this._upperRightCorner=new P(1,1),this._snapBase=new P(0,0),this._snapAngle=0,this._snapSpacing=new P(0,0),this._standardFlag=0,this._gridSpacing=new P,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}modelViewBox(t){const e=this.centerPoint,i=this.viewHeight;if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(i)||i<=0)return;const r=jc(this,t),s=i*r,o=i/2,a=s/2;return new Q().expandByPoint({x:e.x-a,y:e.y-o}).expandByPoint({x:e.x+a,y:e.y+o})}static isModelViewBoxUsable(t,e){if(t.isEmpty()||e.isEmpty())return!1;const i=t.max.x-t.min.x,r=t.max.y-t.min.y,s=e.max.x-e.min.x,o=e.max.y-e.min.y;if(i<=0||r<=0||s<=0||o<=0||i>s*ds||r>o*ds)return!1;const a=Math.max(s,o)*zc,h=gs(t),l=gs(e);if(Math.hypot(h.x-l.x,h.y-l.y)>a)return!1;const u=i*r,g=Gc(t,e);return!(g<=0||g/u<.25)}resolveModelViewBox(t,e){const i=this.modelViewBox(t);if(!(!i||!ee.isModelViewBoxStructurallyValid(i))){if(Dc(e)){if(!ee.isModelViewBoxUsable(i,e))return}else if(!ee.isModelViewBoxPlausibleWithoutExtents(i))return;return i}}static isModelViewBoxStructurallyValid(t){if(t.isEmpty())return!1;const e=t.max.x-t.min.x,i=t.max.y-t.min.y;return Number.isFinite(e)&&Number.isFinite(i)&&e>0&&i>0}static isModelViewBoxPlausibleWithoutExtents(t){const e=t.max.x-t.min.x,i=t.max.y-t.min.y;return Math.max(e,i)<=Fc}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),t.writeDouble(40,this.gsView.viewHeight),this.gsView.aspectRatio!=null&&Number.isFinite(this.gsView.aspectRatio)&&t.writeDouble(41,this.gsView.aspectRatio),t.writeDouble(45,this.gsView.viewHeight),t.writePoint2d(10,this.lowerLeftCorner),t.writePoint2d(11,this.upperRightCorner),t.writePoint2d(12,this.center),t.writePoint2d(13,this.snapBase),t.writePoint2d(14,this.snapIncrements),t.writePoint2d(15,this.gridIncrements),t.writeInt16(70,this.standardFlag),t.writeInt16(71,this.circleSides),t.writeDouble(42,this.gsView.lensLength),t.writePoint3d(16,this.gsView.viewDirectionFromTarget),t.writePoint3d(17,this.gsView.viewTarget),t.writeAngle(50,this.snapAngle),t.writeAngle(51,this.gsView.viewTwistAngle),t.writeInt16(61,this.gridMajor),t.writeInt16(281,this.backgroundObjectId?1:0),t.writeObjectId(332,this.backgroundObjectId),this}}class da extends Yt{constructor(t){super(t)}normalizeName(t){return ee.isActiveVportName(t)?we:t.toUpperCase()}getActiveVport(){return this.getAt(we)}getActiveVportBox(t,e){const i=this.getActiveVport();return i==null?void 0:i.resolveModelViewBox(t,e)}}class ga extends Yt{constructor(t){super(t)}}class cn extends Ut{constructor(t){super(),this.name=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}class pa extends Kt{getBtrIdAt(t){for(const[e,i]of this._recordsByName)if(i.blockTableRecordId==t)return i}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class Hc extends _t{constructor(){super({objectId:"0"}),this._drawNoPlotLayers=!0,this.events={dictObjetSet:new U,dictObjectErased:new U,entityAppended:new U,entityModified:new U,entityErased:new U,layerAppended:new U,layerModified:new U,layerErased:new U,openProgress:new U},this._version=new yt("AC1014"),this._angbase=0,this._angdir=0,this._aunits=at.DecimalDegrees,this._auprec=0,this._lunits=D.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new k,this._celtype=Z,this._celweight=exports.AcGiLineWeight.ByLayer,this._cetransparency=new $,this._clayer="0",this._cmlstyle=Vt,this._cmlscale=1,this._cmleaderstyle=jt,this._hpbackgroundcolor=new k(exports.AcCmColorMethod.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new $,this._textstyle=W,this._extents=new C,this._insunits=j.Millimeters,this._unitmode=0,this._measurement=1,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._orthomode=0,this._maxHandle=0,this._tables={appIdTable:new ga(this),blockTable:new oa(this),dimStyleTable:new aa(this),linetypeTable:new ha(this),textStyleTable:new ca(this),viewTable:new ua(this),layerTable:new la(this),viewportTable:new da(this)},this._objects={dictionary:new Kt(this),imageDefinition:new Kt(this),layout:new pa(this),mleaderStyle:new Kt(this),mlineStyle:new Kt(this),xrecord:new Kt(this)}}get tables(){return this._tables}get objects(){return this._objects}get formatter(){return this._formatter??(this._formatter=new Zo(this))}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const i=t.getAttrWithoutException("objectId");!i||t.isTemp||e&&e(i)?t.objectId=this.generateHandle():this.updateMaxHandle(i)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar(b.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get auprec(){return this._auprec}set auprec(t){this.updateSysVar(b.AUPREC,this._auprec,t??0,e=>{this._auprec=e})}get lunits(){return this._lunits}set lunits(t){this.updateSysVar(b.LUNITS,this._lunits,t??D.Decimal,e=>{this._lunits=e})}get luprec(){return this._luprec}set luprec(t){this.updateSysVar(b.LUPREC,this._luprec,t??4,e=>{this._luprec=e})}get version(){return this._version}set version(t){this.updateSysVar(b.ACADVER,this._version,new yt(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(b.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get unitmode(){return this._unitmode}set unitmode(t){this.updateSysVar(b.UNITMODE,this._unitmode,t??0,e=>{this._unitmode=e})}get measurement(){return this._measurement}set measurement(t){this.updateSysVar(b.MEASUREMENT,this._measurement,t??1,e=>{this._measurement=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(b.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}get drawNoPlotLayers(){return this._drawNoPlotLayers}isLayerDrawable(t){if(this._drawNoPlotLayers)return!0;const e=this.tables.layerTable.getAt(t);return e==null||e.isPlottable}set lwdisplay(t){this.updateSysVar(b.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(b.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(b.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celtype(){return this._celtype}set celtype(t){const e=this.normalizeLinetypeName(t??Z);this.updateSysVar(b.CELTYPE,this._celtype,e,i=>{this._celtype=i})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(b.CELWEIGHT,this._celweight,t??exports.AcGiLineWeight.ByLayer,e=>{this._celweight=e})}get cetransparency(){return this._cetransparency}set cetransparency(t){this.updateSysVar(b.CETRANSPARENCY,this._cetransparency,t??new $,e=>{this._cetransparency=e.clone()})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(b.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get cmlstyle(){return this._cmlstyle}set cmlstyle(t){this.updateSysVar(b.CMLSTYLE,this._cmlstyle,t??Vt,e=>{this._cmlstyle=e})}get cmlscale(){return this._cmlscale}set cmlscale(t){this.updateSysVar(b.CMLSCALE,this._cmlscale,t??1,e=>{this._cmlscale=e})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(t){this.updateSysVar(b.CMLEADERSTYLE,this._cmleaderstyle,t??jt,e=>{this._cmleaderstyle=e})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(t){this.updateSysVar(b.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,t??new k(exports.AcCmColorMethod.None),e=>{this._hpbackgroundcolor=e.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(t){this.updateSysVar(b.HPCOLOR,this._hpcolor,t??this._cecolor,e=>{this._hpcolor=e.clone()})}get hplayer(){return this._hplayer}set hplayer(t){this.updateSysVar(b.HPLAYER,this._hplayer,t??".",e=>{this._hplayer=e})}get hptransparency(){return this._hptransparency}set hptransparency(t){this.updateSysVar(b.HPTRANSPARENCY,this._hptransparency,t??new $,e=>{this._hptransparency=e.clone()})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(b.TEXTSTYLE,this._textstyle,t??W,e=>{this._textstyle=e})}get angbase(){return this._angbase}set angbase(t){this.updateSysVar(b.ANGBASE,this._angbase,t??0,e=>{this._angbase=e})}get angdir(){return this._angdir}set angdir(t){this.updateSysVar(b.ANGDIR,this._angdir,t??0,e=>{this._angdir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent(b.EXTMAX,e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent(b.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(b.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(b.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(b.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}get orthomode(){return this._orthomode}set orthomode(t){this.updateSysVar(b.ORTHOMODE,this._orthomode,t??0,e=>{this._orthomode=e})}async read(t,e,i=Ce.DXF){const r=wt.instance.get(i);if(r==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),this._drawNoPlotLayers=(e==null?void 0:e.drawNoPlotLayers)??!0,await r.read(t,this,e&&e.minimumChunkSize||10,async(s,o,a,h)=>{if(this.events.openProgress.dispatch({database:this,percentage:s,stage:"CONVERSION",subStage:o,subStageStatus:a,data:h}),e&&e.fontLoader&&o=="FONT"&&a=="END"){const l=h||this.tables.textStyleTable.fonts;await e.fontLoader.load(l)}},e==null?void 0:e.timeout,e==null?void 0:e.sysVars),this.ensureDatabaseDefaults()}async openUri(t,e){var d;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const i=await fetch(t);if(!i.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${i.status}'!`);const r=i.headers.get("content-length"),s=r?parseInt(r,10):null;let o=0;const a=(d=i.body)==null?void 0:d.getReader();if(!a)throw new Error("Failed to get response reader");const h=[];for(;;){const{done:p,value:f}=await a.read();if(p)break;if(h.push(f),o+=f.length,s!==null){const y=Math.round(o/s*100);this.events.openProgress.dispatch({database:this,percentage:y,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const l=new Uint8Array(o);let c=0;for(const p of h)l.set(p,c),c+=p.length;const g=this.getFileNameFromUri(t).toLowerCase().split(".").pop();g==="dwg"?await this.read(l.buffer,e,Ce.DWG):g==="dxf"?await this.read(l.buffer,e,Ce.DXF):await this.read(l.buffer,e,g),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,i=this.version.name,r=!1){this.ensureDatabaseDefaults();const s=i instanceof yt?i:new yt(i),o=new Ts({database:this,precision:e,version:s});return this.writeDxfHeaderSection(o),this.writeDxfTablesSection(o,s),this.writeDxfBlocksSection(o),this.writeDxfEntitiesSection(o),this.writeDxfObjectsSection(o),o.writeStart("EOF"),o.toString()}async regen(){await new Ro(this).read(null,this,500,async(e,i,r,s)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:i,subStageStatus:r,data:s})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Ko(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureEntityStyleDefaults(t){var e;if(t.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||Vt);return}if(t.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||jt);return}if(t.dxfTypeName==="HATCH"){const i=t;(e=i.applyPatternDefaultsFromSysVars)==null||e.call(i,this)}}ensureTextStyleDefaults(){this.hasDefaultTextStyle()||this.tables.textStyleTable.add(new sr({name:W,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}hasDefaultTextStyle(){const t=[W,"STANDARD"];for(const e of t)if(this.tables.textStyleTable.has(e))return!0;for(const e of this.tables.textStyleTable.newIterator())if(e.name.toUpperCase()===W.toUpperCase())return!0;return!1}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new k;e.colorIndex=7,this.tables.layerTable.add(new rr({name:"0",standardFlags:0,linetype:Dt,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(St)||this.tables.linetypeTable.add(new te({name:St,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Z)||this.tables.linetypeTable.add(new te({name:Z,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Dt)||this.tables.linetypeTable.add(new te({name:Dt,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.ensureTextStyleDefaults(),this.tables.dimStyleTable.has(W)||this.tables.dimStyleTable.add(new be({name:W,dimtxsty:W})),!this.tables.viewportTable.has(we)){const e=new ee;e.name=we,this.tables.viewportTable.add(e)}this.ensureMLineStyle(this._cmlstyle||Vt),this.ensureMLeaderStyle(this._cmleaderstyle||jt);const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new Ei;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=t.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(e.layoutName,e),t.layoutId=e.objectId}this.tables.appIdTable.has(ln)||this.tables.appIdTable.add(new cn(ln)),this.tables.appIdTable.has(an)||this.tables.appIdTable.add(new cn(an))}ensureMLineStyle(t){const e=this.objects.mlineStyle,i=t.trim();if(!i||e.getAt(i))return;for(const[s,o]of e.entries())if(s.toUpperCase()===i.toUpperCase()||o.styleName.toUpperCase()===i.toUpperCase())return;const r=new sa;r.styleName=i,r.elements=[{offset:.5,color:new k().setByLayer(),lineType:Z},{offset:-.5,color:new k().setByLayer(),lineType:Z}],e.setAt(i,r)}ensureMLeaderStyle(t){const e=this.objects.mleaderStyle,i=t.trim();if(!i||e.getAt(i))return;for(const[a]of e.entries())if(a.toUpperCase()===i.toUpperCase())return;const r=new ra;r.unknown1=2,r.maxLeaderSegmentsPoints=2,r.leaderLineColor=new k().setByBlock(),r.textColor=new k().setByBlock(),r.blockColor=new k().setByBlock(),r.alignSpace=4,r.breakSize=3.75,r.enableBlockRotation=!0,r.unknown2=!1;const s=this.tables.linetypeTable.getAt(St);r.leaderLineTypeId=s==null?void 0:s.objectId;const o=this.tables.textStyleTable.getAt(W);r.textStyleId=o==null?void 0:o.objectId,e.setAt(i,r)}writeDxfHeaderSection(t){var e;t.startSection("HEADER"),t.writeString(9,"$ACADVER"),t.writeString(1,((e=t.version)==null?void 0:e.name)??this.version.name),t.writeString(9,"$HANDSEED"),t.writeString(5,t.nextHandle.toString(16).toUpperCase()),t.version!=null&&t.version.value>=27&&(t.writeString(9,"$DWGCODEPAGE"),t.writeString(3,"UTF-8")),t.writeString(9,"$INSUNITS"),t.writeInt16(70,this.insunits),t.writeString(9,"$LUNITS"),t.writeInt16(70,this.lunits),t.writeString(9,"$LUPREC"),t.writeInt16(70,this.luprec),t.writeString(9,"$UNITMODE"),t.writeInt16(70,this.unitmode),t.writeString(9,"$MEASUREMENT"),t.writeInt16(70,this.measurement),t.writeString(9,"$LTSCALE"),t.writeDouble(40,this.ltscale),t.writeString(9,"$LWDISPLAY"),t.writeInt16(70,this.lwdisplay?1:0),t.writeString(9,"$CLAYER"),t.writeString(8,this.clayer),t.writeString(9,"$CELTYPE"),t.writeString(6,this.celtype),this.cetransparency.isInvalid||(t.writeString(9,"$CETRANSPARENCY"),t.writeTransparency(this.cetransparency)),t.writeString(9,"$CMLSTYLE"),t.writeString(2,this.cmlstyle),t.writeString(9,"$CMLSCALE"),t.writeDouble(40,this.cmlscale),t.writeString(9,"$CMLEADERSTYLE"),t.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPCOLOR"),t.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPBACKGROUNDCOLOR"),t.writeCmColor(this.hpbackgroundcolor,2)),t.writeString(9,"$HPLAYER"),t.writeString(8,this.hplayer),this.hptransparency.isInvalid||(t.writeString(9,"$HPTRANSPARENCY"),t.writeTransparency(this.hptransparency)),t.writeString(9,"$TEXTSTYLE"),t.writeString(7,this.textstyle),t.writeString(9,"$ANGBASE"),t.writeAngle(50,this.angbase),t.writeString(9,"$ANGDIR"),t.writeInt16(70,this.angdir),t.writeString(9,"$AUNITS"),t.writeInt16(70,this.aunits),t.writeString(9,"$AUPREC"),t.writeInt16(70,this.auprec),t.writeString(9,"$EXTMIN"),t.writePoint3d(10,this.extmin),t.writeString(9,"$EXTMAX"),t.writePoint3d(10,this.extmax),t.writeString(9,"$PDMODE"),t.writeInt32(70,this.pdmode),t.writeString(9,"$PDSIZE"),t.writeDouble(40,this.pdsize),t.writeString(9,"$OSMODE"),t.writeInt32(70,this.osmode),t.writeString(9,"$ORTHOMODE"),t.writeInt16(70,this.orthomode),t.endSection()}writeDxfTablesSection(t,e){t.startSection("TABLES"),this.writeDxfTable(t,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(t,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(t,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(t,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(t,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(!0),"STYLE"),this.writeDxfTable(t,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(t,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),e.value>=19&&this.writeDxfTable(t,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),t.endSection()}writeDxfBlocksSection(t){t.startSection("BLOCKS");for(const e of this.tables.blockTable.newIterator()){if(e.dxfOutBlockBegin(t),!e.isModelSapce&&!e.isPaperSapce)for(const i of e.newIterator())this.writeDxfEntity(t,i);e.dxfOutBlockEnd(t)}t.endSection()}writeDxfEntitiesSection(t){t.startSection("ENTITIES");for(const e of this.tables.blockTable.newIterator())if(!(!e.isModelSapce&&!e.isPaperSapce))for(const i of e.newIterator())this.writeDxfEntity(t,i);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const i=o=>{t.writeStart("DICTIONARY"),o.dxfOut(t)},r=(o,a)=>{e.getAt(o)!==a&&e.setAt(o,a)},s=o=>{e.getAt(o)&&e.remove(o)};r("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?r("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):s("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?r("ACAD_MLINESTYLE",this.objects.mlineStyle):s("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?r("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):s("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?r("MLIGHT_XRECORD",this.objects.xrecord):s("MLIGHT_XRECORD"),i(e),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[o,a]of this.objects.layout.entries())t.writeStart("LAYOUT"),a.dxfOut(t);for(const[o,a]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),a.dxfOut(t);for(const[o,a]of this.objects.mleaderStyle.entries())t.writeStart("MLEADERSTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.mlineStyle.entries())t.writeStart("MLINESTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.xrecord.entries())t.writeStart("XRECORD"),a.dxfOut(t);t.endSection()}writeDxfTable(t,e,i,r,s){const o=[...r];t.startTable(e),i.dxfOut(t);for(const a of o){if(s==="BLOCK_RECORD"&&a instanceof et){a.dxfOutBlockRecord(t);continue}t.writeStart(s),a.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,i,r){this.hasSysVarValueChanged(e,i)&&(r(i),this.triggerSysVarChangedEvent(t,e,i))}hasSysVarValueChanged(t,e){return t instanceof k&&e instanceof k||t instanceof $&&e instanceof $?!t.equals(e):t instanceof yt&&e instanceof yt?t.value!==e.value:!Object.is(t,e)}normalizeLinetypeName(t){const e=t.trim();return e.toUpperCase()==="BYLAYER"?Z:e.toUpperCase()==="BYBLOCK"?St:e}triggerSysVarChangedEvent(t,e,i){const r=mt.instance(),s=t.toLowerCase();r.getDescriptor(s)!=null&&r.events.sysVarChanged.dispatch({database:this,name:s,oldVal:e,newVal:i})}getFileNameFromUri(t){try{const i=new URL(t).pathname.split("/");return i[i.length-1]||""}catch{return""}}}class Uc 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(t){this._standardFlags=t}get viewWidth(){return this._viewWidth}set viewWidth(t){this._viewWidth=t}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(t){this._ucsAssociated=t}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(t){this._cameraPlottable=t}get ucsElevation(){return this._ucsElevation}set ucsElevation(t){this._ucsElevation=t}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(t){this._ucsObjectId=t}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(t){this._ucsBaseObjectId=t}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(t){this._liveSectionObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeDouble(40,this.gsView.viewHeight),t.writePoint2d(10,this.centerPoint),t.writeDouble(41,this.viewWidth),t.writePoint3d(11,this.gsView.viewDirectionFromTarget),t.writePoint3d(12,this.gsView.viewTarget),t.writeDouble(42,this.gsView.lensLength),t.writeDouble(43,this.gsView.frontClippingPlane),t.writeDouble(44,this.gsView.backClippingPlane),t.writeAngle(50,this.gsView.viewTwistAngle),t.writeInt16(71,this.gsView.viewMode),t.writeInt16(281,this.gsView.renderMode),t.writeInt16(72,this.ucsAssociated?1:0),t.writeInt16(73,this.cameraPlottable?1:0),t.writeObjectId(332,this.backgroundObjectId),t.writeObjectId(334,this.liveSectionObjectId),t.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(t.writePoint3d(110,this.gsView.ucsOrigin),t.writePoint3d(111,this.gsView.ucsXAxis),t.writePoint3d(112,this.gsView.ucsYAxis),t.writeInt16(79,this.gsView.orthographicType),t.writeDouble(146,this.ucsElevation),t.writeObjectId(345,this.ucsObjectId),t.writeObjectId(346,this.ucsBaseObjectId)),this}}const pr=class pr extends q{getOffsetSideAtPoint(t){return 1}};pr.typeName="Curve";let J=pr;const de=class de extends J{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new V}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}addVertexAt(t,e,i=0,r=-1,s=-1){const o=r<0?void 0:r,a=s<0?void 0:s,h={x:e.x,y:e.y,bulge:i,startWidth:o,endWidth:a};this._geo.addVertexAt(t,h)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new m(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new C({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}subMoveGripPointsAt(t,e){return K(t,i=>{or(this._geo.vertices,i,e)}),this}subGetOsnapPoints(t,e,i,r){var h;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case w.EndPoint:for(let l=0;l<a;l++){const c=s.getPointAt(l);r.push(new m(c.x,c.y,o))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const l=this.closed?a:a-1,c=[];for(let u=0;u<l;u++){const g=[];ci(s.getPointAt(u),s.getPointAt((u+1)%a),(h=s.vertices[u])==null?void 0:h.bulge,o,t,e,g),c.push(...g)}if(t===w.MidPoint)r.push(...c);else{const u=gt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(r=>{const s=new m(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,i=s.z,e&&r.bulge!=null&&(r.bulge=-r.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:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.getPoints(100),i=this.createWidthProfile();if(i!=null){const s=Wc(i,this.closed);if(s!=null){const o=t.subEntityTraits;return o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}}const r=[];return e.forEach(s=>r.push(new m().set(s.x,s.y,this.elevation))),t.lines(r)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0),t.writeDouble(38,this.elevation);for(let e=0;e<this.numberOfVertices;++e)t.writePoint2d(10,this.getPoint2dAt(e));return this}createWidthProfile(){const t=this._geo.vertices,e=t.length;if(e<2)return null;const i=this.closed?e:e-1,r=[];let s=!1;for(let o=0;o<i;o++){const a=t[o],h=t[(o+1)%e],l=Math.max(0,a.startWidth??0),c=Math.max(0,a.endWidth??0);(l>ct||c>ct)&&(s=!0);const u=this.sampleSegment(a,h),g=u.length-1;for(let d=0;d<=g;d++){if(d===0&&r.length>0||this.closed&&o===i-1&&d===g)continue;const p=g>0?d/g:0;r.push({x:u[d].x,y:u[d].y,width:Zc(l,c,p)})}}return s&&r.length>=2?r:null}sampleSegment(t,e){if(t.bulge&&Math.abs(t.bulge)>ct){const r=new ot(t,e,t.bulge).getPoints(32);if(r.length>1)return r.map(s=>new P(s.x,s.y))}return[new P(t.x,t.y),new P(e.x,e.y)]}static from2dPoints(t,e){const i=new de;return t.forEach((r,s)=>i.addVertexAt(s,r)),i.closed=e,i}static fromGePolyline(t){const e=new de;return t.vertices.forEach((i,r)=>{e.addVertexAt(r,new P(i.x,i.y),i.bulge??0)}),e.closed=t.closed,e}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.numberOfVertices;let i=1/0,r=1;const s=this.closed?e:e-1;for(let o=0;o<s;o++){const a=this.getPoint2dAt(o),h=this.getPoint2dAt((o+1)%e),l=h.x-a.x,c=h.y-a.y,u=l*l+c*c;if(u===0)continue;const g=Math.max(0,Math.min(1,((t.x-a.x)*l+(t.y-a.y)*c)/u)),d=(t.x-a.x-g*l)**2+(t.y-a.y-g*c)**2;d<i&&(i=d,r=l*(t.y-a.y)-c*(t.x-a.x)>=0?1:-1)}return r}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:de.fromGePolyline(e[0])}};de.typeName="Polyline";let ut=de;function Xi(n,t,e){const i=ph(n,t,e);return i?ut.fromGePolyline(i):null}const ct=1e-6,ps=4;function Wc(n,t){if(n.length<2)return null;const e=qc(n,t);if(e.length<2)return null;const{left:i,right:r}=$c(e,t);if(i.length<2||r.length<2)return null;const s=new Tt;if(t){if(!$i(i)||!$i(r))return null;const a=Math.abs(un(i)),h=Math.abs(un(r)),[l,c]=a>=h?[i,r]:[r,i];return s.add(new V(l,!0)),s.add(new V(c,!0)),s}const o=[...i,...r.reverse()];return $i(o)?(s.add(new V(o,!0)),s):null}function $c(n,t){const e=[],i=[];for(let r=0;r<n.length;r++){const s=n[r],o=Math.max(0,s.width)/2;if(o<=ct)continue;const a=Kc(n,r,t);a!=null&&(e.push({x:s.x+a.x*o,y:s.y+a.y*o}),i.push({x:s.x-a.x*o,y:s.y-a.y*o}))}return{left:e,right:i}}function qc(n,t){const e=[];if(n.forEach(i=>{const r=e[e.length-1];(!r||Math.abs(r.x-i.x)>ct||Math.abs(r.y-i.y)>ct||Math.abs(r.width-i.width)>ct)&&e.push(i)}),t&&e.length>1){const i=e[0],r=e[e.length-1];Math.abs(i.x-r.x)<=ct&&Math.abs(i.y-r.y)<=ct&&e.pop()}return e}function Kc(n,t,e){const i=n.length,r=n[t],s=n[(t-1+i)%i],o=n[(t+1)%i];let a=fs(r.x-s.x,r.y-s.y),h=fs(o.x-r.x,o.y-r.y);if(e||(t===0&&(a=h),t===i-1&&(h=a)),a==null&&h==null)return null;if(a==null)return ei(h);if(h==null)return ei(a);const l=ei(a),c=ei(h),u=l.x+c.x,g=l.y+c.y,d=Math.hypot(u,g);if(d<=ct)return c;const p={x:u/d,y:g/d},f=Math.abs(p.x*c.x+p.y*c.y),y=f<=ct?ps:Math.min(1/f,ps);return{x:p.x*y,y:p.y*y}}function fs(n,t){const e=Math.hypot(n,t);return e<=ct?null:{x:n/e,y:t/e}}function ei(n){return{x:-n.y,y:n.x}}function un(n){let t=0;const e=n.length;for(let i=0;i<e;i++){const r=n[i],s=n[(i+1)%e];t+=r.x*s.y-s.x*r.y}return t/2}function $i(n){return n.length>=3&&Math.abs(un(n))>ct}function Zc(n,t,e){return n+(t-n)*e}var fa=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(fa||{});const fr=class fr extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=0,r=!1,s=0,o=0,a=null){super(),this._polyType=t,this._elevation=i;const h=a&&(a==null?void 0:a.length)===e.length,l=e.map((c,u)=>({x:c.x,y:c.y,bulge:h?a[u]:void 0}));this._geo=new V(l,r)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}getBulgeAt(t){const e=this._geo.vertices[t];return(e==null?void 0:e.bulge)||0}get geometricExtents(){const t=this._geo.box;return new C({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const i=this._geo.getPointAt(e);t.push(new m(i.x,i.y,this._elevation))}return t}subMoveGripPointsAt(t,e){return K(t,i=>{or(this._geo.vertices,i,e)}),this}subGetOsnapPoints(t,e,i,r){var h;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case w.EndPoint:for(let l=0;l<a;l++){const c=s.getPointAt(l);r.push(new m(c.x,c.y,o))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const l=this.closed?a:a-1,c=[];for(let u=0;u<l;u++){const g=[];ci(s.getPointAt(u),s.getPointAt((u+1)%a),(h=s.vertices[u])==null?void 0:h.bulge,o,t,e,g),c.push(...g)}if(t===w.MidPoint)r.push(...c);else{const u=gt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(r=>{const s=new m(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,i=s.z,e&&r.bulge!=null&&(r.bulge=-r.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:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(r=>e.push(new m().set(r.x,r.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i)t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint3d(10,{x:this.getPointAt(i).x,y:this.getPointAt(i).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(i)),t.writeInt16(70,0);return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb2dPolyline");let e=this.closed?1:0;return this.polyType===1&&(e|=2),this.polyType===2&&(e|=4),this.polyType===3&&(e|=8),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),t.writeDouble(10,0),t.writeDouble(20,0),t.writeDouble(30,this.elevation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ut.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:ut.fromGePolyline(e[0])}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}};fr.typeName="2dPolyline";let dn=fr;var ya=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(ya||{});const yr=class yr extends q{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new m,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){(t===w.EndPoint||t===w.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint2d(10,this.position),t.writeDouble(40,this.startWidth),t.writeDouble(41,this.endWidth),t.writeDouble(42,this.bulge),t.writeInt16(70,this.vertexType),this}};yr.typeName="2dVertex";let gn=yr;var ma=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(ma||{});const bi=class bi extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=!1){super(),this._polyType=t,this._geo=new V(e,i)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}get area(){return 0}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){const e=this._geo.vertices[t];return new m(e.x,e.y,e.z||0)}get geometricExtents(){const t=this._geo.vertices.map(e=>new m(e.x,e.y,e.z||0));return new C().setFromPoints(t)}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e)t.push(this.getPointAt(e));return t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveVertexAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){const s=Array.from({length:this._geo.numberOfVertices},(o,a)=>this.getPointAt(a));if(s.length!==0)switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const h=[];Ae(s[a],s[a+1],t,e,h),o.push(...h)}if(t===w.MidPoint)r.push(...o);else{const a=gt(e,o);a&&r.push(a)}break}}}transformBy(t){return this._geo.vertices.forEach(e=>{const i=new m(e.x,e.y,e.z||0).applyMatrix4(t);e.x=i.x,e.y=i.y,e.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:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.vertices.map(i=>new m(i.x,i.y,i.z||0));return t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i){const r=this.getPointAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,{x:r.x,y:r.y,z:r.z}),t.writeInt16(70,32)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dPolyline");let e=this.closed?1:0;return e|=8,this.polyType===1&&(e|=16),this.polyType===2&&(e|=32),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ut.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);if(e.length===0)return null;const i=e[0],r=[];for(let s=0;s<i.numberOfVertices;s++){const o=i.getPointAt(s);r.push(new m(o.x,o.y,this.interpolateZ(o.x,o.y)))}return new bi(this.polyType,r,this.closed)}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}interpolateZ(t,e){const i=this.numberOfVertices;if(i<=0)return 0;let r=1/0,s=this.getPointAt(0).z;const o=this.closed?i:i-1;for(let a=0;a<o;a++){const h=this.getPointAt(a),l=this.getPointAt((a+1)%i),c=l.x-h.x,u=l.y-h.y,g=c*c+u*u;if(g===0)continue;const d=Math.max(0,Math.min(1,((t-h.x)*c+(e-h.y)*u)/g)),p=h.x+c*d,f=h.y+u*d,y=(t-p)**2+(e-f)**2;y<r&&(r=y,s=h.z+(l.z-h.z)*d)}return s}moveVertexAt(t,e){const i=this._geo.vertices[t];if(!i)return;i.x+=e.x,i.y+=e.y;const r=i;r.z=(r.z??0)+(e.z??0)}};bi.typeName="3dPolyline";let pn=bi;var _a=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(_a||{});const mr=class mr extends q{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new m,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){(t===w.EndPoint||t===w.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,this.position),t.writeInt16(70,this.vertexType|32),this}};mr.typeName="3dVertex";let fn=mr;const vi=class vi extends J{get dxfTypeName(){return"ARC"}constructor(t,e,i,r,s=x.Z_AXIS){super();const o=Ne(s);this._geo=new bt(t,e,i,r,s,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>M.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){const s=this.startPoint,o=this.endPoint;switch(t){case w.EndPoint:r.push(s),r.push(o);break;case w.MidPoint:r.push(this.midPoint);break;case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:{const a=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of a)M.isBetweenAngle(h,this.startAngle,this.endAngle)&&r.push(this._geo.getPointAtAngle(h));break}case w.Nearest:{const a=this._geo.nearestPoint(e);r.push(a)}break;case w.Perpendicular:{const a=this._geo.perpendicularPoints(e),h=gt(e,a);h&&r.push(h);break}case w.Tangent:{const a=this._geo.tangentPoints(e);r.push(...a);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=xe(this.center,this.normal);return t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeAngle(50,Et(this.center,this.startPoint,this.normal)),t.writeAngle(51,Et(this.center,this.endPoint,this.normal)),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,i=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=i?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:{const i=this._geo.startPoint;this._geo.startAngle=Et(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}case 2:{const i=this._geo.endPoint;this._geo.endAngle=Et(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}}}createOffsetCurve(t){const e=this._geo.offset(t);return e?new vi(e.center,e.radius,e.startAngle,e.endAngle,e.normal):null}};vi.typeName="Arc";let yn=vi;const Qc=1;function xa(n){return n.replace(/\\[PpNn]/g,`
5
- `).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"")}function wa(n,t,e=1){if(!n||t<=0)return 0;const i=xa(n),r=Math.max(...i.split(/\r\n|\r|\n/g).map(s=>s.length),0);return r===0?0:Math.max(t,r*t*Qc*e)}function Jc(n){const t=xa(n);return Math.max(t.split(/\r\n|\r|\n/g).length,1)}function tu(n,t,e){if(t<=0||n<=0)return 0;if(n===1)return t;const i=Math.max(e,0);return t+(n-1)*t*i}function eu(n,t,e){switch(e){case exports.AcGiMTextAttachmentPoint.TopCenter:return{minX:-n/2,minY:-t,maxX:n/2,maxY:0};case exports.AcGiMTextAttachmentPoint.TopRight:return{minX:-n,minY:-t,maxX:0,maxY:0};case exports.AcGiMTextAttachmentPoint.MiddleLeft:return{minX:0,minY:-t/2,maxX:n,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleCenter:return{minX:-n/2,minY:-t/2,maxX:n/2,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleRight:return{minX:-n,minY:-t/2,maxX:0,maxY:t/2};case exports.AcGiMTextAttachmentPoint.BottomLeft:case exports.AcGiMTextAttachmentPoint.BaselineLeft:return{minX:0,minY:0,maxX:n,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomCenter:case exports.AcGiMTextAttachmentPoint.BaselineCenter:return{minX:-n/2,minY:0,maxX:n/2,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomRight:case exports.AcGiMTextAttachmentPoint.BaselineRight:return{minX:-n,minY:0,maxX:0,maxY:t};case exports.AcGiMTextAttachmentPoint.TopLeft:default:return{minX:0,minY:-t,maxX:n,maxY:0}}}function iu(n,t){let e;t&&t.lengthSq()>0?e=t.clone().normalize():e=new x(Math.cos(n),Math.sin(n),0);const i=new x(-e.y,e.x,e.z);return i.lengthSq()===0?i.set(0,1,0):i.normalize(),{xAxis:e,yAxis:i}}function ba(n,t,e,i,r,s=0,o){if(e<=0&&i<=0)return n.expandByPoint(t),n;const a=eu(e,i,r),{xAxis:h,yAxis:l}=iu(s,o?new x(o.x,o.y,o.z||0):void 0),c=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];for(const[u,g]of c)n.expandByPoint(new m(t.x+h.x*u+l.x*g,t.y+h.y*u+l.y*g,t.z+h.z*u+l.z*g));return n}var va=(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))(va||{}),Pa=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Pa||{});const _r=class _r extends q{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new m,this._alignmentPoint=new m,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(t){this._alignmentPoint.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){const t=new C,{anchor:e,attachmentPoint:i}=this.resolveTextAnchor(),r=wa(this.textString,this.height,this.widthFactor);return ba(t,e,r,this.height,i,this.rotation)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){w.Insertion===t&&r.push(this._position)}transformBy(t){const e=this._position.clone(),i=this._position.clone().add(new x(Math.cos(this._rotation),Math.sin(this._rotation),0)),r=this._position.clone().add(new x(-Math.sin(this._rotation),Math.cos(this._rotation),0)),s=this._position.clone().add(new x(0,0,1));e.applyMatrix4(t),i.applyMatrix4(t),r.applyMatrix4(t),s.applyMatrix4(t);const o=new x(i).sub(e),a=new x(r).sub(e),h=new x(s).sub(e),l=a.length(),c=o.length(),u=h.length();return this._position.copy(e),c>0&&(this._rotation=Math.atan2(o.y,o.x)),l>0&&(this._height*=l,c>0&&(this._widthFactor*=c/l)),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:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const{anchor:i,attachmentPoint:r}=this.resolveTextAnchor(),s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:i,rotation:this.rotation,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:r};return t.mtext(s,this.getTextStyle(),e)}resolveTextAnchor(){const t=this.resolveAttachmentPoint();if(t===exports.AcGiMTextAttachmentPoint.BaselineLeft)return{anchor:this._position,attachmentPoint:t};const e=this._alignmentPoint;return e.x===0&&e.y===0&&e.z===0||e.x===this._position.x&&e.y===this._position.y&&e.z===this._position.z?{anchor:this._position,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft}:{anchor:e,attachmentPoint:t}}resolveAttachmentPoint(){const t=this._horizontalMode,e=this._verticalModel;if(t===4)return exports.AcGiMTextAttachmentPoint.MiddleCenter;if(t===3||t===5)return exports.AcGiMTextAttachmentPoint.BaselineLeft;switch(e){case 3:return t===1?exports.AcGiMTextAttachmentPoint.TopCenter:t===2?exports.AcGiMTextAttachmentPoint.TopRight:exports.AcGiMTextAttachmentPoint.TopLeft;case 2:return t===1?exports.AcGiMTextAttachmentPoint.MiddleCenter:t===2?exports.AcGiMTextAttachmentPoint.MiddleRight:exports.AcGiMTextAttachmentPoint.MiddleLeft;case 1:return t===1?exports.AcGiMTextAttachmentPoint.BottomCenter:t===2?exports.AcGiMTextAttachmentPoint.BottomRight:exports.AcGiMTextAttachmentPoint.BottomLeft;case 0:default:return t===1?exports.AcGiMTextAttachmentPoint.BaselineCenter:t===2?exports.AcGiMTextAttachmentPoint.BaselineRight:exports.AcGiMTextAttachmentPoint.BaselineLeft}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbText"),t.writePoint3d(10,this.position),t.writeDouble(39,this.thickness),t.writeDouble(40,this.height),t.writeString(1,this.textString),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeString(7,this.styleName),t.writeInt16(72,this.horizontalMode),t.writeInt16(73,this.verticalMode),t.writePoint3d(11,this.alignmentPoint),this}};_r.typeName="Text";let Ve=_r;var st=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(st||{}),zt=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(zt||{});const xr=class xr extends Ve{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttributeDefinition"),t.writeString(3,this.prompt),t.writeString(2,this.tag),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeInt16(74,this.isReallyLocked?1:0),this}};xr.typeName="AttDef";let mn=xr;function nu(n){return n!=null&&typeof n=="object"&&"blockTableRecord"in n}const wr=class wr extends Ve{get dxfTypeName(){return"ATTRIB"}get resolvedColor(){var t;if(this.color.isByBlock){const e=(t=this.database)==null?void 0:t.tables.blockTable.getEntityById(this.ownerId);if(nu(e))return e.resolvedColor}return this.resolveStandardColor()}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&st.Invisible)!==0}set isInvisible(t){t?this._flags|=st.Invisible:this._flags&=~st.Invisible}get isConst(){return(this._flags&st.Const)!==0}set isConst(t){t?this._flags|=st.Const:this._flags&=~st.Const}get isVerifiable(){return(this._flags&st.Verifiable)!==0}set isVerifiable(t){t?this._flags|=st.Verifiable:this._flags&=~st.Verifiable}get isPreset(){return(this._flags&st.Preset)!==0}set isPreset(t){t?this._flags|=st.Preset:this._flags&=~st.Preset}get isMTextAttribute(){return(this._mtextFlag&zt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=zt.MultiLine:this._mtextFlag&=~zt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&zt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=zt.ConstMultiLine:this._mtextFlag&=~zt.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttribute"),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeString(2,this.tag),t.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&t.writeInt16(71,this.isMTextAttribute?1:0),this}};wr.typeName="Attrib";let _n=wr;const ge=class ge extends q{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new m,this._rotation=0,this._normal=new x(0,0,1),this._scaleFactors=new m(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId,this.syncAttributeDatabases()}syncAttributeDatabases(){try{const t=this.database;this._attribs.forEach(e=>{e.database=t})}catch{}}attributeIterator(){return new He(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??m.ORIGIN,i=new O().makeTranslation(-e.x,-e.y,-e.z),r=new O().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),s=new _e().setFromAxisAngle(x.Z_AXIS,this._rotation),o=new O().makeRotationFromQuaternion(s),a=new O().makeTranslation(this._position.x,this._position.y,this._position.z);return new O().multiplyMatrices(a,o).multiply(r).multiply(i)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r,s,o){const a=o??new O;w.Insertion===t?r.push(this.getInsertionPoint(a)):s?this.subEntityGetOsnapPoints(t,e,i,r,s,a):this.collectBlockOsnapPoints(t,e,i,r,a)}transformBy(t){const e=new O().setFromExtrusionDirection(this._normal),i=new O().makeRotationZ(this._rotation),r=new O().multiplyMatrices(e,i),s=this._position.clone(),o=new m(this._scaleFactors.x,0,0).applyMatrix4(r).add(s),a=new m(0,this._scaleFactors.y,0).applyMatrix4(r).add(s),h=new m(0,0,this._scaleFactors.z).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),h.applyMatrix4(t);const l=new x(o).sub(s),c=new x(a).sub(s),u=new x(h).sub(s);let g=new x().crossVectors(l,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const p=new O().setFromExtrusionDirection(g).clone().invert(),f=l.clone().applyMatrix4(p);return this._position.copy(s),this._normal.copy(g),this._rotation=Math.atan2(f.y,f.x),this._scaleFactors.set(l.length(),c.length(),u.length()),this._attribs.forEach(y=>y.transformBy(t)),this}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(i=>{e.properties.push({name:i.tag,type:"string",editable:!i.isConst,skipTranslation:!0,accessor:{get:()=>i.textString,set:r=>{i.textString=r}}})})}return t}get geometricExtents(){const t=new C,e=this.blockTableRecord;if(e!=null){const r=e.newIterator();for(const s of r)t.union(s.geometricExtents)}const i=this.blockTransform;return t.applyMatrix4(i),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const i=this.blockTransform,r=[];return this._attribs.forEach(o=>{if(!o.isInvisible){const a=o.worldDraw(t);a&&r.push(a)}}),ie.instance.draw(t,e,this.resolvedColor,r,!0,i,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let i=!1;for(const r of this.attributeIterator())i=!0,t.writeStart("ATTRIB"),r.dxfOut(t);return i&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}collectBlockOsnapPoints(t,e,i,r,s){const o=this.blockTableRecord;if(!o)return;const a=new O().multiplyMatrices(s,this.getFullInsertionTransform()),h=a.clone().invert(),l=new m(e).applyMatrix4(h),c=new m(i).applyMatrix4(h),u=[];for(const g of o.newIterator()){const d=[];if(g instanceof ge){g.subGetOsnapPoints(t,e,i,d,void 0,a),u.push(...d);continue}g.subGetOsnapPoints(t,l,c,d,void 0,a),d.forEach(p=>u.push(new m(p).applyMatrix4(a)))}if(u.length!==0)if(t===w.Nearest||t===w.Perpendicular||t===w.Tangent){const g=gt(e,u);g&&r.push(g)}else r.push(...u)}subEntityGetOsnapPoints(t,e,i,r,s,o,a=new Set){if(s===this.objectId||a.has(this.objectId))return!1;a.add(this.objectId);try{const h=this.blockTableRecord;if(h==null)return!1;const l=new O().multiplyMatrices(o,this.getFullInsertionTransform());for(const c of h.newIterator()){if(c.objectId===s){const u=new m(e).applyMatrix4(l.clone().invert()),g=new m(i).applyMatrix4(l.clone().invert()),d=[];return c.subGetOsnapPoints(t,u,g,d,s,l),c instanceof ge?d.forEach(p=>{r.push(p.clone())}):d.forEach(p=>{r.push(new m(p).applyMatrix4(l))}),!0}if(c instanceof ge&&c.subEntityGetOsnapPoints(t,e,i,r,s,l,a))return!0}return!1}finally{a.delete(this.objectId)}}getInsertionPoint(t){var r;const e=((r=this.blockTableRecord)==null?void 0:r.origin)??m.ORIGIN,i=new O().multiplyMatrices(t,this.getFullInsertionTransform());return new m(e).applyMatrix4(i)}getFullInsertionTransform(){const t=new O().setFromExtrusionDirection(this._normal);return new O().multiplyMatrices(t,this.blockTransform)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockReference"),t.writePoint3d(10,this.position),t.writeString(2,this.blockName),t.writeDouble(41,this.scaleFactors.x),t.writeDouble(42,this.scaleFactors.y),t.writeDouble(43,this.scaleFactors.z),t.writeAngle(50,this.rotation),t.writeVector3d(210,this.normal),this}};ge.typeName="BlockReference";let ve=ge;const ys=[0,Math.PI/2,Math.PI,Math.PI/2*3],Pi=class Pi extends J{get dxfTypeName(){return"CIRCLE"}constructor(t,e,i=x.Z_AXIS){super();const r=Ne(i);this._geo=new bt(t,e,0,B,i,r)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}subGetOsnapPoints(t,e,i,r){switch(t){case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:r.push(this._geo.getPointAtAngle(0)),r.push(this._geo.getPointAtAngle(Math.PI/2)),r.push(this._geo.getPointAtAngle(Math.PI)),r.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case w.Nearest:{const s=this._geo.nearestPoint(e);r.push(s)}break;case w.Tangent:{const s=this._geo.tangentPoints(e);r.push(...s);break}case w.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=gt(e,s);o&&r.push(o);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;t.push(this.center);for(const e of ys)t.push(this._geo.getPointAtAngle(e));return t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=xe(this.center,this.normal);return t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,i=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=i?1:-1}createOffsetCurve(t){const e=this._geo.offset(t);return e?new Pi(e.center,e.radius,e.normal):null}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:case 2:case 3:case 4:{const i=ys[t-1],r=this._geo.getPointAtAngle(i),o=new m(r.x+e.x,r.y+e.y,(r.z??0)+(e.z??0)).distanceTo(this.center);o>0&&(this.radius=o);break}}}};Pi.typeName="Circle";let xn=Pi;const Ai=class Ai extends J{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,i,r,s,o,a){super(),this._geo=new er(t,e,i,r,s,o,a)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxis(){return this._geo.majorAxis}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}subGetGripPoints(){const t=new Array;return t.push(this._geo.center),t.push(this._geo.startPoint),t.push(this._geo.endPoint),t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:this.closed||(r.push(this._geo.startPoint),r.push(this._geo.endPoint));break;case w.MidPoint:this.closed||r.push(this._geo.midPoint);break;case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:this.closed&&(r.push(this._geo.getPointAtAngle(0)),r.push(this._geo.getPointAtAngle(Math.PI/2)),r.push(this._geo.getPointAtAngle(Math.PI)),r.push(this._geo.getPointAtAngle(Math.PI/2*3)));break;case w.Nearest:r.push(this._geo.nearestPoint(e));break;case w.Tangent:r.push(...this._geo.tangentPoints(e));break;case w.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=gt(e,s);o&&r.push(o);break}}}transformBy(t){return this._geo.transform(t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbEllipse"),t.writePoint3d(10,this.center);const e=this._geo.majorAxis,i=this.majorAxisRadius;return t.writePoint3d(11,{x:e.x*i,y:e.y*i,z:e.z*i}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,i=t.x-e.x,r=t.y-e.y,s=this.majorAxis,o=Math.hypot(s.x,s.y)||1,a=this.minorAxisRadius/this.majorAxisRadius*o||1,h=s.x/o,l=s.y/o,c=-l,u=h,g=i*h+r*l,d=i*c+r*u;return(g/o)**2+(d/a)**2>=1?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:{const i=this._geo.startPoint;this._geo.startAngle=Et(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}case 2:{const i=this._geo.endPoint;this._geo.endAngle=Et(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}}}createOffsetCurve(t){const e=this._geo.offset(t);return e?new Ai(e.center,e.normal,e.majorAxis,e.majorAxisRadius,e.minorAxisRadius,e.startAngle,e.endAngle):null}};Ai.typeName="Ellipse";let wn=Ai;const br=class br extends q{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new m,new m,new m],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new m),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new C().setFromPoints(this._vertices)}get area(){const t=[this.getVertexAt(0),this.getVertexAt(1),this.getVertexAt(2)],e=this.getVertexAt(3);return(e.x!==t[2].x||e.y!==t[2].y||e.z!==t[2].z)&&t.push(e),no(t)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return Ci(t,e,this._vertices),this}subGetOsnapPoints(t,e,i,r){ar(this._vertices,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._vertices.length,i=new Float32Array(e*3),r=new Uint16Array(e*2);for(let s=0;s<e;s++)i[s*3]=this._vertices[s].x,i[s*3+1]=this._vertices[s].y,i[s*3+2]=this._vertices[s].z,this.isEdgeVisibleAt(s)&&(r[s*2]=s,r[s*2+1]=(s+1)%4);return t.lineSegments(i,3,r)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),i=this.getVertexAt(1),r=this.getVertexAt(2),s=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,i),t.writePoint3d(12,r),t.writePoint3d(13,s);let o=0;for(let a=0;a<4;++a)this.isEdgeVisibleAt(a)||(o|=1<<a);return t.writeInt16(70,o),this}};br.typeName="Face";let bn=br;var Aa=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(Aa||{});const vr=class vr extends J{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(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(t){this._isHookLineSameDirection=t}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(t=>t.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get byBlockColor(){return this._byBlockColor}set byBlockColor(t){this._byBlockColor=t}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(t){this._associatedAnnotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(t){this._horizontalDirection.copy(t)}get offsetFromBlock(){var t;return(t=this._offsetFromBlock)==null?void 0:t.clone()}set offsetFromBlock(t){this._offsetFromBlock=t?new x(t):void 0}get offsetFromAnnotation(){var t;return(t=this._offsetFromAnnotation)==null?void 0:t.clone()}set offsetFromAnnotation(t){this._offsetFromAnnotation=t?new x(t):void 0}appendVertex(t){this._vertices.push(new m().copy(t)),this._updated=!0}setVertexAt(t,e){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].copy(e),this._updated=!0,this}vertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].clone()}subGetGripPoints(){return this._vertices.map(t=>t.clone())}subMoveGripPointsAt(t,e){return Ci(t,e,this._vertices),this}subGetOsnapPoints(t,e,i,r){if(this.numVertices===0)return;if(this.isSplined&&this.splineGeo){switch(t){case w.EndPoint:r.push(this._vertices[0]),r.push(this._vertices[this.numVertices-1]);break;case w.Nearest:r.push(this.splineGeo.nearestPoint(e));break}return}const s=this._vertices;switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const h=[];Ae(s[a],s[a+1],t,e,h),o.push(...h)}if(t===w.MidPoint)r.push(...o);else{const a=gt(e,o);a&&r.push(a)}break}}}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new C().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}get area(){return 0}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this.transformVector(this._normal,t),this.transformVector(this._horizontalDirection,t),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,t),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,t),this._splineGeo?(this._splineGeo.transform(t),this._updated=!1):this._updated=!0,this}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new At(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLeader"),t.writeString(3,this.dimensionStyle),t.writeInt16(71,this.hasArrowHead?1:0),t.writeInt16(72,this.isSplined?1:0),t.writeInt16(73,this.annoType),t.writeInt16(74,this.isHookLineSameDirection?1:0),t.writeInt16(75,this.hasHookLine?1:0),t.writeInt16(76,this.numVertices),this.textHeight!==0&&t.writeDouble(40,this.textHeight),this.textWidth!==0&&t.writeDouble(41,this.textWidth),this.byBlockColor!=null&&t.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&t.writeHandle(340,this.associatedAnnotation);for(const e of this.vertices)t.writePoint3d(10,e);return t.writeVector3d(210,this.normal),t.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&t.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&t.writeVector3d(213,this._offsetFromAnnotation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ut.from2dPoints(e,!1).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Xi(this.collectPath2d(),!1,t)}collectPath2d(){return this.isSplined&&this.splineGeo?this.splineGeo.getPoints(64).map(t=>new P(t.x,t.y)):this._vertices.map(t=>new P(t.x,t.y))}transformVector(t,e){const i=new m,r=new m(t.x,t.y,t.z);i.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-i.x,r.y-i.y,r.z-i.z)}};vr.typeName="Leader";let vn=vr;const Si=class Si extends J{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new Ct(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get area(){return 0}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return K(t,i=>{switch(i){case 0:this.transformBy(O.makeTranslation(e));break;case 1:this.startPoint.add(e);break;case 2:this.endPoint.add(e);break}}),this}subGetOsnapPoints(t,e,i,r){const s=this.startPoint,o=this.endPoint;switch(t){case w.EndPoint:r.push(s),r.push(o);break;case w.MidPoint:r.push(this.midPoint);break;case w.Nearest:{const a=this._geo.project(e);r.push(a)}break;case w.Perpendicular:{const a=this._geo.perpPoint(e);r.push(a)}break;case w.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,i=this.endPoint,r=[new m(e.x,e.y,0),new m(i.x,i.y,0)];return t.lines(r)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}getOffsetCurves(t){const e=this._geo.offset(t);return[new Si(e.startPoint,e.endPoint)]}getOffsetSideAtPoint(t){const e=this.startPoint,i=this.endPoint;return(i.x-e.x)*(t.y-e.y)-(i.y-e.y)*(t.x-e.x)>=0?1:-1}};Si.typeName="Line";let di=Si;var Sa=(n=>(n[n.Top=0]="Top",n[n.Zero=1]="Zero",n[n.Bottom=2]="Bottom",n))(Sa||{}),La=(n=>(n[n.HasVertex=1]="HasVertex",n[n.Closed=2]="Closed",n[n.SuppressStartCaps=4]="SuppressStartCaps",n[n.SuppressEndCaps=8]="SuppressEndCaps",n))(La||{});const Pr=class Pr extends q{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new m,this._normal=new x(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(t){this._styleName=t}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(t){this._styleObjectHandle=t}get scale(){return this._scale}set scale(t){this._scale=t}get justification(){return this._justification}set justification(t){this._justification=t}get flags(){return this._flags}set flags(t){this._flags=t}get styleCount(){return this._styleCount}set styleCount(t){this._styleCount=Math.max(0,t)}get startPosition(){return this._startPosition}set startPosition(t){this._startPosition.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get segments(){return this._segments.map(t=>this.cloneSegment(t))}set segments(t){this._segments=t.map(e=>this.createSegment(e)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(t){this.setFlag(2,t)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(t){this.setFlag(4,t)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(t){this.setFlag(8,t)}appendSegment(t){this._segments.push(this.createSegment(t)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const t=this.collectGeometryPoints();return new C().setFromPoints(t)}transformBy(t){return this._startPosition.applyMatrix4(t),this._segments.forEach(e=>{e.position.applyMatrix4(t),this.transformVector(e.direction,t),this.transformVector(e.miterDirection,t)}),this.transformVector(this._normal,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:t=>{this.scale=t}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:t=>{this.justification=t}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this._startPosition),this._segments.forEach(e=>t.push(e.position)),t}subMoveGripPointsAt(t,e){return K(t,i=>{if(i===0)this._startPosition.add(e);else{const r=this._segments[i-1];r&&r.position.add(e)}}),this}subGetOsnapPoints(t,e,i,r){const s=[this._startPosition,...this._segments.map(o=>o.position)];if(s.length!==0)switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const h=[];Ae(s[a],s[a+1],t,e,h),o.push(...h)}if(t===w.MidPoint)r.push(...o);else{const a=gt(e,o);a&&r.push(a)}break}}}subWorldDraw(t){if(this._segments.length===0)return;const e=[],i=this.getMLineStyle(),r=this.getRenderableElementCount(i),s=t.subEntityTraits,o=s.color,a=s.lineType,h=s.fillType,l=s.drawOrder,c=this.createFillArea(i,r);if(c&&(s.color=o,this.applyFillTraits(i,s),s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},s.drawOrder=-1,e.push(t.area(c)),s.fillType=h,s.drawOrder=l),r<=0){const u=this.getReferencePath();u.length>=2&&e.push(t.lines(u))}else{for(let u=0;u<r;u++){s.color=o,s.lineType=a,this.applyStyleElementTraits(i,u,s);const g=this.getElementPath(u,i);g.length>=2&&e.push(t.lines(g))}this.appendStyleDrivenJointAndCapEntities(t,e,i,r,o,a)}if(s.color=o,s.lineType=a,s.fillType=h,s.drawOrder=l,e.length!==0)return e.length===1?e[0]:t.group(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMline"),t.writeString(2,this.styleName),t.writeHandle(340,this._styleObjectHandle),t.writeDouble(40,this._scale),t.writeInt16(70,this._justification),t.writeInt16(71,this._flags),t.writeInt16(72,this.vertexCount),t.writeInt16(73,this._styleCount),t.writePoint3d(10,this._startPosition),t.writeVector3d(210,this._normal),this._segments.forEach(e=>{t.writePoint3d(11,e.position),t.writeVector3d(12,e.direction),t.writeVector3d(13,e.miterDirection),e.elements.forEach(i=>{t.writeInt16(74,i.parameterCount),i.parameters.forEach(r=>t.writeDouble(41,r)),t.writeInt16(75,i.fillCount),i.fillParameters.forEach(r=>t.writeDouble(42,r))})}),this}setFlag(t,e){e?this._flags|=t:this._flags&=~t}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}createSegment(t){var e;return{position:new m().copy(t.position),direction:new x().copy(t.direction),miterDirection:new x().copy(t.miterDirection),elements:((e=t.elements)==null?void 0:e.map(i=>this.createElement(i)))??[]}}createElement(t){const e=t.parameters?[...t.parameters]:[],i=t.fillParameters?[...t.fillParameters]:[];return{parameterCount:t.parameterCount??e.length,parameters:e,fillCount:t.fillCount??i.length,fillParameters:i}}cloneSegment(t){return{position:t.position.clone(),direction:t.direction.clone(),miterDirection:t.miterDirection.clone(),elements:t.elements.map(e=>({parameterCount:e.parameterCount,parameters:[...e.parameters],fillCount:e.fillCount,fillParameters:[...e.fillParameters]}))}}collectGeometryPoints(){const t=[this._startPosition];if(this._segments.length===0)return t;const e=this.getMLineStyle(),i=this.getRenderableElementCount(e);if(i<=0)return this._segments.forEach(r=>t.push(r.position)),t;for(let r=0;r<i;r++)t.push(...this.getElementPath(r,e));return t}getRenderableElementCount(t){const e=(t==null?void 0:t.elementCount)??0;return Math.max(this._styleCount,e,...this._segments.map(i=>i.elements.length),0)}getReferencePath(){const t=[this._startPosition.clone(),...this._segments.map(e=>e.position.clone())];return this.closePathIfNeeded(t)}getElementPath(t,e){const i=[],r=this._segments[0];return i.push(this.getElementBoundaryPoint("start",r,t,e)),this._segments.forEach(s=>{i.push(this.offsetPoint(s.position,s.miterDirection,this.getElementMiterOffset(s,t,e)))}),i[i.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],t,e),this.closePathIfNeeded(i)}getElementMiterOffset(t,e,i){var s;const r=t.elements[e];return(s=r==null?void 0:r.parameters)!=null&&s.length?r.parameters[0]:this.getStyleElementOffset(e,i)}getElementBoundaryPoint(t,e,i,r){const s=this.getElementMiterOffset(e,i,r),o=t==="start"?this._startPosition:e.position,a=this.offsetPoint(o,e.miterDirection,s);if(!this.shouldApplyCapCutAtSide(t,r))return a;const h=t==="start"?r==null?void 0:r.startAngle:r==null?void 0:r.endAngle,l=this.computeCapCutDistance(s,h,t);if(l===0)return a;const c=t==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return c.lengthSq()===0?a:a.add(c.multiplyScalar(l))}shouldApplyCapCutAtSide(t,e){return!e||this.closed?!1:t==="start"?this.suppressStartCaps?!1:(e.flags&112)!==0:this.suppressEndCaps?!1:(e.flags&1792)!==0}computeCapCutDistance(t,e,i){const r=this.normalizeCapAngle(e),s=Math.tan(r);if(Math.abs(s)<1e-6)return 0;const o=t/s;return o}normalizeCapAngle(t){if(t==null||!Number.isFinite(t))return Math.PI/2;let e=t%180;return e<0&&(e+=180),(e<1||e>179)&&(e=90),e*Math.PI/180}getStartSegmentDirection(){const t=this._segments[0],e=new x;return t&&(e.subVectors(t.position,this._startPosition),e.lengthSq()===0&&e.copy(t.direction)),e.lengthSq()>0&&e.normalize(),e}getEndSegmentDirection(){const t=this._segments[this._segments.length-1];if(!t)return new x;const e=new x,i=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return e.subVectors(t.position,i),e.lengthSq()===0&&e.copy(t.direction),e.lengthSq()>0&&e.normalize(),e}createFillArea(t,e){if(!t||!(t.flags&1)||e<2)return;const i=this.getFillBoundaryElementIndices(e,t);if(!i)return;const r=this.getElementPath(i.outerIndex,t),s=this.getElementPath(i.innerIndex,t),o=this.stripClosingPoint(r),a=this.stripClosingPoint(s);if(o.length<2||a.length<2)return;const h=new Tt;if(this.closed){if(o.length<3||a.length<3)return;h.add(new V(o.map(l=>({x:l.x,y:l.y})),!0)),h.add(new V(a.map(l=>({x:l.x,y:l.y})),!0))}else{const l=[...o,...a.slice().reverse()].map(c=>({x:c.x,y:c.y}));if(l.length<3)return;h.add(new V(l,!0))}return h}getFillBoundaryElementIndices(t,e){let i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=-1,o=-1;for(let a=0;a<t;a++){const h=this.getElementReferenceOffset(a,e);h<i&&(i=h,s=a),h>r&&(r=h,o=a)}if(!(s<0||o<0||s===o))return{outerIndex:o,innerIndex:s}}getElementReferenceOffset(t,e){var r;const i=this._segments[0];if(i){const s=i.elements[t];if((r=s==null?void 0:s.parameters)!=null&&r.length)return s.parameters[0]}return this.getStyleElementOffset(t,e)}getStyleElementOffset(t,e){const i=e==null?void 0:e.elements[t];if(!i)return 0;const r=this.getStyleJustificationShift(e);return(i.offset+r)*this._scale}getStyleJustificationShift(t){const e=(t==null?void 0:t.elements)??[];if(e.length<=0)return 0;let i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const s of e){const o=s.offset;o<i&&(i=o),o>r&&(r=o)}return this._justification===0?-r:this._justification===2?-i:0}stripClosingPoint(t){if(t.length<2)return t;const e=t[0],i=t[t.length-1],r=1e-9;return Math.abs(e.x-i.x)<=r&&Math.abs(e.y-i.y)<=r&&Math.abs(e.z-i.z)<=r?t.slice(0,-1):t}offsetPoint(t,e,i){if(i===0||e.lengthSq()===0)return t.clone();const r=e.clone().normalize().multiplyScalar(i);return t.clone().add(r)}closePathIfNeeded(t){if(!this.closed||t.length<2)return t;const e=t[0],i=t[t.length-1],r=1e-9;return Math.abs(e.x-i.x)<=r&&Math.abs(e.y-i.y)<=r&&Math.abs(e.z-i.z)<=r||t.push(e.clone()),t}appendStyleDrivenJointAndCapEntities(t,e,i,r,s,o){!i||r<2||(e.push(...this.drawMiterJointEntities(t,i,r,s,o)),e.push(...this.drawCapEntities(t,i,r,s,o)))}drawMiterJointEntities(t,e,i,r,s){if(this.closed||this._segments.length<2||!(e.flags&2))return[];const o=[],a=t.subEntityTraits;for(let h=0;h<this._segments.length-1;h++){const l=this._segments[h],c=Array.from({length:i},(u,g)=>{const d=this.getElementMiterOffset(l,g,e);return{elementIndex:g,offset:d,point:this.offsetPoint(l.position,l.miterDirection,d)}}).sort((u,g)=>g.offset-u.offset);for(let u=0;u<c.length-1;u++)this.applyElementDrawTraits(a,r,s,e,c[u].elementIndex),o.push(t.lines([c[u].point,c[u+1].point]))}return o}drawCapEntities(t,e,i,r,s){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(t,"start",e,i,r,s)),o.push(...this.drawCapEntitiesForSide(t,"end",e,i,r,s)),o}drawCapEntitiesForSide(t,e,i,r,s,o){if(e==="start"&&this.suppressStartCaps)return[];if(e==="end"&&this.suppressEndCaps)return[];const a=i.flags,h=e==="start",l=h?(a&16)!==0:(a&256)!==0,c=h?(a&64)!==0:(a&1024)!==0,u=h?(a&32)!==0:(a&512)!==0;if(!l&&!c&&!u)return[];const g=this.getCapElementPoints(e,r,i);if(g.length<2)return[];const d=[],p=t.subEntityTraits;if(l)for(let y=0;y<g.length-1;y++)this.applyElementDrawTraits(p,s,o,i,g[y].elementIndex),d.push(t.lines([g[y].point,g[y+1].point]));const f=h?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(c){const y=this.drawCapArcBetweenElements(t,e,g[0],g[g.length-1],f,p,s,o,i);y&&d.push(y)}if(u)for(let y=1;y<Math.floor(g.length/2);y++){const _=g[y],v=g[g.length-1-y];if(!_||!v||_===v)continue;const S=this.drawCapArcBetweenElements(t,e,_,v,f,p,s,o,i);S&&d.push(S)}return d}getCapElementPoints(t,e,i){const r=t==="start"?this._segments[0]:this._segments[this._segments.length-1];return r?Array.from({length:e},(s,o)=>({elementIndex:o,offset:this.getElementMiterOffset(r,o,i),point:this.getElementBoundaryPoint(t,r,o,i)})).sort((s,o)=>o.offset-s.offset):[]}drawCapArcBetweenElements(t,e,i,r,s,o,a,h,l){const c=e==="end"?r.point:i.point,u=e==="end"?i.point:r.point,g=c.distanceTo(u);if(g<=1e-9||s.lengthSq()===0)return;const p=c.clone().add(new x().subVectors(u,c).multiplyScalar(.5)).add(s.clone().normalize().multiplyScalar(g/2)),f=bt.createByThreePoints(c,u,p);if(f)return this.applyElementDrawTraits(o,a,h,l,e==="end"?r.elementIndex:i.elementIndex),t.circularArc(f)}applyElementDrawTraits(t,e,i,r,s){t.color=e,t.lineType=i,this.applyStyleElementTraits(r,s,t)}transformVector(t,e){const i=new m,r=new m(t.x,t.y,t.z);i.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-i.x,r.y-i.y,r.z-i.z)}getMLineStyle(){var s;const t=this.database.objects.mlineStyle,e=this.styleObjectHandle?t.getIdAt(this.styleObjectHandle):void 0;if(e)return e;const i=this.styleName?t.getAt(this.styleName):void 0;if(i)return i;const r=(s=this.styleName)==null?void 0:s.toUpperCase();if(r)for(const[o,a]of t.entries()){const h=(a.styleName||o).toUpperCase();if(o.toUpperCase()===r||h===r)return a}}applyStyleElementTraits(t,e,i){const r=t==null?void 0:t.elements[e];if(!r)return;const s=this.resolveStyleElementLineType(r.lineType);s&&(i.lineType=s),!(r.color.isByBlock||r.color.isByLayer)&&(i.color=r.color.clone())}applyFillTraits(t,e){const i=t==null?void 0:t.fillColor;!i||i.isByBlock||i.isByLayer||(e.color=i.clone())}resolveStyleElementLineType(t){var l;const e=t==null?void 0:t.trim();if(!e)return;const i=e.toUpperCase(),r=Z.toUpperCase(),s=St.toUpperCase();let o="UserSpecified",a=e;if(i===r){o="ByLayer";const c=(l=this.database.tables.layerTable.getAt(this.layer))==null?void 0:l.linetype;a=c&&c.toUpperCase()!==r&&c.toUpperCase()!==s?c:Dt}else i===s&&(o="ByBlock",a=Dt);const h=this.database.tables.linetypeTable.getAt(a);return h?{type:o,...h.linetype}:{type:o,name:a,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||Vt}catch{return Vt}}};Pr.typeName="MLine";let Pn=Pr;var ke=(n=>(n[n.InvisibleLeader=0]="InvisibleLeader",n[n.StraightLeader=1]="StraightLeader",n[n.SplineLeader=2]="SplineLeader",n))(ke||{}),ue=(n=>(n[n.NoneContent=0]="NoneContent",n[n.BlockContent=1]="BlockContent",n[n.MTextContent=2]="MTextContent",n[n.ToleranceContent=3]="ToleranceContent",n))(ue||{}),Ma=(n=>(n[n.Horizontal=0]="Horizontal",n[n.Vertical=1]="Vertical",n))(Ma||{}),Ia=(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))(Ia||{});const ru=1,su=2,ou=4,au=8,lu=64,hu=128,cu=32768,Ar=class Ar extends q{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=exports.AcGiMTextAttachmentPoint.MiddleLeft,this._textDrawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(t=>this.cloneLeader(t))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(t){this._doglegEnabled=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get doglegVector(){return this._doglegVector}set doglegVector(t){this._doglegVector.copy(t)}get landingPoint(){return this._landingPoint}set landingPoint(t){this._landingPoint=t?this.createPoint(t):void 0}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(t){this._mleaderStyleId=t}get version(){return this._version}set version(t){this._version=t}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(t){this._leaderStyleId=t}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(t){this._propertyOverrideFlag=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor=t==null?void 0:t.clone()}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get landingEnabled(){return this._landingEnabled}set landingEnabled(t){this._landingEnabled=t}get arrowheadId(){return this._arrowheadId}set arrowheadId(t){this._arrowheadId=t}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(t){this._arrowheadSize=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor=t==null?void 0:t.clone()}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(t){this._textFrameEnabled=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get textAttachment(){return this._textAttachment}set textAttachment(t){this._textAttachment=t}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(t){this._textFlowDirection=t}get blockContentId(){return this._blockContentId}set blockContentId(t){this._blockContentId=t}get blockContentColor(){return this._blockContentColor}set blockContentColor(t){this._blockContentColor=t==null?void 0:t.clone()}get blockContentScale(){return this._blockContentScale}set blockContentScale(t){this._blockContentScale=t}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(t){this._blockContentRotation=t}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(t){this._blockContentConnectionType=t}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(t){this._annotativeScaleEnabled=t}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(t){this._arrowheadOverrides=t}get blockAttributes(){return this._blockAttributes}set blockAttributes(t){this._blockAttributes=t}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(t){this._textDirectionNegative=t}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(t){this._textAlignInIPE=t}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(t){this._bottomTextAttachmentDirection=t}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(t){this._topTextAttachmentDirection=t}get contentScale(){return this._contentScale}set contentScale(t){this._contentScale=t}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(t){this._contentBasePosition=t}get textAnchor(){return this._textAnchor}set textAnchor(t){this._textAnchor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(t){this._textBackgroundColor=t==null?void 0:t.clone()}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(t){this._textBackgroundScaleFactor=t}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(t){this._textBackgroundTransparency=t}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(t){this._textBackgroundColorOn=t}get textFillOn(){return this._textFillOn}set textFillOn(t){this._textFillOn=t}get textColumnType(){return this._textColumnType}set textColumnType(t){this._textColumnType=t}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(t){this._textUseAutoHeight=t}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(t){this._textColumnWidth=t}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(t){this._textColumnGutterWidth=t}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(t){this._textColumnFlowReversed=t}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(t){this._textColumnHeight=t}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(t){this._textUseWordBreak=t}get hasMText(){return this._hasMText}set hasMText(t){this._hasMText=t}get hasBlock(){return this._hasBlock}set hasBlock(t){this._hasBlock=t}get planeOrigin(){return this._planeOrigin}set planeOrigin(t){this._planeOrigin=t}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(t){this._planeXAxisDirection=t}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(t){this._planeYAxisDirection=t}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(t){this._planeNormalReversed=t}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(t){if(!t){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:t.text,anchorPoint:this.createPoint(t.anchorPoint)},this._contentType=2}get contents(){var t;return((t=this._mtextContent)==null?void 0:t.text)??""}set contents(t){this._mtextContent?this._mtextContent.text=t:this._mtextContent={text:t,anchorPoint:new m},this._contentType=2}get textLocation(){var t;return(t=this._mtextContent)==null?void 0:t.anchorPoint}set textLocation(t){if(!t){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(t):this._mtextContent={text:"",anchorPoint:this.createPoint(t)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get textDirection(){return this._textDirection}set textDirection(t){this._textDirection.copy(t)}get textStyleName(){return this._textStyleName}set textStyleName(t){this._textStyleName=t}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(t){this._textAttachmentPoint=t}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(t){this._textDrawingDirection=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get blockContent(){var t,e,i;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(t=this._blockContent.normal)==null?void 0:t.clone(),position:(e=this._blockContent.position)==null?void 0:e.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:(i=this._blockContent.color)==null?void 0:i.clone(),transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(t){var e;if(!t){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:t.blockContentId??t.blockHandle,blockHandle:t.blockHandle,normal:t.normal?new x(t.normal):void 0,position:t.position?this.createPoint(t.position):void 0,scale:new x(t.scale??{x:1,y:1,z:1}),rotation:t.rotation??0,color:(e=t.color)==null?void 0:e.clone(),transformationMatrix:t.transformationMatrix?[...t.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(t={}){var i,r;const e={lastLeaderLinePoint:t.lastLeaderLinePoint?this.createPoint(t.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:t.landingPoint?this.createPoint(t.landingPoint):void 0,doglegVector:t.doglegVector?new x(t.doglegVector):void 0,doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:((i=t.breaks)==null?void 0:i.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[],leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:[]};return(r=t.leaderLines)==null||r.forEach(s=>{e.leaderLines.push(this.createLeaderLine(s))}),this._leaders.push(e),this._leaders.length-1}removeLeader(t){return this.checkLeaderIndex(t),this._leaders.splice(t,1),this}addLeaderLine(t,e=[]){return this.checkLeaderIndex(t),this._leaders[t].leaderLines.push(this.createLeaderLine({vertices:e})),this._leaders[t].leaderLines.length-1}appendVertex(t,e,i){return this.getMutableLeaderLine(t,e).vertices.push(this.createPoint(i)),this}setLeaderLineVertices(t,e,i){return this.getMutableLeaderLine(t,e).vertices=i.map(r=>this.createPoint(r)),this}getLeaderLineVertices(t,e){return this.getMutableLeaderLine(t,e).vertices.map(i=>i.clone())}addBreak(t,e,i,r){return this.getMutableLeaderLine(t,e).breaks.push({start:this.createPoint(i),end:this.createPoint(r)}),this}setLandingPoint(t,e){return this.checkLeaderIndex(t),this._leaders[t].landingPoint=e?this.createPoint(e):void 0,this}setDoglegDirection(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegVector=new x(e),this}setDoglegLength(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegLength=e,this}get geometricExtents(){const t=this.collectGeometryPoints();return t.length>0?new C().setFromPoints(t):new C}subGetGripPoints(){return this.collectGeometryPoints().map(t=>t.clone())}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGeometryGripPointAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){var s;if(t===w.Insertion){this.contentBasePosition?r.push(this.contentBasePosition):this._mtextContent?r.push(this._mtextContent.anchorPoint):(s=this._blockContent)!=null&&s.position&&r.push(this._blockContent.position);return}this._leaders.forEach(o=>{o.leaderLines.forEach(a=>{const h=this.getLeaderLineDrawPoints(o,a);if(h.length!==0)switch(t){case w.EndPoint:r.push(...h);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const l=[];for(let c=0;c<h.length-1;c++){const u=[];Ae(h[c],h[c+1],t,e,u),l.push(...u)}if(t===w.MidPoint)r.push(...l);else{const c=gt(e,l);c&&r.push(c)}break}}})})}transformBy(t){var e,i,r,s,o,a,h,l;return this._leaders.forEach(c=>{var u,g;(u=c.lastLeaderLinePoint)==null||u.applyMatrix4(t),(g=c.landingPoint)==null||g.applyMatrix4(t),c.doglegVector&&this.transformVector(c.doglegVector,t),c.breaks.forEach(d=>{d.start.applyMatrix4(t),d.end.applyMatrix4(t)}),c.leaderLines.forEach(d=>{d.vertices.forEach(p=>p.applyMatrix4(t)),d.breaks.forEach(p=>{p.start.applyMatrix4(t),p.end.applyMatrix4(t)})})}),(e=this._landingPoint)==null||e.applyMatrix4(t),(i=this.contentBasePosition)==null||i.applyMatrix4(t),this.transformVector(this._doglegVector,t),this.transformVector(this._normal,t),(r=this.textAnchor)==null||r.applyMatrix4(t),(s=this._mtextContent)==null||s.anchorPoint.applyMatrix4(t),this.transformVector(this._textDirection,t),(a=(o=this._blockContent)==null?void 0:o.position)==null||a.applyMatrix4(t),(h=this._blockContent)!=null&&h.normal&&this.transformVector(this._blockContent.normal,t),this.blockContentScale&&this.transformVector(this.blockContentScale,t),(l=this.planeOrigin)==null||l.applyMatrix4(t),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,t),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:ue[0],value:0},{label:ue[1],value:1},{label:ue[2],value:2},{label:ue[3],value:3}],accessor:{get:()=>this.contentType,set:t=>{this.contentType=t}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:ke[0],value:0},{label:ke[1],value:1},{label:ke[2],value:2}],accessor:{get:()=>this.leaderLineType,set:t=>{this.leaderLineType=t}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:t=>{this.doglegEnabled=t}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:t=>{this.doglegLength=t}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:t=>{this.textHeight=t}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:t=>{this.textWidth=t}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:t=>{this.textStyleName=t}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const t=this.getDefaultMLeaderStyle();t&&(this._mleaderStyleId=t.objectId)}subWorldDraw(t,e){const i=[],r=t.subEntityTraits,s=r.color,o=r.lineType,a=r.lineWeight,h=this.getResolvedLeaderLineColor(),l=this.getResolvedLeaderLineStyle(),c=this.getResolvedLeaderLineWeight(),u=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(r,h,s),this.applyLineTraits(r,l,c),this._leaders.forEach(d=>{d.leaderLines.forEach(f=>{const y=this.getLeaderLineDrawPoints(d,f);if(y.length>0){const _=this.drawLeaderLine(t,y);_&&i.push(_)}});const p=this.getDoglegPoints(d);p&&i.push(t.lines(p))}));const g=this.getRenderableMTextContent();if(this.contentType===2&&g){this.applyColorTraits(r,u,s);const d=this.getResolvedTextHeight(),p={text:g.text,height:d,width:this.getMTextRenderWidth(g.text,d),position:g.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};i.push(t.mtext(p,this.getTextStyle(),e))}if(r.color=s,r.lineType=o,r.lineWeight=a,i.length!==0)return i.length===1?i[0]:t.group(i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeader"),t.writeInt16(170,this.leaderLineType),t.writeBoolean(290,this.doglegEnabled),t.writeDouble(41,this.doglegLength),t.writeInt16(172,this.contentType),t.writeVector3d(210,this.normal),t.writeHandle(340,this.mleaderStyleId),this._landingPoint&&t.writePoint3d(10,this._landingPoint),t.writeVector3d(11,this.doglegVector),this._mtextContent&&(t.writeString(1,this._mtextContent.text),t.writePoint3d(12,this._mtextContent.anchorPoint),t.writeDouble(40,this.textHeight),t.writeDouble(42,this.textWidth),t.writeAngle(50,this.textRotation),t.writeString(7,this.textStyleName)),this._blockContent&&(t.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&t.writePoint3d(15,this._blockContent.position),t.writeVector3d(16,this._blockContent.scale),t.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(e=>{e.landingPoint&&t.writePoint3d(110,e.landingPoint),e.doglegVector&&t.writeVector3d(111,e.doglegVector),t.writeDouble(140,e.doglegLength),t.writeInt16(171,e.leaderLines.length),e.leaderLines.forEach(i=>{t.writeInt16(90,i.vertices.length),i.vertices.forEach(r=>t.writePoint3d(10,r))})}),this}createPoint(t){return new m().copy(t)}createLeaderLine(t){var e,i;return{vertices:((e=t.vertices)==null?void 0:e.map(r=>this.createPoint(r)))??[],breakPointIndexes:t.breakPointIndexes?[...t.breakPointIndexes]:[],leaderLineIndex:t.leaderLineIndex,breaks:((i=t.breaks)==null?void 0:i.map(r=>({index:r.index,start:this.createPoint(r.start),end:this.createPoint(r.end)})))??[]}}cloneLeader(t){var e,i,r;return{lastLeaderLinePoint:(e=t.lastLeaderLinePoint)==null?void 0:e.clone(),lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:(i=t.landingPoint)==null?void 0:i.clone(),doglegVector:(r=t.doglegVector)==null?void 0:r.clone(),doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:t.breaks.map(s=>({index:s.index,start:s.start.clone(),end:s.end.clone()})),leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:t.leaderLines.map(s=>({vertices:s.vertices.map(o=>o.clone()),breakPointIndexes:[...s.breakPointIndexes],leaderLineIndex:s.leaderLineIndex,breaks:s.breaks.map(o=>({index:o.index,start:o.start.clone(),end:o.end.clone()}))}))}}checkLeaderIndex(t){if(t<0||t>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(t,e){this.checkLeaderIndex(t);const i=this._leaders[t].leaderLines[e];if(!i)throw new Error("The leader line index is out of range!");return i}collectGeometryPoints(){var e;const t=[];return this._leaders.forEach(i=>{i.lastLeaderLinePoint&&t.push(i.lastLeaderLinePoint),i.landingPoint&&t.push(i.landingPoint),i.breaks.forEach(s=>t.push(s.start,s.end)),i.leaderLines.forEach(s=>{t.push(...s.vertices),s.breaks.forEach(o=>t.push(o.start,o.end))});const r=this.getDoglegPoints(i);r&&t.push(...r),i.leaderLines.forEach(s=>{const o=this.getArrowheadPoints(this.getLeaderLineDrawPoints(i,s));o&&t.push(...o)})}),this._landingPoint&&t.push(this._landingPoint),this.contentBasePosition&&t.push(this.contentBasePosition),this.textAnchor&&t.push(this.textAnchor),this._mtextContent&&t.push(this._mtextContent.anchorPoint),(e=this._blockContent)!=null&&e.position&&t.push(this._blockContent.position),this.planeOrigin&&t.push(this.planeOrigin),t}moveGeometryGripPointAt(t,e){var s;let i=0;const r=(o,a)=>{if(o){i===t&&o.add(e),i++;return}a&&(i===t&&a(),i++)};this._leaders.forEach(o=>{r(o.lastLeaderLinePoint),r(o.landingPoint),o.breaks.forEach(h=>{r(h.start),r(h.end)}),o.leaderLines.forEach(h=>{h.vertices.forEach(l=>r(l)),h.breaks.forEach(l=>{r(l.start),r(l.end)})});const a=this.getDoglegPoints(o);a&&(r(a[0]),r(void 0,()=>{const h=a[0],l=a[1];if(!h||!l)return;const c=h.distanceTo({x:l.x+e.x,y:l.y+e.y,z:(l.z??0)+(e.z??0)});o.doglegLength!=null||o.doglegVectorSet?o.doglegLength=c:this._doglegLength=c})),o.leaderLines.forEach(h=>{const l=this.getLeaderLineDrawPoints(o,h),c=this.getArrowheadPoints(l);c&&c.forEach((u,g)=>{g===0||g===c.length-1?r(l[0]):r(void 0)})})}),r(this._landingPoint),r(this.contentBasePosition),r(this.textAnchor),this._mtextContent&&r(this._mtextContent.anchorPoint),(s=this._blockContent)!=null&&s.position&&r(this._blockContent.position),r(this.planeOrigin)}getLeaderLineDrawPoints(t,e){if(e.vertices.length>=2)return e.vertices;if(e.vertices.length===0)return[];const i=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint??this.contentBasePosition;return!i||e.vertices[0].equals(i)?e.vertices:[e.vertices[0],i]}getDoglegPoints(t){if(!this.getResolvedDoglegEnabled())return;const e=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint,i=t.doglegVector??this._doglegVector,r=t.doglegLength??this.getResolvedDoglegLength();if(!e||r==null||r===0||i.lengthSq()===0)return;const s=e.clone().add(i.clone().normalize().multiplyScalar(r));return[e,s]}getArrowheadPoints(t){if(!this.isArrowheadVisible()||t.length<2)return;const e=this.getArrowheadFrame(t);if(!e)return;const i=this.getResolvedArrowheadSize(),{tip:r,unit:s}=e,o=r.clone().add(s.clone().multiplyScalar(i)),a=i/6,h=new x(-s.y,s.x,0),l=o.clone().add(h.clone().multiplyScalar(a)),c=o.clone().add(h.clone().multiplyScalar(-a));return[r,l,c,r]}isArrowheadVisible(){const t=this.getResolvedArrowheadId();return(t==null?void 0:t.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(t,e){const i=[],r=this.getLeaderLinePointsForDraw(e);r.length>=2&&i.push(t.lines(r));const s=this.drawArrowhead(t,e);if(s&&i.push(s),i.length!==0)return i.length===1?i[0]:t.group(i)}getLeaderLinePointsForDraw(t){const e=this.getArrowheadLeaderLineTrimDistance();return e<=0?t:this.trimPolylineStart(t,e)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const t=this.getResolvedArrowheadBlockTableRecord();if(!t)return 0;const e=this.getResolvedArrowheadSize();if(e<=0)return 0;const i=t.origin??m.ORIGIN;let r=i.x;for(const s of t.newIterator()){const o=s.geometricExtents;o.isEmpty()||o.max.x>r&&(r=o.max.x)}return Math.max(0,(r-i.x)*e)}trimPolylineStart(t,e){if(t.length<2||e<=0)return t;let i=e;for(let r=0;r<t.length-1;r++){const s=t[r],o=t[r+1],a=o.distanceTo(s);if(!(a<=0)){if(i<a){const h=new x().subVectors(o,s);return[s.clone().add(h.multiplyScalar(i/a)),...t.slice(r+1)]}i-=a}}return[t[t.length-1]]}drawArrowhead(t,e){if(!this.isArrowheadVisible())return;const i=this.drawArrowheadBlock(t,e);if(i)return i;const r=this.getArrowheadPoints(e);if(!r)return;const s=new Tt;s.add(new V(r,!0));const o=t.subEntityTraits,a=o.fillType;o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const h=t.area(s);return o.fillType=a,h}drawArrowheadBlock(t,e){const i=this.getResolvedArrowheadBlockTableRecord();if(!i)return;const r=this.getArrowheadFrame(e);if(!r)return;const{tip:s,unit:o}=r,a=this.getResolvedArrowheadSize(),h=Math.atan2(o.y,o.x),l=i.origin??m.ORIGIN,c=new O().makeTranslation(-l.x,-l.y,-l.z),u=new O().makeScale(a,a,a),g=new O().makeRotationZ(h),d=new O().makeTranslation(s.x,s.y,s.z),p=new O().multiplyMatrices(d,g).multiply(u).multiply(c);return ie.instance.draw(t,i,this.resolvedColor,[],!0,p,new x(this.normal))}getArrowheadFrame(t){if(t.length<2)return;const e=t[0],i=t.find(s=>!s.equals(e));if(!i)return;const r=new x().subVectors(i,e);if(r.lengthSq()!==0)return{tip:e,unit:r.normalize()}}getResolvedArrowheadId(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.arrowSymbolId;return this.arrowheadId??t}getResolvedArrowheadBlockTableRecord(){const t=this.getResolvedArrowheadId();if(t)return this.database.tables.blockTable.getIdAt(t)}getResolvedArrowheadSize(){const t=this.getMLeaderStyle(),e=(t==null?void 0:t.arrowSize)??(t==null?void 0:t.scale);return this.arrowheadSize??this.contentScale??e??this.getResolvedTextHeight()}getResolvedTextHeight(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.textHeight;return this.textHeight>0?this.textHeight:t!=null&&t>0?t:2.5}getRenderableMTextContent(){var i;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const t=(i=this.getMLeaderStyle())==null?void 0:i.defaultMTextContents,e=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!t||!e))return{text:t,anchorPoint:e}}getMTextRenderWidth(t,e){if(this._textWidth>0)return this._textWidth;if(!t)return this._textWidth;const i=t.replace(/\\[PpNn]/g,`
6
- `).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),r=Math.max(...i.split(/\r\n|\r|\n/g).map(s=>s.length),1);return Math.max(e,r*e)}transformVector(t,e){const i=new m,r=new m(t.x,t.y,t.z);i.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-i.x,r.y-i.y,r.z-i.z)}getMLeaderStyle(){const t=this.database.objects.mleaderStyle,e=this.mleaderStyleId||this.leaderStyleId;if(e){const i=t.getIdAt(e);if(i)return i}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const t=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return t||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(t){const e=t==null?void 0:t.trim();if(!e)return;const i=this.database.objects.mleaderStyle,r=i.getAt(e);if(r)return r;const s=i.getIdAt(e);if(s)return s;const o=e.toUpperCase();for(const[a,h]of i.entries())if(a.toUpperCase()===o)return h}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||jt}catch{return jt}}getResolvedTextStyleName(){var s,o,a;const t=this.database.tables.textStyleTable,e=(s=this.getMLeaderStyle())==null?void 0:s.textStyleId,i=e?(o=t.getIdAt(e))==null?void 0:o.name:void 0,r=this.textStyleId?(a=t.getIdAt(this.textStyleId))==null?void 0:a.name:void 0;if(this.textStyleName){const h=t.getAt(this.textStyleName);if(h!=null&&h.name)return h.name;const l=t.getIdAt(this.textStyleName);if(l!=null&&l.name)return l.name}return r||i}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.getResolvedTextStyleName());if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}getResolvedLeaderLineColor(){var t;return this.getResolvedComponentColor(this.leaderLineColor,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineColor,su)}getResolvedLeaderLineType(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,t,ru)}getResolvedLeaderLineTypeId(){var t;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineTypeId,ou)}getResolvedLeaderLineStyle(){const t=this.getResolvedLeaderLineTypeId();if(!t)return;const e=this.database.tables.linetypeTable.getIdAt(t);if(e)return{type:"UserSpecified",...e.linetype}}getResolvedLeaderLineWeight(){var i;const t=(i=this.getMLeaderStyle())==null?void 0:i.leaderLineWeight,e=this.getResolvedStyleDrivenValue(this.leaderLineWeight,t,au);if(e!=null)return e}getResolvedDoglegEnabled(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,t,lu)}getResolvedDoglegLength(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,t,hu)}getResolvedTextColor(){var t;return this.getResolvedComponentColor(this.textColor,(t=this.getMLeaderStyle())==null?void 0:t.textColor,cu)}getResolvedComponentColor(t,e,i){if(!t)return e;const r=this.isPropertyOverrideEnabled(i);return r===!0?t:r===!1?e??t:!t.isByBlock&&!t.isByLayer?t:e??t}getResolvedStyleDrivenValue(t,e,i){const r=this.isPropertyOverrideEnabled(i);return r===!0?t??e:e??t}isPropertyOverrideEnabled(t){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&t)!==0}applyColorTraits(t,e,i){t.color=i,e&&(t.color=e)}applyLineTraits(t,e,i){e&&(t.lineType=e),i!=null&&(t.lineWeight=i)}};Ar.typeName="MLeader";let An=Ar;const Sr=class Sr extends q{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 m,this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._direction=new x(1,0,0),this._drawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){const t=new C,e=this.width>0?this.width:wa(this.contents,this.height),i=Jc(this.contents),r=tu(i,this.height,this.lineSpacingFactor);return ba(t,this._location,e,r,this.attachmentPoint,this.rotation,this.direction)}subGetGripPoints(){return[this._location]}subMoveGripPointsAt(t,e){return kt(t,e,this._location),this}subGetOsnapPoints(t,e,i,r){w.Insertion===t&&r.push(this._location)}transformBy(t){const e=this._location.clone(),i=this._direction.lengthSq()>0?this._direction.clone().normalize():new x(Math.cos(this._rotation),Math.sin(this._rotation),0),r=new x(-i.y,i.x,i.z);r.lengthSq()===0&&r.set(0,1,0),r.normalize();const s=e.clone().add(i),o=e.clone().add(r);e.applyMatrix4(t),s.applyMatrix4(t),o.applyMatrix4(t);const a=new x(s).sub(e),h=new x(o).sub(e),l=a.length(),c=h.length();return this._location.copy(e),l>0&&(this._direction.copy(a).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=l),c>0&&(this._height*=c),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:exports.AcGiMTextAttachmentPoint[1],value:1},{label:exports.AcGiMTextAttachmentPoint[2],value:2},{label:exports.AcGiMTextAttachmentPoint[3],value:3},{label:exports.AcGiMTextAttachmentPoint[4],value:4},{label:exports.AcGiMTextAttachmentPoint[5],value:5},{label:exports.AcGiMTextAttachmentPoint[6],value:6},{label:exports.AcGiMTextAttachmentPoint[7],value:7},{label:exports.AcGiMTextAttachmentPoint[8],value:8},{label:exports.AcGiMTextAttachmentPoint[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:exports.AcGiMTextFlowDirection[1],value:1},{label:exports.AcGiMTextFlowDirection[2],value:2},{label:exports.AcGiMTextFlowDirection[3],value:3},{label:exports.AcGiMTextFlowDirection[4],value:4},{label:exports.AcGiMTextFlowDirection[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const 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 t.mtext(i,this.getTextStyle(),e)}encodeMTextContentsForDxf(t){return t.replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMText"),t.writePoint3d(10,this.location),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writeString(1,this.encodeMTextContentsForDxf(this.contents)),t.writeString(7,this.styleName),t.writeAngle(50,this.rotation),t.writeVector3d(11,this.direction),t.writeInt16(71,this.attachmentPoint),t.writeInt16(72,this.drawingDirection),t.writeInt16(73,this.lineSpacingStyle),t.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(t.writeInt16(90,1),t.writeInt32(63,this.backgroundFillColor),t.writeInt32(441,this.backgroundFillTransparency),t.writeDouble(45,this.backgroundScaleFactor)),this}};Sr.typeName="MText";let gi=Sr;function uu(n){return n&2048?"SqrtChord":n&1024?"Chord":"Uniform"}function ms(n,t){try{return new pi(n.controlPoints,n.knots,du(n.weights,n.controlPoints.length),n.degree,t)}catch{return null}}function du(n,t){if(!(!n||n.length!==t))return n}const Ye=class Ye extends J{get dxfTypeName(){return"SPLINE"}static fromControlPoints(t,e,i,r,s){const o=At.fromControlPoints(t,e,i,r,s);return o?ms(o,s):null}static fromFitPoints(t,e,i,r,s,o){const a=At.fromFitPoints(t,e,i,r,s,o);return a?ms(a,r):null}static fromDwgSpline(t){const e=!!(t.flag&1),i=uu(t.flag);if(t.numberOfControlPoints>0&&t.numberOfKnots>0){const r=Ye.fromControlPoints(t.controlPoints,t.knots,t.weights,t.degree,e);if(r)return r}return t.numberOfFitPoints>0?Ye.fromFitPoints(t.fitPoints,i,t.degree,e,t.startTangent,t.endTangent):null}constructor(t,e,i,r,s){super(),this.rebuild(t,e,i,r,s)}rebuild(t,e,i,r,s){const o=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(r!==void 0)+ +(s!==void 0);if(o<2||o>5)throw lt.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new At(t,e,i,r):this._geo=new At(t,e,i,r,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}subGetGripPoints(){return this._geo.controlPoints.map(t=>new m(t.x,t.y,t.z??0))}subMoveGripPointsAt(t,e){return K(t,i=>{const r=this._geo.controlPoints[i];r&&nt.applyOffsetToPoint3d(r,e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:r.push(this._geo.startPoint),r.push(this._geo.endPoint);break;case w.Node:{const s=new Set;for(const o of this._geo.knots)s.has(o)||(s.add(o),r.push(this._geo.evaluateAt(o)));break}case w.Nearest:r.push(this._geo.nearestPoint(e));break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var i;const e=this._geo;super.dxfOutFields(t),t.writeSubclassMarker("AcDbSpline"),t.writeInt16(70,this.closed?1:0),t.writeInt16(71,e.degree),t.writeInt16(72,e.knots.length),t.writeInt16(73,e.controlPoints.length),t.writeInt16(74,((i=e.fitPoints)==null?void 0:i.length)??0);for(const r of e.knots)t.writeDouble(40,r);for(const r of e.weights)t.writeDouble(41,r);for(const r of e.controlPoints)t.writePoint3d(10,r);for(const r of e.fitPoints??[])t.writePoint3d(11,r);return this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d(1);return e.length<2?1:ut.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const{points:e,tangents:i}=this._geo.getOffsetSamplePath2d(t),r=fh(e,this.closed,t,i);return r?ut.fromGePolyline(r):null}collectPath2d(t){return this._geo.getOffsetSamplePath2d(t).points}};Ye.typeName="Spline";let pi=Ye;const gu=new x,Lr=class Lr extends ve{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,i){super(t),this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=i,this._numRows=e,this._columnWidth=new Array(i),this._rowHeight=new Array(e),this._cells=new Array(e*i)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,i){var s;const r=t*this._numColumns+e;return(s=this._cells[r])==null?void 0:s.text}setTextString(t,e,i){const r=t*this._numColumns+e;if(!this._cells[r]){this._cells[r]={text:i,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[r].text=i}isEmpty(t,e){var r;const i=t*this._numColumns+e;return!((r=this._cells[i])!=null&&r.text)}get geometricExtents(){let t;try{t=this.blockTableRecord}catch{t=void 0}if(t&&t.newIterator().count>0){const a=new C;for(const h of t.newIterator())a.union(h.geometricExtents);return a.applyMatrix4(this.blockTransform),a}const e=this._columnWidth.reduce((a,h)=>a+h,0),i=this._rowHeight.reduce((a,h)=>a+h,0),r=new C;if(e===0&&i===0)return r.expandByPoint(this.position),r;const s=new _e;s.setFromAxisAngle(x.Z_AXIS,this.rotation),le.compose(this.position,s,this.scaleFactors);const o=[new m(0,0,0),new m(e,0,0),new m(e,-i,0),new m(0,-i,0)];for(const a of o)r.expandByPoint(a.applyMatrix4(le));return r}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){const e=this.blockTableRecord;if(e&&e.newIterator().count>0){const d=this.drawAnonymousTableBlock(t,e);if(d)return d}let i=0,r=0;const s=new Uint16Array(this.numColumns*this.numRows*8),o=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let d=0;d<=this.numRows;d++){i-=d>0?this.rowHeight(d-1):0,r=0;for(let p=0;p<=this.numColumns;p++)r+=p>0?this.columnWidth(p-1):0,o[a++]=r,o[a++]=i,o[a++]=0}const h=[],l=new Array(this.numRows*this.numColumns).fill(!1);r=0,a=0;let c=0;for(let d=0;d<this.numColumns;d++){r+=d>0?this.columnWidth(d-1):0,i=0;for(let p=0;p<this.numRows;p++){i+=p>0?this.rowHeight(p-1):0;const f=this.cell(p*this.numColumns+d);if(c=p*this.numColumns+d,f&&!l[c]){const y=f.borderWidth??1,_=f.borderHeight??1;this.fillVisited(l,c,this.numColumns,y,_),s[a++]=d+p*(this.numColumns+1),s[a++]=d+p*(this.numColumns+1)+y;const v=o[s[a-1]*3]-r,S=d+(p+_)*(this.numColumns+1)+y;d+y==this.numColumns&&(s[a++]=d+p*(this.numColumns+1)+y,s[a++]=S);const A=-o[S*3+1]-i;if(p+_==this.numRows&&(s[a++]=d+(p+_)*(this.numColumns+1)+_,s[a++]=d+(p+_)*(this.numColumns+1)),s[a++]=d+(p+_)*(this.numColumns+1),s[a++]=d+p*(this.numColumns+1),f.text){const L=f.attachmentPoint||this.attachmentPoint||exports.AcGiMTextAttachmentPoint.MiddleCenter,T=this.getTableTextOffset(L,v,A),I={text:f.text,height:this.getCellTextHeight(f,A),width:v,position:gu.set(r,-i,0).clone().add(T),rotation:this.rotation,attachmentPoint:L},X=this.getTextStyle(f);h.push(t.mtext(I,X))}}}}h.push(t.lineSegments(o,3,s));const u=t.group(h),g=new _e;return g.setFromAxisAngle(x.Z_AXIS,this.rotation),le.compose(this.position,g,this.scaleFactors),u.applyMatrix(le),u}drawAnonymousTableBlock(t,e){const i=[],r=e.newIterator();for(const a of r){let h;if(a.color.isByBlock){_s.copy(a.color);const l=this.resolvedColor;l.isForeground?a.color.setForeground():l.RGB!=null&&a.color.setRGBValue(l.RGB),h=a.worldDraw(t),a.color.copy(_s)}else h=a.worldDraw(t);h&&(h.objectId=this.objectId,h.ownerId=this.ownerId,h.layerName=this.layer,h.visible=this.visibility&&a.visibility,i.push(h))}const s=t.group(i);s.applyMatrix(this.blockTransform);const o=this.normal;return o&&(o.x!==0||o.y!==0||o.z!==1)&&(le.setFromExtrusionDirection(o),s.applyMatrix(le)),s}fillVisited(t,e,i,r,s){if(s==1&&r==1)t[e]=!0;else for(let o=0;o<r;++o)for(let a=0;a<s;++a)t[e+o+a*i]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable.resolveAt(t.textStyle);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}getTableTextOffset(t,e,i){const r=new x;switch(t){case 1:break;case 2:r.setX(e/2);break;case 3:r.setX(e);break;case 4:r.setY(-i/2);break;case 5:r.set(e/2,-i/2,0);break;case 6:r.set(e,-i/2,0);break;case 7:r.setY(-i);break;case 8:r.set(e/2,-i,0);break;case 9:r.set(e,-i,0);break}return r}getCellTextHeight(t,e){return t.textHeight&&t.textHeight>0?t.textHeight:Math.max(e/2,1)}dxfOutFields(t){var s,o,a,h,l,c,u;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((s=t.database)==null?void 0:s.version)??((o=this.database)==null?void 0:o.version),i=(e==null?void 0:e.value)!=null?e.value>=27:!1;t.writeInt16(280,this.tableDataVersion),t.writeObjectId(342,this.tableStyleId),t.writeObjectId(343,this.owningBlockRecordId),t.writeVector3d(11,this.horizontalDirection),t.writeUInt32(90,this.tableValueFlag),t.writeUInt32(93,this.tableOverrideFlag),t.writeUInt32(94,this.borderColorOverrideFlag),t.writeUInt32(95,this.borderLineweightOverrideFlag),t.writeUInt32(96,this.borderVisibilityOverrideFlag),t.writeInt16(71,this.attachmentPoint),t.writeInt32(91,this.numRows),t.writeInt32(92,this.numColumns);for(let g=0;g<this.numRows;++g)t.writeDouble(141,this.rowHeight(g));for(let g=0;g<this.numColumns;++g)t.writeDouble(142,this.columnWidth(g));const r=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let g=0;g<r;g++){const d=this._cells[g],p=(d==null?void 0:d.cellType)??(d!=null&&d.blockTableRecordId?2:1);if(t.writeInt16(171,p),t.writeInt16(172,(d==null?void 0:d.flagValue)??0),t.writeInt16(173,(d==null?void 0:d.mergedValue)??0),t.writeBoolean(174,d==null?void 0:d.autoFit),t.writeInt16(175,d==null?void 0:d.borderWidth),t.writeInt16(176,d==null?void 0:d.borderHeight),(d==null?void 0:d.overrideFlag)!=null&&(i?t.writeInt32(91,d.overrideFlag):t.writeInt16(177,d.overrideFlag)),t.writeInt16(178,d==null?void 0:d.virtualEdgeFlag),t.writeAngle(145,d==null?void 0:d.rotation),i&&t.writeInt16(92,d==null?void 0:d.extendedCellFlags),p===1)d!=null&&d.fieldObjetId?t.writeObjectId(344,d.fieldObjetId):this.writeCellText(t,(d==null?void 0:d.text)??"",i,d==null?void 0:d.cellValueBlockBegin);else if(p===2){if(t.writeObjectId(340,d==null?void 0:d.blockTableRecordId),t.writeDouble(144,d==null?void 0:d.blockScale),t.writeInt16(179,d==null?void 0:d.blockAttrNum),(a=d==null?void 0:d.attrDefineId)!=null&&a.length)for(const f of d.attrDefineId)t.writeObjectId(331,f);if((d==null?void 0:d.attrText)!=null)if(Array.isArray(d.attrText))for(const f of d.attrText)t.writeString(300,f);else t.writeString(300,d.attrText)}d!=null&&d.textStyle&&t.writeString(7,d.textStyle),(d==null?void 0:d.textHeight)!=null&&t.writeDouble(140,d.textHeight),(d==null?void 0:d.attachmentPoint)!=null&&t.writeInt16(170,d.attachmentPoint),(d==null?void 0:d.topBorderVisibility)!=null&&t.writeInt16(289,d.topBorderVisibility?1:0),(d==null?void 0:d.rightBorderVisibility)!=null&&t.writeInt16(285,d.rightBorderVisibility?1:0),(d==null?void 0:d.bottomBorderVisibility)!=null&&t.writeInt16(286,d.bottomBorderVisibility?1:0),(d==null?void 0:d.leftBorderVisibility)!=null&&t.writeInt16(288,d.leftBorderVisibility?1:0)}if(t.writeInt16(70,this.flowDirection),t.writeDouble(40,this.horizontalCellMargin),t.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&t.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&t.writeInt16(281,this.suppressHeader?1:0),(h=this.cellTypeOverrides)!=null&&h.length)for(const g of this.cellTypeOverrides){t.writeString(7,g.textStyle),t.writeDouble(140,g.textHeight),t.writeInt16(170,g.alignment),t.writeInt16(63,g.backgroundColor),t.writeInt16(64,g.contentColor),g.backgroundColorEnabled!=null&&t.writeInt16(283,g.backgroundColorEnabled?1:0);const d=g.borderLineweights;d&&(t.writeInt16(274,d.top),t.writeInt16(275,d.right),t.writeInt16(276,d.bottom),t.writeInt16(277,d.left),t.writeInt16(278,d.insideHorizontal),t.writeInt16(279,d.insideVertical));const p=g.borderVisibility;p&&(t.writeInt16(284,p.top?1:0),t.writeInt16(285,p.right?1:0),t.writeInt16(286,p.bottom?1:0),t.writeInt16(287,p.left?1:0),t.writeInt16(288,p.insideHorizontal?1:0),t.writeInt16(289,p.insideVertical?1:0))}if(this.tableBorderColors&&(t.writeInt16(63,this.tableBorderColors.left),t.writeInt16(64,this.tableBorderColors.top),t.writeInt16(65,this.tableBorderColors.insideHorizontal),t.writeInt16(66,this.tableBorderColors.bottom),t.writeInt16(68,this.tableBorderColors.insideVertical),t.writeInt16(69,this.tableBorderColors.right)),(l=this.rowDataTypes)!=null&&l.length)for(const g of this.rowDataTypes)t.writeInt16(97,g);if((c=this.rowUnitTypes)!=null&&c.length)for(const g of this.rowUnitTypes)t.writeInt16(98,g);if((u=this.rowFormats)!=null&&u.length)for(const g of this.rowFormats)t.writeString(4,g);return this}writeCellText(t,e,i,r){if(!i){if(e.length<=250){t.writeString(1,e);return}const a=Math.ceil(e.length/250);for(let h=0;h<a;h++){const l=h*250,c=l+250,u=e.slice(l,c);h===a-1?t.writeString(1,u):t.writeString(2,u)}return}if(t.writeString(301,r??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const o=Math.ceil(e.length/250);for(let a=0;a<o;a++){const h=a*250,l=h+250,c=e.slice(h,l);a===o-1?t.writeString(302,c):t.writeString(303,c)}t.writeString(304,"ACVALUE_END")}};Lr.typeName="Table";let Sn=Lr;const le=new O,_s=new k,pe=class pe extends J{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new m,new m,new m,new m]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get area(){return new V(pe.boundaryPointsFromVertices(this._vertices),!0).area}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new C().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return Ci(t,e,this._vertices),this}subGetOsnapPoints(t,e,i,r){const s=[this._vertices[0],this._vertices[1],this._vertices[3],this._vertices[2]];ar(s,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._elevation=this._vertices[0].z,this}subWorldDraw(t){const e=new V(pe.boundaryPointsFromVertices(this._vertices),!0),i=new Tt;i.add(e);const r=t.subEntityTraits;return r.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),t.writeDouble(38,this.elevation),t.writeDouble(39,this.thickness),t.writePoint3d(10,this.getPointAt(0)),t.writePoint3d(11,this.getPointAt(1)),t.writePoint3d(12,this.getPointAt(2)),t.writePoint3d(13,this.getPointAt(3)),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:ut.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Xi(this.collectBoundary2d(),!0,t)}collectBoundary2d(){return pe.boundaryPointsFromVertices(this._vertices)}static boundaryPointsFromVertices(t){const e=t[0],i=t[1],r=t[2],s=t[3];return[new P(e.x,e.y),new P(i.x,i.y),new P(s.x,s.y),new P(r.x,r.y)]}};pe.typeName="Trace";let Ln=pe;class Gt extends Error{constructor(t="Unexpected end of buffer."){super(t),this.name="AcDbProxyGraphicEndOfBufferError"}}function Ea(n){return n instanceof ArrayBuffer?new Uint8Array(n):n}class dt{constructor(t,e=4){this._index=0,this._buffer=Ea(t),this._align=e}get index(){return this._index}get hasData(){return this._index<this._buffer.length}alignIndex(t){const e=t%this._align;return e?t+this._align-e:t}readStruct(t){if(!this.hasData)throw new Gt;const e=[];let i=0;for(const r of t){const s=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index+i,r);if(r===8)e.push(s.getFloat64(0,!0));else if(r===4)e.push(s.getUint32(0,!0));else throw new Error(`Unsupported struct size: ${r}`);i+=r}return this._index=this.alignIndex(this._index+i),e}readFloat(){return this.readStruct([8])[0]}readLong(){return this.readStruct([4])[0]}readSignedLong(){if(!this.hasData)throw new Gt;const e=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index,4).getInt32(0,!0);return this._index=this.alignIndex(this._index+4),e}readVertex(){return this.readStruct([8,8,8])}readPaddedString(t="utf-8"){const e=this._buffer;for(let i=this._index;i<e.length;i++)if(e[i]===0){const r=this._index;this._index=this.alignIndex(i+1);const s=e.subarray(r,i);return new TextDecoder(t).decode(s)}throw new Gt("Did not detect terminating zero byte.")}readPaddedUnicodeString(){const t=this._buffer;for(let e=this._index;e<t.length;e+=2)if(e+1<t.length&&t[e]===0&&t[e+1]===0){const i=this._index;this._index=this.alignIndex(e+2);const r=t.subarray(i,e);return new TextDecoder("utf-16le").decode(r)}throw new Gt("Did not detect terminating zero bytes.")}}class Ta{constructor(t,e="AC1015",i="cp1252"){this._bitIndex=0,this._buffer=Ea(t),this.dxfversion=e,this.encoding=i}get hasData(){return this._bitIndex>>3<this._buffer.length}readBit(){const t=this._bitIndex;this._bitIndex+=1;const e=t>>3;if(e>=this._buffer.length)throw new Gt;return this._buffer[e]&128>>(t&7)?1:0}readBits(t){const e=this._bitIndex,i=e+t;if(i-1>>3>=this._buffer.length)throw new Gt;this._bitIndex=i;let r=128>>(e&7),s=e>>3,o=0,a=this._buffer[s];for(;t>0;)o<<=1,a&r&&(o|=1),t-=1,r>>=1,!r&&t&&(r=128,s+=1,a=this._buffer[s]);return o}readUnsignedByte(){return this.readBits(8)}readSignedByte(){const t=this.readBits(8);return t&128?-((~t&255)+1):t}readAlignedBytes(t){const e=this._bitIndex>>3,i=e+t;if(i>this._buffer.length)throw new Gt;return this._bitIndex+=t<<3,this._buffer.subarray(e,i)}readUnsignedShort(){if(this._bitIndex&7){const e=this.readBits(8);return(this.readBits(8)<<8)+e}const t=this.readAlignedBytes(2);return t[1]<<8|t[0]}readSignedShort(){const t=this.readUnsignedShort();return t&32768?-((~t&65535)+1):t}readUnsignedLong(){if(this._bitIndex&7){const e=this.readBits(8),i=this.readBits(8),r=this.readBits(8);return(this.readBits(8)<<24)+(r<<16)+(i<<8)+e}const t=this.readAlignedBytes(4);return(t[3]<<24)+(t[2]<<16)+(t[1]<<8)+t[0]}readSignedLong(){const t=this.readUnsignedLong();return t&2147483648?-((~t&4294967295)+1):t}readFloat(){if(this._bitIndex&7){const i=new Uint8Array(8);for(let r=0;r<8;r++)i[r]=this.readBits(8);return new DataView(i.buffer).getFloat64(0,!0)}const t=this.readAlignedBytes(8),e=new Uint8Array(t);return new DataView(e.buffer).getFloat64(0,!0)}readRawDouble(t=1){return t===1?this.readFloat():Array.from({length:t},()=>this.readFloat())}readBitShort(t=1){const e=()=>{const i=this.readBits(2);return i===0?this.readSignedShort():i===1?this.readUnsignedByte():i===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitLong(t=1){const e=()=>{const i=this.readBits(2);return i===0?this.readSignedLong():i===1?this.readUnsignedByte():i===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitDouble(t=1){const e=()=>{const i=this.readBits(2);return i===0?this.readFloat():i===1?1:0};return t===1?e():Array.from({length:t},()=>e())}readBitDoubleDefault(t=1,e=0){const i=new Uint8Array(8);new DataView(i.buffer).setFloat64(0,e,!0);const r=()=>{const s=this.readBits(2);if(s===0)return e;if(s===1){const o=new Uint8Array(i);return o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}if(s===2){const o=new Uint8Array(i);return o[4]=this.readUnsignedByte(),o[5]=this.readUnsignedByte(),o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}return this.readFloat()};return t===1?r():Array.from({length:t},()=>r())}}function Ca(n){return Array.from(n,t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}function pu(n){const t=n.reduce((r,s)=>r+Math.floor(s.length/2),0),e=new Uint8Array(t);let i=0;for(const r of n)for(let s=0;s<r.length;s+=2)e[i++]=parseInt(r.slice(s,s+2),16);return e}const fu=127;var Oa=(n=>(n[n.Extents=1]="Extents",n[n.Circle=2]="Circle",n[n.Circle3P=3]="Circle3P",n[n.CircularArc=4]="CircularArc",n[n.CircularArc3P=5]="CircularArc3P",n[n.Polyline=6]="Polyline",n[n.Polygon=7]="Polygon",n[n.Mesh=8]="Mesh",n[n.Shell=9]="Shell",n[n.Text=10]="Text",n[n.Text2=11]="Text2",n[n.Xline=12]="Xline",n[n.Ray=13]="Ray",n[n.AttributeColor=14]="AttributeColor",n[n.AttributeLayer=16]="AttributeLayer",n[n.AttributeLinetype=18]="AttributeLinetype",n[n.AttributeMarker=19]="AttributeMarker",n[n.AttributeFill=20]="AttributeFill",n[n.AttributeTrueColor=22]="AttributeTrueColor",n[n.AttributeLineweight=23]="AttributeLineweight",n[n.AttributeLtscale=24]="AttributeLtscale",n[n.AttributeThickness=25]="AttributeThickness",n[n.PushMatrix=29]="PushMatrix",n[n.PopMatrix=31]="PopMatrix",n[n.PolylineWithNormals=32]="PolylineWithNormals",n[n.LwPolyline=33]="LwPolyline",n[n.UnicodeText=36]="UnicodeText",n[n.UnicodeText2=38]="UnicodeText2",n[n.EllipticArc=44]="EllipticArc",n))(Oa||{});const qt=x.Z_AXIS,yu=529;function mu(n){const t=n>>24&255;return t===ki?{rgb:n&16777215}:t===Oi?{colorIndex:256}:t===Fe?{colorIndex:0}:t===Yi?{colorIndex:n&255}:{colorIndex:n&255}}function qi(n){return new x(n.x,n.y,n.z??0)}function Ki(n){return new m(n.x,n.y,n.z??0)}function xs(n){return{x:n[0],y:n[1],z:n[2]}}class Mn{constructor(t,e={}){this._index=8,this._colorIndex=256,this._layer="0",this._linetype=Z,this._lineweight=exports.AcGiLineWeight.ByLineWeightDefault,this._ltscale=1,this._thickness=0,this._fill=!1,this._layers=[],this._linetypes=[],this._matrices=[],this._buffer=t,this._database=e.database,this._dxfversion=e.dxfversion??"AC1015",this._encoding=e.encoding??(this._dxfversion<"AC1024"?"windows-1252":"utf-8"),this._layer=e.defaultLayer??"0",this._database&&(this._database.tables.layerTable.newIterator().toArray().forEach(i=>this._layers.push(i.name)),this._database.tables.linetypeTable.newIterator().toArray().forEach(i=>this._linetypes.push(i.name)))}get extents(){return this._extents}scanExtents(){var i;const t=this._buffer;let e=this._index;for(;e<t.length;){const r=new DataView(t.buffer,t.byteOffset+e,8),s=r.getUint32(0,!0),o=r.getUint32(4,!0);if(s<8)break;if(o===1){const a=t.subarray(e+8,e+s);return this.readExtents(a),((i=this._extents)==null?void 0:i.length)===2?[this._extents[0],this._extents[1]]:void 0}e+=s}}worldDraw(t){const e=[],i=t.subEntityTraits,r={color:i.color.clone(),lineType:i.lineType,lineTypeScale:i.lineTypeScale,lineWeight:i.lineWeight,layer:i.layer,thickness:i.thickness},s=this._buffer;let o=this._index;for(;o<s.length;){const a=new DataView(s.buffer,s.byteOffset+o,8),h=a.getUint32(0,!0),l=a.getUint32(4,!0);if(h<8)break;const c=s.subarray(o+8,o+h);this.dispatchChunk(t,e,l,c),l!==20&&(this._fill=!1),o+=h}if(i.color=r.color,i.lineType=r.lineType,i.lineTypeScale=r.lineTypeScale,i.lineWeight=r.lineWeight,i.layer=r.layer,i.thickness=r.thickness,e.length!==0)return t.group(e)}dispatchChunk(t,e,i,r){switch(i){case 1:this.readExtents(r);break;case 2:this.drawCircle(t,e,r);break;case 3:this.drawCircle3P(t,e,r);break;case 4:this.drawCircularArc(t,e,r);break;case 5:this.drawCircularArc3P(t,e,r);break;case 44:this.drawEllipticArc(t,e,r);break;case 6:this.drawPolyline(t,e,r,!1);break;case 32:this.drawPolyline(t,e,r,!0);break;case 7:this.drawPolygon(t,e,r);break;case 33:this.drawLwPolyline(t,e,r);break;case 9:this.drawShell(t,e,r);break;case 10:this.drawText(t,e,r,!1);break;case 36:this.drawText(t,e,r,!0);break;case 11:this.drawText2(t,e,r,!1);break;case 38:this.drawText2(t,e,r,!0);break;case 12:this.drawXline(t,e,r,!1);break;case 13:this.drawXline(t,e,r,!0);break;case 14:this.readAttributeColor(r);break;case 16:this.readAttributeLayer(r);break;case 18:this.readAttributeLinetype(r);break;case 20:this.readAttributeFill(r);break;case 22:this.readAttributeTrueColor(r);break;case 23:this.readAttributeLineweight(r);break;case 24:this.readAttributeLtscale(r);break;case 25:this.readAttributeThickness(r);break;case 29:this.pushMatrix(r);break;case 31:this.popMatrix();break}}applyTraits(t){const e=t.subEntityTraits;e.layer=this._layer,e.lineTypeScale=this._ltscale,e.thickness=this._thickness,e.lineWeight=this._lineweight,this._rgbColor!=null?e.color=new k(exports.AcCmColorMethod.ByColor,this._rgbColor):this._colorIndex===256?e.color=new k(exports.AcCmColorMethod.ByLayer):this._colorIndex===0?e.color=new k(exports.AcCmColorMethod.ByBlock):this._colorIndex===7?e.color=new k(exports.AcCmColorMethod.ByACI,7):e.color=new k(exports.AcCmColorMethod.ByACI,this._colorIndex),e.lineType={name:this._linetype,type:this.resolveLineStyleType(),standardFlag:0,description:"",totalPatternLength:0}}resolveLineStyleType(){return this._linetype===Z?"ByLayer":this._linetype===St?"ByBlock":"UserSpecified"}transformPoint(t){const e=Array.isArray(t)?xs(t):t,i=Ki(e);return this._matrices.length>0&&i.applyMatrix4(this._matrices[this._matrices.length-1]),i}transformVector(t){const e=Array.isArray(t)?xs(t):t,i=qi(e);return this._matrices.length>0&&i.transformDirection(this._matrices[this._matrices.length-1]),!Number.isFinite(i.lengthSq())||i.lengthSq()<1e-24?qt.clone():i.normalize()}pushEntity(t,e){e&&t.push(e)}readExtents(t){const e=new dt(t),i=e.readVertex(),r=e.readVertex();this._extents=[new m(i[0],i[1],i[2]),new m(r[0],r[1],r[2])]}readAttributeColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);this._rgbColor=void 0,this._colorIndex=e>256||e<0?256:e}readAttributeLayer(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e<this._layers.length&&(this._layer=this._layers[e])}readAttributeLinetype(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e+2<this._linetypes.length?this._linetype=this._linetypes[e+2]:e===32766?this._linetype=St:this._linetype=Z}readAttributeFill(t){this._fill=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0)!==0}readAttributeTrueColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0),i=mu(e);this._rgbColor=i.rgb,i.colorIndex!=null&&(this._colorIndex=i.colorIndex)}readAttributeLineweight(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e>yu?this._lineweight=e-4294967296:this._lineweight=e}readAttributeLtscale(t){this._ltscale=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}readAttributeThickness(t){this._thickness=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}pushMatrix(t){const e=new Float64Array(t.buffer,t.byteOffset,16),i=new O().fromArray(Array.from(e));i.transpose(),this._matrices.push(i)}popMatrix(){this._matrices.length>0&&this._matrices.pop()}loadVertices(t,e){const i=new dt(t);let r=i.readLong();e&&(r+=1);const s=[];for(;r>0;){const[a,h,l]=i.readVertex();s.push(this.transformPoint({x:a,y:h,z:l})),r-=1}let o=qt;return e&&s.length>0&&(o=qi(s.pop())),{vertices:s,normal:o}}drawCircle(t,e,i){const r=new dt(i),s=r.readVertex(),o=r.readFloat(),a=this.transformVector(r.readVertex());let h=Ki({x:s[0],y:s[1],z:s[2]});a.equals(qt)||(h=xe(h,a)),h=this.transformPoint(h);const l=Ne(a),c=new bt(tn(h,a),o,0,B,a,l);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircle3P(t,e,i){const r=new dt(i),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),h=bt.computeCenterPoint(s,o,a);if(!h)return;const l=h.distanceTo(s),c=new bt(h,l,0,B,qt);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircularArc(t,e,i){const r=new dt(i),s=r.readVertex(),o=r.readFloat(),a=r.readVertex(),h=r.readVertex(),l=r.readFloat(),c=this.transformVector(a),u=Ki({x:s[0],y:s[1],z:s[2]}),g=qi({x:h[0],y:h[1],z:h[2]});this._matrices.length>0&&g.transformDirection(this._matrices[this._matrices.length-1]);const d=Number.isFinite(g.lengthSq())&&g.lengthSq()>=1e-24?g.normalize():Ne(c),p=0,f=l,y=new bt(this.transformPoint(u),o,p,f,c,d);this.applyTraits(t),this.pushEntity(e,t.circularArc(y))}drawCircularArc3P(t,e,i){const r=new dt(i),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),h=bt.computeCenterPoint(s,a,o);if(!h)return;const l=h.distanceTo(s),c=Et(h,s,qt),u=Et(h,a,qt),g=new bt(h,l,c,u,qt);this.applyTraits(t),this.pushEntity(e,t.circularArc(g))}drawEllipticArc(t,e,i){const r=new dt(i),s=this.transformPoint(r.readVertex()),o=this.transformVector(r.readVertex()),a=r.readFloat(),h=r.readFloat(),l=r.readFloat(),c=r.readFloat(),u=r.readFloat(),g=tn({x:Math.cos(u)*a,y:Math.sin(u)*a,z:0},o),d=new er(s,o,g,a,h,l,c);this.applyTraits(t),this.pushEntity(e,t.ellipticalArc(d))}drawPolyline(t,e,i,r){var o,a;const{vertices:s}=this.loadVertices(i,r);if(s.length!==0){if(s.length===1){this.applyTraits(t);const h=((o=this._database)==null?void 0:o.pdmode)??0,l=((a=this._database)==null?void 0:a.pdsize)??0;this.pushEntity(e,t.point(s[0],{displayMode:h,displaySize:l}));return}this.applyTraits(t),this.pushEntity(e,t.lines(s))}}drawPolygon(t,e,i){const{vertices:r}=this.loadVertices(i,!1);if(r.length<2)return;if(this._fill){const o=new V(r.map(l=>({x:l.x,y:l.y})),!0),a=new Tt;a.add(o);const h=t.subEntityTraits;h.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},h.drawOrder=-1,this.applyTraits(t),this.pushEntity(e,t.area(a));return}const s=[...r,r[0]];this.applyTraits(t),this.pushEntity(e,t.lines(s))}drawLwPolyline(t,e,i){const r=new Ta(i,this._dxfversion,this._encoding);let s=0,o=!1;r.readUnsignedLong();const a=r.readBitShort();a&8&&(s=r.readBitDouble()),a&512&&(o=!0);const h=r.readBitLong();if(h<=0)return;const l=a&16?r.readBitLong():0;this._dxfversion>="AC1024"&&(a&1024&&r.readBitLong(),a&32&&r.readBitLong());const c=r.readRawDouble(2),u=[this.transformPoint({x:c[0],y:c[1],z:s})];let g=c;for(let d=1;d<h;d++){const p=r.readBitDoubleDefault(1,g[0]),f=r.readBitDoubleDefault(1,g[1]);g=[p,f],u.push(this.transformPoint({x:p,y:f,z:s}))}for(let d=0;d<l;d++)r.readBitDouble();o&&u.length>1&&u.push(u[0].clone()),this.applyTraits(t),this.pushEntity(e,t.lines(u))}drawShell(t,e,i){const r=new dt(i),s=r.readLong(),o=[];for(let c=0;c<s;c++){const[u,g,d]=r.readVertex();o.push(this.transformPoint({x:u,y:g,z:d}))}const a=r.readLong(),h=[];let l=0;for(;l<a;){const c=Math.abs(r.readSignedLong());l+=1+c;const u=[];for(let d=0;d<c;d++)u.push(r.readLong());const g=u.map(d=>o[d]).filter(Boolean);if(g.length>=3)for(let d=0;d<g.length;d++)h.push(g[d]),h.push(g[(d+1)%g.length])}h.length!==0&&(this.applyTraits(t),this.pushEntity(e,t.lines(h)))}drawText(t,e,i,r){const s=new dt(i),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),h=this.transformVector(s.readVertex()),[l,c,u]=s.readStruct([8,8,8]),g=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:h,text:g,height:l,widthFactor:c,obliqueAngle:u})}drawText2(t,e,i,r){const s=new dt(i),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),h=this.transformVector(s.readVertex()),l=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);s.readSignedLong(),s.readSignedLong();const[c,u,g]=s.readStruct([8,8,8]);s.readFloat(),this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:h,text:l,height:c,widthFactor:u,obliqueAngle:g})}drawTextPrimitive(t,e,i){const r=Math.atan2(i.textDirection.y,i.textDirection.x),s={text:i.text,height:i.height,width:1/0,widthFactor:i.widthFactor,position:i.insert,rotation:r*180/Math.PI,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft},o={name:W,standardFlag:0,fixedTextHeight:0,widthFactor:i.widthFactor,obliqueAngle:i.obliqueAngle*180/Math.PI,textGenerationFlag:0,lastHeight:i.height,font:"txt",bigFont:""};this.applyTraits(t),this.pushEntity(e,t.mtext(s,o))}drawXline(t,e,i,r){const s=new dt(i),o=this.transformPoint(s.readVertex()),a=this.transformPoint(s.readVertex()),h=new x().subVectors(a,o);if(h.lengthSq()===0)return;const l=1e6,c=r?o.clone().add(h.normalize().multiplyScalar(l)):o.clone().sub(h.normalize().multiplyScalar(l)),u=a.clone().add(h.normalize().multiplyScalar(l));this.applyTraits(t),this.pushEntity(e,t.lines([c,u]))}}function ka(n,t){if(!(t!=null&&t.length))return;const e=new Uint8Array(t.reduce((r,s)=>r+Math.floor(s.length/2),0));let i=0;for(const r of t)for(let s=0;s<r.length;s+=2)e[i++]=parseInt(r.slice(s,s+2),16);return n!=null&&n>0&&e.length>=n?e.subarray(0,n):e}const Mr=class Mr extends q{constructor(){super(...arguments),this._originalDxfName="",this._originalClassName="",this._applicationName="",this._proxyEntityClassId=0,this._graphicsMetafileType=0,this._entityOrigins=[]}get dxfTypeName(){return"ACAD_PROXY_ENTITY"}get originalDxfName(){return this._originalDxfName}set originalDxfName(t){this._originalDxfName=t}get originalClassName(){return this._originalClassName}set originalClassName(t){this._originalClassName=t}get applicationName(){return this._applicationName}set applicationName(t){this._applicationName=t}get proxyEntityClassId(){return this._proxyEntityClassId}set proxyEntityClassId(t){this._proxyEntityClassId=t}get graphicsMetafileType(){return this._graphicsMetafileType}set graphicsMetafileType(t){this._graphicsMetafileType=t}get proxyGraphic(){return this._proxyGraphic}setProxyGraphic(t){this._proxyGraphic=t?new Uint8Array(t):void 0}get entityOrigins(){return this._entityOrigins}setEntityOrigins(t){this._entityOrigins=t.map(e=>new m(e.x,e.y,e.z))}get geometricExtents(){const t=this._proxyGraphic;if(!(t!=null&&t.length))return new C;const i=new Mn(t,{database:this.database,defaultLayer:this.layer}).scanExtents();return i?new C().setFromPoints(i):new C}subGetGripPoints(){if(this._entityOrigins.length>0)return[...this._entityOrigins];const t=this.geometricExtents;return t.isEmpty()?[]:[new m(t.min.x,t.min.y,t.min.z),new m(t.max.x,t.max.y,t.max.z)]}subMoveGripPointsAt(t,e){return this._entityOrigins.length>0?(Ci(t,e,this._entityOrigins),this):this.geometricExtents.isEmpty()?this:(K(t,r=>{r===0&&this.transformBy(O.makeTranslation(e))}),this)}transformBy(t){return this._entityOrigins.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._proxyGraphic;return e!=null&&e.length?new Mn(e,{database:this.database,defaultLayer:this.layer}).worldDraw(t):void 0}dxfOutFields(t){var e;if(super.dxfOutFields(t),t.writeSubclassMarker("AcDbProxyEntity"),t.writeString(1,this._originalDxfName),this._originalClassName&&t.writeString(3,this._originalClassName),this._applicationName&&t.writeString(1001,this._applicationName),t.writeInt32(90,this._proxyEntityClassId),t.writeInt32(91,this._graphicsMetafileType),this._entityOrigins.length>0&&(t.writeInt32(92,this._entityOrigins.length),this._entityOrigins.forEach(i=>{t.writePoint3d(10,i)})),(e=this._proxyGraphic)!=null&&e.length){t.writeInt32(160,this._proxyGraphic.length);let i=0;for(;i<this._proxyGraphic.length;){const r=this._proxyGraphic.subarray(i,i+127);t.writeString(310,Ca(r)),i+=127}}return this}loadProxyGraphicFromDxf(t,e){const i=ka(t,e);i&&this.setProxyGraphic(i)}};Mr.typeName="ProxyEntity";let In=Mr;const Ir=class Ir extends q{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new m}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new C().expandByPoint(this._geo)}subGetGripPoints(){return[this._geo]}subMoveGripPointsAt(t,e){return kt(t,e,this._geo),this}subGetOsnapPoints(t,e,i,r){t===w.Node&&r.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbPoint"),t.writePoint3d(10,this.position),this}};Ir.typeName="Point";let En=Ir;var Ya=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(Ya||{}),Xa=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Xa||{});const Er=class Er extends q{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new m,this._scale=new G(1,1),this._rotation=0,this._imageSize=new P,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get imageSize(){return this._imageSize}set imageSize(t){this._imageSize.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new C;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subMoveGripPointsAt(t,e){return K(t,i=>{this.isClipped&&this._clipBoundary.length>3?this.moveClippedBoundaryGripAt(i,e):this.moveUnclippedGripAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){if(t===w.Insertion){r.push(this._position);return}const s=this.boundaryPath();if(s.length===0)return;let o=s;if(s.length>1){const a=s[0],h=s[s.length-1];a.x===h.x&&a.y===h.y&&(a.z||0)===(h.z||0)&&(o=s.slice(0,-1))}if(t===w.EndPoint){r.push(...o);return}ar(o,!0,t,e,r)}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}transformBy(t){const e=this._width*this._scale.x,i=this._height*this._scale.y,r=new x(e*Math.cos(this._rotation),e*Math.sin(this._rotation),0),s=new x(-i*Math.sin(this._rotation),i*Math.cos(this._rotation),0),o=this._position.clone(),a=this._position.clone().add(r),h=this._position.clone().add(s);o.applyMatrix4(t),a.applyMatrix4(t),h.applyMatrix4(t);const l=new x(a).sub(o),c=new x(h).sub(o);return this._position.copy(o),this._rotation=Math.atan2(l.y,l.x),this._width=l.length(),this._height=c.length(),this._scale.set(1,1),this}moveUnclippedGripAt(t,e){const i=this._position.x,r=this._position.y,s=this._width,o=this._height;switch(t){case 0:this._position.add(e);break;case 1:{const a=i,h=r+o,l=i+s+e.x,c=r+e.y;this._position.x=a,this._position.y=c,this._width=l-a,this._height=h-c;break}case 2:{const a=i+s+e.x,h=r+o+e.y;this._width=a-i,this._height=h-r;break}case 3:{const a=i+s,h=r,l=i+e.x,c=r+o+e.y;this._position.x=l,this._position.y=h,this._width=a-l,this._height=c-h;break}}}moveClippedBoundaryGripAt(t,e){if(t<0||t>=this._clipBoundary.length)return;const i=this._width,r=this._height,s=new Q;s.setFromPoints(this._clipBoundary);const o=new P;o.setX(this._position.x-s.min.x*i),o.setY(this._position.y-s.min.y*r);const a=this._clipBoundary[t],h=a.x*i+o.x+e.x,l=a.y*r+o.y+e.y;a.x=(h-o.x)/i,a.y=(l-o.y)/r}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,i=this._height,r=new Q;r.setFromPoints(this._clipBoundary);const s=new P;s.setX(this._position.x-r.min.x*e),s.setY(this._position.y-r.min.y*i),this._clipBoundary.forEach(o=>{const a=o.x*e+s.x,h=o.y*i+s.y;t.push(new m(a,h,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){ws.copy(t[1]);for(let e=1;e<4;e++)ii.copy(t[e]),ii.rotateAround(ws,this._rotation),t[e].setX(ii.x),t[e].setY(ii.y)}t.push(t[0])}return t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImage"),t.writePoint3d(10,this.position);const e=this.width*this.scale.x,i=this.height*this.scale.y,r=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:i},s=r.x>0?e/r.x:e,o=r.y>0?i/r.y:i,a=Math.cos(this._rotation),h=Math.sin(this._rotation);t.writePoint3d(11,{x:s*a,y:s*h,z:0}),t.writePoint3d(12,{x:-o*h,y:o*a,z:0}),t.writePoint2d(13,r),t.writeObjectId(340,this.imageDefId);const l=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,l),t.writeInt16(280,this.isClipped?1:0),t.writeInt16(281,this.brightness),t.writeInt16(282,this.contrast),t.writeInt16(283,this.fade),t.writeInt16(71,this.clipBoundaryType),this.isClipped){t.writeInt16(91,this.clipBoundary.length);for(const c of this.clipBoundary)t.writePoint2d(14,c)}return this}};Er.typeName="RasterImage";let fi=Er;const ws=new P,ii=new P,Li=class Li extends J{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new m,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new C;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return kt(t,e,this.basePoint),this}subGetOsnapPoints(t,e,i,r){const s=this.basePoint;if(t===w.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ct(s,s.clone().add(o));switch(t){case w.Nearest:{const h=a.project(e),c=new x(h).sub(s).dot(o);r.push(c<0?s:h);break}case w.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRay"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,i=this.unitDir,r=Math.hypot(i.x,i.y);return r<=1e-9||(i.x*(t.y-e.y)-i.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=uo(this.basePoint,this.unitDir,t);if(!e)return null;const i=new Li;return i.basePoint=e,i.unitDir=this.unitDir.clone(),i}};Li.typeName="Ray";let Tn=Li;const Tr=class Tr extends q{get dxfTypeName(){return"SHAPE"}constructor(){super(),this._position=new m,this._size=1,this._name="",this._rotation=0,this._widthFactor=1,this._oblique=0,this._thickness=0,this._normal=new x(0,0,1),this._shapeNumber=0,this._styleName=""}get position(){return this._position}set position(t){this._position.copy(t)}get size(){return this._size}set size(t){this._size=t}get name(){return this._name}set name(t){this._name=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get shapeNumber(){return this._shapeNumber}set shapeNumber(t){this._shapeNumber=t}get styleId(){var e,i,r;const t=(r=(i=(e=this.database)==null?void 0:e.tables)==null?void 0:i.textStyleTable)==null?void 0:r.resolveAt(this._styleName);return(t==null?void 0:t.objectId)??""}set styleId(t){var i,r,s;const e=(s=(r=(i=this.database)==null?void 0:i.tables)==null?void 0:r.textStyleTable)==null?void 0:s.getIdAt(t);e&&(this._styleName=e.name)}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get isPlanar(){return!0}get geometricExtents(){const t=Math.abs(this._size)/2,e=new C;return e.expandByPoint(this._position),t>0&&(e.expandByPoint(new m(this._position.x-t,this._position.y-t,this._position.z)),e.expandByPoint(new m(this._position.x+t,this._position.y+t,this._position.z))),e}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){t===w.Insertion&&r.push(this._position)}transformBy(t){const e=new O().setFromExtrusionDirection(this._normal),i=new O().makeRotationZ(this._rotation),r=new O().multiplyMatrices(e,i),s=this._position.clone(),o=new m(this._widthFactor,0,0).applyMatrix4(r).add(s),a=new m(0,1,0).applyMatrix4(r).add(s),h=new m(0,0,1).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),h.applyMatrix4(t);const l=new x(o).sub(s),c=new x(a).sub(s),u=new x(h).sub(s);let g=new x().crossVectors(l,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const p=new O().setFromExtrusionDirection(g).clone().invert(),f=l.clone().applyMatrix4(p),y=c.length(),_=l.length();this._position.copy(s),this._normal.copy(g),_>0&&(this._rotation=Math.atan2(f.y,f.x)),y>0&&(this._size*=y,_>0&&(this._widthFactor*=_/y));const v=u.length();return v>0&&(this._thickness*=v),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"shape",properties:[{name:"name",type:"string",editable:!0,accessor:{get:()=>this.name,set:t=>{this.name=t}}},{name:"size",type:"float",editable:!0,accessor:{get:()=>this.size,set:t=>{this.size=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}},{name:"shapeNumber",type:"int",editable:!0,accessor:{get:()=>this.shapeNumber,set:t=>{this.shapeNumber=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t,e){const i=this.getTextStyle(),r=i?{...i,widthFactor:this.widthFactor,obliqueAngle:this.oblique*180/Math.PI}:void 0,s={name:this._name.trim()||void 0,shapeNumber:this._shapeNumber!==0?this._shapeNumber:void 0,size:this.size,position:this._position,rotation:this._rotation,directionVector:this._normal,widthFactor:this.widthFactor};return t.shape(s,r,e)}getTextStyle(){const t=this.styleName.trim();if(!t)return;const e=this.database.tables.textStyleTable.resolveAt(t);return e==null?void 0:e.textStyle}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbShape"),t.writePoint3d(10,this.position),t.writeDouble(40,this.size),t.writeString(2,this.name),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeDouble(39,this.thickness),this._styleName&&t.writeString(3,this._styleName),t.writeVector3d(210,this.normal),this}};Tr.typeName="Shape";let Cn=Tr;const Cr=class Cr extends q{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new m,this._height=0,this._width=0,this._viewCenter=new m,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){const t=this._width/2,e=this._height/2,i=new C;return i.expandByPoint(new m(this._centerPoint.x-t,this._centerPoint.y-e,this._centerPoint.z)),i.expandByPoint(new m(this._centerPoint.x+t,this._centerPoint.y+e,this._centerPoint.z)),i}subGetGripPoints(){const t=new Array,e=this._width/2,i=this._height/2,r=this._centerPoint.z;return t.push(this._centerPoint),(e>0||i>0)&&t.push(new m(this._centerPoint.x-e,this._centerPoint.y-i,r),new m(this._centerPoint.x+e,this._centerPoint.y-i,r),new m(this._centerPoint.x+e,this._centerPoint.y+i,r),new m(this._centerPoint.x-e,this._centerPoint.y+i,r)),t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}transformBy(t){const e=this._centerPoint.clone(),i=this._centerPoint.clone().add(new x(this._width,0,0)),r=this._centerPoint.clone().add(new x(0,this._height,0));e.applyMatrix4(t),i.applyMatrix4(t),r.applyMatrix4(t);const s=new x(i).sub(e),o=new x(r).sub(e),a=this._height!==0?o.length()/this._height:1;return this._centerPoint.copy(e),this._width=s.length(),this._height=o.length(),this._viewHeight*=a,this}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new ko;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const i=[];return i.push(e.lines([new m(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new m(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),i.push(e.lines([new m(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new m(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new m(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new m(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new m(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new m(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),i}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewport"),t.writePoint3d(10,this.centerPoint),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writePoint3d(12,this.viewCenter),t.writeDouble(45,this.viewHeight),t.writeInt32(69,this.number),this}moveGripAt(t,e){switch(t){case 0:this._centerPoint.add(e);break;case 1:case 2:case 3:case 4:{const i=this.width/2,r=this.height/2,s=this._centerPoint.x,o=this._centerPoint.y,a={1:{x:s-i,y:o-r},2:{x:s+i,y:o-r},3:{x:s+i,y:o+r},4:{x:s-i,y:o+r}},h=t===1?3:t===2?4:t===3?1:2,l=a[t],c=a[h];l.x+=e.x,l.y+=e.y,this._centerPoint.x=(l.x+c.x)/2,this._centerPoint.y=(l.y+c.y)/2,this._centerPoint.z=(this._centerPoint.z??0)+(e.z??0),this.width=Math.abs(c.x-l.x),this.height=Math.abs(c.y-l.y);break}}}};Cr.typeName="Viewport";let On=Cr;const Or=class Or extends fi{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),i=new Tt;return i.add(new V(e)),t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),this}};Or.typeName="Wipeout";let kn=Or;const Mi=class Mi extends J{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new m,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new C;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return kt(t,e,this.basePoint),this}subGetOsnapPoints(t,e,i,r){const s=this.basePoint;if(t===w.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ct(s,s.clone().add(o));switch(t){case w.Nearest:r.push(a.project(e));break;case w.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXline"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,i=this.unitDir,r=Math.hypot(i.x,i.y);return r<=1e-9||(i.x*(t.y-e.y)-i.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=uo(this.basePoint,this.unitDir,t);if(!e)return null;const i=new Mi;return i.basePoint=e,i.unitDir=this.unitDir.clone(),i}};Mi.typeName="Xline";let Yn=Mi;class Na{constructor(t){this.position=new m(t.x,t.y,t.z||0)}}const kr=class kr extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i,r=!1,s=!1){super(),this._mCount=t,this._nCount=e,this._closedM=r,this._closedN=s,this._vertices=i.map(o=>new Na(o))}get mCount(){return this._mCount}get nCount(){return this._nCount}get closedM(){return this._closedM}get closedN(){return this._closedN}get closed(){return this._closedM}get area(){return 0}set closed(t){this._closedM=t}get numberOfVertices(){return this._vertices.length}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getVertexAtMN(t,e){const i=t*this._nCount+e;return this.getVertexAt(i)}get geometricExtents(){if(this._vertices.length===0)return new C(new m(0,0,0),new m(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),i=Math.min(i,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new C(new m(t,e,i),new m(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return K(t,i=>{const r=this._vertices[i];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"mCount",type:"float",editable:!1,accessor:{get:()=>this._mCount}},{name:"nCount",type:"float",editable:!1,accessor:{get:()=>this._nCount}},{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:t=>{this._closedM=t}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:t=>{this._closedN=t}}}]}]}}subWorldDraw(t){const e=[];for(let i=0;i<this._mCount;i++)for(let r=0;r<this._nCount;r++){const s=this.getVertexAtMN(i,r);let o=r+1;if(o>=this._nCount)if(this._closedN)o=0;else continue;const a=this.getVertexAtMN(i,o);e.push(s.position),e.push(a.position)}for(let i=0;i<this._nCount;i++)for(let r=0;r<this._mCount;r++){const s=this.getVertexAtMN(r,i);let o=r+1;if(o>=this._mCount)if(this._closedM)o=0;else continue;const a=this.getVertexAtMN(o,i);e.push(s.position),e.push(a.position)}return t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolygonMesh");let e=16;return this._closedM&&(e|=1),this._closedN&&(e|=32),t.writeInt16(66,1),t.writeInt16(70,e),t.writeInt32(71,this._mCount),t.writeInt32(72,this._nCount),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;i++){const r=this.getVertexAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolygonMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,16)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:ut.from2dPoints(e,this.isBoundaryClosed()).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Xi(this.collectBoundary2d(),this.isBoundaryClosed(),t)}isBoundaryClosed(){return this._closedM&&this._closedN&&this._mCount>1&&this._nCount>1}collectBoundary2d(){const t=this._mCount,e=this._nCount;if(t<1||e<1)return[];const i=[],r=(s,o)=>{const a=this.getVertexAtMN(s,o).position;i.push(new P(a.x,a.y))};if(t===1){for(let s=0;s<e;s++)r(0,s);return i}if(e===1){for(let s=0;s<t;s++)r(s,0);return i}for(let s=0;s<e;s++)r(0,s);for(let s=1;s<t;s++)r(s,e-1);for(let s=e-2;s>=0;s--)r(t-1,s);for(let s=t-2;s>=1;s--)r(s,0);return i}};kr.typeName="PolygonMesh";let Xn=kr;class Ba{constructor(t){this.position=new m(t.x,t.y,t.z||0)}}class Ra{constructor(t){this.vertexIndices=t}}const Yr=class Yr extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e){super(),this._vertices=t.map(i=>new Ba(i)),this._faces=e.map(i=>new Ra(i))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}get area(){return 0}set closed(t){}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getFaceAt(t){if(t<0||t>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[t]}get geometricExtents(){if(this._vertices.length===0)return new C(new m(0,0,0),new m(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),i=Math.min(i,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new C(new m(t,e,i),new m(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return K(t,i=>{const r=this._vertices[i];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}},{name:"faces",type:"array",editable:!1,itemSchema:{properties:[{name:"vertexIndices",type:"array",editable:!1,itemSchema:{properties:[{name:"index",type:"int",editable:!1}]}}]},accessor:{get:()=>this._faces.map(t=>({vertexIndices:t.vertexIndices}))}}]}]}}subWorldDraw(t){const e=[];return this._faces.forEach(i=>{const r=[];if(i.vertexIndices.forEach(s=>{const o=Math.abs(s)-1;o>=0&&o<this._vertices.length&&r.push(this._vertices[o].position)}),r.length>=3)for(let s=0;s<r.length;s++){const o=r[s],a=r[(s+1)%r.length];e.push(o),e.push(a)}}),t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyFaceMesh");const e=64;return t.writeInt16(66,1),t.writeInt16(70,e),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;i++){const r=this.getVertexAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,64)}for(let i=0;i<this.numberOfFaces;i++){const r=this.getFaceAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writeInt16(70,128),r.vertexIndices.forEach((s,o)=>{t.writeInt32(10+o,s)})}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectLargestFaceBoundary2d();return e.length<2?1:ut.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Xi(this.collectLargestFaceBoundary2d(),!0,t)}collectLargestFaceBoundary2d(){let t=[];for(const e of this._faces){const i=e.vertexIndices.filter(r=>r>=0);i.length>t.length&&(t=i)}return t.length<2?this._vertices.map(e=>new P(e.position.x,e.position.y)):t.map(e=>{const i=this.getVertexAt(e).position;return new P(i.x,i.y)})}};Yr.typeName="PolyFaceMesh";let Nn=Yr;var za=(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))(za||{});const _u=["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"],xu=n=>_u[n];var Fa=(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))(Fa||{});class ur{parse(t){const i=this.normalizeLineEndings(t).split(`
7
- `),r=[],s=[];let o=null;return i.forEach((a,h)=>{const l=h+1,c=this.stripInlineComment(a).trim();if(!c)return;if(c.startsWith("*")){this.flushCurrentPattern(o,r,s);const g=this.parseHeader(c.slice(1));if(!g){s.push({line:l,message:"Invalid pattern header.",source:a}),o=null;return}o={pattern:{name:g.name,description:g.description,lines:[]},headerLine:l};return}if(!o){s.push({line:l,message:"Line descriptor appears before any pattern header.",source:a});return}const u=this.parseLineDescriptor(c,l);if(!u){s.push({line:l,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:a});return}o.pattern.lines.push(u)}),this.flushCurrentPattern(o,r,s),{patterns:r,issues:s}}static parse(t){return new ur().parse(t)}normalizeLineEndings(t){return t.replace(/\r\n/g,`
3
+ `}registerHandle(t){return this._handleMap.has(t)||(/^[0-9A-F]+$/i.test(t)?this._handleMap.set(t,t.toUpperCase()):(this._handleMap.set(t,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1)),this._handleMap.get(t)}resolveHandle(t){if(t)return this.registerHandle(t)}writeGroup(t,e){if(e==null)return this;this._lines.push(String(Math.trunc(t)));const i=this.formatValue(e);return this._lines.push(i===""?"0":i),this}writeStart(t){return this.writeString(0,t)}writeSubclassMarker(t){return this.writeString(100,t)}writeString(t,e){return!e&&e!==""?this:this.writeGroup(t,e)}writeInt8(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt16(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt32(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt64(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeUInt16(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeUInt32(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeBoolean(t,e){return e==null?this:this.writeGroup(t,e?1:0)}writeBool(t,e){return this.writeBoolean(t,e)}writeDouble(t,e){return e==null||!Number.isFinite(e)?this:this.writeGroup(t,e)}writeAngle(t,e){return e==null||!Number.isFinite(e)?this:this.writeDouble(t,e*180/Math.PI)}writeHandle(t,e){const i=this.resolveHandle(e);return i?this.writeString(t,i):this}writeObjectId(t,e){return this.writeHandle(t,e)}writePoint2d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this):this}writePoint3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeVector3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeCmColor(t,e=62,i=420){if(!t)return this;const r=t.colorIndex;r!=null&&this.writeInt16(e,r);const s=t.RGB;return s!=null&&t.colorIndex==null&&this.writeInt32(i,s),this}writeTransparency(t,e=440){return!t||t.method===exports.AcCmTransparencyMethod.ErrorValue?this:this.writeInt32(e,t.serialize())}writeResultBuffer(t){if(!t)return this;for(const e of t)this.writeGroup(e.code,e.value);return this}startSection(t){return this.writeStart("SECTION"),this.writeString(2,t),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(t){return this.writeStart("TABLE"),this.writeString(2,t),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(t){if(typeof t=="string")return this.sanitizeStringForDxfLine(t);if(typeof t=="boolean")return t?"1":"0";if(typeof t=="number"){if(!Number.isFinite(t))return"0";if(Number.isInteger(t))return String(t);const i=t.toFixed(this._precision).replace(/\.?0+$/,"");return i===""||i==="-"?"0":i}return String(t)}sanitizeStringForDxfLine(t){return t.replace(/\r\n|\r|\n/g," ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}}var Zt=256,ks=[],$r=256,We;for(;Zt--;)ks[Zt]=(Zt+256).toString(16).substring(1);function cl(n){var t=0,e=11;if(!We||Zt+e>$r*2)for(We="",Zt=0;t<$r;t++)We+=ks[Math.random()*256|0];return We.substring(Zt,Zt+++e)}const ri="TEMP_";let Ne;function Ys(n){Ne=n}function ul(){if(Ne)return Ne().workingDatabase;throw new Error("The current working database must be set before using it!")}class _t{constructor(t,e){if(t=t||{},this._attrs=new Ms(t,e),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return ri+cl()}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t),t&&!t.startsWith(ri)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(ri)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){if(this._database)return this._database;if(Ne)return Ne().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this.assignDatabase(t)}assignDatabase(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Un.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}clone(){const t=Object.create(Object.getPrototypeOf(this)),e=this,i=t;for(const r of Object.keys(e))r!=="_database"&&(i[r]=this.cloneValue(e[r]));return t.objectId=this.generateTemporaryHandle(),t}cloneValue(t){if(t==null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(r=>this.cloneValue(r));if(t instanceof Map){const r=new Map;for(const[s,o]of t.entries())r.set(this.cloneValue(s),this.cloneValue(o));return r}if(t instanceof Set){const r=new Set;for(const s of t.values())r.add(this.cloneValue(s));return r}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));const r=t.constructor;return new r(t)}if(t instanceof ArrayBuffer)return t.slice(0);if("clone"in t&&typeof t.clone=="function")return t.clone();const e=Object.create(Object.getPrototypeOf(t)),i=t;for(const r of Object.keys(i))e[r]=this.cloneValue(i[r]);return e}dxfOut(...t){const[e,i=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),i)for(const r of this._xDataMap.values())e.writeResultBuffer(r);return this}dxfOutFields(t){return this}}var tt=["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"],qr=1234567,$n=Math.PI/180,qn=180/Math.PI;function Xs(){var n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0,r=tt[n&255]+tt[n>>8&255]+tt[n>>16&255]+tt[n>>24&255]+"-"+tt[t&255]+tt[t>>8&255]+"-"+tt[t>>16&15|64]+tt[t>>24&255]+"-"+tt[e&63|128]+tt[e>>8&255]+"-"+tt[e>>16&255]+tt[e>>24&255]+tt[i&255]+tt[i>>8&255]+tt[i>>16&255]+tt[i>>24&255];return r.toLowerCase()}function Et(n,t,e){return Math.max(t,Math.min(e,n))}function Kn(n,t){return(n%t+t)%t}function Ns(n,t,e,i,r){return i+(n-t)*(r-i)/(e-t)}function Bs(n,t,e){return n!==t?(e-n)/(t-n):0}function Zn(n,t,e){return(1-e)*n+e*t}function Rs(n,t,e,i){return Zn(n,t,1-Math.exp(-e*i))}function zs(n,t){return t===void 0&&(t=1),t-Math.abs(Kn(n,t*2)-t)}function Fs(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function Vs(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function js(n,t){return n+Math.floor(Math.random()*(t-n+1))}function Gs(n,t){return n+Math.random()*(t-n)}function Ds(n){return n*(.5-Math.random())}function Hs(n){n!==void 0&&(qr=n);var t=qr+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Us(n){return n*$n}function Ws(n){return n*qn}function $s(n){return(n&n-1)===0&&n!==0}function qs(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Ks(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ie(n){var t=Math.PI*2;return(n%t+t)%t}function Zs(n,t,e){return n>t&&n<e||n>e&&n<t}function Qs(n,t,e,i){return i===void 0&&(i=!1),n=Ie(n),t=Ie(t),e=Ie(e),i?t>e?n<=t&&n>=e:n<=t||n>=e:t<e?n>=t&&n<=e:n>=t||n<=e}function Qn(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Js(n,t){t===void 0&&(t=1e-7);var e=Qn(n);return Math.max(Math.pow(10,e)*t,t)}var M={DEG2RAD:$n,RAD2DEG:qn,generateUUID:Xs,clamp:Et,euclideanModulo:Kn,mapLinear:Ns,inverseLerp:Bs,lerp:Zn,damp:Rs,pingpong:zs,smoothstep:Fs,smootherstep:Vs,randInt:js,randFloat:Gs,randFloatSpread:Ds,seededRandom:Hs,degToRad:Us,radToDeg:Ws,isPowerOfTwo:$s,ceilPowerOfTwo:qs,floorPowerOfTwo:Ks,normalizeAngle:Ie,isBetween:Zs,isBetweenAngle:Qs,intPartLength:Qn,relativeEps:Js},dl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},G=function(){function n(t,e){this.x=0,this.y=0;var i=+(t!==void 0)+ +(e!==void 0);if(i!==0){if(i===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(i===1){var r=t,s=r.x,o=r.y;this.x=s,this.y=o;return}if(i===2){this.x=t,this.y=e;return}throw lt.ILLEGAL_PARAMETERS}}return Object.defineProperty(n.prototype,"width",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e){return this.x=t,this.y=e,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},n.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.applyMatrix2d=function(t){var e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this},n.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},n.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},n.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},n.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y},n.prototype.cross=function(t){return this.x*t.y-this.y*t.x},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},n.prototype.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t},n.prototype.rotateAround=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*i-o*r+t.x,this.y=s*r+o*i+t.y,this},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},n.prototype.relativeEps=function(t){return t===void 0&&(t=1e-7),Math.min(M.relativeEps(this.x,t),M.relativeEps(this.y,t))},n.prototype[Symbol.iterator]=function(){return dl(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[2]}})},n.EMPTY=Object.freeze(new n(0,0)),n}(),De=function(){function n(t,e,i,r,s,o,a,h,l){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&h!=null&&l!=null&&this.set(t,e,i,r,s,o,a,h,l)}return n.prototype.set=function(t,e,i,r,s,o,a,h,l){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=s,c[5]=h,c[6]=i,c[7]=o,c[8]=l,this},n.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},n.prototype.copy=function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},n.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[3],h=i[6],l=i[1],c=i[4],u=i[7],g=i[2],d=i[5],p=i[8],f=r[0],y=r[3],_=r[6],v=r[1],S=r[4],A=r[7],L=r[2],T=r[5],E=r[8];return s[0]=o*f+a*v+h*L,s[3]=o*y+a*S+h*T,s[6]=o*_+a*A+h*E,s[1]=l*f+c*v+u*L,s[4]=l*y+c*S+u*T,s[7]=l*_+c*A+u*E,s[2]=g*f+d*v+p*L,s[5]=g*y+d*S+p*T,s[8]=g*_+d*A+p*E,this},n.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8];return e*o*c-e*a*l-i*s*c+i*a*h+r*s*l-r*o*h},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=c*o-a*l,g=a*h-c*s,d=l*s-o*h,p=e*u+i*g+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=u*f,t[1]=(r*l-c*i)*f,t[2]=(a*i-r*o)*f,t[3]=g*f,t[4]=(c*e-r*h)*f,t[5]=(r*s-a*e)*f,t[6]=d*f,t[7]=(i*h-l*e)*f,t[8]=(o*e-i*s)*f,this},n.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},n.prototype.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},n.prototype.transposeIntoArray=function(t){var e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this},n.prototype.setUvTransform=function(t,e,i,r,s,o,a){var h=Math.cos(s),l=Math.sin(s);return this.set(i*h,i*l,-i*(h*o+l*a)+o+t,-r*l,r*h,-r*(-l*o+h*a)+a+e,0,0,1),this},n.prototype.scale=function(t,e){return this.premultiply(zi.makeScale(t,e)),this},n.prototype.rotate=function(t){return this.premultiply(zi.makeRotation(-t)),this},n.prototype.translate=function(t,e){return this.premultiply(zi.makeTranslation(t,e)),this},n.prototype.makeTranslation=function(t,e){return t instanceof G?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this},n.prototype.makeRotation=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this},n.prototype.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.IDENTITY=Object.freeze(new n),n}(),zi=new De,Mt=1e-6,B=2*Math.PI,gl={x:0,y:0},Jn={x:0,y:0,z:0},F=function(){function n(){this.equalPointTol=Mt,this.equalVectorTol=Mt}return n.prototype.clone=function(){var t=new n;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t},n.prototype.equalPoint2d=function(t,e){return new G(t).sub(e).length()<this.equalPointTol},n.prototype.equalPoint3d=function(t,e){return new x(t).sub(e).length()<this.equalPointTol},n.equalToZero=function(t,e){return e===void 0&&(e=Mt),t<e&&t>-e},n.equal=function(t,e,i){return i===void 0&&(i=Mt),Math.abs(t-e)<i},n.great=function(t,e,i){return i===void 0&&(i=Mt),t-e>i},n.less=function(t,e,i){return i===void 0&&(i=Mt),t-e<i},n.isPositive=function(t,e){return e===void 0&&(e=Mt),t>e},n.isNonPositive=function(t,e){return e===void 0&&(e=Mt),t<=e},n}(),Ii=new F,pl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},_e=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this._x=t,this._y=e,this._z=i,this._w=r}return n.slerpFlat=function(t,e,i,r,s,o,a){var h=i[r+0],l=i[r+1],c=i[r+2],u=i[r+3],g=s[o+0],d=s[o+1],p=s[o+2],f=s[o+3];if(a===0){t[e+0]=h,t[e+1]=l,t[e+2]=c,t[e+3]=u;return}if(a===1){t[e+0]=g,t[e+1]=d,t[e+2]=p,t[e+3]=f;return}if(u!==f||h!==g||l!==d||c!==p){var y=1-a,_=h*g+l*d+c*p+u*f,v=_>=0?1:-1,S=1-_*_;if(S>Number.EPSILON){var A=Math.sqrt(S),L=Math.atan2(A,_*v);y=Math.sin(y*L)/A,a=Math.sin(a*L)/A}var T=a*v;if(h=h*y+g*T,l=l*y+d*T,c=c*y+p*T,u=u*y+f*T,y===1-a){var E=1/Math.sqrt(h*h+l*l+c*c+u*u);h*=E,l*=E,c*=E,u*=E}}t[e]=h,t[e+1]=l,t[e+2]=c,t[e+3]=u},n.multiplyQuaternionsFlat=function(t,e,i,r,s,o){var a=i[r],h=i[r+1],l=i[r+2],c=i[r+3],u=s[o],g=s[o+1],d=s[o+2],p=s[o+3];return t[e]=a*p+c*u+h*d-l*g,t[e+1]=h*p+c*g+l*u-a*d,t[e+2]=l*p+c*d+a*g-h*u,t[e+3]=c*p-a*u-h*g-l*d,t},Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},n.prototype.setFromEuler=function(t,e){e===void 0&&(e=!0);var i=t.x,r=t.y,s=t.z,o=t.order,a=Math.cos,h=Math.sin,l=a(i/2),c=a(r/2),u=a(s/2),g=h(i/2),d=h(r/2),p=h(s/2);switch(o){case"XYZ":this._x=g*c*u+l*d*p,this._y=l*d*u-g*c*p,this._z=l*c*p+g*d*u,this._w=l*c*u-g*d*p;break;case"YXZ":this._x=g*c*u+l*d*p,this._y=l*d*u-g*c*p,this._z=l*c*p-g*d*u,this._w=l*c*u+g*d*p;break;case"ZXY":this._x=g*c*u-l*d*p,this._y=l*d*u+g*c*p,this._z=l*c*p+g*d*u,this._w=l*c*u-g*d*p;break;case"ZYX":this._x=g*c*u-l*d*p,this._y=l*d*u+g*c*p,this._z=l*c*p-g*d*u,this._w=l*c*u+g*d*p;break;case"YZX":this._x=g*c*u+l*d*p,this._y=l*d*u+g*c*p,this._z=l*c*p-g*d*u,this._w=l*c*u-g*d*p;break;case"XZY":this._x=g*c*u-l*d*p,this._y=l*d*u-g*c*p,this._z=l*c*p+g*d*u,this._w=l*c*u+g*d*p;break;default:}return e===!0&&this._onChangeCallback(),this},n.prototype.setFromAxisAngle=function(t,e){var i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],s=e[8],o=e[1],a=e[5],h=e[9],l=e[2],c=e[6],u=e[10],g=i+a+u;if(g>0){var d=.5/Math.sqrt(g+1);this._w=.25/d,this._x=(c-h)*d,this._y=(s-l)*d,this._z=(o-r)*d}else if(i>a&&i>u){var d=2*Math.sqrt(1+i-a-u);this._w=(c-h)/d,this._x=.25*d,this._y=(r+o)/d,this._z=(s+l)/d}else if(a>u){var d=2*Math.sqrt(1+a-i-u);this._w=(s-l)/d,this._x=(r+o)/d,this._y=.25*d,this._z=(h+c)/d}else{var d=2*Math.sqrt(1+u-i-a);this._w=(o-r)/d,this._x=(s+l)/d,this._y=(h+c)/d,this._z=.25*d}return this._onChangeCallback(),this},n.prototype.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},n.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(Et(this.dot(t),-1,1)))},n.prototype.rotateTowards=function(t,e){var i=this.angleTo(t);if(i===0)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},n.prototype.identity=function(){return this.set(0,0,0,1)},n.prototype.invert=function(){return this.conjugate()},n.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},n.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},n.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},n.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},n.prototype.multiplyQuaternions=function(t,e){var i=t._x,r=t._y,s=t._z,o=t._w,a=e._x,h=e._y,l=e._z,c=e._w;return this._x=i*c+o*a+r*l-s*h,this._y=r*c+o*h+s*a-i*l,this._z=s*c+o*l+i*h-r*a,this._w=o*c-i*a-r*h-s*l,this._onChangeCallback(),this},n.prototype.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copy(t);var i=this._x,r=this._y,s=this._z,o=this._w,a=o*t._w+i*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;var h=1-a*a;if(h<=Number.EPSILON){var l=1-e;return this._w=l*o+e*this._w,this._x=l*i+e*this._x,this._y=l*r+e*this._y,this._z=l*s+e*this._z,this.normalize(),this}var c=Math.sqrt(h),u=Math.atan2(c,a),g=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*g+this._w*d,this._x=i*g+this._x*d,this._y=r*g+this._y*d,this._z=s*g+this._z*d,this._onChangeCallback(),this},n.prototype.slerpQuaternions=function(t,e,i){return this.copy(t).slerp(e,i)},n.prototype.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))},n.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},n.prototype.toJSON=function(){return this.toArray()},n.prototype._onChange=function(t){return this._onChangeCallback=t,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return pl(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._w];case 4:return t.sent(),[2]}})},n}(),fl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},x=function(){function n(t,e,i){this.x=0,this.y=0,this.z=0;var r=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){var s=t,o=s.x,a=s.y,h=s.z;this.x=o,this.y=a,this.z=h||0;return}if(r===3){this.x=t,this.y=e,this.z=i;return}throw lt.ILLEGAL_PARAMETERS}}return n.prototype.set=function(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setZ=function(t){return this.z=t,this},n.prototype.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},n.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},n.prototype.applyEuler=function(t){return this.applyQuaternion(Kr.setFromEuler(t))},n.prototype.applyAxisAngle=function(t,e){return this.applyQuaternion(Kr.setFromAxisAngle(t,e))},n.prototype.applyMatrix3=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this},n.prototype.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},n.prototype.applyMatrix4=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*o,this},n.prototype.applyQuaternion=function(t){var e=this.x,i=this.y,r=this.z,s=t.x,o=t.y,a=t.z,h=t.w,l=2*(o*r-a*i),c=2*(a*e-s*r),u=2*(s*i-o*e);return this.x=e+h*l+o*u-a*c,this.y=i+h*c+a*l-s*u,this.z=r+h*u+s*c-o*l,this},n.prototype.transformDirection=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.prototype.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},n.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.isParallelTo=function(t){var e=this.dot(t),i=this.length(),r=t.length();return Math.abs(e)===i*r},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},n.prototype.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},n.prototype.cross=function(t){return this.crossVectors(this,t)},n.prototype.crossVectors=function(t,e){var i=t.x,r=t.y,s=t.z,o=e.x,a=e.y,h=e.z;return this.x=r*h-s*a,this.y=s*o-i*h,this.z=i*a-r*o,this},n.prototype.projectOnVector=function(t){var e=t.lengthSq();if(e===0)return this.set(0,0,0);var i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)},n.prototype.projectOnPlane=function(t){return Fi.copy(this).projectOnVector(t),this.sub(Fi)},n.prototype.reflect=function(t){return this.sub(Fi.copy(t).multiplyScalar(2*this.dot(t)))},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},n.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},n.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this},n.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,e*4)},n.prototype.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,e*3)},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},n.prototype.randomDirection=function(){var t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this},n.prototype[Symbol.iterator]=function(){return fl(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[4,this.z];case 3:return t.sent(),[2]}})},n.ORIGIN=Object.freeze(new n(0,0,0)),n.X_AXIS=Object.freeze(new n(1,0,0)),n.NEGATIVE_X_AXIS=Object.freeze(new n(-1,0,0)),n.Y_AXIS=Object.freeze(new n(0,1,0)),n.NEGATIVE_Y_AXIS=Object.freeze(new n(0,-1,0)),n.Z_AXIS=Object.freeze(new n(0,0,1)),n.NEGATIVE_Z_AXIS=Object.freeze(new n(0,0,-1)),n}(),Fi=new x,Kr=new _e,O=function(){function n(t,e,i,r,s,o,a,h,l,c,u,g,d,p,f,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&h!=null&&l!=null&&c!=null&&u!=null&&g!=null&&d!=null&&p!=null&&f!=null&&y!=null&&this.set(t,e,i,r,s,o,a,h,l,c,u,g,d,p,f,y)}return n.makeTranslation=function(t,e,i){return new n().makeTranslation(t,e,i)},n.prototype.set=function(t,e,i,r,s,o,a,h,l,c,u,g,d,p,f,y){var _=this.elements;return _[0]=t,_[4]=e,_[8]=i,_[12]=r,_[1]=s,_[5]=o,_[9]=a,_[13]=h,_[2]=l,_[6]=c,_[10]=u,_[14]=g,_[3]=d,_[7]=p,_[11]=f,_[15]=y,this},n.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.prototype.copy=function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},n.prototype.copyPosition=function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},n.prototype.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},n.prototype.setFromExtrusionDirection=function(t){var e=Math.hypot(t.x,t.y,t.z);if(!Number.isFinite(e)||e<1e-12)return this.identity(),this;var i=Math.abs(e-1)>1e-6?t.clone().multiplyScalar(1/e):t;if(Ii.equalPoint3d(i,x.Z_AXIS))this.identity();else{var r=new x(1,0,0);Math.abs(i.x)<1/64&&Math.abs(i.y)<1/64?r.crossVectors(x.Y_AXIS,i).normalize():r.crossVectors(x.Z_AXIS,i).normalize();var s=i.clone().cross(r).normalize();this.set(r.x,r.y,r.z,0,s.x,s.y,s.z,0,i.x,i.y,i.z,0,0,0,0,1)}return this},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},n.prototype.makeBasis=function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},n.prototype.extractRotation=function(t){var e=this.elements,i=t.elements,r=1/oe.setFromMatrixColumn(t,0).length(),s=1/oe.setFromMatrixColumn(t,1).length(),o=1/oe.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},n.prototype.makeRotationFromQuaternion=function(t){return this.compose(yl,t,ml)},n.prototype.lookAt=function(t,e,i){var r=this.elements;return ht.subVectors(t,e),ht.lengthSq()===0&&(ht.z=1),ht.normalize(),Bt.crossVectors(i,ht),Bt.lengthSq()===0&&(Math.abs(i.z)===1?ht.x+=1e-4:ht.z+=1e-4,ht.normalize(),Bt.crossVectors(i,ht)),Bt.normalize(),$e.crossVectors(ht,Bt),r[0]=Bt.x,r[4]=$e.x,r[8]=ht.x,r[1]=Bt.y,r[5]=$e.y,r[9]=ht.y,r[2]=Bt.z,r[6]=$e.z,r[10]=ht.z,this},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[4],h=i[8],l=i[12],c=i[1],u=i[5],g=i[9],d=i[13],p=i[2],f=i[6],y=i[10],_=i[14],v=i[3],S=i[7],A=i[11],L=i[15],T=r[0],E=r[4],X=r[8],I=r[12],z=r[1],Y=r[5],R=r[9],H=r[13],it=r[2],xt=r[6],ne=r[10],re=r[14],Wt=r[3],se=r[7],Xt=r[11],Nt=r[15];return s[0]=o*T+a*z+h*it+l*Wt,s[4]=o*E+a*Y+h*xt+l*se,s[8]=o*X+a*R+h*ne+l*Xt,s[12]=o*I+a*H+h*re+l*Nt,s[1]=c*T+u*z+g*it+d*Wt,s[5]=c*E+u*Y+g*xt+d*se,s[9]=c*X+u*R+g*ne+d*Xt,s[13]=c*I+u*H+g*re+d*Nt,s[2]=p*T+f*z+y*it+_*Wt,s[6]=p*E+f*Y+y*xt+_*se,s[10]=p*X+f*R+y*ne+_*Xt,s[14]=p*I+f*H+y*re+_*Nt,s[3]=v*T+S*z+A*it+L*Wt,s[7]=v*E+S*Y+A*xt+L*se,s[11]=v*X+S*R+A*ne+L*Xt,s[15]=v*I+S*H+A*re+L*Nt,this},n.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],o=t[1],a=t[5],h=t[9],l=t[13],c=t[2],u=t[6],g=t[10],d=t[14],p=t[3],f=t[7],y=t[11],_=t[15];return p*(+s*h*u-r*l*u-s*a*g+i*l*g+r*a*d-i*h*d)+f*(+e*h*d-e*l*g+s*o*g-r*o*d+r*l*c-s*h*c)+y*(+e*l*u-e*a*d-s*o*u+i*o*d+s*a*c-i*l*c)+_*(-r*a*c-e*h*u+e*a*g+r*o*u-i*o*g+i*h*c)},n.prototype.transpose=function(){var t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},n.prototype.setPosition=function(t,e,i){var r=this.elements;return t instanceof x?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=t[9],g=t[10],d=t[11],p=t[12],f=t[13],y=t[14],_=t[15],v=u*y*l-f*g*l+f*h*d-a*y*d-u*h*_+a*g*_,S=p*g*l-c*y*l-p*h*d+o*y*d+c*h*_-o*g*_,A=c*f*l-p*u*l+p*a*d-o*f*d-c*a*_+o*u*_,L=p*u*h-c*f*h-p*a*g+o*f*g+c*a*y-o*u*y,T=e*v+i*S+r*A+s*L;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=v*E,t[1]=(f*g*s-u*y*s-f*r*d+i*y*d+u*r*_-i*g*_)*E,t[2]=(a*y*s-f*h*s+f*r*l-i*y*l-a*r*_+i*h*_)*E,t[3]=(u*h*s-a*g*s-u*r*l+i*g*l+a*r*d-i*h*d)*E,t[4]=S*E,t[5]=(c*y*s-p*g*s+p*r*d-e*y*d-c*r*_+e*g*_)*E,t[6]=(p*h*s-o*y*s-p*r*l+e*y*l+o*r*_-e*h*_)*E,t[7]=(o*g*s-c*h*s+c*r*l-e*g*l-o*r*d+e*h*d)*E,t[8]=A*E,t[9]=(p*u*s-c*f*s-p*i*d+e*f*d+c*i*_-e*u*_)*E,t[10]=(o*f*s-p*a*s+p*i*l-e*f*l-o*i*_+e*a*_)*E,t[11]=(c*a*s-o*u*s-c*i*l+e*u*l+o*i*d-e*a*d)*E,t[12]=L*E,t[13]=(c*f*r-p*u*r+p*i*g-e*f*g-c*i*y+e*u*y)*E,t[14]=(p*a*r-o*f*r-p*i*h+e*f*h+o*i*y-e*a*y)*E,t[15]=(o*u*r-c*a*r+c*i*h-e*u*h-o*i*g+e*a*g)*E,this},n.prototype.scale=function(t){var e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this},n.prototype.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))},n.prototype.makeTranslation=function(t,e,i){var r;return typeof t=="object"?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,(r=t.z)!==null&&r!==void 0?r:0,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},n.prototype.makeRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},n.prototype.makeRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},n.prototype.makeRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},n.prototype.makeRotationAxis=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=1-i,o=t.x,a=t.y,h=t.z,l=s*o,c=s*a;return this.set(l*o+i,l*a-r*h,l*h+r*a,0,l*a+r*h,c*a+i,c*h-r*o,0,l*h-r*a,c*h+r*o,s*h*h+i,0,0,0,0,1),this},n.prototype.makeScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},n.prototype.makeShear=function(t,e,i,r,s,o){return this.set(1,i,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this},n.prototype.compose=function(t,e,i){var r=this.elements,s=e.x,o=e.y,a=e.z,h=e.w,l=s+s,c=o+o,u=a+a,g=s*l,d=s*c,p=s*u,f=o*c,y=o*u,_=a*u,v=h*l,S=h*c,A=h*u,L=i.x,T=i.y,E=i.z;return r[0]=(1-(f+_))*L,r[1]=(d+A)*L,r[2]=(p-S)*L,r[3]=0,r[4]=(d-A)*T,r[5]=(1-(g+_))*T,r[6]=(y+v)*T,r[7]=0,r[8]=(p+S)*E,r[9]=(y-v)*E,r[10]=(1-(g+f))*E,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},n.prototype.decompose=function(t,e,i){var r=this.elements,s=oe.set(r[0],r[1],r[2]).length(),o=oe.set(r[4],r[5],r[6]).length(),a=oe.set(r[8],r[9],r[10]).length(),h=this.determinant();h<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],pt.copy(this);var l=1/s,c=1/o,u=1/a;return pt.elements[0]*=l,pt.elements[1]*=l,pt.elements[2]*=l,pt.elements[4]*=c,pt.elements[5]*=c,pt.elements[6]*=c,pt.elements[8]*=u,pt.elements[9]*=u,pt.elements[10]*=u,e.setFromRotationMatrix(pt),i.x=s,i.y=o,i.z=a,this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t},n.IDENTITY=Object.freeze(new n),n}(),oe=new x,pt=new O,yl=new x(0,0,0),ml=new x(1,1,1),Bt=new x,$e=new x,ht=new x,C=function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new x(1/0,1/0,1/0):new x(t.x,t.y,t.z),this.max=e==null?new x(-1/0,-1/0,-1/0):new x(e.x,e.y,e.z)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromArray=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e+=3)this.expandByPoint(Vi.fromArray(t,e));return this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Vi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new x(0,0,0):new x(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},n.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},n.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},n.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},n.prototype.intersectsPlane=function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Vi).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.applyMatrix4=function(t){return this.isEmpty()?this:(Lt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Lt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Lt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Lt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Lt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Lt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Lt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Lt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Lt),this)},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n}(),Lt=[new x,new x,new x,new x,new x,new x,new x,new x],Vi=new x,Zr=new G,Q=function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new G(1/0,1/0):new G(t.x,t.y),this.max=e==null?new G(-1/0,-1/0):new G(e.x,e.y)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Zr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new G(0,0):new G(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new G(0,0):new G(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},n.prototype.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},n.prototype.getParameter=function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},n.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Zr).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n}(),Qr=new x,_l=new x,xl=new De,tr=function(){function n(t,e){t===void 0&&(t=new x(1,0,0)),e===void 0&&(e=0),this.normal=t,this.constant=e}return n.prototype.set=function(t,e){return this.normal.copy(t),this.constant=e,this},n.prototype.setComponents=function(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this},n.prototype.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},n.prototype.setFromCoplanarPoints=function(t,e,i){var r=Qr.subVectors(i,e).cross(_l.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},n.prototype.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},n.prototype.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},n.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},n.prototype.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},n.prototype.projectPoint=function(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},n.prototype.intersectsBox=function(t){return t.intersectsPlane(this)},n.prototype.coplanarPoint=function(t){return t.copy(this.normal).multiplyScalar(-this.constant)},n.prototype.applyMatrix4=function(t,e){var i=e||xl.getNormalMatrix(t),r=this.coplanarPoint(Qr).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this},n.prototype.translate=function(t){return this.constant-=t.dot(this.normal),this},n.prototype.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},n.prototype.clone=function(){return new n().copy(this)},n}(),wl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),P=function(n){wl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y)},t.pointArrayToNumberArray=function(e){var i=new Array(e.length*2);return e.forEach(function(r,s){r.toArray(i,s*2)}),i},t}(G),bl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),m=function(n){bl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.pointArrayToNumberArray=function(e,i){i===void 0&&(i=!0);var r=i?3:2,s=new Array(e.length*r);return e.forEach(function(o,a){o.toArray(s,a*r)}),s},t}(x),vl=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,r=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Jr=new O,ts=new _e,Pl=function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=n.DEFAULT_ORDER),this._x=t,this._y=e,this._z=i,this._order=r}return Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"order",{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e,i,r){return r===void 0&&(r=this._order),this._x=t,this._y=e,this._z=i,this._order=r,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._order)},n.prototype.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(t,e,i){e===void 0&&(e=this._order),i===void 0&&(i=!0);var r=t.elements,s=r[0],o=r[4],a=r[8],h=r[1],l=r[5],c=r[9],u=r[2],g=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(Et(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Et(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Et(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(h,s));break;case"ZYX":this._y=Math.asin(-Et(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,d),this._z=Math.atan2(h,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Et(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Et(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:}return this._order=e,i===!0&&this._onChangeCallback(),this},n.prototype.setFromQuaternion=function(t,e,i){return i===void 0&&(i=!0),Jr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Jr,e,i)},n.prototype.setFromVector3=function(t,e){return e===void 0&&(e=this._order),this.set(t.x,t.y,t.z,e)},n.prototype.reorder=function(t){return ts.setFromEuler(this),this.setFromQuaternion(ts,t)},n.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},n.prototype.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},n.prototype._onChange=function(t){return this._onChangeCallback=t,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return vl(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._order];case 4:return t.sent(),[2]}})},n.DEFAULT_ORDER="XYZ",n}();function Al(n){var t,e=n;return{x:n.x,y:n.y,z:(t=e.z)!==null&&t!==void 0?t:0}}function Sl(n,t){var e,i;n.x+=t.x,n.y+=t.y,n.z=((e=n.z)!==null&&e!==void 0?e:0)+((i=t.z)!==null&&i!==void 0?i:0)}function Ll(n,t,e){e===void 0&&(e=!1);for(var i=n.x,r=n.y,s=!1,o=t.length,a=0,h=o-1;a<o;h=a++){var l=t[a].x,c=t[a].y,u=t[h].x,g=t[h].y,d=c>r!=g>r;e&&(d=c>=r!=g>=r);var p=d&&i<(u-l)*(r-c)/(g-c)+l;p&&(s=!s)}return s}function Ml(n,t){if(n.length===0||t.length===0)return!1;var e=new Q().setFromPoints(n),i=new Q().setFromPoints(t);if(!e.intersectsBox(i))return!1;for(var r=0;r<n.length;){if(nt.isPointInPolygon(n[r],t,!0))return!0;r<n.length-1&&Ii.equalPoint2d(n[r+1],n[r])&&++r,++r}return!1}var nt={applyOffsetToPoint3d:Sl,isPointInPolygon:Ll,isPolygonIntersect:Ml,point2dToPoint3d:Al},qe=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Ke=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function El(n,t){for(var e=[],i=t-1,r=n,s=0;s<=r;s++)e.push(0);for(var s=1;s<=i-r;s++)e.push(s);for(var s=0;s<=r;s++)e.push(i-r+1);return e}function Il(n,t){for(var e=t.length-1,i=n,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],l=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+h*h+l*l);s+=c,r.push(s)}for(var u=[],o=0;o<=i;o++)u.push(0);for(var o=1;o<=e-i;o++){var g=r[o]/s;u.push(g*(e-i+1))}for(var o=0;o<=i;o++)u.push(e-i+1);return u}function to(n,t){t===void 0&&(t="Uniform");var e=n.length;if(e===0)return[];if(e===1)return[0];var i=e-1;if(t==="Uniform")return new Array(e).fill(0).map(function(g,d){return d/i});for(var r=[0],s=0,o=1;o<=i;o++){var a=n[o][0]-n[o-1][0],h=n[o][1]-n[o-1][1],l=n[o][2]-n[o-1][2],c=Math.sqrt(a*a+h*h+l*l),u=t==="SqrtChord"?Math.sqrt(c):c;s+=u,r.push(s)}return s<1e-12?new Array(e).fill(0).map(function(g,d){return d/i}):r.map(function(g){return g/s})}function eo(n,t){for(var e=t.length-1,i=n,r=e+i+1,s=new Array(r+1).fill(0),o=t[t.length-1],a=r-i;a<=r;a++)s[a]=o;for(var h=1;h<=e-i;h++){for(var l=0,a=h;a<h+i;a++)l+=t[a];s[h+i]=l/i}return s}function Tl(n,t){for(var e=t.length-1,i=n,r=[0],s=0,o=1;o<=e;o++){var a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],l=t[o][2]-t[o-1][2],c=Math.sqrt(a*a+h*h+l*l),u=Math.sqrt(c);s+=u,r.push(s)}for(var g=[],o=0;o<=i;o++)g.push(0);for(var o=1;o<=e-i;o++){var d=r[o]/s;g.push(d*(e-i+1))}for(var o=0;o<=i;o++)g.push(e-i+1);return g}function ji(n,t){for(var e=n.length,i=n.map(function(y){return y.slice()}),r=t.slice(),s=0;s<e;s++){for(var o=s,a=Math.abs(i[s][s]),h=s+1;h<e;h++){var l=Math.abs(i[h][s]);l>a&&(a=l,o=h)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==s){var c=i[s];i[s]=i[o],i[o]=c;var u=r[s];r[s]=r[o],r[o]=u}for(var h=s+1;h<e;h++){var g=i[h][s]/i[s][s];if(!(Math.abs(g)<1e-14)){for(var d=s;d<e;d++)i[h][d]-=g*i[s][d];r[h]-=g*r[s]}}}for(var p=new Array(e).fill(0),h=e-1;h>=0;h--){for(var f=r[h],d=h+1;d<e;d++)f-=i[h][d]*p[d];p[h]=f/i[h][h]}return p}function er(n,t,e,i,r){var s,o,a,h,l,c;if(e===void 0&&(e="Uniform"),n.length===0)return{controlPoints:[],knots:[],weights:[]};var u=n.map(function(Xt){var Nt;return[Xt[0],Xt[1],(Nt=Xt[2])!==null&&Nt!==void 0?Nt:0]}),g=!!i,d=!!r,p=(g?1:0)+(d?1:0),f=u.length-1,y=f+p;if(y<t)throw new Error("Not enough points to interpolate a curve of this degree.");var _=to(u,e),v=_.slice();g&&v.unshift(_[0]),d&&v.push(_[_.length-1]);var S=eo(t,v),A=y+1,L=new Array(A),T=new Array(A),E=new Array(A),X=new Array(A),I=0;L[I]=new Array(A).fill(0),L[I][0]=1,T[I]=u[0][0],E[I]=u[0][1],X[I]=u[0][2],I++;for(var z=1;z<=f-1;z++){var Y=_[z];L[I]=new Array(A).fill(0);for(var R=0;R<=y;R++)L[I][R]=Ht(R,t,Y,S);T[I]=u[z][0],E[I]=u[z][1],X[I]=u[z][2],I++}if(L[I]=new Array(A).fill(0),L[I][y]=1,T[I]=u[f][0],E[I]=u[f][1],X[I]=u[f][2],I++,g){var H=S[t+1]-S[0],it=H!==0?t/H:0;L[I]=new Array(A).fill(0),L[I][0]=-it,L[I][1]=it,T[I]=(s=i==null?void 0:i[0])!==null&&s!==void 0?s:0,E[I]=(o=i==null?void 0:i[1])!==null&&o!==void 0?o:0,X[I]=(a=i==null?void 0:i[2])!==null&&a!==void 0?a:0,I++}if(d){var H=S[y+t+1]-S[y],it=H!==0?t/H:0;L[I]=new Array(A).fill(0),L[I][y-1]=-it,L[I][y]=it,T[I]=(h=r==null?void 0:r[0])!==null&&h!==void 0?h:0,E[I]=(l=r==null?void 0:r[1])!==null&&l!==void 0?l:0,X[I]=(c=r==null?void 0:r[2])!==null&&c!==void 0?c:0,I++}for(var xt=ji(L,T),ne=ji(L,E),re=ji(L,X),Wt=new Array(A),z=0;z<A;z++)Wt[z]=[xt[z],ne[z],re[z]];var se=new Array(A).fill(1);return{controlPoints:Wt,knots:S,weights:se}}function Ht(n,t,e,i){if(t===0)return e>=i[n]&&e<i[n+1]?1:0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=r>1e-10?(e-i[n])/r:0,a=s>1e-10?(i[n+t+1]-e)/s:0;return o*Ht(n,t-1,e,i)+a*Ht(n+1,t-1,e,i)}function Te(n,t,e,i,r){var s=i.length-1,o=t;if(n=Math.max(e[o],Math.min(e[s+1],n)),Math.abs(n-e[s+1])<1e-8)return Ke([],qe(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return Ke([],qe(i[0]),!1);for(var a=[0,0,0],h=0,l=0;l<=s;l++){var c=Ht(l,o,n,e),u=r[l]*c;a[0]+=i[l][0]*u,a[1]+=i[l][1]*u,a[2]+=i[l][2]*u,h+=u}if(Math.abs(h)<1e-10){var g=e[e.length-o-1];if(Math.abs(n-g)<1e-8)return Ke([],qe(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return Ke([],qe(i[0]),!1)}return Math.abs(h)>=1e-10&&(a[0]/=h,a[1]/=h,a[2]/=h),a}function tn(n,t,e,i){if(t===0)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Ht(n,t-1,e,i)),s>1e-10&&(o-=t/s*Ht(n+1,t-1,e,i)),o}function Cl(n,t,e,i){if(t<=1)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*tn(n,t-1,e,i)),s>1e-10&&(o-=t/s*tn(n+1,t-1,e,i)),o}function Ol(n,t,e,i,r){var s=i.length-1,o=t,a=e[o],h=e[s+1];n=Math.max(a,Math.min(h,n));for(var l=[0,0,0],c=[0,0,0],u=[0,0,0],g=0,d=0,p=0,f=0;f<=s;f++){var y=Ht(f,o,n,e),_=tn(f,o,n,e),v=Cl(f,o,n,e),S=r[f],A=S*y,L=S*_,T=S*v,E=i[f];l[0]+=A*E[0],l[1]+=A*E[1],l[2]+=A*E[2],c[0]+=L*E[0],c[1]+=L*E[1],c[2]+=L*E[2],u[0]+=T*E[0],u[1]+=T*E[1],u[2]+=T*E[2],g+=A,d+=L,p+=T}if(Math.abs(g)<1e-10){var X=Te(n,t,e,i,r);return{point:X,deriv1:[0,0,0],deriv2:[0,0,0]}}var I=g*g,z=[l[0]/g,l[1]/g,l[2]/g],Y=[(c[0]*g-l[0]*d)/I,(c[1]*g-l[1]*d)/I,(c[2]*g-l[2]*d)/I],R=u[0]*g-l[0]*p,H=u[1]*g-l[1]*p,it=u[2]*g-l[2]*p,xt=[R/I-2*d*Y[0]/g,H/I-2*d*Y[1]/g,it/I-2*d*Y[2]/g];return{point:z,deriv1:Y,deriv2:xt}}function kl(n,t){var e=n[0],i=n[1],r=t[0],s=t[1],o=e*e+i*i;return o<1e-20?0:(e*s-i*r)/Math.pow(o,1.5)}function io(n,t,e,i){for(var r=n,s=t[r],o=t[t.length-r-1],a=0,h=1e3,l=(o-s)/h,c=Te(s,n,t,e,i),u=1;u<=h;u++){var g=s+u*l,d=Te(g,n,t,e,i),p=d[0]-c[0],f=d[1]-c[1],y=d[2]-c[2];a+=Math.sqrt(p*p+f*f+y*y),c=d}var _=Te(o,n,t,e,i),v=_[0]-c[0],S=_[1]-c[1],A=_[2]-c[2];return a+=Math.sqrt(v*v+S*S+A*A),a}function Yl(n,t,e,i,r){return t===void 0&&(t=3),e===void 0&&(e="Uniform"),n.length===0?[]:er(n,t,e,i,r).controlPoints}var es=new O,is=new x,Xl=new x,Nl=new x,Gi=new m;function no(n){return new O().setFromExtrusionDirection(new x(n.x,n.y,n.z))}function Be(n){return es.setFromExtrusionDirection(new x(n.x,n.y,n.z)),es.extractBasis(is,Xl,Nl),is.clone()}function en(n,t){var e;return new m(n.x,n.y,(e=n.z)!==null&&e!==void 0?e:0).applyMatrix4(no(t))}function xe(n,t){var e;return new m(n.x,n.y,(e=n.z)!==null&&e!==void 0?e:0).applyMatrix4(no(t).invert())}function It(n,t,e){var i,r,s=xe(n,e),o=xe(t,e);return Gi.set(o.x-s.x,o.y-s.y,((i=o.z)!==null&&i!==void 0?i:0)-((r=s.z)!==null&&r!==void 0?r:0)),M.normalizeAngle(Math.atan2(Gi.y,Gi.x))}function ro(n){var t=n.length;if(t<3)return 0;for(var e=0,i=0,r=t-1;i<t;r=i++){var s=n[r],o=n[i];e+=s.x*o.y-o.x*s.y}return e*.5}function Bl(n){return Math.abs(ro(n))}function Rl(n){var t,e,i=n.length;if(i<3)return 0;for(var r=0,s=0,o=0,a=0,h=i-1;a<i;h=a++){var l=n[h],c=n[a],u=l.x,g=l.y,d=(t=l.z)!==null&&t!==void 0?t:0,p=c.x,f=c.y,y=(e=c.z)!==null&&e!==void 0?e:0;r+=(d+y)*(g-f),s+=(u+p)*(d-y),o+=(g+f)*(u-p)}return .5*Math.hypot(r,s,o)}function zl(n){return n.length<3?0:Bl(n)}function so(n){return n.length<3?0:Rl(n)}var oo=function(){function n(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(n.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),n}(),Fl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),ir=function(n){Fl(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new De().makeTranslation(e.x,e.y))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t}(oo),Vl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Pe=function(n){Vl(t,n);function t(){var e=n.call(this)||this;return e.arcLengthDivisions=100,e}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},t.prototype.getPointAt=function(e){var i=this.getUtoTmapping(e);return this.getPoint(i)},t.prototype.getPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.getSpacedPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPointAt(r/e));return i},t.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},t.prototype.getLengths=function(e){e===void 0&&(e=this.arcLengthDivisions);var i=[],r,s=this.getPoint(0),o=0;i.push(0);for(var a=1;a<=e;a++)r=this.getPoint(a/e),o+=r.distanceTo(s),i.push(o),s=r;return i},t.prototype.getUtoTmapping=function(e,i){var r=this.getLengths(),s=0,o=r.length,a;i?a=i:a=e*r[o-1];for(var h=0,l=o-1,c;h<=l;)if(s=Math.floor(h+(l-h)/2),c=r[s]-a,c<0)h=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,r[s]===a)return s/(o-1);var u=r[s],g=r[s+1],d=g-u,p=(a-u)/d,f=(s+p)/(o-1);return f},t.prototype.getTangent=function(e){var i=1e-4,r=e-i,s=e+i;r<0&&(r=0),s>1&&(s=1);var o=this.getPoint(r),a=this.getPoint(s),h=new P;return h.copy(a).sub(o).normalize(),h},t.prototype.getTangentAt=function(e){var i=this.getUtoTmapping(e);return this.getTangent(i)},t}(ir),jl=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Ze=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Qe=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Je=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},ot=function(n){jl(t,n);function t(e,i,r,s,o){var a=n.call(this)||this,h=+(e!==void 0)+ +(i!==void 0)+ +(r!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(h==3)typeof e=="object"&&typeof i=="object"&&typeof r=="object"?a.createByThreePoints(e,i,r):a.createByStartEndPointsAndBulge(e,i,r);else if(h==5){var l=e;a.center=new P(l.x,l.y),a.radius=i,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(M.normalizeAngle(r)):M.normalizeAngle(r),a._endAngle=a._clockwise?a._mirrorAngle(M.normalizeAngle(s)):M.normalizeAngle(s)}else throw lt.ILLEGAL_PARAMETERS;return a}return t.prototype.createByThreePoints=function(e,i,r){var s=function(X,I){return{x:(X.x+I.x)/2,y:(X.y+I.y)/2}},o=function(X,I){return(I.y-X.y)/(I.x-X.x)},a=function(X){return-1/X},h=s(e,i),l=s(i,r),c=o(e,i),u=o(i,r),g=a(c),d=a(u),p=function(X,I,z,Y){var R=(Y-I)/(X-z),H=X*R+I;return{x:R,y:H}},f=h.y-g*h.x,y=l.y-d*l.x,_=p(g,f,d,y),v=Math.sqrt(Math.pow(e.x-_.x,2)+Math.pow(e.y-_.y,2)),S=function(X,I){return Math.atan2(X.y-I.y,X.x-I.x)},A=S(e,_),L=S(i,_),T=S(r,_),E=T>A&&T<L||A>T&&A<L||L>T&&L<A;this.center=_,this.radius=v,this._clockwise=!E,this._startAngle=A,this._endAngle=T},t.prototype.createByStartEndPointsAndBulge=function(e,i,r){var s,o,a;r<0?(s=Math.atan(-r)*4,o=new G(e),a=new G(i)):(s=Math.atan(r)*4,o=new G(i),a=new G(e));var h=new G().subVectors(a,o),l=h.length(),c=new G().addVectors(o,h.multiplyScalar(.5)),u=Math.abs(l/2/Math.tan(s/2)),g=h.normalize(),d=r<0?-Math.PI/2:Math.PI/2,p=new G(g.x*Math.cos(d)-g.y*Math.sin(d),g.y*Math.cos(d)+g.x*Math.sin(d)),f;s<Math.PI?r<0?f=c.add(p.multiplyScalar(u)):f=c.add(p.multiplyScalar(-u)):r<0?f=c.add(p.multiplyScalar(-u)):f=c.add(p.multiplyScalar(u)),r<0?(this._startAngle=Math.atan2(o.y-f.y,o.x-f.x),this._endAngle=Math.atan2(a.y-f.y,a.x-f.x)):(this._startAngle=Math.atan2(a.y-f.y,a.x-f.x),this._endAngle=Math.atan2(o.y-f.y,o.x-f.x)),this._clockwise=r<0,this.center=f,this.radius=a.sub(f).length()},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new P(e.x,e.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(e){this._startAngle=this._clockwise?this._mirrorAngle(M.normalizeAngle(e)):M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(e){var i=this.startAngle==0&&e==B?e:M.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(i):i,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype._mirrorAngle=function(e){var i=e*180/Math.PI,r=(360-i)%360;return r*Math.PI/180},t.prototype._getInternalAngle=function(e){return this._clockwise?this._mirrorAngle(e):e},Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return this.clockwise?M.normalizeAngle(e-i):M.normalizeAngle(i-e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._clockwise?M.normalizeAngle(e-this.deltaAngle/2):M.normalizeAngle(e+this.deltaAngle/2),r=this._clockwise?this._mirrorAngle(i):i;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return Math.abs(i-e)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i,r=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=Ze(s),a=o.next();!a.done;a=o.next()){var h=a.value,l=this._getInternalAngle(h);M.isBetweenAngle(l,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&r.push(this.getPointAtAngle(h))}}catch(g){e={error:g}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}var c=r.map(function(g){return g.x}),u=r.map(function(g){return g.y});return new Q(new P(Math.min.apply(Math,Je([],Qe(c),!1)),Math.min.apply(Math,Je([],Qe(u),!1))),new P(Math.max.apply(Math,Je([],Qe(c),!1)),Math.max.apply(Math,Je([],Qe(u),!1))))},Object.defineProperty(t.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){var i=this,r=e,s=this.center.clone().applyMatrix2d(r),o=this.startPoint.clone().applyMatrix2d(r);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=r.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(r),h=this.endPoint.clone().applyMatrix2d(r),l=new t(o,a,h),c=r.determinant()<0?!this.clockwise:this.clockwise,u=function(g){var d=M.normalizeAngle(g);return c?i._mirrorAngle(d):d};return this.center=l.center,this.radius=l.radius,this.clockwise=c,this.startAngle=u(Math.atan2(o.y-l.center.y,o.x-l.center.x)),this.endAngle=u(Math.atan2(h.y-l.center.y,h.x-l.center.x)),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},t.prototype.getPointAtAngle=function(e){var i=this._getInternalAngle(e),r=this.center.x+this.radius*Math.cos(i),s=this.center.y+this.radius*Math.sin(i);return new P(r,s)},t.prototype.getQuadrantPoints=function(){var e,i,r=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var h=Ze(a),l=h.next();!l.done;l=h.next()){var c=l.value,u=this._getInternalAngle(c);M.isBetweenAngle(u,s,o,this.clockwise)&&r.push(this.getPointAtAngle(c))}}catch(g){e={error:g}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}return r},t.prototype.nearestPoint=function(e){var i=new P(e.x,e.y),r=i.x-this.center.x,s=i.y-this.center.y,o=Math.hypot(r,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,r),h=this.clockwise?this._mirrorAngle(M.normalizeAngle(a)):M.normalizeAngle(a),l=this._getInternalAngle(h),c=this._getInternalAngle(this.startAngle),u=this._getInternalAngle(this.endAngle);if(M.isBetweenAngle(l,c,u,this.clockwise))return this.getPointAtAngle(h);var g=i.distanceToSquared(this.startPoint),d=i.distanceToSquared(this.endPoint);return g<=d?this.startPoint.clone():this.endPoint.clone()},t.prototype.perpendicularPoints=function(e){var i,r,s=new P(e.x,e.y),o=s.x-this.center.x,a=s.y-this.center.y,h=Math.hypot(o,a);if(h<1e-12)return[];var l=o/h,c=a/h,u=[new P(this.center.x+l*this.radius,this.center.y+c*this.radius),new P(this.center.x-l*this.radius,this.center.y-c*this.radius)],g=[],d=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var f=Ze(u),y=f.next();!y.done;y=f.next()){var _=y.value,v=Math.atan2(_.y-this.center.y,_.x-this.center.x),S=this.clockwise?this._mirrorAngle(M.normalizeAngle(v)):M.normalizeAngle(v),A=this._getInternalAngle(S);(this.closed||M.isBetweenAngle(A,d,p,this.clockwise))&&g.push(_)}}catch(L){i={error:L}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}return g},t.prototype.tangentPoints=function(e){var i,r,s=[],o=e.x-this.center.x,a=e.y-this.center.y,h=Math.hypot(o,a),l=this.radius;if(h<l)return s;var c=Math.acos(l/h),u=Math.atan2(a,o),g=[u+c,u-c],d=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var f=Ze(g),y=f.next();!y.done;y=f.next()){var _=y.value,v=this.clockwise?this._mirrorAngle(M.normalizeAngle(_)):M.normalizeAngle(_),S=this._getInternalAngle(v);(this.closed||M.isBetweenAngle(S,d,p,this.clockwise))&&s.push(this.getPointAtAngle(v))}}catch(A){i={error:A}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}return s},t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(r=B,s=0),this.clockwise)for(var o=0;o<=e;o++){var a=s-r*(o/e),h=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(h);i.push(new P(l.x,l.y))}else for(var o=0;o<=e;o++){var a=s+r*(o/e),h=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(h);i.push(new P(l.x,l.y))}return i},t}(Pe),nn=function(){return nn=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},nn.apply(this,arguments)},Gl=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ti=1e-6;function ao(n,t){if(uh(n)){var e=Hl(n,t);return e?[e]:[]}var i=uo(n),r=i.numberOfVertices;if(r<2)return[];var s=gh(i,t);return s?[s]:[]}function Dl(n){return uo(n)}function Hl(n,t){var e,i,r=Ul(n);if(r.length===0)return null;var s=[];try{for(var o=Gl(r),a=o.next();!a.done;a=o.next()){var h=a.value,l=$l(h,t);if(!l)return null;s.push(l)}}catch(d){e={error:d}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}var c=Wl(n),u=Ql(s,c,n.closed,t);if(u.length<2)return null;var g=new V;return u.forEach(function(d,p){g.addVertexAt(p,{x:d.x,y:d.y})}),g.closed=n.closed,g}function Ul(n){for(var t,e=[],i=n.numberOfVertices,r=n.closed?i:i-1,s=0;s<r;s++){var o=n.vertices[s],a=n.vertices[(s+1)%i];F.isPositive(Math.abs((t=o.bulge)!==null&&t!==void 0?t:0))?e.push({kind:"arc",arc:new ot(o,a,o.bulge)}):e.push({kind:"line",start:new P(o.x,o.y),end:new P(a.x,a.y)})}return e}function Wl(n){for(var t=[],e=0;e<n.numberOfVertices;e++)t.push(n.getPointAt(e));return t}function $l(n,t){if(n.kind==="line"){var e=Zl(n.start,n.end,t);return e?nn({kind:"line"},e):null}var i=ql(n.arc,n.arc.startPoint,n.arc.endPoint,t);return i?{kind:"arc",arc:i}:null}function ql(n,t,e,i){var r=Kl(n,t,e,i),s=n.radius+r;return F.isNonPositive(s)?null:new ot(n.center,s,n.startAngle,n.endAngle,n.clockwise)}function Kl(n,t,e,i){var r=e.x-t.x,s=e.y-t.y,o=Math.hypot(r,s);if(F.isNonPositive(o))return n.clockwise?-i:i;var a=-s/o,h=r/o,l=n.center.x-(t.x+e.x)/2,c=n.center.y-(t.y+e.y)/2,u=l*a+c*h>0;return u?-i:i}function Zl(n,t,e){var i=t.x-n.x,r=t.y-n.y,s=Math.hypot(i,r);if(F.isNonPositive(s))return null;var o=-r/s*e,a=i/s*e;return{start:new P(n.x+o,n.y+a),end:new P(t.x+o,t.y+a),dx:i,dy:r}}function Ql(n,t,e,i){var r,s,o,a=n.length;if(a===0)return[];for(var h=Jl(n,t,e,i),l=[(s=(r=h[0].nextSegmentStart)===null||r===void 0?void 0:r.clone())!==null&&s!==void 0?s:h[0].point.clone()],c=0;c<a;c++){var u=n[c],g=c===a-1&&!e?{point:rh(u)}:h[(c+1)%a];if(c>0&&h[c].filletPoints&&h[c].filletPoints.forEach(function(_){return l.push(_.clone())}),u.kind==="arc")for(var d=(o=h[c].nextSegmentStart)!==null&&o!==void 0?o:h[c].point,p=g.point,f=th(u.arc,d,p,Math.max(16,32)),y=1;y<f.length;y++)l.push(f[y]);else l.push(g.point.clone())}return go(l)}function Jl(n,t,e,i){for(var r=n.length,s=[],o=0;o<r;o++)o===0?s.push(e?ns(n[r-1],n[0],t[0],i):{point:nh(n[0])}):s.push(ns(n[o-1],n[o],t[o],i));return s}function th(n,t,e,i){for(var r=n.nearestPoint(t),s=n.nearestPoint(e),o=rn(n,r),a=rn(n,s),h=ih(n,o,a),l=[],c=0;c<=i;c++){var u=c/i,g=n.clockwise?o-h*u:o+h*u;l.push(n.getPointAtAngle(eh(n,g)))}return l}function rn(n,t){return Math.atan2(t.y-n.center.y,t.x-n.center.x)}function eh(n,t){var e=M.normalizeAngle(t);return n.clockwise?sn(e):e}function sn(n){var t=n*180/Math.PI;return(360-t)%360*(Math.PI/180)}function ih(n,t,e){if(n.clockwise){var i=t-e;return F.isNonPositive(i)&&(i+=B),i}var r=e-t;return F.isNonPositive(r)&&(r+=B),r}function nh(n){return n.kind==="line"?n.start.clone():n.arc.startPoint.clone()}function rh(n){return n.kind==="line"?n.end.clone():n.arc.endPoint.clone()}function ns(n,t,e,i){return n.kind==="line"&&t.kind==="line"?{point:on({start:n.start,end:n.end,dx:n.dx,dy:n.dy},{start:t.start,end:t.end,dx:t.dx,dy:t.dy})}:n.kind==="line"&&t.kind==="arc"?rs(n,t.arc,e,i,!0):n.kind==="arc"&&t.kind==="line"?rs(t,n.arc,e,i,!1):n.kind==="arc"&&t.kind==="arc"?sh(n.arc,t.arc,e,i):{point:e.clone()}}function sh(n,t,e,i){var r=co(n.endPoint,t.startPoint),s=ch(n,t),o=s.filter(function(c){return ai(n,c)&&ai(t,c)});if(o.length>0)return{point:ho(o,r)};var a=n.endPoint.clone(),h=t.startPoint.clone(),l=lo(e,Math.abs(i),a,h);return{point:a,filletPoints:l,nextSegmentStart:h}}function rs(n,t,e,i,r){var s=co(r?n.end:n.start,r?t.startPoint:t.endPoint),o=hh(n,t,s);if(ah(n,o)&&ai(t,o))return{point:o};var a=oh(n,e,i),h=r?t.startPoint.clone():t.endPoint.clone(),l=lo(e,Math.abs(i),r?a:h,r?h:a);return r?{point:a,filletPoints:l,nextSegmentStart:h}:{point:h,filletPoints:l,nextSegmentStart:a}}function oh(n,t,e){var i=Math.hypot(n.dx,n.dy),r=-n.dy/i*e,s=n.dx/i*e;return new P(t.x+r,t.y+s)}function ah(n,t){var e=Math.hypot(n.dx,n.dy);if(F.isNonPositive(e))return!1;var i=n.dx/e,r=n.dy/e,s=t.x-n.start.x,o=t.y-n.start.y,a=Math.abs(s*r-o*i);return F.equalToZero(a)}function lo(n,t,e,i){var r=Math.atan2(e.y-n.y,e.x-n.x),s=Math.atan2(i.y-n.y,i.x-n.x),o=lh(r,s);if(F.equalToZero(Math.abs(o)))return[];for(var a=[],h=Math.max(2,Math.ceil(Math.abs(o)/Math.PI*16)),l=1;l<h;l++){var c=l/h,u=r+o*c;a.push(new P(n.x+t*Math.cos(u),n.y+t*Math.sin(u)))}return a}function lh(n,t){for(var e=t-n;e>Math.PI;)e-=B;for(;e<=-Math.PI;)e+=B;return e}function hh(n,t,e){var i=Math.hypot(n.dx,n.dy);if(F.isNonPositive(i))return e.clone();var r=n.dx/i,s=n.dy/i,o=n.start.x-t.center.x,a=n.start.y-t.center.y,h=2*(o*r+a*s),l=o*o+a*a-t.radius*t.radius,c=h*h-4*l;if(c<0)return e.clone();var u=Math.sqrt(c),g=[(-h-u)/2,(-h+u)/2].map(function(p){return new P(n.start.x+r*p,n.start.y+s*p)}),d=g.filter(function(p){return ai(t,p)});return ho(d.length>0?d:g,e)}function ai(n,t){var e=Math.abs(Math.hypot(t.x-n.center.x,t.y-n.center.y)-n.radius);if(F.isPositive(e))return!1;var i=rn(n,t),r=n.clockwise?sn(M.normalizeAngle(n.startAngle)):M.normalizeAngle(n.startAngle),s=n.clockwise?sn(M.normalizeAngle(n.endAngle)):M.normalizeAngle(n.endAngle);return M.isBetweenAngle(i,r,s,n.clockwise)}function ch(n,t){var e=t.center.x-n.center.x,i=t.center.y-n.center.y,r=Math.hypot(e,i);if(F.isNonPositive(r))return[];var s=n.radius+t.radius,o=Math.abs(n.radius-t.radius);if(r>s+ti)return[];if(r<o-ti)return[];var a=(n.radius*n.radius-t.radius*t.radius+r*r)/(2*r),h=n.radius*n.radius-a*a;if(h<-ti)return[];var l=n.center.x+a*e/r,c=n.center.y+a*i/r;if(h<=ti)return[new P(l,c)];var u=Math.sqrt(h),g=-i*u/r,d=e*u/r;return[new P(l+g,c+d),new P(l-g,c-d)]}function ho(n,t){for(var e=n[0],i=e.distanceToSquared(t),r=1;r<n.length;r++){var s=n[r].distanceToSquared(t);s<i&&(e=n[r],i=s)}return e.clone()}function co(n,t){return new P((n.x+t.x)/2,(n.y+t.y)/2)}function uh(n){for(var t,e=n.numberOfVertices,i=n.closed?e:e-1,r=0;r<i;r++){var s=n.vertices[r];if(F.isPositive(Math.abs((t=s.bulge)!==null&&t!==void 0?t:0)))return!0}return!1}function uo(n){var t=dh(n.vertices.map(function(e){return new P(e.x,e.y)}),n.closed);return t.length===n.numberOfVertices?n:new V(t.map(function(e){return{x:e.x,y:e.y}}),n.closed)}function dh(n,t){var e=go(n);if(!t||e.length<2)return e;var i=e[0],r=e[e.length-1];return F.isNonPositive(Math.hypot(i.x-r.x,i.y-r.y))&&e.pop(),e}function go(n){var t=[];return n.forEach(function(e){var i=t[t.length-1];(!i||F.isPositive(Math.hypot(i.x-e.x,i.y-e.y)))&&t.push(new P(e.x,e.y))}),t}function gh(n,t){for(var e=[],i=0;i<n.numberOfVertices;i++)e.push(n.getPointAt(i));var r=ph(e,n.closed,t);if(r.length===0)return null;var s=[];if(n.closed){if(r.length<2)return null;for(var o=r.length,i=0;i<o;i++){var a=r[(i-1+o)%o],h=r[i];s.push(on(a,h))}}else{s.push(r[0].start);for(var i=1;i<r.length;i++)s.push(on(r[i-1],r[i]));s.push(r[r.length-1].end)}var l=new V;return s.forEach(function(c,u){l.addVertexAt(u,{x:c.x,y:c.y})}),l.closed=n.closed,l}function ph(n,t,e){for(var i=[],r=t?n.length:n.length-1,s=0;s<r;s++){var o=n[s],a=n[t?(s+1)%n.length:s+1],h=a.x-o.x,l=a.y-o.y,c=Math.hypot(h,l);if(!F.isNonPositive(c)){var u=-l/c*e,g=h/c*e;i.push({start:new P(o.x+u,o.y+g),end:new P(a.x+u,a.y+g),dx:h,dy:l})}}return i}function on(n,t){var e=n.dx*t.dy-n.dy*t.dx;if(F.equalToZero(e))return new P((n.end.x+t.start.x)/2,(n.end.y+t.start.y)/2);var i=t.start.x-n.start.x,r=t.start.y-n.start.y,s=(i*t.dy-r*t.dx)/e;return new P(n.start.x+s*n.dx,n.start.y+s*n.dy)}var fh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),an=function(){return an=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},an.apply(this,arguments)},V=function(n){fh(t,n);function t(e,i){e===void 0&&(e=null),i===void 0&&(i=!1);var r=n.call(this)||this;return r._vertices=e||new Array,r._closed=i,r}return Object.defineProperty(t.prototype,"vertices",{get:function(){return this._vertices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numberOfVertices",{get:function(){return this._vertices.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this._closed=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this.numberOfVertices>0){var e=this._vertices[0];return new P(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this.numberOfVertices;if(e>0)if(this.closed){var i=this._vertices[0];return new P(i.x,i.y)}else{var i=this._vertices[e-1];return new P(i.x,i.y)}throw new Error("End point does not exist in an empty polyline.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){for(var e=0,i=this._vertices.length,r=0;r<i;++r){var s=this._vertices[r],o=null;if(r<i-1?o=this._vertices[r+1]:r==i-1&&this.closed&&(o=this._vertices[0]),o)if(s.bulge){var a=new ot(s,o,s.bulge);e+=a.length}else e+=new P(s.x,s.y).distanceTo(o)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed||this._vertices.length<3)return 0;var e=this.getPoints(128);return zl(e)},enumerable:!1,configurable:!0}),t.prototype.addVertexAt=function(e,i){e<=0?this._vertices.unshift(i):this._vertices.splice(e,0,i),this._boundingBoxNeedsUpdate=!0},t.prototype.removeVertexAt=function(e){if(e<0||e>=this._vertices.length)throw new Error("Index ".concat(e," is out of bounds. Valid range is 0 to ").concat(this._vertices.length-1,"."));this._vertices.splice(e,1),this._boundingBoxNeedsUpdate=!0},t.prototype.reset=function(e,i){e?i!==void 0&&i>=0&&i<this._vertices.length&&(this._vertices=this._vertices.slice(0,i),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)},t.prototype.getPointAt=function(e){var i=this._vertices[e];return new P(i.x,i.y)},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new Q().setFromPoints(e)},t.prototype.transform=function(e){var i=e.determinant()<0;return this._vertices.forEach(function(r){var s=new P(r).applyMatrix2d(e);r.x=s.x,r.y=s.y,i&&r.bulge!=null&&(r.bulge=-r.bulge)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._vertices.map(function(e){return an({},e)}),this._closed)},t.prototype.getPoints3d=function(e,i){var r=[],s=this.getPoints(e);return s.forEach(function(o){return r.push(new m().set(o.x,o.y,i))}),r},t.prototype.getPoints=function(e){for(var i=[],r=this._vertices.length,s=0;s<r;++s){var o=this._vertices[s];if(o.bulge){var a=null;if(s<r-1?a=this._vertices[s+1]:s==r-1&&this.closed&&(a=this._vertices[0]),a)for(var h=new ot(o,a,o.bulge),l=h.getPoints(e),c=l.length,u=0;u<c;++u){var g=l[u];i.push(new P(g.x,g.y))}}else i.push(new P(o.x,o.y)),s==r-1&&this.closed&&i.push(i[0])}return i},t.prototype.offset=function(e){return ao(this,e)},t}(Pe);function po(n,t,e){var i=Math.hypot(t.x,t.y);if(F.isNonPositive(i))return null;var r=-t.y/i*e,s=t.x/i*e;return new m(n.x+r,n.y+s,n.z)}function yh(n,t,e){var i;if(n.length<2)return null;var r=Dl(new V(n.map(function(o){return{x:o.x,y:o.y}}),t)),s=ao(r,e);return(i=s[0])!==null&&i!==void 0?i:null}var li=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},ye=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function mh(n,t,e,i){if(n.length<2||F.equalToZero(e))return null;var r=yo(n,i),s=r.points,o=r.tangents;if(s.length<2)return null;var a=o??_h(s,t),h=xh(s,a,e),l=t?bh(h):wh(h);if(l.length<2)return null;var c=new V;return l.forEach(function(u,g){c.addVertexAt(g,{x:u.x,y:u.y})}),c.closed=t,c}function _h(n,t){for(var e=n.length,i=new Array(e),r=0;r<e;r++){var s=0,o=0;if(t){var a=n[(r-1+e)%e],h=n[(r+1)%e];s=h.x-a.x,o=h.y-a.y}else r===0?(s=n[1].x-n[0].x,o=n[1].y-n[0].y):r===e-1?(s=n[e-1].x-n[e-2].x,o=n[e-1].y-n[e-2].y):(s=n[r+1].x-n[r-1].x,o=n[r+1].y-n[r-1].y);var l=Math.hypot(s,o);F.isNonPositive(l)?i[r]=new P(1,0):i[r]=new P(s/l,o/l)}return i}function xh(n,t,e){return n.map(function(i,r){var s=t[r],o=-s.y*e,a=s.x*e;return new P(i.x+o,i.y+a)})}function wh(n){var t=hi(n);if(t.length<3)return t;for(;;){var e=fo(t,!1);if(!e||(t=hi(ye(ye(ye([],li(t.slice(0,e.segmentA+1)),!1),[e.point],!1),li(t.slice(e.segmentB+1)),!1)),t.length<2))break}return t}function bh(n){var t=hi(n);if(t.length<4)return t;for(;;){var e=fo(t,!0);if(!e||(t=hi(ye(ye(ye([],li(t.slice(0,e.segmentA+1)),!1),[e.point],!1),li(t.slice(e.segmentB+1)),!1)),t.length<3))break}return t}function fo(n,t){var e=t?n.length:n.length-1;if(e<2)return null;for(var i=0;i<e;i++)for(var r=n[i],s=n[(i+1)%n.length],o=i+1;o<e;o++)if(!vh(i,o,e,t)){var a=n[o],h=n[(o+1)%n.length],l=Ph(r,s,a,h);if(l)return{point:l,segmentA:i,segmentB:o}}return null}function vh(n,t,e,i){return!!(t===n||t===n+1||i&&n===0&&t===e-1)}function Ph(n,t,e,i){var r=t.x-n.x,s=t.y-n.y,o=i.x-e.x,a=i.y-e.y,h=r*a-s*o;if(F.equalToZero(h))return null;var l=e.x-n.x,c=e.y-n.y,u=(l*a-c*o)/h,g=(l*s-c*r)/h,d=Ii.equalPointTol;return u<-d||u>1+d||g<-d||g>1+d?null:new P(n.x+u*r,n.y+u*s)}function yo(n,t){var e=[],i=[],r=t!=null&&t.length===n.length;return n.forEach(function(s,o){var a=e[e.length-1];if((!a||F.isPositive(Math.hypot(a.x-s.x,a.y-s.y)))&&(e.push(new P(s.x,s.y)),r)){var h=t[o];i.push(new P(h.x,h.y))}}),{points:e,tangents:r?i:void 0}}function hi(n){return yo(n).points}var Ah=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Tt=function(n){Ah(t,n);function t(){var e=n.call(this)||this;return e._loops=[],e}return t.prototype.add=function(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"loops",{get:function(){return this._loops},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outter",{get:function(){if(this._loops.length>0)return this._loops[0]},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.outter;return e?e.box:new Q},t.prototype.transform=function(e){return this._loops.forEach(function(i){i.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){var e=new t;return this._loops.forEach(function(i){e.add(i.clone())}),e},t.prototype.getPoints=function(e){for(var i=[],r=0;r<this.loops.length;++r){var s=this.loops[r],o=s.getPoints(e);i.push(o)}return i},t.prototype.buildHierarchy=function(){for(var e,i=this.getPoints(100),r=this.calculateBoundaryBoxes(i),s=this.sortBoundaryBoxesByAreas(r),o=new Map,a=s.length,h=0;h<a;h++)o.set(s[h],{index:s[h],children:[]});for(var l={index:-1,children:[]},h=0;h<a;h++){for(var c=s[h],u=i[c],g=r[c],d=h+1;d<a;d++){var p=s[d],f=i[p],y=r[p];if(y.containsBox(g)&&nt.isPointInPolygon(u[M.randInt(0,u.length-1)],f)){(e=o.get(p))===null||e===void 0||e.children.push(o.get(c));break}}d===a&&l.children.push(o.get(c))}return l},Object.defineProperty(t.prototype,"area",{get:function(){if(this._loops.length===0)return 0;for(var e=0,i=0;i<this._loops.length;i++){var r=this._loops[i],s=r.getPoints(128),o=ro(s);i===0?e+=Math.abs(o):e-=Math.abs(o)}return e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundaryBoxes=function(e){var i=[];return e.forEach(function(r){i.push(new Q().setFromPoints(r))}),i},t.prototype.sortBoundaryBoxesByAreas=function(e){var i=[];e.forEach(function(s,o){var a=s.size,h=a.width*a.height;i.push({area:h,index:o})}),i.sort(function(s,o){return s.area-o.area});var r=[];return i.forEach(function(s){r.push(s.index)}),r},t}(ir),Sh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Lh=function(n){Sh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new O().makeTranslation(e.x,e.y,e.z))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t}(oo),Mh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),He=function(n){Mh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(Lh),Eh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Ct=function(n){Eh(t,n);function t(e,i){var r=n.call(this)||this;return r._start=new m(e),r._end=new m(i),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return new x().subVectors(this.endPoint,this.startPoint).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){return new m((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){return this.project(e)},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.isPointOnLine=function(e){var i=this.project(e),r=1e-6;return i.distanceTo(e)<r},t.prototype.at=function(e,i){return this.delta(i).multiplyScalar(e).add(this._start)},t.prototype.atLength=function(e,i){if(i===void 0&&(i=!1),i){var r=this.delta($t).normalize();return new m(this._start).addScaledVector(r,e)}else{var r=this.delta($t).normalize();return new m(this._end).addScaledVector(r,e)}},t.prototype.extend=function(e,i){if(i===void 0&&(i=!1),i){var r=$t.subVectors(this._start,this._end).normalize();this._start=new m(this._start).addScaledVector(r,e)}else{var r=this.delta($t).normalize();this._end=new m(this._end).addScaledVector(r,e)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.closestPointToPointParameter=function(e,i){ss.subVectors(e,this._start),ei.subVectors(this.endPoint,this.startPoint);var r=ei.dot(ei),s=ei.dot(ss),o=s/r;return i&&(o=M.clamp(o,0,1)),o},t.prototype.closestPointToPoint=function(e,i,r){var s=this.closestPointToPointParameter(e,i);return this.delta(r).multiplyScalar(s).add(this._start)},t.prototype.delta=function(e){return e.subVectors(this._end,this._start)},t.prototype.distanceSq=function(){return this._start.distanceToSquared(this._end)},t.prototype.distance=function(){return this._start.distanceTo(this._end)},t.prototype.project=function(e){var i=this.direction,r=$t.subVectors(e,this.startPoint),s=r.dot(i);return new m().copy(i).multiplyScalar(s).add(this.startPoint)},t.prototype.perpPoint=function(e){var i=this.direction,r=this.startPoint,s=$t.subVectors(e,r),o=s.dot(i),a=$t.copy(i).multiplyScalar(o);return new m().addVectors(r,a)},t.prototype.calculateBoundingBox=function(){var e=new m(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),i=new m(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new C(e,i)},t.prototype.transform=function(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.offset=function(e){var i=this.startPoint,r=this.endPoint,s=Math.hypot(r.x-i.x,r.y-i.y);if(s===0)return this.clone();var o=new x(r.x-i.x,r.y-i.y,0).normalize(),a=new x(-o.y,o.x,0);return new t(new m(i.x+a.x*e,i.y+a.y*e,i.z),new m(r.x+a.x*e,r.y+a.y*e,r.z))},t}(He),$t=new x,ss=new x,ei=new x,Ih=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Di=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},bt=function(n){Ih(t,n);function t(e,i,r,s,o,a){a===void 0&&(a=x.X_AXIS);var h=n.call(this)||this;return h.center=e,h.radius=i,h.startAngle=r,h.endAngle=s,h.normal=o,h.refVec=a,(s-r)%B==0?(h.startAngle=0,h.endAngle=B):(h.startAngle=r,h.endAngle=s),h}return t.computeCenterPoint=function(e,i,r){var s=new x().addVectors(e,i).multiplyScalar(.5),o=new x().addVectors(e,r).multiplyScalar(.5),a=new x().subVectors(i,e),h=new x().subVectors(r,e),l=new x().crossVectors(a,h).normalize();if(l.lengthSq()===0)return null;var c=new x().crossVectors(a,l).normalize(),u=new x().crossVectors(h,l).normalize(),g=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=u.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new Ct(s,s.clone().add(g)),f=new Ct(o,o.clone().add(d)),y=new x,_=p.closestPointToPoint(f.startPoint,!0,y);return _?y:null},t.createByThreePoints=function(e,i,r){var s=t.computeCenterPoint(e,i,r);if(s){var o=s.distanceTo(e),a=new x().subVectors(e,s),h=new x().subVectors(i,s),l=Math.atan2(a.y,a.x),c=Math.atan2(h.y,h.x);return new t(s,o,l,c,x.Z_AXIS)}},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==B?e:M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return M.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refVec",{get:function(){return this._refVec},set:function(e){this._refVec=new x(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;this.closed&&(e=0,i=B);var r=e+i*.5;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:0},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){var i=new x(e.x,e.y,e.z||0),r=this.center,s=this.normal,o=i.clone().sub(r),a=o.dot(s),h=i.clone().sub(s.clone().multiplyScalar(a)),l=h.clone().sub(r);if(l.lengthSq()===0)return this.startPoint.clone();l.normalize().multiplyScalar(this.radius);var c=r.clone().add(l),u=this.getAngle(c.clone()),g=this.startAngle,d=this.deltaAngle,p=M.normalizeAngle(u-g);p<0&&(p=0),p>d&&(p=d);var f=this.getPointAtAngle(g+p),y=f.distanceTo(i),_=this.startPoint.distanceTo(i),v=this.endPoint.distanceTo(i);return _<y&&_<=v?this.startPoint.clone():v<y&&v<_?this.endPoint.clone():f},t.prototype.tangentPoints=function(e){var i,r,s=[],o=new x(e.x,e.y,e.z||0),a=this.center,h=this.normal,l=this.radius,c=o.clone().sub(a),u=c.dot(h),g=o.clone().sub(h.clone().multiplyScalar(u)),d=a.clone(),p=g.clone().sub(d),f=p.length();if(f<l)return s;var y=Math.acos(l/f),_=this.getAngle(g.clone()),v=[_+y,_-y];try{for(var S=Di(v),A=S.next();!A.done;A=S.next()){var L=A.value,T=M.normalizeAngle(L-this.startAngle);T>=0&&T<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+T))}}catch(E){i={error:E}}finally{try{A&&!A.done&&(r=S.return)&&r.call(S)}finally{if(i)throw i.error}}return s},t.prototype.perpendicularPoints=function(e){var i,r,s=[],o=new x(e.x,e.y,e.z||0),a=this.center,h=this.normal,l=this.radius,c=o.clone().sub(a),u=c.dot(h),g=o.clone().sub(h.clone().multiplyScalar(u)),d=g.clone().sub(a);if(d.lengthSq()<1e-24)return s;d.normalize();var p=[a.clone().add(d.clone().multiplyScalar(l)),a.clone().sub(d.clone().multiplyScalar(l))];try{for(var f=Di(p),y=f.next();!y.done;y=f.next()){var _=y.value,v=this.getAngle(_.clone()),S=M.normalizeAngle(v-this.startAngle);S>=0&&S<=this.deltaAngle&&s.push(new m(_.x,_.y,_.z||0))}}catch(A){i={error:A}}finally{try{y&&!y.done&&(r=f.return)&&r.call(f)}finally{if(i)throw i.error}}return s},t.prototype.nearestTangentPoint=function(e){var i=this.tangentPoints(e);if(i.length===0)return null;var r=new m(e.x,e.y,e.z||0);return i.length===1||i[0].distanceTo(r)<i[1].distanceTo(r)?i[0]:i[1]},t.prototype.calculateBoundingBox=function(){for(var e,i,r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)M.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,h=1/0,l=-1/0,c=-1/0,u=-1/0;try{for(var g=Di(r),d=g.next();!d.done;d=g.next()){var p=d.value,f=this.getPointAtAngle(p);f.x<o&&(o=f.x),f.y<a&&(a=f.y),f.z<h&&(h=f.z),f.x>l&&(l=f.x),f.y>c&&(c=f.y),f.z>u&&(u=f.z)}}catch(y){e={error:y}}finally{try{d&&!d.done&&(i=g.return)&&i.call(g)}finally{if(e)throw e.error}}return new C({x:o,y:a,z:h},{x:l,y:c,z:u})},Object.defineProperty(t.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=B,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),h=this.getPointAtAngle(a);i.push(h)}return i},t.prototype.transform=function(e){var i=this.center.clone().applyMatrix4(e),r=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new x(r).sub(i).normalize(),h=i.distanceTo(r),l=new x().crossVectors(new x(r).sub(i),new x(o).sub(i)).normalize();l.lengthSq()===0&&(l=this.normal.clone().transformDirection(e));var c=function(u){var g=new x(u).sub(i);return Math.atan2(g.dot(os.crossVectors(l,a)),g.dot(a))};return this.center=i,this.radius=h,this.normal=l,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?B:c(s),this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},t.prototype.getAngle=function(e){return e.sub(this.center),Math.atan2(e.dot(os.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))},t.prototype.getPointAtAngle=function(e){var i=this.normal,r=this.refVec,s={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},o=this.center,a=this.radius;return new m(o.x+a*(r.x*Math.cos(e)+s.x*Math.sin(e)),o.y+a*(r.y*Math.cos(e)+s.y*Math.sin(e)),o.z+a*(r.z*Math.cos(e)+s.z*Math.sin(e)))},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new x(this.center).distanceTo(Jn);return new tr(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.radius+e;return i<=0?null:new t(this.center,i,this.startAngle,this.endAngle,this.normal,this.refVec)},t}(He),os=new x,Th=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Qt=function(n){Th(t,n);function t(e,i,r,s,o,a,h){s===void 0&&(s=0),o===void 0&&(o=B),a===void 0&&(a=!1),h===void 0&&(h=0);var l=n.call(this)||this;return l.center=e,l.majorAxisRadius=i,l.minorAxisRadius=r,(o-s)%B==0?(l.startAngle=0,l.endAngle=B):(l.startAngle=s,l.endAngle=o),l.clockwise=a,l.rotation=h,l}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==B?e:M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return M.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){for(var e=100,i=1/0,r=1/0,s=-1/0,o=-1/0,a=0;a<=e;a++){var h=this.getPoint(a/e);i=Math.min(i,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),o=Math.max(o,h.y)}return new Q({x:i,y:r},{x:s,y:o})},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){for(var i=Math.PI*2,r=this.endAngle-this.startAngle,s=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(s?r=0:r=i),this.clockwise===!0&&!s&&(r===i?r=-i:r=r-i);var o=this.startAngle+e*r,a=this.center.x+this.majorAxisRadius*Math.cos(o),h=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var l=Math.cos(this.rotation),c=Math.sin(this.rotation),u=a-this.center.x,g=h-this.center.y;a=u*l-g*c+this.center.x,h=u*c+g*l+this.center.y}return new P(a,h)},t.prototype.transform=function(e){var i=e,r=new P(this.center).applyMatrix2d(i),s=new m(r.x,r.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(i),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(i),h=new P(o).sub(r),l=new P(a).sub(r),c=h.length(),u=l.length(),g=Math.atan2(h.y,h.x),d=h.clone().normalize(),p=l.clone().normalize(),f=function(v){var S=new P(v).sub(r),A=S.dot(d),L=S.dot(p);return M.normalizeAngle(Math.atan2(L/u,A/c))},y=i.determinant()<0?!this.clockwise:this.clockwise,_=this.closed?new t(s,c,u,0,B,y,g):new t(s,c,u,f(this.startPoint.clone().applyMatrix2d(i)),f(this.endPoint.clone().applyMatrix2d(i)),y,g);return this.center=_.center,this.majorAxisRadius=_.majorAxisRadius,this.minorAxisRadius=_.minorAxisRadius,this._startAngle=_._startAngle,this._endAngle=_._endAngle,this._clockwise=_._clockwise,this.rotation=_.rotation,this._boundingBoxNeedsUpdate=!0,this},t.prototype.getPointAtAngle=function(e){return this.getPoint(this.closed?e/B:M.normalizeAngle(e-this.startAngle)/this.deltaAngle)},t.prototype.copy=function(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this},t.prototype.clone=function(){return new t(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},t.prototype.getFocusPoints=function(){var e=Math.max(this.majorAxisRadius,this.minorAxisRadius),i=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(e-i<1e-9)return[];var r=Math.sqrt(e*e-i*i),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,h=a?s:-o,l=a?o:s;return[new P(this.center.x-r*h,this.center.y-r*l),new P(this.center.x+r*h,this.center.y+r*l)]},t.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},t.prototype.nearestPoint=function(e){for(var i=new P(e.x,e.y),r=this.getPoint(0),s=i.distanceToSquared(r),o=72,a=1;a<=o;a++){var h=this.getPoint(a/o),l=i.distanceToSquared(h);l<s&&(s=l,r=h)}return r},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,h,l){var c=-i.majorAxisRadius*l,u=i.minorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,h,l){var c=i.minorAxisRadius*h,u=i.majorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocal=function(e){var i=e.x-this.center.x,r=e.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:i*s-r*o,y:i*o+r*s}},t.prototype._findSnapAngles=function(e,i,r){r===void 0&&(r=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,h=this.deltaAngle,l=[],c=function(A){var L=Math.cos(A),T=Math.sin(A);return i(s*L,o*T,L,T)},u=a,g=c(u),d=1;d<=r;d++){var p=a+h*d/r,f=c(p);if(Math.abs(g)<1e-10&&l.push(u),g*f<0){for(var y=u,_=p,v=0;v<32;v++){var S=(y+_)/2;c(y)*c(S)<=0?_=S:y=S}l.push((y+_)/2)}u=p,g=f}return l},t}(Pe),Ch=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Oh=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},nr=function(n){Ch(t,n);function t(e,i,r,s,o,a,h){a===void 0&&(a=0),h===void 0&&(h=B);var l=n.call(this)||this;l.center=e,l.normal=i,l.majorAxis=r,l.majorAxisRadius=s,l.minorAxisRadius=o;var c=Math.abs(h-a);return Math.abs(c-B)<1e-10||Math.abs(c-2*B)<1e-10?(l.startAngle=0,l.endAngle=B):(l.startAngle=a,l.endAngle=h),l}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new m(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw lt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==B?e:M.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this.endAngle-this.startAngle;return Math.abs(e-B)<1e-10?B:M.normalizeAngle(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new x(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(e){this._majorAxis=new x(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxis",{get:function(){return new x().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;(this.closed||Math.abs(i-B)<1e-10)&&(e=0,i=B);var r=e+i/2;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCircular",{get:function(){return F.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var e=1e3,i=this.deltaAngle/e,r=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=e;o++){var a=this.startAngle+o*i,h=this.getPointAtAngle(a),l=h.x-s.x,c=h.y-s.y,u=h.z-s.z;r+=Math.sqrt(l*l+c*c+u*u),s=h}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return Math.abs(this.deltaAngle-B)>=1e-10?0:Math.PI*this.majorAxisRadius*this.minorAxisRadius},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i;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)){for(var r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)M.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,h=1/0,l=-1/0,c=-1/0,u=-1/0;try{for(var g=Oh(r),d=g.next();!d.done;d=g.next()){var p=d.value,f=this.getPointAtAngle(p);f.x<o&&(o=f.x),f.y<a&&(a=f.y),f.z<h&&(h=f.z),f.x>l&&(l=f.x),f.y>c&&(c=f.y),f.z>u&&(u=f.z)}}catch(_){e={error:_}}finally{try{d&&!d.done&&(i=g.return)&&i.call(g)}finally{if(e)throw e.error}}return new C({x:o,y:a,z:h},{x:l,y:c,z:u})}else{for(var y=100,o=1/0,a=1/0,h=1/0,l=-1/0,c=-1/0,u=-1/0,s=0;s<=y;s++){var p=this.startAngle+this.deltaAngle*(s/y),f=this.getPointAtAngle(p);o=Math.min(o,f.x),a=Math.min(a,f.y),h=Math.min(h,f.z),l=Math.max(l,f.x),c=Math.max(c,f.y),u=Math.max(u,f.z)}return new C({x:o,y:a,z:h},{x:l,y:c,z:u})}},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=B,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),h=this.getPointAtAngle(a);i.push(h)}return i},t.prototype.getPointAtAngle=function(e){var i=Math.cos(e),r=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(r),o=this.majorAxis.clone().multiplyScalar(i*this.majorAxisRadius).add(s);return new m(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},t.prototype.nearestPoint=function(e,i){i===void 0&&(i=72);for(var r=new m(e.x,e.y,e.z||0),s=this.getPointAtAngle(this.startAngle),o=r.distanceToSquared(s),a=1;a<=i;a++){var h=this.startAngle+this.deltaAngle*a/i,l=this.getPointAtAngle(h),c=r.distanceToSquared(l);c<o&&(o=c,s=l)}var u=r.distanceToSquared(this.startPoint),g=r.distanceToSquared(this.endPoint);return u<o&&u<=g?this.startPoint.clone():g<o&&g<u?this.endPoint.clone():s.clone()},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,h,l){var c=-i.majorAxisRadius*l,u=i.minorAxisRadius*h;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,h,l){var c=i.minorAxisRadius*h,u=i.majorAxisRadius*l;return(o-r.x)*u-(a-r.y)*c});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocalPlane=function(e){var i=new m(e.x,e.y,e.z||0),r=new x(i).sub(this.center),s=r.dot(this.normal);return r.sub(this.normal.clone().multiplyScalar(s)),{x:r.dot(this.majorAxis),y:r.dot(this.minorAxis)}},t.prototype._findSnapParameterAngles=function(e,i){i===void 0&&(i=144);for(var r=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,h=[],l=function(S){var A=Math.cos(S),L=Math.sin(S);return e(r*A,s*L,A,L)},c=o,u=l(c),g=1;g<=i;g++){var d=o+a*g/i,p=l(d);if(Math.abs(u)<1e-10&&h.push(c),u*p<0){for(var f=c,y=d,_=0;_<32;_++){var v=(f+y)/2;l(f)*l(v)<=0?y=v:f=v}h.push((f+y)/2)}c=d,u=p}return h},t.prototype.contains=function(e){var i=new x(e).sub(this.center),r=i.dot(this.majorAxis),s=i.dot(this.minorAxis),o=r/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},t.prototype.transform=function(e){var i=e,r=this.center.clone().applyMatrix4(i),s=this.getPointAtAngle(0).clone().applyMatrix4(i),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(i),a=new x(s).sub(r),h=new x(o).sub(r),l=a.length(),c=h.length(),u=a.clone().normalize(),g=new x().crossVectors(a,h).normalize(),d=new x().crossVectors(g,u).normalize();d.dot(h)<0&&(g.negate(),d=new x().crossVectors(g,u).normalize());var p=function(y){var _=new x(y).sub(r),v=_.dot(u),S=_.dot(d);return M.normalizeAngle(Math.atan2(S/c,v/l))},f=this.closed?new t(r,g,u,l,c,0,B):new t(r,g,u,l,c,p(this.startPoint.clone().applyMatrix4(i)),p(this.endPoint.clone().applyMatrix4(i)));return this.center=f.center,this.normal=f.normal,this.majorAxis=f.majorAxis,this.majorAxisRadius=f.majorAxisRadius,this.minorAxisRadius=f.minorAxisRadius,this._startAngle=f._startAngle,this._endAngle=f._endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new x(this.center).distanceTo(Jn);return new tr(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.majorAxisRadius+e,r=this.minorAxisRadius+e;return i<=0||r<=0?null:new t(this.center,this.normal,this.majorAxis,i,r,this.startAngle,this.endAngle)},t}(He),kh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Pt=function(n){kh(t,n);function t(e,i){var r=n.call(this)||this;return r._start=new P(e),r._end=new P(i),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=new P(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),i=new P(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new Q(e,i)},t.prototype.transform=function(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.project=function(e){var i=this._end.x-this._start.x,r=this._end.y-this._start.y,s=i*i+r*r;if(s<1e-18)return this._start.clone();var o=((e.x-this._start.x)*i+(e.y-this._start.y)*r)/s;return o=Math.max(0,Math.min(1,o)),new P(this._start.x+o*i,this._start.y+o*r)},t.prototype.nearestPoint=function(e){return this.project(e)},t}(Pe),Yh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Hi=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Ui=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},rr=function(n){Yh(t,n);function t(e){e===void 0&&(e=[]);var i=n.call(this)||this;return i._curves=e,i}return Object.defineProperty(t.prototype,"curves",{get:function(){return this._curves},enumerable:!1,configurable:!0}),t.buildFromEdges=function(e,i){if(i===void 0&&(i=.001),e.length===0)return[];for(var r=Ui([],Hi(e),!1),s=[],o=i*i,a=function(p,f){var y=p.x-f.x,_=p.y-f.y;return y*y+_*_<=o};r.length>0;){var h=[],l=r.shift();h.push(l);var c=t.getEdgeStartPoint(l),u=t.getEdgeEndPoint(l);if(!a(c,u))for(;r.length>0;){var g=t.findConnectingEdge(r,u,o);if(g.index<0)break;var d=r.splice(g.index,1)[0];if(g.reverse&&(d=t.reverseEdge(d)),h.push(d),u=t.getEdgeEndPoint(d),a(u,c))break}s.push(new t(h))}return s},t.prototype.add=function(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0},Object.defineProperty(t.prototype,"numberOfEdges",{get:function(){return this._curves.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){if(this._curves.length>0){var e=this._curves[0].startPoint;return new P(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.startPoint},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){var e=0;return this._curves.forEach(function(i){e+=i.length}),e},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100),i=new Q;return i.setFromPoints(e),i},t.prototype.transform=function(e){var i=new O().set(e.elements[0],e.elements[3],0,e.elements[6],e.elements[1],e.elements[4],0,e.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(function(r){r instanceof At?r.transform(i):r.transform(e)}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._curves.map(function(e){return e.clone()}))},Object.defineProperty(t.prototype,"closed",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var i=[];return this.curves.forEach(function(r){r.getPoints(e).forEach(function(s){i.push(new P(s.x,s.y))})}),i},t.findConnectingEdge=function(e,i,r){for(var s=-1,o=!1,a=Number.POSITIVE_INFINITY,h=0;h<e.length;h++){var l=e[h],c=t.getEdgeStartPoint(l),u=t.getEdgeEndPoint(l),g=i.x-c.x,d=i.y-c.y,p=g*g+d*d;p<a&&(a=p,s=h,o=!1);var f=i.x-u.x,y=i.y-u.y,_=f*f+y*y;_<a&&(a=_,s=h,o=!0)}return a>r?{index:-1,reverse:!1}:{index:s,reverse:o}},t.getEdgeStartPoint=function(e){var i=e.startPoint;return new P(i.x,i.y)},t.getEdgeEndPoint=function(e){var i=e.endPoint;return new P(i.x,i.y)},t.reverseEdge=function(e){return e instanceof Pt?new Pt(e.endPoint,e.startPoint):e instanceof ot?new ot(e.center,e.radius,e.endAngle,e.startAngle,!e.clockwise):e instanceof Qt?new Qt(e.center,e.majorAxisRadius,e.minorAxisRadius,e.endAngle,e.startAngle,!e.clockwise,e.rotation):e instanceof At?t.reverseSplineEdge(e):e},t.reverseSplineEdge=function(e){var i=Ui([],Hi(e.controlPoints),!1).reverse(),r=e.knots,s=r[0],o=r[r.length-1],a=r.map(function(c){return s+o-c}).reverse(),h=e.weights,l=h.length>0?Ui([],Hi(h),!1).reverse():void 0;return new At(i,a,l,e.degree,e.closed)},t}(Pe),Xh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Wi=function(){function n(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return n.prototype.init=function(t,e,i,r){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-r,this.c3=2*t-2*e+i+r},n.prototype.initCatmullRom=function(t,e,i,r,s){this.init(e,i,s*(i-t),s*(r-e))},n.prototype.initNonuniformCatmullRom=function(t,e,i,r,s,o,a){var h=(e-t)/s-(i-t)/(s+o)+(i-e)/o,l=(i-e)/o-(r-e)/(o+a)+(r-i)/a;h*=o,l*=o,this.init(e,i,h,l)},n.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},n}(),mo=function(n){Xh(t,n);function t(e,i,r,s){e===void 0&&(e=[]),i===void 0&&(i=!1),r===void 0&&(r="centripetal"),s===void 0&&(s=.5);var o=n.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new x,o._px=new Wi,o._py=new Wi,o._pz=new Wi,o._points=e.map(function(a){return new m(a)}),o._closed=i,o._curveType=r,o._tension=s,o}return Object.defineProperty(t.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var e=0,i=1;i<this._points.length;i++)e+=this._points[i-1].distanceTo(this._points[i]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e,i){i===void 0&&(i=new m);var r=i,s=this._points,o=s.length;if(o===0)return r.set(0,0,0);if(o===1)return r.copy(s[0]);var a=(o-(this._closed?0:1))*e,h=Math.floor(a),l=a-h;this._closed?h+=h>0?0:(Math.floor(Math.abs(h)/o)+1)*o:l===0&&h===o-1&&(h=o-2,l=1);var c,u;this._closed||h>0?c=s[(h-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),c=new m(this._tmp.x,this._tmp.y,this._tmp.z));var g=s[h%o],d=s[(h+1)%o];if(this._closed||h+2<o?u=s[(h+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),u=new m(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var p=this._curveType==="chordal"?.5:.25,f=Math.pow(c.distanceToSquared(g),p),y=Math.pow(g.distanceToSquared(d),p),_=Math.pow(d.distanceToSquared(u),p);y<1e-4&&(y=1),f<1e-4&&(f=y),_<1e-4&&(_=y),this._px.initNonuniformCatmullRom(c.x,g.x,d.x,u.x,f,y,_),this._py.initNonuniformCatmullRom(c.y,g.y,d.y,u.y,f,y,_),this._pz.initNonuniformCatmullRom(c.z,g.z,d.z,u.z,f,y,_)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,g.x,d.x,u.x,this._tension),this._py.initCatmullRom(c.y,g.y,d.y,u.y,this._tension),this._pz.initCatmullRom(c.z,g.z,d.z,u.z,this._tension));return r.set(this._px.calc(l),this._py.calc(l),this._pz.calc(l)),r},t.prototype.getPoints=function(e){for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.setPoints=function(e){this._points=e.map(function(i){return new m(i)}),this._boundingBoxNeedsUpdate=!0},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)},t.prototype.setCurveType=function(e){this._curveType=e},t.prototype.setTension=function(e){this._tension=e},t.prototype.clone=function(){return new t(this._points.map(function(e){return e.clone()}),this._closed,this._curveType,this._tension)},t.prototype.transform=function(e){return this._points=this._points.map(function(i){var r=new m;return r.copy(i),r.applyMatrix4(e),r}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new C;var e=new C;return this._points.forEach(function(i){e.expandByPoint(i)}),e},t}(He),he=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},ce=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function as(n,t){var e,i,r=n.x-t[0],s=n.y-t[1],o=((e=n.z)!==null&&e!==void 0?e:0)-((i=t[2])!==null&&i!==void 0?i:0);return r*r+s*s+o*o}var ft=function(){function n(t,e,i,r){this._degree=t,this._knots=ce([],he(e),!1),this._controlPoints=i.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=r?ce([],he(r),!1):new Array(i.length).fill(1)}return n.prototype.degree=function(){return this._degree},n.prototype.knots=function(){return ce([],he(this._knots),!1)},n.prototype.controlPoints=function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z}})},n.prototype.weights=function(){return ce([],he(this._weights),!1)},n.prototype.clone=function(){return new n(this._degree,this._knots,this._controlPoints,this._weights)},n.prototype.point=function(t){return this.evaluate(t).point},n.prototype.evaluate=function(t){var e=this._controlPoints.map(function(i){return[i.x,i.y,i.z]});return Ol(t,this._degree,this._knots,e,this._weights)},n.prototype.signedPlanarCurvatureAt=function(t){var e=this.evaluate(t);return kl(e.deriv1,e.deriv2)},n.prototype.getOffsetSamplePath2d=function(t,e){var i=this;e===void 0&&(e=512);for(var r=Math.abs(t),s=this.getParameterRange(),o=s.start,a=s.end,h=this.length(),l=Math.max(64,Math.ceil(h/Math.max(r*.2,1e-6))),c=Nh(o,a,Math.min(l,e)),u=0;u<8&&c.length<e;u++){for(var g=[],d=0;d<c.length-1;d++){var p=c[d],f=c[d+1],y=(p+f)/2,_=Math.max(Math.abs(this.signedPlanarCurvatureAt(p)),Math.abs(this.signedPlanarCurvatureAt(f)),Math.abs(this.signedPlanarCurvatureAt(y)));r*_>.85&&g.push(y)}if(g.length===0)break;if(c=Bh(c,g),c.length>e){c=c.slice(0,e);break}}var v=[],S=[];return c.forEach(function(A){var L=i.evaluate(A);v.push(new P(L.point[0],L.point[1]));var T=L.deriv1[0],E=L.deriv1[1],X=Math.hypot(T,E);S.push(X>1e-10?new P(T/X,E/X):new P(1,0))}),{points:v,tangents:S}},n.prototype.length=function(){var t=this._controlPoints.map(function(e){return[e.x,e.y,e.z]});return io(this._degree,this._knots,t,this._weights)},n.byKnotsControlPointsWeights=function(t,e,i,r){return new n(t,e,i,r)},n.byPoints=function(t,e,i,r,s){i===void 0&&(i="Uniform");var o=er(t,e,i,r,s),a=o.controlPoints.map(function(h){return{x:h[0],y:h[1],z:h[2]}});return new n(e,o.knots,a,o.weights)},n.prototype.getParameterRange=function(){var t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}},n.prototype.getPoints=function(t){for(var e=[],i=this.getParameterRange(),r=i.start,s=i.end,o=0;o<=t;o++){var a=r+(s-r)*(o/t);e.push(this.point(a))}return e},n.prototype.isClosed=function(t){t===void 0&&(t=1e-6);var e=this.getParameterRange(),i=e.start,r=e.end,s=this.point(i),o=this.point(r),a=s[0]-o[0],h=s[1]-o[1],l=s[2]-o[2];return Math.sqrt(a*a+h*h+l*l)<t},n.createFitPointsForClosedCurve=function(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var e=new mo(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)},n.prototype.nearestPoint=function(t,e){var i;e===void 0&&(e=64);for(var r=this.getParameterRange(),s=r.start,o=r.end,a=this.point(s),h=as(t,a),l=0;l<=e;l++){var c=s+(o-s)*l/e,u=this.point(c),g=as(t,u);g<h&&(h=g,a=u)}return{x:a[0],y:a[1],z:(i=a[2])!==null&&i!==void 0?i:0}},n.createClosedCurve=function(t,e,i){i===void 0&&(i="Chord");var r=this.createFitPointsForClosedCurve(t),s=r.map(function(o){return[o.x,o.y,o.z]});return n.byPoints(s,e,i)},n}();function Nh(n,t,e){if(e<2)return[n,t];for(var i=[],r=0;r<e;r++)i.push(r===e-1?t:n+(t-n)*r/(e-1));return i}function Bh(n,t){var e=ce(ce([],he(n),!1),he(t),!1).sort(function(r,s){return r-s}),i=[];return e.forEach(function(r){var s=i[i.length-1];(s===void 0||Math.abs(s-r)>1e-10)&&i.push(r)}),i}function ls(n){var t,e,i;if(!n)return!1;var r=(t=n.x)!==null&&t!==void 0?t:0,s=(e=n.y)!==null&&e!==void 0?e:0,o=(i=n.z)!==null&&i!==void 0?i:0;return r*r+s*s+o*o>1e-20}function Rh(n,t,e){var i=n??0;return i<1&&e>0&&t>0&&(i=e-t-1),i<1&&(i=3),i=Math.min(i,t-1),Math.max(1,i)}function zh(n,t,e){var i=n??0;i<1&&(i=3);var r=t+e-1;return i=Math.min(i,r),Math.max(1,i)}function Fh(n,t){if(!(!n||n.length!==t))return n}var Vh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),hs=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},cs=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},At=function(n){Vh(t,n);function t(e,i,r,s,o,a){var h=n.call(this)||this,l=arguments.length;if(h._degree=3,h._closed=!1,Array.isArray(i)){if(l<2||l>5)throw lt.ILLEGAL_PARAMETERS;h._controlPoints=e;var d=void 0,p=3,f=!1;if(l>=3&&(Array.isArray(r)?(d=r,l>=4&&(p=s||3),l>=5&&(f=o)):r!==void 0&&(p=r||3,l>=4&&(f=s))),r===void 0&&l>=4&&(p=s||3,l>=5&&(f=o)),h._degree=p,h._closed=f,h._controlPoints.length<h._degree+1)throw lt.ILLEGAL_PARAMETERS;h._nurbsCurve=ft.byKnotsControlPointsWeights(h._degree,i,h._controlPoints,d)}else{if(l<2||l>6)throw lt.ILLEGAL_PARAMETERS;h._fitPoints=e,h._knotParameterization=i,l>=3&&(h._degree=r||3);var c=typeof s=="boolean";l>=4&&c&&(h._closed=s),c?(l>=5&&(h._startTangent=o),l>=6&&(h._endTangent=a)):(l>=4&&(h._startTangent=s),l>=5&&(h._endTangent=o)),h._closed&&(h._startTangent=void 0,h._endTangent=void 0);var u=(h._startTangent?1:0)+(h._endTangent?1:0);if(h._fitPoints.length+u<h._degree+1)throw lt.ILLEGAL_PARAMETERS;if(h._closed)h._nurbsCurve=ft.createClosedCurve(h._fitPoints,h._degree,h._knotParameterization);else{var g=h.toNurbsPoints(h._fitPoints);h._nurbsCurve=ft.byPoints(g,h._degree,h._knotParameterization,h._startTangent?h.toNurbsPoint(h._startTangent):void 0,h._endTangent?h.toNurbsPoint(h._endTangent):void 0)}h._controlPoints=h.toGePoints(h._nurbsCurve.controlPoints().map(function(y){return[y.x,y.y,y.z||0]}))}return h}return t.prototype.buildCurve=function(){if(this._fitPoints&&this._knotParameterization){if(this._closed){var e=ft.createFitPointsForClosedCurve(this._fitPoints),i=this.toNurbsPoints(e);this._nurbsCurve=ft.byPoints(i,this._degree,this._knotParameterization)}else{var i=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=ft.byPoints(i,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(o){return[o.x,o.y,o.z||0]}))}else if(this._controlPoints)if(this._closed){var e=ft.createFitPointsForClosedCurve(this._controlPoints),i=this.toNurbsPoints(e);this._nurbsCurve=ft.byPoints(i,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(function(h){return[h.x,h.y,h.z||0]}))}else{var r=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=ft.byKnotsControlPointsWeights(this._degree,r,this._controlPoints,s)}},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())},Object.defineProperty(t.prototype,"degree",{get:function(){return this._degree},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knotParameterization",{get:function(){return this._knotParameterization},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlPoints",{get:function(){return this._controlPoints.map(nt.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fitPoints",{get:function(){var e;return(e=this._fitPoints)===null||e===void 0?void 0:e.map(nt.point2dToPoint3d)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"knots",{get:function(){return cs([],hs(this._nurbsCurve.knots()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return cs([],hs(this._nurbsCurve.weights()),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){var e=this._nurbsCurve.knots(),i=this._nurbsCurve.degree(),r=e[i],s=this._nurbsCurve.point(r);return new m(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){var e=this._nurbsCurve.knots(),i=this._nurbsCurve.degree(),r=e[e.length-i-1],s=this._nurbsCurve.point(r);return new m(s[0],s[1],s[2])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._nurbsCurve.length()},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e,i){i===void 0&&(i=64);var r=this._nurbsCurve.nearestPoint(e,i);return new m(r.x,r.y,r.z||0)},t.prototype.evaluateAt=function(e){var i=this._nurbsCurve.point(e);return new m(i[0],i[1],i[2])},t.prototype.getFitPointAt=function(e){if(!this._fitPoints)throw new Error("No fit points in this spline");var i=this._fitPoints.length,r=e<0||e>=i?i-1:e,s=this._fitPoints[r];return nt.point2dToPoint3d(s)},t.prototype.getControlPointAt=function(e){var i=this._controlPoints.length,r=e<0||e>=i?i-1:e;return this._controlPoints[r]},t.prototype.getOffsetSamplePath2d=function(e){return this._nurbsCurve.getOffsetSamplePath2d(e)},t.prototype.getPoints=function(e){e===void 0&&(e=100);for(var i=this._nurbsCurve,r=[],s=i.knots(),o=this._nurbsCurve.degree(),a=s[o],h=s[s.length-o-1],l=(h-a)/(e-1),c=0;c<e;c++){var u=c===e-1?h:a+c*l,g=i.point(u);r.push(new m(g[0],g[1],g[2]))}return r},t.prototype.getCurvePoints=function(e,i){for(var r=[],s=e.knots(),o=e.degree(),a=s[o],h=s[s.length-o-1],l=(h-a)/(i-1),c=0;c<i;c++){var u=a+c*l;r.push(e.point(u))}return r},t.prototype.calculateBoundingBox=function(){var e=this.getPoints(100);return new C().setFromPoints(e)},Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},set:function(e){this.setClosed(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){if(!this._closed)return 0;var e=this.getPoints(128);return so(e)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(function(s){return new m(s).applyMatrix4(e)}),this._startTangent&&(this._startTangent=new m(this._startTangent).transformDirection(e)),this._endTangent&&(this._endTangent=new m(this._endTangent).transformDirection(e)),this.buildCurve();else{var i=this._nurbsCurve.knots(),r=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(function(s){return new m(s).applyMatrix4(e)}),this._nurbsCurve=ft.byKnotsControlPointsWeights(this._degree,i,this._controlPoints,r.length>0?r:void 0)}return this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return this._fitPoints&&this._knotParameterization?new t(this._fitPoints.map(nt.point2dToPoint3d),this._knotParameterization,this._degree,this._closed,this._startTangent?nt.point2dToPoint3d(this._startTangent):void 0,this._endTangent?nt.point2dToPoint3d(this._endTangent):void 0):new t(this._controlPoints.map(nt.point2dToPoint3d),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)},t.prototype.toNurbsPoints=function(e){var i=new Array(e.length);return e.forEach(function(r,s){i[s]=[r.x,r.y,r.z||0]}),i},t.prototype.toGePoints=function(e){var i=new Array(e.length);return e.forEach(function(r,s){i[s]={x:r[0],y:r[1],z:r[2]}}),i},t.prototype.toNurbsPoint=function(e){return[e.x,e.y,e.z||0]},t.createClosedSpline=function(e,i,r){if(i===void 0&&(i="Uniform"),r===void 0&&(r=3),e.length<r+1)throw new Error("At least ".concat(r+1," points are required for a degree ").concat(r," closed spline"));return new t(e,i,r,!0)},t.fromControlPoints=function(e,i,r,s,o){if(e.length<2||i.length<2)return null;var a=Rh(s,e.length,i.length);if(e.length<a+1)return null;try{return new t(e,i,Fh(r,e.length),a,o)}catch{return null}},t.fromFitPoints=function(e,i,r,s,o,a){if(e.length<2)return null;var h=ls(o),l=ls(a),c=(h?1:0)+(l?1:0),u=zh(r,e.length,c);if(e.length+c<u+1)return null;try{return h||l?new t(e,i,u,s,h?o:void 0,l?a:void 0):new t(e,i,u,s)}catch{return null}},t.fromDwgSplineEdge=function(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){var i=e.controlPoints.map(nt.point2dToPoint3d),r=!0,s=e.controlPoints.map(function(a){return a.weight==null&&(r=!1),a.weight||1});return t.fromControlPoints(i,e.knots,r?s:void 0,e.degree,!1)}if(e.numberOfFitData>0){var o=e.fitDatum.map(nt.point2dToPoint3d);return t.fromFitPoints(o,"Uniform",e.degree,!1,e.startTangent?nt.point2dToPoint3d(e.startTangent):void 0,e.endTangent?nt.point2dToPoint3d(e.endTangent):void 0)}return null},t}(He);class Ue{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}class Ut extends _t{constructor(t,e){t=t||{},Ge(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var _o=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(_o||{});const Ft=class Ft extends Ut{static isModelSapceName(t){return t.toLowerCase()==Ft.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Ft.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new m,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return Ft.isModelSapceName(this.name)}get isPaperSapce(){return Ft.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(t){this._blockInsertUnits=t}get explodability(){return this._explodability}set explodability(t){this._explodability=t}get blockScaling(){return this._blockScaling}set blockScaling(t){this._blockScaling=t}get bmpPreview(){return this._bmpPreview}set bmpPreview(t){this._bmpPreview=t}appendEntity(t){const e=i=>{i.database=this.database,i.ownerId=this.objectId,this.database.ensureEntityStyleDefaults(i),this.database.commitObjectHandle(i,r=>this._entities.has(r)),i.resolveEffectiveProperties(),this._entities.set(i.objectId,i),i.dxfTypeName==="INSERT"&&"syncAttributeDatabases"in i&&typeof i.syncAttributeDatabases=="function"&&i.syncAttributeDatabases()};if(Array.isArray(t))for(let i=0;i<t.length;++i)e(t[i]);else e(t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],i=[];return e.forEach(r=>{const s=this._entities.get(r);s&&i.push(s),this._entities.delete(r)}),i.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:i}),i.length>0}newIterator(){return new Ue(this._entities)}getIdAt(t){return this._entities.get(t)}dxfOutBlockRecord(t){return t.writeStart("BLOCK_RECORD"),this.dxfOut(t),this}dxfOutBlockBegin(t){return t.writeStart("BLOCK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeString(8,"0"),t.writeSubclassMarker("AcDbBlockBegin"),t.writeString(2,this.name),t.writeInt16(70,0),t.writePoint3d(10,this.origin),t.writeString(3,this.name),this}dxfOutBlockEnd(t){return t.writeStart("ENDBLK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.blockInsertUnits),t.writeInt16(280,this.explodability),t.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&t.writeObjectId(340,this.layoutId),this}};Ft.MODEL_SPACE_NAME="*Model_Space",Ft.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let et=Ft;var xo=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(xo||{}),wo=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(wo||{}),bo=(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))(bo||{}),vo=(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))(vo||{}),Po=(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))(Po||{}),Ao=(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))(Ao||{});const jh={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 So extends _t{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new P,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new P,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new Q,this._modelType=t,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(t){this._plotSettingsName=t}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(t){this._plotSettingsName=t}get plotCfgName(){return this._plotCfgName}set plotCfgName(t){this._plotCfgName=t}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(t){this._canonicalMediaName=t}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(t){this._currentStyleSheet=t}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(t){this._plotOrigin=t}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(t){this._customPrintScale=t}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(t){this._plotPaperSize=t}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(t){this._plotPaperMargins=t}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(t){this._plotViewName=t}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(t){this._plotWindowArea=t}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(t){this._modelType=t}getModelType(){return this._modelType}setModelType(t){this._modelType=t}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(t){this._drawViewportsFirst=t}setDrawViewportsFirst(t){this._drawViewportsFirst=t}get plotCentered(){return this._plotCentered}set plotCentered(t){this._plotCentered=t}setPlotCentered(t){this._plotCentered=t}get plotHidden(){return this._plotHidden}set plotHidden(t){this._plotHidden=t}setPlotHidden(t){this._plotHidden=t}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(t){this._plotPaperUnits=t}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(t){this._plotPlotStyles=t}setPlotPlotStyles(t){this._plotPlotStyles=t}get plotRotation(){return this._plotRotation}set plotRotation(t){this._plotRotation=t}get plotType(){return this._plotType}set plotType(t){this._plotType=t}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(t){this._plotViewportBorders=t}setPlotViewportBorders(t){this._plotViewportBorders=t}get printLineweights(){return this._printLineweights}set printLineweights(t){this._printLineweights=t}setPrintLineweights(t){this._printLineweights=t}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(t){this._scaleLineweights=t}setScaleLineweights(t){this._scaleLineweights=t}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(t){this._showPlotStyles=t}setShowPlotStyles(t){this._showPlotStyles=t}get shadePlot(){return this._shadePlotType}set shadePlot(t){this._shadePlotType=t}setShadePlot(t){this._shadePlotType=t}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(t){this._shadePlotResLevel=t}setShadePlotResLevel(t){this._shadePlotResLevel=t}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(t){this._shadePlotCustomDpi=t}setShadePlotCustomDPI(t){this._shadePlotCustomDpi=t}get shadePlotId(){return this._shadePlotId}set shadePlotId(t){this._shadePlotId=t}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(t){this._stdScaleType=t}get stdScale(){return jh[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(t){this._useStandardScale=t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPlotSettings"),t.writeString(1,this.plotSettingsName),t.writeString(2,this.plotCfgName),t.writeString(4,this.canonicalMediaName),t.writeString(6,this.plotViewName),t.writeDouble(40,this.plotPaperMargins.left),t.writeDouble(41,this.plotPaperMargins.bottom),t.writeDouble(42,this.plotPaperMargins.right),t.writeDouble(43,this.plotPaperMargins.top),t.writeDouble(44,this.plotPaperSize.x),t.writeDouble(45,this.plotPaperSize.y),t.writeDouble(46,this.plotOrigin.x),t.writeDouble(47,this.plotOrigin.y),t.writeDouble(48,this.plotWindowArea.min.x),t.writeDouble(49,this.plotWindowArea.min.y),t.writeDouble(140,this.plotWindowArea.max.x),t.writeDouble(141,this.plotWindowArea.max.y),t.writeDouble(142,this.customPrintScale.numerator),t.writeDouble(143,this.customPrintScale.denominator);let e=0;return this.plotViewportBorders&&(e|=1),this.showPlotStyles&&(e|=2),this.plotCentered&&(e|=4),this.plotHidden&&(e|=8),this.useStandardScale&&(e|=16),this.plotPlotStyles&&(e|=32),this.scaleLineweights&&(e|=64),this.printLineweights&&(e|=128),this.drawViewportsFirst&&(e|=512),this.modelType&&(e|=1024),t.writeInt16(70,e),t.writeInt16(72,this.plotPaperUnits),t.writeInt16(73,this.plotRotation),t.writeInt16(74,this.plotType),t.writeString(7,this.currentStyleSheet),t.writeInt16(75,this.stdScaleType),t.writeInt16(76,this.shadePlot),t.writeInt16(77,this.shadePlotResLevel),t.writeInt16(78,this.shadePlotCustomDPI),t.writeDouble(147,this.stdScale),t.writeObjectId(333,this.shadePlotId),this}}class Ti extends So{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new Q,this._extents=new C,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}get viewportArray(){return this._viewportArray}set viewportArray(t){this._viewportArray=t.slice()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayout"),t.writeString(1,this.layoutName),t.writeInt16(70,this.tabSelected?1:0),t.writeInt16(71,this.tabOrder),t.writeObjectId(330,this.blockTableRecordId),t.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),t.writePoint2d(10,this.limits.min),t.writePoint2d(11,this.limits.max),t.writePoint3d(14,this.extents.min),t.writePoint3d(15,this.extents.max),this}}class Lo{constructor(){this.events={layoutCreated:new U,layoutRemoved:new U,layoutRenamed:new U,layoutSwitched:new U}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const i=this.getWorkingDatabase(e),r=i.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(r,i)}setCurrentLayoutBtrId(t,e){const i=this.getWorkingDatabase(e),r=i.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(r,i)}setCurrentLayout(t,e){const i=this.getWorkingDatabase(e),r=i.objects.layout.getAt(t);return this.setCurrentLayoutInternal(r,i)}renameLayout(t,e,i){const s=this.getWorkingDatabase(i).objects.layout.getAt(t);return s?(s.layoutName=e,this.events.layoutRenamed.dispatch({layout:s,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const i=this.getWorkingDatabase(e).objects.layout,r=i.getAt(t);let s=!1;return r&&(s=i.remove(t),s&&this.events.layoutRemoved.dispatch({layout:r})),s}createLayout(t,e){const i=this.getWorkingDatabase(e),r=new Ti;r.layoutName=t,r.tabOrder=i.objects.layout.maxTabOrder;const s=new et;return s.name=`*Paper_Space${r.tabOrder}`,i.tables.blockTable.add(s),i.objects.layout.setAt(t,r),this.events.layoutCreated.dispatch({layout:r}),{layout:r,btr:s}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||ul()}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}let si;function Gh(n){si=n}function Mo(){return ci.instance}const xi=class xi{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager||(si||(si=()=>new Lo),this._layoutManager=si()),this._layoutManager}};xi.instance=new xi;let ci=xi;Ys(Mo);var Eo=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(Eo||{});class sr{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new sr(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Io{constructor(t,e,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=i,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,i)=>{const r=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(r):setTimeout(r,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let i=0;const r=async()=>{const s=i,o=Math.min(i+this._chunkSize,this._count);await t(s,o),i=o,i<this._count&&await this.scheduleTask(r)};await r(),await(e==null?void 0:e())}}const Dt="Continuous",W="Standard",Vt="Standard",jt="Standard",Dh="ANSI31",To="ANGLE",Jt="SOLID",Co="USER",Oo="LINEAR",Z="ByLayer",St="ByBlock",we="*Active",ln="mlightcad",hn="ACAD",Hh=Object.freeze({x:0,y:0}),Uh=Object.freeze({x:0,y:0}),Wh=Object.freeze({x:1,y:1}),$h=Object.freeze({x:0,y:0,z:1}),qh=Object.freeze({x:0,y:0,z:0}),Kh=0,Zh=32767,Qh=/\\f(.*?)\|/g;class vt{constructor(t){this.styles=t.styles,this.styleMap=vt.buildStyleFontMap(this.styles),this.textStyleVar=t.textStyleVar??W}collect(t,e){const i=new Set;for(const r of vt.collectShapeDefinitionFonts(this.styles))i.add(r);return this.collectFromEntities(t,e,i),Array.from(i)}static normalizeFontFileName(t){if(!t)return;const e=t.lastIndexOf(".");return e>=0?t.substring(0,e).toLowerCase():t.toLowerCase()}collectFromEntities(t,e,i){for(const r of t){const s=e.getEntityFontInfo(r);if(s){if(s.formattedText)for(const o of vt.extractInlineMTextFonts(s.formattedText))i.add(o);if(s.resolveStyle&&this.addResolvedStyleFonts(s.styleName,i),s.blockName&&e.getBlockEntities){const o=e.getBlockEntities(s.blockName);o&&this.collectFromEntities(o,e,i)}}}}resolveStyleFontNames(t){const e=[],i=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};i(t),i(this.textStyleVar),i(W),i("STANDARD");for(const r of e){const s=this.styleMap.get(r);if(s)return s;const o=r.toUpperCase();for(const[a,h]of this.styleMap)if(a.toUpperCase()===o)return h}return this.styleMap.values().next().value}addResolvedStyleFonts(t,e){const i=this.resolveStyleFontNames(t);i==null||i.forEach(r=>e.add(r))}static buildStyleFontMap(t){const e=new Map;for(const i of t)e.set(i.name,vt.collectStyleEntryFontNames(i));return e}static collectStyleEntryFontNames(t){const e=[];for(const i of[t.font,t.bigFont,t.extendedFont]){const r=vt.normalizeFontFileName(i);r&&e.push(r)}return e}static collectShapeDefinitionFonts(t){const e=[];for(const i of t)if(i.standardFlag&&i.standardFlag&1){const r=vt.normalizeFontFileName(i.font);r&&e.push(r)}return e}static extractInlineMTextFonts(t){const e=[];for(const i of t.matchAll(Qh))e.push(i[1].toLowerCase());return e}}class ie{static get instance(){return this._instance||(this._instance=new ie),this._instance}constructor(){this._blocks=new Map}createKey(t,e){let i=e.toString();return!i&&e.isByColor&&(i=`RGB:${e.red},${e.green},${e.blue}`),`${t}_${i}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,i,r=[],s=!0,o,a){const h=[];if(e!=null){const l=i.RGB??0,c=this.createKey(e.name,i);let u;if(this.has(c))u=this.get(c);else{const g=e.newIterator();for(const d of g)d.visibility&&(d.color.isByBlock?(us.copy(d.color),i.isForeground?d.color.setForeground():d.color.setRGBValue(l),this.addEntity(d,h,t),d.color.copy(us)):this.addEntity(d,h,t));u=t.group(h),u&&s&&et.name&&!et.name.startsWith("*U")&&this.set(c,u)}return u&&o&&(u.applyMatrix(o),a&&(a.x!=0||a.y!=0||a.z!=1)&&(o.setFromExtrusionDirection(a),u.applyMatrix(o))),u&&r&&r.length>0&&(u.bakeTransformToChildren(),r.forEach(g=>u.addChild(g))),u}else return t.group(h)}addEntity(t,e,i){if(!t.visibility)return;const r=t.worldDraw(i);r&&(this.attachEntityInfo(r,t),e.push(r))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const us=new k;exports.AcGiArrowType=void 0;(function(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"})(exports.AcGiArrowType||(exports.AcGiArrowType={}));exports.AcGiLineWeight=void 0;(function(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"})(exports.AcGiLineWeight||(exports.AcGiLineWeight={}));var Ci=function(){function n(t){t===void 0&&(t={});var e,i,r,s;this.database=t.database,this.foregroundOnDark=(e=t.foregroundOnDark)!==null&&e!==void 0?e:Re,this.foregroundOnLight=(i=t.foregroundOnLight)!==null&&i!==void 0?i:ze,this.backgroundIsDark=(r=t.backgroundIsDark)!==null&&r!==void 0?r:!0,this.fallbackRgb=(s=t.fallbackRgb)!==null&&s!==void 0?s:16777215}return n.prototype.resolveSubEntityTraitsRgb=function(t){var e,i,r,s=t.color;return s.isForeground?this.backgroundIsDark?this.foregroundOnDark:this.foregroundOnLight:s.isByLayer||s.isByBlock?(e=this.fallbackRgb)!==null&&e!==void 0?e:16777215:(r=(i=s.RGB)!==null&&i!==void 0?i:this.fallbackRgb)!==null&&r!==void 0?r:16777215},n.fromBackgroundColor=function(t,e){return t===void 0&&(t=ko),new n({database:e,foregroundOnDark:Re,foregroundOnLight:ze,backgroundIsDark:!Yo(t),fallbackRgb:16777215})},n}(),ko=0,Re=16777215,ze=0,Jh=16777215,tc=128,ec=new Ci({database:void 0,foregroundOnDark:Re,foregroundOnLight:ze,backgroundIsDark:!0,fallbackRgb:16777215});function Yo(n){var t=n>>16&255,e=n>>8&255,i=n&255;return .299*t+.587*e+.114*i>tc}function ic(n){var t=Ci.fromBackgroundColor(n);return t.backgroundIsDark?t.foregroundOnDark:t.foregroundOnLight}function nc(n){return n?ze:Re}function rc(n,t){return Ci.fromBackgroundColor(t).resolveSubEntityTraitsRgb(n)}exports.AcGiMTextFlowDirection=void 0;(function(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"})(exports.AcGiMTextFlowDirection||(exports.AcGiMTextFlowDirection={}));exports.AcGiMTextAttachmentPoint=void 0;(function(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"})(exports.AcGiMTextAttachmentPoint||(exports.AcGiMTextAttachmentPoint={}));exports.AcGiRenderMode=void 0;(function(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"})(exports.AcGiRenderMode||(exports.AcGiRenderMode={}));exports.AcGiOrthographicType=void 0;(function(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"})(exports.AcGiOrthographicType||(exports.AcGiOrthographicType={}));exports.AcGiDefaultLightingType=void 0;(function(n){n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS"})(exports.AcGiDefaultLightingType||(exports.AcGiDefaultLightingType={}));var Xo=function(){function n(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new m,this._height=0,this._width=0,this._viewCenter=new m,this._viewHeight=0}return Object.defineProperty(n.prototype,"number",{get:function(){return this._number},set:function(t){this._number=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"id",{get:function(){return this._id},set:function(t){this._id=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"groupId",{get:function(){return this._groupId},set:function(t){this._groupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"centerPoint",{get:function(){return this._centerPoint},set:function(t){this._centerPoint.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"box",{get:function(){var t=new Q;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewCenter",{get:function(){return this._viewCenter},set:function(t){this._viewCenter.copy(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(t){this._viewHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewWidth",{get:function(){return this.viewHeight*(this.width/this.height)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viewBox",{get:function(){var t=new Q;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var t=new n;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t},n.prototype.copy=function(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this},n}(),at=(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))(at||{}),D=(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))(D||{}),j=(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))(j||{});function No(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Bo(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}const b={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",AUPREC:"AUPREC",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELTYPE:"CELTYPE",CELWEIGHT:"CELWEIGHT",CETRANSPARENCY:"CETRANSPARENCY",CLAYER:"CLAYER",CMLEADERSTYLE:"CMLEADERSTYLE",CMLSCALE:"CMLSCALE",CMLSTYLE:"CMLSTYLE",COLORTHEME:"COLORTHEME",DYNMODE:"DYNMODE",DYNPROMPT:"DYNPROMPT",DWGNAME:"DWGNAME",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",GRIPOBJLIMIT:"GRIPOBJLIMIT",HPANG:"HPANG",HPASSOC:"HPASSOC",HPBACKGROUNDCOLOR:"HPBACKGROUNDCOLOR",HPCOLOR:"HPCOLOR",HPDOUBLE:"HPDOUBLE",HPISLANDDETECTION:"HPISLANDDETECTION",HPLAYER:"HPLAYER",HPNAME:"HPNAME",HPSCALE:"HPSCALE",HPSEPARATE:"HPSEPARATE",HPTRANSPARENCY:"HPTRANSPARENCY",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LUNITS:"LUNITS",LUPREC:"LUPREC",LWDISPLAY:"LWDISPLAY",MEASUREMENT:"MEASUREMENT",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",MODELBKCOLOR:"MODELBKCOLOR",OSMODE:"OSMODE",ORTHOMODE:"ORTHOMODE",PAPERBKCOLOR:"PAPERBKCOLOR",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",POLARADDANG:"POLARADDANG",POLARMODE:"POLARMODE",POLARANG:"POLARANG",SHORTCUTMENU:"SHORTCUTMENU",TEXTSTYLE:"TEXTSTYLE",UNITMODE:"UNITMODE"},sc=Object.freeze(Object.values(b)),wi=class wi{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new U},this.registerVar({name:b.ANGBASE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.ANGDIR,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.AUNITS,type:"number",isDbVar:!0,defaultValue:at.DecimalDegrees}),this.registerVar({name:b.AUPREC,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.CECOLOR,type:"color",isDbVar:!0,defaultValue:new k(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:b.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:b.CELTYPE,type:"string",isDbVar:!0,defaultValue:Z}),this.registerVar({name:b.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:exports.AcGiLineWeight.ByLayer}),this.registerVar({name:b.CETRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new $}),this.registerVar({name:b.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:b.CMLEADERSTYLE,type:"string",isDbVar:!0,defaultValue:jt}),this.registerVar({name:b.CMLSCALE,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:b.CMLSTYLE,type:"string",isDbVar:!0,defaultValue:Vt}),this.registerVar({name:b.COLORTHEME,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.DYNMODE,type:"number",isDbVar:!1,defaultValue:3}),this.registerVar({name:b.DYNPROMPT,type:"boolean",isDbVar:!1,defaultValue:!0}),this.registerVar({name:b.DWGNAME,type:"string",isDbVar:!0,readOnly:!0,defaultValue:"Drawing1.dwg"}),this.registerVar({name:b.GRIPOBJLIMIT,type:"number",isDbVar:!1,defaultValue:100}),this.registerVar({name:b.HPANG,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.HPASSOC,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:b.HPBACKGROUNDCOLOR,type:"color",isDbVar:!0,defaultValue:new k(exports.AcCmColorMethod.None)}),this.registerVar({name:b.HPCOLOR,type:"color",isDbVar:!0,defaultValue:new k(exports.AcCmColorMethod.ByLayer)}),this.registerVar({name:b.HPDOUBLE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.HPISLANDDETECTION,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:b.HPLAYER,type:"string",isDbVar:!0,defaultValue:"."}),this.registerVar({name:b.HPNAME,type:"string",isDbVar:!1,defaultValue:To}),this.registerVar({name:b.HPSCALE,type:"number",isDbVar:!1,defaultValue:1}),this.registerVar({name:b.HPSEPARATE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.HPTRANSPARENCY,type:"transparency",isDbVar:!0,defaultValue:new $}),this.registerVar({name:b.INSUNITS,type:"number",isDbVar:!0,defaultValue:j.Millimeters}),this.registerVar({name:b.LUNITS,type:"number",isDbVar:!0,defaultValue:D.Decimal}),this.registerVar({name:b.LUPREC,type:"number",isDbVar:!0,defaultValue:4}),this.registerVar({name:b.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:b.MEASUREMENT,type:"number",isDbVar:!0,defaultValue:1}),this.registerVar({name:b.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new k(exports.AcCmColorMethod.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:b.MODELBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new k(exports.AcCmColorMethod.ByColor);return t.setRGB(0,0,0),t})()}),this.registerVar({name:b.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.ORTHOMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:b.PAPERBKCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new k(exports.AcCmColorMethod.ByColor);return t.setRGB(255,255,255),t})()}),this.registerVar({name:b.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:b.POLARADDANG,type:"string",isDbVar:!1,defaultValue:""}),this.registerVar({name:b.POLARMODE,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.POLARANG,type:"number",isDbVar:!1,defaultValue:90}),this.registerVar({name:b.SHORTCUTMENU,type:"number",isDbVar:!1,defaultValue:0}),this.registerVar({name:b.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:W}),this.registerVar({name:b.UNITMODE,type:"number",isDbVar:!0,defaultValue:0})}static instance(){return this._instance||(this._instance=new wi),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const i=this.getDescriptor(t);if(!i)throw new Error(`System variable ${t} not found!`);if(i.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}getDefaultValue(t){t=this.normalizeName(t);const e=this.getDescriptor(t);if(!e)throw new Error(`System variable ${t} not found!`);return e.defaultValue}setVar(t,e,i){t=this.normalizeName(t);const r=this.getDescriptor(t);if(r){if(r.readOnly)throw new Error(`System variable ${t} is read-only!`);const s=this.getVar(t,i);if(r.type==="transparency"){const o=this.parseTransparency(e);if(o==null||o.isInvalid)throw new Error("Invalid transparency value!");e=o}else if(r.type!=="string"&&(typeof e=="string"||e instanceof String)){if(r.type==="number"){const o=Number(e);if(Number.isNaN(o))throw new Error("Invalid number input!");e=o}else if(r.type==="boolean")e=this.parseBoolean(e);else if(r.type==="color"){const o=this.parseColorSysVar(t,e,i);if(o==null)throw new Error("Invalid color value!");e=o}}if(t===b.GRIPOBJLIMIT.toLowerCase()){const o=Math.trunc(e);if(!Number.isFinite(o)||o<0||o>32767)throw new Error("Invalid GRIPOBJLIMIT value! Valid range is 0 to 32767.");e=o}r.isDbVar?i[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(s,e)&&this.events.sysVarChanged.dispatch({database:i,name:t,newVal:e,oldVal:s}))}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),i=new Set(["true","t","1","yes","y"]),r=new Set(["false","f","0","no","n"]);return i.has(e)?!0:(r.has(e),!1)}parseColorSysVar(t,e,i){const r=e.trim().toLowerCase();return t===b.HPCOLOR.toLowerCase()&&(r==="."||r==="use current")?i.cecolor.clone():t===b.HPBACKGROUNDCOLOR.toLowerCase()&&(r===""||r==="."||r==="none")?new k(exports.AcCmColorMethod.None):k.fromString(e)}parseTransparency(t){if(t instanceof $)return t;if(typeof t=="number")return $.deserialize(t);if(!(typeof t!="string"&&!(t instanceof String)))return $.fromString(String(t))}hasValueChanged(t,e){return t instanceof k&&e instanceof k||t instanceof $&&e instanceof $?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};wi._instance=null;let mt=wi;const Ro="Load Database",ds=3e4,oc=12e4,ac=1024*1024;class rt extends Es{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Wn.getInstance().getEntry(Ro),i=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",r?r.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-i),r}}class zo{constructor(t={}){this.config={useWorker:t.useWorker??!0,...t}}async read(t,e,i,r,s,o){const a={name:Ro,data:{total:0},format(){let u="";return Object.keys(this.data).forEach(g=>{g!=="total"&&(u+=`- ${g}: ${this.data[g]} ms
4
+ `)}),u+=`- total: ${this.data.total} ms`,u}};Wn.getInstance().collect(a),this.progress=r;const h={value:0},l=new Is;l.setCompleteCallback(()=>this.onFinished()),l.setErrorCallback(u=>this.onError(u)),l.addTask(new rt({stage:"START",step:1,progress:h,task:async u=>u},r)),l.addTask(new rt({stage:"PARSE",step:5,progress:h,task:async u=>await this.parse(u,s)},r)),l.addTask(new rt({stage:"FONT",step:5,progress:h,task:async u=>{const g=this.getFonts(u.model);return{model:u.model,data:g}}},r)),l.addTask(new rt({stage:"LTYPE",step:1,progress:h,task:async u=>(this.processLineTypes(u.model,e),u)},r)),l.addTask(new rt({stage:"STYLE",step:1,progress:h,task:async u=>(this.processTextStyles(u.model,e),u)},r)),l.addTask(new rt({stage:"DIMSTYLE",step:1,progress:h,task:async u=>(this.processDimStyles(u.model,e),u)},r)),l.addTask(new rt({stage:"LAYER",step:1,progress:h,task:async u=>(this.processLayers(u.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),u)},r)),l.addTask(new rt({stage:"VPORT",step:1,progress:h,task:async u=>(this.processViewports(u.model,e),u)},r)),l.addTask(new rt({stage:"HEADER",step:1,progress:h,task:async u=>{if(this.processHeader(u.model,e),o){const g=mt.instance();for(const[d,p]of Object.entries(o))g.setVar(d,p,e)}return u}},r)),l.addTask(new rt({stage:"BLOCK_RECORD",step:5,progress:h,task:async u=>(this.processBlockTables(u.model,e),u)},r)),l.addTask(new rt({stage:"OBJECT",step:5,progress:h,task:async u=>(this.processObjects(u.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),u)},r)),l.addTask(new rt({stage:"BLOCK",step:5,progress:h,task:async u=>(await this.processBlocks(u.model,e),u)},r)),l.addTask(new rt({stage:"ENTITY",step:100,progress:h,task:async u=>(await this.processEntities(u.model,e,i,h,r),u)},r)),l.addTask(new rt({stage:"END",step:0,progress:h,task:async u=>u},r));const c=Date.now();await l.run(t),a.data.total=Date.now()-c}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),ie.instance.clear())}getParserWorkerTimeout(t,e){const i=e??this.config.timeout;if(i!=null)return i;const r=Math.ceil(t.byteLength/ac),s=ds+r*1e3;return Math.min(oc,Math.max(ds,s))}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,i,r,s){throw new Error("Not impelemented yet!")}}class Fo extends zo{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,i,r,s){let o=t.tables.blockTable.modelSpace.newIterator().toArray();const a=o.length,h=new Io(a,100-r.value,i);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const l=e.tables.blockTable.modelSpace;await h.processChunk(async(c,u)=>{let g=[],d=c<u?o[c].type:"";for(let p=c;p<u;p++){const f=o[p];this.config.convertByEntityType&&f.type!==d&&(this.triggerEvents(l,g),g=[],d=f.type),g.push(f)}if(this.triggerEvents(l,g),s){let p=r.value+u/a*(100-r.value);p>100&&(p=100),await s(p,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const i=e.newIterator().toArray();this.triggerEvents(e,i)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const r of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const r of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.objectId});const i=this._database.objects.mleaderStyle.newIterator();for(const r of i)this._database.events.dictObjetSet.dispatch({database:this._database,object:r,key:r.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},i=[];for(const r of t)e[r.type]||(e[r.type]=[],i.push(r.type)),e[r.type].push(r);return i.flatMap(r=>e[r])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}class Vo{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const i=Date.now(),r=this.generateTaskId();try{return await this.executeInWorker(r,t,e||this.config.workerUrl)}catch(s){const o=Date.now()-i;return{success:!1,error:s instanceof Error?s.message:String(s),duration:o}}}async executeInWorker(t,e,i){const r=Date.now();return new Promise((s,o)=>{const a=this.getAvailableWorker(i),h=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(a),o(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:u=>{clearTimeout(h),this.releaseWorker(a),s(u)},reject:u=>{clearTimeout(h),this.releaseWorker(a),o(u)},timeout:h});const l=u=>{const{id:g,success:d,data:p,error:f}=u.data;if(g!==t)return;this.cleanupTask(t);const y=Date.now()-r;s(d?{success:!0,data:p,duration:y}:{success:!1,error:f,duration:y})},c=u=>{this.cleanupTask(t),o(new Error(`Worker error: ${u.message}`))};a.addEventListener("message",l),a.addEventListener("error",c),a.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[i,r]of this.workers)if(!r.isBusy)return r.isBusy=!0,r.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const i=new Worker(t,{type:"module"}),r=this.generateWorkerId(),s={worker:i,isBusy:!0,id:r,createdAt:new Date};return this.workers.set(r,s),i}const e=Array.from(this.workers.values()).sort((i,r)=>i.createdAt.getTime()-r.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,i]of this.workers)if(i.worker===t){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(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class jo{constructor(t){this.framework=new Vo(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function lc(n){return new jo(n)}class hc{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:i}=t.data;try{const r=await this.executeTask(i);this.sendResponse(e,!0,r)}catch(r){this.sendResponse(e,!1,void 0,r instanceof Error?r.message:String(r))}}}sendResponse(t,e,i,r){const s={id:t,success:e,data:i,error:r};self.postMessage(s)}}var Ce=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Ce||{});class wt{constructor(){this.events={registered:new U,unregistered:new U},this._converters=new Map}static createInstance(){return wt._instance==null&&(wt._instance=new wt),this._instance}static get instance(){return wt._instance||(wt._instance=new wt),wt._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}var Go=(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))(Go||{}),Do=(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))(Do||{}),Ho=(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))(Ho||{}),Uo=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(Uo||{}),Wo=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(Wo||{});const bi=class bi extends Ut{constructor(t,e){t=t||{},Ge(t,bi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}dxfOutFields(t){super.dxfOutFields(t);const e=this.database.tables.textStyleTable.getAt(this.dimtxsty),i=this.database.tables.blockTable.getAt(this.dimldrblk),r=this.database.tables.blockTable.getAt(this.dimblk),s=this.database.tables.blockTable.getAt(this.dimblk1),o=this.database.tables.blockTable.getAt(this.dimblk2);return t.writeSubclassMarker("AcDbDimStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),t.writeString(3,this.dimpost),t.writeString(4,this.dimapost),t.writeDouble(40,this.dimscale),t.writeDouble(41,this.dimasz),t.writeDouble(42,this.dimexo),t.writeDouble(43,this.dimdli),t.writeDouble(44,this.dimexe),t.writeDouble(140,this.dimtxt),t.writeDouble(147,this.dimgap),t.writeInt16(170,this.dimalt),t.writeInt16(171,this.dimtol),t.writeInt16(172,this.dimlim),t.writeInt16(173,this.dimtih),t.writeInt16(174,this.dimtoh),t.writeObjectId(340,e==null?void 0:e.objectId),t.writeObjectId(341,i==null?void 0:i.objectId),t.writeObjectId(342,r==null?void 0:r.objectId),t.writeObjectId(343,s==null?void 0:s.objectId),t.writeObjectId(344,o==null?void 0:o.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};bi.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:W,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let be=bi;class or extends Ut{constructor(t,e){t=t||{},Ge(t,{color:new k,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new $,linetype:"",lineWeight:1,materialId:-1}),super(t,e),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(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeCmColor(this.color),t.writeString(6,this.linetype),t.writeInt16(290,this.isPlottable?1:0),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency),this.description&&t.writeString(4,this.description),this}}class te extends Ut{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[t].elementLength}toPreviewSvgString(t){const e=Math.max((t==null?void 0:t.width)??220,1),i=Math.max((t==null?void 0:t.height)??36,1),r=Math.min(Math.max((t==null?void 0:t.padding)??8,0),Math.floor(e/2)),s=Math.max((t==null?void 0:t.strokeWidth)??2,.5),o=this.escapeSvgAttribute((t==null?void 0:t.stroke)??"currentColor"),a=Math.max((t==null?void 0:t.repeats)??4,1),h=i/2,l=r,c=Math.max(e-r,l+1),u=c-l,g=this._linetype.pattern??[];if(g.length===0||this.patternLength<=0||!g.some(S=>S.elementLength!==0))return this.buildSvgString({width:e,height:i,stroke:o,strokeWidth:s,lineSegments:[[l,c]],dots:[],y:h});const d=[],p=[],f=u/(this.patternLength*a),y=.5,_=Math.max(s*2,2);let v=l;for(;v<c;)for(const S of g){if(v>=c)break;const A=S.elementLength;if(A===0){p.push(v),v=Math.min(v+_,c);continue}const L=Math.max(Math.abs(A)*f,y),T=Math.min(v+L,c);A>0&&T>v&&d.push([v,T]),v=T}return this.buildSvgString({width:e,height:i,stroke:o,strokeWidth:s,lineSegments:d,dots:p,y:h})}buildSvgString(t){const{width:e,height:i,stroke:r,strokeWidth:s,lineSegments:o,dots:a,y:h}=t,l=o.map(([u,g])=>`<line x1="${u.toFixed(2)}" y1="${h.toFixed(2)}" x2="${g.toFixed(2)}" y2="${h.toFixed(2)}" stroke="${r}" stroke-width="${s.toFixed(2)}" stroke-linecap="round" />`).join(""),c=a.map(u=>`<circle cx="${u.toFixed(2)}" cy="${h.toFixed(2)}" r="${(s/2).toFixed(2)}" fill="${r}" />`).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}" viewBox="0 0 ${e} ${i}" role="img" aria-label="${this.escapeSvgAttribute(this.name)} linetype preview">${l}${c}</svg>`}escapeSvgAttribute(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;")}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLinetypeTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.linetype.standardFlag),t.writeString(3,this.comments),t.writeInt16(72,65),t.writeInt16(73,this.numDashes),t.writeDouble(40,this.patternLength);for(const e of this.linetype.pattern??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class ar extends Ut{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name)}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return(this._textStyle.standardFlag&4)===4}set isVertical(t){t?this._textStyle.standardFlag|=4:this._textStyle.standardFlag&=-5}get isShapeFile(){return(this._textStyle.standardFlag&1)===1}set isShapeFile(t){t?this._textStyle.standardFlag|=1:this._textStyle.standardFlag&=-2}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const i=e.lastIndexOf(".");return i===-1?e:e.substring(0,i)}return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.textStyle.standardFlag),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.textStyle.textGenerationFlag),t.writeDouble(42,this.priorSize),t.writeString(3,this.fileName),t.writeString(4,this.bigFontFileName),this}}var w=(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))(w||{});function cc(n){let t=0;for(const e of n)t|=1<<e-1;return t}function uc(n){const t=[];for(const e of Object.values(w)){if(typeof e!="number")continue;const i=1<<e-1;n&i&&t.push(e)}return t}function dc(n,t){return n^1<<t-1}function gc(n,t){return(n&1<<t-1)!==0}function pc(n,t){return n|1<<t-1}function fc(n,t){return n&~(1<<t-1)}const yc={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:[]},$o={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:[]},pr=class pr extends _t{constructor(){super(...arguments),this._visibility=!0,this._transparency=new $,this._transparencySet=!1}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this.getEntityColor()}set color(t){this.setEntityColor(t)}get resolvedColor(){return this.resolveStandardColor()}resolveStandardColor(){var e;let t=this.color;if(t.isByLayer){const i=this.getLayerColor();i&&i.RGB!=null&&(t=i)}else if(t.isByBlock){const i=this.database.cecolor;if(i&&(t=i,t.isByLayer)){const r=this.database.clayer||this.layer,s=this.database.tables.layerTable.getAt(r);((e=s==null?void 0:s.color)==null?void 0:e.RGB)!=null&&(t=s.color)}}return t}get lineType(){var t;return this._lineType==null&&(this._lineType=((t=this.database)==null?void 0:t.celtype)??Z),this._lineType}set lineType(t){t?t.toUpperCase()==="BYLAYER"?this._lineType=Z:t.toUpperCase()==="BYBLOCK"?this._lineType=St:this._lineType=t:this._lineType=Z}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone(),this._transparencySet=!0}hasExplicitLayer(){return this._layer!=null}hasExplicitColor(){return this._color!=null}getEntityColor(){return this._color==null&&(this._color=new k,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}setEntityColor(t){this._color==null&&(this._color=new k),this._color.copy(t)}shouldResolveColorFromCecolor(){return!0}hasExplicitTransparency(){return this._transparencySet}dxfOutFields(t){t.writeSubclassMarker("AcDbEntity"),t.writeString(8,this.layer),t.writeString(6,this.lineType),t.writeDouble(48,this.linetypeScale),t.writeInt16(60,this.visibility?0:1),t.writeCmColor(this.color),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency);const e=this.database.tables.blockTable.getIdAt(this.ownerId);return e!=null&&e.isPaperSapce&&t.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new k,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=this.database.celtype??Z),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??exports.AcGiLineWeight.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subMoveGripPointsAt(t,e){return this}subGetOsnapPoints(t,e,i,r,s,o){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){if(!this.database.isLayerDrawable(this.layer))return;const i=t.subEntityTraits;i.color=this.resolvedColor,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),t.context.database=this.database;const r=this.subWorldDraw(t,e);return this.attachEntityInfo(r),r}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color=t}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var r;const{type:t,name:e}=this.getLineType(),i=(r=this.database)==null?void 0:r.tables.linetypeTable.getAt(e);return i?{type:t,...i.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Z){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==St?{type:"ByBlock",name:Dt}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Dt}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);return t!=null?t.color:null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};pr.typeName="Entity";let q=pr;function K(n,t){for(const e of n)Number.isInteger(e)&&e>=0&&t(e)}function kt(n,t,e){K(n,i=>{i===0&&e.add(t)})}function lr(n,t,e){const i=n[t];i&&(i.x+=e.x,i.y+=e.y)}function Oi(n,t,e){K(n,i=>{const r=e[i];r&&r.add(t)})}function gs(n,t){const e=n.x-t.x,i=n.y-t.y,r=(n.z||0)-(t.z||0);return e*e+i*i+r*r}function gt(n,t){if(t.length===0)return;let e=new m(t[0].x,t[0].y,t[0].z||0),i=gs(n,e);for(let r=1;r<t.length;r++){const s=t[r],o=new m(s.x,s.y,s.z||0),a=gs(n,o);a<i&&(e=o,i=a)}return e}function Ae(n,t,e,i,r){const s=new m(n.x,n.y,n.z||0),o=new m(t.x,t.y,t.z||0),a=new Ct(s,o);switch(e){case w.EndPoint:r.push(s,o);break;case w.MidPoint:r.push(a.midPoint);break;case w.Nearest:r.push(a.nearestPoint(i));break;case w.Perpendicular:r.push(a.perpPoint(i));break}}function ui(n,t,e,i,r,s,o){if(e){const a=new ot(n,t,e);switch(r){case w.EndPoint:o.push(new m(a.startPoint.x,a.startPoint.y,i),new m(a.endPoint.x,a.endPoint.y,i));break;case w.MidPoint:o.push(new m(a.midPoint.x,a.midPoint.y,i));break;case w.Nearest:{const h=a.nearestPoint({x:s.x,y:s.y});o.push(new m(h.x,h.y,i));break}case w.Perpendicular:{a.perpendicularPoints({x:s.x,y:s.y}).forEach(l=>o.push(new m(l.x,l.y,i)));break}case w.Tangent:{a.tangentPoints({x:s.x,y:s.y}).forEach(l=>o.push(new m(l.x,l.y,i)));break}}return}Ae(new m(n.x,n.y,i),new m(t.x,t.y,i),r,s,o)}function hr(n,t,e,i,r){if(n.length!==0)switch(e){case w.EndPoint:n.forEach(s=>r.push(new m(s.x,s.y,s.z||0)));break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const s=n.length,o=[];for(let a=0;a<s;a++){const h=[];Ae(n[a],n[(a+1)%n.length],e,i,h),o.push(...h)}if(e===w.MidPoint)r.push(...o);else{const a=gt(i,o);a&&r.push(a)}break}}}var Oe=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Oe||{}),qo=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(qo||{}),Ko=(n=>(n[n.HatchObject=0]="HatchObject",n[n.GradientObject=1]="GradientObject",n))(Ko||{}),Zo=(n=>(n[n.PreDefinedGradient=0]="PreDefinedGradient",n[n.UserDefinedGradient=1]="UserDefinedGradient",n))(Zo||{});const fr=class fr extends q{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()===Jt}set isSolidFill(t){this._isSolidFill=t}get color(){if(this.hasExplicitColor())return this.getEntityColor();const t=this.database,e=mt.instance().getVar(b.HPCOLOR,t);return e instanceof k&&e.colorMethod!==exports.AcCmColorMethod.None?e.clone():t.cecolor.clone()}set color(t){this.setEntityColor(t)}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t??"",this._isSolidFill=this._patternName.trim().toUpperCase()===Jt,this._patternNameSet=!0,this.updatePredefinedPatternDefinitionLines()}get patternType(){return this._patternType}set patternType(t){this._patternType=t,t!==1&&this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1),this.updatePredefinedPatternDefinitionLines()}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t,this._patternAngleSet=!0}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}get associative(){return this._associative}set associative(t){this._associative=!!t,this._associativeSet=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t==null?void 0:t.clone(),this._backgroundColorSet=!0}get patternDouble(){return this._patternDouble}set patternDouble(t){this._patternDouble=!!t,this._patternDoubleSet=!0}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t,this._hatchStyleSet=!0}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get hatchObjectType(){return this._hatchObjectType}set hatchObjectType(t){this._hatchObjectType=t}get gradientAngle(){return this._gradientAngle}set gradientAngle(t){this._gradientAngle=t}get gradientShift(){return this._gradientShift}set gradientShift(t){this._gradientShift=t}get gradientType(){return this._gradientType}set gradientType(t){this._gradientType=t}get gradientName(){return this.isGradient&&this._gradientName.trim()===""?Oo:this._gradientName}set gradientName(t){this._gradientName=t??""}get gradientOneColorMode(){return this._gradientOneColorMode}set gradientOneColorMode(t){this._gradientOneColorMode=t}get shadeTintValue(){return this._shadeTintValue}set shadeTintValue(t){this._shadeTintValue=t}get gradientStartColor(){return this._gradientStartColor}set gradientStartColor(t){this._gradientStartColor=t==null||!Number.isFinite(t)?void 0:t&16777215}get gradientEndColor(){return this._gradientEndColor}set gradientEndColor(t){this._gradientEndColor=t==null||!Number.isFinite(t)?void 0:t&16777215}applyPatternDefaultsFromSysVars(t){const e=mt.instance();if(!this.hasExplicitLayer()){const i=e.getVar(b.HPLAYER,t);this.shouldUseSysVarOverride(i)&&(this.layer=i)}if(!this.hasExplicitTransparency()){const i=this.parseHpTransparency(e.getVar(b.HPTRANSPARENCY,t));i&&(this.transparency=i)}if(this._backgroundColorSet||(this._backgroundColor=this.parseHpBackgroundColor(e.getVar(b.HPBACKGROUNDCOLOR,t)),this._backgroundColorSet=!0),!this._patternNameSet){const i=e.getVar(b.HPNAME,t);this._patternName=typeof i=="string"?i:"",this._patternNameSet=!0}if(!this._patternAngleSet){const i=e.getVar(b.HPANG,t);this._patternAngle=typeof i=="number"&&Number.isFinite(i)?i:0,this._patternAngleSet=!0}if(this._patternScaleSet||(this._patternScale=this.normalizePatternScale(e.getVar(b.HPSCALE,t)),this._patternScaleSet=!0),!this._associativeSet){const i=e.getVar(b.HPASSOC,t);this._associative=typeof i=="number"?i!==0:!1,this._associativeSet=!0}if(this._hatchStyleSet||(this._hatchStyle=this.normalizeHatchStyle(e.getVar(b.HPISLANDDETECTION,t)),this._hatchStyleSet=!0),!this._patternDoubleSet){const i=e.getVar(b.HPDOUBLE,t);this._patternDouble=typeof i=="number"?i!==0:!1,this._patternDoubleSet=!0}this.updatePredefinedPatternDefinitionLines()}getEffectivePatternName(){if(this._patternNameSet)return this._patternName;const t=this.database,e=mt.instance().getVar(b.HPNAME,t);return typeof e=="string"?e:this._patternName}shouldResolveColorFromCecolor(){return!1}getEffectivePatternAngle(){if(this._patternAngleSet)return this._patternAngle;const t=this.database,e=mt.instance().getVar(b.HPANG,t);return typeof e=="number"&&Number.isFinite(e)?e:this._patternAngle}getRenderablePatternAngle(){return!this._definitionLinesAutoGenerated&&this._definitionLines.length>0?0:this.getEffectivePatternAngle()}getEffectivePatternScale(){if(this._patternScaleSet)return this._patternScale;const t=this.database;return this.normalizePatternScale(mt.instance().getVar(b.HPSCALE,t))}getEffectiveAssociative(){if(this._associativeSet)return this._associative;const t=this.database,e=mt.instance().getVar(b.HPASSOC,t);return typeof e=="number"?e!==0:this._associative}normalizePatternScale(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:1}normalizeHatchStyle(t){return typeof t!="number"||!Number.isFinite(t)?1:t===0?0:t===2?2:1}shouldUseSysVarOverride(t){if(typeof t!="string")return!1;const e=t.trim().toLowerCase();return e!==""&&e!=="."&&e!=="use current"}parseHpBackgroundColor(t){if(t instanceof k)return t.colorMethod===exports.AcCmColorMethod.None?void 0:t.clone();if(typeof t!="string")return;const e=t.trim().toLowerCase();if(!(!e||e==="."||e==="none"))return k.fromString(t)}parseHpTransparency(t){if(t instanceof $)return t.clone();if(!this.shouldUseSysVarOverride(t))return;const e=t.trim();if(/^bylayer$/i.test(e)||/^byblock$/i.test(e))return $.fromString(e);const i=Number(e);if(Number.isInteger(i)&&i>=0&&i<=90){const r=new $;return r.percentage=i,r}}updatePredefinedPatternDefinitionLines(t=this.getEffectivePatternName(),e=this.getEffectivePatternScale()){if(this.patternType!==1||!(this._definitionLinesAutoGenerated||this._definitionLines.length===0))return;const r=t.trim().toUpperCase();if(!r||r===Jt){this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1;return}const s=this.normalizePatternScale(e);if(this._definitionLinesAutoGenerated&&this._definitionLinesPatternName===r&&this._definitionLinesPatternScale===s)return;const o=$o.patterns.find(a=>a.name.trim().toUpperCase()===r);if(!o){this._definitionLinesAutoGenerated&&(this._definitionLines=[],this._definitionLinesAutoGenerated=!1,this._definitionLinesPatternName="",this._definitionLinesPatternScale=1);return}this._definitionLines=o.lines.map(a=>({angle:a.angle*Math.PI/180,base:{x:a.originX*s,y:a.originY*s},offset:{x:a.deltaX*s,y:a.deltaY*s},dashLengths:a.dashes.map(h=>h*s)})),this._definitionLinesAutoGenerated=!0,this._definitionLinesPatternName=r,this._definitionLinesPatternScale=s}add(t){this._geo.add(t)}buildAreasFromLoops(){const t=this._geo.loops;if(t.length===0)return[];if(t.length===1)return[this._geo];const e=this._geo.buildHierarchy(),i=[],r=(s,o)=>{if(s.index>=0&&o%2===0){const a=new Tt;a.add(t[s.index]),s.children.forEach(h=>{h.index>=0&&a.add(t[h.index])}),i.push(a)}s.children.forEach(a=>r(a,o+1))};return e.children.forEach(s=>r(s,0)),i.length>0?i:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,i)=>e+i.area,0)}get area(){return this.getCalculatedAreaValue()}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new C;const e=new C;return t.forEach(i=>{const r=i.box;e.union(new C({x:r.min.x,y:r.min.y,z:this._elevation},{x:r.max.x,y:r.max.y,z:this._elevation}))}),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Oe[0],value:0},{label:Oe[1],value:1},{label:Oe[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}},{name:"associative",type:"boolean",editable:!0,accessor:{get:()=>this.associative,set:t=>{this.associative=t}}},{name:"backgroundColor",type:"color",editable:!0,accessor:{get:()=>this.backgroundColor,set:t=>{this.backgroundColor=t}}},{name:"patternDouble",type:"boolean",editable:!0,accessor:{get:()=>this.patternDouble,set:t=>{this.patternDouble=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){return this.associative?[]:this.collectBoundaryGripPoints()}subMoveGripPointsAt(t,e){return this.associative?this:(K(t,i=>{this.moveBoundaryGripPointAt(i,e)}),this)}collectBoundaryGripPoints(){const t=new Array,e=this._elevation,i=new Set,r=s=>{const o=`${s.x},${s.y},${s.z??0}`;i.has(o)||(i.add(o),t.push(new m(s.x,s.y,s.z??e)))};return this._geo.loops.forEach(s=>{if(s instanceof V){const o=s.numberOfVertices;for(let a=0;a<o;a++){const h=s.getPointAt(a);r({x:h.x,y:h.y,z:e})}return}s.curves.forEach(o=>{if(o instanceof Pt)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});else if(o instanceof ot)r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e}),r({x:o.midPoint.x,y:o.midPoint.y,z:e});else if(o instanceof Qt){r({x:o.startPoint.x,y:o.startPoint.y,z:e}),r({x:o.endPoint.x,y:o.endPoint.y,z:e});const a=o.getPoint(.5);r({x:a.x,y:a.y,z:e})}})}),t}moveBoundaryGripPointAt(t,e){let i=0;const r=this._elevation,s=new Set,o=(a,h)=>{const l=`${a.x},${a.y},${a.z??0}`;s.has(l)||(s.add(l),i===t&&h(),i++)};this._geo.loops.forEach(a=>{if(a instanceof V){const h=a.numberOfVertices;for(let l=0;l<h;l++){const c=a.vertices[l];c&&o({x:c.x,y:c.y,z:r},()=>{lr(a.vertices,l,e)})}return}a.curves.forEach(h=>{if(h instanceof Pt)o({x:h.startPoint.x,y:h.startPoint.y,z:r},()=>{h.startPoint.x+=e.x,h.startPoint.y+=e.y}),o({x:h.endPoint.x,y:h.endPoint.y,z:r},()=>{h.endPoint.x+=e.x,h.endPoint.y+=e.y});else if(h instanceof ot)o({x:h.startPoint.x,y:h.startPoint.y,z:r},()=>this.moveCircArc2dGripPoint(h,"start",e)),o({x:h.endPoint.x,y:h.endPoint.y,z:r},()=>this.moveCircArc2dGripPoint(h,"end",e)),o({x:h.midPoint.x,y:h.midPoint.y,z:r},()=>this.moveCircArc2dGripPoint(h,"mid",e));else if(h instanceof Qt){o({x:h.startPoint.x,y:h.startPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(h,"start",e)),o({x:h.endPoint.x,y:h.endPoint.y,z:r},()=>this.moveEllipseArc2dGripPoint(h,"end",e));const l=h.getPoint(.5);o({x:l.x,y:l.y,z:r},()=>this.moveEllipseArc2dGripPoint(h,"mid",e))}})})}moveCircArc2dGripPoint(t,e,i){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"mid":{const s=t.midPoint,o=new ot(t.startPoint,{x:s.x+i.x,y:s.y+i.y},t.endPoint);t.center=o.center,t.radius=o.radius,t.startAngle=o.startAngle,t.endAngle=o.endAngle,t.clockwise=o.clockwise;break}}}moveEllipseArc2dGripPoint(t,e,i){const r=t.center;switch(e){case"start":{const s=t.startPoint;t.startAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"end":{const s=t.endPoint;t.endAngle=Math.atan2(s.y+i.y-r.y,s.x+i.x-r.x);break}case"mid":{const s=t.getPoint(.5),o=s.x+i.x-t.center.x,a=s.y+i.y-t.center.y,h=Math.hypot(s.x-t.center.x,s.y-t.center.y),l=Math.hypot(o,a);if(h>0&&l>0){const c=l/h;t.majorAxisRadius*=c,t.minorAxisRadius*=c}break}}}subGetOsnapPoints(t,e,i,r){const s=this._elevation,o=[];if(this._geo.loops.forEach(a=>{var h;if(a instanceof V){const l=a,c=l.numberOfVertices;if(c===0)return;switch(t){case w.EndPoint:for(let u=0;u<c;u++){const g=l.getPointAt(u);r.push(new m(g.x,g.y,s))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const u=a.closed?c:c-1;for(let g=0;g<u;g++){const d=[];ui(l.getPointAt(g),l.getPointAt((g+1)%c),(h=l.vertices[g])==null?void 0:h.bulge,s,t,e,d),t===w.MidPoint?r.push(...d):o.push(...d)}break}}return}a.curves.forEach(l=>{if(l instanceof Pt){const c=[];ui(l.startPoint,l.endPoint,void 0,s,t,e,c),t===w.MidPoint?r.push(...c):t===w.Nearest||t===w.Perpendicular||t===w.Tangent?o.push(...c):r.push(...c)}else if(l instanceof ot)switch(t){case w.EndPoint:r.push(new m(l.startPoint.x,l.startPoint.y,s),new m(l.endPoint.x,l.endPoint.y,s));break;case w.MidPoint:r.push(new m(l.midPoint.x,l.midPoint.y,s));break;case w.Nearest:{const c=l.nearestPoint({x:e.x,y:e.y});o.push(new m(c.x,c.y,s));break}case w.Perpendicular:{l.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}case w.Tangent:{l.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}}else if(l instanceof Qt)switch(t){case w.EndPoint:r.push(new m(l.startPoint.x,l.startPoint.y,s),new m(l.endPoint.x,l.endPoint.y,s));break;case w.MidPoint:{const c=l.getPoint(.5);r.push(new m(c.x,c.y,s));break}case w.Nearest:{const c=l.nearestPoint({x:e.x,y:e.y});o.push(new m(c.x,c.y,s));break}case w.Perpendicular:{l.perpendicularPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}case w.Tangent:{l.tangentPoints({x:e.x,y:e.y}).forEach(u=>o.push(new m(u.x,u.y,s)));break}}})}),(t===w.Nearest||t===w.Perpendicular||t===w.Tangent)&&o.length>0){const a=gt(e,o);r.length=0,a&&r.push(a)}}subWorldDraw(t){var s;this.updatePredefinedPatternDefinitionLines();const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.getRenderablePatternAngle(),definitionLines:this.definitionLines,backgroundColor:(s=this.backgroundColor)==null?void 0:s.clone(),gradient:this.isGradient?{name:this.gradientName,angle:this.gradientAngle,shift:this.gradientShift,oneColorMode:this.gradientOneColorMode,shadeTintValue:this.shadeTintValue,startColor:this.gradientStartColor,endColor:this.gradientEndColor}:void 0},e.drawOrder=-1;const i=this.buildAreasFromLoops();if(i.length===0)return t.area(this._geo);if(i.length===1)return t.area(i[0]);const r=i.map(o=>t.area(o));return t.group(r)}transformBy(t){const e=t.elements,i=new De(e[0],e[4],e[12],e[1],e[5],e[13],0,0,1);this._geo.transform(i),this._elevation=new m(0,0,this._elevation).applyMatrix4(t).z;const r=new m(1,0,0).applyMatrix4(t),s=new m().applyMatrix4(t),o=new m(r).sub(s);if(o.length()>0){const a=Math.atan2(o.y,o.x);this._patternAngle=this.getEffectivePatternAngle()+a,this._gradientAngle+=a,this._patternScale=this.getEffectivePatternScale()*o.length(),this._patternAngleSet=!0,this._patternScaleSet=!0,this.updatePredefinedPatternDefinitionLines()}return this}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops,i=this.getEffectivePatternName(),r=this.getEffectivePatternAngle(),s=this.getEffectivePatternScale();return this.updatePredefinedPatternDefinitionLines(i,s),t.writeSubclassMarker("AcDbHatch"),t.writePoint3d(10,{x:0,y:0,z:this.elevation}),t.writeVector3d(210,{x:0,y:0,z:1}),t.writeString(2,i||(this.isSolidFill?Jt:Co)),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,this.getEffectiveAssociative()?1:0),t.writeInt16(91,e.length),e.forEach((o,a)=>{const h=a===0;if(o instanceof V){const l=o.vertices,c=l.some(g=>(g.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,c?1:0),t.writeInt16(73,o.closed?1:0),t.writeInt16(93,l.length);for(const g of l)t.writePoint2d(10,g),c&&t.writeDouble(42,g.bulge??0);t.writeInt16(97,0);return}if(o instanceof rr){const l=h?1:0;t.writeInt16(92,l),t.writeInt16(93,o.numberOfEdges);for(const c of o.curves){if(c instanceof Pt){t.writeInt16(72,1),t.writePoint2d(10,c.startPoint),t.writePoint2d(11,c.endPoint);continue}if(c instanceof ot){t.writeInt16(72,2),t.writePoint2d(10,c.center),t.writeDouble(40,c.radius),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof Qt){t.writeInt16(72,3),t.writePoint2d(10,c.center);const u=new P(c.majorAxisRadius*Math.cos(c.rotation),c.majorAxisRadius*Math.sin(c.rotation));t.writePoint2d(11,u);const g=c.majorAxisRadius===0?0:c.minorAxisRadius/c.majorAxisRadius;t.writeDouble(40,g),t.writeAngle(50,c.startAngle),t.writeAngle(51,c.endAngle),t.writeInt16(73,c.clockwise?0:1);continue}if(c instanceof At){const u=c.knots,g=c.controlPoints,d=c.weights,p=c.fitPoints,f=d.some(y=>y!==1);t.writeInt16(72,4),t.writeInt16(94,c.degree),t.writeInt16(73,f?1:0),t.writeInt16(74,c.closed?1:0),t.writeInt16(95,u.length),t.writeInt16(96,g.length),u.forEach(y=>t.writeDouble(40,y)),g.forEach((y,_)=>{t.writePoint2d(10,y),f&&t.writeDouble(42,d[_]??1)}),t.writeInt16(97,(p==null?void 0:p.length)??0),p==null||p.forEach(y=>t.writePoint2d(11,y))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,r),t.writeDouble(41,s),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(o=>{t.writeAngle(53,o.angle),t.writePoint2d(43,o.base),t.writePoint2d(45,o.offset),t.writeInt16(79,o.dashLengths.length),o.dashLengths.forEach(a=>t.writeDouble(49,a))}),this.isGradient&&(t.writeInt16(450,this._hatchObjectType),t.writeInt16(451,0),t.writeInt16(452,this._gradientOneColorMode?1:0),t.writeAngle(460,this._gradientAngle),t.writeDouble(461,this._gradientShift),t.writeString(470,this.gradientName)),t.writeInt16(98,0),this}};fr.typeName="Hatch";let di=fr;class Qo{constructor(t){this.db=t}createDefaultLayer(){const t=new k;return t.colorIndex=7,this.db.tables.layerTable.add(new or({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new te({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new te({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new te({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new ar({name:W,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new be({name:W,dimtxsty:W}))}createDefaultLayout(){const t=new Ti;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new di;e.patternName=Jt;const i=new rr;i.add(new Pt({x:0,y:0},{x:-1,y:.125})),i.add(new Pt({x:-1,y:.125},{x:-1,y:-.125})),i.add(new Pt({x:-1,y:-.125},{x:0,y:0})),e.add(i);const r=new et;r.name="_CAXARROW",r.appendEntity(e),this.db.tables.blockTable.add(r)}}}const cn=Math.PI/200;class Jo{constructor(t){this.database=t}formatLength(t,e){const i=this.createContext(e);return ae(t,i)}formatPoint2d(t,e){const i=this.createContext(e);return`${ae(t.x,i)}, ${ae(t.y,i)}`}formatPoint3d(t,e){const i=this.createContext(e);return`${ae(t.x,i)}, ${ae(t.y,i)}, ${ae(t.z,i)}`}formatAngle(t,e){const i=this.createContext(e),s=(e==null?void 0:e.applyAngbaseAngdir)??!0?_c(t,this.database.angbase,this.database.angdir):M.normalizeAngle(t);return mc(s,i)}createContext(t){return{lunits:this.database.lunits,luprec:Fe(this.database.luprec),insunits:this.database.insunits,unitmode:this.database.unitmode,measurement:this.database.measurement,aunits:this.database.aunits,auprec:Fe(this.database.auprec),showUnits:(t==null?void 0:t.showUnits)??!1,showApproximate:(t==null?void 0:t.showApproximate)??!1}}}function ae(n,t){let e;switch(t.lunits){case D.Scientific:e=$i(Mc(n,t.luprec),t);break;case D.Engineering:e=Ec(n,t);break;case D.Architectural:e=Ic(n,t);break;case D.Fractional:e=$i(Tc(n,t),t);break;case D.WindowsDesktop:case D.Decimal:default:e=$i(Le(n,t.luprec),t)}return ta(e,xc(n,t),t)}function mc(n,t){let e;switch(t.aunits){case at.DegreesMinutesSeconds:e=na(n,t);break;case at.Gradians:e=kc(n,t);break;case at.Radians:e=Oc(n,t);break;case at.SurveyorsUnits:e=Yc(n,t);break;case at.DecimalDegrees:default:e=Cc(n,t)}return ta(e,wc(n,t),t)}function _c(n,t,e){let i=n-t;return e===1&&(i=-i),M.normalizeAngle(i)}function cr(n){const t=n.showUnits?'"':"";return n.unitmode===1?{feetInchSeparator:"",fractionSeparator:"-",inchSuffix:t}:{feetInchSeparator:"-",fractionSeparator:" ",inchSuffix:t}}function Fe(n,t=0,e=8){return Number.isFinite(n)?Math.max(t,Math.min(e,Math.round(n))):t}function Se(n){return Object.is(n,-0)?0:n}function ta(n,t,e){return!e.showApproximate||!t?n:`~ ${n}`}function xc(n,t){if(!Number.isFinite(n))return!1;const e=vc(n,t);return ur(n,e)}function wc(n,t){if(!Number.isFinite(n))return!1;if(t.aunits===at.SurveyorsUnits)return bc(n,t.auprec);const e=Pc(n,t);return ur(n,e)}function bc(n,t){const i=((90-M.radToDeg(n))%360+360)%360,r=ra(i),s=Math.min(Math.abs(i-r.base),Math.abs(r.base+90-i)),o=M.degToRad(s),a=ea(o,t);return ur(o,a)}function vc(n,t){const e=Se(n);switch(t.lunits){case D.Scientific:return Ac(e,t.luprec);case D.Engineering:case D.Architectural:case D.Fractional:return Sc(e,t);case D.WindowsDesktop:case D.Decimal:default:return me(e,t.luprec)}}function Pc(n,t){const e=Se(n);switch(t.aunits){case at.DegreesMinutesSeconds:return ea(e,t.auprec);case at.Gradians:return me(e/cn,t.auprec)*cn;case at.Radians:return me(e,t.auprec);case at.DecimalDegrees:default:return M.degToRad(me(M.radToDeg(e),t.auprec))}}function me(n,t){if(!Number.isFinite(n))return 0;const e=10**t;return Math.round(Se(n)*e)/e}function Ac(n,t){if(!Number.isFinite(n))return 0;const e=Se(n);if(e===0)return 0;const i=e.toExponential(t);return Number(i)}function Sc(n,t){if(!Number.isFinite(n))return 0;const e=n<0?-1:1,i=Math.abs(n),r=Math.floor(i/12),s=i-r*12;if(t.lunits===D.Architectural||t.lunits===D.Fractional){const o=1<<Fe(t.luprec,0,8),a=Lc(s,o);return e*(r*12+a)}return e*(r*12+me(s,t.luprec))}function Lc(n,t){const e=Math.floor(n),i=n-e,r=Math.round(i*t);return r>=t?e+1:e+r/t}function ea(n,t){const e=M.radToDeg(n),i=e<0?-1:1,r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),h=me((o-a)*60,t),l=s+a/60+h/3600;return M.degToRad(i*l)}function ur(n,t){if(n===t)return!1;const e=Math.max(Math.abs(n),Math.abs(t),1);return Math.abs(n-t)>e*Number.EPSILON*8}function Le(n,t){if(!Number.isFinite(n))return"0";const e=Se(n);if(Number.isInteger(e)&&t===0)return String(e);const r=e.toFixed(t).replace(/\.?0+$/,"");return r===""||r==="-"?"0":r}function Mc(n,t){if(!Number.isFinite(n))return"0";const e=Se(n);if(e===0)return"0";const i=e.toExponential(t).match(/^(.+)e([+-])(\d+)$/i);if(!i)return"0";const[,r,s,o]=i,a=o.length<2?o.padStart(2,"0"):o;return`${r}E${s}${a}`.toUpperCase()}function Ec(n,t){if(!Number.isFinite(n))return"0";const e=cr(t),i=n<0?"-":"",r=Math.abs(n),s=Math.floor(r/12),o=r-s*12,a=Le(o,t.luprec);return s===0?`${i}${a}${e.inchSuffix}`:`${i}${s}'${e.feetInchSeparator}${a}${e.inchSuffix}`}function Ic(n,t){if(!Number.isFinite(n))return"0";const e=cr(t),i=n<0?"-":"",r=Math.abs(n),s=Math.floor(r/12),o=r-s*12,a=1<<Fe(t.luprec,0,8),h=ia(o,a,e.fractionSeparator);return s===0?`${i}${h}${e.inchSuffix}`:`${i}${s}'${e.feetInchSeparator}${h}${e.inchSuffix}`}function Tc(n,t){if(!Number.isFinite(n))return"0";const e=cr(t),i=n<0?"-":"",r=Math.abs(n),s=1<<Fe(t.luprec,0,8);return`${i}${ia(r,s,e.fractionSeparator)}`}function ia(n,t,e){const i=Math.floor(n),r=n-i;let s=Math.round(r*t);if(s>=t)return String(i+1);if(s===0)return String(i);const o=Rc(s,t);s/=o;const a=t/o,h=`${s}/${a}`;return i===0?h:`${i}${e}${h}`}function Cc(n,t){const e=M.radToDeg(n);return`${Le(e,t.auprec)}${t.showUnits?"°":""}`}function Oc(n,t){return`${Le(n,t.auprec)}${t.showUnits?" rad":""}`}function kc(n,t){const e=n/cn;return`${Le(e,t.auprec)}${t.showUnits?"g":""}`}function na(n,t){const e=M.radToDeg(n),i=e<0?"-":"",r=Math.abs(e),s=Math.floor(r),o=(r-s)*60,a=Math.floor(o),h=(o-a)*60,l=Le(h,t.auprec),c=t.showUnits?'"':"";return`${i}${s}d${a}'${l}${c}`}function Yc(n,t){const i=((90-M.radToDeg(n))%360+360)%360,r=ra(i),s=Math.min(Math.abs(i-r.base),Math.abs(r.base+90-i)),a=na(M.degToRad(s),t).replace(/^-/,"");return`${r.prefix} ${a} ${r.suffix}`.trim()}function ra(n){return n<90?{prefix:"N",suffix:"E",base:0}:n<180?{prefix:"S",suffix:"E",base:90}:n<270?{prefix:"S",suffix:"W",base:180}:{prefix:"N",suffix:"W",base:270}}function $i(n,t){if(!t.showUnits||t.lunits===D.Engineering||t.lunits===D.Architectural)return n;const e=Xc(t.insunits,t.measurement);return e?`${n}${e}`:n}function Xc(n,t){return n===j.Undefined?t===0?'"':" mm":No(n)?Nc(n):Bo(n)?Bc(n):""}function Nc(n){switch(n){case j.Millimeters:return" mm";case j.Centimeters:return" cm";case j.Meters:return" m";case j.Kilometers:return" km";case j.Decimeters:return" dm";case j.Microns:return" µm";case j.Nanometers:return" nm";default:return""}}function Bc(n){switch(n){case j.Inches:case j.Microinches:case j.Mils:case j.USSurveyInch:return'"';case j.Feet:case j.USSurveyFeet:return"'";case j.Miles:case j.USSurveyMile:return" mi";case j.Yards:case j.USSurveyYard:return" yd";default:return""}}function Rc(n,t){let e=Math.abs(n),i=Math.abs(t);for(;i!==0;){const r=i;i=e%i,e=r}return e||1}class Kt extends _t{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,i=>this.hasId(i)),this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((i,r)=>{i===e&&(this._recordsByName.delete(r),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:r}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new Ue(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const[e,i]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,i.objectId);return this}}const ki=192,Ve=193,Yi=194,Xi=195,sa=200;function oi(n){if(n.isByBlock)return Ve<<24>>0;if(n.isByLayer)return ki<<24>>0;const t=n.colorIndex;if(t!=null&&t>0&&t<256)return(Xi<<24|t&255)>>0;const e=n.RGB;return e!=null?(Yi<<24|e&16777215)>>0:Ve<<24>>0}function zc(n){const t=new k(exports.AcCmColorMethod.ByBlock);switch(n>>>24&255){case ki:t.setByLayer();break;case Ve:case sa:t.setByBlock();break;case Xi:t.colorIndex=n&255;break;case Yi:t.setRGBValue(n&16777215);break;default:n===256?t.setByLayer():n===0?t.setByBlock():n>0&&n<256&&(t.colorIndex=n);break}return t}class oa extends _t{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 k(exports.AcCmColorMethod.ByLayer),this._leaderLineWeight=-2,this._enableLanding=!0,this._landingGap=2,this._enableDogleg=!0,this._doglegLength=8,this._description="",this._arrowSize=4,this._defaultMTextContents="",this._textLeftAttachmentType=1,this._textAngleType=1,this._textAlignmentType=0,this._textRightAttachmentType=1,this._textColor=new k(exports.AcCmColorMethod.ByLayer),this._textHeight=4,this._enableFrameText=!1,this._textAlignAlwaysLeft=!1,this._alignSpace=0,this._blockColor=new k(exports.AcCmColorMethod.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(t){this._unknown1=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get drawMLeaderOrderType(){return this._drawMLeaderOrderType}set drawMLeaderOrderType(t){this._drawMLeaderOrderType=t}get drawLeaderOrderType(){return this._drawLeaderOrderType}set drawLeaderOrderType(t){this._drawLeaderOrderType=t}get bitFlags(){return this._bitFlags}set bitFlags(t){this._bitFlags=t}get maxLeaderSegmentsPoints(){return this._maxLeaderSegmentsPoints}set maxLeaderSegmentsPoints(t){this._maxLeaderSegmentsPoints=t}get maxLeaderSegmentPoints(){return this.maxLeaderSegmentsPoints}set maxLeaderSegmentPoints(t){this.maxLeaderSegmentsPoints=t}get firstSegmentAngleConstraint(){return this._firstSegmentAngleConstraint}set firstSegmentAngleConstraint(t){this._firstSegmentAngleConstraint=t}get secondSegmentAngleConstraint(){return this._secondSegmentAngleConstraint}set secondSegmentAngleConstraint(t){this._secondSegmentAngleConstraint=t}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor.copy(t)}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get enableLanding(){return this._enableLanding}set enableLanding(t){this._enableLanding=t}get landingEnabled(){return this.enableLanding}set landingEnabled(t){this.enableLanding=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get enableDogleg(){return this._enableDogleg}set enableDogleg(t){this._enableDogleg=t}get doglegEnabled(){return this.enableDogleg}set doglegEnabled(t){this.enableDogleg=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get description(){return this._description}set description(t){this._description=t}get arrowSymbolId(){return this._arrowSymbolId}set arrowSymbolId(t){this._arrowSymbolId=t}get arrowheadId(){return this.arrowSymbolId}set arrowheadId(t){this.arrowSymbolId=t}get arrowSize(){return this._arrowSize}set arrowSize(t){this._arrowSize=t}get arrowheadSize(){return this.arrowSize}set arrowheadSize(t){this.arrowSize=t}get defaultMTextContents(){return this._defaultMTextContents}set defaultMTextContents(t){this._defaultMTextContents=t}get defaultMText(){return this.defaultMTextContents}set defaultMText(t){this.defaultMTextContents=t}get textString(){return this.defaultMTextContents}set textString(t){this.defaultMTextContents=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textStyle(){return this.textStyleId}set textStyle(t){this.textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor.copy(t)}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get enableFrameText(){return this._enableFrameText}set enableFrameText(t){this._enableFrameText=t}get textFrameEnabled(){return this.enableFrameText}set textFrameEnabled(t){this.enableFrameText=t}get textAlignAlwaysLeft(){return this._textAlignAlwaysLeft}set textAlignAlwaysLeft(t){this._textAlignAlwaysLeft=t}get alignSpace(){return this._alignSpace}set alignSpace(t){this._alignSpace=t}get blockId(){return this._blockId}set blockId(t){this._blockId=t}get blockContentId(){return this.blockId}set blockContentId(t){this.blockId=t}get blockColor(){return this._blockColor}set blockColor(t){this._blockColor.copy(t)}get blockContentColor(){return this.blockColor}set blockContentColor(t){this.blockColor=t}get blockScale(){return this._blockScale.clone()}set blockScale(t){this._blockScale.copy(t)}get blockContentScale(){return this.blockScale}set blockContentScale(t){this.blockScale=t}get enableBlockScale(){return this._enableBlockScale}set enableBlockScale(t){this._enableBlockScale=t}get blockContentScaleEnabled(){return this.enableBlockScale}set blockContentScaleEnabled(t){this.enableBlockScale=t}get blockRotation(){return this._blockRotation}set blockRotation(t){this._blockRotation=t}get blockContentRotation(){return this.blockRotation}set blockContentRotation(t){this.blockRotation=t}get enableBlockRotation(){return this._enableBlockRotation}set enableBlockRotation(t){this._enableBlockRotation=t}get blockContentRotationEnabled(){return this.enableBlockRotation}set blockContentRotationEnabled(t){this.enableBlockRotation=t}get blockConnectionType(){return this._blockConnectionType}set blockConnectionType(t){this._blockConnectionType=t}get blockContentConnectionType(){return this.blockConnectionType}set blockContentConnectionType(t){this.blockConnectionType=t}get scale(){return this._scale}set scale(t){this._scale=t}get scaleFactor(){return this.scale}set scaleFactor(t){this.scale=t}get overwritePropChanged(){return this._overwritePropChanged}set overwritePropChanged(t){this._overwritePropChanged=t}get overwritePropertyValue(){return this.overwritePropChanged}set overwritePropertyValue(t){this.overwritePropChanged=t}get annotative(){return this._annotative}set annotative(t){this._annotative=t}get breakSize(){return this._breakSize}set breakSize(t){this._breakSize=t}get breakGapSize(){return this.breakSize}set breakGapSize(t){this.breakSize=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get bottomTextAttachmentType(){return this._bottomTextAttachmentType}set bottomTextAttachmentType(t){this._bottomTextAttachmentType=t}get bottomTextAttachmentDirection(){return this.bottomTextAttachmentType}set bottomTextAttachmentDirection(t){this.bottomTextAttachmentType=t}get topTextAttachmentType(){return this._topTextAttachmentType}set topTextAttachmentType(t){this._topTextAttachmentType=t}get topTextAttachmentDirection(){return this.topTextAttachmentType}set topTextAttachmentDirection(t){this.topTextAttachmentType=t}get extendLeaderToText(){return this._extendLeaderToText}set extendLeaderToText(t){this._extendLeaderToText=t}get unknown2(){return this._unknown2}set unknown2(t){this._unknown2=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeaderStyle"),t.writeInt16(179,this.unknown1),t.writeInt16(170,this.contentType),t.writeInt16(171,this.drawMLeaderOrderType),t.writeInt16(172,this.drawLeaderOrderType),t.writeInt32(90,this.maxLeaderSegmentsPoints),t.writeDouble(40,this.firstSegmentAngleConstraint),t.writeDouble(41,this.secondSegmentAngleConstraint),t.writeInt16(173,this.leaderLineType),t.writeInt32(91,oi(this.leaderLineColor)),t.writeHandle(340,this.leaderLineTypeId),t.writeInt32(92,this.leaderLineWeight),t.writeBoolean(290,this.enableLanding),t.writeDouble(42,this.landingGap),t.writeBoolean(291,this.enableDogleg),t.writeDouble(43,this.doglegLength),t.writeString(3,this.description),t.writeHandle(341,this.arrowSymbolId),t.writeDouble(44,this.arrowSize),t.writeString(300,this.defaultMTextContents),t.writeHandle(342,this.textStyleId),t.writeInt16(174,this.textLeftAttachmentType),t.writeInt16(175,this.textAngleType),t.writeInt16(176,this.textAlignmentType),t.writeInt16(178,this.textRightAttachmentType),t.writeInt32(93,oi(this.textColor)),t.writeDouble(45,this.textHeight),t.writeBoolean(292,this.enableFrameText),t.writeBoolean(297,this.textAlignAlwaysLeft),t.writeDouble(46,this.alignSpace),t.writeHandle(343,this.blockId),t.writeInt32(94,oi(this.blockColor)),t.writeDouble(47,this._blockScale.x),t.writeDouble(49,this._blockScale.y),t.writeDouble(140,this._blockScale.z),t.writeBoolean(293,this.enableBlockScale),t.writeDouble(141,this.blockRotation),t.writeBoolean(294,this.enableBlockRotation),t.writeInt16(177,this.blockConnectionType),t.writeDouble(142,this.scale),t.writeBoolean(295,this.overwritePropChanged),t.writeBoolean(296,this.annotative),t.writeDouble(143,this.breakSize),t.writeInt16(271,this.textAttachmentDirection),t.writeInt16(272,this.bottomTextAttachmentType),t.writeInt16(273,this.topTextAttachmentType),t.writeBoolean(298,this.unknown2),this}}class aa extends _t{constructor(){super(),this._styleName="STANDARD",this._flags=0,this._description="",this._fillColor=new k,this._startAngle=90,this._endAngle=90,this._elements=[]}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get flags(){return this._flags}set flags(t){this._flags=t}get description(){return this._description}set description(t){this._description=t}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor.copy(t)}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=t}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=t}get elementCount(){return this._elements.length}get elements(){return this._elements.map(t=>({offset:t.offset,color:t.color.clone(),lineType:t.lineType}))}set elements(t){this._elements=t.map(e=>({offset:e.offset,color:e.color.clone(),lineType:e.lineType}))}addElement(t){this._elements.push({offset:t.offset,color:t.color.clone(),lineType:t.lineType})}removeElementAt(t){if(t<0||t>=this._elements.length)throw new Error("The element index is out of range!");this._elements.splice(t,1)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMlineStyle"),t.writeString(2,this.styleName),t.writeInt16(70,this.flags),t.writeString(3,this.description),t.writeCmColor(this.fillColor),t.writeDouble(51,this.startAngle),t.writeDouble(52,this.endAngle),t.writeInt16(71,this.elementCount),this._elements.forEach(e=>{t.writeDouble(49,e.offset),t.writeCmColor(e.color),t.writeString(6,e.lineType)}),this}}class Yt extends _t{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,i=>this.hasId(i));const e=this.normalizeName(t.name);e&&this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),i=this._recordsByName.get(e);return i?(this._recordsById.delete(i.objectId),this._recordsByName.delete(e),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(this.normalizeName(e.name)),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(t=!1){return new Ue(t?this._recordsById:this._recordsByName)}normalizeName(t){return t}get dxfEntryCount(){return this.numEntries}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.dxfEntryCount),this}}class la extends Yt{constructor(t){super(t)}get modelSpace(){let t=this.getAt(et.MODEL_SPACE_NAME);return t||(t=new et,t.name=et.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const i=e.getIdAt(t);if(i)return i}}removeEntity(t){let e=!1;for(const i of this.database.tables.blockTable.newIterator())if(i.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(et.isModelSapceName(t))e=et.MODEL_SPACE_NAME;else if(et.isPaperSapceName(t)){const i=et.PAPER_SPACE_NAME_PREFIX,r=t.substring(i.length);e=i+r}return e}}class ha extends Yt{constructor(t){super(t)}}class ca extends Yt{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class ua extends Yt{constructor(t){super(t)}}class da extends Yt{constructor(t){super(t)}get dxfEntryCount(){return this._recordsById.size}resolveAt(t){this.database.ensureTextStyleDefaults();const e=[],i=r=>{const s=r==null?void 0:r.trim();s&&!e.includes(s)&&e.push(s)};i(t),i(this.database.textstyle),i(W),i("STANDARD");for(const r of e){const s=this.getAt(r);if(s)return s;const o=r.toUpperCase();for(const a of this.newIterator())if(a.name.toUpperCase()===o)return a}return this.newIterator().next().value??void 0}get shapeFiles(){return this.newIterator(!0).toArray().filter(t=>t.isShapeFile)}get fonts(){const t=new Set;for(const e of this.newIterator()){const i=vt.normalizeFontFileName(e.fileName);i&&t.add(i);const r=vt.normalizeFontFileName(e.bigFontFileName);r&&t.add(r)}return Array.from(t)}}class ga extends Yt{constructor(t){super(t)}}const Fc=()=>({center:new P,viewDirectionFromTarget:new m(0,0,1),viewTarget:new m(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:exports.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new m(0,0,0),ucsXAxis:new m(1,0,0),ucsYAxis:new m(0,1,0),orthographicType:exports.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:exports.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0,aspectRatio:void 0});class dr extends Ut{constructor(){super(),this._gsView=Fc(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(t){this._gsView.viewDirectionFromTarget.copy(t)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(t){this._gsView.viewTarget.copy(t)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(t){this._gsView.viewHeight=t}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(t){this._gsView.viewTwistAngle=t}get lensLength(){return this._gsView.lensLength}set lensLength(t){this._gsView.lensLength=t}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(t){this._gsView.frontClippingPlane=t}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(t){this._gsView.backClippingPlane=t}get renderMode(){return this._gsView.renderMode}set renderMode(t){this._gsView.renderMode=t}get viewMode(){return this._gsView.viewMode}set viewMode(t){this._gsView.viewMode=t}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(t){this._gsView.ucsIconSetting=t}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(t){this._gsView.ucsOrigin.copy(t)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(t){this._gsView.ucsXAxis.copy(t)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(t){this._gsView.ucsYAxis.copy(t)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(t){this._gsView.orthographicType=t}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(t){this._gsView.shadePlotSetting=t}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(t){this._gsView.shadePlotObjectId=t}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(t){this._gsView.visualStyleObjectId=t}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(t){this._gsView.isDefaultLightingOn=t}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(t){this._gsView.defaultLightingType=t}get brightness(){return this._gsView.brightness}set brightness(t){this._gsView.brightness=t}get contrast(){return this._gsView.contrast}set contrast(t){this._gsView.contrast=t}get ambientColor(){return this._gsView.ambientColor}set ambientColor(t){this._gsView.ambientColor=t}get aspectRatio(){return this._gsView.aspectRatio}set aspectRatio(t){this._gsView.aspectRatio=t}}const ps=2,Vc=.45,jc=1e5;function Gc(n){var i;const t=n,e=t.aspectRatio??((i=t.gsView)==null?void 0:i.aspectRatio);return Number.isFinite(e)?e:void 0}function Dc(n,t){if(Number.isFinite(t)&&t>0)return t;const e=Gc(n);return e!=null&&e>0?e:1}function Hc(n,t){const e=Math.max(n.min.x,t.min.x),i=Math.max(n.min.y,t.min.y),r=Math.min(n.max.x,t.max.x),s=Math.min(n.max.y,t.max.y);return e>=r||i>=s?0:(r-e)*(s-i)}function fs(n){return{x:(n.min.x+n.max.x)/2,y:(n.min.y+n.max.y)/2}}function Uc(n){if(!n||n.isEmpty())return!1;const t=n.max.x-n.min.x,e=n.max.y-n.min.y;return t>0&&e>0}class ee extends dr{static isActiveVportName(t){return t.toLowerCase()===we.toLowerCase()}constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new P(0,0),this._upperRightCorner=new P(1,1),this._snapBase=new P(0,0),this._snapAngle=0,this._snapSpacing=new P(0,0),this._standardFlag=0,this._gridSpacing=new P,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}modelViewBox(t){const e=this.centerPoint,i=this.viewHeight;if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(i)||i<=0)return;const r=Dc(this,t),s=i*r,o=i/2,a=s/2;return new Q().expandByPoint({x:e.x-a,y:e.y-o}).expandByPoint({x:e.x+a,y:e.y+o})}static isModelViewBoxUsable(t,e){if(t.isEmpty()||e.isEmpty())return!1;const i=t.max.x-t.min.x,r=t.max.y-t.min.y,s=e.max.x-e.min.x,o=e.max.y-e.min.y;if(i<=0||r<=0||s<=0||o<=0||i>s*ps||r>o*ps)return!1;const a=Math.max(s,o)*Vc,h=fs(t),l=fs(e);if(Math.hypot(h.x-l.x,h.y-l.y)>a)return!1;const u=i*r,g=Hc(t,e);return!(g<=0||g/u<.25)}resolveModelViewBox(t,e){const i=this.modelViewBox(t);if(!(!i||!ee.isModelViewBoxStructurallyValid(i))){if(Uc(e)){if(!ee.isModelViewBoxUsable(i,e))return}else if(!ee.isModelViewBoxPlausibleWithoutExtents(i))return;return i}}static isModelViewBoxStructurallyValid(t){if(t.isEmpty())return!1;const e=t.max.x-t.min.x,i=t.max.y-t.min.y;return Number.isFinite(e)&&Number.isFinite(i)&&e>0&&i>0}static isModelViewBoxPlausibleWithoutExtents(t){const e=t.max.x-t.min.x,i=t.max.y-t.min.y;return Math.max(e,i)<=jc}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),t.writeDouble(40,this.gsView.viewHeight),this.gsView.aspectRatio!=null&&Number.isFinite(this.gsView.aspectRatio)&&t.writeDouble(41,this.gsView.aspectRatio),t.writeDouble(45,this.gsView.viewHeight),t.writePoint2d(10,this.lowerLeftCorner),t.writePoint2d(11,this.upperRightCorner),t.writePoint2d(12,this.center),t.writePoint2d(13,this.snapBase),t.writePoint2d(14,this.snapIncrements),t.writePoint2d(15,this.gridIncrements),t.writeInt16(70,this.standardFlag),t.writeInt16(71,this.circleSides),t.writeDouble(42,this.gsView.lensLength),t.writePoint3d(16,this.gsView.viewDirectionFromTarget),t.writePoint3d(17,this.gsView.viewTarget),t.writeAngle(50,this.snapAngle),t.writeAngle(51,this.gsView.viewTwistAngle),t.writeInt16(61,this.gridMajor),t.writeInt16(281,this.backgroundObjectId?1:0),t.writeObjectId(332,this.backgroundObjectId),this}}class pa extends Yt{constructor(t){super(t)}normalizeName(t){return ee.isActiveVportName(t)?we:t.toUpperCase()}getActiveVport(){return this.getAt(we)}getActiveVportBox(t,e){const i=this.getActiveVport();return i==null?void 0:i.resolveModelViewBox(t,e)}}class fa extends Yt{constructor(t){super(t)}}class un extends Ut{constructor(t){super(),this.name=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}class ya extends Kt{getBtrIdAt(t){for(const[e,i]of this._recordsByName)if(i.blockTableRecordId==t)return i}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}const Ye=class Ye extends _t{constructor(){super({objectId:"0"}),this._drawNoPlotLayers=!0,this.events={dictObjetSet:new U,dictObjectErased:new U,entityAppended:new U,entityModified:new U,entityErased:new U,layerAppended:new U,layerModified:new U,layerErased:new U,openProgress:new U},Ye._unsavedDrawingSequence+=1,this._dwgname=`Drawing${Ye._unsavedDrawingSequence}.dwg`,this._version=new yt("AC1014"),this._angbase=0,this._angdir=0,this._aunits=at.DecimalDegrees,this._auprec=0,this._lunits=D.Decimal,this._luprec=4,this._celtscale=1,this._cecolor=new k,this._celtype=Z,this._celweight=exports.AcGiLineWeight.ByLayer,this._cetransparency=new $,this._clayer="0",this._cmlstyle=Vt,this._cmlscale=1,this._cmleaderstyle=jt,this._hpbackgroundcolor=new k(exports.AcCmColorMethod.None),this._hpcolor=this._cecolor.clone(),this._hplayer=".",this._hptransparency=new $,this._textstyle=W,this._extents=new C,this._insunits=j.Millimeters,this._unitmode=0,this._measurement=1,this._ltscale=1,this._lwdisplay=!1,this._pdmode=0,this._pdsize=0,this._osmode=0,this._orthomode=0,this._maxHandle=0,this._tables={appIdTable:new fa(this),blockTable:new la(this),dimStyleTable:new ha(this),linetypeTable:new ua(this),textStyleTable:new da(this),viewTable:new ga(this),layerTable:new ca(this),viewportTable:new pa(this)},this._objects={dictionary:new Kt(this),imageDefinition:new Kt(this),layout:new ya(this),mleaderStyle:new Kt(this),mlineStyle:new Kt(this),xrecord:new Kt(this)}}get tables(){return this._tables}get objects(){return this._objects}get formatter(){return this._formatter??(this._formatter=new Jo(this))}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const i=t.getAttrWithoutException("objectId");!i||t.isTemp||e&&e(i)?t.objectId=this.generateHandle():this.updateMaxHandle(i)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar(b.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get auprec(){return this._auprec}set auprec(t){this.updateSysVar(b.AUPREC,this._auprec,t??0,e=>{this._auprec=e})}get lunits(){return this._lunits}set lunits(t){this.updateSysVar(b.LUNITS,this._lunits,t??D.Decimal,e=>{this._lunits=e})}get luprec(){return this._luprec}set luprec(t){this.updateSysVar(b.LUPREC,this._luprec,t??4,e=>{this._luprec=e})}get version(){return this._version}set version(t){this.updateSysVar(b.ACADVER,this._version,new yt(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(b.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get unitmode(){return this._unitmode}set unitmode(t){this.updateSysVar(b.UNITMODE,this._unitmode,t??0,e=>{this._unitmode=e})}get measurement(){return this._measurement}set measurement(t){this.updateSysVar(b.MEASUREMENT,this._measurement,t??1,e=>{this._measurement=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(b.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}get drawNoPlotLayers(){return this._drawNoPlotLayers}get dwgname(){return this._dwgname}setDwgName(t){const e=t.trim();e&&this.updateSysVar(b.DWGNAME,this._dwgname,e,i=>{this._dwgname=i})}isLayerDrawable(t){if(this._drawNoPlotLayers)return!0;const e=this.tables.layerTable.getAt(t);return e==null||e.isPlottable}set lwdisplay(t){this.updateSysVar(b.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(b.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(b.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celtype(){return this._celtype}set celtype(t){const e=this.normalizeLinetypeName(t??Z);this.updateSysVar(b.CELTYPE,this._celtype,e,i=>{this._celtype=i})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(b.CELWEIGHT,this._celweight,t??exports.AcGiLineWeight.ByLayer,e=>{this._celweight=e})}get cetransparency(){return this._cetransparency}set cetransparency(t){this.updateSysVar(b.CETRANSPARENCY,this._cetransparency,t??new $,e=>{this._cetransparency=e.clone()})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(b.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get cmlstyle(){return this._cmlstyle}set cmlstyle(t){this.updateSysVar(b.CMLSTYLE,this._cmlstyle,t??Vt,e=>{this._cmlstyle=e})}get cmlscale(){return this._cmlscale}set cmlscale(t){this.updateSysVar(b.CMLSCALE,this._cmlscale,t??1,e=>{this._cmlscale=e})}get cmleaderstyle(){return this._cmleaderstyle}set cmleaderstyle(t){this.updateSysVar(b.CMLEADERSTYLE,this._cmleaderstyle,t??jt,e=>{this._cmleaderstyle=e})}get hpbackgroundcolor(){return this._hpbackgroundcolor}set hpbackgroundcolor(t){this.updateSysVar(b.HPBACKGROUNDCOLOR,this._hpbackgroundcolor,t??new k(exports.AcCmColorMethod.None),e=>{this._hpbackgroundcolor=e.clone()})}get hpcolor(){return this._hpcolor}set hpcolor(t){this.updateSysVar(b.HPCOLOR,this._hpcolor,t??this._cecolor,e=>{this._hpcolor=e.clone()})}get hplayer(){return this._hplayer}set hplayer(t){this.updateSysVar(b.HPLAYER,this._hplayer,t??".",e=>{this._hplayer=e})}get hptransparency(){return this._hptransparency}set hptransparency(t){this.updateSysVar(b.HPTRANSPARENCY,this._hptransparency,t??new $,e=>{this._hptransparency=e.clone()})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(b.TEXTSTYLE,this._textstyle,t??W,e=>{this._textstyle=e})}get angbase(){return this._angbase}set angbase(t){this.updateSysVar(b.ANGBASE,this._angbase,t??0,e=>{this._angbase=e})}get angdir(){return this._angdir}set angdir(t){this.updateSysVar(b.ANGDIR,this._angdir,t??0,e=>{this._angdir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent(b.EXTMAX,e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent(b.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(b.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(b.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(b.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}get orthomode(){return this._orthomode}set orthomode(t){this.updateSysVar(b.ORTHOMODE,this._orthomode,t??0,e=>{this._orthomode=e})}async read(t,e,i=Ce.DXF){const r=wt.instance.get(i);if(r==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),this._drawNoPlotLayers=(e==null?void 0:e.drawNoPlotLayers)??!0,e!=null&&e.fileName&&this.setDwgName(e.fileName),await r.read(t,this,e&&e.minimumChunkSize||10,async(s,o,a,h)=>{if(this.events.openProgress.dispatch({database:this,percentage:s,stage:"CONVERSION",subStage:o,subStageStatus:a,data:h}),e&&e.fontLoader&&o=="FONT"&&a=="END"){const l=h||this.tables.textStyleTable.fonts;await e.fontLoader.load(l)}},e==null?void 0:e.timeout,e==null?void 0:e.sysVars),this.ensureDatabaseDefaults()}async openUri(t,e){var d;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const i=await fetch(t);if(!i.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${i.status}'!`);const r=i.headers.get("content-length"),s=r?parseInt(r,10):null;let o=0;const a=(d=i.body)==null?void 0:d.getReader();if(!a)throw new Error("Failed to get response reader");const h=[];for(;;){const{done:p,value:f}=await a.read();if(p)break;if(h.push(f),o+=f.length,s!==null){const y=Math.round(o/s*100);this.events.openProgress.dispatch({database:this,percentage:y,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const l=new Uint8Array(o);let c=0;for(const p of h)l.set(p,c),c+=p.length;const u=this.getFileNameFromUri(t);u&&this.setDwgName(u);const g=u.toLowerCase().split(".").pop();g==="dwg"?await this.read(l.buffer,e,Ce.DWG):g==="dxf"?await this.read(l.buffer,e,Ce.DXF):await this.read(l.buffer,e,g),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,i=this.version.name,r=!1){this.ensureDatabaseDefaults();const s=i instanceof yt?i:new yt(i),o=new Os({database:this,precision:e,version:s});return this.writeDxfHeaderSection(o),this.writeDxfTablesSection(o,s),this.writeDxfBlocksSection(o),this.writeDxfEntitiesSection(o),this.writeDxfObjectsSection(o),o.writeStart("EOF"),o.toString()}async regen(){await new Fo(this).read(null,this,500,async(e,i,r,s)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:i,subStageStatus:r,data:s})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Qo(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureEntityStyleDefaults(t){var e;if(t.dxfTypeName==="MLINE"){this.ensureMLineStyle(this._cmlstyle||Vt);return}if(t.dxfTypeName==="MULTILEADER"){this.ensureMLeaderStyle(this._cmleaderstyle||jt);return}if(t.dxfTypeName==="HATCH"){const i=t;(e=i.applyPatternDefaultsFromSysVars)==null||e.call(i,this)}}ensureTextStyleDefaults(){this.hasDefaultTextStyle()||this.tables.textStyleTable.add(new ar({name:W,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}hasDefaultTextStyle(){const t=[W,"STANDARD"];for(const e of t)if(this.tables.textStyleTable.has(e))return!0;for(const e of this.tables.textStyleTable.newIterator())if(e.name.toUpperCase()===W.toUpperCase())return!0;return!1}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new k;e.colorIndex=7,this.tables.layerTable.add(new or({name:"0",standardFlags:0,linetype:Dt,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(St)||this.tables.linetypeTable.add(new te({name:St,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Z)||this.tables.linetypeTable.add(new te({name:Z,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Dt)||this.tables.linetypeTable.add(new te({name:Dt,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.ensureTextStyleDefaults(),this.tables.dimStyleTable.has(W)||this.tables.dimStyleTable.add(new be({name:W,dimtxsty:W})),!this.tables.viewportTable.has(we)){const e=new ee;e.name=we,this.tables.viewportTable.add(e)}this.ensureMLineStyle(this._cmlstyle||Vt),this.ensureMLeaderStyle(this._cmleaderstyle||jt);const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new Ti;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=t.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(e.layoutName,e),t.layoutId=e.objectId}this.tables.appIdTable.has(hn)||this.tables.appIdTable.add(new un(hn)),this.tables.appIdTable.has(ln)||this.tables.appIdTable.add(new un(ln))}ensureMLineStyle(t){const e=this.objects.mlineStyle,i=t.trim();if(!i||e.getAt(i))return;for(const[s,o]of e.entries())if(s.toUpperCase()===i.toUpperCase()||o.styleName.toUpperCase()===i.toUpperCase())return;const r=new aa;r.styleName=i,r.elements=[{offset:.5,color:new k().setByLayer(),lineType:Z},{offset:-.5,color:new k().setByLayer(),lineType:Z}],e.setAt(i,r)}ensureMLeaderStyle(t){const e=this.objects.mleaderStyle,i=t.trim();if(!i||e.getAt(i))return;for(const[a]of e.entries())if(a.toUpperCase()===i.toUpperCase())return;const r=new oa;r.unknown1=2,r.maxLeaderSegmentsPoints=2,r.leaderLineColor=new k().setByBlock(),r.textColor=new k().setByBlock(),r.blockColor=new k().setByBlock(),r.alignSpace=4,r.breakSize=3.75,r.enableBlockRotation=!0,r.unknown2=!1;const s=this.tables.linetypeTable.getAt(St);r.leaderLineTypeId=s==null?void 0:s.objectId;const o=this.tables.textStyleTable.getAt(W);r.textStyleId=o==null?void 0:o.objectId,e.setAt(i,r)}writeDxfHeaderSection(t){var e;t.startSection("HEADER"),t.writeString(9,"$ACADVER"),t.writeString(1,((e=t.version)==null?void 0:e.name)??this.version.name),t.writeString(9,"$HANDSEED"),t.writeString(5,t.nextHandle.toString(16).toUpperCase()),t.version!=null&&t.version.value>=27&&(t.writeString(9,"$DWGCODEPAGE"),t.writeString(3,"UTF-8")),t.writeString(9,"$INSUNITS"),t.writeInt16(70,this.insunits),t.writeString(9,"$LUNITS"),t.writeInt16(70,this.lunits),t.writeString(9,"$LUPREC"),t.writeInt16(70,this.luprec),t.writeString(9,"$UNITMODE"),t.writeInt16(70,this.unitmode),t.writeString(9,"$MEASUREMENT"),t.writeInt16(70,this.measurement),t.writeString(9,"$LTSCALE"),t.writeDouble(40,this.ltscale),t.writeString(9,"$LWDISPLAY"),t.writeInt16(70,this.lwdisplay?1:0),t.writeString(9,"$CLAYER"),t.writeString(8,this.clayer),t.writeString(9,"$CELTYPE"),t.writeString(6,this.celtype),this.cetransparency.isInvalid||(t.writeString(9,"$CETRANSPARENCY"),t.writeTransparency(this.cetransparency)),t.writeString(9,"$CMLSTYLE"),t.writeString(2,this.cmlstyle),t.writeString(9,"$CMLSCALE"),t.writeDouble(40,this.cmlscale),t.writeString(9,"$CMLEADERSTYLE"),t.writeString(2,this.cmleaderstyle),this.hpcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPCOLOR"),t.writeCmColor(this.hpcolor,2)),this.hpbackgroundcolor.colorMethod!==exports.AcCmColorMethod.None&&(t.writeString(9,"$HPBACKGROUNDCOLOR"),t.writeCmColor(this.hpbackgroundcolor,2)),t.writeString(9,"$HPLAYER"),t.writeString(8,this.hplayer),this.hptransparency.isInvalid||(t.writeString(9,"$HPTRANSPARENCY"),t.writeTransparency(this.hptransparency)),t.writeString(9,"$TEXTSTYLE"),t.writeString(7,this.textstyle),t.writeString(9,"$ANGBASE"),t.writeAngle(50,this.angbase),t.writeString(9,"$ANGDIR"),t.writeInt16(70,this.angdir),t.writeString(9,"$AUNITS"),t.writeInt16(70,this.aunits),t.writeString(9,"$AUPREC"),t.writeInt16(70,this.auprec),t.writeString(9,"$EXTMIN"),t.writePoint3d(10,this.extmin),t.writeString(9,"$EXTMAX"),t.writePoint3d(10,this.extmax),t.writeString(9,"$PDMODE"),t.writeInt32(70,this.pdmode),t.writeString(9,"$PDSIZE"),t.writeDouble(40,this.pdsize),t.writeString(9,"$OSMODE"),t.writeInt32(70,this.osmode),t.writeString(9,"$ORTHOMODE"),t.writeInt16(70,this.orthomode),t.endSection()}writeDxfTablesSection(t,e){t.startSection("TABLES"),this.writeDxfTable(t,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(t,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(t,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(t,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(t,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(!0),"STYLE"),this.writeDxfTable(t,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(t,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),e.value>=19&&this.writeDxfTable(t,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),t.endSection()}writeDxfBlocksSection(t){t.startSection("BLOCKS");for(const e of this.tables.blockTable.newIterator()){if(e.dxfOutBlockBegin(t),!e.isModelSapce&&!e.isPaperSapce)for(const i of e.newIterator())this.writeDxfEntity(t,i);e.dxfOutBlockEnd(t)}t.endSection()}writeDxfEntitiesSection(t){t.startSection("ENTITIES");for(const e of this.tables.blockTable.newIterator())if(!(!e.isModelSapce&&!e.isPaperSapce))for(const i of e.newIterator())this.writeDxfEntity(t,i);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const i=o=>{t.writeStart("DICTIONARY"),o.dxfOut(t)},r=(o,a)=>{e.getAt(o)!==a&&e.setAt(o,a)},s=o=>{e.getAt(o)&&e.remove(o)};r("ACAD_LAYOUT",this.objects.layout),this.objects.mleaderStyle.numEntries>0?r("ACAD_MLEADERSTYLE",this.objects.mleaderStyle):s("ACAD_MLEADERSTYLE"),this.objects.mlineStyle.numEntries>0?r("ACAD_MLINESTYLE",this.objects.mlineStyle):s("ACAD_MLINESTYLE"),this.objects.imageDefinition.numEntries>0?r("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):s("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?r("MLIGHT_XRECORD",this.objects.xrecord):s("MLIGHT_XRECORD"),i(e),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[o,a]of this.objects.layout.entries())t.writeStart("LAYOUT"),a.dxfOut(t);for(const[o,a]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),a.dxfOut(t);for(const[o,a]of this.objects.mleaderStyle.entries())t.writeStart("MLEADERSTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.mlineStyle.entries())t.writeStart("MLINESTYLE"),a.dxfOut(t);for(const[o,a]of this.objects.xrecord.entries())t.writeStart("XRECORD"),a.dxfOut(t);t.endSection()}writeDxfTable(t,e,i,r,s){const o=[...r];t.startTable(e),i.dxfOut(t);for(const a of o){if(s==="BLOCK_RECORD"&&a instanceof et){a.dxfOutBlockRecord(t);continue}t.writeStart(s),a.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._objects.imageDefinition.removeAll(),this._objects.mleaderStyle.removeAll(),this._objects.mlineStyle.removeAll(),this._objects.xrecord.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,i,r){this.hasSysVarValueChanged(e,i)&&(r(i),this.triggerSysVarChangedEvent(t,e,i))}hasSysVarValueChanged(t,e){return t instanceof k&&e instanceof k||t instanceof $&&e instanceof $?!t.equals(e):t instanceof yt&&e instanceof yt?t.value!==e.value:!Object.is(t,e)}normalizeLinetypeName(t){const e=t.trim();return e.toUpperCase()==="BYLAYER"?Z:e.toUpperCase()==="BYBLOCK"?St:e}triggerSysVarChangedEvent(t,e,i){const r=mt.instance(),s=t.toLowerCase();r.getDescriptor(s)!=null&&r.events.sysVarChanged.dispatch({database:this,name:s,oldVal:e,newVal:i})}getFileNameFromUri(t){try{const i=new URL(t).pathname.split("/");return i[i.length-1]||""}catch{return""}}};Ye._unsavedDrawingSequence=0;let dn=Ye;class Wc extends dr{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(t){this._standardFlags=t}get viewWidth(){return this._viewWidth}set viewWidth(t){this._viewWidth=t}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(t){this._ucsAssociated=t}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(t){this._cameraPlottable=t}get ucsElevation(){return this._ucsElevation}set ucsElevation(t){this._ucsElevation=t}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(t){this._ucsObjectId=t}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(t){this._ucsBaseObjectId=t}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(t){this._liveSectionObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeDouble(40,this.gsView.viewHeight),t.writePoint2d(10,this.centerPoint),t.writeDouble(41,this.viewWidth),t.writePoint3d(11,this.gsView.viewDirectionFromTarget),t.writePoint3d(12,this.gsView.viewTarget),t.writeDouble(42,this.gsView.lensLength),t.writeDouble(43,this.gsView.frontClippingPlane),t.writeDouble(44,this.gsView.backClippingPlane),t.writeAngle(50,this.gsView.viewTwistAngle),t.writeInt16(71,this.gsView.viewMode),t.writeInt16(281,this.gsView.renderMode),t.writeInt16(72,this.ucsAssociated?1:0),t.writeInt16(73,this.cameraPlottable?1:0),t.writeObjectId(332,this.backgroundObjectId),t.writeObjectId(334,this.liveSectionObjectId),t.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(t.writePoint3d(110,this.gsView.ucsOrigin),t.writePoint3d(111,this.gsView.ucsXAxis),t.writePoint3d(112,this.gsView.ucsYAxis),t.writeInt16(79,this.gsView.orthographicType),t.writeDouble(146,this.ucsElevation),t.writeObjectId(345,this.ucsObjectId),t.writeObjectId(346,this.ucsBaseObjectId)),this}}const yr=class yr extends q{getOffsetSideAtPoint(t){return 1}};yr.typeName="Curve";let J=yr;const de=class de extends J{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new V}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}addVertexAt(t,e,i=0,r=-1,s=-1){const o=r<0?void 0:r,a=s<0?void 0:s,h={x:e.x,y:e.y,bulge:i,startWidth:o,endWidth:a};this._geo.addVertexAt(t,h)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new m(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new C({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}subMoveGripPointsAt(t,e){return K(t,i=>{lr(this._geo.vertices,i,e)}),this}subGetOsnapPoints(t,e,i,r){var h;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case w.EndPoint:for(let l=0;l<a;l++){const c=s.getPointAt(l);r.push(new m(c.x,c.y,o))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const l=this.closed?a:a-1,c=[];for(let u=0;u<l;u++){const g=[];ui(s.getPointAt(u),s.getPointAt((u+1)%a),(h=s.vertices[u])==null?void 0:h.bulge,o,t,e,g),c.push(...g)}if(t===w.MidPoint)r.push(...c);else{const u=gt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(r=>{const s=new m(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,i=s.z,e&&r.bulge!=null&&(r.bulge=-r.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:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.getPoints(100),i=this.createWidthProfile();if(i!=null){const s=$c(i,this.closed);if(s!=null){const o=t.subEntityTraits;return o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}}const r=[];return e.forEach(s=>r.push(new m().set(s.x,s.y,this.elevation))),t.lines(r)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0),t.writeDouble(38,this.elevation);for(let e=0;e<this.numberOfVertices;++e)t.writePoint2d(10,this.getPoint2dAt(e));return this}createWidthProfile(){const t=this._geo.vertices,e=t.length;if(e<2)return null;const i=this.closed?e:e-1,r=[];let s=!1;for(let o=0;o<i;o++){const a=t[o],h=t[(o+1)%e],l=Math.max(0,a.startWidth??0),c=Math.max(0,a.endWidth??0);(l>ct||c>ct)&&(s=!0);const u=this.sampleSegment(a,h),g=u.length-1;for(let d=0;d<=g;d++){if(d===0&&r.length>0||this.closed&&o===i-1&&d===g)continue;const p=g>0?d/g:0;r.push({x:u[d].x,y:u[d].y,width:Qc(l,c,p)})}}return s&&r.length>=2?r:null}sampleSegment(t,e){if(t.bulge&&Math.abs(t.bulge)>ct){const r=new ot(t,e,t.bulge).getPoints(32);if(r.length>1)return r.map(s=>new P(s.x,s.y))}return[new P(t.x,t.y),new P(e.x,e.y)]}static from2dPoints(t,e){const i=new de;return t.forEach((r,s)=>i.addVertexAt(s,r)),i.closed=e,i}static fromGePolyline(t){const e=new de;return t.vertices.forEach((i,r)=>{e.addVertexAt(r,new P(i.x,i.y),i.bulge??0)}),e.closed=t.closed,e}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.numberOfVertices;let i=1/0,r=1;const s=this.closed?e:e-1;for(let o=0;o<s;o++){const a=this.getPoint2dAt(o),h=this.getPoint2dAt((o+1)%e),l=h.x-a.x,c=h.y-a.y,u=l*l+c*c;if(u===0)continue;const g=Math.max(0,Math.min(1,((t.x-a.x)*l+(t.y-a.y)*c)/u)),d=(t.x-a.x-g*l)**2+(t.y-a.y-g*c)**2;d<i&&(i=d,r=l*(t.y-a.y)-c*(t.x-a.x)>=0?1:-1)}return r}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:de.fromGePolyline(e[0])}};de.typeName="Polyline";let ut=de;function Ni(n,t,e){const i=yh(n,t,e);return i?ut.fromGePolyline(i):null}const ct=1e-6,ys=4;function $c(n,t){if(n.length<2)return null;const e=Kc(n,t);if(e.length<2)return null;const{left:i,right:r}=qc(e,t);if(i.length<2||r.length<2)return null;const s=new Tt;if(t){if(!qi(i)||!qi(r))return null;const a=Math.abs(gn(i)),h=Math.abs(gn(r)),[l,c]=a>=h?[i,r]:[r,i];return s.add(new V(l,!0)),s.add(new V(c,!0)),s}const o=[...i,...r.reverse()];return qi(o)?(s.add(new V(o,!0)),s):null}function qc(n,t){const e=[],i=[];for(let r=0;r<n.length;r++){const s=n[r],o=Math.max(0,s.width)/2;if(o<=ct)continue;const a=Zc(n,r,t);a!=null&&(e.push({x:s.x+a.x*o,y:s.y+a.y*o}),i.push({x:s.x-a.x*o,y:s.y-a.y*o}))}return{left:e,right:i}}function Kc(n,t){const e=[];if(n.forEach(i=>{const r=e[e.length-1];(!r||Math.abs(r.x-i.x)>ct||Math.abs(r.y-i.y)>ct||Math.abs(r.width-i.width)>ct)&&e.push(i)}),t&&e.length>1){const i=e[0],r=e[e.length-1];Math.abs(i.x-r.x)<=ct&&Math.abs(i.y-r.y)<=ct&&e.pop()}return e}function Zc(n,t,e){const i=n.length,r=n[t],s=n[(t-1+i)%i],o=n[(t+1)%i];let a=ms(r.x-s.x,r.y-s.y),h=ms(o.x-r.x,o.y-r.y);if(e||(t===0&&(a=h),t===i-1&&(h=a)),a==null&&h==null)return null;if(a==null)return ii(h);if(h==null)return ii(a);const l=ii(a),c=ii(h),u=l.x+c.x,g=l.y+c.y,d=Math.hypot(u,g);if(d<=ct)return c;const p={x:u/d,y:g/d},f=Math.abs(p.x*c.x+p.y*c.y),y=f<=ct?ys:Math.min(1/f,ys);return{x:p.x*y,y:p.y*y}}function ms(n,t){const e=Math.hypot(n,t);return e<=ct?null:{x:n/e,y:t/e}}function ii(n){return{x:-n.y,y:n.x}}function gn(n){let t=0;const e=n.length;for(let i=0;i<e;i++){const r=n[i],s=n[(i+1)%e];t+=r.x*s.y-s.x*r.y}return t/2}function qi(n){return n.length>=3&&Math.abs(gn(n))>ct}function Qc(n,t,e){return n+(t-n)*e}var ma=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(ma||{});const mr=class mr extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=0,r=!1,s=0,o=0,a=null){super(),this._polyType=t,this._elevation=i;const h=a&&(a==null?void 0:a.length)===e.length,l=e.map((c,u)=>({x:c.x,y:c.y,bulge:h?a[u]:void 0}));this._geo=new V(l,r)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}getBulgeAt(t){const e=this._geo.vertices[t];return(e==null?void 0:e.bulge)||0}get geometricExtents(){const t=this._geo.box;return new C({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const i=this._geo.getPointAt(e);t.push(new m(i.x,i.y,this._elevation))}return t}subMoveGripPointsAt(t,e){return K(t,i=>{lr(this._geo.vertices,i,e)}),this}subGetOsnapPoints(t,e,i,r){var h;const s=this._geo,o=this._elevation,a=s.numberOfVertices;if(a!==0)switch(t){case w.EndPoint:for(let l=0;l<a;l++){const c=s.getPointAt(l);r.push(new m(c.x,c.y,o))}break;case w.MidPoint:case w.Nearest:case w.Perpendicular:case w.Tangent:{const l=this.closed?a:a-1,c=[];for(let u=0;u<l;u++){const g=[];ui(s.getPointAt(u),s.getPointAt((u+1)%a),(h=s.vertices[u])==null?void 0:h.bulge,o,t,e,g),c.push(...g)}if(t===w.MidPoint)r.push(...c);else{const u=gt(e,c);u&&r.push(u)}break}}}transformBy(t){const e=t.determinant()<0;let i=this._elevation;return this._geo.vertices.forEach(r=>{const s=new m(r.x,r.y,this._elevation).applyMatrix4(t);r.x=s.x,r.y=s.y,i=s.z,e&&r.bulge!=null&&(r.bulge=-r.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:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(r=>e.push(new m().set(r.x,r.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i)t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint3d(10,{x:this.getPointAt(i).x,y:this.getPointAt(i).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(i)),t.writeInt16(70,0);return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb2dPolyline");let e=this.closed?1:0;return this.polyType===1&&(e|=2),this.polyType===2&&(e|=4),this.polyType===3&&(e|=8),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),t.writeDouble(10,0),t.writeDouble(20,0),t.writeDouble(30,this.elevation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ut.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);return e.length===0?null:ut.fromGePolyline(e[0])}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}};mr.typeName="2dPolyline";let pn=mr;var _a=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(_a||{});const _r=class _r extends q{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new m,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){(t===w.EndPoint||t===w.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint2d(10,this.position),t.writeDouble(40,this.startWidth),t.writeDouble(41,this.endWidth),t.writeDouble(42,this.bulge),t.writeInt16(70,this.vertexType),this}};_r.typeName="2dVertex";let fn=_r;var xa=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(xa||{});const vi=class vi extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=!1){super(),this._polyType=t,this._geo=new V(e,i)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}get area(){return 0}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){const e=this._geo.vertices[t];return new m(e.x,e.y,e.z||0)}get geometricExtents(){const t=this._geo.vertices.map(e=>new m(e.x,e.y,e.z||0));return new C().setFromPoints(t)}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e)t.push(this.getPointAt(e));return t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveVertexAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){const s=Array.from({length:this._geo.numberOfVertices},(o,a)=>this.getPointAt(a));if(s.length!==0)switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const h=[];Ae(s[a],s[a+1],t,e,h),o.push(...h)}if(t===w.MidPoint)r.push(...o);else{const a=gt(e,o);a&&r.push(a)}break}}}transformBy(t){return this._geo.vertices.forEach(e=>{const i=new m(e.x,e.y,e.z||0).applyMatrix4(t);e.x=i.x,e.y=i.y,e.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:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=this._geo.vertices.map(i=>new m(i.x,i.y,i.z||0));return t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i){const r=this.getPointAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,{x:r.x,y:r.y,z:r.z}),t.writeInt16(70,32)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dPolyline");let e=this.closed?1:0;return e|=8,this.polyType===1&&(e|=16),this.polyType===2&&(e|=32),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ut.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const e=this._geo.offset(t);if(e.length===0)return null;const i=e[0],r=[];for(let s=0;s<i.numberOfVertices;s++){const o=i.getPointAt(s);r.push(new m(o.x,o.y,this.interpolateZ(o.x,o.y)))}return new vi(this.polyType,r,this.closed)}collectPath2d(){const t=Math.max(32,this.numberOfVertices*4);return this._geo.getPoints(t)}interpolateZ(t,e){const i=this.numberOfVertices;if(i<=0)return 0;let r=1/0,s=this.getPointAt(0).z;const o=this.closed?i:i-1;for(let a=0;a<o;a++){const h=this.getPointAt(a),l=this.getPointAt((a+1)%i),c=l.x-h.x,u=l.y-h.y,g=c*c+u*u;if(g===0)continue;const d=Math.max(0,Math.min(1,((t-h.x)*c+(e-h.y)*u)/g)),p=h.x+c*d,f=h.y+u*d,y=(t-p)**2+(e-f)**2;y<r&&(r=y,s=h.z+(l.z-h.z)*d)}return s}moveVertexAt(t,e){const i=this._geo.vertices[t];if(!i)return;i.x+=e.x,i.y+=e.y;const r=i;r.z=(r.z??0)+(e.z??0)}};vi.typeName="3dPolyline";let yn=vi;var wa=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(wa||{});const xr=class xr extends q{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new m,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new C().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){(t===w.EndPoint||t===w.Node)&&r.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,this.position),t.writeInt16(70,this.vertexType|32),this}};xr.typeName="3dVertex";let mn=xr;const Pi=class Pi extends J{get dxfTypeName(){return"ARC"}constructor(t,e,i,r,s=x.Z_AXIS){super();const o=Be(s);this._geo=new bt(t,e,i,r,s,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>M.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){const s=this.startPoint,o=this.endPoint;switch(t){case w.EndPoint:r.push(s),r.push(o);break;case w.MidPoint:r.push(this.midPoint);break;case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:{const a=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of a)M.isBetweenAngle(h,this.startAngle,this.endAngle)&&r.push(this._geo.getPointAtAngle(h));break}case w.Nearest:{const a=this._geo.nearestPoint(e);r.push(a)}break;case w.Perpendicular:{const a=this._geo.perpendicularPoints(e),h=gt(e,a);h&&r.push(h);break}case w.Tangent:{const a=this._geo.tangentPoints(e);r.push(...a);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=xe(this.center,this.normal);return t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeAngle(50,It(this.center,this.startPoint,this.normal)),t.writeAngle(51,It(this.center,this.endPoint,this.normal)),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,i=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=i?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:{const i=this._geo.startPoint;this._geo.startAngle=It(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}case 2:{const i=this._geo.endPoint;this._geo.endAngle=It(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}}}createOffsetCurve(t){const e=this._geo.offset(t);return e?new Pi(e.center,e.radius,e.startAngle,e.endAngle,e.normal):null}};Pi.typeName="Arc";let _n=Pi;const Jc=1;function ba(n){return n.replace(/\\[PpNn]/g,`
5
+ `).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,"")}function va(n,t,e=1){if(!n||t<=0)return 0;const i=ba(n),r=Math.max(...i.split(/\r\n|\r|\n/g).map(s=>s.length),0);return r===0?0:Math.max(t,r*t*Jc*e)}function tu(n){const t=ba(n);return Math.max(t.split(/\r\n|\r|\n/g).length,1)}function eu(n,t,e){if(t<=0||n<=0)return 0;if(n===1)return t;const i=Math.max(e,0);return t+(n-1)*t*i}function iu(n,t,e){switch(e){case exports.AcGiMTextAttachmentPoint.TopCenter:return{minX:-n/2,minY:-t,maxX:n/2,maxY:0};case exports.AcGiMTextAttachmentPoint.TopRight:return{minX:-n,minY:-t,maxX:0,maxY:0};case exports.AcGiMTextAttachmentPoint.MiddleLeft:return{minX:0,minY:-t/2,maxX:n,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleCenter:return{minX:-n/2,minY:-t/2,maxX:n/2,maxY:t/2};case exports.AcGiMTextAttachmentPoint.MiddleRight:return{minX:-n,minY:-t/2,maxX:0,maxY:t/2};case exports.AcGiMTextAttachmentPoint.BottomLeft:case exports.AcGiMTextAttachmentPoint.BaselineLeft:return{minX:0,minY:0,maxX:n,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomCenter:case exports.AcGiMTextAttachmentPoint.BaselineCenter:return{minX:-n/2,minY:0,maxX:n/2,maxY:t};case exports.AcGiMTextAttachmentPoint.BottomRight:case exports.AcGiMTextAttachmentPoint.BaselineRight:return{minX:-n,minY:0,maxX:0,maxY:t};case exports.AcGiMTextAttachmentPoint.TopLeft:default:return{minX:0,minY:-t,maxX:n,maxY:0}}}function nu(n,t){let e;t&&t.lengthSq()>0?e=t.clone().normalize():e=new x(Math.cos(n),Math.sin(n),0);const i=new x(-e.y,e.x,e.z);return i.lengthSq()===0?i.set(0,1,0):i.normalize(),{xAxis:e,yAxis:i}}function Pa(n,t,e,i,r,s=0,o){if(e<=0&&i<=0)return n.expandByPoint(t),n;const a=iu(e,i,r),{xAxis:h,yAxis:l}=nu(s,o?new x(o.x,o.y,o.z||0):void 0),c=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]];for(const[u,g]of c)n.expandByPoint(new m(t.x+h.x*u+l.x*g,t.y+h.y*u+l.y*g,t.z+h.z*u+l.z*g));return n}var Aa=(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))(Aa||{}),Sa=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Sa||{});const wr=class wr extends q{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new m,this._alignmentPoint=new m,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get alignmentPoint(){return this._alignmentPoint}set alignmentPoint(t){this._alignmentPoint.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){const t=new C,{anchor:e,attachmentPoint:i}=this.resolveTextAnchor(),r=va(this.textString,this.height,this.widthFactor);return Pa(t,e,r,this.height,i,this.rotation)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){w.Insertion===t&&r.push(this._position)}transformBy(t){const e=this._position.clone(),i=this._position.clone().add(new x(Math.cos(this._rotation),Math.sin(this._rotation),0)),r=this._position.clone().add(new x(-Math.sin(this._rotation),Math.cos(this._rotation),0)),s=this._position.clone().add(new x(0,0,1));e.applyMatrix4(t),i.applyMatrix4(t),r.applyMatrix4(t),s.applyMatrix4(t);const o=new x(i).sub(e),a=new x(r).sub(e),h=new x(s).sub(e),l=a.length(),c=o.length(),u=h.length();return this._position.copy(e),c>0&&(this._rotation=Math.atan2(o.y,o.x)),l>0&&(this._height*=l,c>0&&(this._widthFactor*=c/l)),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:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const{anchor:i,attachmentPoint:r}=this.resolveTextAnchor(),s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:i,rotation:this.rotation,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:r};return t.mtext(s,this.getTextStyle(),e)}resolveTextAnchor(){const t=this.resolveAttachmentPoint();if(t===exports.AcGiMTextAttachmentPoint.BaselineLeft)return{anchor:this._position,attachmentPoint:t};const e=this._alignmentPoint;return e.x===0&&e.y===0&&e.z===0||e.x===this._position.x&&e.y===this._position.y&&e.z===this._position.z?{anchor:this._position,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft}:{anchor:e,attachmentPoint:t}}resolveAttachmentPoint(){const t=this._horizontalMode,e=this._verticalModel;if(t===4)return exports.AcGiMTextAttachmentPoint.MiddleCenter;if(t===3||t===5)return exports.AcGiMTextAttachmentPoint.BaselineLeft;switch(e){case 3:return t===1?exports.AcGiMTextAttachmentPoint.TopCenter:t===2?exports.AcGiMTextAttachmentPoint.TopRight:exports.AcGiMTextAttachmentPoint.TopLeft;case 2:return t===1?exports.AcGiMTextAttachmentPoint.MiddleCenter:t===2?exports.AcGiMTextAttachmentPoint.MiddleRight:exports.AcGiMTextAttachmentPoint.MiddleLeft;case 1:return t===1?exports.AcGiMTextAttachmentPoint.BottomCenter:t===2?exports.AcGiMTextAttachmentPoint.BottomRight:exports.AcGiMTextAttachmentPoint.BottomLeft;case 0:default:return t===1?exports.AcGiMTextAttachmentPoint.BaselineCenter:t===2?exports.AcGiMTextAttachmentPoint.BaselineRight:exports.AcGiMTextAttachmentPoint.BaselineLeft}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbText"),t.writePoint3d(10,this.position),t.writeDouble(39,this.thickness),t.writeDouble(40,this.height),t.writeString(1,this.textString),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeString(7,this.styleName),t.writeInt16(72,this.horizontalMode),t.writeInt16(73,this.verticalMode),t.writePoint3d(11,this.alignmentPoint),this}};wr.typeName="Text";let je=wr;var st=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(st||{}),zt=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(zt||{});const br=class br extends je{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttributeDefinition"),t.writeString(3,this.prompt),t.writeString(2,this.tag),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeInt16(74,this.isReallyLocked?1:0),this}};br.typeName="AttDef";let xn=br;function ru(n){return n!=null&&typeof n=="object"&&"blockTableRecord"in n}const vr=class vr extends je{get dxfTypeName(){return"ATTRIB"}get resolvedColor(){var t;if(this.color.isByBlock){const e=(t=this.database)==null?void 0:t.tables.blockTable.getEntityById(this.ownerId);if(ru(e))return e.resolvedColor}return this.resolveStandardColor()}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&st.Invisible)!==0}set isInvisible(t){t?this._flags|=st.Invisible:this._flags&=~st.Invisible}get isConst(){return(this._flags&st.Const)!==0}set isConst(t){t?this._flags|=st.Const:this._flags&=~st.Const}get isVerifiable(){return(this._flags&st.Verifiable)!==0}set isVerifiable(t){t?this._flags|=st.Verifiable:this._flags&=~st.Verifiable}get isPreset(){return(this._flags&st.Preset)!==0}set isPreset(t){t?this._flags|=st.Preset:this._flags&=~st.Preset}get isMTextAttribute(){return(this._mtextFlag&zt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=zt.MultiLine:this._mtextFlag&=~zt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&zt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=zt.ConstMultiLine:this._mtextFlag&=~zt.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttribute"),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeString(2,this.tag),t.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&t.writeInt16(71,this.isMTextAttribute?1:0),this}};vr.typeName="Attrib";let wn=vr;const ge=class ge extends q{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new m,this._rotation=0,this._normal=new x(0,0,1),this._scaleFactors=new m(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId,this.syncAttributeDatabases()}syncAttributeDatabases(){try{const t=this.database;this._attribs.forEach(e=>{e.database=t})}catch{}}attributeIterator(){return new Ue(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??m.ORIGIN,i=new O().makeTranslation(-e.x,-e.y,-e.z),r=new O().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),s=new _e().setFromAxisAngle(x.Z_AXIS,this._rotation),o=new O().makeRotationFromQuaternion(s),a=new O().makeTranslation(this._position.x,this._position.y,this._position.z);return new O().multiplyMatrices(a,o).multiply(r).multiply(i)}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r,s,o){const a=o??new O;w.Insertion===t?r.push(this.getInsertionPoint(a)):s?this.subEntityGetOsnapPoints(t,e,i,r,s,a):this.collectBlockOsnapPoints(t,e,i,r,a)}transformBy(t){const e=new O().setFromExtrusionDirection(this._normal),i=new O().makeRotationZ(this._rotation),r=new O().multiplyMatrices(e,i),s=this._position.clone(),o=new m(this._scaleFactors.x,0,0).applyMatrix4(r).add(s),a=new m(0,this._scaleFactors.y,0).applyMatrix4(r).add(s),h=new m(0,0,this._scaleFactors.z).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),h.applyMatrix4(t);const l=new x(o).sub(s),c=new x(a).sub(s),u=new x(h).sub(s);let g=new x().crossVectors(l,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const p=new O().setFromExtrusionDirection(g).clone().invert(),f=l.clone().applyMatrix4(p);return this._position.copy(s),this._normal.copy(g),this._rotation=Math.atan2(f.y,f.x),this._scaleFactors.set(l.length(),c.length(),u.length()),this._attribs.forEach(y=>y.transformBy(t)),this}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(i=>{e.properties.push({name:i.tag,type:"string",editable:!i.isConst,skipTranslation:!0,accessor:{get:()=>i.textString,set:r=>{i.textString=r}}})})}return t}get geometricExtents(){const t=new C,e=this.blockTableRecord;if(e!=null){const r=e.newIterator();for(const s of r)t.union(s.geometricExtents)}const i=this.blockTransform;return t.applyMatrix4(i),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const i=this.blockTransform,r=[];return this._attribs.forEach(o=>{if(!o.isInvisible){const a=o.worldDraw(t);a&&r.push(a)}}),ie.instance.draw(t,e,this.resolvedColor,r,!0,i,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let i=!1;for(const r of this.attributeIterator())i=!0,t.writeStart("ATTRIB"),r.dxfOut(t);return i&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}collectBlockOsnapPoints(t,e,i,r,s){const o=this.blockTableRecord;if(!o)return;const a=new O().multiplyMatrices(s,this.getFullInsertionTransform()),h=a.clone().invert(),l=new m(e).applyMatrix4(h),c=new m(i).applyMatrix4(h),u=[];for(const g of o.newIterator()){const d=[];if(g instanceof ge){g.subGetOsnapPoints(t,e,i,d,void 0,a),u.push(...d);continue}g.subGetOsnapPoints(t,l,c,d,void 0,a),d.forEach(p=>u.push(new m(p).applyMatrix4(a)))}if(u.length!==0)if(t===w.Nearest||t===w.Perpendicular||t===w.Tangent){const g=gt(e,u);g&&r.push(g)}else r.push(...u)}subEntityGetOsnapPoints(t,e,i,r,s,o,a=new Set){if(s===this.objectId||a.has(this.objectId))return!1;a.add(this.objectId);try{const h=this.blockTableRecord;if(h==null)return!1;const l=new O().multiplyMatrices(o,this.getFullInsertionTransform());for(const c of h.newIterator()){if(c.objectId===s){const u=new m(e).applyMatrix4(l.clone().invert()),g=new m(i).applyMatrix4(l.clone().invert()),d=[];return c.subGetOsnapPoints(t,u,g,d,s,l),c instanceof ge?d.forEach(p=>{r.push(p.clone())}):d.forEach(p=>{r.push(new m(p).applyMatrix4(l))}),!0}if(c instanceof ge&&c.subEntityGetOsnapPoints(t,e,i,r,s,l,a))return!0}return!1}finally{a.delete(this.objectId)}}getInsertionPoint(t){var r;const e=((r=this.blockTableRecord)==null?void 0:r.origin)??m.ORIGIN,i=new O().multiplyMatrices(t,this.getFullInsertionTransform());return new m(e).applyMatrix4(i)}getFullInsertionTransform(){const t=new O().setFromExtrusionDirection(this._normal);return new O().multiplyMatrices(t,this.blockTransform)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockReference"),t.writePoint3d(10,this.position),t.writeString(2,this.blockName),t.writeDouble(41,this.scaleFactors.x),t.writeDouble(42,this.scaleFactors.y),t.writeDouble(43,this.scaleFactors.z),t.writeAngle(50,this.rotation),t.writeVector3d(210,this.normal),this}};ge.typeName="BlockReference";let ve=ge;const _s=[0,Math.PI/2,Math.PI,Math.PI/2*3],Ai=class Ai extends J{get dxfTypeName(){return"CIRCLE"}constructor(t,e,i=x.Z_AXIS){super();const r=Be(i);this._geo=new bt(t,e,0,B,i,r)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}subGetOsnapPoints(t,e,i,r){switch(t){case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:r.push(this._geo.getPointAtAngle(0)),r.push(this._geo.getPointAtAngle(Math.PI/2)),r.push(this._geo.getPointAtAngle(Math.PI)),r.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case w.Nearest:{const s=this._geo.nearestPoint(e);r.push(s)}break;case w.Tangent:{const s=this._geo.tangentPoints(e);r.push(...s);break}case w.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=gt(e,s);o&&r.push(o);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subGetGripPoints(){const t=new Array;t.push(this.center);for(const e of _s)t.push(this._geo.getPointAtAngle(e));return t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=xe(this.center,this.normal);return t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,e),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,i=this.radius;return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)>=i?1:-1}createOffsetCurve(t){const e=this._geo.offset(t);return e?new Ai(e.center,e.radius,e.normal):null}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:case 2:case 3:case 4:{const i=_s[t-1],r=this._geo.getPointAtAngle(i),o=new m(r.x+e.x,r.y+e.y,(r.z??0)+(e.z??0)).distanceTo(this.center);o>0&&(this.radius=o);break}}}};Ai.typeName="Circle";let bn=Ai;const Si=class Si extends J{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,i,r,s,o,a){super(),this._geo=new nr(t,e,i,r,s,o,a)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxis(){return this._geo.majorAxis}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}subGetGripPoints(){const t=new Array;return t.push(this._geo.center),t.push(this._geo.startPoint),t.push(this._geo.endPoint),t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:this.closed||(r.push(this._geo.startPoint),r.push(this._geo.endPoint));break;case w.MidPoint:this.closed||r.push(this._geo.midPoint);break;case w.Center:case w.Centroid:r.push(this._geo.center);break;case w.Quadrant:this.closed&&(r.push(this._geo.getPointAtAngle(0)),r.push(this._geo.getPointAtAngle(Math.PI/2)),r.push(this._geo.getPointAtAngle(Math.PI)),r.push(this._geo.getPointAtAngle(Math.PI/2*3)));break;case w.Nearest:r.push(this._geo.nearestPoint(e));break;case w.Tangent:r.push(...this._geo.tangentPoints(e));break;case w.Perpendicular:{const s=this._geo.perpendicularPoints(e),o=gt(e,s);o&&r.push(o);break}}}transformBy(t){return this._geo.transform(t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbEllipse"),t.writePoint3d(10,this.center);const e=this._geo.majorAxis,i=this.majorAxisRadius;return t.writePoint3d(11,{x:e.x*i,y:e.y*i,z:e.z*i}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.center,i=t.x-e.x,r=t.y-e.y,s=this.majorAxis,o=Math.hypot(s.x,s.y)||1,a=this.minorAxisRadius/this.majorAxisRadius*o||1,h=s.x/o,l=s.y/o,c=-l,u=h,g=i*h+r*l,d=i*c+r*u;return(g/o)**2+(d/a)**2>=1?1:-1}moveGripAt(t,e){switch(t){case 0:this.transformBy(O.makeTranslation(e));break;case 1:{const i=this._geo.startPoint;this._geo.startAngle=It(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}case 2:{const i=this._geo.endPoint;this._geo.endAngle=It(this._geo.center,{x:i.x+e.x,y:i.y+e.y,z:(i.z??0)+(e.z??0)},this._geo.normal);break}}}createOffsetCurve(t){const e=this._geo.offset(t);return e?new Si(e.center,e.normal,e.majorAxis,e.majorAxisRadius,e.minorAxisRadius,e.startAngle,e.endAngle):null}};Si.typeName="Ellipse";let vn=Si;const Pr=class Pr extends q{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new m,new m,new m],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new m),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new C().setFromPoints(this._vertices)}get area(){const t=[this.getVertexAt(0),this.getVertexAt(1),this.getVertexAt(2)],e=this.getVertexAt(3);return(e.x!==t[2].x||e.y!==t[2].y||e.z!==t[2].z)&&t.push(e),so(t)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return Oi(t,e,this._vertices),this}subGetOsnapPoints(t,e,i,r){hr(this._vertices,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._vertices.length,i=new Float32Array(e*3),r=new Uint16Array(e*2);for(let s=0;s<e;s++)i[s*3]=this._vertices[s].x,i[s*3+1]=this._vertices[s].y,i[s*3+2]=this._vertices[s].z,this.isEdgeVisibleAt(s)&&(r[s*2]=s,r[s*2+1]=(s+1)%4);return t.lineSegments(i,3,r)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),i=this.getVertexAt(1),r=this.getVertexAt(2),s=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,i),t.writePoint3d(12,r),t.writePoint3d(13,s);let o=0;for(let a=0;a<4;++a)this.isEdgeVisibleAt(a)||(o|=1<<a);return t.writeInt16(70,o),this}};Pr.typeName="Face";let Pn=Pr;var La=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(La||{});const Ar=class Ar extends J{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(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get isHookLineSameDirection(){return this._isHookLineSameDirection}set isHookLineSameDirection(t){this._isHookLineSameDirection=t}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(t=>t.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get byBlockColor(){return this._byBlockColor}set byBlockColor(t){this._byBlockColor=t}get associatedAnnotation(){return this._associatedAnnotation}set associatedAnnotation(t){this._associatedAnnotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get horizontalDirection(){return this._horizontalDirection}set horizontalDirection(t){this._horizontalDirection.copy(t)}get offsetFromBlock(){var t;return(t=this._offsetFromBlock)==null?void 0:t.clone()}set offsetFromBlock(t){this._offsetFromBlock=t?new x(t):void 0}get offsetFromAnnotation(){var t;return(t=this._offsetFromAnnotation)==null?void 0:t.clone()}set offsetFromAnnotation(t){this._offsetFromAnnotation=t?new x(t):void 0}appendVertex(t){this._vertices.push(new m().copy(t)),this._updated=!0}setVertexAt(t,e){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].copy(e),this._updated=!0,this}vertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("The vertex index is out of range!");return this._vertices[t].clone()}subGetGripPoints(){return this._vertices.map(t=>t.clone())}subMoveGripPointsAt(t,e){return Oi(t,e,this._vertices),this}subGetOsnapPoints(t,e,i,r){if(this.numVertices===0)return;if(this.isSplined&&this.splineGeo){switch(t){case w.EndPoint:r.push(this._vertices[0]),r.push(this._vertices[this.numVertices-1]);break;case w.Nearest:r.push(this.splineGeo.nearestPoint(e));break}return}const s=this._vertices;switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const h=[];Ae(s[a],s[a+1],t,e,h),o.push(...h)}if(t===w.MidPoint)r.push(...o);else{const a=gt(e,o);a&&r.push(a)}break}}}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new C().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}get area(){return 0}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this.transformVector(this._normal,t),this.transformVector(this._horizontalDirection,t),this._offsetFromBlock&&this.transformVector(this._offsetFromBlock,t),this._offsetFromAnnotation&&this.transformVector(this._offsetFromAnnotation,t),this._splineGeo?(this._splineGeo.transform(t),this._updated=!1):this._updated=!0,this}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new At(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLeader"),t.writeString(3,this.dimensionStyle),t.writeInt16(71,this.hasArrowHead?1:0),t.writeInt16(72,this.isSplined?1:0),t.writeInt16(73,this.annoType),t.writeInt16(74,this.isHookLineSameDirection?1:0),t.writeInt16(75,this.hasHookLine?1:0),t.writeInt16(76,this.numVertices),this.textHeight!==0&&t.writeDouble(40,this.textHeight),this.textWidth!==0&&t.writeDouble(41,this.textWidth),this.byBlockColor!=null&&t.writeInt16(77,this.byBlockColor),this.associatedAnnotation&&t.writeHandle(340,this.associatedAnnotation);for(const e of this.vertices)t.writePoint3d(10,e);return t.writeVector3d(210,this.normal),t.writeVector3d(211,this.horizontalDirection),this._offsetFromBlock&&t.writeVector3d(212,this._offsetFromBlock),this._offsetFromAnnotation&&t.writeVector3d(213,this._offsetFromAnnotation),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d();return e.length<2?1:ut.from2dPoints(e,!1).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Ni(this.collectPath2d(),!1,t)}collectPath2d(){return this.isSplined&&this.splineGeo?this.splineGeo.getPoints(64).map(t=>new P(t.x,t.y)):this._vertices.map(t=>new P(t.x,t.y))}transformVector(t,e){const i=new m,r=new m(t.x,t.y,t.z);i.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-i.x,r.y-i.y,r.z-i.z)}};Ar.typeName="Leader";let An=Ar;const Li=class Li extends J{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new Ct(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get area(){return 0}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subMoveGripPointsAt(t,e){return K(t,i=>{switch(i){case 0:this.transformBy(O.makeTranslation(e));break;case 1:this.startPoint.add(e);break;case 2:this.endPoint.add(e);break}}),this}subGetOsnapPoints(t,e,i,r){const s=this.startPoint,o=this.endPoint;switch(t){case w.EndPoint:r.push(s),r.push(o);break;case w.MidPoint:r.push(this.midPoint);break;case w.Nearest:{const a=this._geo.project(e);r.push(a)}break;case w.Perpendicular:{const a=this._geo.perpPoint(e);r.push(a)}break;case w.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,i=this.endPoint,r=[new m(e.x,e.y,0),new m(i.x,i.y,0)];return t.lines(r)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}getOffsetCurves(t){const e=this._geo.offset(t);return[new Li(e.startPoint,e.endPoint)]}getOffsetSideAtPoint(t){const e=this.startPoint,i=this.endPoint;return(i.x-e.x)*(t.y-e.y)-(i.y-e.y)*(t.x-e.x)>=0?1:-1}};Li.typeName="Line";let gi=Li;var Ma=(n=>(n[n.Top=0]="Top",n[n.Zero=1]="Zero",n[n.Bottom=2]="Bottom",n))(Ma||{}),Ea=(n=>(n[n.HasVertex=1]="HasVertex",n[n.Closed=2]="Closed",n[n.SuppressStartCaps=4]="SuppressStartCaps",n[n.SuppressEndCaps=8]="SuppressEndCaps",n))(Ea||{});const Sr=class Sr extends q{get dxfTypeName(){return"MLINE"}constructor(){super(),this._styleName="",this._styleObjectHandle="",this._scale=1,this._justification=1,this._flags=0,this._styleCount=0,this._startPosition=new m,this._normal=new x(0,0,1),this._segments=[]}get styleName(){return this._styleName||this.getDefaultStyleName()}set styleName(t){this._styleName=t}get styleObjectHandle(){return this._styleObjectHandle}set styleObjectHandle(t){this._styleObjectHandle=t}get scale(){return this._scale}set scale(t){this._scale=t}get justification(){return this._justification}set justification(t){this._justification=t}get flags(){return this._flags}set flags(t){this._flags=t}get styleCount(){return this._styleCount}set styleCount(t){this._styleCount=Math.max(0,t)}get startPosition(){return this._startPosition}set startPosition(t){this._startPosition.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get segments(){return this._segments.map(t=>this.cloneSegment(t))}set segments(t){this._segments=t.map(e=>this.createSegment(e)),this.updateHasVertexFlag()}get vertexCount(){return this._segments.length}get closed(){return(this._flags&2)!==0}set closed(t){this.setFlag(2,t)}get suppressStartCaps(){return(this._flags&4)!==0}set suppressStartCaps(t){this.setFlag(4,t)}get suppressEndCaps(){return(this._flags&8)!==0}set suppressEndCaps(t){this.setFlag(8,t)}appendSegment(t){this._segments.push(this.createSegment(t)),this.updateHasVertexFlag()}clearSegments(){this._segments=[],this.updateHasVertexFlag()}get geometricExtents(){const t=this.collectGeometryPoints();return new C().setFromPoints(t)}transformBy(t){return this._startPosition.applyMatrix4(t),this._segments.forEach(e=>{e.position.applyMatrix4(t),this.transformVector(e.direction,t),this.transformVector(e.miterDirection,t)}),this.transformVector(this._normal,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"mline",properties:[{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"scale",type:"float",editable:!0,accessor:{get:()=>this.scale,set:t=>{this.scale=t}}},{name:"justification",type:"int",editable:!0,accessor:{get:()=>this.justification,set:t=>{this.justification=t}}},{name:"closed",type:"boolean",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}},{name:"vertexCount",type:"int",editable:!1,accessor:{get:()=>this.vertexCount}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this._startPosition),this._segments.forEach(e=>t.push(e.position)),t}subMoveGripPointsAt(t,e){return K(t,i=>{if(i===0)this._startPosition.add(e);else{const r=this._segments[i-1];r&&r.position.add(e)}}),this}subGetOsnapPoints(t,e,i,r){const s=[this._startPosition,...this._segments.map(o=>o.position)];if(s.length!==0)switch(t){case w.EndPoint:r.push(...s);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const o=[];for(let a=0;a<s.length-1;a++){const h=[];Ae(s[a],s[a+1],t,e,h),o.push(...h)}if(t===w.MidPoint)r.push(...o);else{const a=gt(e,o);a&&r.push(a)}break}}}subWorldDraw(t){if(this._segments.length===0)return;const e=[],i=this.getMLineStyle(),r=this.getRenderableElementCount(i),s=t.subEntityTraits,o=s.color,a=s.lineType,h=s.fillType,l=s.drawOrder,c=this.createFillArea(i,r);if(c&&(s.color=o,this.applyFillTraits(i,s),s.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},s.drawOrder=-1,e.push(t.area(c)),s.fillType=h,s.drawOrder=l),r<=0){const u=this.getReferencePath();u.length>=2&&e.push(t.lines(u))}else{for(let u=0;u<r;u++){s.color=o,s.lineType=a,this.applyStyleElementTraits(i,u,s);const g=this.getElementPath(u,i);g.length>=2&&e.push(t.lines(g))}this.appendStyleDrivenJointAndCapEntities(t,e,i,r,o,a)}if(s.color=o,s.lineType=a,s.fillType=h,s.drawOrder=l,e.length!==0)return e.length===1?e[0]:t.group(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMline"),t.writeString(2,this.styleName),t.writeHandle(340,this._styleObjectHandle),t.writeDouble(40,this._scale),t.writeInt16(70,this._justification),t.writeInt16(71,this._flags),t.writeInt16(72,this.vertexCount),t.writeInt16(73,this._styleCount),t.writePoint3d(10,this._startPosition),t.writeVector3d(210,this._normal),this._segments.forEach(e=>{t.writePoint3d(11,e.position),t.writeVector3d(12,e.direction),t.writeVector3d(13,e.miterDirection),e.elements.forEach(i=>{t.writeInt16(74,i.parameterCount),i.parameters.forEach(r=>t.writeDouble(41,r)),t.writeInt16(75,i.fillCount),i.fillParameters.forEach(r=>t.writeDouble(42,r))})}),this}setFlag(t,e){e?this._flags|=t:this._flags&=~t}updateHasVertexFlag(){this.setFlag(1,this._segments.length>0)}createSegment(t){var e;return{position:new m().copy(t.position),direction:new x().copy(t.direction),miterDirection:new x().copy(t.miterDirection),elements:((e=t.elements)==null?void 0:e.map(i=>this.createElement(i)))??[]}}createElement(t){const e=t.parameters?[...t.parameters]:[],i=t.fillParameters?[...t.fillParameters]:[];return{parameterCount:t.parameterCount??e.length,parameters:e,fillCount:t.fillCount??i.length,fillParameters:i}}cloneSegment(t){return{position:t.position.clone(),direction:t.direction.clone(),miterDirection:t.miterDirection.clone(),elements:t.elements.map(e=>({parameterCount:e.parameterCount,parameters:[...e.parameters],fillCount:e.fillCount,fillParameters:[...e.fillParameters]}))}}collectGeometryPoints(){const t=[this._startPosition];if(this._segments.length===0)return t;const e=this.getMLineStyle(),i=this.getRenderableElementCount(e);if(i<=0)return this._segments.forEach(r=>t.push(r.position)),t;for(let r=0;r<i;r++)t.push(...this.getElementPath(r,e));return t}getRenderableElementCount(t){const e=(t==null?void 0:t.elementCount)??0;return Math.max(this._styleCount,e,...this._segments.map(i=>i.elements.length),0)}getReferencePath(){const t=[this._startPosition.clone(),...this._segments.map(e=>e.position.clone())];return this.closePathIfNeeded(t)}getElementPath(t,e){const i=[],r=this._segments[0];return i.push(this.getElementBoundaryPoint("start",r,t,e)),this._segments.forEach(s=>{i.push(this.offsetPoint(s.position,s.miterDirection,this.getElementMiterOffset(s,t,e)))}),i[i.length-1]=this.getElementBoundaryPoint("end",this._segments[this._segments.length-1],t,e),this.closePathIfNeeded(i)}getElementMiterOffset(t,e,i){var s;const r=t.elements[e];return(s=r==null?void 0:r.parameters)!=null&&s.length?r.parameters[0]:this.getStyleElementOffset(e,i)}getElementBoundaryPoint(t,e,i,r){const s=this.getElementMiterOffset(e,i,r),o=t==="start"?this._startPosition:e.position,a=this.offsetPoint(o,e.miterDirection,s);if(!this.shouldApplyCapCutAtSide(t,r))return a;const h=t==="start"?r==null?void 0:r.startAngle:r==null?void 0:r.endAngle,l=this.computeCapCutDistance(s,h,t);if(l===0)return a;const c=t==="start"?this.getStartSegmentDirection():this.getEndSegmentDirection();return c.lengthSq()===0?a:a.add(c.multiplyScalar(l))}shouldApplyCapCutAtSide(t,e){return!e||this.closed?!1:t==="start"?this.suppressStartCaps?!1:(e.flags&112)!==0:this.suppressEndCaps?!1:(e.flags&1792)!==0}computeCapCutDistance(t,e,i){const r=this.normalizeCapAngle(e),s=Math.tan(r);if(Math.abs(s)<1e-6)return 0;const o=t/s;return o}normalizeCapAngle(t){if(t==null||!Number.isFinite(t))return Math.PI/2;let e=t%180;return e<0&&(e+=180),(e<1||e>179)&&(e=90),e*Math.PI/180}getStartSegmentDirection(){const t=this._segments[0],e=new x;return t&&(e.subVectors(t.position,this._startPosition),e.lengthSq()===0&&e.copy(t.direction)),e.lengthSq()>0&&e.normalize(),e}getEndSegmentDirection(){const t=this._segments[this._segments.length-1];if(!t)return new x;const e=new x,i=this._segments.length>1?this._segments[this._segments.length-2].position:this._startPosition;return e.subVectors(t.position,i),e.lengthSq()===0&&e.copy(t.direction),e.lengthSq()>0&&e.normalize(),e}createFillArea(t,e){if(!t||!(t.flags&1)||e<2)return;const i=this.getFillBoundaryElementIndices(e,t);if(!i)return;const r=this.getElementPath(i.outerIndex,t),s=this.getElementPath(i.innerIndex,t),o=this.stripClosingPoint(r),a=this.stripClosingPoint(s);if(o.length<2||a.length<2)return;const h=new Tt;if(this.closed){if(o.length<3||a.length<3)return;h.add(new V(o.map(l=>({x:l.x,y:l.y})),!0)),h.add(new V(a.map(l=>({x:l.x,y:l.y})),!0))}else{const l=[...o,...a.slice().reverse()].map(c=>({x:c.x,y:c.y}));if(l.length<3)return;h.add(new V(l,!0))}return h}getFillBoundaryElementIndices(t,e){let i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=-1,o=-1;for(let a=0;a<t;a++){const h=this.getElementReferenceOffset(a,e);h<i&&(i=h,s=a),h>r&&(r=h,o=a)}if(!(s<0||o<0||s===o))return{outerIndex:o,innerIndex:s}}getElementReferenceOffset(t,e){var r;const i=this._segments[0];if(i){const s=i.elements[t];if((r=s==null?void 0:s.parameters)!=null&&r.length)return s.parameters[0]}return this.getStyleElementOffset(t,e)}getStyleElementOffset(t,e){const i=e==null?void 0:e.elements[t];if(!i)return 0;const r=this.getStyleJustificationShift(e);return(i.offset+r)*this._scale}getStyleJustificationShift(t){const e=(t==null?void 0:t.elements)??[];if(e.length<=0)return 0;let i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(const s of e){const o=s.offset;o<i&&(i=o),o>r&&(r=o)}return this._justification===0?-r:this._justification===2?-i:0}stripClosingPoint(t){if(t.length<2)return t;const e=t[0],i=t[t.length-1],r=1e-9;return Math.abs(e.x-i.x)<=r&&Math.abs(e.y-i.y)<=r&&Math.abs(e.z-i.z)<=r?t.slice(0,-1):t}offsetPoint(t,e,i){if(i===0||e.lengthSq()===0)return t.clone();const r=e.clone().normalize().multiplyScalar(i);return t.clone().add(r)}closePathIfNeeded(t){if(!this.closed||t.length<2)return t;const e=t[0],i=t[t.length-1],r=1e-9;return Math.abs(e.x-i.x)<=r&&Math.abs(e.y-i.y)<=r&&Math.abs(e.z-i.z)<=r||t.push(e.clone()),t}appendStyleDrivenJointAndCapEntities(t,e,i,r,s,o){!i||r<2||(e.push(...this.drawMiterJointEntities(t,i,r,s,o)),e.push(...this.drawCapEntities(t,i,r,s,o)))}drawMiterJointEntities(t,e,i,r,s){if(this.closed||this._segments.length<2||!(e.flags&2))return[];const o=[],a=t.subEntityTraits;for(let h=0;h<this._segments.length-1;h++){const l=this._segments[h],c=Array.from({length:i},(u,g)=>{const d=this.getElementMiterOffset(l,g,e);return{elementIndex:g,offset:d,point:this.offsetPoint(l.position,l.miterDirection,d)}}).sort((u,g)=>g.offset-u.offset);for(let u=0;u<c.length-1;u++)this.applyElementDrawTraits(a,r,s,e,c[u].elementIndex),o.push(t.lines([c[u].point,c[u+1].point]))}return o}drawCapEntities(t,e,i,r,s){if(this.closed||this._segments.length<=0)return[];const o=[];return o.push(...this.drawCapEntitiesForSide(t,"start",e,i,r,s)),o.push(...this.drawCapEntitiesForSide(t,"end",e,i,r,s)),o}drawCapEntitiesForSide(t,e,i,r,s,o){if(e==="start"&&this.suppressStartCaps)return[];if(e==="end"&&this.suppressEndCaps)return[];const a=i.flags,h=e==="start",l=h?(a&16)!==0:(a&256)!==0,c=h?(a&64)!==0:(a&1024)!==0,u=h?(a&32)!==0:(a&512)!==0;if(!l&&!c&&!u)return[];const g=this.getCapElementPoints(e,r,i);if(g.length<2)return[];const d=[],p=t.subEntityTraits;if(l)for(let y=0;y<g.length-1;y++)this.applyElementDrawTraits(p,s,o,i,g[y].elementIndex),d.push(t.lines([g[y].point,g[y+1].point]));const f=h?this.getStartSegmentDirection().multiplyScalar(-1):this.getEndSegmentDirection().clone();if(c){const y=this.drawCapArcBetweenElements(t,e,g[0],g[g.length-1],f,p,s,o,i);y&&d.push(y)}if(u)for(let y=1;y<Math.floor(g.length/2);y++){const _=g[y],v=g[g.length-1-y];if(!_||!v||_===v)continue;const S=this.drawCapArcBetweenElements(t,e,_,v,f,p,s,o,i);S&&d.push(S)}return d}getCapElementPoints(t,e,i){const r=t==="start"?this._segments[0]:this._segments[this._segments.length-1];return r?Array.from({length:e},(s,o)=>({elementIndex:o,offset:this.getElementMiterOffset(r,o,i),point:this.getElementBoundaryPoint(t,r,o,i)})).sort((s,o)=>o.offset-s.offset):[]}drawCapArcBetweenElements(t,e,i,r,s,o,a,h,l){const c=e==="end"?r.point:i.point,u=e==="end"?i.point:r.point,g=c.distanceTo(u);if(g<=1e-9||s.lengthSq()===0)return;const p=c.clone().add(new x().subVectors(u,c).multiplyScalar(.5)).add(s.clone().normalize().multiplyScalar(g/2)),f=bt.createByThreePoints(c,u,p);if(f)return this.applyElementDrawTraits(o,a,h,l,e==="end"?r.elementIndex:i.elementIndex),t.circularArc(f)}applyElementDrawTraits(t,e,i,r,s){t.color=e,t.lineType=i,this.applyStyleElementTraits(r,s,t)}transformVector(t,e){const i=new m,r=new m(t.x,t.y,t.z);i.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-i.x,r.y-i.y,r.z-i.z)}getMLineStyle(){var s;const t=this.database.objects.mlineStyle,e=this.styleObjectHandle?t.getIdAt(this.styleObjectHandle):void 0;if(e)return e;const i=this.styleName?t.getAt(this.styleName):void 0;if(i)return i;const r=(s=this.styleName)==null?void 0:s.toUpperCase();if(r)for(const[o,a]of t.entries()){const h=(a.styleName||o).toUpperCase();if(o.toUpperCase()===r||h===r)return a}}applyStyleElementTraits(t,e,i){const r=t==null?void 0:t.elements[e];if(!r)return;const s=this.resolveStyleElementLineType(r.lineType);s&&(i.lineType=s),!(r.color.isByBlock||r.color.isByLayer)&&(i.color=r.color.clone())}applyFillTraits(t,e){const i=t==null?void 0:t.fillColor;!i||i.isByBlock||i.isByLayer||(e.color=i.clone())}resolveStyleElementLineType(t){var l;const e=t==null?void 0:t.trim();if(!e)return;const i=e.toUpperCase(),r=Z.toUpperCase(),s=St.toUpperCase();let o="UserSpecified",a=e;if(i===r){o="ByLayer";const c=(l=this.database.tables.layerTable.getAt(this.layer))==null?void 0:l.linetype;a=c&&c.toUpperCase()!==r&&c.toUpperCase()!==s?c:Dt}else i===s&&(o="ByBlock",a=Dt);const h=this.database.tables.linetypeTable.getAt(a);return h?{type:o,...h.linetype}:{type:o,name:a,standardFlag:0,description:"",totalPatternLength:0}}resolveEffectiveProperties(){super.resolveEffectiveProperties(),this._styleName||(this._styleName=this.getDefaultStyleName())}getDefaultStyleName(){try{return this.database.cmlstyle||Vt}catch{return Vt}}};Sr.typeName="MLine";let Sn=Sr;var ke=(n=>(n[n.InvisibleLeader=0]="InvisibleLeader",n[n.StraightLeader=1]="StraightLeader",n[n.SplineLeader=2]="SplineLeader",n))(ke||{}),ue=(n=>(n[n.NoneContent=0]="NoneContent",n[n.BlockContent=1]="BlockContent",n[n.MTextContent=2]="MTextContent",n[n.ToleranceContent=3]="ToleranceContent",n))(ue||{}),Ia=(n=>(n[n.Horizontal=0]="Horizontal",n[n.Vertical=1]="Vertical",n))(Ia||{}),Ta=(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))(Ta||{});const su=1,ou=2,au=4,lu=8,hu=64,cu=128,uu=32768,Lr=class Lr extends q{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=exports.AcGiMTextAttachmentPoint.MiddleLeft,this._textDrawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT,this._textLineSpacingFactor=1,this._textAttachmentDirection=0,this._arrowheadOverrides=[],this._blockAttributes=[]}get leaders(){return this._leaders.map(t=>this.cloneLeader(t))}get numberOfLeaders(){return this._leaders.length}get leaderLineType(){return this._leaderLineType}set leaderLineType(t){this._leaderLineType=t}get contentType(){return this._contentType}set contentType(t){this._contentType=t}get doglegEnabled(){return this._doglegEnabled}set doglegEnabled(t){this._doglegEnabled=t}get doglegLength(){return this._doglegLength}set doglegLength(t){this._doglegLength=t}get doglegVector(){return this._doglegVector}set doglegVector(t){this._doglegVector.copy(t)}get landingPoint(){return this._landingPoint}set landingPoint(t){this._landingPoint=t?this.createPoint(t):void 0}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get mleaderStyleId(){return this._mleaderStyleId}set mleaderStyleId(t){this._mleaderStyleId=t}get version(){return this._version}set version(t){this._version=t}get leaderStyleId(){return this._leaderStyleId}set leaderStyleId(t){this._leaderStyleId=t}get propertyOverrideFlag(){return this._propertyOverrideFlag}set propertyOverrideFlag(t){this._propertyOverrideFlag=t}get leaderLineColor(){return this._leaderLineColor}set leaderLineColor(t){this._leaderLineColor=t==null?void 0:t.clone()}get leaderLineTypeId(){return this._leaderLineTypeId}set leaderLineTypeId(t){this._leaderLineTypeId=t}get leaderLineWeight(){return this._leaderLineWeight}set leaderLineWeight(t){this._leaderLineWeight=t}get landingEnabled(){return this._landingEnabled}set landingEnabled(t){this._landingEnabled=t}get arrowheadId(){return this._arrowheadId}set arrowheadId(t){this._arrowheadId=t}get arrowheadSize(){return this._arrowheadSize}set arrowheadSize(t){this._arrowheadSize=t}get textStyleId(){return this._textStyleId}set textStyleId(t){this._textStyleId=t}get textLeftAttachmentType(){return this._textLeftAttachmentType}set textLeftAttachmentType(t){this._textLeftAttachmentType=t}get textRightAttachmentType(){return this._textRightAttachmentType}set textRightAttachmentType(t){this._textRightAttachmentType=t}get textAngleType(){return this._textAngleType}set textAngleType(t){this._textAngleType=t}get textAlignmentType(){return this._textAlignmentType}set textAlignmentType(t){this._textAlignmentType=t}get textColor(){return this._textColor}set textColor(t){this._textColor=t==null?void 0:t.clone()}get textFrameEnabled(){return this._textFrameEnabled}set textFrameEnabled(t){this._textFrameEnabled=t}get landingGap(){return this._landingGap}set landingGap(t){this._landingGap=t}get textAttachment(){return this._textAttachment}set textAttachment(t){this._textAttachment=t}get textFlowDirection(){return this._textFlowDirection}set textFlowDirection(t){this._textFlowDirection=t}get blockContentId(){return this._blockContentId}set blockContentId(t){this._blockContentId=t}get blockContentColor(){return this._blockContentColor}set blockContentColor(t){this._blockContentColor=t==null?void 0:t.clone()}get blockContentScale(){return this._blockContentScale}set blockContentScale(t){this._blockContentScale=t}get blockContentRotation(){return this._blockContentRotation}set blockContentRotation(t){this._blockContentRotation=t}get blockContentConnectionType(){return this._blockContentConnectionType}set blockContentConnectionType(t){this._blockContentConnectionType=t}get annotativeScaleEnabled(){return this._annotativeScaleEnabled}set annotativeScaleEnabled(t){this._annotativeScaleEnabled=t}get arrowheadOverrides(){return this._arrowheadOverrides}set arrowheadOverrides(t){this._arrowheadOverrides=t}get blockAttributes(){return this._blockAttributes}set blockAttributes(t){this._blockAttributes=t}get textDirectionNegative(){return this._textDirectionNegative}set textDirectionNegative(t){this._textDirectionNegative=t}get textAlignInIPE(){return this._textAlignInIPE}set textAlignInIPE(t){this._textAlignInIPE=t}get bottomTextAttachmentDirection(){return this._bottomTextAttachmentDirection}set bottomTextAttachmentDirection(t){this._bottomTextAttachmentDirection=t}get topTextAttachmentDirection(){return this._topTextAttachmentDirection}set topTextAttachmentDirection(t){this._topTextAttachmentDirection=t}get contentScale(){return this._contentScale}set contentScale(t){this._contentScale=t}get contentBasePosition(){return this._contentBasePosition}set contentBasePosition(t){this._contentBasePosition=t}get textAnchor(){return this._textAnchor}set textAnchor(t){this._textAnchor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textBackgroundColor(){return this._textBackgroundColor}set textBackgroundColor(t){this._textBackgroundColor=t==null?void 0:t.clone()}get textBackgroundScaleFactor(){return this._textBackgroundScaleFactor}set textBackgroundScaleFactor(t){this._textBackgroundScaleFactor=t}get textBackgroundTransparency(){return this._textBackgroundTransparency}set textBackgroundTransparency(t){this._textBackgroundTransparency=t}get textBackgroundColorOn(){return this._textBackgroundColorOn}set textBackgroundColorOn(t){this._textBackgroundColorOn=t}get textFillOn(){return this._textFillOn}set textFillOn(t){this._textFillOn=t}get textColumnType(){return this._textColumnType}set textColumnType(t){this._textColumnType=t}get textUseAutoHeight(){return this._textUseAutoHeight}set textUseAutoHeight(t){this._textUseAutoHeight=t}get textColumnWidth(){return this._textColumnWidth}set textColumnWidth(t){this._textColumnWidth=t}get textColumnGutterWidth(){return this._textColumnGutterWidth}set textColumnGutterWidth(t){this._textColumnGutterWidth=t}get textColumnFlowReversed(){return this._textColumnFlowReversed}set textColumnFlowReversed(t){this._textColumnFlowReversed=t}get textColumnHeight(){return this._textColumnHeight}set textColumnHeight(t){this._textColumnHeight=t}get textUseWordBreak(){return this._textUseWordBreak}set textUseWordBreak(t){this._textUseWordBreak=t}get hasMText(){return this._hasMText}set hasMText(t){this._hasMText=t}get hasBlock(){return this._hasBlock}set hasBlock(t){this._hasBlock=t}get planeOrigin(){return this._planeOrigin}set planeOrigin(t){this._planeOrigin=t}get planeXAxisDirection(){return this._planeXAxisDirection}set planeXAxisDirection(t){this._planeXAxisDirection=t}get planeYAxisDirection(){return this._planeYAxisDirection}set planeYAxisDirection(t){this._planeYAxisDirection=t}get planeNormalReversed(){return this._planeNormalReversed}set planeNormalReversed(t){this._planeNormalReversed=t}get leaderSections(){return this.leaders}get blockContentData(){return this.blockContent}get mtextContent(){return this._mtextContent?{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint.clone()}:void 0}set mtextContent(t){if(!t){this._mtextContent=void 0,this._contentType===2&&(this._contentType=0);return}this._mtextContent={text:t.text,anchorPoint:this.createPoint(t.anchorPoint)},this._contentType=2}get contents(){var t;return((t=this._mtextContent)==null?void 0:t.text)??""}set contents(t){this._mtextContent?this._mtextContent.text=t:this._mtextContent={text:t,anchorPoint:new m},this._contentType=2}get textLocation(){var t;return(t=this._mtextContent)==null?void 0:t.anchorPoint}set textLocation(t){if(!t){this._mtextContent=void 0;return}this._mtextContent?this._mtextContent.anchorPoint.copy(t):this._mtextContent={text:"",anchorPoint:this.createPoint(t)},this._contentType=2}get textHeight(){return this._textHeight}set textHeight(t){this._textHeight=t}get textWidth(){return this._textWidth}set textWidth(t){this._textWidth=t}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get textDirection(){return this._textDirection}set textDirection(t){this._textDirection.copy(t)}get textStyleName(){return this._textStyleName}set textStyleName(t){this._textStyleName=t}get textAttachmentPoint(){return this._textAttachmentPoint}set textAttachmentPoint(t){this._textAttachmentPoint=t}get textDrawingDirection(){return this._textDrawingDirection}set textDrawingDirection(t){this._textDrawingDirection=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textAttachmentDirection(){return this._textAttachmentDirection}set textAttachmentDirection(t){this._textAttachmentDirection=t}get blockContent(){var t,e,i;return this._blockContent?{blockContentId:this._blockContent.blockContentId,blockHandle:this._blockContent.blockHandle,normal:(t=this._blockContent.normal)==null?void 0:t.clone(),position:(e=this._blockContent.position)==null?void 0:e.clone(),scale:this._blockContent.scale.clone(),rotation:this._blockContent.rotation,color:(i=this._blockContent.color)==null?void 0:i.clone(),transformationMatrix:[...this._blockContent.transformationMatrix]}:void 0}set blockContent(t){var e;if(!t){this._blockContent=void 0,this._contentType===1&&(this._contentType=0);return}this._blockContent={blockContentId:t.blockContentId??t.blockHandle,blockHandle:t.blockHandle,normal:t.normal?new x(t.normal):void 0,position:t.position?this.createPoint(t.position):void 0,scale:new x(t.scale??{x:1,y:1,z:1}),rotation:t.rotation??0,color:(e=t.color)==null?void 0:e.clone(),transformationMatrix:t.transformationMatrix?[...t.transformationMatrix]:[]},this.blockContentId=this._blockContent.blockContentId,this._contentType=1}addLeader(t={}){var i,r;const e={lastLeaderLinePoint:t.lastLeaderLinePoint?this.createPoint(t.lastLeaderLinePoint):void 0,lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:t.landingPoint?this.createPoint(t.landingPoint):void 0,doglegVector:t.doglegVector?new x(t.doglegVector):void 0,doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:((i=t.breaks)==null?void 0:i.map(s=>({index:s.index,start:this.createPoint(s.start),end:this.createPoint(s.end)})))??[],leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:[]};return(r=t.leaderLines)==null||r.forEach(s=>{e.leaderLines.push(this.createLeaderLine(s))}),this._leaders.push(e),this._leaders.length-1}removeLeader(t){return this.checkLeaderIndex(t),this._leaders.splice(t,1),this}addLeaderLine(t,e=[]){return this.checkLeaderIndex(t),this._leaders[t].leaderLines.push(this.createLeaderLine({vertices:e})),this._leaders[t].leaderLines.length-1}appendVertex(t,e,i){return this.getMutableLeaderLine(t,e).vertices.push(this.createPoint(i)),this}setLeaderLineVertices(t,e,i){return this.getMutableLeaderLine(t,e).vertices=i.map(r=>this.createPoint(r)),this}getLeaderLineVertices(t,e){return this.getMutableLeaderLine(t,e).vertices.map(i=>i.clone())}addBreak(t,e,i,r){return this.getMutableLeaderLine(t,e).breaks.push({start:this.createPoint(i),end:this.createPoint(r)}),this}setLandingPoint(t,e){return this.checkLeaderIndex(t),this._leaders[t].landingPoint=e?this.createPoint(e):void 0,this}setDoglegDirection(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegVector=new x(e),this}setDoglegLength(t,e){return this.checkLeaderIndex(t),this._leaders[t].doglegLength=e,this}get geometricExtents(){const t=this.collectGeometryPoints();return t.length>0?new C().setFromPoints(t):new C}subGetGripPoints(){return this.collectGeometryPoints().map(t=>t.clone())}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGeometryGripPointAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){var s;if(t===w.Insertion){this.contentBasePosition?r.push(this.contentBasePosition):this._mtextContent?r.push(this._mtextContent.anchorPoint):(s=this._blockContent)!=null&&s.position&&r.push(this._blockContent.position);return}this._leaders.forEach(o=>{o.leaderLines.forEach(a=>{const h=this.getLeaderLineDrawPoints(o,a);if(h.length!==0)switch(t){case w.EndPoint:r.push(...h);break;case w.MidPoint:case w.Nearest:case w.Perpendicular:{const l=[];for(let c=0;c<h.length-1;c++){const u=[];Ae(h[c],h[c+1],t,e,u),l.push(...u)}if(t===w.MidPoint)r.push(...l);else{const c=gt(e,l);c&&r.push(c)}break}}})})}transformBy(t){var e,i,r,s,o,a,h,l;return this._leaders.forEach(c=>{var u,g;(u=c.lastLeaderLinePoint)==null||u.applyMatrix4(t),(g=c.landingPoint)==null||g.applyMatrix4(t),c.doglegVector&&this.transformVector(c.doglegVector,t),c.breaks.forEach(d=>{d.start.applyMatrix4(t),d.end.applyMatrix4(t)}),c.leaderLines.forEach(d=>{d.vertices.forEach(p=>p.applyMatrix4(t)),d.breaks.forEach(p=>{p.start.applyMatrix4(t),p.end.applyMatrix4(t)})})}),(e=this._landingPoint)==null||e.applyMatrix4(t),(i=this.contentBasePosition)==null||i.applyMatrix4(t),this.transformVector(this._doglegVector,t),this.transformVector(this._normal,t),(r=this.textAnchor)==null||r.applyMatrix4(t),(s=this._mtextContent)==null||s.anchorPoint.applyMatrix4(t),this.transformVector(this._textDirection,t),(a=(o=this._blockContent)==null?void 0:o.position)==null||a.applyMatrix4(t),(h=this._blockContent)!=null&&h.normal&&this.transformVector(this._blockContent.normal,t),this.blockContentScale&&this.transformVector(this.blockContentScale,t),(l=this.planeOrigin)==null||l.applyMatrix4(t),this.planeXAxisDirection&&this.transformVector(this.planeXAxisDirection,t),this.planeYAxisDirection&&this.transformVector(this.planeYAxisDirection,t),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"leader",properties:[{name:"contentType",type:"enum",editable:!0,options:[{label:ue[0],value:0},{label:ue[1],value:1},{label:ue[2],value:2},{label:ue[3],value:3}],accessor:{get:()=>this.contentType,set:t=>{this.contentType=t}}},{name:"leaderLineType",type:"enum",editable:!0,options:[{label:ke[0],value:0},{label:ke[1],value:1},{label:ke[2],value:2}],accessor:{get:()=>this.leaderLineType,set:t=>{this.leaderLineType=t}}},{name:"doglegEnabled",type:"boolean",editable:!0,accessor:{get:()=>this.doglegEnabled,set:t=>{this.doglegEnabled=t}}},{name:"doglegLength",type:"float",editable:!0,accessor:{get:()=>this.doglegLength,set:t=>{this.doglegLength=t}}},{name:"leaderCount",type:"int",editable:!1,accessor:{get:()=>this.numberOfLeaders}}]},{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.textHeight,set:t=>{this.textHeight=t}}},{name:"textWidth",type:"float",editable:!0,accessor:{get:()=>this.textWidth,set:t=>{this.textWidth=t}}},{name:"textStyleName",type:"string",editable:!0,accessor:{get:()=>this.textStyleName,set:t=>{this.textStyleName=t}}}]}]}}resolveEffectiveProperties(){if(super.resolveEffectiveProperties(),this._mleaderStyleId)return;const t=this.getDefaultMLeaderStyle();t&&(this._mleaderStyleId=t.objectId)}subWorldDraw(t,e){const i=[],r=t.subEntityTraits,s=r.color,o=r.lineType,a=r.lineWeight,h=this.getResolvedLeaderLineColor(),l=this.getResolvedLeaderLineStyle(),c=this.getResolvedLeaderLineWeight(),u=this.getResolvedTextColor();this.getResolvedLeaderLineType()!==0&&(this.applyColorTraits(r,h,s),this.applyLineTraits(r,l,c),this._leaders.forEach(d=>{d.leaderLines.forEach(f=>{const y=this.getLeaderLineDrawPoints(d,f);if(y.length>0){const _=this.drawLeaderLine(t,y);_&&i.push(_)}});const p=this.getDoglegPoints(d);p&&i.push(t.lines(p))}));const g=this.getRenderableMTextContent();if(this.contentType===2&&g){this.applyColorTraits(r,u,s);const d=this.getResolvedTextHeight(),p={text:g.text,height:d,width:this.getMTextRenderWidth(g.text,d),position:g.anchorPoint,rotation:this.textRotation,directionVector:this.textDirection,attachmentPoint:this.textAttachmentPoint,drawingDirection:this.textDrawingDirection,lineSpaceFactor:this.textLineSpacingFactor};i.push(t.mtext(p,this.getTextStyle(),e))}if(r.color=s,r.lineType=o,r.lineWeight=a,i.length!==0)return i.length===1?i[0]:t.group(i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMLeader"),t.writeInt16(170,this.leaderLineType),t.writeBoolean(290,this.doglegEnabled),t.writeDouble(41,this.doglegLength),t.writeInt16(172,this.contentType),t.writeVector3d(210,this.normal),t.writeHandle(340,this.mleaderStyleId),this._landingPoint&&t.writePoint3d(10,this._landingPoint),t.writeVector3d(11,this.doglegVector),this._mtextContent&&(t.writeString(1,this._mtextContent.text),t.writePoint3d(12,this._mtextContent.anchorPoint),t.writeDouble(40,this.textHeight),t.writeDouble(42,this.textWidth),t.writeAngle(50,this.textRotation),t.writeString(7,this.textStyleName)),this._blockContent&&(t.writeHandle(341,this._blockContent.blockContentId??""),this._blockContent.position&&t.writePoint3d(15,this._blockContent.position),t.writeVector3d(16,this._blockContent.scale),t.writeAngle(52,this._blockContent.rotation)),this._leaders.forEach(e=>{e.landingPoint&&t.writePoint3d(110,e.landingPoint),e.doglegVector&&t.writeVector3d(111,e.doglegVector),t.writeDouble(140,e.doglegLength),t.writeInt16(171,e.leaderLines.length),e.leaderLines.forEach(i=>{t.writeInt16(90,i.vertices.length),i.vertices.forEach(r=>t.writePoint3d(10,r))})}),this}createPoint(t){return new m().copy(t)}createLeaderLine(t){var e,i;return{vertices:((e=t.vertices)==null?void 0:e.map(r=>this.createPoint(r)))??[],breakPointIndexes:t.breakPointIndexes?[...t.breakPointIndexes]:[],leaderLineIndex:t.leaderLineIndex,breaks:((i=t.breaks)==null?void 0:i.map(r=>({index:r.index,start:this.createPoint(r.start),end:this.createPoint(r.end)})))??[]}}cloneLeader(t){var e,i,r;return{lastLeaderLinePoint:(e=t.lastLeaderLinePoint)==null?void 0:e.clone(),lastLeaderLinePointSet:t.lastLeaderLinePointSet,landingPoint:(i=t.landingPoint)==null?void 0:i.clone(),doglegVector:(r=t.doglegVector)==null?void 0:r.clone(),doglegVectorSet:t.doglegVectorSet,doglegLength:t.doglegLength,breaks:t.breaks.map(s=>({index:s.index,start:s.start.clone(),end:s.end.clone()})),leaderBranchIndex:t.leaderBranchIndex,directionType:t.directionType,leaderLines:t.leaderLines.map(s=>({vertices:s.vertices.map(o=>o.clone()),breakPointIndexes:[...s.breakPointIndexes],leaderLineIndex:s.leaderLineIndex,breaks:s.breaks.map(o=>({index:o.index,start:o.start.clone(),end:o.end.clone()}))}))}}checkLeaderIndex(t){if(t<0||t>=this._leaders.length)throw new Error("The leader index is out of range!")}getMutableLeaderLine(t,e){this.checkLeaderIndex(t);const i=this._leaders[t].leaderLines[e];if(!i)throw new Error("The leader line index is out of range!");return i}collectGeometryPoints(){var e;const t=[];return this._leaders.forEach(i=>{i.lastLeaderLinePoint&&t.push(i.lastLeaderLinePoint),i.landingPoint&&t.push(i.landingPoint),i.breaks.forEach(s=>t.push(s.start,s.end)),i.leaderLines.forEach(s=>{t.push(...s.vertices),s.breaks.forEach(o=>t.push(o.start,o.end))});const r=this.getDoglegPoints(i);r&&t.push(...r),i.leaderLines.forEach(s=>{const o=this.getArrowheadPoints(this.getLeaderLineDrawPoints(i,s));o&&t.push(...o)})}),this._landingPoint&&t.push(this._landingPoint),this.contentBasePosition&&t.push(this.contentBasePosition),this.textAnchor&&t.push(this.textAnchor),this._mtextContent&&t.push(this._mtextContent.anchorPoint),(e=this._blockContent)!=null&&e.position&&t.push(this._blockContent.position),this.planeOrigin&&t.push(this.planeOrigin),t}moveGeometryGripPointAt(t,e){var s;let i=0;const r=(o,a)=>{if(o){i===t&&o.add(e),i++;return}a&&(i===t&&a(),i++)};this._leaders.forEach(o=>{r(o.lastLeaderLinePoint),r(o.landingPoint),o.breaks.forEach(h=>{r(h.start),r(h.end)}),o.leaderLines.forEach(h=>{h.vertices.forEach(l=>r(l)),h.breaks.forEach(l=>{r(l.start),r(l.end)})});const a=this.getDoglegPoints(o);a&&(r(a[0]),r(void 0,()=>{const h=a[0],l=a[1];if(!h||!l)return;const c=h.distanceTo({x:l.x+e.x,y:l.y+e.y,z:(l.z??0)+(e.z??0)});o.doglegLength!=null||o.doglegVectorSet?o.doglegLength=c:this._doglegLength=c})),o.leaderLines.forEach(h=>{const l=this.getLeaderLineDrawPoints(o,h),c=this.getArrowheadPoints(l);c&&c.forEach((u,g)=>{g===0||g===c.length-1?r(l[0]):r(void 0)})})}),r(this._landingPoint),r(this.contentBasePosition),r(this.textAnchor),this._mtextContent&&r(this._mtextContent.anchorPoint),(s=this._blockContent)!=null&&s.position&&r(this._blockContent.position),r(this.planeOrigin)}getLeaderLineDrawPoints(t,e){if(e.vertices.length>=2)return e.vertices;if(e.vertices.length===0)return[];const i=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint??this.contentBasePosition;return!i||e.vertices[0].equals(i)?e.vertices:[e.vertices[0],i]}getDoglegPoints(t){if(!this.getResolvedDoglegEnabled())return;const e=t.lastLeaderLinePoint??t.landingPoint??this._landingPoint,i=t.doglegVector??this._doglegVector,r=t.doglegLength??this.getResolvedDoglegLength();if(!e||r==null||r===0||i.lengthSq()===0)return;const s=e.clone().add(i.clone().normalize().multiplyScalar(r));return[e,s]}getArrowheadPoints(t){if(!this.isArrowheadVisible()||t.length<2)return;const e=this.getArrowheadFrame(t);if(!e)return;const i=this.getResolvedArrowheadSize(),{tip:r,unit:s}=e,o=r.clone().add(s.clone().multiplyScalar(i)),a=i/6,h=new x(-s.y,s.x,0),l=o.clone().add(h.clone().multiplyScalar(a)),c=o.clone().add(h.clone().multiplyScalar(-a));return[r,l,c,r]}isArrowheadVisible(){const t=this.getResolvedArrowheadId();return(t==null?void 0:t.toUpperCase())==="_NONE"?!1:this.getResolvedArrowheadSize()>0}drawLeaderLine(t,e){const i=[],r=this.getLeaderLinePointsForDraw(e);r.length>=2&&i.push(t.lines(r));const s=this.drawArrowhead(t,e);if(s&&i.push(s),i.length!==0)return i.length===1?i[0]:t.group(i)}getLeaderLinePointsForDraw(t){const e=this.getArrowheadLeaderLineTrimDistance();return e<=0?t:this.trimPolylineStart(t,e)}getArrowheadLeaderLineTrimDistance(){if(!this.isArrowheadVisible())return 0;const t=this.getResolvedArrowheadBlockTableRecord();if(!t)return 0;const e=this.getResolvedArrowheadSize();if(e<=0)return 0;const i=t.origin??m.ORIGIN;let r=i.x;for(const s of t.newIterator()){const o=s.geometricExtents;o.isEmpty()||o.max.x>r&&(r=o.max.x)}return Math.max(0,(r-i.x)*e)}trimPolylineStart(t,e){if(t.length<2||e<=0)return t;let i=e;for(let r=0;r<t.length-1;r++){const s=t[r],o=t[r+1],a=o.distanceTo(s);if(!(a<=0)){if(i<a){const h=new x().subVectors(o,s);return[s.clone().add(h.multiplyScalar(i/a)),...t.slice(r+1)]}i-=a}}return[t[t.length-1]]}drawArrowhead(t,e){if(!this.isArrowheadVisible())return;const i=this.drawArrowheadBlock(t,e);if(i)return i;const r=this.getArrowheadPoints(e);if(!r)return;const s=new Tt;s.add(new V(r,!0));const o=t.subEntityTraits,a=o.fillType;o.fillType={solidFill:!0,patternAngle:0,definitionLines:[]};const h=t.area(s);return o.fillType=a,h}drawArrowheadBlock(t,e){const i=this.getResolvedArrowheadBlockTableRecord();if(!i)return;const r=this.getArrowheadFrame(e);if(!r)return;const{tip:s,unit:o}=r,a=this.getResolvedArrowheadSize(),h=Math.atan2(o.y,o.x),l=i.origin??m.ORIGIN,c=new O().makeTranslation(-l.x,-l.y,-l.z),u=new O().makeScale(a,a,a),g=new O().makeRotationZ(h),d=new O().makeTranslation(s.x,s.y,s.z),p=new O().multiplyMatrices(d,g).multiply(u).multiply(c);return ie.instance.draw(t,i,this.resolvedColor,[],!0,p,new x(this.normal))}getArrowheadFrame(t){if(t.length<2)return;const e=t[0],i=t.find(s=>!s.equals(e));if(!i)return;const r=new x().subVectors(i,e);if(r.lengthSq()!==0)return{tip:e,unit:r.normalize()}}getResolvedArrowheadId(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.arrowSymbolId;return this.arrowheadId??t}getResolvedArrowheadBlockTableRecord(){const t=this.getResolvedArrowheadId();if(t)return this.database.tables.blockTable.getIdAt(t)}getResolvedArrowheadSize(){const t=this.getMLeaderStyle(),e=(t==null?void 0:t.arrowSize)??(t==null?void 0:t.scale);return this.arrowheadSize??this.contentScale??e??this.getResolvedTextHeight()}getResolvedTextHeight(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.textHeight;return this.textHeight>0?this.textHeight:t!=null&&t>0?t:2.5}getRenderableMTextContent(){var i;if(this._mtextContent)return{text:this._mtextContent.text,anchorPoint:this._mtextContent.anchorPoint};const t=(i=this.getMLeaderStyle())==null?void 0:i.defaultMTextContents,e=this.textAnchor??this.contentBasePosition??this._landingPoint;if(!(!t||!e))return{text:t,anchorPoint:e}}getMTextRenderWidth(t,e){if(this._textWidth>0)return this._textWidth;if(!t)return this._textWidth;const i=t.replace(/\\[PpNn]/g,`
6
+ `).replace(/\\[A-Za-z][^;]*;/g,"").replace(/[{}]/g,""),r=Math.max(...i.split(/\r\n|\r|\n/g).map(s=>s.length),1);return Math.max(e,r*e)}transformVector(t,e){const i=new m,r=new m(t.x,t.y,t.z);i.applyMatrix4(e),r.applyMatrix4(e),t.set(r.x-i.x,r.y-i.y,r.z-i.z)}getMLeaderStyle(){const t=this.database.objects.mleaderStyle,e=this.mleaderStyleId||this.leaderStyleId;if(e){const i=t.getIdAt(e);if(i)return i}return this.getDefaultMLeaderStyle()}getDefaultMLeaderStyle(){const t=this.resolveMLeaderStyleByName(this.getDefaultMLeaderStyleName());return t||this.database.objects.mleaderStyle.newIterator().toArray()[0]}resolveMLeaderStyleByName(t){const e=t==null?void 0:t.trim();if(!e)return;const i=this.database.objects.mleaderStyle,r=i.getAt(e);if(r)return r;const s=i.getIdAt(e);if(s)return s;const o=e.toUpperCase();for(const[a,h]of i.entries())if(a.toUpperCase()===o)return h}getDefaultMLeaderStyleName(){try{return this.database.cmleaderstyle||jt}catch{return jt}}getResolvedTextStyleName(){var s,o,a;const t=this.database.tables.textStyleTable,e=(s=this.getMLeaderStyle())==null?void 0:s.textStyleId,i=e?(o=t.getIdAt(e))==null?void 0:o.name:void 0,r=this.textStyleId?(a=t.getIdAt(this.textStyleId))==null?void 0:a.name:void 0;if(this.textStyleName){const h=t.getAt(this.textStyleName);if(h!=null&&h.name)return h.name;const l=t.getIdAt(this.textStyleName);if(l!=null&&l.name)return l.name}return r||i}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.getResolvedTextStyleName());if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}getResolvedLeaderLineColor(){var t;return this.getResolvedComponentColor(this.leaderLineColor,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineColor,ou)}getResolvedLeaderLineType(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.leaderLineType;return this.getResolvedStyleDrivenValue(this.leaderLineType,t,su)}getResolvedLeaderLineTypeId(){var t;return this.getResolvedStyleDrivenValue(this.leaderLineTypeId,(t=this.getMLeaderStyle())==null?void 0:t.leaderLineTypeId,au)}getResolvedLeaderLineStyle(){const t=this.getResolvedLeaderLineTypeId();if(!t)return;const e=this.database.tables.linetypeTable.getIdAt(t);if(e)return{type:"UserSpecified",...e.linetype}}getResolvedLeaderLineWeight(){var i;const t=(i=this.getMLeaderStyle())==null?void 0:i.leaderLineWeight,e=this.getResolvedStyleDrivenValue(this.leaderLineWeight,t,lu);if(e!=null)return e}getResolvedDoglegEnabled(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegEnabled;return this.getResolvedStyleDrivenValue(this.doglegEnabled,t,hu)}getResolvedDoglegLength(){var e;const t=(e=this.getMLeaderStyle())==null?void 0:e.doglegLength;return this.getResolvedStyleDrivenValue(this.doglegLength,t,cu)}getResolvedTextColor(){var t;return this.getResolvedComponentColor(this.textColor,(t=this.getMLeaderStyle())==null?void 0:t.textColor,uu)}getResolvedComponentColor(t,e,i){if(!t)return e;const r=this.isPropertyOverrideEnabled(i);return r===!0?t:r===!1?e??t:!t.isByBlock&&!t.isByLayer?t:e??t}getResolvedStyleDrivenValue(t,e,i){const r=this.isPropertyOverrideEnabled(i);return r===!0?t??e:e??t}isPropertyOverrideEnabled(t){if(this.propertyOverrideFlag!=null)return(this.propertyOverrideFlag&t)!==0}applyColorTraits(t,e,i){t.color=i,e&&(t.color=e)}applyLineTraits(t,e,i){e&&(t.lineType=e),i!=null&&(t.lineWeight=i)}};Lr.typeName="MLeader";let Ln=Lr;const Mr=class Mr extends q{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 m,this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._direction=new x(1,0,0),this._drawingDirection=exports.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){const t=new C,e=this.width>0?this.width:va(this.contents,this.height),i=tu(this.contents),r=eu(i,this.height,this.lineSpacingFactor);return Pa(t,this._location,e,r,this.attachmentPoint,this.rotation,this.direction)}subGetGripPoints(){return[this._location]}subMoveGripPointsAt(t,e){return kt(t,e,this._location),this}subGetOsnapPoints(t,e,i,r){w.Insertion===t&&r.push(this._location)}transformBy(t){const e=this._location.clone(),i=this._direction.lengthSq()>0?this._direction.clone().normalize():new x(Math.cos(this._rotation),Math.sin(this._rotation),0),r=new x(-i.y,i.x,i.z);r.lengthSq()===0&&r.set(0,1,0),r.normalize();const s=e.clone().add(i),o=e.clone().add(r);e.applyMatrix4(t),s.applyMatrix4(t),o.applyMatrix4(t);const a=new x(s).sub(e),h=new x(o).sub(e),l=a.length(),c=h.length();return this._location.copy(e),l>0&&(this._direction.copy(a).normalize(),this._rotation=Math.atan2(this._direction.y,this._direction.x),this._width*=l),c>0&&(this._height*=c),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:exports.AcGiMTextAttachmentPoint[1],value:1},{label:exports.AcGiMTextAttachmentPoint[2],value:2},{label:exports.AcGiMTextAttachmentPoint[3],value:3},{label:exports.AcGiMTextAttachmentPoint[4],value:4},{label:exports.AcGiMTextAttachmentPoint[5],value:5},{label:exports.AcGiMTextAttachmentPoint[6],value:6},{label:exports.AcGiMTextAttachmentPoint[7],value:7},{label:exports.AcGiMTextAttachmentPoint[8],value:8},{label:exports.AcGiMTextAttachmentPoint[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:exports.AcGiMTextFlowDirection[1],value:1},{label:exports.AcGiMTextFlowDirection[2],value:2},{label:exports.AcGiMTextFlowDirection[3],value:3},{label:exports.AcGiMTextFlowDirection[4],value:4},{label:exports.AcGiMTextFlowDirection[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable.resolveAt(this.styleName);if(!t)throw new Error("No valid text style found in text style table.");return t.textStyle}subWorldDraw(t,e){const 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 t.mtext(i,this.getTextStyle(),e)}encodeMTextContentsForDxf(t){return t.replace(/\r\n|\r|\n/g,"\\P")}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMText"),t.writePoint3d(10,this.location),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writeString(1,this.encodeMTextContentsForDxf(this.contents)),t.writeString(7,this.styleName),t.writeAngle(50,this.rotation),t.writeVector3d(11,this.direction),t.writeInt16(71,this.attachmentPoint),t.writeInt16(72,this.drawingDirection),t.writeInt16(73,this.lineSpacingStyle),t.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(t.writeInt16(90,1),t.writeInt32(63,this.backgroundFillColor),t.writeInt32(441,this.backgroundFillTransparency),t.writeDouble(45,this.backgroundScaleFactor)),this}};Mr.typeName="MText";let pi=Mr;function du(n){return n&2048?"SqrtChord":n&1024?"Chord":"Uniform"}function xs(n,t){try{return new fi(n.controlPoints,n.knots,gu(n.weights,n.controlPoints.length),n.degree,t)}catch{return null}}function gu(n,t){if(!(!n||n.length!==t))return n}const Xe=class Xe extends J{get dxfTypeName(){return"SPLINE"}static fromControlPoints(t,e,i,r,s){const o=At.fromControlPoints(t,e,i,r,s);return o?xs(o,s):null}static fromFitPoints(t,e,i,r,s,o){const a=At.fromFitPoints(t,e,i,r,s,o);return a?xs(a,r):null}static fromDwgSpline(t){const e=!!(t.flag&1),i=du(t.flag);if(t.numberOfControlPoints>0&&t.numberOfKnots>0){const r=Xe.fromControlPoints(t.controlPoints,t.knots,t.weights,t.degree,e);if(r)return r}return t.numberOfFitPoints>0?Xe.fromFitPoints(t.fitPoints,i,t.degree,e,t.startTangent,t.endTangent):null}constructor(t,e,i,r,s){super(),this.rebuild(t,e,i,r,s)}rebuild(t,e,i,r,s){const o=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(r!==void 0)+ +(s!==void 0);if(o<2||o>5)throw lt.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new At(t,e,i,r):this._geo=new At(t,e,i,r,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get area(){return this._geo.area}set closed(t){this._geo.closed=t}subGetGripPoints(){return this._geo.controlPoints.map(t=>new m(t.x,t.y,t.z??0))}subMoveGripPointsAt(t,e){return K(t,i=>{const r=this._geo.controlPoints[i];r&&nt.applyOffsetToPoint3d(r,e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:r.push(this._geo.startPoint),r.push(this._geo.endPoint);break;case w.Node:{const s=new Set;for(const o of this._geo.knots)s.has(o)||(s.add(o),r.push(this._geo.evaluateAt(o)));break}case w.Nearest:r.push(this._geo.nearestPoint(e));break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var i;const e=this._geo;super.dxfOutFields(t),t.writeSubclassMarker("AcDbSpline"),t.writeInt16(70,this.closed?1:0),t.writeInt16(71,e.degree),t.writeInt16(72,e.knots.length),t.writeInt16(73,e.controlPoints.length),t.writeInt16(74,((i=e.fitPoints)==null?void 0:i.length)??0);for(const r of e.knots)t.writeDouble(40,r);for(const r of e.weights)t.writeDouble(41,r);for(const r of e.controlPoints)t.writePoint3d(10,r);for(const r of e.fitPoints??[])t.writePoint3d(11,r);return this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectPath2d(1);return e.length<2?1:ut.from2dPoints(e,this.closed).getOffsetSideAtPoint(t)}createOffsetCurve(t){const{points:e,tangents:i}=this._geo.getOffsetSamplePath2d(t),r=mh(e,this.closed,t,i);return r?ut.fromGePolyline(r):null}collectPath2d(t){return this._geo.getOffsetSamplePath2d(t).points}};Xe.typeName="Spline";let fi=Xe;const pu=new x,Er=class Er extends ve{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,i){super(t),this._attachmentPoint=exports.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=i,this._numRows=e,this._columnWidth=new Array(i),this._rowHeight=new Array(e),this._cells=new Array(e*i)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,i){var s;const r=t*this._numColumns+e;return(s=this._cells[r])==null?void 0:s.text}setTextString(t,e,i){const r=t*this._numColumns+e;if(!this._cells[r]){this._cells[r]={text:i,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[r].text=i}isEmpty(t,e){var r;const i=t*this._numColumns+e;return!((r=this._cells[i])!=null&&r.text)}get geometricExtents(){let t;try{t=this.blockTableRecord}catch{t=void 0}if(t&&t.newIterator().count>0){const a=new C;for(const h of t.newIterator())a.union(h.geometricExtents);return a.applyMatrix4(this.blockTransform),a}const e=this._columnWidth.reduce((a,h)=>a+h,0),i=this._rowHeight.reduce((a,h)=>a+h,0),r=new C;if(e===0&&i===0)return r.expandByPoint(this.position),r;const s=new _e;s.setFromAxisAngle(x.Z_AXIS,this.rotation),le.compose(this.position,s,this.scaleFactors);const o=[new m(0,0,0),new m(e,0,0),new m(e,-i,0),new m(0,-i,0)];for(const a of o)r.expandByPoint(a.applyMatrix4(le));return r}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){const e=this.blockTableRecord;if(e&&e.newIterator().count>0){const d=this.drawAnonymousTableBlock(t,e);if(d)return d}let i=0,r=0;const s=new Uint16Array(this.numColumns*this.numRows*8),o=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let d=0;d<=this.numRows;d++){i-=d>0?this.rowHeight(d-1):0,r=0;for(let p=0;p<=this.numColumns;p++)r+=p>0?this.columnWidth(p-1):0,o[a++]=r,o[a++]=i,o[a++]=0}const h=[],l=new Array(this.numRows*this.numColumns).fill(!1);r=0,a=0;let c=0;for(let d=0;d<this.numColumns;d++){r+=d>0?this.columnWidth(d-1):0,i=0;for(let p=0;p<this.numRows;p++){i+=p>0?this.rowHeight(p-1):0;const f=this.cell(p*this.numColumns+d);if(c=p*this.numColumns+d,f&&!l[c]){const y=f.borderWidth??1,_=f.borderHeight??1;this.fillVisited(l,c,this.numColumns,y,_),s[a++]=d+p*(this.numColumns+1),s[a++]=d+p*(this.numColumns+1)+y;const v=o[s[a-1]*3]-r,S=d+(p+_)*(this.numColumns+1)+y;d+y==this.numColumns&&(s[a++]=d+p*(this.numColumns+1)+y,s[a++]=S);const A=-o[S*3+1]-i;if(p+_==this.numRows&&(s[a++]=d+(p+_)*(this.numColumns+1)+_,s[a++]=d+(p+_)*(this.numColumns+1)),s[a++]=d+(p+_)*(this.numColumns+1),s[a++]=d+p*(this.numColumns+1),f.text){const L=f.attachmentPoint||this.attachmentPoint||exports.AcGiMTextAttachmentPoint.MiddleCenter,T=this.getTableTextOffset(L,v,A),E={text:f.text,height:this.getCellTextHeight(f,A),width:v,position:pu.set(r,-i,0).clone().add(T),rotation:this.rotation,attachmentPoint:L},X=this.getTextStyle(f);h.push(t.mtext(E,X))}}}}h.push(t.lineSegments(o,3,s));const u=t.group(h),g=new _e;return g.setFromAxisAngle(x.Z_AXIS,this.rotation),le.compose(this.position,g,this.scaleFactors),u.applyMatrix(le),u}drawAnonymousTableBlock(t,e){const i=[],r=e.newIterator();for(const a of r){let h;if(a.color.isByBlock){ws.copy(a.color);const l=this.resolvedColor;l.isForeground?a.color.setForeground():l.RGB!=null&&a.color.setRGBValue(l.RGB),h=a.worldDraw(t),a.color.copy(ws)}else h=a.worldDraw(t);h&&(h.objectId=this.objectId,h.ownerId=this.ownerId,h.layerName=this.layer,h.visible=this.visibility&&a.visibility,i.push(h))}const s=t.group(i);s.applyMatrix(this.blockTransform);const o=this.normal;return o&&(o.x!==0||o.y!==0||o.z!==1)&&(le.setFromExtrusionDirection(o),s.applyMatrix(le)),s}fillVisited(t,e,i,r,s){if(s==1&&r==1)t[e]=!0;else for(let o=0;o<r;++o)for(let a=0;a<s;++a)t[e+o+a*i]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable.resolveAt(t.textStyle);if(!e)throw new Error("No valid text style found in text style table.");return e.textStyle}getTableTextOffset(t,e,i){const r=new x;switch(t){case 1:break;case 2:r.setX(e/2);break;case 3:r.setX(e);break;case 4:r.setY(-i/2);break;case 5:r.set(e/2,-i/2,0);break;case 6:r.set(e,-i/2,0);break;case 7:r.setY(-i);break;case 8:r.set(e/2,-i,0);break;case 9:r.set(e,-i,0);break}return r}getCellTextHeight(t,e){return t.textHeight&&t.textHeight>0?t.textHeight:Math.max(e/2,1)}dxfOutFields(t){var s,o,a,h,l,c,u;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((s=t.database)==null?void 0:s.version)??((o=this.database)==null?void 0:o.version),i=(e==null?void 0:e.value)!=null?e.value>=27:!1;t.writeInt16(280,this.tableDataVersion),t.writeObjectId(342,this.tableStyleId),t.writeObjectId(343,this.owningBlockRecordId),t.writeVector3d(11,this.horizontalDirection),t.writeUInt32(90,this.tableValueFlag),t.writeUInt32(93,this.tableOverrideFlag),t.writeUInt32(94,this.borderColorOverrideFlag),t.writeUInt32(95,this.borderLineweightOverrideFlag),t.writeUInt32(96,this.borderVisibilityOverrideFlag),t.writeInt16(71,this.attachmentPoint),t.writeInt32(91,this.numRows),t.writeInt32(92,this.numColumns);for(let g=0;g<this.numRows;++g)t.writeDouble(141,this.rowHeight(g));for(let g=0;g<this.numColumns;++g)t.writeDouble(142,this.columnWidth(g));const r=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let g=0;g<r;g++){const d=this._cells[g],p=(d==null?void 0:d.cellType)??(d!=null&&d.blockTableRecordId?2:1);if(t.writeInt16(171,p),t.writeInt16(172,(d==null?void 0:d.flagValue)??0),t.writeInt16(173,(d==null?void 0:d.mergedValue)??0),t.writeBoolean(174,d==null?void 0:d.autoFit),t.writeInt16(175,d==null?void 0:d.borderWidth),t.writeInt16(176,d==null?void 0:d.borderHeight),(d==null?void 0:d.overrideFlag)!=null&&(i?t.writeInt32(91,d.overrideFlag):t.writeInt16(177,d.overrideFlag)),t.writeInt16(178,d==null?void 0:d.virtualEdgeFlag),t.writeAngle(145,d==null?void 0:d.rotation),i&&t.writeInt16(92,d==null?void 0:d.extendedCellFlags),p===1)d!=null&&d.fieldObjetId?t.writeObjectId(344,d.fieldObjetId):this.writeCellText(t,(d==null?void 0:d.text)??"",i,d==null?void 0:d.cellValueBlockBegin);else if(p===2){if(t.writeObjectId(340,d==null?void 0:d.blockTableRecordId),t.writeDouble(144,d==null?void 0:d.blockScale),t.writeInt16(179,d==null?void 0:d.blockAttrNum),(a=d==null?void 0:d.attrDefineId)!=null&&a.length)for(const f of d.attrDefineId)t.writeObjectId(331,f);if((d==null?void 0:d.attrText)!=null)if(Array.isArray(d.attrText))for(const f of d.attrText)t.writeString(300,f);else t.writeString(300,d.attrText)}d!=null&&d.textStyle&&t.writeString(7,d.textStyle),(d==null?void 0:d.textHeight)!=null&&t.writeDouble(140,d.textHeight),(d==null?void 0:d.attachmentPoint)!=null&&t.writeInt16(170,d.attachmentPoint),(d==null?void 0:d.topBorderVisibility)!=null&&t.writeInt16(289,d.topBorderVisibility?1:0),(d==null?void 0:d.rightBorderVisibility)!=null&&t.writeInt16(285,d.rightBorderVisibility?1:0),(d==null?void 0:d.bottomBorderVisibility)!=null&&t.writeInt16(286,d.bottomBorderVisibility?1:0),(d==null?void 0:d.leftBorderVisibility)!=null&&t.writeInt16(288,d.leftBorderVisibility?1:0)}if(t.writeInt16(70,this.flowDirection),t.writeDouble(40,this.horizontalCellMargin),t.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&t.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&t.writeInt16(281,this.suppressHeader?1:0),(h=this.cellTypeOverrides)!=null&&h.length)for(const g of this.cellTypeOverrides){t.writeString(7,g.textStyle),t.writeDouble(140,g.textHeight),t.writeInt16(170,g.alignment),t.writeInt16(63,g.backgroundColor),t.writeInt16(64,g.contentColor),g.backgroundColorEnabled!=null&&t.writeInt16(283,g.backgroundColorEnabled?1:0);const d=g.borderLineweights;d&&(t.writeInt16(274,d.top),t.writeInt16(275,d.right),t.writeInt16(276,d.bottom),t.writeInt16(277,d.left),t.writeInt16(278,d.insideHorizontal),t.writeInt16(279,d.insideVertical));const p=g.borderVisibility;p&&(t.writeInt16(284,p.top?1:0),t.writeInt16(285,p.right?1:0),t.writeInt16(286,p.bottom?1:0),t.writeInt16(287,p.left?1:0),t.writeInt16(288,p.insideHorizontal?1:0),t.writeInt16(289,p.insideVertical?1:0))}if(this.tableBorderColors&&(t.writeInt16(63,this.tableBorderColors.left),t.writeInt16(64,this.tableBorderColors.top),t.writeInt16(65,this.tableBorderColors.insideHorizontal),t.writeInt16(66,this.tableBorderColors.bottom),t.writeInt16(68,this.tableBorderColors.insideVertical),t.writeInt16(69,this.tableBorderColors.right)),(l=this.rowDataTypes)!=null&&l.length)for(const g of this.rowDataTypes)t.writeInt16(97,g);if((c=this.rowUnitTypes)!=null&&c.length)for(const g of this.rowUnitTypes)t.writeInt16(98,g);if((u=this.rowFormats)!=null&&u.length)for(const g of this.rowFormats)t.writeString(4,g);return this}writeCellText(t,e,i,r){if(!i){if(e.length<=250){t.writeString(1,e);return}const a=Math.ceil(e.length/250);for(let h=0;h<a;h++){const l=h*250,c=l+250,u=e.slice(l,c);h===a-1?t.writeString(1,u):t.writeString(2,u)}return}if(t.writeString(301,r??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const o=Math.ceil(e.length/250);for(let a=0;a<o;a++){const h=a*250,l=h+250,c=e.slice(h,l);a===o-1?t.writeString(302,c):t.writeString(303,c)}t.writeString(304,"ACVALUE_END")}};Er.typeName="Table";let Mn=Er;const le=new O,ws=new k,pe=class pe extends J{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new m,new m,new m,new m]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get area(){return new V(pe.boundaryPointsFromVertices(this._vertices),!0).area}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new C().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subMoveGripPointsAt(t,e){return Oi(t,e,this._vertices),this}subGetOsnapPoints(t,e,i,r){const s=[this._vertices[0],this._vertices[1],this._vertices[3],this._vertices[2]];hr(s,!0,t,e,r)}transformBy(t){return this._vertices.forEach(e=>e.applyMatrix4(t)),this._elevation=this._vertices[0].z,this}subWorldDraw(t){const e=new V(pe.boundaryPointsFromVertices(this._vertices),!0),i=new Tt;i.add(e);const r=t.subEntityTraits;return r.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),t.writeDouble(38,this.elevation),t.writeDouble(39,this.thickness),t.writePoint3d(10,this.getPointAt(0)),t.writePoint3d(11,this.getPointAt(1)),t.writePoint3d(12,this.getPointAt(2)),t.writePoint3d(13,this.getPointAt(3)),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:ut.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Ni(this.collectBoundary2d(),!0,t)}collectBoundary2d(){return pe.boundaryPointsFromVertices(this._vertices)}static boundaryPointsFromVertices(t){const e=t[0],i=t[1],r=t[2],s=t[3];return[new P(e.x,e.y),new P(i.x,i.y),new P(s.x,s.y),new P(r.x,r.y)]}};pe.typeName="Trace";let En=pe;class Gt extends Error{constructor(t="Unexpected end of buffer."){super(t),this.name="AcDbProxyGraphicEndOfBufferError"}}function Ca(n){return n instanceof ArrayBuffer?new Uint8Array(n):n}class dt{constructor(t,e=4){this._index=0,this._buffer=Ca(t),this._align=e}get index(){return this._index}get hasData(){return this._index<this._buffer.length}alignIndex(t){const e=t%this._align;return e?t+this._align-e:t}readStruct(t){if(!this.hasData)throw new Gt;const e=[];let i=0;for(const r of t){const s=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index+i,r);if(r===8)e.push(s.getFloat64(0,!0));else if(r===4)e.push(s.getUint32(0,!0));else throw new Error(`Unsupported struct size: ${r}`);i+=r}return this._index=this.alignIndex(this._index+i),e}readFloat(){return this.readStruct([8])[0]}readLong(){return this.readStruct([4])[0]}readSignedLong(){if(!this.hasData)throw new Gt;const e=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index,4).getInt32(0,!0);return this._index=this.alignIndex(this._index+4),e}readVertex(){return this.readStruct([8,8,8])}readPaddedString(t="utf-8"){const e=this._buffer;for(let i=this._index;i<e.length;i++)if(e[i]===0){const r=this._index;this._index=this.alignIndex(i+1);const s=e.subarray(r,i);return new TextDecoder(t).decode(s)}throw new Gt("Did not detect terminating zero byte.")}readPaddedUnicodeString(){const t=this._buffer;for(let e=this._index;e<t.length;e+=2)if(e+1<t.length&&t[e]===0&&t[e+1]===0){const i=this._index;this._index=this.alignIndex(e+2);const r=t.subarray(i,e);return new TextDecoder("utf-16le").decode(r)}throw new Gt("Did not detect terminating zero bytes.")}}class Oa{constructor(t,e="AC1015",i="cp1252"){this._bitIndex=0,this._buffer=Ca(t),this.dxfversion=e,this.encoding=i}get hasData(){return this._bitIndex>>3<this._buffer.length}readBit(){const t=this._bitIndex;this._bitIndex+=1;const e=t>>3;if(e>=this._buffer.length)throw new Gt;return this._buffer[e]&128>>(t&7)?1:0}readBits(t){const e=this._bitIndex,i=e+t;if(i-1>>3>=this._buffer.length)throw new Gt;this._bitIndex=i;let r=128>>(e&7),s=e>>3,o=0,a=this._buffer[s];for(;t>0;)o<<=1,a&r&&(o|=1),t-=1,r>>=1,!r&&t&&(r=128,s+=1,a=this._buffer[s]);return o}readUnsignedByte(){return this.readBits(8)}readSignedByte(){const t=this.readBits(8);return t&128?-((~t&255)+1):t}readAlignedBytes(t){const e=this._bitIndex>>3,i=e+t;if(i>this._buffer.length)throw new Gt;return this._bitIndex+=t<<3,this._buffer.subarray(e,i)}readUnsignedShort(){if(this._bitIndex&7){const e=this.readBits(8);return(this.readBits(8)<<8)+e}const t=this.readAlignedBytes(2);return t[1]<<8|t[0]}readSignedShort(){const t=this.readUnsignedShort();return t&32768?-((~t&65535)+1):t}readUnsignedLong(){if(this._bitIndex&7){const e=this.readBits(8),i=this.readBits(8),r=this.readBits(8);return(this.readBits(8)<<24)+(r<<16)+(i<<8)+e}const t=this.readAlignedBytes(4);return(t[3]<<24)+(t[2]<<16)+(t[1]<<8)+t[0]}readSignedLong(){const t=this.readUnsignedLong();return t&2147483648?-((~t&4294967295)+1):t}readFloat(){if(this._bitIndex&7){const i=new Uint8Array(8);for(let r=0;r<8;r++)i[r]=this.readBits(8);return new DataView(i.buffer).getFloat64(0,!0)}const t=this.readAlignedBytes(8),e=new Uint8Array(t);return new DataView(e.buffer).getFloat64(0,!0)}readRawDouble(t=1){return t===1?this.readFloat():Array.from({length:t},()=>this.readFloat())}readBitShort(t=1){const e=()=>{const i=this.readBits(2);return i===0?this.readSignedShort():i===1?this.readUnsignedByte():i===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitLong(t=1){const e=()=>{const i=this.readBits(2);return i===0?this.readSignedLong():i===1?this.readUnsignedByte():i===2?0:256};return t===1?e():Array.from({length:t},()=>e())}readBitDouble(t=1){const e=()=>{const i=this.readBits(2);return i===0?this.readFloat():i===1?1:0};return t===1?e():Array.from({length:t},()=>e())}readBitDoubleDefault(t=1,e=0){const i=new Uint8Array(8);new DataView(i.buffer).setFloat64(0,e,!0);const r=()=>{const s=this.readBits(2);if(s===0)return e;if(s===1){const o=new Uint8Array(i);return o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}if(s===2){const o=new Uint8Array(i);return o[4]=this.readUnsignedByte(),o[5]=this.readUnsignedByte(),o[0]=this.readUnsignedByte(),o[1]=this.readUnsignedByte(),o[2]=this.readUnsignedByte(),o[3]=this.readUnsignedByte(),new DataView(o.buffer).getFloat64(0,!0)}return this.readFloat()};return t===1?r():Array.from({length:t},()=>r())}}function ka(n){return Array.from(n,t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()}function fu(n){const t=n.reduce((r,s)=>r+Math.floor(s.length/2),0),e=new Uint8Array(t);let i=0;for(const r of n)for(let s=0;s<r.length;s+=2)e[i++]=parseInt(r.slice(s,s+2),16);return e}const yu=127;var Ya=(n=>(n[n.Extents=1]="Extents",n[n.Circle=2]="Circle",n[n.Circle3P=3]="Circle3P",n[n.CircularArc=4]="CircularArc",n[n.CircularArc3P=5]="CircularArc3P",n[n.Polyline=6]="Polyline",n[n.Polygon=7]="Polygon",n[n.Mesh=8]="Mesh",n[n.Shell=9]="Shell",n[n.Text=10]="Text",n[n.Text2=11]="Text2",n[n.Xline=12]="Xline",n[n.Ray=13]="Ray",n[n.AttributeColor=14]="AttributeColor",n[n.AttributeLayer=16]="AttributeLayer",n[n.AttributeLinetype=18]="AttributeLinetype",n[n.AttributeMarker=19]="AttributeMarker",n[n.AttributeFill=20]="AttributeFill",n[n.AttributeTrueColor=22]="AttributeTrueColor",n[n.AttributeLineweight=23]="AttributeLineweight",n[n.AttributeLtscale=24]="AttributeLtscale",n[n.AttributeThickness=25]="AttributeThickness",n[n.PushMatrix=29]="PushMatrix",n[n.PopMatrix=31]="PopMatrix",n[n.PolylineWithNormals=32]="PolylineWithNormals",n[n.LwPolyline=33]="LwPolyline",n[n.UnicodeText=36]="UnicodeText",n[n.UnicodeText2=38]="UnicodeText2",n[n.EllipticArc=44]="EllipticArc",n))(Ya||{});const qt=x.Z_AXIS,mu=529;function _u(n){const t=n>>24&255;return t===Yi?{rgb:n&16777215}:t===ki?{colorIndex:256}:t===Ve?{colorIndex:0}:t===Xi?{colorIndex:n&255}:{colorIndex:n&255}}function Ki(n){return new x(n.x,n.y,n.z??0)}function Zi(n){return new m(n.x,n.y,n.z??0)}function bs(n){return{x:n[0],y:n[1],z:n[2]}}class In{constructor(t,e={}){this._index=8,this._colorIndex=256,this._layer="0",this._linetype=Z,this._lineweight=exports.AcGiLineWeight.ByLineWeightDefault,this._ltscale=1,this._thickness=0,this._fill=!1,this._layers=[],this._linetypes=[],this._matrices=[],this._buffer=t,this._database=e.database,this._dxfversion=e.dxfversion??"AC1015",this._encoding=e.encoding??(this._dxfversion<"AC1024"?"windows-1252":"utf-8"),this._layer=e.defaultLayer??"0",this._database&&(this._database.tables.layerTable.newIterator().toArray().forEach(i=>this._layers.push(i.name)),this._database.tables.linetypeTable.newIterator().toArray().forEach(i=>this._linetypes.push(i.name)))}get extents(){return this._extents}scanExtents(){var i;const t=this._buffer;let e=this._index;for(;e<t.length;){const r=new DataView(t.buffer,t.byteOffset+e,8),s=r.getUint32(0,!0),o=r.getUint32(4,!0);if(s<8)break;if(o===1){const a=t.subarray(e+8,e+s);return this.readExtents(a),((i=this._extents)==null?void 0:i.length)===2?[this._extents[0],this._extents[1]]:void 0}e+=s}}worldDraw(t){const e=[],i=t.subEntityTraits,r={color:i.color.clone(),lineType:i.lineType,lineTypeScale:i.lineTypeScale,lineWeight:i.lineWeight,layer:i.layer,thickness:i.thickness},s=this._buffer;let o=this._index;for(;o<s.length;){const a=new DataView(s.buffer,s.byteOffset+o,8),h=a.getUint32(0,!0),l=a.getUint32(4,!0);if(h<8)break;const c=s.subarray(o+8,o+h);this.dispatchChunk(t,e,l,c),l!==20&&(this._fill=!1),o+=h}if(i.color=r.color,i.lineType=r.lineType,i.lineTypeScale=r.lineTypeScale,i.lineWeight=r.lineWeight,i.layer=r.layer,i.thickness=r.thickness,e.length!==0)return t.group(e)}dispatchChunk(t,e,i,r){switch(i){case 1:this.readExtents(r);break;case 2:this.drawCircle(t,e,r);break;case 3:this.drawCircle3P(t,e,r);break;case 4:this.drawCircularArc(t,e,r);break;case 5:this.drawCircularArc3P(t,e,r);break;case 44:this.drawEllipticArc(t,e,r);break;case 6:this.drawPolyline(t,e,r,!1);break;case 32:this.drawPolyline(t,e,r,!0);break;case 7:this.drawPolygon(t,e,r);break;case 33:this.drawLwPolyline(t,e,r);break;case 9:this.drawShell(t,e,r);break;case 10:this.drawText(t,e,r,!1);break;case 36:this.drawText(t,e,r,!0);break;case 11:this.drawText2(t,e,r,!1);break;case 38:this.drawText2(t,e,r,!0);break;case 12:this.drawXline(t,e,r,!1);break;case 13:this.drawXline(t,e,r,!0);break;case 14:this.readAttributeColor(r);break;case 16:this.readAttributeLayer(r);break;case 18:this.readAttributeLinetype(r);break;case 20:this.readAttributeFill(r);break;case 22:this.readAttributeTrueColor(r);break;case 23:this.readAttributeLineweight(r);break;case 24:this.readAttributeLtscale(r);break;case 25:this.readAttributeThickness(r);break;case 29:this.pushMatrix(r);break;case 31:this.popMatrix();break}}applyTraits(t){const e=t.subEntityTraits;e.layer=this._layer,e.lineTypeScale=this._ltscale,e.thickness=this._thickness,e.lineWeight=this._lineweight,this._rgbColor!=null?e.color=new k(exports.AcCmColorMethod.ByColor,this._rgbColor):this._colorIndex===256?e.color=new k(exports.AcCmColorMethod.ByLayer):this._colorIndex===0?e.color=new k(exports.AcCmColorMethod.ByBlock):this._colorIndex===7?e.color=new k(exports.AcCmColorMethod.ByACI,7):e.color=new k(exports.AcCmColorMethod.ByACI,this._colorIndex),e.lineType={name:this._linetype,type:this.resolveLineStyleType(),standardFlag:0,description:"",totalPatternLength:0}}resolveLineStyleType(){return this._linetype===Z?"ByLayer":this._linetype===St?"ByBlock":"UserSpecified"}transformPoint(t){const e=Array.isArray(t)?bs(t):t,i=Zi(e);return this._matrices.length>0&&i.applyMatrix4(this._matrices[this._matrices.length-1]),i}transformVector(t){const e=Array.isArray(t)?bs(t):t,i=Ki(e);return this._matrices.length>0&&i.transformDirection(this._matrices[this._matrices.length-1]),!Number.isFinite(i.lengthSq())||i.lengthSq()<1e-24?qt.clone():i.normalize()}pushEntity(t,e){e&&t.push(e)}readExtents(t){const e=new dt(t),i=e.readVertex(),r=e.readVertex();this._extents=[new m(i[0],i[1],i[2]),new m(r[0],r[1],r[2])]}readAttributeColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);this._rgbColor=void 0,this._colorIndex=e>256||e<0?256:e}readAttributeLayer(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e<this._layers.length&&(this._layer=this._layers[e])}readAttributeLinetype(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e+2<this._linetypes.length?this._linetype=this._linetypes[e+2]:e===32766?this._linetype=St:this._linetype=Z}readAttributeFill(t){this._fill=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0)!==0}readAttributeTrueColor(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0),i=_u(e);this._rgbColor=i.rgb,i.colorIndex!=null&&(this._colorIndex=i.colorIndex)}readAttributeLineweight(t){const e=new DataView(t.buffer,t.byteOffset,4).getUint32(0,!0);e>mu?this._lineweight=e-4294967296:this._lineweight=e}readAttributeLtscale(t){this._ltscale=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}readAttributeThickness(t){this._thickness=new DataView(t.buffer,t.byteOffset,8).getFloat64(0,!0)}pushMatrix(t){const e=new Float64Array(t.buffer,t.byteOffset,16),i=new O().fromArray(Array.from(e));i.transpose(),this._matrices.push(i)}popMatrix(){this._matrices.length>0&&this._matrices.pop()}loadVertices(t,e){const i=new dt(t);let r=i.readLong();e&&(r+=1);const s=[];for(;r>0;){const[a,h,l]=i.readVertex();s.push(this.transformPoint({x:a,y:h,z:l})),r-=1}let o=qt;return e&&s.length>0&&(o=Ki(s.pop())),{vertices:s,normal:o}}drawCircle(t,e,i){const r=new dt(i),s=r.readVertex(),o=r.readFloat(),a=this.transformVector(r.readVertex());let h=Zi({x:s[0],y:s[1],z:s[2]});a.equals(qt)||(h=xe(h,a)),h=this.transformPoint(h);const l=Be(a),c=new bt(en(h,a),o,0,B,a,l);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircle3P(t,e,i){const r=new dt(i),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),h=bt.computeCenterPoint(s,o,a);if(!h)return;const l=h.distanceTo(s),c=new bt(h,l,0,B,qt);this.applyTraits(t),this.pushEntity(e,t.circularArc(c))}drawCircularArc(t,e,i){const r=new dt(i),s=r.readVertex(),o=r.readFloat(),a=r.readVertex(),h=r.readVertex(),l=r.readFloat(),c=this.transformVector(a),u=Zi({x:s[0],y:s[1],z:s[2]}),g=Ki({x:h[0],y:h[1],z:h[2]});this._matrices.length>0&&g.transformDirection(this._matrices[this._matrices.length-1]);const d=Number.isFinite(g.lengthSq())&&g.lengthSq()>=1e-24?g.normalize():Be(c),p=0,f=l,y=new bt(this.transformPoint(u),o,p,f,c,d);this.applyTraits(t),this.pushEntity(e,t.circularArc(y))}drawCircularArc3P(t,e,i){const r=new dt(i),s=this.transformPoint(r.readVertex()),o=this.transformPoint(r.readVertex()),a=this.transformPoint(r.readVertex()),h=bt.computeCenterPoint(s,a,o);if(!h)return;const l=h.distanceTo(s),c=It(h,s,qt),u=It(h,a,qt),g=new bt(h,l,c,u,qt);this.applyTraits(t),this.pushEntity(e,t.circularArc(g))}drawEllipticArc(t,e,i){const r=new dt(i),s=this.transformPoint(r.readVertex()),o=this.transformVector(r.readVertex()),a=r.readFloat(),h=r.readFloat(),l=r.readFloat(),c=r.readFloat(),u=r.readFloat(),g=en({x:Math.cos(u)*a,y:Math.sin(u)*a,z:0},o),d=new nr(s,o,g,a,h,l,c);this.applyTraits(t),this.pushEntity(e,t.ellipticalArc(d))}drawPolyline(t,e,i,r){var o,a;const{vertices:s}=this.loadVertices(i,r);if(s.length!==0){if(s.length===1){this.applyTraits(t);const h=((o=this._database)==null?void 0:o.pdmode)??0,l=((a=this._database)==null?void 0:a.pdsize)??0;this.pushEntity(e,t.point(s[0],{displayMode:h,displaySize:l}));return}this.applyTraits(t),this.pushEntity(e,t.lines(s))}}drawPolygon(t,e,i){const{vertices:r}=this.loadVertices(i,!1);if(r.length<2)return;if(this._fill){const o=new V(r.map(l=>({x:l.x,y:l.y})),!0),a=new Tt;a.add(o);const h=t.subEntityTraits;h.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},h.drawOrder=-1,this.applyTraits(t),this.pushEntity(e,t.area(a));return}const s=[...r,r[0]];this.applyTraits(t),this.pushEntity(e,t.lines(s))}drawLwPolyline(t,e,i){const r=new Oa(i,this._dxfversion,this._encoding);let s=0,o=!1;r.readUnsignedLong();const a=r.readBitShort();a&8&&(s=r.readBitDouble()),a&512&&(o=!0);const h=r.readBitLong();if(h<=0)return;const l=a&16?r.readBitLong():0;this._dxfversion>="AC1024"&&(a&1024&&r.readBitLong(),a&32&&r.readBitLong());const c=r.readRawDouble(2),u=[this.transformPoint({x:c[0],y:c[1],z:s})];let g=c;for(let d=1;d<h;d++){const p=r.readBitDoubleDefault(1,g[0]),f=r.readBitDoubleDefault(1,g[1]);g=[p,f],u.push(this.transformPoint({x:p,y:f,z:s}))}for(let d=0;d<l;d++)r.readBitDouble();o&&u.length>1&&u.push(u[0].clone()),this.applyTraits(t),this.pushEntity(e,t.lines(u))}drawShell(t,e,i){const r=new dt(i),s=r.readLong(),o=[];for(let c=0;c<s;c++){const[u,g,d]=r.readVertex();o.push(this.transformPoint({x:u,y:g,z:d}))}const a=r.readLong(),h=[];let l=0;for(;l<a;){const c=Math.abs(r.readSignedLong());l+=1+c;const u=[];for(let d=0;d<c;d++)u.push(r.readLong());const g=u.map(d=>o[d]).filter(Boolean);if(g.length>=3)for(let d=0;d<g.length;d++)h.push(g[d]),h.push(g[(d+1)%g.length])}h.length!==0&&(this.applyTraits(t),this.pushEntity(e,t.lines(h)))}drawText(t,e,i,r){const s=new dt(i),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),h=this.transformVector(s.readVertex()),[l,c,u]=s.readStruct([8,8,8]),g=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:h,text:g,height:l,widthFactor:c,obliqueAngle:u})}drawText2(t,e,i,r){const s=new dt(i),o=this.transformPoint(s.readVertex()),a=this.transformVector(s.readVertex()),h=this.transformVector(s.readVertex()),l=r?s.readPaddedUnicodeString():s.readPaddedString(this._encoding);s.readSignedLong(),s.readSignedLong();const[c,u,g]=s.readStruct([8,8,8]);s.readFloat(),this.drawTextPrimitive(t,e,{insert:o,normal:a,textDirection:h,text:l,height:c,widthFactor:u,obliqueAngle:g})}drawTextPrimitive(t,e,i){const r=Math.atan2(i.textDirection.y,i.textDirection.x),s={text:i.text,height:i.height,width:1/0,widthFactor:i.widthFactor,position:i.insert,rotation:r*180/Math.PI,drawingDirection:exports.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:exports.AcGiMTextAttachmentPoint.BaselineLeft},o={name:W,standardFlag:0,fixedTextHeight:0,widthFactor:i.widthFactor,obliqueAngle:i.obliqueAngle*180/Math.PI,textGenerationFlag:0,lastHeight:i.height,font:"txt",bigFont:""};this.applyTraits(t),this.pushEntity(e,t.mtext(s,o))}drawXline(t,e,i,r){const s=new dt(i),o=this.transformPoint(s.readVertex()),a=this.transformPoint(s.readVertex()),h=new x().subVectors(a,o);if(h.lengthSq()===0)return;const l=1e6,c=r?o.clone().add(h.normalize().multiplyScalar(l)):o.clone().sub(h.normalize().multiplyScalar(l)),u=a.clone().add(h.normalize().multiplyScalar(l));this.applyTraits(t),this.pushEntity(e,t.lines([c,u]))}}function Xa(n,t){if(!(t!=null&&t.length))return;const e=new Uint8Array(t.reduce((r,s)=>r+Math.floor(s.length/2),0));let i=0;for(const r of t)for(let s=0;s<r.length;s+=2)e[i++]=parseInt(r.slice(s,s+2),16);return n!=null&&n>0&&e.length>=n?e.subarray(0,n):e}const Ir=class Ir extends q{constructor(){super(...arguments),this._originalDxfName="",this._originalClassName="",this._applicationName="",this._proxyEntityClassId=0,this._graphicsMetafileType=0,this._entityOrigins=[]}get dxfTypeName(){return"ACAD_PROXY_ENTITY"}get originalDxfName(){return this._originalDxfName}set originalDxfName(t){this._originalDxfName=t}get originalClassName(){return this._originalClassName}set originalClassName(t){this._originalClassName=t}get applicationName(){return this._applicationName}set applicationName(t){this._applicationName=t}get proxyEntityClassId(){return this._proxyEntityClassId}set proxyEntityClassId(t){this._proxyEntityClassId=t}get graphicsMetafileType(){return this._graphicsMetafileType}set graphicsMetafileType(t){this._graphicsMetafileType=t}get proxyGraphic(){return this._proxyGraphic}setProxyGraphic(t){this._proxyGraphic=t?new Uint8Array(t):void 0}get entityOrigins(){return this._entityOrigins}setEntityOrigins(t){this._entityOrigins=t.map(e=>new m(e.x,e.y,e.z))}get geometricExtents(){const t=this._proxyGraphic;if(!(t!=null&&t.length))return new C;const i=new In(t,{database:this.database,defaultLayer:this.layer}).scanExtents();return i?new C().setFromPoints(i):new C}subGetGripPoints(){if(this._entityOrigins.length>0)return[...this._entityOrigins];const t=this.geometricExtents;return t.isEmpty()?[]:[new m(t.min.x,t.min.y,t.min.z),new m(t.max.x,t.max.y,t.max.z)]}subMoveGripPointsAt(t,e){return this._entityOrigins.length>0?(Oi(t,e,this._entityOrigins),this):this.geometricExtents.isEmpty()?this:(K(t,r=>{r===0&&this.transformBy(O.makeTranslation(e))}),this)}transformBy(t){return this._entityOrigins.forEach(e=>e.applyMatrix4(t)),this}subWorldDraw(t){const e=this._proxyGraphic;return e!=null&&e.length?new In(e,{database:this.database,defaultLayer:this.layer}).worldDraw(t):void 0}dxfOutFields(t){var e;if(super.dxfOutFields(t),t.writeSubclassMarker("AcDbProxyEntity"),t.writeString(1,this._originalDxfName),this._originalClassName&&t.writeString(3,this._originalClassName),this._applicationName&&t.writeString(1001,this._applicationName),t.writeInt32(90,this._proxyEntityClassId),t.writeInt32(91,this._graphicsMetafileType),this._entityOrigins.length>0&&(t.writeInt32(92,this._entityOrigins.length),this._entityOrigins.forEach(i=>{t.writePoint3d(10,i)})),(e=this._proxyGraphic)!=null&&e.length){t.writeInt32(160,this._proxyGraphic.length);let i=0;for(;i<this._proxyGraphic.length;){const r=this._proxyGraphic.subarray(i,i+127);t.writeString(310,ka(r)),i+=127}}return this}loadProxyGraphicFromDxf(t,e){const i=Xa(t,e);i&&this.setProxyGraphic(i)}};Ir.typeName="ProxyEntity";let Tn=Ir;const Tr=class Tr extends q{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new m}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new C().expandByPoint(this._geo)}subGetGripPoints(){return[this._geo]}subMoveGripPointsAt(t,e){return kt(t,e,this._geo),this}subGetOsnapPoints(t,e,i,r){t===w.Node&&r.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbPoint"),t.writePoint3d(10,this.position),this}};Tr.typeName="Point";let Cn=Tr;var Na=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(Na||{}),Ba=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Ba||{});const Cr=class Cr extends q{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new m,this._scale=new G(1,1),this._rotation=0,this._imageSize=new P,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get imageSize(){return this._imageSize}set imageSize(t){this._imageSize.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new C;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subMoveGripPointsAt(t,e){return K(t,i=>{this.isClipped&&this._clipBoundary.length>3?this.moveClippedBoundaryGripAt(i,e):this.moveUnclippedGripAt(i,e)}),this}subGetOsnapPoints(t,e,i,r){if(t===w.Insertion){r.push(this._position);return}const s=this.boundaryPath();if(s.length===0)return;let o=s;if(s.length>1){const a=s[0],h=s[s.length-1];a.x===h.x&&a.y===h.y&&(a.z||0)===(h.z||0)&&(o=s.slice(0,-1))}if(t===w.EndPoint){r.push(...o);return}hr(o,!0,t,e,r)}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}transformBy(t){const e=this._width*this._scale.x,i=this._height*this._scale.y,r=new x(e*Math.cos(this._rotation),e*Math.sin(this._rotation),0),s=new x(-i*Math.sin(this._rotation),i*Math.cos(this._rotation),0),o=this._position.clone(),a=this._position.clone().add(r),h=this._position.clone().add(s);o.applyMatrix4(t),a.applyMatrix4(t),h.applyMatrix4(t);const l=new x(a).sub(o),c=new x(h).sub(o);return this._position.copy(o),this._rotation=Math.atan2(l.y,l.x),this._width=l.length(),this._height=c.length(),this._scale.set(1,1),this}moveUnclippedGripAt(t,e){const i=this._position.x,r=this._position.y,s=this._width,o=this._height;switch(t){case 0:this._position.add(e);break;case 1:{const a=i,h=r+o,l=i+s+e.x,c=r+e.y;this._position.x=a,this._position.y=c,this._width=l-a,this._height=h-c;break}case 2:{const a=i+s+e.x,h=r+o+e.y;this._width=a-i,this._height=h-r;break}case 3:{const a=i+s,h=r,l=i+e.x,c=r+o+e.y;this._position.x=l,this._position.y=h,this._width=a-l,this._height=c-h;break}}}moveClippedBoundaryGripAt(t,e){if(t<0||t>=this._clipBoundary.length)return;const i=this._width,r=this._height,s=new Q;s.setFromPoints(this._clipBoundary);const o=new P;o.setX(this._position.x-s.min.x*i),o.setY(this._position.y-s.min.y*r);const a=this._clipBoundary[t],h=a.x*i+o.x+e.x,l=a.y*r+o.y+e.y;a.x=(h-o.x)/i,a.y=(l-o.y)/r}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,i=this._height,r=new Q;r.setFromPoints(this._clipBoundary);const s=new P;s.setX(this._position.x-r.min.x*e),s.setY(this._position.y-r.min.y*i),this._clipBoundary.forEach(o=>{const a=o.x*e+s.x,h=o.y*i+s.y;t.push(new m(a,h,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){vs.copy(t[1]);for(let e=1;e<4;e++)ni.copy(t[e]),ni.rotateAround(vs,this._rotation),t[e].setX(ni.x),t[e].setY(ni.y)}t.push(t[0])}return t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImage"),t.writePoint3d(10,this.position);const e=this.width*this.scale.x,i=this.height*this.scale.y,r=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:i},s=r.x>0?e/r.x:e,o=r.y>0?i/r.y:i,a=Math.cos(this._rotation),h=Math.sin(this._rotation);t.writePoint3d(11,{x:s*a,y:s*h,z:0}),t.writePoint3d(12,{x:-o*h,y:o*a,z:0}),t.writePoint2d(13,r),t.writeObjectId(340,this.imageDefId);const l=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,l),t.writeInt16(280,this.isClipped?1:0),t.writeInt16(281,this.brightness),t.writeInt16(282,this.contrast),t.writeInt16(283,this.fade),t.writeInt16(71,this.clipBoundaryType),this.isClipped){t.writeInt16(91,this.clipBoundary.length);for(const c of this.clipBoundary)t.writePoint2d(14,c)}return this}};Cr.typeName="RasterImage";let yi=Cr;const vs=new P,ni=new P,Mi=class Mi extends J{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new m,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new C;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return kt(t,e,this.basePoint),this}subGetOsnapPoints(t,e,i,r){const s=this.basePoint;if(t===w.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ct(s,s.clone().add(o));switch(t){case w.Nearest:{const h=a.project(e),c=new x(h).sub(s).dot(o);r.push(c<0?s:h);break}case w.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRay"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,i=this.unitDir,r=Math.hypot(i.x,i.y);return r<=1e-9||(i.x*(t.y-e.y)-i.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=po(this.basePoint,this.unitDir,t);if(!e)return null;const i=new Mi;return i.basePoint=e,i.unitDir=this.unitDir.clone(),i}};Mi.typeName="Ray";let On=Mi;const Or=class Or extends q{get dxfTypeName(){return"SHAPE"}constructor(){super(),this._position=new m,this._size=1,this._name="",this._rotation=0,this._widthFactor=1,this._oblique=0,this._thickness=0,this._normal=new x(0,0,1),this._shapeNumber=0,this._styleName=""}get position(){return this._position}set position(t){this._position.copy(t)}get size(){return this._size}set size(t){this._size=t}get name(){return this._name}set name(t){this._name=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get normal(){return this._normal}set normal(t){this._normal.copy(t)}get shapeNumber(){return this._shapeNumber}set shapeNumber(t){this._shapeNumber=t}get styleId(){var e,i,r;const t=(r=(i=(e=this.database)==null?void 0:e.tables)==null?void 0:i.textStyleTable)==null?void 0:r.resolveAt(this._styleName);return(t==null?void 0:t.objectId)??""}set styleId(t){var i,r,s;const e=(s=(r=(i=this.database)==null?void 0:i.tables)==null?void 0:r.textStyleTable)==null?void 0:s.getIdAt(t);e&&(this._styleName=e.name)}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get isPlanar(){return!0}get geometricExtents(){const t=Math.abs(this._size)/2,e=new C;return e.expandByPoint(this._position),t>0&&(e.expandByPoint(new m(this._position.x-t,this._position.y-t,this._position.z)),e.expandByPoint(new m(this._position.x+t,this._position.y+t,this._position.z))),e}subGetGripPoints(){return[this._position]}subMoveGripPointsAt(t,e){return kt(t,e,this._position),this}subGetOsnapPoints(t,e,i,r){t===w.Insertion&&r.push(this._position)}transformBy(t){const e=new O().setFromExtrusionDirection(this._normal),i=new O().makeRotationZ(this._rotation),r=new O().multiplyMatrices(e,i),s=this._position.clone(),o=new m(this._widthFactor,0,0).applyMatrix4(r).add(s),a=new m(0,1,0).applyMatrix4(r).add(s),h=new m(0,0,1).applyMatrix4(r).add(s);s.applyMatrix4(t),o.applyMatrix4(t),a.applyMatrix4(t),h.applyMatrix4(t);const l=new x(o).sub(s),c=new x(a).sub(s),u=new x(h).sub(s);let g=new x().crossVectors(l,c);g.lengthSq()===0?g=this._normal.clone().transformDirection(t):g.normalize();const p=new O().setFromExtrusionDirection(g).clone().invert(),f=l.clone().applyMatrix4(p),y=c.length(),_=l.length();this._position.copy(s),this._normal.copy(g),_>0&&(this._rotation=Math.atan2(f.y,f.x)),y>0&&(this._size*=y,_>0&&(this._widthFactor*=_/y));const v=u.length();return v>0&&(this._thickness*=v),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"shape",properties:[{name:"name",type:"string",editable:!0,accessor:{get:()=>this.name,set:t=>{this.name=t}}},{name:"size",type:"float",editable:!0,accessor:{get:()=>this.size,set:t=>{this.size=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}},{name:"shapeNumber",type:"int",editable:!0,accessor:{get:()=>this.shapeNumber,set:t=>{this.shapeNumber=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t,e){const i=this.getTextStyle(),r=i?{...i,widthFactor:this.widthFactor,obliqueAngle:this.oblique*180/Math.PI}:void 0,s={name:this._name.trim()||void 0,shapeNumber:this._shapeNumber!==0?this._shapeNumber:void 0,size:this.size,position:this._position,rotation:this._rotation,directionVector:this._normal,widthFactor:this.widthFactor};return t.shape(s,r,e)}getTextStyle(){const t=this.styleName.trim();if(!t)return;const e=this.database.tables.textStyleTable.resolveAt(t);return e==null?void 0:e.textStyle}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbShape"),t.writePoint3d(10,this.position),t.writeDouble(40,this.size),t.writeString(2,this.name),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeDouble(39,this.thickness),this._styleName&&t.writeString(3,this._styleName),t.writeVector3d(210,this.normal),this}};Or.typeName="Shape";let kn=Or;const kr=class kr extends q{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new m,this._height=0,this._width=0,this._viewCenter=new m,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){const t=this._width/2,e=this._height/2,i=new C;return i.expandByPoint(new m(this._centerPoint.x-t,this._centerPoint.y-e,this._centerPoint.z)),i.expandByPoint(new m(this._centerPoint.x+t,this._centerPoint.y+e,this._centerPoint.z)),i}subGetGripPoints(){const t=new Array,e=this._width/2,i=this._height/2,r=this._centerPoint.z;return t.push(this._centerPoint),(e>0||i>0)&&t.push(new m(this._centerPoint.x-e,this._centerPoint.y-i,r),new m(this._centerPoint.x+e,this._centerPoint.y-i,r),new m(this._centerPoint.x+e,this._centerPoint.y+i,r),new m(this._centerPoint.x-e,this._centerPoint.y+i,r)),t}subMoveGripPointsAt(t,e){return K(t,i=>{this.moveGripAt(i,e)}),this}transformBy(t){const e=this._centerPoint.clone(),i=this._centerPoint.clone().add(new x(this._width,0,0)),r=this._centerPoint.clone().add(new x(0,this._height,0));e.applyMatrix4(t),i.applyMatrix4(t),r.applyMatrix4(t);const s=new x(i).sub(e),o=new x(r).sub(e),a=this._height!==0?o.length()/this._height:1;return this._centerPoint.copy(e),this._width=s.length(),this._height=o.length(),this._viewHeight*=a,this}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Xo;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const i=[];return i.push(e.lines([new m(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new m(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),i.push(e.lines([new m(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new m(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new m(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new m(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new m(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new m(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),i}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewport"),t.writePoint3d(10,this.centerPoint),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writePoint3d(12,this.viewCenter),t.writeDouble(45,this.viewHeight),t.writeInt32(69,this.number),this}moveGripAt(t,e){switch(t){case 0:this._centerPoint.add(e);break;case 1:case 2:case 3:case 4:{const i=this.width/2,r=this.height/2,s=this._centerPoint.x,o=this._centerPoint.y,a={1:{x:s-i,y:o-r},2:{x:s+i,y:o-r},3:{x:s+i,y:o+r},4:{x:s-i,y:o+r}},h=t===1?3:t===2?4:t===3?1:2,l=a[t],c=a[h];l.x+=e.x,l.y+=e.y,this._centerPoint.x=(l.x+c.x)/2,this._centerPoint.y=(l.y+c.y)/2,this._centerPoint.z=(this._centerPoint.z??0)+(e.z??0),this.width=Math.abs(c.x-l.x),this.height=Math.abs(c.y-l.y);break}}}};kr.typeName="Viewport";let Yn=kr;const Yr=class Yr extends yi{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),i=new Tt;return i.add(new V(e)),t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),this}};Yr.typeName="Wipeout";let Xn=Yr;const Ei=class Ei extends J{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new m,this._unitDir=new x}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get area(){return 0}get geometricExtents(){const t=new C;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subMoveGripPointsAt(t,e){return kt(t,e,this.basePoint),this}subGetOsnapPoints(t,e,i,r){const s=this.basePoint;if(t===w.EndPoint){r.push(s);return}const o=this.unitDir.clone();if(o.lengthSq()===0)return;o.normalize();const a=new Ct(s,s.clone().add(o));switch(t){case w.Nearest:r.push(a.project(e));break;case w.Perpendicular:r.push(a.perpPoint(e));break}}transformBy(t){return this._basePoint.applyMatrix4(t),this._unitDir.transformDirection(t),this}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXline"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.basePoint,i=this.unitDir,r=Math.hypot(i.x,i.y);return r<=1e-9||(i.x*(t.y-e.y)-i.y*(t.x-e.x))/r>=0?1:-1}createOffsetCurve(t){const e=po(this.basePoint,this.unitDir,t);if(!e)return null;const i=new Ei;return i.basePoint=e,i.unitDir=this.unitDir.clone(),i}};Ei.typeName="Xline";let Nn=Ei;class Ra{constructor(t){this.position=new m(t.x,t.y,t.z||0)}}const Xr=class Xr extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i,r=!1,s=!1){super(),this._mCount=t,this._nCount=e,this._closedM=r,this._closedN=s,this._vertices=i.map(o=>new Ra(o))}get mCount(){return this._mCount}get nCount(){return this._nCount}get closedM(){return this._closedM}get closedN(){return this._closedN}get closed(){return this._closedM}get area(){return 0}set closed(t){this._closedM=t}get numberOfVertices(){return this._vertices.length}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getVertexAtMN(t,e){const i=t*this._nCount+e;return this.getVertexAt(i)}get geometricExtents(){if(this._vertices.length===0)return new C(new m(0,0,0),new m(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),i=Math.min(i,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new C(new m(t,e,i),new m(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return K(t,i=>{const r=this._vertices[i];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"mCount",type:"float",editable:!1,accessor:{get:()=>this._mCount}},{name:"nCount",type:"float",editable:!1,accessor:{get:()=>this._nCount}},{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}}]},{groupName:"others",properties:[{name:"closedM",type:"boolean",editable:!0,accessor:{get:()=>this._closedM,set:t=>{this._closedM=t}}},{name:"closedN",type:"boolean",editable:!0,accessor:{get:()=>this._closedN,set:t=>{this._closedN=t}}}]}]}}subWorldDraw(t){const e=[];for(let i=0;i<this._mCount;i++)for(let r=0;r<this._nCount;r++){const s=this.getVertexAtMN(i,r);let o=r+1;if(o>=this._nCount)if(this._closedN)o=0;else continue;const a=this.getVertexAtMN(i,o);e.push(s.position),e.push(a.position)}for(let i=0;i<this._nCount;i++)for(let r=0;r<this._mCount;r++){const s=this.getVertexAtMN(r,i);let o=r+1;if(o>=this._mCount)if(this._closedM)o=0;else continue;const a=this.getVertexAtMN(o,i);e.push(s.position),e.push(a.position)}return t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolygonMesh");let e=16;return this._closedM&&(e|=1),this._closedN&&(e|=32),t.writeInt16(66,1),t.writeInt16(70,e),t.writeInt32(71,this._mCount),t.writeInt32(72,this._nCount),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;i++){const r=this.getVertexAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolygonMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,16)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectBoundary2d();return e.length<2?1:ut.from2dPoints(e,this.isBoundaryClosed()).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Ni(this.collectBoundary2d(),this.isBoundaryClosed(),t)}isBoundaryClosed(){return this._closedM&&this._closedN&&this._mCount>1&&this._nCount>1}collectBoundary2d(){const t=this._mCount,e=this._nCount;if(t<1||e<1)return[];const i=[],r=(s,o)=>{const a=this.getVertexAtMN(s,o).position;i.push(new P(a.x,a.y))};if(t===1){for(let s=0;s<e;s++)r(0,s);return i}if(e===1){for(let s=0;s<t;s++)r(s,0);return i}for(let s=0;s<e;s++)r(0,s);for(let s=1;s<t;s++)r(s,e-1);for(let s=e-2;s>=0;s--)r(t-1,s);for(let s=t-2;s>=1;s--)r(s,0);return i}};Xr.typeName="PolygonMesh";let Bn=Xr;class za{constructor(t){this.position=new m(t.x,t.y,t.z||0)}}class Fa{constructor(t){this.vertexIndices=t}}const Nr=class Nr extends J{get dxfTypeName(){return"POLYLINE"}constructor(t,e){super(),this._vertices=t.map(i=>new za(i)),this._faces=e.map(i=>new Fa(i))}get numberOfVertices(){return this._vertices.length}get numberOfFaces(){return this._faces.length}get closed(){return!1}get area(){return 0}set closed(t){}getVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error("Vertex index out of bounds");return this._vertices[t]}getFaceAt(t){if(t<0||t>=this._faces.length)throw new Error("Face index out of bounds");return this._faces[t]}get geometricExtents(){if(this._vertices.length===0)return new C(new m(0,0,0),new m(0,0,0));let t=Number.MAX_VALUE,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=-Number.MAX_VALUE;return this._vertices.forEach(a=>{t=Math.min(t,a.position.x),e=Math.min(e,a.position.y),i=Math.min(i,a.position.z),r=Math.max(r,a.position.x),s=Math.max(s,a.position.y),o=Math.max(o,a.position.z)}),new C(new m(t,e,i),new m(r,s,o))}subGetGripPoints(){const t=new Array;return this._vertices.forEach(e=>{t.push(e.position)}),t}subMoveGripPointsAt(t,e){return K(t,i=>{const r=this._vertices[i];r&&r.position.add(e)}),this}subGetOsnapPoints(t,e,i,r){switch(t){case w.EndPoint:this._vertices.forEach(s=>{r.push(s.position)});break}}transformBy(t){return this._vertices.forEach(e=>{e.position.applyMatrix4(t)}),this}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._vertices.map(t=>({x:t.position.x,y:t.position.y,z:t.position.z}))}},{name:"faces",type:"array",editable:!1,itemSchema:{properties:[{name:"vertexIndices",type:"array",editable:!1,itemSchema:{properties:[{name:"index",type:"int",editable:!1}]}}]},accessor:{get:()=>this._faces.map(t=>({vertexIndices:t.vertexIndices}))}}]}]}}subWorldDraw(t){const e=[];return this._faces.forEach(i=>{const r=[];if(i.vertexIndices.forEach(s=>{const o=Math.abs(s)-1;o>=0&&o<this._vertices.length&&r.push(this._vertices[o].position)}),r.length>=3)for(let s=0;s<r.length;s++){const o=r[s],a=r[(s+1)%r.length];e.push(o),e.push(a)}}),t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyFaceMesh");const e=64;return t.writeInt16(66,1),t.writeInt16(70,e),this}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;i++){const r=this.getVertexAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writePoint3d(10,r.position),t.writeInt16(70,64)}for(let i=0;i<this.numberOfFaces;i++){const r=this.getFaceAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDbPolyFaceMeshVertex"),t.writeInt16(70,128),r.vertexIndices.forEach((s,o)=>{t.writeInt32(10+o,s)})}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}getOffsetCurves(t){const e=this.createOffsetCurve(t);return e?[e]:[]}getOffsetSideAtPoint(t){const e=this.collectLargestFaceBoundary2d();return e.length<2?1:ut.from2dPoints(e,!0).getOffsetSideAtPoint(t)}createOffsetCurve(t){return Ni(this.collectLargestFaceBoundary2d(),!0,t)}collectLargestFaceBoundary2d(){let t=[];for(const e of this._faces){const i=e.vertexIndices.filter(r=>r>=0);i.length>t.length&&(t=i)}return t.length<2?this._vertices.map(e=>new P(e.position.x,e.position.y)):t.map(e=>{const i=this.getVertexAt(e).position;return new P(i.x,i.y)})}};Nr.typeName="PolyFaceMesh";let Rn=Nr;var Va=(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))(Va||{});const xu=["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"],wu=n=>xu[n];var ja=(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))(ja||{});class gr{parse(t){const i=this.normalizeLineEndings(t).split(`
7
+ `),r=[],s=[];let o=null;return i.forEach((a,h)=>{const l=h+1,c=this.stripInlineComment(a).trim();if(!c)return;if(c.startsWith("*")){this.flushCurrentPattern(o,r,s);const g=this.parseHeader(c.slice(1));if(!g){s.push({line:l,message:"Invalid pattern header.",source:a}),o=null;return}o={pattern:{name:g.name,description:g.description,lines:[]},headerLine:l};return}if(!o){s.push({line:l,message:"Line descriptor appears before any pattern header.",source:a});return}const u=this.parseLineDescriptor(c,l);if(!u){s.push({line:l,message:"Invalid line descriptor. Expect: angle,x-origin,y-origin,delta-x,delta-y[,dash-1,...].",source:a});return}o.pattern.lines.push(u)}),this.flushCurrentPattern(o,r,s),{patterns:r,issues:s}}static parse(t){return new gr().parse(t)}normalizeLineEndings(t){return t.replace(/\r\n/g,`
8
8
  `).replace(/\r/g,`
9
- `)}stripInlineComment(t){const e=t.indexOf(";");return e<0?t:t.slice(0,e)}parseHeader(t){const e=t.indexOf(",");if(e<0){const s=t.trim();return s?{name:s,description:""}:null}const i=t.slice(0,e).trim(),r=t.slice(e+1).trim();return i?{name:i,description:r}:null}parseNumber(t){const e=Number(t.trim());return Number.isFinite(e)?e:null}parseLineDescriptor(t,e){const i=t.split(",").map(u=>u.trim()).filter(u=>u.length>0);if(i.length<5)return null;const r=this.parseNumber(i[0]),s=this.parseNumber(i[1]),o=this.parseNumber(i[2]),a=this.parseNumber(i[3]),h=this.parseNumber(i[4]);if(r==null||s==null||o==null||a==null||h==null)return null;const l=i.slice(5),c=[];for(const u of l){const g=this.parseNumber(u);if(g==null)return null;c.push(g)}return{angle:r,originX:s,originY:o,deltaX:a,deltaY:h,dashes:c,sourceLine:e}}flushCurrentPattern(t,e,i){t&&(t.pattern.lines.length===0&&i.push({line:t.headerLine,message:`Pattern "${t.pattern.name}" has no line descriptor.`,source:""}),e.push(t.pattern))}}const N=class N{static nextGradientId(t){return N.gradientIdCounter+=1,`acdb-pat-gradient-${t.toLowerCase()}-${N.gradientIdCounter}`}static packedRgbToCss(t){return`#${(t&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(t,e){return typeof t=="number"?N.packedRgbToCss(t):t??e}static applyShadeTint(t,e){const i=M.clamp(e,0,1),r=i<.5?0:16777215,s=i<.5?1-i*2:i*2-1,o=t>>16&255,a=t>>8&255,h=t&255,l=r>>16&255,c=r>>8&255,u=r&255;return Math.round(o+(l-o)*s)*65536+Math.round(a+(c-a)*s)*256+Math.round(h+(u-h)*s)}static resolveGradientColors(t){const e="#2563eb",i="#f8fafc",r=N.gradientColorToCss(t.startColor,e);if(t.oneColorMode&&t.endColor==null){if(typeof t.startColor=="number"){const s=N.applyShadeTint(t.startColor,t.shadeTintValue??.5);return{start:r,end:N.packedRgbToCss(s)}}return{start:r,end:(t.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:r,end:N.gradientColorToCss(t.endColor,i)}}static renderGradientStops(t){return t.map(e=>`<stop offset="${(M.clamp(e.offset,0,1)*100).toFixed(2)}%" stop-color="${e.color}" />`).join("")}static getGradientVector(t){return{x:Math.cos(t),y:-Math.sin(t)}}static isSolidPattern(t){return t.name.trim().toUpperCase()===Jt}static renderBackground(t,e,i){return`<rect x="${-t/2}" y="${-e/2}" width="${t}" height="${e}" fill="${i}" />`}static estimateUnitScale(t){const e=[];for(const s of t.lines){e.push(Math.abs(s.deltaX),Math.abs(s.deltaY));for(const o of s.dashes)e.push(Math.abs(o))}const i=e.filter(s=>s>N.EPSILON);if(i.length===0)return 1;const r=i.sort((s,o)=>s-o);return r[Math.floor(r.length/2)]||1}static segmentToSvgPath(t){return`M ${t.x1.toFixed(2)} ${(-t.y1).toFixed(2)} L ${t.x2.toFixed(2)} ${(-t.y2).toFixed(2)}`}static buildDashSegments(t,e,i,r,s,o,a){const h=t.dashes;if(h.length===0)return[{x1:r+o*e,y1:s+a*e,x2:r+o*i,y2:s+a*i}];const l=h.reduce((d,p)=>d+Math.abs(p),0);if(l<=N.EPSILON)return[{x1:r+o*e,y1:s+a*e,x2:r+o*i,y2:s+a*i}];const c=[],u=Math.ceil((i-e)/l)+2;let g=e-l;for(let d=0;d<u;d++){let p=g;for(const f of h){const y=Math.abs(f),_=p+y;if(f>0||f===0){const v=M.clamp(p,e,i),S=M.clamp(_,e,i);S>v?c.push({x1:r+o*v,y1:s+a*v,x2:r+o*S,y2:s+a*S}):f===0&&v>=e&&v<=i&&c.push({x1:r+o*(v-.35),y1:s+a*(v-.35),x2:r+o*(v+.35),y2:s+a*(v+.35)})}p=_}g+=l}return c}static renderFamily(t,e){const i=M.degToRad(t.angle),r=Math.cos(i),s=Math.sin(i),o=-s,a=r,h=r*t.deltaX+o*t.deltaY,l=s*t.deltaX+a*t.deltaY,c=Math.hypot(h,l),u=c<=N.EPSILON?1:Math.max(1,Math.ceil(e*2/c)+1),g=Math.floor(u/2),d=-e*1.5,p=e*1.5,f=[];for(let y=-g;y<=g;y++){const _=t.originX+h*y,v=t.originY+l*y,S=N.buildDashSegments(t,d,p,_,v,r,s);for(const A of S)f.push(N.segmentToSvgPath(A))}return`<path d="${f.join(" ")}" fill="none" />`}static renderLinearGradientDef(t,e,i,r,s){const o=N.getGradientVector(e),a=M.clamp(i,-1,1)*r*.5,h=o.x*a,l=o.y*a;return[`<linearGradient id="${t}" gradientUnits="userSpaceOnUse"`,` x1="${(-o.x*r+h).toFixed(2)}"`,` y1="${(-o.y*r+l).toFixed(2)}"`,` x2="${(o.x*r+h).toFixed(2)}"`,` y2="${(o.y*r+l).toFixed(2)}">`,N.renderGradientStops(s),"</linearGradient>"].join("")}static renderRadialGradientDef(t,e,i,r,s){return[`<radialGradient id="${t}" gradientUnits="userSpaceOnUse"`,` cx="${e.toFixed(2)}" cy="${i.toFixed(2)}" r="${r.toFixed(2)}"`,` fx="${e.toFixed(2)}" fy="${i.toFixed(2)}">`,N.renderGradientStops(s),"</radialGradient>"].join("")}static renderGradientDef(t,e,i,r,s,o,a){const h=e.toUpperCase(),l=h.startsWith("INV"),c=h.replace(/^INV/,""),u=l?i.end:i.start,g=l?i.start:i.end,d=Math.hypot(o,a)/2,p=N.getGradientVector(r),f=M.clamp(s,-1,1),y=p.x*f*o*.25,_=p.y*f*a*.25;switch(c){case"CYLINDER":{const v=M.clamp(.5+f*.45,.05,.95);return N.renderLinearGradientDef(t,r,0,d,[{offset:0,color:u},{offset:v,color:g},{offset:1,color:u}])}case"SPHERICAL":return N.renderRadialGradientDef(t,y,_,d,[{offset:0,color:g},{offset:1,color:u}]);case"HEMISPHERICAL":return N.renderRadialGradientDef(t,y+p.x*o*.18,_+p.y*a*.18,d*.92,[{offset:0,color:g},{offset:.72,color:u},{offset:1,color:u}]);case"CURVED":return N.renderRadialGradientDef(t,-p.x*o*.95+y,-p.y*a*.95+_,d*1.65,[{offset:0,color:u},{offset:.55,color:u},{offset:1,color:g}]);case"LINEAR":default:return N.renderLinearGradientDef(t,r,s,d,[{offset:0,color:u},{offset:1,color:g}])}}renderPattern(t,e={}){const i=e.width??260,r=e.height??160,s=e.stroke??"#1f2937",o=e.strokeWidth??1.3,a=e.background??"#ffffff",h=`${-i/2} ${-r/2} ${i} ${r}`;if(N.isSolidPattern(t))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${r}">`,N.renderBackground(i,r,a),`<rect x="${-i/2}" y="${-r/2}" width="${i}" height="${r}" fill="${s}" />`,"</svg>"].join("");const l=N.estimateUnitScale(t),u=Math.min(i,r)*.18/Math.max(l,N.EPSILON),g={...t,lines:t.lines.map(f=>({...f,originX:f.originX*u,originY:f.originY*u,deltaX:f.deltaX*u,deltaY:f.deltaY*u,dashes:f.dashes.map(y=>y*u)}))},d=Math.hypot(i,r)*.75,p=g.lines.map(f=>N.renderFamily(f,d)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${r}">`,N.renderBackground(i,r,a),`<g stroke="${s}" stroke-width="${o.toFixed(2)}" stroke-linecap="round">`,p,"</g>","</svg>"].join("")}renderGradient(t,e={}){const i=e.width??260,r=e.height??160,s=e.background??"#ffffff",o=e.angle??0,a=e.shift??0,h=`${-i/2} ${-r/2} ${i} ${r}`,l=N.nextGradientId(t),c=N.resolveGradientColors(e),u=N.renderGradientDef(l,t,c,o,a,i,r);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${r}">`,N.renderBackground(i,r,s),"<defs>",u,"</defs>",`<rect x="${-i/2}" y="${-r/2}" width="${i}" height="${r}" fill="url(#${l})" />`,"</svg>"].join("")}};N.EPSILON=1e-9,N.gradientIdCounter=0;let Bn=N;var yi=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(yi||{});const Xr=class Xr extends q{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new m,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new m,this._textRotation=0,this._normal=new x(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new be),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(t){const e=this._textPosition.clone(),i=this._textPosition.clone().add(new x(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(t),this._textPosition.applyMatrix4(t),this._normal.transformDirection(t),e.applyMatrix4(t),i.applyMatrix4(t);const r=new x(i).sub(e);return r.lengthSq()>0&&(this._textRotation=Math.atan2(r.y,r.x)),this.subTransformBy(t),this}subGetOsnapPoints(t,e,i,r,s){const o=this.getDimBlockTableRecord();if(!o)return;const a=this.getFullDimBlockTransform(),h=new m(e).applyMatrix4(a.clone().invert()),l=new m(i).applyMatrix4(a.clone().invert()),c=(u,g)=>{const d=[];u.subGetOsnapPoints(t,h,l,d,g,a),u instanceof ve?d.forEach(p=>r.push(p.clone())):d.forEach(p=>r.push(new m(p).applyMatrix4(a)))};if(s){const u=o.getIdAt(s);if(u&&(c(u,s),r.length>0))return}for(const u of o.newIterator())c(u)}subWorldDraw(t){const e=this.getDimBlockTableRecord();if(e){const r=this.computeDimBlockTransform();return ie.instance.draw(t,e,this.resolvedColor,[],!1,r,this._normal)}return t.group([])}getDimBlockGeometricExtents(){const t=new C,e=this.getDimBlockTableRecord();if(!e)return t;for(const i of e.newIterator())t.union(i.geometricExtents);return t.applyMatrix4(this.getFullDimBlockTransform()),t}getGeometricExtentsFromDimBlockOrPoints(t){const e=this.getDimBlockGeometricExtents();if(!e.isEmpty())return e;const i=new C;for(const r of t)i.expandByPoint(r);return this.hasExplicitTextPosition()&&i.expandByPoint(this.textPosition),i}hasExplicitTextPosition(){const{x:t,y:e,z:i}=this.textPosition;return t!==0||e!==0||i!==0}collectDimensionDefinitionGripPoints(){return[]}subGetGripPoints(){return this.collectDimensionDefinitionGripPoints().concat([this.textPosition])}subMoveGripPointsAt(t,e){const i=this.collectDimensionDefinitionGripPoints();return K(t,r=>{r>=0&&r<i.length?i[r].add(e):r===i.length&&this.textPosition.add(e)}),this}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",t=>{this.dimensionStyleName=t.trim()===""?null:t}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",t=>{this.dimensionText=t}),this.createProperty("measurement","float",()=>this.getMeasurementPropertyValue()),this.createProperty("dimBlockId","string",()=>this.dimBlockId??""),...this.createPoint3dProperties("dimBlockPosition",()=>this.dimBlockPosition),...this.createPoint3dProperties("textPosition",()=>this.textPosition),this.createProperty("textRotation","float",()=>this.textRotation,t=>{this.textRotation=t}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,t=>{this.textLineSpacingFactor=t}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,t=>{this.textLineSpacingStyle=t},[{label:yi[1],value:1},{label:yi[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(t,e,i,r,s){return{name:t,type:e,editable:r!=null,options:s,accessor:r?{get:i,set:r}:{get:i}}}createPoint3dProperties(t,e){return[this.createProperty(`${t}X`,"float",()=>e().x,i=>{e().x=i}),this.createProperty(`${t}Y`,"float",()=>e().y,i=>{e().y=i}),this.createProperty(`${t}Z`,"float",()=>e().z,i=>{e().z=i})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const t=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return t;const e=new O().setFromExtrusionDirection(this._normal);return new O().multiplyMatrices(e,t)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}findPointOnLine1(t,e,i){const r=new m().subVectors(e,t).normalize();return new m(e).addScaledVector(r,i)}findPointOnLine2(t,e,i){const r=t.x+i*Math.cos(e),s=t.y+i*Math.sin(e);return{x:r,y:s}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():exports.AcGiArrowType.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??m.ORIGIN,i=new O().makeTranslation(-e.x,-e.y,-e.z),r=new O().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new O().multiplyMatrices(r,i)}subTransformBy(t){}dxfOutFields(t){super.dxfOutFields(t);const e=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return t.writeSubclassMarker("AcDbDimension"),t.writeInt16(280,0),t.writeString(2,this.dimBlockId??void 0),t.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),t.writePoint3d(10,this.dimBlockPosition),t.writeString(1,this.dimensionText??""),t.writeAngle(53,this.textRotation),t.writePoint3d(11,this.textPosition),t.writeInt16(70,0),t.writeInt16(72,this.textLineSpacingStyle),t.writeDouble(41,this.textLineSpacingFactor),t.writeDouble(42,this.measurement),t.writeVector3d(210,this.normal),t.writeObjectId(340,e==null?void 0:e.objectId),this}};Xr.typeName="Dimension";let Ot=Xr;const Nr=class Nr extends Ot{constructor(t,e,i,r,s=null,o=null){super(),this._centerPoint=new m().copy(t),this._xLine1Point=new m().copy(e),this._xLine2Point=new m().copy(i),this._arcPoint=new m().copy(r),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDb3PointAngularDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Nr.typeName="3PointAngularDimension";let Rn=Nr;const Br=class Br extends Ot{constructor(t,e,i,r=null,s=null){super(),this._dimLinePoint=new m().copy(i),this._xLine1Point=new m().copy(t),this._xLine2Point=new m().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),r?this.dimensionText=r:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=s}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("dimLinePoint",()=>this.dimLinePoint),this.createProperty("rotation","float",()=>this.rotation,e=>{this.rotation=e}),this.createProperty("oblique","float",()=>this.oblique,e=>{this.oblique=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.xLine1Point,this.xLine2Point,this.dimLinePoint]}subMoveGripPointsAt(t,e){return super.subMoveGripPointsAt(t,e),this.calculateRotation(),this}subTransformBy(t){this._dimLinePoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t),this.calculateRotation()}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.dimLinePoint])}get isAppendArrow(){return!1}createDimBlock(t){const e=new et;e.name=t;const i=this.createLines();i.forEach(a=>e.appendEntity(new di(a.startPoint,a.endPoint))),this.createArrows(i[0]).forEach(a=>e.appendEntity(a));const s=i[0].midPoint,o=this.createMText(s,this._rotation);return o&&e.appendEntity(o),e}createMText(t,e){const i=r=>({x:Math.cos(r),y:Math.sin(r),z:0});if(this.dimensionText){const r=new gi;return r.attachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,r.layer="0",r.color=new k(exports.AcCmColorMethod.ByBlock),r.location=t,r.contents=this.dimensionText??"",r.height=10,r.direction=i(e),r.styleName=this.dimensionStyle.dimtxsty,r}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,i){const r="_CAXARROW",s=new ve(r);return s.position=t,s.rotation=e,s.scaleFactors={x:i,y:i,z:i},s}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),i=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(e,this._dimLinePoint),s=this.findIntersectionPoint(i,this._dimLinePoint),o=new Ct(r,s);return t.push(o),e.endPoint=r,this.adjustExtensionLine(e),t.push(e),i.endPoint=s,this.adjustExtensionLine(i),t.push(i),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,i=this.findPointOnLine2(t,e,100);return new Ct(t,{...i,z:t.z})}findIntersectionPoint(t,e){const i=t.startPoint,r=t.endPoint,s=new x().subVectors(r,i).normalize(),a=new x().subVectors(e,i).dot(s),h=new x().copy(s).multiplyScalar(a);return new x().addVectors(i,h)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,i=e.x-t.x,r=e.y-t.y;this._rotation=Math.atan2(r,i)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker(this.dxfSubclassMarker),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.dimLinePoint),t.writeAngle(50,this.rotation),t.writeAngle(52,this.oblique),this}};Br.typeName="AlignedDimension";let mi=Br;const Rr=class Rr extends Ot{constructor(t,e,i,r,s=null,o=null){super(),this._arcPoint=new m().copy(r),this._xLine1Point=new m().copy(e),this._xLine2Point=new m().copy(i),this._centerPoint=new m().copy(t),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArcDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Rr.typeName="ArcDimension";let zn=Rr;const zr=class zr extends Ot{constructor(t,e,i=0,r=null,s=null){super(),this._chordPoint=new m().copy(t),this._farChordPoint=new m().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=i,this.dimensionText=r,this.dimensionStyleName=s}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.chordPoint,this.farChordPoint]}subTransformBy(t){this._chordPoint.applyMatrix4(t),this._farChordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){const t=[this.chordPoint,this.farChordPoint];if(this.leaderLength>0){const e=this.farChordPoint.clone().sub(this.chordPoint);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.farChordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbDiametricDimension"),t.writePoint3d(15,this.chordPoint),t.writePoint3d(16,this.farChordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};zr.typeName="DiametricDimension";let Fn=zr;const Fr=class Fr extends Ot{constructor(t,e,i=null,r=null){super(),this._definingPoint=new m().copy(t),this._leaderEndPoint=new m().copy(e),this.dimensionText=i,this.dimensionStyleName=r}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.definingPoint,this.leaderEndPoint]}subTransformBy(t){this._definingPoint.applyMatrix4(t),this._leaderEndPoint.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.definingPoint,this.leaderEndPoint])}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};Fr.typeName="OrdinateDimension";let Vn=Fr;const Vr=class Vr extends Ot{constructor(t,e,i,r=null,s=null){super(),this._center=new m().copy(t),this._chordPoint=new m().copy(e),this._leaderLength=i,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=s}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}set leaderLenght(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.center,this.chordPoint]}subTransformBy(t){this._center.applyMatrix4(t),this._chordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){const t=[this.center,this.chordPoint];if(this.leaderLength>0){const e=this.chordPoint.clone().sub(this.center);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.chordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRadialDimension"),t.writePoint3d(15,this.center),t.writePoint3d(13,this.chordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Vr.typeName="RadialDimension";let jn=Vr;const jr=class jr extends mi{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};jr.typeName="RotatedDimension";let Gn=jr;class wu extends _t{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImageDef"),t.writeString(1,this.sourceFileName),t.writeInt16(280,1),t.writeInt16(281,0),this}}var Va=(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))(Va||{});class bu extends _t{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXrecord"),t.writeInt16(280,1),t.writeResultBuffer(this.data),this}}exports.ACAD_APPID=ln;exports.ACDB_GRIPOBJLIMIT_MAX=qh;exports.ACDB_GRIPOBJLIMIT_MIN=$h;exports.ACDB_PROXY_GRAPHIC_CHUNK_SIZE=fu;exports.ACGI_DARK_THEME_FOREGROUND=Be;exports.ACGI_LIGHT_THEME_FOREGROUND=Re;exports.ACGI_MODEL_SPACE_BACKGROUND=Co;exports.ACGI_PAPER_SPACE_BACKGROUND=Zh;exports.ACTIVE_VPORT_NAME=we;exports.AC_DB_SYSTEM_VARIABLE_NAMES=nc;exports.AcCmColor=k;exports.AcCmColorUtil=Rt;exports.AcCmEntityColor=Ha;exports.AcCmErrors=lt;exports.AcCmEventDispatcher=Ua;exports.AcCmEventManager=U;exports.AcCmLoader=al;exports.AcCmLoadingManager=Is;exports.AcCmObject=Ss;exports.AcCmPerformanceCollector=Hn;exports.AcCmTask=Ls;exports.AcCmTaskScheduler=Ms;exports.AcCmTransparency=$;exports.AcDb2dPolyline=dn;exports.AcDb2dVertex=gn;exports.AcDb2dVertexType=ya;exports.AcDb3PointAngularDimension=Rn;exports.AcDb3dPolyline=pn;exports.AcDb3dVertex=fn;exports.AcDb3dVertexType=_a;exports.AcDbAbstractViewTableRecord=cr;exports.AcDbAlignedDimension=mi;exports.AcDbAngleUnits=at;exports.AcDbArc=yn;exports.AcDbArcDimension=zn;exports.AcDbAttribute=_n;exports.AcDbAttributeDefinition=mn;exports.AcDbAttributeFlags=st;exports.AcDbAttributeMTextFlag=zt;exports.AcDbBaseWorker=ac;exports.AcDbBatchProcessing=Mo;exports.AcDbBlockReference=ve;exports.AcDbBlockScaling=yo;exports.AcDbBlockTable=oa;exports.AcDbBlockTableRecord=et;exports.AcDbCircle=xn;exports.AcDbCodePage=za;exports.AcDbCurve=J;exports.AcDbDataGenerator=Ko;exports.AcDbDatabase=Hc;exports.AcDbDatabaseConverter=Bo;exports.AcDbDatabaseConverterManager=wt;exports.AcDbDiametricDimension=Fn;exports.AcDbDictionary=Kt;exports.AcDbDimArrowType=Fa;exports.AcDbDimStyleTable=aa;exports.AcDbDimStyleTableRecord=be;exports.AcDbDimTextHorizontal=Vo;exports.AcDbDimTextVertical=jo;exports.AcDbDimVerticalJustification=Ho;exports.AcDbDimZeroSuppression=Go;exports.AcDbDimZeroSuppressionAngular=Do;exports.AcDbDimension=Ot;exports.AcDbDuplicateRecordCloning=Va;exports.AcDbDwgVersion=yt;exports.AcDbDxfCode=Dn;exports.AcDbDxfFiler=Ts;exports.AcDbEllipse=wn;exports.AcDbEntity=q;exports.AcDbFace=bn;exports.AcDbFileType=Ce;exports.AcDbFontNameCollector=vt;exports.AcDbFormatter=Zo;exports.AcDbGradientPatternType=qo;exports.AcDbHatch=ui;exports.AcDbHatchObjectType=$o;exports.AcDbHatchPatternType=Oe;exports.AcDbHatchStyle=Wo;exports.AcDbHostApplicationServices=hi;exports.AcDbLayerTable=la;exports.AcDbLayerTableRecord=rr;exports.AcDbLayout=Ei;exports.AcDbLayoutDictionary=pa;exports.AcDbLayoutManager=Ao;exports.AcDbLeader=vn;exports.AcDbLeaderAnnotationType=Aa;exports.AcDbLine=di;exports.AcDbLineSpacingStyle=yi;exports.AcDbLinearUnits=D;exports.AcDbLinetypeTable=ha;exports.AcDbLinetypeTableRecord=te;exports.AcDbMLeader=An;exports.AcDbMLeaderContentType=ue;exports.AcDbMLeaderDirectionType=Ia;exports.AcDbMLeaderLineType=ke;exports.AcDbMLeaderStyle=ra;exports.AcDbMLeaderTextAttachmentDirection=Ma;exports.AcDbMLine=Pn;exports.AcDbMLineFlags=La;exports.AcDbMLineJustification=Sa;exports.AcDbMText=gi;exports.AcDbMlineStyle=sa;exports.AcDbObject=_t;exports.AcDbObjectIterator=He;exports.AcDbOpenMode=Lo;exports.AcDbOrdinateDimension=Vn;exports.AcDbOsnapMode=w;exports.AcDbPatParser=ur;exports.AcDbPatSvgRenderer=Bn;exports.AcDbPlotPaperUnits=mo;exports.AcDbPlotRotation=_o;exports.AcDbPlotSettings=Po;exports.AcDbPlotShadePlotResLevel=wo;exports.AcDbPlotShadePlotType=bo;exports.AcDbPlotStdScaleType=vo;exports.AcDbPlotType=xo;exports.AcDbPoint=En;exports.AcDbPoly2dType=fa;exports.AcDbPoly3dType=ma;exports.AcDbPolyFaceMesh=Nn;exports.AcDbPolyFaceMeshFace=Ra;exports.AcDbPolyFaceMeshVertex=Ba;exports.AcDbPolygonMesh=Xn;exports.AcDbPolygonMeshVertex=Na;exports.AcDbPolyline=ut;exports.AcDbPredefinedAcadIsoPat=Uo;exports.AcDbPredefinedAcadPat=pc;exports.AcDbProxyEntity=In;exports.AcDbProxyGraphic=Mn;exports.AcDbProxyGraphicBitStream=Ta;exports.AcDbProxyGraphicByteStream=dt;exports.AcDbProxyGraphicEndOfBufferError=Gt;exports.AcDbProxyGraphicType=Oa;exports.AcDbRadialDimension=jn;exports.AcDbRasterImage=fi;exports.AcDbRasterImageClipBoundaryType=Ya;exports.AcDbRasterImageDef=wu;exports.AcDbRasterImageImageDisplayOpt=Xa;exports.AcDbRay=Tn;exports.AcDbRegAppTable=ga;exports.AcDbRegAppTableRecord=cn;exports.AcDbRegenerator=Ro;exports.AcDbRenderingCache=ie;exports.AcDbResultBuffer=nr;exports.AcDbRotatedDimension=Gn;exports.AcDbShape=Cn;exports.AcDbSpline=pi;exports.AcDbSymbolTable=Yt;exports.AcDbSymbolTableRecord=Ut;exports.AcDbSysVarManager=mt;exports.AcDbSystemVariables=b;exports.AcDbTable=Sn;exports.AcDbText=Ve;exports.AcDbTextHorizontalMode=va;exports.AcDbTextStyleTable=ca;exports.AcDbTextStyleTableRecord=sr;exports.AcDbTextVerticalMode=Pa;exports.AcDbTrace=Ln;exports.AcDbUnitsValue=j;exports.AcDbViewTable=ua;exports.AcDbViewTableRecord=Uc;exports.AcDbViewport=On;exports.AcDbViewportTable=da;exports.AcDbViewportTableRecord=ee;exports.AcDbWipeout=kn;exports.AcDbWorkerApi=Fo;exports.AcDbWorkerManager=zo;exports.AcDbXline=Yn;exports.AcDbXrecord=bu;exports.AcGeArea2d=Tt;exports.AcGeBox2d=Q;exports.AcGeBox3d=C;exports.AcGeCatmullRomCurve3d=fo;exports.AcGeCircArc2d=ot;exports.AcGeCircArc3d=bt;exports.AcGeCurve2d=Pe;exports.AcGeEllipseArc2d=Qt;exports.AcGeEllipseArc3d=er;exports.AcGeEuler=bl;exports.AcGeGeometryUtil=nt;exports.AcGeLine2d=Pt;exports.AcGeLine3d=Ct;exports.AcGeLoop2d=ir;exports.AcGeMathUtil=M;exports.AcGeMatrix2d=Ge;exports.AcGeMatrix3d=O;exports.AcGeNurbsCurve=ft;exports.AcGePlane=Qn;exports.AcGePoint2d=P;exports.AcGePoint3d=m;exports.AcGePolyline2d=V;exports.AcGeQuaternion=_e;exports.AcGeShape2d=tr;exports.AcGeSpline3d=At;exports.AcGeTol=F;exports.AcGeVector2d=G;exports.AcGeVector3d=x;exports.AcGiContext=Ti;exports.AcGiViewport=ko;exports.AcTrStringUtil=ol;exports.ByBlock=St;exports.ByLayer=Z;exports.DEBUG_MODE=il;exports.DEFAULT_ACGI_CONTEXT=Jh;exports.DEFAULT_GRADIENT_HATCH_NAME=To;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=jh;exports.DEFAULT_HATCH_PATTERN_METRIC=Io;exports.DEFAULT_LINE_TYPE=Dt;exports.DEFAULT_MLEADER_STYLE=jt;exports.DEFAULT_MLINE_STYLE=Vt;exports.DEFAULT_TEXT_STYLE=W;exports.DEFAULT_TOL=Ii;exports.DEG2RAD=Un;exports.DefaultLoadingManager=Es;exports.FLOAT_TOL=Mt;exports.HATCH_PATTERN_SOLID=Jt;exports.HATCH_PATTERN_USER=Eo;exports.MLIGHTCAD_APPID=an;exports.ORIGIN_POINT_2D=ul;exports.ORIGIN_POINT_3D=Zn;exports.RAD2DEG=Wn;exports.RAW_COLOR_TYPE_ACI=Yi;exports.RAW_COLOR_TYPE_BY_BLOCK=Fe;exports.RAW_COLOR_TYPE_BY_LAYER=Oi;exports.RAW_COLOR_TYPE_RGB=ki;exports.RAW_COLOR_TYPE_WINDOW_BG=na;exports.TAU=B;exports.TEMP_OBJECT_ID_PREFIX=ni;exports.VPORT_FALLBACK_CENTER_2D=Gh;exports.VPORT_FALLBACK_LLC=Dh;exports.VPORT_FALLBACK_URC=Hh;exports.VPORT_FALLBACK_VIEW_DIR=Uh;exports.VPORT_FALLBACK_VIEW_TARGET=Wh;exports.acdbDisableOsnapMode=gc;exports.acdbEnableOsnapMode=dc;exports.acdbHasOsnapMode=uc;exports.acdbHostApplicationServices=So;exports.acdbMaskToOsnapModes=hc;exports.acdbOsnapModesToMask=lc;exports.acdbToggleOsnapMode=cc;exports.acgiContrastingForegroundColor=ec;exports.acgiForegroundColorForBackground=tc;exports.acgiIsLightBackground=Oo;exports.acgiResolveSubEntityTraitsRgbFromBackground=ic;exports.basisFunction=Ht;exports.bytesToHexString=Ca;exports.calculateCurveLength=to;exports.ceilPowerOfTwo=Ws;exports.clamp=It;exports.clone=Me;exports.computeParameterValues=Qs;exports.createWorkerApi=oc;exports.damp=Ns;exports.decodeMLeaderStyleRawColor=Bc;exports.deepClone=Qi;exports.defaults=je;exports.degToRad=Ds;exports.dwgCodePageToEncoding=xu;exports.encodeMLeaderStyleRawColor=si;exports.euclideanModulo=$n;exports.evaluateNurbsPoint=Te;exports.floorPowerOfTwo=$s;exports.generateAveragedKnots=Js;exports.generateChordKnots=Ml;exports.generateSqrtChordKnots=Il;exports.generateUUID=ks;exports.generateUniformKnots=Ll;exports.getOcsAngle=Et;exports.getOcsReferenceVector=Ne;exports.has=vs;exports.hexStringsToBytes=pu;exports.intPartLength=Kn;exports.interpolateControlPoints=Ol;exports.interpolateNurbsCurve=Jn;exports.inverseLerp=Xs;exports.isBetween=qs;exports.isBetweenAngle=Ks;exports.isEmpty=Ps;exports.isEqual=fe;exports.isImperialUnits=Xo;exports.isMetricUnits=Yo;exports.isPowerOfTwo=Us;exports.lerp=qn;exports.loadAcDbProxyGraphicFromDxf=ka;exports.log=Ie;exports.mapLinear=Ys;exports.normalizeAngle=Ee;exports.pingpong=Bs;exports.radToDeg=Hs;exports.randFloat=Vs;exports.randFloatSpread=js;exports.randInt=Fs;exports.relativeEps=Zs;exports.seededRandom=Gs;exports.setAcDbHostApplicationServicesProvider=Os;exports.setAcDbLayoutManagerFactory=Vh;exports.setLogLevel=nl;exports.smootherstep=zs;exports.smoothstep=Rs;exports.transformOcsPointToWcs=tn;exports.transformWcsPointToOcs=xe;
9
+ `)}stripInlineComment(t){const e=t.indexOf(";");return e<0?t:t.slice(0,e)}parseHeader(t){const e=t.indexOf(",");if(e<0){const s=t.trim();return s?{name:s,description:""}:null}const i=t.slice(0,e).trim(),r=t.slice(e+1).trim();return i?{name:i,description:r}:null}parseNumber(t){const e=Number(t.trim());return Number.isFinite(e)?e:null}parseLineDescriptor(t,e){const i=t.split(",").map(u=>u.trim()).filter(u=>u.length>0);if(i.length<5)return null;const r=this.parseNumber(i[0]),s=this.parseNumber(i[1]),o=this.parseNumber(i[2]),a=this.parseNumber(i[3]),h=this.parseNumber(i[4]);if(r==null||s==null||o==null||a==null||h==null)return null;const l=i.slice(5),c=[];for(const u of l){const g=this.parseNumber(u);if(g==null)return null;c.push(g)}return{angle:r,originX:s,originY:o,deltaX:a,deltaY:h,dashes:c,sourceLine:e}}flushCurrentPattern(t,e,i){t&&(t.pattern.lines.length===0&&i.push({line:t.headerLine,message:`Pattern "${t.pattern.name}" has no line descriptor.`,source:""}),e.push(t.pattern))}}const N=class N{static nextGradientId(t){return N.gradientIdCounter+=1,`acdb-pat-gradient-${t.toLowerCase()}-${N.gradientIdCounter}`}static packedRgbToCss(t){return`#${(t&16777215).toString(16).padStart(6,"0")}`}static gradientColorToCss(t,e){return typeof t=="number"?N.packedRgbToCss(t):t??e}static applyShadeTint(t,e){const i=M.clamp(e,0,1),r=i<.5?0:16777215,s=i<.5?1-i*2:i*2-1,o=t>>16&255,a=t>>8&255,h=t&255,l=r>>16&255,c=r>>8&255,u=r&255;return Math.round(o+(l-o)*s)*65536+Math.round(a+(c-a)*s)*256+Math.round(h+(u-h)*s)}static resolveGradientColors(t){const e="#2563eb",i="#f8fafc",r=N.gradientColorToCss(t.startColor,e);if(t.oneColorMode&&t.endColor==null){if(typeof t.startColor=="number"){const s=N.applyShadeTint(t.startColor,t.shadeTintValue??.5);return{start:r,end:N.packedRgbToCss(s)}}return{start:r,end:(t.shadeTintValue??.5)<.5?"#000000":"#ffffff"}}return{start:r,end:N.gradientColorToCss(t.endColor,i)}}static renderGradientStops(t){return t.map(e=>`<stop offset="${(M.clamp(e.offset,0,1)*100).toFixed(2)}%" stop-color="${e.color}" />`).join("")}static getGradientVector(t){return{x:Math.cos(t),y:-Math.sin(t)}}static isSolidPattern(t){return t.name.trim().toUpperCase()===Jt}static renderBackground(t,e,i){return`<rect x="${-t/2}" y="${-e/2}" width="${t}" height="${e}" fill="${i}" />`}static estimateUnitScale(t){const e=[];for(const s of t.lines){e.push(Math.abs(s.deltaX),Math.abs(s.deltaY));for(const o of s.dashes)e.push(Math.abs(o))}const i=e.filter(s=>s>N.EPSILON);if(i.length===0)return 1;const r=i.sort((s,o)=>s-o);return r[Math.floor(r.length/2)]||1}static segmentToSvgPath(t){return`M ${t.x1.toFixed(2)} ${(-t.y1).toFixed(2)} L ${t.x2.toFixed(2)} ${(-t.y2).toFixed(2)}`}static buildDashSegments(t,e,i,r,s,o,a){const h=t.dashes;if(h.length===0)return[{x1:r+o*e,y1:s+a*e,x2:r+o*i,y2:s+a*i}];const l=h.reduce((d,p)=>d+Math.abs(p),0);if(l<=N.EPSILON)return[{x1:r+o*e,y1:s+a*e,x2:r+o*i,y2:s+a*i}];const c=[],u=Math.ceil((i-e)/l)+2;let g=e-l;for(let d=0;d<u;d++){let p=g;for(const f of h){const y=Math.abs(f),_=p+y;if(f>0||f===0){const v=M.clamp(p,e,i),S=M.clamp(_,e,i);S>v?c.push({x1:r+o*v,y1:s+a*v,x2:r+o*S,y2:s+a*S}):f===0&&v>=e&&v<=i&&c.push({x1:r+o*(v-.35),y1:s+a*(v-.35),x2:r+o*(v+.35),y2:s+a*(v+.35)})}p=_}g+=l}return c}static renderFamily(t,e){const i=M.degToRad(t.angle),r=Math.cos(i),s=Math.sin(i),o=-s,a=r,h=r*t.deltaX+o*t.deltaY,l=s*t.deltaX+a*t.deltaY,c=Math.hypot(h,l),u=c<=N.EPSILON?1:Math.max(1,Math.ceil(e*2/c)+1),g=Math.floor(u/2),d=-e*1.5,p=e*1.5,f=[];for(let y=-g;y<=g;y++){const _=t.originX+h*y,v=t.originY+l*y,S=N.buildDashSegments(t,d,p,_,v,r,s);for(const A of S)f.push(N.segmentToSvgPath(A))}return`<path d="${f.join(" ")}" fill="none" />`}static renderLinearGradientDef(t,e,i,r,s){const o=N.getGradientVector(e),a=M.clamp(i,-1,1)*r*.5,h=o.x*a,l=o.y*a;return[`<linearGradient id="${t}" gradientUnits="userSpaceOnUse"`,` x1="${(-o.x*r+h).toFixed(2)}"`,` y1="${(-o.y*r+l).toFixed(2)}"`,` x2="${(o.x*r+h).toFixed(2)}"`,` y2="${(o.y*r+l).toFixed(2)}">`,N.renderGradientStops(s),"</linearGradient>"].join("")}static renderRadialGradientDef(t,e,i,r,s){return[`<radialGradient id="${t}" gradientUnits="userSpaceOnUse"`,` cx="${e.toFixed(2)}" cy="${i.toFixed(2)}" r="${r.toFixed(2)}"`,` fx="${e.toFixed(2)}" fy="${i.toFixed(2)}">`,N.renderGradientStops(s),"</radialGradient>"].join("")}static renderGradientDef(t,e,i,r,s,o,a){const h=e.toUpperCase(),l=h.startsWith("INV"),c=h.replace(/^INV/,""),u=l?i.end:i.start,g=l?i.start:i.end,d=Math.hypot(o,a)/2,p=N.getGradientVector(r),f=M.clamp(s,-1,1),y=p.x*f*o*.25,_=p.y*f*a*.25;switch(c){case"CYLINDER":{const v=M.clamp(.5+f*.45,.05,.95);return N.renderLinearGradientDef(t,r,0,d,[{offset:0,color:u},{offset:v,color:g},{offset:1,color:u}])}case"SPHERICAL":return N.renderRadialGradientDef(t,y,_,d,[{offset:0,color:g},{offset:1,color:u}]);case"HEMISPHERICAL":return N.renderRadialGradientDef(t,y+p.x*o*.18,_+p.y*a*.18,d*.92,[{offset:0,color:g},{offset:.72,color:u},{offset:1,color:u}]);case"CURVED":return N.renderRadialGradientDef(t,-p.x*o*.95+y,-p.y*a*.95+_,d*1.65,[{offset:0,color:u},{offset:.55,color:u},{offset:1,color:g}]);case"LINEAR":default:return N.renderLinearGradientDef(t,r,s,d,[{offset:0,color:u},{offset:1,color:g}])}}renderPattern(t,e={}){const i=e.width??260,r=e.height??160,s=e.stroke??"#1f2937",o=e.strokeWidth??1.3,a=e.background??"#ffffff",h=`${-i/2} ${-r/2} ${i} ${r}`;if(N.isSolidPattern(t))return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${r}">`,N.renderBackground(i,r,a),`<rect x="${-i/2}" y="${-r/2}" width="${i}" height="${r}" fill="${s}" />`,"</svg>"].join("");const l=N.estimateUnitScale(t),u=Math.min(i,r)*.18/Math.max(l,N.EPSILON),g={...t,lines:t.lines.map(f=>({...f,originX:f.originX*u,originY:f.originY*u,deltaX:f.deltaX*u,deltaY:f.deltaY*u,dashes:f.dashes.map(y=>y*u)}))},d=Math.hypot(i,r)*.75,p=g.lines.map(f=>N.renderFamily(f,d)).join("");return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${r}">`,N.renderBackground(i,r,a),`<g stroke="${s}" stroke-width="${o.toFixed(2)}" stroke-linecap="round">`,p,"</g>","</svg>"].join("")}renderGradient(t,e={}){const i=e.width??260,r=e.height??160,s=e.background??"#ffffff",o=e.angle??0,a=e.shift??0,h=`${-i/2} ${-r/2} ${i} ${r}`,l=N.nextGradientId(t),c=N.resolveGradientColors(e),u=N.renderGradientDef(l,t,c,o,a,i,r);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h}" width="${i}" height="${r}">`,N.renderBackground(i,r,s),"<defs>",u,"</defs>",`<rect x="${-i/2}" y="${-r/2}" width="${i}" height="${r}" fill="url(#${l})" />`,"</svg>"].join("")}};N.EPSILON=1e-9,N.gradientIdCounter=0;let zn=N;var mi=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(mi||{});const Br=class Br extends q{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new m,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new m,this._textRotation=0,this._normal=new x(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t,this._dimStyle=void 0}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new be),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get properties(){return this.getBaseProperties()}getBaseProperties(){return{type:this.type,groups:[this.getGeneralProperties(),this.getDimensionProperties()]}}transformBy(t){const e=this._textPosition.clone(),i=this._textPosition.clone().add(new x(Math.cos(this._textRotation),Math.sin(this._textRotation),0));this._dimBlockPosition.applyMatrix4(t),this._textPosition.applyMatrix4(t),this._normal.transformDirection(t),e.applyMatrix4(t),i.applyMatrix4(t);const r=new x(i).sub(e);return r.lengthSq()>0&&(this._textRotation=Math.atan2(r.y,r.x)),this.subTransformBy(t),this}subGetOsnapPoints(t,e,i,r,s){const o=this.getDimBlockTableRecord();if(!o)return;const a=this.getFullDimBlockTransform(),h=new m(e).applyMatrix4(a.clone().invert()),l=new m(i).applyMatrix4(a.clone().invert()),c=(u,g)=>{const d=[];u.subGetOsnapPoints(t,h,l,d,g,a),u instanceof ve?d.forEach(p=>r.push(p.clone())):d.forEach(p=>r.push(new m(p).applyMatrix4(a)))};if(s){const u=o.getIdAt(s);if(u&&(c(u,s),r.length>0))return}for(const u of o.newIterator())c(u)}subWorldDraw(t){const e=this.getDimBlockTableRecord();if(e){const r=this.computeDimBlockTransform();return ie.instance.draw(t,e,this.resolvedColor,[],!1,r,this._normal)}return t.group([])}getDimBlockGeometricExtents(){const t=new C,e=this.getDimBlockTableRecord();if(!e)return t;for(const i of e.newIterator())t.union(i.geometricExtents);return t.applyMatrix4(this.getFullDimBlockTransform()),t}getGeometricExtentsFromDimBlockOrPoints(t){const e=this.getDimBlockGeometricExtents();if(!e.isEmpty())return e;const i=new C;for(const r of t)i.expandByPoint(r);return this.hasExplicitTextPosition()&&i.expandByPoint(this.textPosition),i}hasExplicitTextPosition(){const{x:t,y:e,z:i}=this.textPosition;return t!==0||e!==0||i!==0}collectDimensionDefinitionGripPoints(){return[]}subGetGripPoints(){return this.collectDimensionDefinitionGripPoints().concat([this.textPosition])}subMoveGripPointsAt(t,e){const i=this.collectDimensionDefinitionGripPoints();return K(t,r=>{r>=0&&r<i.length?i[r].add(e):r===i.length&&this.textPosition.add(e)}),this}getDimBlockTableRecord(){return this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0}getDimensionProperties(){return{groupName:"dimension",properties:[this.createProperty("dimensionStyleName","string",()=>this.dimensionStyleName??"",t=>{this.dimensionStyleName=t.trim()===""?null:t}),this.createProperty("dimensionText","string",()=>this.dimensionText??"",t=>{this.dimensionText=t}),this.createProperty("measurement","float",()=>this.getMeasurementPropertyValue()),this.createProperty("dimBlockId","string",()=>this.dimBlockId??""),...this.createPoint3dProperties("dimBlockPosition",()=>this.dimBlockPosition),...this.createPoint3dProperties("textPosition",()=>this.textPosition),this.createProperty("textRotation","float",()=>this.textRotation,t=>{this.textRotation=t}),this.createProperty("textLineSpacingFactor","float",()=>this.textLineSpacingFactor,t=>{this.textLineSpacingFactor=t}),this.createProperty("textLineSpacingStyle","enum",()=>this.textLineSpacingStyle,t=>{this.textLineSpacingStyle=t},[{label:mi[1],value:1},{label:mi[2],value:2}]),...this.createPoint3dProperties("normal",()=>this.normal)]}}createProperty(t,e,i,r,s){return{name:t,type:e,editable:r!=null,options:s,accessor:r?{get:i,set:r}:{get:i}}}createPoint3dProperties(t,e){return[this.createProperty(`${t}X`,"float",()=>e().x,i=>{e().x=i}),this.createProperty(`${t}Y`,"float",()=>e().y,i=>{e().y=i}),this.createProperty(`${t}Z`,"float",()=>e().z,i=>{e().z=i})]}getMeasurementPropertyValue(){return this.measurement}getFullDimBlockTransform(){const t=this.computeDimBlockTransform();if(this._normal.x===0&&this._normal.y===0&&this._normal.z===1)return t;const e=new O().setFromExtrusionDirection(this._normal);return new O().multiplyMatrices(e,t)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}findPointOnLine1(t,e,i){const r=new m().subVectors(e,t).normalize();return new m(e).addScaledVector(r,i)}findPointOnLine2(t,e,i){const r=t.x+i*Math.cos(e),s=t.y+i*Math.sin(e);return{x:r,y:s}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():exports.AcGiArrowType.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??m.ORIGIN,i=new O().makeTranslation(-e.x,-e.y,-e.z),r=new O().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new O().multiplyMatrices(r,i)}subTransformBy(t){}dxfOutFields(t){super.dxfOutFields(t);const e=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return t.writeSubclassMarker("AcDbDimension"),t.writeInt16(280,0),t.writeString(2,this.dimBlockId??void 0),t.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),t.writePoint3d(10,this.dimBlockPosition),t.writeString(1,this.dimensionText??""),t.writeAngle(53,this.textRotation),t.writePoint3d(11,this.textPosition),t.writeInt16(70,0),t.writeInt16(72,this.textLineSpacingStyle),t.writeDouble(41,this.textLineSpacingFactor),t.writeDouble(42,this.measurement),t.writeVector3d(210,this.normal),t.writeObjectId(340,e==null?void 0:e.objectId),this}};Br.typeName="Dimension";let Ot=Br;const Rr=class Rr extends Ot{constructor(t,e,i,r,s=null,o=null){super(),this._centerPoint=new m().copy(t),this._xLine1Point=new m().copy(e),this._xLine2Point=new m().copy(i),this._arcPoint=new m().copy(r),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDb3PointAngularDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Rr.typeName="3PointAngularDimension";let Fn=Rr;const zr=class zr extends Ot{constructor(t,e,i,r=null,s=null){super(),this._dimLinePoint=new m().copy(i),this._xLine1Point=new m().copy(t),this._xLine2Point=new m().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),r?this.dimensionText=r:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=s}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("dimLinePoint",()=>this.dimLinePoint),this.createProperty("rotation","float",()=>this.rotation,e=>{this.rotation=e}),this.createProperty("oblique","float",()=>this.oblique,e=>{this.oblique=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.xLine1Point,this.xLine2Point,this.dimLinePoint]}subMoveGripPointsAt(t,e){return super.subMoveGripPointsAt(t,e),this.calculateRotation(),this}subTransformBy(t){this._dimLinePoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t),this.calculateRotation()}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.dimLinePoint])}get isAppendArrow(){return!1}createDimBlock(t){const e=new et;e.name=t;const i=this.createLines();i.forEach(a=>e.appendEntity(new gi(a.startPoint,a.endPoint))),this.createArrows(i[0]).forEach(a=>e.appendEntity(a));const s=i[0].midPoint,o=this.createMText(s,this._rotation);return o&&e.appendEntity(o),e}createMText(t,e){const i=r=>({x:Math.cos(r),y:Math.sin(r),z:0});if(this.dimensionText){const r=new pi;return r.attachmentPoint=exports.AcGiMTextAttachmentPoint.MiddleLeft,r.layer="0",r.color=new k(exports.AcCmColorMethod.ByBlock),r.location=t,r.contents=this.dimensionText??"",r.height=10,r.direction=i(e),r.styleName=this.dimensionStyle.dimtxsty,r}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,i){const r="_CAXARROW",s=new ve(r);return s.position=t,s.rotation=e,s.scaleFactors={x:i,y:i,z:i},s}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),i=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(e,this._dimLinePoint),s=this.findIntersectionPoint(i,this._dimLinePoint),o=new Ct(r,s);return t.push(o),e.endPoint=r,this.adjustExtensionLine(e),t.push(e),i.endPoint=s,this.adjustExtensionLine(i),t.push(i),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,i=this.findPointOnLine2(t,e,100);return new Ct(t,{...i,z:t.z})}findIntersectionPoint(t,e){const i=t.startPoint,r=t.endPoint,s=new x().subVectors(r,i).normalize(),a=new x().subVectors(e,i).dot(s),h=new x().copy(s).multiplyScalar(a);return new x().addVectors(i,h)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,i=e.x-t.x,r=e.y-t.y;this._rotation=Math.atan2(r,i)}get dxfSubclassMarker(){return"AcDbAlignedDimension"}getMeasurementPropertyValue(){return this.measurement??this.xLine1Point.distanceTo(this.xLine2Point)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker(this.dxfSubclassMarker),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.dimLinePoint),t.writeAngle(50,this.rotation),t.writeAngle(52,this.oblique),this}};zr.typeName="AlignedDimension";let _i=zr;const Fr=class Fr extends Ot{constructor(t,e,i,r,s=null,o=null){super(),this._arcPoint=new m().copy(r),this._xLine1Point=new m().copy(e),this._xLine2Point=new m().copy(i),this._centerPoint=new m().copy(t),this.dimensionText=s,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("centerPoint",()=>this.centerPoint),...this.createPoint3dProperties("xLine1Point",()=>this.xLine1Point),...this.createPoint3dProperties("xLine2Point",()=>this.xLine2Point),...this.createPoint3dProperties("arcPoint",()=>this.arcPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.centerPoint,this.xLine1Point,this.xLine2Point,this.arcPoint]}subTransformBy(t){this._arcPoint.applyMatrix4(t),this._centerPoint.applyMatrix4(t),this._xLine1Point.applyMatrix4(t),this._xLine2Point.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.xLine1Point,this.xLine2Point,this.centerPoint,this.arcPoint])}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArcDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Fr.typeName="ArcDimension";let Vn=Fr;const Vr=class Vr extends Ot{constructor(t,e,i=0,r=null,s=null){super(),this._chordPoint=new m().copy(t),this._farChordPoint=new m().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=i,this.dimensionText=r,this.dimensionStyleName=s}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),...this.createPoint3dProperties("farChordPoint",()=>this.farChordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.chordPoint,this.farChordPoint]}subTransformBy(t){this._chordPoint.applyMatrix4(t),this._farChordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.chordPoint.distanceTo(this.farChordPoint)}get geometricExtents(){const t=[this.chordPoint,this.farChordPoint];if(this.leaderLength>0){const e=this.farChordPoint.clone().sub(this.chordPoint);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.farChordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbDiametricDimension"),t.writePoint3d(15,this.chordPoint),t.writePoint3d(16,this.farChordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Vr.typeName="DiametricDimension";let jn=Vr;const jr=class jr extends Ot{constructor(t,e,i=null,r=null){super(),this._definingPoint=new m().copy(t),this._leaderEndPoint=new m().copy(e),this.dimensionText=i,this.dimensionStyleName=r}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("definingPoint",()=>this.definingPoint),...this.createPoint3dProperties("leaderEndPoint",()=>this.leaderEndPoint)]}]}}collectDimensionDefinitionGripPoints(){return[this.definingPoint,this.leaderEndPoint]}subTransformBy(t){this._definingPoint.applyMatrix4(t),this._leaderEndPoint.applyMatrix4(t)}get geometricExtents(){return this.getGeometricExtentsFromDimBlockOrPoints([this.definingPoint,this.leaderEndPoint])}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};jr.typeName="OrdinateDimension";let Gn=jr;const Gr=class Gr extends Ot{constructor(t,e,i,r=null,s=null){super(),this._center=new m().copy(t),this._chordPoint=new m().copy(e),this._leaderLength=i,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=s}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLength(t){this._leaderLength=t}set leaderLenght(t){this._leaderLength=t}get properties(){const t=this.getBaseProperties();return{type:this.type,groups:[...t.groups,{groupName:"geometry",properties:[...this.createPoint3dProperties("center",()=>this.center),...this.createPoint3dProperties("chordPoint",()=>this.chordPoint),this.createProperty("leaderLength","float",()=>this.leaderLength,e=>{this.leaderLength=e}),this.createProperty("extArcStartAngle","float",()=>this.extArcStartAngle,e=>{this.extArcStartAngle=e}),this.createProperty("extArcEndAngle","float",()=>this.extArcEndAngle,e=>{this.extArcEndAngle=e})]}]}}collectDimensionDefinitionGripPoints(){return[this.center,this.chordPoint]}subTransformBy(t){this._center.applyMatrix4(t),this._chordPoint.applyMatrix4(t)}getMeasurementPropertyValue(){return this.measurement??this.center.distanceTo(this.chordPoint)}get geometricExtents(){const t=[this.center,this.chordPoint];if(this.leaderLength>0){const e=this.chordPoint.clone().sub(this.center);e.lengthSq()>0&&(e.normalize().multiplyScalar(this.leaderLength),t.push(this.chordPoint.clone().add(e)))}return this.getGeometricExtentsFromDimBlockOrPoints(t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRadialDimension"),t.writePoint3d(15,this.center),t.writePoint3d(13,this.chordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Gr.typeName="RadialDimension";let Dn=Gr;const Dr=class Dr extends _i{get dxfSubclassMarker(){return"AcDbRotatedDimension"}};Dr.typeName="RotatedDimension";let Hn=Dr;class bu extends _t{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImageDef"),t.writeString(1,this.sourceFileName),t.writeInt16(280,1),t.writeInt16(281,0),this}}var Ga=(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))(Ga||{});class vu extends _t{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){return super.clone()}getDuplicateRecordCloning(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXrecord"),t.writeInt16(280,1),t.writeResultBuffer(this.data),this}}exports.ACAD_APPID=hn;exports.ACDB_GRIPOBJLIMIT_MAX=Zh;exports.ACDB_GRIPOBJLIMIT_MIN=Kh;exports.ACDB_PROXY_GRAPHIC_CHUNK_SIZE=yu;exports.ACGI_DARK_THEME_FOREGROUND=Re;exports.ACGI_LIGHT_THEME_FOREGROUND=ze;exports.ACGI_MODEL_SPACE_BACKGROUND=ko;exports.ACGI_PAPER_SPACE_BACKGROUND=Jh;exports.ACTIVE_VPORT_NAME=we;exports.AC_DB_SYSTEM_VARIABLE_NAMES=sc;exports.AcCmColor=k;exports.AcCmColorUtil=Rt;exports.AcCmEntityColor=Wa;exports.AcCmErrors=lt;exports.AcCmEventDispatcher=$a;exports.AcCmEventManager=U;exports.AcCmLoader=hl;exports.AcCmLoadingManager=Ts;exports.AcCmObject=Ms;exports.AcCmPerformanceCollector=Wn;exports.AcCmTask=Es;exports.AcCmTaskScheduler=Is;exports.AcCmTransparency=$;exports.AcDb2dPolyline=pn;exports.AcDb2dVertex=fn;exports.AcDb2dVertexType=_a;exports.AcDb3PointAngularDimension=Fn;exports.AcDb3dPolyline=yn;exports.AcDb3dVertex=mn;exports.AcDb3dVertexType=wa;exports.AcDbAbstractViewTableRecord=dr;exports.AcDbAlignedDimension=_i;exports.AcDbAngleUnits=at;exports.AcDbArc=_n;exports.AcDbArcDimension=Vn;exports.AcDbAttribute=wn;exports.AcDbAttributeDefinition=xn;exports.AcDbAttributeFlags=st;exports.AcDbAttributeMTextFlag=zt;exports.AcDbBaseWorker=hc;exports.AcDbBatchProcessing=Io;exports.AcDbBlockReference=ve;exports.AcDbBlockScaling=_o;exports.AcDbBlockTable=la;exports.AcDbBlockTableRecord=et;exports.AcDbCircle=bn;exports.AcDbCodePage=Va;exports.AcDbCurve=J;exports.AcDbDataGenerator=Qo;exports.AcDbDatabase=dn;exports.AcDbDatabaseConverter=zo;exports.AcDbDatabaseConverterManager=wt;exports.AcDbDiametricDimension=jn;exports.AcDbDictionary=Kt;exports.AcDbDimArrowType=ja;exports.AcDbDimStyleTable=ha;exports.AcDbDimStyleTableRecord=be;exports.AcDbDimTextHorizontal=Go;exports.AcDbDimTextVertical=Do;exports.AcDbDimVerticalJustification=Wo;exports.AcDbDimZeroSuppression=Ho;exports.AcDbDimZeroSuppressionAngular=Uo;exports.AcDbDimension=Ot;exports.AcDbDuplicateRecordCloning=Ga;exports.AcDbDwgVersion=yt;exports.AcDbDxfCode=Un;exports.AcDbDxfFiler=Os;exports.AcDbEllipse=vn;exports.AcDbEntity=q;exports.AcDbFace=Pn;exports.AcDbFileType=Ce;exports.AcDbFontNameCollector=vt;exports.AcDbFormatter=Jo;exports.AcDbGradientPatternType=Zo;exports.AcDbHatch=di;exports.AcDbHatchObjectType=Ko;exports.AcDbHatchPatternType=Oe;exports.AcDbHatchStyle=qo;exports.AcDbHostApplicationServices=ci;exports.AcDbLayerTable=ca;exports.AcDbLayerTableRecord=or;exports.AcDbLayout=Ti;exports.AcDbLayoutDictionary=ya;exports.AcDbLayoutManager=Lo;exports.AcDbLeader=An;exports.AcDbLeaderAnnotationType=La;exports.AcDbLine=gi;exports.AcDbLineSpacingStyle=mi;exports.AcDbLinearUnits=D;exports.AcDbLinetypeTable=ua;exports.AcDbLinetypeTableRecord=te;exports.AcDbMLeader=Ln;exports.AcDbMLeaderContentType=ue;exports.AcDbMLeaderDirectionType=Ta;exports.AcDbMLeaderLineType=ke;exports.AcDbMLeaderStyle=oa;exports.AcDbMLeaderTextAttachmentDirection=Ia;exports.AcDbMLine=Sn;exports.AcDbMLineFlags=Ea;exports.AcDbMLineJustification=Ma;exports.AcDbMText=pi;exports.AcDbMlineStyle=aa;exports.AcDbObject=_t;exports.AcDbObjectIterator=Ue;exports.AcDbOpenMode=Eo;exports.AcDbOrdinateDimension=Gn;exports.AcDbOsnapMode=w;exports.AcDbPatParser=gr;exports.AcDbPatSvgRenderer=zn;exports.AcDbPlotPaperUnits=xo;exports.AcDbPlotRotation=wo;exports.AcDbPlotSettings=So;exports.AcDbPlotShadePlotResLevel=vo;exports.AcDbPlotShadePlotType=Po;exports.AcDbPlotStdScaleType=Ao;exports.AcDbPlotType=bo;exports.AcDbPoint=Cn;exports.AcDbPoly2dType=ma;exports.AcDbPoly3dType=xa;exports.AcDbPolyFaceMesh=Rn;exports.AcDbPolyFaceMeshFace=Fa;exports.AcDbPolyFaceMeshVertex=za;exports.AcDbPolygonMesh=Bn;exports.AcDbPolygonMeshVertex=Ra;exports.AcDbPolyline=ut;exports.AcDbPredefinedAcadIsoPat=$o;exports.AcDbPredefinedAcadPat=yc;exports.AcDbProxyEntity=Tn;exports.AcDbProxyGraphic=In;exports.AcDbProxyGraphicBitStream=Oa;exports.AcDbProxyGraphicByteStream=dt;exports.AcDbProxyGraphicEndOfBufferError=Gt;exports.AcDbProxyGraphicType=Ya;exports.AcDbRadialDimension=Dn;exports.AcDbRasterImage=yi;exports.AcDbRasterImageClipBoundaryType=Na;exports.AcDbRasterImageDef=bu;exports.AcDbRasterImageImageDisplayOpt=Ba;exports.AcDbRay=On;exports.AcDbRegAppTable=fa;exports.AcDbRegAppTableRecord=un;exports.AcDbRegenerator=Fo;exports.AcDbRenderingCache=ie;exports.AcDbResultBuffer=sr;exports.AcDbRotatedDimension=Hn;exports.AcDbShape=kn;exports.AcDbSpline=fi;exports.AcDbSymbolTable=Yt;exports.AcDbSymbolTableRecord=Ut;exports.AcDbSysVarManager=mt;exports.AcDbSystemVariables=b;exports.AcDbTable=Mn;exports.AcDbText=je;exports.AcDbTextHorizontalMode=Aa;exports.AcDbTextStyleTable=da;exports.AcDbTextStyleTableRecord=ar;exports.AcDbTextVerticalMode=Sa;exports.AcDbTrace=En;exports.AcDbUnitsValue=j;exports.AcDbViewTable=ga;exports.AcDbViewTableRecord=Wc;exports.AcDbViewport=Yn;exports.AcDbViewportTable=pa;exports.AcDbViewportTableRecord=ee;exports.AcDbWipeout=Xn;exports.AcDbWorkerApi=jo;exports.AcDbWorkerManager=Vo;exports.AcDbXline=Nn;exports.AcDbXrecord=vu;exports.AcGeArea2d=Tt;exports.AcGeBox2d=Q;exports.AcGeBox3d=C;exports.AcGeCatmullRomCurve3d=mo;exports.AcGeCircArc2d=ot;exports.AcGeCircArc3d=bt;exports.AcGeCurve2d=Pe;exports.AcGeEllipseArc2d=Qt;exports.AcGeEllipseArc3d=nr;exports.AcGeEuler=Pl;exports.AcGeGeometryUtil=nt;exports.AcGeLine2d=Pt;exports.AcGeLine3d=Ct;exports.AcGeLoop2d=rr;exports.AcGeMathUtil=M;exports.AcGeMatrix2d=De;exports.AcGeMatrix3d=O;exports.AcGeNurbsCurve=ft;exports.AcGePlane=tr;exports.AcGePoint2d=P;exports.AcGePoint3d=m;exports.AcGePolyline2d=V;exports.AcGeQuaternion=_e;exports.AcGeShape2d=ir;exports.AcGeSpline3d=At;exports.AcGeTol=F;exports.AcGeVector2d=G;exports.AcGeVector3d=x;exports.AcGiContext=Ci;exports.AcGiViewport=Xo;exports.AcTrStringUtil=ll;exports.ByBlock=St;exports.ByLayer=Z;exports.DEBUG_MODE=rl;exports.DEFAULT_ACGI_CONTEXT=ec;exports.DEFAULT_GRADIENT_HATCH_NAME=Oo;exports.DEFAULT_HATCH_PATTERN_IMPERIAL=Dh;exports.DEFAULT_HATCH_PATTERN_METRIC=To;exports.DEFAULT_LINE_TYPE=Dt;exports.DEFAULT_MLEADER_STYLE=jt;exports.DEFAULT_MLINE_STYLE=Vt;exports.DEFAULT_TEXT_STYLE=W;exports.DEFAULT_TOL=Ii;exports.DEG2RAD=$n;exports.DefaultLoadingManager=Cs;exports.FLOAT_TOL=Mt;exports.HATCH_PATTERN_SOLID=Jt;exports.HATCH_PATTERN_USER=Co;exports.MLIGHTCAD_APPID=ln;exports.ORIGIN_POINT_2D=gl;exports.ORIGIN_POINT_3D=Jn;exports.RAD2DEG=qn;exports.RAW_COLOR_TYPE_ACI=Xi;exports.RAW_COLOR_TYPE_BY_BLOCK=Ve;exports.RAW_COLOR_TYPE_BY_LAYER=ki;exports.RAW_COLOR_TYPE_RGB=Yi;exports.RAW_COLOR_TYPE_WINDOW_BG=sa;exports.TAU=B;exports.TEMP_OBJECT_ID_PREFIX=ri;exports.VPORT_FALLBACK_CENTER_2D=Hh;exports.VPORT_FALLBACK_LLC=Uh;exports.VPORT_FALLBACK_URC=Wh;exports.VPORT_FALLBACK_VIEW_DIR=$h;exports.VPORT_FALLBACK_VIEW_TARGET=qh;exports.acdbDisableOsnapMode=fc;exports.acdbEnableOsnapMode=pc;exports.acdbHasOsnapMode=gc;exports.acdbHostApplicationServices=Mo;exports.acdbMaskToOsnapModes=uc;exports.acdbOsnapModesToMask=cc;exports.acdbToggleOsnapMode=dc;exports.acgiContrastingForegroundColor=nc;exports.acgiForegroundColorForBackground=ic;exports.acgiIsLightBackground=Yo;exports.acgiResolveSubEntityTraitsRgbFromBackground=rc;exports.basisFunction=Ht;exports.bytesToHexString=ka;exports.calculateCurveLength=io;exports.ceilPowerOfTwo=qs;exports.clamp=Et;exports.clone=Me;exports.computeParameterValues=to;exports.createWorkerApi=lc;exports.damp=Rs;exports.decodeMLeaderStyleRawColor=zc;exports.deepClone=Ji;exports.defaults=Ge;exports.degToRad=Us;exports.dwgCodePageToEncoding=wu;exports.encodeMLeaderStyleRawColor=oi;exports.euclideanModulo=Kn;exports.evaluateNurbsPoint=Te;exports.floorPowerOfTwo=Ks;exports.generateAveragedKnots=eo;exports.generateChordKnots=Il;exports.generateSqrtChordKnots=Tl;exports.generateUUID=Xs;exports.generateUniformKnots=El;exports.getOcsAngle=It;exports.getOcsReferenceVector=Be;exports.has=As;exports.hexStringsToBytes=fu;exports.intPartLength=Qn;exports.interpolateControlPoints=Yl;exports.interpolateNurbsCurve=er;exports.inverseLerp=Bs;exports.isBetween=Zs;exports.isBetweenAngle=Qs;exports.isEmpty=Ss;exports.isEqual=fe;exports.isImperialUnits=Bo;exports.isMetricUnits=No;exports.isPowerOfTwo=$s;exports.lerp=Zn;exports.loadAcDbProxyGraphicFromDxf=Xa;exports.log=Ee;exports.mapLinear=Ns;exports.normalizeAngle=Ie;exports.pingpong=zs;exports.radToDeg=Ws;exports.randFloat=Gs;exports.randFloatSpread=Ds;exports.randInt=js;exports.relativeEps=Js;exports.seededRandom=Hs;exports.setAcDbHostApplicationServicesProvider=Ys;exports.setAcDbLayoutManagerFactory=Gh;exports.setLogLevel=sl;exports.smootherstep=Vs;exports.smoothstep=Fs;exports.transformOcsPointToWcs=en;exports.transformWcsPointToOcs=xe;