@mlightcad/data-model 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-model.cjs +5 -5
- package/dist/data-model.js +4855 -4154
- package/lib/entity/AcDb2dPolyline.d.ts +15 -1
- package/lib/entity/AcDb2dPolyline.d.ts.map +1 -1
- package/lib/entity/AcDb2dPolyline.js +32 -2
- package/lib/entity/AcDb2dPolyline.js.map +1 -1
- package/lib/entity/AcDb2dVertex.d.ts +15 -1
- package/lib/entity/AcDb2dVertex.d.ts.map +1 -1
- package/lib/entity/AcDb2dVertex.js +16 -1
- package/lib/entity/AcDb2dVertex.js.map +1 -1
- package/lib/entity/AcDb3dPolyline.d.ts +15 -1
- package/lib/entity/AcDb3dPolyline.d.ts.map +1 -1
- package/lib/entity/AcDb3dPolyline.js +32 -2
- package/lib/entity/AcDb3dPolyline.js.map +1 -1
- package/lib/entity/AcDb3dVertex.d.ts +15 -1
- package/lib/entity/AcDb3dVertex.d.ts.map +1 -1
- package/lib/entity/AcDb3dVertex.js +16 -1
- package/lib/entity/AcDb3dVertex.js.map +1 -1
- package/lib/entity/AcDbArc.d.ts +19 -1
- package/lib/entity/AcDbArc.d.ts.map +1 -1
- package/lib/entity/AcDbArc.js +103 -2
- package/lib/entity/AcDbArc.js.map +1 -1
- package/lib/entity/AcDbBlockReference.d.ts +18 -4
- package/lib/entity/AcDbBlockReference.d.ts.map +1 -1
- package/lib/entity/AcDbBlockReference.js +19 -2
- package/lib/entity/AcDbBlockReference.js.map +1 -1
- package/lib/entity/AcDbCircle.d.ts +15 -6
- package/lib/entity/AcDbCircle.d.ts.map +1 -1
- package/lib/entity/AcDbCircle.js +90 -6
- package/lib/entity/AcDbCircle.js.map +1 -1
- package/lib/entity/AcDbEllipse.d.ts +15 -6
- package/lib/entity/AcDbEllipse.d.ts.map +1 -1
- package/lib/entity/AcDbEllipse.js +55 -6
- package/lib/entity/AcDbEllipse.js.map +1 -1
- package/lib/entity/AcDbEntity.d.ts +17 -5
- package/lib/entity/AcDbEntity.d.ts.map +1 -1
- package/lib/entity/AcDbEntity.js +30 -0
- package/lib/entity/AcDbEntity.js.map +1 -1
- package/lib/entity/AcDbFace.d.ts +16 -13
- package/lib/entity/AcDbFace.d.ts.map +1 -1
- package/lib/entity/AcDbFace.js +49 -15
- package/lib/entity/AcDbFace.js.map +1 -1
- package/lib/entity/AcDbHatch.d.ts +18 -1
- package/lib/entity/AcDbHatch.d.ts.map +1 -1
- package/lib/entity/AcDbHatch.js +115 -1
- package/lib/entity/AcDbHatch.js.map +1 -1
- package/lib/entity/AcDbLeader.d.ts +1 -1
- package/lib/entity/AcDbLeader.d.ts.map +1 -1
- package/lib/entity/AcDbLeader.js +1 -1
- package/lib/entity/AcDbLeader.js.map +1 -1
- package/lib/entity/AcDbLine.d.ts +3 -15
- package/lib/entity/AcDbLine.d.ts.map +1 -1
- package/lib/entity/AcDbLine.js +12 -18
- package/lib/entity/AcDbLine.js.map +1 -1
- package/lib/entity/AcDbMText.d.ts +17 -8
- package/lib/entity/AcDbMText.d.ts.map +1 -1
- package/lib/entity/AcDbMText.js +20 -19
- package/lib/entity/AcDbMText.js.map +1 -1
- package/lib/entity/AcDbPoint.d.ts +16 -7
- package/lib/entity/AcDbPoint.d.ts.map +1 -1
- package/lib/entity/AcDbPoint.js +19 -6
- package/lib/entity/AcDbPoint.js.map +1 -1
- package/lib/entity/AcDbPolyline.d.ts +16 -7
- package/lib/entity/AcDbPolyline.d.ts.map +1 -1
- package/lib/entity/AcDbPolyline.js +52 -6
- package/lib/entity/AcDbPolyline.js.map +1 -1
- package/lib/entity/AcDbRasterImage.d.ts +1 -1
- package/lib/entity/AcDbRasterImage.d.ts.map +1 -1
- package/lib/entity/AcDbRasterImage.js +1 -1
- package/lib/entity/AcDbRasterImage.js.map +1 -1
- package/lib/entity/AcDbRay.d.ts +16 -7
- package/lib/entity/AcDbRay.d.ts.map +1 -1
- package/lib/entity/AcDbRay.js +23 -6
- package/lib/entity/AcDbRay.js.map +1 -1
- package/lib/entity/AcDbSpline.d.ts +15 -6
- package/lib/entity/AcDbSpline.d.ts.map +1 -1
- package/lib/entity/AcDbSpline.js +24 -6
- package/lib/entity/AcDbSpline.js.map +1 -1
- package/lib/entity/AcDbTable.d.ts +12 -2
- package/lib/entity/AcDbTable.d.ts.map +1 -1
- package/lib/entity/AcDbTable.js +108 -2
- package/lib/entity/AcDbTable.js.map +1 -1
- package/lib/entity/AcDbText.d.ts +16 -7
- package/lib/entity/AcDbText.d.ts.map +1 -1
- package/lib/entity/AcDbText.js +20 -19
- package/lib/entity/AcDbText.js.map +1 -1
- package/lib/entity/AcDbTrace.d.ts +16 -7
- package/lib/entity/AcDbTrace.d.ts.map +1 -1
- package/lib/entity/AcDbTrace.js +49 -9
- package/lib/entity/AcDbTrace.js.map +1 -1
- package/lib/entity/AcDbViewport.d.ts +1 -2
- package/lib/entity/AcDbViewport.d.ts.map +1 -1
- package/lib/entity/AcDbViewport.js +1 -2
- package/lib/entity/AcDbViewport.js.map +1 -1
- package/lib/entity/AcDbWipeout.d.ts +2 -7
- package/lib/entity/AcDbWipeout.d.ts.map +1 -1
- package/lib/entity/AcDbWipeout.js +2 -7
- package/lib/entity/AcDbWipeout.js.map +1 -1
- package/lib/entity/AcDbXline.d.ts +1 -6
- package/lib/entity/AcDbXline.d.ts.map +1 -1
- package/lib/entity/AcDbXline.js +1 -6
- package/lib/entity/AcDbXline.js.map +1 -1
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts +27 -4
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbAlignedDimension.js +143 -2
- package/lib/entity/dimension/AcDbAlignedDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts +0 -2
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbDiametricDimension.js +1 -3
- package/lib/entity/dimension/AcDbDiametricDimension.js.map +1 -1
- package/lib/entity/dimension/AcDbDimension.d.ts +1 -3
- package/lib/entity/dimension/AcDbDimension.d.ts.map +1 -1
- package/lib/entity/dimension/AcDbDimension.js +1 -15
- package/lib/entity/dimension/AcDbDimension.js.map +1 -1
- package/lib/misc/AcDbRenderingCache.js +1 -1
- package/lib/misc/AcDbRenderingCache.js.map +1 -1
- package/package.json +3 -3
package/dist/data-model.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function bu(i,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const o in n)if(o!=="default"&&!(o in i)){const h=Object.getOwnPropertyDescriptor(n,o);h&&Object.defineProperty(i,o,h.get?h:{enumerable:!0,get:()=>n[o]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var me=(i=>(i[i.ByColor=1]="ByColor",i[i.ByACI=2]="ByACI",i[i.ByLayer=3]="ByLayer",i[i.ByBlock=4]="ByBlock",i[i.None=0]="None",i))(me||{});const el={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},sa=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];let gn=class{static getColorByIndex(e){return sa[e]}static getIndexByColor(e){const t=sa.length-1;for(let n=1;n<t;++n)if(sa[n]===e)return n}static getColorByName(e){return el[e.toLowerCase()]}static getNameByColor(e){for(const[t,n]of Object.entries(el))if(n===e)return t}static getNameByIndex(e){const t=this.getColorByIndex(e);return this.getNameByColor(t)}},Qr=class fn{constructor(e=me.ByLayer,t){this._colorMethod=e,this._colorMethod==me.ByColor&&t==null?this._value=16777215:this._colorMethod==me.ByACI?t==null?this._value=8:t===0?this._colorMethod=me.ByBlock:t===256?this._colorMethod=me.ByLayer:this._value=Math.max(0,Math.min(t,256)):this._value=t}get colorMethod(){return this._colorMethod}set colorMethod(e){this._colorMethod=e}get red(){const e=this.RGB;return e!=null?e>>16&255:void 0}get green(){const e=this.RGB;return e!=null?e>>8&255:void 0}get blue(){const e=this.RGB;return e!=null?e&255:void 0}get RGB(){switch(this._colorMethod){case me.ByColor:case me.ByBlock:case me.ByLayer:return this._value;case me.ByACI:return this._value?gn.getColorByIndex(this._value):this._value;default:return}}setRGB(e,t,n){const o=Math.max(0,Math.min(255,Math.round(e))),h=Math.max(0,Math.min(255,Math.round(t))),u=Math.max(0,Math.min(255,Math.round(n)));return this._value=o<<16|h<<8|u,this._colorMethod=me.ByColor,this}setRGBValue(e){return e==null||!Number.isFinite(e)?(console.warn("Invalid RGB value:",e),this):(this._value=e&16777215,this._colorMethod=me.ByColor,this)}setRGBFromCss(e){if(!e)return this;const t=e.trim().toLowerCase();if(t.startsWith("#")){let h=0,u=0,g=0;if(t.length===7)h=parseInt(t.substr(1,2),16),u=parseInt(t.substr(3,2),16),g=parseInt(t.substr(5,2),16);else if(t.length===4)h=parseInt(t[1]+t[1],16),u=parseInt(t[2]+t[2],16),g=parseInt(t[3]+t[3],16);else return console.warn("Invalid hex color:",e),this;return this.setRGB(h,u,g)}const n=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n){const h=parseInt(n[1],10),u=parseInt(n[2],10),g=parseInt(n[3],10);return this.setRGB(h,u,g)}const o=gn.getColorByName(e);return o!==void 0?this.setRGBValue(o):(console.warn("Unknown CSS color string:",e),this)}setScalar(e){return this.setRGB(e,e,e)}get hexColor(){const e=this.RGB;return e==null?void 0:"0x"+e.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const e=this.RGB;if(e!=null)return`rgb(${e>>16&255},${e>>8&255},${e&255})`}get colorIndex(){return this._colorMethod===me.ByACI?this._value:this._colorMethod===me.ByLayer?256:this._colorMethod===me.ByBlock?0:void 0}set colorIndex(e){if(e==null)return;const t=Math.max(0,Math.min(256,Math.round(e)));t===0?(this._colorMethod=me.ByBlock,this._value=void 0):t===256?(this._colorMethod=me.ByLayer,this._value=void 0):(this._colorMethod=me.ByACI,this._value=t)}get isByColor(){return this._colorMethod===me.ByColor}get isByACI(){return this._colorMethod===me.ByACI}get isByLayer(){return this._colorMethod===me.ByLayer}setByLayer(e){return this._colorMethod=me.ByLayer,e==null?this._value=256:this._value=e,this}get isByBlock(){return this._colorMethod===me.ByBlock}setByBlock(e){return this._colorMethod=me.ByBlock,e==null?this._value=0:this._value=e,this}get colorName(){switch(this._colorMethod){case me.ByLayer:return"ByLayer";case me.ByBlock:return"ByBlock";case me.ByColor:return this._value?gn.getNameByColor(this._value):"";case me.ByACI:return this._value?gn.getNameByIndex(this._value):"";default:return}}set colorName(e){if(!e)return;const t=gn.getColorByName(e);t!==void 0?(this._value=t,this._colorMethod=me.ByColor):console.warn("Unknown color name:",e)}clone(){const e=new fn;return e._colorMethod=this._colorMethod,e._value=this._value,e}copy(e){return this._colorMethod=e._colorMethod,this._value=e._value,this}equals(e){return this._colorMethod===e._colorMethod&&this._value===e._value}toString(){switch(this._colorMethod){case me.ByLayer:return"ByLayer";case me.ByBlock:return"ByBlock";case me.ByACI:return this._value!==void 0?String(this._value):"";case me.ByColor:return this._value?`${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(e){if(!e)return;const t=e.trim();if(/^bylayer$/i.test(t))return new fn(me.ByLayer);if(/^byblock$/i.test(t))return new fn(me.ByBlock);if(/^\d{1,3},\d{1,3},\d{1,3}$/i.test(t)){const[o,h,u]=t.split(",").map(Number),g=new fn(me.ByColor);return g.setRGB(o,h,u),g}if(/^\d+$/.test(t)){const o=parseInt(t,10);return new fn(me.ByACI,o)}const n=gn.getColorByName(t);if(n!=null)return new fn(me.ByColor,n);console.warn("Unknown color name:",e)}};class xu{constructor(e=me.ByColor,t=0){this._colorMethod=e,this._value=t}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(e){this._colorMethod=me.ByColor,this._value=this._value&65535|(e&255)<<16}get green(){return this._value>>8&255}set green(e){this._colorMethod=me.ByColor,this._value=this._value&16711935|(e&255)<<8}get blue(){return this._value&255}set blue(e){this._colorMethod=me.ByColor,this._value=this._value&16776960|e&255}setRGB(e,t,n){this._colorMethod=me.ByColor,this._value=(e&255)<<16|(t&255)<<8|n&255}get colorIndex(){return this._value}set colorIndex(e){this._colorMethod=me.ByACI,this._value=e}get layerIndex(){return this._value}set layerIndex(e){this._colorMethod=me.ByLayer,this._value=e}isByColor(){return this._colorMethod===me.ByColor}isByLayer(){return this._colorMethod===me.ByLayer}isByBlock(){return this._colorMethod===me.ByBlock}isByACI(){return this._colorMethod===me.ByACI}isNone(){return this._colorMethod===me.None}get rawValue(){return this._value}set rawValue(e){this._value=e}}const Ht={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")}};class wu{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const n=this._listeners[e];if(n!==void 0){const o=n.indexOf(t);o!==-1&&n.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const n=t.slice(0);for(let o=0,h=n.length;o<h;o++)n[o].call(this,e)}}}let at=class{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const n of this.listeners)n.call(null,e,...t)}};function Ns(i){return i===null||typeof i!="object"?i:Array.isArray(i)?[...i]:{...i}}function va(i){if(i===null||typeof i!="object")return i;if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp)return new RegExp(i.source,i.flags);if(Array.isArray(i))return i.map(va);const e={};for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=va(i[t]));return e}function Hn(i,...e){for(const t of e)if(t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&i[n]===void 0&&(i[n]=t[n]);return i}function vl(i,e){return i!=null&&Object.prototype.hasOwnProperty.call(i,e)}function bl(i){return i==null?!0:Array.isArray(i)||typeof i=="string"?i.length===0:i instanceof Map||i instanceof Set?i.size===0:typeof i=="object"?Object.keys(i).length===0:!1}function Gn(i,e){if(i===e)return!0;if(i==null||e==null)return i===e;if(typeof i!=typeof e)return!1;if(typeof i!="object")return i===e;if(Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)){if(i.length!==e.length)return!1;for(let o=0;o<i.length;o++)if(!Gn(i[o],e[o]))return!1;return!0}const t=Object.keys(i),n=Object.keys(e);if(t.length!==n.length)return!1;for(const o of t)if(!Object.prototype.hasOwnProperty.call(e,o)||!Gn(i[o],e[o]))return!1;return!0}var Au=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Su(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var xl={exports:{}};(function(i){(function(e,t){i.exports?i.exports=t():e.log=t()})(Au,function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],h={},u=null;function g(B,F){var D=B[F];if(typeof D.bind=="function")return D.bind(B);try{return Function.prototype.bind.call(D,B)}catch{return function(){return Function.prototype.apply.apply(D,[B,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(B){return B==="debug"&&(B="log"),typeof console===t?!1:B==="trace"&&n?b:console[B]!==void 0?g(console,B):console.log!==void 0?g(console,"log"):e}function w(){for(var B=this.getLevel(),F=0;F<o.length;F++){var D=o[F];this[D]=F<B?e:this.methodFactory(D,B,this.name)}if(this.log=this.debug,typeof console===t&&B<this.levels.SILENT)return"No console available for logging"}function x(B){return function(){typeof console!==t&&(w.call(this),this[B].apply(this,arguments))}}function E(B,F,D){return f(B)||x.apply(this,arguments)}function M(B,F){var D=this,de,ve,oe,W="loglevel";typeof B=="string"?W+=":"+B:typeof B=="symbol"&&(W=void 0);function ce(we){var Be=(o[we]||"silent").toUpperCase();if(!(typeof window===t||!W)){try{window.localStorage[W]=Be;return}catch{}try{window.document.cookie=encodeURIComponent(W)+"="+Be+";"}catch{}}}function se(){var we;if(!(typeof window===t||!W)){try{we=window.localStorage[W]}catch{}if(typeof we===t)try{var Be=window.document.cookie,mt=encodeURIComponent(W),gt=Be.indexOf(mt+"=");gt!==-1&&(we=/^([^;]+)/.exec(Be.slice(gt+mt.length+1))[1])}catch{}return D.levels[we]===void 0&&(we=void 0),we}}function Ge(){if(!(typeof window===t||!W)){try{window.localStorage.removeItem(W)}catch{}try{window.document.cookie=encodeURIComponent(W)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Xe(we){var Be=we;if(typeof Be=="string"&&D.levels[Be.toUpperCase()]!==void 0&&(Be=D.levels[Be.toUpperCase()]),typeof Be=="number"&&Be>=0&&Be<=D.levels.SILENT)return Be;throw new TypeError("log.setLevel() called with invalid level: "+we)}D.name=B,D.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},D.methodFactory=F||E,D.getLevel=function(){return oe??ve??de},D.setLevel=function(we,Be){return oe=Xe(we),Be!==!1&&ce(oe),w.call(D)},D.setDefaultLevel=function(we){ve=Xe(we),se()||D.setLevel(we,!1)},D.resetLevel=function(){oe=null,Ge(),w.call(D)},D.enableAll=function(we){D.setLevel(D.levels.TRACE,we)},D.disableAll=function(we){D.setLevel(D.levels.SILENT,we)},D.rebuild=function(){if(u!==D&&(de=Xe(u.getLevel())),w.call(D),u===D)for(var we in h)h[we].rebuild()},de=Xe(u?u.getLevel():"WARN");var He=se();He!=null&&(oe=Xe(He)),w.call(D)}u=new M,u.getLogger=function(B){if(typeof B!="symbol"&&typeof B!="string"||B==="")throw new TypeError("You must supply a name when creating a logger.");var F=h[B];return F||(F=h[B]=new M(B,u.methodFactory)),F};var L=typeof window!==t?window.log:void 0;return u.noConflict=function(){return typeof window!==t&&window.log===u&&(window.log=L),u},u.getLoggers=function(){return h},u.default=u,u})})(xl);var wl=xl.exports;const Iu=Su(wl),Pu=bu({__proto__:null,default:Iu},[wl]),Eu=!0,Ls=Pu;Ls.setLevel("debug");const ku=i=>{try{Ls.setLevel(i)}catch(e){Ls.setLevel("error"),Ls.error(e)}};let Al=class Sl{constructor(e,t){this.events={attrChanged:new at,modelChanged:new at},this._changing=!1,this._previousAttributes={},this._pending=!1;const n=e||{};t&&Hn(n,t),this.attributes=n,this.changed={}}get(e){return this.attributes[e]}set(e,t,n){if(e==null)return this;let o;typeof e=="object"?(o=e,n=t):(o={},o[e]=t),n||(n={});const h=n.unset,u=n.silent,g=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=Ns(this.attributes),this.changed={});const f=this.attributes,w=this.changed,x=this._previousAttributes;for(const E in o)t=o[E],Gn(f[E],t)||g.push(E),Gn(x[E],t)?delete w[E]:w[E]=t,h?delete f[E]:f[E]=t;if(!u){g.length&&(this._pending=n);for(let E=0;E<g.length;E++)this.events.attrChanged.dispatch({object:this,attrName:g[E],attrValue:f[g[E]],options:n})}if(b)return this;if(!u)for(;this._pending;)n=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:n});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!bl(this.changed):vl(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?Ns(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,n={};for(const o in e){const h=e[o];Gn(t[o],h)||(n[o]=h)}return n}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return Ns(this._previousAttributes)}clone(){const e=Ns(this.attributes);return new Sl(e)}},Ma=class Cs{constructor(){this.entries=new Map}static getInstance(){return Cs.instance||(Cs.instance=new Cs),Cs.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries)console.log(`${e}:`),console.log(t.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}};class Mu{static formatBytes(e,t=2){if(e===0)return"0 B";const n=1024,o=Math.max(0,t),h=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(e)/Math.log(n)),g=e/Math.pow(n,u);return`${parseFloat(g.toFixed(o))} ${h[u]}`}}var St=(i=>(i[i.ByLayer=0]="ByLayer",i[i.ByBlock=1]="ByBlock",i[i.ByAlpha=2]="ByAlpha",i[i.ErrorValue=3]="ErrorValue",i))(St||{});let Ui=class ur{constructor(e){e!==void 0?(this._method=St.ByAlpha,this._alpha=ur.clampAlpha(e)):(this._method=St.ByLayer,this._alpha=255)}get method(){return this._method}set method(e){this._method=e}get alpha(){return this._alpha}set alpha(e){this._alpha=ur.clampAlpha(e),this._method=St.ByAlpha}get percentage(){if(this._method===St.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(e){const t=Math.max(0,Math.min(100,e)),n=Math.round(255*(1-t/100));this.alpha=n}static clampAlpha(e){return Math.max(0,Math.min(255,Math.floor(e)))}get isByAlpha(){return this._method===St.ByAlpha}get isByBlock(){return this._method===St.ByBlock}get isByLayer(){return this._method===St.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===St.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const e=new ur;return e._method=this._method,e._alpha=this._alpha,e}equals(e){return this._method===e._method&&this._alpha===e._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(e){const t=e.trim();if(/^bylayer$/i.test(t)){const h=new ur;return h._method=St.ByLayer,h}if(/^byblock$/i.test(t)){const h=new ur;return h._method=St.ByBlock,h}const n=Number(t);if(Number.isInteger(n)&&n>=0&&n<=255)return new ur(n);const o=new ur;return o._method=St.ErrorValue,o}static deserialize(e){const t=e>>>24&255,n=e&255,o=Object.values(St)[t]??St.ErrorValue,h=new ur;return h._method=o,h._alpha=ur.clampAlpha(n),h}};class Il{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}let Pl=class{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(e){return new Promise((t,n)=>{const o=()=>{Promise.resolve(e()).then(t).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let n=e;for(let o=0;o<t;o++){const h=this.tasks[o];try{n=await this.scheduleTask(async()=>{const u=await h.run(n);return this.onProgress((o+1)/t,h),u})}catch(u){if(this.onError({error:u,taskIndex:o,task:h}))break}}this.onComplete(n)}},El=class{constructor(e,t,n){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,n=this.handlers.length;t<n;t+=2){const o=this.handlers[t],h=this.handlers[t+1];if(o.global&&(o.lastIndex=0),o.test(e))return h}return null}};const kl=new El;class Tu{constructor(e){this.manager=e!==void 0?e:kl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((n,o)=>{this.load(e,n,t,o)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}class Ta{constructor(e,t,n){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=n,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,n)=>{const o=()=>{Promise.resolve(e()).then(t).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}async processChunk(e){let t=0;const n=async()=>{const o=t,h=Math.min(t+this._chunkSize,this._count);await e(o,h),t=h,t<this._count&&await this.scheduleTask(n)};await n()}}var Na=(i=>(i[i.DecimalDegrees=0]="DecimalDegrees",i[i.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",i[i.Gradians=2]="Gradians",i[i.Radians=3]="Radians",i[i.SurveyorsUnits=4]="SurveyorsUnits",i))(Na||{});class Xr{static get instance(){return this._instance||(this._instance=new Xr),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,n,o=!0,h,u){var b;const g=[];if(t!=null){const f=this.createKey(t.name,n);let w;if(this.has(f))w=this.get(f);else{const x=(b=e.basePoint)==null?void 0:b.clone();e.basePoint=void 0;const E=t.newIterator();let M=!0;for(const L of E)if(L.color.isByBlock&&n?(tl.copy(L.color),L.color.setRGBValue(n),this.addEntity(L,g,e),L.color.copy(tl)):this.addEntity(L,g,e),M){const B=g[0];e.basePoint=B.basePoint,M=!1}w=e.group(g),w&&o&&pt.name&&!pt.name.startsWith("*U")&&this.set(f,w),e.basePoint=x}return w&&h&&(w.applyMatrix(h),u&&(u.x!=0||u.y!=0||u.z!=1)&&(h.setFromExtrusionDirection(u),w.applyMatrix(h))),w}else return e.group(g)}addEntity(e,t,n){const o=e.draw(n);o&&(this.attachEntityInfo(o,e),t.push(o))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const tl=new Qr;var Ca=(i=>(i[i.UTF8=0]="UTF8",i[i.US_ASCII=1]="US_ASCII",i[i.ISO_8859_1=2]="ISO_8859_1",i[i.ISO_8859_2=3]="ISO_8859_2",i[i.ISO_8859_3=4]="ISO_8859_3",i[i.ISO_8859_4=5]="ISO_8859_4",i[i.ISO_8859_5=6]="ISO_8859_5",i[i.ISO_8859_6=7]="ISO_8859_6",i[i.ISO_8859_7=8]="ISO_8859_7",i[i.ISO_8859_8=9]="ISO_8859_8",i[i.ISO_8859_9=10]="ISO_8859_9",i[i.CP437=11]="CP437",i[i.CP850=12]="CP850",i[i.CP852=13]="CP852",i[i.CP855=14]="CP855",i[i.CP857=15]="CP857",i[i.CP860=16]="CP860",i[i.CP861=17]="CP861",i[i.CP863=18]="CP863",i[i.CP864=19]="CP864",i[i.CP865=20]="CP865",i[i.CP869=21]="CP869",i[i.CP932=22]="CP932",i[i.MACINTOSH=23]="MACINTOSH",i[i.BIG5=24]="BIG5",i[i.CP949=25]="CP949",i[i.JOHAB=26]="JOHAB",i[i.CP866=27]="CP866",i[i.ANSI_1250=28]="ANSI_1250",i[i.ANSI_1251=29]="ANSI_1251",i[i.ANSI_1252=30]="ANSI_1252",i[i.GB2312=31]="GB2312",i[i.ANSI_1253=32]="ANSI_1253",i[i.ANSI_1254=33]="ANSI_1254",i[i.ANSI_1255=34]="ANSI_1255",i[i.ANSI_1256=35]="ANSI_1256",i[i.ANSI_1257=36]="ANSI_1257",i[i.ANSI_874=37]="ANSI_874",i[i.ANSI_932=38]="ANSI_932",i[i.ANSI_936=39]="ANSI_936",i[i.ANSI_949=40]="ANSI_949",i[i.ANSI_950=41]="ANSI_950",i[i.ANSI_1361=42]="ANSI_1361",i[i.UTF16=43]="UTF16",i[i.ANSI_1258=44]="ANSI_1258",i[i.UNDEFINED=255]="UNDEFINED",i))(Ca||{});const Nu=["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"],Ml=i=>Nu[i],li="Continuous",ti="ByLayer",Tl="ByBlock",yt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let rl=1234567;const La=Math.PI/180,Oa=180/Math.PI;function Nl(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(yt[i&255]+yt[i>>8&255]+yt[i>>16&255]+yt[i>>24&255]+"-"+yt[e&255]+yt[e>>8&255]+"-"+yt[e>>16&15|64]+yt[e>>24&255]+"-"+yt[t&63|128]+yt[t>>8&255]+"-"+yt[t>>16&255]+yt[t>>24&255]+yt[n&255]+yt[n>>8&255]+yt[n>>16&255]+yt[n>>24&255]).toLowerCase()}function Cr(i,e,t){return Math.max(e,Math.min(t,i))}function Ba(i,e){return(i%e+e)%e}function Cl(i,e,t,n,o){return n+(i-e)*(o-n)/(t-e)}function Ll(i,e,t){return i!==e?(t-i)/(e-i):0}function za(i,e,t){return(1-t)*i+t*e}function Ol(i,e,t,n){return za(i,e,1-Math.exp(-t*n))}function Bl(i,e=1){return e-Math.abs(Ba(i,e*2)-e)}function zl(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Rl(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Dl(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Fl(i,e){return i+Math.random()*(e-i)}function Ul(i){return i*(.5-Math.random())}function Vl(i){i!==void 0&&(rl=i);let e=rl+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Gl(i){return i*La}function jl(i){return i*Oa}function Wl(i){return(i&i-1)===0&&i!==0}function Hl(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Yl(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Os(i){const e=Math.PI*2;return(i%e+e)%e}function ql(i,e,t){return i>e&&i<t||i>t&&i<e}function Xl(i,e,t,n=!1){return i=Os(i),e=Os(e),t=Os(t),n?e>t?i<=e&&i>=t:i<=e||i>=t:e<t?i>=e&&i<=t:i>=e||i<=t}function Ra(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function Kl(i,e=1e-7){const t=Ra(i);return Math.max(Math.pow(10,t)*e,e)}const ke={DEG2RAD:La,RAD2DEG:Oa,generateUUID:Nl,clamp:Cr,euclideanModulo:Ba,mapLinear:Cl,inverseLerp:Ll,lerp:za,damp:Ol,pingpong:Bl,smoothstep:zl,smootherstep:Rl,randInt:Dl,randFloat:Fl,randFloatSpread:Ul,seededRandom:Vl,degToRad:Gl,radToDeg:jl,isPowerOfTwo:Wl,ceilPowerOfTwo:Hl,floorPowerOfTwo:Yl,normalizeAngle:Os,isBetween:ql,isBetweenAngle:Xl,intPartLength:Ra,relativeEps:Kl},ba=class $l{constructor(e,t){this.x=0,this.y=0;const n=+(e!==void 0)+ +(t!==void 0);if(n!==0){if(n===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(n===1){const{x:o,y:h}=e;this.x=o,this.y=h;return}if(n===2){this.x=e,this.y=t;return}throw Ht.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new $l(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix2d(e){const t=this.x,n=this.y,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6],this.y=o[1]*t+o[4]*n+o[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,n)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const n=Math.cos(t),o=Math.sin(t),h=this.x-e.x,u=this.y-e.y;return this.x=h*n-u*o+e.x,this.y=h*o+u*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(ke.relativeEps(this.x,e),ke.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};ba.EMPTY=Object.freeze(new ba(0,0));let Ze=ba;const xa=class Zl{constructor(e,t,n,o,h,u,g,b,f){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&n!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&this.set(e,t,n,o,h,u,g,b,f)}set(e,t,n,o,h,u,g,b,f){const w=this.elements;return w[0]=e,w[1]=o,w[2]=g,w[3]=t,w[4]=h,w[5]=b,w[6]=n,w[7]=u,w[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,o=t.elements,h=this.elements,u=n[0],g=n[3],b=n[6],f=n[1],w=n[4],x=n[7],E=n[2],M=n[5],L=n[8],B=o[0],F=o[3],D=o[6],de=o[1],ve=o[4],oe=o[7],W=o[2],ce=o[5],se=o[8];return h[0]=u*B+g*de+b*W,h[3]=u*F+g*ve+b*ce,h[6]=u*D+g*oe+b*se,h[1]=f*B+w*de+x*W,h[4]=f*F+w*ve+x*ce,h[7]=f*D+w*oe+x*se,h[2]=E*B+M*de+L*W,h[5]=E*F+M*ve+L*ce,h[8]=E*D+M*oe+L*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],w=e[8];return t*u*w-t*g*f-n*h*w+n*g*b+o*h*f-o*u*b}invert(){const e=this.elements,t=e[0],n=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],w=e[8],x=w*u-g*f,E=g*b-w*h,M=f*h-u*b,L=t*x+n*E+o*M;if(L===0)return this.set(0,0,0,0,0,0,0,0,0);const B=1/L;return e[0]=x*B,e[1]=(o*f-w*n)*B,e[2]=(g*n-o*u)*B,e[3]=E*B,e[4]=(w*t-o*b)*B,e[5]=(o*h-g*t)*B,e[6]=M*B,e[7]=(n*b-f*t)*B,e[8]=(u*t-n*h)*B,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this}setUvTransform(e,t,n,o,h,u,g){const b=Math.cos(h),f=Math.sin(h);return this.set(n*b,n*f,-n*(b*u+f*g)+u+e,-o*f,o*b,-o*(-f*u+b*g)+g+t,0,0,1),this}scale(e,t){return this.premultiply(ia.makeScale(e,t)),this}rotate(e){return this.premultiply(ia.makeRotation(-e)),this}translate(e,t){return this.premultiply(ia.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof Ze?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let o=0;o<9;o++)if(t[o]!==n[o])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new Zl().fromArray(this.elements)}};xa.IDENTITY=Object.freeze(new xa);let Vi=xa;const ia=new Vi,_n=1e-6,st=2*Math.PI,Cu={x:0,y:0},Da={x:0,y:0,z:0};class Fa{constructor(){this.equalPointTol=_n,this.equalVectorTol=_n}equalPoint2d(e,t){return new Ze(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new Z(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=_n){return e<t&&e>-t}static equal(e,t,n=_n){return Math.abs(e-t)<n}static great(e,t,n=_n){return e-t>n}static less(e,t,n=_n){return e-t<n}}const Ua=new Fa;function Va(i,e,t=!1){const n=i.x,o=i.y;let h=!1;const u=e.length;for(let g=0,b=u-1;g<u;b=g++){const f=e[g].x,w=e[g].y,x=e[b].x,E=e[b].y;let M=w>o!=E>o;t&&(M=w>=o!=E>=o),M&&n<(x-f)*(o-w)/(E-w)+f&&(h=!h)}return h}function Ql(i,e){if(i.length===0||e.length===0)return!1;const t=new vt().setFromPoints(i),n=new vt().setFromPoints(e);if(!t.intersectsBox(n))return!1;for(let o=0;o<i.length;){if(Va(i[o],e,!0))return!0;o<i.length-1&&Ua.equalPoint2d(i[o+1],i[o])&&++o,++o}return!1}const Jl={isPointInPolygon:Va,isPolygonIntersect:Ql};function eh(i,e){const t=[],n=e-1,o=i;for(let h=0;h<=o;h++)t.push(0);for(let h=1;h<=n-o;h++)t.push(h);for(let h=0;h<=o;h++)t.push(n-o+1);return t}function th(i,e){const t=e.length-1,n=i,o=[0];let h=0;for(let g=1;g<=t;g++){const b=e[g][0]-e[g-1][0],f=e[g][1]-e[g-1][1],w=e[g][2]-e[g-1][2],x=Math.sqrt(b*b+f*f+w*w);h+=x,o.push(h)}const u=[];for(let g=0;g<=n;g++)u.push(0);for(let g=1;g<=t-n;g++){const b=o[g]/h;u.push(b*(t-n+1))}for(let g=0;g<=n;g++)u.push(t-n+1);return u}function rh(i,e){const t=e.length-1,n=i,o=[0];let h=0;for(let g=1;g<=t;g++){const b=e[g][0]-e[g-1][0],f=e[g][1]-e[g-1][1],w=e[g][2]-e[g-1][2],x=Math.sqrt(b*b+f*f+w*w),E=Math.sqrt(x);h+=E,o.push(h)}const u=[];for(let g=0;g<=n;g++)u.push(0);for(let g=1;g<=t-n;g++){const b=o[g]/h;u.push(b*(t-n+1))}for(let g=0;g<=n;g++)u.push(t-n+1);return u}function hi(i,e,t,n){if(e===0)return t>=n[i]&&t<n[i+1]?1:0;const o=n[i+e]-n[i],h=n[i+e+1]-n[i+1],u=o>1e-10?(t-n[i])/o:0,g=h>1e-10?(n[i+e+1]-t)/h:0;return u*hi(i,e-1,t,n)+g*hi(i+1,e-1,t,n)}function Bs(i,e,t,n,o){const h=n.length-1,u=e;if(i=Math.max(t[u],Math.min(t[h+1],i)),Math.abs(i-t[h+1])<1e-8)return[...n[h]];if(Math.abs(i-t[u])<1e-8)return[...n[0]];const g=[0,0,0];let b=0;for(let f=0;f<=h;f++){const w=hi(f,u,i,t),x=o[f]*w;g[0]+=n[f][0]*x,g[1]+=n[f][1]*x,g[2]+=n[f][2]*x,b+=x}if(b<1e-10){const f=t[t.length-u-1];if(Math.abs(i-f)<1e-8)return[...n[h]];if(Math.abs(i-t[u])<1e-8)return[...n[0]]}return b>1e-10&&(g[0]/=b,g[1]/=b,g[2]/=b),g}function nh(i,e,t,n){const o=i,h=e[o],u=e[e.length-o-1];let g=0;const b=1e3,f=(u-h)/b;let w=Bs(h,i,e,t,n);for(let B=1;B<=b;B++){const F=h+B*f,D=Bs(F,i,e,t,n),de=D[0]-w[0],ve=D[1]-w[1],oe=D[2]-w[2];g+=Math.sqrt(de*de+ve*ve+oe*oe),w=D}const x=Bs(u,i,e,t,n),E=x[0]-w[0],M=x[1]-w[1],L=x[2]-w[2];return g+=Math.sqrt(E*E+M*M+L*L),g}function Lu(i){return i.map(e=>[...e])}class Kr{constructor(e=0,t=0,n=0,o=1){this._x=e,this._y=t,this._z=n,this._w=o}static slerpFlat(e,t,n,o,h,u,g){let b=n[o+0],f=n[o+1],w=n[o+2],x=n[o+3];const E=h[u+0],M=h[u+1],L=h[u+2],B=h[u+3];if(g===0){e[t+0]=b,e[t+1]=f,e[t+2]=w,e[t+3]=x;return}if(g===1){e[t+0]=E,e[t+1]=M,e[t+2]=L,e[t+3]=B;return}if(x!==B||b!==E||f!==M||w!==L){let F=1-g;const D=b*E+f*M+w*L+x*B,de=D>=0?1:-1,ve=1-D*D;if(ve>Number.EPSILON){const W=Math.sqrt(ve),ce=Math.atan2(W,D*de);F=Math.sin(F*ce)/W,g=Math.sin(g*ce)/W}const oe=g*de;if(b=b*F+E*oe,f=f*F+M*oe,w=w*F+L*oe,x=x*F+B*oe,F===1-g){const W=1/Math.sqrt(b*b+f*f+w*w+x*x);b*=W,f*=W,w*=W,x*=W}}e[t]=b,e[t+1]=f,e[t+2]=w,e[t+3]=x}static multiplyQuaternionsFlat(e,t,n,o,h,u){const g=n[o],b=n[o+1],f=n[o+2],w=n[o+3],x=h[u],E=h[u+1],M=h[u+2],L=h[u+3];return e[t]=g*L+w*x+b*M-f*E,e[t+1]=b*L+w*E+f*x-g*M,e[t+2]=f*L+w*M+g*E-b*x,e[t+3]=w*L-g*x-b*E-f*M,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,o){return this._x=e,this._y=t,this._z=n,this._w=o,this._onChangeCallback(),this}clone(){return new Kr(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e.x,o=e.y,h=e.z,u=e.order,g=Math.cos,b=Math.sin,f=g(n/2),w=g(o/2),x=g(h/2),E=b(n/2),M=b(o/2),L=b(h/2);switch(u){case"XYZ":this._x=E*w*x+f*M*L,this._y=f*M*x-E*w*L,this._z=f*w*L+E*M*x,this._w=f*w*x-E*M*L;break;case"YXZ":this._x=E*w*x+f*M*L,this._y=f*M*x-E*w*L,this._z=f*w*L-E*M*x,this._w=f*w*x+E*M*L;break;case"ZXY":this._x=E*w*x-f*M*L,this._y=f*M*x+E*w*L,this._z=f*w*L+E*M*x,this._w=f*w*x-E*M*L;break;case"ZYX":this._x=E*w*x-f*M*L,this._y=f*M*x+E*w*L,this._z=f*w*L-E*M*x,this._w=f*w*x+E*M*L;break;case"YZX":this._x=E*w*x+f*M*L,this._y=f*M*x+E*w*L,this._z=f*w*L-E*M*x,this._w=f*w*x-E*M*L;break;case"XZY":this._x=E*w*x-f*M*L,this._y=f*M*x-E*w*L,this._z=f*w*L+E*M*x,this._w=f*w*x+E*M*L;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+u)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,o=Math.sin(n);return this._x=e.x*o,this._y=e.y*o,this._z=e.z*o,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],o=t[4],h=t[8],u=t[1],g=t[5],b=t[9],f=t[2],w=t[6],x=t[10],E=n+g+x;if(E>0){const M=.5/Math.sqrt(E+1);this._w=.25/M,this._x=(w-b)*M,this._y=(h-f)*M,this._z=(u-o)*M}else if(n>g&&n>x){const M=2*Math.sqrt(1+n-g-x);this._w=(w-b)/M,this._x=.25*M,this._y=(o+u)/M,this._z=(h+f)/M}else if(g>x){const M=2*Math.sqrt(1+g-n-x);this._w=(h-f)/M,this._x=(o+u)/M,this._y=.25*M,this._z=(b+w)/M}else{const M=2*Math.sqrt(1+x-n-g);this._w=(u-o)/M,this._x=(h+f)/M,this._y=(b+w)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Cr(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const o=Math.min(1,t/n);return this.slerp(e,o),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,o=e._y,h=e._z,u=e._w,g=t._x,b=t._y,f=t._z,w=t._w;return this._x=n*w+u*g+o*f-h*b,this._y=o*w+u*b+h*g-n*f,this._z=h*w+u*f+n*b-o*g,this._w=u*w-n*g-o*b-h*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,o=this._y,h=this._z,u=this._w;let g=u*e._w+n*e._x+o*e._y+h*e._z;if(g<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,g=-g):this.copy(e),g>=1)return this._w=u,this._x=n,this._y=o,this._z=h,this;const b=1-g*g;if(b<=Number.EPSILON){const M=1-t;return this._w=M*u+t*this._w,this._x=M*n+t*this._x,this._y=M*o+t*this._y,this._z=M*h+t*this._z,this.normalize(),this}const f=Math.sqrt(b),w=Math.atan2(f,g),x=Math.sin((1-t)*w)/f,E=Math.sin(t*w)/f;return this._w=u*x+this._w*E,this._x=n*x+this._x*E,this._y=o*x+this._y*E,this._z=h*x+this._z*E,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),o=Math.sqrt(1-n),h=Math.sqrt(n);return this.set(o*Math.sin(e),o*Math.cos(e),h*Math.sin(t),h*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Wt=class sh{constructor(e,t,n){this.x=0,this.y=0,this.z=0;const o=+(e!==void 0)+ +(t!==void 0)+ +(n!==void 0);if(o!==0){if(o===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(o===1){const{x:h,y:u,z:g}=e;this.x=h,this.y=u,this.z=g||0;return}if(o===3){this.x=e,this.y=t,this.z=n;return}throw Ht.ILLEGAL_PARAMETERS}}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new sh(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(nl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(nl.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,o=this.z,h=e.elements;return this.x=h[0]*t+h[3]*n+h[6]*o,this.y=h[1]*t+h[4]*n+h[7]*o,this.z=h[2]*t+h[5]*n+h[8]*o,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,o=this.z,h=e.elements,u=1/(h[3]*t+h[7]*n+h[11]*o+h[15]);return this.x=(h[0]*t+h[4]*n+h[8]*o+h[12])*u,this.y=(h[1]*t+h[5]*n+h[9]*o+h[13])*u,this.z=(h[2]*t+h[6]*n+h[10]*o+h[14])*u,this}applyQuaternion(e){const t=this.x,n=this.y,o=this.z,h=e.x,u=e.y,g=e.z,b=e.w,f=2*(u*o-g*n),w=2*(g*t-h*o),x=2*(h*n-u*t);return this.x=t+b*f+u*x-g*w,this.y=n+b*w+g*f-h*x,this.z=o+b*x+h*w-u*f,this}transformDirection(e){const t=this.x,n=this.y,o=this.z,h=e.elements;return this.x=h[0]*t+h[4]*n+h[8]*o,this.y=h[1]*t+h[5]*n+h[9]*o,this.z=h[2]*t+h[6]*n+h[10]*o,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),n=this.length(),o=e.length();return Math.abs(t)===n*o}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,o=e.y,h=e.z,u=t.x,g=t.y,b=t.z;return this.x=o*b-h*g,this.y=h*u-n*b,this.z=n*g-o*u,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return aa.copy(this).projectOnVector(e),this.sub(aa)}reflect(e){return this.sub(aa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,n)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,o=this.z-e.z;return t*t+n*n+o*o}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),o=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=o,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Wt.X_AXIS=Object.freeze(new Wt(1,0,0)),Wt.NEGATIVE_X_AXIS=Object.freeze(new Wt(-1,0,0)),Wt.Y_AXIS=Object.freeze(new Wt(0,1,0)),Wt.NEGATIVE_Y_AXIS=Object.freeze(new Wt(0,-1,0)),Wt.Z_AXIS=Object.freeze(new Wt(0,0,1)),Wt.NEGATIVE_Z_AXIS=Object.freeze(new Wt(0,0,-1));let Z=Wt;const aa=new Z,nl=new Kr,wa=class ih{constructor(e,t,n,o,h,u,g,b,f,w,x,E,M,L,B,F){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&n!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&w!=null&&x!=null&&E!=null&&M!=null&&L!=null&&B!=null&&F!=null&&this.set(e,t,n,o,h,u,g,b,f,w,x,E,M,L,B,F)}set(e,t,n,o,h,u,g,b,f,w,x,E,M,L,B,F){const D=this.elements;return D[0]=e,D[4]=t,D[8]=n,D[12]=o,D[1]=h,D[5]=u,D[9]=g,D[13]=b,D[2]=f,D[6]=w,D[10]=x,D[14]=E,D[3]=M,D[7]=L,D[11]=B,D[15]=F,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ih().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(Ua.equalPoint3d(e,Z.Z_AXIS))this.identity();else{const t=new Z(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(Z.Y_AXIS,e).normalize():t.crossVectors(Z.Z_AXIS,e).normalize();const n=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,n.x,n.y,n.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,o=1/Dn.setFromMatrixColumn(e,0).length(),h=1/Dn.setFromMatrixColumn(e,1).length(),u=1/Dn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o,t[3]=0,t[4]=n[4]*h,t[5]=n[5]*h,t[6]=n[6]*h,t[7]=0,t[8]=n[8]*u,t[9]=n[9]*u,t[10]=n[10]*u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ou,e,Bu)}lookAt(e,t,n){const o=this.elements;return Rt.subVectors(e,t),Rt.lengthSq()===0&&(Rt.z=1),Rt.normalize(),Hr.crossVectors(n,Rt),Hr.lengthSq()===0&&(Math.abs(n.z)===1?Rt.x+=1e-4:Rt.z+=1e-4,Rt.normalize(),Hr.crossVectors(n,Rt)),Hr.normalize(),Ks.crossVectors(Rt,Hr),o[0]=Hr.x,o[4]=Ks.x,o[8]=Rt.x,o[1]=Hr.y,o[5]=Ks.y,o[9]=Rt.y,o[2]=Hr.z,o[6]=Ks.z,o[10]=Rt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,o=t.elements,h=this.elements,u=n[0],g=n[4],b=n[8],f=n[12],w=n[1],x=n[5],E=n[9],M=n[13],L=n[2],B=n[6],F=n[10],D=n[14],de=n[3],ve=n[7],oe=n[11],W=n[15],ce=o[0],se=o[4],Ge=o[8],Xe=o[12],He=o[1],we=o[5],Be=o[9],mt=o[13],gt=o[2],Ct=o[6],et=o[10],ot=o[14],Q=o[3],Ce=o[7],lt=o[11],pr=o[15];return h[0]=u*ce+g*He+b*gt+f*Q,h[4]=u*se+g*we+b*Ct+f*Ce,h[8]=u*Ge+g*Be+b*et+f*lt,h[12]=u*Xe+g*mt+b*ot+f*pr,h[1]=w*ce+x*He+E*gt+M*Q,h[5]=w*se+x*we+E*Ct+M*Ce,h[9]=w*Ge+x*Be+E*et+M*lt,h[13]=w*Xe+x*mt+E*ot+M*pr,h[2]=L*ce+B*He+F*gt+D*Q,h[6]=L*se+B*we+F*Ct+D*Ce,h[10]=L*Ge+B*Be+F*et+D*lt,h[14]=L*Xe+B*mt+F*ot+D*pr,h[3]=de*ce+ve*He+oe*gt+W*Q,h[7]=de*se+ve*we+oe*Ct+W*Ce,h[11]=de*Ge+ve*Be+oe*et+W*lt,h[15]=de*Xe+ve*mt+oe*ot+W*pr,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],o=e[8],h=e[12],u=e[1],g=e[5],b=e[9],f=e[13],w=e[2],x=e[6],E=e[10],M=e[14],L=e[3],B=e[7],F=e[11],D=e[15];return L*(+h*b*x-o*f*x-h*g*E+n*f*E+o*g*M-n*b*M)+B*(+t*b*M-t*f*E+h*u*E-o*u*M+o*f*w-h*b*w)+F*(+t*f*x-t*g*M-h*u*x+n*u*M+h*g*w-n*f*w)+D*(-o*g*w-t*b*x+t*g*E+o*u*x-n*u*E+n*b*w)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const o=this.elements;return e instanceof Z?(o[12]=e.x,o[13]=e.y,o[14]=e.z):(o[12]=e,o[13]=t,o[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],w=e[8],x=e[9],E=e[10],M=e[11],L=e[12],B=e[13],F=e[14],D=e[15],de=x*F*f-B*E*f+B*b*M-g*F*M-x*b*D+g*E*D,ve=L*E*f-w*F*f-L*b*M+u*F*M+w*b*D-u*E*D,oe=w*B*f-L*x*f+L*g*M-u*B*M-w*g*D+u*x*D,W=L*x*b-w*B*b-L*g*E+u*B*E+w*g*F-u*x*F,ce=t*de+n*ve+o*oe+h*W;if(ce===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const se=1/ce;return e[0]=de*se,e[1]=(B*E*h-x*F*h-B*o*M+n*F*M+x*o*D-n*E*D)*se,e[2]=(g*F*h-B*b*h+B*o*f-n*F*f-g*o*D+n*b*D)*se,e[3]=(x*b*h-g*E*h-x*o*f+n*E*f+g*o*M-n*b*M)*se,e[4]=ve*se,e[5]=(w*F*h-L*E*h+L*o*M-t*F*M-w*o*D+t*E*D)*se,e[6]=(L*b*h-u*F*h-L*o*f+t*F*f+u*o*D-t*b*D)*se,e[7]=(u*E*h-w*b*h+w*o*f-t*E*f-u*o*M+t*b*M)*se,e[8]=oe*se,e[9]=(L*x*h-w*B*h-L*n*M+t*B*M+w*n*D-t*x*D)*se,e[10]=(u*B*h-L*g*h+L*n*f-t*B*f-u*n*D+t*g*D)*se,e[11]=(w*g*h-u*x*h-w*n*f+t*x*f+u*n*M-t*g*M)*se,e[12]=W*se,e[13]=(w*B*o-L*x*o+L*n*E-t*B*E-w*n*F+t*x*F)*se,e[14]=(L*g*o-u*B*o-L*n*b+t*B*b+u*n*F-t*g*F)*se,e[15]=(u*x*o-w*g*o+w*n*b-t*x*b-u*n*E+t*g*E)*se,this}scale(e){const t=this.elements,n=e.x,o=e.y,h=e.z;return t[0]*=n,t[4]*=o,t[8]*=h,t[1]*=n,t[5]*=o,t[9]*=h,t[2]*=n,t[6]*=o,t[10]*=h,t[3]*=n,t[7]*=o,t[11]*=h,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],o=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,o))}makeTranslation(e,t,n){return e instanceof Z?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),o=Math.sin(t),h=1-n,u=e.x,g=e.y,b=e.z,f=h*u,w=h*g;return this.set(f*u+n,f*g-o*b,f*b+o*g,0,f*g+o*b,w*g+n,w*b-o*u,0,f*b-o*g,w*b+o*u,h*b*b+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,o,h,u){return this.set(1,n,h,0,e,1,u,0,t,o,1,0,0,0,0,1),this}compose(e,t,n){const o=this.elements,h=t.x,u=t.y,g=t.z,b=t.w,f=h+h,w=u+u,x=g+g,E=h*f,M=h*w,L=h*x,B=u*w,F=u*x,D=g*x,de=b*f,ve=b*w,oe=b*x,W=n.x,ce=n.y,se=n.z;return o[0]=(1-(B+D))*W,o[1]=(M+oe)*W,o[2]=(L-ve)*W,o[3]=0,o[4]=(M-oe)*ce,o[5]=(1-(E+D))*ce,o[6]=(F+de)*ce,o[7]=0,o[8]=(L+ve)*se,o[9]=(F-de)*se,o[10]=(1-(E+B))*se,o[11]=0,o[12]=e.x,o[13]=e.y,o[14]=e.z,o[15]=1,this}decompose(e,t,n){const o=this.elements;let h=Dn.set(o[0],o[1],o[2]).length();const u=Dn.set(o[4],o[5],o[6]).length(),g=Dn.set(o[8],o[9],o[10]).length();this.determinant()<0&&(h=-h),e.x=o[12],e.y=o[13],e.z=o[14],rr.copy(this);const b=1/h,f=1/u,w=1/g;return rr.elements[0]*=b,rr.elements[1]*=b,rr.elements[2]*=b,rr.elements[4]*=f,rr.elements[5]*=f,rr.elements[6]*=f,rr.elements[8]*=w,rr.elements[9]*=w,rr.elements[10]*=w,t.setFromRotationMatrix(rr),n.x=h,n.y=u,n.z=g,this}equals(e){const t=this.elements,n=e.elements;for(let o=0;o<16;o++)if(t[o]!==n[o])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};wa.IDENTITY=Object.freeze(new wa);let $r=wa;const Dn=new Z,rr=new $r,Ou=new Z(0,0,0),Bu=new Z(1,1,1),Hr=new Z,Ks=new Z,Rt=new Z;class Ne{constructor(e=void 0,t=void 0){this.min=e==null?new Z(1/0,1/0,1/0):new Z(e.x,e.y,e.z),this.max=t==null?new Z(-1/0,-1/0,-1/0):new Z(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(oa.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=oa.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new Ne().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,oa).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(yr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const yr=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],oa=new Z,sl=new Ze;class vt{constructor(e=void 0,t=void 0){this.min=e==null?new Ze(1/0,1/0):new Ze(e.x,e.y),this.max=t==null?new Ze(-1/0,-1/0):new Ze(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=sl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new vt().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Ze(0,0):new Ze(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Ze(0,0):new Ze(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sl).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const il=new Z,zu=new Z,Ru=new Vi;class Ws{constructor(e=new Z(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,o){return this.normal.set(e,t,n),this.constant=o,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const o=il.subVectors(n,t).cross(zu.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(o,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectsBox(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Ru.getNormalMatrix(e),o=this.coplanarPoint(il).applyMatrix4(e),h=this.normal.applyMatrix3(n).normalize();return this.constant=-o.dot(h),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new Ws().copy(this)}}class Te extends Ze{static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((n,o)=>{n.toArray(t,o*2)}),t}}class Y extends Z{static pointArrayToNumberArray(e,t=!0){const n=t?3:2,o=new Array(e.length*n);return e.forEach((h,u)=>{h.toArray(o,u*n)}),o}}const al=new $r,ol=new Kr,ah=class Aa{constructor(e=0,t=0,n=0,o=Aa.DEFAULT_ORDER){this._x=e,this._y=t,this._z=n,this._order=o}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,o=this._order){return this._x=e,this._y=t,this._z=n,this._order=o,this._onChangeCallback(),this}clone(){return new Aa(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const o=e.elements,h=o[0],u=o[4],g=o[8],b=o[1],f=o[5],w=o[9],x=o[2],E=o[6],M=o[10];switch(t){case"XYZ":this._y=Math.asin(Cr(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-w,M),this._z=Math.atan2(-u,h)):(this._x=Math.atan2(E,f),this._z=0);break;case"YXZ":this._x=Math.asin(-Cr(w,-1,1)),Math.abs(w)<.9999999?(this._y=Math.atan2(g,M),this._z=Math.atan2(b,f)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(Cr(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-u,f)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-Cr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(E,M),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-u,f));break;case"YZX":this._z=Math.asin(Cr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-w,f),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(g,M));break;case"XZY":this._z=Math.asin(-Cr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(E,f),this._y=Math.atan2(g,h)):(this._x=Math.atan2(-w,M),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n=!0){return al.makeRotationFromQuaternion(e),this.setFromRotationMatrix(al,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ol.setFromEuler(this),this.setFromQuaternion(ol,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ah.DEFAULT_ORDER="XYZ";let oh=ah;class lh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}let Ga=class extends lh{translate(e){return this.transform(new Vi().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}};class Gi extends Ga{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new vt}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const t=[];for(let n=0;n<this.loops.length;++n){const o=this.loops[n].getPoints(e);t.push(o)}return t}buildHierarchy(){var e;const t=this.getPoints(100),n=this.calculateBoundaryBoxes(t),o=this.sortBoundaryBoxesByAreas(n),h=new Map,u=o.length;for(let b=0;b<u;b++)h.set(o[b],{index:o[b],children:[]});const g={index:-1,children:[]};for(let b=0;b<u;b++){const f=o[b],w=t[f],x=n[f];let E=b+1;for(;E<u;E++){const M=o[E],L=t[M];if(n[M].containsBox(x)&&Jl.isPointInPolygon(w[ke.randInt(0,w.length-1)],L)){(e=h.get(M))==null||e.children.push(h.get(f));break}}E===u&&g.children.push(h.get(f))}return g}calculateBoundaryBoxes(e){const t=[];return e.forEach(n=>{t.push(new vt().setFromPoints(n))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((o,h)=>{const u=o.size,g=u.width*u.height;t.push({area:g,index:h})}),t.sort((o,h)=>o.area-h.area);const n=[];return t.forEach(o=>{n.push(o.index)}),n}}class Yn extends Ga{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const t=this.getUtoTmapping(e);return this.getPoint(t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let n,o=this.getPoint(0),h=0;t.push(0);for(let u=1;u<=e;u++)n=this.getPoint(u/e),h+=n.distanceTo(o),t.push(h),o=n;return t}getUtoTmapping(e,t){const n=this.getLengths();let o=0;const h=n.length;let u;t?u=t:u=e*n[h-1];let g=0,b=h-1,f;for(;g<=b;)if(o=Math.floor(g+(b-g)/2),f=n[o]-u,f<0)g=o+1;else if(f>0)b=o-1;else{b=o;break}if(o=b,n[o]===u)return o/(h-1);const w=n[o],x=n[o+1]-w,E=(u-w)/x;return(o+E)/(h-1)}getTangent(e){let t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);const o=this.getPoint(t),h=this.getPoint(n),u=new Te;return u.copy(h).sub(o).normalize(),u}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}}class jn extends Yn{constructor(e,t,n,o,h){super();const u=+(e!==void 0)+ +(t!==void 0)+ +(n!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u==3)typeof e=="object"&&typeof t=="object"&&typeof n=="object"?this.createByThreePoints(e,t,n):this.createByStartEndPointsAndBulge(e,t,n);else if(u==5){const g=e;this.center=new Te(g.x,g.y),this.radius=t,this._clockwise=h,this._startAngle=this._clockwise?this._mirrorAngle(ke.normalizeAngle(n)):ke.normalizeAngle(n),this._endAngle=this._clockwise?this._mirrorAngle(ke.normalizeAngle(o)):ke.normalizeAngle(o)}else throw Ht.ILLEGAL_PARAMETERS}createByThreePoints(e,t,n){const o=(se,Ge)=>({x:(se.x+Ge.x)/2,y:(se.y+Ge.y)/2}),h=(se,Ge)=>(Ge.y-se.y)/(Ge.x-se.x),u=se=>-1/se,g=o(e,t),b=o(t,n),f=h(e,t),w=h(t,n),x=u(f),E=u(w),M=(se,Ge,Xe,He)=>{const we=(He-Ge)/(se-Xe),Be=se*we+Ge;return{x:we,y:Be}},L=g.y-x*g.x,B=b.y-E*b.x,F=M(x,L,E,B),D=Math.sqrt(Math.pow(e.x-F.x,2)+Math.pow(e.y-F.y,2)),de=(se,Ge)=>Math.atan2(se.y-Ge.y,se.x-Ge.x),ve=de(e,F),oe=de(t,F),W=de(n,F),ce=W>ve&&W<oe||ve>W&&ve<oe||oe>W&&oe<ve;this.center=F,this.radius=D,this._clockwise=!ce,this._startAngle=ve,this._endAngle=W}createByStartEndPointsAndBulge(e,t,n){let o,h,u;n<0?(o=Math.atan(-n)*4,h=new Ze(e),u=new Ze(t)):(o=Math.atan(n)*4,h=new Ze(t),u=new Ze(e));const g=new Ze().subVectors(u,h),b=g.length(),f=new Ze().addVectors(h,g.multiplyScalar(.5)),w=Math.abs(b/2/Math.tan(o/2)),x=g.normalize();let E;if(o<Math.PI){const M=new Ze(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=f.add(M.multiplyScalar(-w))}else{const M=new Ze(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=f.add(M.multiplyScalar(w))}n<0?(this._startAngle=Math.atan2(h.y-E.y,h.x-E.x),this._endAngle=Math.atan2(u.y-E.y,u.x-E.x)):(this._startAngle=Math.atan2(u.y-E.y,u.x-E.x),this._endAngle=Math.atan2(h.y-E.y,h.x-E.x)),this._clockwise=n<0,this.center=E,this.radius=u.sub(E).length()}get center(){return this._center}set center(e){this._center=new Te(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(e){this._startAngle=this._clockwise?this._mirrorAngle(ke.normalizeAngle(e)):ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(e){const t=this.startAngle==0&&e==st?e:ke.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(t):t,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(e){return(360-e*180/Math.PI)%360*Math.PI/180}_getInternalAngle(e){return this._clockwise?this._mirrorAngle(e):e}get deltaAngle(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return this.clockwise?ke.normalizeAngle(e-t):ke.normalizeAngle(t-e)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle),n=ke.normalizeAngle((e+t)/2),o=this._clockwise?this._mirrorAngle(n):n;return this.getPointAtAngle(o)}get closed(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return Math.abs(t-e)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of t){const u=this._getInternalAngle(h);ke.isBetweenAngle(u,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&e.push(this.getPointAtAngle(h))}const n=e.map(h=>h.x),o=e.map(h=>h.y);return new vt(new Te(Math.min(...n),Math.min(...o)),new Te(Math.max(...n),Math.max(...o)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new jn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(e){const t=this._getInternalAngle(e),n=this.center.x+this.radius*Math.cos(t),o=this.center.y+this.radius*Math.sin(t);return new Te(n,o)}getPoints(e=100){const t=[];let n=this.deltaAngle,o=this._getInternalAngle(this.startAngle);if(this.closed&&(n=st,o=0),this.clockwise)for(let h=0;h<=e;h++){const u=o-n*(h/e),g=this._clockwise?this._mirrorAngle(u):u,b=this.getPointAtAngle(g);t.push(new Te(b.x,b.y))}else for(let h=0;h<=e;h++){const u=o+n*(h/e),g=this._clockwise?this._mirrorAngle(u):u,b=this.getPointAtAngle(g);t.push(new Te(b.x,b.y))}return t}}class Du extends lh{translate(e){return this.transform(new $r().makeTranslation(e.x,e.y,e.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Hs extends Du{}let ci=class hh extends Hs{constructor(e,t){super(),this._start=new Y(e),this._end=new Y(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new Z().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new Y((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(e){return this.project(e).distanceTo(e)<1e-6}at(e,t){return this.delta(t).multiplyScalar(e).add(this._start)}atLength(e,t=!1){if(t){const n=this.delta(an).normalize();return new Y(this._start).addScaledVector(n,e)}else{const n=this.delta(an).normalize();return new Y(this._end).addScaledVector(n,e)}}extend(e,t=!1){if(t){const n=an.subVectors(this._start,this._end).normalize();this._start=new Y(this._start).addScaledVector(n,e)}else{const n=this.delta(an).normalize();this._end=new Y(this._end).addScaledVector(n,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){ll.subVectors(e,this._start),$s.subVectors(this.endPoint,this.startPoint);const n=$s.dot($s);let o=$s.dot(ll)/n;return t&&(o=ke.clamp(o,0,1)),o}closestPointToPoint(e,t,n){const o=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(o).add(this._start)}delta(e){return e.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(e){const t=this.direction,n=an.subVectors(e,this.startPoint).dot(t);return new Y().copy(t).multiplyScalar(n).add(this.startPoint)}perpPoint(e){const t=this.direction,n=this.startPoint,o=an.subVectors(e,n).dot(t),h=an.copy(t).multiplyScalar(o);return new Y().addVectors(n,h)}calculateBoundingBox(){const e=new Y(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),t=new Y(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new Ne(e,t)}transform(e){return this._start.applyMatrix4(e),this._end.applyMatrix4(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new hh(this._start.clone(),this._end.clone())}};const an=new Z,ll=new Z,$s=new Z;let ja=class ri extends Hs{static computeCenterPoint(e,t,n){const o=new Z().addVectors(e,t).multiplyScalar(.5),h=new Z().addVectors(e,n).multiplyScalar(.5),u=new Z().subVectors(t,e),g=new Z().subVectors(n,e),b=new Z().crossVectors(u,g).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new Z().crossVectors(u,b).normalize(),w=new Z().crossVectors(g,b).normalize(),x=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),E=w.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),M=new ci(o,o.clone().add(x)),L=new ci(h,h.clone().add(E)),B=new Z;return M.closestPointToPoint(L.startPoint,!0,B)?B:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(e,t,n){const o=ri.computeCenterPoint(e,t,n);if(o){const h=o.distanceTo(e),u=new Z().subVectors(e,o),g=new Z().subVectors(t,o),b=Math.atan2(u.y,u.x),f=Math.atan2(g.y,g.x);return new ri(o,h,b,f,Z.Z_AXIS)}}constructor(e,t,n,o,h,u=Z.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=n,this.endAngle=o,this.normal=h,this.refVec=u,(o-n)%st==0?(this.startAngle=0,this.endAngle=st):(this.startAngle=n,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new Y(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw Ht.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==st?e:ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return ke.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new Z(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)ke.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,n=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of e){const f=this.getPointAtAngle(b);f.x<t&&(t=f.x),f.y<n&&(n=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Ne({x:t,y:n,z:o},{x:h,y:u,z:g})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let n=this.deltaAngle,o=this.startAngle;this.closed&&(n=st,o=0);for(let h=0;h<=e;h++){const u=o+n*(h/e),g=this.getPointAtAngle(u);t.push(g)}return t}transform(e){const t=la.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),n=la.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix4(e),t.applyMatrix4(e),n.applyMatrix4(e),this.normal.applyMatrix4(e).normalize(),this.refVec.applyMatrix4(e).normalize(),this.startAngle=this.getAngle(t),this.endAngle=this.getAngle(n),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ri(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(la.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,n=this.refVec,o={x:t.y*n.z-t.z*n.y,y:t.z*n.x-t.x*n.z,z:t.x*n.y-t.y*n.x},h=this.center,u=this.radius;return new Y(h.x+u*(n.x*Math.cos(e)+o.x*Math.sin(e)),h.y+u*(n.y*Math.cos(e)+o.y*Math.sin(e)),h.z+u*(n.z*Math.cos(e)+o.z*Math.sin(e)))}get plane(){const e=new Z(this.center).distanceTo(Da);return new Ws(this.normal,e)}};const la=new Z;class ji extends Yn{constructor(e,t,n,o=0,h=st,u=!1,g=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=n,(h-o)%st==0?(this.startAngle=0,this.endAngle=st):(this.startAngle=o,this.endAngle=h),this.clockwise=u,this.rotation=g}get center(){return this._center}set center(e){this._center=new Y(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Ht.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Ht.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==st?e:ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return ke.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,n=-1/0,o=-1/0;for(let h=0;h<=100;h++){const u=this.getPoint(h/100);e=Math.min(e,u.x),t=Math.min(t,u.y),n=Math.max(n,u.x),o=Math.max(o,u.y)}return new vt({x:e,y:t},{x:n,y:o})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let n=this.endAngle-this.startAngle;const o=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=t;for(;n>t;)n-=t;n<Number.EPSILON&&(o?n=0:n=t),this.clockwise===!0&&!o&&(n===t?n=-t:n=n-t);const h=this.startAngle+e*n;let u=this.center.x+this.majorAxisRadius*Math.cos(h),g=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),f=Math.sin(this.rotation),w=u-this.center.x,x=g-this.center.y;u=w*b-x*f+this.center.x,g=w*f+x*b+this.center.y}return new Te(u,g)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}clone(){return new ji(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class Wi extends Hs{constructor(e,t,n,o,h,u=0,g=st){super(),this.center=e,this.normal=t,this.majorAxis=n,this.majorAxisRadius=o,this.minorAxisRadius=h;const b=Math.abs(g-u);Math.abs(b-st)<1e-10||Math.abs(b-2*st)<1e-10?(this.startAngle=0,this.endAngle=st):(this.startAngle=u,this.endAngle=g)}get center(){return this._center}set center(e){this._center=new Y(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Ht.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Ht.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==st?e:ke.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-st)<1e-10?st:ke.normalizeAngle(e)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new Z(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new Z().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return Fa.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const e=1e3,t=this.deltaAngle/e;let n=0,o=this.getPointAtAngle(this.startAngle);for(let h=1;h<=e;h++){const u=this.startAngle+h*t,g=this.getPointAtAngle(u),b=g.x-o.x,f=g.y-o.y,w=g.z-o.z;n+=Math.sqrt(b*b+f*f+w*w),o=g}return n}calculateBoundingBox(){if(this.majorAxis.equals(Z.X_AXIS)||this.majorAxis.equals(Z.Y_AXIS)||this.majorAxis.isParallelTo(Z.X_AXIS)||this.majorAxis.isParallelTo(Z.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)ke.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,n=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of e){const f=this.getPointAtAngle(b);f.x<t&&(t=f.x),f.y<n&&(n=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Ne({x:t,y:n,z:o},{x:h,y:u,z:g})}else{let e=1/0,t=1/0,n=1/0,o=-1/0,h=-1/0,u=-1/0;for(let g=0;g<=100;g++){const b=this.startAngle+this.deltaAngle*(g/100),f=this.getPointAtAngle(b);e=Math.min(e,f.x),t=Math.min(t,f.y),n=Math.min(n,f.z),o=Math.max(o,f.x),h=Math.max(h,f.y),u=Math.max(u,f.z)}return new Ne({x:e,y:t,z:n},{x:o,y:h,z:u})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let n=this.deltaAngle,o=this.startAngle;this.closed&&(n=st,o=0);for(let h=0;h<=e;h++){const u=o+n*(h/e),g=this.getPointAtAngle(u);t.push(g)}return t}getPointAtAngle(e){const t=Math.cos(e),n=Math.sin(e),o=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(n),h=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(o);return new Y(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(e){const t=new Z(e).sub(this.center),n=t.dot(this.majorAxis),o=t.dot(this.minorAxis),h=n/this.majorAxisRadius,u=o/this.minorAxisRadius;return h*h+u*u<=1}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Wi(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new Z(this.center).distanceTo(Da);return new Ws(this.normal,e)}}class wn extends Yn{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new Te(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new Te(t.x,t.y)}else{const t=this._vertices[e-1];return new Te(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let n=0;n<t;++n){const o=this._vertices[n];let h=null;if(n<t-1?h=this._vertices[n+1]:n==t-1&&this.closed&&(h=this._vertices[0]),h)if(o.bulge){const u=new jn(o,h,o.bulge);e+=u.length}else e+=new Te(o.x,o.y).distanceTo(h)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}getPointAt(e){const t=this._vertices[e];return new Te(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new vt().setFromPoints(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(e,t){const n=[];return this.getPoints(e).forEach(o=>n.push(new Y().set(o.x,o.y,t))),n}getPoints(e){const t=[],n=this._vertices.length;for(let o=0;o<n;++o){const h=this._vertices[o];if(h.bulge){let u=null;if(o<n-1?u=this._vertices[o+1]:o==n-1&&this.closed&&(u=this._vertices[0]),u){const g=new jn(h,u,h.bulge).getPoints(e),b=g.length;for(let f=0;f<b;++f){const w=g[f];t.push(new Te(w.x,w.y))}}}else t.push(new Te(h.x,h.y)),o==n-1&&this.closed&&t.push(t[0])}return t}}let zs=class ch extends Yn{constructor(e,t){super(),this._start=new Te(e),this._end=new Te(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new Te(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new Te(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new vt(e,t)}transform(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ch(this._start.clone(),this._end.clone())}},Wa=class extends Yn{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new Te(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new vt;return t.setFromPoints(e),t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(n=>{n.getPoints(e).forEach(o=>{t.push(new Te(o.x,o.y))})}),t}};function Fu(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var uh={exports:{}};(function(i,e){(function(t){i.exports=t()})(function(){var t={},n=this;new Function("try {return this===window;}catch(e){ return false;}");var o=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(o()&&h(),o()||h()){var u=n;if(h()){var g=function(b,f){var w=n;return b.split(".").forEach(function(x){w&&(w=w[x])}),w?w[f]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var f=g(b.data.className,b.data.methodName);if(!f)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:f.apply(null,b.data.args),id:b.data.id})}}}}return function(b,f,w){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var x={},E=function(){return Ce.__string_rec(this,"")};function M(r,s){function a(){}a.prototype=r;var l=new a;for(var c in s)l[c]=s[c];return s.toString!==Object.prototype.toString&&(l.toString=s.toString),l}var L=function(){};x.HxOverrides=L,L.__name__=["HxOverrides"],L.strDate=function(r){var s=r.length;switch(s){case 8:var a=r.split(":"),l=new Date;return l.setTime(0),l.setUTCHours(a[0]),l.setUTCMinutes(a[1]),l.setUTCSeconds(a[2]),l;case 10:var c=r.split("-");return new Date(c[0],c[1]-1,c[2],0,0,0);case 19:var d=r.split(" "),m=d[0].split("-"),_=d[1].split(":");return new Date(m[0],m[1]-1,m[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},L.cca=function(r,s){var a=r.charCodeAt(s);if(a==a)return a},L.substr=function(r,s,a){return s!=null&&s!=0&&a!=null&&a<0?"":(a==null&&(a=r.length),s<0?(s=r.length+s,s<0&&(s=0)):a<0&&(a=r.length+a-s),r.substr(s,a))},L.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var B=function(){};x.Lambda=B,B.__name__=["Lambda"],B.fold=function(r,s,a){for(var l=Zt(r)();l.hasNext();){var c=l.next();a=s(c,a)}return a};var F=function(){this.length=0};x.List=F,F.__name__=["List"],F.prototype={add:function(r){var s=[r];this.h==null?this.h=s:this.q[1]=s,this.q=s,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:F},Math.__name__=["Math"];var D=function(){};x.Reflect=D,D.__name__=["Reflect"],D.field=function(r,s){try{return r[s]}catch(a){return a instanceof Q&&(a=a.val),null}},D.callMethod=function(r,s,a){return s.apply(r,a)},D.fields=function(r){var s=[];if(r!=null){var a=Object.prototype.hasOwnProperty;for(var l in r)l!="__id__"&&l!="hx__closures__"&&a.call(r,l)&&s.push(l)}return s},D.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},D.deleteField=function(r,s){return Object.prototype.hasOwnProperty.call(r,s)?(delete r[s],!0):!1};var de=function(){};x.Std=de,de.__name__=["Std"],de.string=function(r){return Ce.__string_rec(r,"")},de.parseFloat=function(r){return parseFloat(r)};var ve=function(){this.b=""};x.StringBuf=ve,ve.__name__=["StringBuf"],ve.prototype={add:function(r){this.b+=de.string(r)},__class__:ve};var oe=function(){};x.StringTools=oe,oe.__name__=["StringTools"],oe.fastCodeAt=function(r,s){return r.charCodeAt(s)};var W=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};W.TNull=["TNull",0],W.TNull.toString=E,W.TNull.__enum__=W,W.TInt=["TInt",1],W.TInt.toString=E,W.TInt.__enum__=W,W.TFloat=["TFloat",2],W.TFloat.toString=E,W.TFloat.__enum__=W,W.TBool=["TBool",3],W.TBool.toString=E,W.TBool.__enum__=W,W.TObject=["TObject",4],W.TObject.toString=E,W.TObject.__enum__=W,W.TFunction=["TFunction",5],W.TFunction.toString=E,W.TFunction.__enum__=W,W.TClass=function(r){var s=["TClass",6,r];return s.__enum__=W,s.toString=E,s},W.TEnum=function(r){var s=["TEnum",7,r];return s.__enum__=W,s.toString=E,s},W.TUnknown=["TUnknown",8],W.TUnknown.toString=E,W.TUnknown.__enum__=W;var ce=function(){};x.Type=ce,ce.__name__=["Type"],ce.getClassName=function(r){var s=r.__name__;return s==null?null:s.join(".")},ce.getEnumName=function(r){var s=r.__ename__;return s.join(".")},ce.resolveClass=function(r){var s=x[r];return s==null||!s.__name__?null:s},ce.resolveEnum=function(r){var s=x[r];return s==null||!s.__ename__?null:s},ce.createEmptyInstance=function(r){function s(){}return s.prototype=r.prototype,new s},ce.createEnum=function(r,s,a){var l=D.field(r,s);if(l==null)throw new Q("No such constructor "+s);if(D.isFunction(l)){if(a==null)throw new Q("Constructor "+s+" need parameters");return D.callMethod(r,l,a)}if(a!=null&&a.length!=0)throw new Q("Constructor "+s+" does not need parameters");return l},ce.getEnumConstructs=function(r){var s=r.__constructs__;return s.slice()},ce.typeof=function(r){var s=typeof r;switch(s){case"boolean":return W.TBool;case"string":return W.TClass(String);case"number":return Math.ceil(r)==r%2147483648?W.TInt:W.TFloat;case"object":if(r==null)return W.TNull;var a=r.__enum__;if(a!=null)return W.TEnum(a);var l=Ce.getClass(r);return l!=null?W.TClass(l):W.TObject;case"function":return r.__name__||r.__ename__?W.TObject:W.TFunction;case"undefined":return W.TNull;default:return W.TUnknown}};var se=function(){};x["haxe.IMap"]=se,se.__name__=["haxe","IMap"];var Ge=function(r,s){this.high=r,this.low=s};x["haxe._Int64.___Int64"]=Ge,Ge.__name__=["haxe","_Int64","___Int64"],Ge.prototype={__class__:Ge};var Xe=function(){this.buf=new ve,this.cache=[],this.useCache=Xe.USE_CACHE,this.useEnumIndex=Xe.USE_ENUM_INDEX,this.shash=new gt,this.scount=0};x["haxe.Serializer"]=Xe,Xe.__name__=["haxe","Serializer"],Xe.prototype={toString:function(){return this.buf.b},serializeString:function(r){var s=this.shash.get(r);if(s!=null){this.buf.b+="R",s==null?this.buf.b+="null":this.buf.b+=""+s;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var s=typeof r,a=0,l=this.cache.length;a<l;){var c=a++,d=this.cache[c];if(typeof d==s&&d==r)return this.buf.b+="r",c==null?this.buf.b+="null":this.buf.b+=""+c,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var s=0,a=D.fields(r);s<a.length;){var l=a[s];++s,this.serializeString(l),this.serialize(D.field(r,l))}this.buf.b+="g"},serialize:function(r){{var s=ce.typeof(r);switch(s[1]){case 0:this.buf.b+="n";break;case 1:var a=r;if(a==0){this.buf.b+="z";return}this.buf.b+="i",a==null?this.buf.b+="null":this.buf.b+=""+a;break;case 2:var l=r;isNaN(l)?this.buf.b+="k":isFinite(l)?(this.buf.b+="d",l==null?this.buf.b+="null":this.buf.b+=""+l):l<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var c=s[2];if(c==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(c){case Array:var d=0;this.buf.b+="a";for(var m=r.length,_=0;_<m;){var y=_++;r[y]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[y]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case F:this.buf.b+="l";for(var A=r,I=A.h,S=null;I!=null;){var P;S=I[0],I=I[1],P=S,this.serialize(P)}this.buf.b+="h";break;case Date:var k=r;this.buf.b+="v",this.buf.add(k.getTime());break;case gt:this.buf.b+="b";for(var T=r,O=T.keys();O.hasNext();){var C=O.next();this.serializeString(C),this.serialize(Qi[C]!=null?T.getReserved(C):T.h[C])}this.buf.b+="h";break;case we:this.buf.b+="q";for(var R=r,z=R.keys();z.hasNext();){var U=z.next();this.buf.b+=":",U==null?this.buf.b+="null":this.buf.b+=""+U,this.serialize(R.h[U])}this.buf.b+="h";break;case Be:this.buf.b+="M";for(var V=r,q=V.keys();q.hasNext();){var J=q.next(),H=D.field(J,"__id__");D.deleteField(J,"__id__"),this.serialize(J),J.__id__=H,this.serialize(V.h[J.__id__])}this.buf.b+="h";break;case Ct:for(var G=r,K=0,ee=G.length-2,te=new ve,ie=Xe.BASE64;K<ee;){var he=G.get(K++),ae=G.get(K++),ue=G.get(K++);te.add(ie.charAt(he>>2)),te.add(ie.charAt((he<<4|ae>>4)&63)),te.add(ie.charAt((ae<<2|ue>>6)&63)),te.add(ie.charAt(ue&63))}if(K==ee){var ne=G.get(K++),pe=G.get(K++);te.add(ie.charAt(ne>>2)),te.add(ie.charAt((ne<<4|pe>>4)&63)),te.add(ie.charAt(pe<<2&63))}else if(K==ee+1){var X=G.get(K++);te.add(ie.charAt(X>>2)),te.add(ie.charAt(X<<4&63))}var fe=te.b;this.buf.b+="s",fe.length==null?this.buf.b+="null":this.buf.b+=""+fe.length,this.buf.b+=":",fe==null?this.buf.b+="null":this.buf.b+=""+fe;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(ce.getClassName(c)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(ce.getClassName(c)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(Ce.__instanceof(r,Uo)){var Pe=ce.getClassName(r);this.buf.b+="A",this.serializeString(Pe)}else if(Ce.__instanceof(r,Vo))this.buf.b+="B",this.serializeString(ce.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var We=s[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(ce.getEnumName(We)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=de.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var Ke=r.length;this.buf.b+=de.string(Ke-2);for(var Ue=2;Ue<Ke;){var $e=Ue++;this.serialize(r[$e])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+de.string(r))}}},__class__:Xe};var He=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var s=He.DEFAULT_RESOLVER;s==null&&(s=ce,He.DEFAULT_RESOLVER=s),this.setResolver(s)};x["haxe.Unserializer"]=He,He.__name__=["haxe","Unserializer"],He.initCodes=function(){for(var r=[],s=0,a=He.BASE64.length;s<a;){var l=s++;r[He.BASE64.charCodeAt(l)]=l}return r},He.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(s){return null},resolveEnum:function(s){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,s=!1,a=this.pos;;){var l=this.buf.charCodeAt(this.pos);if(l!=l)break;if(l==45){if(this.pos!=a)break;s=!0,this.pos++;continue}if(l<48||l>57)break;r=r*10+(l-48),this.pos++}return s&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var s=this.buf.charCodeAt(this.pos);if(s>=43&&s<58||s==101||s==69)this.pos++;else break}return de.parseFloat(L.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var s=this.unserialize();if(typeof s!="string")throw new Q("Invalid object key");var a=this.unserialize();r[s]=a}this.pos++},unserializeEnum:function(r,s){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var a=this.readDigits();if(a==0)return ce.createEnum(r,s);for(var l=[];a-- >0;)l.push(this.unserialize());return ce.createEnum(r,s,l)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var s=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<s)throw new Q("Invalid string length");var a=L.substr(this.buf,this.pos,s);return this.pos+=s,a=decodeURIComponent(a.split("+").join(" ")),this.scache.push(a),a;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var l=[];for(this.cache.push(l);;){var c=this.buf.charCodeAt(this.pos);if(c==104){this.pos++;break}if(c==117){this.pos++;var d=this.readDigits();l[l.length+d-1]=null}else l.push(this.unserialize())}return l;case 111:var m={};return this.cache.push(m),this.unserializeObject(m),m;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var y=this.readDigits();if(y<0||y>=this.scache.length)throw new Q("Invalid string reference");return this.scache[y];case 120:throw new Q(this.unserialize());case 99:var A=this.unserialize(),I=this.resolver.resolveClass(A);if(I==null)throw new Q("Class not found "+A);var S=ce.createEmptyInstance(I);return this.cache.push(S),this.unserializeObject(S),S;case 119:var P=this.unserialize(),k=this.resolver.resolveEnum(P);if(k==null)throw new Q("Enum not found "+P);var T=this.unserializeEnum(k,this.unserialize());return this.cache.push(T),T;case 106:var O=this.unserialize(),C=this.resolver.resolveEnum(O);if(C==null)throw new Q("Enum not found "+O);this.pos++;var R=this.readDigits(),z=ce.getEnumConstructs(C)[R];if(z==null)throw new Q("Unknown enum index "+O+"@"+R);var U=this.unserializeEnum(C,z);return this.cache.push(U),U;case 108:var V=new F;for(this.cache.push(V),this.buf;this.buf.charCodeAt(this.pos)!=104;)V.add(this.unserialize());return this.pos++,V;case 98:var q=new gt;for(this.cache.push(q),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();q.set(J,this.unserialize())}return this.pos++,q;case 113:var H=new we;this.cache.push(H),this.buf;for(var G=this.get(this.pos++);G==58;){var K=this.readDigits();H.set(K,this.unserialize()),G=this.get(this.pos++)}if(G!=104)throw new Q("Invalid IntMap format");return H;case 77:var ee=new Be;for(this.cache.push(ee),this.buf;this.buf.charCodeAt(this.pos)!=104;){var te=this.unserialize();ee.set(te,this.unserialize())}return this.pos++,ee;case 118:var ie;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var he=L.substr(this.buf,this.pos,19);ie=L.strDate(he),this.pos+=19}else{var ae=this.readFloat(),ue=new Date;ue.setTime(ae),ie=ue}return this.cache.push(ie),ie;case 115:var ne=this.readDigits(),pe=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<ne)throw new Q("Invalid bytes length");var X=He.CODES;X==null&&(X=He.initCodes(),He.CODES=X);var fe=this.pos,Pe=ne&3,We;We=(ne>>2)*3+(Pe>=2?Pe-1:0);for(var Ke=fe+(ne-Pe),Ue=Ct.alloc(We),$e=0;fe<Ke;){var Mt=X[oe.fastCodeAt(pe,fe++)],Xt=X[oe.fastCodeAt(pe,fe++)];Ue.set($e++,Mt<<2|Xt>>4);var bt=X[oe.fastCodeAt(pe,fe++)];Ue.set($e++,Xt<<4|bt>>2);var _t=X[oe.fastCodeAt(pe,fe++)];Ue.set($e++,bt<<6|_t)}if(Pe>=2){var Tt=X[oe.fastCodeAt(pe,fe++)],zt=X[oe.fastCodeAt(pe,fe++)];if(Ue.set($e++,Tt<<2|zt>>4),Pe==3){var Qt=X[oe.fastCodeAt(pe,fe++)];Ue.set($e++,zt<<4|Qt>>2)}}return this.pos+=ne,this.cache.push(Ue),Ue;case 67:var cr=this.unserialize(),Jt=this.resolver.resolveClass(cr);if(Jt==null)throw new Q("Class not found "+cr);var er=ce.createEmptyInstance(Jt);if(this.cache.push(er),er.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return er;case 65:var tr=this.unserialize(),fr=this.resolver.resolveClass(tr);if(fr==null)throw new Q("Class not found "+tr);return fr;case 66:var zn=this.unserialize(),rn=this.resolver.resolveEnum(zn);if(rn==null)throw new Q("Enum not found "+zn);return rn}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:He};var we=function(){this.h={}};x["haxe.ds.IntMap"]=we,we.__name__=["haxe","ds","IntMap"],we.__interfaces__=[se],we.prototype={set:function(r,s){this.h[r]=s},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var s in this.h)this.h.hasOwnProperty(s)&&r.push(s|0);return L.iter(r)},__class__:we};var Be=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Be,Be.__name__=["haxe","ds","ObjectMap"],Be.__interfaces__=[se],Be.prototype={set:function(r,s){var a=r.__id__||(r.__id__=++Be.count);this.h[a]=s,this.h.__keys__[a]=r},keys:function(){var r=[];for(var s in this.h.__keys__)this.h.hasOwnProperty(s)&&r.push(this.h.__keys__[s]);return L.iter(r)},__class__:Be};var mt=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};mt.Some=function(r){var s=["Some",0,r];return s.__enum__=mt,s.toString=E,s},mt.None=["None",1],mt.None.toString=E,mt.None.__enum__=mt;var gt=function(){this.h={}};x["haxe.ds.StringMap"]=gt,gt.__name__=["haxe","ds","StringMap"],gt.__interfaces__=[se],gt.prototype={set:function(r,s){Qi[r]!=null?this.setReserved(r,s):this.h[r]=s},get:function(r){return Qi[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,s){this.rh==null&&(this.rh={}),this.rh["$"+r]=s},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return L.iter(r)},arrayKeys:function(){var r=[];for(var s in this.h)this.h.hasOwnProperty(s)&&r.push(s);if(this.rh!=null)for(var s in this.rh)s.charCodeAt(0)==36&&r.push(s.substr(1));return r},__class__:gt};var Ct=function(r){this.length=r.byteLength,this.b=new Ji(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};x["haxe.io.Bytes"]=Ct,Ct.__name__=["haxe","io","Bytes"],Ct.alloc=function(r){return new Ct(new Xs(r))},Ct.prototype={get:function(r){return this.b[r]},set:function(r,s){this.b[r]=s&255},__class__:Ct};var et=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};et.Blocked=["Blocked",0],et.Blocked.toString=E,et.Blocked.__enum__=et,et.Overflow=["Overflow",1],et.Overflow.toString=E,et.Overflow.__enum__=et,et.OutsideBounds=["OutsideBounds",2],et.OutsideBounds.toString=E,et.OutsideBounds.__enum__=et,et.Custom=function(r){var s=["Custom",3,r];return s.__enum__=et,s.toString=E,s};var ot=function(){};x["haxe.io.FPHelper"]=ot,ot.__name__=["haxe","io","FPHelper"],ot.i32ToFloat=function(r){var s=1-(r>>>31<<1),a=r>>>23&255,l=r&8388607;return l==0&&a==0?0:s*(1+Math.pow(2,-23)*l)*Math.pow(2,a-127)},ot.floatToI32=function(r){if(r==0)return 0;var s;r<0?s=-r:s=r;var a=Math.floor(Math.log(s)/.6931471805599453);a<-127?a=-127:a>128&&(a=128);var l=Math.round((s/Math.pow(2,a)-1)*8388608)&8388607;return(r<0?-2147483648:0)|a+127<<23|l},ot.i64ToDouble=function(r,s){var a=1-(s>>>31<<1),l=(s>>20&2047)-1023,c=(s&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return c==0&&l==-1023?0:a*(1+Math.pow(2,-52)*c)*Math.pow(2,l)},ot.doubleToI64=function(r){var s=ot.i64tmp;if(r==0)s.low=0,s.high=0;else{var a;r<0?a=-r:a=r;var l=Math.floor(Math.log(a)/.6931471805599453),c,d=(a/Math.pow(2,l)-1)*4503599627370496;c=Math.round(d);var m=c|0,_=c/4294967296|0;s.low=m,s.high=(r<0?-2147483648:0)|l+1023<<20|_}return s};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};x["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=M(Error.prototype,{__class__:Q});var Ce=function(){};x["js.Boot"]=Ce,Ce.__name__=["js","Boot"],Ce.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var s=r.__class__;if(s!=null)return s;var a=Ce.__nativeClassName(r);return a!=null?Ce.__resolveNativeClass(a):null},Ce.__string_rec=function(r,s){if(r==null)return"null";if(s.length>=5)return"<...>";var a=typeof r;switch(a=="function"&&(r.__name__||r.__ename__)&&(a="object"),a){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var l=r[0]+"(";s+=" ";for(var c=2,d=r.length;c<d;){var m=c++;m!=2?l+=","+Ce.__string_rec(r[m],s):l+=Ce.__string_rec(r[m],s)}return l+")"}var _=r.length,y="[";s+=" ";for(var A=0;A<_;){var I=A++;y+=(I>0?",":"")+Ce.__string_rec(r[I],s)}return y+="]",y}var S;try{S=r.toString}catch(C){return C instanceof Q&&(C=C.val),"???"}if(S!=null&&S!=Object.toString&&typeof S=="function"){var P=r.toString();if(P!="[object Object]")return P}var k=null,T=`{
|
|
2
|
-
`;s+=" ";var
|
|
3
|
-
`),T+=s+k+" : "+
|
|
4
|
-
`+s+"}",T;case"function":return"<function>";case"string":return r;default:return String(r)}},Ce.__interfLoop=function(r,s){if(r==null)return!1;if(r==s)return!0;var a=r.__interfaces__;if(a!=null)for(var l=0,c=a.length;l<c;){var d=l++,m=a[d];if(m==s||Ce.__interfLoop(m,s))return!0}return Ce.__interfLoop(r.__super__,s)},Ce.__instanceof=function(r,s){if(s==null)return!1;switch(s){case iu:return(r|0)===r;case Do:return typeof r=="number";case Fo:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case au:return!0;default:if(r!=null){if(typeof s=="function"){if(r instanceof s||Ce.__interfLoop(Ce.getClass(r),s))return!0}else if(typeof s=="object"&&Ce.__isNativeObj(s)&&r instanceof s)return!0}else return!1;return s==Uo&&r.__name__!=null||s==Vo&&r.__ename__!=null?!0:r.__enum__==s}},Ce.__nativeClassName=function(r){var s=Ce.__toStr.call(r).slice(8,-1);return s=="Object"||s=="Function"||s=="Math"||s=="JSON"?null:s},Ce.__isNativeObj=function(r){return Ce.__nativeClassName(r)!=null},Ce.__resolveNativeClass=function(r){return w[r]};var lt=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var s=r;this.a=[];for(var a=0;a<s;){var l=a++;this.a[l]=0}this.byteLength=s}};x["js.html.compat.ArrayBuffer"]=lt,lt.__name__=["js","html","compat","ArrayBuffer"],lt.sliceImpl=function(r,s){var a=new Ji(this,r,s==null?null:s-r),l=new Xs(a.byteLength),c=new Ji(l);return c.set(a),l},lt.prototype={slice:function(r,s){return new lt(this.a.slice(r,s))},__class__:lt};var pr=function(r,s,a){if(this.buf=r,s==null?this.offset=0:this.offset=s,a==null?this.length=r.byteLength-this.offset:this.length=a,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(et.OutsideBounds)};x["js.html.compat.DataView"]=pr,pr.__name__=["js","html","compat","DataView"],pr.prototype={getInt8:function(r){var s=this.buf.a[this.offset+r];return s>=128?s-256:s},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,s){var a=this.getUint16(r,s);return a>=32768?a-65536:a},getUint16:function(r,s){return s?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,s){var a=this.offset+r,l=this.buf.a[a++],c=this.buf.a[a++],d=this.buf.a[a++],m=this.buf.a[a++];return s?l|c<<8|d<<16|m<<24:m|d<<8|c<<16|l<<24},getUint32:function(r,s){var a=this.getInt32(r,s);return a<0?a+4294967296:a},getFloat32:function(r,s){return ot.i32ToFloat(this.getInt32(r,s))},getFloat64:function(r,s){var a=this.getInt32(r,s),l=this.getInt32(r+4,s);return ot.i64ToDouble(s?a:l,s?l:a)},setInt8:function(r,s){s<0?this.buf.a[r+this.offset]=s+128&255:this.buf.a[r+this.offset]=s&255},setUint8:function(r,s){this.buf.a[r+this.offset]=s&255},setInt16:function(r,s,a){this.setUint16(r,s<0?s+65536:s,a)},setUint16:function(r,s,a){var l=r+this.offset;a?(this.buf.a[l]=s&255,this.buf.a[l++]=s>>8&255):(this.buf.a[l++]=s>>8&255,this.buf.a[l]=s&255)},setInt32:function(r,s,a){this.setUint32(r,s,a)},setUint32:function(r,s,a){var l=r+this.offset;a?(this.buf.a[l++]=s&255,this.buf.a[l++]=s>>8&255,this.buf.a[l++]=s>>16&255,this.buf.a[l++]=s>>>24):(this.buf.a[l++]=s>>>24,this.buf.a[l++]=s>>16&255,this.buf.a[l++]=s>>8&255,this.buf.a[l++]=s&255)},setFloat32:function(r,s,a){this.setUint32(r,ot.floatToI32(s),a)},setFloat64:function(r,s,a){var l=ot.doubleToI64(s);a?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:pr};var ar=function(){};x["js.html.compat.Uint8Array"]=ar,ar.__name__=["js","html","compat","Uint8Array"],ar._new=function(r,s,a){var l;if(typeof r=="number"){l=[];for(var c=0;c<r;){var d=c++;l[d]=0}l.byteLength=l.length,l.byteOffset=0,l.buffer=new lt(l)}else if(Ce.__instanceof(r,lt)){var m=r;s==null&&(s=0),a==null&&(a=m.byteLength-s),s==0?l=m.a:l=m.a.slice(s,s+a),l.byteLength=l.length,l.byteOffset=s,l.buffer=m}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new lt(l);else throw new Q("TODO "+de.string(r));return l.subarray=ar._subarray,l.set=ar._set,l},ar._set=function(r,s){var a=this;if(Ce.__instanceof(r.buffer,lt)){var l=r;if(r.byteLength+s>a.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var m=c++;a[m+s]=l[m]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+s>a.byteLength)throw new Q("set() outside of range");for(var y=0,A=_.length;y<A;){var I=y++;a[I+s]=_[I]}}else throw new Q("TODO")},ar._subarray=function(r,s){var a=this,l=ar._new(a.slice(r,s));return l.byteOffset=r,l};var Me=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&Me.link(r,this,function(s){return s})};x["promhx.base.AsyncBase"]=Me,Me.__name__=["promhx","base","AsyncBase"],Me.link=function(r,s,a){r._update.push({async:s,linkf:function(l){s.handleResolve(a(l))}}),Me.immediateLinkUpdate(r,s,a)},Me.immediateLinkUpdate=function(r,s,a){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&s.handleError(r._errorVal),r._resolved&&!r._pending)try{s.handleResolve(a(r._val))}catch(l){l instanceof Q&&(l=l.val),s.handleError(l)}},Me.linkAll=function(r,s){for(var a=function(d,m,_){if(d.length==0||Me.allFulfilled(d)){for(var y,A=[],I=Zt(r)();I.hasNext();){var S=I.next();A.push(S==m?_:S._val)}y=A,s.handleResolve(y)}},l=Zt(r)();l.hasNext();){var c=l.next();c._update.push({async:s,linkf:function(d,m,_){return function(y){d(m,_,y)}}(a,function(d){for(var m,_=[],y=Zt(r)();y.hasNext();){var A=y.next();A!=c&&_.push(A)}return m=_,m}(),c)})}Me.allFulfilled(r)&&s.handleResolve(function(d){for(var m,_=[],y=Zt(r)();y.hasNext();){var A=y.next();_.push(A._val)}return m=_,m}())},Me.pipeLink=function(r,s,a){var l=!1,c=function(d){if(!l){l=!0;var m=a(d);m._update.push({async:s,linkf:Bt(s,s.handleResolve)}),Me.immediateLinkUpdate(m,s,function(_){return _})}};if(r._update.push({async:s,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),s.handleError(d)}},Me.allResolved=function(r){for(var s=Zt(r)();s.hasNext();){var a=s.next();if(!a._resolved)return!1}return!0},Me.allFulfilled=function(r){for(var s=Zt(r)();s.hasNext();){var a=s.next();if(!a._fulfilled)return!1}return!0},Me.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var s=this;this._pending?Ie.enqueue(function(a,l){return function(){a(l)}}(Bt(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,Ie.queue.add(function(){s._val=r;for(var a=0,l=s._update;a<l.length;){var c=l[a];++a;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}s._fulfilled=!0,s._pending=!1}),Ie.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var s=this,a=function(l){if(s._error.length>0)for(var c=0,d=s._error;c<d.length;){var m=d[c];++c,m(l)}else if(s._update.length>0)for(var _=0,y=s._update;_<y.length;){var A=y[_];++_,A.async.handleError(l)}else throw new Q(l);s._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,Ie.queue.add(function(){if(s._errorMap!=null)try{s._resolve(s._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),a(l)}else a(r)}),Ie.continueOnNextLoop())},then:function(r){var s=new Me(null);return Me.link(this,s,r),s},unlink:function(r){var s=this;Ie.queue.add(function(){s._update=s._update.filter(function(a){return a.async!=r})}),Ie.continueOnNextLoop()},isLinked:function(r){for(var s=!1,a=0,l=this._update;a<l.length;){var c=l[a];if(++a,c.async==r)return!0}return s},__class__:Me};var In=f.promhx.Deferred=function(){Me.call(this)};x["promhx.Deferred"]=In,In.__name__=["promhx","Deferred"],In.__super__=Me,In.prototype=M(Me.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new ft(this)},stream:function(){return new Ye(this)},publicStream:function(){return new Br(this)},__class__:In});var ft=f.promhx.Promise=function(r){Me.call(this,r),this._rejected=!1};x["promhx.Promise"]=ft,ft.__name__=["promhx","Promise"],ft.whenAll=function(r){var s=new ft(null);return Me.linkAll(r,s),s},ft.promise=function(r){var s=new ft;return s.handleResolve(r),s},ft.__super__=Me,ft.prototype=M(Me.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var s="Promise has already been resolved";throw new Q(Pn.AlreadyResolved(s))}this._resolve(r)},then:function(r){var s=new ft(null);return Me.link(this,s,r),s},unlink:function(r){var s=this;Ie.queue.add(function(){if(s._fulfilled)s._update=s._update.filter(function(l){return l.async!=r});else{var a="Downstream Promise is not fullfilled";s.handleError(Pn.DownstreamNotFullfilled(a))}}),Ie.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var s=new ft(null);return Me.pipeLink(this,s,r),s},errorPipe:function(r){var s=new ft;return this.catchError(function(a){var l=r(a);l.then(Bt(s,s._resolve))}),this.then(Bt(s,s._resolve)),s},__class__:ft});var Ye=f.promhx.Stream=function(r){Me.call(this,r),this._end_promise=new ft};x["promhx.Stream"]=Ye,Ye.__name__=["promhx","Stream"],Ye.foreach=function(r){for(var s=new Ye(null),a=Zt(r)();a.hasNext();){var l=a.next();s.handleResolve(l)}return s.end(),s},Ye.wheneverAll=function(r){var s=new Ye(null);return Me.linkAll(r,s),s},Ye.concatAll=function(r){for(var s=new Ye(null),a=Zt(r)();a.hasNext();){var l=a.next();s.concat(l)}return s},Ye.mergeAll=function(r){for(var s=new Ye(null),a=Zt(r)();a.hasNext();){var l=a.next();s.merge(l)}return s},Ye.stream=function(r){var s=new Ye(null);return s.handleResolve(r),s},Ye.__super__=Me,Ye.prototype=M(Me.prototype,{then:function(r){var s=new Ye(null);return Me.link(this,s,r),this._end_promise._update.push({async:s._end_promise,linkf:function(a){s.end()}}),s},detachStream:function(r){for(var s=[],a=!1,l=0,c=this._update;l<c.length;){var d=c[l];++l,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(m){return m.async!=r._end_promise}),a=!0):s.push(d)}return this._update=s,a},first:function(){var r=new ft(null);return this.then(function(s){r._resolved||r.handleResolve(s)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var s=new Ye(null);return Me.pipeLink(this,s,r),this._end_promise.then(function(a){s.end()}),s},errorPipe:function(r){var s=new Ye(null);return this.catchError(function(a){var l=r(a);l.then(Bt(s,s._resolve)),l._end_promise.then((Zi=s._end_promise,Bt(Zi,Zi._resolve)))}),this.then(Bt(s,s._resolve)),this._end_promise.then(function(a){s.end()}),s},handleEnd:function(){if(this._pending)Ie.queue.add(Bt(this,this.handleEnd)),Ie.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=mt.Some(this._val):r=mt.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return Ie.queue.add(Bt(this,this.handleEnd)),Ie.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var s=new Ye(null);return this._update.push({async:s,linkf:function(a){r(a)&&s.handleResolve(a)}}),Me.immediateLinkUpdate(this,s,function(a){return a}),s},concat:function(r){var s=new Ye(null);return this._update.push({async:s,linkf:Bt(s,s.handleResolve)}),Me.immediateLinkUpdate(this,s,function(a){return a}),this._end_promise.then(function(a){r.pipe(function(l){return s.handleResolve(l),s}),r._end_promise.then(function(l){s.end()})}),s},merge:function(r){var s=new Ye(null);return this._update.push({async:s,linkf:Bt(s,s.handleResolve)}),r._update.push({async:s,linkf:Bt(s,s.handleResolve)}),Me.immediateLinkUpdate(this,s,function(a){return a}),Me.immediateLinkUpdate(r,s,function(a){return a}),s},__class__:Ye});var Br=f.promhx.PublicStream=function(r){Ye.call(this,r)};x["promhx.PublicStream"]=Br,Br.__name__=["promhx","PublicStream"],Br.publicstream=function(r){var s=new Br(null);return s.handleResolve(r),s},Br.__super__=Ye,Br.prototype=M(Ye.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Br});var Ie=function(){};x["promhx.base.EventLoop"]=Ie,Ie.__name__=["promhx","base","EventLoop"],Ie.enqueue=function(r){Ie.queue.add(r),Ie.continueOnNextLoop()},Ie.set_nextLoop=function(r){if(Ie.nextLoop!=null)throw new Q("nextLoop has already been set");return Ie.nextLoop=r,Ie.nextLoop},Ie.queueEmpty=function(){return Ie.queue.isEmpty()},Ie.finish=function(r){r==null&&(r=1e3);for(var s=null;r-- >0&&(s=Ie.queue.pop())!=null;)s();return Ie.queue.isEmpty()},Ie.clear=function(){Ie.queue=new F},Ie.f=function(){var r=Ie.queue.pop();r!=null&&r(),Ie.queue.isEmpty()||Ie.continueOnNextLoop()},Ie.continueOnNextLoop=function(){Ie.nextLoop!=null?Ie.nextLoop(Ie.f):setImmediate(Ie.f)};var Pn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};Pn.AlreadyResolved=function(r){var s=["AlreadyResolved",0,r];return s.__enum__=Pn,s.toString=E,s},Pn.DownstreamNotFullfilled=function(r){var s=["DownstreamNotFullfilled",1,r];return s.__enum__=Pn,s.toString=E,s};var Ys=function(){};x["verb.Verb"]=Ys,Ys.__name__=["verb","Verb"],Ys.main=function(){b.log("verb 2.1.0")};var $=function(){};x["verb.core.ArrayExtensions"]=$,$.__name__=["verb","core","ArrayExtensions"],$.alloc=function(r,s){if(!(s<0))for(;r.length<s;)r.push(null)},$.reversed=function(r){var s=r.slice();return s.reverse(),s},$.last=function(r){return r[r.length-1]},$.first=function(r){return r[0]},$.spliceAndInsert=function(r,s,a,l){r.splice(s,a),r.splice(s,0,l)},$.left=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(0,s)},$.right=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(s)},$.rightWithPivot=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(s-1)},$.unique=function(r,s){if(r.length==0)return[];for(var a=[r.pop()];r.length>0;){for(var l=r.pop(),c=!0,d=0;d<a.length;){var m=a[d];if(++d,s(l,m)){c=!1;break}}c&&a.push(l)}return a};var De=function(){};x["verb.core.Binomial"]=De,De.__name__=["verb","core","Binomial"],De.get=function(r,s){if(s==0)return 1;if(r==0||s>r)return 0;if(s>r-s&&(s=r-s),De.memo_exists(r,s))return De.get_memo(r,s);for(var a=1,l=r,c=1,d=s+1;c<d;){var m=c++;if(De.memo_exists(l,m)){r--,a=De.get_memo(l,m);continue}a*=r--,a/=m,De.memoize(l,m,a)}return a},De.get_no_memo=function(r,s){if(s==0)return 1;if(r==0||s>r)return 0;s>r-s&&(s=r-s);for(var a=1,l=1,c=s+1;l<c;){var d=l++;a*=r--,a/=d}return a},De.memo_exists=function(r,s){return De.memo.h.hasOwnProperty(r)&&De.memo.h[r].h.hasOwnProperty(s)},De.get_memo=function(r,s){return De.memo.h[r].h[s]},De.memoize=function(r,s,a){De.memo.h.hasOwnProperty(r)||De.memo.set(r,new we),De.memo.h[r].h[s]=a};var Lt=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};x["verb.core.BoundingBox"]=Lt,Lt.__name__=["verb","core","BoundingBox"],Lt.intervalsOverlap=function(r,s,a,l,c){c==null&&(c=-1);var d;c<-.5?d=re.TOLERANCE:d=c;var m=Math.min(r,s)-d,_=Math.max(r,s)+d,y=Math.min(a,l)-d,A=Math.max(a,l)+d;return m>=y&&m<=A||_>=y&&_<=A||y>=m&&y<=_||A>=m&&A<=_},Lt.prototype={fromPoint:function(r){return new Lt([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var s=0,a=this.dim;s<a;){var l=s++;r[l]>this.max[l]&&(this.max[l]=r[l]),r[l]<this.min[l]&&(this.min[l]=r[l])}return this},addRange:function(r){for(var s=r.length,a=0;a<s;){var l=a++;this.add(r[l])}return this},contains:function(r,s){return s==null&&(s=-1),this.initialized?this.intersects(new Lt([r]),s):!1},intersects:function(r,s){if(s==null&&(s=-1),!this.initialized||!r.initialized)return!1;for(var a=this.min,l=this.max,c=r.min,d=r.max,m=0,_=this.dim;m<_;){var y=m++;if(!Lt.intervalsOverlap(a[y],l[y],c[y],d[y],s))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,s=0,a=0,l=this.dim;a<l;){var c=a++,d=this.getAxisLength(c);d>r&&(r=d,s=c)}return s},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,s){if(!this.initialized)return null;var a=this.min,l=this.max,c=r.min,d=r.max;if(!this.intersects(r,s))return null;for(var m=[],_=[],y=0,A=this.dim;y<A;){var I=y++;m.push(Math.min(l[I],d[I])),_.push(Math.max(a[I],c[I]))}return new Lt([_,m])},__class__:Lt};var re=f.core.Constants=function(){};x["verb.core.Constants"]=re,re.__name__=["verb","core","Constants"];var Qe=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=Qe,Qe.__name__=["verb","core","SerializableBase"],Qe.prototype={serialize:function(){var r=new Xe;return r.serialize(this),r.toString()},__class__:Qe};var Xn=f.core.Plane=function(r,s){this.origin=r,this.normal=s};x["verb.core.Plane"]=Xn,Xn.__name__=["verb","core","Plane"],Xn.__super__=Qe,Xn.prototype=M(Qe.prototype,{__class__:Xn});var En=f.core.Ray=function(r,s){this.origin=r,this.dir=s};x["verb.core.Ray"]=En,En.__name__=["verb","core","Ray"],En.__super__=Qe,En.prototype=M(Qe.prototype,{__class__:En});var je=f.core.NurbsCurveData=function(r,s,a){this.degree=r,this.controlPoints=a,this.knots=s};x["verb.core.NurbsCurveData"]=je,je.__name__=["verb","core","NurbsCurveData"],je.__super__=Qe,je.prototype=M(Qe.prototype,{__class__:je});var tt=f.core.NurbsSurfaceData=function(r,s,a,l,c){this.degreeU=r,this.degreeV=s,this.knotsU=a,this.knotsV=l,this.controlPoints=c};x["verb.core.NurbsSurfaceData"]=tt,tt.__name__=["verb","core","NurbsSurfaceData"],tt.__super__=Qe,tt.prototype=M(Qe.prototype,{__class__:tt});var Kt=f.core.MeshData=function(r,s,a,l){this.faces=r,this.points=s,this.normals=a,this.uvs=l};x["verb.core.MeshData"]=Kt,Kt.__name__=["verb","core","MeshData"],Kt.empty=function(){return new Kt([],[],[],[])},Kt.__super__=Qe,Kt.prototype=M(Qe.prototype,{__class__:Kt});var Kn=f.core.PolylineData=function(r,s){this.points=r,this.params=s};x["verb.core.PolylineData"]=Kn,Kn.__name__=["verb","core","PolylineData"],Kn.__super__=Qe,Kn.prototype=M(Qe.prototype,{__class__:Kn});var $n=f.core.VolumeData=function(r,s,a,l,c,d,m){this.degreeU=r,this.degreeV=s,this.degreeW=a,this.knotsU=l,this.knotsV=c,this.knotsW=d,this.controlPoints=m};x["verb.core.VolumeData"]=$n,$n.__name__=["verb","core","VolumeData"],$n.__super__=Qe,$n.prototype=M(Qe.prototype,{__class__:$n});var rt=f.core.Pair=function(r,s){this.item0=r,this.item1=s};x["verb.core.Pair"]=rt,rt.__name__=["verb","core","Pair"],rt.prototype={__class__:rt};var kt=f.core.Interval=function(r,s){this.min=r,this.max=s};x["verb.core.Interval"]=kt,kt.__name__=["verb","core","Interval"],kt.prototype={__class__:kt};var en=f.core.CurveCurveIntersection=function(r,s,a,l){this.point0=r,this.point1=s,this.u0=a,this.u1=l};x["verb.core.CurveCurveIntersection"]=en,en.__name__=["verb","core","CurveCurveIntersection"],en.prototype={__class__:en};var Zn=f.core.CurveSurfaceIntersection=function(r,s,a,l){this.u=r,this.uv=s,this.curvePoint=a,this.surfacePoint=l};x["verb.core.CurveSurfaceIntersection"]=Zn,Zn.__name__=["verb","core","CurveSurfaceIntersection"],Zn.prototype={__class__:Zn};var zr=f.core.MeshIntersectionPoint=function(r,s,a,l,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=s,this.point=a,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=zr,zr.__name__=["verb","core","MeshIntersectionPoint"],zr.prototype={__class__:zr};var Qn=f.core.PolylineMeshIntersection=function(r,s,a,l,c){this.point=r,this.u=s,this.uv=a,this.polylineIndex=l,this.faceIndex=c};x["verb.core.PolylineMeshIntersection"]=Qn,Qn.__name__=["verb","core","PolylineMeshIntersection"],Qn.prototype={__class__:Qn};var Jn=f.core.SurfaceSurfaceIntersectionPoint=function(r,s,a,l){this.uv0=r,this.uv1=s,this.point=a,this.dist=l};x["verb.core.SurfaceSurfaceIntersectionPoint"]=Jn,Jn.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],Jn.prototype={__class__:Jn};var es=f.core.TriSegmentIntersection=function(r,s,a,l){this.point=r,this.s=s,this.t=a,this.p=l};x["verb.core.TriSegmentIntersection"]=es,es.__name__=["verb","core","TriSegmentIntersection"],es.prototype={__class__:es};var kn=f.core.CurveTriPoint=function(r,s,a){this.u=r,this.point=s,this.uv=a};x["verb.core.CurveTriPoint"]=kn,kn.__name__=["verb","core","CurveTriPoint"],kn.prototype={__class__:kn};var Yt=function(r,s,a,l,c){c==null&&(c=!1),l==null&&(l=-1),this.uv=a,this.point=r,this.normal=s,this.id=l,this.degen=c};x["verb.core.SurfacePoint"]=Yt,Yt.__name__=["verb","core","SurfacePoint"],Yt.fromUv=function(r,s){return new Yt(null,null,[r,s])},Yt.prototype={__class__:Yt};var qs=f.core.CurvePoint=function(r,s){this.u=r,this.pt=s};x["verb.core.CurvePoint"]=qs,qs.__name__=["verb","core","CurvePoint"],qs.prototype={__class__:qs};var ts=f.core.KdTree=function(r,s){this.dim=3,this.points=r,this.distanceFunction=s,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=ts,ts.__name__=["verb","core","KdTree"],ts.prototype={buildTree:function(r,s,a){var l=s%this.dim,c,d;return r.length==0?null:r.length==1?new Tn(r[0],l,a):(r.sort(function(m,_){var y=m.point[l]-_.point[l];return y==0?0:y>0?1:-1}),c=Math.floor(r.length/2),d=new Tn(r[c],l,a),d.left=this.buildTree(r.slice(0,c),s+1,d),d.right=this.buildTree(r.slice(c+1),s+1,d),d)},nearest:function(r,s,a){var l=this,c=new rs(function(S){return-S.item1}),d,m=null;m=function(S){for(var P,k=S.dimension,T=l.distanceFunction(r,S.kdPoint.point),O,C=[],R=0,z=l.dim;R<z;)R++,C.push(0);O=C;for(var U,V,q=function(K,ee){c.push(new rt(K,ee)),c.size()>s&&c.pop()},J=0,H=l.dim;J<H;){var G=J++;G==S.dimension?O[G]=r[G]:O[G]=S.kdPoint.point[G]}if(U=l.distanceFunction(O,S.kdPoint.point),S.right==null&&S.left==null){(c.size()<s||T<c.peek().item1)&&q(S,T);return}S.right==null?P=S.left:S.left==null?P=S.right:r[k]<S.kdPoint.point[k]?P=S.left:P=S.right,m(P),(c.size()<s||T<c.peek().item1)&&q(S,T),(c.size()<s||Math.abs(U)<c.peek().item1)&&(P==S.left?V=S.right:V=S.left,V!=null&&m(V))},d=m;for(var _=0;_<s;)_++,c.push(new rt(null,a));d(this.root);for(var y=[],A=0;A<s;){var I=A++;c.content[I].item0!=null&&y.push(new rt(c.content[I].item0.kdPoint,c.content[I].item1))}return y},__class__:ts};var rs=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=rs,rs.__name__=["verb","core","BinaryHeap"],rs.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],s=this.content.pop();return this.content.length>0&&(this.content[0]=s,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var s=this.content.length,a=0;a<s;){var l=a++;if(this.content[l]==r){var c=this.content.pop();l!=s-1&&(this.content[l]=c,this.scoreFunction(c)<this.scoreFunction(r)?this.bubbleUp(l):this.sinkDown(l));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var s=this.content[r];r>0;){var a=Math.floor((r+1)/2)-1,l=this.content[a];if(this.scoreFunction(s)<this.scoreFunction(l))this.content[a]=s,this.content[r]=l,r=a;else break}},sinkDown:function(r){for(var s=this.content.length,a=this.content[r],l=this.scoreFunction(a);;){var c=(r+1)*2,d=c-1,m=-1,_=0;if(d<s){var y=this.content[d];_=this.scoreFunction(y),_<l&&(m=d)}if(c<s){var A=this.content[c],I=this.scoreFunction(A);I<(m==-1?l:_)&&(m=c)}if(m!=-1)this.content[r]=this.content[m],this.content[m]=a,r=m;else break}},__class__:rs};var Mn=f.core.KdPoint=function(r,s){this.point=r,this.obj=s};x["verb.core.KdPoint"]=Mn,Mn.__name__=["verb","core","KdPoint"],Mn.prototype={__class__:Mn};var Tn=f.core.KdNode=function(r,s,a){this.kdPoint=r,this.left=null,this.right=null,this.parent=a,this.dimension=s};x["verb.core.KdNode"]=Tn,Tn.__name__=["verb","core","KdNode"],Tn.prototype={__class__:Tn};var mr=function(){};x["verb.eval.IBoundingBoxTree"]=mr,mr.__name__=["verb","eval","IBoundingBoxTree"],mr.prototype={__class__:mr};var or=function(r,s){this._boundingBox=null,this._curve=r,s==null&&(s=p.domain(this._curve.knots)/64),this._knotTol=s};x["verb.core.LazyCurveBoundingBoxTree"]=or,or.__name__=["verb","core","LazyCurveBoundingBoxTree"],or.__interfaces__=[mr],or.prototype={split:function(){var r=$.first(this._curve.knots),s=$.last(this._curve.knots),a=s-r,l=ht.curveSplit(this._curve,(s+r)/2+a*.1*Math.random());return new rt(new or(l[0],this._knotTol),new or(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Lt(N.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return p.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:or};var lr=function(r,s){if(this._boundingBox=null,this._mesh=r,s==null){for(var a=[],l=0,c=r.faces.length;l<c;){var d=l++;a.push(d)}s=a}this._faceIndices=s};x["verb.core.LazyMeshBoundingBoxTree"]=lr,lr.__name__=["verb","core","LazyMeshBoundingBoxTree"],lr.__interfaces__=[mr],lr.prototype={split:function(){var r=nt.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),s=$.left(r),a=$.right(r);return new rt(new lr(this._mesh,s),new lr(this._mesh,a))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=nt.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:lr};var hr=function(r,s){this._boundingBox=null,this._polyline=r,s==null&&(s=new kt(0,r.points.length!=0?r.points.length-1:0)),this._interval=s};x["verb.core.LazyPolylineBoundingBoxTree"]=hr,hr.__name__=["verb","core","LazyPolylineBoundingBoxTree"],hr.__interfaces__=[mr],hr.prototype={split:function(){var r=this._interval.min,s=this._interval.max,a=r+Math.ceil((s-r)/2),l=new kt(r,a),c=new kt(a,s);return new rt(new hr(this._polyline,l),new hr(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Lt(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:hr};var Rr=function(r,s,a,l){s==null&&(s=!1),this._boundingBox=null,this._surface=r,this._splitV=s,a==null&&(a=p.domain(r.knotsU)/16),l==null&&(l=p.domain(r.knotsV)/16),this._knotTolU=a,this._knotTolV=l};x["verb.core.LazySurfaceBoundingBoxTree"]=Rr,Rr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Rr.__interfaces__=[mr],Rr.prototype={split:function(){var r,s;this._splitV?(r=$.first(this._surface.knotsV),s=$.last(this._surface.knotsV)):(r=$.first(this._surface.knotsU),s=$.last(this._surface.knotsU));var a=(r+s)/2,l=ht.surfaceSplit(this._surface,a,this._splitV);return new rt(new Rr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Rr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Lt;for(var r=0,s=this._surface.controlPoints;r<s.length;){var a=s[r];++r,this._boundingBox.addRange(N.dehomogenize1d(a))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return p.domain(this._surface.knotsV)<this._knotTolV&&p.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Rr};var Oe=f.core.Mat=function(){};x["verb.core.Mat"]=Oe,Oe.__name__=["verb","core","Mat"],Oe.mul=function(r,s){for(var a=[],l=0,c=s.length;l<c;){var d=l++;a.push(p.mul(r,s[d]))}return a},Oe.mult=function(r,s){var a,l,c,d,m,_,y,A;a=r.length,l=s.length,c=s[0].length,d=[];for(var I=a-1,S=0,P=0;I>=0;){for(m=[],_=r[I],P=c-1;P>=0;){for(y=_[l-1]*s[l-1][P],S=l-2;S>=1;)A=S-1,y+=_[S]*s[S][P]+_[A]*s[A][P],S-=2;S==0&&(y+=_[0]*s[0][P]),m[P]=y,P--}d[I]=m,I--}return d},Oe.add=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(p.add(r[d],s[d]))}return a},Oe.div=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(p.div(r[d],s))}return a},Oe.sub=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(p.sub(r[d],s[d]))}return a},Oe.dot=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(p.dot(r[d],s))}return a},Oe.identity=function(r){for(var s=p.zeros2d(r,r),a=0;a<r;){var l=a++;s[l][l]=1}return s},Oe.transpose=function(r){if(r.length==0)return[];for(var s=[],a=0,l=r[0].length;a<l;){var c=a++;s.push(function(d){for(var m,_=[],y=0,A=r.length;y<A;){var I=y++;_.push(r[I][c])}return m=_,m}())}return s},Oe.solve=function(r,s){return Oe.LUsolve(Oe.LU(r),s)},Oe.LUsolve=function(r,s){var a,l,c=r.LU,d=c.length,m=s.slice(),_=r.P,y,A,I;for(a=d-1;a!=-1;)m[a]=s[a],--a;for(a=0;a<d;){for(y=_[a],_[a]!=a&&(I=m[a],m[a]=m[y],m[y]=I),A=c[a],l=0;l<a;)m[a]-=m[l]*A[l],++l;++a}for(a=d-1;a>=0;){for(A=c[a],l=a+1;l<d;)m[a]-=m[l]*A[l],++l;m[a]/=A[a],--a}return m},Oe.LU=function(r){for(var s,a,l,c,d,m,_,y,A,I=[],S=0,P=r.length;S<P;){var k=S++;I.push(r[k].slice())}r=I;var T=r.length,O=T-1,C=[];for(l=0;l<T;){for(_=l,m=r[l],A=Math.abs(m[l]),a=l+1;a<T;)c=Math.abs(r[a][l]),A<c&&(A=c,_=a),++a;for(C[l]=_,_!=l&&(r[l]=r[_],r[_]=m,m=r[l]),d=m[l],s=l+1;s<T;)r[s][l]/=d,++s;for(s=l+1;s<T;){for(y=r[s],a=l+1;a<O;)y[a]-=y[l]*m[a],++a,y[a]-=y[l]*m[a],++a;a==O&&(y[a]-=y[l]*m[a]),++s}++l}return new ns(r,C)};var ns=function(r,s){this.LU=r,this.P=s};x["verb.core._Mat.LUDecomp"]=ns,ns.__name__=["verb","core","_Mat","LUDecomp"],ns.prototype={__class__:ns};var nt=f.core.Mesh=function(){};x["verb.core.Mesh"]=nt,nt.__name__=["verb","core","Mesh"],nt.getTriangleNorm=function(r,s){var a=r[s[0]],l=r[s[1]],c=r[s[2]],d=p.sub(l,a),m=p.sub(c,a),_=p.cross(d,m);return p.mul(1/p.norm(_),_)},nt.makeMeshAabb=function(r,s){for(var a=new Lt,l=0;l<s.length;){var c=s[l];++l,a.add(r.points[r.faces[c][0]]),a.add(r.points[r.faces[c][1]]),a.add(r.points[r.faces[c][2]])}return a},nt.sortTrianglesOnLongestAxis=function(r,s,a){for(var l=r.getLongestAxis(),c=[],d=0;d<a.length;){var m=a[d];++d;var _=nt.getMinCoordOnAxis(s.points,s.faces[m],l);c.push(new rt(_,m))}c.sort(function(P,k){var T=P.item0,O=k.item0;return T==O?0:T>O?1:-1});for(var y=[],A=0,I=c.length;A<I;){var S=A++;y.push(c[S].item1)}return y},nt.getMinCoordOnAxis=function(r,s,a){for(var l=1/0,c=0;c<3;){var d=c++,m=r[s[d]][a];m<l&&(l=m)}return l},nt.getTriangleCentroid=function(r,s){for(var a=[0,0,0],l=0;l<3;)for(var c=l++,d=0;d<3;){var m=d++;a[m]+=r[s[c]][m]}for(var _=0;_<3;){var y=_++;a[y]/=3}return a},nt.triangleUVFromPoint=function(r,s,a){var l=r.faces[s],c=r.points[l[0]],d=r.points[l[1]],m=r.points[l[2]],_=r.uvs[l[0]],y=r.uvs[l[1]],A=r.uvs[l[2]],I=p.sub(c,a),S=p.sub(d,a),P=p.sub(m,a),k=p.norm(p.cross(p.sub(c,d),p.sub(c,m))),T=p.norm(p.cross(S,P))/k,O=p.norm(p.cross(P,I))/k,C=p.norm(p.cross(I,S))/k;return p.add(p.mul(T,_),p.add(p.mul(O,y),p.mul(C,A)))};var Dr=function(r,s){if(this._empty=!1,this._face=-1,s==null){for(var a=[],l=0,c=r.faces.length;l<c;){var d=l++;a.push(d)}s=a}if(this._boundingBox=nt.makeMeshAabb(r,s),s.length<1){this._empty=!0;return}else if(s.length<2){this._face=s[0];return}var m=nt.sortTrianglesOnLongestAxis(this._boundingBox,r,s),_=$.left(m),y=$.right(m);this._children=new rt(new Dr(r,_),new Dr(r,y))};x["verb.core.MeshBoundingBoxTree"]=Dr,Dr.__name__=["verb","core","MeshBoundingBoxTree"],Dr.__interfaces__=[mr],Dr.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:Dr};var $t=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=$t,$t.__name__=["verb","core","Minimizer"],$t.uncmin=function(r,s,a,l,c){a==null&&(a=1e-8),l==null&&(l=function(J){return $t.numericalGradient(r,J)}),c==null&&(c=1e3),s=s.slice(0);var d=s.length,m=r(s),_=m,y;if(isNaN(m))throw new Q("uncmin: f(x0) is a NaN!");a=Math.max(a,re.EPSILON);var A,I,S,P=Oe.identity(d),k=0,T=[],O,C,R,z,U,V,q="";for(I=l(s);k<c;){if(!p.all(p.finite(I))){q="Gradient has Infinity or NaN";break}if(A=p.neg(Oe.dot(P,I)),!p.all(p.finite(A))){q="Search direction has Infinity or NaN";break}if(V=p.norm(A),V<a){q="Newton step smaller than tol";break}for(U=1,y=p.dot(I,A),O=s;k<c&&!(U*V<a);){if(T=p.mul(U,A),O=p.add(s,T),_=r(O),_-m>=.1*U*y||isNaN(_)){U*=.5,++k;continue}break}if(U*V<a){q="Line search step size smaller than tol";break}if(k==c){q="maxit reached during line search";break}S=l(O),C=p.sub(S,I),z=p.dot(C,T),R=Oe.dot(P,C),P=Oe.sub(Oe.add(P,Oe.mul((z+p.dot(C,R))/(z*z),$t.tensor(T,T))),Oe.div(Oe.add($t.tensor(R,T),$t.tensor(T,R)),z)),s=O,m=_,I=S,++k}return new ss(s,m,I,P,k,q)},$t.numericalGradient=function(r,s){var a=s.length,l=r(s);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=s.slice(0),d,m,_=[],y,A=.001,I,S,P,k=0,T,O,C,R=0;R<a;)for(var z=R++,U=Math.max(1e-6*l,1e-8);;){if(++k,k>20)throw new Q("Numerical gradient fails");if(c[z]=s[z]+U,d=r(c),c[z]=s[z]-U,m=r(c),c[z]=s[z],isNaN(d)||isNaN(m)){U/=16;continue}if(_[z]=(d-m)/(2*U),I=s[z]-U,S=s[z],P=s[z]+U,T=(d-l)/U,O=(l-m)/U,C=p.max([Math.abs(_[z]),Math.abs(l),Math.abs(d),Math.abs(m),Math.abs(I),Math.abs(S),Math.abs(P),1e-8]),y=Math.min(p.max([Math.abs(T-_[z]),Math.abs(O-_[z]),Math.abs(T-O)])/C,U/C),y>A)U/=16;else break}return _},$t.tensor=function(r,s){for(var a=r.length,l=s.length,c=[],d,m,_=a-1;_>=0;){d=[],m=r[_];for(var y=l-1;y>=3;)d[y]=m*s[y],--y,d[y]=m*s[y],--y,d[y]=m*s[y],--y,d[y]=m*s[y],--y;for(;y>=0;)d[y]=m*s[y],--y;c[_]=d,_--}return c};var ss=function(r,s,a,l,c,d){this.solution=r,this.value=s,this.gradient=a,this.invHessian=l,this.iterations=c,this.message=d};x["verb.core.MinimizationResult"]=ss,ss.__name__=["verb","core","MinimizationResult"],ss.prototype={__class__:ss};var Nn=function(){};x["verb.core.ISerializable"]=Nn,Nn.__name__=["verb","core","ISerializable"],Nn.prototype={__class__:Nn};var $i=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=$i,$i.__name__=["verb","core","Deserializer"],$i.deserialize=function(r){var s=new He(r),a=s.unserialize();return a};var Ot=f.core.Trig=function(){};x["verb.core.Trig"]=Ot,Ot.__name__=["verb","core","Trig"],Ot.isPointInPlane=function(r,s,a){return Math.abs(p.dot(p.sub(r,s.origin),s.normal))<a},Ot.distToSegment=function(r,s,a){var l=Ot.segmentClosestPoint(s,r,a,0,1);return p.dist(s,l.pt)},Ot.rayClosestPoint=function(r,s,a){var l=p.sub(r,s),c=p.dot(l,a),d=p.add(s,p.mul(c,a));return d},Ot.distToRay=function(r,s,a){var l=Ot.rayClosestPoint(r,s,a),c=p.sub(l,r);return p.norm(c)},Ot.threePointsAreFlat=function(r,s,a,l){var c=p.sub(s,r),d=p.sub(a,r),m=p.cross(c,d),_=p.dot(m,m);return _<l},Ot.segmentClosestPoint=function(r,s,a,l,c){var d=p.sub(a,s),m=p.norm(d);if(m<re.EPSILON)return{u:l,pt:s};var _=s,y=p.mul(1/m,d),A=p.sub(r,_),I=p.dot(A,y);return I<0?{u:l,pt:s}:I>m?{u:c,pt:a}:{u:l+(c-l)*I/m,pt:p.add(_,p.mul(I,y))}};var p=f.core.Vec=function(){};x["verb.core.Vec"]=p,p.__name__=["verb","core","Vec"],p.angleBetween=function(r,s){return Math.acos(p.dot(r,s)/(p.norm(r)*p.norm(s)))},p.positiveAngleBetween=function(r,s,a){var l=p.cross(r,s),c=p.norm(r),d=p.norm(s),m=c*d,_=p.dot(r,s),y=p.norm(l)/m,A=_/m,I=Math.atan2(y,A),S=p.dot(a,l);return Math.abs(S)<re.EPSILON||S>0?I:-I},p.signedAngleBetween=function(r,s,a){var l=p.cross(r,s),c=p.norm(r),d=p.norm(s),m=c*d,_=p.dot(r,s),y=p.norm(l)/m,A=_/m,I=Math.atan2(y,A),S=p.dot(a,l);return S>0?I:2*Math.PI-I},p.angleBetweenNormalized2d=function(r,s){var a=r[0]*s[1]-r[1]*s[0];return Math.atan2(a,p.dot(r,s))},p.domain=function(r){return $.last(r)-$.first(r)},p.range=function(r){for(var s=[],a=0,l=0;l<r;)l++,s.push(a),a+=1;return s},p.span=function(r,s,a){if(a==null)return[];if(a<re.EPSILON)return[];if(r>s&&a>0)return[];if(s>r&&a<0)return[];for(var l=[],c=r;c<=s;)l.push(c),c+=a;return l},p.neg=function(r){return r.map(function(s){return-s})},p.min=function(r){return B.fold(r,function(s,a){return Math.min(s,a)},1/0)},p.max=function(r){return B.fold(r,function(s,a){return Math.max(s,a)},-1/0)},p.all=function(r){return B.fold(r,function(s,a){return a&&s},!0)},p.finite=function(r){return r.map(function(s){return isFinite(s)})},p.onRay=function(r,s,a){return p.add(r,p.mul(a,s))},p.lerp=function(r,s,a){return p.add(p.mul(r,s),p.mul(1-r,a))},p.normalized=function(r){return p.div(r,p.norm(r))},p.cross=function(r,s){return[r[1]*s[2]-r[2]*s[1],r[2]*s[0]-r[0]*s[2],r[0]*s[1]-r[1]*s[0]]},p.dist=function(r,s){return p.norm(p.sub(r,s))},p.distSquared=function(r,s){return p.normSquared(p.sub(r,s))},p.sum=function(r){return B.fold(r,function(s,a){return a+s},0)},p.addAll=function(r){var s=Zt(r)();if(!s.hasNext())return null;var a=s.next().length;return B.fold(r,function(l,c){return p.add(c,l)},p.rep(a,0))},p.addAllMutate=function(r){for(var s=r[0],a=1,l=r.length;a<l;){var c=a++;p.addMutate(s,r[c])}},p.addMulMutate=function(r,s,a){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]+s*a[d]}},p.subMulMutate=function(r,s,a){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]-s*a[d]}},p.addMutate=function(r,s){for(var a=0,l=r.length;a<l;){var c=a++;r[c]=r[c]+s[c]}},p.subMutate=function(r,s){for(var a=0,l=r.length;a<l;){var c=a++;r[c]=r[c]-s[c]}},p.mulMutate=function(r,s){for(var a=0,l=s.length;a<l;){var c=a++;s[c]=s[c]*r}},p.norm=function(r){var s=p.normSquared(r);return s!=0?Math.sqrt(s):s},p.normSquared=function(r){return B.fold(r,function(s,a){return a+s*s},0)},p.rep=function(r,s){for(var a=[],l=0;l<r;)l++,a.push(s);return a},p.zeros1d=function(r){for(var s=[],a=0;a<r;)a++,s.push(0);return s},p.zeros2d=function(r,s){for(var a=[],l=0;l<r;)l++,a.push(p.zeros1d(s));return a},p.zeros3d=function(r,s,a){for(var l=[],c=0;c<r;)c++,l.push(p.zeros2d(s,a));return l},p.dot=function(r,s){for(var a=0,l=0,c=r.length;l<c;){var d=l++;a+=r[d]*s[d]}return a},p.add=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]+s[d])}return a},p.mul=function(r,s){for(var a=[],l=0,c=s.length;l<c;){var d=l++;a.push(r*s[d])}return a},p.div=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]/s)}return a},p.sub=function(r,s){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]-s[d])}return a},p.isZero=function(r){for(var s=0,a=r.length;s<a;){var l=s++;if(Math.abs(r[l])>re.TOLERANCE)return!1}return!0},p.sortedSetUnion=function(r,s){for(var a=[],l=0,c=0;l<r.length||c<s.length;){if(l>=r.length){a.push(s[c]),c++;continue}else if(c>=s.length){a.push(r[l]),l++;continue}var d=r[l]-s[c];if(Math.abs(d)<re.EPSILON){a.push(r[l]),l++,c++;continue}if(d>0){a.push(s[c]),c++;continue}a.push(r[l]),l++}return a},p.sortedSetSub=function(r,s){for(var a=[],l=0,c=0;l<r.length;){if(c>=s.length){a.push(r[l]),l++;continue}if(Math.abs(r[l]-s[c])<re.EPSILON){l++,c++;continue}a.push(r[l]),l++}return a};var be=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=be,be.__name__=["verb","eval","Analyze"],be.knotMultiplicities=function(r){for(var s=[new Cn(r[0],0)],a=s[0],l=0;l<r.length;){var c=r[l];++l,Math.abs(c-a.knot)>re.EPSILON&&(a=new Cn(c,0),s.push(a)),a.inc()}return s},be.isRationalSurfaceClosed=function(r,s){s==null&&(s=!0);var a;s?a=r.controlPoints:a=Oe.transpose(r.controlPoints);for(var l=0,c=a[0].length;l<c;){var d=l++,m=p.dist($.first(a)[d],$.last(a)[d])<re.EPSILON;if(!m)return!1}return!0},be.rationalSurfaceClosestPoint=function(r,s){var a=be.rationalSurfaceClosestParam(r,s);return N.rationalSurfacePoint(r,a[0],a[1])},be.rationalSurfaceClosestParam=function(r,s){for(var a=5,l=0,c,d=1e-4,m=5e-4,_,y=r.knotsU[0],A=$.last(r.knotsU),I=r.knotsV[0],S=$.last(r.knotsV),P=be.isRationalSurfaceClosed(r),k=be.isRationalSurfaceClosed(r,!1),T,O=ze.rationalSurfaceAdaptive(r,new Fr),C=1/0,R=0,z=O.points.length;R<z;){var U=R++,V=O.points[U],q=p.normSquared(p.sub(s,V));q<C&&(C=q,T=O.uvs[U])}for(var J=function(We){return N.rationalSurfaceDerivatives(r,We[0],We[1],2)},H=function(We,Ke,Ue){var $e=Ke[1][0],Mt=Ke[0][1],Xt=Ke[2][0],bt=Ke[0][2],_t=Ke[1][1],Tt=Ke[1][1],zt=p.dot($e,Ue),Qt=p.dot(Mt,Ue),cr=[-zt,-Qt],Jt=p.dot($e,$e)+p.dot(Xt,Ue),er=p.dot($e,Mt)+p.dot(_t,Ue),tr=p.dot($e,Mt)+p.dot(Tt,Ue),fr=p.dot(Mt,Mt)+p.dot(bt,Ue),zn=[[Jt,er],[tr,fr]],rn=Oe.solve(zn,cr);return p.add(rn,We)};l<a;){c=J(T),_=p.sub(c[0][0],s);var G=p.norm(_),K=p.dot(c[1][0],_),ee=p.norm(c[1][0])*G,te=p.dot(c[0][1],_),ie=p.norm(c[0][1])*G,he=K/ee,ae=te/ie,ue=G<d,ne=he<m,pe=ae<m;if(ue&&ne&&pe)return T;var X=H(T,c,_);X[0]<y?P?X=[A-(X[0]-y),X[1]]:X=[y+re.EPSILON,X[1]]:X[0]>A&&(P?X=[y+(X[0]-A),X[1]]:X=[A-re.EPSILON,X[1]]),X[1]<I?k?X=[X[0],S-(X[1]-I)]:X=[X[0],I+re.EPSILON]:X[1]>S&&(k?X=[X[0],I+(X[0]-S)]:X=[X[0],S-re.EPSILON]);var fe=p.norm(p.mul(X[0]-T[0],c[1][0])),Pe=p.norm(p.mul(X[1]-T[1],c[0][1]));if(fe+Pe<d)return T;T=X,l++}return T},be.rationalCurveClosestPoint=function(r,s){return N.rationalCurvePoint(r,be.rationalCurveClosestParam(r,s))},be.rationalCurveClosestParam=function(r,s){for(var a=1/0,l=0,c=ze.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,m=c.length-1;d<m;){var _=d++,y=c[_][0],A=c[_+1][0],I=c[_].slice(1),S=c[_+1].slice(1),P=Ot.segmentClosestPoint(s,I,S,y,A),k=p.norm(p.sub(s,P.pt));k<a&&(a=k,l=P.u)}for(var T=5,O=0,C,R=1e-4,z=5e-4,U,V=r.knots[0],q=$.last(r.knots),J=p.normSquared(p.sub(r.controlPoints[0],$.last(r.controlPoints)))<re.EPSILON,H=l,G=function(X){return N.rationalCurveDerivatives(r,X,2)},K=function(X,fe,Pe){var We=p.dot(fe[1],Pe),Ke=p.dot(fe[2],Pe),Ue=p.dot(fe[1],fe[1]),$e=Ke+Ue;return X-We/$e};O<T;){C=G(H),U=p.sub(C[0],s);var ee=p.norm(U),te=p.dot(C[1],U),ie=p.norm(C[1])*ee,he=te/ie,ae=ee<R,ue=Math.abs(he)<z;if(ae&&ue)return H;var ne=K(H,C,U);ne<V?J?ne=q-(ne-V):ne=V:ne>q&&(J?ne=V+(ne-q):ne=q);var pe=p.norm(p.mul(ne-H,C[1]));if(pe<R)return H;H=ne,O++}return H},be.rationalCurveParamAtArcLength=function(r,s,a,l,c){if(a==null&&(a=.001),s<re.EPSILON)return r.knots[0];var d;l!=null?d=l:d=_e.decomposeCurveIntoBeziers(r);var m=0;d[m];var _=-re.EPSILON,y;for(c!=null?y=c:y=[];_<s&&m<d.length;){if(m<y.length?y[m]=y[m]:y[m]=be.rationalBezierCurveArcLength(r),_+=y[m],s<_+re.EPSILON)return be.rationalBezierCurveParamAtArcLength(r,s,a,y[m]);m++}return-1},be.rationalBezierCurveParamAtArcLength=function(r,s,a,l){if(s<0)return r.knots[0];var c;if(l!=null?c=l:c=be.rationalBezierCurveArcLength(r),s>c)return $.last(r.knots);var d=r.knots[0],m=0,_=$.last(r.knots),y=c,A=0,I=0,S;for(a!=null?S=a:S=re.TOLERANCE*2;y-m>S;)A=(d+_)/2,I=be.rationalBezierCurveArcLength(r,A),I>s?(_=A,y=I):(d=A,m=I);return(d+_)/2},be.rationalCurveArcLength=function(r,s,a){a==null&&(a=16),s==null?s=$.last(r.knots):s=s;for(var l=_e.decomposeCurveIntoBeziers(r),c=0,d=l[0],m=0;c<l.length&&d.knots[0]+re.EPSILON<s;){var _=Math.min($.last(d.knots),s);m+=be.rationalBezierCurveArcLength(d,_,a),d=l[++c]}return m},be.rationalBezierCurveArcLength=function(r,s,a){a==null&&(a=16);var l;s==null?l=$.last(r.knots):l=s;for(var c=(l-r.knots[0])/2,d=0,m=r.degree+a,_,y,A=0;A<m;){var I=A++;_=c*be.Tvalues[m][I]+c+r.knots[0],y=N.rationalCurveDerivatives(r,_,1),d+=be.Cvalues[m][I]*p.norm(y[1])}return c*d};var Cn=f.eval.KnotMultiplicity=function(r,s){this.knot=r,this.mult=s};x["verb.eval.KnotMultiplicity"]=Cn,Cn.__name__=["verb","eval","KnotMultiplicity"],Cn.prototype={inc:function(){this.mult++},__class__:Cn};var qt=f.eval.Check=function(){};x["verb.eval.Check"]=qt,qt.__name__=["verb","eval","Check"],qt.isValidKnotVector=function(r,s){if(r.length==0||r.length<(s+1)*2)return!1;for(var a=$.first(r),l=0,c=s+1;l<c;){var d=l++;if(Math.abs(r[d]-a)>re.EPSILON)return!1}a=$.last(r);for(var m=r.length-s-1,_=r.length;m<_;){var y=m++;if(Math.abs(r[y]-a)>re.EPSILON)return!1}return qt.isNonDecreasing(r)},qt.isNonDecreasing=function(r){for(var s=$.first(r),a=0,l=r.length;a<l;){var c=a++;if(r[c]<s-re.EPSILON)return!1;s=r[c]}return!0},qt.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!qt.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},qt.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!qt.isValidKnotVector(r.knotsU,r.degreeU)||!qt.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var ht=f.eval.Divide=function(){};x["verb.eval.Divide"]=ht,ht.__name__=["verb","eval","Divide"],ht.surfaceSplit=function(r,s,a){a==null&&(a=!1);var l,c,d;a?(d=r.controlPoints,l=r.knotsV,c=r.degreeV):(d=Oe.transpose(r.controlPoints),l=r.knotsU,c=r.degreeU);for(var m,_=[],y=0,A=c+1;y<A;)y++,_.push(s);m=_;for(var I=[],S=[],P=N.knotSpan(c,s,l),k=null,T=0;T<d.length;){var O=d[T];++T,k=_e.curveKnotRefine(new je(c,l,O),m),I.push(k.controlPoints.slice(0,P+1)),S.push(k.controlPoints.slice(P+1))}var C=k.knots.slice(0,P+c+2),R=k.knots.slice(P+1);return a?[new tt(r.degreeU,c,r.knotsU.slice(),C,I),new tt(r.degreeU,c,r.knotsU.slice(),R,S)]:(I=Oe.transpose(I),S=Oe.transpose(S),[new tt(c,r.degreeV,C,r.knotsV.slice(),I),new tt(c,r.degreeV,R,r.knotsV.slice(),S)])},ht.curveSplit=function(r,s){var a=r.degree;r.controlPoints;for(var l=r.knots,c,d=[],m=0,_=a+1;m<_;)m++,d.push(s);c=d;var y=_e.curveKnotRefine(r,c),A=N.knotSpan(a,s,l),I=y.knots.slice(0,A+a+2),S=y.knots.slice(A+1),P=y.controlPoints.slice(0,A+1),k=y.controlPoints.slice(A+1);return[new je(a,I,P),new je(a,S,k)]},ht.rationalCurveByEqualArcLength=function(r,s){var a=be.rationalCurveArcLength(r),l=a/s;return ht.rationalCurveByArcLength(r,l)},ht.rationalCurveByArcLength=function(r,s){var a=_e.decomposeCurveIntoBeziers(r),l=a.map(function(P){return be.rationalBezierCurveArcLength(P)}),c=p.sum(l),d=[new Ln(r.knots[0],0)];if(s>c)return d;for(var m=s,_=0,y=m,A=0,I=0,S;_<a.length;){for(A+=l[_];y<A+re.EPSILON;)S=be.rationalBezierCurveParamAtArcLength(a[_],y-I,re.TOLERANCE,l[_]),d.push(new Ln(S,y)),y+=m;I+=l[_],_++}return d};var Ln=f.eval.CurveLengthSample=function(r,s){this.u=r,this.len=s};x["verb.eval.CurveLengthSample"]=Ln,Ln.__name__=["verb","eval","CurveLengthSample"],Ln.prototype={__class__:Ln};var N=f.eval.Eval=function(){};x["verb.eval.Eval"]=N,N.__name__=["verb","eval","Eval"],N.rationalCurveTangent=function(r,s){var a=N.rationalCurveDerivatives(r,s,1);return a[1]},N.rationalSurfaceNormal=function(r,s,a){var l=N.rationalSurfaceDerivatives(r,s,a,1);return p.cross(l[1][0],l[0][1])},N.rationalSurfaceDerivatives=function(r,s,a,l){l==null&&(l=1);for(var c=N.surfaceDerivatives(r,s,a,l),d=N.rational2d(c),m=N.weight2d(c),_=[],y=d[0][0].length,A=0,I=l+1;A<I;){var S=A++;_.push([]);for(var P=0,k=l-S+1;P<k;){for(var T=P++,O=d[S][T],C=1,R=T+1;C<R;){var z=C++;p.subMulMutate(O,De.get(T,z)*m[0][z],_[S][T-z])}for(var U=1,V=S+1;U<V;){var q=U++;p.subMulMutate(O,De.get(S,q)*m[q][0],_[S-q][T]);for(var J=p.zeros1d(y),H=1,G=T+1;H<G;){var K=H++;p.addMulMutate(J,De.get(T,K)*m[q][K],_[S-q][T-K])}p.subMulMutate(O,De.get(S,q),J)}p.mulMutate(1/m[0][0],O),_[S].push(O)}}return _},N.rationalSurfacePoint=function(r,s,a){return N.dehomogenize(N.surfacePoint(r,s,a))},N.rationalCurveDerivatives=function(r,s,a){a==null&&(a=1);for(var l=N.curveDerivatives(r,s,a),c=N.rational1d(l),d=N.weight1d(l),m=[],_=0,y=a+1;_<y;){for(var A=_++,I=c[A],S=1,P=A+1;S<P;){var k=S++;p.subMulMutate(I,De.get(A,k)*d[k],m[A-k])}p.mulMutate(1/d[0],I),m.push(I)}return m},N.rationalCurvePoint=function(r,s){return N.dehomogenize(N.curvePoint(r,s))},N.surfaceDerivatives=function(r,s,a,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return N.surfaceDerivativesGivenNM(c,d,r,s,a,l)},N.surfaceDerivativesGivenNM=function(r,s,a,l,c,d){var m=a.degreeU,_=a.degreeV,y=a.controlPoints,A=a.knotsU,I=a.knotsV;if(!N.areValidRelations(m,y.length,A.length)||!N.areValidRelations(_,y[0].length,I.length))throw new Q("Invalid relations between control points, knot vector, and n");var S=y[0][0].length,P;d<m?P=d:P=m;var k;d<_?k=d:k=_;for(var T=p.zeros3d(d+1,d+1,S),O=N.knotSpanGivenN(r,m,l,A),C=N.knotSpanGivenN(s,_,c,I),R=N.derivativeBasisFunctionsGivenNI(O,l,m,r,A),z=N.derivativeBasisFunctionsGivenNI(C,c,_,s,I),U=p.zeros2d(_+1,S),V=0,q=0,J=P+1;q<J;){for(var H=q++,G=0,K=_+1;G<K;){var ee=G++;U[ee]=p.zeros1d(S);for(var te=0,ie=m+1;te<ie;){var he=te++;p.addMulMutate(U[ee],R[H][he],y[O-m+he][C-_+ee])}}var ae=d-H;ae<k?V=ae:V=k;for(var ue=0,ne=V+1;ue<ne;){var pe=ue++;T[H][pe]=p.zeros1d(S);for(var X=0,fe=_+1;X<fe;){var Pe=X++;p.addMulMutate(T[H][pe],z[pe][Pe],U[Pe])}}}return T},N.surfacePoint=function(r,s,a){var l=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return N.surfacePointGivenNM(l,c,r,s,a)},N.surfacePointGivenNM=function(r,s,a,l,c){var d=a.degreeU,m=a.degreeV,_=a.controlPoints,y=a.knotsU,A=a.knotsV;if(!N.areValidRelations(d,_.length,y.length)||!N.areValidRelations(m,_[0].length,A.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var I=_[0][0].length,S=N.knotSpanGivenN(r,d,l,y),P=N.knotSpanGivenN(s,m,c,A),k=N.basisFunctionsGivenKnotSpanIndex(S,l,d,y),T=N.basisFunctionsGivenKnotSpanIndex(P,c,m,A),O=S-d,C=P,R=p.zeros1d(I),z=p.zeros1d(I),U=0,V=m+1;U<V;){var q=U++;z=p.zeros1d(I),C=P-m+q;for(var J=0,H=d+1;J<H;){var G=J++;p.addMulMutate(z,k[G],_[O+G][C])}p.addMulMutate(R,T[q],z)}return R},N.curveRegularSamplePoints=function(r,s){for(var a=N.curveDerivatives(r,r.knots[0],r.degree),l=1/s,c=l*l,d=a[0],m=p.mul(l,a[1]),_=p.mul(c*.5,a[2]),y=p.mul(c*l*.5,a[3]),A=p.add(_,_),I=p.add(y,y),S=p.mul(.3333333333333333,y),P=[],k=0,T=s+1;k<T;)k++,P.push(N.dehomogenize(d)),p.addAllMutate([d,m,_,S]),p.addAllMutate([m,A,y]),p.addAllMutate([A,I]),p.addAllMutate([_,y]);return P},N.curveRegularSamplePoints2=function(r,s){for(var a=N.curveDerivatives(r,r.knots[0],r.degree),l=1/s,c=l*l,d=a[0],m=p.mul(l,a[1]),_=p.mul(c*.5,a[2]),y=p.mul(c*l*.5,a[3]),A=p.add(_,_),I=p.add(y,y),S=p.mul(.3333333333333333,y),P=[],k=0,T=s+1;k<T;)k++,P.push(N.dehomogenize(d)),p.addAllMutate([d,m,_,S]),p.addAllMutate([m,A,y]),p.addAllMutate([A,I]),p.addAllMutate([_,y]);return P},N.rationalSurfaceRegularSampleDerivatives=function(r,s,a,l){for(var c=N.surfaceRegularSampleDerivatives(r,s,a,l),d=[],m=s+1,_=a+1,y=l+1,A=0;A<m;){var I=A++,S=[];d.push(S);for(var P=0;P<_;){for(var k=P++,T=c[I][k],O=N.rational2d(T),C=N.weight2d(T),R=[],z=O[0][0].length,U=0;U<y;){var V=U++;R.push([]);for(var q=0,J=y-V;q<J;){for(var H=q++,G=O[V][H],K=1,ee=H+1;K<ee;){var te=K++;p.subMulMutate(G,De.get(H,te)*C[0][te],R[V][H-te])}for(var ie=1,he=V+1;ie<he;){var ae=ie++;p.subMulMutate(G,De.get(V,ae)*C[ae][0],R[V-ae][H]);for(var ue=p.zeros1d(z),ne=1,pe=H+1;ne<pe;){var X=ne++;p.addMulMutate(ue,De.get(H,X)*C[ae][X],R[V-ae][H-X])}p.subMulMutate(G,De.get(V,ae),ue)}p.mulMutate(1/C[0][0],G),R[V].push(G)}}S.push(R)}}return d},N.surfaceRegularSampleDerivatives=function(r,s,a,l){var c=r.degreeU,d=r.degreeV,m=r.controlPoints,_=r.knotsU,y=r.knotsV,A=m[0][0].length;($.last(_)-_[0])/s,($.last(y)-y[0])/a;for(var I=N.regularlySpacedDerivativeBasisFunctions(c,_,s),S=I.item0,P=I.item1,k=N.regularlySpacedDerivativeBasisFunctions(d,y,a),T=k.item0,O=k.item1,C=[],R=s+1,z=a+1,U=0;U<R;){var V=U++,q=[];C.push(q);for(var J=0;J<z;){var H=J++;q.push(N.surfaceDerivativesGivenBasesKnotSpans(c,d,m,S[V],T[H],P[V],O[H],A,l))}}return C},N.rationalSurfaceRegularSamplePoints=function(r,s,a){return N.dehomogenize2d(N.surfaceRegularSamplePoints(r,s,a))},N.surfaceRegularSamplePoints=function(r,s,a){var l=r.degreeU,c=r.degreeV,d=r.controlPoints,m=r.knotsU,_=r.knotsV,y=d[0][0].length;($.last(m)-m[0])/s,($.last(_)-_[0])/a;for(var A=N.regularlySpacedBasisFunctions(l,m,s),I=A.item0,S=A.item1,P=N.regularlySpacedBasisFunctions(c,_,a),k=P.item0,T=P.item1,O=[],C=s+1,R=a+1,z=0;z<C;){var U=z++,V=[];O.push(V);for(var q=0;q<R;){var J=q++;V.push(N.surfacePointGivenBasesKnotSpans(l,c,d,I[U],k[J],S[U],T[J],y))}}return O},N.regularlySpacedBasisFunctions=function(r,s,a){for(var l=s.length-r-2,c=($.last(s)-s[0])/a,d=[],m=[],_=s[0],y=N.knotSpanGivenN(l,r,_,s),A=a+1,I=0;I<A;){for(I++;_>=s[y+1];)y++;m.push(y),d.push(N.basisFunctionsGivenKnotSpanIndex(y,_,r,s)),_+=c}return new rt(m,d)},N.regularlySpacedDerivativeBasisFunctions=function(r,s,a){for(var l=s.length-r-2,c=($.last(s)-s[0])/a,d=[],m=[],_=s[0],y=N.knotSpanGivenN(l,r,_,s),A=a+1,I=0;I<A;){for(I++;_>=s[y+1];)y++;m.push(y),d.push(N.derivativeBasisFunctionsGivenNI(y,_,r,l,s)),_+=c}return new rt(m,d)},N.surfacePointGivenBasesKnotSpans=function(r,s,a,l,c,d,m,_){for(var y=p.zeros1d(_),A,I=l-r,S=c-s,P=0,k=s+1;P<k;){var T=P++;A=p.zeros1d(_);for(var O=0,C=r+1;O<C;){var R=O++;p.addMulMutate(A,d[R],a[I+R][S])}S++,p.addMulMutate(y,m[T],A)}return y},N.surfaceDerivativesGivenBasesKnotSpans=function(r,s,a,l,c,d,m,_,y){var A=a[0][0].length,I;y<r?I=y:I=r;var S;y<s?S=y:S=s;for(var P=p.zeros3d(I+1,S+1,A),k=p.zeros2d(s+1,A),T=0,O=0,C=I+1;O<C;){for(var R=O++,z=0,U=s+1;z<U;){var V=z++;k[V]=p.zeros1d(A);for(var q=0,J=r+1;q<J;){var H=q++;p.addMulMutate(k[V],d[R][H],a[l-r+H][c-s+V])}}var G=y-R;G<S?T=G:T=S;for(var K=0,ee=T+1;K<ee;){var te=K++;P[R][te]=p.zeros1d(A);for(var ie=0,he=s+1;ie<he;){var ae=ie++;p.addMulMutate(P[R][te],m[te][ae],k[ae])}}}return P},N.curveDerivatives=function(r,s,a){var l=r.knots.length-r.degree-2;return N.curveDerivativesGivenN(l,r,s,a)},N.curveDerivativesGivenN=function(r,s,a,l){var c=s.degree,d=s.controlPoints,m=s.knots;if(!N.areValidRelations(c,d.length,m.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,y;l<c?y=l:y=c;for(var A=p.zeros2d(l+1,_),I=N.knotSpanGivenN(r,c,a,m),S=N.derivativeBasisFunctionsGivenNI(I,a,c,y,m),P=0,k=y+1;P<k;)for(var T=P++,O=0,C=c+1;O<C;){var R=O++;p.addMulMutate(A[T],S[T][R],d[I-c+R])}return A},N.curvePoint=function(r,s){var a=r.knots.length-r.degree-2;return N.curvePointGivenN(a,r,s)},N.areValidRelations=function(r,s,a){return s+r+1-a==0},N.curvePointGivenN=function(r,s,a){var l=s.degree,c=s.controlPoints,d=s.knots;if(!N.areValidRelations(l,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var m=N.knotSpanGivenN(r,l,a,d),_=N.basisFunctionsGivenKnotSpanIndex(m,a,l,d),y=p.zeros1d(c[0].length),A=0,I=l+1;A<I;){var S=A++;p.addMulMutate(y,_[S],c[m-l+S])}return y},N.volumePoint=function(r,s,a,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,m=r.knotsW.length-r.degreeW-2;return N.volumePointGivenNML(r,c,d,m,s,a,l)},N.volumePointGivenNML=function(r,s,a,l,c,d,m){if(!N.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!N.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!N.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,y=r.degreeU,A=r.degreeV,I=r.degreeW,S=r.knotsU,P=r.knotsV,k=r.knotsW,T=_[0][0][0].length,O=N.knotSpanGivenN(s,y,c,S),C=N.knotSpanGivenN(a,A,d,P),R=N.knotSpanGivenN(l,I,m,k),z=N.basisFunctionsGivenKnotSpanIndex(O,c,y,S),U=N.basisFunctionsGivenKnotSpanIndex(C,d,A,P),V=N.basisFunctionsGivenKnotSpanIndex(R,m,I,k),q=O-y,J=p.zeros1d(T),H=p.zeros1d(T),G=p.zeros1d(T),K=0,ee=I+1;K<ee;){var te=K++;G=p.zeros1d(T);for(var ie=R-I+te,he=0,ae=A+1;he<ae;){var ue=he++;H=p.zeros1d(T);for(var ne=C-A+ue,pe=0,X=y+1;pe<X;){var fe=pe++;p.addMulMutate(H,z[fe],_[q+fe][ne][ie])}p.addMulMutate(G,U[ue],H)}p.addMulMutate(J,V[te],G)}return J},N.derivativeBasisFunctions=function(r,s,a){var l=N.knotSpan(s,r,a),c=a.length-1,d=c-s-1;return N.derivativeBasisFunctionsGivenNI(l,r,s,d,a)},N.derivativeBasisFunctionsGivenNI=function(r,s,a,l,c){var d=p.zeros2d(a+1,a+1),m=p.zeros1d(a+1),_=p.zeros1d(a+1),y=0,A=0;d[0][0]=1;for(var I=1,S=a+1;I<S;){var P=I++;m[P]=s-c[r+1-P],_[P]=c[r+P]-s,y=0;for(var k=0;k<P;){var T=k++;d[P][T]=_[T+1]+m[P-T],A=d[T][P-1]/d[P][T],d[T][P]=y+_[T+1]*A,y=m[P-T]*A}d[P][P]=y}for(var O=p.zeros2d(l+1,a+1),C=p.zeros2d(2,a+1),R=0,z=1,U=0,V=0,q=0,J=0,H=0,G=0,K=a+1;G<K;){var ee=G++;O[0][ee]=d[ee][a]}for(var te=0,ie=a+1;te<ie;){var he=te++;R=0,z=1,C[0][0]=1;for(var ae=1,ue=l+1;ae<ue;){var ne=ae++;U=0,V=he-ne,q=a-ne,he>=ne&&(C[z][0]=C[R][0]/d[q+1][V],U=C[z][0]*d[V][q]),V>=-1?J=1:J=-V,he-1<=q?H=ne-1:H=a-he;for(var pe=J,X=H+1;pe<X;){var fe=pe++;C[z][fe]=(C[R][fe]-C[R][fe-1])/d[q+1][V+fe],U+=C[z][fe]*d[V+fe][q]}he<=q&&(C[z][ne]=-C[R][ne-1]/d[q+1][he],U+=C[z][ne]*d[he][q]),O[ne][he]=U;var Pe=R;R=z,z=Pe}}for(var We=a,Ke=1,Ue=l+1;Ke<Ue;){for(var $e=Ke++,Mt=0,Xt=a+1;Mt<Xt;){var bt=Mt++;O[$e][bt]*=We}We*=a-$e}return O},N.basisFunctions=function(r,s,a){var l=N.knotSpan(s,r,a);return N.basisFunctionsGivenKnotSpanIndex(l,r,s,a)},N.basisFunctionsGivenKnotSpanIndex=function(r,s,a,l){var c=p.zeros1d(a+1),d=p.zeros1d(a+1),m=p.zeros1d(a+1),_=0,y=0;c[0]=1;for(var A=1,I=a+1;A<I;){var S=A++;d[S]=s-l[r+1-S],m[S]=l[r+S]-s,_=0;for(var P=0;P<S;){var k=P++;y=c[k]/(m[k+1]+d[S-k]),c[k]=_+m[k+1]*y,_=d[S-k]*y}c[S]=_}return c},N.knotSpan=function(r,s,a){return N.knotSpanGivenN(a.length-r-2,r,s,a)},N.knotSpanGivenN=function(r,s,a,l){if(a>l[r+1]-re.EPSILON)return r;if(a<l[s]+re.EPSILON)return s;for(var c=s,d=r+1,m=Math.floor((c+d)/2);a<l[m]||a>=l[m+1];)a<l[m]?d=m:c=m,m=Math.floor((c+d)/2);return m},N.dehomogenize=function(r){for(var s=r.length,a=[],l=r[s-1],c=r.length-1,d=0;d<c;){var m=d++;a.push(r[m]/l)}return a},N.rational1d=function(r){var s=r[0].length-1;return r.map(function(a){return a.slice(0,s)})},N.rational2d=function(r){return r.map(N.rational1d)},N.weight1d=function(r){var s=r[0].length-1;return r.map(function(a){return a[s]})},N.weight2d=function(r){return r.map(N.weight1d)},N.dehomogenize1d=function(r){return r.map(N.dehomogenize)},N.dehomogenize2d=function(r){return r.map(N.dehomogenize1d)},N.homogenize1d=function(r,s){var a=r.length,l=r[0].length,c=[],d=0,m=[],_;s!=null?_=s:_=p.rep(r.length,1);for(var y=0;y<a;){var A=y++,I=[];m=r[A],d=_[A];for(var S=0;S<l;){var P=S++;I.push(m[P]*d)}I.push(d),c.push(I)}return c},N.homogenize2d=function(r,s){var a=r.length,l=[],c;if(s!=null)c=s;else{for(var d=[],m=0;m<a;)m++,d.push(p.rep(r[0].length,1));c=d}for(var _=0;_<a;){var y=_++;l.push(N.homogenize1d(r[y],c[y]))}return l};var le=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=le,le.__name__=["verb","eval","Intersect"],le.surfaces=function(r,s,a){var l=ze.rationalSurfaceAdaptive(r),c=ze.rationalSurfaceAdaptive(s),d=le.meshes(l,c),m=d.map(function(_){return _.map(function(y){return le.surfacesAtPointWithEstimate(r,s,y.uv0,y.uv1,a)})});return m.map(function(_){return ge.rationalInterpCurve(_.map(function(y){return y.point}),3)})},le.surfacesAtPointWithEstimate=function(r,s,a,l,c){var d,m,_,y,A,I,S,P,k,T,O,C,R,z=5,U=0;do{if(d=N.rationalSurfaceDerivatives(r,a[0],a[1],1),m=d[0][0],y=d[1][0],A=d[0][1],_=p.normalized(p.cross(y,A)),I=p.dot(_,m),S=N.rationalSurfaceDerivatives(s,l[0],l[1],1),P=S[0][0],T=S[1][0],O=S[0][1],k=p.normalized(p.cross(T,O)),C=p.dot(k,P),R=p.distSquared(m,P),R<c*c)break;var V=p.normalized(p.cross(_,k)),q=p.dot(V,m),J=le.threePlanes(_,I,k,C,V,q);if(J==null)throw new Q("panic!");var H=p.sub(J,m),G=p.sub(J,P),K=p.cross(y,_),ee=p.cross(A,_),te=p.cross(T,k),ie=p.cross(O,k),he=p.dot(ee,H)/p.dot(ee,y),ae=p.dot(K,H)/p.dot(K,A),ue=p.dot(ie,G)/p.dot(ie,T),ne=p.dot(te,G)/p.dot(te,O);a=p.add([he,ae],a),l=p.add([ue,ne],l),U++}while(U<z);return new Jn(a,l,m,R)},le.meshes=function(r,s,a,l){a==null&&(a=new lr(r)),l==null&&(l=new lr(s));var c=le.boundingBoxTrees(a,l,0),d=$.unique(c.map(function(m){return le.triangles(r,m.item0,s,m.item1)}).filter(function(m){return m!=null}).filter(function(m){return p.distSquared(m.min.point,m.max.point)>re.EPSILON}),function(m,_){var y=p.sub(m.min.uv0,_.min.uv0),A=p.dot(y,y),I=p.sub(m.max.uv0,_.max.uv0),S=p.dot(I,I),P=p.sub(m.min.uv0,_.max.uv0),k=p.dot(P,P),T=p.sub(m.max.uv0,_.min.uv0),O=p.dot(T,T);return A<re.EPSILON&&S<re.EPSILON||k<re.EPSILON&&O<re.EPSILON});return le.makeMeshIntersectionPolylines(d)},le.meshSlices=function(r,s,a,l){for(var c=new Dr(r),d=c.boundingBox(),m=d.min[0],_=d.min[1],y=d.max[0],A=d.max[1],I=p.span(s,a,l),S=[],P=0;P<I.length;){var k=I[P];++P;var T=[[m,_,k],[y,_,k],[y,A,k],[m,A,k]],O=[[0,0],[1,0],[1,1],[0,1]],C=[[0,1,2],[0,2,3]],R=new Kt(C,T,null,O);S.push(le.meshes(r,R,c))}return S},le.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var s=0;s<r.length;){var a=r[s];++s,a.max.opp=a.min,a.min.opp=a.max}for(var l=le.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var m=r[d];++d,c.push(m.min),c.push(m.max)}for(var _=0;_<c.length;){var y=c[_];if(++_,y.adj==null){var A=le.lookupAdjacentSegment(y,l,r.length);A!=null&&A.adj==null&&(y.adj=A,A.adj=y)}}var I=c.filter(function(z){return z.adj==null});I.length==0&&(I=c);for(var S=[],P=0,k=!1;I.length!=0;){var T=I.pop();if(!T.visited){for(var O=[],C=T;C!=null&&!(C.visited||(C.visited=!0,C.opp.visited=!0,O.push(C),P+=2,C=C.opp.adj,C==T)););O.length>0&&(O.push(O[O.length-1].opp),S.push(O))}if(I.length==0&&c.length>0&&(k||P<c.length)){k=!0;var R=c.pop();I.push(R)}}return S},le.kdTreeFromSegments=function(r){for(var s=[],a=0;a<r.length;){var l=r[a];++a,s.push(new Mn(l.min.point,l.min)),s.push(new Mn(l.max.point,l.max))}return new ts(s,p.distSquared)},le.lookupAdjacentSegment=function(r,s,a){var l=s.nearest(r.point,a,re.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return l.length==1?l[0]:null},le.curveAndSurface=function(r,s,a,l,c){a==null&&(a=.001),l!=null?l=l:l=new or(r),c!=null?c=c:c=new Rr(s);var d=le.boundingBoxTrees(l,c,a);return $.unique(d.map(function(m){var _=m.item0,y=m.item1,A=$.first(_.knots),I=$.last(_.knots),S=(A+I)/2,P=$.first(y.knotsU),k=$.last(y.knotsU),T=$.first(y.knotsV),O=$.last(y.knotsV),C=[(P+k)/2,(T+O)/2];return le.curveAndSurfaceWithEstimate(_,y,[S].concat(C),a)}).filter(function(m){return p.distSquared(m.curvePoint,m.surfacePoint)<a*a}),function(m,_){return Math.abs(m.u-_.u)<.5*a})},le.curveAndSurfaceWithEstimate=function(r,s,a,l){l==null&&(l=.001);var c=function(y){var A=N.rationalCurvePoint(r,y[0]),I=N.rationalSurfacePoint(s,y[1],y[2]),S=p.sub(A,I);return p.dot(S,S)},d=function(y){var A=N.rationalCurveDerivatives(r,y[0],1),I=N.rationalSurfaceDerivatives(s,y[1],y[2],1),S=p.sub(I[0][0],A[0]),P=p.mul(-1,A[1]),k=I[1][0],T=I[0][1];return[2*p.dot(P,S),2*p.dot(k,S),2*p.dot(T,S)]},m=$t.uncmin(c,a,l*l,d),_=m.solution;return new Zn(_[0],[_[1],_[2]],N.rationalCurvePoint(r,_[0]),N.rationalSurfacePoint(s,_[1],_[2]))},le.polylineAndMesh=function(r,s,a){for(var l=le.boundingBoxTrees(new hr(r),new lr(s),a),c=[],d=0;d<l.length;){var m=l[d];++d;var _=m.item0,y=m.item1,A=le.segmentWithTriangle(r.points[_],r.points[_+1],s.points,s.faces[y]);if(A!=null){var I=A.point,S=p.lerp(A.p,[r.params[_]],[r.params[_+1]])[0],P=nt.triangleUVFromPoint(s,y,I);c.push(new Qn(I,S,P,_,y))}}return c},le.boundingBoxTrees=function(r,s,a){a==null&&(a=1e-9);var l=[],c=[];l.push(r),c.push(s);for(var d=[];l.length>0;){var m=l.pop(),_=c.pop();if(!(m.empty()||_.empty())&&m.boundingBox().intersects(_.boundingBox(),a)){var y=m.indivisible(a),A=_.indivisible(a);if(y&&A){d.push(new rt(m.yield(),_.yield()));continue}else if(y&&!A){var I=_.split();l.push(m),c.push(I.item1),l.push(m),c.push(I.item0);continue}else if(!y&&A){var S=m.split();l.push(S.item1),c.push(_),l.push(S.item0),c.push(_);continue}var P=m.split(),k=_.split();l.push(P.item1),c.push(k.item1),l.push(P.item1),c.push(k.item0),l.push(P.item0),c.push(k.item1),l.push(P.item0),c.push(k.item0)}}return d},le.curves=function(r,s,a){var l=le.boundingBoxTrees(new or(r),new or(s),0);return $.unique(l.map(function(c){return le.curvesWithEstimate(r,s,$.first(c.item0.knots),$.first(c.item1.knots),a)}).filter(function(c){return p.distSquared(c.point0,c.point1)<a}),function(c,d){return Math.abs(c.u0-d.u0)<a*5})},le.curvesWithEstimate=function(r,s,a,l,c){var d=function(P){var k=N.rationalCurvePoint(r,P[0]),T=N.rationalCurvePoint(s,P[1]),O=p.sub(k,T);return p.dot(O,O)},m=function(P){var k=N.rationalCurveDerivatives(r,P[0],1),T=N.rationalCurveDerivatives(s,P[1],1),O=p.sub(k[0],T[0]),C=k[1],R=p.mul(-1,T[1]);return[2*p.dot(C,O),2*p.dot(R,O)]},_=$t.uncmin(d,[a,l],c*c,m),y=_.solution[0],A=_.solution[1],I=N.rationalCurvePoint(r,y),S=N.rationalCurvePoint(s,A);return new en(I,S,y,A)},le.triangles=function(r,s,a,l){var c=r.faces[s],d=a.faces[l],m=nt.getTriangleNorm(r.points,c),_=nt.getTriangleNorm(a.points,d),y=r.points[c[0]],A=a.points[d[0]],I=le.planes(y,m,A,_);if(I==null)return null;var S=le.clipRayInCoplanarTriangle(I,r,s);if(S==null)return null;var P=le.clipRayInCoplanarTriangle(I,a,l);if(P==null)return null;var k=le.mergeTriangleClipIntervals(S,P,r,s,a,l);return k==null?null:new kt(new zr(k.min.uv0,k.min.uv1,k.min.point,s,l),new zr(k.max.uv0,k.max.uv1,k.max.point,s,l))},le.clipRayInCoplanarTriangle=function(r,s,a){for(var l=s.faces[a],c=[s.points[l[0]],s.points[l[1]],s.points[l[2]]],d=[s.uvs[l[0]],s.uvs[l[1]],s.uvs[l[2]]],m=[p.sub(d[1],d[0]),p.sub(d[2],d[1]),p.sub(d[0],d[2])],_=[p.sub(c[1],c[0]),p.sub(c[2],c[1]),p.sub(c[0],c[2])],y=_.map(p.normalized),A=_.map(p.norm),I=null,S=null,P=0;P<3;){var k=P++,T=c[k],O=y[k],C=le.rays(T,O,r.origin,r.dir);if(C!=null){var R=C.u0,z=C.u1;R<-re.EPSILON||R>A[k]+re.EPSILON||((I==null||z<I.u)&&(I=new kn(z,p.onRay(r.origin,r.dir,z),p.onRay(d[k],m[k],R/A[k]))),(S==null||z>S.u)&&(S=new kn(z,p.onRay(r.origin,r.dir,z),p.onRay(d[k],m[k],R/A[k]))))}}return S==null||I==null?null:new kt(I,S)},le.mergeTriangleClipIntervals=function(r,s,a,l,c,d){if(s.min.u>r.max.u+re.EPSILON||r.min.u>s.max.u+re.EPSILON)return null;var m;r.min.u>s.min.u?m=new rt(r.min,0):m=new rt(s.min,1);var _;r.max.u<s.max.u?_=new rt(r.max,0):_=new rt(s.max,1);var y=new kt(new zr(null,null,m.item0.point,l,d),new zr(null,null,_.item0.point,l,d));return m.item1==0?(y.min.uv0=m.item0.uv,y.min.uv1=nt.triangleUVFromPoint(c,d,m.item0.point)):(y.min.uv0=nt.triangleUVFromPoint(a,l,m.item0.point),y.min.uv1=m.item0.uv),_.item1==0?(y.max.uv0=_.item0.uv,y.max.uv1=nt.triangleUVFromPoint(c,d,_.item0.point)):(y.max.uv0=nt.triangleUVFromPoint(a,l,_.item0.point),y.max.uv1=_.item0.uv),y},le.planes=function(r,s,a,l){var c=p.cross(s,l);if(p.dot(c,c)<re.EPSILON)return null;var d=0,m=Math.abs(c[0]),_=Math.abs(c[1]),y=Math.abs(c[2]);_>m&&(d=1,m=_),y>m&&(d=2,m=y);var A,I,S,P;d==0?(A=s[1],I=s[2],S=l[1],P=l[2]):d==1?(A=s[0],I=s[2],S=l[0],P=l[2]):(A=s[0],I=s[1],S=l[0],P=l[1]);var k=-p.dot(r,s),T=-p.dot(a,l),O=A*P-I*S,C=(I*T-k*P)/O,R=(k*S-A*T)/O,z;return d==0?z=[0,C,R]:d==1?z=[C,0,R]:z=[C,R,0],new En(z,p.normalized(c))},le.threePlanes=function(r,s,a,l,c,d){var m=p.cross(a,c),_=p.dot(r,m);if(Math.abs(_)<re.EPSILON)return null;var y=p.sub(p.mul(d,a),p.mul(l,c)),A=p.add(p.mul(s,m),p.cross(r,y));return p.mul(1/_,A)},le.polylines=function(r,s,a){for(var l=le.boundingBoxTrees(new hr(r),new hr(s),a),c=[],d=0;d<l.length;){var m=l[d];++d;var _=m.item0,y=m.item1,A=le.segments(r.points[_],r.points[_+1],s.points[y],s.points[y+1],a);A!=null&&(A.u0=p.lerp(A.u0,[r.params[_]],[r.params[_+1]])[0],A.u1=p.lerp(A.u1,[s.params[y]],[s.params[y+1]])[0],c.push(A))}return c},le.segments=function(r,s,a,l,c){var d=p.sub(s,r),m=Math.sqrt(p.dot(d,d)),_=p.mul(1/m,d),y=p.sub(l,a),A=Math.sqrt(p.dot(y,y)),I=p.mul(1/A,y),S=le.rays(r,_,a,I);if(S!=null){var P=Math.min(Math.max(0,S.u0/m),1),k=Math.min(Math.max(0,S.u1/A),1),T=p.onRay(r,d,P),O=p.onRay(a,y,k),C=p.distSquared(T,O);if(C<c*c)return new en(T,O,P,k)}return null},le.rays=function(r,s,a,l){var c=p.dot(s,l),d=p.dot(s,a),m=p.dot(s,r),_=p.dot(l,a),y=p.dot(l,r),A=p.dot(s,s),I=p.dot(l,l),S=A*I-c*c;if(Math.abs(S)<re.EPSILON)return null;var P=c*(d-m)-A*(_-y),k=P/S,T=(d-m+k*c)/A,O=p.onRay(r,s,T),C=p.onRay(a,l,k);return new en(O,C,T,k)},le.segmentWithTriangle=function(r,s,a,l){var c=a[l[0]],d=a[l[1]],m=a[l[2]],_=p.sub(d,c),y=p.sub(m,c),A=p.cross(_,y),I=p.sub(s,r),S=p.sub(r,c),P=-p.dot(A,S),k=p.dot(A,I);if(Math.abs(k)<re.EPSILON)return null;var T=P/k;if(T<0||T>1)return null;var O=p.add(r,p.mul(T,I)),C=p.dot(_,y),R=p.dot(_,_),z=p.dot(y,y),U=p.sub(O,c),V=p.dot(U,_),q=p.dot(U,y),J=C*C-R*z;if(Math.abs(J)<re.EPSILON)return null;var H=(C*q-z*V)/J,G=(C*V-R*q)/J;return H>1+re.EPSILON||G>1+re.EPSILON||G<-re.EPSILON||H<-re.EPSILON||H+G>1+re.EPSILON?null:new es(O,H,G,T)},le.segmentAndPlane=function(r,s,a,l){var c=p.dot(l,p.sub(s,r));if(Math.abs(c)<re.EPSILON)return null;var d=p.dot(l,p.sub(a,r)),m=d/c;return m>1+re.EPSILON||m<-re.EPSILON?null:{p:m}};var ge=f.eval.Make=function(){};x["verb.eval.Make"]=ge,ge.__name__=["verb","eval","Make"],ge.rationalTranslationalSurface=function(r,s){for(var a=N.rationalCurvePoint(s,$.first(s.knots)),l=$.first(s.knots),c=$.last(s.knots),d=2*s.controlPoints.length,m=(c-l)/(d-1),_=[],y=0;y<d;){var A=y++,I=p.sub(N.rationalCurvePoint(s,l+A*m),a),S=_e.rationalCurveTransform(r,[[1,0,0,I[0]],[0,1,0,I[1]],[0,0,1,I[2]],[0,0,0,1]]);_.push(S)}return ge.loftedSurface(_)},ge.surfaceBoundaryCurves=function(r){var s=ge.surfaceIsocurve(r,$.first(r.knotsU),!1),a=ge.surfaceIsocurve(r,$.last(r.knotsU),!1),l=ge.surfaceIsocurve(r,$.first(r.knotsV),!0),c=ge.surfaceIsocurve(r,$.last(r.knotsV),!0);return[s,a,l,c]},ge.surfaceIsocurve=function(r,s,a){a==null&&(a=!1);var l;a?l=r.knotsV:l=r.knotsU;var c;a?c=r.degreeV:c=r.degreeU;for(var d=be.knotMultiplicities(l),m=-1,_=0,y=d.length;_<y;){var A=_++;if(Math.abs(s-d[A].knot)<re.EPSILON){m=A;break}}var I=c+1;m>=0&&(I=I-d[m].mult);var S;I>0?S=_e.surfaceKnotRefine(r,p.rep(I,s),a):S=r;var P=N.knotSpan(c,s,l);return Math.abs(s-$.first(l))<re.EPSILON?P=0:Math.abs(s-$.last(l))<re.EPSILON&&(P=(a?S.controlPoints[0].length:S.controlPoints.length)-1),a?new je(S.degreeU,S.knotsU,function(k){for(var T,O=[],C=0,R=S.controlPoints;C<R.length;){var z=R[C];++C,O.push(z[P])}return T=O,T}()):new je(S.degreeV,S.knotsV,S.controlPoints[P])},ge.loftedSurface=function(r,s){r=_e.unifyCurveKnotVectors(r);var a=r[0].degree;s==null&&(s=3),s>r.length-1&&(s=r.length-1);for(var l=r[0].knots,c=[],d=[],m=0,_=r[0].controlPoints.length;m<_;){var y=[m++],A=r.map(function(S){return function(P){return P.controlPoints[S[0]]}}(y)),I=ge.rationalInterpCurve(A,s,!0);d.push(I.controlPoints),c=I.knots}return new tt(a,s,l,c,d)},ge.clonedCurve=function(r){return new je(r.degree,r.knots.slice(),r.controlPoints.map(function(s){return s.slice()}))},ge.rationalBezierCurve=function(r,s){for(var a=r.length-1,l=[],c=0,d=a+1;c<d;)c++,l.push(0);for(var m=0,_=a+1;m<_;)m++,l.push(1);return s==null&&(s=p.rep(r.length,1)),new je(a,l,N.homogenize1d(r,s))},ge.fourPointSurface=function(r,s,a,l,c){c==null&&(c=3);for(var d=c,m=[],_=0,y=c+1;_<y;){for(var A=_++,I=[],S=0,P=c+1;S<P;){var k=S++,T=1-A/d,O=p.lerp(T,r,s),C=p.lerp(T,l,a),R=p.lerp(1-k/d,O,C);R.push(1),I.push(R)}m.push(I)}var z=p.rep(c+1,0),U=p.rep(c+1,1);return new tt(c,c,z.concat(U),z.concat(U),m)},ge.ellipseArc=function(r,s,a,l,c){var d=p.norm(s),m=p.norm(a);s=p.normalized(s),a=p.normalized(a),c<l&&(c=2*Math.PI+l);var _=c-l,y=0;_<=Math.PI/2?y=1:_<=Math.PI?y=2:_<=3*Math.PI/2?y=3:y=4;var A=_/y,I=Math.cos(A/2),S=p.add(r,p.add(p.mul(d*Math.cos(l),s),p.mul(m*Math.sin(l),a))),P=p.sub(p.mul(Math.cos(l),a),p.mul(Math.sin(l),s)),k=[],T=p.zeros1d(2*y+3),O=0,C=l,R=p.zeros1d(y*2);k[0]=S,R[0]=1;for(var z=1,U=y+1;z<U;){var V=z++;C+=A;var q=p.add(r,p.add(p.mul(d*Math.cos(C),s),p.mul(m*Math.sin(C),a)));R[O+2]=1,k[O+2]=q;var J=p.sub(p.mul(Math.cos(C),a),p.mul(Math.sin(C),s)),H=le.rays(S,p.mul(1/p.norm(P),P),q,p.mul(1/p.norm(J),J)),G=p.add(S,p.mul(H.u0,P));R[O+1]=I,k[O+1]=G,O+=2,V<y&&(S=q,P=J)}for(var K=2*y+1,ee=0;ee<3;){var te=ee++;T[te]=0,T[te+K]=1}switch(y){case 2:T[3]=T[4]=.5;break;case 3:T[3]=T[4]=.3333333333333333,T[5]=T[6]=.6666666666666666;break;case 4:T[3]=T[4]=.25,T[5]=T[6]=.5,T[7]=T[8]=.75;break}return new je(2,T,N.homogenize1d(k,R))},ge.arc=function(r,s,a,l,c,d){return ge.ellipseArc(r,p.mul(l,p.normalized(s)),p.mul(l,p.normalized(a)),c,d)},ge.polyline=function(r){for(var s=[0,0],a=0,l=0,c=r.length-1;l<c;){var d=l++;a+=p.dist(r[d],r[d+1]),s.push(a)}s.push(a),s=p.mul(1/a,s);for(var m,_=[],y=0,A=r.length;y<A;)y++,_.push(1);return m=_,new je(1,s,N.homogenize1d(r.slice(0),m))},ge.extrudedSurface=function(r,s,a){for(var l=[[],[],[]],c=[[],[],[]],d=N.dehomogenize1d(a.controlPoints),m=N.weight1d(a.controlPoints),_=p.mul(s,r),y=p.mul(.5*s,r),A=0,I=d.length;A<I;){var S=A++;l[2][S]=d[S],l[1][S]=p.add(y,d[S]),l[0][S]=p.add(_,d[S]),c[0][S]=m[S],c[1][S]=m[S],c[2][S]=m[S]}return new tt(2,a.degree,[0,0,0,1,1,1],a.knots,N.homogenize2d(l,c))},ge.cylindricalSurface=function(r,s,a,l,c){var d=p.cross(r,s),m=ge.arc(a,s,d,c,0,2*Math.PI);return ge.extrudedSurface(r,l,m)},ge.revolvedSurface=function(r,s,a,l){var c=N.dehomogenize1d(r.controlPoints),d=N.weight1d(r.controlPoints),m,_;l<=Math.PI/2?(m=1,_=p.zeros1d(6+2*(m-1))):l<=Math.PI?(m=2,_=p.zeros1d(6+2*(m-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(m=3,_=p.zeros1d(6+2*(m-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(m=4,_=p.zeros1d(6+2*(m-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var y=l/m,A=3+2*(m-1),I=0;I<3;){var S=I++;_[S]=0,_[A+S]=1}for(var P=Math.cos(y/2),k=0,T=p.zeros1d(m+1),O=p.zeros1d(m+1),C=p.zeros3d(2*m+1,c.length,3),R=p.zeros2d(2*m+1,c.length),z=1,U=m+1;z<U;){var V=z++;k+=y,O[V]=Math.cos(k),T[V]=Math.sin(k)}for(var q=0,J=c.length;q<J;){var H=q++,G=Ot.rayClosestPoint(c[H],s,a),K=p.sub(c[H],G),ee=p.norm(K),te=p.cross(a,K);ee>re.EPSILON&&(K=p.mul(1/ee,K),te=p.mul(1/ee,te)),C[0][H]=c[H];var ie=c[H];R[0][H]=d[H];for(var he=te,ae=0,ue=1,ne=m+1;ue<ne;){var pe=ue++,X;ee==0?X=G:X=p.add(G,p.add(p.mul(ee*O[pe],K),p.mul(ee*T[pe],te))),C[ae+2][H]=X,R[ae+2][H]=d[H];var fe=p.sub(p.mul(O[pe],te),p.mul(T[pe],K));if(ee==0)C[ae+1][H]=G;else{var Pe=le.rays(ie,p.mul(1/p.norm(he),he),X,p.mul(1/p.norm(fe),fe)),We=p.add(ie,p.mul(Pe.u0,he));C[ae+1][H]=We}R[ae+1][H]=P*d[H],ae+=2,pe<m&&(ie=X,he=fe)}}return new tt(2,r.degree,_,r.knots,N.homogenize2d(C,R))},ge.sphericalSurface=function(r,s,a,l){var c=ge.arc(r,p.mul(-1,s),a,l,0,Math.PI);return ge.revolvedSurface(c,r,s,2*Math.PI)},ge.conicalSurface=function(r,s,a,l,c){var d=2*Math.PI,m=1,_=[p.add(a,p.mul(l,r)),p.add(a,p.mul(c,s))],y=[0,0,1,1],A=[1,1],I=new je(m,y,N.homogenize1d(_,A));return ge.revolvedSurface(I,a,r,d)},ge.rationalInterpCurve=function(r,s,a,l,c){if(a==null&&(a=!1),s==null&&(s=3),r.length<s+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],m=1,_=r.length;m<_;){var y=m++,A=p.norm(p.sub(r[y],r[y-1])),I=d[d.length-1];d.push(I+A)}for(var S=d[d.length-1],P=0,k=d.length;P<k;){var T=P++;d[T]=d[T]/S}var O=p.rep(s+1,0),C=l!=null&&c!=null,R;C?R=0:R=1;var z;C?z=d.length-s+1:z=d.length-s;for(var U=R;U<z;){for(var V=U++,q=0,J=0;J<s;){var H=J++;q+=d[V+H]}O.push(1/s*q)}var G=O.concat(p.rep(s+1,1)),K=[],ee;C?ee=r.length+1:ee=r.length-1;var te;C?te=r.length-(s-1):te=r.length-(s+1);for(var ie=0;ie<d.length;){var he=d[ie];++ie;var ae=N.knotSpanGivenN(ee,s,he,G),ue=N.basisFunctionsGivenKnotSpanIndex(ae,he,s,G),ne=ae-s,pe=p.zeros1d(ne),X=p.zeros1d(te-ne);K.push(pe.concat(ue).concat(X))}if(C){var fe=K[0].length-2,Pe=[-1,1].concat(p.zeros1d(fe)),We=p.zeros1d(fe).concat([-1,1]);$.spliceAndInsert(K,1,0,Pe),$.spliceAndInsert(K,K.length-1,0,We)}for(var Ke=r[0].length,Ue=[],$e=(1-G[G.length-s-2])/s,Mt=G[s+1]/s,Xt=0;Xt<Ke;){var bt=[Xt++],_t;if(!C)_t=r.map(function(tr){return function(fr){return fr[tr[0]]}}(bt));else{_t=[r[0][bt[0]]],_t.push(Mt*l[bt[0]]);for(var Tt=1,zt=r.length-1;Tt<zt;){var Qt=Tt++;_t.push(r[Qt][bt[0]])}_t.push($e*c[bt[0]]),_t.push($.last(r)[bt[0]])}var cr=Oe.solve(K,_t);Ue.push(cr)}var Jt=Oe.transpose(Ue);if(!a){var er=p.rep(Jt.length,1);Jt=N.homogenize1d(Jt,er)}return new je(s,G,Jt)};var _e=f.eval.Modify=function(){};x["verb.eval.Modify"]=_e,_e.__name__=["verb","eval","Modify"],_e.curveReverse=function(r){return new je(r.degree,_e.knotsReverse(r.knots),$.reversed(r.controlPoints))},_e.surfaceReverse=function(r,s){return s==null&&(s=!1),s?new tt(r.degreeU,r.degreeV,r.knotsU,_e.knotsReverse(r.knotsV),function(a){for(var l,c=[],d=0,m=r.controlPoints;d<m.length;){var _=m[d];++d,c.push($.reversed(_))}return l=c,l}()):new tt(r.degreeU,r.degreeV,_e.knotsReverse(r.knotsU),r.knotsV,$.reversed(r.controlPoints))},_e.knotsReverse=function(r){var s=$.first(r);$.last(r);for(var a=[s],l=r.length,c=1;c<l;){var d=c++;a.push(a[d-1]+(r[l-d]-r[l-d-1]))}return a},_e.unifyCurveKnotVectors=function(r){r=r.map(ge.clonedCurve);for(var s=B.fold(r,function(G,K){return _e.imax(G.degree,K)},0),a=0,l=r.length;a<l;){var c=a++;r[c].degree<s&&(r[c]=_e.curveElevateDegree(r[c],s))}for(var d,m=[],_=0;_<r.length;){var y=r[_];++_,m.push(new kt($.first(y.knots),$.last(y.knots)))}d=m;for(var A=0,I=r.length;A<I;){var S=A++,P=[d[S].min];r[S].knots=r[S].knots.map(function(G){return function(K){return K-G[0]}}(P))}for(var k=d.map(function(G){return G.max-G.min}),T=B.fold(k,function(G,K){return Math.max(G,K)},0),O=0,C=r.length;O<C;){var R=O++,z=[T/k[R]];r[R].knots=r[R].knots.map(function(G){return function(K){return K*G[0]}}(z))}for(var U=B.fold(r,function(G,K){return p.sortedSetUnion(G.knots,K)},[]),V=0,q=r.length;V<q;){var J=V++,H=p.sortedSetSub(U,r[J].knots);H.length==0&&(r[J]=r[J]),r[J]=_e.curveKnotRefine(r[J],H)}return r},_e.imin=function(r,s){return r<s?r:s},_e.imax=function(r,s){return r>s?r:s},_e.curveElevateDegree=function(r,s){if(s<=r.degree)return r;var a=r.knots.length-r.degree-2,l=r.degree,c=r.knots,d=r.controlPoints,m=s-r.degree,_=r.controlPoints[0].length,y=p.zeros2d(l+m+1,l+1),A=[],I=[],S=[],P=a+l+1,k=s,T=Math.floor(k/2),O=[],C=[];y[0][0]=1,y[k][l]=1;for(var R=1,z=T+1;R<z;)for(var U=R++,V=1/De.get(k,U),q=_e.imin(l,U),J=_e.imax(0,U-m),H=q+1;J<H;){var G=J++;y[U][G]=V*De.get(l,G)*De.get(m,U-G)}for(var K=T+1;K<k;)for(var ee=K++,te=_e.imin(l,ee),ie=_e.imax(0,ee-m),he=te+1;ie<he;){var ae=ie++;y[ee][ae]=y[k-ee][l-ae]}var ue=k+1,ne=-1,pe=l,X=l+1,fe=1,Pe=c[0];O[0]=d[0];for(var We=0,Ke=k+1;We<Ke;){var Ue=We++;C[Ue]=Pe}for(var $e=0,Mt=l+1;$e<Mt;){var Xt=$e++;A[Xt]=d[Xt]}for(;X<P;){for(var bt=X;X<P&&c[X]==c[X+1];)X=X+1;var _t=X-bt+1,Tt=c[X],zt=ne;ne=l-_t;var Qt;zt>0?Qt=Math.floor((zt+2)/2):Qt=1;var cr;if(ne>0?cr=Math.floor(k-(ne+1)/2):cr=k,ne>0){for(var Jt=Tt-Pe,er=[],tr=l;tr>_t;)er[tr-_t-1]=Jt/(c[pe+tr]-Pe),tr--;for(var fr=1,zn=ne+1;fr<zn;){for(var rn=fr++,ou=ne-rn,ea=_t+rn,nn=l;nn>=ea;)A[nn]=p.add(p.mul(er[nn-ea],A[nn]),p.mul(1-er[nn-ea],A[nn-1])),nn--;S[ou]=A[l]}}for(var Go=Qt,lu=k+1;Go<lu;){var Rn=Go++;I[Rn]=p.zeros1d(_);for(var hu=_e.imin(l,Rn),jo=_e.imax(0,Rn-m),cu=hu+1;jo<cu;){var Wo=jo++;I[Rn]=p.add(I[Rn],p.mul(y[Rn][Wo],A[Wo]))}}if(zt>1)for(var ta=ue-2,ra=ue,Ho=Tt-Pe,uu=(Tt-C[ue-1])/Ho,Yo=1;Yo<zt;){for(var na=Yo++,_r=ta,sn=ra,Wr=sn-ue+1;sn-_r>na;){if(_r<fe){var du=(Tt-C[_r])/(Pe-C[_r]);O[_r]=p.lerp(du,O[_r],O[_r-1])}if(sn>=Qt){if(sn-na<=ue-k+zt){var pu=(Tt-C[sn-na])/Ho;I[Wr]=p.lerp(pu,I[Wr],I[Wr+1])}}else I[Wr]=p.lerp(uu,I[Wr],I[Wr+1]);_r=_r+1,sn=sn-1,Wr=Wr-1}ta=ta-1,ra=ra+1}if(pe!=l)for(var qo=0,mu=k-zt;qo<mu;)qo++,C[ue]=Pe,ue=ue+1;for(var Xo=Qt,gu=cr+1;Xo<gu;){var fu=Xo++;O[fe]=I[fu],fe=fe+1}if(X<P){for(var Ko=0;Ko<ne;){var $o=Ko++;A[$o]=S[$o]}for(var Zo=ne,_u=l+1;Zo<_u;){var Qo=Zo++;A[Qo]=d[X-l+Qo]}pe=X,X=X+1,Pe=Tt}else for(var Jo=0,yu=k+1;Jo<yu;){var vu=Jo++;C[ue+vu]=Tt}}return new je(s,C,O)},_e.rationalSurfaceTransform=function(r,s){for(var a=N.dehomogenize2d(r.controlPoints),l=0,c=a.length;l<c;)for(var d=l++,m=0,_=a[d].length;m<_;){var y=m++,A=a[d][y];A.push(1),a[d][y]=Oe.dot(s,A).slice(0,A.length-1)}return new tt(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),N.homogenize2d(a,N.weight2d(r.controlPoints)))},_e.rationalCurveTransform=function(r,s){for(var a=N.dehomogenize1d(r.controlPoints),l=0,c=a.length;l<c;){var d=l++,m=a[d];m.push(1),a[d]=Oe.dot(s,m).slice(0,m.length-1)}return new je(r.degree,r.knots.slice(),N.homogenize1d(a,N.weight1d(r.controlPoints)))},_e.surfaceKnotRefine=function(r,s,a){var l=[],c,d,m;a?(m=r.controlPoints,c=r.knotsV,d=r.degreeV):(m=Oe.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,y=0;y<m.length;){var A=m[y];++y,_=_e.curveKnotRefine(new je(d,c,A),s),l.push(_.controlPoints)}var I=_.knots;return a?new tt(r.degreeU,r.degreeV,r.knotsU.slice(),I,l):(l=Oe.transpose(l),new tt(r.degreeU,r.degreeV,I,r.knotsV.slice(),l))},_e.decomposeCurveIntoBeziers=function(r){for(var s=r.degree,a=r.controlPoints,l=r.knots,c=be.knotMultiplicities(l),d=s+1,m=0;m<c.length;){var _=c[m];if(++m,_.mult<d){var y=p.rep(d-_.mult,_.knot),A=_e.curveKnotRefine(new je(s,l,a),y);l=A.knots,a=A.controlPoints}}l.length/d-1;for(var I=d*2,S=[],P=0;P<a.length;){var k=l.slice(P,P+I),T=a.slice(P,P+d);S.push(new je(s,k,T)),P+=d}return S},_e.curveKnotRefine=function(r,s){if(s.length==0)return ge.clonedCurve(r);for(var a=r.degree,l=r.controlPoints,c=r.knots,d=l.length-1,m=d+a+1,_=s.length-1,y=N.knotSpan(a,s[0],c),A=N.knotSpan(a,s[_],c),I=[],S=[],P=0,k=y-a+1;P<k;){var T=P++;I[T]=l[T]}for(var O=A-1,C=d+1;O<C;){var R=O++;I[R+_+1]=l[R]}for(var z=0,U=y+1;z<U;){var V=z++;S[V]=c[V]}for(var q=A+a,J=m+1;q<J;){var H=q++;S[H+_+1]=c[H]}for(var G=A+a-1,K=A+a+_,ee=_;ee>=0;){for(;s[ee]<=c[G]&&G>y;)I[K-a-1]=l[G-a-1],S[K]=c[G],K=K-1,G=G-1;I[K-a-1]=I[K-a];for(var te=1,ie=a+1;te<ie;){var he=te++,ae=K-a+he,ue=S[K+he]-s[ee];Math.abs(ue)<re.EPSILON?I[ae-1]=I[ae]:(ue=ue/(S[K+he]-c[G-a+he]),I[ae-1]=p.add(p.mul(ue,I[ae-1]),p.mul(1-ue,I[ae])))}S[K]=s[ee],K=K-1,ee--}return new je(a,S,I)},_e.curveKnotInsert=function(r,s,a){for(var l=r.degree,c=r.controlPoints,d=r.knots,m=0,_=c.length,y=N.knotSpan(l,s,d),A=[],I=[],S=[],P=1,k=y+1;P<k;){var T=P++;I[T]=d[T]}for(var O=1,C=a+1;O<C;){var R=O++;I[y+R]=s}for(var z=y+1,U=d.length;z<U;){var V=z++;I[V+a]=d[V]}for(var q=0,J=y-l+1;q<J;){var H=q++;S[H]=c[H]}for(var G=y-m;G<_;){var K=G++;S[K+a]=c[K]}for(var ee=0,te=l-m+1;ee<te;){var ie=ee++;A[ie]=c[y-l+ie]}for(var he=0,ae=0,ue=1,ne=a+1;ue<ne;){var pe=ue++;he=y-l+pe;for(var X=0,fe=l-pe-m+1;X<fe;){var Pe=X++;ae=(s-d[he+Pe])/(d[Pe+y+1]-d[he+Pe]),A[Pe]=p.add(p.mul(ae,A[Pe+1]),p.mul(1-ae,A[Pe]))}S[he]=A[0],S[y+a-pe-m]=A[l-pe-m]}for(var We=he+1,Ke=y-m;We<Ke;){var Ue=We++;S[Ue]=A[Ue-he]}return new je(l,I,S)};var ze=f.eval.Tess=function(){};x["verb.eval.Tess"]=ze,ze.__name__=["verb","eval","Tess"],ze.rationalCurveRegularSample=function(r,s,a){return ze.rationalCurveRegularSampleRange(r,r.knots[0],$.last(r.knots),s,a)},ze.rationalCurveRegularSampleRange=function(r,s,a,l,c){l<1&&(l=2);for(var d=[],m=(a-s)/(l-1),_=0,y=0;y<l;){var A=y++;_=s+m*A,c?d.push([_].concat(N.rationalCurvePoint(r,_))):d.push(N.rationalCurvePoint(r,_))}return d},ze.rationalCurveAdaptiveSample=function(r,s,a){if(a==null&&(a=!1),s==null&&(s=1e-6),r.degree==1)if(a){for(var l=[],c=0,d=r.controlPoints.length;c<d;){var m=c++;l.push([r.knots[m+1]].concat(N.dehomogenize(r.controlPoints[m])))}return l}else return r.controlPoints.map(N.dehomogenize);return ze.rationalCurveAdaptiveSampleRange(r,r.knots[0],$.last(r.knots),s,a)},ze.rationalCurveAdaptiveSampleRange=function(r,s,a,l,c){var d=N.rationalCurvePoint(r,s),m=N.rationalCurvePoint(r,a),_=.5+.2*Math.random(),y=s+(a-s)*_,A=N.rationalCurvePoint(r,y),I=p.sub(d,m),S=p.sub(d,A);if(p.dot(I,I)<l&&p.dot(S,S)>l||!Ot.threePointsAreFlat(d,A,m,l)){var P=s+(a-s)*.5,k=ze.rationalCurveAdaptiveSampleRange(r,s,P,l,c),T=ze.rationalCurveAdaptiveSampleRange(r,P,a,l,c);return k.slice(0,-1).concat(T)}else return c?[[s].concat(d),[a].concat(m)]:[d,m]},ze.rationalSurfaceNaive=function(r,s,a){s<1&&(s=1),a<1&&(a=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,c=r.knotsV,d=$.last(l)-l[0],m=$.last(c)-c[0],_=d/s,y=m/a,A=[],I=[],S=[],P=0,k=s+1;P<k;)for(var T=P++,O=0,C=a+1;O<C;){var R=O++,z=T*_,U=R*y;I.push([z,U]);var V=N.rationalSurfaceDerivatives(r,z,U,1),q=V[0][0];A.push(q);var J=p.normalized(p.cross(V[1][0],V[0][1]));S.push(J)}for(var H=[],G=0;G<s;)for(var K=G++,ee=0;ee<a;){var te=ee++,ie=K*(a+1)+te,he=(K+1)*(a+1)+te,ae=he+1,ue=ie+1,ne=[ie,he,ae],pe=[ie,ae,ue];H.push(ne),H.push(pe)}return new Kt(H,A,S,I)},ze.divideRationalSurfaceAdaptive=function(r,s){s==null&&(s=new Fr),s.minDivsU!=null?s.minDivsU=s.minDivsU:s.minDivsU=1,s.minDivsV!=null?s.minDivsU=s.minDivsV:s.minDivsU=1,s.refine!=null?s.refine=s.refine:s.refine=!0;var a=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,c;s.minDivsU>a?c=s.minDivsU=s.minDivsU:c=s.minDivsU=a;var d;s.minDivsV>l?d=s.minDivsV=s.minDivsV:d=s.minDivsV=l;for(var m=$.last(r.knotsU),_=r.knotsU[0],y=$.last(r.knotsV),A=r.knotsV[0],I=(m-_)/c,S=(y-A)/d,P=[],k=[],T=0,O=d+1;T<O;){for(var C=T++,R=[],z=0,U=c+1;z<U;){var V=z++,q=_+I*V,J=A+S*C,H=N.rationalSurfaceDerivatives(r,q,J,1),G=p.normalized(p.cross(H[0][1],H[1][0]));R.push(new Yt(H[0][0],G,[q,J],-1,p.isZero(G)))}k.push(R)}for(var K=0;K<d;)for(var ee=K++,te=0;te<c;){var ie=te++,he=[k[d-ee-1][ie],k[d-ee-1][ie+1],k[d-ee][ie+1],k[d-ee][ie]];P.push(new gr(r,he))}if(!s.refine)return P;for(var ae=0;ae<d;)for(var ue=ae++,ne=0;ne<c;){var pe=ne++,X=ue*c+pe,fe=ze.north(X,ue,pe,c,d,P),Pe=ze.east(X,ue,pe,c,d,P),We=ze.south(X,ue,pe,c,d,P),Ke=ze.west(X,ue,pe,c,d,P);P[X].neighbors=[We,Pe,fe,Ke],P[X].divide(s)}return P},ze.north=function(r,s,a,l,c,d){return s==0?null:d[r-l]},ze.south=function(r,s,a,l,c,d){return s==c-1?null:d[r+l]},ze.east=function(r,s,a,l,c,d){return a==l-1?null:d[r+1]},ze.west=function(r,s,a,l,c,d){return a==0?null:d[r-1]},ze.triangulateAdaptiveRefinementNodeTree=function(r){for(var s=Kt.empty(),a=0;a<r.length;){var l=r[a];++a,l.triangulate(s)}return s},ze.rationalSurfaceAdaptive=function(r,s){s!=null?s=s:s=new Fr;var a=ze.divideRationalSurfaceAdaptive(r,s);return ze.triangulateAdaptiveRefinementNodeTree(a)};var Fr=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=Fr,Fr.__name__=["verb","eval","AdaptiveRefinementOptions"],Fr.prototype={__class__:Fr};var gr=f.core.AdaptiveRefinementNode=function(r,s,a){if(this.srf=r,a==null?this.neighbors=[null,null,null,null]:this.neighbors=a,this.corners=s,this.corners==null){var l=r.knotsU[0],c=$.last(r.knotsU),d=r.knotsV[0],m=$.last(r.knotsV);this.corners=[Yt.fromUv(l,d),Yt.fromUv(c,d),Yt.fromUv(c,m),Yt.fromUv(l,m)]}};x["verb.eval.AdaptiveRefinementNode"]=gr,gr.__name__=["verb","eval","AdaptiveRefinementNode"],gr.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var s=r++;if(this.corners[s].point==null){var a=this.corners[s];this.evalSrf(a.uv[0],a.uv[1],a)}}},evalSrf:function(r,s,a){var l=N.rationalSurfaceDerivatives(this.srf,r,s,1),c=l[0][0],d=p.cross(l[0][1],l[1][0]),m=p.isZero(d);return m||(d=p.normalized(d)),a!=null?(a.degen=m,a.point=c,a.normal=d,a):new Yt(c,d,[r,s],-1,m)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var s=[this.corners[r]];if(this.neighbors[r]==null)return s;var a=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,c=re.EPSILON,d=this,m=[function(y){return y.uv[0]>d.corners[0].uv[0]+c&&y.uv[0]<d.corners[2].uv[0]-c},function(y){return y.uv[1]>d.corners[0].uv[1]+c&&y.uv[1]<d.corners[2].uv[1]-c}],_=a.filter(m[l]);return _.reverse(),s.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,s=0;s<r;){var a=s++;if(this.corners[a],this.corners[a].degen){var l=this.corners[(a+1)%r],c=this.corners[(a+3)%r];l.degen?this.corners[a].normal=c.normal:this.corners[a].normal=l.normal}}},shouldDivide:function(r,s){if(s<r.minDepth)return!0;if(s>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=p.normSquared(p.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||p.normSquared(p.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=p.normSquared(p.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||p.normSquared(p.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var a=this.center();return p.normSquared(p.sub(a.normal,this.corners[0].normal))>r.normTol||p.normSquared(p.sub(a.normal,this.corners[1].normal))>r.normTol||p.normSquared(p.sub(a.normal,this.corners[2].normal))>r.normTol||p.normSquared(p.sub(a.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new Fr),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,s,a){if(this.evalCorners(),!!this.shouldDivide(r,s)){if(s++,this.splitVert&&!this.splitHoriz?a=!1:!this.splitVert&&this.splitHoriz&&(a=!0),this.horizontal=a,this.horizontal){var l=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],c=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new gr(this.srf,l),new gr(this.srf,c)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],m=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new gr(this.srf,d),new gr(this.srf,m)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,y=this.children;_<y.length;){var A=y[_];++_,A._divide(r,s,!a)}}},triangulate:function(r){if(r==null&&(r=Kt.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var s=0,a=this.children;s<a.length;){var l=a[s];if(++s,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var s=r.points.length,a=[],l=[],c=0,d=0;d<4;){var m=d++,_=this.getAllCorners(m);_.length==2&&(c=m+1);for(var y=0,A=_.length;y<A;){var I=y++;a.push(_[I])}}for(var S=0;S<a.length;){var P=a[S];if(++S,P.id!=-1){l.push(P.id);continue}r.uvs.push(P.uv),r.points.push(P.point),r.normals.push(P.normal),P.id=s,l.push(s),s++}if(a.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(a.length==5){var k=l.length;return r.faces.push([l[c],l[(c+2)%k],l[(c+1)%k]]),r.faces.push([l[(c+4)%k],l[(c+3)%k],l[c]]),r.faces.push([l[c],l[(c+3)%k],l[(c+2)%k]]),r}var T=this.center();r.uvs.push(T.uv),r.points.push(T.point),r.normals.push(T.normal);for(var O=r.points.length-1,C=0,R=a.length-1;C<a.length;)r.faces.push([O,l[C],l[R]]),R=C++;return r},__class__:gr};var Ae=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=Ae,Ae.__name__=["verb","exe","Dispatcher"],Ae.init=function(){Ae._init||(Ae._workerPool=new Ur(Ae.THREADS),Ae._init=!0)},Ae.dispatchMethod=function(r,s,a){Ae.init();var l=new In,c=function(d){l.resolve(d)};return Ae._workerPool.addWork(ce.getClassName(r),s,a,c),new ft(l)};var Ur=f.exe.WorkerPool=function(r,s){s==null&&(s="verb.js"),r==null&&(r=1),this._callbacks=new we,this._working=new we,this._pool=[],this._queue=[];for(var a=0;a<r;){a++;var l;try{l=new Worker(Ur.basePath+s)}catch(c){c instanceof Q&&(c=c.val),l=new Worker(Ur.basePath+s.substring(0,-3)+".min.js")}this._pool.push(l)}};x["verb.exe.WorkerPool"]=Ur,Ur.__name__=["verb","exe","WorkerPool"],Ur.prototype={addWork:function(r,s,a,l){var c=new tn(r,s,a);this._callbacks.set(c.id,l),this._queue.push(c),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var s=this._queue.shift(),a=[s.id],l=[this._pool.shift()];this._working.h[a[0]]=l[0],l[0].onmessage=function(c,d){return function(m){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](m.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(l,a),l[0].postMessage(s)}},__class__:Ur};var tn=function(r,s,a){this.className=r,this.methodName=s,this.args=a,this.id=tn.uuid++};x["verb.exe._WorkerPool.Work"]=tn,tn.__name__=["verb","exe","_WorkerPool","Work"],tn.prototype={__class__:tn};var On=function(){};x["verb.geom.ICurve"]=On,On.__name__=["verb","geom","ICurve"],On.__interfaces__=[Nn],On.prototype={__class__:On};var Le=f.geom.NurbsCurve=function(r){this._data=qt.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=Le,Le.__name__=["verb","geom","NurbsCurve"],Le.__interfaces__=[On],Le.byKnotsControlPointsWeights=function(r,s,a,l){return new Le(new je(r,s.slice(),N.homogenize1d(a,l)))},Le.byPoints=function(r,s){return s==null&&(s=3),new Le(ge.rationalInterpCurve(r,s))},Le.__super__=Qe,Le.prototype=M(Qe.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return N.dehomogenize1d(this._data.controlPoints)},weights:function(){return N.weight1d(this._data.controlPoints)},asNurbs:function(){return new je(this.degree(),this.knots(),N.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Le(this._data)},domain:function(){return new kt($.first(this._data.knots),$.last(this._data.knots))},transform:function(r){return new Le(_e.rationalCurveTransform(this._data,r))},transformAsync:function(r){return Ae.dispatchMethod(_e,"rationalCurveTransform",[this._data,r]).then(function(s){return new Le(s)})},point:function(r){return N.rationalCurvePoint(this._data,r)},pointAsync:function(r){return Ae.dispatchMethod(N,"rationalCurvePoint",[this._data,r])},tangent:function(r){return N.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return Ae.dispatchMethod(N,"rationalCurveTangent",[this._data,r])},derivatives:function(r,s){return s==null&&(s=1),N.rationalCurveDerivatives(this._data,r,s)},derivativesAsync:function(r,s){return s==null&&(s=1),Ae.dispatchMethod(N,"rationalCurveDerivatives",[this._data,r,s])},closestPoint:function(r){return be.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return Ae.dispatchMethod(be,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return be.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return Ae.dispatchMethod(be,"rationalCurveClosestParam",[this._data,r])},length:function(){return be.rationalCurveArcLength(this._data)},lengthAsync:function(){return Ae.dispatchMethod(be,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return be.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return Ae.dispatchMethod(be,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,s){return be.rationalCurveParamAtArcLength(this._data,r,s)},paramAtLengthAsync:function(r,s){return Ae.dispatchMethod(be,"rationalCurveParamAtArcLength",[this._data,r,s])},divideByEqualArcLength:function(r){return ht.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return Ae.dispatchMethod(ht,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return ht.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return Ae.dispatchMethod(ht,"rationalCurveByArcLength",[this._data,r])},split:function(r){return ht.curveSplit(this._data,r).map(function(s){return new Le(s)})},splitAsync:function(r){return Ae.dispatchMethod(ht,"curveSplit",[this._data,r]).then(function(s){return s.map(function(a){return new Le(a)})})},reverse:function(){return new Le(_e.curveReverse(this._data))},reverseAsync:function(){return Ae.dispatchMethod(_e,"curveReverse",[this._data]).then(function(r){return new Le(r)})},tessellate:function(r){return ze.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return Ae.dispatchMethod(ze,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:Le});var Vr=f.geom.Arc=function(r,s,a,l,c,d){Le.call(this,ge.arc(r,s,a,l,c,d)),this._center=r,this._xaxis=s,this._yaxis=a,this._radius=l,this._minAngle=c,this._maxAngle=d};x["verb.geom.Arc"]=Vr,Vr.__name__=["verb","geom","Arc"],Vr.__super__=Le,Vr.prototype=M(Le.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Vr});var is=f.geom.BezierCurve=function(r,s){Le.call(this,ge.rationalBezierCurve(r,s))};x["verb.geom.BezierCurve"]=is,is.__name__=["verb","geom","BezierCurve"],is.__super__=Le,is.prototype=M(Le.prototype,{__class__:is});var as=f.geom.Circle=function(r,s,a,l){Vr.call(this,r,s,a,l,0,Math.PI*2)};x["verb.geom.Circle"]=as,as.__name__=["verb","geom","Circle"],as.__super__=Vr,as.prototype=M(Vr.prototype,{__class__:as});var Bn=function(){};x["verb.geom.ISurface"]=Bn,Bn.__name__=["verb","geom","ISurface"],Bn.__interfaces__=[Nn],Bn.prototype={__class__:Bn};var Ee=f.geom.NurbsSurface=function(r){this._data=qt.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Ee,Ee.__name__=["verb","geom","NurbsSurface"],Ee.__interfaces__=[Bn],Ee.byKnotsControlPointsWeights=function(r,s,a,l,c,d){return new Ee(new tt(r,s,a,l,N.homogenize2d(c,d)))},Ee.byCorners=function(r,s,a,l){return new Ee(ge.fourPointSurface(r,s,a,l))},Ee.byLoftingCurves=function(r,s){return new Ee(ge.loftedSurface(function(a){for(var l,c=[],d=0;d<r.length;){var m=r[d];++d,c.push(m.asNurbs())}return l=c,l}(),s))},Ee.__super__=Qe,Ee.prototype=M(Qe.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return N.dehomogenize2d(this._data.controlPoints)},weights:function(){return N.weight2d(this._data.controlPoints)},asNurbs:function(){return new tt(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),N.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Ee(this.asNurbs())},domainU:function(){return new kt($.first(this._data.knotsU),$.last(this._data.knotsU))},domainV:function(){return new kt($.first(this._data.knotsV),$.last(this._data.knotsV))},point:function(r,s){return N.rationalSurfacePoint(this._data,r,s)},pointAsync:function(r,s){return Ae.dispatchMethod(N,"rationalSurfacePoint",[this._data,r,s])},normal:function(r,s){return N.rationalSurfaceNormal(this._data,r,s)},normalAsync:function(r,s){return Ae.dispatchMethod(N,"rationalSurfaceNormal",[this._data,r,s])},derivatives:function(r,s,a){return a==null&&(a=1),N.rationalSurfaceDerivatives(this._data,r,s,a)},derivativesAsync:function(r,s,a){return a==null&&(a=1),Ae.dispatchMethod(N,"rationalSurfaceDerivatives",[this._data,r,s,a])},closestParam:function(r){return be.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return Ae.dispatchMethod(be,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return be.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return Ae.dispatchMethod(be,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,s){return s==null&&(s=!1),ht.surfaceSplit(this._data,r,s).map(function(a){return new Ee(a)})},splitAsync:function(r,s){return s==null&&(s=!1),Ae.dispatchMethod(ht,"surfaceSplit",[this._data,r,s]).then(function(a){return a.map(function(l){return new Ee(l)})})},reverse:function(r){return r==null&&(r=!1),new Ee(_e.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),Ae.dispatchMethod(_e,"surfaceReverse",[this._data,r]).then(function(s){return new Ee(s)})},isocurve:function(r,s){return s==null&&(s=!1),new Le(ge.surfaceIsocurve(this._data,r,s))},isocurveAsync:function(r,s){return s==null&&(s=!1),Ae.dispatchMethod(ge,"surfaceIsocurve",[this._data,r,s]).then(function(a){return new Le(a)})},boundaries:function(r){return ge.surfaceBoundaryCurves(this._data).map(function(s){return new Le(s)})},boundariesAsync:function(r){return Ae.dispatchMethod(ge,"surfaceBoundaryCurves",[this._data]).then(function(s){return s.map(function(a){return new Le(a)})})},tessellate:function(r){return ze.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return Ae.dispatchMethod(ze,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Ee(_e.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return Ae.dispatchMethod(_e,"rationalSurfaceTransform",[this._data,r]).then(function(s){return new Ee(s)})},__class__:Ee});var os=f.geom.ConicalSurface=function(r,s,a,l,c){Ee.call(this,ge.conicalSurface(r,s,a,l,c)),this._axis=r,this._xaxis=s,this._base=a,this._height=l,this._radius=c};x["verb.geom.ConicalSurface"]=os,os.__name__=["verb","geom","ConicalSurface"],os.__super__=Ee,os.prototype=M(Ee.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:os});var ls=f.geom.CylindricalSurface=function(r,s,a,l,c){Ee.call(this,ge.cylindricalSurface(r,s,a,l,c)),this._axis=r,this._xaxis=s,this._base=a,this._height=l,this._radius=c};x["verb.geom.CylindricalSurface"]=ls,ls.__name__=["verb","geom","CylindricalSurface"],ls.__super__=Ee,ls.prototype=M(Ee.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:ls});var Gr=f.geom.EllipseArc=function(r,s,a,l,c){Le.call(this,ge.ellipseArc(r,s,a,l,c)),this._center=r,this._xaxis=s,this._yaxis=a,this._minAngle=l,this._maxAngle=c};x["verb.geom.EllipseArc"]=Gr,Gr.__name__=["verb","geom","EllipseArc"],Gr.__super__=Le,Gr.prototype=M(Le.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Gr});var hs=f.geom.Ellipse=function(r,s,a){Gr.call(this,r,s,a,0,Math.PI*2)};x["verb.geom.Ellipse"]=hs,hs.__name__=["verb","geom","Ellipse"],hs.__super__=Gr,hs.prototype=M(Gr.prototype,{__class__:hs});var cs=f.geom.ExtrudedSurface=function(r,s){Ee.call(this,ge.extrudedSurface(p.normalized(s),p.norm(s),r.asNurbs())),this._profile=r,this._direction=s};x["verb.geom.ExtrudedSurface"]=cs,cs.__name__=["verb","geom","ExtrudedSurface"],cs.__super__=Ee,cs.prototype=M(Ee.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:cs});var jr=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=jr,jr.__name__=["verb","geom","Intersect"],jr.curves=function(r,s,a){return a==null&&(a=.001),le.curves(r.asNurbs(),s.asNurbs(),a)},jr.curvesAsync=function(r,s,a){return a==null&&(a=.001),Ae.dispatchMethod(le,"curves",[r.asNurbs(),s.asNurbs(),a])},jr.curveAndSurface=function(r,s,a){return a==null&&(a=.001),le.curveAndSurface(r.asNurbs(),s.asNurbs(),a)},jr.curveAndSurfaceAsync=function(r,s,a){return a==null&&(a=.001),Ae.dispatchMethod(le,"curveAndSurface",[r.asNurbs(),s.asNurbs(),a])},jr.surfaces=function(r,s,a){return a==null&&(a=.001),le.surfaces(r.asNurbs(),s.asNurbs(),a).map(function(l){return new Le(l)})},jr.surfacesAsync=function(r,s,a){return a==null&&(a=.001),Ae.dispatchMethod(le,"surfaces",[r.asNurbs(),s.asNurbs(),a]).then(function(l){return l.map(function(c){return new Le(c)})})};var us=f.geom.Line=function(r,s){Le.call(this,ge.polyline([r,s])),this._start=r,this._end=s};x["verb.geom.Line"]=us,us.__name__=["verb","geom","Line"],us.__super__=Le,us.prototype=M(Le.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:us});var ds=f.geom.RevolvedSurface=function(r,s,a,l){Ee.call(this,ge.revolvedSurface(r.asNurbs(),s,a,l)),this._profile=r,this._center=s,this._axis=a,this._angle=l};x["verb.geom.RevolvedSurface"]=ds,ds.__name__=["verb","geom","RevolvedSurface"],ds.__super__=Ee,ds.prototype=M(Ee.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:ds});var ps=f.geom.SphericalSurface=function(r,s){Ee.call(this,ge.sphericalSurface(r,[0,0,1],[1,0,0],s)),this._center=r,this._radius=s};x["verb.geom.SphericalSurface"]=ps,ps.__name__=["verb","geom","SphericalSurface"],ps.__super__=Ee,ps.prototype=M(Ee.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:ps});var ms=f.geom.SweptSurface=function(r,s){Ee.call(this,ge.rationalTranslationalSurface(r.asNurbs(),s.asNurbs())),this._profile=r,this._rail=s};x["verb.geom.SweptSurface"]=ms,ms.__name__=["verb","geom","SweptSurface"],ms.__super__=Ee,ms.prototype=M(Ee.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:ms});function Zt(r){return r instanceof Array?function(){return L.iter(r)}:typeof r.iterator=="function"?Bt(r,r.iterator):r.iterator}var Zi,su=0;function Bt(r,s){if(s==null)return null;s.__id__==null&&(s.__id__=su++);var a;return r.hx__closures__==null?r.hx__closures__={}:a=r.hx__closures__[s.__id__],a==null&&(a=function(){return a.method.apply(a.scope,arguments)},a.scope=r,a.method=s,r.hx__closures__[s.__id__]=a),a}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var iu=x.Int={__name__:["Int"]},au=x.Dynamic={__name__:["Dynamic"]},Do=x.Float=Number;Do.__name__=["Float"];var Fo=x.Bool=Boolean;Fo.__ename__=["Bool"];var Uo=x.Class={__name__:["Class"]},Vo={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var s=[],a=0,l=this.length;a<l;){var c=a++;s[c]=r(this[c])}return s}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var s=[],a=0,l=this.length;a<l;){var c=a++,d=this[c];r(d)&&s.push(d)}return s});var Qi={},Xs=w.ArrayBuffer||lt;Xs.prototype.slice==null&&(Xs.prototype.slice=lt.sliceImpl),w.DataView;var Ji=w.Uint8Array||ar._new;(function(r,s){if(r.setImmediate)return;var a=1,l={},c=!1,d=r.document,m;function _(z){return l[a]=y.apply(s,z),a++}function y(z){var U=[].slice.call(arguments,1);return function(){typeof z=="function"?z.apply(s,U):new Function(""+z)()}}function A(z){if(c)setTimeout(y(A,z),0);else{var U=l[z];if(U){c=!0;try{U()}finally{I(z),c=!1}}}}function I(z){delete l[z]}function S(){m=function(){var z=_(arguments);return process.nextTick(y(A,z)),z}}function P(){if(r.postMessage&&!r.importScripts){var z=!0,U=r.onmessage;return r.onmessage=function(){z=!1},r.postMessage("","*"),r.onmessage=U,z}}function k(){var z="setImmediate$"+Math.random()+"$",U=function(V){V.source===r&&typeof V.data=="string"&&V.data.indexOf(z)===0&&A(+V.data.slice(z.length))};r.addEventListener?r.addEventListener("message",U,!1):r.attachEvent("onmessage",U),m=function(){var V=_(arguments);return r.postMessage(z+V,"*"),V}}function T(){var z=new MessageChannel;z.port1.onmessage=function(U){var V=U.data;A(V)},m=function(){var U=_(arguments);return z.port2.postMessage(U),U}}function O(){var z=d.documentElement;m=function(){var U=_(arguments),V=d.createElement("script");return V.onreadystatechange=function(){A(U),V.onreadystatechange=null,z.removeChild(V),V=null},z.appendChild(V),U}}function C(){m=function(){var z=_(arguments);return setTimeout(y(A,z),0),z}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?S():P()?k():r.MessageChannel?T():d&&"onreadystatechange"in d.createElement("script")?O():C(),R.setImmediate=m,R.clearImmediate=I})(new Function("return this")()),Xe.USE_CACHE=!1,Xe.USE_ENUM_INDEX=!1,Xe.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",He.DEFAULT_RESOLVER=ce,He.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Be.count=0,ot.i64tmp=function(r){var s,a=new Ge(0,0);return s=a,s}(),Ce.__toStr={}.toString,ar.BYTES_PER_ELEMENT=1,Ie.queue=new F,De.memo=new we,re.TOLERANCE=1e-6,re.EPSILON=1e-10,re.VERSION="2.0.0",be.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],be.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],Ae.THREADS=1,Ae._init=!1,Ur.basePath="",tn.uuid=0,Ys.main()}(typeof console<"u"?console:{log:function(){}},t,typeof u<"u"?u:typeof n<"u"?n:typeof self<"u"?self:this),t})})(uh);var Uu=uh.exports;const Fn=Fu(Uu);class ha{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(e,t,n,o){this.c0=e,this.c1=n,this.c2=-3*e+3*t-2*n-o,this.c3=2*e-2*t+n+o}initCatmullRom(e,t,n,o,h){this.init(t,n,h*(n-e),h*(o-t))}initNonuniformCatmullRom(e,t,n,o,h,u,g){let b=(t-e)/h-(n-e)/(h+u)+(n-t)/u,f=(n-t)/u-(o-t)/(u+g)+(o-n)/g;b*=u,f*=u,this.init(t,n,b,f)}calc(e){const t=e*e,n=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*n}}let dh=class extends Hs{constructor(e=[],t=!1,n="centripetal",o=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new Z,this._px=new ha,this._py=new ha,this._pz=new ha,this._points=e.map(h=>new Y(h)),this._closed=t,this._curveType=n,this._tension=o}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new Y}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new Y}get length(){if(this._points.length<2)return 0;let e=0;for(let t=1;t<this._points.length;t++)e+=this._points[t-1].distanceTo(this._points[t]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e}getPoint(e,t=new Y){const n=t,o=this._points,h=o.length;if(h===0)return n.set(0,0,0);if(h===1)return n.copy(o[0]);const u=(h-(this._closed?0:1))*e;let g=Math.floor(u),b=u-g;this._closed?g+=g>0?0:(Math.floor(Math.abs(g)/h)+1)*h:b===0&&g===h-1&&(g=h-2,b=1);let f,w;this._closed||g>0?f=o[(g-1)%h]:(this._tmp.subVectors(o[0],o[1]).add(o[0]),f=new Y(this._tmp.x,this._tmp.y,this._tmp.z));const x=o[g%h],E=o[(g+1)%h];if(this._closed||g+2<h?w=o[(g+2)%h]:(this._tmp.subVectors(o[h-1],o[h-2]).add(o[h-1]),w=new Y(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const M=this._curveType==="chordal"?.5:.25;let L=Math.pow(f.distanceToSquared(x),M),B=Math.pow(x.distanceToSquared(E),M),F=Math.pow(E.distanceToSquared(w),M);B<1e-4&&(B=1),L<1e-4&&(L=B),F<1e-4&&(F=B),this._px.initNonuniformCatmullRom(f.x,x.x,E.x,w.x,L,B,F),this._py.initNonuniformCatmullRom(f.y,x.y,E.y,w.y,L,B,F),this._pz.initNonuniformCatmullRom(f.z,x.z,E.z,w.z,L,B,F)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,E.x,w.x,this._tension),this._py.initCatmullRom(f.y,x.y,E.y,w.y,this._tension),this._pz.initCatmullRom(f.z,x.z,E.z,w.z,this._tension));return n.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),n}getPoints(e){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}setPoints(e){this._points=e.map(t=>new Y(t)),this._boundingBoxNeedsUpdate=!0}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)}setCurveType(e){this._curveType=e}setTension(e){this._tension=e}transform(e){return this._points=this._points.map(t=>{const n=new Y;return n.copy(t),n.applyMatrix4(e),n}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Ne;const e=new Ne;return this._points.forEach(t=>{e.expandByPoint(t)}),e}};class bn{constructor(e,t,n,o){this._degree=e,this._knots=[...t],this._controlPoints=n.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=o?[...o]:new Array(n.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z}))}weights(){return[...this._weights]}point(e){const t=this._controlPoints.map(n=>[n.x,n.y,n.z]);return Bs(e,this._degree,this._knots,t,this._weights)}length(){const e=this._controlPoints.map(t=>[t.x,t.y,t.z]);return nh(this._degree,this._knots,e,this._weights)}static byKnotsControlPointsWeights(e,t,n,o){return new bn(e,t,n,o)}static byPoints(e,t,n="Uniform"){let o;switch(n){case"Chord":o=th(t,e);break;case"SqrtChord":o=rh(t,e);break;case"Uniform":default:o=eh(t,e.length);break}const h=e.map(g=>({x:g[0],y:g[1],z:g[2]})),u=new Array(h.length).fill(1);return new bn(t,o,h,u)}getParameterRange(){const e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}}getPoints(e){const t=[],{start:n,end:o}=this.getParameterRange();for(let h=0;h<=e;h++){const u=n+(o-n)*(h/e);t.push(this.point(u))}return t}isClosed(e=1e-6){const{start:t,end:n}=this.getParameterRange(),o=this.point(t),h=this.point(n),u=o[0]-h[0],g=o[1]-h[1],b=o[2]-h[2];return Math.sqrt(u*u+g*g+b*b)<e}static createFitPointsForClosedCurve(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const t=new dh(e,!0,"centripetal"),n=Math.max(50,e.length*2);return t.getPoints(n)}static createClosedCurve(e,t,n="Chord"){const o=this.createFitPointsForClosedCurve(e).map(h=>[h.x,h.y,h.z]);return bn.byPoints(o,t,n)}}class Zr extends Hs{constructor(e,t,n,o,h){super();const u=arguments.length;if(u<2||u>5)throw Ht.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(t)){this._controlPoints=e;let g,b=3,f=!1;if(u>=3&&(Array.isArray(n)?(g=n,u>=4&&(b=o||3),u>=5&&(f=h)):n!==void 0&&(b=n||3,u>=4&&(f=o))),n===void 0&&u>=4&&(b=o||3,u>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw Ht.ILLEGAL_PARAMETERS;const w=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Fn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,w,g)}else{if(this._fitPoints=e,this._knotParameterization=t,u>=3&&(this._degree=n||3),u>=4&&(this._closed=o),this._fitPoints.length<this._degree+1)throw Ht.ILLEGAL_PARAMETERS;const g=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Fn.geom.NurbsCurve.byPoints(g,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const e=bn.createFitPointsForClosedCurve(this._fitPoints),t=this.toNurbsPoints(e);this._nurbsCurve=Fn.geom.NurbsCurve.byPoints(t,this._degree)}else{const e=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Fn.geom.NurbsCurve.byPoints(e,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const e=bn.createFitPointsForClosedCurve(this._controlPoints),t=this.toNurbsPoints(e);this._nurbsCurve=Fn.geom.NurbsCurve.byPoints(t,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const e=this._nurbsCurve.knots(),t=this._nurbsCurve.weights(),n=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Fn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,n,t)}}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),n=e[t],o=this._nurbsCurve.point(n);return new Y(o[0],o[1],o[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),n=e[e.length-t-1],o=this._nurbsCurve.point(n);return new Y(o[0],o[1],o[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(e){if(!this._fitPoints)throw new Error("No fit points in this spline");const t=this._fitPoints.length,n=e<0||e>=t?t-1:e,o=this._fitPoints[n];return{x:o.x,y:o.y,z:o.z||0}}getControlPointAt(e){const t=this._controlPoints.length,n=e<0||e>=t?t-1:e;return this._controlPoints[n]}getPoints(e=100){const t=this._nurbsCurve,n=[],o=t.knots(),h=this._nurbsCurve.degree(),u=o[h],g=o[o.length-h-1],b=(g-u)/(e-1);for(let f=0;f<e;f++){const w=f===e-1?g:u+f*b,x=t.point(w);n.push(new Y(x[0],x[1],x[2]))}return n}getCurvePoints(e,t){const n=[],o=e.knots(),h=o[3],u=(o[o.length-4]-h)/(t-1);for(let g=0;g<t;g++){const b=h+g*u;n.push(e.point(b))}return n}calculateBoundingBox(){const e=this.getPoints(100);return new Ne().setFromPoints(e)}get closed(){return this._closed}set closed(e){this.setClosed(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(e){const t=new Array(e.length);return e.forEach((n,o)=>{t[o]=[n.x,n.y,n.z||0]}),t}toVerbPoints(e){const t=new Array(e.length);return e.forEach((n,o)=>{t[o]=[n.x,n.y,n.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((n,o)=>{t[o]={x:n[0],y:n[1],z:n[2]}}),t}static createClosedSpline(e,t="Uniform",n=3){if(e.length<n+1)throw new Error(`At least ${n+1} points are required for a degree ${n} closed spline`);return new Zr(e,t,n,!0)}}var Ha=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(Ha||{}),Hi=(i=>(i[i.ByBlock=-2]="ByBlock",i[i.ByDIPs=-4]="ByDIPs",i[i.ByLayer=-1]="ByLayer",i[i.ByLineWeightDefault=-3]="ByLineWeightDefault",i[i.LineWeight000=0]="LineWeight000",i[i.LineWeight005=5]="LineWeight005",i[i.LineWeight009=9]="LineWeight009",i[i.LineWeight013=13]="LineWeight013",i[i.LineWeight015=15]="LineWeight015",i[i.LineWeight018=18]="LineWeight018",i[i.LineWeight020=20]="LineWeight020",i[i.LineWeight025=25]="LineWeight025",i[i.LineWeight030=30]="LineWeight030",i[i.LineWeight035=35]="LineWeight035",i[i.LineWeight040=40]="LineWeight040",i[i.LineWeight050=50]="LineWeight050",i[i.LineWeight053=53]="LineWeight053",i[i.LineWeight060=60]="LineWeight060",i[i.LineWeight070=70]="LineWeight070",i[i.LineWeight080=80]="LineWeight080",i[i.LineWeight090=90]="LineWeight090",i[i.LineWeight100=100]="LineWeight100",i[i.LineWeight106=106]="LineWeight106",i[i.LineWeight120=120]="LineWeight120",i[i.LineWeight140=140]="LineWeight140",i[i.LineWeight158=158]="LineWeight158",i[i.LineWeight200=200]="LineWeight200",i[i.LineWeight211=211]="LineWeight211",i))(Hi||{}),Lr=(i=>(i[i.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",i[i.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",i[i.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",i[i.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",i[i.BY_STYLE=5]="BY_STYLE",i))(Lr||{}),It=(i=>(i[i.TopLeft=1]="TopLeft",i[i.TopCenter=2]="TopCenter",i[i.TopRight=3]="TopRight",i[i.MiddleLeft=4]="MiddleLeft",i[i.MiddleCenter=5]="MiddleCenter",i[i.MiddleRight=6]="MiddleRight",i[i.BottomLeft=7]="BottomLeft",i[i.BottomCenter=8]="BottomCenter",i[i.BottomRight=9]="BottomRight",i))(It||{}),Ya=(i=>(i[i.OPTIMIZED_2D=0]="OPTIMIZED_2D",i[i.WIREFRAME=1]="WIREFRAME",i[i.HIDDEN_LINE=2]="HIDDEN_LINE",i[i.FLAT_SHADED=3]="FLAT_SHADED",i[i.GOURAUD_SHADED=4]="GOURAUD_SHADED",i[i.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",i[i.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",i))(Ya||{}),qa=(i=>(i[i.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",i[i.TOP=1]="TOP",i[i.BOTTOM=2]="BOTTOM",i[i.FRONT=3]="FRONT",i[i.BACK=4]="BACK",i[i.LEFT=5]="LEFT",i[i.RIGHT=6]="RIGHT",i))(qa||{}),Xa=(i=>(i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",i))(Xa||{});let ph=class mh{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new Y,this._height=0,this._width=0,this._viewCenter=new Y,this._viewHeight=0}get number(){return this._number}set number(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new vt;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter.copy(e)}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const e=new vt;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new mh;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e}copy(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this}};var vn=256,gh=[],hl=256,Zs;for(;vn--;)gh[vn]=(vn+256).toString(16).substring(1);function Vu(i){var e=0,t=11;if(!Zs||vn+t>hl*2)for(Zs="",vn=0;e<hl;e++)Zs+=gh[Math.random()*256|0];return Zs.substring(vn,vn+++t)}class Jr{constructor(e,t){e=e||{},Hn(e,{objectId:Vu()}),this._attrs=new Al(e,t)}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get database(){return this._database?this._database:no().workingDatabase}set database(e){this._database=e}close(){}}const so=class so extends Jr{constructor(){super(...arguments),this._layer="0",this._color=new Qr,this._lineType=ti,this._lineWeight=Hi.ByLayer,this._linetypeScale=-1,this._visibility=!0,this._transparency=new Ui}get type(){return this.constructor.typeName}get layer(){return this._layer}set layer(e){this._layer=e}get color(){return this._color}set color(e){this._color.copy(e)}get rgbColor(){let e=this.database.cecolor;if(this.color.isByLayer){const n=this.getLayerColor();n&&n.RGB!=null&&(e=n)}else this.color.isByBlock||this.color.RGB!=null&&(e=this.color);const t=e.RGB;return t??16777215}get lineType(){return this._lineType}set lineType(e){this._lineType=e||ti}get lineWeight(){return this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e.clone()}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,n,o){}transformBy(e){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:e=>{this.color.copy(e)}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:e=>{this.layer=e}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:e=>{this.lineType=e}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:e=>{this.linetypeScale=e}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:e=>{this.lineWeight=e}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:e=>{this.transparency=e}}}]}}get lineStyle(){var o;const{type:e,name:t}=this.getLineType(),n=(o=this.database)==null?void 0:o.tables.linetypeTable.getAt(t);return n?{type:e,...n.linetype}:{type:e,name:t,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==ti){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==Tl?{type:"ByBlock",name:li}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:li}}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return e.color;return null}attachEntityInfo(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)}};so.typeName="Entity";let Pt=so;const io=class io extends Pt{};io.typeName="Curve";let Et=io;var Vn=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.FitCurvePoly=1]="FitCurvePoly",i[i.QuadSplinePoly=2]="QuadSplinePoly",i[i.CubicSplinePoly=3]="CubicSplinePoly",i))(Vn||{});const ao=class ao extends Et{constructor(e,t,n=0,o=!1,h=0,u=0,g=null){super(),this._polyType=e,this._elevation=n;const b=g&&(g==null?void 0:g.length)===t.length,f=t.map((w,x)=>({x:w.x,y:w.y,bulge:b?g[x]:void 0}));this._geo=new wn(f,o)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get geometricExtents(){const e=this._geo.box;return new Ne({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){return new Array}draw(e){const t=[];return this._geo.getPoints(100).forEach(o=>t.push(new Y().set(o.x,o.y,this.elevation))),e.lines(t)}};ao.typeName="2dPolyline";let ui=ao;var fh=(i=>(i[i.Vertex=0]="Vertex",i[i.CurveFitVertex=1]="CurveFitVertex",i[i.SplineFitVertex=8]="SplineFitVertex",i[i.SplineCtlVertex=9]="SplineCtlVertex",i))(fh||{});const oo=class oo extends Pt{constructor(){super(),this._position=new Y,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get bulge(){return this._bulge}set bulge(e){this._bulge=e}get startWidth(){return this._startWidth}set startWidth(e){this._startWidth=e}get endWidth(){return this._endWidth}set endWidth(e){this._endWidth=e}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new Ne().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}transformBy(e){return this._position.applyMatrix4(e),this}draw(e){}};oo.typeName="2dVertex";let Sa=oo;var Rs=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.QuadSplinePoly=1]="QuadSplinePoly",i[i.CubicSplinePoly=2]="CubicSplinePoly",i))(Rs||{});const lo=class lo extends Et{constructor(e,t,n=!1){super(),this._polyType=e,this._geo=new wn(t,n)}get polyType(){return this._polyType}set polyType(e){this._polyType=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}get geometricExtents(){const e=this._geo.box;return new Ne({x:e.min.x,y:e.min.y,z:0},{x:e.max.x,y:e.max.y,z:0})}subGetGripPoints(){return new Array}draw(e){const t=[];return this._geo.getPoints(100).forEach(o=>t.push(new Y().set(o.x,o.y,0))),e.lines(t)}};lo.typeName="3dPolyline";let di=lo;var _h=(i=>(i[i.SimpleVertex=0]="SimpleVertex",i[i.ControlVertex=1]="ControlVertex",i[i.FitVertex=2]="FitVertex",i))(_h||{});const ho=class ho extends Pt{constructor(){super(),this._position=new Y,this._vertexType=0}get position(){return this._position}set position(e){this._position.copy(e)}get vertexType(){return this._vertexType}set vertexType(e){this._vertexType=e}get geometricExtents(){return new Ne().expandByPoint(this._position)}subGetGripPoints(){const e=new Array;return e.push(this._position),e}transformBy(e){return this._position.applyMatrix4(e),this}draw(e){}};ho.typeName="3dVertex";let Ia=ho;const co=class co extends Et{constructor(e,t,n,o,h=Z.Z_AXIS){super(),this._geo=new ja(e,t,n,o,h,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo)}};co.typeName="Arc";let pi=co;const uo=class uo extends Pt{constructor(e){super(),this._blockName=e,this._position=new Y,this._rotation=0,this._normal=new Z(0,0,1),this._scaleFactors=new Y(1,1,1)}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get properties(){return{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}}}]}]}}get geometricExtents(){const e=new Ne,t=this.blockTableRecord;if(t!=null){const h=t.newIterator();for(const u of h)e.union(u.geometricExtents)}const n=new Kr().setFromEuler(new oh(this.rotation,0,0)),o=new $r;return o.compose(this.position,n,this.scaleFactors),e.applyMatrix4(o),e}draw(e){const t=[],n=this.blockTableRecord;if(n!=null){const o=this.computeTransformMatrix(),h=Xr.instance.draw(e,n,this.rgbColor,!0,o,this.normal);return this.attachEntityInfo(h),h}else{const o=e.group(t);return this.attachEntityInfo(o),o}}computeTransformMatrix(){const e=new Kr;return e.setFromAxisAngle(Z.Z_AXIS,this.rotation),new $r().compose(this._position,e,this._scaleFactors)}};uo.typeName="BlockReference";let Us=uo;const po=class po extends Et{constructor(e,t,n=Z.Z_AXIS){super(),this._geo=new ja(e,t,0,st,n,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:e=>{this.radius=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo)}};po.typeName="Circle";let mi=po;const mo=class mo extends Et{constructor(e,t,n,o,h,u,g){super(),this._geo=new Wi(e,t,n,o,h,u,g)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:e=>{this.center.x=e}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:e=>{this.center.y=e}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:e=>{this.center.z=e}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:e=>{this.center.x=e}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:e=>{this.minorAxisRadius=e}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:e=>{this.startAngle=e}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:e=>{this.endAngle=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]}}draw(e){return e.ellipticalArc(this._geo)}};mo.typeName="Ellipse";let gi=mo;const go=class go extends Pt{constructor(){super(),this._vertices=[new Y,new Y,new Y],this._edgeInvisibilities=0}getVertexAt(e){return e<0?this._vertices[0]:e>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[e]}setVertexAt(e,t){if(e<0&&this._vertices[0].copy(t),e>=3)return this._vertices.length===3&&this._vertices.push(new Y),this._vertices[3].copy(t);this._vertices[e].copy(t)}setEdgeInvisibilities(e){this._edgeInvisibilities=e}isEdgeVisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<e)===0}makeEdgeInvisibleAt(e){if(e<0||e>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<e}get geometricExtents(){return new Ne().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;for(let t=0;t<this._vertices.length;++t)e.push(this.getVertexAt(t));return e}draw(e){const t=this._vertices.length,n=new Float32Array(t*3),o=new Uint16Array(t*2);for(let h=0;h<t;h++)n[h*3]=this._vertices[h].x,n[h*3+1]=this._vertices[h].y,n[h*3+2]=this._vertices[h].z,this.isEdgeVisibleAt(h)&&(o[h*2]=h,o[h*2+1]=(h+1)%4);return e.lineSegments(n,3,o)}};go.typeName="Face";let fi=go;var yh=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(yh||{}),vh=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(vh||{});const fo=class fo extends Pt{constructor(){super(),this._elevation=0,this._geo=new Gi,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get isSolidFill(){return this._isSolidFill||this._patternName.toUpperCase()==="SOLID"}set isSolidFill(e){this._isSolidFill=e}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e}get patternType(){return this._patternType}set patternType(e){this._patternType=e}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e}add(e){this._geo.add(e)}get geometricExtents(){const e=this._geo.box;return new Ne({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}draw(e){const t=e.subEntityTraits;return t.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,patternLines:this.definitionLines},e.area(this._geo)}};fo.typeName="Hatch";let Vs=fo;var bh=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(bh||{});const _o=class _o extends Et{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}appendVertex(e){this._vertices.push(new Y().copy(e)),this._updated=!0}setVertexAt(e,t){throw(e<0||e>=this._vertices.length)&&(this._vertices[e].copy(t),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(e){throw(e<0||e>=this._vertices.length)&&this._vertices[e],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Ne().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}draw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t)}else return e.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Zr(this._vertices,"Uniform"),this._updated=!1)}};_o.typeName="Leader";let _i=_o;var yn=(i=>(i[i.EndPoint=1]="EndPoint",i[i.MidPoint=2]="MidPoint",i[i.Center=3]="Center",i[i.Node=4]="Node",i[i.Quadrant=5]="Quadrant",i[i.Insertion=7]="Insertion",i[i.Perpendicular=8]="Perpendicular",i[i.Tangent=9]="Tangent",i[i.Nearest=10]="Nearest",i[i.Centroid=11]="Centroid",i))(yn||{});const yo=class yo extends Et{constructor(e,t){super(),this._geo=new ci(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:e=>{this.startPoint.x=e}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:e=>{this.startPoint.y=e}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:e=>{this.startPoint.z=e}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:e=>{this.endPoint.x=e}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:e=>{this.endPoint.y=e}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:e=>{this.endPoint.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,n,o){const h=this.startPoint,u=this.endPoint;switch(e){case yn.EndPoint:o.push(h),o.push(u);break;case yn.MidPoint:o.push(this.midPoint);break;case yn.Nearest:{const g=this._geo.project(t);o.push(g)}break;case yn.Perpendicular:{const g=this._geo.perpPoint(t);o.push(g)}break;case yn.Tangent:o.push(h);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,n=this.endPoint,o=[new Y(t.x,t.y,0),new Y(n.x,n.y,0)];return e.lines(o)}};yo.typeName="Line";let yi=yo;const vo=class vo extends Pt{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 Y,this._attachmentPoint=It.TopLeft,this._direction=new Z(1,0,0),this._drawingDirection=Lr.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new Ne}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:e=>{this.contents=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:It[1],value:1},{label:It[2],value:2},{label:It[3],value:3},{label:It[4],value:4},{label:It[5],value:5},{label:It[6],value:6},{label:It[7],value:7},{label:It[8],value:8},{label:It[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:e=>{this.attachmentPoint=e}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:Lr[1],value:1},{label:Lr[2],value:2},{label:Lr[3],value:3},{label:Lr[4],value:4},{label:Lr[5],value:5}],accessor:{get:()=>this.drawingDirection,set:e=>{this.drawingDirection=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:e=>{this.lineSpacingFactor=e}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:e=>{this.width=e}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:e=>{this.direction.x=e}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:e=>{this.direction.y=e}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:e=>{this.direction.z=e}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:e=>{this.location.x=e}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:e=>{this.location.y=e}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:e=>{this.location.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e,t){const n={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor},o={...this.getTextStyle()};return e.mtext(n,o,t)}};vo.typeName="MText";let vi=vo;const bo=class bo extends Et{constructor(e,t,n,o,h){super();const u=+(e!==void 0)+ +(t!==void 0)+ +(n!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Ht.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new Zr(e,t,n,o):this._geo=new Zr(e,t,n,o,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}draw(e){const t=this._geo.getPoints(100);return e.lines(t)}};bo.typeName="Spline";let Gs=bo;const Gu=new Z,xo=class xo extends Us{constructor(e,t,n){super(e),this._attachmentPoint=It.TopLeft,this._numColumns=n,this._numRows=t,this._columnWidth=new Array(n),this._rowHeight=new Array(t),this._cells=new Array(t*n)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,n){return this._cells[e*t].text}setTextString(e,t,n){this._cells[e*t].text=n}isEmpty(e,t){return!this._cells[e*t].text}get geometricExtents(){return new Ne}draw(e){let t=0,n=0;const o=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let E=0;E<=this.numRows;E++){t-=E>0?this.rowHeight(E-1):0,n=0;for(let M=0;M<=this.numColumns;M++)n+=M>0?this.columnWidth(M-1):0,h[u++]=n,h[u++]=t,h[u++]=0}const g=[],b=new Array(this.numRows*this.numColumns).fill(!1);n=0,u=0;let f=0;for(let E=0;E<this.numColumns;E++){n+=E>0?this.columnWidth(E-1):0,t=0;for(let M=0;M<this.numRows;M++){t+=M>0?this.rowHeight(M-1):0;const L=this.cell(M*this.numColumns+E);if(f=M*this.numColumns+E,L&&!b[f]){const B=L.borderWidth??1,F=L.borderHeight??1;this.fillVisited(b,f,this.numColumns,B,F),o[u++]=E+M*(this.numColumns+1),o[u++]=E+M*(this.numColumns+1)+B;const D=h[o[u-1]*3]-n,de=E+(M+F)*(this.numColumns+1)+B;E+B==this.numColumns&&(o[u++]=E+M*(this.numColumns+1)+B,o[u++]=de);const ve=-h[de*3+1]-t;if(M+F==this.numRows&&(o[u++]=E+(M+F)*(this.numColumns+1)+F,o[u++]=E+(M+F)*(this.numColumns+1)),o[u++]=E+(M+F)*(this.numColumns+1),o[u++]=E+M*(this.numColumns+1),L.text){const oe=L.attachmentPoint||this.attachmentPoint||It.MiddleCenter,W=this.getTableTextOffset(oe,D,ve),ce={text:L.text,height:L.textHeight,width:D,position:Gu.set(n,-t,0).clone().add(W),rotation:this.rotation,attachmentPoint:oe},se=this.getTextStyle(L);g.push(e.mtext(ce,se))}}}}g.push(e.lineSegments(h,3,o));const w=e.group(g),x=new Kr;return x.setFromAxisAngle(Z.Z_AXIS,this.rotation),cl.compose(this.position,x,this.scaleFactors),w.applyMatrix(cl),this.attachEntityInfo(w),w}fillVisited(e,t,n,o,h){if(h==1&&o==1)e[t]=!0;else for(let u=0;u<o;++u)for(let g=0;g<h;++g)e[t+u+g*n]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable;let n;return e.textStyle&&(n=t.getAt(e.textStyle)),n||(n=t.getAt("STANDARD")||t.getAt("Standard")),n.textStyle}getTableTextOffset(e,t,n){const o=new Z;switch(e){case 1:break;case 2:o.setX(t/2);break;case 3:o.setX(t);break;case 4:o.setY(-n/2);break;case 5:o.set(t/2,-n/2,0);break;case 6:o.set(t,-n/2,0);break;case 7:o.setY(-n);break;case 8:o.set(t/2,-n,0);break;case 9:o.set(t,-n,0);break}return o}};xo.typeName="Table";let bi=xo;const cl=new $r;var xh=(i=>(i[i.LEFT=0]="LEFT",i[i.CENTER=1]="CENTER",i[i.RIGHT=2]="RIGHT",i[i.ALIGNED=3]="ALIGNED",i[i.MIDDLE=4]="MIDDLE",i[i.FIT=5]="FIT",i))(xh||{}),wh=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(wh||{});const wo=class wo extends Pt{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new Y,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new Ne}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:e=>{this.textString=e}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:e=>{this.styleName=e}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:e=>{this.height=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:e=>{this.widthFactor=e}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:e=>{this.oblique=e}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e,t){const n={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Lr.BOTTOM_TO_TOP,attachmentPoint:It.BottomLeft},o={...this.getTextStyle(),color:this.rgbColor};return e.mtext(n,o,t)}};wo.typeName="Text";let xi=wo;const Ao=class Ao extends Et{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new Y,new Y,new Y,new Y]}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new Ne().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;for(let t=0;t<4;++t)e.push(this.getPointAt(t));return e}draw(e){const t=new wn(this._vertices,!0),n=new Gi;n.add(t);const o=e.subEntityTraits;return o.fillType={solidFill:!0,patternAngle:0,patternLines:[]},e.area(n)}};Ao.typeName="Trace";let wi=Ao;const So=class So extends Et{constructor(){super(),this._elevation=0,this._geo=new wn}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,n=0,o=-1,h=-1){const u=o<0?void 0:o,g=h<0?void 0:h,b={x:t.x,y:t.y,bulge:n,startWidth:u,endWidth:g};this._geo.addVertexAt(e,b)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new Y(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new Ne({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}draw(e){const t=[];return this._geo.getPoints(100).forEach(o=>t.push(new Y().set(o.x,o.y,this.elevation))),e.lines(t)}};So.typeName="Polyline";let Ai=So;const Io=class Io extends Pt{constructor(){super(),this._geo=new Y}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new Ne().expandByPoint(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}}]}]}}transformBy(e){return this._geo.applyMatrix4(e),this}draw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}};Io.typeName="Point";let Si=Io;var Ah=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(Ah||{}),Sh=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(Sh||{});const Po=class Po extends Pt{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new Y,this._scale=new Ze(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new Ne;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}draw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t)}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,n=this._height,o=new vt;o.setFromPoints(this._clipBoundary);const h=new Te;h.setX(this._position.x-o.min.x*t),h.setY(this._position.y-o.min.y*n),this._clipBoundary.forEach(u=>{const g=u.x*t+h.x,b=u.y*n+h.y;e.push(new Y(g,b,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){ul.copy(e[1]);for(let t=1;t<4;t++)Qs.copy(e[t]),Qs.rotateAround(ul,this._rotation),e[t].setX(Qs.x),e[t].setY(Qs.y)}e.push(e[0])}return e}};Po.typeName="RasterImage";let js=Po;const ul=new Te,Qs=new Te,Eo=class Eo extends Et{constructor(){super(),this._basePoint=new Y,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Ne;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}};Eo.typeName="Ray";let Ii=Eo;const ko=class ko extends Pt{constructor(){super(),this._centerPoint=new Y,this._height=0,this._width=0,this._viewCenter=new Y,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new Ne}draw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport(),n=e.group(this.createViewportRect(t,e));return this.attachEntityInfo(n),n}}toGiViewport(){const e=new ph;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const n=[];return n.push(t.lines([new Y(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new Y(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)])),n.push(t.lines([new Y(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new Y(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)])),n.push(t.lines([new Y(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new Y(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)])),n.push(t.lines([new Y(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new Y(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)])),n}};ko.typeName="Viewport";let Pi=ko;const Mo=class Mo extends js{draw(e){const t=this.boundaryPath(),n=new Gi;return n.add(new wn(t)),e.area(n)}};Mo.typeName="Wipeout";let Ei=Mo;const To=class To extends Et{constructor(){super(),this._basePoint=new Y,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Ne;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:e=>{this.basePoint.x=e}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:e=>{this.basePoint.y=e}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:e=>{this.basePoint.z=e}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:e=>{this.unitDir.x=e}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:e=>{this.unitDir.y=e}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:e=>{this.unitDir.z=e}}}]}]}}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t)}};To.typeName="Xline";let ki=To;var Ih=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(Ih||{});const No=class No extends Pt{constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new Y,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new Y,this._textRotation=0,this._normal=new Z(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(e){this._dimBlockPosition.copy(e)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new Wn),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}draw(e){if(this.dimBlockId){const n=this.database.tables.blockTable.getAt(this.dimBlockId);if(n){const o=new $r().makeTranslation(this.dimBlockPosition),h=Xr.instance.draw(e,n,this.rgbColor,!1,o,this.normal);return this.attachEntityInfo(h),h}}const t=e.group([]);return this.attachEntityInfo(t),t}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return Xr.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return Xr.instance.draw(e,t,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}getLineArrowStyle(e){}findPointOnLine1(e,t,n){const o=new Y().subVectors(t,e).normalize();return new Y(t).addScaledVector(o,n)}findPointOnLine2(e,t,n){const o=e.x+n*Math.cos(t),h=e.y+n*Math.sin(t);return{x:o,y:h}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():Ha.Closed}};No.typeName="Dimension";let Or=No;const Co=class Co extends Or{constructor(e,t,n,o,h=null,u=null){super(),this._centerPoint=new Y().copy(e),this._xLine1Point=new Y().copy(t),this._xLine2Point=new Y().copy(n),this._arcPoint=new Y().copy(o),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new Ne}};Co.typeName="3PointAngularDimension";let Mi=Co;const Lo=class Lo extends Or{constructor(e,t,n,o=null,h=null){super(),this._dimLinePoint=new Y().copy(n),this._xLine1Point=new Y().copy(e),this._xLine2Point=new Y().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=o,this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get geometricExtents(){return new Ne}get isAppendArrow(){return!1}};Lo.typeName="AlignedDimension";let Ti=Lo;const Oo=class Oo extends Or{constructor(e,t,n,o,h=null,u=null){super(),this._arcPoint=new Y().copy(o),this._xLine1Point=new Y().copy(t),this._xLine2Point=new Y().copy(n),this._centerPoint=new Y().copy(e),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new Ne}};Oo.typeName="ArcDimension";let Pa=Oo;const Bo=class Bo extends Or{constructor(e,t,n=0,o=null,h=null){super(),this._chordPoint=new Y().copy(e),this._farChordPoint=new Y().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=n,this.dimensionText=o,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Ne}drawLines(e,t){const n=[],o=t.length;return o==1?n.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):o==3?(this.sortLines(t),n.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})),n.push(this.drawLine(e,t[1])),n.push(this.drawLine(e,t[2],{firstArrow:this.firstArrowStyle}))):t.forEach(h=>{n.push(this.drawLine(e,h))}),n}drawLine(e,t,n){if(n){const o=[t.startPoint,t.endPoint];return e.lines(o)}else return t.draw(e)}sortLines(e){const t=(n,o)=>n.x!==o.x?n.x-o.x:n.y!==o.y?n.y-o.y:n.z-o.z;e.sort((n,o)=>{const h=t(n.startPoint,o.startPoint);return h!==0?h:t(n.endPoint,o.endPoint)})}};Bo.typeName="DiametricDimension";let Ni=Bo;const zo=class zo extends Or{constructor(e,t,n=null,o=null){super(),this._definingPoint=new Y().copy(e),this._leaderEndPoint=new Y().copy(t),this.dimensionText=n,this.dimensionStyleName=o}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get geometricExtents(){return new Ne}get arrowLineCount(){return 0}};zo.typeName="OrdinateDimension";let Ci=zo;const Ro=class Ro extends Or{constructor(e,t,n,o=null,h=null){super(),this._center=new Y().copy(e),this._chordPoint=new Y().copy(t),this._leaderLength=n,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=o,this.dimensionStyleName=h}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLenght(e){this._leaderLength=e}get geometricExtents(){return new Ne}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}};Ro.typeName="RadialDimension";let Li=Ro;class Yi extends Jr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new vt,this._extents=new Ne}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}}class Ka extends Jr{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((n,o)=>{n===t&&(this._recordsByName.delete(o),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:o}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new qi(this._recordsByName)}}class Ph extends Ka{getBtrIdAt(e){for(const[t,n]of this._recordsByName)if(n.blockTableRecordId==e)return n}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class Eh extends Jr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class kh{constructor(e){this.db=e}createDefaultLayer(){const e=new Qr;return e.colorIndex=7,this.db.tables.layerTable.add(new Ki({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new Fs({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Fs({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Fs({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new ro({name:"Standard",standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new Wn({name:"Standard",dimtxsty:"Standard"}))}createDefaultLayout(){const e=new Yi;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.dictionaries.layouts.setAt(e.layoutName,e),this.db.tables.blockTable.modelSpace.layoutId=e.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const t=new Vs;t.patternName="SOLID";const n=new Wa;n.add(new zs({x:0,y:0},{x:-1,y:.125})),n.add(new zs({x:-1,y:.125},{x:-1,y:-.125})),n.add(new zs({x:-1,y:-.125},{x:0,y:0})),t.add(n);const o=new pt;o.name="_CAXARROW",o.appendEntity(t),this.db.tables.blockTable.add(o)}}}var Mh=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(Mh||{});class qi{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}var $a=(i=>(i[i.Undefined=0]="Undefined",i[i.Inches=1]="Inches",i[i.Feet=2]="Feet",i[i.Miles=3]="Miles",i[i.Millimeters=4]="Millimeters",i[i.Centimeters=5]="Centimeters",i[i.Meters=6]="Meters",i[i.Kilometers=7]="Kilometers",i[i.Microinches=8]="Microinches",i[i.Mils=9]="Mils",i[i.Yards=10]="Yards",i[i.Angstroms=11]="Angstroms",i[i.Nanometers=12]="Nanometers",i[i.Microns=13]="Microns",i[i.Decimeters=14]="Decimeters",i[i.Dekameters=15]="Dekameters",i[i.Hectometers=16]="Hectometers",i[i.Gigameters=17]="Gigameters",i[i.Astronomical=18]="Astronomical",i[i.LightYears=19]="LightYears",i[i.Parsecs=20]="Parsecs",i[i.USSurveyFeet=21]="USSurveyFeet",i[i.USSurveyInch=22]="USSurveyInch",i[i.USSurveyYard=23]="USSurveyYard",i[i.USSurveyMile=24]="USSurveyMile",i[i.Max=24]="Max",i))($a||{});function ju(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function Wu(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}const Th="Load Database";class Nt extends Il{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=Ma.getInstance().getEntry(Th),n=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const o=await this.data.task(e);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",o?o.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),t&&(t.data[this.name]=Date.now()-n),o}}class Za{constructor(e={}){this.config=e}async read(e,t,n,o){const h={name:Th,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(w=>{w!=="total"&&(f+=`- ${w}: ${this.data[w]} ms
|
|
5
|
-
`)}),f+=`- total: ${this.data.total} ms`,f}};Ma.getInstance().collect(h),this.progress=o;const u={value:0},g=new Pl;g.setCompleteCallback(()=>this.onFinished()),g.setErrorCallback(f=>this.onError(f)),g.addTask(new Nt({stage:"START",step:1,progress:u,task:async f=>f},o)),g.addTask(new Nt({stage:"PARSE",step:5,progress:u,task:async f=>await this.parse(f)},o)),g.addTask(new Nt({stage:"FONT",step:5,progress:u,task:async f=>{const w=this.getFonts(f.model);return{model:f.model,data:w}}},o)),g.addTask(new Nt({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,t),f)},o)),g.addTask(new Nt({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,t),f)},o)),g.addTask(new Nt({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,t),f)},o)),g.addTask(new Nt({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,t),t.tables.layerTable.numEntries===0&&t.createDefaultData({layer:!0}),f)},o)),g.addTask(new Nt({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,t),f)},o)),g.addTask(new Nt({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,t),f)},o)),g.addTask(new Nt({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,t),f)},o)),g.addTask(new Nt({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,t),t.dictionaries.layouts.numEntries===0&&t.createDefaultData({layout:!0}),f)},o)),g.addTask(new Nt({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,t),f)},o)),g.addTask(new Nt({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,t,n,u,o),f)},o)),g.addTask(new Nt({stage:"END",step:0,progress:u,task:async f=>f},o));const b=Date.now();await g.run(e),h.data.total=Date.now()-b}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}return console.error(`Error occurred in conversion stage '${e.task.name}': `,e.error),e.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),Xr.instance.clear())}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,n,o,h){throw new Error("Not impelemented yet!")}}var ct,gs,Je,it,fs,nr,xt,vr,sr,on,_s,ys,ln,hn,vs,bs,xs,Dt,br,qe,cn,ws,ye,wt,As,At,Ss,xr,wr,ir,Is,un,Ft,Ar,dn,ca,ua,Sr,Ir,Ps,Es,Pr,ks,da,pa,ut,Er,dt,Ut,ma,ga,fa,_a,kr,Vt,pn,Ms,mn,Gt,Mr,jt,Tr;(ct={})[ct.None=0]="None",ct[ct.Anonymous=1]="Anonymous",ct[ct.NonConstant=2]="NonConstant",ct[ct.Xref=4]="Xref",ct[ct.XrefOverlay=8]="XrefOverlay",ct[ct.ExternallyDependent=16]="ExternallyDependent",ct[ct.ResolvedOrDependent=32]="ResolvedOrDependent",ct[ct.ReferencedXref=64]="ReferencedXref";(gs={})[gs.BYBLOCK=0]="BYBLOCK",gs[gs.BYLAYER=256]="BYLAYER";(Je={})[Je.Rotated=0]="Rotated",Je[Je.Aligned=1]="Aligned",Je[Je.Angular=2]="Angular",Je[Je.Diameter=3]="Diameter",Je[Je.Radius=4]="Radius",Je[Je.Angular3Point=5]="Angular3Point",Je[Je.Ordinate=6]="Ordinate",Je[Je.ReferenceIsExclusive=32]="ReferenceIsExclusive",Je[Je.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Je[Je.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(it={})[it.TopLeft=1]="TopLeft",it[it.TopCenter=2]="TopCenter",it[it.TopRight=3]="TopRight",it[it.MiddleLeft=4]="MiddleLeft",it[it.MiddleCenter=5]="MiddleCenter",it[it.MiddleRight=6]="MiddleRight",it[it.BottomLeft=7]="BottomLeft",it[it.BottomCenter=8]="BottomCenter",it[it.BottomRight=9]="BottomRight";(fs={})[fs.AtLeast=1]="AtLeast",fs[fs.Exact=2]="Exact";var dl=((nr={})[nr.Center=0]="Center",nr[nr.Above=1]="Above",nr[nr.Outside=2]="Outside",nr[nr.JIS=3]="JIS",nr[nr.Below=4]="Below",nr),Un=((xt={})[xt.Feet=0]="Feet",xt[xt.None=1]="None",xt[xt.Inch=2]="Inch",xt[xt.FeetAndInch=3]="FeetAndInch",xt[xt.Leading=4]="Leading",xt[xt.Trailing=8]="Trailing",xt[xt.LeadingAndTrailing=12]="LeadingAndTrailing",xt),Hu=((vr={})[vr.None=0]="None",vr[vr.Leading=1]="Leading",vr[vr.Trailing=2]="Trailing",vr[vr.LeadingAndTrailing=3]="LeadingAndTrailing",vr),Yu=((sr={})[sr.Center=0]="Center",sr[sr.Left=1]="Left",sr[sr.Right=2]="Right",sr[sr.OverFirst=3]="OverFirst",sr[sr.OverSecond=4]="OverSecond",sr),qu=((on={})[on.Bottom=0]="Bottom",on[on.Center=1]="Center",on[on.Top=2]="Top",on),Xu=((_s={})[_s.PatternFill=0]="PatternFill",_s[_s.SolidFill=1]="SolidFill",_s);(ys={})[ys.NonAssociative=0]="NonAssociative",ys[ys.Associative=1]="Associative";(ln={})[ln.Normal=0]="Normal",ln[ln.Outer=1]="Outer",ln[ln.Ignore=2]="Ignore";(hn={})[hn.UserDefined=0]="UserDefined",hn[hn.Predefined=1]="Predefined",hn[hn.Custom=2]="Custom";(vs={})[vs.NotAnnotated=0]="NotAnnotated",vs[vs.Annotated=1]="Annotated";(bs={})[bs.Solid=0]="Solid",bs[bs.Gradient=1]="Gradient";(xs={})[xs.TwoColor=0]="TwoColor",xs[xs.OneColor=1]="OneColor";var Ku=((Dt={})[Dt.Default=0]="Default",Dt[Dt.External=1]="External",Dt[Dt.Polyline=2]="Polyline",Dt[Dt.Derived=4]="Derived",Dt[Dt.Textbox=8]="Textbox",Dt[Dt.Outermost=16]="Outermost",Dt),Js=((br={})[br.Line=1]="Line",br[br.Circular=2]="Circular",br[br.Elliptic=3]="Elliptic",br[br.Spline=4]="Spline",br),$u=((qe={})[qe.Off=0]="Off",qe[qe.Solid=1]="Solid",qe[qe.Dashed=2]="Dashed",qe[qe.Dotted=3]="Dotted",qe[qe.ShotDash=4]="ShotDash",qe[qe.MediumDash=5]="MediumDash",qe[qe.LongDash=6]="LongDash",qe[qe.DoubleShortDash=7]="DoubleShortDash",qe[qe.DoubleMediumDash=8]="DoubleMediumDash",qe[qe.DoubleLongDash=9]="DoubleLongDash",qe[qe.DoubleMediumLongDash=10]="DoubleMediumLongDash",qe[qe.SparseDot=11]="SparseDot",qe);$u.Off;(cn={})[cn.Standard=-3]="Standard",cn[cn.ByLayer=-2]="ByLayer",cn[cn.ByBlock=-1]="ByBlock";(ws={})[ws.English=0]="English",ws[ws.Metric=1]="Metric";(ye={})[ye.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",ye[ye.FRONT_CLIPPING=2]="FRONT_CLIPPING",ye[ye.BACK_CLIPPING=4]="BACK_CLIPPING",ye[ye.UCS_FOLLOW=8]="UCS_FOLLOW",ye[ye.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",ye[ye.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",ye[ye.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",ye[ye.FAST_ZOOM=128]="FAST_ZOOM",ye[ye.SNAP_MODE=256]="SNAP_MODE",ye[ye.GRID_MODE=512]="GRID_MODE",ye[ye.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",ye[ye.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",ye[ye.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",ye[ye.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",ye[ye.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",ye[ye.UNUSED=32768]="UNUSED",ye[ye.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",ye[ye.VIEWPORT_OFF=131072]="VIEWPORT_OFF",ye[ye.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",ye[ye.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",ye[ye.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",ye[ye.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(wt={})[wt.OPTIMIZED_2D=0]="OPTIMIZED_2D",wt[wt.WIREFRAME=1]="WIREFRAME",wt[wt.HIDDEN_LINE=2]="HIDDEN_LINE",wt[wt.FLAT_SHADED=3]="FLAT_SHADED",wt[wt.GOURAUD_SHADED=4]="GOURAUD_SHADED",wt[wt.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",wt[wt.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(As={})[As.UCS_UNCHANGED=0]="UCS_UNCHANGED",As[As.HAS_OWN_UCS=1]="HAS_OWN_UCS";(At={})[At.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",At[At.TOP=1]="TOP",At[At.BOTTOM=2]="BOTTOM",At[At.FRONT=3]="FRONT",At[At.BACK=4]="BACK",At[At.LEFT=5]="LEFT",At[At.RIGHT=6]="RIGHT";(Ss={})[Ss.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ss[Ss.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(xr={})[xr.ByLayer=0]="ByLayer",xr[xr.ByBlock=1]="ByBlock",xr[xr.ByDictionaryDefault=2]="ByDictionaryDefault",xr[xr.ByObject=3]="ByObject";function Se(i,e,t){return i.code===e&&(t==null||i.value===t)}function Re(i){let e={};i.rewind();let t=i.next(),n=t.code;if(e.x=t.value,(t=i.next()).code!==n+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=i.next()).code!==n+20?i.rewind():e.z=t.value,e}let Qa=Symbol();function xe(i,e){return(t,n,o)=>{let h=function(b,f=!1){return b.reduce((w,x)=>{x.pushContext&&w.push({});let E=w[w.length-1];for(let M of typeof x.code=="number"?[x.code]:x.code){let L=E[M]??(E[M]=[]);x.isMultiple&&L.length&&f&&console.warn(`Snippet ${L[L.length-1].name} for code(${M}) is shadowed by ${x.name}`),L.push(x)}return w},[{}])}(i,n.debug),u=!1,g=h.length-1;for(;!Se(t,0,"EOF");){let b=function(F,D,de){return F.find((ve,oe)=>{var W;return oe>=de&&((W=ve[D])==null?void 0:W.length)})}(h,t.code,g),f=b==null?void 0:b[t.code],w=f==null?void 0:f[f.length-1];if(!b||!w){n.rewind();break}w.isMultiple||b[t.code].pop();let{name:x,parser:E,isMultiple:M,isReducible:L}=w,B=E==null?void 0:E(t,n,o);if(B===Qa){n.rewind();break}if(x){let[F,D]=function(de,ve){let oe=ve.split(".");if(!oe.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let W=de;for(let ce=0;ce<oe.length-1;++ce){let se=ya(oe[ce]),Ge=ya(oe[ce+1]);Object.prototype.hasOwnProperty.call(W,se)||(typeof Ge=="number"?W[se]=[]:W[se]={}),W=W[se]}return[W,ya(oe[oe.length-1])]}(o,x);M&&!L?(Object.prototype.hasOwnProperty.call(F,D)||(F[D]=[]),F[D].push(B)):F[D]=B}w.pushContext&&(g-=1),u=!0,t=n.next()}return e&&Object.setPrototypeOf(o,e),u}}function ya(i){let e=Number.parseInt(i);return Number.isNaN(e)?i:e}function v({value:i}){return i}function j(i,e){return Re(e)}function Fe({value:i}){return!!i}let Zu=[{code:1001,name:"xdata",parser:Nh}];function Nh(i,e){var o;if(!Se(i,1001))throw Error("XData must starts with code 1001");let t={appName:i.value,value:[]};i=e.next();let n=[t.value];for(;!Se(i,0,"EOF")&&i.code>=1e3;){let h=n[n.length-1];switch(i.code){case 1002:i.value==="{"?n.push([]):(n.pop(),(o=n[n.length-1])==null||o.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:Nr(i.code),value:i.value});break;case 1003:h.push({name:"layer",type:Nr(i.code),value:i.value});break;case 1005:h.push({name:"handle",type:Nr(i.code),value:i.value});break;case 1010:h.push({type:Nr(i.code),value:Re(e)});break;case 1011:h.push({name:"worldSpacePosition",type:Nr(i.code),value:Re(e)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:Nr(i.code),value:Re(e)});break;case 1013:h.push({name:"worldSpaceDirection",type:Nr(i.code),value:Re(e)});break;case 1041:h.push({name:"distance",type:Nr(i.code),value:i.value});break;case 1042:h.push({name:"scale",type:Nr(i.code),value:i.value})}i=e.next()}return e.rewind(),t}function Nr(i){switch(i){case 1e3:case 1003:case 1005:return"string";case 1004:return"hex";case 1040:case 1041:case 1042:return"real";case 1070:return"integer";case 1071:return"long";case 1010:case 1011:case 1012:case 1013:return"point";default:return""}}function xn(i,e,t){for(;Se(i,102);){var n;let o=i.value;if(i=e.next(),!o.startsWith("{")){e.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${o}`),function(u,g){for(;!Se(u,102)&&!Se(u,0,"EOF");)u=g.next()}(i,e),i=e.next();continue}let h=o.slice(1).trim();t.extensions??(t.extensions={}),(n=t.extensions)[h]??(n[h]=[]),function(u,g,b){for(;!Se(u,102,"}")&&!Se(u,0,"EOF");)b.push(u),u=g.next()}(i,e,t.extensions[h]),i=e.next()}e.rewind()}let Qu=0;function Ch(i){if(!i)throw TypeError("entity cannot be undefined or null");i.handle||(i.handle=Qu++)}var Ju=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function Lh(i){return Ju[i]}(wr={})[wr.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",wr[wr.CAST=1]="CAST",wr[wr.RECEIVE=2]="RECEIVE",wr[wr.IGNORE=3]="IGNORE";let Ve=[...Zu,{code:284,name:"shadowMode",parser:v},{code:390,name:"plotStyleHardId",parser:v},{code:380,name:"plotStyleType",parser:v},{code:440,name:"transparency",parser:v},{code:430,name:"colorName",parser:v},{code:420,name:"color",parser:v},{code:310,name:"proxyEntity",isMultiple:!0,parser:v},{code:92,name:"proxyByte",parser:v},{code:60,name:"isVisible",parser:Fe},{code:48,name:"lineTypeScale",parser:v},{code:370,name:"lineweight",parser:v},{code:62,name:"colorIndex",parser(i,e,t){let n=i.value;return n>0&&n<256&&(t.color=Lh(Math.abs(n))),n}},{code:347,name:"materialObjectHardId",parser:v},{code:6,name:"lineType",parser:v},{code:8,name:"layer",parser:v},{code:410,name:"layoutTabName",parser:v},{code:67,name:"isInPaperSpace",parser:Fe},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:v},{code:102,parser:xn},{code:102,parser:xn},{code:102,parser:xn},{code:5,name:"handle",parser:v}];function Xi(i){return[{code:3,name:i,parser:(e,t,n)=>(n._code3text=(n._code3text??"")+e.value,n._code3text+(n._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:i,parser:(e,t,n)=>(n._code1text=e.value,(n._code3text??"")+n._code1text)}]}function Oh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let ed={extrusionDirection:{x:0,y:0,z:1}},td=[{code:210,name:"extrusionDirection",parser:j},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:100,name:"subclassMarker",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:j},{code:39,name:"thickness",parser:v},{code:100},...Ve];class Bh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Oh(this,"parser",xe(td,ed))}}Oh(Bh,"ForEntityName","ARC");(ir={})[ir.NONE=0]="NONE",ir[ir.INVISIBLE=1]="INVISIBLE",ir[ir.CONSTANT=2]="CONSTANT",ir[ir.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",ir[ir.PRESET=8]="PRESET";(Is={})[Is.MULTILINE=2]="MULTILINE",Is[Is.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(un={})[un.NONE=0]="NONE",un[un.MIRRORED_X=2]="MIRRORED_X",un[un.MIRRORED_Y=4]="MIRRORED_Y";var rd=((Ft={})[Ft.LEFT=0]="LEFT",Ft[Ft.CENTER=1]="CENTER",Ft[Ft.RIGHT=2]="RIGHT",Ft[Ft.ALIGNED=3]="ALIGNED",Ft[Ft.MIDDLE=4]="MIDDLE",Ft[Ft.FIT=5]="FIT",Ft),nd=((Ar={})[Ar.BASELINE=0]="BASELINE",Ar[Ar.BOTTOM=1]="BOTTOM",Ar[Ar.MIDDLE=2]="MIDDLE",Ar[Ar.TOP=3]="TOP",Ar);function zh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Rh={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:rd.LEFT,valign:nd.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Dh=[{code:73,name:"valign",parser:v},{code:100},{code:210,name:"extrusionDirection",parser:j},{code:11,name:"endPoint",parser:j},{code:72,name:"valign",parser:v},{code:72,name:"halign",parser:v},{code:71,name:"generationFlag",parser:v},{code:7,name:"styleName",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"xScale",parser:v},{code:50,name:"rotation",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:j},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class Fh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){zh(this,"parser",xe(Dh,Rh))}}function Uh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}zh(Fh,"ForEntityName","TEXT");let sd={...Rh},id=[{code:2},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:j},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Fe},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedRecord",parser:Fe},{code:100},{code:280,name:"isLocked",parser:Fe},{code:74,name:"valign",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:3,name:"prompt",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},...Dh.slice(2)];class Vh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Uh(this,"parser",xe(id,sd))}}Uh(Vh,"ForEntityName","ATTDEF");(dn={})[dn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",dn[dn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",dn[dn.BY_STYLE=5]="BY_STYLE";function ad(i,e){let t={};for(let n of i){let o=e(n);o!=null&&(t[o]??(t[o]=[]),t[o].push(n))}return t}function*Oi(i,e=1/0,t=1){for(let n=i;n!==e;n+=t)yield n}function Yr(i){return{x:i.x??0,y:i.y??0,z:i.z??0}}function Ja(i,e,t){if(Se(e,102))return xn(e,t,i),!0;switch(e.code){case 0:i.type=e.value;break;case 5:i.handle=e.value;break;case 330:i.ownerBlockRecordSoftId=e.value;break;case 67:i.isInPaperSpace=!!e.value;break;case 8:i.layer=e.value;break;case 6:i.lineType=e.value;break;case 347:i.materialObjectHardId=e.value;break;case 62:i.colorIndex=e.value,i.color=Lh(Math.abs(e.value));break;case 370:i.lineweight=e.value;break;case 48:i.lineTypeScale=e.value;break;case 60:i.isVisible=!!e.value;break;case 92:i.proxyByte=e.value;break;case 310:i.proxyEntity=e.value;break;case 100:break;case 420:i.color=e.value;break;case 430:i.transparency=e.value;break;case 390:i.plotStyleHardId=e.value;break;case 284:i.shadowMode=e.value;break;case 1001:i.xdata=Nh(e,t);break;default:return!1}return!0}function Gh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let od={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},ni=[{code:46,name:"annotationHeight",parser:v},{code:101,parser(i,e){(function(t){t.rewind();let n=t.next();if(n.code!==101)throw Error("Bad call for skipEmbeddedObject()");do n=t.next();while(n.code!==0);t.rewind()})(e)}},{code:50,name:"columnHeight",parser:v},{code:49,name:"columnGutter",parser:v},{code:48,name:"columnWidth",parser:v},{code:79,name:"columnAutoHeight",parser:v},{code:78,name:"columnFlowReversed",parser:v},{code:76,name:"columnCount",parser:v},{code:75,name:"columnType",parser:v},{code:441,name:"backgroundFillTransparency",parser:v},{code:63,name:"backgroundFillColor",parser:v},{code:45,name:"fillBoxScale",parser:v},{code:[...Oi(430,440)],name:"backgroundColor",parser:v},{code:[...Oi(420,430)],name:"backgroundColor",parser:v},{code:90,name:"backgroundFill",parser:v},{code:44,name:"lineSpacing",parser:v},{code:73,name:"lineSpacingStyle",parser:v},{code:50,name:"rotation",parser:v},{code:43},{code:42},{code:11,name:"direction",parser:j},{code:210,name:"extrusionDirection",parser:j},{code:7,name:"styleName",parser:v},...Xi("text"),{code:72,name:"drawingDirection",parser:v},{code:71,name:"attachmentPoint",parser:v},{code:41,name:"width",parser:v},{code:40,name:"height",parser:v},{code:10,name:"insertionPoint",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class jh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Gh(this,"parser",xe(ni,od))}}function Wh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Gh(jh,"ForEntityName","MTEXT");let ld={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},hd=[...ni.slice(ni.findIndex(({name:i})=>i==="columnType"),ni.findIndex(({name:i})=>i==="subclassMarker")+1),{code:100},{code:0,parser(i){if(!Se(i,0,"MTEXT"))return Qa}},{code:2,name:"definitionTag",parser:v},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:j},{code:340,name:"secondaryAttributesHardId",parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Fe},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedEntriesKeep",parser:Fe},{code:100},{code:280,name:"lockPositionFlag",parser:Fe},{code:210,name:"extrusionDirection",parser:j},{code:11,name:"alignmentPoint",parser:j},{code:74,name:"verticalJustification",parser:v},{code:72,name:"horizontalJustification",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:7,name:"textStyle",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"scale",parser:v},{code:50,name:"rotation",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:j},{code:39,name:"thickness",parser:v},{code:100},...Ve];class Hh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Wh(this,"parser",xe(hd,ld))}}function Yh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Wh(Hh,"ForEntityName","ATTRIB");let cd=[...Xi("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class qh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Yh(this,"parser",xe(cd))}}function Xh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Yh(qh,"ForEntityName","BODY");let ud={thickness:0,extrusionDirection:{x:0,y:0,z:1}},dd=[{code:210,name:"extrusionDirection",parser:j},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:j},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class Kh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Xh(this,"parser",xe(dd,ud))}}Xh(Kh,"ForEntityName","CIRCLE");class si{parseEntity(e,t){let n={};for(;!Se(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(o,h,u){switch(h.code){case 100:o.subclassMarker=h.value;break;case 280:o.version=h.value;break;case 2:o.name=h.value;break;case 10:o.definitionPoint=Re(u);break;case 11:o.textPoint=Re(u);break;case 12:o.insertionPoint=Re(u);break;case 13:o.subDefinitionPoint1=Re(u);break;case 14:o.subDefinitionPoint2=Re(u);break;case 15:o.centerPoint=Re(u);break;case 16:o.arcPoint=Re(u);break;case 70:o.dimensionType=h.value;break;case 71:o.attachmentPoint=h.value;break;case 72:o.textLineSpacingStyle=h.value;break;case 40:o.leaderLength=h.value;break;case 41:o.textLineSpacingFactor=h.value;break;case 42:o.measurement=h.value;break;case 1:o.text=h.value;break;case 50:o.rotationAngle=h.value;break;case 52:o.obliqueAngle=h.value;break;case 53:o.textRotation=h.value;break;case 51:o.ocsRotation=h.value;break;case 210:o.extrusionDirection=Re(u);break;case 3:o.styleName=h.value;break;default:Ja(o,h,u)}})(n,t,e),t=e.next()}return n}}function $h(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ua="DIMENSION",(ca="ForEntityName")in si?Object.defineProperty(si,ca,{value:ua,enumerable:!0,configurable:!0,writable:!0}):si[ca]=ua;let pd={extrusionDirection:{x:0,y:0,z:1}},md=[{code:42,name:"endAngle",parser:v},{code:41,name:"startAngle",parser:v},{code:40,name:"axisRatio",parser:v},{code:210,name:"extrusionDirection",parser:j},{code:11,name:"majorAxisEndPoint",parser:j},{code:10,name:"center",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class Zh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){$h(this,"parser",xe(md,pd))}}$h(Zh,"ForEntityName","ELLIPSE");(Sr={})[Sr.First=1]="First",Sr[Sr.Second=2]="Second",Sr[Sr.Third=4]="Third",Sr[Sr.Fourth=8]="Fourth";function Qh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let gd=[{code:13,name:"vertices.3",parser:j},{code:12,name:"vertices.2",parser:j},{code:11,name:"vertices.1",parser:j},{code:10,name:"vertices.0",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class Jh{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Qh(this,"parser",xe(gd))}}Qh(Jh,"ForEntityName","3DFACE");let ec=[{code:330,name:"sourceBoundaryObjects",parser:v,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:v}],fd=[{code:11,name:"end",parser:j},{code:10,name:"start",parser:j}],_d=[{code:73,name:"isCCW",parser:Fe},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:j}],yd=[{code:73,name:"isCCW",parser:Fe},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"lengthOfMinorAxis",parser:v},{code:11,name:"end",parser:j},{code:10,name:"center",parser:j}],vd=[{code:13,name:"endTangent",parser:j},{code:12,name:"startTangent",parser:j},{code:11,name:"fitDatum",isMultiple:!0,parser:j},{code:97,name:"numberOfFitData",parser:v},{code:10,name:"controlPoints",isMultiple:!0,parser(i,e){let t={...Re(e),weight:1};return(i=e.next()).code===42?t.weight=i.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:v},{code:96,name:"numberOfControlPoints",parser:v},{code:95,name:"numberOfKnots",parser:v},{code:74,name:"isPeriodic",parser:Fe},{code:73,name:"splineFlag",parser:v},{code:94,name:"degree",parser:v}],bd={[Js.Line]:fd,[Js.Circular]:_d,[Js.Elliptic]:yd,[Js.Spline]:vd},xd=[...ec,{code:72,name:"edges",parser(i,e){let t={type:i.value},n=xe(bd[t.type]);if(!n)throw Error(`Invalid edge type ${t.type}`);return n(i=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:v}],wd=[...ec,{code:10,name:"vertices",parser(i,e){let t={...Re(e),bulge:0};return(i=e.next()).code===42?t.bulge=i.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:v},{code:73,name:"isClosed",parser:Fe},{code:72,name:"hasBulge",parser:Fe}],Ad=[{code:49,name:"dashLengths",parser:v,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:v},{code:45,name:"offset",parser:pl},{code:43,name:"base",parser:pl},{code:53,name:"angle",parser:v}];function pl(i,e){let t=i.code+1,n={x:i.value,y:1};return(i=e.next()).code===t?n.y=i.value:e.rewind(),n}function tc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Sd={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Id=[{code:470},{code:463},{code:462,name:"colorTint",parser:v},{code:461,name:"gradientDefinition",parser:v},{code:460,name:"gradientRotation",parser:v},{code:453,name:"numberOfColors",parser:v},{code:452,name:"gradientColorFlag",parser:v},{code:451},{code:450,name:"gradientFlag",parser:v},{code:10,name:"seedPoints",parser:j,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:j},{code:98,name:"numberOfSeedPoints",parser:v},{code:47,name:"pixelSize",parser:v},{code:53,name:"definitionLines",parser:function(i,e){let t={};return xe(Ad)(i,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:v},{code:77,name:"isDouble",parser:Fe},{code:73,name:"isAnnotated",parser:Fe},{code:41,name:"patternScale",parser:v},{code:52,name:"patternAngle",parser:v},{code:76,name:"patternType",parser:v},{code:75,name:"hatchStyle",parser:v},{code:92,name:"boundaryPaths",parser:function(i,e){let t={boundaryPathTypeFlag:i.value},n=t.boundaryPathTypeFlag&Ku.Polyline;return i=e.next(),n?xe(wd)(i,e,t):xe(xd)(i,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:v},{code:71,name:"associativity",parser:v},{code:63,name:"patternFillColor",parser:v},{code:70,name:"solidFill",parser:v},{code:2,name:"patternName",parser:v},{code:210,name:"extrusionDirection",parser:j},{code:10,name:"elevationPoint",parser:j},{code:100,name:"subclassMarker",parser:v,pushContext:!0},...Ve];class rc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){tc(this,"parser",xe(Id,Sd))}}tc(rc,"ForEntityName","HATCH");(Ir={})[Ir.ShowImage=1]="ShowImage",Ir[Ir.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Ir[Ir.UseClippingBoundary=4]="UseClippingBoundary",Ir[Ir.TransparencyIsOn=8]="TransparencyIsOn";(Ps={})[Ps.Rectangular=1]="Rectangular",Ps[Ps.Polygonal=2]="Polygonal";(Es={})[Es.Outside=0]="Outside",Es[Es.Inside=1]="Inside";function nc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Pd={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Ed=[{code:290,name:"clipMode",parser:v},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:j},{code:91,name:"countBoundaryPoints",parser:v},{code:71,name:"clippingBoundaryType",parser:v},{code:360,name:"imageDefReactorHandle",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipped",parser:Fe},{code:70,name:"flags",parser:v},{code:340,name:"imageDefHandle",parser:v},{code:13,name:"imageSize",parser:j},{code:12,name:"vPixel",parser:j},{code:11,name:"uPixel",parser:j},{code:10,name:"position",parser:j},{code:90,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class sc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){nc(this,"parser",xe(Ed,Pd))}}function ic(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}nc(sc,"ForEntityName","IMAGE");let kd={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Md=[{code:210,name:"extrusionDirection",parser:j},{code:45,name:"rowSpacing",parser:v},{code:44,name:"columnSpacing",parser:v},{code:71,name:"rowCount",parser:v},{code:70,name:"columnCount",parser:v},{code:50,name:"rotation",parser:v},{code:43,name:"zScale",parser:v},{code:42,name:"yScale",parser:v},{code:41,name:"xScale",parser:v},{code:10,name:"insertionPoint",parser:j},{code:2,name:"name",parser:v},{code:66,name:"isVariableAttributes",parser:Fe},{code:100,name:"subclassMarker",parser:v},...Ve];class ac{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){ic(this,"parser",xe(Md,kd))}}function oc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ic(ac,"ForEntityName","INSERT");let Td={isArrowheadEnabled:!0},Nd=[{code:213,name:"offsetFromAnnotation",parser:j},{code:212,name:"offsetFromBlock",parser:j},{code:211,name:"horizontalDirection",parser:j},{code:210,name:"normal",parser:j},{code:340,name:"associatedAnnotation",parser:v},{code:77,name:"byBlockColor",parser:v},{code:10,name:"vertices",parser:j,isMultiple:!0},{code:76,name:"numberOfVertices",parser:v},{code:41,name:"textWidth",parser:v},{code:40,name:"textHeight",parser:v},{code:75,name:"isHooklineExists",parser:Fe},{code:74,name:"isHooklineSameDirection",parser:Fe},{code:73,name:"leaderCreationFlag",parser:v},{code:72,name:"isSpline",parser:Fe},{code:71,name:"isArrowheadEnabled",parser:Fe},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class lc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){oc(this,"parser",xe(Nd,Td))}}oc(lc,"ForEntityName","LEADER");(Pr={})[Pr.TextAnnotation=0]="TextAnnotation",Pr[Pr.ToleranceAnnotation=1]="ToleranceAnnotation",Pr[Pr.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Pr[Pr.NoAnnotation=3]="NoAnnotation";function hc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Cd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ld=[{code:210,name:"extrusionDirection",parser:j},{code:11,name:"endPoint",parser:j},{code:10,name:"startPoint",parser:j},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class cc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){hc(this,"parser",xe(Ld,Cd))}}hc(cc,"ForEntityName","LINE");(ks={})[ks.IS_CLOSED=1]="IS_CLOSED",ks[ks.PLINE_GEN=128]="PLINE_GEN";let Od={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Bd={bulge:0},zd=[{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:91,name:"id",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v}],Rd=[{code:210,name:"extrusionDirection",parser:j},{code:10,name:"vertices",isMultiple:!0,parser(i,e){let t={};return xe(zd,Bd)(i,e,t),t}},{code:39,name:"thickness",parser:v},{code:38,name:"elevation",parser:v},{code:43,name:"constantWidth",parser:v},{code:70,name:"flag",parser:v},{code:90,name:"numberOfVertices",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class ii{parseEntity(e,t){let n={};return xe(Rd,Od)(t,e,n),n}}function uc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}pa="LWPOLYLINE",(da="ForEntityName")in ii?Object.defineProperty(ii,da,{value:pa,enumerable:!0,configurable:!0,writable:!0}):ii[da]=pa;let Dd=[{code:90,name:"overridenSubEntityCount",parser:v},{code:140,name:"edgeCreaseWeights",parser:v,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:v},{code:94,parser(i,e,t){t.edgeCount=i.value,t.edgeIndices=[];for(let n=0;n<t.edgeCount;++n){let o=[];i=e.next(),o[0]=i.value,i=e.next(),o[1]=i.value,t.edgeIndices.push(o)}}},{code:93,parser(i,e,t){t.totalFaceIndices=i.value,t.faceIndices=[];let n=[];for(let h=0;h<t.totalFaceIndices&&!Se(i,0);++h)i=e.next(),n.push(i.value);let o=0;for(;o<n.length;){let h=n[o++],u=[];for(let g=0;g<h;++g)u.push(n[o++]);t.faceIndices.push(u)}}},{code:10,name:"vertices",parser:j,isMultiple:!0},{code:92,name:"verticesCount",parser:v},{code:91,name:"subdivisionLevel",parser:v},{code:40,name:"blendCrease",parser:v},{code:72,name:"isBlendCreased",parser:Fe},{code:71,name:"version",parser:v},{code:100,name:"subclassMarker",parser:function({value:i}){return i.trim()},pushContext:!0},...Ve];class dc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){uc(this,"parser",xe(Dd))}}function pc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}uc(dc,"ForEntityName","MESH");let Fd={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Ud=[{code:50,name:"angle",parser:v},{code:210,name:"extrusionDirection",parser:j},{code:39,name:"thickness",parser:v},{code:10,name:"position",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class mc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){pc(this,"parser",xe(Ud,Fd))}}pc(mc,"ForEntityName","POINT");(ut={})[ut.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",ut[ut.CURVE_FIT=2]="CURVE_FIT",ut[ut.SPLINE_FIT=4]="SPLINE_FIT",ut[ut.POLYLINE_3D=8]="POLYLINE_3D",ut[ut.POLYGON_3D=16]="POLYGON_3D",ut[ut.CLOSED_POLYGON=32]="CLOSED_POLYGON",ut[ut.POLYFACE=64]="POLYFACE",ut[ut.CONTINUOUS=128]="CONTINUOUS";var ei=((Er={})[Er.NONE=0]="NONE",Er[Er.QUADRATIC=5]="QUADRATIC",Er[Er.CUBIC=6]="CUBIC",Er[Er.BEZIER=8]="BEZIER",Er),Vd=((dt={})[dt.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",dt[dt.TANGENT_DEFINED=2]="TANGENT_DEFINED",dt[dt.NOT_USED=4]="NOT_USED",dt[dt.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",dt[dt.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",dt[dt.FOR_POLYLINE=32]="FOR_POLYLINE",dt[dt.FOR_POLYGON=64]="FOR_POLYGON",dt[dt.POLYFACE=128]="POLYFACE",dt);function gc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Gd={startWidth:0,endWidth:0,bulge:0},jd=[{code:91,name:"id",parser:v},{code:[...Oi(71,75)],name:"faces",isMultiple:!0,parser:v},{code:50,name:"tangentDirection",parser:v},{code:70,name:"flag",parser:v},{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:30,name:"z",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...Ve];class eo{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){gc(this,"parser",xe(jd,Gd))}}function fc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}gc(eo,"ForEntityName","VERTEX");let Wd={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Hd=[{code:0,name:"vertices",isMultiple:!0,parser:(i,e)=>Se(i,0,"VERTEX")?(i=e.next(),new eo().parseEntity(e,i)):Qa},{code:210,name:"extrusionDirection",parser:j},{code:75,name:"smoothType",parser:v},{code:74,name:"surfaceNDensity",parser:v},{code:73,name:"surfaceMDensity",parser:v},{code:72,name:"meshNVertexCount",parser:v},{code:71,name:"meshMVertexCount",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:70,name:"flag",parser:v},{code:39,name:"thickness",parser:v},{code:30,name:"elevation",parser:v},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:v},...Ve];class _c{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){fc(this,"parser",xe(Hd,Wd))}}function yc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}fc(_c,"ForEntityName","POLYLINE");let Yd=[{code:11,name:"direction",parser:j},{code:10,name:"position",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class vc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){yc(this,"parser",xe(Yd))}}function bc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}yc(vc,"ForEntityName","RAY");let qd=[...Xi("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class xc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){bc(this,"parser",xe(qd))}}function wc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}bc(xc,"ForEntityName","REGION");let Xd={vertices:[],backLineVertices:[]},Kd=[{code:360,name:"geometrySettingHardId",parser:v},{code:12,name:"backLineVertices",isMultiple:!0,parser:j},{code:93,name:"numberOfBackLineVertices",parser:v},{code:11,name:"vertices",isMultiple:!0,parser:j},{code:92,name:"verticesCount",parser:v},{code:[63,411],name:"indicatorColor",parser:v},{code:70,name:"indicatorTransparency",parser:v},{code:41,name:"bottomHeight",parser:v},{code:40,name:"topHeight",parser:v},{code:10,name:"verticalDirection",parser:j},{code:1,name:"name",parser:v},{code:91,name:"flag",parser:v},{code:90,name:"state",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class Ac{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){wc(this,"parser",xe(Kd,Xd))}}function Sc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}wc(Ac,"ForEntityName","SECTION");let $d={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Zd=[{code:210,name:"extrusionDirection",parser:j},{code:39,name:"thickness",parser:v},{code:[...Oi(10,14)],name:"points",isMultiple:!0,parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class Ic{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Sc(this,"parser",xe(Zd,$d))}}function Pc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Sc(Ic,"ForEntityName","SOLID");let Qd=[{code:350,name:"historyObjectSoftId",parser:v},{code:100,name:"subclassMarker",parser:v},...Xi("data"),{code:70,name:"version",parser:v},{code:100},...Ve];class Ec{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Pc(this,"parser",xe(Qd))}}Pc(Ec,"ForEntityName","3DSOLID");(Ut={})[Ut.NONE=0]="NONE",Ut[Ut.CLOSED=1]="CLOSED",Ut[Ut.PERIODIC=2]="PERIODIC",Ut[Ut.RATIONAL=4]="RATIONAL",Ut[Ut.PLANAR=8]="PLANAR",Ut[Ut.LINEAR=16]="LINEAR";function kc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Jd={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},e0=[{code:11,name:"fitPoints",isMultiple:!0,parser:j},{code:10,name:"controlPoints",isMultiple:!0,parser:j},{code:41,name:"weights",isMultiple:!0,parser:v},{code:40,name:"knots",isMultiple:!0,parser:v},{code:13,name:"endTangent",parser:j},{code:12,name:"startTangent",parser:j},{code:44,name:"fitTolerance",parser:v},{code:43,name:"controlTolerance",parser:v},{code:42,name:"knotTolerance",parser:v},{code:74,name:"numberOfFitPoints",parser:v},{code:73,name:"numberOfControlPoints",parser:v},{code:72,name:"numberOfKnots",parser:v},{code:71,name:"degree",parser:v},{code:70,name:"flag",parser:v},{code:210,name:"normal",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class Mc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){kc(this,"parser",xe(e0,Jd))}}kc(Mc,"ForEntityName","SPLINE");class ai{parseEntity(e,t){let n={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:n.subclassMarker=t.value,t=e.next();break;case 2:n.name=t.value,t=e.next();break;case 5:n.handle=t.value,t=e.next();break;case 10:n.startPoint=Yr(Re(e)),t=e.lastReadGroup;break;case 11:n.directionVector=Yr(Re(e)),t=e.lastReadGroup;break;case 90:n.tableValue=t.value,t=e.next();break;case 91:n.rowCount=t.value,t=e.next();break;case 92:n.columnCount=t.value,t=e.next();break;case 93:n.overrideFlag=t.value,t=e.next();break;case 94:n.borderColorOverrideFlag=t.value,t=e.next();break;case 95:n.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:n.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:n.rowHeightArr??(n.rowHeightArr=[]),n.rowHeightArr.push(t.value),t=e.next();break;case 142:n.columnWidthArr??(n.columnWidthArr=[]),n.columnWidthArr.push(t.value),t=e.next();break;case 280:n.version=t.value,t=e.next();break;case 310:n.bmpPreview??(n.bmpPreview=""),n.bmpPreview+=t.value,t=e.next();break;case 330:n.ownerDictionaryId=t.value,t=e.next();break;case 342:n.tableStyleId=t.value,t=e.next();break;case 343:n.blockRecordHandle=t.value,t=e.next();break;case 170:n.attachmentPoint=t.value,t=e.next();break;case 171:n.cells??(n.cells=[]),n.cells.push(function(o,h){let u=!1,g=!1,b={};for(;!o.isEOF()&&h.code!==0&&!g;)switch(h.code){case 171:if(u){g=!0;continue}b.cellType=h.value,u=!0,h=o.next();break;case 172:b.flagValue=h.value,h=o.next();break;case 173:b.mergedValue=h.value,h=o.next();break;case 174:b.autoFit=h.value,h=o.next();break;case 175:b.borderWidth=h.value,h=o.next();break;case 176:b.borderHeight=h.value,h=o.next();break;case 91:b.overrideFlag=h.value,h=o.next();break;case 178:b.virtualEdgeFlag=h.value,h=o.next();break;case 145:b.rotation=h.value,h=o.next();break;case 345:b.fieldObjetId=h.value,h=o.next();break;case 340:b.blockTableRecordId=h.value,h=o.next();break;case 146:b.blockScale=h.value,h=o.next();break;case 177:b.blockAttrNum=h.value,h=o.next();break;case 7:b.textStyle=h.value,h=o.next();break;case 140:b.textHeight=h.value,h=o.next();break;case 170:b.attachmentPoint=h.value,h=o.next();break;case 92:b.extendedCellFlags=h.value,h=o.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=o.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=o.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=o.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=o.next();break;case 301:(function(f,w,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=w.next();break;case 1:f.text=x.value,x=w.next();break;case 300:f.attrText=x.value,x=w.next();break;case 302:f.text=x.value?x.value:f.text,x=w.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=w.next()}})(b,o,h),h=o.next();break;default:return b}return u=!1,g=!1,b}(e,t)),t=e.lastReadGroup;break;default:Ja(n,t,e),t=e.next()}}return n}}function Tc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ga="ACAD_TABLE",(ma="ForEntityName")in ai?Object.defineProperty(ai,ma,{value:ga,enumerable:!0,configurable:!0,writable:!0}):ai[ma]=ga;let t0=[{code:11,name:"xAxisDirection",parser:j},{code:210,name:"extrusionDirection",parser:j},{code:1,name:"text",parser:v},{code:10,name:"position",parser:j},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class Nc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Tc(this,"parser",xe(t0))}}Tc(Nc,"ForEntityName","TOLERANCE");class oi{parseEntity(e,t){let n={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(o,h,u){if(u==="EOF")return!1;switch(u.code){case 0:return!1;case 8:o.layer=u.value;break;case 100:o.subclassMarker=u.value;break;case 10:o.viewportCenter=Yr(Re(h));break;case 40:o.width=u.value;break;case 41:o.height=u.value;break;case 68:o.status=u.value;break;case 69:o.viewportId=u.value;break;case 12:o.displayCenter=Re(h);break;case 13:o.snapBase=Re(h);break;case 14:o.snapSpacing=Re(h);break;case 15:o.gridSpacing=Re(h);break;case 16:o.viewDirection=Yr(Re(h));break;case 17:o.targetPoint=Yr(Re(h));break;case 42:o.perspectiveLensLength=u.value;break;case 43:o.frontClipZ=u.value;break;case 44:o.backClipZ=u.value;break;case 45:o.viewHeight=u.value;break;case 50:o.snapAngle=u.value;break;case 51:o.viewTwistAngle=u.value;break;case 72:o.circleZoomPercent=u.value;break;case 331:o.frozenLayerIds??(o.frozenLayerIds=[]),o.frozenLayerIds.push(u.value);break;case 90:o.statusBitFlags=u.value;break;case 340:o.clippingBoundaryId=u.value;break;case 1:o.sheetName=u.value;break;case 281:o.renderMode=u.value;break;case 71:o.ucsPerViewport=u.value;break;case 110:o.ucsOrigin=Yr(Re(h));break;case 111:o.ucsXAxis=Yr(Re(h));break;case 112:o.ucsYAxis=Yr(Re(h));break;case 345:o.ucsId=u.value;break;case 346:o.ucsBaseId=u.value;break;case 79:o.orthographicType=u.value;break;case 146:o.elevation=u.value;break;case 170:o.shadePlotMode=u.value;break;case 61:o.majorGridFrequency=u.value;break;case 332:o.backgroundId=u.value;break;case 333:o.shadePlotId=u.value;break;case 348:o.visualStyleId=u.value;break;case 292:o.isDefaultLighting=!!u.value;break;case 282:o.defaultLightingType=u.value;break;case 141:o.brightness=u.value;break;case 142:o.contrast=u.value;break;case 63:case 421:case 431:o.ambientLightColor=u.value;break;case 361:o.sunId=u.value;break;case 335:case 343:case 344:case 91:o.softPointer=u.value}return!0}(n,e,t)&&Ja(n,t,e),t=e.next()}return n}}_a="VIEWPORT",(fa="ForEntityName")in oi?Object.defineProperty(oi,fa,{value:_a,enumerable:!0,configurable:!0,writable:!0}):oi[fa]=_a;(kr={})[kr.ShowImage=1]="ShowImage",kr[kr.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",kr[kr.UseClippingBoundary=4]="UseClippingBoundary",kr[kr.Transparency=8]="Transparency";function Cc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let r0={brightness:50,constrast:50,fade:0},n0=[{code:14,name:"boundary",isMultiple:!0,parser:j},{code:91,name:"numberOfVertices",parser:v},{code:71,name:"boundaryType",parser:v},{code:360,name:"imageDefReactorHardId",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipping",parser:Fe},{code:70,name:"displayFlag",parser:v},{code:340,name:"imageDefHardId",parser:v},{code:13,name:"imageSize",parser:j},{code:12,name:"vDirection",parser:j},{code:11,name:"uDirection",parser:j},{code:10,name:"position",parser:j},{code:90,name:"classVersion",parser:v},{code:100,name:"subclassMarker",parser:v},...Ve];class Lc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Cc(this,"parser",xe(n0,r0))}}function Oc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Cc(Lc,"ForEntityName","WIPEOUT");let s0=[{code:11,name:"direction",parser:j},{code:10,name:"position",parser:j},{code:100,name:"subclassMarker",parser:v},...Ve];class Bc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){Oc(this,"parser",xe(s0))}}function zc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Oc(Bc,"ForEntityName","XLINE");let i0={},a0=[{code:170,name:"multileaderType",parser:v},{code:291,name:"doglegEnabled",parser:Fe},{code:40,name:"doglegLength",parser:v},{code:172,name:"contentType",parser:v},{code:3,name:"textContent",parser:v},{code:12,name:"textAnchor",parser:j},{code:344,name:"blockHandle",parser:v},{code:15,name:"blockPosition",parser:j},{code:302,name:"leaderSections",parser:function(i,e,t){let n,o={leaderLines:[]};for(;e.hasNext()&&(n=e.next()).code!==303;)switch(n.code){case 10:o.landingPoint=(n.value,Re(e));break;case 11:o.doglegVector=(n.value,Re(e));break;case 40:o.doglegLength=n.value;break;case 304:o.leaderLines.push(function(h,u,g){let b,f={vertices:[]};for(;u.hasNext()&&(b=u.next()).code!==305;)b.code===10&&f.vertices.push((b.value,Re(u)));return f}(0,e))}return o},isMultiple:!0},...Ve];class Rc{parseEntity(e,t){let n={};return this.parser(t,e,n),n}constructor(){zc(this,"parser",xe(a0,i0))}}zc(Rc,"ForEntityName","MULTILEADER");let o0=Object.fromEntries([Bh,Vh,Hh,qh,Kh,si,Zh,Jh,sc,ac,lc,cc,ii,dc,jh,Rc,mc,_c,vc,xc,Ac,Ic,Ec,Mc,ai,Fh,Nc,rc,eo,oi,Lc,Bc].map(i=>[i.ForEntityName,new i]));function Dc(i,e){let t=[];for(;!Se(i,0,"EOF");){if(i.code===0){if(i.value==="ENDBLK"||i.value==="ENDSEC"){e.rewind();break}let n=o0[i.value];if(n){let o=i.value;i=e.next();let h=n.parseEntity(e,i);h.type=o,Ch(h),t.push(h)}else e.debug&&console.warn(`Unsupported ENTITY type: ${i.value}`)}i=e.next()}return t}function l0(i,e){let t={};for(;!Se(i,0,"EOF")&&!Se(i,0,"ENDSEC");){if(Se(i,0,"BLOCK")){let n=h0(i=e.next(),e);Ch(n),n.name&&(t[n.name]=n)}i=e.next()}return t}function h0(i,e){let t={};for(;!Se(i,0,"EOF");){if(Se(i,0,"ENDBLK")){for(i=e.next();!Se(i,0,"EOF");){if(Se(i,100,"AcDbBlockEnd"))return t;i=e.next()}break}switch(i.code){case 1:t.xrefPath=i.value;break;case 2:t.name=i.value;break;case 3:t.name2=i.value;break;case 5:t.handle=i.value;break;case 8:t.layer=i.value;break;case 10:t.position=Re(e);break;case 67:t.paperSpace=!!i.value&&i.value==1;break;case 70:i.value!==0&&(t.type=i.value);break;case 100:break;case 330:t.ownerHandle=i.value;break;case 0:t.entities=Dc(i,e)}i=e.next()}return t}function c0(i,e){let t=null,n={};for(;!Se(i,0,"EOF")&&!Se(i,0,"ENDSEC");)i.code===9?t=i.value:i.code===10?n[t]=Re(e):n[t]=i.value,i=e.next();return n}(Vt={})[Vt.NOT_APPLICABLE=0]="NOT_APPLICABLE",Vt[Vt.KEEP_EXISTING=1]="KEEP_EXISTING",Vt[Vt.USE_CLONE=2]="USE_CLONE",Vt[Vt.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Vt[Vt.VALUE_NAME=4]="VALUE_NAME",Vt[Vt.UNMANGLE_NAME=5]="UNMANGLE_NAME";let to=[{code:330,name:"ownerObjectId",parser:v},{code:102,parser:xn},{code:102,parser:xn},{code:102,parser:xn},{code:5,name:"handle",parser:v}],u0=[{code:3,name:"entries",parser:(i,e)=>{let t={name:i.value};return(i=e.next()).code===350?t.objectSoftId=i.value:i.code===360?t.objectHardId=i.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:v},{code:280,name:"isHardOwned",parser:Fe},{code:100,name:"subclassMarker",parser:v},...to],d0=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:v},{code:90,name:"version",parser:v},{code:1,name:"fileName",parser:v},{code:10,name:"size",parser:j},{code:11,name:"sizeOfOnePixel",parser:j},{code:280,name:"isLoaded",parser:v},{code:281,name:"resolutionUnits",parser:v},{code:100,name:"subclassMarker",parser:v}];(pn={})[pn.NOUNIT=0]="NOUNIT",pn[pn.CENTIMETERS=2]="CENTIMETERS",pn[pn.INCH=5]="INCH";(Ms={})[Ms.PSLTSCALE=1]="PSLTSCALE",Ms[Ms.LIMCHECK=2]="LIMCHECK";(mn={})[mn.INCHES=0]="INCHES",mn[mn.MILLIMETERS=1]="MILLIMETERS",mn[mn.PIXELS=2]="PIXELS";(Gt={})[Gt.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Gt[Gt.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Gt[Gt.DRAWING_LIMITS=2]="DRAWING_LIMITS",Gt[Gt.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Gt[Gt.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Gt[Gt.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Mr={})[Mr.AS_DISPLAYED=0]="AS_DISPLAYED",Mr[Mr.WIREFRAME=1]="WIREFRAME",Mr[Mr.HIDDEN=2]="HIDDEN",Mr[Mr.RENDERED=3]="RENDERED";(jt={})[jt.DRAFT=0]="DRAFT",jt[jt.PREVIEW=1]="PREVIEW",jt[jt.NORMAL=2]="NORMAL",jt[jt.PRESENTATION=3]="PRESENTATION",jt[jt.MAXIMUM=4]="MAXIMUM",jt[jt.CUSTOM=5]="CUSTOM";let Fc=[{code:333,name:"shadePlotId",parser:v},{code:149,name:"imageOriginY",parser:v},{code:148,name:"imageOriginX",parser:v},{code:147,name:"scaleFactor",parser:v},{code:78,name:"shadePlotCustomDPI",parser:v},{code:77,name:"shadePlotResolution",parser:v},{code:76,name:"shadePlotMode",parser:v},{code:75,name:"standardScaleType",parser:v},{code:7,name:"currentStyleSheet",parser:v},{code:74,name:"plotType",parser:v},{code:73,name:"plotRotation",parser:v},{code:72,name:"plotPaperUnit",parser:v},{code:70,name:"layoutFlag",parser:v},{code:143,name:"printScaleDenominator",parser:v},{code:142,name:"printScaleNumerator",parser:v},{code:141,name:"windowAreaYMax",parser:v},{code:140,name:"windowAreaXMax",parser:v},{code:49,name:"windowAreaYMin",parser:v},{code:48,name:"windowAreaXMin",parser:v},{code:47,name:"plotOriginY",parser:v},{code:46,name:"plotOriginX",parser:v},{code:45,name:"paperHeight",parser:v},{code:44,name:"paperWidth",parser:v},{code:43,name:"marginTop",parser:v},{code:42,name:"marginRight",parser:v},{code:41,name:"marginBottom",parser:v},{code:40,name:"marginLeft",parser:v},{code:6,name:"plotViewName",parser:v},{code:4,name:"paperSize",parser:v},{code:2,name:"configName",parser:v},{code:1,name:"pageSetupName",parser:v},{code:100,name:"subclassMarker",parser:v},...to],p0=[{code:346,name:"orthographicUcsId",parser:v},{code:345,name:"namedUcsId",parser:v},{code:331,name:"viewportId",parser:v},{code:330,name:"paperSpaceTableId",parser:v},{code:76,name:"orthographicType",parser:v},{code:17,name:"ucsYAxis",parser:j},{code:16,name:"ucsXAxis",parser:j},{code:13,name:"ucsOrigin",parser:j},{code:146,name:"elevation",parser:v},{code:15,name:"maxExtent",parser:j},{code:14,name:"minExtent",parser:j},{code:12,name:"insertionPoint",parser:j},{code:11,name:"maxLimit",parser:j},{code:10,name:"minLimit",parser:j},{code:71,name:"tabOrder",parser:v},{code:70,name:"controlFlag",parser:v},{code:1,name:"layoutName",parser:v},{code:100,name:"subclassMarker",parser:v},...Fc],m0=[{code:40,name:"wcsToOCSTransform",parser:ml},{code:40,name:"ocsToWCSTransform",parser:ml},{code:41,name:"backClippingDistance",parser:v},{code:73,name:"isBackClipping",parser:Fe,pushContext:!0},{code:40,name:"frontClippingDistance",parser:v},{code:72,name:"isFrontClipping",parser:Fe,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:Fe},{code:11,name:"position",parser:j},{code:210,name:"normal",parser:j},{code:10,name:"boundaryVertices",parser:j,isMultiple:!0},{code:70,name:"boundaryCount",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...to];function ml(i,e){let t=[];for(let n=0;n<3&&Se(i,40);++n){let o=[];for(let h=0;h<4&&Se(i,40);++h)o.push(i.value),i=e.next();t.push(o)}return e.rewind(),t}let g0={LAYOUT:p0,PLOTSETTINGS:Fc,DICTIONARY:u0,SPATIAL_FILTER:m0,IMAGEDEF:d0};function f0(i,e){let t=[];for(;i.code!==0||!["EOF","ENDSEC"].includes(i.value);){let n=i.value,o=g0[n];if(i.code===0&&(o!=null&&o.length)){let h=xe(o),u={name:n};h(i=e.next(),e,u)?(t.push(u),i=e.peek()):i=e.next()}else i=e.next()}return{byName:ad(t,({name:n})=>n)}}let qn=[{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102,parser(i,e){for(;!Se(i,0,"EOF")&&!Se(i,102,"}");)i=e.next()}},{code:5,name:"handle",parser:v}],_0=xe([{code:310,name:"bmpPreview",parser:v},{code:281,name:"scalability",parser:v},{code:280,name:"explodability",parser:v},{code:70,name:"insertionUnits",parser:v},{code:340,name:"layoutObjects",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...qn]),y0=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:dl.Above,defaultValueImperial:dl.Center},{name:"DIMZIN",code:78,defaultValue:Un.Trailing,defaultValueImperial:Un.Feet},{name:"DIMAZIN",code:79,defaultValue:Hu.None},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:2,defaultValueImperial:4},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:",",defaultValueImperial:"."},{name:"DIMJUST",code:280,defaultValue:Yu.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:qu.Center},{name:"DIMTZIN",code:284,defaultValue:Un.Trailing,defaultValueImperial:Un.Feet},{name:"DIMALTZ",code:285,defaultValue:Un.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Un.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMTXSTY",code:340},{name:"DIMLDRBLK",code:341},{name:"DIMBLK",code:342},{name:"DIMBLK1",code:343},{name:"DIMBLK2",code:344},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWD",code:372,defaultValue:-2}],v0=xe([...y0.map(i=>({...i,parser:v})),{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},{code:105,name:"handle",parser:v},...qn.filter(i=>i.code!==5)]),b0=xe([{code:347,name:"materialObjectId",parser:v},{code:390,name:"plotStyleNameObjectId",parser:v},{code:370,name:"lineweight",parser:v},{code:290,name:"isPlotting",parser:Fe},{code:6,name:"lineType",parser:v},{code:62,name:"colorIndex",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...qn]);(Tr={})[Tr.NONE=0]="NONE",Tr[Tr.AbsoluteRotation=1]="AbsoluteRotation",Tr[Tr.TextEmbedded=2]="TextEmbedded",Tr[Tr.ShapeEmbedded=4]="ShapeEmbedded";let x0=xe([{code:9,name:"text",parser:v},{code:45,name:"offsetY",parser:v},{code:44,name:"offsetX",parser:v},{code:50,name:"rotation",parser:v},{code:46,name:"scale",parser:v},{code:340,name:"styleObjectId",parser:v},{code:75,name:"shapeNumber",parser:v},{code:74,name:"elementTypeFlag",parser:v},{code:49,name:"elementLength",parser:v}],{elementTypeFlag:0,elementLength:0}),w0=xe([{code:49,name:"pattern",parser(i,e){let t={};return x0(i,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:v},{code:73,name:"numberOfLineTypes",parser:v},{code:72,parser:v},{code:3,name:"description",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...qn]),A0=xe([{code:1e3,name:"extendedFont",parser:v},{code:1001},{code:4,name:"bigFont",parser:v},{code:3,name:"font",parser:v},{code:42,name:"lastHeight",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:50,name:"obliqueAngle",parser:v},{code:41,name:"widthFactor",parser:v},{code:40,name:"fixedTextHeight",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...qn]),S0=xe([{code:[63,421,431],name:"ambientColor",parser:v},{code:142,name:"contrast",parser:v},{code:141,name:"brightness",parser:v},{code:282,name:"defaultLightingType",parser:v},{code:292,name:"isDefaultLightingOn",parser:Fe},{code:348,name:"visualStyleObjectId",parser:v},{code:333,name:"shadePlotObjectId",parser:v},{code:332,name:"backgroundObjectId",parser:v},{code:61,name:"majorGridLines",parser:v},{code:170,name:"shadePlotSetting",parser:v},{code:146,name:"elevation",parser:v},{code:79,name:"orthographicType",parser:v},{code:112,name:"ucsYAxis",parser:j},{code:111,name:"ucsXAxis",parser:j},{code:110,name:"ucsOrigin",parser:j},{code:74,name:"ucsIconSetting",parser:v},{code:71,name:"viewMode",parser:v},{code:281,name:"renderMode",parser:v},{code:1,name:"styleSheet",parser:v},{code:[331,441],name:"frozenLayers",parser:v,isMultiple:!0},{code:72,name:"circleSides",parser:v},{code:51,name:"viewTwistAngle",parser:v},{code:50,name:"snapRotationAngle",parser:v},{code:45,name:"viewHeight",parser:v},{code:44,name:"backClippingPlane",parser:v},{code:43,name:"frontClippingPlane",parser:v},{code:42,name:"lensLength",parser:v},{code:17,name:"viewTarget",parser:j},{code:16,name:"viewDirectionFromTarget",parser:j},{code:15,name:"gridSpacing",parser:j},{code:14,name:"snapSpacing",parser:j},{code:13,name:"snapBasePoint",parser:j},{code:12,name:"center",parser:j},{code:11,name:"upperRightCorner",parser:j},{code:10,name:"lowerLeftCorner",parser:j},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...qn]),I0={BLOCK_RECORD:_0,DIMSTYLE:v0,LAYER:b0,LTYPE:w0,STYLE:A0,VPORT:S0},P0=xe([{code:70,name:"maxNumberOfEntries",parser:v},{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:v},{code:2,name:"name",parser:v}]);function E0(i,e){var n;let t={};for(;!Se(i,0,"EOF")&&!Se(i,0,"ENDSEC");){if(Se(i,0,"TABLE")){i=e.next();let o={entries:[]};P0(i,e,o),t[o.name]=o}if(Se(i,0)&&!Se(i,0,"ENDTAB")){let o=i.value;i=e.next();let h=I0[o];if(!h){e.debug&&console.warn(`parseTable: Invalid table name '${o}'`),i=e.next();continue}let u={};h(i,e,u),(n=t[o])==null||n.entries.push(u)}i=e.next()}return t}function Ts(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}class gl{next(){if(!this.hasNext())return this._eof?this.debug&&console.warn("Cannot call 'next' after EOF group has been read"):this.debug&&console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=fl(e,this._data[this._pointer++],this.debug),n={code:e,value:t};return Se(n,0,"EOF")&&(this._eof=!0),this.lastReadGroup=n,n}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e={code:parseInt(this._data[this._pointer]),value:0};return e.value=fl(e.code,this._data[this._pointer+1],this.debug),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){Ts(this,"_data",void 0),Ts(this,"debug",void 0),Ts(this,"_pointer",void 0),Ts(this,"_eof",void 0),Ts(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function fl(i,e,t=!1){return i<=9?e:i>=10&&i<=59?parseFloat(e.trim()):i>=60&&i<=99?parseInt(e.trim()):i>=100&&i<=109?e:i>=110&&i<=149?parseFloat(e.trim()):i>=160&&i<=179?parseInt(e.trim()):i>=210&&i<=239?parseFloat(e.trim()):i>=270&&i<=289?parseInt(e.trim()):i>=290&&i<=299?function(n){if(n==="0")return!1;if(n==="1")return!0;throw TypeError("String '"+n+"' cannot be cast to Boolean type")}(e.trim()):i>=300&&i<=369?e:i>=370&&i<=389?parseInt(e.trim()):i>=390&&i<=399?e:i>=400&&i<=409?parseInt(e.trim()):i>=410&&i<=419?e:i>=420&&i<=429?parseInt(e.trim()):i>=430&&i<=439?e:i>=440&&i<=459?parseInt(e.trim()):i>=460&&i<=469?parseFloat(e.trim()):i>=470&&i<=481||i===999||i>=1e3&&i<=1009?e:i>=1010&&i<=1059?parseFloat(e.trim()):i>=1060&&i<=1071?parseInt(e.trim()):(t&&console.warn("WARNING: Group code does not have a defined type: %j",{code:i,value:e}),e)}function Ea(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}class k0{constructor(){Ea(this,"encoding","utf-8"),Ea(this,"encodingFailureFatal",!1)}}class M0 extends EventTarget{parseSync(e,t=!1){let n=new gl(e.split(/\r\n|\r|\n/g),t);if(!n.hasNext())throw Error("Empty file");return this.parseAll(n)}parseStream(e){let t="",n=this;return new Promise((o,h)=>{e.on("data",u=>{t+=u}),e.on("end",()=>{try{let u=t.split(/\r\n|\r|\n/g),g=new gl(u);if(!g.hasNext())throw Error("Empty file");o(n.parseAll(g))}catch(u){h(u)}}),e.on("error",u=>{h(u)})})}async parseFromUrl(e,t){let n=await fetch(e,t);if(!n.body)return null;let o=n.body.getReader(),h="";for(;;){let{done:u,value:g}=await o.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(g,{stream:!0})}return this.parseSync(h)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},n=e.next();for(;!Se(n,0,"EOF");)Se(n,0,"SECTION")&&(Se(n=e.next(),2,"HEADER")?(n=e.next(),t.header=c0(n,e)):Se(n,2,"BLOCKS")?(n=e.next(),t.blocks=l0(n,e)):Se(n,2,"ENTITIES")?(n=e.next(),t.entities=Dc(n,e)):Se(n,2,"TABLES")?(n=e.next(),t.tables=E0(n,e)):Se(n,2,"OBJECTS")&&(n=e.next(),t.objects=f0(n,e))),n=e.next();return t}constructor(e=new k0){super(),Ea(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}const _l=[{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 Bi{constructor(e){if(typeof e=="string"){const t=_l.find(n=>n.name===e);if(!t)throw new Error(`Unknown DWG version name: ${e}`);this.name=t.name,this.value=t.value;return}if(typeof e=="number"){const t=_l.find(n=>n.value===e);if(!t)throw new Error(`Unknown DWG version value: ${e}`);this.name=t.name,this.value=t.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class T0{parse(e){const t=new M0,n=this.getDxfInfoFromBuffer(e);let o="";return n.version&&n.version.value<=23&&n.encoding?o=new TextDecoder(n.encoding).decode(e):o=new TextDecoder().decode(e),t.parseSync(o)}getDxfInfoFromBuffer(e){var f,w,x;const n=new TextDecoder("utf-8");let o=0,h="",u=null,g=null,b=!1;for(;o<e.byteLength;){const E=Math.min(o+65536,e.byteLength),M=e.slice(o,E);o=E;const B=(h+n.decode(M,{stream:!0})).split(/\r?\n/);h=B.pop()??"";for(let F=0;F<B.length;F++){const D=B[F].trim();if(D==="SECTION"&&((f=B[F+2])==null?void 0:f.trim())==="HEADER")b=!0;else if(D==="ENDSEC"&&b)return{version:u,encoding:g};if(b&&D==="$ACADVER"){const de=(w=B[F+2])==null?void 0:w.trim();de&&(u=new Bi(de))}else if(b&&D==="$DWGCODEPAGE"){const de=(x=B[F+2])==null?void 0:x.trim();if(de){const ve=Ca[de];g=Ml(ve)}}if(u&&g)return{version:u,encoding:g}}}return{version:u,encoding:g}}}class yl{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="3DFACE"?this.convertFace(e):e.type=="ARC"?this.convertArc(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="LWPOLYLINE"?this.convertLWPolyline(e):e.type=="MTEXT"?this.convertMText(e):e.type=="POLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertFace(e){const t=new fi;return e.vertices.forEach((n,o)=>t.setVertexAt(o,n)),t}convertArc(e){return new pi(e.center,e.radius,ke.degToRad(e.startAngle),ke.degToRad(e.endAngle),e.extrusionDirection??Z.Z_AXIS)}convertCirle(e){return new mi(e.center,e.radius,e.extrusionDirection??Z.Z_AXIS)}convertEllipse(e){const t=new Z(e.majorAxisEndPoint),n=t.length();return new gi(e.center,e.extrusionDirection??Z.Z_AXIS,t,n,n*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,n=e.endPoint;return new yi(new Y(t.x,t.y,t.z||0),new Y(n.x,n.y,n.z||0))}convertSpline(e){try{if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new Gs(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0){const t=this.numberArrayToPointArray(e.fitPoints,e.numberOfFitPoints);if(t!=null)return new Gs(t,"Uniform",e.degree,!!(e.flag&1))}}catch(t){console.log(`Failed to convert spline with error: ${t}`)}return null}convertPoint(e){const t=new Si;return t.position=e.position,t}convertSolid(e){const t=new wi;return e.points.forEach((n,o)=>t.setPointAt(o,n)),t.thickness=e.thickness,t}convertPolyline(e){const t=!!(e.flag&1),n=!!(e.flag&8),o=[],h=[];if(e.vertices.map(u=>{u.flag&Vd.SPLINE_CONTROL_POINT||(o.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0))}),n){let u=Rs.SimplePoly;return e.flag&4&&(e.smoothType==ei.CUBIC?u=Rs.CubicSplinePoly:e.smoothType==ei.QUADRATIC&&(u=Rs.QuadSplinePoly)),new di(u,o,t)}else{let u=Vn.SimplePoly;return e.flag&2?u=Vn.FitCurvePoly:e.flag&4&&(e.smoothType==ei.CUBIC?u=Vn.CubicSplinePoly:e.smoothType==ei.QUADRATIC&&(u=Vn.QuadSplinePoly)),new ui(u,o,0,t,e.startWidth,e.endWidth,h)}}convertLWPolyline(e){const t=new Ai;return t.closed=!!(e.flag&1),e.vertices.forEach((n,o)=>{t.addVertexAt(o,new Te(n.x,n.y),n.bulge,n.startWidth,n.endWidth)}),t}convertHatch(e){var o;const t=new Vs;return(o=e.definitionLines)==null||o.forEach(h=>{t.definitionLines.push({angle:h.angle,origin:h.base,delta:h.offset,dashPattern:h.numberOfDashLengths>0?h.dashLengths:[]})}),t.isSolidFill=e.solidFill==Xu.SolidFill,t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:e.patternAngle,t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const g=h,b=new wn;b.closed=g.isClosed,g.vertices.forEach((f,w)=>{b.addVertexAt(w,{x:f.x,y:f.y,bulge:f.bulge})}),t.add(b)}else{const g=h,b=new Wa;g.edges.forEach(f=>{if(f.type==1){const w=f;b.add(new zs(w.start,w.end))}else if(f.type==2){const w=f;b.add(new jn(w.center,w.radius,ke.degToRad(w.startAngle||0),ke.degToRad(w.endAngle||0),!w.isCCW))}else if(f.type==3){const w=f;new Ze().subVectors(w.end,w.center);const E=Math.sqrt(Math.pow(w.end.x,2)+Math.pow(w.end.y,2)),M=E*w.lengthOfMinorAxis;let L=ke.degToRad(w.startAngle||0),B=ke.degToRad(w.endAngle||0);const F=Math.atan2(w.end.y,w.end.x);w.isCCW||(L=Math.PI*2-L,B=Math.PI*2-B),b.add(new ji({...w.center,z:0},E,M,L,B,!w.isCCW,F))}else if(f.type==4){const w=f;if(w.numberOfControlPoints>0&&w.numberOfKnots>0){const x=w.controlPoints.map(L=>({x:L.x,y:L.y,z:0}));let E=!0;const M=w.controlPoints.map(L=>(L.weight==null&&(E=!1),L.weight||1));b.add(new Zr(x,w.knots,E?M:void 0))}else if(w.numberOfFitData>0){const x=w.fitDatum.map(E=>({x:E.x,y:E.y,z:0}));b.add(new Zr(x,"Uniform"))}}}),t.add(b)}}),t}convertTable(e){const t=new bi(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((n,o)=>t.setColumnWidth(o,n)),e.rowHeightArr.forEach((n,o)=>t.setRowHeight(o,n)),e.cells.forEach((n,o)=>{t.setCell(o,n)}),t}convertText(e){const t=new xi;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=ke.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new vi;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=ke.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new Z(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new _i;return e.vertices.forEach(n=>{t.appendVertex(n)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName,t.annoType=e.leaderCreationFlag,t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"||e.subclassMarker=="AcDbRotatedDimension"){const t=e,n=new Ti(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return t.insertionPoint&&(n.dimBlockPosition={...t.insertionPoint,z:0}),n.rotation=ke.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,n=new Mi(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,n=new Ci(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,n=new Li(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,n),n}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,n=new Ni(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,n),n}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(n=>{t.clipBoundary.push(new Te(n))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new js;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(n=>{t.clipBoundary.push(new Te(n))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new Ei;return this.processWipeout(e,t),t}convertViewport(e){const t=new Pi;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new Ii;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new ki;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new Us(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?ke.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(e,t){t.layer=e.layer||"0",e.handle&&(t.objectId=e.handle),t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null&&t.color.setRGBValue(e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=e.isVisible),e.transparency!=null&&(t.transparency=Ui.deserialize(e.transparency))}numberArrayToPointArray(e,t){const n=e.length;let o=0;if(n/2==t?o=2:n/3==t&&(o=3),o==0)return;const h=[];for(let u=0,g=n/o;u<g;++u)h.push({x:e[u*o],y:e[u*o+1],z:o==3?e[u*o+2]:0});return h}}class An extends Jr{constructor(e,t){e=e||{},Hn(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const qr=class qr extends An{static isModelSapceName(e){return e.toLowerCase()==qr.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(qr.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new Y,this._layoutId="",this._entities=new Map}get isModelSapce(){return qr.isModelSapceName(this.name)}get isPaperSapce(){return qr.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}appendEntity(e){if(Array.isArray(e))for(let t=0;t<e.length;++t){const n=e[t];n.database=this.database,n.ownerId=this.objectId,this._entities.set(n.objectId,n)}else e.database=this.database,e.ownerId=this.objectId,this._entities.set(e.objectId,e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}newIterator(){return new qi(this._entities)}getIdAt(e){return this._entities.get(e)}};qr.MODEL_SPACE_NAME="*MODEL_SPACE",qr.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let pt=qr;class N0{convertLayout(e,t){var o,h;const n=new Yi;if(n.layoutName=e.layoutName,n.tabOrder=e.tabOrder,e.layoutName==="Model"){const u=pt.MODEL_SPACE_NAME;(o=t.tables.BLOCK_RECORD)==null||o.entries.some(g=>g.name.toUpperCase()===u?(n.blockTableRecordId=g.handle,!0):!1)}else(h=t.tables.BLOCK_RECORD)==null||h.entries.some(u=>u.layoutObjects===e.handle?(n.blockTableRecordId=u.handle,!0):!1),n.blockTableRecordId||(n.blockTableRecordId=e.paperSpaceTableId);return n.limits.min.copy(e.minLimit),n.limits.max.copy(e.maxLimit),n.extents.min.copy(e.minExtent),n.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,n),n}convertImageDef(e){const t=new Eh;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class Uc{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const n=Date.now(),o=this.generateTaskId();try{return await this.executeInWorker(o,e,t||this.config.workerUrl)}catch(h){const u=Date.now()-n;return{success:!1,error:h instanceof Error?h.message:String(h),duration:u}}}async executeInWorker(e,t,n){const o=Date.now();return new Promise((h,u)=>{const g=this.getAvailableWorker(n),b=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(g),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:x=>{clearTimeout(b),this.releaseWorker(g),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(g),u(x)},timeout:b});const f=x=>{const{id:E,success:M,data:L,error:B}=x.data;if(E!==e)return;this.cleanupTask(e);const F=Date.now()-o;h(M?{success:!0,data:L,duration:F}:{success:!1,error:B,duration:F})},w=x=>{this.cleanupTask(e),u(new Error(`Worker error: ${x.message}`))};g.addEventListener("message",f),g.addEventListener("error",w),g.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[n,o]of this.workers)if(!o.isBusy)return o.isBusy=!0,o.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const n=new Worker(e,{type:"module"}),o=this.generateWorkerId(),h={worker:n,isBusy:!0,id:o,createdAt:new Date};return this.workers.set(o,h),n}const t=Array.from(this.workers.values()).sort((n,o)=>n.createdAt.getTime()-o.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,n]of this.workers)if(n.worker===e){n.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class Vc{constructor(e){this.framework=new Uc(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Gc(i){return new Vc(i)}class C0{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:n}=e.data;try{const o=await this.executeTask(n);this.sendResponse(t,!0,o)}catch(o){this.sendResponse(t,!1,void 0,o instanceof Error?o.message:String(o))}}}sendResponse(e,t,n,o){const h={id:e,success:t,data:n,error:o};self.postMessage(h)}}class jc extends Za{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e){if(this.config.useWorker&&this.config.parserWorkerUrl){const t=Gc({workerUrl:this.config.parserWorkerUrl,maxConcurrentWorkers:1}),n=await t.execute(e);if(t.destroy(),n.success)return{model:n.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${n.error}'`)}else return{model:new T0().parse(e),data:{unknownEntityCount:0}}}getFonts(e){var h;const t=new Map,n=u=>{if(u){const g=u.lastIndexOf(".");return g>=0?u.substring(0,g).toLowerCase():u.toLowerCase()}};(h=e.tables.STYLE)==null||h.entries.forEach(u=>{const g=[];if(u.font){const b=n(u.font);b&&g.push(b)}if(u.bigFont){const b=n(u.bigFont);b&&g.push(b)}if(u.extendedFont){const b=n(u.extendedFont);b&&g.push(b)}t.set(u.name,g)});const o=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,o),Array.from(o)}getFontsInBlock(e,t,n,o){const h=/\\f(.*?)\|/g;e.forEach(u=>{if(u.type=="MTEXT"){const g=u;[...g.text.matchAll(h)].forEach(w=>{o.add(w[1].toLowerCase())});const f=n.get(g.styleName);f==null||f.forEach(w=>o.add(w))}else if(u.type=="TEXT"){const g=u,b=n.get(g.styleName);b==null||b.forEach(f=>o.add(f))}else if(u.type=="INSERT"){const b=t[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,t,n,o)}})}async processEntities(e,t,n,o,h){const u=new yl;let g=e.entities;const b=g.length,f=new Ta(b,100-o.value,n);this.config.convertByEntityType&&(g=this.groupAndFlattenByType(g));const w=t.tables.blockTable.modelSpace;await f.processChunk(async(x,E)=>{let M=[],L=x<E?g[x].type:"";for(let B=x;B<E;B++){const F=g[B],D=u.convert(F);D&&(this.config.convertByEntityType&&F.type!==L&&(w.appendEntity(M),M=[],L=F.type),M.push(D))}if(w.appendEntity(M),h){let B=o.value+E/b*(100-o.value);B>100&&(B=100),await h(B,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t){const n=new yl,o=e.length,h=[];for(let u=0;u<o;u++){const g=e[u],b=n.convert(g);b&&h.push(b)}t.appendEntity(h)}processBlocks(e,t){const n=e.blocks;for(const[o,h]of Object.entries(n)){let u=t.tables.blockTable.getAt(h.name);u||(u=new pt,u.objectId=h.handle,u.name=o,u.origin.copy(h.position),t.tables.blockTable.add(u)),h.entities&&this.processEntitiesInBlock(h.entities,u)}}processHeader(e,t){const n=e.header;n.$ACADVER&&(t.version=n.$ACADVER),t.cecolor.colorIndex=n.$CECOLOR||256,t.angBase=n.$ANGBASE||0,t.angDir=n.$ANGDIR||0,n.$AUNITS!=null&&(t.aunits=n.$AUNITS),n.$EXTMAX&&(t.extmax=n.$EXTMAX),n.$EXTMIN&&(t.extmin=n.$EXTMIN),n.$INSUNITS!=null&&(t.insunits=n.$INSUNITS),t.pdmode=n.$PDMODE||0,t.pdsize=n.$PDSIZE||0}processBlockTables(e,t){var o;const n=(o=e.tables.BLOCK_RECORD)==null?void 0:o.entries;n&&n.length>0&&(t.tables.blockTable.removeAll(),n.forEach(h=>{const u=new pt;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,t.tables.blockTable.add(u)}))}processObjects(e,t){const n=e.objects.byName,o=new N0;if("LAYOUT"in n){const h=t.dictionaries.layouts;n.LAYOUT.forEach(u=>{const g=o.convertLayout(u,e);h.setAt(g.layoutName,g)})}if("IMAGEDEF"in n){const h=t.dictionaries.imageDefs;n.IMAGEDEF.forEach(u=>{const g=o.convertImageDef(u);h.setAt(g.objectId,g)})}}processViewports(e,t){var o,h;const n=(h=(o=e.tables)==null?void 0:o.VPORT)==null?void 0:h.entries;n&&n.length>0&&n.forEach(u=>{const g=new ru;this.processCommonTableEntryAttrs(u,g),u.circleSides&&(g.circleSides=u.circleSides),g.standardFlag=u.standardFlag,g.center.copy(u.center),g.lowerLeftCorner.copy(u.lowerLeftCorner),g.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&g.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(g.snapAngle=u.snapRotationAngle),u.snapSpacing&&g.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(g.gridMajor=u.majorGridLines),u.gridSpacing&&g.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(g.backgroundObjectId=u.backgroundObjectId),g.gsView.center.copy(u.center),g.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),g.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(g.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(g.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(g.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(g.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(g.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(g.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(g.gsView.styleSheet=u.styleSheet),u.renderMode&&(g.gsView.renderMode=u.renderMode),u.viewMode&&(g.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(g.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&g.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&g.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&g.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(g.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(g.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(g.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(g.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(g.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(g.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(g.gsView.brightness=u.brightness),u.contrast&&(g.gsView.contrast=u.contrast),u.ambientColor&&(g.gsView.ambientColor=u.ambientColor),t.tables.viewportTable.add(g)})}processLayers(e,t){var o,h;const n=(h=(o=e.tables)==null?void 0:o.LAYER)==null?void 0:h.entries;n&&n.length>0&&n.forEach(u=>{const g=new Qr;g.colorIndex=u.colorIndex;const b=new Ki({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:g,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),t.tables.layerTable.add(b)})}processLineTypes(e,t){var o,h;const n=(h=(o=e.tables)==null?void 0:o.LTYPE)==null?void 0:h.entries;n&&n.length>0&&n.forEach(u=>{const g=new Fs(u);this.processCommonTableEntryAttrs(u,g),g.name=u.name,t.tables.linetypeTable.add(g)})}processTextStyles(e,t){var o;const n=(o=e.tables.STYLE)==null?void 0:o.entries;n&&n.length>0&&n.forEach(h=>{const u=new ro(h);this.processCommonTableEntryAttrs(h,u),t.tables.textStyleTable.add(u)})}processDimStyles(e,t){var o;const n=(o=e.tables.DIMSTYLE)==null?void 0:o.entries;n&&n.length>0&&n.forEach(h=>{const u={name:h.name,ownerId:h.ownerObjectId,dimpost:h.DIMPOST||"",dimapost:h.DIMAPOST||"",dimscale:h.DIMSCALE,dimasz:h.DIMASZ,dimexo:h.DIMEXO,dimdli:h.DIMDLI,dimexe:h.DIMEXE,dimrnd:h.DIMRND,dimdle:h.DIMDLE,dimtp:h.DIMTP,dimtm:h.DIMTM,dimtxt:h.DIMTXT,dimcen:h.DIMCEN,dimtsz:h.DIMTSZ,dimaltf:h.DIMALTF,dimlfac:h.DIMLFAC,dimtvp:h.DIMTVP,dimtfac:h.DIMTFAC,dimgap:h.DIMGAP,dimaltrnd:h.DIMALTRND,dimtol:h.DIMTOL==null||h.DIMTOL==0?0:1,dimlim:h.DIMLIM==null||h.DIMLIM==0?0:1,dimtih:h.DIMTIH==null||h.DIMTIH==0?0:1,dimtoh:h.DIMTOH==null||h.DIMTOH==0?0:1,dimse1:h.DIMSE1==null||h.DIMSE1==0?0:1,dimse2:h.DIMSE2==null||h.DIMSE2==0?0:1,dimtad:h.DIMTAD,dimzin:h.DIMZIN,dimazin:h.DIMAZIN,dimalt:h.DIMALT,dimaltd:h.DIMALTD,dimtofl:h.DIMTOFL,dimsah:h.DIMSAH,dimtix:h.DIMTIX,dimsoxd:h.DIMSOXD,dimclrd:h.DIMCLRD,dimclre:h.DIMCLRE,dimclrt:h.DIMCLRT,dimadec:h.DIMADEC||0,dimunit:h.DIMUNIT||2,dimdec:h.DIMDEC,dimtdec:h.DIMTDEC,dimaltu:h.DIMALTU,dimalttd:h.DIMALTTD,dimaunit:h.DIMAUNIT,dimfrac:h.DIMFRAC,dimlunit:h.DIMLUNIT,dimdsep:h.DIMDSEP,dimtmove:h.DIMTMOVE||0,dimjust:h.DIMJUST,dimsd1:h.DIMSD1,dimsd2:h.DIMSD2,dimtolj:h.DIMTOLJ,dimtzin:h.DIMTZIN,dimaltz:h.DIMALTZ,dimalttz:h.DIMALTTZ,dimfit:h.DIMFIT||0,dimupt:h.DIMUPT,dimatfit:h.DIMATFIT,dimtxsty:h.DIMTXSTY||"Standard",dimldrblk:h.DIMLDRBLK||"",dimblk:h.DIMBLK||"",dimblk1:h.DIMBLK1||"",dimblk2:h.DIMBLK2||"",dimlwd:h.DIMLWD,dimlwe:h.DIMLWE},g=new Wn(u);this.processCommonTableEntryAttrs(h,g),t.tables.dimStyleTable.add(g)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}groupAndFlattenByType(e){const t={},n=[];for(const o of e)t[o.type]||(t[o.type]=[],n.push(o.type)),t[o.type].push(o);return n.flatMap(o=>t[o])}}class Wc extends Za{constructor(e){super({}),this._database=e}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(e,t,n,o,h){let u=e.tables.blockTable.modelSpace.newIterator().toArray();const g=u.length,b=new Ta(g,100-o.value,n);this.config.convertByEntityType&&(u=this.groupAndFlattenByType(u));const f=t.tables.blockTable.modelSpace;await b.processChunk(async(w,x)=>{let E=[],M=w<x?u[w].type:"";for(let L=w;L<x;L++){const B=u[L];this.config.convertByEntityType&&B.type!==M&&(this.triggerEvents(f,E),E=[],M=B.type),E.push(B)}if(this.triggerEvents(f,E),h){let L=o.value+x/g*(100-o.value);L>100&&(L=100),await h(L,"ENTITY","IN-PROGRESS")}})}processBlocks(){const e=this._database.tables.blockTable.newIterator();for(const t of e){const n=t.newIterator().toArray();this.triggerEvents(t,n)}}processHeader(){}processBlockTables(){}processObjects(){const e=this._database.dictionaries.layouts.newIterator();for(const n of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:n,key:n.layoutName});const t=this._database.dictionaries.imageDefs.newIterator();for(const n of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:n,key:n.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(t=>{this._database.events.layerAppended.dispatch({database:this._database,layer:t})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(e){const t={},n=[];for(const o of e)t[o.type]||(t[o.type]=[],n.push(o.type)),t[o.type].push(o);return n.flatMap(o=>t[o])}triggerEvents(e,t){(e.isModelSapce||e.isPaperSapce)&&e.database.events.entityAppended.dispatch({database:e.database,entity:t})}}var Ds=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Ds||{});class dr{constructor(){this.events={registered:new at,unregistered:new at},this._converters=new Map,this.register("dxf",new jc)}static createInstance(){return dr._instance==null&&(dr._instance=new dr),this._instance}static get instance(){return dr._instance||(dr._instance=new dr),dr._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}class Sn extends Jr{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(e){e.database=this.database;const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),n=this._recordsByName.get(t);return n?(this._recordsById.delete(n.objectId),this._recordsByName.delete(e),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(t.name),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new qi(this._recordsByName)}normalizeName(e){return e}}class Hc extends Sn{constructor(e){super(e)}get modelSpace(){let e=this.getAt(pt.MODEL_SPACE_NAME);return e||(e=new pt,e.name=pt.MODEL_SPACE_NAME,this.add(e)),e}normalizeName(e){let t=e;if(pt.isModelSapceName(e))t=pt.MODEL_SPACE_NAME;else if(pt.isPaperSapceName(e)){const n=pt.PAPER_SPACE_NAME_PREFIX,o=e.substring(n.length);t=n+o}return t}}class Yc extends Sn{constructor(e){super(e)}}class Ki extends An{constructor(e,t){e=e||{},Hn(e,{color:new Qr,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new Ui,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(n=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:n.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e.clone())}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineStyle(){var t;const e=(t=this.database)==null?void 0:t.tables.linetypeTable.getAt(this.linetype);if(e)return{type:"UserSpecified",...e.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}}class qc extends Sn{constructor(e){super(e);const t=new Qr,n=new Ki({name:"0",standardFlags:0,linetype:li,lineWeight:Hi.ByLineWeightDefault,isOff:!1,color:t,isPlottable:!0});this.add(n)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class Xc extends Sn{constructor(e){super(e)}}class Kc extends Sn{constructor(e){super(e)}get fonts(){const e=new Set,t=o=>{if(o){const h=o.lastIndexOf(".");if(h>=0){const u=o.substring(0,h).toLowerCase();e.add(u)}else e.add(o.toLowerCase())}},n=this.newIterator();for(const o of n)t(o.fileName),t(o.bigFontFileName);return Array.from(e)}}class $c extends Sn{constructor(e){super(e)}}class L0 extends Jr{constructor(){super(),this.events={dictObjetSet:new at,dictObjectErased:new at,entityAppended:new at,entityModified:new at,layerAppended:new at,layerModified:new at,layerErased:new at,openProgress:new at,headerSysVarChanged:new at},this._version=new Bi("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Na.DecimalDegrees,this._celtscale=1,this._cecolor=new Qr,this._extents=new Ne,this._insunits=$a.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Hc(this),dimStyleTable:new Yc(this),linetypeTable:new Xc(this),textStyleTable:new Kc(this),layerTable:new qc(this),viewportTable:new $c(this)},this._dictionaries={layouts:new Ph(this),imageDefs:new Ka(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this._aunits=e||0,this.triggerHeaderSysVarChangedEvent("aunits")}get version(){return this._version}set version(e){this._version=new Bi(e),this.triggerHeaderSysVarChangedEvent("version")}get insunits(){return this._insunits}set insunits(e){this._insunits=e||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(e){this._ltscale=e||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(e){this._cecolor=e||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(e){this._celtscale=e||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(e){this._angBase=e||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(e){this._angDir=e||0,this.triggerHeaderSysVarChangedEvent("angdir")}get extmax(){return this._extents.max}set extmax(e){e&&(this._extents.expandByPoint(e),this.triggerHeaderSysVarChangedEvent("extmax"))}get extmin(){return this._extents.min}set extmin(e){e&&(this._extents.expandByPoint(e),this.triggerHeaderSysVarChangedEvent("extmin"))}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(e){this._pdmode=e||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(e){this._pdsize=e||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(e,t,n=Ds.DXF){const o=dr.instance.get(n);if(o==null)throw new Error(`Database converter for file type '${n}' isn't registered and can can't read this file!`);this.clear(),await o.read(e,this,t&&t.minimumChunkSize||10,async(h,u,g,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,subStageStatus:g,data:b}),t&&t.fontLoader&&u=="FONT"&&g=="END"){const f=b||this.tables.textStyleTable.fonts;await t.fontLoader.load(f)}})}async openUri(e,t){var M;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const n=await fetch(e);if(!n.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${n.status}'!`);const o=n.headers.get("content-length"),h=o?parseInt(o,10):null;let u=0;const g=(M=n.body)==null?void 0:M.getReader();if(!g)throw new Error("Failed to get response reader");const b=[];for(;;){const{done:L,value:B}=await g.read();if(L)break;if(b.push(B),u+=B.length,h!==null){const F=Math.round(u/h*100);this.events.openProgress.dispatch({database:this,percentage:F,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(u);let w=0;for(const L of b)f.set(L,w),w+=L.length;this.getFileNameFromUri(e).toLowerCase().split(".").pop()==="dwg"?await this.read(f.buffer,t,Ds.DWG):await this.read(f.buffer,t,Ds.DXF),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}async regen(){await new Wc(this).read(null,this,500,async(t,n,o,h)=>{this.events.openProgress.dispatch({database:this,percentage:t,stage:"CONVERSION",subStage:n,subStageStatus:o,data:h})})}createDefaultData(e={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const t=new kh(this);e.layer&&t.createDefaultLayer(),e.lineType&&t.createDefaultLineType(),e.textStyle&&t.createDefaultTextStyle(),e.dimStyle&&t.createDefaultDimStyle(),e.layout&&t.createDefaultLayout()}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._dictionaries.layouts.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}triggerHeaderSysVarChangedEvent(e){this.events.headerSysVarChanged.dispatch({database:this,name:e})}getFileNameFromUri(e){try{const n=new URL(e).pathname.split("/");return n[n.length-1]||""}catch(t){return console.error("Invalid URI:",t),""}}}var Zc=(i=>(i[i.Center=0]="Center",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.OverFirst=3]="OverFirst",i[i.OverSecond=4]="OverSecond",i))(Zc||{}),Qc=(i=>(i[i.Center=0]="Center",i[i.Above=1]="Above",i[i.Outside=2]="Outside",i[i.JIS=3]="JIS",i[i.Below=4]="Below",i))(Qc||{}),Jc=(i=>(i[i.Feet=0]="Feet",i[i.None=1]="None",i[i.Inch=2]="Inch",i[i.FeetAndInch=3]="FeetAndInch",i[i.Leading=4]="Leading",i[i.Trailing=8]="Trailing",i[i.LeadingAndTrailing=12]="LeadingAndTrailing",i))(Jc||{}),eu=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(eu||{}),tu=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(tu||{});const Ri=class Ri extends An{constructor(e,t){e=e||{},Hn(e,Ri.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}};Ri.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:"Standard",dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let Wn=Ri;class Fs extends An{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}}const Di=class Di{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new at},this.registerVar({name:"PICKBOX",type:"number",defaultValue:0})}static instance(){return this._instance||(this._instance=new Di),this._instance}registerVar(e){this.registry.set(e.name.toUpperCase(),e)}registerMany(e){e.forEach(t=>this.registerVar(t))}getVar(e){if(e=e.toUpperCase(),this.cache.has(e))return this.cache.get(e)}setVar(e,t){e=e.toUpperCase();const n=this.getDescriptor(e);if(n){const o=this.getVar(e);if(this.cache.set(e,t),n.type!=="string"&&(typeof t=="string"||t instanceof String))if(n.type==="number"){const h=Number(t);if(Number.isNaN(h))throw new Error("Invalid input!");t=h}else n.type==="boolean"&&(t=this.parseBoolean(t));this.events.sysVarChanged.dispatch({name:e,newVal:t,oldVal:o})}else throw new Error(`System variable ${e} not found!`)}getDescriptor(e){return this.registry.get(e.toUpperCase())}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(e){if(e==null)return!1;const t=String(e).trim().toLowerCase(),n=new Set(["true","t","1","yes","y"]),o=new Set(["false","f","0","no","n"]);return n.has(t)?!0:(o.has(t),!1)}};Di._instance=null;let ka=Di;class ro extends An{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const n=t.lastIndexOf(".");return n===-1?t:t.substring(0,n)}return e}}const O0={center:new Te,viewDirectionFromTarget:new Y(0,0,1),viewTarget:new Y(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:Ya.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new Y(0,0,0),ucsXAxis:new Y(1,0,0),ucsYAxis:new Y(0,1,0),orthographicType:qa.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Xa.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class ru extends An{constructor(){super(),this._circleSides=100,this._center=new Te,this._lowerLeftCorner=new Te(0,0),this._upperRightCorner=new Te(1,1),this._snapBase=new Te(0,0),this._snapAngle=0,this._snapSpacing=new Te(0,0),this._standardFlag=0,this._gridSpacing=new Te,this._gridMajor=10,this._gsView=O0}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get gsView(){return this._gsView}}class nu{constructor(){this.events={layoutCreated:new at,layoutRemoved:new at,layoutRenamed:new at,layoutSwitched:new at}}countLayouts(e){return this.getWorkingDatabase(e).dictionaries.layouts.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const n=this.getWorkingDatabase(t),o=n.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(o,n)}setCurrentLayoutBtrId(e,t){const n=this.getWorkingDatabase(t),o=n.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(o,n)}setCurrentLayout(e,t){const n=this.getWorkingDatabase(t),o=n.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(o,n)}renameLayout(e,t,n){const h=this.getWorkingDatabase(n).dictionaries.layouts.getAt(e);return h?(h.layoutName=t,this.events.layoutRenamed.dispatch({layout:h,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.has(e)}deleteLayout(e,t){const n=this.getWorkingDatabase(t).dictionaries.layouts,o=n.getAt(e);let h=!1;return o&&(h=n.remove(e),h&&this.events.layoutRemoved.dispatch({layout:o})),h}createLayout(e,t){const n=this.getWorkingDatabase(t),o=new Yi;o.layoutName=e,o.tabOrder=n.dictionaries.layouts.maxTabOrder;const h=new pt;return h.name=`*Paper_Space${o.tabOrder}`,n.tables.blockTable.add(h),n.dictionaries.layouts.setAt(e,o),this.events.layoutCreated.dispatch({layout:o}),{layout:o,btr:h}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||no().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function no(){return zi.instance}const Fi=class Fi{constructor(){this._workingDatabase=null,this._layoutManager=new nu}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager}};Fi.instance=new Fi;let zi=Fi;exports.AcCmColor=Qr;exports.AcCmColorMethod=me;exports.AcCmColorUtil=gn;exports.AcCmEntityColor=xu;exports.AcCmErrors=Ht;exports.AcCmEventDispatcher=wu;exports.AcCmEventManager=at;exports.AcCmLoader=Tu;exports.AcCmLoadingManager=El;exports.AcCmObject=Al;exports.AcCmPerformanceCollector=Ma;exports.AcCmTask=Il;exports.AcCmTaskScheduler=Pl;exports.AcCmTransparency=Ui;exports.AcCmTransparencyMethod=St;exports.AcDb2dPolyline=ui;exports.AcDb2dVertex=Sa;exports.AcDb2dVertexType=fh;exports.AcDb3PointAngularDimension=Mi;exports.AcDb3dPolyline=di;exports.AcDb3dVertex=Ia;exports.AcDb3dVertexType=_h;exports.AcDbAlignedDimension=Ti;exports.AcDbAngleUnits=Na;exports.AcDbArc=pi;exports.AcDbArcDimension=Pa;exports.AcDbBaseWorker=C0;exports.AcDbBatchProcessing=Ta;exports.AcDbBlockReference=Us;exports.AcDbBlockTable=Hc;exports.AcDbBlockTableRecord=pt;exports.AcDbCircle=mi;exports.AcDbCodePage=Ca;exports.AcDbCurve=Et;exports.AcDbDataGenerator=kh;exports.AcDbDatabase=L0;exports.AcDbDatabaseConverter=Za;exports.AcDbDatabaseConverterManager=dr;exports.AcDbDiametricDimension=Ni;exports.AcDbDictionary=Ka;exports.AcDbDimArrowType=Mh;exports.AcDbDimStyleTable=Yc;exports.AcDbDimStyleTableRecord=Wn;exports.AcDbDimTextHorizontal=Zc;exports.AcDbDimTextVertical=Qc;exports.AcDbDimVerticalJustification=tu;exports.AcDbDimZeroSuppression=Jc;exports.AcDbDimZeroSuppressionAngular=eu;exports.AcDbDimension=Or;exports.AcDbDwgVersion=Bi;exports.AcDbDxfConverter=jc;exports.AcDbEllipse=gi;exports.AcDbEntity=Pt;exports.AcDbFace=fi;exports.AcDbFileType=Ds;exports.AcDbHatch=Vs;exports.AcDbHatchPatternType=yh;exports.AcDbHatchStyle=vh;exports.AcDbHostApplicationServices=zi;exports.AcDbLayerTable=qc;exports.AcDbLayerTableRecord=Ki;exports.AcDbLayout=Yi;exports.AcDbLayoutDictionary=Ph;exports.AcDbLayoutManager=nu;exports.AcDbLeader=_i;exports.AcDbLeaderAnnotationType=bh;exports.AcDbLine=yi;exports.AcDbLineSpacingStyle=Ih;exports.AcDbLinetypeTable=Xc;exports.AcDbLinetypeTableRecord=Fs;exports.AcDbMText=vi;exports.AcDbObject=Jr;exports.AcDbObjectIterator=qi;exports.AcDbOrdinateDimension=Ci;exports.AcDbOsnapMode=yn;exports.AcDbPoint=Si;exports.AcDbPoly2dType=Vn;exports.AcDbPoly3dType=Rs;exports.AcDbPolyline=Ai;exports.AcDbRadialDimension=Li;exports.AcDbRasterImage=js;exports.AcDbRasterImageClipBoundaryType=Ah;exports.AcDbRasterImageDef=Eh;exports.AcDbRasterImageImageDisplayOpt=Sh;exports.AcDbRay=Ii;exports.AcDbRegenerator=Wc;exports.AcDbRenderingCache=Xr;exports.AcDbSpline=Gs;exports.AcDbSymbolTable=Sn;exports.AcDbSymbolTableRecord=An;exports.AcDbSysVarManager=ka;exports.AcDbTable=bi;exports.AcDbText=xi;exports.AcDbTextHorizontalMode=xh;exports.AcDbTextStyleTable=Kc;exports.AcDbTextStyleTableRecord=ro;exports.AcDbTextVerticalMode=wh;exports.AcDbTrace=wi;exports.AcDbUnitsValue=$a;exports.AcDbViewport=Pi;exports.AcDbViewportTable=$c;exports.AcDbViewportTableRecord=ru;exports.AcDbWipeout=Ei;exports.AcDbWorkerApi=Vc;exports.AcDbWorkerManager=Uc;exports.AcDbXline=ki;exports.AcGeArea2d=Gi;exports.AcGeBox2d=vt;exports.AcGeBox3d=Ne;exports.AcGeCatmullRomCurve3d=dh;exports.AcGeCircArc2d=jn;exports.AcGeCircArc3d=ja;exports.AcGeCurve2d=Yn;exports.AcGeEllipseArc2d=ji;exports.AcGeEllipseArc3d=Wi;exports.AcGeEuler=oh;exports.AcGeGeometryUtil=Jl;exports.AcGeLine2d=zs;exports.AcGeLine3d=ci;exports.AcGeLoop2d=Wa;exports.AcGeMathUtil=ke;exports.AcGeMatrix2d=Vi;exports.AcGeMatrix3d=$r;exports.AcGeNurbsCurve=bn;exports.AcGePlane=Ws;exports.AcGePoint2d=Te;exports.AcGePoint3d=Y;exports.AcGePolyline2d=wn;exports.AcGeQuaternion=Kr;exports.AcGeShape2d=Ga;exports.AcGeSpline3d=Zr;exports.AcGeTol=Fa;exports.AcGeVector2d=Ze;exports.AcGeVector3d=Z;exports.AcGiArrowType=Ha;exports.AcGiDefaultLightingType=Xa;exports.AcGiLineWeight=Hi;exports.AcGiMTextAttachmentPoint=It;exports.AcGiMTextFlowDirection=Lr;exports.AcGiOrthographicType=qa;exports.AcGiRenderMode=Ya;exports.AcGiViewport=ph;exports.AcTrStringUtil=Mu;exports.ByBlock=Tl;exports.ByLayer=ti;exports.DEBUG_MODE=Eu;exports.DEFAULT_LINE_TYPE=li;exports.DEFAULT_TOL=Ua;exports.DEG2RAD=La;exports.DefaultLoadingManager=kl;exports.FLOAT_TOL=_n;exports.ORIGIN_POINT_2D=Cu;exports.ORIGIN_POINT_3D=Da;exports.RAD2DEG=Oa;exports.TAU=st;exports.acdbHostApplicationServices=no;exports.basisFunction=hi;exports.calculateCurveLength=nh;exports.ceilPowerOfTwo=Hl;exports.clamp=Cr;exports.clone=Ns;exports.createWorkerApi=Gc;exports.damp=Ol;exports.deepClone=va;exports.defaults=Hn;exports.degToRad=Gl;exports.dwgCodePageToEncoding=Ml;exports.euclideanModulo=Ba;exports.evaluateNurbsPoint=Bs;exports.floorPowerOfTwo=Yl;exports.generateChordKnots=th;exports.generateSqrtChordKnots=rh;exports.generateUUID=Nl;exports.generateUniformKnots=eh;exports.has=vl;exports.intPartLength=Ra;exports.interpolateControlPoints=Lu;exports.inverseLerp=Ll;exports.isBetween=ql;exports.isBetweenAngle=Xl;exports.isEmpty=bl;exports.isEqual=Gn;exports.isImperialUnits=Wu;exports.isMetricUnits=ju;exports.isPointInPolygon=Va;exports.isPolygonIntersect=Ql;exports.isPowerOfTwo=Wl;exports.lerp=za;exports.log=Ls;exports.mapLinear=Cl;exports.normalizeAngle=Os;exports.pingpong=Bl;exports.radToDeg=jl;exports.randFloat=Fl;exports.randFloatSpread=Ul;exports.randInt=Dl;exports.relativeEps=Kl;exports.seededRandom=Vl;exports.setLogLevel=ku;exports.smootherstep=Rl;exports.smoothstep=zl;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function bu(i,t){for(var e=0;e<t.length;e++){const n=t[e];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in i)){const h=Object.getOwnPropertyDescriptor(n,a);h&&Object.defineProperty(i,a,h.get?h:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var pt=(i=>(i[i.ByColor=1]="ByColor",i[i.ByACI=2]="ByACI",i[i.ByLayer=3]="ByLayer",i[i.ByBlock=4]="ByBlock",i[i.None=0]="None",i))(pt||{});const el={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},ia=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];let gn=class{static getColorByIndex(t){return ia[t]}static getIndexByColor(t){const e=ia.length-1;for(let n=1;n<e;++n)if(ia[n]===t)return n}static getColorByName(t){return el[t.toLowerCase()]}static getNameByColor(t){for(const[e,n]of Object.entries(el))if(n===t)return e}static getNameByIndex(t){const e=this.getColorByIndex(t);return this.getNameByColor(e)}},zr=class fn{constructor(t=pt.ByLayer,e){this._colorMethod=t,this._colorMethod==pt.ByColor&&e==null?this._value=16777215:this._colorMethod==pt.ByACI?e==null?this._value=8:e===0?this._colorMethod=pt.ByBlock:e===256?this._colorMethod=pt.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}get colorMethod(){return this._colorMethod}set colorMethod(t){this._colorMethod=t}get red(){const t=this.RGB;return t!=null?t>>16&255:void 0}get green(){const t=this.RGB;return t!=null?t>>8&255:void 0}get blue(){const t=this.RGB;return t!=null?t&255:void 0}get RGB(){switch(this._colorMethod){case pt.ByColor:case pt.ByBlock:case pt.ByLayer:return this._value;case pt.ByACI:return this._value?gn.getColorByIndex(this._value):this._value;default:return}}setRGB(t,e,n){const a=Math.max(0,Math.min(255,Math.round(t))),h=Math.max(0,Math.min(255,Math.round(e))),c=Math.max(0,Math.min(255,Math.round(n)));return this._value=a<<16|h<<8|c,this._colorMethod=pt.ByColor,this}setRGBValue(t){return t==null||!Number.isFinite(t)?(console.warn("Invalid RGB value:",t),this):(this._value=t&16777215,this._colorMethod=pt.ByColor,this)}setRGBFromCss(t){if(!t)return this;const e=t.trim().toLowerCase();if(e.startsWith("#")){let h=0,c=0,g=0;if(e.length===7)h=parseInt(e.substr(1,2),16),c=parseInt(e.substr(3,2),16),g=parseInt(e.substr(5,2),16);else if(e.length===4)h=parseInt(e[1]+e[1],16),c=parseInt(e[2]+e[2],16),g=parseInt(e[3]+e[3],16);else return console.warn("Invalid hex color:",t),this;return this.setRGB(h,c,g)}const n=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n){const h=parseInt(n[1],10),c=parseInt(n[2],10),g=parseInt(n[3],10);return this.setRGB(h,c,g)}const a=gn.getColorByName(t);return a!==void 0?this.setRGBValue(a):(console.warn("Unknown CSS color string:",t),this)}setScalar(t){return this.setRGB(t,t,t)}get hexColor(){const t=this.RGB;return t==null?void 0:"0x"+t.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const t=this.RGB;if(t!=null)return`rgb(${t>>16&255},${t>>8&255},${t&255})`}get colorIndex(){return this._colorMethod===pt.ByACI?this._value:this._colorMethod===pt.ByLayer?256:this._colorMethod===pt.ByBlock?0:void 0}set colorIndex(t){if(t==null)return;const e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=pt.ByBlock,this._value=void 0):e===256?(this._colorMethod=pt.ByLayer,this._value=void 0):(this._colorMethod=pt.ByACI,this._value=e)}get isByColor(){return this._colorMethod===pt.ByColor}get isByACI(){return this._colorMethod===pt.ByACI}get isByLayer(){return this._colorMethod===pt.ByLayer}setByLayer(t){return this._colorMethod=pt.ByLayer,t==null?this._value=256:this._value=t,this}get isByBlock(){return this._colorMethod===pt.ByBlock}setByBlock(t){return this._colorMethod=pt.ByBlock,t==null?this._value=0:this._value=t,this}get colorName(){switch(this._colorMethod){case pt.ByLayer:return"ByLayer";case pt.ByBlock:return"ByBlock";case pt.ByColor:return this._value?gn.getNameByColor(this._value):"";case pt.ByACI:return this._value?gn.getNameByIndex(this._value):"";default:return}}set colorName(t){if(!t)return;const e=gn.getColorByName(t);e!==void 0?(this._value=e,this._colorMethod=pt.ByColor):console.warn("Unknown color name:",t)}clone(){const t=new fn;return t._colorMethod=this._colorMethod,t._value=this._value,t}copy(t){return this._colorMethod=t._colorMethod,this._value=t._value,this}equals(t){return this._colorMethod===t._colorMethod&&this._value===t._value}toString(){switch(this._colorMethod){case pt.ByLayer:return"ByLayer";case pt.ByBlock:return"ByBlock";case pt.ByACI:return this._value!==void 0?String(this._value):"";case pt.ByColor:return this._value?`${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(t){if(!t)return;const e=t.trim();if(/^bylayer$/i.test(e))return new fn(pt.ByLayer);if(/^byblock$/i.test(e))return new fn(pt.ByBlock);if(/^\d{1,3},\d{1,3},\d{1,3}$/i.test(e)){const[a,h,c]=e.split(",").map(Number),g=new fn(pt.ByColor);return g.setRGB(a,h,c),g}if(/^\d+$/.test(e)){const a=parseInt(e,10);return new fn(pt.ByACI,a)}const n=gn.getColorByName(e);if(n!=null)return new fn(pt.ByColor,n);console.warn("Unknown color name:",t)}};class xu{constructor(t=pt.ByColor,e=0){this._colorMethod=t,this._value=e}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(t){this._colorMethod=pt.ByColor,this._value=this._value&65535|(t&255)<<16}get green(){return this._value>>8&255}set green(t){this._colorMethod=pt.ByColor,this._value=this._value&16711935|(t&255)<<8}get blue(){return this._value&255}set blue(t){this._colorMethod=pt.ByColor,this._value=this._value&16776960|t&255}setRGB(t,e,n){this._colorMethod=pt.ByColor,this._value=(t&255)<<16|(e&255)<<8|n&255}get colorIndex(){return this._value}set colorIndex(t){this._colorMethod=pt.ByACI,this._value=t}get layerIndex(){return this._value}set layerIndex(t){this._colorMethod=pt.ByLayer,this._value=t}isByColor(){return this._colorMethod===pt.ByColor}isByLayer(){return this._colorMethod===pt.ByLayer}isByBlock(){return this._colorMethod===pt.ByBlock}isByACI(){return this._colorMethod===pt.ByACI}isNone(){return this._colorMethod===pt.None}get rawValue(){return this._value}set rawValue(t){this._value=t}}const qe={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")}};class wu{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const n=this._listeners[t];if(n!==void 0){const a=n.indexOf(e);a!==-1&&n.splice(a,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const n=e.slice(0);for(let a=0,h=n.length;a<h;a++)n[a].call(this,t)}}}let oe=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const n of this.listeners)n.call(null,t,...e)}};function Ls(i){return i===null||typeof i!="object"?i:Array.isArray(i)?[...i]:{...i}}function ba(i){if(i===null||typeof i!="object")return i;if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp)return new RegExp(i.source,i.flags);if(Array.isArray(i))return i.map(ba);const t={};for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=ba(i[e]));return t}function qn(i,...t){for(const e of t)if(e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&i[n]===void 0&&(i[n]=e[n]);return i}function bl(i,t){return i!=null&&Object.prototype.hasOwnProperty.call(i,t)}function xl(i){return i==null?!0:Array.isArray(i)||typeof i=="string"?i.length===0:i instanceof Map||i instanceof Set?i.size===0:typeof i=="object"?Object.keys(i).length===0:!1}function Un(i,t){if(i===t)return!0;if(i==null||t==null)return i===t;if(typeof i!=typeof t)return!1;if(typeof i!="object")return i===t;if(Array.isArray(i)!==Array.isArray(t))return!1;if(Array.isArray(i)){if(i.length!==t.length)return!1;for(let a=0;a<i.length;a++)if(!Un(i[a],t[a]))return!1;return!0}const e=Object.keys(i),n=Object.keys(t);if(e.length!==n.length)return!1;for(const a of e)if(!Object.prototype.hasOwnProperty.call(t,a)||!Un(i[a],t[a]))return!1;return!0}var Au=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pu(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var wl={exports:{}};(function(i){(function(t,e){i.exports?i.exports=e():t.log=e()})(Au,function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],h={},c=null;function g(O,F){var D=O[F];if(typeof D.bind=="function")return D.bind(O);try{return Function.prototype.bind.call(D,O)}catch{return function(){return Function.prototype.apply.apply(D,[O,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(O){return O==="debug"&&(O="log"),typeof console===e?!1:O==="trace"&&n?b:console[O]!==void 0?g(console,O):console.log!==void 0?g(console,"log"):t}function w(){for(var O=this.getLevel(),F=0;F<a.length;F++){var D=a[F];this[D]=F<O?t:this.methodFactory(D,O,this.name)}if(this.log=this.debug,typeof console===e&&O<this.levels.SILENT)return"No console available for logging"}function x(O){return function(){typeof console!==e&&(w.call(this),this[O].apply(this,arguments))}}function I(O,F,D){return f(O)||x.apply(this,arguments)}function M(O,F){var D=this,dt,vt,ot,H="loglevel";typeof O=="string"?H+=":"+O:typeof O=="symbol"&&(H=void 0);function ct(wt){var Bt=(a[wt]||"silent").toUpperCase();if(!(typeof window===e||!H)){try{window.localStorage[H]=Bt;return}catch{}try{window.document.cookie=encodeURIComponent(H)+"="+Bt+";"}catch{}}}function st(){var wt;if(!(typeof window===e||!H)){try{wt=window.localStorage[H]}catch{}if(typeof wt===e)try{var Bt=window.document.cookie,ge=encodeURIComponent(H),fe=Bt.indexOf(ge+"=");fe!==-1&&(wt=/^([^;]+)/.exec(Bt.slice(fe+ge.length+1))[1])}catch{}return D.levels[wt]===void 0&&(wt=void 0),wt}}function Gt(){if(!(typeof window===e||!H)){try{window.localStorage.removeItem(H)}catch{}try{window.document.cookie=encodeURIComponent(H)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Kt(wt){var Bt=wt;if(typeof Bt=="string"&&D.levels[Bt.toUpperCase()]!==void 0&&(Bt=D.levels[Bt.toUpperCase()]),typeof Bt=="number"&&Bt>=0&&Bt<=D.levels.SILENT)return Bt;throw new TypeError("log.setLevel() called with invalid level: "+wt)}D.name=O,D.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},D.methodFactory=F||I,D.getLevel=function(){return ot??vt??dt},D.setLevel=function(wt,Bt){return ot=Kt(wt),Bt!==!1&&ct(ot),w.call(D)},D.setDefaultLevel=function(wt){vt=Kt(wt),st()||D.setLevel(wt,!1)},D.resetLevel=function(){ot=null,Gt(),w.call(D)},D.enableAll=function(wt){D.setLevel(D.levels.TRACE,wt)},D.disableAll=function(wt){D.setLevel(D.levels.SILENT,wt)},D.rebuild=function(){if(c!==D&&(dt=Kt(c.getLevel())),w.call(D),c===D)for(var wt in h)h[wt].rebuild()},dt=Kt(c?c.getLevel():"WARN");var qt=st();qt!=null&&(ot=Kt(qt)),w.call(D)}c=new M,c.getLogger=function(O){if(typeof O!="symbol"&&typeof O!="string"||O==="")throw new TypeError("You must supply a name when creating a logger.");var F=h[O];return F||(F=h[O]=new M(O,c.methodFactory)),F};var L=typeof window!==e?window.log:void 0;return c.noConflict=function(){return typeof window!==e&&window.log===c&&(window.log=L),c},c.getLoggers=function(){return h},c.default=c,c})})(wl);var Al=wl.exports;const Su=Pu(Al),Iu=bu({__proto__:null,default:Su},[Al]),Eu=!0,Bs=Iu;Bs.setLevel("debug");const Mu=i=>{try{Bs.setLevel(i)}catch(t){Bs.setLevel("error"),Bs.error(t)}};let Pl=class Sl{constructor(t,e){this.events={attrChanged:new oe,modelChanged:new oe},this._changing=!1,this._previousAttributes={},this._pending=!1;const n=t||{};e&&qn(n,e),this.attributes=n,this.changed={}}get(t){return this.attributes[t]}set(t,e,n){if(t==null)return this;let a;typeof t=="object"?(a=t,n=e):(a={},a[t]=e),n||(n={});const h=n.unset,c=n.silent,g=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=Ls(this.attributes),this.changed={});const f=this.attributes,w=this.changed,x=this._previousAttributes;for(const I in a)e=a[I],Un(f[I],e)||g.push(I),Un(x[I],e)?delete w[I]:w[I]=e,h?delete f[I]:f[I]=e;if(!c){g.length&&(this._pending=n);for(let I=0;I<g.length;I++)this.events.attrChanged.dispatch({object:this,attrName:g[I],attrValue:f[g[I]],options:n})}if(b)return this;if(!c)for(;this._pending;)n=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:n});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!xl(this.changed):bl(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?Ls(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,n={};for(const a in t){const h=t[a];Un(e[a],h)||(n[a]=h)}return n}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return Ls(this._previousAttributes)}clone(){const t=Ls(this.attributes);return new Sl(t)}},Ta=class Os{constructor(){this.entries=new Map}static getInstance(){return Os.instance||(Os.instance=new Os),Os.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries)console.log(`${t}:`),console.log(e.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class ku{static formatBytes(t,e=2){if(t===0)return"0 B";const n=1024,a=Math.max(0,e),h=["B","KB","MB","GB","TB"],c=Math.floor(Math.log(t)/Math.log(n)),g=t/Math.pow(n,c);return`${parseFloat(g.toFixed(a))} ${h[c]}`}}var Ie=(i=>(i[i.ByLayer=0]="ByLayer",i[i.ByBlock=1]="ByBlock",i[i.ByAlpha=2]="ByAlpha",i[i.ErrorValue=3]="ErrorValue",i))(Ie||{});let Ui=class dr{constructor(t){t!==void 0?(this._method=Ie.ByAlpha,this._alpha=dr.clampAlpha(t)):(this._method=Ie.ByLayer,this._alpha=255)}get method(){return this._method}set method(t){this._method=t}get alpha(){return this._alpha}set alpha(t){this._alpha=dr.clampAlpha(t),this._method=Ie.ByAlpha}get percentage(){if(this._method===Ie.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(t){const e=Math.max(0,Math.min(100,t)),n=Math.round(255*(1-e/100));this.alpha=n}static clampAlpha(t){return Math.max(0,Math.min(255,Math.floor(t)))}get isByAlpha(){return this._method===Ie.ByAlpha}get isByBlock(){return this._method===Ie.ByBlock}get isByLayer(){return this._method===Ie.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===Ie.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const t=new dr;return t._method=this._method,t._alpha=this._alpha,t}equals(t){return this._method===t._method&&this._alpha===t._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(t){const e=t.trim();if(/^bylayer$/i.test(e)){const h=new dr;return h._method=Ie.ByLayer,h}if(/^byblock$/i.test(e)){const h=new dr;return h._method=Ie.ByBlock,h}const n=Number(e);if(Number.isInteger(n)&&n>=0&&n<=255)return new dr(n);const a=new dr;return a._method=Ie.ErrorValue,a}static deserialize(t){const e=t>>>24&255,n=t&255,a=Object.values(Ie)[e]??Ie.ErrorValue,h=new dr;return h._method=a,h._alpha=dr.clampAlpha(n),h}};class Il{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}let El=class{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(t){return new Promise((e,n)=>{const a=()=>{Promise.resolve(t()).then(e).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(a):setTimeout(a,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let n=t;for(let a=0;a<e;a++){const h=this.tasks[a];try{n=await this.scheduleTask(async()=>{const c=await h.run(n);return this.onProgress((a+1)/e,h),c})}catch(c){if(this.onError({error:c,taskIndex:a,task:h}))break}}this.onComplete(n)}},Ml=class{constructor(t,e,n){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,n=this.handlers.length;e<n;e+=2){const a=this.handlers[e],h=this.handlers[e+1];if(a.global&&(a.lastIndex=0),a.test(t))return h}return null}};const kl=new Ml;class Tu{constructor(t){this.manager=t!==void 0?t:kl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((n,a)=>{this.load(t,n,e,a)})}parse(t){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}class Ca{constructor(t,e,n){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=n,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,n)=>{const a=()=>{Promise.resolve(t()).then(e).catch(n)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(a):setTimeout(a,0)})}async processChunk(t){let e=0;const n=async()=>{const a=e,h=Math.min(e+this._chunkSize,this._count);await t(a,h),e=h,e<this._count&&await this.scheduleTask(n)};await n()}}var Na=(i=>(i[i.DecimalDegrees=0]="DecimalDegrees",i[i.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",i[i.Gradians=2]="Gradians",i[i.Radians=3]="Radians",i[i.SurveyorsUnits=4]="SurveyorsUnits",i))(Na||{});class Yn{static get instance(){return this._instance||(this._instance=new Yn),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,n,a=!0,h,c){var b;const g=[];if(e!=null){const f=this.createKey(e.name,n);let w;if(this.has(f))w=this.get(f);else{const x=(b=t.basePoint)==null?void 0:b.clone();t.basePoint=void 0;const I=e.newIterator();let M=!0;for(const L of I)if(L.color.isByBlock&&n?(rl.copy(L.color),L.color.setRGBValue(n),this.addEntity(L,g,t),L.color.copy(rl)):this.addEntity(L,g,t),M){const O=g[0];t.basePoint=O.basePoint,M=!1}w=t.group(g),w&&a&&le.name&&!le.name.startsWith("*U")&&this.set(f,w),t.basePoint=x}return w&&h&&(w.applyMatrix(h),c&&(c.x!=0||c.y!=0||c.z!=1)&&(h.setFromExtrusionDirection(c),w.applyMatrix(h))),w}else return t.group(g)}addEntity(t,e,n){const a=t.worldDraw(n);a&&(this.attachEntityInfo(a,t),e.push(a))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const rl=new zr;var La=(i=>(i[i.UTF8=0]="UTF8",i[i.US_ASCII=1]="US_ASCII",i[i.ISO_8859_1=2]="ISO_8859_1",i[i.ISO_8859_2=3]="ISO_8859_2",i[i.ISO_8859_3=4]="ISO_8859_3",i[i.ISO_8859_4=5]="ISO_8859_4",i[i.ISO_8859_5=6]="ISO_8859_5",i[i.ISO_8859_6=7]="ISO_8859_6",i[i.ISO_8859_7=8]="ISO_8859_7",i[i.ISO_8859_8=9]="ISO_8859_8",i[i.ISO_8859_9=10]="ISO_8859_9",i[i.CP437=11]="CP437",i[i.CP850=12]="CP850",i[i.CP852=13]="CP852",i[i.CP855=14]="CP855",i[i.CP857=15]="CP857",i[i.CP860=16]="CP860",i[i.CP861=17]="CP861",i[i.CP863=18]="CP863",i[i.CP864=19]="CP864",i[i.CP865=20]="CP865",i[i.CP869=21]="CP869",i[i.CP932=22]="CP932",i[i.MACINTOSH=23]="MACINTOSH",i[i.BIG5=24]="BIG5",i[i.CP949=25]="CP949",i[i.JOHAB=26]="JOHAB",i[i.CP866=27]="CP866",i[i.ANSI_1250=28]="ANSI_1250",i[i.ANSI_1251=29]="ANSI_1251",i[i.ANSI_1252=30]="ANSI_1252",i[i.GB2312=31]="GB2312",i[i.ANSI_1253=32]="ANSI_1253",i[i.ANSI_1254=33]="ANSI_1254",i[i.ANSI_1255=34]="ANSI_1255",i[i.ANSI_1256=35]="ANSI_1256",i[i.ANSI_1257=36]="ANSI_1257",i[i.ANSI_874=37]="ANSI_874",i[i.ANSI_932=38]="ANSI_932",i[i.ANSI_936=39]="ANSI_936",i[i.ANSI_949=40]="ANSI_949",i[i.ANSI_950=41]="ANSI_950",i[i.ANSI_1361=42]="ANSI_1361",i[i.UTF16=43]="UTF16",i[i.ANSI_1258=44]="ANSI_1258",i[i.UNDEFINED=255]="UNDEFINED",i))(La||{});const Cu=["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"],Tl=i=>Cu[i],di="Continuous",ii="ByLayer",Cl="ByBlock",ve=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let nl=1234567;const Oa=Math.PI/180,Ba=180/Math.PI;function Nl(){const i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ve[i&255]+ve[i>>8&255]+ve[i>>16&255]+ve[i>>24&255]+"-"+ve[t&255]+ve[t>>8&255]+"-"+ve[t>>16&15|64]+ve[t>>24&255]+"-"+ve[e&63|128]+ve[e>>8&255]+"-"+ve[e>>16&255]+ve[e>>24&255]+ve[n&255]+ve[n>>8&255]+ve[n>>16&255]+ve[n>>24&255]).toLowerCase()}function Lr(i,t,e){return Math.max(t,Math.min(e,i))}function za(i,t){return(i%t+t)%t}function Ll(i,t,e,n,a){return n+(i-t)*(a-n)/(e-t)}function Ol(i,t,e){return i!==t?(e-i)/(t-i):0}function Ra(i,t,e){return(1-e)*i+e*t}function Bl(i,t,e,n){return Ra(i,t,1-Math.exp(-e*n))}function zl(i,t=1){return t-Math.abs(za(i,t*2)-t)}function Rl(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function Dl(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Fl(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Vl(i,t){return i+Math.random()*(t-i)}function Ul(i){return i*(.5-Math.random())}function jl(i){i!==void 0&&(nl=i);let t=nl+=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 Gl(i){return i*Oa}function Wl(i){return i*Ba}function Hl(i){return(i&i-1)===0&&i!==0}function ql(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Yl(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function zs(i){const t=Math.PI*2;return(i%t+t)%t}function Xl(i,t,e){return i>t&&i<e||i>e&&i<t}function Kl(i,t,e,n=!1){return i=zs(i),t=zs(t),e=zs(e),n?t>e?i<=t&&i>=e:i<=t||i>=e:t<e?i>=t&&i<=e:i>=t||i<=e}function Da(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function $l(i,t=1e-7){const e=Da(i);return Math.max(Math.pow(10,e)*t,t)}const Pt={DEG2RAD:Oa,RAD2DEG:Ba,generateUUID:Nl,clamp:Lr,euclideanModulo:za,mapLinear:Ll,inverseLerp:Ol,lerp:Ra,damp:Bl,pingpong:zl,smoothstep:Rl,smootherstep:Dl,randInt:Fl,randFloat:Vl,randFloatSpread:Ul,seededRandom:jl,degToRad:Gl,radToDeg:Wl,isPowerOfTwo:Hl,ceilPowerOfTwo:ql,floorPowerOfTwo:Yl,normalizeAngle:zs,isBetween:Xl,isBetweenAngle:Kl,intPartLength:Da,relativeEps:$l},xa=class Zl{constructor(t,e){this.x=0,this.y=0;const n=+(t!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(n===1){const{x:a,y:h}=t;this.x=a,this.y=h;return}if(n===2){this.x=t,this.y=e;return}throw qe.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new Zl(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const e=this.x,n=this.y,a=t.elements;return this.x=a[0]*e+a[3]*n+a[6],this.y=a[1]*e+a[4]*n+a[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,n)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const n=Math.cos(e),a=Math.sin(e),h=this.x-t.x,c=this.y-t.y;return this.x=h*n-c*a+t.x,this.y=h*a+c*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(Pt.relativeEps(this.x,t),Pt.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};xa.EMPTY=Object.freeze(new xa(0,0));let Jt=xa;const wa=class Ql{constructor(t,e,n,a,h,c,g,b,f){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&n!=null&&a!=null&&h!=null&&c!=null&&g!=null&&b!=null&&f!=null&&this.set(t,e,n,a,h,c,g,b,f)}set(t,e,n,a,h,c,g,b,f){const w=this.elements;return w[0]=t,w[1]=a,w[2]=g,w[3]=e,w[4]=h,w[5]=b,w[6]=n,w[7]=c,w[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,a=e.elements,h=this.elements,c=n[0],g=n[3],b=n[6],f=n[1],w=n[4],x=n[7],I=n[2],M=n[5],L=n[8],O=a[0],F=a[3],D=a[6],dt=a[1],vt=a[4],ot=a[7],H=a[2],ct=a[5],st=a[8];return h[0]=c*O+g*dt+b*H,h[3]=c*F+g*vt+b*ct,h[6]=c*D+g*ot+b*st,h[1]=f*O+w*dt+x*H,h[4]=f*F+w*vt+x*ct,h[7]=f*D+w*ot+x*st,h[2]=I*O+M*dt+L*H,h[5]=I*F+M*vt+L*ct,h[8]=I*D+M*ot+L*st,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],a=t[2],h=t[3],c=t[4],g=t[5],b=t[6],f=t[7],w=t[8];return e*c*w-e*g*f-n*h*w+n*g*b+a*h*f-a*c*b}invert(){const t=this.elements,e=t[0],n=t[1],a=t[2],h=t[3],c=t[4],g=t[5],b=t[6],f=t[7],w=t[8],x=w*c-g*f,I=g*b-w*h,M=f*h-c*b,L=e*x+n*I+a*M;if(L===0)return this.set(0,0,0,0,0,0,0,0,0);const O=1/L;return t[0]=x*O,t[1]=(a*f-w*n)*O,t[2]=(g*n-a*c)*O,t[3]=I*O,t[4]=(w*e-a*b)*O,t[5]=(a*h-g*e)*O,t[6]=M*O,t[7]=(n*b-f*e)*O,t[8]=(c*e-n*h)*O,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this}setUvTransform(t,e,n,a,h,c,g){const b=Math.cos(h),f=Math.sin(h);return this.set(n*b,n*f,-n*(b*c+f*g)+c+t,-a*f,a*b,-a*(-f*c+b*g)+g+e,0,0,1),this}scale(t,e){return this.premultiply(aa.makeScale(t,e)),this}rotate(t){return this.premultiply(aa.makeRotation(-t)),this}translate(t,e){return this.premultiply(aa.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof Jt?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let a=0;a<9;a++)if(e[a]!==n[a])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new Ql().fromArray(this.elements)}};wa.IDENTITY=Object.freeze(new wa);let ji=wa;const aa=new ji,_n=1e-6,Zt=2*Math.PI,Nu={x:0,y:0},Fa={x:0,y:0,z:0};class Va{constructor(){this.equalPointTol=_n,this.equalVectorTol=_n}equalPoint2d(t,e){return new Jt(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new X(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=_n){return t<e&&t>-e}static equal(t,e,n=_n){return Math.abs(t-e)<n}static great(t,e,n=_n){return t-e>n}static less(t,e,n=_n){return t-e<n}}const Ua=new Va;function ja(i,t,e=!1){const n=i.x,a=i.y;let h=!1;const c=t.length;for(let g=0,b=c-1;g<c;b=g++){const f=t[g].x,w=t[g].y,x=t[b].x,I=t[b].y;let M=w>a!=I>a;e&&(M=w>=a!=I>=a),M&&n<(x-f)*(a-w)/(I-w)+f&&(h=!h)}return h}function Jl(i,t){if(i.length===0||t.length===0)return!1;const e=new xe().setFromPoints(i),n=new xe().setFromPoints(t);if(!e.intersectsBox(n))return!1;for(let a=0;a<i.length;){if(ja(i[a],t,!0))return!0;a<i.length-1&&Ua.equalPoint2d(i[a+1],i[a])&&++a,++a}return!1}const th={isPointInPolygon:ja,isPolygonIntersect:Jl};function eh(i,t){const e=[],n=t-1,a=i;for(let h=0;h<=a;h++)e.push(0);for(let h=1;h<=n-a;h++)e.push(h);for(let h=0;h<=a;h++)e.push(n-a+1);return e}function rh(i,t){const e=t.length-1,n=i,a=[0];let h=0;for(let g=1;g<=e;g++){const b=t[g][0]-t[g-1][0],f=t[g][1]-t[g-1][1],w=t[g][2]-t[g-1][2],x=Math.sqrt(b*b+f*f+w*w);h+=x,a.push(h)}const c=[];for(let g=0;g<=n;g++)c.push(0);for(let g=1;g<=e-n;g++){const b=a[g]/h;c.push(b*(e-n+1))}for(let g=0;g<=n;g++)c.push(e-n+1);return c}function nh(i,t){const e=t.length-1,n=i,a=[0];let h=0;for(let g=1;g<=e;g++){const b=t[g][0]-t[g-1][0],f=t[g][1]-t[g-1][1],w=t[g][2]-t[g-1][2],x=Math.sqrt(b*b+f*f+w*w),I=Math.sqrt(x);h+=I,a.push(h)}const c=[];for(let g=0;g<=n;g++)c.push(0);for(let g=1;g<=e-n;g++){const b=a[g]/h;c.push(b*(e-n+1))}for(let g=0;g<=n;g++)c.push(e-n+1);return c}function pi(i,t,e,n){if(t===0)return e>=n[i]&&e<n[i+1]?1:0;const a=n[i+t]-n[i],h=n[i+t+1]-n[i+1],c=a>1e-10?(e-n[i])/a:0,g=h>1e-10?(n[i+t+1]-e)/h:0;return c*pi(i,t-1,e,n)+g*pi(i+1,t-1,e,n)}function Rs(i,t,e,n,a){const h=n.length-1,c=t;if(i=Math.max(e[c],Math.min(e[h+1],i)),Math.abs(i-e[h+1])<1e-8)return[...n[h]];if(Math.abs(i-e[c])<1e-8)return[...n[0]];const g=[0,0,0];let b=0;for(let f=0;f<=h;f++){const w=pi(f,c,i,e),x=a[f]*w;g[0]+=n[f][0]*x,g[1]+=n[f][1]*x,g[2]+=n[f][2]*x,b+=x}if(b<1e-10){const f=e[e.length-c-1];if(Math.abs(i-f)<1e-8)return[...n[h]];if(Math.abs(i-e[c])<1e-8)return[...n[0]]}return b>1e-10&&(g[0]/=b,g[1]/=b,g[2]/=b),g}function sh(i,t,e,n){const a=i,h=t[a],c=t[t.length-a-1];let g=0;const b=1e3,f=(c-h)/b;let w=Rs(h,i,t,e,n);for(let O=1;O<=b;O++){const F=h+O*f,D=Rs(F,i,t,e,n),dt=D[0]-w[0],vt=D[1]-w[1],ot=D[2]-w[2];g+=Math.sqrt(dt*dt+vt*vt+ot*ot),w=D}const x=Rs(c,i,t,e,n),I=x[0]-w[0],M=x[1]-w[1],L=x[2]-w[2];return g+=Math.sqrt(I*I+M*M+L*L),g}function Lu(i){return i.map(t=>[...t])}class $r{constructor(t=0,e=0,n=0,a=1){this._x=t,this._y=e,this._z=n,this._w=a}static slerpFlat(t,e,n,a,h,c,g){let b=n[a+0],f=n[a+1],w=n[a+2],x=n[a+3];const I=h[c+0],M=h[c+1],L=h[c+2],O=h[c+3];if(g===0){t[e+0]=b,t[e+1]=f,t[e+2]=w,t[e+3]=x;return}if(g===1){t[e+0]=I,t[e+1]=M,t[e+2]=L,t[e+3]=O;return}if(x!==O||b!==I||f!==M||w!==L){let F=1-g;const D=b*I+f*M+w*L+x*O,dt=D>=0?1:-1,vt=1-D*D;if(vt>Number.EPSILON){const H=Math.sqrt(vt),ct=Math.atan2(H,D*dt);F=Math.sin(F*ct)/H,g=Math.sin(g*ct)/H}const ot=g*dt;if(b=b*F+I*ot,f=f*F+M*ot,w=w*F+L*ot,x=x*F+O*ot,F===1-g){const H=1/Math.sqrt(b*b+f*f+w*w+x*x);b*=H,f*=H,w*=H,x*=H}}t[e]=b,t[e+1]=f,t[e+2]=w,t[e+3]=x}static multiplyQuaternionsFlat(t,e,n,a,h,c){const g=n[a],b=n[a+1],f=n[a+2],w=n[a+3],x=h[c],I=h[c+1],M=h[c+2],L=h[c+3];return t[e]=g*L+w*x+b*M-f*I,t[e+1]=b*L+w*I+f*x-g*M,t[e+2]=f*L+w*M+g*I-b*x,t[e+3]=w*L-g*x-b*I-f*M,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,a){return this._x=t,this._y=e,this._z=n,this._w=a,this._onChangeCallback(),this}clone(){return new $r(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t.x,a=t.y,h=t.z,c=t.order,g=Math.cos,b=Math.sin,f=g(n/2),w=g(a/2),x=g(h/2),I=b(n/2),M=b(a/2),L=b(h/2);switch(c){case"XYZ":this._x=I*w*x+f*M*L,this._y=f*M*x-I*w*L,this._z=f*w*L+I*M*x,this._w=f*w*x-I*M*L;break;case"YXZ":this._x=I*w*x+f*M*L,this._y=f*M*x-I*w*L,this._z=f*w*L-I*M*x,this._w=f*w*x+I*M*L;break;case"ZXY":this._x=I*w*x-f*M*L,this._y=f*M*x+I*w*L,this._z=f*w*L+I*M*x,this._w=f*w*x-I*M*L;break;case"ZYX":this._x=I*w*x-f*M*L,this._y=f*M*x+I*w*L,this._z=f*w*L-I*M*x,this._w=f*w*x+I*M*L;break;case"YZX":this._x=I*w*x+f*M*L,this._y=f*M*x+I*w*L,this._z=f*w*L-I*M*x,this._w=f*w*x-I*M*L;break;case"XZY":this._x=I*w*x-f*M*L,this._y=f*M*x-I*w*L,this._z=f*w*L+I*M*x,this._w=f*w*x+I*M*L;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,a=Math.sin(n);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],a=e[4],h=e[8],c=e[1],g=e[5],b=e[9],f=e[2],w=e[6],x=e[10],I=n+g+x;if(I>0){const M=.5/Math.sqrt(I+1);this._w=.25/M,this._x=(w-b)*M,this._y=(h-f)*M,this._z=(c-a)*M}else if(n>g&&n>x){const M=2*Math.sqrt(1+n-g-x);this._w=(w-b)/M,this._x=.25*M,this._y=(a+c)/M,this._z=(h+f)/M}else if(g>x){const M=2*Math.sqrt(1+g-n-x);this._w=(h-f)/M,this._x=(a+c)/M,this._y=.25*M,this._z=(b+w)/M}else{const M=2*Math.sqrt(1+x-n-g);this._w=(c-a)/M,this._x=(h+f)/M,this._y=(b+w)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Lr(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const a=Math.min(1,e/n);return this.slerp(t,a),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,a=t._y,h=t._z,c=t._w,g=e._x,b=e._y,f=e._z,w=e._w;return this._x=n*w+c*g+a*f-h*b,this._y=a*w+c*b+h*g-n*f,this._z=h*w+c*f+n*b-a*g,this._w=c*w-n*g-a*b-h*f,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,a=this._y,h=this._z,c=this._w;let g=c*t._w+n*t._x+a*t._y+h*t._z;if(g<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,g=-g):this.copy(t),g>=1)return this._w=c,this._x=n,this._y=a,this._z=h,this;const b=1-g*g;if(b<=Number.EPSILON){const M=1-e;return this._w=M*c+e*this._w,this._x=M*n+e*this._x,this._y=M*a+e*this._y,this._z=M*h+e*this._z,this.normalize(),this}const f=Math.sqrt(b),w=Math.atan2(f,g),x=Math.sin((1-e)*w)/f,I=Math.sin(e*w)/f;return this._w=c*x+this._w*I,this._x=n*x+this._x*I,this._y=a*x+this._y*I,this._z=h*x+this._z*I,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),a=Math.sqrt(1-n),h=Math.sqrt(n);return this.set(a*Math.sin(t),a*Math.cos(t),h*Math.sin(e),h*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const He=class ih{constructor(t,e,n){this.x=0,this.y=0,this.z=0;const a=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0);if(a!==0){if(a===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(a===1){const{x:h,y:c,z:g}=t;this.x=h,this.y=c,this.z=g||0;return}if(a===3){this.x=t,this.y=e,this.z=n;return}throw qe.ILLEGAL_PARAMETERS}}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new ih(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(sl.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(sl.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,a=this.z,h=t.elements;return this.x=h[0]*e+h[3]*n+h[6]*a,this.y=h[1]*e+h[4]*n+h[7]*a,this.z=h[2]*e+h[5]*n+h[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,a=this.z,h=t.elements,c=1/(h[3]*e+h[7]*n+h[11]*a+h[15]);return this.x=(h[0]*e+h[4]*n+h[8]*a+h[12])*c,this.y=(h[1]*e+h[5]*n+h[9]*a+h[13])*c,this.z=(h[2]*e+h[6]*n+h[10]*a+h[14])*c,this}applyQuaternion(t){const e=this.x,n=this.y,a=this.z,h=t.x,c=t.y,g=t.z,b=t.w,f=2*(c*a-g*n),w=2*(g*e-h*a),x=2*(h*n-c*e);return this.x=e+b*f+c*x-g*w,this.y=n+b*w+g*f-h*x,this.z=a+b*x+h*w-c*f,this}transformDirection(t){const e=this.x,n=this.y,a=this.z,h=t.elements;return this.x=h[0]*e+h[4]*n+h[8]*a,this.y=h[1]*e+h[5]*n+h[9]*a,this.z=h[2]*e+h[6]*n+h[10]*a,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const e=this.dot(t),n=this.length(),a=t.length();return Math.abs(e)===n*a}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,a=t.y,h=t.z,c=e.x,g=e.y,b=e.z;return this.x=a*b-h*g,this.y=h*c-n*b,this.z=n*g-a*c,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return oa.copy(this).projectOnVector(t),this.sub(oa)}reflect(t){return this.sub(oa.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,n)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,a=this.z-t.z;return e*e+n*n+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=a,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};He.X_AXIS=Object.freeze(new He(1,0,0)),He.NEGATIVE_X_AXIS=Object.freeze(new He(-1,0,0)),He.Y_AXIS=Object.freeze(new He(0,1,0)),He.NEGATIVE_Y_AXIS=Object.freeze(new He(0,-1,0)),He.Z_AXIS=Object.freeze(new He(0,0,1)),He.NEGATIVE_Z_AXIS=Object.freeze(new He(0,0,-1));let X=He;const oa=new X,sl=new $r,Aa=class ah{constructor(t,e,n,a,h,c,g,b,f,w,x,I,M,L,O,F){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&n!=null&&a!=null&&h!=null&&c!=null&&g!=null&&b!=null&&f!=null&&w!=null&&x!=null&&I!=null&&M!=null&&L!=null&&O!=null&&F!=null&&this.set(t,e,n,a,h,c,g,b,f,w,x,I,M,L,O,F)}set(t,e,n,a,h,c,g,b,f,w,x,I,M,L,O,F){const D=this.elements;return D[0]=t,D[4]=e,D[8]=n,D[12]=a,D[1]=h,D[5]=c,D[9]=g,D[13]=b,D[2]=f,D[6]=w,D[10]=x,D[14]=I,D[3]=M,D[7]=L,D[11]=O,D[15]=F,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ah().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Ua.equalPoint3d(t,X.Z_AXIS))this.identity();else{const e=new X(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(X.Y_AXIS,t).normalize():e.crossVectors(X.Z_AXIS,t).normalize();const n=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,n.x,n.y,n.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,a=1/Rn.setFromMatrixColumn(t,0).length(),h=1/Rn.setFromMatrixColumn(t,1).length(),c=1/Rn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*a,e[1]=n[1]*a,e[2]=n[2]*a,e[3]=0,e[4]=n[4]*h,e[5]=n[5]*h,e[6]=n[6]*h,e[7]=0,e[8]=n[8]*c,e[9]=n[9]*c,e[10]=n[10]*c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ou,t,Bu)}lookAt(t,e,n){const a=this.elements;return De.subVectors(t,e),De.lengthSq()===0&&(De.z=1),De.normalize(),Yr.crossVectors(n,De),Yr.lengthSq()===0&&(Math.abs(n.z)===1?De.x+=1e-4:De.z+=1e-4,De.normalize(),Yr.crossVectors(n,De)),Yr.normalize(),Js.crossVectors(De,Yr),a[0]=Yr.x,a[4]=Js.x,a[8]=De.x,a[1]=Yr.y,a[5]=Js.y,a[9]=De.y,a[2]=Yr.z,a[6]=Js.z,a[10]=De.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,a=e.elements,h=this.elements,c=n[0],g=n[4],b=n[8],f=n[12],w=n[1],x=n[5],I=n[9],M=n[13],L=n[2],O=n[6],F=n[10],D=n[14],dt=n[3],vt=n[7],ot=n[11],H=n[15],ct=a[0],st=a[4],Gt=a[8],Kt=a[12],qt=a[1],wt=a[5],Bt=a[9],ge=a[13],fe=a[2],Le=a[6],re=a[10],he=a[14],Q=a[3],Nt=a[7],ce=a[11],mr=a[15];return h[0]=c*ct+g*qt+b*fe+f*Q,h[4]=c*st+g*wt+b*Le+f*Nt,h[8]=c*Gt+g*Bt+b*re+f*ce,h[12]=c*Kt+g*ge+b*he+f*mr,h[1]=w*ct+x*qt+I*fe+M*Q,h[5]=w*st+x*wt+I*Le+M*Nt,h[9]=w*Gt+x*Bt+I*re+M*ce,h[13]=w*Kt+x*ge+I*he+M*mr,h[2]=L*ct+O*qt+F*fe+D*Q,h[6]=L*st+O*wt+F*Le+D*Nt,h[10]=L*Gt+O*Bt+F*re+D*ce,h[14]=L*Kt+O*ge+F*he+D*mr,h[3]=dt*ct+vt*qt+ot*fe+H*Q,h[7]=dt*st+vt*wt+ot*Le+H*Nt,h[11]=dt*Gt+vt*Bt+ot*re+H*ce,h[15]=dt*Kt+vt*ge+ot*he+H*mr,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],a=t[8],h=t[12],c=t[1],g=t[5],b=t[9],f=t[13],w=t[2],x=t[6],I=t[10],M=t[14],L=t[3],O=t[7],F=t[11],D=t[15];return L*(+h*b*x-a*f*x-h*g*I+n*f*I+a*g*M-n*b*M)+O*(+e*b*M-e*f*I+h*c*I-a*c*M+a*f*w-h*b*w)+F*(+e*f*x-e*g*M-h*c*x+n*c*M+h*g*w-n*f*w)+D*(-a*g*w-e*b*x+e*g*I+a*c*x-n*c*I+n*b*w)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const a=this.elements;return t instanceof X?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],a=t[2],h=t[3],c=t[4],g=t[5],b=t[6],f=t[7],w=t[8],x=t[9],I=t[10],M=t[11],L=t[12],O=t[13],F=t[14],D=t[15],dt=x*F*f-O*I*f+O*b*M-g*F*M-x*b*D+g*I*D,vt=L*I*f-w*F*f-L*b*M+c*F*M+w*b*D-c*I*D,ot=w*O*f-L*x*f+L*g*M-c*O*M-w*g*D+c*x*D,H=L*x*b-w*O*b-L*g*I+c*O*I+w*g*F-c*x*F,ct=e*dt+n*vt+a*ot+h*H;if(ct===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const st=1/ct;return t[0]=dt*st,t[1]=(O*I*h-x*F*h-O*a*M+n*F*M+x*a*D-n*I*D)*st,t[2]=(g*F*h-O*b*h+O*a*f-n*F*f-g*a*D+n*b*D)*st,t[3]=(x*b*h-g*I*h-x*a*f+n*I*f+g*a*M-n*b*M)*st,t[4]=vt*st,t[5]=(w*F*h-L*I*h+L*a*M-e*F*M-w*a*D+e*I*D)*st,t[6]=(L*b*h-c*F*h-L*a*f+e*F*f+c*a*D-e*b*D)*st,t[7]=(c*I*h-w*b*h+w*a*f-e*I*f-c*a*M+e*b*M)*st,t[8]=ot*st,t[9]=(L*x*h-w*O*h-L*n*M+e*O*M+w*n*D-e*x*D)*st,t[10]=(c*O*h-L*g*h+L*n*f-e*O*f-c*n*D+e*g*D)*st,t[11]=(w*g*h-c*x*h-w*n*f+e*x*f+c*n*M-e*g*M)*st,t[12]=H*st,t[13]=(w*O*a-L*x*a+L*n*I-e*O*I-w*n*F+e*x*F)*st,t[14]=(L*g*a-c*O*a-L*n*b+e*O*b+c*n*F-e*g*F)*st,t[15]=(c*x*a-w*g*a+w*n*b-e*x*b-c*n*I+e*g*I)*st,this}scale(t){const e=this.elements,n=t.x,a=t.y,h=t.z;return e[0]*=n,e[4]*=a,e[8]*=h,e[1]*=n,e[5]*=a,e[9]*=h,e[2]*=n,e[6]*=a,e[10]*=h,e[3]*=n,e[7]*=a,e[11]*=h,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,a))}makeTranslation(t,e,n){return t instanceof X?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),a=Math.sin(e),h=1-n,c=t.x,g=t.y,b=t.z,f=h*c,w=h*g;return this.set(f*c+n,f*g-a*b,f*b+a*g,0,f*g+a*b,w*g+n,w*b-a*c,0,f*b-a*g,w*b+a*c,h*b*b+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,a,h,c){return this.set(1,n,h,0,t,1,c,0,e,a,1,0,0,0,0,1),this}compose(t,e,n){const a=this.elements,h=e.x,c=e.y,g=e.z,b=e.w,f=h+h,w=c+c,x=g+g,I=h*f,M=h*w,L=h*x,O=c*w,F=c*x,D=g*x,dt=b*f,vt=b*w,ot=b*x,H=n.x,ct=n.y,st=n.z;return a[0]=(1-(O+D))*H,a[1]=(M+ot)*H,a[2]=(L-vt)*H,a[3]=0,a[4]=(M-ot)*ct,a[5]=(1-(I+D))*ct,a[6]=(F+dt)*ct,a[7]=0,a[8]=(L+vt)*st,a[9]=(F-dt)*st,a[10]=(1-(I+O))*st,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,n){const a=this.elements;let h=Rn.set(a[0],a[1],a[2]).length();const c=Rn.set(a[4],a[5],a[6]).length(),g=Rn.set(a[8],a[9],a[10]).length();this.determinant()<0&&(h=-h),t.x=a[12],t.y=a[13],t.z=a[14],nr.copy(this);const b=1/h,f=1/c,w=1/g;return nr.elements[0]*=b,nr.elements[1]*=b,nr.elements[2]*=b,nr.elements[4]*=f,nr.elements[5]*=f,nr.elements[6]*=f,nr.elements[8]*=w,nr.elements[9]*=w,nr.elements[10]*=w,e.setFromRotationMatrix(nr),n.x=h,n.y=c,n.z=g,this}equals(t){const e=this.elements,n=t.elements;for(let a=0;a<16;a++)if(e[a]!==n[a])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}};Aa.IDENTITY=Object.freeze(new Aa);let Zr=Aa;const Rn=new X,nr=new Zr,Ou=new X(0,0,0),Bu=new X(1,1,1),Yr=new X,Js=new X,De=new X;class Ct{constructor(t=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)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(la.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=la.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new Ct().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new X(0,0,0):new X(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new X(0,0,0):new X(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,la).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(vr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),vr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),vr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),vr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),vr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),vr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),vr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),vr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(vr),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const vr=[new X,new X,new X,new X,new X,new X,new X,new X],la=new X,il=new Jt;class xe{constructor(t=void 0,e=void 0){this.min=t==null?new Jt(1/0,1/0):new Jt(t.x,t.y),this.max=e==null?new Jt(-1/0,-1/0):new Jt(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=il.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new xe().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Jt(0,0):new Jt(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Jt(0,0):new Jt(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,il).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const al=new X,zu=new X,Ru=new ji;class Xs{constructor(t=new X(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,a){return this.normal.set(t,e,n),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const a=al.subVectors(n,e).cross(zu.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ru.getNormalMatrix(t),a=this.coplanarPoint(al).applyMatrix4(t),h=this.normal.applyMatrix3(n).normalize();return this.constant=-a.dot(h),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new Xs().copy(this)}}class Tt extends Jt{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((n,a)=>{n.toArray(e,a*2)}),e}}class W extends X{static pointArrayToNumberArray(t,e=!0){const n=e?3:2,a=new Array(t.length*n);return t.forEach((h,c)=>{h.toArray(a,c*n)}),a}}const ol=new Zr,ll=new $r,oh=class Pa{constructor(t=0,e=0,n=0,a=Pa.DEFAULT_ORDER){this._x=t,this._y=e,this._z=n,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,a=this._order){return this._x=t,this._y=e,this._z=n,this._order=a,this._onChangeCallback(),this}clone(){return new Pa(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const a=t.elements,h=a[0],c=a[4],g=a[8],b=a[1],f=a[5],w=a[9],x=a[2],I=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(Lr(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-w,M),this._z=Math.atan2(-c,h)):(this._x=Math.atan2(I,f),this._z=0);break;case"YXZ":this._x=Math.asin(-Lr(w,-1,1)),Math.abs(w)<.9999999?(this._y=Math.atan2(g,M),this._z=Math.atan2(b,f)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(Lr(I,-1,1)),Math.abs(I)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-c,f)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-Lr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(I,M),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-c,f));break;case"YZX":this._z=Math.asin(Lr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-w,f),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(g,M));break;case"XZY":this._z=Math.asin(-Lr(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(I,f),this._y=Math.atan2(g,h)):(this._x=Math.atan2(-w,M),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n=!0){return ol.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ol,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ll.setFromEuler(this),this.setFromQuaternion(ll,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};oh.DEFAULT_ORDER="XYZ";let lh=oh;class hh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}let Ga=class extends hh{translate(t){return this.transform(new ji().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}};class Gi extends Ga{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new xe}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let n=0;n<this.loops.length;++n){const a=this.loops[n].getPoints(t);e.push(a)}return e}buildHierarchy(){var t;const e=this.getPoints(100),n=this.calculateBoundaryBoxes(e),a=this.sortBoundaryBoxesByAreas(n),h=new Map,c=a.length;for(let b=0;b<c;b++)h.set(a[b],{index:a[b],children:[]});const g={index:-1,children:[]};for(let b=0;b<c;b++){const f=a[b],w=e[f],x=n[f];let I=b+1;for(;I<c;I++){const M=a[I],L=e[M];if(n[M].containsBox(x)&&th.isPointInPolygon(w[Pt.randInt(0,w.length-1)],L)){(t=h.get(M))==null||t.children.push(h.get(f));break}}I===c&&g.children.push(h.get(f))}return g}get area(){if(this._loops.length===0)return 0;let t=0;for(let e=0;e<this._loops.length;e++){const n=this._loops[e].getPoints(128),a=this.polygonArea(n);e===0?t+=Math.abs(a):t-=Math.abs(a)}return t}polygonArea(t){const e=t.length;if(e<3)return 0;let n=0;for(let a=0,h=e-1;a<e;h=a++){const c=t[h],g=t[a];n+=c.x*g.y-g.x*c.y}return n*.5}calculateBoundaryBoxes(t){const e=[];return t.forEach(n=>{e.push(new xe().setFromPoints(n))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((a,h)=>{const c=a.size,g=c.width*c.height;e.push({area:g,index:h})}),e.sort((a,h)=>a.area-h.area);const n=[];return e.forEach(a=>{n.push(a.index)}),n}}class Xn extends Ga{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let n,a=this.getPoint(0),h=0;e.push(0);for(let c=1;c<=t;c++)n=this.getPoint(c/t),h+=n.distanceTo(a),e.push(h),a=n;return e}getUtoTmapping(t,e){const n=this.getLengths();let a=0;const h=n.length;let c;e?c=e:c=t*n[h-1];let g=0,b=h-1,f;for(;g<=b;)if(a=Math.floor(g+(b-g)/2),f=n[a]-c,f<0)g=a+1;else if(f>0)b=a-1;else{b=a;break}if(a=b,n[a]===c)return a/(h-1);const w=n[a],x=n[a+1]-w,I=(c-w)/x;return(a+I)/(h-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const a=this.getPoint(e),h=this.getPoint(n),c=new Tt;return c.copy(h).sub(a).normalize(),c}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}class jn extends Xn{constructor(t,e,n,a,h){super();const c=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(a!==void 0)+ +(h!==void 0);if(c==3)typeof t=="object"&&typeof e=="object"&&typeof n=="object"?this.createByThreePoints(t,e,n):this.createByStartEndPointsAndBulge(t,e,n);else if(c==5){const g=t;this.center=new Tt(g.x,g.y),this.radius=e,this._clockwise=h,this._startAngle=this._clockwise?this._mirrorAngle(Pt.normalizeAngle(n)):Pt.normalizeAngle(n),this._endAngle=this._clockwise?this._mirrorAngle(Pt.normalizeAngle(a)):Pt.normalizeAngle(a)}else throw qe.ILLEGAL_PARAMETERS}createByThreePoints(t,e,n){const a=(st,Gt)=>({x:(st.x+Gt.x)/2,y:(st.y+Gt.y)/2}),h=(st,Gt)=>(Gt.y-st.y)/(Gt.x-st.x),c=st=>-1/st,g=a(t,e),b=a(e,n),f=h(t,e),w=h(e,n),x=c(f),I=c(w),M=(st,Gt,Kt,qt)=>{const wt=(qt-Gt)/(st-Kt),Bt=st*wt+Gt;return{x:wt,y:Bt}},L=g.y-x*g.x,O=b.y-I*b.x,F=M(x,L,I,O),D=Math.sqrt(Math.pow(t.x-F.x,2)+Math.pow(t.y-F.y,2)),dt=(st,Gt)=>Math.atan2(st.y-Gt.y,st.x-Gt.x),vt=dt(t,F),ot=dt(e,F),H=dt(n,F),ct=H>vt&&H<ot||vt>H&&vt<ot||ot>H&&ot<vt;this.center=F,this.radius=D,this._clockwise=!ct,this._startAngle=vt,this._endAngle=H}createByStartEndPointsAndBulge(t,e,n){let a,h,c;n<0?(a=Math.atan(-n)*4,h=new Jt(t),c=new Jt(e)):(a=Math.atan(n)*4,h=new Jt(e),c=new Jt(t));const g=new Jt().subVectors(c,h),b=g.length(),f=new Jt().addVectors(h,g.multiplyScalar(.5)),w=Math.abs(b/2/Math.tan(a/2)),x=g.normalize();let I;if(a<Math.PI){const M=new Jt(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));I=f.add(M.multiplyScalar(-w))}else{const M=new Jt(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));I=f.add(M.multiplyScalar(w))}n<0?(this._startAngle=Math.atan2(h.y-I.y,h.x-I.x),this._endAngle=Math.atan2(c.y-I.y,c.x-I.x)):(this._startAngle=Math.atan2(c.y-I.y,c.x-I.x),this._endAngle=Math.atan2(h.y-I.y,h.x-I.x)),this._clockwise=n<0,this.center=I,this.radius=c.sub(I).length()}get center(){return this._center}set center(t){this._center=new Tt(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(Pt.normalizeAngle(t)):Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const e=this.startAngle==0&&t==Zt?t:Pt.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(e):e,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return this.clockwise?Pt.normalizeAngle(t-e):Pt.normalizeAngle(e-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle),n=Pt.normalizeAngle((t+e)/2),a=this._clockwise?this._mirrorAngle(n):n;return this.getPointAtAngle(a)}get closed(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return Math.abs(e-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of e){const c=this._getInternalAngle(h);Pt.isBetweenAngle(c,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(h))}const n=t.map(h=>h.x),a=t.map(h=>h.y);return new xe(new Tt(Math.min(...n),Math.min(...a)),new Tt(Math.max(...n),Math.max(...a)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new jn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const e=this._getInternalAngle(t),n=this.center.x+this.radius*Math.cos(e),a=this.center.y+this.radius*Math.sin(e);return new Tt(n,a)}getPoints(t=100){const e=[];let n=this.deltaAngle,a=this._getInternalAngle(this.startAngle);if(this.closed&&(n=Zt,a=0),this.clockwise)for(let h=0;h<=t;h++){const c=a-n*(h/t),g=this._clockwise?this._mirrorAngle(c):c,b=this.getPointAtAngle(g);e.push(new Tt(b.x,b.y))}else for(let h=0;h<=t;h++){const c=a+n*(h/t),g=this._clockwise?this._mirrorAngle(c):c,b=this.getPointAtAngle(g);e.push(new Tt(b.x,b.y))}return e}}class Du extends hh{translate(t){return this.transform(new Zr().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ks extends Du{}let Gn=class ch extends Ks{constructor(t,e){super(),this._start=new W(t),this._end=new W(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new X().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new W((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const n=this.delta(an).normalize();return new W(this._start).addScaledVector(n,t)}else{const n=this.delta(an).normalize();return new W(this._end).addScaledVector(n,t)}}extend(t,e=!1){if(e){const n=an.subVectors(this._start,this._end).normalize();this._start=new W(this._start).addScaledVector(n,t)}else{const n=this.delta(an).normalize();this._end=new W(this._end).addScaledVector(n,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){hl.subVectors(t,this._start),ti.subVectors(this.endPoint,this.startPoint);const n=ti.dot(ti);let a=ti.dot(hl)/n;return e&&(a=Pt.clamp(a,0,1)),a}closestPointToPoint(t,e,n){const a=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(a).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,n=an.subVectors(t,this.startPoint).dot(e);return new W().copy(e).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const e=this.direction,n=this.startPoint,a=an.subVectors(t,n).dot(e),h=an.copy(e).multiplyScalar(a);return new W().addVectors(n,h)}calculateBoundingBox(){const t=new W(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),e=new W(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new Ct(t,e)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ch(this._start.clone(),this._end.clone())}};const an=new X,hl=new X,ti=new X;let Wa=class ai extends Ks{static computeCenterPoint(t,e,n){const a=new X().addVectors(t,e).multiplyScalar(.5),h=new X().addVectors(t,n).multiplyScalar(.5),c=new X().subVectors(e,t),g=new X().subVectors(n,t),b=new X().crossVectors(c,g).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new X().crossVectors(c,b).normalize(),w=new X().crossVectors(g,b).normalize(),x=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),I=w.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),M=new Gn(a,a.clone().add(x)),L=new Gn(h,h.clone().add(I)),O=new X;return M.closestPointToPoint(L.startPoint,!0,O)?O:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,n){const a=ai.computeCenterPoint(t,e,n);if(a){const h=a.distanceTo(t),c=new X().subVectors(t,a),g=new X().subVectors(e,a),b=Math.atan2(c.y,c.x),f=Math.atan2(g.y,g.x);return new ai(a,h,b,f,X.Z_AXIS)}}constructor(t,e,n,a,h,c=X.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=n,this.endAngle=a,this.normal=h,this.refVec=c,(a-n)%Zt==0?(this.startAngle=0,this.endAngle=Zt):(this.startAngle=n,this.endAngle=a)}get center(){return this._center}set center(t){this._center=new W(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw qe.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==Zt?t:Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Pt.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new X(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new X(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;this.closed&&(t=0,e=Zt);const n=t+e*.5;return this.getPointAtAngle(n)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const e=new X(t.x,t.y,t.z||0),n=this.center,a=this.normal,h=e.clone().sub(n).dot(a),c=e.clone().sub(a.clone().multiplyScalar(h)).clone().sub(n);if(c.lengthSq()===0)return this.startPoint.clone();c.normalize().multiplyScalar(this.radius);const g=n.clone().add(c),b=this.getAngle(g.clone()),f=this.startAngle,w=this.deltaAngle;let x=Pt.normalizeAngle(b-f);x<0&&(x=0),x>w&&(x=w);const I=this.getPointAtAngle(f+x),M=I.distanceTo(e),L=this.startPoint.distanceTo(e),O=this.endPoint.distanceTo(e);return L<M&&L<=O?this.startPoint.clone():O<M&&O<L?this.endPoint.clone():I}tangentPoints(t){const e=[],n=new X(t.x,t.y,t.z||0),a=this.center,h=this.normal,c=this.radius,g=n.clone().sub(a).dot(h),b=n.clone().sub(h.clone().multiplyScalar(g)),f=a.clone(),w=b.clone().sub(f).length();if(w<c)return e;const x=Math.acos(c/w),I=this.getAngle(b.clone()),M=[I+x,I-x];for(const L of M){const O=Pt.normalizeAngle(L-this.startAngle);O>=0&&O<=this.deltaAngle&&e.push(this.getPointAtAngle(this.startAngle+O))}return e}nearestTangentPoint(t){const e=this.tangentPoints(t);if(e.length===0)return null;const n=new W(t.x,t.y,t.z||0);return e.length===1||e[0].distanceTo(n)<e[1].distanceTo(n)?e[0]:e[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Pt.isBetweenAngle(b,this.startAngle,this.endAngle)&&t.push(b);let e=1/0,n=1/0,a=1/0,h=-1/0,c=-1/0,g=-1/0;for(const b of t){const f=this.getPointAtAngle(b);f.x<e&&(e=f.x),f.y<n&&(n=f.y),f.z<a&&(a=f.z),f.x>h&&(h=f.x),f.y>c&&(c=f.y),f.z>g&&(g=f.z)}return new Ct({x:e,y:n,z:a},{x:h,y:c,z:g})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let n=this.deltaAngle,a=this.startAngle;this.closed&&(n=Zt,a=0);for(let h=0;h<=t;h++){const c=a+n*(h/t),g=this.getPointAtAngle(c);e.push(g)}return e}transform(t){const e=ha.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),n=ha.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix4(t),e.applyMatrix4(t),n.applyMatrix4(t),this.normal.applyMatrix4(t).normalize(),this.refVec.applyMatrix4(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(n),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ai(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(ha.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,n=this.refVec,a={x:e.y*n.z-e.z*n.y,y:e.z*n.x-e.x*n.z,z:e.x*n.y-e.y*n.x},h=this.center,c=this.radius;return new W(h.x+c*(n.x*Math.cos(t)+a.x*Math.sin(t)),h.y+c*(n.y*Math.cos(t)+a.y*Math.sin(t)),h.z+c*(n.z*Math.cos(t)+a.z*Math.sin(t)))}get plane(){const t=new X(this.center).distanceTo(Fa);return new Xs(this.normal,t)}};const ha=new X;class Wi extends Xn{constructor(t,e,n,a=0,h=Zt,c=!1,g=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=n,(h-a)%Zt==0?(this.startAngle=0,this.endAngle=Zt):(this.startAngle=a,this.endAngle=h),this.clockwise=c,this.rotation=g}get center(){return this._center}set center(t){this._center=new W(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw qe.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw qe.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==Zt?t:Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Pt.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,n=-1/0,a=-1/0;for(let h=0;h<=100;h++){const c=this.getPoint(h/100);t=Math.min(t,c.x),e=Math.min(e,c.y),n=Math.max(n,c.x),a=Math.max(a,c.y)}return new xe({x:t,y:e},{x:n,y:a})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let n=this.endAngle-this.startAngle;const a=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(a?n=0:n=e),this.clockwise===!0&&!a&&(n===e?n=-e:n=n-e);const h=this.startAngle+t*n;let c=this.center.x+this.majorAxisRadius*Math.cos(h),g=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),f=Math.sin(this.rotation),w=c-this.center.x,x=g-this.center.y;c=w*b-x*f+this.center.x,g=w*f+x*b+this.center.y}return new Tt(c,g)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new Wi(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class Hi extends Ks{constructor(t,e,n,a,h,c=0,g=Zt){super(),this.center=t,this.normal=e,this.majorAxis=n,this.majorAxisRadius=a,this.minorAxisRadius=h;const b=Math.abs(g-c);Math.abs(b-Zt)<1e-10||Math.abs(b-2*Zt)<1e-10?(this.startAngle=0,this.endAngle=Zt):(this.startAngle=c,this.endAngle=g)}get center(){return this._center}set center(t){this._center=new W(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw qe.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw qe.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==Zt?t:Pt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-Zt)<1e-10?Zt:Pt.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new X(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new X(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new X().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;(this.closed||Math.abs(e-Zt)<1e-10)&&(t=0,e=Zt);const n=t+e/2;return this.getPointAtAngle(n)}get isCircular(){return Va.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let n=0,a=this.getPointAtAngle(this.startAngle);for(let h=1;h<=t;h++){const c=this.startAngle+h*e,g=this.getPointAtAngle(c),b=g.x-a.x,f=g.y-a.y,w=g.z-a.z;n+=Math.sqrt(b*b+f*f+w*w),a=g}return n}get area(){const t=this.majorAxisRadius,e=this.minorAxisRadius,n=this.startAngle,a=n+this.deltaAngle;if(Math.abs(this.deltaAngle-Zt)<1e-10)return Math.PI*t*e;const h=t*e/2*(a-n-(Math.sin(a)*Math.cos(a)-Math.sin(n)*Math.cos(n)));return Math.abs(h)}calculateBoundingBox(){if(this.majorAxis.equals(X.X_AXIS)||this.majorAxis.equals(X.Y_AXIS)||this.majorAxis.isParallelTo(X.X_AXIS)||this.majorAxis.isParallelTo(X.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Pt.isBetweenAngle(b,this.startAngle,this.endAngle)&&t.push(b);let e=1/0,n=1/0,a=1/0,h=-1/0,c=-1/0,g=-1/0;for(const b of t){const f=this.getPointAtAngle(b);f.x<e&&(e=f.x),f.y<n&&(n=f.y),f.z<a&&(a=f.z),f.x>h&&(h=f.x),f.y>c&&(c=f.y),f.z>g&&(g=f.z)}return new Ct({x:e,y:n,z:a},{x:h,y:c,z:g})}else{let t=1/0,e=1/0,n=1/0,a=-1/0,h=-1/0,c=-1/0;for(let g=0;g<=100;g++){const b=this.startAngle+this.deltaAngle*(g/100),f=this.getPointAtAngle(b);t=Math.min(t,f.x),e=Math.min(e,f.y),n=Math.min(n,f.z),a=Math.max(a,f.x),h=Math.max(h,f.y),c=Math.max(c,f.z)}return new Ct({x:t,y:e,z:n},{x:a,y:h,z:c})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let n=this.deltaAngle,a=this.startAngle;this.closed&&(n=Zt,a=0);for(let h=0;h<=t;h++){const c=a+n*(h/t),g=this.getPointAtAngle(c);e.push(g)}return e}getPointAtAngle(t){const e=Math.cos(t),n=Math.sin(t),a=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(n),h=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(a);return new W(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(t){const e=new X(t).sub(this.center),n=e.dot(this.majorAxis),a=e.dot(this.minorAxis),h=n/this.majorAxisRadius,c=a/this.minorAxisRadius;return h*h+c*c<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Hi(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new X(this.center).distanceTo(Fa);return new Xs(this.normal,t)}}class xn extends Xn{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new Tt(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new Tt(e.x,e.y)}else{const e=this._vertices[t-1];return new Tt(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let n=0;n<e;++n){const a=this._vertices[n];let h=null;if(n<e-1?h=this._vertices[n+1]:n==e-1&&this.closed&&(h=this._vertices[0]),h)if(a.bulge){const c=new jn(a,h,a.bulge);t+=c.length}else t+=new Tt(a.x,a.y).distanceTo(h)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const e=this._vertices[t];return new Tt(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new xe().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const n=[];return this.getPoints(t).forEach(a=>n.push(new W().set(a.x,a.y,e))),n}getPoints(t){const e=[],n=this._vertices.length;for(let a=0;a<n;++a){const h=this._vertices[a];if(h.bulge){let c=null;if(a<n-1?c=this._vertices[a+1]:a==n-1&&this.closed&&(c=this._vertices[0]),c){const g=new jn(h,c,h.bulge).getPoints(t),b=g.length;for(let f=0;f<b;++f){const w=g[f];e.push(new Tt(w.x,w.y))}}}else e.push(new Tt(h.x,h.y)),a==n-1&&this.closed&&e.push(e[0])}return e}}let Ds=class uh extends Xn{constructor(t,e){super(),this._start=new Tt(t),this._end=new Tt(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new Tt(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new Tt(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new xe(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new uh(this._start.clone(),this._end.clone())}},Ha=class extends Xn{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new Tt(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new xe;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(n=>{n.getPoints(t).forEach(a=>{e.push(new Tt(a.x,a.y))})}),e}};function Fu(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var dh={exports:{}};(function(i,t){(function(e){i.exports=e()})(function(){var e={},n=this;new Function("try {return this===window;}catch(e){ return false;}");var a=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(a()&&h(),a()||h()){var c=n;if(h()){var g=function(b,f){var w=n;return b.split(".").forEach(function(x){w&&(w=w[x])}),w?w[f]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var f=g(b.data.className,b.data.methodName);if(!f)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:f.apply(null,b.data.args),id:b.data.id})}}}}return function(b,f,w){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var x={},I=function(){return Nt.__string_rec(this,"")};function M(r,s){function o(){}o.prototype=r;var l=new o;for(var u in s)l[u]=s[u];return s.toString!==Object.prototype.toString&&(l.toString=s.toString),l}var L=function(){};x.HxOverrides=L,L.__name__=["HxOverrides"],L.strDate=function(r){var s=r.length;switch(s){case 8:var o=r.split(":"),l=new Date;return l.setTime(0),l.setUTCHours(o[0]),l.setUTCMinutes(o[1]),l.setUTCSeconds(o[2]),l;case 10:var u=r.split("-");return new Date(u[0],u[1]-1,u[2],0,0,0);case 19:var d=r.split(" "),m=d[0].split("-"),_=d[1].split(":");return new Date(m[0],m[1]-1,m[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},L.cca=function(r,s){var o=r.charCodeAt(s);if(o==o)return o},L.substr=function(r,s,o){return s!=null&&s!=0&&o!=null&&o<0?"":(o==null&&(o=r.length),s<0?(s=r.length+s,s<0&&(s=0)):o<0&&(o=r.length+o-s),r.substr(s,o))},L.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var O=function(){};x.Lambda=O,O.__name__=["Lambda"],O.fold=function(r,s,o){for(var l=Qe(r)();l.hasNext();){var u=l.next();o=s(u,o)}return o};var F=function(){this.length=0};x.List=F,F.__name__=["List"],F.prototype={add:function(r){var s=[r];this.h==null?this.h=s:this.q[1]=s,this.q=s,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:F},Math.__name__=["Math"];var D=function(){};x.Reflect=D,D.__name__=["Reflect"],D.field=function(r,s){try{return r[s]}catch(o){return o instanceof Q&&(o=o.val),null}},D.callMethod=function(r,s,o){return s.apply(r,o)},D.fields=function(r){var s=[];if(r!=null){var o=Object.prototype.hasOwnProperty;for(var l in r)l!="__id__"&&l!="hx__closures__"&&o.call(r,l)&&s.push(l)}return s},D.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},D.deleteField=function(r,s){return Object.prototype.hasOwnProperty.call(r,s)?(delete r[s],!0):!1};var dt=function(){};x.Std=dt,dt.__name__=["Std"],dt.string=function(r){return Nt.__string_rec(r,"")},dt.parseFloat=function(r){return parseFloat(r)};var vt=function(){this.b=""};x.StringBuf=vt,vt.__name__=["StringBuf"],vt.prototype={add:function(r){this.b+=dt.string(r)},__class__:vt};var ot=function(){};x.StringTools=ot,ot.__name__=["StringTools"],ot.fastCodeAt=function(r,s){return r.charCodeAt(s)};var H=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};H.TNull=["TNull",0],H.TNull.toString=I,H.TNull.__enum__=H,H.TInt=["TInt",1],H.TInt.toString=I,H.TInt.__enum__=H,H.TFloat=["TFloat",2],H.TFloat.toString=I,H.TFloat.__enum__=H,H.TBool=["TBool",3],H.TBool.toString=I,H.TBool.__enum__=H,H.TObject=["TObject",4],H.TObject.toString=I,H.TObject.__enum__=H,H.TFunction=["TFunction",5],H.TFunction.toString=I,H.TFunction.__enum__=H,H.TClass=function(r){var s=["TClass",6,r];return s.__enum__=H,s.toString=I,s},H.TEnum=function(r){var s=["TEnum",7,r];return s.__enum__=H,s.toString=I,s},H.TUnknown=["TUnknown",8],H.TUnknown.toString=I,H.TUnknown.__enum__=H;var ct=function(){};x.Type=ct,ct.__name__=["Type"],ct.getClassName=function(r){var s=r.__name__;return s==null?null:s.join(".")},ct.getEnumName=function(r){var s=r.__ename__;return s.join(".")},ct.resolveClass=function(r){var s=x[r];return s==null||!s.__name__?null:s},ct.resolveEnum=function(r){var s=x[r];return s==null||!s.__ename__?null:s},ct.createEmptyInstance=function(r){function s(){}return s.prototype=r.prototype,new s},ct.createEnum=function(r,s,o){var l=D.field(r,s);if(l==null)throw new Q("No such constructor "+s);if(D.isFunction(l)){if(o==null)throw new Q("Constructor "+s+" need parameters");return D.callMethod(r,l,o)}if(o!=null&&o.length!=0)throw new Q("Constructor "+s+" does not need parameters");return l},ct.getEnumConstructs=function(r){var s=r.__constructs__;return s.slice()},ct.typeof=function(r){var s=typeof r;switch(s){case"boolean":return H.TBool;case"string":return H.TClass(String);case"number":return Math.ceil(r)==r%2147483648?H.TInt:H.TFloat;case"object":if(r==null)return H.TNull;var o=r.__enum__;if(o!=null)return H.TEnum(o);var l=Nt.getClass(r);return l!=null?H.TClass(l):H.TObject;case"function":return r.__name__||r.__ename__?H.TObject:H.TFunction;case"undefined":return H.TNull;default:return H.TUnknown}};var st=function(){};x["haxe.IMap"]=st,st.__name__=["haxe","IMap"];var Gt=function(r,s){this.high=r,this.low=s};x["haxe._Int64.___Int64"]=Gt,Gt.__name__=["haxe","_Int64","___Int64"],Gt.prototype={__class__:Gt};var Kt=function(){this.buf=new vt,this.cache=[],this.useCache=Kt.USE_CACHE,this.useEnumIndex=Kt.USE_ENUM_INDEX,this.shash=new fe,this.scount=0};x["haxe.Serializer"]=Kt,Kt.__name__=["haxe","Serializer"],Kt.prototype={toString:function(){return this.buf.b},serializeString:function(r){var s=this.shash.get(r);if(s!=null){this.buf.b+="R",s==null?this.buf.b+="null":this.buf.b+=""+s;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var s=typeof r,o=0,l=this.cache.length;o<l;){var u=o++,d=this.cache[u];if(typeof d==s&&d==r)return this.buf.b+="r",u==null?this.buf.b+="null":this.buf.b+=""+u,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var s=0,o=D.fields(r);s<o.length;){var l=o[s];++s,this.serializeString(l),this.serialize(D.field(r,l))}this.buf.b+="g"},serialize:function(r){{var s=ct.typeof(r);switch(s[1]){case 0:this.buf.b+="n";break;case 1:var o=r;if(o==0){this.buf.b+="z";return}this.buf.b+="i",o==null?this.buf.b+="null":this.buf.b+=""+o;break;case 2:var l=r;isNaN(l)?this.buf.b+="k":isFinite(l)?(this.buf.b+="d",l==null?this.buf.b+="null":this.buf.b+=""+l):l<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var u=s[2];if(u==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(u){case Array:var d=0;this.buf.b+="a";for(var m=r.length,_=0;_<m;){var y=_++;r[y]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[y]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case F:this.buf.b+="l";for(var A=r,S=A.h,P=null;S!=null;){var E;P=S[0],S=S[1],E=P,this.serialize(E)}this.buf.b+="h";break;case Date:var k=r;this.buf.b+="v",this.buf.add(k.getTime());break;case fe:this.buf.b+="b";for(var T=r,B=T.keys();B.hasNext();){var N=B.next();this.serializeString(N),this.serialize(Ji[N]!=null?T.getReserved(N):T.h[N])}this.buf.b+="h";break;case wt:this.buf.b+="q";for(var R=r,z=R.keys();z.hasNext();){var V=z.next();this.buf.b+=":",V==null?this.buf.b+="null":this.buf.b+=""+V,this.serialize(R.h[V])}this.buf.b+="h";break;case Bt:this.buf.b+="M";for(var U=r,Y=U.keys();Y.hasNext();){var J=Y.next(),q=D.field(J,"__id__");D.deleteField(J,"__id__"),this.serialize(J),J.__id__=q,this.serialize(U.h[J.__id__])}this.buf.b+="h";break;case Le:for(var j=r,$=0,tt=j.length-2,et=new vt,it=Kt.BASE64;$<tt;){var ht=j.get($++),at=j.get($++),ut=j.get($++);et.add(it.charAt(ht>>2)),et.add(it.charAt((ht<<4|at>>4)&63)),et.add(it.charAt((at<<2|ut>>6)&63)),et.add(it.charAt(ut&63))}if($==tt){var nt=j.get($++),mt=j.get($++);et.add(it.charAt(nt>>2)),et.add(it.charAt((nt<<4|mt>>4)&63)),et.add(it.charAt(mt<<2&63))}else if($==tt+1){var K=j.get($++);et.add(it.charAt(K>>2)),et.add(it.charAt(K<<4&63))}var ft=et.b;this.buf.b+="s",ft.length==null?this.buf.b+="null":this.buf.b+=""+ft.length,this.buf.b+=":",ft==null?this.buf.b+="null":this.buf.b+=""+ft;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(ct.getClassName(u)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(ct.getClassName(u)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(Nt.__instanceof(r,Uo)){var Et=ct.getClassName(r);this.buf.b+="A",this.serializeString(Et)}else if(Nt.__instanceof(r,jo))this.buf.b+="B",this.serializeString(ct.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var Ht=s[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(ct.getEnumName(Ht)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=dt.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var $t=r.length;this.buf.b+=dt.string($t-2);for(var Ut=2;Ut<$t;){var Qt=Ut++;this.serialize(r[Qt])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+dt.string(r))}}},__class__:Kt};var qt=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var s=qt.DEFAULT_RESOLVER;s==null&&(s=ct,qt.DEFAULT_RESOLVER=s),this.setResolver(s)};x["haxe.Unserializer"]=qt,qt.__name__=["haxe","Unserializer"],qt.initCodes=function(){for(var r=[],s=0,o=qt.BASE64.length;s<o;){var l=s++;r[qt.BASE64.charCodeAt(l)]=l}return r},qt.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(s){return null},resolveEnum:function(s){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,s=!1,o=this.pos;;){var l=this.buf.charCodeAt(this.pos);if(l!=l)break;if(l==45){if(this.pos!=o)break;s=!0,this.pos++;continue}if(l<48||l>57)break;r=r*10+(l-48),this.pos++}return s&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var s=this.buf.charCodeAt(this.pos);if(s>=43&&s<58||s==101||s==69)this.pos++;else break}return dt.parseFloat(L.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var s=this.unserialize();if(typeof s!="string")throw new Q("Invalid object key");var o=this.unserialize();r[s]=o}this.pos++},unserializeEnum:function(r,s){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var o=this.readDigits();if(o==0)return ct.createEnum(r,s);for(var l=[];o-- >0;)l.push(this.unserialize());return ct.createEnum(r,s,l)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var s=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<s)throw new Q("Invalid string length");var o=L.substr(this.buf,this.pos,s);return this.pos+=s,o=decodeURIComponent(o.split("+").join(" ")),this.scache.push(o),o;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var l=[];for(this.cache.push(l);;){var u=this.buf.charCodeAt(this.pos);if(u==104){this.pos++;break}if(u==117){this.pos++;var d=this.readDigits();l[l.length+d-1]=null}else l.push(this.unserialize())}return l;case 111:var m={};return this.cache.push(m),this.unserializeObject(m),m;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var y=this.readDigits();if(y<0||y>=this.scache.length)throw new Q("Invalid string reference");return this.scache[y];case 120:throw new Q(this.unserialize());case 99:var A=this.unserialize(),S=this.resolver.resolveClass(A);if(S==null)throw new Q("Class not found "+A);var P=ct.createEmptyInstance(S);return this.cache.push(P),this.unserializeObject(P),P;case 119:var E=this.unserialize(),k=this.resolver.resolveEnum(E);if(k==null)throw new Q("Enum not found "+E);var T=this.unserializeEnum(k,this.unserialize());return this.cache.push(T),T;case 106:var B=this.unserialize(),N=this.resolver.resolveEnum(B);if(N==null)throw new Q("Enum not found "+B);this.pos++;var R=this.readDigits(),z=ct.getEnumConstructs(N)[R];if(z==null)throw new Q("Unknown enum index "+B+"@"+R);var V=this.unserializeEnum(N,z);return this.cache.push(V),V;case 108:var U=new F;for(this.cache.push(U),this.buf;this.buf.charCodeAt(this.pos)!=104;)U.add(this.unserialize());return this.pos++,U;case 98:var Y=new fe;for(this.cache.push(Y),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();Y.set(J,this.unserialize())}return this.pos++,Y;case 113:var q=new wt;this.cache.push(q),this.buf;for(var j=this.get(this.pos++);j==58;){var $=this.readDigits();q.set($,this.unserialize()),j=this.get(this.pos++)}if(j!=104)throw new Q("Invalid IntMap format");return q;case 77:var tt=new Bt;for(this.cache.push(tt),this.buf;this.buf.charCodeAt(this.pos)!=104;){var et=this.unserialize();tt.set(et,this.unserialize())}return this.pos++,tt;case 118:var it;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var ht=L.substr(this.buf,this.pos,19);it=L.strDate(ht),this.pos+=19}else{var at=this.readFloat(),ut=new Date;ut.setTime(at),it=ut}return this.cache.push(it),it;case 115:var nt=this.readDigits(),mt=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<nt)throw new Q("Invalid bytes length");var K=qt.CODES;K==null&&(K=qt.initCodes(),qt.CODES=K);var ft=this.pos,Et=nt&3,Ht;Ht=(nt>>2)*3+(Et>=2?Et-1:0);for(var $t=ft+(nt-Et),Ut=Le.alloc(Ht),Qt=0;ft<$t;){var Te=K[ot.fastCodeAt(mt,ft++)],Ke=K[ot.fastCodeAt(mt,ft++)];Ut.set(Qt++,Te<<2|Ke>>4);var we=K[ot.fastCodeAt(mt,ft++)];Ut.set(Qt++,Ke<<4|we>>2);var ye=K[ot.fastCodeAt(mt,ft++)];Ut.set(Qt++,we<<6|ye)}if(Et>=2){var Ce=K[ot.fastCodeAt(mt,ft++)],Re=K[ot.fastCodeAt(mt,ft++)];if(Ut.set(Qt++,Ce<<2|Re>>4),Et==3){var Je=K[ot.fastCodeAt(mt,ft++)];Ut.set(Qt++,Re<<4|Je>>2)}}return this.pos+=nt,this.cache.push(Ut),Ut;case 67:var ur=this.unserialize(),tr=this.resolver.resolveClass(ur);if(tr==null)throw new Q("Class not found "+ur);var er=ct.createEmptyInstance(tr);if(this.cache.push(er),er.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return er;case 65:var rr=this.unserialize(),_r=this.resolver.resolveClass(rr);if(_r==null)throw new Q("Class not found "+rr);return _r;case 66:var Bn=this.unserialize(),rn=this.resolver.resolveEnum(Bn);if(rn==null)throw new Q("Enum not found "+Bn);return rn}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:qt};var wt=function(){this.h={}};x["haxe.ds.IntMap"]=wt,wt.__name__=["haxe","ds","IntMap"],wt.__interfaces__=[st],wt.prototype={set:function(r,s){this.h[r]=s},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var s in this.h)this.h.hasOwnProperty(s)&&r.push(s|0);return L.iter(r)},__class__:wt};var Bt=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Bt,Bt.__name__=["haxe","ds","ObjectMap"],Bt.__interfaces__=[st],Bt.prototype={set:function(r,s){var o=r.__id__||(r.__id__=++Bt.count);this.h[o]=s,this.h.__keys__[o]=r},keys:function(){var r=[];for(var s in this.h.__keys__)this.h.hasOwnProperty(s)&&r.push(this.h.__keys__[s]);return L.iter(r)},__class__:Bt};var ge=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};ge.Some=function(r){var s=["Some",0,r];return s.__enum__=ge,s.toString=I,s},ge.None=["None",1],ge.None.toString=I,ge.None.__enum__=ge;var fe=function(){this.h={}};x["haxe.ds.StringMap"]=fe,fe.__name__=["haxe","ds","StringMap"],fe.__interfaces__=[st],fe.prototype={set:function(r,s){Ji[r]!=null?this.setReserved(r,s):this.h[r]=s},get:function(r){return Ji[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,s){this.rh==null&&(this.rh={}),this.rh["$"+r]=s},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return L.iter(r)},arrayKeys:function(){var r=[];for(var s in this.h)this.h.hasOwnProperty(s)&&r.push(s);if(this.rh!=null)for(var s in this.rh)s.charCodeAt(0)==36&&r.push(s.substr(1));return r},__class__:fe};var Le=function(r){this.length=r.byteLength,this.b=new ta(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};x["haxe.io.Bytes"]=Le,Le.__name__=["haxe","io","Bytes"],Le.alloc=function(r){return new Le(new Qs(r))},Le.prototype={get:function(r){return this.b[r]},set:function(r,s){this.b[r]=s&255},__class__:Le};var re=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};re.Blocked=["Blocked",0],re.Blocked.toString=I,re.Blocked.__enum__=re,re.Overflow=["Overflow",1],re.Overflow.toString=I,re.Overflow.__enum__=re,re.OutsideBounds=["OutsideBounds",2],re.OutsideBounds.toString=I,re.OutsideBounds.__enum__=re,re.Custom=function(r){var s=["Custom",3,r];return s.__enum__=re,s.toString=I,s};var he=function(){};x["haxe.io.FPHelper"]=he,he.__name__=["haxe","io","FPHelper"],he.i32ToFloat=function(r){var s=1-(r>>>31<<1),o=r>>>23&255,l=r&8388607;return l==0&&o==0?0:s*(1+Math.pow(2,-23)*l)*Math.pow(2,o-127)},he.floatToI32=function(r){if(r==0)return 0;var s;r<0?s=-r:s=r;var o=Math.floor(Math.log(s)/.6931471805599453);o<-127?o=-127:o>128&&(o=128);var l=Math.round((s/Math.pow(2,o)-1)*8388608)&8388607;return(r<0?-2147483648:0)|o+127<<23|l},he.i64ToDouble=function(r,s){var o=1-(s>>>31<<1),l=(s>>20&2047)-1023,u=(s&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return u==0&&l==-1023?0:o*(1+Math.pow(2,-52)*u)*Math.pow(2,l)},he.doubleToI64=function(r){var s=he.i64tmp;if(r==0)s.low=0,s.high=0;else{var o;r<0?o=-r:o=r;var l=Math.floor(Math.log(o)/.6931471805599453),u,d=(o/Math.pow(2,l)-1)*4503599627370496;u=Math.round(d);var m=u|0,_=u/4294967296|0;s.low=m,s.high=(r<0?-2147483648:0)|l+1023<<20|_}return s};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};x["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=M(Error.prototype,{__class__:Q});var Nt=function(){};x["js.Boot"]=Nt,Nt.__name__=["js","Boot"],Nt.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var s=r.__class__;if(s!=null)return s;var o=Nt.__nativeClassName(r);return o!=null?Nt.__resolveNativeClass(o):null},Nt.__string_rec=function(r,s){if(r==null)return"null";if(s.length>=5)return"<...>";var o=typeof r;switch(o=="function"&&(r.__name__||r.__ename__)&&(o="object"),o){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var l=r[0]+"(";s+=" ";for(var u=2,d=r.length;u<d;){var m=u++;m!=2?l+=","+Nt.__string_rec(r[m],s):l+=Nt.__string_rec(r[m],s)}return l+")"}var _=r.length,y="[";s+=" ";for(var A=0;A<_;){var S=A++;y+=(S>0?",":"")+Nt.__string_rec(r[S],s)}return y+="]",y}var P;try{P=r.toString}catch(N){return N instanceof Q&&(N=N.val),"???"}if(P!=null&&P!=Object.toString&&typeof P=="function"){var E=r.toString();if(E!="[object Object]")return E}var k=null,T=`{
|
|
2
|
+
`;s+=" ";var B=r.hasOwnProperty!=null;for(var k in r)B&&!r.hasOwnProperty(k)||k=="prototype"||k=="__class__"||k=="__super__"||k=="__interfaces__"||k=="__properties__"||(T.length!=2&&(T+=`,
|
|
3
|
+
`),T+=s+k+" : "+Nt.__string_rec(r[k],s));return s=s.substring(1),T+=`
|
|
4
|
+
`+s+"}",T;case"function":return"<function>";case"string":return r;default:return String(r)}},Nt.__interfLoop=function(r,s){if(r==null)return!1;if(r==s)return!0;var o=r.__interfaces__;if(o!=null)for(var l=0,u=o.length;l<u;){var d=l++,m=o[d];if(m==s||Nt.__interfLoop(m,s))return!0}return Nt.__interfLoop(r.__super__,s)},Nt.__instanceof=function(r,s){if(s==null)return!1;switch(s){case iu:return(r|0)===r;case Fo:return typeof r=="number";case Vo:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case au:return!0;default:if(r!=null){if(typeof s=="function"){if(r instanceof s||Nt.__interfLoop(Nt.getClass(r),s))return!0}else if(typeof s=="object"&&Nt.__isNativeObj(s)&&r instanceof s)return!0}else return!1;return s==Uo&&r.__name__!=null||s==jo&&r.__ename__!=null?!0:r.__enum__==s}},Nt.__nativeClassName=function(r){var s=Nt.__toStr.call(r).slice(8,-1);return s=="Object"||s=="Function"||s=="Math"||s=="JSON"?null:s},Nt.__isNativeObj=function(r){return Nt.__nativeClassName(r)!=null},Nt.__resolveNativeClass=function(r){return w[r]};var ce=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var s=r;this.a=[];for(var o=0;o<s;){var l=o++;this.a[l]=0}this.byteLength=s}};x["js.html.compat.ArrayBuffer"]=ce,ce.__name__=["js","html","compat","ArrayBuffer"],ce.sliceImpl=function(r,s){var o=new ta(this,r,s==null?null:s-r),l=new Qs(o.byteLength),u=new ta(l);return u.set(o),l},ce.prototype={slice:function(r,s){return new ce(this.a.slice(r,s))},__class__:ce};var mr=function(r,s,o){if(this.buf=r,s==null?this.offset=0:this.offset=s,o==null?this.length=r.byteLength-this.offset:this.length=o,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(re.OutsideBounds)};x["js.html.compat.DataView"]=mr,mr.__name__=["js","html","compat","DataView"],mr.prototype={getInt8:function(r){var s=this.buf.a[this.offset+r];return s>=128?s-256:s},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,s){var o=this.getUint16(r,s);return o>=32768?o-65536:o},getUint16:function(r,s){return s?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,s){var o=this.offset+r,l=this.buf.a[o++],u=this.buf.a[o++],d=this.buf.a[o++],m=this.buf.a[o++];return s?l|u<<8|d<<16|m<<24:m|d<<8|u<<16|l<<24},getUint32:function(r,s){var o=this.getInt32(r,s);return o<0?o+4294967296:o},getFloat32:function(r,s){return he.i32ToFloat(this.getInt32(r,s))},getFloat64:function(r,s){var o=this.getInt32(r,s),l=this.getInt32(r+4,s);return he.i64ToDouble(s?o:l,s?l:o)},setInt8:function(r,s){s<0?this.buf.a[r+this.offset]=s+128&255:this.buf.a[r+this.offset]=s&255},setUint8:function(r,s){this.buf.a[r+this.offset]=s&255},setInt16:function(r,s,o){this.setUint16(r,s<0?s+65536:s,o)},setUint16:function(r,s,o){var l=r+this.offset;o?(this.buf.a[l]=s&255,this.buf.a[l++]=s>>8&255):(this.buf.a[l++]=s>>8&255,this.buf.a[l]=s&255)},setInt32:function(r,s,o){this.setUint32(r,s,o)},setUint32:function(r,s,o){var l=r+this.offset;o?(this.buf.a[l++]=s&255,this.buf.a[l++]=s>>8&255,this.buf.a[l++]=s>>16&255,this.buf.a[l++]=s>>>24):(this.buf.a[l++]=s>>>24,this.buf.a[l++]=s>>16&255,this.buf.a[l++]=s>>8&255,this.buf.a[l++]=s&255)},setFloat32:function(r,s,o){this.setUint32(r,he.floatToI32(s),o)},setFloat64:function(r,s,o){var l=he.doubleToI64(s);o?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:mr};var or=function(){};x["js.html.compat.Uint8Array"]=or,or.__name__=["js","html","compat","Uint8Array"],or._new=function(r,s,o){var l;if(typeof r=="number"){l=[];for(var u=0;u<r;){var d=u++;l[d]=0}l.byteLength=l.length,l.byteOffset=0,l.buffer=new ce(l)}else if(Nt.__instanceof(r,ce)){var m=r;s==null&&(s=0),o==null&&(o=m.byteLength-s),s==0?l=m.a:l=m.a.slice(s,s+o),l.byteLength=l.length,l.byteOffset=s,l.buffer=m}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new ce(l);else throw new Q("TODO "+dt.string(r));return l.subarray=or._subarray,l.set=or._set,l},or._set=function(r,s){var o=this;if(Nt.__instanceof(r.buffer,ce)){var l=r;if(r.byteLength+s>o.byteLength)throw new Q("set() outside of range");for(var u=0,d=r.byteLength;u<d;){var m=u++;o[m+s]=l[m]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+s>o.byteLength)throw new Q("set() outside of range");for(var y=0,A=_.length;y<A;){var S=y++;o[S+s]=_[S]}}else throw new Q("TODO")},or._subarray=function(r,s){var o=this,l=or._new(o.slice(r,s));return l.byteOffset=r,l};var kt=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&kt.link(r,this,function(s){return s})};x["promhx.base.AsyncBase"]=kt,kt.__name__=["promhx","base","AsyncBase"],kt.link=function(r,s,o){r._update.push({async:s,linkf:function(l){s.handleResolve(o(l))}}),kt.immediateLinkUpdate(r,s,o)},kt.immediateLinkUpdate=function(r,s,o){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&s.handleError(r._errorVal),r._resolved&&!r._pending)try{s.handleResolve(o(r._val))}catch(l){l instanceof Q&&(l=l.val),s.handleError(l)}},kt.linkAll=function(r,s){for(var o=function(d,m,_){if(d.length==0||kt.allFulfilled(d)){for(var y,A=[],S=Qe(r)();S.hasNext();){var P=S.next();A.push(P==m?_:P._val)}y=A,s.handleResolve(y)}},l=Qe(r)();l.hasNext();){var u=l.next();u._update.push({async:s,linkf:function(d,m,_){return function(y){d(m,_,y)}}(o,function(d){for(var m,_=[],y=Qe(r)();y.hasNext();){var A=y.next();A!=u&&_.push(A)}return m=_,m}(),u)})}kt.allFulfilled(r)&&s.handleResolve(function(d){for(var m,_=[],y=Qe(r)();y.hasNext();){var A=y.next();_.push(A._val)}return m=_,m}())},kt.pipeLink=function(r,s,o){var l=!1,u=function(d){if(!l){l=!0;var m=o(d);m._update.push({async:s,linkf:ze(s,s.handleResolve)}),kt.immediateLinkUpdate(m,s,function(_){return _})}};if(r._update.push({async:s,linkf:u}),r._resolved&&!r._pending)try{u(r._val)}catch(d){d instanceof Q&&(d=d.val),s.handleError(d)}},kt.allResolved=function(r){for(var s=Qe(r)();s.hasNext();){var o=s.next();if(!o._resolved)return!1}return!0},kt.allFulfilled=function(r){for(var s=Qe(r)();s.hasNext();){var o=s.next();if(!o._fulfilled)return!1}return!0},kt.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var s=this;this._pending?It.enqueue(function(o,l){return function(){o(l)}}(ze(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,It.queue.add(function(){s._val=r;for(var o=0,l=s._update;o<l.length;){var u=l[o];++o;try{u.linkf(r)}catch(d){d instanceof Q&&(d=d.val),u.async.handleError(d)}}s._fulfilled=!0,s._pending=!1}),It.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var s=this,o=function(l){if(s._error.length>0)for(var u=0,d=s._error;u<d.length;){var m=d[u];++u,m(l)}else if(s._update.length>0)for(var _=0,y=s._update;_<y.length;){var A=y[_];++_,A.async.handleError(l)}else throw new Q(l);s._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,It.queue.add(function(){if(s._errorMap!=null)try{s._resolve(s._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),o(l)}else o(r)}),It.continueOnNextLoop())},then:function(r){var s=new kt(null);return kt.link(this,s,r),s},unlink:function(r){var s=this;It.queue.add(function(){s._update=s._update.filter(function(o){return o.async!=r})}),It.continueOnNextLoop()},isLinked:function(r){for(var s=!1,o=0,l=this._update;o<l.length;){var u=l[o];if(++o,u.async==r)return!0}return s},__class__:kt};var Pn=f.promhx.Deferred=function(){kt.call(this)};x["promhx.Deferred"]=Pn,Pn.__name__=["promhx","Deferred"],Pn.__super__=kt,Pn.prototype=M(kt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new _e(this)},stream:function(){return new Yt(this)},publicStream:function(){return new Rr(this)},__class__:Pn});var _e=f.promhx.Promise=function(r){kt.call(this,r),this._rejected=!1};x["promhx.Promise"]=_e,_e.__name__=["promhx","Promise"],_e.whenAll=function(r){var s=new _e(null);return kt.linkAll(r,s),s},_e.promise=function(r){var s=new _e;return s.handleResolve(r),s},_e.__super__=kt,_e.prototype=M(kt.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var s="Promise has already been resolved";throw new Q(Sn.AlreadyResolved(s))}this._resolve(r)},then:function(r){var s=new _e(null);return kt.link(this,s,r),s},unlink:function(r){var s=this;It.queue.add(function(){if(s._fulfilled)s._update=s._update.filter(function(l){return l.async!=r});else{var o="Downstream Promise is not fullfilled";s.handleError(Sn.DownstreamNotFullfilled(o))}}),It.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var s=new _e(null);return kt.pipeLink(this,s,r),s},errorPipe:function(r){var s=new _e;return this.catchError(function(o){var l=r(o);l.then(ze(s,s._resolve))}),this.then(ze(s,s._resolve)),s},__class__:_e});var Yt=f.promhx.Stream=function(r){kt.call(this,r),this._end_promise=new _e};x["promhx.Stream"]=Yt,Yt.__name__=["promhx","Stream"],Yt.foreach=function(r){for(var s=new Yt(null),o=Qe(r)();o.hasNext();){var l=o.next();s.handleResolve(l)}return s.end(),s},Yt.wheneverAll=function(r){var s=new Yt(null);return kt.linkAll(r,s),s},Yt.concatAll=function(r){for(var s=new Yt(null),o=Qe(r)();o.hasNext();){var l=o.next();s.concat(l)}return s},Yt.mergeAll=function(r){for(var s=new Yt(null),o=Qe(r)();o.hasNext();){var l=o.next();s.merge(l)}return s},Yt.stream=function(r){var s=new Yt(null);return s.handleResolve(r),s},Yt.__super__=kt,Yt.prototype=M(kt.prototype,{then:function(r){var s=new Yt(null);return kt.link(this,s,r),this._end_promise._update.push({async:s._end_promise,linkf:function(o){s.end()}}),s},detachStream:function(r){for(var s=[],o=!1,l=0,u=this._update;l<u.length;){var d=u[l];++l,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(m){return m.async!=r._end_promise}),o=!0):s.push(d)}return this._update=s,o},first:function(){var r=new _e(null);return this.then(function(s){r._resolved||r.handleResolve(s)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var s=new Yt(null);return kt.pipeLink(this,s,r),this._end_promise.then(function(o){s.end()}),s},errorPipe:function(r){var s=new Yt(null);return this.catchError(function(o){var l=r(o);l.then(ze(s,s._resolve)),l._end_promise.then((Qi=s._end_promise,ze(Qi,Qi._resolve)))}),this.then(ze(s,s._resolve)),this._end_promise.then(function(o){s.end()}),s},handleEnd:function(){if(this._pending)It.queue.add(ze(this,this.handleEnd)),It.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=ge.Some(this._val):r=ge.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return It.queue.add(ze(this,this.handleEnd)),It.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var s=new Yt(null);return this._update.push({async:s,linkf:function(o){r(o)&&s.handleResolve(o)}}),kt.immediateLinkUpdate(this,s,function(o){return o}),s},concat:function(r){var s=new Yt(null);return this._update.push({async:s,linkf:ze(s,s.handleResolve)}),kt.immediateLinkUpdate(this,s,function(o){return o}),this._end_promise.then(function(o){r.pipe(function(l){return s.handleResolve(l),s}),r._end_promise.then(function(l){s.end()})}),s},merge:function(r){var s=new Yt(null);return this._update.push({async:s,linkf:ze(s,s.handleResolve)}),r._update.push({async:s,linkf:ze(s,s.handleResolve)}),kt.immediateLinkUpdate(this,s,function(o){return o}),kt.immediateLinkUpdate(r,s,function(o){return o}),s},__class__:Yt});var Rr=f.promhx.PublicStream=function(r){Yt.call(this,r)};x["promhx.PublicStream"]=Rr,Rr.__name__=["promhx","PublicStream"],Rr.publicstream=function(r){var s=new Rr(null);return s.handleResolve(r),s},Rr.__super__=Yt,Rr.prototype=M(Yt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Rr});var It=function(){};x["promhx.base.EventLoop"]=It,It.__name__=["promhx","base","EventLoop"],It.enqueue=function(r){It.queue.add(r),It.continueOnNextLoop()},It.set_nextLoop=function(r){if(It.nextLoop!=null)throw new Q("nextLoop has already been set");return It.nextLoop=r,It.nextLoop},It.queueEmpty=function(){return It.queue.isEmpty()},It.finish=function(r){r==null&&(r=1e3);for(var s=null;r-- >0&&(s=It.queue.pop())!=null;)s();return It.queue.isEmpty()},It.clear=function(){It.queue=new F},It.f=function(){var r=It.queue.pop();r!=null&&r(),It.queue.isEmpty()||It.continueOnNextLoop()},It.continueOnNextLoop=function(){It.nextLoop!=null?It.nextLoop(It.f):setImmediate(It.f)};var Sn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};Sn.AlreadyResolved=function(r){var s=["AlreadyResolved",0,r];return s.__enum__=Sn,s.toString=I,s},Sn.DownstreamNotFullfilled=function(r){var s=["DownstreamNotFullfilled",1,r];return s.__enum__=Sn,s.toString=I,s};var $s=function(){};x["verb.Verb"]=$s,$s.__name__=["verb","Verb"],$s.main=function(){b.log("verb 2.1.0")};var Z=function(){};x["verb.core.ArrayExtensions"]=Z,Z.__name__=["verb","core","ArrayExtensions"],Z.alloc=function(r,s){if(!(s<0))for(;r.length<s;)r.push(null)},Z.reversed=function(r){var s=r.slice();return s.reverse(),s},Z.last=function(r){return r[r.length-1]},Z.first=function(r){return r[0]},Z.spliceAndInsert=function(r,s,o,l){r.splice(s,o),r.splice(s,0,l)},Z.left=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(0,s)},Z.right=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(s)},Z.rightWithPivot=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(s-1)},Z.unique=function(r,s){if(r.length==0)return[];for(var o=[r.pop()];r.length>0;){for(var l=r.pop(),u=!0,d=0;d<o.length;){var m=o[d];if(++d,s(l,m)){u=!1;break}}u&&o.push(l)}return o};var Dt=function(){};x["verb.core.Binomial"]=Dt,Dt.__name__=["verb","core","Binomial"],Dt.get=function(r,s){if(s==0)return 1;if(r==0||s>r)return 0;if(s>r-s&&(s=r-s),Dt.memo_exists(r,s))return Dt.get_memo(r,s);for(var o=1,l=r,u=1,d=s+1;u<d;){var m=u++;if(Dt.memo_exists(l,m)){r--,o=Dt.get_memo(l,m);continue}o*=r--,o/=m,Dt.memoize(l,m,o)}return o},Dt.get_no_memo=function(r,s){if(s==0)return 1;if(r==0||s>r)return 0;s>r-s&&(s=r-s);for(var o=1,l=1,u=s+1;l<u;){var d=l++;o*=r--,o/=d}return o},Dt.memo_exists=function(r,s){return Dt.memo.h.hasOwnProperty(r)&&Dt.memo.h[r].h.hasOwnProperty(s)},Dt.get_memo=function(r,s){return Dt.memo.h[r].h[s]},Dt.memoize=function(r,s,o){Dt.memo.h.hasOwnProperty(r)||Dt.memo.set(r,new wt),Dt.memo.h[r].h[s]=o};var Oe=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};x["verb.core.BoundingBox"]=Oe,Oe.__name__=["verb","core","BoundingBox"],Oe.intervalsOverlap=function(r,s,o,l,u){u==null&&(u=-1);var d;u<-.5?d=rt.TOLERANCE:d=u;var m=Math.min(r,s)-d,_=Math.max(r,s)+d,y=Math.min(o,l)-d,A=Math.max(o,l)+d;return m>=y&&m<=A||_>=y&&_<=A||y>=m&&y<=_||A>=m&&A<=_},Oe.prototype={fromPoint:function(r){return new Oe([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var s=0,o=this.dim;s<o;){var l=s++;r[l]>this.max[l]&&(this.max[l]=r[l]),r[l]<this.min[l]&&(this.min[l]=r[l])}return this},addRange:function(r){for(var s=r.length,o=0;o<s;){var l=o++;this.add(r[l])}return this},contains:function(r,s){return s==null&&(s=-1),this.initialized?this.intersects(new Oe([r]),s):!1},intersects:function(r,s){if(s==null&&(s=-1),!this.initialized||!r.initialized)return!1;for(var o=this.min,l=this.max,u=r.min,d=r.max,m=0,_=this.dim;m<_;){var y=m++;if(!Oe.intervalsOverlap(o[y],l[y],u[y],d[y],s))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,s=0,o=0,l=this.dim;o<l;){var u=o++,d=this.getAxisLength(u);d>r&&(r=d,s=u)}return s},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,s){if(!this.initialized)return null;var o=this.min,l=this.max,u=r.min,d=r.max;if(!this.intersects(r,s))return null;for(var m=[],_=[],y=0,A=this.dim;y<A;){var S=y++;m.push(Math.min(l[S],d[S])),_.push(Math.max(o[S],u[S]))}return new Oe([_,m])},__class__:Oe};var rt=f.core.Constants=function(){};x["verb.core.Constants"]=rt,rt.__name__=["verb","core","Constants"];var te=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=te,te.__name__=["verb","core","SerializableBase"],te.prototype={serialize:function(){var r=new Kt;return r.serialize(this),r.toString()},__class__:te};var $n=f.core.Plane=function(r,s){this.origin=r,this.normal=s};x["verb.core.Plane"]=$n,$n.__name__=["verb","core","Plane"],$n.__super__=te,$n.prototype=M(te.prototype,{__class__:$n});var In=f.core.Ray=function(r,s){this.origin=r,this.dir=s};x["verb.core.Ray"]=In,In.__name__=["verb","core","Ray"],In.__super__=te,In.prototype=M(te.prototype,{__class__:In});var Wt=f.core.NurbsCurveData=function(r,s,o){this.degree=r,this.controlPoints=o,this.knots=s};x["verb.core.NurbsCurveData"]=Wt,Wt.__name__=["verb","core","NurbsCurveData"],Wt.__super__=te,Wt.prototype=M(te.prototype,{__class__:Wt});var ne=f.core.NurbsSurfaceData=function(r,s,o,l,u){this.degreeU=r,this.degreeV=s,this.knotsU=o,this.knotsV=l,this.controlPoints=u};x["verb.core.NurbsSurfaceData"]=ne,ne.__name__=["verb","core","NurbsSurfaceData"],ne.__super__=te,ne.prototype=M(te.prototype,{__class__:ne});var $e=f.core.MeshData=function(r,s,o,l){this.faces=r,this.points=s,this.normals=o,this.uvs=l};x["verb.core.MeshData"]=$e,$e.__name__=["verb","core","MeshData"],$e.empty=function(){return new $e([],[],[],[])},$e.__super__=te,$e.prototype=M(te.prototype,{__class__:$e});var Zn=f.core.PolylineData=function(r,s){this.points=r,this.params=s};x["verb.core.PolylineData"]=Zn,Zn.__name__=["verb","core","PolylineData"],Zn.__super__=te,Zn.prototype=M(te.prototype,{__class__:Zn});var Qn=f.core.VolumeData=function(r,s,o,l,u,d,m){this.degreeU=r,this.degreeV=s,this.degreeW=o,this.knotsU=l,this.knotsV=u,this.knotsW=d,this.controlPoints=m};x["verb.core.VolumeData"]=Qn,Qn.__name__=["verb","core","VolumeData"],Qn.__super__=te,Qn.prototype=M(te.prototype,{__class__:Qn});var se=f.core.Pair=function(r,s){this.item0=r,this.item1=s};x["verb.core.Pair"]=se,se.__name__=["verb","core","Pair"],se.prototype={__class__:se};var ke=f.core.Interval=function(r,s){this.min=r,this.max=s};x["verb.core.Interval"]=ke,ke.__name__=["verb","core","Interval"],ke.prototype={__class__:ke};var tn=f.core.CurveCurveIntersection=function(r,s,o,l){this.point0=r,this.point1=s,this.u0=o,this.u1=l};x["verb.core.CurveCurveIntersection"]=tn,tn.__name__=["verb","core","CurveCurveIntersection"],tn.prototype={__class__:tn};var Jn=f.core.CurveSurfaceIntersection=function(r,s,o,l){this.u=r,this.uv=s,this.curvePoint=o,this.surfacePoint=l};x["verb.core.CurveSurfaceIntersection"]=Jn,Jn.__name__=["verb","core","CurveSurfaceIntersection"],Jn.prototype={__class__:Jn};var Dr=f.core.MeshIntersectionPoint=function(r,s,o,l,u){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=s,this.point=o,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=Dr,Dr.__name__=["verb","core","MeshIntersectionPoint"],Dr.prototype={__class__:Dr};var ts=f.core.PolylineMeshIntersection=function(r,s,o,l,u){this.point=r,this.u=s,this.uv=o,this.polylineIndex=l,this.faceIndex=u};x["verb.core.PolylineMeshIntersection"]=ts,ts.__name__=["verb","core","PolylineMeshIntersection"],ts.prototype={__class__:ts};var es=f.core.SurfaceSurfaceIntersectionPoint=function(r,s,o,l){this.uv0=r,this.uv1=s,this.point=o,this.dist=l};x["verb.core.SurfaceSurfaceIntersectionPoint"]=es,es.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],es.prototype={__class__:es};var rs=f.core.TriSegmentIntersection=function(r,s,o,l){this.point=r,this.s=s,this.t=o,this.p=l};x["verb.core.TriSegmentIntersection"]=rs,rs.__name__=["verb","core","TriSegmentIntersection"],rs.prototype={__class__:rs};var En=f.core.CurveTriPoint=function(r,s,o){this.u=r,this.point=s,this.uv=o};x["verb.core.CurveTriPoint"]=En,En.__name__=["verb","core","CurveTriPoint"],En.prototype={__class__:En};var Ye=function(r,s,o,l,u){u==null&&(u=!1),l==null&&(l=-1),this.uv=o,this.point=r,this.normal=s,this.id=l,this.degen=u};x["verb.core.SurfacePoint"]=Ye,Ye.__name__=["verb","core","SurfacePoint"],Ye.fromUv=function(r,s){return new Ye(null,null,[r,s])},Ye.prototype={__class__:Ye};var Zs=f.core.CurvePoint=function(r,s){this.u=r,this.pt=s};x["verb.core.CurvePoint"]=Zs,Zs.__name__=["verb","core","CurvePoint"],Zs.prototype={__class__:Zs};var ns=f.core.KdTree=function(r,s){this.dim=3,this.points=r,this.distanceFunction=s,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=ns,ns.__name__=["verb","core","KdTree"],ns.prototype={buildTree:function(r,s,o){var l=s%this.dim,u,d;return r.length==0?null:r.length==1?new kn(r[0],l,o):(r.sort(function(m,_){var y=m.point[l]-_.point[l];return y==0?0:y>0?1:-1}),u=Math.floor(r.length/2),d=new kn(r[u],l,o),d.left=this.buildTree(r.slice(0,u),s+1,d),d.right=this.buildTree(r.slice(u+1),s+1,d),d)},nearest:function(r,s,o){var l=this,u=new ss(function(P){return-P.item1}),d,m=null;m=function(P){for(var E,k=P.dimension,T=l.distanceFunction(r,P.kdPoint.point),B,N=[],R=0,z=l.dim;R<z;)R++,N.push(0);B=N;for(var V,U,Y=function($,tt){u.push(new se($,tt)),u.size()>s&&u.pop()},J=0,q=l.dim;J<q;){var j=J++;j==P.dimension?B[j]=r[j]:B[j]=P.kdPoint.point[j]}if(V=l.distanceFunction(B,P.kdPoint.point),P.right==null&&P.left==null){(u.size()<s||T<u.peek().item1)&&Y(P,T);return}P.right==null?E=P.left:P.left==null?E=P.right:r[k]<P.kdPoint.point[k]?E=P.left:E=P.right,m(E),(u.size()<s||T<u.peek().item1)&&Y(P,T),(u.size()<s||Math.abs(V)<u.peek().item1)&&(E==P.left?U=P.right:U=P.left,U!=null&&m(U))},d=m;for(var _=0;_<s;)_++,u.push(new se(null,o));d(this.root);for(var y=[],A=0;A<s;){var S=A++;u.content[S].item0!=null&&y.push(new se(u.content[S].item0.kdPoint,u.content[S].item1))}return y},__class__:ns};var ss=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=ss,ss.__name__=["verb","core","BinaryHeap"],ss.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],s=this.content.pop();return this.content.length>0&&(this.content[0]=s,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var s=this.content.length,o=0;o<s;){var l=o++;if(this.content[l]==r){var u=this.content.pop();l!=s-1&&(this.content[l]=u,this.scoreFunction(u)<this.scoreFunction(r)?this.bubbleUp(l):this.sinkDown(l));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var s=this.content[r];r>0;){var o=Math.floor((r+1)/2)-1,l=this.content[o];if(this.scoreFunction(s)<this.scoreFunction(l))this.content[o]=s,this.content[r]=l,r=o;else break}},sinkDown:function(r){for(var s=this.content.length,o=this.content[r],l=this.scoreFunction(o);;){var u=(r+1)*2,d=u-1,m=-1,_=0;if(d<s){var y=this.content[d];_=this.scoreFunction(y),_<l&&(m=d)}if(u<s){var A=this.content[u],S=this.scoreFunction(A);S<(m==-1?l:_)&&(m=u)}if(m!=-1)this.content[r]=this.content[m],this.content[m]=o,r=m;else break}},__class__:ss};var Mn=f.core.KdPoint=function(r,s){this.point=r,this.obj=s};x["verb.core.KdPoint"]=Mn,Mn.__name__=["verb","core","KdPoint"],Mn.prototype={__class__:Mn};var kn=f.core.KdNode=function(r,s,o){this.kdPoint=r,this.left=null,this.right=null,this.parent=o,this.dimension=s};x["verb.core.KdNode"]=kn,kn.__name__=["verb","core","KdNode"],kn.prototype={__class__:kn};var gr=function(){};x["verb.eval.IBoundingBoxTree"]=gr,gr.__name__=["verb","eval","IBoundingBoxTree"],gr.prototype={__class__:gr};var lr=function(r,s){this._boundingBox=null,this._curve=r,s==null&&(s=p.domain(this._curve.knots)/64),this._knotTol=s};x["verb.core.LazyCurveBoundingBoxTree"]=lr,lr.__name__=["verb","core","LazyCurveBoundingBoxTree"],lr.__interfaces__=[gr],lr.prototype={split:function(){var r=Z.first(this._curve.knots),s=Z.last(this._curve.knots),o=s-r,l=ue.curveSplit(this._curve,(s+r)/2+o*.1*Math.random());return new se(new lr(l[0],this._knotTol),new lr(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Oe(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return p.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:lr};var hr=function(r,s){if(this._boundingBox=null,this._mesh=r,s==null){for(var o=[],l=0,u=r.faces.length;l<u;){var d=l++;o.push(d)}s=o}this._faceIndices=s};x["verb.core.LazyMeshBoundingBoxTree"]=hr,hr.__name__=["verb","core","LazyMeshBoundingBoxTree"],hr.__interfaces__=[gr],hr.prototype={split:function(){var r=ie.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),s=Z.left(r),o=Z.right(r);return new se(new hr(this._mesh,s),new hr(this._mesh,o))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=ie.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:hr};var cr=function(r,s){this._boundingBox=null,this._polyline=r,s==null&&(s=new ke(0,r.points.length!=0?r.points.length-1:0)),this._interval=s};x["verb.core.LazyPolylineBoundingBoxTree"]=cr,cr.__name__=["verb","core","LazyPolylineBoundingBoxTree"],cr.__interfaces__=[gr],cr.prototype={split:function(){var r=this._interval.min,s=this._interval.max,o=r+Math.ceil((s-r)/2),l=new ke(r,o),u=new ke(o,s);return new se(new cr(this._polyline,l),new cr(this._polyline,u))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Oe(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:cr};var Fr=function(r,s,o,l){s==null&&(s=!1),this._boundingBox=null,this._surface=r,this._splitV=s,o==null&&(o=p.domain(r.knotsU)/16),l==null&&(l=p.domain(r.knotsV)/16),this._knotTolU=o,this._knotTolV=l};x["verb.core.LazySurfaceBoundingBoxTree"]=Fr,Fr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Fr.__interfaces__=[gr],Fr.prototype={split:function(){var r,s;this._splitV?(r=Z.first(this._surface.knotsV),s=Z.last(this._surface.knotsV)):(r=Z.first(this._surface.knotsU),s=Z.last(this._surface.knotsU));var o=(r+s)/2,l=ue.surfaceSplit(this._surface,o,this._splitV);return new se(new Fr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Fr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Oe;for(var r=0,s=this._surface.controlPoints;r<s.length;){var o=s[r];++r,this._boundingBox.addRange(C.dehomogenize1d(o))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return p.domain(this._surface.knotsV)<this._knotTolV&&p.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Fr};var Ot=f.core.Mat=function(){};x["verb.core.Mat"]=Ot,Ot.__name__=["verb","core","Mat"],Ot.mul=function(r,s){for(var o=[],l=0,u=s.length;l<u;){var d=l++;o.push(p.mul(r,s[d]))}return o},Ot.mult=function(r,s){var o,l,u,d,m,_,y,A;o=r.length,l=s.length,u=s[0].length,d=[];for(var S=o-1,P=0,E=0;S>=0;){for(m=[],_=r[S],E=u-1;E>=0;){for(y=_[l-1]*s[l-1][E],P=l-2;P>=1;)A=P-1,y+=_[P]*s[P][E]+_[A]*s[A][E],P-=2;P==0&&(y+=_[0]*s[0][E]),m[E]=y,E--}d[S]=m,S--}return d},Ot.add=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(p.add(r[d],s[d]))}return o},Ot.div=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(p.div(r[d],s))}return o},Ot.sub=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(p.sub(r[d],s[d]))}return o},Ot.dot=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(p.dot(r[d],s))}return o},Ot.identity=function(r){for(var s=p.zeros2d(r,r),o=0;o<r;){var l=o++;s[l][l]=1}return s},Ot.transpose=function(r){if(r.length==0)return[];for(var s=[],o=0,l=r[0].length;o<l;){var u=o++;s.push(function(d){for(var m,_=[],y=0,A=r.length;y<A;){var S=y++;_.push(r[S][u])}return m=_,m}())}return s},Ot.solve=function(r,s){return Ot.LUsolve(Ot.LU(r),s)},Ot.LUsolve=function(r,s){var o,l,u=r.LU,d=u.length,m=s.slice(),_=r.P,y,A,S;for(o=d-1;o!=-1;)m[o]=s[o],--o;for(o=0;o<d;){for(y=_[o],_[o]!=o&&(S=m[o],m[o]=m[y],m[y]=S),A=u[o],l=0;l<o;)m[o]-=m[l]*A[l],++l;++o}for(o=d-1;o>=0;){for(A=u[o],l=o+1;l<d;)m[o]-=m[l]*A[l],++l;m[o]/=A[o],--o}return m},Ot.LU=function(r){for(var s,o,l,u,d,m,_,y,A,S=[],P=0,E=r.length;P<E;){var k=P++;S.push(r[k].slice())}r=S;var T=r.length,B=T-1,N=[];for(l=0;l<T;){for(_=l,m=r[l],A=Math.abs(m[l]),o=l+1;o<T;)u=Math.abs(r[o][l]),A<u&&(A=u,_=o),++o;for(N[l]=_,_!=l&&(r[l]=r[_],r[_]=m,m=r[l]),d=m[l],s=l+1;s<T;)r[s][l]/=d,++s;for(s=l+1;s<T;){for(y=r[s],o=l+1;o<B;)y[o]-=y[l]*m[o],++o,y[o]-=y[l]*m[o],++o;o==B&&(y[o]-=y[l]*m[o]),++s}++l}return new is(r,N)};var is=function(r,s){this.LU=r,this.P=s};x["verb.core._Mat.LUDecomp"]=is,is.__name__=["verb","core","_Mat","LUDecomp"],is.prototype={__class__:is};var ie=f.core.Mesh=function(){};x["verb.core.Mesh"]=ie,ie.__name__=["verb","core","Mesh"],ie.getTriangleNorm=function(r,s){var o=r[s[0]],l=r[s[1]],u=r[s[2]],d=p.sub(l,o),m=p.sub(u,o),_=p.cross(d,m);return p.mul(1/p.norm(_),_)},ie.makeMeshAabb=function(r,s){for(var o=new Oe,l=0;l<s.length;){var u=s[l];++l,o.add(r.points[r.faces[u][0]]),o.add(r.points[r.faces[u][1]]),o.add(r.points[r.faces[u][2]])}return o},ie.sortTrianglesOnLongestAxis=function(r,s,o){for(var l=r.getLongestAxis(),u=[],d=0;d<o.length;){var m=o[d];++d;var _=ie.getMinCoordOnAxis(s.points,s.faces[m],l);u.push(new se(_,m))}u.sort(function(E,k){var T=E.item0,B=k.item0;return T==B?0:T>B?1:-1});for(var y=[],A=0,S=u.length;A<S;){var P=A++;y.push(u[P].item1)}return y},ie.getMinCoordOnAxis=function(r,s,o){for(var l=1/0,u=0;u<3;){var d=u++,m=r[s[d]][o];m<l&&(l=m)}return l},ie.getTriangleCentroid=function(r,s){for(var o=[0,0,0],l=0;l<3;)for(var u=l++,d=0;d<3;){var m=d++;o[m]+=r[s[u]][m]}for(var _=0;_<3;){var y=_++;o[y]/=3}return o},ie.triangleUVFromPoint=function(r,s,o){var l=r.faces[s],u=r.points[l[0]],d=r.points[l[1]],m=r.points[l[2]],_=r.uvs[l[0]],y=r.uvs[l[1]],A=r.uvs[l[2]],S=p.sub(u,o),P=p.sub(d,o),E=p.sub(m,o),k=p.norm(p.cross(p.sub(u,d),p.sub(u,m))),T=p.norm(p.cross(P,E))/k,B=p.norm(p.cross(E,S))/k,N=p.norm(p.cross(S,P))/k;return p.add(p.mul(T,_),p.add(p.mul(B,y),p.mul(N,A)))};var Vr=function(r,s){if(this._empty=!1,this._face=-1,s==null){for(var o=[],l=0,u=r.faces.length;l<u;){var d=l++;o.push(d)}s=o}if(this._boundingBox=ie.makeMeshAabb(r,s),s.length<1){this._empty=!0;return}else if(s.length<2){this._face=s[0];return}var m=ie.sortTrianglesOnLongestAxis(this._boundingBox,r,s),_=Z.left(m),y=Z.right(m);this._children=new se(new Vr(r,_),new Vr(r,y))};x["verb.core.MeshBoundingBoxTree"]=Vr,Vr.__name__=["verb","core","MeshBoundingBoxTree"],Vr.__interfaces__=[gr],Vr.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:Vr};var Ze=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=Ze,Ze.__name__=["verb","core","Minimizer"],Ze.uncmin=function(r,s,o,l,u){o==null&&(o=1e-8),l==null&&(l=function(J){return Ze.numericalGradient(r,J)}),u==null&&(u=1e3),s=s.slice(0);var d=s.length,m=r(s),_=m,y;if(isNaN(m))throw new Q("uncmin: f(x0) is a NaN!");o=Math.max(o,rt.EPSILON);var A,S,P,E=Ot.identity(d),k=0,T=[],B,N,R,z,V,U,Y="";for(S=l(s);k<u;){if(!p.all(p.finite(S))){Y="Gradient has Infinity or NaN";break}if(A=p.neg(Ot.dot(E,S)),!p.all(p.finite(A))){Y="Search direction has Infinity or NaN";break}if(U=p.norm(A),U<o){Y="Newton step smaller than tol";break}for(V=1,y=p.dot(S,A),B=s;k<u&&!(V*U<o);){if(T=p.mul(V,A),B=p.add(s,T),_=r(B),_-m>=.1*V*y||isNaN(_)){V*=.5,++k;continue}break}if(V*U<o){Y="Line search step size smaller than tol";break}if(k==u){Y="maxit reached during line search";break}P=l(B),N=p.sub(P,S),z=p.dot(N,T),R=Ot.dot(E,N),E=Ot.sub(Ot.add(E,Ot.mul((z+p.dot(N,R))/(z*z),Ze.tensor(T,T))),Ot.div(Ot.add(Ze.tensor(R,T),Ze.tensor(T,R)),z)),s=B,m=_,S=P,++k}return new as(s,m,S,E,k,Y)},Ze.numericalGradient=function(r,s){var o=s.length,l=r(s);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var u=s.slice(0),d,m,_=[],y,A=.001,S,P,E,k=0,T,B,N,R=0;R<o;)for(var z=R++,V=Math.max(1e-6*l,1e-8);;){if(++k,k>20)throw new Q("Numerical gradient fails");if(u[z]=s[z]+V,d=r(u),u[z]=s[z]-V,m=r(u),u[z]=s[z],isNaN(d)||isNaN(m)){V/=16;continue}if(_[z]=(d-m)/(2*V),S=s[z]-V,P=s[z],E=s[z]+V,T=(d-l)/V,B=(l-m)/V,N=p.max([Math.abs(_[z]),Math.abs(l),Math.abs(d),Math.abs(m),Math.abs(S),Math.abs(P),Math.abs(E),1e-8]),y=Math.min(p.max([Math.abs(T-_[z]),Math.abs(B-_[z]),Math.abs(T-B)])/N,V/N),y>A)V/=16;else break}return _},Ze.tensor=function(r,s){for(var o=r.length,l=s.length,u=[],d,m,_=o-1;_>=0;){d=[],m=r[_];for(var y=l-1;y>=3;)d[y]=m*s[y],--y,d[y]=m*s[y],--y,d[y]=m*s[y],--y,d[y]=m*s[y],--y;for(;y>=0;)d[y]=m*s[y],--y;u[_]=d,_--}return u};var as=function(r,s,o,l,u,d){this.solution=r,this.value=s,this.gradient=o,this.invHessian=l,this.iterations=u,this.message=d};x["verb.core.MinimizationResult"]=as,as.__name__=["verb","core","MinimizationResult"],as.prototype={__class__:as};var Tn=function(){};x["verb.core.ISerializable"]=Tn,Tn.__name__=["verb","core","ISerializable"],Tn.prototype={__class__:Tn};var Zi=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=Zi,Zi.__name__=["verb","core","Deserializer"],Zi.deserialize=function(r){var s=new qt(r),o=s.unserialize();return o};var Be=f.core.Trig=function(){};x["verb.core.Trig"]=Be,Be.__name__=["verb","core","Trig"],Be.isPointInPlane=function(r,s,o){return Math.abs(p.dot(p.sub(r,s.origin),s.normal))<o},Be.distToSegment=function(r,s,o){var l=Be.segmentClosestPoint(s,r,o,0,1);return p.dist(s,l.pt)},Be.rayClosestPoint=function(r,s,o){var l=p.sub(r,s),u=p.dot(l,o),d=p.add(s,p.mul(u,o));return d},Be.distToRay=function(r,s,o){var l=Be.rayClosestPoint(r,s,o),u=p.sub(l,r);return p.norm(u)},Be.threePointsAreFlat=function(r,s,o,l){var u=p.sub(s,r),d=p.sub(o,r),m=p.cross(u,d),_=p.dot(m,m);return _<l},Be.segmentClosestPoint=function(r,s,o,l,u){var d=p.sub(o,s),m=p.norm(d);if(m<rt.EPSILON)return{u:l,pt:s};var _=s,y=p.mul(1/m,d),A=p.sub(r,_),S=p.dot(A,y);return S<0?{u:l,pt:s}:S>m?{u,pt:o}:{u:l+(u-l)*S/m,pt:p.add(_,p.mul(S,y))}};var p=f.core.Vec=function(){};x["verb.core.Vec"]=p,p.__name__=["verb","core","Vec"],p.angleBetween=function(r,s){return Math.acos(p.dot(r,s)/(p.norm(r)*p.norm(s)))},p.positiveAngleBetween=function(r,s,o){var l=p.cross(r,s),u=p.norm(r),d=p.norm(s),m=u*d,_=p.dot(r,s),y=p.norm(l)/m,A=_/m,S=Math.atan2(y,A),P=p.dot(o,l);return Math.abs(P)<rt.EPSILON||P>0?S:-S},p.signedAngleBetween=function(r,s,o){var l=p.cross(r,s),u=p.norm(r),d=p.norm(s),m=u*d,_=p.dot(r,s),y=p.norm(l)/m,A=_/m,S=Math.atan2(y,A),P=p.dot(o,l);return P>0?S:2*Math.PI-S},p.angleBetweenNormalized2d=function(r,s){var o=r[0]*s[1]-r[1]*s[0];return Math.atan2(o,p.dot(r,s))},p.domain=function(r){return Z.last(r)-Z.first(r)},p.range=function(r){for(var s=[],o=0,l=0;l<r;)l++,s.push(o),o+=1;return s},p.span=function(r,s,o){if(o==null)return[];if(o<rt.EPSILON)return[];if(r>s&&o>0)return[];if(s>r&&o<0)return[];for(var l=[],u=r;u<=s;)l.push(u),u+=o;return l},p.neg=function(r){return r.map(function(s){return-s})},p.min=function(r){return O.fold(r,function(s,o){return Math.min(s,o)},1/0)},p.max=function(r){return O.fold(r,function(s,o){return Math.max(s,o)},-1/0)},p.all=function(r){return O.fold(r,function(s,o){return o&&s},!0)},p.finite=function(r){return r.map(function(s){return isFinite(s)})},p.onRay=function(r,s,o){return p.add(r,p.mul(o,s))},p.lerp=function(r,s,o){return p.add(p.mul(r,s),p.mul(1-r,o))},p.normalized=function(r){return p.div(r,p.norm(r))},p.cross=function(r,s){return[r[1]*s[2]-r[2]*s[1],r[2]*s[0]-r[0]*s[2],r[0]*s[1]-r[1]*s[0]]},p.dist=function(r,s){return p.norm(p.sub(r,s))},p.distSquared=function(r,s){return p.normSquared(p.sub(r,s))},p.sum=function(r){return O.fold(r,function(s,o){return o+s},0)},p.addAll=function(r){var s=Qe(r)();if(!s.hasNext())return null;var o=s.next().length;return O.fold(r,function(l,u){return p.add(u,l)},p.rep(o,0))},p.addAllMutate=function(r){for(var s=r[0],o=1,l=r.length;o<l;){var u=o++;p.addMutate(s,r[u])}},p.addMulMutate=function(r,s,o){for(var l=0,u=r.length;l<u;){var d=l++;r[d]=r[d]+s*o[d]}},p.subMulMutate=function(r,s,o){for(var l=0,u=r.length;l<u;){var d=l++;r[d]=r[d]-s*o[d]}},p.addMutate=function(r,s){for(var o=0,l=r.length;o<l;){var u=o++;r[u]=r[u]+s[u]}},p.subMutate=function(r,s){for(var o=0,l=r.length;o<l;){var u=o++;r[u]=r[u]-s[u]}},p.mulMutate=function(r,s){for(var o=0,l=s.length;o<l;){var u=o++;s[u]=s[u]*r}},p.norm=function(r){var s=p.normSquared(r);return s!=0?Math.sqrt(s):s},p.normSquared=function(r){return O.fold(r,function(s,o){return o+s*s},0)},p.rep=function(r,s){for(var o=[],l=0;l<r;)l++,o.push(s);return o},p.zeros1d=function(r){for(var s=[],o=0;o<r;)o++,s.push(0);return s},p.zeros2d=function(r,s){for(var o=[],l=0;l<r;)l++,o.push(p.zeros1d(s));return o},p.zeros3d=function(r,s,o){for(var l=[],u=0;u<r;)u++,l.push(p.zeros2d(s,o));return l},p.dot=function(r,s){for(var o=0,l=0,u=r.length;l<u;){var d=l++;o+=r[d]*s[d]}return o},p.add=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(r[d]+s[d])}return o},p.mul=function(r,s){for(var o=[],l=0,u=s.length;l<u;){var d=l++;o.push(r*s[d])}return o},p.div=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(r[d]/s)}return o},p.sub=function(r,s){for(var o=[],l=0,u=r.length;l<u;){var d=l++;o.push(r[d]-s[d])}return o},p.isZero=function(r){for(var s=0,o=r.length;s<o;){var l=s++;if(Math.abs(r[l])>rt.TOLERANCE)return!1}return!0},p.sortedSetUnion=function(r,s){for(var o=[],l=0,u=0;l<r.length||u<s.length;){if(l>=r.length){o.push(s[u]),u++;continue}else if(u>=s.length){o.push(r[l]),l++;continue}var d=r[l]-s[u];if(Math.abs(d)<rt.EPSILON){o.push(r[l]),l++,u++;continue}if(d>0){o.push(s[u]),u++;continue}o.push(r[l]),l++}return o},p.sortedSetSub=function(r,s){for(var o=[],l=0,u=0;l<r.length;){if(u>=s.length){o.push(r[l]),l++;continue}if(Math.abs(r[l]-s[u])<rt.EPSILON){l++,u++;continue}o.push(r[l]),l++}return o};var bt=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=bt,bt.__name__=["verb","eval","Analyze"],bt.knotMultiplicities=function(r){for(var s=[new Cn(r[0],0)],o=s[0],l=0;l<r.length;){var u=r[l];++l,Math.abs(u-o.knot)>rt.EPSILON&&(o=new Cn(u,0),s.push(o)),o.inc()}return s},bt.isRationalSurfaceClosed=function(r,s){s==null&&(s=!0);var o;s?o=r.controlPoints:o=Ot.transpose(r.controlPoints);for(var l=0,u=o[0].length;l<u;){var d=l++,m=p.dist(Z.first(o)[d],Z.last(o)[d])<rt.EPSILON;if(!m)return!1}return!0},bt.rationalSurfaceClosestPoint=function(r,s){var o=bt.rationalSurfaceClosestParam(r,s);return C.rationalSurfacePoint(r,o[0],o[1])},bt.rationalSurfaceClosestParam=function(r,s){for(var o=5,l=0,u,d=1e-4,m=5e-4,_,y=r.knotsU[0],A=Z.last(r.knotsU),S=r.knotsV[0],P=Z.last(r.knotsV),E=bt.isRationalSurfaceClosed(r),k=bt.isRationalSurfaceClosed(r,!1),T,B=zt.rationalSurfaceAdaptive(r,new Ur),N=1/0,R=0,z=B.points.length;R<z;){var V=R++,U=B.points[V],Y=p.normSquared(p.sub(s,U));Y<N&&(N=Y,T=B.uvs[V])}for(var J=function(Ht){return C.rationalSurfaceDerivatives(r,Ht[0],Ht[1],2)},q=function(Ht,$t,Ut){var Qt=$t[1][0],Te=$t[0][1],Ke=$t[2][0],we=$t[0][2],ye=$t[1][1],Ce=$t[1][1],Re=p.dot(Qt,Ut),Je=p.dot(Te,Ut),ur=[-Re,-Je],tr=p.dot(Qt,Qt)+p.dot(Ke,Ut),er=p.dot(Qt,Te)+p.dot(ye,Ut),rr=p.dot(Qt,Te)+p.dot(Ce,Ut),_r=p.dot(Te,Te)+p.dot(we,Ut),Bn=[[tr,er],[rr,_r]],rn=Ot.solve(Bn,ur);return p.add(rn,Ht)};l<o;){u=J(T),_=p.sub(u[0][0],s);var j=p.norm(_),$=p.dot(u[1][0],_),tt=p.norm(u[1][0])*j,et=p.dot(u[0][1],_),it=p.norm(u[0][1])*j,ht=$/tt,at=et/it,ut=j<d,nt=ht<m,mt=at<m;if(ut&&nt&&mt)return T;var K=q(T,u,_);K[0]<y?E?K=[A-(K[0]-y),K[1]]:K=[y+rt.EPSILON,K[1]]:K[0]>A&&(E?K=[y+(K[0]-A),K[1]]:K=[A-rt.EPSILON,K[1]]),K[1]<S?k?K=[K[0],P-(K[1]-S)]:K=[K[0],S+rt.EPSILON]:K[1]>P&&(k?K=[K[0],S+(K[0]-P)]:K=[K[0],P-rt.EPSILON]);var ft=p.norm(p.mul(K[0]-T[0],u[1][0])),Et=p.norm(p.mul(K[1]-T[1],u[0][1]));if(ft+Et<d)return T;T=K,l++}return T},bt.rationalCurveClosestPoint=function(r,s){return C.rationalCurvePoint(r,bt.rationalCurveClosestParam(r,s))},bt.rationalCurveClosestParam=function(r,s){for(var o=1/0,l=0,u=zt.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,m=u.length-1;d<m;){var _=d++,y=u[_][0],A=u[_+1][0],S=u[_].slice(1),P=u[_+1].slice(1),E=Be.segmentClosestPoint(s,S,P,y,A),k=p.norm(p.sub(s,E.pt));k<o&&(o=k,l=E.u)}for(var T=5,B=0,N,R=1e-4,z=5e-4,V,U=r.knots[0],Y=Z.last(r.knots),J=p.normSquared(p.sub(r.controlPoints[0],Z.last(r.controlPoints)))<rt.EPSILON,q=l,j=function(K){return C.rationalCurveDerivatives(r,K,2)},$=function(K,ft,Et){var Ht=p.dot(ft[1],Et),$t=p.dot(ft[2],Et),Ut=p.dot(ft[1],ft[1]),Qt=$t+Ut;return K-Ht/Qt};B<T;){N=j(q),V=p.sub(N[0],s);var tt=p.norm(V),et=p.dot(N[1],V),it=p.norm(N[1])*tt,ht=et/it,at=tt<R,ut=Math.abs(ht)<z;if(at&&ut)return q;var nt=$(q,N,V);nt<U?J?nt=Y-(nt-U):nt=U:nt>Y&&(J?nt=U+(nt-Y):nt=Y);var mt=p.norm(p.mul(nt-q,N[1]));if(mt<R)return q;q=nt,B++}return q},bt.rationalCurveParamAtArcLength=function(r,s,o,l,u){if(o==null&&(o=.001),s<rt.EPSILON)return r.knots[0];var d;l!=null?d=l:d=_t.decomposeCurveIntoBeziers(r);var m=0;d[m];var _=-rt.EPSILON,y;for(u!=null?y=u:y=[];_<s&&m<d.length;){if(m<y.length?y[m]=y[m]:y[m]=bt.rationalBezierCurveArcLength(r),_+=y[m],s<_+rt.EPSILON)return bt.rationalBezierCurveParamAtArcLength(r,s,o,y[m]);m++}return-1},bt.rationalBezierCurveParamAtArcLength=function(r,s,o,l){if(s<0)return r.knots[0];var u;if(l!=null?u=l:u=bt.rationalBezierCurveArcLength(r),s>u)return Z.last(r.knots);var d=r.knots[0],m=0,_=Z.last(r.knots),y=u,A=0,S=0,P;for(o!=null?P=o:P=rt.TOLERANCE*2;y-m>P;)A=(d+_)/2,S=bt.rationalBezierCurveArcLength(r,A),S>s?(_=A,y=S):(d=A,m=S);return(d+_)/2},bt.rationalCurveArcLength=function(r,s,o){o==null&&(o=16),s==null?s=Z.last(r.knots):s=s;for(var l=_t.decomposeCurveIntoBeziers(r),u=0,d=l[0],m=0;u<l.length&&d.knots[0]+rt.EPSILON<s;){var _=Math.min(Z.last(d.knots),s);m+=bt.rationalBezierCurveArcLength(d,_,o),d=l[++u]}return m},bt.rationalBezierCurveArcLength=function(r,s,o){o==null&&(o=16);var l;s==null?l=Z.last(r.knots):l=s;for(var u=(l-r.knots[0])/2,d=0,m=r.degree+o,_,y,A=0;A<m;){var S=A++;_=u*bt.Tvalues[m][S]+u+r.knots[0],y=C.rationalCurveDerivatives(r,_,1),d+=bt.Cvalues[m][S]*p.norm(y[1])}return u*d};var Cn=f.eval.KnotMultiplicity=function(r,s){this.knot=r,this.mult=s};x["verb.eval.KnotMultiplicity"]=Cn,Cn.__name__=["verb","eval","KnotMultiplicity"],Cn.prototype={inc:function(){this.mult++},__class__:Cn};var Xe=f.eval.Check=function(){};x["verb.eval.Check"]=Xe,Xe.__name__=["verb","eval","Check"],Xe.isValidKnotVector=function(r,s){if(r.length==0||r.length<(s+1)*2)return!1;for(var o=Z.first(r),l=0,u=s+1;l<u;){var d=l++;if(Math.abs(r[d]-o)>rt.EPSILON)return!1}o=Z.last(r);for(var m=r.length-s-1,_=r.length;m<_;){var y=m++;if(Math.abs(r[y]-o)>rt.EPSILON)return!1}return Xe.isNonDecreasing(r)},Xe.isNonDecreasing=function(r){for(var s=Z.first(r),o=0,l=r.length;o<l;){var u=o++;if(r[u]<s-rt.EPSILON)return!1;s=r[u]}return!0},Xe.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!Xe.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},Xe.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!Xe.isValidKnotVector(r.knotsU,r.degreeU)||!Xe.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var ue=f.eval.Divide=function(){};x["verb.eval.Divide"]=ue,ue.__name__=["verb","eval","Divide"],ue.surfaceSplit=function(r,s,o){o==null&&(o=!1);var l,u,d;o?(d=r.controlPoints,l=r.knotsV,u=r.degreeV):(d=Ot.transpose(r.controlPoints),l=r.knotsU,u=r.degreeU);for(var m,_=[],y=0,A=u+1;y<A;)y++,_.push(s);m=_;for(var S=[],P=[],E=C.knotSpan(u,s,l),k=null,T=0;T<d.length;){var B=d[T];++T,k=_t.curveKnotRefine(new Wt(u,l,B),m),S.push(k.controlPoints.slice(0,E+1)),P.push(k.controlPoints.slice(E+1))}var N=k.knots.slice(0,E+u+2),R=k.knots.slice(E+1);return o?[new ne(r.degreeU,u,r.knotsU.slice(),N,S),new ne(r.degreeU,u,r.knotsU.slice(),R,P)]:(S=Ot.transpose(S),P=Ot.transpose(P),[new ne(u,r.degreeV,N,r.knotsV.slice(),S),new ne(u,r.degreeV,R,r.knotsV.slice(),P)])},ue.curveSplit=function(r,s){var o=r.degree;r.controlPoints;for(var l=r.knots,u,d=[],m=0,_=o+1;m<_;)m++,d.push(s);u=d;var y=_t.curveKnotRefine(r,u),A=C.knotSpan(o,s,l),S=y.knots.slice(0,A+o+2),P=y.knots.slice(A+1),E=y.controlPoints.slice(0,A+1),k=y.controlPoints.slice(A+1);return[new Wt(o,S,E),new Wt(o,P,k)]},ue.rationalCurveByEqualArcLength=function(r,s){var o=bt.rationalCurveArcLength(r),l=o/s;return ue.rationalCurveByArcLength(r,l)},ue.rationalCurveByArcLength=function(r,s){var o=_t.decomposeCurveIntoBeziers(r),l=o.map(function(E){return bt.rationalBezierCurveArcLength(E)}),u=p.sum(l),d=[new Nn(r.knots[0],0)];if(s>u)return d;for(var m=s,_=0,y=m,A=0,S=0,P;_<o.length;){for(A+=l[_];y<A+rt.EPSILON;)P=bt.rationalBezierCurveParamAtArcLength(o[_],y-S,rt.TOLERANCE,l[_]),d.push(new Nn(P,y)),y+=m;S+=l[_],_++}return d};var Nn=f.eval.CurveLengthSample=function(r,s){this.u=r,this.len=s};x["verb.eval.CurveLengthSample"]=Nn,Nn.__name__=["verb","eval","CurveLengthSample"],Nn.prototype={__class__:Nn};var C=f.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(r,s){var o=C.rationalCurveDerivatives(r,s,1);return o[1]},C.rationalSurfaceNormal=function(r,s,o){var l=C.rationalSurfaceDerivatives(r,s,o,1);return p.cross(l[1][0],l[0][1])},C.rationalSurfaceDerivatives=function(r,s,o,l){l==null&&(l=1);for(var u=C.surfaceDerivatives(r,s,o,l),d=C.rational2d(u),m=C.weight2d(u),_=[],y=d[0][0].length,A=0,S=l+1;A<S;){var P=A++;_.push([]);for(var E=0,k=l-P+1;E<k;){for(var T=E++,B=d[P][T],N=1,R=T+1;N<R;){var z=N++;p.subMulMutate(B,Dt.get(T,z)*m[0][z],_[P][T-z])}for(var V=1,U=P+1;V<U;){var Y=V++;p.subMulMutate(B,Dt.get(P,Y)*m[Y][0],_[P-Y][T]);for(var J=p.zeros1d(y),q=1,j=T+1;q<j;){var $=q++;p.addMulMutate(J,Dt.get(T,$)*m[Y][$],_[P-Y][T-$])}p.subMulMutate(B,Dt.get(P,Y),J)}p.mulMutate(1/m[0][0],B),_[P].push(B)}}return _},C.rationalSurfacePoint=function(r,s,o){return C.dehomogenize(C.surfacePoint(r,s,o))},C.rationalCurveDerivatives=function(r,s,o){o==null&&(o=1);for(var l=C.curveDerivatives(r,s,o),u=C.rational1d(l),d=C.weight1d(l),m=[],_=0,y=o+1;_<y;){for(var A=_++,S=u[A],P=1,E=A+1;P<E;){var k=P++;p.subMulMutate(S,Dt.get(A,k)*d[k],m[A-k])}p.mulMutate(1/d[0],S),m.push(S)}return m},C.rationalCurvePoint=function(r,s){return C.dehomogenize(C.curvePoint(r,s))},C.surfaceDerivatives=function(r,s,o,l){var u=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return C.surfaceDerivativesGivenNM(u,d,r,s,o,l)},C.surfaceDerivativesGivenNM=function(r,s,o,l,u,d){var m=o.degreeU,_=o.degreeV,y=o.controlPoints,A=o.knotsU,S=o.knotsV;if(!C.areValidRelations(m,y.length,A.length)||!C.areValidRelations(_,y[0].length,S.length))throw new Q("Invalid relations between control points, knot vector, and n");var P=y[0][0].length,E;d<m?E=d:E=m;var k;d<_?k=d:k=_;for(var T=p.zeros3d(d+1,d+1,P),B=C.knotSpanGivenN(r,m,l,A),N=C.knotSpanGivenN(s,_,u,S),R=C.derivativeBasisFunctionsGivenNI(B,l,m,r,A),z=C.derivativeBasisFunctionsGivenNI(N,u,_,s,S),V=p.zeros2d(_+1,P),U=0,Y=0,J=E+1;Y<J;){for(var q=Y++,j=0,$=_+1;j<$;){var tt=j++;V[tt]=p.zeros1d(P);for(var et=0,it=m+1;et<it;){var ht=et++;p.addMulMutate(V[tt],R[q][ht],y[B-m+ht][N-_+tt])}}var at=d-q;at<k?U=at:U=k;for(var ut=0,nt=U+1;ut<nt;){var mt=ut++;T[q][mt]=p.zeros1d(P);for(var K=0,ft=_+1;K<ft;){var Et=K++;p.addMulMutate(T[q][mt],z[mt][Et],V[Et])}}}return T},C.surfacePoint=function(r,s,o){var l=r.knotsU.length-r.degreeU-2,u=r.knotsV.length-r.degreeV-2;return C.surfacePointGivenNM(l,u,r,s,o)},C.surfacePointGivenNM=function(r,s,o,l,u){var d=o.degreeU,m=o.degreeV,_=o.controlPoints,y=o.knotsU,A=o.knotsV;if(!C.areValidRelations(d,_.length,y.length)||!C.areValidRelations(m,_[0].length,A.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var S=_[0][0].length,P=C.knotSpanGivenN(r,d,l,y),E=C.knotSpanGivenN(s,m,u,A),k=C.basisFunctionsGivenKnotSpanIndex(P,l,d,y),T=C.basisFunctionsGivenKnotSpanIndex(E,u,m,A),B=P-d,N=E,R=p.zeros1d(S),z=p.zeros1d(S),V=0,U=m+1;V<U;){var Y=V++;z=p.zeros1d(S),N=E-m+Y;for(var J=0,q=d+1;J<q;){var j=J++;p.addMulMutate(z,k[j],_[B+j][N])}p.addMulMutate(R,T[Y],z)}return R},C.curveRegularSamplePoints=function(r,s){for(var o=C.curveDerivatives(r,r.knots[0],r.degree),l=1/s,u=l*l,d=o[0],m=p.mul(l,o[1]),_=p.mul(u*.5,o[2]),y=p.mul(u*l*.5,o[3]),A=p.add(_,_),S=p.add(y,y),P=p.mul(.3333333333333333,y),E=[],k=0,T=s+1;k<T;)k++,E.push(C.dehomogenize(d)),p.addAllMutate([d,m,_,P]),p.addAllMutate([m,A,y]),p.addAllMutate([A,S]),p.addAllMutate([_,y]);return E},C.curveRegularSamplePoints2=function(r,s){for(var o=C.curveDerivatives(r,r.knots[0],r.degree),l=1/s,u=l*l,d=o[0],m=p.mul(l,o[1]),_=p.mul(u*.5,o[2]),y=p.mul(u*l*.5,o[3]),A=p.add(_,_),S=p.add(y,y),P=p.mul(.3333333333333333,y),E=[],k=0,T=s+1;k<T;)k++,E.push(C.dehomogenize(d)),p.addAllMutate([d,m,_,P]),p.addAllMutate([m,A,y]),p.addAllMutate([A,S]),p.addAllMutate([_,y]);return E},C.rationalSurfaceRegularSampleDerivatives=function(r,s,o,l){for(var u=C.surfaceRegularSampleDerivatives(r,s,o,l),d=[],m=s+1,_=o+1,y=l+1,A=0;A<m;){var S=A++,P=[];d.push(P);for(var E=0;E<_;){for(var k=E++,T=u[S][k],B=C.rational2d(T),N=C.weight2d(T),R=[],z=B[0][0].length,V=0;V<y;){var U=V++;R.push([]);for(var Y=0,J=y-U;Y<J;){for(var q=Y++,j=B[U][q],$=1,tt=q+1;$<tt;){var et=$++;p.subMulMutate(j,Dt.get(q,et)*N[0][et],R[U][q-et])}for(var it=1,ht=U+1;it<ht;){var at=it++;p.subMulMutate(j,Dt.get(U,at)*N[at][0],R[U-at][q]);for(var ut=p.zeros1d(z),nt=1,mt=q+1;nt<mt;){var K=nt++;p.addMulMutate(ut,Dt.get(q,K)*N[at][K],R[U-at][q-K])}p.subMulMutate(j,Dt.get(U,at),ut)}p.mulMutate(1/N[0][0],j),R[U].push(j)}}P.push(R)}}return d},C.surfaceRegularSampleDerivatives=function(r,s,o,l){var u=r.degreeU,d=r.degreeV,m=r.controlPoints,_=r.knotsU,y=r.knotsV,A=m[0][0].length;(Z.last(_)-_[0])/s,(Z.last(y)-y[0])/o;for(var S=C.regularlySpacedDerivativeBasisFunctions(u,_,s),P=S.item0,E=S.item1,k=C.regularlySpacedDerivativeBasisFunctions(d,y,o),T=k.item0,B=k.item1,N=[],R=s+1,z=o+1,V=0;V<R;){var U=V++,Y=[];N.push(Y);for(var J=0;J<z;){var q=J++;Y.push(C.surfaceDerivativesGivenBasesKnotSpans(u,d,m,P[U],T[q],E[U],B[q],A,l))}}return N},C.rationalSurfaceRegularSamplePoints=function(r,s,o){return C.dehomogenize2d(C.surfaceRegularSamplePoints(r,s,o))},C.surfaceRegularSamplePoints=function(r,s,o){var l=r.degreeU,u=r.degreeV,d=r.controlPoints,m=r.knotsU,_=r.knotsV,y=d[0][0].length;(Z.last(m)-m[0])/s,(Z.last(_)-_[0])/o;for(var A=C.regularlySpacedBasisFunctions(l,m,s),S=A.item0,P=A.item1,E=C.regularlySpacedBasisFunctions(u,_,o),k=E.item0,T=E.item1,B=[],N=s+1,R=o+1,z=0;z<N;){var V=z++,U=[];B.push(U);for(var Y=0;Y<R;){var J=Y++;U.push(C.surfacePointGivenBasesKnotSpans(l,u,d,S[V],k[J],P[V],T[J],y))}}return B},C.regularlySpacedBasisFunctions=function(r,s,o){for(var l=s.length-r-2,u=(Z.last(s)-s[0])/o,d=[],m=[],_=s[0],y=C.knotSpanGivenN(l,r,_,s),A=o+1,S=0;S<A;){for(S++;_>=s[y+1];)y++;m.push(y),d.push(C.basisFunctionsGivenKnotSpanIndex(y,_,r,s)),_+=u}return new se(m,d)},C.regularlySpacedDerivativeBasisFunctions=function(r,s,o){for(var l=s.length-r-2,u=(Z.last(s)-s[0])/o,d=[],m=[],_=s[0],y=C.knotSpanGivenN(l,r,_,s),A=o+1,S=0;S<A;){for(S++;_>=s[y+1];)y++;m.push(y),d.push(C.derivativeBasisFunctionsGivenNI(y,_,r,l,s)),_+=u}return new se(m,d)},C.surfacePointGivenBasesKnotSpans=function(r,s,o,l,u,d,m,_){for(var y=p.zeros1d(_),A,S=l-r,P=u-s,E=0,k=s+1;E<k;){var T=E++;A=p.zeros1d(_);for(var B=0,N=r+1;B<N;){var R=B++;p.addMulMutate(A,d[R],o[S+R][P])}P++,p.addMulMutate(y,m[T],A)}return y},C.surfaceDerivativesGivenBasesKnotSpans=function(r,s,o,l,u,d,m,_,y){var A=o[0][0].length,S;y<r?S=y:S=r;var P;y<s?P=y:P=s;for(var E=p.zeros3d(S+1,P+1,A),k=p.zeros2d(s+1,A),T=0,B=0,N=S+1;B<N;){for(var R=B++,z=0,V=s+1;z<V;){var U=z++;k[U]=p.zeros1d(A);for(var Y=0,J=r+1;Y<J;){var q=Y++;p.addMulMutate(k[U],d[R][q],o[l-r+q][u-s+U])}}var j=y-R;j<P?T=j:T=P;for(var $=0,tt=T+1;$<tt;){var et=$++;E[R][et]=p.zeros1d(A);for(var it=0,ht=s+1;it<ht;){var at=it++;p.addMulMutate(E[R][et],m[et][at],k[at])}}}return E},C.curveDerivatives=function(r,s,o){var l=r.knots.length-r.degree-2;return C.curveDerivativesGivenN(l,r,s,o)},C.curveDerivativesGivenN=function(r,s,o,l){var u=s.degree,d=s.controlPoints,m=s.knots;if(!C.areValidRelations(u,d.length,m.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,y;l<u?y=l:y=u;for(var A=p.zeros2d(l+1,_),S=C.knotSpanGivenN(r,u,o,m),P=C.derivativeBasisFunctionsGivenNI(S,o,u,y,m),E=0,k=y+1;E<k;)for(var T=E++,B=0,N=u+1;B<N;){var R=B++;p.addMulMutate(A[T],P[T][R],d[S-u+R])}return A},C.curvePoint=function(r,s){var o=r.knots.length-r.degree-2;return C.curvePointGivenN(o,r,s)},C.areValidRelations=function(r,s,o){return s+r+1-o==0},C.curvePointGivenN=function(r,s,o){var l=s.degree,u=s.controlPoints,d=s.knots;if(!C.areValidRelations(l,u.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var m=C.knotSpanGivenN(r,l,o,d),_=C.basisFunctionsGivenKnotSpanIndex(m,o,l,d),y=p.zeros1d(u[0].length),A=0,S=l+1;A<S;){var P=A++;p.addMulMutate(y,_[P],u[m-l+P])}return y},C.volumePoint=function(r,s,o,l){var u=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,m=r.knotsW.length-r.degreeW-2;return C.volumePointGivenNML(r,u,d,m,s,o,l)},C.volumePointGivenNML=function(r,s,o,l,u,d,m){if(!C.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!C.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!C.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,y=r.degreeU,A=r.degreeV,S=r.degreeW,P=r.knotsU,E=r.knotsV,k=r.knotsW,T=_[0][0][0].length,B=C.knotSpanGivenN(s,y,u,P),N=C.knotSpanGivenN(o,A,d,E),R=C.knotSpanGivenN(l,S,m,k),z=C.basisFunctionsGivenKnotSpanIndex(B,u,y,P),V=C.basisFunctionsGivenKnotSpanIndex(N,d,A,E),U=C.basisFunctionsGivenKnotSpanIndex(R,m,S,k),Y=B-y,J=p.zeros1d(T),q=p.zeros1d(T),j=p.zeros1d(T),$=0,tt=S+1;$<tt;){var et=$++;j=p.zeros1d(T);for(var it=R-S+et,ht=0,at=A+1;ht<at;){var ut=ht++;q=p.zeros1d(T);for(var nt=N-A+ut,mt=0,K=y+1;mt<K;){var ft=mt++;p.addMulMutate(q,z[ft],_[Y+ft][nt][it])}p.addMulMutate(j,V[ut],q)}p.addMulMutate(J,U[et],j)}return J},C.derivativeBasisFunctions=function(r,s,o){var l=C.knotSpan(s,r,o),u=o.length-1,d=u-s-1;return C.derivativeBasisFunctionsGivenNI(l,r,s,d,o)},C.derivativeBasisFunctionsGivenNI=function(r,s,o,l,u){var d=p.zeros2d(o+1,o+1),m=p.zeros1d(o+1),_=p.zeros1d(o+1),y=0,A=0;d[0][0]=1;for(var S=1,P=o+1;S<P;){var E=S++;m[E]=s-u[r+1-E],_[E]=u[r+E]-s,y=0;for(var k=0;k<E;){var T=k++;d[E][T]=_[T+1]+m[E-T],A=d[T][E-1]/d[E][T],d[T][E]=y+_[T+1]*A,y=m[E-T]*A}d[E][E]=y}for(var B=p.zeros2d(l+1,o+1),N=p.zeros2d(2,o+1),R=0,z=1,V=0,U=0,Y=0,J=0,q=0,j=0,$=o+1;j<$;){var tt=j++;B[0][tt]=d[tt][o]}for(var et=0,it=o+1;et<it;){var ht=et++;R=0,z=1,N[0][0]=1;for(var at=1,ut=l+1;at<ut;){var nt=at++;V=0,U=ht-nt,Y=o-nt,ht>=nt&&(N[z][0]=N[R][0]/d[Y+1][U],V=N[z][0]*d[U][Y]),U>=-1?J=1:J=-U,ht-1<=Y?q=nt-1:q=o-ht;for(var mt=J,K=q+1;mt<K;){var ft=mt++;N[z][ft]=(N[R][ft]-N[R][ft-1])/d[Y+1][U+ft],V+=N[z][ft]*d[U+ft][Y]}ht<=Y&&(N[z][nt]=-N[R][nt-1]/d[Y+1][ht],V+=N[z][nt]*d[ht][Y]),B[nt][ht]=V;var Et=R;R=z,z=Et}}for(var Ht=o,$t=1,Ut=l+1;$t<Ut;){for(var Qt=$t++,Te=0,Ke=o+1;Te<Ke;){var we=Te++;B[Qt][we]*=Ht}Ht*=o-Qt}return B},C.basisFunctions=function(r,s,o){var l=C.knotSpan(s,r,o);return C.basisFunctionsGivenKnotSpanIndex(l,r,s,o)},C.basisFunctionsGivenKnotSpanIndex=function(r,s,o,l){var u=p.zeros1d(o+1),d=p.zeros1d(o+1),m=p.zeros1d(o+1),_=0,y=0;u[0]=1;for(var A=1,S=o+1;A<S;){var P=A++;d[P]=s-l[r+1-P],m[P]=l[r+P]-s,_=0;for(var E=0;E<P;){var k=E++;y=u[k]/(m[k+1]+d[P-k]),u[k]=_+m[k+1]*y,_=d[P-k]*y}u[P]=_}return u},C.knotSpan=function(r,s,o){return C.knotSpanGivenN(o.length-r-2,r,s,o)},C.knotSpanGivenN=function(r,s,o,l){if(o>l[r+1]-rt.EPSILON)return r;if(o<l[s]+rt.EPSILON)return s;for(var u=s,d=r+1,m=Math.floor((u+d)/2);o<l[m]||o>=l[m+1];)o<l[m]?d=m:u=m,m=Math.floor((u+d)/2);return m},C.dehomogenize=function(r){for(var s=r.length,o=[],l=r[s-1],u=r.length-1,d=0;d<u;){var m=d++;o.push(r[m]/l)}return o},C.rational1d=function(r){var s=r[0].length-1;return r.map(function(o){return o.slice(0,s)})},C.rational2d=function(r){return r.map(C.rational1d)},C.weight1d=function(r){var s=r[0].length-1;return r.map(function(o){return o[s]})},C.weight2d=function(r){return r.map(C.weight1d)},C.dehomogenize1d=function(r){return r.map(C.dehomogenize)},C.dehomogenize2d=function(r){return r.map(C.dehomogenize1d)},C.homogenize1d=function(r,s){var o=r.length,l=r[0].length,u=[],d=0,m=[],_;s!=null?_=s:_=p.rep(r.length,1);for(var y=0;y<o;){var A=y++,S=[];m=r[A],d=_[A];for(var P=0;P<l;){var E=P++;S.push(m[E]*d)}S.push(d),u.push(S)}return u},C.homogenize2d=function(r,s){var o=r.length,l=[],u;if(s!=null)u=s;else{for(var d=[],m=0;m<o;)m++,d.push(p.rep(r[0].length,1));u=d}for(var _=0;_<o;){var y=_++;l.push(C.homogenize1d(r[y],u[y]))}return l};var lt=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=lt,lt.__name__=["verb","eval","Intersect"],lt.surfaces=function(r,s,o){var l=zt.rationalSurfaceAdaptive(r),u=zt.rationalSurfaceAdaptive(s),d=lt.meshes(l,u),m=d.map(function(_){return _.map(function(y){return lt.surfacesAtPointWithEstimate(r,s,y.uv0,y.uv1,o)})});return m.map(function(_){return gt.rationalInterpCurve(_.map(function(y){return y.point}),3)})},lt.surfacesAtPointWithEstimate=function(r,s,o,l,u){var d,m,_,y,A,S,P,E,k,T,B,N,R,z=5,V=0;do{if(d=C.rationalSurfaceDerivatives(r,o[0],o[1],1),m=d[0][0],y=d[1][0],A=d[0][1],_=p.normalized(p.cross(y,A)),S=p.dot(_,m),P=C.rationalSurfaceDerivatives(s,l[0],l[1],1),E=P[0][0],T=P[1][0],B=P[0][1],k=p.normalized(p.cross(T,B)),N=p.dot(k,E),R=p.distSquared(m,E),R<u*u)break;var U=p.normalized(p.cross(_,k)),Y=p.dot(U,m),J=lt.threePlanes(_,S,k,N,U,Y);if(J==null)throw new Q("panic!");var q=p.sub(J,m),j=p.sub(J,E),$=p.cross(y,_),tt=p.cross(A,_),et=p.cross(T,k),it=p.cross(B,k),ht=p.dot(tt,q)/p.dot(tt,y),at=p.dot($,q)/p.dot($,A),ut=p.dot(it,j)/p.dot(it,T),nt=p.dot(et,j)/p.dot(et,B);o=p.add([ht,at],o),l=p.add([ut,nt],l),V++}while(V<z);return new es(o,l,m,R)},lt.meshes=function(r,s,o,l){o==null&&(o=new hr(r)),l==null&&(l=new hr(s));var u=lt.boundingBoxTrees(o,l,0),d=Z.unique(u.map(function(m){return lt.triangles(r,m.item0,s,m.item1)}).filter(function(m){return m!=null}).filter(function(m){return p.distSquared(m.min.point,m.max.point)>rt.EPSILON}),function(m,_){var y=p.sub(m.min.uv0,_.min.uv0),A=p.dot(y,y),S=p.sub(m.max.uv0,_.max.uv0),P=p.dot(S,S),E=p.sub(m.min.uv0,_.max.uv0),k=p.dot(E,E),T=p.sub(m.max.uv0,_.min.uv0),B=p.dot(T,T);return A<rt.EPSILON&&P<rt.EPSILON||k<rt.EPSILON&&B<rt.EPSILON});return lt.makeMeshIntersectionPolylines(d)},lt.meshSlices=function(r,s,o,l){for(var u=new Vr(r),d=u.boundingBox(),m=d.min[0],_=d.min[1],y=d.max[0],A=d.max[1],S=p.span(s,o,l),P=[],E=0;E<S.length;){var k=S[E];++E;var T=[[m,_,k],[y,_,k],[y,A,k],[m,A,k]],B=[[0,0],[1,0],[1,1],[0,1]],N=[[0,1,2],[0,2,3]],R=new $e(N,T,null,B);P.push(lt.meshes(r,R,u))}return P},lt.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var s=0;s<r.length;){var o=r[s];++s,o.max.opp=o.min,o.min.opp=o.max}for(var l=lt.kdTreeFromSegments(r),u=[],d=0;d<r.length;){var m=r[d];++d,u.push(m.min),u.push(m.max)}for(var _=0;_<u.length;){var y=u[_];if(++_,y.adj==null){var A=lt.lookupAdjacentSegment(y,l,r.length);A!=null&&A.adj==null&&(y.adj=A,A.adj=y)}}var S=u.filter(function(z){return z.adj==null});S.length==0&&(S=u);for(var P=[],E=0,k=!1;S.length!=0;){var T=S.pop();if(!T.visited){for(var B=[],N=T;N!=null&&!(N.visited||(N.visited=!0,N.opp.visited=!0,B.push(N),E+=2,N=N.opp.adj,N==T)););B.length>0&&(B.push(B[B.length-1].opp),P.push(B))}if(S.length==0&&u.length>0&&(k||E<u.length)){k=!0;var R=u.pop();S.push(R)}}return P},lt.kdTreeFromSegments=function(r){for(var s=[],o=0;o<r.length;){var l=r[o];++o,s.push(new Mn(l.min.point,l.min)),s.push(new Mn(l.max.point,l.max))}return new ns(s,p.distSquared)},lt.lookupAdjacentSegment=function(r,s,o){var l=s.nearest(r.point,o,rt.EPSILON).filter(function(u){return r!=u.item0.obj}).map(function(u){return u.item0.obj});return l.length==1?l[0]:null},lt.curveAndSurface=function(r,s,o,l,u){o==null&&(o=.001),l!=null?l=l:l=new lr(r),u!=null?u=u:u=new Fr(s);var d=lt.boundingBoxTrees(l,u,o);return Z.unique(d.map(function(m){var _=m.item0,y=m.item1,A=Z.first(_.knots),S=Z.last(_.knots),P=(A+S)/2,E=Z.first(y.knotsU),k=Z.last(y.knotsU),T=Z.first(y.knotsV),B=Z.last(y.knotsV),N=[(E+k)/2,(T+B)/2];return lt.curveAndSurfaceWithEstimate(_,y,[P].concat(N),o)}).filter(function(m){return p.distSquared(m.curvePoint,m.surfacePoint)<o*o}),function(m,_){return Math.abs(m.u-_.u)<.5*o})},lt.curveAndSurfaceWithEstimate=function(r,s,o,l){l==null&&(l=.001);var u=function(y){var A=C.rationalCurvePoint(r,y[0]),S=C.rationalSurfacePoint(s,y[1],y[2]),P=p.sub(A,S);return p.dot(P,P)},d=function(y){var A=C.rationalCurveDerivatives(r,y[0],1),S=C.rationalSurfaceDerivatives(s,y[1],y[2],1),P=p.sub(S[0][0],A[0]),E=p.mul(-1,A[1]),k=S[1][0],T=S[0][1];return[2*p.dot(E,P),2*p.dot(k,P),2*p.dot(T,P)]},m=Ze.uncmin(u,o,l*l,d),_=m.solution;return new Jn(_[0],[_[1],_[2]],C.rationalCurvePoint(r,_[0]),C.rationalSurfacePoint(s,_[1],_[2]))},lt.polylineAndMesh=function(r,s,o){for(var l=lt.boundingBoxTrees(new cr(r),new hr(s),o),u=[],d=0;d<l.length;){var m=l[d];++d;var _=m.item0,y=m.item1,A=lt.segmentWithTriangle(r.points[_],r.points[_+1],s.points,s.faces[y]);if(A!=null){var S=A.point,P=p.lerp(A.p,[r.params[_]],[r.params[_+1]])[0],E=ie.triangleUVFromPoint(s,y,S);u.push(new ts(S,P,E,_,y))}}return u},lt.boundingBoxTrees=function(r,s,o){o==null&&(o=1e-9);var l=[],u=[];l.push(r),u.push(s);for(var d=[];l.length>0;){var m=l.pop(),_=u.pop();if(!(m.empty()||_.empty())&&m.boundingBox().intersects(_.boundingBox(),o)){var y=m.indivisible(o),A=_.indivisible(o);if(y&&A){d.push(new se(m.yield(),_.yield()));continue}else if(y&&!A){var S=_.split();l.push(m),u.push(S.item1),l.push(m),u.push(S.item0);continue}else if(!y&&A){var P=m.split();l.push(P.item1),u.push(_),l.push(P.item0),u.push(_);continue}var E=m.split(),k=_.split();l.push(E.item1),u.push(k.item1),l.push(E.item1),u.push(k.item0),l.push(E.item0),u.push(k.item1),l.push(E.item0),u.push(k.item0)}}return d},lt.curves=function(r,s,o){var l=lt.boundingBoxTrees(new lr(r),new lr(s),0);return Z.unique(l.map(function(u){return lt.curvesWithEstimate(r,s,Z.first(u.item0.knots),Z.first(u.item1.knots),o)}).filter(function(u){return p.distSquared(u.point0,u.point1)<o}),function(u,d){return Math.abs(u.u0-d.u0)<o*5})},lt.curvesWithEstimate=function(r,s,o,l,u){var d=function(E){var k=C.rationalCurvePoint(r,E[0]),T=C.rationalCurvePoint(s,E[1]),B=p.sub(k,T);return p.dot(B,B)},m=function(E){var k=C.rationalCurveDerivatives(r,E[0],1),T=C.rationalCurveDerivatives(s,E[1],1),B=p.sub(k[0],T[0]),N=k[1],R=p.mul(-1,T[1]);return[2*p.dot(N,B),2*p.dot(R,B)]},_=Ze.uncmin(d,[o,l],u*u,m),y=_.solution[0],A=_.solution[1],S=C.rationalCurvePoint(r,y),P=C.rationalCurvePoint(s,A);return new tn(S,P,y,A)},lt.triangles=function(r,s,o,l){var u=r.faces[s],d=o.faces[l],m=ie.getTriangleNorm(r.points,u),_=ie.getTriangleNorm(o.points,d),y=r.points[u[0]],A=o.points[d[0]],S=lt.planes(y,m,A,_);if(S==null)return null;var P=lt.clipRayInCoplanarTriangle(S,r,s);if(P==null)return null;var E=lt.clipRayInCoplanarTriangle(S,o,l);if(E==null)return null;var k=lt.mergeTriangleClipIntervals(P,E,r,s,o,l);return k==null?null:new ke(new Dr(k.min.uv0,k.min.uv1,k.min.point,s,l),new Dr(k.max.uv0,k.max.uv1,k.max.point,s,l))},lt.clipRayInCoplanarTriangle=function(r,s,o){for(var l=s.faces[o],u=[s.points[l[0]],s.points[l[1]],s.points[l[2]]],d=[s.uvs[l[0]],s.uvs[l[1]],s.uvs[l[2]]],m=[p.sub(d[1],d[0]),p.sub(d[2],d[1]),p.sub(d[0],d[2])],_=[p.sub(u[1],u[0]),p.sub(u[2],u[1]),p.sub(u[0],u[2])],y=_.map(p.normalized),A=_.map(p.norm),S=null,P=null,E=0;E<3;){var k=E++,T=u[k],B=y[k],N=lt.rays(T,B,r.origin,r.dir);if(N!=null){var R=N.u0,z=N.u1;R<-rt.EPSILON||R>A[k]+rt.EPSILON||((S==null||z<S.u)&&(S=new En(z,p.onRay(r.origin,r.dir,z),p.onRay(d[k],m[k],R/A[k]))),(P==null||z>P.u)&&(P=new En(z,p.onRay(r.origin,r.dir,z),p.onRay(d[k],m[k],R/A[k]))))}}return P==null||S==null?null:new ke(S,P)},lt.mergeTriangleClipIntervals=function(r,s,o,l,u,d){if(s.min.u>r.max.u+rt.EPSILON||r.min.u>s.max.u+rt.EPSILON)return null;var m;r.min.u>s.min.u?m=new se(r.min,0):m=new se(s.min,1);var _;r.max.u<s.max.u?_=new se(r.max,0):_=new se(s.max,1);var y=new ke(new Dr(null,null,m.item0.point,l,d),new Dr(null,null,_.item0.point,l,d));return m.item1==0?(y.min.uv0=m.item0.uv,y.min.uv1=ie.triangleUVFromPoint(u,d,m.item0.point)):(y.min.uv0=ie.triangleUVFromPoint(o,l,m.item0.point),y.min.uv1=m.item0.uv),_.item1==0?(y.max.uv0=_.item0.uv,y.max.uv1=ie.triangleUVFromPoint(u,d,_.item0.point)):(y.max.uv0=ie.triangleUVFromPoint(o,l,_.item0.point),y.max.uv1=_.item0.uv),y},lt.planes=function(r,s,o,l){var u=p.cross(s,l);if(p.dot(u,u)<rt.EPSILON)return null;var d=0,m=Math.abs(u[0]),_=Math.abs(u[1]),y=Math.abs(u[2]);_>m&&(d=1,m=_),y>m&&(d=2,m=y);var A,S,P,E;d==0?(A=s[1],S=s[2],P=l[1],E=l[2]):d==1?(A=s[0],S=s[2],P=l[0],E=l[2]):(A=s[0],S=s[1],P=l[0],E=l[1]);var k=-p.dot(r,s),T=-p.dot(o,l),B=A*E-S*P,N=(S*T-k*E)/B,R=(k*P-A*T)/B,z;return d==0?z=[0,N,R]:d==1?z=[N,0,R]:z=[N,R,0],new In(z,p.normalized(u))},lt.threePlanes=function(r,s,o,l,u,d){var m=p.cross(o,u),_=p.dot(r,m);if(Math.abs(_)<rt.EPSILON)return null;var y=p.sub(p.mul(d,o),p.mul(l,u)),A=p.add(p.mul(s,m),p.cross(r,y));return p.mul(1/_,A)},lt.polylines=function(r,s,o){for(var l=lt.boundingBoxTrees(new cr(r),new cr(s),o),u=[],d=0;d<l.length;){var m=l[d];++d;var _=m.item0,y=m.item1,A=lt.segments(r.points[_],r.points[_+1],s.points[y],s.points[y+1],o);A!=null&&(A.u0=p.lerp(A.u0,[r.params[_]],[r.params[_+1]])[0],A.u1=p.lerp(A.u1,[s.params[y]],[s.params[y+1]])[0],u.push(A))}return u},lt.segments=function(r,s,o,l,u){var d=p.sub(s,r),m=Math.sqrt(p.dot(d,d)),_=p.mul(1/m,d),y=p.sub(l,o),A=Math.sqrt(p.dot(y,y)),S=p.mul(1/A,y),P=lt.rays(r,_,o,S);if(P!=null){var E=Math.min(Math.max(0,P.u0/m),1),k=Math.min(Math.max(0,P.u1/A),1),T=p.onRay(r,d,E),B=p.onRay(o,y,k),N=p.distSquared(T,B);if(N<u*u)return new tn(T,B,E,k)}return null},lt.rays=function(r,s,o,l){var u=p.dot(s,l),d=p.dot(s,o),m=p.dot(s,r),_=p.dot(l,o),y=p.dot(l,r),A=p.dot(s,s),S=p.dot(l,l),P=A*S-u*u;if(Math.abs(P)<rt.EPSILON)return null;var E=u*(d-m)-A*(_-y),k=E/P,T=(d-m+k*u)/A,B=p.onRay(r,s,T),N=p.onRay(o,l,k);return new tn(B,N,T,k)},lt.segmentWithTriangle=function(r,s,o,l){var u=o[l[0]],d=o[l[1]],m=o[l[2]],_=p.sub(d,u),y=p.sub(m,u),A=p.cross(_,y),S=p.sub(s,r),P=p.sub(r,u),E=-p.dot(A,P),k=p.dot(A,S);if(Math.abs(k)<rt.EPSILON)return null;var T=E/k;if(T<0||T>1)return null;var B=p.add(r,p.mul(T,S)),N=p.dot(_,y),R=p.dot(_,_),z=p.dot(y,y),V=p.sub(B,u),U=p.dot(V,_),Y=p.dot(V,y),J=N*N-R*z;if(Math.abs(J)<rt.EPSILON)return null;var q=(N*Y-z*U)/J,j=(N*U-R*Y)/J;return q>1+rt.EPSILON||j>1+rt.EPSILON||j<-rt.EPSILON||q<-rt.EPSILON||q+j>1+rt.EPSILON?null:new rs(B,q,j,T)},lt.segmentAndPlane=function(r,s,o,l){var u=p.dot(l,p.sub(s,r));if(Math.abs(u)<rt.EPSILON)return null;var d=p.dot(l,p.sub(o,r)),m=d/u;return m>1+rt.EPSILON||m<-rt.EPSILON?null:{p:m}};var gt=f.eval.Make=function(){};x["verb.eval.Make"]=gt,gt.__name__=["verb","eval","Make"],gt.rationalTranslationalSurface=function(r,s){for(var o=C.rationalCurvePoint(s,Z.first(s.knots)),l=Z.first(s.knots),u=Z.last(s.knots),d=2*s.controlPoints.length,m=(u-l)/(d-1),_=[],y=0;y<d;){var A=y++,S=p.sub(C.rationalCurvePoint(s,l+A*m),o),P=_t.rationalCurveTransform(r,[[1,0,0,S[0]],[0,1,0,S[1]],[0,0,1,S[2]],[0,0,0,1]]);_.push(P)}return gt.loftedSurface(_)},gt.surfaceBoundaryCurves=function(r){var s=gt.surfaceIsocurve(r,Z.first(r.knotsU),!1),o=gt.surfaceIsocurve(r,Z.last(r.knotsU),!1),l=gt.surfaceIsocurve(r,Z.first(r.knotsV),!0),u=gt.surfaceIsocurve(r,Z.last(r.knotsV),!0);return[s,o,l,u]},gt.surfaceIsocurve=function(r,s,o){o==null&&(o=!1);var l;o?l=r.knotsV:l=r.knotsU;var u;o?u=r.degreeV:u=r.degreeU;for(var d=bt.knotMultiplicities(l),m=-1,_=0,y=d.length;_<y;){var A=_++;if(Math.abs(s-d[A].knot)<rt.EPSILON){m=A;break}}var S=u+1;m>=0&&(S=S-d[m].mult);var P;S>0?P=_t.surfaceKnotRefine(r,p.rep(S,s),o):P=r;var E=C.knotSpan(u,s,l);return Math.abs(s-Z.first(l))<rt.EPSILON?E=0:Math.abs(s-Z.last(l))<rt.EPSILON&&(E=(o?P.controlPoints[0].length:P.controlPoints.length)-1),o?new Wt(P.degreeU,P.knotsU,function(k){for(var T,B=[],N=0,R=P.controlPoints;N<R.length;){var z=R[N];++N,B.push(z[E])}return T=B,T}()):new Wt(P.degreeV,P.knotsV,P.controlPoints[E])},gt.loftedSurface=function(r,s){r=_t.unifyCurveKnotVectors(r);var o=r[0].degree;s==null&&(s=3),s>r.length-1&&(s=r.length-1);for(var l=r[0].knots,u=[],d=[],m=0,_=r[0].controlPoints.length;m<_;){var y=[m++],A=r.map(function(P){return function(E){return E.controlPoints[P[0]]}}(y)),S=gt.rationalInterpCurve(A,s,!0);d.push(S.controlPoints),u=S.knots}return new ne(o,s,l,u,d)},gt.clonedCurve=function(r){return new Wt(r.degree,r.knots.slice(),r.controlPoints.map(function(s){return s.slice()}))},gt.rationalBezierCurve=function(r,s){for(var o=r.length-1,l=[],u=0,d=o+1;u<d;)u++,l.push(0);for(var m=0,_=o+1;m<_;)m++,l.push(1);return s==null&&(s=p.rep(r.length,1)),new Wt(o,l,C.homogenize1d(r,s))},gt.fourPointSurface=function(r,s,o,l,u){u==null&&(u=3);for(var d=u,m=[],_=0,y=u+1;_<y;){for(var A=_++,S=[],P=0,E=u+1;P<E;){var k=P++,T=1-A/d,B=p.lerp(T,r,s),N=p.lerp(T,l,o),R=p.lerp(1-k/d,B,N);R.push(1),S.push(R)}m.push(S)}var z=p.rep(u+1,0),V=p.rep(u+1,1);return new ne(u,u,z.concat(V),z.concat(V),m)},gt.ellipseArc=function(r,s,o,l,u){var d=p.norm(s),m=p.norm(o);s=p.normalized(s),o=p.normalized(o),u<l&&(u=2*Math.PI+l);var _=u-l,y=0;_<=Math.PI/2?y=1:_<=Math.PI?y=2:_<=3*Math.PI/2?y=3:y=4;var A=_/y,S=Math.cos(A/2),P=p.add(r,p.add(p.mul(d*Math.cos(l),s),p.mul(m*Math.sin(l),o))),E=p.sub(p.mul(Math.cos(l),o),p.mul(Math.sin(l),s)),k=[],T=p.zeros1d(2*y+3),B=0,N=l,R=p.zeros1d(y*2);k[0]=P,R[0]=1;for(var z=1,V=y+1;z<V;){var U=z++;N+=A;var Y=p.add(r,p.add(p.mul(d*Math.cos(N),s),p.mul(m*Math.sin(N),o)));R[B+2]=1,k[B+2]=Y;var J=p.sub(p.mul(Math.cos(N),o),p.mul(Math.sin(N),s)),q=lt.rays(P,p.mul(1/p.norm(E),E),Y,p.mul(1/p.norm(J),J)),j=p.add(P,p.mul(q.u0,E));R[B+1]=S,k[B+1]=j,B+=2,U<y&&(P=Y,E=J)}for(var $=2*y+1,tt=0;tt<3;){var et=tt++;T[et]=0,T[et+$]=1}switch(y){case 2:T[3]=T[4]=.5;break;case 3:T[3]=T[4]=.3333333333333333,T[5]=T[6]=.6666666666666666;break;case 4:T[3]=T[4]=.25,T[5]=T[6]=.5,T[7]=T[8]=.75;break}return new Wt(2,T,C.homogenize1d(k,R))},gt.arc=function(r,s,o,l,u,d){return gt.ellipseArc(r,p.mul(l,p.normalized(s)),p.mul(l,p.normalized(o)),u,d)},gt.polyline=function(r){for(var s=[0,0],o=0,l=0,u=r.length-1;l<u;){var d=l++;o+=p.dist(r[d],r[d+1]),s.push(o)}s.push(o),s=p.mul(1/o,s);for(var m,_=[],y=0,A=r.length;y<A;)y++,_.push(1);return m=_,new Wt(1,s,C.homogenize1d(r.slice(0),m))},gt.extrudedSurface=function(r,s,o){for(var l=[[],[],[]],u=[[],[],[]],d=C.dehomogenize1d(o.controlPoints),m=C.weight1d(o.controlPoints),_=p.mul(s,r),y=p.mul(.5*s,r),A=0,S=d.length;A<S;){var P=A++;l[2][P]=d[P],l[1][P]=p.add(y,d[P]),l[0][P]=p.add(_,d[P]),u[0][P]=m[P],u[1][P]=m[P],u[2][P]=m[P]}return new ne(2,o.degree,[0,0,0,1,1,1],o.knots,C.homogenize2d(l,u))},gt.cylindricalSurface=function(r,s,o,l,u){var d=p.cross(r,s),m=gt.arc(o,s,d,u,0,2*Math.PI);return gt.extrudedSurface(r,l,m)},gt.revolvedSurface=function(r,s,o,l){var u=C.dehomogenize1d(r.controlPoints),d=C.weight1d(r.controlPoints),m,_;l<=Math.PI/2?(m=1,_=p.zeros1d(6+2*(m-1))):l<=Math.PI?(m=2,_=p.zeros1d(6+2*(m-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(m=3,_=p.zeros1d(6+2*(m-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(m=4,_=p.zeros1d(6+2*(m-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var y=l/m,A=3+2*(m-1),S=0;S<3;){var P=S++;_[P]=0,_[A+P]=1}for(var E=Math.cos(y/2),k=0,T=p.zeros1d(m+1),B=p.zeros1d(m+1),N=p.zeros3d(2*m+1,u.length,3),R=p.zeros2d(2*m+1,u.length),z=1,V=m+1;z<V;){var U=z++;k+=y,B[U]=Math.cos(k),T[U]=Math.sin(k)}for(var Y=0,J=u.length;Y<J;){var q=Y++,j=Be.rayClosestPoint(u[q],s,o),$=p.sub(u[q],j),tt=p.norm($),et=p.cross(o,$);tt>rt.EPSILON&&($=p.mul(1/tt,$),et=p.mul(1/tt,et)),N[0][q]=u[q];var it=u[q];R[0][q]=d[q];for(var ht=et,at=0,ut=1,nt=m+1;ut<nt;){var mt=ut++,K;tt==0?K=j:K=p.add(j,p.add(p.mul(tt*B[mt],$),p.mul(tt*T[mt],et))),N[at+2][q]=K,R[at+2][q]=d[q];var ft=p.sub(p.mul(B[mt],et),p.mul(T[mt],$));if(tt==0)N[at+1][q]=j;else{var Et=lt.rays(it,p.mul(1/p.norm(ht),ht),K,p.mul(1/p.norm(ft),ft)),Ht=p.add(it,p.mul(Et.u0,ht));N[at+1][q]=Ht}R[at+1][q]=E*d[q],at+=2,mt<m&&(it=K,ht=ft)}}return new ne(2,r.degree,_,r.knots,C.homogenize2d(N,R))},gt.sphericalSurface=function(r,s,o,l){var u=gt.arc(r,p.mul(-1,s),o,l,0,Math.PI);return gt.revolvedSurface(u,r,s,2*Math.PI)},gt.conicalSurface=function(r,s,o,l,u){var d=2*Math.PI,m=1,_=[p.add(o,p.mul(l,r)),p.add(o,p.mul(u,s))],y=[0,0,1,1],A=[1,1],S=new Wt(m,y,C.homogenize1d(_,A));return gt.revolvedSurface(S,o,r,d)},gt.rationalInterpCurve=function(r,s,o,l,u){if(o==null&&(o=!1),s==null&&(s=3),r.length<s+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],m=1,_=r.length;m<_;){var y=m++,A=p.norm(p.sub(r[y],r[y-1])),S=d[d.length-1];d.push(S+A)}for(var P=d[d.length-1],E=0,k=d.length;E<k;){var T=E++;d[T]=d[T]/P}var B=p.rep(s+1,0),N=l!=null&&u!=null,R;N?R=0:R=1;var z;N?z=d.length-s+1:z=d.length-s;for(var V=R;V<z;){for(var U=V++,Y=0,J=0;J<s;){var q=J++;Y+=d[U+q]}B.push(1/s*Y)}var j=B.concat(p.rep(s+1,1)),$=[],tt;N?tt=r.length+1:tt=r.length-1;var et;N?et=r.length-(s-1):et=r.length-(s+1);for(var it=0;it<d.length;){var ht=d[it];++it;var at=C.knotSpanGivenN(tt,s,ht,j),ut=C.basisFunctionsGivenKnotSpanIndex(at,ht,s,j),nt=at-s,mt=p.zeros1d(nt),K=p.zeros1d(et-nt);$.push(mt.concat(ut).concat(K))}if(N){var ft=$[0].length-2,Et=[-1,1].concat(p.zeros1d(ft)),Ht=p.zeros1d(ft).concat([-1,1]);Z.spliceAndInsert($,1,0,Et),Z.spliceAndInsert($,$.length-1,0,Ht)}for(var $t=r[0].length,Ut=[],Qt=(1-j[j.length-s-2])/s,Te=j[s+1]/s,Ke=0;Ke<$t;){var we=[Ke++],ye;if(!N)ye=r.map(function(rr){return function(_r){return _r[rr[0]]}}(we));else{ye=[r[0][we[0]]],ye.push(Te*l[we[0]]);for(var Ce=1,Re=r.length-1;Ce<Re;){var Je=Ce++;ye.push(r[Je][we[0]])}ye.push(Qt*u[we[0]]),ye.push(Z.last(r)[we[0]])}var ur=Ot.solve($,ye);Ut.push(ur)}var tr=Ot.transpose(Ut);if(!o){var er=p.rep(tr.length,1);tr=C.homogenize1d(tr,er)}return new Wt(s,j,tr)};var _t=f.eval.Modify=function(){};x["verb.eval.Modify"]=_t,_t.__name__=["verb","eval","Modify"],_t.curveReverse=function(r){return new Wt(r.degree,_t.knotsReverse(r.knots),Z.reversed(r.controlPoints))},_t.surfaceReverse=function(r,s){return s==null&&(s=!1),s?new ne(r.degreeU,r.degreeV,r.knotsU,_t.knotsReverse(r.knotsV),function(o){for(var l,u=[],d=0,m=r.controlPoints;d<m.length;){var _=m[d];++d,u.push(Z.reversed(_))}return l=u,l}()):new ne(r.degreeU,r.degreeV,_t.knotsReverse(r.knotsU),r.knotsV,Z.reversed(r.controlPoints))},_t.knotsReverse=function(r){var s=Z.first(r);Z.last(r);for(var o=[s],l=r.length,u=1;u<l;){var d=u++;o.push(o[d-1]+(r[l-d]-r[l-d-1]))}return o},_t.unifyCurveKnotVectors=function(r){r=r.map(gt.clonedCurve);for(var s=O.fold(r,function(j,$){return _t.imax(j.degree,$)},0),o=0,l=r.length;o<l;){var u=o++;r[u].degree<s&&(r[u]=_t.curveElevateDegree(r[u],s))}for(var d,m=[],_=0;_<r.length;){var y=r[_];++_,m.push(new ke(Z.first(y.knots),Z.last(y.knots)))}d=m;for(var A=0,S=r.length;A<S;){var P=A++,E=[d[P].min];r[P].knots=r[P].knots.map(function(j){return function($){return $-j[0]}}(E))}for(var k=d.map(function(j){return j.max-j.min}),T=O.fold(k,function(j,$){return Math.max(j,$)},0),B=0,N=r.length;B<N;){var R=B++,z=[T/k[R]];r[R].knots=r[R].knots.map(function(j){return function($){return $*j[0]}}(z))}for(var V=O.fold(r,function(j,$){return p.sortedSetUnion(j.knots,$)},[]),U=0,Y=r.length;U<Y;){var J=U++,q=p.sortedSetSub(V,r[J].knots);q.length==0&&(r[J]=r[J]),r[J]=_t.curveKnotRefine(r[J],q)}return r},_t.imin=function(r,s){return r<s?r:s},_t.imax=function(r,s){return r>s?r:s},_t.curveElevateDegree=function(r,s){if(s<=r.degree)return r;var o=r.knots.length-r.degree-2,l=r.degree,u=r.knots,d=r.controlPoints,m=s-r.degree,_=r.controlPoints[0].length,y=p.zeros2d(l+m+1,l+1),A=[],S=[],P=[],E=o+l+1,k=s,T=Math.floor(k/2),B=[],N=[];y[0][0]=1,y[k][l]=1;for(var R=1,z=T+1;R<z;)for(var V=R++,U=1/Dt.get(k,V),Y=_t.imin(l,V),J=_t.imax(0,V-m),q=Y+1;J<q;){var j=J++;y[V][j]=U*Dt.get(l,j)*Dt.get(m,V-j)}for(var $=T+1;$<k;)for(var tt=$++,et=_t.imin(l,tt),it=_t.imax(0,tt-m),ht=et+1;it<ht;){var at=it++;y[tt][at]=y[k-tt][l-at]}var ut=k+1,nt=-1,mt=l,K=l+1,ft=1,Et=u[0];B[0]=d[0];for(var Ht=0,$t=k+1;Ht<$t;){var Ut=Ht++;N[Ut]=Et}for(var Qt=0,Te=l+1;Qt<Te;){var Ke=Qt++;A[Ke]=d[Ke]}for(;K<E;){for(var we=K;K<E&&u[K]==u[K+1];)K=K+1;var ye=K-we+1,Ce=u[K],Re=nt;nt=l-ye;var Je;Re>0?Je=Math.floor((Re+2)/2):Je=1;var ur;if(nt>0?ur=Math.floor(k-(nt+1)/2):ur=k,nt>0){for(var tr=Ce-Et,er=[],rr=l;rr>ye;)er[rr-ye-1]=tr/(u[mt+rr]-Et),rr--;for(var _r=1,Bn=nt+1;_r<Bn;){for(var rn=_r++,ou=nt-rn,ea=ye+rn,nn=l;nn>=ea;)A[nn]=p.add(p.mul(er[nn-ea],A[nn]),p.mul(1-er[nn-ea],A[nn-1])),nn--;P[ou]=A[l]}}for(var Go=Je,lu=k+1;Go<lu;){var zn=Go++;S[zn]=p.zeros1d(_);for(var hu=_t.imin(l,zn),Wo=_t.imax(0,zn-m),cu=hu+1;Wo<cu;){var Ho=Wo++;S[zn]=p.add(S[zn],p.mul(y[zn][Ho],A[Ho]))}}if(Re>1)for(var ra=ut-2,na=ut,qo=Ce-Et,uu=(Ce-N[ut-1])/qo,Yo=1;Yo<Re;){for(var sa=Yo++,yr=ra,sn=na,qr=sn-ut+1;sn-yr>sa;){if(yr<ft){var du=(Ce-N[yr])/(Et-N[yr]);B[yr]=p.lerp(du,B[yr],B[yr-1])}if(sn>=Je){if(sn-sa<=ut-k+Re){var pu=(Ce-N[sn-sa])/qo;S[qr]=p.lerp(pu,S[qr],S[qr+1])}}else S[qr]=p.lerp(uu,S[qr],S[qr+1]);yr=yr+1,sn=sn-1,qr=qr-1}ra=ra-1,na=na+1}if(mt!=l)for(var Xo=0,mu=k-Re;Xo<mu;)Xo++,N[ut]=Et,ut=ut+1;for(var Ko=Je,gu=ur+1;Ko<gu;){var fu=Ko++;B[ft]=S[fu],ft=ft+1}if(K<E){for(var $o=0;$o<nt;){var Zo=$o++;A[Zo]=P[Zo]}for(var Qo=nt,_u=l+1;Qo<_u;){var Jo=Qo++;A[Jo]=d[K-l+Jo]}mt=K,K=K+1,Et=Ce}else for(var tl=0,yu=k+1;tl<yu;){var vu=tl++;N[ut+vu]=Ce}}return new Wt(s,N,B)},_t.rationalSurfaceTransform=function(r,s){for(var o=C.dehomogenize2d(r.controlPoints),l=0,u=o.length;l<u;)for(var d=l++,m=0,_=o[d].length;m<_;){var y=m++,A=o[d][y];A.push(1),o[d][y]=Ot.dot(s,A).slice(0,A.length-1)}return new ne(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),C.homogenize2d(o,C.weight2d(r.controlPoints)))},_t.rationalCurveTransform=function(r,s){for(var o=C.dehomogenize1d(r.controlPoints),l=0,u=o.length;l<u;){var d=l++,m=o[d];m.push(1),o[d]=Ot.dot(s,m).slice(0,m.length-1)}return new Wt(r.degree,r.knots.slice(),C.homogenize1d(o,C.weight1d(r.controlPoints)))},_t.surfaceKnotRefine=function(r,s,o){var l=[],u,d,m;o?(m=r.controlPoints,u=r.knotsV,d=r.degreeV):(m=Ot.transpose(r.controlPoints),u=r.knotsU,d=r.degreeU);for(var _=null,y=0;y<m.length;){var A=m[y];++y,_=_t.curveKnotRefine(new Wt(d,u,A),s),l.push(_.controlPoints)}var S=_.knots;return o?new ne(r.degreeU,r.degreeV,r.knotsU.slice(),S,l):(l=Ot.transpose(l),new ne(r.degreeU,r.degreeV,S,r.knotsV.slice(),l))},_t.decomposeCurveIntoBeziers=function(r){for(var s=r.degree,o=r.controlPoints,l=r.knots,u=bt.knotMultiplicities(l),d=s+1,m=0;m<u.length;){var _=u[m];if(++m,_.mult<d){var y=p.rep(d-_.mult,_.knot),A=_t.curveKnotRefine(new Wt(s,l,o),y);l=A.knots,o=A.controlPoints}}l.length/d-1;for(var S=d*2,P=[],E=0;E<o.length;){var k=l.slice(E,E+S),T=o.slice(E,E+d);P.push(new Wt(s,k,T)),E+=d}return P},_t.curveKnotRefine=function(r,s){if(s.length==0)return gt.clonedCurve(r);for(var o=r.degree,l=r.controlPoints,u=r.knots,d=l.length-1,m=d+o+1,_=s.length-1,y=C.knotSpan(o,s[0],u),A=C.knotSpan(o,s[_],u),S=[],P=[],E=0,k=y-o+1;E<k;){var T=E++;S[T]=l[T]}for(var B=A-1,N=d+1;B<N;){var R=B++;S[R+_+1]=l[R]}for(var z=0,V=y+1;z<V;){var U=z++;P[U]=u[U]}for(var Y=A+o,J=m+1;Y<J;){var q=Y++;P[q+_+1]=u[q]}for(var j=A+o-1,$=A+o+_,tt=_;tt>=0;){for(;s[tt]<=u[j]&&j>y;)S[$-o-1]=l[j-o-1],P[$]=u[j],$=$-1,j=j-1;S[$-o-1]=S[$-o];for(var et=1,it=o+1;et<it;){var ht=et++,at=$-o+ht,ut=P[$+ht]-s[tt];Math.abs(ut)<rt.EPSILON?S[at-1]=S[at]:(ut=ut/(P[$+ht]-u[j-o+ht]),S[at-1]=p.add(p.mul(ut,S[at-1]),p.mul(1-ut,S[at])))}P[$]=s[tt],$=$-1,tt--}return new Wt(o,P,S)},_t.curveKnotInsert=function(r,s,o){for(var l=r.degree,u=r.controlPoints,d=r.knots,m=0,_=u.length,y=C.knotSpan(l,s,d),A=[],S=[],P=[],E=1,k=y+1;E<k;){var T=E++;S[T]=d[T]}for(var B=1,N=o+1;B<N;){var R=B++;S[y+R]=s}for(var z=y+1,V=d.length;z<V;){var U=z++;S[U+o]=d[U]}for(var Y=0,J=y-l+1;Y<J;){var q=Y++;P[q]=u[q]}for(var j=y-m;j<_;){var $=j++;P[$+o]=u[$]}for(var tt=0,et=l-m+1;tt<et;){var it=tt++;A[it]=u[y-l+it]}for(var ht=0,at=0,ut=1,nt=o+1;ut<nt;){var mt=ut++;ht=y-l+mt;for(var K=0,ft=l-mt-m+1;K<ft;){var Et=K++;at=(s-d[ht+Et])/(d[Et+y+1]-d[ht+Et]),A[Et]=p.add(p.mul(at,A[Et+1]),p.mul(1-at,A[Et]))}P[ht]=A[0],P[y+o-mt-m]=A[l-mt-m]}for(var Ht=ht+1,$t=y-m;Ht<$t;){var Ut=Ht++;P[Ut]=A[Ut-ht]}return new Wt(l,S,P)};var zt=f.eval.Tess=function(){};x["verb.eval.Tess"]=zt,zt.__name__=["verb","eval","Tess"],zt.rationalCurveRegularSample=function(r,s,o){return zt.rationalCurveRegularSampleRange(r,r.knots[0],Z.last(r.knots),s,o)},zt.rationalCurveRegularSampleRange=function(r,s,o,l,u){l<1&&(l=2);for(var d=[],m=(o-s)/(l-1),_=0,y=0;y<l;){var A=y++;_=s+m*A,u?d.push([_].concat(C.rationalCurvePoint(r,_))):d.push(C.rationalCurvePoint(r,_))}return d},zt.rationalCurveAdaptiveSample=function(r,s,o){if(o==null&&(o=!1),s==null&&(s=1e-6),r.degree==1)if(o){for(var l=[],u=0,d=r.controlPoints.length;u<d;){var m=u++;l.push([r.knots[m+1]].concat(C.dehomogenize(r.controlPoints[m])))}return l}else return r.controlPoints.map(C.dehomogenize);return zt.rationalCurveAdaptiveSampleRange(r,r.knots[0],Z.last(r.knots),s,o)},zt.rationalCurveAdaptiveSampleRange=function(r,s,o,l,u){var d=C.rationalCurvePoint(r,s),m=C.rationalCurvePoint(r,o),_=.5+.2*Math.random(),y=s+(o-s)*_,A=C.rationalCurvePoint(r,y),S=p.sub(d,m),P=p.sub(d,A);if(p.dot(S,S)<l&&p.dot(P,P)>l||!Be.threePointsAreFlat(d,A,m,l)){var E=s+(o-s)*.5,k=zt.rationalCurveAdaptiveSampleRange(r,s,E,l,u),T=zt.rationalCurveAdaptiveSampleRange(r,E,o,l,u);return k.slice(0,-1).concat(T)}else return u?[[s].concat(d),[o].concat(m)]:[d,m]},zt.rationalSurfaceNaive=function(r,s,o){s<1&&(s=1),o<1&&(o=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,u=r.knotsV,d=Z.last(l)-l[0],m=Z.last(u)-u[0],_=d/s,y=m/o,A=[],S=[],P=[],E=0,k=s+1;E<k;)for(var T=E++,B=0,N=o+1;B<N;){var R=B++,z=T*_,V=R*y;S.push([z,V]);var U=C.rationalSurfaceDerivatives(r,z,V,1),Y=U[0][0];A.push(Y);var J=p.normalized(p.cross(U[1][0],U[0][1]));P.push(J)}for(var q=[],j=0;j<s;)for(var $=j++,tt=0;tt<o;){var et=tt++,it=$*(o+1)+et,ht=($+1)*(o+1)+et,at=ht+1,ut=it+1,nt=[it,ht,at],mt=[it,at,ut];q.push(nt),q.push(mt)}return new $e(q,A,P,S)},zt.divideRationalSurfaceAdaptive=function(r,s){s==null&&(s=new Ur),s.minDivsU!=null?s.minDivsU=s.minDivsU:s.minDivsU=1,s.minDivsV!=null?s.minDivsU=s.minDivsV:s.minDivsU=1,s.refine!=null?s.refine=s.refine:s.refine=!0;var o=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,u;s.minDivsU>o?u=s.minDivsU=s.minDivsU:u=s.minDivsU=o;var d;s.minDivsV>l?d=s.minDivsV=s.minDivsV:d=s.minDivsV=l;for(var m=Z.last(r.knotsU),_=r.knotsU[0],y=Z.last(r.knotsV),A=r.knotsV[0],S=(m-_)/u,P=(y-A)/d,E=[],k=[],T=0,B=d+1;T<B;){for(var N=T++,R=[],z=0,V=u+1;z<V;){var U=z++,Y=_+S*U,J=A+P*N,q=C.rationalSurfaceDerivatives(r,Y,J,1),j=p.normalized(p.cross(q[0][1],q[1][0]));R.push(new Ye(q[0][0],j,[Y,J],-1,p.isZero(j)))}k.push(R)}for(var $=0;$<d;)for(var tt=$++,et=0;et<u;){var it=et++,ht=[k[d-tt-1][it],k[d-tt-1][it+1],k[d-tt][it+1],k[d-tt][it]];E.push(new fr(r,ht))}if(!s.refine)return E;for(var at=0;at<d;)for(var ut=at++,nt=0;nt<u;){var mt=nt++,K=ut*u+mt,ft=zt.north(K,ut,mt,u,d,E),Et=zt.east(K,ut,mt,u,d,E),Ht=zt.south(K,ut,mt,u,d,E),$t=zt.west(K,ut,mt,u,d,E);E[K].neighbors=[Ht,Et,ft,$t],E[K].divide(s)}return E},zt.north=function(r,s,o,l,u,d){return s==0?null:d[r-l]},zt.south=function(r,s,o,l,u,d){return s==u-1?null:d[r+l]},zt.east=function(r,s,o,l,u,d){return o==l-1?null:d[r+1]},zt.west=function(r,s,o,l,u,d){return o==0?null:d[r-1]},zt.triangulateAdaptiveRefinementNodeTree=function(r){for(var s=$e.empty(),o=0;o<r.length;){var l=r[o];++o,l.triangulate(s)}return s},zt.rationalSurfaceAdaptive=function(r,s){s!=null?s=s:s=new Ur;var o=zt.divideRationalSurfaceAdaptive(r,s);return zt.triangulateAdaptiveRefinementNodeTree(o)};var Ur=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=Ur,Ur.__name__=["verb","eval","AdaptiveRefinementOptions"],Ur.prototype={__class__:Ur};var fr=f.core.AdaptiveRefinementNode=function(r,s,o){if(this.srf=r,o==null?this.neighbors=[null,null,null,null]:this.neighbors=o,this.corners=s,this.corners==null){var l=r.knotsU[0],u=Z.last(r.knotsU),d=r.knotsV[0],m=Z.last(r.knotsV);this.corners=[Ye.fromUv(l,d),Ye.fromUv(u,d),Ye.fromUv(u,m),Ye.fromUv(l,m)]}};x["verb.eval.AdaptiveRefinementNode"]=fr,fr.__name__=["verb","eval","AdaptiveRefinementNode"],fr.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var s=r++;if(this.corners[s].point==null){var o=this.corners[s];this.evalSrf(o.uv[0],o.uv[1],o)}}},evalSrf:function(r,s,o){var l=C.rationalSurfaceDerivatives(this.srf,r,s,1),u=l[0][0],d=p.cross(l[0][1],l[1][0]),m=p.isZero(d);return m||(d=p.normalized(d)),o!=null?(o.degen=m,o.point=u,o.normal=d,o):new Ye(u,d,[r,s],-1,m)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var s=[this.corners[r]];if(this.neighbors[r]==null)return s;var o=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,u=rt.EPSILON,d=this,m=[function(y){return y.uv[0]>d.corners[0].uv[0]+u&&y.uv[0]<d.corners[2].uv[0]-u},function(y){return y.uv[1]>d.corners[0].uv[1]+u&&y.uv[1]<d.corners[2].uv[1]-u}],_=o.filter(m[l]);return _.reverse(),s.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,s=0;s<r;){var o=s++;if(this.corners[o],this.corners[o].degen){var l=this.corners[(o+1)%r],u=this.corners[(o+3)%r];l.degen?this.corners[o].normal=u.normal:this.corners[o].normal=l.normal}}},shouldDivide:function(r,s){if(s<r.minDepth)return!0;if(s>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=p.normSquared(p.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||p.normSquared(p.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=p.normSquared(p.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||p.normSquared(p.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var o=this.center();return p.normSquared(p.sub(o.normal,this.corners[0].normal))>r.normTol||p.normSquared(p.sub(o.normal,this.corners[1].normal))>r.normTol||p.normSquared(p.sub(o.normal,this.corners[2].normal))>r.normTol||p.normSquared(p.sub(o.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new Ur),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,s,o){if(this.evalCorners(),!!this.shouldDivide(r,s)){if(s++,this.splitVert&&!this.splitHoriz?o=!1:!this.splitVert&&this.splitHoriz&&(o=!0),this.horizontal=o,this.horizontal){var l=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],u=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new fr(this.srf,l),new fr(this.srf,u)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],m=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new fr(this.srf,d),new fr(this.srf,m)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,y=this.children;_<y.length;){var A=y[_];++_,A._divide(r,s,!o)}}},triangulate:function(r){if(r==null&&(r=$e.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var s=0,o=this.children;s<o.length;){var l=o[s];if(++s,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var s=r.points.length,o=[],l=[],u=0,d=0;d<4;){var m=d++,_=this.getAllCorners(m);_.length==2&&(u=m+1);for(var y=0,A=_.length;y<A;){var S=y++;o.push(_[S])}}for(var P=0;P<o.length;){var E=o[P];if(++P,E.id!=-1){l.push(E.id);continue}r.uvs.push(E.uv),r.points.push(E.point),r.normals.push(E.normal),E.id=s,l.push(s),s++}if(o.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(o.length==5){var k=l.length;return r.faces.push([l[u],l[(u+2)%k],l[(u+1)%k]]),r.faces.push([l[(u+4)%k],l[(u+3)%k],l[u]]),r.faces.push([l[u],l[(u+3)%k],l[(u+2)%k]]),r}var T=this.center();r.uvs.push(T.uv),r.points.push(T.point),r.normals.push(T.normal);for(var B=r.points.length-1,N=0,R=o.length-1;N<o.length;)r.faces.push([B,l[N],l[R]]),R=N++;return r},__class__:fr};var At=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=At,At.__name__=["verb","exe","Dispatcher"],At.init=function(){At._init||(At._workerPool=new jr(At.THREADS),At._init=!0)},At.dispatchMethod=function(r,s,o){At.init();var l=new Pn,u=function(d){l.resolve(d)};return At._workerPool.addWork(ct.getClassName(r),s,o,u),new _e(l)};var jr=f.exe.WorkerPool=function(r,s){s==null&&(s="verb.js"),r==null&&(r=1),this._callbacks=new wt,this._working=new wt,this._pool=[],this._queue=[];for(var o=0;o<r;){o++;var l;try{l=new Worker(jr.basePath+s)}catch(u){u instanceof Q&&(u=u.val),l=new Worker(jr.basePath+s.substring(0,-3)+".min.js")}this._pool.push(l)}};x["verb.exe.WorkerPool"]=jr,jr.__name__=["verb","exe","WorkerPool"],jr.prototype={addWork:function(r,s,o,l){var u=new en(r,s,o);this._callbacks.set(u.id,l),this._queue.push(u),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var s=this._queue.shift(),o=[s.id],l=[this._pool.shift()];this._working.h[o[0]]=l[0],l[0].onmessage=function(u,d){return function(m){r._working.remove(d[0]),r._pool.push(u[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](m.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(l,o),l[0].postMessage(s)}},__class__:jr};var en=function(r,s,o){this.className=r,this.methodName=s,this.args=o,this.id=en.uuid++};x["verb.exe._WorkerPool.Work"]=en,en.__name__=["verb","exe","_WorkerPool","Work"],en.prototype={__class__:en};var Ln=function(){};x["verb.geom.ICurve"]=Ln,Ln.__name__=["verb","geom","ICurve"],Ln.__interfaces__=[Tn],Ln.prototype={__class__:Ln};var Lt=f.geom.NurbsCurve=function(r){this._data=Xe.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=Lt,Lt.__name__=["verb","geom","NurbsCurve"],Lt.__interfaces__=[Ln],Lt.byKnotsControlPointsWeights=function(r,s,o,l){return new Lt(new Wt(r,s.slice(),C.homogenize1d(o,l)))},Lt.byPoints=function(r,s){return s==null&&(s=3),new Lt(gt.rationalInterpCurve(r,s))},Lt.__super__=te,Lt.prototype=M(te.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return C.dehomogenize1d(this._data.controlPoints)},weights:function(){return C.weight1d(this._data.controlPoints)},asNurbs:function(){return new Wt(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Lt(this._data)},domain:function(){return new ke(Z.first(this._data.knots),Z.last(this._data.knots))},transform:function(r){return new Lt(_t.rationalCurveTransform(this._data,r))},transformAsync:function(r){return At.dispatchMethod(_t,"rationalCurveTransform",[this._data,r]).then(function(s){return new Lt(s)})},point:function(r){return C.rationalCurvePoint(this._data,r)},pointAsync:function(r){return At.dispatchMethod(C,"rationalCurvePoint",[this._data,r])},tangent:function(r){return C.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return At.dispatchMethod(C,"rationalCurveTangent",[this._data,r])},derivatives:function(r,s){return s==null&&(s=1),C.rationalCurveDerivatives(this._data,r,s)},derivativesAsync:function(r,s){return s==null&&(s=1),At.dispatchMethod(C,"rationalCurveDerivatives",[this._data,r,s])},closestPoint:function(r){return bt.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return At.dispatchMethod(bt,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return bt.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return At.dispatchMethod(bt,"rationalCurveClosestParam",[this._data,r])},length:function(){return bt.rationalCurveArcLength(this._data)},lengthAsync:function(){return At.dispatchMethod(bt,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return bt.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return At.dispatchMethod(bt,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,s){return bt.rationalCurveParamAtArcLength(this._data,r,s)},paramAtLengthAsync:function(r,s){return At.dispatchMethod(bt,"rationalCurveParamAtArcLength",[this._data,r,s])},divideByEqualArcLength:function(r){return ue.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return At.dispatchMethod(ue,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return ue.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return At.dispatchMethod(ue,"rationalCurveByArcLength",[this._data,r])},split:function(r){return ue.curveSplit(this._data,r).map(function(s){return new Lt(s)})},splitAsync:function(r){return At.dispatchMethod(ue,"curveSplit",[this._data,r]).then(function(s){return s.map(function(o){return new Lt(o)})})},reverse:function(){return new Lt(_t.curveReverse(this._data))},reverseAsync:function(){return At.dispatchMethod(_t,"curveReverse",[this._data]).then(function(r){return new Lt(r)})},tessellate:function(r){return zt.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return At.dispatchMethod(zt,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:Lt});var Gr=f.geom.Arc=function(r,s,o,l,u,d){Lt.call(this,gt.arc(r,s,o,l,u,d)),this._center=r,this._xaxis=s,this._yaxis=o,this._radius=l,this._minAngle=u,this._maxAngle=d};x["verb.geom.Arc"]=Gr,Gr.__name__=["verb","geom","Arc"],Gr.__super__=Lt,Gr.prototype=M(Lt.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Gr});var os=f.geom.BezierCurve=function(r,s){Lt.call(this,gt.rationalBezierCurve(r,s))};x["verb.geom.BezierCurve"]=os,os.__name__=["verb","geom","BezierCurve"],os.__super__=Lt,os.prototype=M(Lt.prototype,{__class__:os});var ls=f.geom.Circle=function(r,s,o,l){Gr.call(this,r,s,o,l,0,Math.PI*2)};x["verb.geom.Circle"]=ls,ls.__name__=["verb","geom","Circle"],ls.__super__=Gr,ls.prototype=M(Gr.prototype,{__class__:ls});var On=function(){};x["verb.geom.ISurface"]=On,On.__name__=["verb","geom","ISurface"],On.__interfaces__=[Tn],On.prototype={__class__:On};var Mt=f.geom.NurbsSurface=function(r){this._data=Xe.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Mt,Mt.__name__=["verb","geom","NurbsSurface"],Mt.__interfaces__=[On],Mt.byKnotsControlPointsWeights=function(r,s,o,l,u,d){return new Mt(new ne(r,s,o,l,C.homogenize2d(u,d)))},Mt.byCorners=function(r,s,o,l){return new Mt(gt.fourPointSurface(r,s,o,l))},Mt.byLoftingCurves=function(r,s){return new Mt(gt.loftedSurface(function(o){for(var l,u=[],d=0;d<r.length;){var m=r[d];++d,u.push(m.asNurbs())}return l=u,l}(),s))},Mt.__super__=te,Mt.prototype=M(te.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return C.dehomogenize2d(this._data.controlPoints)},weights:function(){return C.weight2d(this._data.controlPoints)},asNurbs:function(){return new ne(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Mt(this.asNurbs())},domainU:function(){return new ke(Z.first(this._data.knotsU),Z.last(this._data.knotsU))},domainV:function(){return new ke(Z.first(this._data.knotsV),Z.last(this._data.knotsV))},point:function(r,s){return C.rationalSurfacePoint(this._data,r,s)},pointAsync:function(r,s){return At.dispatchMethod(C,"rationalSurfacePoint",[this._data,r,s])},normal:function(r,s){return C.rationalSurfaceNormal(this._data,r,s)},normalAsync:function(r,s){return At.dispatchMethod(C,"rationalSurfaceNormal",[this._data,r,s])},derivatives:function(r,s,o){return o==null&&(o=1),C.rationalSurfaceDerivatives(this._data,r,s,o)},derivativesAsync:function(r,s,o){return o==null&&(o=1),At.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,r,s,o])},closestParam:function(r){return bt.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return At.dispatchMethod(bt,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return bt.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return At.dispatchMethod(bt,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,s){return s==null&&(s=!1),ue.surfaceSplit(this._data,r,s).map(function(o){return new Mt(o)})},splitAsync:function(r,s){return s==null&&(s=!1),At.dispatchMethod(ue,"surfaceSplit",[this._data,r,s]).then(function(o){return o.map(function(l){return new Mt(l)})})},reverse:function(r){return r==null&&(r=!1),new Mt(_t.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),At.dispatchMethod(_t,"surfaceReverse",[this._data,r]).then(function(s){return new Mt(s)})},isocurve:function(r,s){return s==null&&(s=!1),new Lt(gt.surfaceIsocurve(this._data,r,s))},isocurveAsync:function(r,s){return s==null&&(s=!1),At.dispatchMethod(gt,"surfaceIsocurve",[this._data,r,s]).then(function(o){return new Lt(o)})},boundaries:function(r){return gt.surfaceBoundaryCurves(this._data).map(function(s){return new Lt(s)})},boundariesAsync:function(r){return At.dispatchMethod(gt,"surfaceBoundaryCurves",[this._data]).then(function(s){return s.map(function(o){return new Lt(o)})})},tessellate:function(r){return zt.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return At.dispatchMethod(zt,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Mt(_t.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return At.dispatchMethod(_t,"rationalSurfaceTransform",[this._data,r]).then(function(s){return new Mt(s)})},__class__:Mt});var hs=f.geom.ConicalSurface=function(r,s,o,l,u){Mt.call(this,gt.conicalSurface(r,s,o,l,u)),this._axis=r,this._xaxis=s,this._base=o,this._height=l,this._radius=u};x["verb.geom.ConicalSurface"]=hs,hs.__name__=["verb","geom","ConicalSurface"],hs.__super__=Mt,hs.prototype=M(Mt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:hs});var cs=f.geom.CylindricalSurface=function(r,s,o,l,u){Mt.call(this,gt.cylindricalSurface(r,s,o,l,u)),this._axis=r,this._xaxis=s,this._base=o,this._height=l,this._radius=u};x["verb.geom.CylindricalSurface"]=cs,cs.__name__=["verb","geom","CylindricalSurface"],cs.__super__=Mt,cs.prototype=M(Mt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:cs});var Wr=f.geom.EllipseArc=function(r,s,o,l,u){Lt.call(this,gt.ellipseArc(r,s,o,l,u)),this._center=r,this._xaxis=s,this._yaxis=o,this._minAngle=l,this._maxAngle=u};x["verb.geom.EllipseArc"]=Wr,Wr.__name__=["verb","geom","EllipseArc"],Wr.__super__=Lt,Wr.prototype=M(Lt.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Wr});var us=f.geom.Ellipse=function(r,s,o){Wr.call(this,r,s,o,0,Math.PI*2)};x["verb.geom.Ellipse"]=us,us.__name__=["verb","geom","Ellipse"],us.__super__=Wr,us.prototype=M(Wr.prototype,{__class__:us});var ds=f.geom.ExtrudedSurface=function(r,s){Mt.call(this,gt.extrudedSurface(p.normalized(s),p.norm(s),r.asNurbs())),this._profile=r,this._direction=s};x["verb.geom.ExtrudedSurface"]=ds,ds.__name__=["verb","geom","ExtrudedSurface"],ds.__super__=Mt,ds.prototype=M(Mt.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:ds});var Hr=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=Hr,Hr.__name__=["verb","geom","Intersect"],Hr.curves=function(r,s,o){return o==null&&(o=.001),lt.curves(r.asNurbs(),s.asNurbs(),o)},Hr.curvesAsync=function(r,s,o){return o==null&&(o=.001),At.dispatchMethod(lt,"curves",[r.asNurbs(),s.asNurbs(),o])},Hr.curveAndSurface=function(r,s,o){return o==null&&(o=.001),lt.curveAndSurface(r.asNurbs(),s.asNurbs(),o)},Hr.curveAndSurfaceAsync=function(r,s,o){return o==null&&(o=.001),At.dispatchMethod(lt,"curveAndSurface",[r.asNurbs(),s.asNurbs(),o])},Hr.surfaces=function(r,s,o){return o==null&&(o=.001),lt.surfaces(r.asNurbs(),s.asNurbs(),o).map(function(l){return new Lt(l)})},Hr.surfacesAsync=function(r,s,o){return o==null&&(o=.001),At.dispatchMethod(lt,"surfaces",[r.asNurbs(),s.asNurbs(),o]).then(function(l){return l.map(function(u){return new Lt(u)})})};var ps=f.geom.Line=function(r,s){Lt.call(this,gt.polyline([r,s])),this._start=r,this._end=s};x["verb.geom.Line"]=ps,ps.__name__=["verb","geom","Line"],ps.__super__=Lt,ps.prototype=M(Lt.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:ps});var ms=f.geom.RevolvedSurface=function(r,s,o,l){Mt.call(this,gt.revolvedSurface(r.asNurbs(),s,o,l)),this._profile=r,this._center=s,this._axis=o,this._angle=l};x["verb.geom.RevolvedSurface"]=ms,ms.__name__=["verb","geom","RevolvedSurface"],ms.__super__=Mt,ms.prototype=M(Mt.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:ms});var gs=f.geom.SphericalSurface=function(r,s){Mt.call(this,gt.sphericalSurface(r,[0,0,1],[1,0,0],s)),this._center=r,this._radius=s};x["verb.geom.SphericalSurface"]=gs,gs.__name__=["verb","geom","SphericalSurface"],gs.__super__=Mt,gs.prototype=M(Mt.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:gs});var fs=f.geom.SweptSurface=function(r,s){Mt.call(this,gt.rationalTranslationalSurface(r.asNurbs(),s.asNurbs())),this._profile=r,this._rail=s};x["verb.geom.SweptSurface"]=fs,fs.__name__=["verb","geom","SweptSurface"],fs.__super__=Mt,fs.prototype=M(Mt.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:fs});function Qe(r){return r instanceof Array?function(){return L.iter(r)}:typeof r.iterator=="function"?ze(r,r.iterator):r.iterator}var Qi,su=0;function ze(r,s){if(s==null)return null;s.__id__==null&&(s.__id__=su++);var o;return r.hx__closures__==null?r.hx__closures__={}:o=r.hx__closures__[s.__id__],o==null&&(o=function(){return o.method.apply(o.scope,arguments)},o.scope=r,o.method=s,r.hx__closures__[s.__id__]=o),o}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var iu=x.Int={__name__:["Int"]},au=x.Dynamic={__name__:["Dynamic"]},Fo=x.Float=Number;Fo.__name__=["Float"];var Vo=x.Bool=Boolean;Vo.__ename__=["Bool"];var Uo=x.Class={__name__:["Class"]},jo={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var s=[],o=0,l=this.length;o<l;){var u=o++;s[u]=r(this[u])}return s}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var s=[],o=0,l=this.length;o<l;){var u=o++,d=this[u];r(d)&&s.push(d)}return s});var Ji={},Qs=w.ArrayBuffer||ce;Qs.prototype.slice==null&&(Qs.prototype.slice=ce.sliceImpl),w.DataView;var ta=w.Uint8Array||or._new;(function(r,s){if(r.setImmediate)return;var o=1,l={},u=!1,d=r.document,m;function _(z){return l[o]=y.apply(s,z),o++}function y(z){var V=[].slice.call(arguments,1);return function(){typeof z=="function"?z.apply(s,V):new Function(""+z)()}}function A(z){if(u)setTimeout(y(A,z),0);else{var V=l[z];if(V){u=!0;try{V()}finally{S(z),u=!1}}}}function S(z){delete l[z]}function P(){m=function(){var z=_(arguments);return process.nextTick(y(A,z)),z}}function E(){if(r.postMessage&&!r.importScripts){var z=!0,V=r.onmessage;return r.onmessage=function(){z=!1},r.postMessage("","*"),r.onmessage=V,z}}function k(){var z="setImmediate$"+Math.random()+"$",V=function(U){U.source===r&&typeof U.data=="string"&&U.data.indexOf(z)===0&&A(+U.data.slice(z.length))};r.addEventListener?r.addEventListener("message",V,!1):r.attachEvent("onmessage",V),m=function(){var U=_(arguments);return r.postMessage(z+U,"*"),U}}function T(){var z=new MessageChannel;z.port1.onmessage=function(V){var U=V.data;A(U)},m=function(){var V=_(arguments);return z.port2.postMessage(V),V}}function B(){var z=d.documentElement;m=function(){var V=_(arguments),U=d.createElement("script");return U.onreadystatechange=function(){A(V),U.onreadystatechange=null,z.removeChild(U),U=null},z.appendChild(U),V}}function N(){m=function(){var z=_(arguments);return setTimeout(y(A,z),0),z}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?P():E()?k():r.MessageChannel?T():d&&"onreadystatechange"in d.createElement("script")?B():N(),R.setImmediate=m,R.clearImmediate=S})(new Function("return this")()),Kt.USE_CACHE=!1,Kt.USE_ENUM_INDEX=!1,Kt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",qt.DEFAULT_RESOLVER=ct,qt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Bt.count=0,he.i64tmp=function(r){var s,o=new Gt(0,0);return s=o,s}(),Nt.__toStr={}.toString,or.BYTES_PER_ELEMENT=1,It.queue=new F,Dt.memo=new wt,rt.TOLERANCE=1e-6,rt.EPSILON=1e-10,rt.VERSION="2.0.0",bt.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],bt.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],At.THREADS=1,At._init=!1,jr.basePath="",en.uuid=0,$s.main()}(typeof console<"u"?console:{log:function(){}},e,typeof c<"u"?c:typeof n<"u"?n:typeof self<"u"?self:this),e})})(dh);var Vu=dh.exports;const Dn=Fu(Vu);class ca{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,n,a){this.c0=t,this.c1=n,this.c2=-3*t+3*e-2*n-a,this.c3=2*t-2*e+n+a}initCatmullRom(t,e,n,a,h){this.init(e,n,h*(n-t),h*(a-e))}initNonuniformCatmullRom(t,e,n,a,h,c,g){let b=(e-t)/h-(n-t)/(h+c)+(n-e)/c,f=(n-e)/c-(a-e)/(c+g)+(a-n)/g;b*=c,f*=c,this.init(e,n,b,f)}calc(t){const e=t*t,n=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*n}}let ph=class extends Ks{constructor(t=[],e=!1,n="centripetal",a=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new X,this._px=new ca,this._py=new ca,this._pz=new ca,this._points=t.map(h=>new W(h)),this._closed=e,this._curveType=n,this._tension=a}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new W}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new W}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new W){const n=e,a=this._points,h=a.length;if(h===0)return n.set(0,0,0);if(h===1)return n.copy(a[0]);const c=(h-(this._closed?0:1))*t;let g=Math.floor(c),b=c-g;this._closed?g+=g>0?0:(Math.floor(Math.abs(g)/h)+1)*h:b===0&&g===h-1&&(g=h-2,b=1);let f,w;this._closed||g>0?f=a[(g-1)%h]:(this._tmp.subVectors(a[0],a[1]).add(a[0]),f=new W(this._tmp.x,this._tmp.y,this._tmp.z));const x=a[g%h],I=a[(g+1)%h];if(this._closed||g+2<h?w=a[(g+2)%h]:(this._tmp.subVectors(a[h-1],a[h-2]).add(a[h-1]),w=new W(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const M=this._curveType==="chordal"?.5:.25;let L=Math.pow(f.distanceToSquared(x),M),O=Math.pow(x.distanceToSquared(I),M),F=Math.pow(I.distanceToSquared(w),M);O<1e-4&&(O=1),L<1e-4&&(L=O),F<1e-4&&(F=O),this._px.initNonuniformCatmullRom(f.x,x.x,I.x,w.x,L,O,F),this._py.initNonuniformCatmullRom(f.y,x.y,I.y,w.y,L,O,F),this._pz.initNonuniformCatmullRom(f.z,x.z,I.z,w.z,L,O,F)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,I.x,w.x,this._tension),this._py.initCatmullRom(f.y,x.y,I.y,w.y,this._tension),this._pz.initCatmullRom(f.z,x.z,I.z,w.z,this._tension));return n.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),n}getPoints(t){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}setPoints(t){this._points=t.map(e=>new W(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(e=>{const n=new W;return n.copy(e),n.applyMatrix4(t),n}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Ct;const t=new Ct;return this._points.forEach(e=>{t.expandByPoint(e)}),t}};class vn{constructor(t,e,n,a){this._degree=t,this._knots=[...e],this._controlPoints=n.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=a?[...a]:new Array(n.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(n=>[n.x,n.y,n.z]);return Rs(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return sh(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,n,a){return new vn(t,e,n,a)}static byPoints(t,e,n="Uniform"){let a;switch(n){case"Chord":a=rh(e,t);break;case"SqrtChord":a=nh(e,t);break;case"Uniform":default:a=eh(e,t.length);break}const h=t.map(g=>({x:g[0],y:g[1],z:g[2]})),c=new Array(h.length).fill(1);return new vn(e,a,h,c)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:n,end:a}=this.getParameterRange();for(let h=0;h<=t;h++){const c=n+(a-n)*(h/t);e.push(this.point(c))}return e}isClosed(t=1e-6){const{start:e,end:n}=this.getParameterRange(),a=this.point(e),h=this.point(n),c=a[0]-h[0],g=a[1]-h[1],b=a[2]-h[2];return Math.sqrt(c*c+g*g+b*b)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new ph(t,!0,"centripetal"),n=Math.max(50,t.length*2);return e.getPoints(n)}static createClosedCurve(t,e,n="Chord"){const a=this.createFitPointsForClosedCurve(t).map(h=>[h.x,h.y,h.z]);return vn.byPoints(a,e,n)}}class Qr extends Ks{constructor(t,e,n,a,h){super();const c=arguments.length;if(c<2||c>5)throw qe.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(e)){this._controlPoints=t;let g,b=3,f=!1;if(c>=3&&(Array.isArray(n)?(g=n,c>=4&&(b=a||3),c>=5&&(f=h)):n!==void 0&&(b=n||3,c>=4&&(f=a))),n===void 0&&c>=4&&(b=a||3,c>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw qe.ILLEGAL_PARAMETERS;const w=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Dn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,w,g)}else{if(this._fitPoints=t,this._knotParameterization=e,c>=3&&(this._degree=n||3),c>=4&&(this._closed=a),this._fitPoints.length<this._degree+1)throw qe.ILLEGAL_PARAMETERS;const g=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Dn.geom.NurbsCurve.byPoints(g,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=vn.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Dn.geom.NurbsCurve.byPoints(e,this._degree)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Dn.geom.NurbsCurve.byPoints(t,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const t=vn.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Dn.geom.NurbsCurve.byPoints(e,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights(),n=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Dn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,n,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),n=t[e],a=this._nurbsCurve.point(n);return new W(a[0],a[1],a[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),n=t[t.length-e-1],a=this._nurbsCurve.point(n);return new W(a[0],a[1],a[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,n=t<0||t>=e?e-1:t,a=this._fitPoints[n];return{x:a.x,y:a.y,z:a.z||0}}getControlPointAt(t){const e=this._controlPoints.length,n=t<0||t>=e?e-1:t;return this._controlPoints[n]}getPoints(t=100){const e=this._nurbsCurve,n=[],a=e.knots(),h=this._nurbsCurve.degree(),c=a[h],g=a[a.length-h-1],b=(g-c)/(t-1);for(let f=0;f<t;f++){const w=f===t-1?g:c+f*b,x=e.point(w);n.push(new W(x[0],x[1],x[2]))}return n}getCurvePoints(t,e){const n=[],a=t.knots(),h=a[3],c=(a[a.length-4]-h)/(e-1);for(let g=0;g<e;g++){const b=h+g*c;n.push(t.point(b))}return n}calculateBoundingBox(){const t=this.getPoints(100);return new Ct().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((n,a)=>{e[a]=[n.x,n.y,n.z||0]}),e}toVerbPoints(t){const e=new Array(t.length);return t.forEach((n,a)=>{e[a]=[n.x,n.y,n.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((n,a)=>{e[a]={x:n[0],y:n[1],z:n[2]}}),e}static createClosedSpline(t,e="Uniform",n=3){if(t.length<n+1)throw new Error(`At least ${n+1} points are required for a degree ${n} closed spline`);return new Qr(t,e,n,!0)}}var qa=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(qa||{}),qi=(i=>(i[i.ByBlock=-2]="ByBlock",i[i.ByDIPs=-4]="ByDIPs",i[i.ByLayer=-1]="ByLayer",i[i.ByLineWeightDefault=-3]="ByLineWeightDefault",i[i.LineWeight000=0]="LineWeight000",i[i.LineWeight005=5]="LineWeight005",i[i.LineWeight009=9]="LineWeight009",i[i.LineWeight013=13]="LineWeight013",i[i.LineWeight015=15]="LineWeight015",i[i.LineWeight018=18]="LineWeight018",i[i.LineWeight020=20]="LineWeight020",i[i.LineWeight025=25]="LineWeight025",i[i.LineWeight030=30]="LineWeight030",i[i.LineWeight035=35]="LineWeight035",i[i.LineWeight040=40]="LineWeight040",i[i.LineWeight050=50]="LineWeight050",i[i.LineWeight053=53]="LineWeight053",i[i.LineWeight060=60]="LineWeight060",i[i.LineWeight070=70]="LineWeight070",i[i.LineWeight080=80]="LineWeight080",i[i.LineWeight090=90]="LineWeight090",i[i.LineWeight100=100]="LineWeight100",i[i.LineWeight106=106]="LineWeight106",i[i.LineWeight120=120]="LineWeight120",i[i.LineWeight140=140]="LineWeight140",i[i.LineWeight158=158]="LineWeight158",i[i.LineWeight200=200]="LineWeight200",i[i.LineWeight211=211]="LineWeight211",i))(qi||{}),Or=(i=>(i[i.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",i[i.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",i[i.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",i[i.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",i[i.BY_STYLE=5]="BY_STYLE",i))(Or||{}),be=(i=>(i[i.TopLeft=1]="TopLeft",i[i.TopCenter=2]="TopCenter",i[i.TopRight=3]="TopRight",i[i.MiddleLeft=4]="MiddleLeft",i[i.MiddleCenter=5]="MiddleCenter",i[i.MiddleRight=6]="MiddleRight",i[i.BottomLeft=7]="BottomLeft",i[i.BottomCenter=8]="BottomCenter",i[i.BottomRight=9]="BottomRight",i))(be||{}),Ya=(i=>(i[i.OPTIMIZED_2D=0]="OPTIMIZED_2D",i[i.WIREFRAME=1]="WIREFRAME",i[i.HIDDEN_LINE=2]="HIDDEN_LINE",i[i.FLAT_SHADED=3]="FLAT_SHADED",i[i.GOURAUD_SHADED=4]="GOURAUD_SHADED",i[i.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",i[i.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",i))(Ya||{}),Xa=(i=>(i[i.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",i[i.TOP=1]="TOP",i[i.BOTTOM=2]="BOTTOM",i[i.FRONT=3]="FRONT",i[i.BACK=4]="BACK",i[i.LEFT=5]="LEFT",i[i.RIGHT=6]="RIGHT",i))(Xa||{}),Ka=(i=>(i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",i))(Ka||{});let mh=class gh{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new W,this._height=0,this._width=0,this._viewCenter=new W,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new xe;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new xe;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new gh;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t}copy(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this}};var yn=256,fh=[],cl=256,ei;for(;yn--;)fh[yn]=(yn+256).toString(16).substring(1);function Uu(i){var t=0,e=11;if(!ei||yn+e>cl*2)for(ei="",yn=0;t<cl;t++)ei+=fh[Math.random()*256|0];return ei.substring(yn,yn+++e)}class Jr{constructor(t,e){t=t||{},qn(t,{objectId:Uu()}),this._attrs=new Pl(t,e)}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)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get database(){return this._database?this._database:so().workingDatabase}set database(t){this._database=t}close(){}}const io=class io extends Jr{constructor(){super(...arguments),this._layer="0",this._color=new zr,this._lineType=ii,this._lineWeight=qi.ByLayer,this._linetypeScale=-1,this._visibility=!0,this._transparency=new Ui}get type(){return this.constructor.typeName}get layer(){return this._layer}set layer(t){this._layer=t}get color(){return this._color}set color(t){this._color.copy(t)}get rgbColor(){let t=this.database.cecolor;if(this.color.isByLayer){const n=this.getLayerColor();n&&n.RGB!=null&&(t=n)}else this.color.isByBlock||this.color.RGB!=null&&(t=this.color);const e=t.RGB;return e??16777215}get lineType(){return this._lineType}set lineType(t){this._lineType=t||ii}get lineWeight(){return this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return 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()}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,n,a){}transformBy(t){return this}worldDraw(t,e){const n=t.subEntityTraits;return n.color=this.color,n.rgbColor=this.rgbColor,n.lineType=this.lineStyle,n.lineTypeScale=this.linetypeScale,n.lineWeight=this.lineWeight,n.transparency=this.transparency,n.layer=this.layer,"thickness"in this&&(n.thickness=this.thickness),this.subWorldDraw(t,e)}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color.copy(t)}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var a;const{type:t,name:e}=this.getLineType(),n=(a=this.database)==null?void 0:a.tables.linetypeTable.getAt(e);return n?{type:t,...n.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==ii){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==Cl?{type:"ByBlock",name:di}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:di}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);if(t==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return t.color;return null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};io.typeName="Entity";let Ee=io;const ao=class ao extends Ee{};ao.typeName="Curve";let Me=ao;var Vn=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.FitCurvePoly=1]="FitCurvePoly",i[i.QuadSplinePoly=2]="QuadSplinePoly",i[i.CubicSplinePoly=3]="CubicSplinePoly",i))(Vn||{});const oo=class oo extends Me{constructor(t,e,n=0,a=!1,h=0,c=0,g=null){super(),this._polyType=t,this._elevation=n;const b=g&&(g==null?void 0:g.length)===e.length,f=e.map((w,x)=>({x:w.x,y:w.y,bulge:b?g[x]:void 0}));this._geo=new xn(f,a)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get geometricExtents(){const t=this._geo.box;return new Ct({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const n=this._geo.getPointAt(e);t.push(new W(n.x,n.y,0))}return t}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:for(let h=0;h<this._geo.numberOfVertices;++h){const c=this._geo.getPointAt(h);a.push(new W(c.x,c.y,0))}break}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,this.elevation))),t.lines(e)}};oo.typeName="2dPolyline";let mi=oo;var _h=(i=>(i[i.Vertex=0]="Vertex",i[i.CurveFitVertex=1]="CurveFitVertex",i[i.SplineFitVertex=8]="SplineFitVertex",i[i.SplineCtlVertex=9]="SplineCtlVertex",i))(_h||{});const lo=class lo extends Ee{constructor(){super(),this._position=new W,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new Ct().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,n,a){a.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}};lo.typeName="2dVertex";let Sa=lo;var Fs=(i=>(i[i.SimplePoly=0]="SimplePoly",i[i.QuadSplinePoly=1]="QuadSplinePoly",i[i.CubicSplinePoly=2]="CubicSplinePoly",i))(Fs||{});const ho=class ho extends Me{constructor(t,e,n=!1){super(),this._polyType=t,this._geo=new xn(e,n)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get geometricExtents(){const t=this._geo.box;return new Ct({x:t.min.x,y:t.min.y,z:0},{x:t.max.x,y:t.max.y,z:0})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const n=this._geo.getPointAt(e);t.push(new W(n.x,n.y,0))}return t}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:for(let h=0;h<this._geo.numberOfVertices;++h){const c=this._geo.getPointAt(h);a.push(new W(c.x,c.y,0))}break}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,0))),t.lines(e)}};ho.typeName="3dPolyline";let gi=ho;var yh=(i=>(i[i.SimpleVertex=0]="SimpleVertex",i[i.ControlVertex=1]="ControlVertex",i[i.FitVertex=2]="FitVertex",i))(yh||{});const co=class co extends Ee{constructor(){super(),this._position=new W,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new Ct().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,n,a){a.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}};co.typeName="3dVertex";let Ia=co;const uo=class uo extends Me{constructor(t,e,n,a,h=X.Z_AXIS){super(),this._geo=new Wa(t,e,n,a,h,X.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>Pt.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,n,a){const h=this.startPoint,c=this.endPoint;switch(t){case Ft.EndPoint:a.push(h),a.push(c);break;case Ft.MidPoint:a.push(this.midPoint);break;case Ft.Nearest:{const g=this._geo.nearestPoint(e);a.push(g)}break;case Ft.Perpendicular:break;case Ft.Tangent:{const g=this._geo.tangentPoints(e);a.push(...g);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}};uo.typeName="Arc";let fi=uo;const po=class po extends Ee{constructor(t){super(),this._blockName=t,this._position=new W,this._rotation=0,this._normal=new X(0,0,1),this._scaleFactors=new W(1,1,1)}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 blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}subGetOsnapPoints(t,e,n,a){Ft.Insertion===t&&a.push(this._position)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:t=>{this.scaleFactors.x=t}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:t=>{this.scaleFactors.y=t}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:t=>{this.scaleFactors.z=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}}]}]}}get geometricExtents(){const t=new Ct,e=this.blockTableRecord;if(e!=null){const h=e.newIterator();for(const c of h)t.union(c.geometricExtents)}const n=new $r().setFromEuler(new lh(this.rotation,0,0)),a=new Zr;return a.compose(this.position,n,this.scaleFactors),t.applyMatrix4(a),t}subWorldDraw(t){const e=[],n=this.blockTableRecord;if(n!=null){const a=this.computeTransformMatrix(),h=Yn.instance.draw(t,n,this.rgbColor,!0,a,this.normal);return this.attachEntityInfo(h),h}else{const a=t.group(e);return this.attachEntityInfo(a),a}}computeTransformMatrix(){const t=new $r;return t.setFromAxisAngle(X.Z_AXIS,this.rotation),new Zr().compose(this._position,t,this._scaleFactors)}};po.typeName="BlockReference";let Wn=po;const mo=class mo extends Me{constructor(t,e,n=X.Z_AXIS){super(),this._geo=new Wa(t,e,0,Zt,n,X.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.Center:case Ft.Centroid:a.push(this._geo.center);break;case Ft.Quadrant:a.push(this._geo.getPointAtAngle(0)),a.push(this._geo.getPointAtAngle(Math.PI/2)),a.push(this._geo.getPointAtAngle(Math.PI)),a.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case Ft.Nearest:{const h=this._geo.nearestPoint(e);a.push(h)}break;case Ft.Tangent:{const h=this._geo.tangentPoints(e);a.push(...h);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}};mo.typeName="Circle";let _i=mo;const go=class go extends Me{constructor(t,e,n,a,h,c,g){super(),this._geo=new Hi(t,e,n,a,h,c,g)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:this.closed||(a.push(this._geo.startPoint),a.push(this._geo.endPoint));break;case Ft.MidPoint:this.closed||a.push(this._geo.midPoint);break;case Ft.Quadrant:this.closed&&(a.push(this._geo.getPointAtAngle(0)),a.push(this._geo.getPointAtAngle(Math.PI/2)),a.push(this._geo.getPointAtAngle(Math.PI)),a.push(this._geo.getPointAtAngle(Math.PI/2*3)));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:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}};go.typeName="Ellipse";let yi=go;const fo=class fo extends Ee{constructor(){super(),this._vertices=[new W,new W,new W],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new W),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new Ct().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:a.push(...this._vertices);break}}subWorldDraw(t){const e=this._vertices.length,n=new Float32Array(e*3),a=new Uint16Array(e*2);for(let h=0;h<e;h++)n[h*3]=this._vertices[h].x,n[h*3+1]=this._vertices[h].y,n[h*3+2]=this._vertices[h].z,this.isEdgeVisibleAt(h)&&(a[h*2]=h,a[h*2+1]=(h+1)%4);return t.lineSegments(n,3,a)}};fo.typeName="Face";let vi=fo;var Vs=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(Vs||{}),vh=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(vh||{});const _o=class _o extends Ee{constructor(){super(),this._elevation=0,this._geo=new Gi,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get isSolidFill(){return this._isSolidFill||this._patternName.toUpperCase()==="SOLID"}set isSolidFill(t){this._isSolidFill=t}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}add(t){this._geo.add(t)}get geometricExtents(){const t=this._geo.box;return new Ct({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Vs[0],value:0},{label:Vs[1],value:1},{label:Vs[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){const e=t.subEntityTraits;return e.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,patternLines:this.definitionLines},t.area(this._geo)}};_o.typeName="Hatch";let Gs=_o;var bh=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(bh||{});const yo=class yo extends Me{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}appendVertex(t){this._vertices.push(new W().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Ct().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}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 Qr(this._vertices,"Uniform"),this._updated=!1)}};yo.typeName="Leader";let bi=yo;var Ft=(i=>(i[i.EndPoint=1]="EndPoint",i[i.MidPoint=2]="MidPoint",i[i.Center=3]="Center",i[i.Node=4]="Node",i[i.Quadrant=5]="Quadrant",i[i.Insertion=7]="Insertion",i[i.Perpendicular=8]="Perpendicular",i[i.Tangent=9]="Tangent",i[i.Nearest=10]="Nearest",i[i.Centroid=11]="Centroid",i))(Ft||{});const vo=class vo extends Me{constructor(t,e){super(),this._geo=new Gn(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,n,a){const h=this.startPoint,c=this.endPoint;switch(t){case Ft.EndPoint:a.push(h),a.push(c);break;case Ft.MidPoint:a.push(this.midPoint);break;case Ft.Nearest:{const g=this._geo.project(e);a.push(g)}break;case Ft.Perpendicular:{const g=this._geo.perpPoint(e);a.push(g)}break;case Ft.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,n=this.endPoint,a=[new W(e.x,e.y,0),new W(n.x,n.y,0)];return t.lines(a)}};vo.typeName="Line";let Ws=vo;const bo=class bo extends Ee{constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new W,this._attachmentPoint=be.TopLeft,this._direction=new X(1,0,0),this._drawingDirection=Or.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){return new Ct}subGetOsnapPoints(t,e,n,a){Ft.Insertion===t&&a.push(this._location)}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:be[1],value:1},{label:be[2],value:2},{label:be[3],value:3},{label:be[4],value:4},{label:be[5],value:5},{label:be[6],value:6},{label:be[7],value:7},{label:be[8],value:8},{label:be[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:Or[1],value:1},{label:Or[2],value:2},{label:Or[3],value:3},{label:Or[4],value:4},{label:Or[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;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}subWorldDraw(t,e){const n={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return t.mtext(n,this.getTextStyle(),e)}};bo.typeName="MText";let Hs=bo;const xo=class xo extends Me{constructor(t,e,n,a,h){super();const c=+(t!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(a!==void 0)+ +(h!==void 0);if(c<2||c>5)throw qe.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Qr(t,e,n,a):this._geo=new Qr(t,e,n,a,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:a.push(this._geo.startPoint),a.push(this._geo.endPoint);break}}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}};xo.typeName="Spline";let qs=xo;const ju=new X,wo=class wo extends Wn{constructor(t,e,n){super(t),this._attachmentPoint=be.TopLeft,this._numColumns=n,this._numRows=e,this._columnWidth=new Array(n),this._rowHeight=new Array(e),this._cells=new Array(e*n)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,n){return this._cells[t*e].text}setTextString(t,e,n){this._cells[t*e].text=n}isEmpty(t,e){return!this._cells[t*e].text}get geometricExtents(){return new Ct}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){let e=0,n=0;const a=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let c=0;for(let I=0;I<=this.numRows;I++){e-=I>0?this.rowHeight(I-1):0,n=0;for(let M=0;M<=this.numColumns;M++)n+=M>0?this.columnWidth(M-1):0,h[c++]=n,h[c++]=e,h[c++]=0}const g=[],b=new Array(this.numRows*this.numColumns).fill(!1);n=0,c=0;let f=0;for(let I=0;I<this.numColumns;I++){n+=I>0?this.columnWidth(I-1):0,e=0;for(let M=0;M<this.numRows;M++){e+=M>0?this.rowHeight(M-1):0;const L=this.cell(M*this.numColumns+I);if(f=M*this.numColumns+I,L&&!b[f]){const O=L.borderWidth??1,F=L.borderHeight??1;this.fillVisited(b,f,this.numColumns,O,F),a[c++]=I+M*(this.numColumns+1),a[c++]=I+M*(this.numColumns+1)+O;const D=h[a[c-1]*3]-n,dt=I+(M+F)*(this.numColumns+1)+O;I+O==this.numColumns&&(a[c++]=I+M*(this.numColumns+1)+O,a[c++]=dt);const vt=-h[dt*3+1]-e;if(M+F==this.numRows&&(a[c++]=I+(M+F)*(this.numColumns+1)+F,a[c++]=I+(M+F)*(this.numColumns+1)),a[c++]=I+(M+F)*(this.numColumns+1),a[c++]=I+M*(this.numColumns+1),L.text){const ot=L.attachmentPoint||this.attachmentPoint||be.MiddleCenter,H=this.getTableTextOffset(ot,D,vt),ct={text:L.text,height:L.textHeight,width:D,position:ju.set(n,-e,0).clone().add(H),rotation:this.rotation,attachmentPoint:ot},st=this.getTextStyle(L);g.push(t.mtext(ct,st))}}}}g.push(t.lineSegments(h,3,a));const w=t.group(g),x=new $r;return x.setFromAxisAngle(X.Z_AXIS,this.rotation),ul.compose(this.position,x,this.scaleFactors),w.applyMatrix(ul),this.attachEntityInfo(w),w}fillVisited(t,e,n,a,h){if(h==1&&a==1)t[e]=!0;else for(let c=0;c<a;++c)for(let g=0;g<h;++g)t[e+c+g*n]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let n;return t.textStyle&&(n=e.getAt(t.textStyle)),n||(n=e.getAt("STANDARD")||e.getAt("Standard")),n.textStyle}getTableTextOffset(t,e,n){const a=new X;switch(t){case 1:break;case 2:a.setX(e/2);break;case 3:a.setX(e);break;case 4:a.setY(-n/2);break;case 5:a.set(e/2,-n/2,0);break;case 6:a.set(e,-n/2,0);break;case 7:a.setY(-n);break;case 8:a.set(e/2,-n,0);break;case 9:a.set(e,-n,0);break}return a}};wo.typeName="Table";let xi=wo;const ul=new Zr;var xh=(i=>(i[i.LEFT=0]="LEFT",i[i.CENTER=1]="CENTER",i[i.RIGHT=2]="RIGHT",i[i.ALIGNED=3]="ALIGNED",i[i.MIDDLE=4]="MIDDLE",i[i.FIT=5]="FIT",i))(xh||{}),wh=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(wh||{});const Ao=class Ao extends Ee{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new W,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){return new Ct}subGetOsnapPoints(t,e,n,a){Ft.Insertion===t&&a.push(this._position)}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;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}subWorldDraw(t,e){const n={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Or.BOTTOM_TO_TOP,attachmentPoint:be.BottomLeft};return t.mtext(n,this.getTextStyle(),e)}};Ao.typeName="Text";let wi=Ao;const Po=class Po extends Me{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new W,new W,new W,new W]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new Ct().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:a.push(...this._vertices);break}}subWorldDraw(t){const e=new xn(this._vertices,!0),n=new Gi;n.add(e);const a=t.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,patternLines:[]},t.area(n)}};Po.typeName="Trace";let Ai=Po;const So=class So extends Me{constructor(){super(),this._elevation=0,this._geo=new xn}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,n=0,a=-1,h=-1){const c=a<0?void 0:a,g=h<0?void 0:h,b={x:e.x,y:e.y,bulge:n,startWidth:c,endWidth:g};this._geo.addVertexAt(t,b)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new W(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new Ct({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}subGetOsnapPoints(t,e,n,a){const h=new Array;for(let c=0;c<this.numberOfVertices;++c)h.push(this.getPoint3dAt(c));switch(t){case Ft.EndPoint:a.push(...h);break}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,this.elevation))),t.lines(e)}};So.typeName="Polyline";let Pi=So;const Io=class Io extends Ee{constructor(){super(),this._geo=new W}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new Ct().expandByPoint(this._geo)}subGetOsnapPoints(t,e,n,a){Ft.Node===t&&a.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})}};Io.typeName="Point";let Si=Io;var Ah=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(Ah||{}),Ph=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(Ph||{});const Eo=class Eo extends Ee{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new W,this._scale=new Jt(1,1),this._rotation=0,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 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.dictionaries.imageDefs.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new Ct;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,n=this._height,a=new xe;a.setFromPoints(this._clipBoundary);const h=new Tt;h.setX(this._position.x-a.min.x*e),h.setY(this._position.y-a.min.y*n),this._clipBoundary.forEach(c=>{const g=c.x*e+h.x,b=c.y*n+h.y;t.push(new W(g,b,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){dl.copy(t[1]);for(let e=1;e<4;e++)ri.copy(t[e]),ri.rotateAround(dl,this._rotation),t[e].setX(ri.x),t[e].setY(ri.y)}t.push(t[0])}return t}};Eo.typeName="RasterImage";let Ys=Eo;const dl=new Tt,ri=new Tt,Mo=class Mo extends Me{constructor(){super(),this._basePoint=new W,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 geometricExtents(){const t=new Ct;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subGetOsnapPoints(t,e,n,a){switch(t){case Ft.EndPoint:a.push(this.basePoint);break}}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}};Mo.typeName="Ray";let Ii=Mo;const ko=class ko extends Ee{constructor(){super(),this._centerPoint=new W,this._height=0,this._width=0,this._viewCenter=new W,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){return new Ct}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport(),n=t.group(this.createViewportRect(e,t));return this.attachEntityInfo(n),n}}toGiViewport(){const t=new mh;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const n=[];return n.push(e.lines([new W(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new W(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),n.push(e.lines([new W(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new W(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),n.push(e.lines([new W(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new W(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),n.push(e.lines([new W(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new W(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),n}};ko.typeName="Viewport";let Ei=ko;const To=class To extends Ys{subWorldDraw(t){const e=this.boundaryPath(),n=new Gi;return n.add(new xn(e)),t.area(n)}};To.typeName="Wipeout";let Mi=To;const Co=class Co extends Me{constructor(){super(),this._basePoint=new W,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 geometricExtents(){const t=new Ct;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}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)}};Co.typeName="Xline";let ki=Co;var Sh=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(Sh||{});const No=class No extends Ee{constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new W,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new W,this._textRotation=0,this._normal=new X(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(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}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new Hn),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()}subWorldDraw(t){if(this.dimBlockId){const n=this.database.tables.blockTable.getAt(this.dimBlockId);if(n){const a=new Zr().makeTranslation(this.dimBlockPosition),h=Yn.instance.draw(t,n,this.rgbColor,!1,a,this.normal);return this.attachEntityInfo(h),h}}const e=t.group([]);return this.attachEntityInfo(e),e}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,n){const a=new W().subVectors(e,t).normalize();return new W(e).addScaledVector(a,n)}findPointOnLine2(t,e,n){const a=t.x+n*Math.cos(e),h=t.y+n*Math.sin(e);return{x:a,y:h}}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():qa.Closed}};No.typeName="Dimension";let Br=No;const Lo=class Lo extends Br{constructor(t,e,n,a,h=null,c=null){super(),this._centerPoint=new W().copy(t),this._xLine1Point=new W().copy(e),this._xLine2Point=new W().copy(n),this._arcPoint=new W().copy(a),this.dimensionText=h,this.dimensionStyleName=c}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 geometricExtents(){return new Ct}};Lo.typeName="3PointAngularDimension";let Ti=Lo;const Oo=class Oo extends Br{constructor(t,e,n,a=null,h=null){super(),this._dimLinePoint=new W().copy(n),this._xLine1Point=new W().copy(t),this._xLine2Point=new W().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),a?this.dimensionText=a:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=h}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 geometricExtents(){return new Ct}get isAppendArrow(){return!1}createDimBlock(t){const e=new le;e.name=t;const n=this.createLines();n.forEach(g=>e.appendEntity(new Ws(g.startPoint,g.endPoint))),this.createArrows(n[0]).forEach(g=>e.appendEntity(g));const h=n[0].midPoint,c=this.createMText(h,this._rotation);return c&&e.appendEntity(c),e}createMText(t,e){const n=a=>({x:Math.cos(a),y:Math.sin(a),z:0});if(this.dimensionText){const a=new Hs;return a.attachmentPoint=be.MiddleLeft,a.layer="0",a.color=new zr(pt.ByBlock),a.location=t,a.contents=this.dimensionText??"",a.height=10,a.direction=n(e),a.styleName=this.dimensionStyle.dimtxsty,a}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,n){const a="_CAXARROW",h=new Wn(a);return h.position=t,h.rotation=e,h.scaleFactors={x:n,y:n,z:n},h}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),n=this.createExtensionLine(this._xLine2Point),a=this.findIntersectionPoint(e,this._dimLinePoint),h=this.findIntersectionPoint(n,this._dimLinePoint),c=new Gn(a,h);return t.push(c),e.endPoint=a,this.adjustExtensionLine(e),t.push(e),n.endPoint=h,this.adjustExtensionLine(n),t.push(n),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,n=this.findPointOnLine2(t,e,100);return new Gn(t,{...n,z:t.z})}findIntersectionPoint(t,e){const n=t.startPoint,a=t.endPoint,h=new X().subVectors(a,n).normalize(),g=new X().subVectors(e,n).dot(h),b=new X().copy(h).multiplyScalar(g);return new X().addVectors(n,b)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,n=e.x-t.x,a=e.y-t.y;this._rotation=Math.atan2(a,n)}};Oo.typeName="AlignedDimension";let Ci=Oo;const Bo=class Bo extends Br{constructor(t,e,n,a,h=null,c=null){super(),this._arcPoint=new W().copy(a),this._xLine1Point=new W().copy(e),this._xLine2Point=new W().copy(n),this._centerPoint=new W().copy(t),this.dimensionText=h,this.dimensionStyleName=c}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 geometricExtents(){return new Ct}};Bo.typeName="ArcDimension";let Ea=Bo;const zo=class zo extends Br{constructor(t,e,n=0,a=null,h=null){super(),this._chordPoint=new W().copy(t),this._farChordPoint=new W().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=n,this.dimensionText=a,this.dimensionStyleName=h}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}get geometricExtents(){return new Ct}drawLines(t,e){const n=[],a=e.length;return a==1?n.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):a==3?(this.sortLines(e),n.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),n.push(this.drawLine(t,e[1])),n.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(h=>{n.push(this.drawLine(t,h))}),n}drawLine(t,e,n){if(n){const a=[e.startPoint,e.endPoint];return t.lines(a)}else return e.worldDraw(t)}sortLines(t){const e=(n,a)=>n.x!==a.x?n.x-a.x:n.y!==a.y?n.y-a.y:n.z-a.z;t.sort((n,a)=>{const h=e(n.startPoint,a.startPoint);return h!==0?h:e(n.endPoint,a.endPoint)})}};zo.typeName="DiametricDimension";let Ni=zo;const Ro=class Ro extends Br{constructor(t,e,n=null,a=null){super(),this._definingPoint=new W().copy(t),this._leaderEndPoint=new W().copy(e),this.dimensionText=n,this.dimensionStyleName=a}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 geometricExtents(){return new Ct}get arrowLineCount(){return 0}};Ro.typeName="OrdinateDimension";let Li=Ro;const Do=class Do extends Br{constructor(t,e,n,a=null,h=null){super(),this._center=new W().copy(t),this._chordPoint=new W().copy(e),this._leaderLength=n,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=a,this.dimensionStyleName=h}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 leaderLenght(t){this._leaderLength=t}get geometricExtents(){return new Ct}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}};Do.typeName="RadialDimension";let Oi=Do;class Yi extends Jr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new xe,this._extents=new Ct}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)}}class $a extends Jr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,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((n,a)=>{n===e&&(this._recordsByName.delete(a),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:a}))}),!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 Xi(this._recordsByName)}}class Ih extends $a{getBtrIdAt(t){for(const[e,n]of this._recordsByName)if(n.blockTableRecordId==t)return n}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class Eh extends Jr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}}class Mh{constructor(t){this.db=t}createDefaultLayer(){const t=new zr;return t.colorIndex=7,this.db.tables.layerTable.add(new $i({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new js({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new js({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new js({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new no({name:"Standard",standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new Hn({name:"Standard",dimtxsty:"Standard"}))}createDefaultLayout(){const t=new Yi;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.dictionaries.layouts.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new Gs;e.patternName="SOLID";const n=new Ha;n.add(new Ds({x:0,y:0},{x:-1,y:.125})),n.add(new Ds({x:-1,y:.125},{x:-1,y:-.125})),n.add(new Ds({x:-1,y:-.125},{x:0,y:0})),e.add(n);const a=new le;a.name="_CAXARROW",a.appendEntity(e),this.db.tables.blockTable.add(a)}}}var kh=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(kh||{});class Xi{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}}}var Za=(i=>(i[i.Undefined=0]="Undefined",i[i.Inches=1]="Inches",i[i.Feet=2]="Feet",i[i.Miles=3]="Miles",i[i.Millimeters=4]="Millimeters",i[i.Centimeters=5]="Centimeters",i[i.Meters=6]="Meters",i[i.Kilometers=7]="Kilometers",i[i.Microinches=8]="Microinches",i[i.Mils=9]="Mils",i[i.Yards=10]="Yards",i[i.Angstroms=11]="Angstroms",i[i.Nanometers=12]="Nanometers",i[i.Microns=13]="Microns",i[i.Decimeters=14]="Decimeters",i[i.Dekameters=15]="Dekameters",i[i.Hectometers=16]="Hectometers",i[i.Gigameters=17]="Gigameters",i[i.Astronomical=18]="Astronomical",i[i.LightYears=19]="LightYears",i[i.Parsecs=20]="Parsecs",i[i.USSurveyFeet=21]="USSurveyFeet",i[i.USSurveyInch=22]="USSurveyInch",i[i.USSurveyYard=23]="USSurveyYard",i[i.USSurveyMile=24]="USSurveyMile",i[i.Max=24]="Max",i))(Za||{});function Gu(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function Wu(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}const Th="Load Database";class Ne extends Il{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Ta.getInstance().getEntry(Th),n=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const a=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",a?a.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-n),a}}class Qa{constructor(t={}){this.config=t}async read(t,e,n,a){const h={name:Th,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(w=>{w!=="total"&&(f+=`- ${w}: ${this.data[w]} ms
|
|
5
|
+
`)}),f+=`- total: ${this.data.total} ms`,f}};Ta.getInstance().collect(h),this.progress=a;const c={value:0},g=new El;g.setCompleteCallback(()=>this.onFinished()),g.setErrorCallback(f=>this.onError(f)),g.addTask(new Ne({stage:"START",step:1,progress:c,task:async f=>f},a)),g.addTask(new Ne({stage:"PARSE",step:5,progress:c,task:async f=>await this.parse(f)},a)),g.addTask(new Ne({stage:"FONT",step:5,progress:c,task:async f=>{const w=this.getFonts(f.model);return{model:f.model,data:w}}},a)),g.addTask(new Ne({stage:"LTYPE",step:1,progress:c,task:async f=>(this.processLineTypes(f.model,e),f)},a)),g.addTask(new Ne({stage:"STYLE",step:1,progress:c,task:async f=>(this.processTextStyles(f.model,e),f)},a)),g.addTask(new Ne({stage:"DIMSTYLE",step:1,progress:c,task:async f=>(this.processDimStyles(f.model,e),f)},a)),g.addTask(new Ne({stage:"LAYER",step:1,progress:c,task:async f=>(this.processLayers(f.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),f)},a)),g.addTask(new Ne({stage:"VPORT",step:1,progress:c,task:async f=>(this.processViewports(f.model,e),f)},a)),g.addTask(new Ne({stage:"HEADER",step:1,progress:c,task:async f=>(this.processHeader(f.model,e),f)},a)),g.addTask(new Ne({stage:"BLOCK_RECORD",step:5,progress:c,task:async f=>(this.processBlockTables(f.model,e),f)},a)),g.addTask(new Ne({stage:"OBJECT",step:5,progress:c,task:async f=>(this.processObjects(f.model,e),e.dictionaries.layouts.numEntries===0&&e.createDefaultData({layout:!0}),f)},a)),g.addTask(new Ne({stage:"BLOCK",step:5,progress:c,task:async f=>(await this.processBlocks(f.model,e),f)},a)),g.addTask(new Ne({stage:"ENTITY",step:100,progress:c,task:async f=>(await this.processEntities(f.model,e,n,c,a),f)},a)),g.addTask(new Ne({stage:"END",step:0,progress:c,task:async f=>f},a));const b=Date.now();await g.run(t),h.data.total=Date.now()-b}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),Yn.instance.clear())}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,n,a,h){throw new Error("Not impelemented yet!")}}var de,_s,ee,ae,ys,sr,Ae,br,ir,on,vs,bs,ln,hn,xs,ws,As,Fe,xr,Xt,cn,Ps,yt,Pe,Ss,Se,Is,wr,Ar,ar,Es,un,Ve,Pr,dn,ua,da,Sr,Ir,Ms,ks,Er,Ts,pa,ma,pe,Mr,me,Ue,ga,fa,_a,ya,kr,je,pn,Cs,mn,Ge,Tr,We,Cr;(de={})[de.None=0]="None",de[de.Anonymous=1]="Anonymous",de[de.NonConstant=2]="NonConstant",de[de.Xref=4]="Xref",de[de.XrefOverlay=8]="XrefOverlay",de[de.ExternallyDependent=16]="ExternallyDependent",de[de.ResolvedOrDependent=32]="ResolvedOrDependent",de[de.ReferencedXref=64]="ReferencedXref";(_s={})[_s.BYBLOCK=0]="BYBLOCK",_s[_s.BYLAYER=256]="BYLAYER";(ee={})[ee.Rotated=0]="Rotated",ee[ee.Aligned=1]="Aligned",ee[ee.Angular=2]="Angular",ee[ee.Diameter=3]="Diameter",ee[ee.Radius=4]="Radius",ee[ee.Angular3Point=5]="Angular3Point",ee[ee.Ordinate=6]="Ordinate",ee[ee.ReferenceIsExclusive=32]="ReferenceIsExclusive",ee[ee.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",ee[ee.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(ae={})[ae.TopLeft=1]="TopLeft",ae[ae.TopCenter=2]="TopCenter",ae[ae.TopRight=3]="TopRight",ae[ae.MiddleLeft=4]="MiddleLeft",ae[ae.MiddleCenter=5]="MiddleCenter",ae[ae.MiddleRight=6]="MiddleRight",ae[ae.BottomLeft=7]="BottomLeft",ae[ae.BottomCenter=8]="BottomCenter",ae[ae.BottomRight=9]="BottomRight";(ys={})[ys.AtLeast=1]="AtLeast",ys[ys.Exact=2]="Exact";var pl=((sr={})[sr.Center=0]="Center",sr[sr.Above=1]="Above",sr[sr.Outside=2]="Outside",sr[sr.JIS=3]="JIS",sr[sr.Below=4]="Below",sr),Fn=((Ae={})[Ae.Feet=0]="Feet",Ae[Ae.None=1]="None",Ae[Ae.Inch=2]="Inch",Ae[Ae.FeetAndInch=3]="FeetAndInch",Ae[Ae.Leading=4]="Leading",Ae[Ae.Trailing=8]="Trailing",Ae[Ae.LeadingAndTrailing=12]="LeadingAndTrailing",Ae),Hu=((br={})[br.None=0]="None",br[br.Leading=1]="Leading",br[br.Trailing=2]="Trailing",br[br.LeadingAndTrailing=3]="LeadingAndTrailing",br),qu=((ir={})[ir.Center=0]="Center",ir[ir.Left=1]="Left",ir[ir.Right=2]="Right",ir[ir.OverFirst=3]="OverFirst",ir[ir.OverSecond=4]="OverSecond",ir),Yu=((on={})[on.Bottom=0]="Bottom",on[on.Center=1]="Center",on[on.Top=2]="Top",on),Xu=((vs={})[vs.PatternFill=0]="PatternFill",vs[vs.SolidFill=1]="SolidFill",vs);(bs={})[bs.NonAssociative=0]="NonAssociative",bs[bs.Associative=1]="Associative";(ln={})[ln.Normal=0]="Normal",ln[ln.Outer=1]="Outer",ln[ln.Ignore=2]="Ignore";(hn={})[hn.UserDefined=0]="UserDefined",hn[hn.Predefined=1]="Predefined",hn[hn.Custom=2]="Custom";(xs={})[xs.NotAnnotated=0]="NotAnnotated",xs[xs.Annotated=1]="Annotated";(ws={})[ws.Solid=0]="Solid",ws[ws.Gradient=1]="Gradient";(As={})[As.TwoColor=0]="TwoColor",As[As.OneColor=1]="OneColor";var Ku=((Fe={})[Fe.Default=0]="Default",Fe[Fe.External=1]="External",Fe[Fe.Polyline=2]="Polyline",Fe[Fe.Derived=4]="Derived",Fe[Fe.Textbox=8]="Textbox",Fe[Fe.Outermost=16]="Outermost",Fe),ni=((xr={})[xr.Line=1]="Line",xr[xr.Circular=2]="Circular",xr[xr.Elliptic=3]="Elliptic",xr[xr.Spline=4]="Spline",xr),$u=((Xt={})[Xt.Off=0]="Off",Xt[Xt.Solid=1]="Solid",Xt[Xt.Dashed=2]="Dashed",Xt[Xt.Dotted=3]="Dotted",Xt[Xt.ShotDash=4]="ShotDash",Xt[Xt.MediumDash=5]="MediumDash",Xt[Xt.LongDash=6]="LongDash",Xt[Xt.DoubleShortDash=7]="DoubleShortDash",Xt[Xt.DoubleMediumDash=8]="DoubleMediumDash",Xt[Xt.DoubleLongDash=9]="DoubleLongDash",Xt[Xt.DoubleMediumLongDash=10]="DoubleMediumLongDash",Xt[Xt.SparseDot=11]="SparseDot",Xt);$u.Off;(cn={})[cn.Standard=-3]="Standard",cn[cn.ByLayer=-2]="ByLayer",cn[cn.ByBlock=-1]="ByBlock";(Ps={})[Ps.English=0]="English",Ps[Ps.Metric=1]="Metric";(yt={})[yt.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",yt[yt.FRONT_CLIPPING=2]="FRONT_CLIPPING",yt[yt.BACK_CLIPPING=4]="BACK_CLIPPING",yt[yt.UCS_FOLLOW=8]="UCS_FOLLOW",yt[yt.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",yt[yt.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",yt[yt.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",yt[yt.FAST_ZOOM=128]="FAST_ZOOM",yt[yt.SNAP_MODE=256]="SNAP_MODE",yt[yt.GRID_MODE=512]="GRID_MODE",yt[yt.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",yt[yt.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",yt[yt.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",yt[yt.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",yt[yt.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",yt[yt.UNUSED=32768]="UNUSED",yt[yt.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",yt[yt.VIEWPORT_OFF=131072]="VIEWPORT_OFF",yt[yt.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",yt[yt.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",yt[yt.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",yt[yt.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(Pe={})[Pe.OPTIMIZED_2D=0]="OPTIMIZED_2D",Pe[Pe.WIREFRAME=1]="WIREFRAME",Pe[Pe.HIDDEN_LINE=2]="HIDDEN_LINE",Pe[Pe.FLAT_SHADED=3]="FLAT_SHADED",Pe[Pe.GOURAUD_SHADED=4]="GOURAUD_SHADED",Pe[Pe.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",Pe[Pe.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(Ss={})[Ss.UCS_UNCHANGED=0]="UCS_UNCHANGED",Ss[Ss.HAS_OWN_UCS=1]="HAS_OWN_UCS";(Se={})[Se.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",Se[Se.TOP=1]="TOP",Se[Se.BOTTOM=2]="BOTTOM",Se[Se.FRONT=3]="FRONT",Se[Se.BACK=4]="BACK",Se[Se.LEFT=5]="LEFT",Se[Se.RIGHT=6]="RIGHT";(Is={})[Is.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Is[Is.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(wr={})[wr.ByLayer=0]="ByLayer",wr[wr.ByBlock=1]="ByBlock",wr[wr.ByDictionaryDefault=2]="ByDictionaryDefault",wr[wr.ByObject=3]="ByObject";function St(i,t,e){return i.code===t&&(e==null||i.value===e)}function Rt(i){let t={};i.rewind();let e=i.next(),n=e.code;if(t.x=e.value,(e=i.next()).code!==n+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=i.next()).code!==n+20?i.rewind():t.z=e.value,t}let Ja=Symbol();function xt(i,t){return(e,n,a)=>{let h=function(b,f=!1){return b.reduce((w,x)=>{x.pushContext&&w.push({});let I=w[w.length-1];for(let M of typeof x.code=="number"?[x.code]:x.code){let L=I[M]??(I[M]=[]);x.isMultiple&&L.length&&f&&console.warn(`Snippet ${L[L.length-1].name} for code(${M}) is shadowed by ${x.name}`),L.push(x)}return w},[{}])}(i,n.debug),c=!1,g=h.length-1;for(;!St(e,0,"EOF");){let b=function(F,D,dt){return F.find((vt,ot)=>{var H;return ot>=dt&&((H=vt[D])==null?void 0:H.length)})}(h,e.code,g),f=b==null?void 0:b[e.code],w=f==null?void 0:f[f.length-1];if(!b||!w){n.rewind();break}w.isMultiple||b[e.code].pop();let{name:x,parser:I,isMultiple:M,isReducible:L}=w,O=I==null?void 0:I(e,n,a);if(O===Ja){n.rewind();break}if(x){let[F,D]=function(dt,vt){let ot=vt.split(".");if(!ot.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let H=dt;for(let ct=0;ct<ot.length-1;++ct){let st=va(ot[ct]),Gt=va(ot[ct+1]);Object.prototype.hasOwnProperty.call(H,st)||(typeof Gt=="number"?H[st]=[]:H[st]={}),H=H[st]}return[H,va(ot[ot.length-1])]}(a,x);M&&!L?(Object.prototype.hasOwnProperty.call(F,D)||(F[D]=[]),F[D].push(O)):F[D]=O}w.pushContext&&(g-=1),c=!0,e=n.next()}return t&&Object.setPrototypeOf(a,t),c}}function va(i){let t=Number.parseInt(i);return Number.isNaN(t)?i:t}function v({value:i}){return i}function G(i,t){return Rt(t)}function Vt({value:i}){return!!i}let Zu=[{code:1001,name:"xdata",parser:Ch}];function Ch(i,t){var a;if(!St(i,1001))throw Error("XData must starts with code 1001");let e={appName:i.value,value:[]};i=t.next();let n=[e.value];for(;!St(i,0,"EOF")&&i.code>=1e3;){let h=n[n.length-1];switch(i.code){case 1002:i.value==="{"?n.push([]):(n.pop(),(a=n[n.length-1])==null||a.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:Nr(i.code),value:i.value});break;case 1003:h.push({name:"layer",type:Nr(i.code),value:i.value});break;case 1005:h.push({name:"handle",type:Nr(i.code),value:i.value});break;case 1010:h.push({type:Nr(i.code),value:Rt(t)});break;case 1011:h.push({name:"worldSpacePosition",type:Nr(i.code),value:Rt(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:Nr(i.code),value:Rt(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:Nr(i.code),value:Rt(t)});break;case 1041:h.push({name:"distance",type:Nr(i.code),value:i.value});break;case 1042:h.push({name:"scale",type:Nr(i.code),value:i.value})}i=t.next()}return t.rewind(),e}function Nr(i){switch(i){case 1e3:case 1003:case 1005:return"string";case 1004:return"hex";case 1040:case 1041:case 1042:return"real";case 1070:return"integer";case 1071:return"long";case 1010:case 1011:case 1012:case 1013:return"point";default:return""}}function bn(i,t,e){for(;St(i,102);){var n;let a=i.value;if(i=t.next(),!a.startsWith("{")){t.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${a}`),function(c,g){for(;!St(c,102)&&!St(c,0,"EOF");)c=g.next()}(i,t),i=t.next();continue}let h=a.slice(1).trim();e.extensions??(e.extensions={}),(n=e.extensions)[h]??(n[h]=[]),function(c,g,b){for(;!St(c,102,"}")&&!St(c,0,"EOF");)b.push(c),c=g.next()}(i,t,e.extensions[h]),i=t.next()}t.rewind()}let Qu=0;function Nh(i){if(!i)throw TypeError("entity cannot be undefined or null");i.handle||(i.handle=Qu++)}var Ju=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function Lh(i){return Ju[i]}(Ar={})[Ar.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Ar[Ar.CAST=1]="CAST",Ar[Ar.RECEIVE=2]="RECEIVE",Ar[Ar.IGNORE=3]="IGNORE";let jt=[...Zu,{code:284,name:"shadowMode",parser:v},{code:390,name:"plotStyleHardId",parser:v},{code:380,name:"plotStyleType",parser:v},{code:440,name:"transparency",parser:v},{code:430,name:"colorName",parser:v},{code:420,name:"color",parser:v},{code:310,name:"proxyEntity",isMultiple:!0,parser:v},{code:92,name:"proxyByte",parser:v},{code:60,name:"isVisible",parser:Vt},{code:48,name:"lineTypeScale",parser:v},{code:370,name:"lineweight",parser:v},{code:62,name:"colorIndex",parser(i,t,e){let n=i.value;return n>0&&n<256&&(e.color=Lh(Math.abs(n))),n}},{code:347,name:"materialObjectHardId",parser:v},{code:6,name:"lineType",parser:v},{code:8,name:"layer",parser:v},{code:410,name:"layoutTabName",parser:v},{code:67,name:"isInPaperSpace",parser:Vt},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:v},{code:102,parser:bn},{code:102,parser:bn},{code:102,parser:bn},{code:5,name:"handle",parser:v}];function Ki(i){return[{code:3,name:i,parser:(t,e,n)=>(n._code3text=(n._code3text??"")+t.value,n._code3text+(n._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:i,parser:(t,e,n)=>(n._code1text=t.value,(n._code3text??"")+n._code1text)}]}function Oh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let td={extrusionDirection:{x:0,y:0,z:1}},ed=[{code:210,name:"extrusionDirection",parser:G},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:100,name:"subclassMarker",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:v},{code:100},...jt];class Bh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Oh(this,"parser",xt(ed,td))}}Oh(Bh,"ForEntityName","ARC");(ar={})[ar.NONE=0]="NONE",ar[ar.INVISIBLE=1]="INVISIBLE",ar[ar.CONSTANT=2]="CONSTANT",ar[ar.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",ar[ar.PRESET=8]="PRESET";(Es={})[Es.MULTILINE=2]="MULTILINE",Es[Es.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(un={})[un.NONE=0]="NONE",un[un.MIRRORED_X=2]="MIRRORED_X",un[un.MIRRORED_Y=4]="MIRRORED_Y";var rd=((Ve={})[Ve.LEFT=0]="LEFT",Ve[Ve.CENTER=1]="CENTER",Ve[Ve.RIGHT=2]="RIGHT",Ve[Ve.ALIGNED=3]="ALIGNED",Ve[Ve.MIDDLE=4]="MIDDLE",Ve[Ve.FIT=5]="FIT",Ve),nd=((Pr={})[Pr.BASELINE=0]="BASELINE",Pr[Pr.BOTTOM=1]="BOTTOM",Pr[Pr.MIDDLE=2]="MIDDLE",Pr[Pr.TOP=3]="TOP",Pr);function zh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Rh={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:rd.LEFT,valign:nd.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Dh=[{code:73,name:"valign",parser:v},{code:100},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:72,name:"valign",parser:v},{code:72,name:"halign",parser:v},{code:71,name:"generationFlag",parser:v},{code:7,name:"styleName",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"xScale",parser:v},{code:50,name:"rotation",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class Fh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){zh(this,"parser",xt(Dh,Rh))}}function Vh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}zh(Fh,"ForEntityName","TEXT");let sd={...Rh},id=[{code:2},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Vt},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedRecord",parser:Vt},{code:100},{code:280,name:"isLocked",parser:Vt},{code:74,name:"valign",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:3,name:"prompt",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},...Dh.slice(2)];class Uh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Vh(this,"parser",xt(id,sd))}}Vh(Uh,"ForEntityName","ATTDEF");(dn={})[dn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",dn[dn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",dn[dn.BY_STYLE=5]="BY_STYLE";function ad(i,t){let e={};for(let n of i){let a=t(n);a!=null&&(e[a]??(e[a]=[]),e[a].push(n))}return e}function*Bi(i,t=1/0,e=1){for(let n=i;n!==t;n+=e)yield n}function Xr(i){return{x:i.x??0,y:i.y??0,z:i.z??0}}function to(i,t,e){if(St(t,102))return bn(t,e,i),!0;switch(t.code){case 0:i.type=t.value;break;case 5:i.handle=t.value;break;case 330:i.ownerBlockRecordSoftId=t.value;break;case 67:i.isInPaperSpace=!!t.value;break;case 8:i.layer=t.value;break;case 6:i.lineType=t.value;break;case 347:i.materialObjectHardId=t.value;break;case 62:i.colorIndex=t.value,i.color=Lh(Math.abs(t.value));break;case 370:i.lineweight=t.value;break;case 48:i.lineTypeScale=t.value;break;case 60:i.isVisible=!!t.value;break;case 92:i.proxyByte=t.value;break;case 310:i.proxyEntity=t.value;break;case 100:break;case 420:i.color=t.value;break;case 430:i.transparency=t.value;break;case 390:i.plotStyleHardId=t.value;break;case 284:i.shadowMode=t.value;break;case 1001:i.xdata=Ch(t,e);break;default:return!1}return!0}function jh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let od={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},oi=[{code:46,name:"annotationHeight",parser:v},{code:101,parser(i,t){(function(e){e.rewind();let n=e.next();if(n.code!==101)throw Error("Bad call for skipEmbeddedObject()");do n=e.next();while(n.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:v},{code:49,name:"columnGutter",parser:v},{code:48,name:"columnWidth",parser:v},{code:79,name:"columnAutoHeight",parser:v},{code:78,name:"columnFlowReversed",parser:v},{code:76,name:"columnCount",parser:v},{code:75,name:"columnType",parser:v},{code:441,name:"backgroundFillTransparency",parser:v},{code:63,name:"backgroundFillColor",parser:v},{code:45,name:"fillBoxScale",parser:v},{code:[...Bi(430,440)],name:"backgroundColor",parser:v},{code:[...Bi(420,430)],name:"backgroundColor",parser:v},{code:90,name:"backgroundFill",parser:v},{code:44,name:"lineSpacing",parser:v},{code:73,name:"lineSpacingStyle",parser:v},{code:50,name:"rotation",parser:v},{code:43},{code:42},{code:11,name:"direction",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:7,name:"styleName",parser:v},...Ki("text"),{code:72,name:"drawingDirection",parser:v},{code:71,name:"attachmentPoint",parser:v},{code:41,name:"width",parser:v},{code:40,name:"height",parser:v},{code:10,name:"insertionPoint",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class Gh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){jh(this,"parser",xt(oi,od))}}function Wh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}jh(Gh,"ForEntityName","MTEXT");let ld={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},hd=[...oi.slice(oi.findIndex(({name:i})=>i==="columnType"),oi.findIndex(({name:i})=>i==="subclassMarker")+1),{code:100},{code:0,parser(i){if(!St(i,0,"MTEXT"))return Ja}},{code:2,name:"definitionTag",parser:v},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardId",parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Vt},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedEntriesKeep",parser:Vt},{code:100},{code:280,name:"lockPositionFlag",parser:Vt},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"alignmentPoint",parser:G},{code:74,name:"verticalJustification",parser:v},{code:72,name:"horizontalJustification",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:7,name:"textStyle",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"scale",parser:v},{code:50,name:"rotation",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:v},{code:100},...jt];class Hh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Wh(this,"parser",xt(hd,ld))}}function qh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Wh(Hh,"ForEntityName","ATTRIB");let cd=[...Ki("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class Yh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){qh(this,"parser",xt(cd))}}function Xh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}qh(Yh,"ForEntityName","BODY");let ud={thickness:0,extrusionDirection:{x:0,y:0,z:1}},dd=[{code:210,name:"extrusionDirection",parser:G},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class Kh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Xh(this,"parser",xt(dd,ud))}}Xh(Kh,"ForEntityName","CIRCLE");class li{parseEntity(t,e){let n={};for(;!St(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(a,h,c){switch(h.code){case 100:a.subclassMarker=h.value;break;case 280:a.version=h.value;break;case 2:a.name=h.value;break;case 10:a.definitionPoint=Rt(c);break;case 11:a.textPoint=Rt(c);break;case 12:a.insertionPoint=Rt(c);break;case 13:a.subDefinitionPoint1=Rt(c);break;case 14:a.subDefinitionPoint2=Rt(c);break;case 15:a.centerPoint=Rt(c);break;case 16:a.arcPoint=Rt(c);break;case 70:a.dimensionType=h.value;break;case 71:a.attachmentPoint=h.value;break;case 72:a.textLineSpacingStyle=h.value;break;case 40:a.leaderLength=h.value;break;case 41:a.textLineSpacingFactor=h.value;break;case 42:a.measurement=h.value;break;case 1:a.text=h.value;break;case 50:a.rotationAngle=h.value;break;case 52:a.obliqueAngle=h.value;break;case 53:a.textRotation=h.value;break;case 51:a.ocsRotation=h.value;break;case 210:a.extrusionDirection=Rt(c);break;case 3:a.styleName=h.value;break;default:to(a,h,c)}})(n,e,t),e=t.next()}return n}}function $h(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}da="DIMENSION",(ua="ForEntityName")in li?Object.defineProperty(li,ua,{value:da,enumerable:!0,configurable:!0,writable:!0}):li[ua]=da;let pd={extrusionDirection:{x:0,y:0,z:1}},md=[{code:42,name:"endAngle",parser:v},{code:41,name:"startAngle",parser:v},{code:40,name:"axisRatio",parser:v},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"majorAxisEndPoint",parser:G},{code:10,name:"center",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class Zh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){$h(this,"parser",xt(md,pd))}}$h(Zh,"ForEntityName","ELLIPSE");(Sr={})[Sr.First=1]="First",Sr[Sr.Second=2]="Second",Sr[Sr.Third=4]="Third",Sr[Sr.Fourth=8]="Fourth";function Qh(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let gd=[{code:13,name:"vertices.3",parser:G},{code:12,name:"vertices.2",parser:G},{code:11,name:"vertices.1",parser:G},{code:10,name:"vertices.0",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class Jh{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Qh(this,"parser",xt(gd))}}Qh(Jh,"ForEntityName","3DFACE");let tc=[{code:330,name:"sourceBoundaryObjects",parser:v,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:v}],fd=[{code:11,name:"end",parser:G},{code:10,name:"start",parser:G}],_d=[{code:73,name:"isCCW",parser:Vt},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:G}],yd=[{code:73,name:"isCCW",parser:Vt},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"lengthOfMinorAxis",parser:v},{code:11,name:"end",parser:G},{code:10,name:"center",parser:G}],vd=[{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:11,name:"fitDatum",isMultiple:!0,parser:G},{code:97,name:"numberOfFitData",parser:v},{code:10,name:"controlPoints",isMultiple:!0,parser(i,t){let e={...Rt(t),weight:1};return(i=t.next()).code===42?e.weight=i.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:v},{code:96,name:"numberOfControlPoints",parser:v},{code:95,name:"numberOfKnots",parser:v},{code:74,name:"isPeriodic",parser:Vt},{code:73,name:"splineFlag",parser:v},{code:94,name:"degree",parser:v}],bd={[ni.Line]:fd,[ni.Circular]:_d,[ni.Elliptic]:yd,[ni.Spline]:vd},xd=[...tc,{code:72,name:"edges",parser(i,t){let e={type:i.value},n=xt(bd[e.type]);if(!n)throw Error(`Invalid edge type ${e.type}`);return n(i=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:v}],wd=[...tc,{code:10,name:"vertices",parser(i,t){let e={...Rt(t),bulge:0};return(i=t.next()).code===42?e.bulge=i.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:v},{code:73,name:"isClosed",parser:Vt},{code:72,name:"hasBulge",parser:Vt}],Ad=[{code:49,name:"dashLengths",parser:v,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:v},{code:45,name:"offset",parser:ml},{code:43,name:"base",parser:ml},{code:53,name:"angle",parser:v}];function ml(i,t){let e=i.code+1,n={x:i.value,y:1};return(i=t.next()).code===e?n.y=i.value:t.rewind(),n}function ec(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Pd={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Sd=[{code:470},{code:463},{code:462,name:"colorTint",parser:v},{code:461,name:"gradientDefinition",parser:v},{code:460,name:"gradientRotation",parser:v},{code:453,name:"numberOfColors",parser:v},{code:452,name:"gradientColorFlag",parser:v},{code:451},{code:450,name:"gradientFlag",parser:v},{code:10,name:"seedPoints",parser:G,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:G},{code:98,name:"numberOfSeedPoints",parser:v},{code:47,name:"pixelSize",parser:v},{code:53,name:"definitionLines",parser:function(i,t){let e={};return xt(Ad)(i,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:v},{code:77,name:"isDouble",parser:Vt},{code:73,name:"isAnnotated",parser:Vt},{code:41,name:"patternScale",parser:v},{code:52,name:"patternAngle",parser:v},{code:76,name:"patternType",parser:v},{code:75,name:"hatchStyle",parser:v},{code:92,name:"boundaryPaths",parser:function(i,t){let e={boundaryPathTypeFlag:i.value},n=e.boundaryPathTypeFlag&Ku.Polyline;return i=t.next(),n?xt(wd)(i,t,e):xt(xd)(i,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:v},{code:71,name:"associativity",parser:v},{code:63,name:"patternFillColor",parser:v},{code:70,name:"solidFill",parser:v},{code:2,name:"patternName",parser:v},{code:210,name:"extrusionDirection",parser:G},{code:10,name:"elevationPoint",parser:G},{code:100,name:"subclassMarker",parser:v,pushContext:!0},...jt];class rc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){ec(this,"parser",xt(Sd,Pd))}}ec(rc,"ForEntityName","HATCH");(Ir={})[Ir.ShowImage=1]="ShowImage",Ir[Ir.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Ir[Ir.UseClippingBoundary=4]="UseClippingBoundary",Ir[Ir.TransparencyIsOn=8]="TransparencyIsOn";(Ms={})[Ms.Rectangular=1]="Rectangular",Ms[Ms.Polygonal=2]="Polygonal";(ks={})[ks.Outside=0]="Outside",ks[ks.Inside=1]="Inside";function nc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Id={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Ed=[{code:290,name:"clipMode",parser:v},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:G},{code:91,name:"countBoundaryPoints",parser:v},{code:71,name:"clippingBoundaryType",parser:v},{code:360,name:"imageDefReactorHandle",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipped",parser:Vt},{code:70,name:"flags",parser:v},{code:340,name:"imageDefHandle",parser:v},{code:13,name:"imageSize",parser:G},{code:12,name:"vPixel",parser:G},{code:11,name:"uPixel",parser:G},{code:10,name:"position",parser:G},{code:90,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class sc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){nc(this,"parser",xt(Ed,Id))}}function ic(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}nc(sc,"ForEntityName","IMAGE");let Md={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},kd=[{code:210,name:"extrusionDirection",parser:G},{code:45,name:"rowSpacing",parser:v},{code:44,name:"columnSpacing",parser:v},{code:71,name:"rowCount",parser:v},{code:70,name:"columnCount",parser:v},{code:50,name:"rotation",parser:v},{code:43,name:"zScale",parser:v},{code:42,name:"yScale",parser:v},{code:41,name:"xScale",parser:v},{code:10,name:"insertionPoint",parser:G},{code:2,name:"name",parser:v},{code:66,name:"isVariableAttributes",parser:Vt},{code:100,name:"subclassMarker",parser:v},...jt];class ac{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){ic(this,"parser",xt(kd,Md))}}function oc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}ic(ac,"ForEntityName","INSERT");let Td={isArrowheadEnabled:!0},Cd=[{code:213,name:"offsetFromAnnotation",parser:G},{code:212,name:"offsetFromBlock",parser:G},{code:211,name:"horizontalDirection",parser:G},{code:210,name:"normal",parser:G},{code:340,name:"associatedAnnotation",parser:v},{code:77,name:"byBlockColor",parser:v},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:76,name:"numberOfVertices",parser:v},{code:41,name:"textWidth",parser:v},{code:40,name:"textHeight",parser:v},{code:75,name:"isHooklineExists",parser:Vt},{code:74,name:"isHooklineSameDirection",parser:Vt},{code:73,name:"leaderCreationFlag",parser:v},{code:72,name:"isSpline",parser:Vt},{code:71,name:"isArrowheadEnabled",parser:Vt},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class lc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){oc(this,"parser",xt(Cd,Td))}}oc(lc,"ForEntityName","LEADER");(Er={})[Er.TextAnnotation=0]="TextAnnotation",Er[Er.ToleranceAnnotation=1]="ToleranceAnnotation",Er[Er.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Er[Er.NoAnnotation=3]="NoAnnotation";function hc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Nd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ld=[{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class cc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){hc(this,"parser",xt(Ld,Nd))}}hc(cc,"ForEntityName","LINE");(Ts={})[Ts.IS_CLOSED=1]="IS_CLOSED",Ts[Ts.PLINE_GEN=128]="PLINE_GEN";let Od={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Bd={bulge:0},zd=[{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:91,name:"id",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v}],Rd=[{code:210,name:"extrusionDirection",parser:G},{code:10,name:"vertices",isMultiple:!0,parser(i,t){let e={};return xt(zd,Bd)(i,t,e),e}},{code:39,name:"thickness",parser:v},{code:38,name:"elevation",parser:v},{code:43,name:"constantWidth",parser:v},{code:70,name:"flag",parser:v},{code:90,name:"numberOfVertices",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class hi{parseEntity(t,e){let n={};return xt(Rd,Od)(e,t,n),n}}function uc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}ma="LWPOLYLINE",(pa="ForEntityName")in hi?Object.defineProperty(hi,pa,{value:ma,enumerable:!0,configurable:!0,writable:!0}):hi[pa]=ma;let Dd=[{code:90,name:"overridenSubEntityCount",parser:v},{code:140,name:"edgeCreaseWeights",parser:v,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:v},{code:94,parser(i,t,e){e.edgeCount=i.value,e.edgeIndices=[];for(let n=0;n<e.edgeCount;++n){let a=[];i=t.next(),a[0]=i.value,i=t.next(),a[1]=i.value,e.edgeIndices.push(a)}}},{code:93,parser(i,t,e){e.totalFaceIndices=i.value,e.faceIndices=[];let n=[];for(let h=0;h<e.totalFaceIndices&&!St(i,0);++h)i=t.next(),n.push(i.value);let a=0;for(;a<n.length;){let h=n[a++],c=[];for(let g=0;g<h;++g)c.push(n[a++]);e.faceIndices.push(c)}}},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:92,name:"verticesCount",parser:v},{code:91,name:"subdivisionLevel",parser:v},{code:40,name:"blendCrease",parser:v},{code:72,name:"isBlendCreased",parser:Vt},{code:71,name:"version",parser:v},{code:100,name:"subclassMarker",parser:function({value:i}){return i.trim()},pushContext:!0},...jt];class dc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){uc(this,"parser",xt(Dd))}}function pc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}uc(dc,"ForEntityName","MESH");let Fd={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Vd=[{code:50,name:"angle",parser:v},{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:v},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class mc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){pc(this,"parser",xt(Vd,Fd))}}pc(mc,"ForEntityName","POINT");(pe={})[pe.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",pe[pe.CURVE_FIT=2]="CURVE_FIT",pe[pe.SPLINE_FIT=4]="SPLINE_FIT",pe[pe.POLYLINE_3D=8]="POLYLINE_3D",pe[pe.POLYGON_3D=16]="POLYGON_3D",pe[pe.CLOSED_POLYGON=32]="CLOSED_POLYGON",pe[pe.POLYFACE=64]="POLYFACE",pe[pe.CONTINUOUS=128]="CONTINUOUS";var si=((Mr={})[Mr.NONE=0]="NONE",Mr[Mr.QUADRATIC=5]="QUADRATIC",Mr[Mr.CUBIC=6]="CUBIC",Mr[Mr.BEZIER=8]="BEZIER",Mr),Ud=((me={})[me.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",me[me.TANGENT_DEFINED=2]="TANGENT_DEFINED",me[me.NOT_USED=4]="NOT_USED",me[me.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",me[me.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",me[me.FOR_POLYLINE=32]="FOR_POLYLINE",me[me.FOR_POLYGON=64]="FOR_POLYGON",me[me.POLYFACE=128]="POLYFACE",me);function gc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let jd={startWidth:0,endWidth:0,bulge:0},Gd=[{code:91,name:"id",parser:v},{code:[...Bi(71,75)],name:"faces",isMultiple:!0,parser:v},{code:50,name:"tangentDirection",parser:v},{code:70,name:"flag",parser:v},{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:30,name:"z",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...jt];class eo{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){gc(this,"parser",xt(Gd,jd))}}function fc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}gc(eo,"ForEntityName","VERTEX");let Wd={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Hd=[{code:0,name:"vertices",isMultiple:!0,parser:(i,t)=>St(i,0,"VERTEX")?(i=t.next(),new eo().parseEntity(t,i)):Ja},{code:210,name:"extrusionDirection",parser:G},{code:75,name:"smoothType",parser:v},{code:74,name:"surfaceNDensity",parser:v},{code:73,name:"surfaceMDensity",parser:v},{code:72,name:"meshNVertexCount",parser:v},{code:71,name:"meshMVertexCount",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:70,name:"flag",parser:v},{code:39,name:"thickness",parser:v},{code:30,name:"elevation",parser:v},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:v},...jt];class _c{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){fc(this,"parser",xt(Hd,Wd))}}function yc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}fc(_c,"ForEntityName","POLYLINE");let qd=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class vc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){yc(this,"parser",xt(qd))}}function bc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}yc(vc,"ForEntityName","RAY");let Yd=[...Ki("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class xc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){bc(this,"parser",xt(Yd))}}function wc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}bc(xc,"ForEntityName","REGION");let Xd={vertices:[],backLineVertices:[]},Kd=[{code:360,name:"geometrySettingHardId",parser:v},{code:12,name:"backLineVertices",isMultiple:!0,parser:G},{code:93,name:"numberOfBackLineVertices",parser:v},{code:11,name:"vertices",isMultiple:!0,parser:G},{code:92,name:"verticesCount",parser:v},{code:[63,411],name:"indicatorColor",parser:v},{code:70,name:"indicatorTransparency",parser:v},{code:41,name:"bottomHeight",parser:v},{code:40,name:"topHeight",parser:v},{code:10,name:"verticalDirection",parser:G},{code:1,name:"name",parser:v},{code:91,name:"flag",parser:v},{code:90,name:"state",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class Ac{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){wc(this,"parser",xt(Kd,Xd))}}function Pc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}wc(Ac,"ForEntityName","SECTION");let $d={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Zd=[{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:v},{code:[...Bi(10,14)],name:"points",isMultiple:!0,parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class Sc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Pc(this,"parser",xt(Zd,$d))}}function Ic(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Pc(Sc,"ForEntityName","SOLID");let Qd=[{code:350,name:"historyObjectSoftId",parser:v},{code:100,name:"subclassMarker",parser:v},...Ki("data"),{code:70,name:"version",parser:v},{code:100},...jt];class Ec{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Ic(this,"parser",xt(Qd))}}Ic(Ec,"ForEntityName","3DSOLID");(Ue={})[Ue.NONE=0]="NONE",Ue[Ue.CLOSED=1]="CLOSED",Ue[Ue.PERIODIC=2]="PERIODIC",Ue[Ue.RATIONAL=4]="RATIONAL",Ue[Ue.PLANAR=8]="PLANAR",Ue[Ue.LINEAR=16]="LINEAR";function Mc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let Jd={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},t0=[{code:11,name:"fitPoints",isMultiple:!0,parser:G},{code:10,name:"controlPoints",isMultiple:!0,parser:G},{code:41,name:"weights",isMultiple:!0,parser:v},{code:40,name:"knots",isMultiple:!0,parser:v},{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:44,name:"fitTolerance",parser:v},{code:43,name:"controlTolerance",parser:v},{code:42,name:"knotTolerance",parser:v},{code:74,name:"numberOfFitPoints",parser:v},{code:73,name:"numberOfControlPoints",parser:v},{code:72,name:"numberOfKnots",parser:v},{code:71,name:"degree",parser:v},{code:70,name:"flag",parser:v},{code:210,name:"normal",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class kc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Mc(this,"parser",xt(t0,Jd))}}Mc(kc,"ForEntityName","SPLINE");class ci{parseEntity(t,e){let n={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:n.subclassMarker=e.value,e=t.next();break;case 2:n.name=e.value,e=t.next();break;case 5:n.handle=e.value,e=t.next();break;case 10:n.startPoint=Xr(Rt(t)),e=t.lastReadGroup;break;case 11:n.directionVector=Xr(Rt(t)),e=t.lastReadGroup;break;case 90:n.tableValue=e.value,e=t.next();break;case 91:n.rowCount=e.value,e=t.next();break;case 92:n.columnCount=e.value,e=t.next();break;case 93:n.overrideFlag=e.value,e=t.next();break;case 94:n.borderColorOverrideFlag=e.value,e=t.next();break;case 95:n.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:n.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:n.rowHeightArr??(n.rowHeightArr=[]),n.rowHeightArr.push(e.value),e=t.next();break;case 142:n.columnWidthArr??(n.columnWidthArr=[]),n.columnWidthArr.push(e.value),e=t.next();break;case 280:n.version=e.value,e=t.next();break;case 310:n.bmpPreview??(n.bmpPreview=""),n.bmpPreview+=e.value,e=t.next();break;case 330:n.ownerDictionaryId=e.value,e=t.next();break;case 342:n.tableStyleId=e.value,e=t.next();break;case 343:n.blockRecordHandle=e.value,e=t.next();break;case 170:n.attachmentPoint=e.value,e=t.next();break;case 171:n.cells??(n.cells=[]),n.cells.push(function(a,h){let c=!1,g=!1,b={};for(;!a.isEOF()&&h.code!==0&&!g;)switch(h.code){case 171:if(c){g=!0;continue}b.cellType=h.value,c=!0,h=a.next();break;case 172:b.flagValue=h.value,h=a.next();break;case 173:b.mergedValue=h.value,h=a.next();break;case 174:b.autoFit=h.value,h=a.next();break;case 175:b.borderWidth=h.value,h=a.next();break;case 176:b.borderHeight=h.value,h=a.next();break;case 91:b.overrideFlag=h.value,h=a.next();break;case 178:b.virtualEdgeFlag=h.value,h=a.next();break;case 145:b.rotation=h.value,h=a.next();break;case 345:b.fieldObjetId=h.value,h=a.next();break;case 340:b.blockTableRecordId=h.value,h=a.next();break;case 146:b.blockScale=h.value,h=a.next();break;case 177:b.blockAttrNum=h.value,h=a.next();break;case 7:b.textStyle=h.value,h=a.next();break;case 140:b.textHeight=h.value,h=a.next();break;case 170:b.attachmentPoint=h.value,h=a.next();break;case 92:b.extendedCellFlags=h.value,h=a.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=a.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=a.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=a.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=a.next();break;case 301:(function(f,w,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=w.next();break;case 1:f.text=x.value,x=w.next();break;case 300:f.attrText=x.value,x=w.next();break;case 302:f.text=x.value?x.value:f.text,x=w.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=w.next()}})(b,a,h),h=a.next();break;default:return b}return c=!1,g=!1,b}(t,e)),e=t.lastReadGroup;break;default:to(n,e,t),e=t.next()}}return n}}function Tc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}fa="ACAD_TABLE",(ga="ForEntityName")in ci?Object.defineProperty(ci,ga,{value:fa,enumerable:!0,configurable:!0,writable:!0}):ci[ga]=fa;let e0=[{code:11,name:"xAxisDirection",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:1,name:"text",parser:v},{code:10,name:"position",parser:G},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class Cc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Tc(this,"parser",xt(e0))}}Tc(Cc,"ForEntityName","TOLERANCE");class ui{parseEntity(t,e){let n={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(a,h,c){if(c==="EOF")return!1;switch(c.code){case 0:return!1;case 8:a.layer=c.value;break;case 100:a.subclassMarker=c.value;break;case 10:a.viewportCenter=Xr(Rt(h));break;case 40:a.width=c.value;break;case 41:a.height=c.value;break;case 68:a.status=c.value;break;case 69:a.viewportId=c.value;break;case 12:a.displayCenter=Rt(h);break;case 13:a.snapBase=Rt(h);break;case 14:a.snapSpacing=Rt(h);break;case 15:a.gridSpacing=Rt(h);break;case 16:a.viewDirection=Xr(Rt(h));break;case 17:a.targetPoint=Xr(Rt(h));break;case 42:a.perspectiveLensLength=c.value;break;case 43:a.frontClipZ=c.value;break;case 44:a.backClipZ=c.value;break;case 45:a.viewHeight=c.value;break;case 50:a.snapAngle=c.value;break;case 51:a.viewTwistAngle=c.value;break;case 72:a.circleZoomPercent=c.value;break;case 331:a.frozenLayerIds??(a.frozenLayerIds=[]),a.frozenLayerIds.push(c.value);break;case 90:a.statusBitFlags=c.value;break;case 340:a.clippingBoundaryId=c.value;break;case 1:a.sheetName=c.value;break;case 281:a.renderMode=c.value;break;case 71:a.ucsPerViewport=c.value;break;case 110:a.ucsOrigin=Xr(Rt(h));break;case 111:a.ucsXAxis=Xr(Rt(h));break;case 112:a.ucsYAxis=Xr(Rt(h));break;case 345:a.ucsId=c.value;break;case 346:a.ucsBaseId=c.value;break;case 79:a.orthographicType=c.value;break;case 146:a.elevation=c.value;break;case 170:a.shadePlotMode=c.value;break;case 61:a.majorGridFrequency=c.value;break;case 332:a.backgroundId=c.value;break;case 333:a.shadePlotId=c.value;break;case 348:a.visualStyleId=c.value;break;case 292:a.isDefaultLighting=!!c.value;break;case 282:a.defaultLightingType=c.value;break;case 141:a.brightness=c.value;break;case 142:a.contrast=c.value;break;case 63:case 421:case 431:a.ambientLightColor=c.value;break;case 361:a.sunId=c.value;break;case 335:case 343:case 344:case 91:a.softPointer=c.value}return!0}(n,t,e)&&to(n,e,t),e=t.next()}return n}}ya="VIEWPORT",(_a="ForEntityName")in ui?Object.defineProperty(ui,_a,{value:ya,enumerable:!0,configurable:!0,writable:!0}):ui[_a]=ya;(kr={})[kr.ShowImage=1]="ShowImage",kr[kr.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",kr[kr.UseClippingBoundary=4]="UseClippingBoundary",kr[kr.Transparency=8]="Transparency";function Nc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}let r0={brightness:50,constrast:50,fade:0},n0=[{code:14,name:"boundary",isMultiple:!0,parser:G},{code:91,name:"numberOfVertices",parser:v},{code:71,name:"boundaryType",parser:v},{code:360,name:"imageDefReactorHardId",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipping",parser:Vt},{code:70,name:"displayFlag",parser:v},{code:340,name:"imageDefHardId",parser:v},{code:13,name:"imageSize",parser:G},{code:12,name:"vDirection",parser:G},{code:11,name:"uDirection",parser:G},{code:10,name:"position",parser:G},{code:90,name:"classVersion",parser:v},{code:100,name:"subclassMarker",parser:v},...jt];class Lc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Nc(this,"parser",xt(n0,r0))}}function Oc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Nc(Lc,"ForEntityName","WIPEOUT");let s0=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:v},...jt];class Bc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){Oc(this,"parser",xt(s0))}}function zc(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}Oc(Bc,"ForEntityName","XLINE");let i0={},a0=[{code:170,name:"multileaderType",parser:v},{code:291,name:"doglegEnabled",parser:Vt},{code:40,name:"doglegLength",parser:v},{code:172,name:"contentType",parser:v},{code:3,name:"textContent",parser:v},{code:12,name:"textAnchor",parser:G},{code:344,name:"blockHandle",parser:v},{code:15,name:"blockPosition",parser:G},{code:302,name:"leaderSections",parser:function(i,t,e){let n,a={leaderLines:[]};for(;t.hasNext()&&(n=t.next()).code!==303;)switch(n.code){case 10:a.landingPoint=(n.value,Rt(t));break;case 11:a.doglegVector=(n.value,Rt(t));break;case 40:a.doglegLength=n.value;break;case 304:a.leaderLines.push(function(h,c,g){let b,f={vertices:[]};for(;c.hasNext()&&(b=c.next()).code!==305;)b.code===10&&f.vertices.push((b.value,Rt(c)));return f}(0,t))}return a},isMultiple:!0},...jt];class Rc{parseEntity(t,e){let n={};return this.parser(e,t,n),n}constructor(){zc(this,"parser",xt(a0,i0))}}zc(Rc,"ForEntityName","MULTILEADER");let o0=Object.fromEntries([Bh,Uh,Hh,Yh,Kh,li,Zh,Jh,sc,ac,lc,cc,hi,dc,Gh,Rc,mc,_c,vc,xc,Ac,Sc,Ec,kc,ci,Fh,Cc,rc,eo,ui,Lc,Bc].map(i=>[i.ForEntityName,new i]));function Dc(i,t){let e=[];for(;!St(i,0,"EOF");){if(i.code===0){if(i.value==="ENDBLK"||i.value==="ENDSEC"){t.rewind();break}let n=o0[i.value];if(n){let a=i.value;i=t.next();let h=n.parseEntity(t,i);h.type=a,Nh(h),e.push(h)}else t.debug&&console.warn(`Unsupported ENTITY type: ${i.value}`)}i=t.next()}return e}function l0(i,t){let e={};for(;!St(i,0,"EOF")&&!St(i,0,"ENDSEC");){if(St(i,0,"BLOCK")){let n=h0(i=t.next(),t);Nh(n),n.name&&(e[n.name]=n)}i=t.next()}return e}function h0(i,t){let e={};for(;!St(i,0,"EOF");){if(St(i,0,"ENDBLK")){for(i=t.next();!St(i,0,"EOF");){if(St(i,100,"AcDbBlockEnd"))return e;i=t.next()}break}switch(i.code){case 1:e.xrefPath=i.value;break;case 2:e.name=i.value;break;case 3:e.name2=i.value;break;case 5:e.handle=i.value;break;case 8:e.layer=i.value;break;case 10:e.position=Rt(t);break;case 67:e.paperSpace=!!i.value&&i.value==1;break;case 70:i.value!==0&&(e.type=i.value);break;case 100:break;case 330:e.ownerHandle=i.value;break;case 0:e.entities=Dc(i,t)}i=t.next()}return e}function c0(i,t){let e=null,n={};for(;!St(i,0,"EOF")&&!St(i,0,"ENDSEC");)i.code===9?e=i.value:i.code===10?n[e]=Rt(t):n[e]=i.value,i=t.next();return n}(je={})[je.NOT_APPLICABLE=0]="NOT_APPLICABLE",je[je.KEEP_EXISTING=1]="KEEP_EXISTING",je[je.USE_CLONE=2]="USE_CLONE",je[je.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",je[je.VALUE_NAME=4]="VALUE_NAME",je[je.UNMANGLE_NAME=5]="UNMANGLE_NAME";let ro=[{code:330,name:"ownerObjectId",parser:v},{code:102,parser:bn},{code:102,parser:bn},{code:102,parser:bn},{code:5,name:"handle",parser:v}],u0=[{code:3,name:"entries",parser:(i,t)=>{let e={name:i.value};return(i=t.next()).code===350?e.objectSoftId=i.value:i.code===360?e.objectHardId=i.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:v},{code:280,name:"isHardOwned",parser:Vt},{code:100,name:"subclassMarker",parser:v},...ro],d0=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:v},{code:90,name:"version",parser:v},{code:1,name:"fileName",parser:v},{code:10,name:"size",parser:G},{code:11,name:"sizeOfOnePixel",parser:G},{code:280,name:"isLoaded",parser:v},{code:281,name:"resolutionUnits",parser:v},{code:100,name:"subclassMarker",parser:v}];(pn={})[pn.NOUNIT=0]="NOUNIT",pn[pn.CENTIMETERS=2]="CENTIMETERS",pn[pn.INCH=5]="INCH";(Cs={})[Cs.PSLTSCALE=1]="PSLTSCALE",Cs[Cs.LIMCHECK=2]="LIMCHECK";(mn={})[mn.INCHES=0]="INCHES",mn[mn.MILLIMETERS=1]="MILLIMETERS",mn[mn.PIXELS=2]="PIXELS";(Ge={})[Ge.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",Ge[Ge.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",Ge[Ge.DRAWING_LIMITS=2]="DRAWING_LIMITS",Ge[Ge.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",Ge[Ge.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",Ge[Ge.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Tr={})[Tr.AS_DISPLAYED=0]="AS_DISPLAYED",Tr[Tr.WIREFRAME=1]="WIREFRAME",Tr[Tr.HIDDEN=2]="HIDDEN",Tr[Tr.RENDERED=3]="RENDERED";(We={})[We.DRAFT=0]="DRAFT",We[We.PREVIEW=1]="PREVIEW",We[We.NORMAL=2]="NORMAL",We[We.PRESENTATION=3]="PRESENTATION",We[We.MAXIMUM=4]="MAXIMUM",We[We.CUSTOM=5]="CUSTOM";let Fc=[{code:333,name:"shadePlotId",parser:v},{code:149,name:"imageOriginY",parser:v},{code:148,name:"imageOriginX",parser:v},{code:147,name:"scaleFactor",parser:v},{code:78,name:"shadePlotCustomDPI",parser:v},{code:77,name:"shadePlotResolution",parser:v},{code:76,name:"shadePlotMode",parser:v},{code:75,name:"standardScaleType",parser:v},{code:7,name:"currentStyleSheet",parser:v},{code:74,name:"plotType",parser:v},{code:73,name:"plotRotation",parser:v},{code:72,name:"plotPaperUnit",parser:v},{code:70,name:"layoutFlag",parser:v},{code:143,name:"printScaleDenominator",parser:v},{code:142,name:"printScaleNumerator",parser:v},{code:141,name:"windowAreaYMax",parser:v},{code:140,name:"windowAreaXMax",parser:v},{code:49,name:"windowAreaYMin",parser:v},{code:48,name:"windowAreaXMin",parser:v},{code:47,name:"plotOriginY",parser:v},{code:46,name:"plotOriginX",parser:v},{code:45,name:"paperHeight",parser:v},{code:44,name:"paperWidth",parser:v},{code:43,name:"marginTop",parser:v},{code:42,name:"marginRight",parser:v},{code:41,name:"marginBottom",parser:v},{code:40,name:"marginLeft",parser:v},{code:6,name:"plotViewName",parser:v},{code:4,name:"paperSize",parser:v},{code:2,name:"configName",parser:v},{code:1,name:"pageSetupName",parser:v},{code:100,name:"subclassMarker",parser:v},...ro],p0=[{code:346,name:"orthographicUcsId",parser:v},{code:345,name:"namedUcsId",parser:v},{code:331,name:"viewportId",parser:v},{code:330,name:"paperSpaceTableId",parser:v},{code:76,name:"orthographicType",parser:v},{code:17,name:"ucsYAxis",parser:G},{code:16,name:"ucsXAxis",parser:G},{code:13,name:"ucsOrigin",parser:G},{code:146,name:"elevation",parser:v},{code:15,name:"maxExtent",parser:G},{code:14,name:"minExtent",parser:G},{code:12,name:"insertionPoint",parser:G},{code:11,name:"maxLimit",parser:G},{code:10,name:"minLimit",parser:G},{code:71,name:"tabOrder",parser:v},{code:70,name:"controlFlag",parser:v},{code:1,name:"layoutName",parser:v},{code:100,name:"subclassMarker",parser:v},...Fc],m0=[{code:40,name:"wcsToOCSTransform",parser:gl},{code:40,name:"ocsToWCSTransform",parser:gl},{code:41,name:"backClippingDistance",parser:v},{code:73,name:"isBackClipping",parser:Vt,pushContext:!0},{code:40,name:"frontClippingDistance",parser:v},{code:72,name:"isFrontClipping",parser:Vt,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:Vt},{code:11,name:"position",parser:G},{code:210,name:"normal",parser:G},{code:10,name:"boundaryVertices",parser:G,isMultiple:!0},{code:70,name:"boundaryCount",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...ro];function gl(i,t){let e=[];for(let n=0;n<3&&St(i,40);++n){let a=[];for(let h=0;h<4&&St(i,40);++h)a.push(i.value),i=t.next();e.push(a)}return t.rewind(),e}let g0={LAYOUT:p0,PLOTSETTINGS:Fc,DICTIONARY:u0,SPATIAL_FILTER:m0,IMAGEDEF:d0};function f0(i,t){let e=[];for(;i.code!==0||!["EOF","ENDSEC"].includes(i.value);){let n=i.value,a=g0[n];if(i.code===0&&(a!=null&&a.length)){let h=xt(a),c={name:n};h(i=t.next(),t,c)?(e.push(c),i=t.peek()):i=t.next()}else i=t.next()}return{byName:ad(e,({name:n})=>n)}}let Kn=[{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102,parser(i,t){for(;!St(i,0,"EOF")&&!St(i,102,"}");)i=t.next()}},{code:5,name:"handle",parser:v}],_0=xt([{code:310,name:"bmpPreview",parser:v},{code:281,name:"scalability",parser:v},{code:280,name:"explodability",parser:v},{code:70,name:"insertionUnits",parser:v},{code:340,name:"layoutObjects",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...Kn]),y0=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:pl.Above,defaultValueImperial:pl.Center},{name:"DIMZIN",code:78,defaultValue:Fn.Trailing,defaultValueImperial:Fn.Feet},{name:"DIMAZIN",code:79,defaultValue:Hu.None},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:2,defaultValueImperial:4},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:",",defaultValueImperial:"."},{name:"DIMJUST",code:280,defaultValue:qu.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Yu.Center},{name:"DIMTZIN",code:284,defaultValue:Fn.Trailing,defaultValueImperial:Fn.Feet},{name:"DIMALTZ",code:285,defaultValue:Fn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Fn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMTXSTY",code:340},{name:"DIMLDRBLK",code:341},{name:"DIMBLK",code:342},{name:"DIMBLK1",code:343},{name:"DIMBLK2",code:344},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWD",code:372,defaultValue:-2}],v0=xt([...y0.map(i=>({...i,parser:v})),{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},{code:105,name:"handle",parser:v},...Kn.filter(i=>i.code!==5)]),b0=xt([{code:347,name:"materialObjectId",parser:v},{code:390,name:"plotStyleNameObjectId",parser:v},{code:370,name:"lineweight",parser:v},{code:290,name:"isPlotting",parser:Vt},{code:6,name:"lineType",parser:v},{code:62,name:"colorIndex",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...Kn]);(Cr={})[Cr.NONE=0]="NONE",Cr[Cr.AbsoluteRotation=1]="AbsoluteRotation",Cr[Cr.TextEmbedded=2]="TextEmbedded",Cr[Cr.ShapeEmbedded=4]="ShapeEmbedded";let x0=xt([{code:9,name:"text",parser:v},{code:45,name:"offsetY",parser:v},{code:44,name:"offsetX",parser:v},{code:50,name:"rotation",parser:v},{code:46,name:"scale",parser:v},{code:340,name:"styleObjectId",parser:v},{code:75,name:"shapeNumber",parser:v},{code:74,name:"elementTypeFlag",parser:v},{code:49,name:"elementLength",parser:v}],{elementTypeFlag:0,elementLength:0}),w0=xt([{code:49,name:"pattern",parser(i,t){let e={};return x0(i,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:v},{code:73,name:"numberOfLineTypes",parser:v},{code:72,parser:v},{code:3,name:"description",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...Kn]),A0=xt([{code:1e3,name:"extendedFont",parser:v},{code:1001},{code:4,name:"bigFont",parser:v},{code:3,name:"font",parser:v},{code:42,name:"lastHeight",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:50,name:"obliqueAngle",parser:v},{code:41,name:"widthFactor",parser:v},{code:40,name:"fixedTextHeight",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...Kn]),P0=xt([{code:[63,421,431],name:"ambientColor",parser:v},{code:142,name:"contrast",parser:v},{code:141,name:"brightness",parser:v},{code:282,name:"defaultLightingType",parser:v},{code:292,name:"isDefaultLightingOn",parser:Vt},{code:348,name:"visualStyleObjectId",parser:v},{code:333,name:"shadePlotObjectId",parser:v},{code:332,name:"backgroundObjectId",parser:v},{code:61,name:"majorGridLines",parser:v},{code:170,name:"shadePlotSetting",parser:v},{code:146,name:"elevation",parser:v},{code:79,name:"orthographicType",parser:v},{code:112,name:"ucsYAxis",parser:G},{code:111,name:"ucsXAxis",parser:G},{code:110,name:"ucsOrigin",parser:G},{code:74,name:"ucsIconSetting",parser:v},{code:71,name:"viewMode",parser:v},{code:281,name:"renderMode",parser:v},{code:1,name:"styleSheet",parser:v},{code:[331,441],name:"frozenLayers",parser:v,isMultiple:!0},{code:72,name:"circleSides",parser:v},{code:51,name:"viewTwistAngle",parser:v},{code:50,name:"snapRotationAngle",parser:v},{code:45,name:"viewHeight",parser:v},{code:44,name:"backClippingPlane",parser:v},{code:43,name:"frontClippingPlane",parser:v},{code:42,name:"lensLength",parser:v},{code:17,name:"viewTarget",parser:G},{code:16,name:"viewDirectionFromTarget",parser:G},{code:15,name:"gridSpacing",parser:G},{code:14,name:"snapSpacing",parser:G},{code:13,name:"snapBasePoint",parser:G},{code:12,name:"center",parser:G},{code:11,name:"upperRightCorner",parser:G},{code:10,name:"lowerLeftCorner",parser:G},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...Kn]),S0={BLOCK_RECORD:_0,DIMSTYLE:v0,LAYER:b0,LTYPE:w0,STYLE:A0,VPORT:P0},I0=xt([{code:70,name:"maxNumberOfEntries",parser:v},{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:v},{code:2,name:"name",parser:v}]);function E0(i,t){var n;let e={};for(;!St(i,0,"EOF")&&!St(i,0,"ENDSEC");){if(St(i,0,"TABLE")){i=t.next();let a={entries:[]};I0(i,t,a),e[a.name]=a}if(St(i,0)&&!St(i,0,"ENDTAB")){let a=i.value;i=t.next();let h=S0[a];if(!h){t.debug&&console.warn(`parseTable: Invalid table name '${a}'`),i=t.next();continue}let c={};h(i,t,c),(n=e[a])==null||n.entries.push(c)}i=t.next()}return e}function Ns(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class fl{next(){if(!this.hasNext())return this._eof?this.debug&&console.warn("Cannot call 'next' after EOF group has been read"):this.debug&&console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=_l(t,this._data[this._pointer++],this.debug),n={code:t,value:e};return St(n,0,"EOF")&&(this._eof=!0),this.lastReadGroup=n,n}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=_l(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){Ns(this,"_data",void 0),Ns(this,"debug",void 0),Ns(this,"_pointer",void 0),Ns(this,"_eof",void 0),Ns(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function _l(i,t,e=!1){return i<=9?t:i>=10&&i<=59?parseFloat(t.trim()):i>=60&&i<=99?parseInt(t.trim()):i>=100&&i<=109?t:i>=110&&i<=149?parseFloat(t.trim()):i>=160&&i<=179?parseInt(t.trim()):i>=210&&i<=239?parseFloat(t.trim()):i>=270&&i<=289?parseInt(t.trim()):i>=290&&i<=299?function(n){if(n==="0")return!1;if(n==="1")return!0;throw TypeError("String '"+n+"' cannot be cast to Boolean type")}(t.trim()):i>=300&&i<=369?t:i>=370&&i<=389?parseInt(t.trim()):i>=390&&i<=399?t:i>=400&&i<=409?parseInt(t.trim()):i>=410&&i<=419?t:i>=420&&i<=429?parseInt(t.trim()):i>=430&&i<=439?t:i>=440&&i<=459?parseInt(t.trim()):i>=460&&i<=469?parseFloat(t.trim()):i>=470&&i<=481||i===999||i>=1e3&&i<=1009?t:i>=1010&&i<=1059?parseFloat(t.trim()):i>=1060&&i<=1071?parseInt(t.trim()):(e&&console.warn("WARNING: Group code does not have a defined type: %j",{code:i,value:t}),t)}function Ma(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}class M0{constructor(){Ma(this,"encoding","utf-8"),Ma(this,"encodingFailureFatal",!1)}}class k0 extends EventTarget{parseSync(t,e=!1){let n=new fl(t.split(/\r\n|\r|\n/g),e);if(!n.hasNext())throw Error("Empty file");return this.parseAll(n)}parseStream(t){let e="",n=this;return new Promise((a,h)=>{t.on("data",c=>{e+=c}),t.on("end",()=>{try{let c=e.split(/\r\n|\r|\n/g),g=new fl(c);if(!g.hasNext())throw Error("Empty file");a(n.parseAll(g))}catch(c){h(c)}}),t.on("error",c=>{h(c)})})}async parseFromUrl(t,e){let n=await fetch(t,e);if(!n.body)return null;let a=n.body.getReader(),h="";for(;;){let{done:c,value:g}=await a.read();if(c){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(g,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},n=t.next();for(;!St(n,0,"EOF");)St(n,0,"SECTION")&&(St(n=t.next(),2,"HEADER")?(n=t.next(),e.header=c0(n,t)):St(n,2,"BLOCKS")?(n=t.next(),e.blocks=l0(n,t)):St(n,2,"ENTITIES")?(n=t.next(),e.entities=Dc(n,t)):St(n,2,"TABLES")?(n=t.next(),e.tables=E0(n,t)):St(n,2,"OBJECTS")&&(n=t.next(),e.objects=f0(n,t))),n=t.next();return e}constructor(t=new M0){super(),Ma(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}const yl=[{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 zi{constructor(t){if(typeof t=="string"){const e=yl.find(n=>n.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=yl.find(n=>n.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class T0{parse(t){const e=new k0,n=this.getDxfInfoFromBuffer(t);let a="";return n.version&&n.version.value<=23&&n.encoding?a=new TextDecoder(n.encoding).decode(t):a=new TextDecoder().decode(t),e.parseSync(a)}getDxfInfoFromBuffer(t){var f,w,x;const n=new TextDecoder("utf-8");let a=0,h="",c=null,g=null,b=!1;for(;a<t.byteLength;){const I=Math.min(a+65536,t.byteLength),M=t.slice(a,I);a=I;const O=(h+n.decode(M,{stream:!0})).split(/\r?\n/);h=O.pop()??"";for(let F=0;F<O.length;F++){const D=O[F].trim();if(D==="SECTION"&&((f=O[F+2])==null?void 0:f.trim())==="HEADER")b=!0;else if(D==="ENDSEC"&&b)return{version:c,encoding:g};if(b&&D==="$ACADVER"){const dt=(w=O[F+2])==null?void 0:w.trim();dt&&(c=new zi(dt))}else if(b&&D==="$DWGCODEPAGE"){const dt=(x=O[F+2])==null?void 0:x.trim();if(dt){const vt=La[dt];g=Tl(vt)}}if(c&&g)return{version:c,encoding:g}}}return{version:c,encoding:g}}}class vl{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new vi;return t.vertices.forEach((n,a)=>e.setVertexAt(a,n)),e}convertArc(t){return new fi(t.center,t.radius,Pt.degToRad(t.startAngle),Pt.degToRad(t.endAngle),t.extrusionDirection??X.Z_AXIS)}convertCirle(t){return new _i(t.center,t.radius,t.extrusionDirection??X.Z_AXIS)}convertEllipse(t){const e=new X(t.majorAxisEndPoint),n=e.length();return new yi(t.center,t.extrusionDirection??X.Z_AXIS,e,n,n*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,n=t.endPoint;return new Ws(new W(e.x,e.y,e.z||0),new W(n.x,n.y,n.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new qs(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new qs(e,"Uniform",t.degree,!!(t.flag&1))}}catch(e){console.log(`Failed to convert spline with error: ${e}`)}return null}convertPoint(t){const e=new Si;return e.position=t.position,e}convertSolid(t){const e=new Ai;return t.points.forEach((n,a)=>e.setPointAt(a,n)),e.thickness=t.thickness,e}convertPolyline(t){const e=!!(t.flag&1),n=!!(t.flag&8),a=[],h=[];if(t.vertices.map(c=>{c.flag&Ud.SPLINE_CONTROL_POINT||(a.push({x:c.x,y:c.y,z:c.z}),h.push(c.bulge??0))}),n){let c=Fs.SimplePoly;return t.flag&4&&(t.smoothType==si.CUBIC?c=Fs.CubicSplinePoly:t.smoothType==si.QUADRATIC&&(c=Fs.QuadSplinePoly)),new gi(c,a,e)}else{let c=Vn.SimplePoly;return t.flag&2?c=Vn.FitCurvePoly:t.flag&4&&(t.smoothType==si.CUBIC?c=Vn.CubicSplinePoly:t.smoothType==si.QUADRATIC&&(c=Vn.QuadSplinePoly)),new mi(c,a,0,e,t.startWidth,t.endWidth,h)}}convertLWPolyline(t){const e=new Pi;return e.closed=!!(t.flag&1),t.vertices.forEach((n,a)=>{e.addVertexAt(a,new Tt(n.x,n.y),n.bulge,n.startWidth,n.endWidth)}),e}convertHatch(t){var a;const e=new Gs;return(a=t.definitionLines)==null||a.forEach(h=>{e.definitionLines.push({angle:h.angle,origin:h.base,delta:h.offset,dashPattern:h.numberOfDashLengths>0?h.dashLengths:[]})}),e.isSolidFill=t.solidFill==Xu.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const g=h,b=new xn;b.closed=g.isClosed,g.vertices.forEach((f,w)=>{b.addVertexAt(w,{x:f.x,y:f.y,bulge:f.bulge})}),e.add(b)}else{const g=h,b=new Ha;g.edges.forEach(f=>{if(f.type==1){const w=f;b.add(new Ds(w.start,w.end))}else if(f.type==2){const w=f;b.add(new jn(w.center,w.radius,Pt.degToRad(w.startAngle||0),Pt.degToRad(w.endAngle||0),!w.isCCW))}else if(f.type==3){const w=f;new Jt().subVectors(w.end,w.center);const I=Math.sqrt(Math.pow(w.end.x,2)+Math.pow(w.end.y,2)),M=I*w.lengthOfMinorAxis;let L=Pt.degToRad(w.startAngle||0),O=Pt.degToRad(w.endAngle||0);const F=Math.atan2(w.end.y,w.end.x);w.isCCW||(L=Math.PI*2-L,O=Math.PI*2-O),b.add(new Wi({...w.center,z:0},I,M,L,O,!w.isCCW,F))}else if(f.type==4){const w=f;if(w.numberOfControlPoints>0&&w.numberOfKnots>0){const x=w.controlPoints.map(L=>({x:L.x,y:L.y,z:0}));let I=!0;const M=w.controlPoints.map(L=>(L.weight==null&&(I=!1),L.weight||1));b.add(new Qr(x,w.knots,I?M:void 0))}else if(w.numberOfFitData>0){const x=w.fitDatum.map(I=>({x:I.x,y:I.y,z:0}));b.add(new Qr(x,"Uniform"))}}}),e.add(b)}}),e}convertTable(t){const e=new xi(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((n,a)=>e.setColumnWidth(a,n)),t.rowHeightArr.forEach((n,a)=>e.setRowHeight(a,n)),t.cells.forEach((n,a)=>{e.setCell(a,n)}),e}convertText(t){const e=new wi;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=Pt.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Hs;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=Pt.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new X(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new bi;return t.vertices.forEach(n=>{e.appendVertex(n)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,n=new Ci(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(n.dimBlockPosition={...e.insertionPoint,z:0}),n.rotation=Pt.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,n),n}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,n=new Ti(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,n),n}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,n=new Li(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,n),n}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,n=new Oi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,n),n}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,n=new Ni(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,n),n}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(n=>{e.clipBoundary.push(new Tt(n))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new Ys;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(n=>{e.clipBoundary.push(new Tt(n))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new Mi;return this.processWipeout(t,e),e}convertViewport(t){const e=new Ei;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Ii;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new ki;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new Wn(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?Pt.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=Ui.deserialize(t.transparency))}numberArrayToPointArray(t,e){const n=t.length;let a=0;if(n/2==e?a=2:n/3==e&&(a=3),a==0)return;const h=[];for(let c=0,g=n/a;c<g;++c)h.push({x:t[c*a],y:t[c*a+1],z:a==3?t[c*a+2]:0});return h}}class wn extends Jr{constructor(t,e){t=t||{},qn(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const Kr=class Kr extends wn{static isModelSapceName(t){return t.toLowerCase()==Kr.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Kr.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new W,this._layoutId="",this._entities=new Map}get isModelSapce(){return Kr.isModelSapceName(this.name)}get isPaperSapce(){return Kr.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}appendEntity(t){if(Array.isArray(t))for(let e=0;e<t.length;++e){const n=t[e];n.database=this.database,n.ownerId=this.objectId,this._entities.set(n.objectId,n)}else t.database=this.database,t.ownerId=this.objectId,this._entities.set(t.objectId,t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}newIterator(){return new Xi(this._entities)}getIdAt(t){return this._entities.get(t)}};Kr.MODEL_SPACE_NAME="*MODEL_SPACE",Kr.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let le=Kr;class C0{convertLayout(t,e){var a,h;const n=new Yi;if(n.layoutName=t.layoutName,n.tabOrder=t.tabOrder,t.layoutName==="Model"){const c=le.MODEL_SPACE_NAME;(a=e.tables.BLOCK_RECORD)==null||a.entries.some(g=>g.name.toUpperCase()===c?(n.blockTableRecordId=g.handle,!0):!1)}else(h=e.tables.BLOCK_RECORD)==null||h.entries.some(c=>c.layoutObjects===t.handle?(n.blockTableRecordId=c.handle,!0):!1),n.blockTableRecordId||(n.blockTableRecordId=t.paperSpaceTableId);return n.limits.min.copy(t.minLimit),n.limits.max.copy(t.maxLimit),n.extents.min.copy(t.minExtent),n.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,n),n}convertImageDef(t){const e=new Eh;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Vc{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const n=Date.now(),a=this.generateTaskId();try{return await this.executeInWorker(a,t,e||this.config.workerUrl)}catch(h){const c=Date.now()-n;return{success:!1,error:h instanceof Error?h.message:String(h),duration:c}}}async executeInWorker(t,e,n){const a=Date.now();return new Promise((h,c)=>{const g=this.getAvailableWorker(n),b=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(g),c(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:x=>{clearTimeout(b),this.releaseWorker(g),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(g),c(x)},timeout:b});const f=x=>{const{id:I,success:M,data:L,error:O}=x.data;if(I!==t)return;this.cleanupTask(t);const F=Date.now()-a;h(M?{success:!0,data:L,duration:F}:{success:!1,error:O,duration:F})},w=x=>{this.cleanupTask(t),c(new Error(`Worker error: ${x.message}`))};g.addEventListener("message",f),g.addEventListener("error",w),g.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[n,a]of this.workers)if(!a.isBusy)return a.isBusy=!0,a.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const n=new Worker(t,{type:"module"}),a=this.generateWorkerId(),h={worker:n,isBusy:!0,id:a,createdAt:new Date};return this.workers.set(a,h),n}const e=Array.from(this.workers.values()).sort((n,a)=>n.createdAt.getTime()-a.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,n]of this.workers)if(n.worker===t){n.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Uc{constructor(t){this.framework=new Vc(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function jc(i){return new Uc(i)}class N0{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:n}=t.data;try{const a=await this.executeTask(n);this.sendResponse(e,!0,a)}catch(a){this.sendResponse(e,!1,void 0,a instanceof Error?a.message:String(a))}}}sendResponse(t,e,n,a){const h={id:t,success:e,data:n,error:a};self.postMessage(h)}}class Gc extends Qa{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t){if(this.config.useWorker&&this.config.parserWorkerUrl){const e=jc({workerUrl:this.config.parserWorkerUrl,maxConcurrentWorkers:1}),n=await e.execute(t);if(e.destroy(),n.success)return{model:n.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${n.error}'`)}else return{model:new T0().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var h;const e=new Map,n=c=>{if(c){const g=c.lastIndexOf(".");return g>=0?c.substring(0,g).toLowerCase():c.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(c=>{const g=[];if(c.font){const b=n(c.font);b&&g.push(b)}if(c.bigFont){const b=n(c.bigFont);b&&g.push(b)}if(c.extendedFont){const b=n(c.extendedFont);b&&g.push(b)}e.set(c.name,g)});const a=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,a),Array.from(a)}getFontsInBlock(t,e,n,a){const h=/\\f(.*?)\|/g;t.forEach(c=>{if(c.type=="MTEXT"){const g=c;[...g.text.matchAll(h)].forEach(w=>{a.add(w[1].toLowerCase())});const f=n.get(g.styleName);f==null||f.forEach(w=>a.add(w))}else if(c.type=="TEXT"){const g=c,b=n.get(g.styleName);b==null||b.forEach(f=>a.add(f))}else if(c.type=="INSERT"){const b=e[c.name];b&&b.entities&&this.getFontsInBlock(b.entities,e,n,a)}})}async processEntities(t,e,n,a,h){const c=new vl;let g=t.entities;const b=g.length,f=new Ca(b,100-a.value,n);this.config.convertByEntityType&&(g=this.groupAndFlattenByType(g));const w=e.tables.blockTable.modelSpace;await f.processChunk(async(x,I)=>{let M=[],L=x<I?g[x].type:"";for(let O=x;O<I;O++){const F=g[O],D=c.convert(F);D&&(this.config.convertByEntityType&&F.type!==L&&(w.appendEntity(M),M=[],L=F.type),M.push(D))}if(w.appendEntity(M),h){let O=a.value+I/b*(100-a.value);O>100&&(O=100),await h(O,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(t,e){const n=new vl,a=t.length,h=[];for(let c=0;c<a;c++){const g=t[c],b=n.convert(g);b&&h.push(b)}e.appendEntity(h)}processBlocks(t,e){const n=t.blocks;for(const[a,h]of Object.entries(n)){let c=e.tables.blockTable.getAt(h.name);c||(c=new le,c.objectId=h.handle,c.name=a,c.origin.copy(h.position),e.tables.blockTable.add(c)),h.entities&&this.processEntitiesInBlock(h.entities,c)}}processHeader(t,e){const n=t.header;n.$ACADVER&&(e.version=n.$ACADVER),e.cecolor.colorIndex=n.$CECOLOR||256,e.angBase=n.$ANGBASE||0,e.angDir=n.$ANGDIR||0,n.$AUNITS!=null&&(e.aunits=n.$AUNITS),n.$EXTMAX&&(e.extmax=n.$EXTMAX),n.$EXTMIN&&(e.extmin=n.$EXTMIN),n.$INSUNITS!=null&&(e.insunits=n.$INSUNITS),e.pdmode=n.$PDMODE||0,e.pdsize=n.$PDSIZE||0}processBlockTables(t,e){var a;const n=(a=t.tables.BLOCK_RECORD)==null?void 0:a.entries;n&&n.length>0&&(e.tables.blockTable.removeAll(),n.forEach(h=>{const c=new le;c.objectId=h.handle,c.name=h.name,c.layoutId=h.layoutObjects,e.tables.blockTable.add(c)}))}processObjects(t,e){const n=t.objects.byName,a=new C0;if("LAYOUT"in n){const h=e.dictionaries.layouts;n.LAYOUT.forEach(c=>{const g=a.convertLayout(c,t);h.setAt(g.layoutName,g)})}if("IMAGEDEF"in n){const h=e.dictionaries.imageDefs;n.IMAGEDEF.forEach(c=>{const g=a.convertImageDef(c);h.setAt(g.objectId,g)})}}processViewports(t,e){var a,h;const n=(h=(a=t.tables)==null?void 0:a.VPORT)==null?void 0:h.entries;n&&n.length>0&&n.forEach(c=>{const g=new ru;this.processCommonTableEntryAttrs(c,g),c.circleSides&&(g.circleSides=c.circleSides),g.standardFlag=c.standardFlag,g.center.copy(c.center),g.lowerLeftCorner.copy(c.lowerLeftCorner),g.upperRightCorner.copy(c.upperRightCorner),c.snapBasePoint&&g.snapBase.copy(c.snapBasePoint),c.snapRotationAngle&&(g.snapAngle=c.snapRotationAngle),c.snapSpacing&&g.snapIncrements.copy(c.snapSpacing),c.majorGridLines&&(g.gridMajor=c.majorGridLines),c.gridSpacing&&g.gridIncrements.copy(c.gridSpacing),c.backgroundObjectId&&(g.backgroundObjectId=c.backgroundObjectId),g.gsView.center.copy(c.center),g.gsView.viewDirectionFromTarget.copy(c.viewDirectionFromTarget),g.gsView.viewTarget.copy(c.viewTarget),c.lensLength&&(g.gsView.lensLength=c.lensLength),c.frontClippingPlane&&(g.gsView.frontClippingPlane=c.frontClippingPlane),c.backClippingPlane&&(g.gsView.backClippingPlane=c.backClippingPlane),c.viewHeight&&(g.gsView.viewHeight=c.viewHeight),c.viewTwistAngle&&(g.gsView.viewTwistAngle=c.viewTwistAngle),c.frozenLayers&&(g.gsView.frozenLayers=c.frozenLayers),c.styleSheet&&(g.gsView.styleSheet=c.styleSheet),c.renderMode&&(g.gsView.renderMode=c.renderMode),c.viewMode&&(g.gsView.viewMode=c.viewMode),c.ucsIconSetting&&(g.gsView.ucsIconSetting=c.ucsIconSetting),c.ucsOrigin&&g.gsView.ucsOrigin.copy(c.ucsOrigin),c.ucsXAxis&&g.gsView.ucsXAxis.copy(c.ucsXAxis),c.ucsYAxis&&g.gsView.ucsYAxis.copy(c.ucsYAxis),c.orthographicType&&(g.gsView.orthographicType=c.orthographicType),c.shadePlotSetting&&(g.gsView.shadePlotSetting=c.shadePlotSetting),c.shadePlotObjectId&&(g.gsView.shadePlotObjectId=c.shadePlotObjectId),c.visualStyleObjectId&&(g.gsView.visualStyleObjectId=c.visualStyleObjectId),c.isDefaultLightingOn&&(g.gsView.isDefaultLightingOn=c.isDefaultLightingOn),c.defaultLightingType&&(g.gsView.defaultLightingType=c.defaultLightingType),c.brightness&&(g.gsView.brightness=c.brightness),c.contrast&&(g.gsView.contrast=c.contrast),c.ambientColor&&(g.gsView.ambientColor=c.ambientColor),e.tables.viewportTable.add(g)})}processLayers(t,e){var a,h;const n=(h=(a=t.tables)==null?void 0:a.LAYER)==null?void 0:h.entries;n&&n.length>0&&n.forEach(c=>{const g=new zr;g.colorIndex=c.colorIndex;const b=new $i({name:c.name,standardFlags:c.standardFlag,linetype:c.lineType,lineWeight:c.lineweight,isOff:c.colorIndex<0,color:g,isPlottable:c.isPlotting});this.processCommonTableEntryAttrs(c,b),e.tables.layerTable.add(b)})}processLineTypes(t,e){var a,h;const n=(h=(a=t.tables)==null?void 0:a.LTYPE)==null?void 0:h.entries;n&&n.length>0&&n.forEach(c=>{const g=new js(c);this.processCommonTableEntryAttrs(c,g),g.name=c.name,e.tables.linetypeTable.add(g)})}processTextStyles(t,e){var a;const n=(a=t.tables.STYLE)==null?void 0:a.entries;n&&n.length>0&&n.forEach(h=>{const c=new no(h);this.processCommonTableEntryAttrs(h,c),e.tables.textStyleTable.add(c)})}processDimStyles(t,e){var a;const n=(a=t.tables.DIMSTYLE)==null?void 0:a.entries;n&&n.length>0&&n.forEach(h=>{const c={name:h.name,ownerId:h.ownerObjectId,dimpost:h.DIMPOST||"",dimapost:h.DIMAPOST||"",dimscale:h.DIMSCALE,dimasz:h.DIMASZ,dimexo:h.DIMEXO,dimdli:h.DIMDLI,dimexe:h.DIMEXE,dimrnd:h.DIMRND,dimdle:h.DIMDLE,dimtp:h.DIMTP,dimtm:h.DIMTM,dimtxt:h.DIMTXT,dimcen:h.DIMCEN,dimtsz:h.DIMTSZ,dimaltf:h.DIMALTF,dimlfac:h.DIMLFAC,dimtvp:h.DIMTVP,dimtfac:h.DIMTFAC,dimgap:h.DIMGAP,dimaltrnd:h.DIMALTRND,dimtol:h.DIMTOL==null||h.DIMTOL==0?0:1,dimlim:h.DIMLIM==null||h.DIMLIM==0?0:1,dimtih:h.DIMTIH==null||h.DIMTIH==0?0:1,dimtoh:h.DIMTOH==null||h.DIMTOH==0?0:1,dimse1:h.DIMSE1==null||h.DIMSE1==0?0:1,dimse2:h.DIMSE2==null||h.DIMSE2==0?0:1,dimtad:h.DIMTAD,dimzin:h.DIMZIN,dimazin:h.DIMAZIN,dimalt:h.DIMALT,dimaltd:h.DIMALTD,dimtofl:h.DIMTOFL,dimsah:h.DIMSAH,dimtix:h.DIMTIX,dimsoxd:h.DIMSOXD,dimclrd:h.DIMCLRD,dimclre:h.DIMCLRE,dimclrt:h.DIMCLRT,dimadec:h.DIMADEC||0,dimunit:h.DIMUNIT||2,dimdec:h.DIMDEC,dimtdec:h.DIMTDEC,dimaltu:h.DIMALTU,dimalttd:h.DIMALTTD,dimaunit:h.DIMAUNIT,dimfrac:h.DIMFRAC,dimlunit:h.DIMLUNIT,dimdsep:h.DIMDSEP,dimtmove:h.DIMTMOVE||0,dimjust:h.DIMJUST,dimsd1:h.DIMSD1,dimsd2:h.DIMSD2,dimtolj:h.DIMTOLJ,dimtzin:h.DIMTZIN,dimaltz:h.DIMALTZ,dimalttz:h.DIMALTTZ,dimfit:h.DIMFIT||0,dimupt:h.DIMUPT,dimatfit:h.DIMATFIT,dimtxsty:h.DIMTXSTY||"Standard",dimldrblk:h.DIMLDRBLK||"",dimblk:h.DIMBLK||"",dimblk1:h.DIMBLK1||"",dimblk2:h.DIMBLK2||"",dimlwd:h.DIMLWD,dimlwe:h.DIMLWE},g=new Hn(c);this.processCommonTableEntryAttrs(h,g),e.tables.dimStyleTable.add(g)})}processCommonTableEntryAttrs(t,e){e.name=t.name,e.objectId=t.handle,e.ownerId=t.ownerObjectId}groupAndFlattenByType(t){const e={},n=[];for(const a of t)e[a.type]||(e[a.type]=[],n.push(a.type)),e[a.type].push(a);return n.flatMap(a=>e[a])}}class Wc extends Qa{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,n,a,h){let c=t.tables.blockTable.modelSpace.newIterator().toArray();const g=c.length,b=new Ca(g,100-a.value,n);this.config.convertByEntityType&&(c=this.groupAndFlattenByType(c));const f=e.tables.blockTable.modelSpace;await b.processChunk(async(w,x)=>{let I=[],M=w<x?c[w].type:"";for(let L=w;L<x;L++){const O=c[L];this.config.convertByEntityType&&O.type!==M&&(this.triggerEvents(f,I),I=[],M=O.type),I.push(O)}if(this.triggerEvents(f,I),h){let L=a.value+x/g*(100-a.value);L>100&&(L=100),await h(L,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const n=e.newIterator().toArray();this.triggerEvents(e,n)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.dictionaries.layouts.newIterator();for(const n of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:n,key:n.layoutName});const e=this._database.dictionaries.imageDefs.newIterator();for(const n of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:n,key:n.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},n=[];for(const a of t)e[a.type]||(e[a.type]=[],n.push(a.type)),e[a.type].push(a);return n.flatMap(a=>e[a])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}var Us=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Us||{});class pr{constructor(){this.events={registered:new oe,unregistered:new oe},this._converters=new Map,this.register("dxf",new Gc)}static createInstance(){return pr._instance==null&&(pr._instance=new pr),this._instance}static get instance(){return pr._instance||(pr._instance=new pr),pr._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}))}}class An extends Jr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database;const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),n=this._recordsByName.get(e);return n?(this._recordsById.delete(n.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new Xi(this._recordsByName)}normalizeName(t){return t}}class Hc extends An{constructor(t){super(t)}get modelSpace(){let t=this.getAt(le.MODEL_SPACE_NAME);return t||(t=new le,t.name=le.MODEL_SPACE_NAME,this.add(t)),t}normalizeName(t){let e=t;if(le.isModelSapceName(t))e=le.MODEL_SPACE_NAME;else if(le.isPaperSapceName(t)){const n=le.PAPER_SPACE_NAME_PREFIX,a=t.substring(n.length);e=n+a}return e}}class qc extends An{constructor(t){super(t)}}class $i extends wn{constructor(t,e){t=t||{},qn(t,{color:new zr,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new Ui,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(n=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:n.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)}}class Yc extends An{constructor(t){super(t);const e=new zr,n=new $i({name:"0",standardFlags:0,linetype:di,lineWeight:qi.ByLineWeightDefault,isOff:!1,color:e,isPlottable:!0});this.add(n)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class Xc extends An{constructor(t){super(t)}}class Kc extends An{constructor(t){super(t)}get fonts(){const t=new Set,e=a=>{if(a){const h=a.lastIndexOf(".");if(h>=0){const c=a.substring(0,h).toLowerCase();t.add(c)}else t.add(a.toLowerCase())}},n=this.newIterator();for(const a of n)e(a.fileName),e(a.bigFontFileName);return Array.from(t)}}class $c extends An{constructor(t){super(t)}}class L0 extends Jr{constructor(){super(),this.events={dictObjetSet:new oe,dictObjectErased:new oe,entityAppended:new oe,entityModified:new oe,layerAppended:new oe,layerModified:new oe,layerErased:new oe,openProgress:new oe,headerSysVarChanged:new oe},this._version=new zi("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Na.DecimalDegrees,this._celtscale=1,this._cecolor=new zr,this._extents=new Ct,this._insunits=Za.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Hc(this),dimStyleTable:new qc(this),linetypeTable:new Xc(this),textStyleTable:new Kc(this),layerTable:new Yc(this),viewportTable:new $c(this)},this._dictionaries={layouts:new Ih(this),imageDefs:new $a(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}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._aunits=t||0,this.triggerHeaderSysVarChangedEvent("aunits")}get version(){return this._version}set version(t){this._version=new zi(t),this.triggerHeaderSysVarChangedEvent("version")}get insunits(){return this._insunits}set insunits(t){this._insunits=t||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(t){this._ltscale=t||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(t){this._cecolor=t||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(t){this._celtscale=t||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(t){this._angBase=t||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(t){this._angDir=t||0,this.triggerHeaderSysVarChangedEvent("angdir")}get extmax(){return this._extents.max}set extmax(t){t&&(this._extents.expandByPoint(t),this.triggerHeaderSysVarChangedEvent("extmax"))}get extmin(){return this._extents.min}set extmin(t){t&&(this._extents.expandByPoint(t),this.triggerHeaderSysVarChangedEvent("extmin"))}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this._pdmode=t||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(t){this._pdsize=t||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(t,e,n=Us.DXF){const a=pr.instance.get(n);if(a==null)throw new Error(`Database converter for file type '${n}' isn't registered and can can't read this file!`);this.clear(),await a.read(t,this,e&&e.minimumChunkSize||10,async(h,c,g,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:c,subStageStatus:g,data:b}),e&&e.fontLoader&&c=="FONT"&&g=="END"){const f=b||this.tables.textStyleTable.fonts;await e.fontLoader.load(f)}})}async openUri(t,e){var M;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const n=await fetch(t);if(!n.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${n.status}'!`);const a=n.headers.get("content-length"),h=a?parseInt(a,10):null;let c=0;const g=(M=n.body)==null?void 0:M.getReader();if(!g)throw new Error("Failed to get response reader");const b=[];for(;;){const{done:L,value:O}=await g.read();if(L)break;if(b.push(O),c+=O.length,h!==null){const F=Math.round(c/h*100);this.events.openProgress.dispatch({database:this,percentage:F,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(c);let w=0;for(const L of b)f.set(L,w),w+=L.length;this.getFileNameFromUri(t).toLowerCase().split(".").pop()==="dwg"?await this.read(f.buffer,e,Us.DWG):await this.read(f.buffer,e,Us.DXF),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}async regen(){await new Wc(this).read(null,this,500,async(e,n,a,h)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:n,subStageStatus:a,data:h})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Mh(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._dictionaries.layouts.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}triggerHeaderSysVarChangedEvent(t){this.events.headerSysVarChanged.dispatch({database:this,name:t})}getFileNameFromUri(t){try{const n=new URL(t).pathname.split("/");return n[n.length-1]||""}catch(e){return console.error("Invalid URI:",e),""}}}var Zc=(i=>(i[i.Center=0]="Center",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.OverFirst=3]="OverFirst",i[i.OverSecond=4]="OverSecond",i))(Zc||{}),Qc=(i=>(i[i.Center=0]="Center",i[i.Above=1]="Above",i[i.Outside=2]="Outside",i[i.JIS=3]="JIS",i[i.Below=4]="Below",i))(Qc||{}),Jc=(i=>(i[i.Feet=0]="Feet",i[i.None=1]="None",i[i.Inch=2]="Inch",i[i.FeetAndInch=3]="FeetAndInch",i[i.Leading=4]="Leading",i[i.Trailing=8]="Trailing",i[i.LeadingAndTrailing=12]="LeadingAndTrailing",i))(Jc||{}),tu=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(tu||{}),eu=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(eu||{});const Di=class Di extends wn{constructor(t,e){t=t||{},qn(t,Di.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)}};Di.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:"Standard",dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let Hn=Di;class js extends wn{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}}const Fi=class Fi{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new oe},this.registerVar({name:"PICKBOX",type:"number",defaultValue:0})}static instance(){return this._instance||(this._instance=new Fi),this._instance}registerVar(t){this.registry.set(t.name.toUpperCase(),t)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t){if(t=t.toUpperCase(),this.cache.has(t))return this.cache.get(t)}setVar(t,e){t=t.toUpperCase();const n=this.getDescriptor(t);if(n){const a=this.getVar(t);if(this.cache.set(t,e),n.type!=="string"&&(typeof e=="string"||e instanceof String))if(n.type==="number"){const h=Number(e);if(Number.isNaN(h))throw new Error("Invalid input!");e=h}else n.type==="boolean"&&(e=this.parseBoolean(e));this.events.sysVarChanged.dispatch({name:t,newVal:e,oldVal:a})}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(t.toUpperCase())}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),n=new Set(["true","t","1","yes","y"]),a=new Set(["false","f","0","no","n"]);return n.has(e)?!0:(a.has(e),!1)}};Fi._instance=null;let ka=Fi;class no extends wn{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const n=e.lastIndexOf(".");return n===-1?e:e.substring(0,n)}return t}}const O0={center:new Tt,viewDirectionFromTarget:new W(0,0,1),viewTarget:new W(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:Ya.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new W(0,0,0),ucsXAxis:new W(1,0,0),ucsYAxis:new W(0,1,0),orthographicType:Xa.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Ka.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class ru extends wn{constructor(){super(),this._circleSides=100,this._center=new Tt,this._lowerLeftCorner=new Tt(0,0),this._upperRightCorner=new Tt(1,1),this._snapBase=new Tt(0,0),this._snapAngle=0,this._snapSpacing=new Tt(0,0),this._standardFlag=0,this._gridSpacing=new Tt,this._gridMajor=10,this._gsView=O0}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this._center}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}get gsView(){return this._gsView}}class nu{constructor(){this.events={layoutCreated:new oe,layoutRemoved:new oe,layoutRenamed:new oe,layoutSwitched:new oe}}countLayouts(t){return this.getWorkingDatabase(t).dictionaries.layouts.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const n=this.getWorkingDatabase(e),a=n.dictionaries.layouts.getIdAt(t);return this.setCurrentLayoutInternal(a,n)}setCurrentLayoutBtrId(t,e){const n=this.getWorkingDatabase(e),a=n.dictionaries.layouts.getBtrIdAt(t);return this.setCurrentLayoutInternal(a,n)}setCurrentLayout(t,e){const n=this.getWorkingDatabase(e),a=n.dictionaries.layouts.getAt(t);return this.setCurrentLayoutInternal(a,n)}renameLayout(t,e,n){const h=this.getWorkingDatabase(n).dictionaries.layouts.getAt(t);return h?(h.layoutName=e,this.events.layoutRenamed.dispatch({layout:h,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.has(t)}deleteLayout(t,e){const n=this.getWorkingDatabase(e).dictionaries.layouts,a=n.getAt(t);let h=!1;return a&&(h=n.remove(t),h&&this.events.layoutRemoved.dispatch({layout:a})),h}createLayout(t,e){const n=this.getWorkingDatabase(e),a=new Yi;a.layoutName=t,a.tabOrder=n.dictionaries.layouts.maxTabOrder;const h=new le;return h.name=`*Paper_Space${a.tabOrder}`,n.tables.blockTable.add(h),n.dictionaries.layouts.setAt(t,a),this.events.layoutCreated.dispatch({layout:a}),{layout:a,btr:h}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.dictionaries.layouts.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||so().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function so(){return Ri.instance}const Vi=class Vi{constructor(){this._workingDatabase=null,this._layoutManager=new nu}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}};Vi.instance=new Vi;let Ri=Vi;exports.AcCmColor=zr;exports.AcCmColorMethod=pt;exports.AcCmColorUtil=gn;exports.AcCmEntityColor=xu;exports.AcCmErrors=qe;exports.AcCmEventDispatcher=wu;exports.AcCmEventManager=oe;exports.AcCmLoader=Tu;exports.AcCmLoadingManager=Ml;exports.AcCmObject=Pl;exports.AcCmPerformanceCollector=Ta;exports.AcCmTask=Il;exports.AcCmTaskScheduler=El;exports.AcCmTransparency=Ui;exports.AcCmTransparencyMethod=Ie;exports.AcDb2dPolyline=mi;exports.AcDb2dVertex=Sa;exports.AcDb2dVertexType=_h;exports.AcDb3PointAngularDimension=Ti;exports.AcDb3dPolyline=gi;exports.AcDb3dVertex=Ia;exports.AcDb3dVertexType=yh;exports.AcDbAlignedDimension=Ci;exports.AcDbAngleUnits=Na;exports.AcDbArc=fi;exports.AcDbArcDimension=Ea;exports.AcDbBaseWorker=N0;exports.AcDbBatchProcessing=Ca;exports.AcDbBlockReference=Wn;exports.AcDbBlockTable=Hc;exports.AcDbBlockTableRecord=le;exports.AcDbCircle=_i;exports.AcDbCodePage=La;exports.AcDbCurve=Me;exports.AcDbDataGenerator=Mh;exports.AcDbDatabase=L0;exports.AcDbDatabaseConverter=Qa;exports.AcDbDatabaseConverterManager=pr;exports.AcDbDiametricDimension=Ni;exports.AcDbDictionary=$a;exports.AcDbDimArrowType=kh;exports.AcDbDimStyleTable=qc;exports.AcDbDimStyleTableRecord=Hn;exports.AcDbDimTextHorizontal=Zc;exports.AcDbDimTextVertical=Qc;exports.AcDbDimVerticalJustification=eu;exports.AcDbDimZeroSuppression=Jc;exports.AcDbDimZeroSuppressionAngular=tu;exports.AcDbDimension=Br;exports.AcDbDwgVersion=zi;exports.AcDbDxfConverter=Gc;exports.AcDbEllipse=yi;exports.AcDbEntity=Ee;exports.AcDbFace=vi;exports.AcDbFileType=Us;exports.AcDbHatch=Gs;exports.AcDbHatchPatternType=Vs;exports.AcDbHatchStyle=vh;exports.AcDbHostApplicationServices=Ri;exports.AcDbLayerTable=Yc;exports.AcDbLayerTableRecord=$i;exports.AcDbLayout=Yi;exports.AcDbLayoutDictionary=Ih;exports.AcDbLayoutManager=nu;exports.AcDbLeader=bi;exports.AcDbLeaderAnnotationType=bh;exports.AcDbLine=Ws;exports.AcDbLineSpacingStyle=Sh;exports.AcDbLinetypeTable=Xc;exports.AcDbLinetypeTableRecord=js;exports.AcDbMText=Hs;exports.AcDbObject=Jr;exports.AcDbObjectIterator=Xi;exports.AcDbOrdinateDimension=Li;exports.AcDbOsnapMode=Ft;exports.AcDbPoint=Si;exports.AcDbPoly2dType=Vn;exports.AcDbPoly3dType=Fs;exports.AcDbPolyline=Pi;exports.AcDbRadialDimension=Oi;exports.AcDbRasterImage=Ys;exports.AcDbRasterImageClipBoundaryType=Ah;exports.AcDbRasterImageDef=Eh;exports.AcDbRasterImageImageDisplayOpt=Ph;exports.AcDbRay=Ii;exports.AcDbRegenerator=Wc;exports.AcDbRenderingCache=Yn;exports.AcDbSpline=qs;exports.AcDbSymbolTable=An;exports.AcDbSymbolTableRecord=wn;exports.AcDbSysVarManager=ka;exports.AcDbTable=xi;exports.AcDbText=wi;exports.AcDbTextHorizontalMode=xh;exports.AcDbTextStyleTable=Kc;exports.AcDbTextStyleTableRecord=no;exports.AcDbTextVerticalMode=wh;exports.AcDbTrace=Ai;exports.AcDbUnitsValue=Za;exports.AcDbViewport=Ei;exports.AcDbViewportTable=$c;exports.AcDbViewportTableRecord=ru;exports.AcDbWipeout=Mi;exports.AcDbWorkerApi=Uc;exports.AcDbWorkerManager=Vc;exports.AcDbXline=ki;exports.AcGeArea2d=Gi;exports.AcGeBox2d=xe;exports.AcGeBox3d=Ct;exports.AcGeCatmullRomCurve3d=ph;exports.AcGeCircArc2d=jn;exports.AcGeCircArc3d=Wa;exports.AcGeCurve2d=Xn;exports.AcGeEllipseArc2d=Wi;exports.AcGeEllipseArc3d=Hi;exports.AcGeEuler=lh;exports.AcGeGeometryUtil=th;exports.AcGeLine2d=Ds;exports.AcGeLine3d=Gn;exports.AcGeLoop2d=Ha;exports.AcGeMathUtil=Pt;exports.AcGeMatrix2d=ji;exports.AcGeMatrix3d=Zr;exports.AcGeNurbsCurve=vn;exports.AcGePlane=Xs;exports.AcGePoint2d=Tt;exports.AcGePoint3d=W;exports.AcGePolyline2d=xn;exports.AcGeQuaternion=$r;exports.AcGeShape2d=Ga;exports.AcGeSpline3d=Qr;exports.AcGeTol=Va;exports.AcGeVector2d=Jt;exports.AcGeVector3d=X;exports.AcGiArrowType=qa;exports.AcGiDefaultLightingType=Ka;exports.AcGiLineWeight=qi;exports.AcGiMTextAttachmentPoint=be;exports.AcGiMTextFlowDirection=Or;exports.AcGiOrthographicType=Xa;exports.AcGiRenderMode=Ya;exports.AcGiViewport=mh;exports.AcTrStringUtil=ku;exports.ByBlock=Cl;exports.ByLayer=ii;exports.DEBUG_MODE=Eu;exports.DEFAULT_LINE_TYPE=di;exports.DEFAULT_TOL=Ua;exports.DEG2RAD=Oa;exports.DefaultLoadingManager=kl;exports.FLOAT_TOL=_n;exports.ORIGIN_POINT_2D=Nu;exports.ORIGIN_POINT_3D=Fa;exports.RAD2DEG=Ba;exports.TAU=Zt;exports.acdbHostApplicationServices=so;exports.basisFunction=pi;exports.calculateCurveLength=sh;exports.ceilPowerOfTwo=ql;exports.clamp=Lr;exports.clone=Ls;exports.createWorkerApi=jc;exports.damp=Bl;exports.deepClone=ba;exports.defaults=qn;exports.degToRad=Gl;exports.dwgCodePageToEncoding=Tl;exports.euclideanModulo=za;exports.evaluateNurbsPoint=Rs;exports.floorPowerOfTwo=Yl;exports.generateChordKnots=rh;exports.generateSqrtChordKnots=nh;exports.generateUUID=Nl;exports.generateUniformKnots=eh;exports.has=bl;exports.intPartLength=Da;exports.interpolateControlPoints=Lu;exports.inverseLerp=Ol;exports.isBetween=Xl;exports.isBetweenAngle=Kl;exports.isEmpty=xl;exports.isEqual=Un;exports.isImperialUnits=Wu;exports.isMetricUnits=Gu;exports.isPointInPolygon=ja;exports.isPolygonIntersect=Jl;exports.isPowerOfTwo=Hl;exports.lerp=Ra;exports.log=Bs;exports.mapLinear=Ll;exports.normalizeAngle=zs;exports.pingpong=zl;exports.radToDeg=Wl;exports.randFloat=Vl;exports.randFloatSpread=Ul;exports.randInt=Fl;exports.relativeEps=$l;exports.seededRandom=jl;exports.setLogLevel=Mu;exports.smootherstep=Dl;exports.smoothstep=Rl;
|