@mlightcad/data-model 1.0.10 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-model.js +1433 -1194
- package/dist/data-model.umd.cjs +2 -2
- package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
- package/lib/converter/AcDbEntitiyConverter.js +3 -7
- package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
- package/lib/entity/AcDbSpline.d.ts +5 -3
- package/lib/entity/AcDbSpline.d.ts.map +1 -1
- package/lib/entity/AcDbSpline.js +11 -6
- package/lib/entity/AcDbSpline.js.map +1 -1
- package/lib/object/layout/AcDbLayoutDictionary.js +1 -1
- package/lib/object/layout/AcDbLayoutDictionary.js.map +1 -1
- package/package.json +4 -4
package/dist/data-model.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(g,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(g=typeof globalThis<"u"?globalThis:g||self,ct(g["data-model"]={}))})(this,function(g){"use strict";function ct(n,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in n)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const Dt={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},_s=[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];function dt(n,e,t){return Math.max(e,Math.min(t,n))}const dn=class oa{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(e){e==null?this._color=null:(this._color=Math.round(dt(e,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let e=this._color.toString(16).toUpperCase();for(;e.length<6;)e="0"+e;return`0x${e}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(e){e==null?this._colorIndex=null:(this._colorIndex=dt(e,0,256),this._color=_s[e],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(e){if(e){const t=Dt[e.toLowerCase()];t!==void 0?(this._colorName=e,this._color=t,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+e)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(e){return this.setRGB(e,e,e),this}setRGB(e,t,s){const r=Math.round(dt(e,0,255)),i=Math.round(dt(t,0,255)),a=Math.round(dt(s,0,255));return this.color=(r<<16)+(i<<8)+a,this}setColorName(e){const t=Dt[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new oa;return e.colorIndex=this.colorIndex,e.color=this.color,e._colorName=this._colorName,this}copy(e){return this.colorIndex=e.colorIndex,this.color=e.color,this._colorName=e._colorName,this}equals(e){return e.color==this.color&&e.colorIndex==this.colorIndex&&e._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(e){for(const[t,s]of Object.entries(Dt))if(s===e)return t;return null}getColorIndexByValue(e){const t=_s.length-1;for(let s=1;s<t;++s)if(_s[s]===e)return s;return null}};dn.NAMES=Dt;let Ne=dn;const te={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 ma{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const s=t.slice(0);for(let r=0,i=s.length;r<i;r++)s[r].call(this,e)}}}let se=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 s of this.listeners)s.call(null,e,...t)}};var ga=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var un={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(ga,function(){var e=function(){},t="undefined",s=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],i={},a=null;function o(_,x){var f=_[x];if(typeof f.bind=="function")return f.bind(_);try{return Function.prototype.bind.call(f,_)}catch{return function(){return Function.prototype.apply.apply(f,[_,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function h(_){return _==="debug"&&(_="log"),typeof console===t?!1:_==="trace"&&s?c:console[_]!==void 0?o(console,_):console.log!==void 0?o(console,"log"):e}function d(){for(var _=this.getLevel(),x=0;x<r.length;x++){var f=r[x];this[f]=x<_?e:this.methodFactory(f,_,this.name)}if(this.log=this.debug,typeof console===t&&_<this.levels.SILENT)return"No console available for logging"}function u(_){return function(){typeof console!==t&&(d.call(this),this[_].apply(this,arguments))}}function m(_,x,f){return h(_)||u.apply(this,arguments)}function p(_,x){var f=this,M,T,S,I="loglevel";typeof _=="string"?I+=":"+_:typeof _=="symbol"&&(I=void 0);function z(O){var V=(r[O]||"silent").toUpperCase();if(!(typeof window===t||!I)){try{window.localStorage[I]=V;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+V+";"}catch{}}}function P(){var O;if(!(typeof window===t||!I)){try{O=window.localStorage[I]}catch{}if(typeof O===t)try{var V=window.document.cookie,Qe=encodeURIComponent(I),Je=V.indexOf(Qe+"=");Je!==-1&&(O=/^([^;]+)/.exec(V.slice(Je+Qe.length+1))[1])}catch{}return f.levels[O]===void 0&&(O=void 0),O}}function W(){if(!(typeof window===t||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function le(O){var V=O;if(typeof V=="string"&&f.levels[V.toUpperCase()]!==void 0&&(V=f.levels[V.toUpperCase()]),typeof V=="number"&&V>=0&&V<=f.levels.SILENT)return V;throw new TypeError("log.setLevel() called with invalid level: "+O)}f.name=_,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=x||m,f.getLevel=function(){return S??T??M},f.setLevel=function(O,V){return S=le(O),V!==!1&&z(S),d.call(f)},f.setDefaultLevel=function(O){T=le(O),P()||f.setLevel(O,!1)},f.resetLevel=function(){S=null,W(),d.call(f)},f.enableAll=function(O){f.setLevel(f.levels.TRACE,O)},f.disableAll=function(O){f.setLevel(f.levels.SILENT,O)},f.rebuild=function(){if(a!==f&&(M=le(a.getLevel())),d.call(f),a===f)for(var O in i)i[O].rebuild()},M=le(a?a.getLevel():"WARN");var Me=P();Me!=null&&(S=le(Me)),d.call(f)}a=new p,a.getLogger=function(_){if(typeof _!="symbol"&&typeof _!="string"||_==="")throw new TypeError("You must supply a name when creating a logger.");var x=i[_];return x||(x=i[_]=new p(_,a.methodFactory)),x};var y=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=y),a},a.getLoggers=function(){return i},a.default=a,a})})(un);var mn=un.exports;const ya=pa(mn),_a=ct({__proto__:null,default:ya},[mn]),fa=!0,ut=_a;ut.setLevel("debug");const xa=n=>{try{ut.setLevel(n)}catch(e){ut.setLevel("error"),ut.error(e)}};function mt(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function et(n,...e){for(const t of e)if(t)for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&n[s]===void 0&&(n[s]=t[s]);return n}function gn(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function pn(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function tt(n,e){if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(let r=0;r<n.length;r++)if(!tt(n[r],e[r]))return!1;return!0}const t=Object.keys(n),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(e,r)||!tt(n[r],e[r]))return!1;return!0}let yn=class la{constructor(e,t){this.events={attrChanged:new se,modelChanged:new se},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=e||{};t&&et(s,t),this.attributes=s,this.changed={}}get(e){return this.attributes[e]}set(e,t,s){if(e==null)return this;let r;typeof e=="object"?(r=e,s=t):(r={},r[e]=t),s||(s={});const i=s.unset,a=s.silent,o=[],c=this._changing;this._changing=!0,c||(this._previousAttributes=mt(this.attributes),this.changed={});const h=this.attributes,d=this.changed,u=this._previousAttributes;for(const m in r)t=r[m],tt(h[m],t)||o.push(m),tt(u[m],t)?delete d[m]:d[m]=t,i?delete h[m]:h[m]=t;if(!a){o.length&&(this._pending=s);for(let m=0;m<o.length;m++)this.events.attrChanged.dispatch({object:this,attrName:o[m],attrValue:h[o[m]],options:s})}if(c)return this;if(!a)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!pn(this.changed):gn(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?mt(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,s={};for(const r in e){const i=e[r];tt(t[r],i)||(s[r]=i)}return s}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return mt(this._previousAttributes)}clone(){const e=mt(this.attributes);return new la(e)}},fs=class Ot{constructor(){this.entries=new Map}static getInstance(){return Ot.instance||(Ot.instance=new Ot),Ot.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 ba{static formatBytes(e,t=2){if(e===0)return"0 B";const s=1024,r=Math.max(0,t),i=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(s)),o=e/Math.pow(s,a);return`${parseFloat(o.toFixed(r))} ${i[a]}`}}class _n{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class fn{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}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 s=e;for(let r=0;r<t;r++){const i=this.tasks[r];try{s=await new Promise((a,o)=>{setTimeout(async()=>{try{const c=await i.run(s);this.onProgress((r+1)/t,i),a(c)}catch(c){o(c)}},0)})}catch(a){this.onError(a,r,i);return}}this.onComplete(s)}}let xn=class{constructor(e,t,s){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=s}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,s=this.handlers.length;t<s;t+=2){const r=this.handlers[t],i=this.handlers[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}};const bn=new xn;let Aa=class{constructor(e){this.manager=e!==void 0?e:bn,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((s,r)=>{this.load(e,s,t,r)})}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 An{constructor(e,t,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=s,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){typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(e):setTimeout(e,0)}async processChunk(e){let t=0;const s=async()=>{const r=t,i=Math.min(t+this._chunkSize,this._count);await e(r,i),t=i,t<this._count&&this.scheduleTask(s)};await s()}}var Y,gt,j,U,pt,he,Z,ye,ce,Re,yt,_t,ze,Fe,ft,xt,bt,ne,_e,R,Be,At,E,Q,wt,J,fe,It,xe,de,Pt,Ve,re,be,xs,bs,Ae,Et,Tt,we,St,As,ws,je,q,Ie,X,ie,Is,Ps,Es,Ts,Ss,Ms;(Y={})[Y.None=0]="None",Y[Y.Anonymous=1]="Anonymous",Y[Y.NonConstant=2]="NonConstant",Y[Y.Xref=4]="Xref",Y[Y.XrefOverlay=8]="XrefOverlay",Y[Y.ExternallyDependent=16]="ExternallyDependent",Y[Y.ResolvedOrDependent=32]="ResolvedOrDependent",Y[Y.ReferencedXref=64]="ReferencedXref",(gt={})[gt.BYBLOCK=0]="BYBLOCK",gt[gt.BYLAYER=256]="BYLAYER",(j={})[j.Rotated=0]="Rotated",j[j.Aligned=1]="Aligned",j[j.Angular=2]="Angular",j[j.Diameter=3]="Diameter",j[j.Radius=4]="Radius",j[j.Angular3Point=5]="Angular3Point",j[j.Ordinate=6]="Ordinate",j[j.ReferenceIsExclusive=32]="ReferenceIsExclusive",j[j.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",j[j.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(U={})[U.TopLeft=1]="TopLeft",U[U.TopCenter=2]="TopCenter",U[U.TopRight=3]="TopRight",U[U.MiddleLeft=4]="MiddleLeft",U[U.MiddleCenter=5]="MiddleCenter",U[U.MiddleRight=6]="MiddleRight",U[U.BottomLeft=7]="BottomLeft",U[U.BottomCenter=8]="BottomCenter",U[U.BottomRight=9]="BottomRight",(pt={})[pt.AtLeast=1]="AtLeast",pt[pt.Exact=2]="Exact";var wn=((he={})[he.Center=0]="Center",he[he.Above=1]="Above",he[he.Outside=2]="Outside",he[he.JIS=3]="JIS",he[he.Below=4]="Below",he),st=((Z={})[Z.Feet=0]="Feet",Z[Z.None=1]="None",Z[Z.Inch=2]="Inch",Z[Z.FeetAndInch=3]="FeetAndInch",Z[Z.Leading=4]="Leading",Z[Z.Trailing=8]="Trailing",Z[Z.LeadingAndTrailing=12]="LeadingAndTrailing",Z),wa=((ye={})[ye.None=0]="None",ye[ye.Leading=1]="Leading",ye[ye.Trailing=2]="Trailing",ye[ye.LeadingAndTrailing=3]="LeadingAndTrailing",ye),Ia=((ce={})[ce.Center=0]="Center",ce[ce.Left=1]="Left",ce[ce.Right=2]="Right",ce[ce.OverFirst=3]="OverFirst",ce[ce.OverSecond=4]="OverSecond",ce),Pa=((Re={})[Re.Bottom=0]="Bottom",Re[Re.Center=1]="Center",Re[Re.Top=2]="Top",Re);(yt={})[yt.PatternFill=0]="PatternFill",yt[yt.SolidFill=1]="SolidFill",(_t={})[_t.NonAssociative=0]="NonAssociative",_t[_t.Associative=1]="Associative",(ze={})[ze.Normal=0]="Normal",ze[ze.Outer=1]="Outer",ze[ze.Ignore=2]="Ignore",(Fe={})[Fe.UserDefined=0]="UserDefined",Fe[Fe.Predefined=1]="Predefined",Fe[Fe.Custom=2]="Custom",(ft={})[ft.NotAnnotated=0]="NotAnnotated",ft[ft.Annotated=1]="Annotated",(xt={})[xt.Solid=0]="Solid",xt[xt.Gradient=1]="Gradient",(bt={})[bt.TwoColor=0]="TwoColor",bt[bt.OneColor=1]="OneColor";var Ea=((ne={})[ne.Default=0]="Default",ne[ne.External=1]="External",ne[ne.Polyline=2]="Polyline",ne[ne.Derived=4]="Derived",ne[ne.Textbox=8]="Textbox",ne[ne.Outermost=16]="Outermost",ne),Nt=((_e={})[_e.Line=1]="Line",_e[_e.Circular=2]="Circular",_e[_e.Elliptic=3]="Elliptic",_e[_e.Spline=4]="Spline",_e),Ta=((R={})[R.Off=0]="Off",R[R.Solid=1]="Solid",R[R.Dashed=2]="Dashed",R[R.Dotted=3]="Dotted",R[R.ShotDash=4]="ShotDash",R[R.MediumDash=5]="MediumDash",R[R.LongDash=6]="LongDash",R[R.DoubleShortDash=7]="DoubleShortDash",R[R.DoubleMediumDash=8]="DoubleMediumDash",R[R.DoubleLongDash=9]="DoubleLongDash",R[R.DoubleMediumLongDash=10]="DoubleMediumLongDash",R[R.SparseDot=11]="SparseDot",R);Ta.Off,(Be={})[Be.Standard=-3]="Standard",Be[Be.ByLayer=-2]="ByLayer",Be[Be.ByBlock=-1]="ByBlock",(At={})[At.English=0]="English",At[At.Metric=1]="Metric",(E={})[E.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",E[E.FRONT_CLIPPING=2]="FRONT_CLIPPING",E[E.BACK_CLIPPING=4]="BACK_CLIPPING",E[E.UCS_FOLLOW=8]="UCS_FOLLOW",E[E.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",E[E.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",E[E.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",E[E.FAST_ZOOM=128]="FAST_ZOOM",E[E.SNAP_MODE=256]="SNAP_MODE",E[E.GRID_MODE=512]="GRID_MODE",E[E.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",E[E.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",E[E.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",E[E.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",E[E.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",E[E.UNUSED=32768]="UNUSED",E[E.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",E[E.VIEWPORT_OFF=131072]="VIEWPORT_OFF",E[E.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",E[E.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",E[E.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",E[E.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(Q={})[Q.OPTIMIZED_2D=0]="OPTIMIZED_2D",Q[Q.WIREFRAME=1]="WIREFRAME",Q[Q.HIDDEN_LINE=2]="HIDDEN_LINE",Q[Q.FLAT_SHADED=3]="FLAT_SHADED",Q[Q.GOURAUD_SHADED=4]="GOURAUD_SHADED",Q[Q.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",Q[Q.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(wt={})[wt.UCS_UNCHANGED=0]="UCS_UNCHANGED",wt[wt.HAS_OWN_UCS=1]="HAS_OWN_UCS",(J={})[J.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",J[J.TOP=1]="TOP",J[J.BOTTOM=2]="BOTTOM",J[J.FRONT=3]="FRONT",J[J.BACK=4]="BACK",J[J.LEFT=5]="LEFT",J[J.RIGHT=6]="RIGHT",(fe={})[fe.AS_DISPLAYED=0]="AS_DISPLAYED",fe[fe.WIREFRAME=1]="WIREFRAME",fe[fe.HIDDEN=2]="HIDDEN",fe[fe.RENDERED=3]="RENDERED",(It={})[It.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",It[It.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function k(n,e,t){return n.code===e&&(t==null||n.value===t)}function D(n){let e={};n.rewind();let t=n.next(),s=t.code;if(e.x=t.value,(t=n.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=n.next()).code!==s+20?n.rewind():e.z=t.value,e}let vs=Symbol();function v(n,e){return(t,s,r)=>{let i=n.reduce((c,h)=>{h.pushContext&&c.push({});let d=c[c.length-1];for(let u of typeof h.code=="number"?[h.code]:h.code){let m=d[u]??(d[u]=[]);h.isMultiple&&m.length&&console.warn(`Snippet ${m.at(-1).name} for code(${u}) is shadowed by ${h.name}`),m.push(h)}return c},[{}]),a=!1,o=i.length-1;for(;!k(t,0,"EOF");){let c=function(y,_,x){return y.find((f,M)=>{var T;return M>=x&&((T=f[_])==null?void 0:T.length)})}(i,t.code,o),h=c==null?void 0:c[t.code].at(-1);if(!c||!h){s.rewind();break}h.isMultiple||c[t.code].pop();let{name:d,parser:u,isMultiple:m}=h,p=u==null?void 0:u(t,s,r);if(p===vs){s.rewind();break}if(d){let[y,_]=function(x,f){let M=f.split("."),T=x;for(let S=0;S<M.length-1;++S){let I=M[S];Object.hasOwn(T,I)||(T[I]={}),T=T[I]}return[T,M.at(-1)]}(r,d);m?(Object.hasOwn(y,_)||(y[_]=[]),y[_].push(p)):y[_]=p}h.pushContext&&(o-=1),a=!0,t=s.next()}return e&&Object.setPrototypeOf(r,e),a}}function l({value:n}){return n}function b(n,e){return D(e)}function F({value:n}){return!!n}var In=[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 Pn(n,e){var r;if(!k(n,1001))throw Error("XData must starts with code 1001");let t={appName:n.value,value:[]};n=e.next();let s=[t.value];for(;!k(n,0,"EOF")&&n.code>=1e3;){let i=s.at(-1);switch(n.code){case 1002:n.value==="{"?s.push([]):(s.pop(),(r=s.at(-1))==null||r.push(i));break;case 1e3:case 1004:case 1040:case 1070:case 1071:i.push({type:Pe(n.code),value:n.value});break;case 1003:i.push({name:"layer",type:Pe(n.code),value:n.value});break;case 1005:i.push({name:"handle",type:Pe(n.code),value:n.value});break;case 1010:i.push({type:Pe(n.code),value:D(e)});break;case 1011:i.push({name:"worldSpacePosition",type:Pe(n.code),value:D(e)});break;case 1012:i.push({name:"worldSpaceDisplacement",type:Pe(n.code),value:D(e)});break;case 1013:i.push({name:"worldSpaceDirection",type:Pe(n.code),value:D(e)});break;case 1041:i.push({name:"distance",type:Pe(n.code),value:n.value});break;case 1042:i.push({name:"scale",type:Pe(n.code),value:n.value})}n=e.next()}return e.rewind(),t}function Pe(n){switch(n){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 Ls(n,e,t){if(k(e,102))return Rt(e,t),!0;switch(e.code){case 0:n.type=e.value;break;case 5:n.handle=e.value;break;case 330:n.ownerDictionarySoftId?n.ownerBlockRecordSoftId=e.value:n.ownerDictionarySoftId=e.value;break;case 360:n.ownerdictionaryHardId=e.value;break;case 67:n.isInPaperSpace=!!e.value;break;case 8:n.layer=e.value;break;case 6:n.lineType=e.value;break;case 347:n.materialObjectHardId=e.value;break;case 62:n.colorIndex=e.value,n.color=In[Math.abs(e.value)];break;case 370:n.lineweight=e.value;break;case 48:n.lineTypeScale=e.value;break;case 60:n.isVisible=!!e.value;break;case 92:n.proxyByte=e.value;break;case 310:n.proxyEntity=e.value;break;case 100:break;case 420:n.color=e.value;break;case 430:n.transparency=e.value;break;case 390:n.plotStyleHardId=e.value;break;case 284:n.shadowMode=e.value;break;case 1001:n.xdata=Pn(e,t);break;default:return!1}return!0}let Sa=0;function En(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=Sa++)}(xe={})[xe.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",xe[xe.CAST=1]="CAST",xe[xe.RECEIVE=2]="RECEIVE",xe[xe.IGNORE=3]="IGNORE";let G=[{code:1001,name:"xdata",parser:Pn},{code:284,name:"shadowMode",parser:l},{code:390,name:"plotStyleHardId",parser:l},{code:440,name:"transparency",parser:l},{code:430,name:"colorName",parser:l},{code:420,name:"color",parser:l},{code:310,name:"proxyEntity",isMultiple:!0,parser:l},{code:92,name:"proxyByte",parser:l},{code:60,name:"isVisible",parser:F},{code:48,name:"lineTypeScale",parser:l},{code:370,name:"lineweight",parser:l},{code:62,name:"colorIndex",parser(n,e,t){let s=n.value;return t.color=In[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:l},{code:6,name:"lineType",parser:l},{code:8,name:"layer",parser:l},{code:410,name:"layoutTabName",parser:l},{code:67,name:"isInPaperSpace",parser:F},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:l},{code:102,parser:Rt},{code:102,parser:Rt},{code:102,parser:Rt},{code:5,name:"handle",parser:l}];function Rt(n,e){for(n=e.next();!k(n,102)&&!k(n,0,"EOF");)n=e.next()}function Tn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ma={extrusionDirection:{x:0,y:0,z:1}},va=[{code:210,name:"extrusionDirection",parser:b},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:100,name:"subclassMarker",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100},...G];class Sn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Tn(this,"parser",v(va,Ma))}}Tn(Sn,"ForEntityName","ARC"),(de={})[de.NONE=0]="NONE",de[de.INVISIBLE=1]="INVISIBLE",de[de.CONSTANT=2]="CONSTANT",de[de.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",de[de.PRESET=8]="PRESET",(Pt={})[Pt.MULTILINE=2]="MULTILINE",Pt[Pt.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(Ve={})[Ve.NONE=0]="NONE",Ve[Ve.MIRRORED_X=2]="MIRRORED_X",Ve[Ve.MIRRORED_Y=4]="MIRRORED_Y";var La=((re={})[re.LEFT=0]="LEFT",re[re.CENTER=1]="CENTER",re[re.RIGHT=2]="RIGHT",re[re.ALIGNED=3]="ALIGNED",re[re.MIDDLE=4]="MIDDLE",re[re.FIT=5]="FIT",re),ka=((be={})[be.BASELINE=0]="BASELINE",be[be.BOTTOM=1]="BOTTOM",be[be.MIDDLE=2]="MIDDLE",be[be.TOP=3]="TOP",be);function Mn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let vn={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:La.LEFT,valign:ka.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Ln=[{code:73,name:"valign",parser:l},{code:100},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:72,name:"valign",parser:l},{code:72,name:"halign",parser:l},{code:71,name:"generationFlag",parser:l},{code:7,name:"styleName",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"xScale",parser:l},{code:50,name:"rotation",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class kn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Mn(this,"parser",v(Ln,vn))}}function Cn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Mn(kn,"ForEntityName","TEXT");let Ca={...vn},Oa=[{code:2},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:F},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedRecord",parser:F},{code:100},{code:280,name:"isLocked",parser:F},{code:74,name:"valign",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:3,name:"prompt",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},...Ln.slice(2)];class On{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Cn(this,"parser",v(Oa,Ca))}}function Dn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Cn(On,"ForEntityName","ATTDEF");let Da={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Na=[{code:210,name:"extrusionDirection",parser:b},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Nn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Dn(this,"parser",v(Na,Da))}}Dn(Nn,"ForEntityName","CIRCLE");let zt=class{parseEntity(e,t){let s={};for(;!k(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(r,i,a){switch(i.code){case 100:r.subclassMarker=i.value;break;case 280:r.version=i.value;break;case 2:r.name=i.value;break;case 10:r.definitionPoint=D(a);break;case 11:r.textPoint=D(a);break;case 12:r.insertionPoint=D(a);break;case 13:r.subDefinitionPoint1=D(a);break;case 14:r.subDefinitionPoint2=D(a);break;case 15:r.centerPoint=D(a);break;case 16:r.arcPoint=D(a);break;case 70:r.dimensionType=i.value;break;case 71:r.attachmentPoint=i.value;break;case 72:r.textLineSpacingStyle=i.value;break;case 40:r.leaderLength=i.value;break;case 41:r.textLineSpacingFactor=i.value;break;case 42:r.measurement=i.value;break;case 1:r.text=i.value;break;case 50:r.rotationAngle=i.value;break;case 52:r.obliqueAngle=i.value;break;case 53:r.textRotation=i.value;break;case 51:r.ocsRotation=i.value;break;case 210:r.extrusionDirection=D(a);break;case 3:r.styleName=i.value;break;default:Ls(r,i,a)}})(s,t,e),t=e.next()}return s}};function Rn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}bs="DIMENSION",(xs="ForEntityName")in zt?Object.defineProperty(zt,xs,{value:bs,enumerable:!0,configurable:!0,writable:!0}):zt[xs]=bs;let Ra={extrusionDirection:{x:0,y:0,z:1}},za=[{code:42,name:"endAngle",parser:l},{code:41,name:"startAngle",parser:l},{code:40,name:"axisRatio",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"majorAxisEndPoint",parser:b},{code:10,name:"center",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class zn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Rn(this,"parser",v(za,Ra))}}Rn(zn,"ForEntityName","ELLIPSE");let Fn=[{code:330,name:"sourceBoundaryObjects",parser:l,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:l}],Fa=[{code:11,name:"end",parser:b},{code:10,name:"start",parser:b}],Ba=[{code:73,name:"isCCW",parser:F},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b}],Va=[{code:73,name:"isCCW",parser:F},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"lengthOfMinorAxis",parser:l},{code:11,name:"end",parser:b},{code:10,name:"center",parser:b}],ja=[{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:11,name:"fitDatum",isMultiple:!0,parser:b},{code:97,name:"numberOfFitData",parser:l},{code:10,name:"controlPoints",isMultiple:!0,parser(n,e){let t={...D(e),weight:1};return(n=e.next()).code===42?t.weight=n.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:l},{code:96,name:"numberOfControlPoints",parser:l},{code:95,name:"numberOfKnots",parser:l},{code:74,name:"isPeriodic",parser:F},{code:73,name:"splineFlag",parser:l},{code:94,name:"degree",parser:l}],Ga={[Nt.Line]:Fa,[Nt.Circular]:Ba,[Nt.Elliptic]:Va,[Nt.Spline]:ja},Ha=[...Fn,{code:72,name:"edges",parser(n,e){let t={type:n.value},s=v(Ga[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(n=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:l}],Ua=[...Fn,{code:10,name:"vertices",parser(n,e){let t={...D(e),bulge:0};return(n=e.next()).code===42?t.bulge=n.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:l},{code:73,name:"isClosed",parser:F},{code:72,name:"hasBulge",parser:F}],Wa=[{code:49,name:"dashLengths",parser:l,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:l},{code:45,name:"offset",parser:Bn},{code:43,name:"base",parser:Bn},{code:53,name:"angle",parser:l}];function Bn(n,e){let t=n.code+1,s={x:n.value,y:1};return(n=e.next()).code===t?s.y=n.value:e.rewind(),s}function Vn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ya={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},qa=[{code:470},{code:463},{code:462,name:"colorTint",parser:l},{code:461,name:"gradientDefinition",parser:l},{code:460,name:"gradientRotation",parser:l},{code:453,name:"numberOfColors",parser:l},{code:452,name:"gradientColorFlag",parser:l},{code:451},{code:450,name:"gradientFlag",parser:l},{code:10,name:"seedPoints",parser:b,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:b},{code:98,name:"numberOfSeedPoints",parser:l},{code:47,name:"pixelSize",parser:l},{code:53,name:"definitionLines",parser:function(n,e){let t={};return v(Wa)(n,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:l},{code:77,name:"isDouble",parser:F},{code:73,name:"isAnnotated",parser:F},{code:41,name:"patternScale",parser:l},{code:52,name:"patternAngle",parser:l},{code:76,name:"patternType",parser:l},{code:75,name:"hatchStyle",parser:l},{code:92,name:"boundaryPaths",parser:function(n,e){let t={boundaryPathTypeFlag:n.value},s=t.boundaryPathTypeFlag&Ea.Polyline;return n=e.next(),s?v(Ua)(n,e,t):v(Ha)(n,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:l},{code:71,name:"associativity",parser:l},{code:63,name:"patternFillColor",parser:l},{code:70,name:"solidFill",parser:l},{code:2,name:"patternName",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:10,name:"elevationPoint",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...G];class jn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Vn(this,"parser",v(qa,Ya))}}Vn(jn,"ForEntityName","HATCH"),(Ae={})[Ae.ShowImage=1]="ShowImage",Ae[Ae.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Ae[Ae.UseClippingBoundary=4]="UseClippingBoundary",Ae[Ae.TransparencyIsOn=8]="TransparencyIsOn",(Et={})[Et.Rectangular=1]="Rectangular",Et[Et.Polygonal=2]="Polygonal",(Tt={})[Tt.Outside=0]="Outside",Tt[Tt.Inside=1]="Inside";function Gn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Xa={clippingBoundaryPath:[]},$a=[{code:90,name:"version",parser:l},{code:10,name:"position",parser:b},{code:11,name:"uPixel",parser:b},{code:12,name:"vPixel",parser:b},{code:13,name:"imageSize",parser:b},{code:340,name:"imageDefHandle",parser:l},{code:70,name:"flags",parser:l},{code:280,name:"clipping",parser:l},{code:281,name:"brightness",parser:l},{code:282,name:"contrast",parser:l},{code:283,name:"fade",parser:l},{code:360,name:"imageDefReactorHandle",parser:l},{code:71,name:"clippingBoundaryType",parser:l},{code:91,name:"countBoundaryPoints",parser:l},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:b},{code:290,name:"clipMode",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class ks{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Gn(this,"parser",v($a,Xa))}}function Hn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Gn(ks,"ForEntityName","IMAGE");let Ka={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Za=[{code:210,name:"extrusionDirection",parser:b},{code:45,name:"rowSpacing",parser:l},{code:44,name:"columnSpacing",parser:l},{code:71,name:"rowCount",parser:l},{code:70,name:"columnCount",parser:l},{code:50,name:"rotation",parser:l},{code:43,name:"zScale",parser:l},{code:42,name:"yScale",parser:l},{code:41,name:"xScale",parser:l},{code:10,name:"insertionPoint",parser:b},{code:2,name:"name",parser:l},{code:66,name:"isVariableAttributes",parser:F},{code:100,name:"subclassMarker",parser:l},...G];class Un{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Hn(this,"parser",v(Za,Ka))}}function Wn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Hn(Un,"ForEntityName","INSERT");let Qa={isArrowheadEnabled:!0},Ja=[{code:213,name:"offsetFromAnnotation",parser:b},{code:212,name:"offsetFromBlock",parser:b},{code:211,name:"horizontalDirection",parser:b},{code:210,name:"normal",parser:b},{code:340,name:"associatedAnnotation",parser:l},{code:77,name:"byBlockColor",parser:l},{code:10,name:"vertices",parser:b,isMultiple:!0},{code:76,name:"numberOfVertices",parser:l},{code:41,name:"textWidth",parser:l},{code:40,name:"textHeight",parser:l},{code:75,name:"isHooklineExists",parser:F},{code:74,name:"isHooklineSameDirection",parser:F},{code:73,name:"leaderCreationFlag",parser:l},{code:72,name:"isSpline",parser:F},{code:71,name:"isArrowheadEnabled",parser:F},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Yn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Wn(this,"parser",v(Ja,Qa))}}Wn(Yn,"ForEntityName","LEADER"),(we={})[we.TextAnnotation=0]="TextAnnotation",we[we.ToleranceAnnotation=1]="ToleranceAnnotation",we[we.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",we[we.NoAnnotation=3]="NoAnnotation";function qn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let eo={thickness:0,extrusionDirection:{x:0,y:0,z:1}},to=[{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Xn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){qn(this,"parser",v(to,eo))}}qn(Xn,"ForEntityName","LINE"),(St={})[St.IS_CLOSED=1]="IS_CLOSED",St[St.PLINE_GEN=128]="PLINE_GEN";let so={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},no={bulge:0},ro=[{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:91,name:"id",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l}],io=[{code:210,name:"extrusionDirection",parser:b},{code:10,name:"vertices",isMultiple:!0,parser(n,e){let t={};return v(ro,no)(n,e,t),t}},{code:39,name:"thickness",parser:l},{code:38,name:"elevation",parser:l},{code:43,name:"constantWidth",parser:l},{code:70,name:"flag",parser:l},{code:90,name:"numberOfVertices",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Ft{parseEntity(e,t){let s={};return v(io,so)(t,e,s),s}}ws="LWPOLYLINE",(As="ForEntityName")in Ft?Object.defineProperty(Ft,As,{value:ws,enumerable:!0,configurable:!0,writable:!0}):Ft[As]=ws,(je={})[je.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",je[je.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",je[je.BY_STYLE=5]="BY_STYLE";function ao(n,e){let t={};for(let s of n){let r=e(s);r!=null&&(t[r]??(t[r]=[]),t[r].push(s))}return t}function*Bt(n,e=1/0,t=1){for(let s=n;s!==e;s+=t)yield s}function ve(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}function $n(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let oo={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Vt=[{code:46,name:"annotationHeight",parser:l},{code:101,parser(n,e){(function(t){t.rewind();let s=t.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=t.next();while(s.code!==0);t.rewind()})(e)}},{code:50,name:"columnHeight",parser:l},{code:49,name:"columnGutter",parser:l},{code:48,name:"columnWidth",parser:l},{code:79,name:"columnAutoHeight",parser:l},{code:78,name:"columnFlowReversed",parser:l},{code:76,name:"columnCount",parser:l},{code:75,name:"columnType",parser:l},{code:441,name:"backgroundFillTransparency",parser:l},{code:63,name:"backgroundFillColor",parser:l},{code:45,name:"fillBoxScale",parser:l},{code:[...Bt(430,440)],name:"backgroundColor",parser:l},{code:[...Bt(420,430)],name:"backgroundColor",parser:l},{code:90,name:"backgroundFill",parser:l},{code:44,name:"lineSpacing",parser:l},{code:73,name:"lineSpacingStyle",parser:l},{code:50,name:"rotation",parser:l},{code:43},{code:42},{code:11,name:"direction",parser:b},{code:210,name:"extrusionDirection",parser:b},{code:7,name:"styleName",parser:l},{code:3,name:"text",isMultiple:!0,parser:l},{code:1,name:"text",isMultiple:!0,parser:l},{code:72,name:"drawingDirection",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:10,name:"insertionPoint",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class Kn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){$n(this,"parser",v(Vt,oo))}}function Zn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}$n(Kn,"ForEntityName","MTEXT");let lo={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},ho=[{code:50,name:"angle",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class Qn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Zn(this,"parser",v(ho,lo))}}Zn(Qn,"ForEntityName","POINT"),(q={})[q.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",q[q.CURVE_FIT=2]="CURVE_FIT",q[q.SPLINE_FIT=4]="SPLINE_FIT",q[q.POLYLINE_3D=8]="POLYLINE_3D",q[q.POLYGON_3D=16]="POLYGON_3D",q[q.CLOSED_POLYGON=32]="CLOSED_POLYGON",q[q.POLYFACE=64]="POLYFACE",q[q.CONTINUOUS=128]="CONTINUOUS",(Ie={})[Ie.NONE=0]="NONE",Ie[Ie.QUADRATIC=5]="QUADRATIC",Ie[Ie.CUBIC=6]="CUBIC",Ie[Ie.BEZIER=8]="BEZIER",(X={})[X.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",X[X.TANGENT_DEFINED=2]="TANGENT_DEFINED",X[X.NOT_USED=4]="NOT_USED",X[X.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",X[X.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",X[X.FOR_POLYLINE=32]="FOR_POLYLINE",X[X.FOR_POLYGON=64]="FOR_POLYGON",X[X.POLYFACE=128]="POLYFACE";function Jn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let co={startWidth:0,endWidth:0,bulge:0},uo=[{code:91,name:"id",parser:l},{code:[...Bt(71,75)],name:"faces",isMultiple:!0,parser:l},{code:50,name:"tangentDirection",parser:l},{code:70,name:"flag",parser:l},{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:30,name:"z",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...G],er=class{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Jn(this,"parser",v(uo,co))}};function tr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Jn(er,"ForEntityName","VERTEX");let mo={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:[]},go=[{code:0,name:"vertices",isMultiple:!0,parser:(n,e)=>k(n,0,"VERTEX")?(n=e.next(),new er().parseEntity(e,n)):vs},{code:210,name:"extrusionDirection",parser:b},{code:75,name:"smoothType",parser:l},{code:74,name:"surfaceNDensity",parser:l},{code:73,name:"surfaceMDensity",parser:l},{code:72,name:"meshNVertexCount",parser:l},{code:71,name:"meshMVertexCount",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:70,name:"flag",parser:l},{code:39,name:"thickness",parser:l},{code:30,name:"elevation",parser:l},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:l},...G];class sr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){tr(this,"parser",v(go,mo))}}function nr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}tr(sr,"ForEntityName","POLYLINE");let po={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},yo=[{code:10,name:"firstPoint",parser:b},{code:11,name:"unitDirection",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class rr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){nr(this,"parser",v(yo,po))}}function ir(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}nr(rr,"ForEntityName","RAY");let _o={vertices:[],backLineVertices:[]},fo=[{code:360,name:"geometrySettingHardId",parser:l},{code:12,name:"backLineVertices",isMultiple:!0,parser:b},{code:93,name:"numberOfBackLineVertices",parser:l},{code:11,name:"vertices",isMultiple:!0,parser:b},{code:92,name:"verticesCount",parser:l},{code:[63,411],name:"indicatorColor",parser:l},{code:70,name:"indicatorTransparency",parser:l},{code:41,name:"bottomHeight",parser:l},{code:40,name:"topHeight",parser:l},{code:10,name:"verticalDirection",parser:b},{code:1,name:"name",parser:l},{code:91,name:"flag",parser:l},{code:90,name:"state",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class ar{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ir(this,"parser",v(fo,_o))}}function or(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ir(ar,"ForEntityName","SECTION");let xo={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},bo=[{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:[...Bt(10,14)],name:"points",isMultiple:!0,parser:b},{code:100,name:"subclassMarker",parser:l},...G];class lr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){or(this,"parser",v(bo,xo))}}or(lr,"ForEntityName","SOLID"),(ie={})[ie.NONE=0]="NONE",ie[ie.CLOSED=1]="CLOSED",ie[ie.PERIODIC=2]="PERIODIC",ie[ie.RATIONAL=4]="RATIONAL",ie[ie.PLANAR=8]="PLANAR",ie[ie.LINEAR=16]="LINEAR";function hr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ao={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},wo=[{code:11,name:"fitPoints",isMultiple:!0,parser:b},{code:10,name:"controlPoints",isMultiple:!0,parser:b},{code:41,name:"weights",isMultiple:!0,parser:l},{code:40,name:"knots",isMultiple:!0,parser:l},{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:44,name:"fitTolerance",parser:l},{code:43,name:"controlTolerance",parser:l},{code:42,name:"knotTolerance",parser:l},{code:74,name:"numberOfFitPoints",parser:l},{code:73,name:"numberOfControlPoints",parser:l},{code:72,name:"numberOfKnots",parser:l},{code:71,name:"degree",parser:l},{code:70,name:"flag",parser:l},{code:210,name:"normal",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class cr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){hr(this,"parser",v(wo,Ao))}}hr(cr,"ForEntityName","SPLINE");class jt{parseEntity(e,t){let s={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:s.subclassMarker=t.value,t=e.next();break;case 2:s.name=t.value,t=e.next();break;case 5:s.handle=t.value,t=e.next();break;case 10:s.startPoint=ve(D(e)),t=e.lastReadGroup;break;case 11:s.directionVector=ve(D(e)),t=e.lastReadGroup;break;case 90:s.tableValue=t.value,t=e.next();break;case 91:s.rowCount=t.value,t=e.next();break;case 92:s.columnCount=t.value,t=e.next();break;case 93:s.overrideFlag=t.value,t=e.next();break;case 94:s.borderColorOverrideFlag=t.value,t=e.next();break;case 95:s.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:s.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(t.value),t=e.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(t.value),t=e.next();break;case 280:s.version=t.value,t=e.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=t.value,t=e.next();break;case 330:s.ownerDictionaryId=t.value,t=e.next();break;case 342:s.tableStyleId=t.value,t=e.next();break;case 343:s.blockRecordHandle=t.value,t=e.next();break;case 170:s.attachmentPoint=t.value,t=e.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(r,i){let a=!1,o=!1,c={};for(;!r.isEOF()&&i.code!==0&&!o;)switch(i.code){case 171:if(a){o=!0;continue}c.cellType=i.value,a=!0,i=r.next();break;case 172:c.flagValue=i.value,i=r.next();break;case 173:c.mergedValue=i.value,i=r.next();break;case 174:c.autoFit=i.value,i=r.next();break;case 175:c.borderWidth=i.value,i=r.next();break;case 176:c.borderHeight=i.value,i=r.next();break;case 91:c.overrideFlag=i.value,i=r.next();break;case 178:c.virtualEdgeFlag=i.value,i=r.next();break;case 145:c.rotation=i.value,i=r.next();break;case 345:c.fieldObjetId=i.value,i=r.next();break;case 340:c.blockTableRecordId=i.value,i=r.next();break;case 146:c.blockScale=i.value,i=r.next();break;case 177:c.blockAttrNum=i.value,i=r.next();break;case 7:c.textStyle=i.value,i=r.next();break;case 140:c.textHeight=i.value,i=r.next();break;case 170:c.attachmentPoint=i.value,i=r.next();break;case 92:c.extendedCellFlags=i.value,i=r.next();break;case 285:c.rightBorderVisibility=!!(i.value??!0),i=r.next();break;case 286:c.bottomBorderVisibility=!!(i.value??!0),i=r.next();break;case 288:c.leftBorderVisibility=!!(i.value??!0),i=r.next();break;case 289:c.topBorderVisibility=!!(i.value??!0),i=r.next();break;case 301:(function(h,d,u){for(;u.code!==304;)switch(u.code){case 301:case 93:case 90:case 94:u=d.next();break;case 1:h.text=u.value,u=d.next();break;case 300:h.attrText=u.value,u=d.next();break;case 302:h.text=u.value?u.value:h.text,u=d.next();break;default:console.log(`Ignore code: ${u.code}, value: ${u.value}`),u=d.next()}})(c,r,i),i=r.next();break;default:return c}return a=!1,o=!1,c}(e,t)),t=e.lastReadGroup;break;default:Ls(s,t,e),t=e.next()}}return s}}Ps="ACAD_TABLE",(Is="ForEntityName")in jt?Object.defineProperty(jt,Is,{value:Ps,enumerable:!0,configurable:!0,writable:!0}):jt[Is]=Ps;class Gt{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(r,i,a){if(a==="EOF")return!1;switch(a.code){case 0:default:return!1;case 100:r.subclassMarker=a.value;break;case 10:r.viewportCenter=ve(D(i));break;case 40:r.width=a.value;break;case 41:r.height=a.value;break;case 68:r.status=a.value;break;case 69:r.viewportId=a.value;break;case 12:r.displayCenter=D(i);break;case 13:r.snapBase=D(i);break;case 14:r.snapSpacing=D(i);break;case 15:r.gridSpacing=D(i);break;case 16:r.viewDirection=ve(D(i));break;case 17:r.targetPoint=ve(D(i));break;case 42:r.perspectiveLensLength=a.value;break;case 43:r.frontClipZ=a.value;break;case 44:r.backClipZ=a.value;break;case 45:r.viewHeight=a.value;break;case 50:r.snapAngle=a.value;break;case 51:r.viewTwistAngle=a.value;break;case 72:r.circleZoomPercent=a.value;break;case 331:r.frozenLayerIds??(r.frozenLayerIds=[]),r.frozenLayerIds.push(a.value);break;case 90:r.statusBitFlags=a.value;break;case 330:r.ownerBlockRecordSoftId=a.value;break;case 340:r.clippingBoundaryId=a.value;break;case 1:r.sheetName=a.value;break;case 281:r.renderMode=a.value;break;case 71:r.ucsPerViewport=a.value;break;case 110:r.ucsOrigin=ve(D(i));break;case 111:r.ucsXAxis=ve(D(i));break;case 112:r.ucsYAxis=ve(D(i));break;case 345:r.ucsId=a.value;break;case 346:r.ucsBaseId=a.value;break;case 79:r.orthographicType=a.value;break;case 146:r.elevation=a.value;break;case 170:r.shadePlotMode=a.value;break;case 61:r.majorGridFrequency=a.value;break;case 332:r.backgroundId=a.value;break;case 333:r.shadePlotId=a.value;break;case 348:r.visualStyleId=a.value;break;case 292:r.isDefaultLighting=!!a.value;break;case 282:r.defaultLightingType=a.value;break;case 141:r.brightness=a.value;break;case 142:r.contrast=a.value;break;case 63:case 421:case 431:r.ambientLightColor=a.value;break;case 361:r.sunId=a.value;break;case 335:case 343:case 344:case 91:r.softPointer=a.value}return!0}(s,e,t)&&Ls(s,t,e),t=e.next()}return s}}Ts="VIEWPORT",(Es="ForEntityName")in Gt?Object.defineProperty(Gt,Es,{value:Ts,enumerable:!0,configurable:!0,writable:!0}):Gt[Es]=Ts;class Ht extends ks{parseEntity(e,t){return super.parseEntity(e,t)}}function dr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ms="WIPEOUT",(Ss="ForEntityName")in Ht?Object.defineProperty(Ht,Ss,{value:Ms,enumerable:!0,configurable:!0,writable:!0}):Ht[Ss]=Ms;let Io={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Po=[{code:10,name:"firstPoint",parser:b},{code:11,name:"unitDirection",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class ur{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){dr(this,"parser",v(Po,Io))}}function mr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}dr(ur,"ForEntityName","XLINE");let Eo={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},To=[...Vt.slice(Vt.findIndex(({name:n})=>n==="columnType"),Vt.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!k(n,0,"MTEXT"))return vs}},{code:2,name:"definitionTag",parser:l},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardId",parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:F},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedEntriesKeep",parser:F},{code:100},{code:280,name:"lockPositionFlag",parser:F},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"alignmentPoint",parser:b},{code:74,name:"verticalJustification",parser:l},{code:72,name:"horizontalJustification",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:7,name:"textStyle",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"scale",parser:l},{code:50,name:"rotation",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100},...G];class gr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){mr(this,"parser",v(To,Eo))}}mr(gr,"ForEntityName","ATTRIB");let So=Object.fromEntries([Sn,On,gr,Nn,zt,zn,ks,Un,Yn,Xn,Ft,Kn,Qn,sr,rr,ar,lr,cr,jt,kn,jn,Gt,Ht,ur].map(n=>[n.ForEntityName,new n]));function pr(n,e){let t=[];for(;!k(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){e.rewind();break}let s=So[n.value];if(s){let r=n.value;n=e.next();let i=s.parseEntity(e,n);i.type=r,En(i),t.push(i)}else console.warn(`Unsupported ENTITY type: ${n.value}`)}n=e.next()}return t}function Mo(n,e){let t={};for(;!k(n,0,"EOF")&&!k(n,0,"ENDSEC");){if(k(n,0,"BLOCK")){let s=vo(n=e.next(),e);En(s),s.name&&(t[s.name]=s)}n=e.next()}return t}function vo(n,e){let t={};for(;!k(n,0,"EOF");){if(k(n,0,"ENDBLK")){for(n=e.next();!k(n,0,"EOF");){if(k(n,100,"AcDbBlockEnd"))return t;n=e.next()}break}switch(n.code){case 1:t.xrefPath=n.value;break;case 2:t.name=n.value;break;case 3:t.name2=n.value;break;case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 10:t.position=D(e);break;case 67:t.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(t.type=n.value);break;case 100:break;case 330:t.ownerHandle=n.value;break;case 0:t.entities=pr(n,e)}n=e.next()}return t}function Lo(n,e){let t=null,s={};for(;!k(n,0,"EOF")&&!k(n,0,"ENDSEC");)n.code===9?t=n.value:n.code===10?s[t]=D(e):s[t]=n.value,n=e.next();return s}let ko=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:l},{code:90,name:"version",parser:l},{code:1,name:"fileName",parser:l},{code:10,name:"size",parser:b},{code:11,name:"sizeOfOnePixel",parser:b},{code:280,name:"isLoaded",parser:l},{code:281,name:"resolutionUnits",parser:l},{code:100,name:"subclassMarker",parser:l}],yr=[{code:333,name:"shadePlotId",parser:l},{code:149,name:"imageOriginY",parser:l},{code:148,name:"imageOriginX",parser:l},{code:147,name:"scaleFactor",parser:l},{code:78,name:"shadePlotCustomDPI",parser:l},{code:77,name:"shadePlotResolution",parser:l},{code:76,name:"shadePlotMode",parser:l},{code:75,name:"standardScaleType",parser:l},{code:7,name:"currentStyleSheet",parser:l},{code:74,name:"plotType",parser:l},{code:73,name:"plotRotation",parser:l},{code:72,name:"paperUnit",parser:l},{code:70,name:"layoutFlag",parser:l},{code:143,name:"printScaleDenominator",parser:l},{code:142,name:"printScaleNominator",parser:l},{code:141,name:"windowAreaYMax",parser:l},{code:140,name:"windowAreaYMin",parser:l},{code:49,name:"windowAreaXMax",parser:l},{code:48,name:"windowAreaXMin",parser:l},{code:47,name:"plotOriginY",parser:l},{code:46,name:"plotOriginX",parser:l},{code:45,name:"paperHeight",parser:l},{code:44,name:"paperWidth",parser:l},{code:43,name:"marginTop",parser:l},{code:42,name:"marginRight",parser:l},{code:41,name:"marginBottom",parser:l},{code:40,name:"marginLeft",parser:l},{code:6,name:"plotViewName",parser:l},{code:4,name:"paperSize",parser:l},{code:2,name:"configName",parser:l},{code:1,name:"pageSetupName",parser:l},{code:100,name:"subclassMarker",parser:l}],Co=[{code:333,name:"shadePlotId",parser:l},{code:346,name:"orthographicUcsId",parser:l},{code:345,name:"namedUcsId",parser:l},{code:331,name:"viewportId",parser:l},{code:330,name:"paperSpaceTableId",parser:l},{code:76,name:"orthographicType",parser:l},{code:17,name:"ucsYAxis",parser:b},{code:16,name:"ucsXAxis",parser:b},{code:13,name:"ucsOrigin",parser:b},{code:146,name:"elevation",parser:l},{code:15,name:"maxExtent",parser:b},{code:14,name:"minExtent",parser:b},{code:12,name:"insertionBase",parser:b},{code:11,name:"maxLimit",parser:b},{code:10,name:"minLimit",parser:b},{code:71,name:"tabOrder",parser:l},{code:70,name:"controlFlag",parser:l},{code:1,name:"layoutName",parser:l},{code:100,name:"subclassMarker",parser:l},...yr],Oo=[{code:330,name:"ownerObjectId",parser:l},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:l},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:l},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:l}];function _r(n){return n.subclassMarker==="AcDbDictionary"}let Do={LAYOUT:Co,PLOTSETTINGS:yr,DICTIONARY:[{code:3,name:"entries",parser:(n,e)=>{let t={name:n.value};return(n=e.next()).code===350?t.objectId=n.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:l},{code:280,name:"isHardOwned",parser:F},{code:100,name:"subclassMarker",parser:l}],IMAGEDEF:ko};function No(n,e){let t=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let s=n.value,r=Do[s];if(n.code===0&&(r!=null&&r.length)){let i=v([...Oo,...r]),a={name:s};i(n=e.next(),e,a)?(t.push(a),n=e.peek()):n=e.next()}else n=e.next()}return{byName:ao(t,({name:s})=>s),byTree:function(s){let r=Object.fromEntries(s.map(i=>[i.handle,i]));for(let i of s)(!_r(i)||i.ownerDictionaryIdSoft!=="0")&&(i.ownerDictionaryIdSoft&&(i.ownerDictionarySoft=r[i.ownerDictionaryIdSoft]),i.ownerDictionaryIdHard&&(i.ownerDictionaryHard=r[i.ownerDictionaryIdHard]),i.ownerObjectId&&(i.ownerObject=r[i.ownerObjectId])),function(a,o){_r(a)&&a.entries&&(a.entries=Object.fromEntries(a.entries.map(({name:c,objectId:h})=>[c,o[h]])))}(i,r);return s[0]}(t)}}let nt=[{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,parser(n,e){for(;!k(n,0,"EOF")&&!k(n,102,"}");)n=e.next()}},{code:5,name:"handle",parser:l}],Ro=v([{code:310,name:"bmpPreview",parser:l},{code:281,name:"scalability",parser:l},{code:280,name:"explodability",parser:l},{code:70,name:"insertionUnits",parser:l},{code:340,name:"layoutObjects",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...nt]),zo=v([...[{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:wn.Above,defaultValueImperial:wn.Center},{name:"DIMZIN",code:78,defaultValue:st.Trailing,defaultValueImperial:st.Feet},{name:"DIMAZIN",code:79,defaultValue:wa.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:Ia.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Pa.Center},{name:"DIMTZIN",code:284,defaultValue:st.Trailing,defaultValueImperial:st.Feet},{name:"DIMALTZ",code:285,defaultValue:st.Trailing},{name:"DIMALTTZ",code:286,defaultValue:st.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}].map(n=>({...n,parser:l})),{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},{code:105,name:"handle",parser:l},...nt.filter(n=>n.code!==5)]),Fo=v([{code:347,name:"materialObjectId",parser:l},{code:390,name:"plotStyleNameObjectId",parser:l},{code:370,name:"lineweight",parser:l},{code:290,name:"isPlotting",parser:F},{code:6,name:"lineType",parser:l},{code:62,name:"colorIndex",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...nt]),Bo=v([{code:9,name:"text",parser:l},{code:45,name:"offsetY",parser:l},{code:44,name:"offsetX",parser:l},{code:50,name:"rotation",parser:l},{code:46,name:"scale",parser:l},{code:340,name:"styleObjectId",parser:l},{code:75,name:"shapeNumber",parser:l},{code:74,name:"elementTypeFlag",parser:l},{code:49,name:"elementLength",parser:l}],{elementTypeFlag:0,elementLength:0}),Vo={BLOCK_RECORD:Ro,DIMSTYLE:zo,LAYER:Fo,LTYPE:v([{code:49,name:"pattern",parser(n,e){let t={};return Bo(n,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:l},{code:73,name:"numberOfLineTypes",parser:l},{code:72,parser:l},{code:3,name:"description",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...nt]),STYLE:v([{code:1e3,name:"extendedFont",parser:l},{code:1001},{code:4,name:"bigFont",parser:l},{code:3,name:"font",parser:l},{code:42,name:"lastHeight",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:50,name:"obliqueAngle",parser:l},{code:41,name:"widthFactor",parser:l},{code:40,name:"fixedTextHeight",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...nt]),VPORT:v([{code:[63,421,431],name:"ambientColor",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLightingOn",parser:F},{code:348,name:"visualStyleObjectId",parser:l},{code:333,name:"shadePlotObjectId",parser:l},{code:332,name:"backgroundObjectId",parser:l},{code:61,name:"majorGridLines",parser:l},{code:170,name:"shadePlotSetting",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:74,name:"ucsIconSetting",parser:l},{code:71,name:"viewMode",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"styleSheet",parser:l},{code:[331,441],name:"frozenLayers",parser:l,isMultiple:!0},{code:72,name:"circleSides",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapRotationAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:17,name:"viewTarget",parser:b},{code:16,name:"viewDirectionFromTarget",parser:b},{code:15,name:"gridSpacing",parser:b},{code:14,name:"snapSpacing",parser:b},{code:13,name:"snapBasePoint",parser:b},{code:12,name:"center",parser:b},{code:11,name:"upperRightCorner",parser:b},{code:10,name:"lowerLeftCorner",parser:b},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...nt])},jo=v([{code:70,name:"maxNumberOfEntries",parser:l},{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:l},{code:2,name:"name",parser:l}]);function Go(n,e){var s;let t={};for(;!k(n,0,"EOF")&&!k(n,0,"ENDSEC");){if(k(n,0,"TABLE")){n=e.next();let r={entries:[]};jo(n,e,r),t[r.name]=r}if(k(n,0)&&!k(n,0,"ENDTAB")){let r=n.value;n=e.next();let i=Vo[r];if(!i){console.warn(`parseTable: Invalid table name '${r}'`),n=e.next();continue}let a={};i(n,e,a),(s=t[r])==null||s.entries.push(a)}n=e.next()}return t}function Ut(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class fr{next(){if(!this.hasNext())return this._eof?console.warn("Cannot call 'next' after EOF group has been read"):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=xr(e,this._data[this._pointer++]),s={code:e,value:t};return k(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e={code:parseInt(this._data[this._pointer]),value:0};return e.value=xr(e.code,this._data[this._pointer+1]),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){Ut(this,"_pointer",void 0),Ut(this,"_data",void 0),Ut(this,"_eof",void 0),Ut(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=e,this._eof=!1}}function xr(n,e){return n<=9?e:n>=10&&n<=59?parseFloat(e.trim()):n>=60&&n<=99?parseInt(e.trim()):n>=100&&n<=109?e:n>=110&&n<=149?parseFloat(e.trim()):n>=160&&n<=179?parseInt(e.trim()):n>=210&&n<=239?parseFloat(e.trim()):n>=270&&n<=289?parseInt(e.trim()):n>=290&&n<=299?function(t){if(t==="0")return!1;if(t==="1")return!0;throw TypeError("String '"+t+"' cannot be cast to Boolean type")}(e.trim()):n>=300&&n<=369?e:n>=370&&n<=389?parseInt(e.trim()):n>=390&&n<=399?e:n>=400&&n<=409?parseInt(e.trim()):n>=410&&n<=419?e:n>=420&&n<=429?parseInt(e.trim()):n>=430&&n<=439?e:n>=440&&n<=459?parseInt(e.trim()):n>=460&&n<=469?parseFloat(e.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?e:n>=1010&&n<=1059?parseFloat(e.trim()):n>=1060&&n<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:n,value:e}),e)}function Cs(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ho=class{constructor(){Cs(this,"encoding","utf-8"),Cs(this,"encodingFailureFatal",!1)}};class Uo extends EventTarget{parseSync(e){let t=new fr(e.split(/\r\n|\r|\n/g));if(!t.hasNext())throw Error("Empty file");return this.parseAll(t)}parseStream(e){let t="",s=this;return new Promise((r,i)=>{e.on("data",a=>{t+=a}),e.on("end",()=>{try{let a=t.split(/\r\n|\r|\n/g),o=new fr(a);if(!o.hasNext())throw Error("Empty file");r(s.parseAll(o))}catch(a){i(a)}}),e.on("error",a=>{i(a)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let r=s.body.getReader(),i="";for(;;){let{done:a,value:o}=await r.read();if(a){i+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}i+=this._decoder.decode(o,{stream:!0})}return this.parseSync(i)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!k(s,0,"EOF");)k(s,0,"SECTION")&&(k(s=e.next(),2,"HEADER")?(s=e.next(),t.header=Lo(s,e)):k(s,2,"BLOCKS")?(s=e.next(),t.blocks=Mo(s,e)):k(s,2,"ENTITIES")?(s=e.next(),t.entities=pr(s,e)):k(s,2,"TABLES")?(s=e.next(),t.tables=Go(s,e)):k(s,2,"OBJECTS")&&(s=e.next(),t.objects=No(s,e))),s=e.next();return t}constructor(e=new Ho){super(),Cs(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var Os=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(Os||{});class Le{static get instance(){return this._instance||(this._instance=new Le),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,s,r=!0,i,a){const o=[];if(t!=null){const c=this.createKey(t.name,s);let h;if(this.has(c))h=this.get(c);else{const d=t.newIterator();for(const u of d)if(u.color.isByBlock&&s){br.copy(u.color),u.color.color=s;const m=u.draw(e);m&&o.push(m),u.color.copy(br)}else{const m=u.draw(e);m&&o.push(m)}h=e.group(o),h&&r&&this.set(c,h)}return h&&i&&(h.applyMatrix(i),a&&(a.x!=0||a.y!=0||a.z!=1)&&(i.setFromExtrusionDirection(a),h.applyMatrix(i))),h}else return e.group(o)}}const br=new Ne,Wt="Continuous",Yt="ByLayer",Ar="ByBlock";var Ge=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(Ge||{}),Ds=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(Ds||{});function Wo(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Yo(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}var wr=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(wr||{});class qt{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}[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}}}const Ir="Load Database";class ee extends _n{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=fs.getInstance().getEntry(Ir),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(e);if(this.progress){const i=r.data;await this.progress(this.data.progress.value,this.data.stage,"END",i),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return t&&(t.data[this.name]=Date.now()-s),r}}class Pr{async read(e,t,s,r){const i={name:Ir,data:{total:0},format(){let h="";return Object.keys(this.data).forEach(d=>{d!=="total"&&(h+=`- ${d}: ${this.data[d]} ms
|
|
2
|
-
`)}),h+=`- total: ${this.data.total} ms`,h}};fs.getInstance().collect(i),this.progress=r;const a={value:0},o=new fn;o.setCompleteCallback(()=>this.onFinished()),o.setErrorCallback(()=>this.onFinished()),o.addTask(new ee({stage:"START",step:1,progress:a,task:async h=>h},r)),o.addTask(new ee({stage:"PARSE",step:5,progress:a,task:async h=>({model:await this.parse(h)})},r)),o.addTask(new ee({stage:"FONT",step:5,progress:a,task:async h=>{const d=this.getFonts(h.model);return{model:h.model,data:d}}},r)),o.addTask(new ee({stage:"LTYPE",step:1,progress:a,task:async h=>(this.processLineTypes(h.model,t),h)},r)),o.addTask(new ee({stage:"STYLE",step:1,progress:a,task:async h=>(this.processTextStyles(h.model,t),h)},r)),o.addTask(new ee({stage:"DIMSTYLE",step:1,progress:a,task:async h=>(this.processDimStyles(h.model,t),h)},r)),o.addTask(new ee({stage:"LAYER",step:1,progress:a,task:async h=>(this.processLayers(h.model,t),h)},r)),o.addTask(new ee({stage:"VPORT",step:1,progress:a,task:async h=>(this.processViewports(h.model,t),h)},r)),o.addTask(new ee({stage:"HEADER",step:1,progress:a,task:async h=>(this.processHeader(h.model,t),h)},r)),o.addTask(new ee({stage:"BLOCK_RECORD",step:5,progress:a,task:async h=>(this.processBlockTables(h.model,t),h)},r)),o.addTask(new ee({stage:"OBJECT",step:5,progress:a,task:async h=>(this.processObjects(h.model,t),h)},r)),o.addTask(new ee({stage:"BLOCK",step:5,progress:a,task:async h=>(await this.processBlocks(h.model,t),h)},r)),o.addTask(new ee({stage:"ENTITY",step:100,progress:a,task:async h=>(await this.processEntities(h.model,t,s,a,r),h)},r)),o.addTask(new ee({stage:"END",step:0,progress:a,task:async h=>h},r));const c=Date.now();await o.run(e),i.data.total=Date.now()-c}onFinished(){this.progress&&(this.progress(100,"END","END"),Le.instance.clear())}parse(e){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,s,r,i){throw new Error("Not impelemented yet!")}}const $=["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 Er=1234567;const Ns=Math.PI/180,Rs=180/Math.PI;function Tr(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return($[n&255]+$[n>>8&255]+$[n>>16&255]+$[n>>24&255]+"-"+$[e&255]+$[e>>8&255]+"-"+$[e>>16&15|64]+$[e>>24&255]+"-"+$[t&63|128]+$[t>>8&255]+"-"+$[t>>16&255]+$[t>>24&255]+$[s&255]+$[s>>8&255]+$[s>>16&255]+$[s>>24&255]).toLowerCase()}function Ee(n,e,t){return Math.max(e,Math.min(t,n))}function zs(n,e){return(n%e+e)%e}function Sr(n,e,t,s,r){return s+(n-e)*(r-s)/(t-e)}function Mr(n,e,t){return n!==e?(t-n)/(e-n):0}function Fs(n,e,t){return(1-t)*n+t*e}function vr(n,e,t,s){return Fs(n,e,1-Math.exp(-t*s))}function Lr(n,e=1){return e-Math.abs(zs(n,e*2)-e)}function kr(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Cr(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Or(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Dr(n,e){return n+Math.random()*(e-n)}function Nr(n){return n*(.5-Math.random())}function Rr(n){n!==void 0&&(Er=n);let e=Er+=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 zr(n){return n*Ns}function Fr(n){return n*Rs}function Br(n){return(n&n-1)===0&&n!==0}function Vr(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function jr(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Mt(n){const e=Math.PI*2;return(n%e+e)%e}function Gr(n,e,t){return n>e&&n<t||n>t&&n<e}function Hr(n,e,t,s=!1){return n=Mt(n),e=Mt(e),t=Mt(t),s?e>t?n<=e&&n>=t:n<=e||n>=t:e<t?n>=e&&n<=t:n>=e||n<=t}function Bs(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Ur(n,e=1e-7){const t=Bs(n);return Math.max(Math.pow(10,t)*e,e)}const C={DEG2RAD:Ns,RAD2DEG:Rs,generateUUID:Tr,clamp:Ee,euclideanModulo:zs,mapLinear:Sr,inverseLerp:Mr,lerp:Fs,damp:vr,pingpong:Lr,smoothstep:kr,smootherstep:Cr,randInt:Or,randFloat:Dr,randFloatSpread:Nr,seededRandom:Rr,degToRad:zr,radToDeg:Fr,isPowerOfTwo:Br,ceilPowerOfTwo:Vr,floorPowerOfTwo:jr,normalizeAngle:Mt,isBetween:Gr,isBetweenAngle:Hr,intPartLength:Bs,relativeEps:Ur},Vs=class ha{constructor(e,t){this.x=0,this.y=0;const s=+(e!==void 0)+ +(t!==void 0);if(s!==0){if(s===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(s===1){const{x:r,y:i}=e;this.x=r,this.y=i;return}if(s===2){this.x=e,this.y=t;return}throw te.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 ha(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,s=this.y,r=e.elements;return this.x=r[0]*t+r[3]*s+r[6],this.y=r[1]*t+r[4]*s+r[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 s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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 s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,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 s=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*s-a*r+e.x,this.y=i*r+a*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(C.relativeEps(this.x,e),C.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};Vs.EMPTY=Object.freeze(new Vs(0,0));let B=Vs;const js=class ca{constructor(e,t,s,r,i,a,o,c,h){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&s!=null&&r!=null&&i!=null&&a!=null&&o!=null&&c!=null&&h!=null&&this.set(e,t,s,r,i,a,o,c,h)}set(e,t,s,r,i,a,o,c,h){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=i,d[5]=c,d[6]=s,d[7]=a,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.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 s=e.elements,r=t.elements,i=this.elements,a=s[0],o=s[3],c=s[6],h=s[1],d=s[4],u=s[7],m=s[2],p=s[5],y=s[8],_=r[0],x=r[3],f=r[6],M=r[1],T=r[4],S=r[7],I=r[2],z=r[5],P=r[8];return i[0]=a*_+o*M+c*I,i[3]=a*x+o*T+c*z,i[6]=a*f+o*S+c*P,i[1]=h*_+d*M+u*I,i[4]=h*x+d*T+u*z,i[7]=h*f+d*S+u*P,i[2]=m*_+p*M+y*I,i[5]=m*x+p*T+y*z,i[8]=m*f+p*S+y*P,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],s=e[1],r=e[2],i=e[3],a=e[4],o=e[5],c=e[6],h=e[7],d=e[8];return t*a*d-t*o*h-s*i*d+s*o*c+r*i*h-r*a*c}invert(){const e=this.elements,t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],o=e[5],c=e[6],h=e[7],d=e[8],u=d*a-o*h,m=o*c-d*i,p=h*i-a*c,y=t*u+s*m+r*p;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/y;return e[0]=u*_,e[1]=(r*h-d*s)*_,e[2]=(o*s-r*a)*_,e[3]=m*_,e[4]=(d*t-r*c)*_,e[5]=(r*i-o*t)*_,e[6]=p*_,e[7]=(s*c-h*t)*_,e[8]=(a*t-s*i)*_,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,s,r,i,a,o){const c=Math.cos(i),h=Math.sin(i);return this.set(s*c,s*h,-s*(c*a+h*o)+a+e,-r*h,r*c,-r*(-h*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Gs.makeScale(e,t)),this}rotate(e){return this.premultiply(Gs.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gs.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof B?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),s=Math.sin(e);return this.set(t,-s,0,s,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,s=e.elements;for(let r=0;r<9;r++)if(t[r]!==s[r])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new ca().fromArray(this.elements)}};js.IDENTITY=Object.freeze(new js);let Xt=js;const Gs=new Xt,He=1e-6,H=2*Math.PI,qo={x:0,y:0},Hs={x:0,y:0,z:0};class Wr{constructor(){this.equalPointTol=He,this.equalVectorTol=He}equalPoint2d(e,t){return new B(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new A(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=He){return e<t&&e>-t}static equal(e,t,s=He){return Math.abs(e-t)<s}static great(e,t,s=He){return e-t>s}static less(e,t,s=He){return e-t<s}}const Us=new Wr;function Ws(n,e,t=!1){const s=n.x,r=n.y;let i=!1;const a=e.length;for(let o=0,c=a-1;o<a;c=o++){const h=e[o].x,d=e[o].y,u=e[c].x,m=e[c].y;let p=d>r!=m>r;t&&(p=d>=r!=m>=r),p&&s<(u-h)*(r-d)/(m-d)+h&&(i=!i)}return i}function Yr(n,e){if(n.length===0||e.length===0)return!1;const t=new K().setFromPoints(n),s=new K().setFromPoints(e);if(!t.intersectsBox(s))return!1;for(let r=0;r<n.length;){if(Ws(n[r],e,!0))return!0;r<n.length-1&&Us.equalPoint2d(n[r+1],n[r])&&++r,++r}return!1}const qr={isPointInPolygon:Ws,isPolygonIntersect:Yr};function Xr(n,e){const t=[],s=e-1,r=n;for(let i=0;i<=r;i++)t.push(0);for(let i=1;i<=s-r;i++)t.push(i);for(let i=0;i<=r;i++)t.push(s-r+1);return t}function $r(n,e){const t=e.length-1,s=n,r=[0];let i=0;for(let o=1;o<=t;o++){const c=e[o][0]-e[o-1][0],h=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(c*c+h*h+d*d);i+=u,r.push(i)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=t-s;o++){const c=r[o]/i;a.push(c*(t-s+1))}for(let o=0;o<=s;o++)a.push(t-s+1);return a}function Kr(n,e){const t=e.length-1,s=n,r=[0];let i=0;for(let o=1;o<=t;o++){const c=e[o][0]-e[o-1][0],h=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(c*c+h*h+d*d),m=Math.sqrt(u);i+=m,r.push(i)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=t-s;o++){const c=r[o]/i;a.push(c*(t-s+1))}for(let o=0;o<=s;o++)a.push(t-s+1);return a}function $t(n,e,t,s){if(e===0)return t>=s[n]&&t<s[n+1]?1:0;const r=s[n+e]-s[n],i=s[n+e+1]-s[n+1],a=r>1e-10?(t-s[n])/r:0,o=i>1e-10?(s[n+e+1]-t)/i:0;return a*$t(n,e-1,t,s)+o*$t(n+1,e-1,t,s)}function vt(n,e,t,s,r){const i=s.length-1,a=e;if(n=Math.max(t[a],Math.min(t[i+1],n)),Math.abs(n-t[i+1])<1e-8)return[...s[i]];if(Math.abs(n-t[a])<1e-8)return[...s[0]];const o=[0,0,0];let c=0;for(let h=0;h<=i;h++){const d=$t(h,a,n,t),u=r[h]*d;o[0]+=s[h][0]*u,o[1]+=s[h][1]*u,o[2]+=s[h][2]*u,c+=u}if(c<1e-10){const h=t[t.length-a-1];if(Math.abs(n-h)<1e-8)return[...s[i]];if(Math.abs(n-t[a])<1e-8)return[...s[0]]}return c>1e-10&&(o[0]/=c,o[1]/=c,o[2]/=c),o}function Zr(n,e,t,s){const r=n,i=e[r],a=e[e.length-r-1];let o=0;const c=1e3,h=(a-i)/c;let d=vt(i,n,e,t,s);for(let _=1;_<=c;_++){const x=i+_*h,f=vt(x,n,e,t,s),M=f[0]-d[0],T=f[1]-d[1],S=f[2]-d[2];o+=Math.sqrt(M*M+T*T+S*S),d=f}const u=vt(a,n,e,t,s),m=u[0]-d[0],p=u[1]-d[1],y=u[2]-d[2];return o+=Math.sqrt(m*m+p*p+y*y),o}function Qr(n){return n.map(e=>[...e])}class ke{constructor(e=0,t=0,s=0,r=1){this._x=e,this._y=t,this._z=s,this._w=r}static slerpFlat(e,t,s,r,i,a,o){let c=s[r+0],h=s[r+1],d=s[r+2],u=s[r+3];const m=i[a+0],p=i[a+1],y=i[a+2],_=i[a+3];if(o===0){e[t+0]=c,e[t+1]=h,e[t+2]=d,e[t+3]=u;return}if(o===1){e[t+0]=m,e[t+1]=p,e[t+2]=y,e[t+3]=_;return}if(u!==_||c!==m||h!==p||d!==y){let x=1-o;const f=c*m+h*p+d*y+u*_,M=f>=0?1:-1,T=1-f*f;if(T>Number.EPSILON){const I=Math.sqrt(T),z=Math.atan2(I,f*M);x=Math.sin(x*z)/I,o=Math.sin(o*z)/I}const S=o*M;if(c=c*x+m*S,h=h*x+p*S,d=d*x+y*S,u=u*x+_*S,x===1-o){const I=1/Math.sqrt(c*c+h*h+d*d+u*u);c*=I,h*=I,d*=I,u*=I}}e[t]=c,e[t+1]=h,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,s,r,i,a){const o=s[r],c=s[r+1],h=s[r+2],d=s[r+3],u=i[a],m=i[a+1],p=i[a+2],y=i[a+3];return e[t]=o*y+d*u+c*p-h*m,e[t+1]=c*y+d*m+h*u-o*p,e[t+2]=h*y+d*p+o*m-c*u,e[t+3]=d*y-o*u-c*m-h*p,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,s,r){return this._x=e,this._y=t,this._z=s,this._w=r,this._onChangeCallback(),this}clone(){return new ke(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 s=e.x,r=e.y,i=e.z,a=e.order,o=Math.cos,c=Math.sin,h=o(s/2),d=o(r/2),u=o(i/2),m=c(s/2),p=c(r/2),y=c(i/2);switch(a){case"XYZ":this._x=m*d*u+h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u-m*p*y;break;case"YXZ":this._x=m*d*u+h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u+m*p*y;break;case"ZXY":this._x=m*d*u-h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u-m*p*y;break;case"ZYX":this._x=m*d*u-h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u+m*p*y;break;case"YZX":this._x=m*d*u+h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u-m*p*y;break;case"XZY":this._x=m*d*u-h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u+m*p*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,r=Math.sin(s);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],r=t[4],i=t[8],a=t[1],o=t[5],c=t[9],h=t[2],d=t[6],u=t[10],m=s+o+u;if(m>0){const p=.5/Math.sqrt(m+1);this._w=.25/p,this._x=(d-c)*p,this._y=(i-h)*p,this._z=(a-r)*p}else if(s>o&&s>u){const p=2*Math.sqrt(1+s-o-u);this._w=(d-c)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+h)/p}else if(o>u){const p=2*Math.sqrt(1+o-s-u);this._w=(i-h)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(c+d)/p}else{const p=2*Math.sqrt(1+u-s-o);this._w=(a-r)/p,this._x=(i+h)/p,this._y=(c+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<Number.EPSILON?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(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=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ee(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const r=Math.min(1,t/s);return this.slerp(e,r),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 s=e._x,r=e._y,i=e._z,a=e._w,o=t._x,c=t._y,h=t._z,d=t._w;return this._x=s*d+a*o+r*h-i*c,this._y=r*d+a*c+i*o-s*h,this._z=i*d+a*h+s*c-r*o,this._w=a*d-s*o-r*c-i*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const s=this._x,r=this._y,i=this._z,a=this._w;let o=a*e._w+s*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=s,this._y=r,this._z=i,this;const c=1-o*o;if(c<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*s+t*this._x,this._y=p*r+t*this._y,this._z=p*i+t*this._z,this.normalize(),this}const h=Math.sqrt(c),d=Math.atan2(h,o),u=Math.sin((1-t)*d)/h,m=Math.sin(t*d)/h;return this._w=a*u+this._w*m,this._x=s*u+this._x*m,this._y=r*u+this._y*m,this._z=i*u+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),r=Math.sqrt(1-s),i=Math.sqrt(s);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*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 ae=class da{constructor(e,t,s){this.x=0,this.y=0,this.z=0;const r=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(r!==0){if(r===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(r===1){const{x:i,y:a,z:o}=e;this.x=i,this.y=a,this.z=o||0;return}if(r===3){this.x=e,this.y=t,this.z=s;return}throw te.ILLEGAL_PARAMETERS}}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,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 da(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(Jr.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Jr.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6]*r,this.y=i[1]*t+i[4]*s+i[7]*r,this.z=i[2]*t+i[5]*s+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix3d(e){const t=this.x,s=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*s+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*s+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*s+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*s+i[10]*r+i[14])*a,this}applyQuaternion(e){const t=this.x,s=this.y,r=this.z,i=e.x,a=e.y,o=e.z,c=e.w,h=2*(a*r-o*s),d=2*(o*t-i*r),u=2*(i*s-a*t);return this.x=t+c*h+a*u-o*d,this.y=s+c*d+o*h-i*u,this.z=r+c*u+i*d-a*h,this}transformDirection(e){const t=this.x,s=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*s+i[8]*r,this.y=i[1]*t+i[5]*s+i[9]*r,this.z=i[2]*t+i[6]*s+i[10]*r,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 s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),s=this.length(),r=e.length();return Math.abs(t)===s*r}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,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,r=e.y,i=e.z,a=t.x,o=t.y,c=t.z;return this.x=r*c-i*o,this.y=i*a-s*c,this.z=s*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return Ys.copy(this).projectOnVector(e),this.sub(Ys)}reflect(e){return this.sub(Ys.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 s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,r=this.z-e.z;return t*t+s*s+r*r}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(),s=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=r,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,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ae.X_AXIS=Object.freeze(new ae(1,0,0)),ae.NEGATIVE_X_AXIS=Object.freeze(new ae(-1,0,0)),ae.Y_AXIS=Object.freeze(new ae(0,1,0)),ae.NEGATIVE_Y_AXIS=Object.freeze(new ae(0,-1,0)),ae.Z_AXIS=Object.freeze(new ae(0,0,1)),ae.NEGATIVE_Z_AXIS=Object.freeze(new ae(0,0,-1));let A=ae;const Ys=new A,Jr=new ke,qs=class ua{constructor(e,t,s,r,i,a,o,c,h,d,u,m,p,y,_,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&s!=null&&r!=null&&i!=null&&a!=null&&o!=null&&c!=null&&h!=null&&d!=null&&u!=null&&m!=null&&p!=null&&y!=null&&_!=null&&x!=null&&this.set(e,t,s,r,i,a,o,c,h,d,u,m,p,y,_,x)}set(e,t,s,r,i,a,o,c,h,d,u,m,p,y,_,x){const f=this.elements;return f[0]=e,f[4]=t,f[8]=s,f[12]=r,f[1]=i,f[5]=a,f[9]=o,f[13]=c,f[2]=h,f[6]=d,f[10]=u,f[14]=m,f[3]=p,f[7]=y,f[11]=_,f[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ua().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[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(Us.equalPoint3d(e,A.Z_AXIS))this.identity();else{const t=new A(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(A.Y_AXIS,e).normalize():t.crossVectors(A.Z_AXIS,e).normalize();const s=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,s.x,s.y,s.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,s){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,s=e.elements,r=1/rt.setFromMatrixColumn(e,0).length(),i=1/rt.setFromMatrixColumn(e,1).length(),a=1/rt.setFromMatrixColumn(e,2).length();return t[0]=s[0]*r,t[1]=s[1]*r,t[2]=s[2]*r,t[3]=0,t[4]=s[4]*i,t[5]=s[5]*i,t[6]=s[6]*i,t[7]=0,t[8]=s[8]*a,t[9]=s[9]*a,t[10]=s[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Xo,e,$o)}lookAt(e,t,s){const r=this.elements;return oe.subVectors(e,t),oe.lengthSq()===0&&(oe.z=1),oe.normalize(),Ce.crossVectors(s,oe),Ce.lengthSq()===0&&(Math.abs(s.z)===1?oe.x+=1e-4:oe.z+=1e-4,oe.normalize(),Ce.crossVectors(s,oe)),Ce.normalize(),Kt.crossVectors(oe,Ce),r[0]=Ce.x,r[4]=Kt.x,r[8]=oe.x,r[1]=Ce.y,r[5]=Kt.y,r[9]=oe.y,r[2]=Ce.z,r[6]=Kt.z,r[10]=oe.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,r=t.elements,i=this.elements,a=s[0],o=s[4],c=s[8],h=s[12],d=s[1],u=s[5],m=s[9],p=s[13],y=s[2],_=s[6],x=s[10],f=s[14],M=s[3],T=s[7],S=s[11],I=s[15],z=r[0],P=r[4],W=r[8],le=r[12],Me=r[1],O=r[5],V=r[9],Qe=r[13],Je=r[2],cs=r[6],ds=r[10],us=r[14],ms=r[3],gs=r[7],ps=r[11],ys=r[15];return i[0]=a*z+o*Me+c*Je+h*ms,i[4]=a*P+o*O+c*cs+h*gs,i[8]=a*W+o*V+c*ds+h*ps,i[12]=a*le+o*Qe+c*us+h*ys,i[1]=d*z+u*Me+m*Je+p*ms,i[5]=d*P+u*O+m*cs+p*gs,i[9]=d*W+u*V+m*ds+p*ps,i[13]=d*le+u*Qe+m*us+p*ys,i[2]=y*z+_*Me+x*Je+f*ms,i[6]=y*P+_*O+x*cs+f*gs,i[10]=y*W+_*V+x*ds+f*ps,i[14]=y*le+_*Qe+x*us+f*ys,i[3]=M*z+T*Me+S*Je+I*ms,i[7]=M*P+T*O+S*cs+I*gs,i[11]=M*W+T*V+S*ds+I*ps,i[15]=M*le+T*Qe+S*us+I*ys,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],s=e[4],r=e[8],i=e[12],a=e[1],o=e[5],c=e[9],h=e[13],d=e[2],u=e[6],m=e[10],p=e[14],y=e[3],_=e[7],x=e[11],f=e[15];return y*(+i*c*u-r*h*u-i*o*m+s*h*m+r*o*p-s*c*p)+_*(+t*c*p-t*h*m+i*a*m-r*a*p+r*h*d-i*c*d)+x*(+t*h*u-t*o*p-i*a*u+s*a*p+i*o*d-s*h*d)+f*(-r*o*d-t*c*u+t*o*m+r*a*u-s*a*m+s*c*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,s){const r=this.elements;return e instanceof A?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],o=e[5],c=e[6],h=e[7],d=e[8],u=e[9],m=e[10],p=e[11],y=e[12],_=e[13],x=e[14],f=e[15],M=u*x*h-_*m*h+_*c*p-o*x*p-u*c*f+o*m*f,T=y*m*h-d*x*h-y*c*p+a*x*p+d*c*f-a*m*f,S=d*_*h-y*u*h+y*o*p-a*_*p-d*o*f+a*u*f,I=y*u*c-d*_*c-y*o*m+a*_*m+d*o*x-a*u*x,z=t*M+s*T+r*S+i*I;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/z;return e[0]=M*P,e[1]=(_*m*i-u*x*i-_*r*p+s*x*p+u*r*f-s*m*f)*P,e[2]=(o*x*i-_*c*i+_*r*h-s*x*h-o*r*f+s*c*f)*P,e[3]=(u*c*i-o*m*i-u*r*h+s*m*h+o*r*p-s*c*p)*P,e[4]=T*P,e[5]=(d*x*i-y*m*i+y*r*p-t*x*p-d*r*f+t*m*f)*P,e[6]=(y*c*i-a*x*i-y*r*h+t*x*h+a*r*f-t*c*f)*P,e[7]=(a*m*i-d*c*i+d*r*h-t*m*h-a*r*p+t*c*p)*P,e[8]=S*P,e[9]=(y*u*i-d*_*i-y*s*p+t*_*p+d*s*f-t*u*f)*P,e[10]=(a*_*i-y*o*i+y*s*h-t*_*h-a*s*f+t*o*f)*P,e[11]=(d*o*i-a*u*i-d*s*h+t*u*h+a*s*p-t*o*p)*P,e[12]=I*P,e[13]=(d*_*r-y*u*r+y*s*m-t*_*m-d*s*x+t*u*x)*P,e[14]=(y*o*r-a*_*r-y*s*c+t*_*c+a*s*x-t*o*x)*P,e[15]=(a*u*r-d*o*r+d*s*c-t*u*c-a*s*m+t*o*m)*P,this}scale(e){const t=this.elements,s=e.x,r=e.y,i=e.z;return t[0]*=s,t[4]*=r,t[8]*=i,t[1]*=s,t[5]*=r,t[9]*=i,t[2]*=s,t[6]*=r,t[10]*=i,t[3]*=s,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,r))}makeTranslation(e,t,s){return e instanceof A?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,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),r=Math.sin(t),i=1-s,a=e.x,o=e.y,c=e.z,h=i*a,d=i*o;return this.set(h*a+s,h*o-r*c,h*c+r*o,0,h*o+r*c,d*o+s,d*c-r*a,0,h*c-r*o,d*c+r*a,i*c*c+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,r,i,a){return this.set(1,s,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,s){const r=this.elements,i=t.x,a=t.y,o=t.z,c=t.w,h=i+i,d=a+a,u=o+o,m=i*h,p=i*d,y=i*u,_=a*d,x=a*u,f=o*u,M=c*h,T=c*d,S=c*u,I=s.x,z=s.y,P=s.z;return r[0]=(1-(_+f))*I,r[1]=(p+S)*I,r[2]=(y-T)*I,r[3]=0,r[4]=(p-S)*z,r[5]=(1-(m+f))*z,r[6]=(x+M)*z,r[7]=0,r[8]=(y+T)*P,r[9]=(x-M)*P,r[10]=(1-(m+_))*P,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,s){const r=this.elements;let i=rt.set(r[0],r[1],r[2]).length();const a=rt.set(r[4],r[5],r[6]).length(),o=rt.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],ue.copy(this);const c=1/i,h=1/a,d=1/o;return ue.elements[0]*=c,ue.elements[1]*=c,ue.elements[2]*=c,ue.elements[4]*=h,ue.elements[5]*=h,ue.elements[6]*=h,ue.elements[8]*=d,ue.elements[9]*=d,ue.elements[10]*=d,t.setFromRotationMatrix(ue),s.x=i,s.y=a,s.z=o,this}equals(e){const t=this.elements,s=e.elements;for(let r=0;r<16;r++)if(t[r]!==s[r])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}};qs.IDENTITY=Object.freeze(new qs);let Ue=qs;const rt=new A,ue=new Ue,Xo=new A(0,0,0),$o=new A(1,1,1),Ce=new A,Kt=new A,oe=new A;class N{constructor(e=void 0,t=void 0){this.min=e==null?new A(1/0,1/0,1/0):new A(e.x,e.y,e.z),this.max=t==null?new A(-1/0,-1/0,-1/0):new A(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,s=e.length;t<s;t+=3)this.expandByPoint(Xs.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=Xs.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new N().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 A(0,0,0):new A(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new A(0,0,0):new A(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,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xs).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:(Te[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(e),Te[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(e),Te[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(e),Te[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(e),Te[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(e),Te[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(e),Te[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(e),Te[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(e),this.setFromPoints(Te),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 Te=[new A,new A,new A,new A,new A,new A,new A,new A],Xs=new A,ei=new B;class K{constructor(e=void 0,t=void 0){this.min=e==null?new B(1/0,1/0):new B(e.x,e.y),this.max=t==null?new B(-1/0,-1/0):new B(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,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=ei.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new K().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 B(0,0):new B(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new B(0,0):new B(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,ei).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 ti=new A,Ko=new A,Zo=new Xt;class Lt{constructor(e=new A(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,s,r){return this.normal.set(e,t,s),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const r=ti.subVectors(s,t).cross(Ko.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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 s=t||Zo.getNormalMatrix(e),r=this.coplanarPoint(ti).applyMatrix3d(e),i=this.normal.applyMatrix3(s).normalize();return this.constant=-r.dot(i),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 Lt().copy(this)}}class L extends B{static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((s,r)=>{s.toArray(t,r*2)}),t}}class w extends A{static pointArrayToNumberArray(e,t=!0){const s=t?3:2,r=new Array(e.length*s);return e.forEach((i,a)=>{i.toArray(r,a*s)}),r}}const si=new Ue,ni=new ke,ri=class cn{constructor(e=0,t=0,s=0,r=cn.DEFAULT_ORDER){this._x=e,this._y=t,this._z=s,this._order=r}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,s,r=this._order){return this._x=e,this._y=t,this._z=s,this._order=r,this._onChangeCallback(),this}clone(){return new cn(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,s=!0){const r=e.elements,i=r[0],a=r[4],o=r[8],c=r[1],h=r[5],d=r[9],u=r[2],m=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Ee(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Ee(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(Ee(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,i));break;case"ZYX":this._y=Math.asin(-Ee(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(m,p),this._z=Math.atan2(c,i)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Ee(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ee(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-d,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s=!0){return si.makeRotationFromQuaternion(e),this.setFromRotationMatrix(si,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ni.setFromEuler(this),this.setFromQuaternion(ni,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}};ri.DEFAULT_ORDER="XYZ";let ii=ri;class ai{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class $s extends ai{translate(e){return this.transform(new Xt().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Zt extends $s{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 K}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const t=[];for(let s=0;s<this.loops.length;++s){const r=this.loops[s].getPoints(e);t.push(r)}return t}buildHierarchy(){var e;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),r=this.sortBoundaryBoxesByAreas(s),i=new Map,a=r.length;for(let c=0;c<a;c++)i.set(r[c],{index:r[c],children:[]});const o={index:-1,children:[]};for(let c=0;c<a;c++){const h=r[c],d=t[h],u=s[h];let m=c+1;for(;m<a;m++){const p=r[m],y=t[p];if(s[p].containsBox(u)&&qr.isPointInPolygon(d[C.randInt(0,d.length-1)],y)){(e=i.get(p))==null||e.children.push(i.get(h));break}}m===a&&o.children.push(i.get(h))}return o}calculateBoundaryBoxes(e){const t=[];return e.forEach(s=>{t.push(new K().setFromPoints(s))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((r,i)=>{const a=r.size,o=a.width*a.height;t.push({area:o,index:i})}),t.sort((r,i)=>r.area-i.area);const s=[];return t.forEach(r=>{s.push(r.index)}),s}}class it extends $s{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 s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}getSpacedPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPointAt(s/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let s,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)s=this.getPoint(a/e),i+=s.distanceTo(r),t.push(i),r=s;return t}getUtoTmapping(e,t){const s=this.getLengths();let r=0;const i=s.length;let a;t?a=t:a=e*s[i-1];let o=0,c=i-1,h;for(;o<=c;)if(r=Math.floor(o+(c-o)/2),h=s[r]-a,h<0)o=r+1;else if(h>0)c=r-1;else{c=r;break}if(r=c,s[r]===a)return r/(i-1);const d=s[r],u=s[r+1]-d,m=(a-d)/u;return(r+m)/(i-1)}getTangent(e){let t=e-1e-4,s=e+1e-4;t<0&&(t=0),s>1&&(s=1);const r=this.getPoint(t),i=this.getPoint(s),a=new L;return a.copy(i).sub(r).normalize(),a}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}}class at extends it{constructor(e,t,s,r,i){super();const a=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(r!==void 0)+ +(i!==void 0);if(a==3)typeof e=="object"&&typeof t=="object"&&typeof s=="object"?this.createByThreePoints(e,t,s):this.createByStartEndPointsAndBulge(e,t,s);else if(a==5){const o=e;this.center=new L(o.x,o.y),this.radius=t,this.startAngle=s,this.endAngle=r,this.clockwise=i}else throw te.ILLEGAL_PARAMETERS}createByThreePoints(e,t,s){const r=(P,W)=>({x:(P.x+W.x)/2,y:(P.y+W.y)/2}),i=(P,W)=>(W.y-P.y)/(W.x-P.x),a=P=>-1/P,o=r(e,t),c=r(t,s),h=i(e,t),d=i(t,s),u=a(h),m=a(d),p=(P,W,le,Me)=>{const O=(Me-W)/(P-le),V=P*O+W;return{x:O,y:V}},y=o.y-u*o.x,_=c.y-m*c.x,x=p(u,y,m,_),f=Math.sqrt(Math.pow(e.x-x.x,2)+Math.pow(e.y-x.y,2)),M=(P,W)=>Math.atan2(P.y-W.y,P.x-W.x),T=M(e,x),S=M(t,x),I=M(s,x),z=I>T&&I<S||T>I&&T<S||S>I&&S<T;this.center=x,this.radius=f,this.startAngle=T,this.endAngle=I,this.clockwise=!z}createByStartEndPointsAndBulge(e,t,s){let r,i,a;s<0?(r=Math.atan(-s)*4,i=new B(e),a=new B(t)):(r=Math.atan(s)*4,i=new B(t),a=new B(e));const o=new B().subVectors(a,i),c=o.length(),h=new B().addVectors(i,o.multiplyScalar(.5)),d=Math.abs(c/2/Math.tan(r/2)),u=o.normalize();let m;if(r<Math.PI){const p=new B(u.x*Math.cos(Math.PI/2)-u.y*Math.sin(Math.PI/2),u.y*Math.cos(Math.PI/2)+u.x*Math.sin(Math.PI/2));m=h.add(p.multiplyScalar(-d))}else{const p=new B(u.x*Math.cos(Math.PI/2)-u.y*Math.sin(Math.PI/2),u.y*Math.cos(Math.PI/2)+u.x*Math.sin(Math.PI/2));m=h.add(p.multiplyScalar(d))}s<0?(this.startAngle=Math.atan2(i.y-m.y,i.x-m.x),this.endAngle=Math.atan2(a.y-m.y,a.x-m.x)):(this.startAngle=Math.atan2(a.y-m.y,a.x-m.x),this.endAngle=Math.atan2(i.y-m.y,i.x-m.x)),this.clockwise=s<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(e){this._center=new L(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._startAngle}set startAngle(e){this._startAngle=C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?C.normalizeAngle(this.startAngle-this.endAngle):C.normalizeAngle(this.endAngle-this.startAngle)}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=C.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(e)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of t)C.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&e.push(this.getPointAtAngle(i));const s=e.map(i=>i.x),r=e.map(i=>i.y);return new K(new L(Math.min(...s),Math.min(...r)),new L(Math.max(...s),Math.max(...r)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new at(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(e){const t=this.center.x+this.radius*Math.cos(e),s=this.center.y+this.radius*Math.sin(e);return new L(t,s)}getPoints(e=100){const t=[];let s=this.deltaAngle,r=this.startAngle;if(this.closed&&(s=H,r=0),this.clockwise)for(let i=0;i<=e;i++){const a=r-s*(i/e),o=this.getPointAtAngle(a);t.push(new L(o.x,o.y))}else for(let i=0;i<=e;i++){const a=r+s*(i/e),o=this.getPointAtAngle(a);t.push(new L(o.x,o.y))}return t}}class Qo extends ai{translate(e){return this.transform(new Ue().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 Qt extends Qo{}class Oe extends Qt{constructor(e,t){super(),this._start=new w(e),this._end=new w(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new A().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)}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 s=this.delta(We).normalize();return new w(this._start).addScaledVector(s,e)}else{const s=this.delta(We).normalize();return new w(this._end).addScaledVector(s,e)}}extend(e,t=!1){if(t){const s=We.subVectors(this._start,this._end).normalize();this._start=new w(this._start).addScaledVector(s,e)}else{const s=this.delta(We).normalize();this._end=new w(this._end).addScaledVector(s,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){oi.subVectors(e,this._start),Jt.subVectors(this.endPoint,this.startPoint);const s=Jt.dot(Jt);let r=Jt.dot(oi)/s;return t&&(r=C.clamp(r,0,1)),r}closestPointToPoint(e,t,s){const r=this.closestPointToPointParameter(e,t);return this.delta(s).multiplyScalar(r).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,s=We.subVectors(e,this.startPoint).dot(t);return new w().copy(t).multiplyScalar(s).add(this.startPoint)}perpPoint(e){const t=this.direction,s=this.startPoint,r=We.subVectors(e,s).dot(t),i=We.copy(t).multiplyScalar(r);return new w().addVectors(s,i)}calculateBoundingBox(){const e=new w(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),t=new w(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new N(e,t)}transform(e){return this._start.applyMatrix3d(e),this._end.applyMatrix3d(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 Oe(this._start.clone(),this._end.clone())}}const We=new A,oi=new A,Jt=new A;class Ye extends Qt{static computeCenterPoint(e,t,s){const r=new A().addVectors(e,t).multiplyScalar(.5),i=new A().addVectors(e,s).multiplyScalar(.5),a=new A().subVectors(t,e),o=new A().subVectors(s,e),c=new A().crossVectors(a,o).normalize();if(c.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const h=new A().crossVectors(a,c).normalize(),d=new A().crossVectors(o,c).normalize(),u=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new Oe(r,r.clone().add(u)),y=new Oe(i,i.clone().add(m)),_=new A;return p.closestPointToPoint(y.startPoint,!0,_)?_:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(e,t,s){const r=Ye.computeCenterPoint(e,t,s);if(r){const i=r.distanceTo(e),a=new A().subVectors(e,r),o=new A().subVectors(t,r),c=Math.atan2(a.y,a.x),h=Math.atan2(o.y,o.x);return new Ye(r,i,c,h,A.Z_AXIS)}}constructor(e,t,s,r,i,a=A.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=s,this.endAngle=r,this.normal=i,this.refVec=a,(r-s)%H==0?(this.startAngle=0,this.endAngle=H):(this.startAngle=s,this.endAngle=r)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return C.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 A(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new A(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 c=0;c<2*Math.PI;c+=Math.PI/2)C.isBetweenAngle(c,this.startAngle,this.endAngle)&&e.push(c);let t=1/0,s=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(const c of e){const h=this.getPointAtAngle(c);h.x<t&&(t=h.x),h.y<s&&(s=h.y),h.z<r&&(r=h.z),h.x>i&&(i=h.x),h.y>a&&(a=h.y),h.z>o&&(o=h.z)}return new N({x:t,y:s,z:r},{x:i,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let s=this.deltaAngle,r=this.startAngle;this.closed&&(s=H,r=0);for(let i=0;i<=e;i++){const a=r+s*(i/e),o=this.getPointAtAngle(a);t.push(o)}return t}transform(e){const t=Ks.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=Ks.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(e),t.applyMatrix3d(e),s.applyMatrix3d(e),this.normal.applyMatrix3d(e).normalize(),this.refVec.applyMatrix3d(e).normalize(),this.startAngle=this.getAngle(t),this.endAngle=this.getAngle(s),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ye(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(Ks.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,s=this.refVec,r={x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x},i=this.center,a=this.radius;return new w(i.x+a*(s.x*Math.cos(e)+r.x*Math.sin(e)),i.y+a*(s.y*Math.cos(e)+r.y*Math.sin(e)),i.z+a*(s.z*Math.cos(e)+r.z*Math.sin(e)))}get plane(){const e=new A(this.center).distanceTo(Hs);return new Lt(this.normal,e)}}const Ks=new A;class es extends it{constructor(e,t,s,r=0,i=H,a=!1,o=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=s,(i-r)%H==0?(this.startAngle=0,this.endAngle=H):(this.startAngle=r,this.endAngle=i),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:C.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 C.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,s=-1/0,r=-1/0;for(let i=0;i<=100;i++){const a=this.getPoint(i/100);e=Math.min(e,a.x),t=Math.min(t,a.y),s=Math.max(s,a.x),r=Math.max(r,a.y)}return new K({x:e,y:t},{x:s,y:r})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let s=this.endAngle-this.startAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=t;for(;s>t;)s-=t;s<Number.EPSILON&&(r?s=0:s=t),this.clockwise===!0&&!r&&(s===t?s=-t:s=s-t);const i=this.startAngle+e*s;let a=this.center.x+this.majorAxisRadius*Math.cos(i),o=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const c=Math.cos(this.rotation),h=Math.sin(this.rotation),d=a-this.center.x,u=o-this.center.y;a=d*c-u*h+this.center.x,o=d*h+u*c+this.center.y}return new L(a,o)}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 es(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class ts extends Qt{constructor(e,t,s,r,i,a=0,o=H){super(),this.center=e,this.normal=t,this.majorAxis=s,this.majorAxisRadius=r,this.minorAxisRadius=i;const c=Math.abs(o-a);Math.abs(c-H)<1e-10||Math.abs(c-2*H)<1e-10?(this.startAngle=0,this.endAngle=H):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:C.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-H)<1e-10?H:C.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 A(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new A(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new A().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){const e=this.deltaAngle/1e3;let t=0,s=this.getPointAtAngle(this.startAngle);for(let r=1;r<=1e3;r++){const i=this.startAngle+r*e,a=this.getPointAtAngle(i),o=a.x-s.x,c=a.y-s.y,h=a.z-s.z;t+=Math.sqrt(o*o+c*c+h*h),s=a}return t}calculateBoundingBox(){if(this.majorAxis.equals(A.X_AXIS)||this.majorAxis.equals(A.Y_AXIS)||this.majorAxis.isParallelTo(A.X_AXIS)||this.majorAxis.isParallelTo(A.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let c=0;c<2*Math.PI;c+=Math.PI/2)C.isBetweenAngle(c,this.startAngle,this.endAngle)&&e.push(c);let t=1/0,s=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(const c of e){const h=this.getPointAtAngle(c);h.x<t&&(t=h.x),h.y<s&&(s=h.y),h.z<r&&(r=h.z),h.x>i&&(i=h.x),h.y>a&&(a=h.y),h.z>o&&(o=h.z)}return new N({x:t,y:s,z:r},{x:i,y:a,z:o})}else{let e=1/0,t=1/0,s=1/0,r=-1/0,i=-1/0,a=-1/0;for(let o=0;o<=100;o++){const c=this.startAngle+this.deltaAngle*(o/100),h=this.getPointAtAngle(c);e=Math.min(e,h.x),t=Math.min(t,h.y),s=Math.min(s,h.z),r=Math.max(r,h.x),i=Math.max(i,h.y),a=Math.max(a,h.z)}return new N({x:e,y:t,z:s},{x:r,y:i,z:a})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let s=this.deltaAngle,r=this.startAngle;this.closed&&(s=H,r=0);for(let i=0;i<=e;i++){const a=r+s*(i/e),o=this.getPointAtAngle(a);t.push(o)}return t}getPointAtAngle(e){const t=Math.cos(e),s=Math.sin(e),r=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),i=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(r);return new w(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(e){const t=new A(e).sub(this.center),s=t.dot(this.majorAxis),r=t.dot(this.minorAxis),i=s/this.majorAxisRadius,a=r/this.minorAxisRadius;return i*i+a*a<=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 ts(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new A(this.center).distanceTo(Hs);return new Lt(this.normal,e)}}class kt extends it{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 L(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 L(t.x,t.y)}else{const t=this._vertices[e-1];return new L(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 s=0;s<t;++s){const r=this._vertices[s];let i=null;if(s<t-1?i=this._vertices[s+1]:s==t-1&&this.closed&&(i=this._vertices[0]),i)if(r.bulge){const a=new at(r,i,r.bulge);e+=a.length}else e+=new L(r.x,r.y).distanceTo(i)}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 L(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new K().setFromPoints(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(e,t){const s=[];return this.getPoints(e).forEach(r=>s.push(new w().set(r.x,r.y,t))),s}getPoints(e){const t=[],s=this._vertices.length;for(let r=0;r<s;++r){const i=this._vertices[r];if(i.bulge){let a=null;if(r<s-1?a=this._vertices[r+1]:r==s-1&&this.closed&&(a=this._vertices[0]),a){const o=new at(i,a,i.bulge).getPoints(e),c=o.length;for(let h=0;h<c;++h){const d=o[h];t.push(new L(d.x,d.y))}}}else t.push(new L(i.x,i.y)),r==s-1&&this.closed&&t.push(t[0])}return t}}class ss extends it{constructor(e,t){super(),this._start=new L(e),this._end=new L(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 L(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new L(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new K(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 ss(this._start.clone(),this._end.clone())}}class li extends it{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 L(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 K;return t.setFromPoints(e),t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(s=>{s.getPoints(e).forEach(r=>{t.push(new L(r.x,r.y))})}),t}}class qe{constructor(e,t,s,r){this._degree=e,this._knots=[...t],this._controlPoints=s.map(i=>[...i]),this._weights=r?[...r]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>[...e])}weights(){return[...this._weights]}point(e){return vt(e,this._degree,this._knots,this._controlPoints,this._weights)}length(){return Zr(this._degree,this._knots,this._controlPoints,this._weights)}static byKnotsControlPointsWeights(e,t,s,r){return new qe(e,t,s,r)}static byPoints(e,t,s="Uniform"){let r;switch(s){case"Chord":r=$r(t,e);break;case"SqrtChord":r=Kr(t,e);break;case"Uniform":default:r=Xr(t,e.length);break}const i=Qr(e),a=new Array(i.length).fill(1);return new qe(t,r,i,a)}}class ot extends Qt{constructor(e,t,s){super();const r=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(r!=2&&r!=3)throw te.ILLEGAL_PARAMETERS;const i=3;if(this._closed=!1,r==2&&!Array.isArray(t)){if(this._fitPoints=e,this._knotParameterization=t,this._fitPoints.length<4)throw te.ILLEGAL_PARAMETERS;const a=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=qe.byPoints(a,i,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints()),this._originalControlPoints=[...this._controlPoints],this._originalKnots=[...this._nurbsCurve.knots()],this._originalWeights=[...this._nurbsCurve.weights()]}else{if(this._controlPoints=e,this._controlPoints.length<4)throw te.ILLEGAL_PARAMETERS;const a=this.toNurbsPoints(this._controlPoints);this._nurbsCurve=qe.byKnotsControlPointsWeights(i,t,a,s),this._originalControlPoints=[...this._controlPoints],this._originalKnots=[...this._nurbsCurve.knots()],this._originalWeights=s?[...s]:new Array(this._controlPoints.length).fill(1)}}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,e?this.makeClosed():this.makeOpen())}makeClosed(){const e=this._nurbsCurve.degree(),t=this._nurbsCurve.controlPoints(),s=this._nurbsCurve.weights(),r=t.length,i=[...t,...t.slice(0,e)],a=[...s,...s.slice(0,e)],o=this.createClosedKnotVector(r,e);this._nurbsCurve=qe.byKnotsControlPointsWeights(e,o,i,a),this._controlPoints=this.toGePoints(i)}makeOpen(){if(!this._originalControlPoints||!this._originalKnots||!this._originalWeights)throw new Error("Original curve data not available");const e=this._nurbsCurve.degree(),t=this.toNurbsPoints(this._originalControlPoints);this._nurbsCurve=qe.byKnotsControlPointsWeights(e,this._originalKnots,t,this._originalWeights),this._controlPoints=[...this._originalControlPoints]}createClosedKnotVector(e,t){const s=e+2*t+1,r=[];for(let i=0;i<s;i++)r.push(i);return r}get degree(){return this._nurbsCurve.degree()}get knotParameterization(){return this._knotParameterization}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[t],r=this._nurbsCurve.point(s);return new w(r[0],r[1],r[2])}get endPoint(){if(this._closed)return this.startPoint;const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[e.length-t-1],r=this._nurbsCurve.point(s);return new w(r[0],r[1],r[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,s=e<0||e>=t?t-1:e,r=this._fitPoints[s];return{x:r.x,y:r.y,z:r.z||0}}getControlPointAt(e){const t=this._controlPoints.length,s=e<0||e>=t?t-1:e;return this._controlPoints[s]}getPoints(e=100){const t=this._nurbsCurve,s=[],r=t.knots(),i=t.degree(),a=r[i],o=r[r.length-i-1];if(this._closed){const c=(o-a)/(e-1);for(let h=0;h<e-1;h++){const d=a+h*c,u=t.point(d);s.push(new w(u[0],u[1],u[2]))}s.push(s[0])}else{const c=(o-a)/(e-1);for(let h=0;h<e;h++){const d=h===e-1?o:a+h*c,u=t.point(d);s.push(new w(u[0],u[1],u[2]))}}return s}getCurvePoints(e,t){const s=[],r=e.knots(),i=r[3],a=(r[r.length-4]-i)/(t-1);for(let o=0;o<t;o++){const c=i+o*a;s.push(e.point(c))}return s}calculateBoundingBox(){const e=this.getPoints(100);return new N().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((s,r)=>{t[r]=[s.x,s.y,s.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((s,r)=>{t[r]={x:s[0],y:s[1],z:s[2]}}),t}}for(var Xe=256,hi=[],ci=256,ns;Xe--;)hi[Xe]=(Xe+256).toString(16).substring(1);function Jo(n){var e=0,t=11;if(!ns||Xe+t>ci*2)for(ns="",Xe=0;e<ci;e++)ns+=hi[Math.random()*256|0];return ns.substring(Xe,Xe+++t)}class De{constructor(e,t){e=e||{},et(e,{objectId:Jo()}),this._attrs=new yn(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:hn().workingDatabase}set database(e){this._database=e}close(){}}class ge extends De{constructor(){super(...arguments),this._layer="0",this._color=new Ne,this._lineType=Yt,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.name.substring(4)}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 t=this.getLayerColor();t&&t.color&&(e=t)}else this.color.isByBlock||this.color.color!=null&&(e=this.color);return e.color==null?16777215:e.color}get lineType(){return this._lineType}set lineType(e){this._lineType=e||Yt}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}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,s,r,i){}transformBy(e){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const e=this.getLineType(),t=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(e);return t?{...t.linetype,color:this.rgbColor}:{name:e,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Yt){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==Ar?Wt:this.lineType;return Wt}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}}class Zs extends ge{constructor(e){super(),this._blockName=e,this._position=new w,this._rotation=0,this._normal=new A(0,0,1),this._scaleFactors=new w(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 geometricExtents(){const e=new N,t=this.blockTableRecord;if(t!=null){const i=t.newIterator();for(const a of i)e.union(a.geometricExtents)}const s=new ke().setFromEuler(new ii(this.rotation,0,0)),r=new Ue;return r.compose(this.position,s,this.scaleFactors),e.applyMatrix4(r),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const r=this.computeTransformMatrix();return Le.instance.draw(e,s,this.rgbColor,!0,r,this.normal)}else return e.group(t)}computeTransformMatrix(){const e=new ke;return e.setFromAxisAngle(A.Z_AXIS,this.rotation),new Ue().compose(this._position,e,this._scaleFactors)}}class me extends ge{}class di extends me{constructor(e,t,s,r,i,a,o){super(),this._geo=new ts(e,t,s,r,i,a,o)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(e){return e.ellipticalArc(this._geo,this.lineStyle)}}class ui extends me{constructor(e,t,s,r){super(),this._geo=new Ye(e,t,s,r,A.Z_AXIS,A.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 startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}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,this.lineStyle)}}class mi extends me{constructor(e,t,s=A.Z_AXIS){super(),this._geo=new Ye(e,t,0,H,s,A.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}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,this.lineStyle)}}var gi=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(gi||{}),pi=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(pi||{});class yi extends ge{constructor(){super(),this._elevation=0,this._geo=new Zt,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}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 N({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}draw(e){return e.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}}var _i=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(_i||{});class fi 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(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 w().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 N().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,this.lineStyle)}else return e.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new ot(this._vertices,"Uniform"),this._updated=!1)}}class xi extends me{constructor(e,t){super(),this._geo=new Oe(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}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,s,r,i){const a=this.startPoint,o=this.endPoint;switch(e){case Ge.EndPoint:i.push(a),i.push(o);break;case Ge.MidPoint:i.push(this.midPoint);break;case Ge.Nearest:{const c=this._geo.project(s);i.push(c)}break;case Ge.Perpendicular:{const c=this._geo.perpPoint(s);i.push(c)}break;case Ge.Tangent:i.push(a);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,r=[new w(t.x,t.y,0),new w(s.x,s.y,0)];return e.lines(r,this.lineStyle)}}var Qs=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(Qs||{}),rs=(n=>(n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE",n))(rs||{}),lt=(n=>(n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n))(lt||{}),Js=(n=>(n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",n))(Js||{}),en=(n=>(n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT",n))(en||{}),tn=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(tn||{});class is{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new w,this._height=0,this._width=0,this._viewCenter=new w,this._viewHeight=0}get number(){return this._number}set number(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new K;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 K;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new is;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}}class bi extends ge{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=lt.TopLeft,this._direction=new A(1,0,0),this._drawingDirection=rs.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 N}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){const t={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},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class sn extends me{constructor(e,t,s){super();const r=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(r!=2&&r!=3)throw te.ILLEGAL_PARAMETERS;r==2&&!Array.isArray(t)?this._geo=new ot(e,t):this._geo=new ot(e,t,s)}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,this.lineStyle)}}const el=new A;class Ai extends Zs{constructor(e,t,s){super(e),this._attachmentPoint=lt.TopLeft,this._numColumns=s,this._numRows=t,this._columnWidth=new Array(s),this._rowHeight=new Array(t),this._cells=new Array(t*s)}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,s){return this._cells[e*t].text}setTextString(e,t,s){this._cells[e*t].text=s}isEmpty(e,t){return!this._cells[e*t].text}get geometricExtents(){return new N}draw(e){let t=0,s=0;const r=new Uint16Array(this.numColumns*this.numRows*8),i=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let m=0;m<=this.numRows;m++){t-=m>0?this.rowHeight(m-1):0,s=0;for(let p=0;p<=this.numColumns;p++)s+=p>0?this.columnWidth(p-1):0,i[a++]=s,i[a++]=t,i[a++]=0}const o=[],c=new Array(this.numRows*this.numColumns).fill(!1);s=0,a=0;let h=0;for(let m=0;m<this.numColumns;m++){s+=m>0?this.columnWidth(m-1):0,t=0;for(let p=0;p<this.numRows;p++){t+=p>0?this.rowHeight(p-1):0;const y=this.cell(p*this.numColumns+m);if(h=p*this.numColumns+m,y&&!c[h]){const _=y.borderWidth??1,x=y.borderHeight??1;this.fillVisited(c,h,this.numColumns,_,x),r[a++]=m+p*(this.numColumns+1),r[a++]=m+p*(this.numColumns+1)+_;const f=i[r[a-1]*3]-s,M=m+(p+x)*(this.numColumns+1)+_;m+_==this.numColumns&&(r[a++]=m+p*(this.numColumns+1)+_,r[a++]=M);const T=-i[M*3+1]-t;if(p+x==this.numRows&&(r[a++]=m+(p+x)*(this.numColumns+1)+x,r[a++]=m+(p+x)*(this.numColumns+1)),r[a++]=m+(p+x)*(this.numColumns+1),r[a++]=m+p*(this.numColumns+1),y.text){const S=y.attachmentPoint||this.attachmentPoint||lt.MiddleCenter,I=this.getTableTextOffset(S,f,T),z={text:y.text,height:y.textHeight,width:f,position:el.set(s,-t,0).clone().add(I),rotation:this.rotation,attachmentPoint:S},P={...this.getTextStyle(y),color:this.color.color};o.push(e.mtext(z,P))}}}}o.push(e.lineSegments(i,3,r,this.lineStyle));const d=e.group(o),u=new ke;return u.setFromAxisAngle(A.Z_AXIS,this.rotation),wi.compose(this.position,u,this.scaleFactors),d.applyMatrix(wi),d}fillVisited(e,t,s,r,i){if(i==1&&r==1)e[t]=!0;else for(let a=0;a<r;++a)for(let o=0;o<i;++o)e[t+a+o*s]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable;let s;return e.textStyle&&(s=t.getAt(e.textStyle)),s||(s=t.getAt("STANDARD")||t.getAt("Standard")),s.textStyle}getTableTextOffset(e,t,s){const r=new A;switch(e){case 1:break;case 2:r.setX(t/2);break;case 3:r.setX(t);break;case 4:r.setY(-s/2);break;case 5:r.set(t/2,-s/2,0);break;case 6:r.set(t,-s/2,0);break;case 7:r.setY(-s);break;case 8:r.set(t/2,-s,0);break;case 9:r.set(t,-s,0);break}return r}}const wi=new Ue;var Ii=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(Ii||{}),Pi=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Pi||{});class Ei extends ge{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(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 N}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){const t={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:rs.BOTTOM_TO_TOP,attachmentPoint:lt.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class Ti 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(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 N().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 kt(this._vertices,!0),s=new Zt;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}}class Si extends me{constructor(){super(),this._elevation=0,this._geo=new kt}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,s=0,r=-1,i=-1){const a=r<0?void 0:r,o=i<0?void 0:i,c={x:t.x,y:t.y,bulge:s,startWidth:a,endWidth:o};this._geo.addVertexAt(e,c)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new w(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new N({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(r=>t.push(new w().set(r.x,r.y,this.elevation))),e.lines(t,this.lineStyle)}}class Mi extends ge{constructor(){super(),this._geo=new w}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new N().expandByPoint(this._geo)}transformBy(e){return this._geo.applyMatrix3d(e),this}draw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}}var vi=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(vi||{}),Li=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Li||{});class nn extends ge{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new w,this._scale=new B(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!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 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 N;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,this.lineStyle)}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,s=this._height,r=new K;r.setFromPoints(this._clipBoundary);const i=new L;i.setX(this._position.x-r.min.x*t),i.setY(this._position.y-r.min.y*s),this._clipBoundary.forEach(a=>{const o=a.x*t+i.x,c=a.y*s+i.y;e.push(new w(o,c,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){ki.copy(e[1]);for(let t=1;t<4;t++)as.copy(e[t]),as.rotateAround(ki,this._rotation),e[t].setX(as.x),e[t].setY(as.y)}e.push(e[0])}return e}}const ki=new L,as=new L;class Ci extends me{constructor(){super(),this._basePoint=new w,this._unitDir=new A}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 N;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),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,this.lineStyle)}}class Oi extends ge{constructor(){super(),this._centerPoint=new w,this._height=0,this._width=0,this._viewCenter=new w,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new N}draw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new is;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 s=[];return s.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}}class Di extends nn{draw(e){const t=this.boundaryPath(),s=new Zt;return s.add(new kt(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}}class Ni extends me{constructor(){super(),this._basePoint=new w,this._unitDir=new A}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 N;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),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,this.lineStyle)}}var Ri=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(Ri||{});class $e extends ge{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new w,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=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 Ct),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}draw(e){if(this.dimBlockId){const t=this.database.tables.blockTable.getAt(this.dimBlockId);if(t)return Le.instance.draw(e,t,this.rgbColor,!1)}return e.group([])}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return Le.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return Le.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,s){const r=new w().subVectors(t,e).normalize();return new w(t).addScaledVector(r,s)}findPointOnLine2(e,t,s){const r=e.x+s*Math.cos(t),i=e.y+s*Math.sin(t);return{x:r,y:i}}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():Qs.Closed}}class zi extends $e{constructor(e,t,s,r,i=null,a=null){super(),this._centerPoint=new w().copy(e),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(s),this._arcPoint=new w().copy(r),this.dimensionText=i,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new N}}class Fi extends $e{constructor(e,t,s,r=null,i=null){super(),this._dimLinePoint=new w().copy(s),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=r,this.dimensionStyleName=i}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 N}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(t,this._dimLinePoint),i=this.findIntersectionPoint(s,this._dimLinePoint),a=new Oe(r,i);return e.push(a),t.endPoint=r,this.adjustExtensionLine(t),e.push(t),s.endPoint=i,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new Oe(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,r=e.endPoint,i=new A().subVectors(r,s).normalize(),o=new A().subVectors(t,s).dot(i),c=new A().copy(i).multiplyScalar(o);return new A().addVectors(s,c)}}class tl extends $e{constructor(e,t,s,r,i=null,a=null){super(),this._arcPoint=new w().copy(r),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(s),this._centerPoint=new w().copy(e),this.dimensionText=i,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new N}}class Bi extends $e{constructor(e,t,s=0,r=null,i=null){super(),this._chordPoint=new w().copy(e),this._farChordPoint=new w().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=r,this.dimensionStyleName=i}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 N}drawLines(e,t){const s=[],r=t.length;return r==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):r==3?(this.sortLines(t),s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(e,t[1])),s.push(this.drawLine(e,t[2],{firstArrow:this.firstArrowStyle}))):t.forEach(i=>{s.push(this.drawLine(e,i))}),s}drawLine(e,t,s){if(s){const r=[t.startPoint,t.endPoint];return e.lines(r,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,r)=>s.x!==r.x?s.x-r.x:s.y!==r.y?s.y-r.y:s.z-r.z;e.sort((s,r)=>{const i=t(s.startPoint,r.startPoint);return i!==0?i:t(s.endPoint,r.endPoint)})}}class Vi extends $e{constructor(e,t,s=null,r=null){super(),this._definingPoint=new w().copy(e),this._leaderEndPoint=new w().copy(t),this.dimensionText=s,this.dimensionStyleName=r}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 N}get arrowLineCount(){return 0}}class ji extends $e{constructor(e,t,s,r=null,i=null){super(),this._center=new w().copy(e),this._chordPoint=new w().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=i}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 N}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}}class Gi{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return 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=="MTEXT"?this.convertMText(e):e.type=="POLYLINE"||e.type=="LWPOLYLINE"?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}convertArc(e){return new ui(e.center,e.radius,C.degToRad(e.startAngle),C.degToRad(e.endAngle))}convertCirle(e){return new mi(e.center,e.radius)}convertEllipse(e){const t=new A(e.majorAxisEndPoint),s=t.length();return new di(e.center,A.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new xi(new w(t.x,t.y,t.z||0),new w(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){const t=new sn(e.controlPoints,e.knots,e.weights);return t.closed=!!(e.flag&1),t}else if(e.numberOfFitPoints>0){const t=this.numberArrayToPointArray(e.fitPoints,e.numberOfFitPoints);if(t!=null){const s=new sn(t,"Uniform");return s.closed=!!(e.flag&1),s}}return null}convertPoint(e){const t=new Mi;return t.position=e.position,t}convertSolid(e){const t=new Ti;return e.points.forEach((s,r)=>t.setPointAt(r,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new Si;return t.closed=!!(e.flag&1),e.vertices.forEach((s,r)=>{t.addVertexAt(r,new L(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var r;const t=new yi;return(r=e.definitionLines)==null||r.forEach(i=>{t.definitionLines.push({angle:i.angle,origin:i.base,delta:i.offset,dashPattern:i.numberOfDashLengths>0?i.dashLengths:[]})}),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(i=>{if(i.boundaryPathTypeFlag&2){const o=i,c=new kt;c.closed=o.isClosed,o.vertices.forEach((h,d)=>{c.addVertexAt(d,{x:h.x,y:h.y,bulge:h.bulge})}),t.add(c)}else{const o=i,c=new li;o.edges.forEach(h=>{if(h.type==1){const d=h;c.add(new ss(d.start,d.end))}else if(h.type==2){const d=h;c.add(new at(d.center,d.radius,C.degToRad(d.startAngle||0),C.degToRad(d.endAngle||0),!d.isCCW))}else if(h.type==3){const d=h;new B().subVectors(d.end,d.center);const m=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),p=m*d.lengthOfMinorAxis;let y=C.degToRad(d.startAngle||0),_=C.degToRad(d.endAngle||0);const x=Math.atan2(d.end.y,d.end.x);d.isCCW||(y=Math.PI*2-y,_=Math.PI*2-_),c.add(new es({...d.center,z:0},m,p,y,_,!d.isCCW,x))}else if(h.type==4){const d=h;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const u=d.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let m=!0;const p=d.controlPoints.map(y=>(y.weight==null&&(m=!1),y.weight||1));c.add(new ot(u,d.knots,m?p:void 0))}else if(d.numberOfFitData>0){const u=d.fitDatum.map(m=>({x:m.x,y:m.y,z:0}));c.add(new ot(u,"Uniform"))}}}),t.add(c)}}),t}convertTable(e){const t=new Ai(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,r)=>t.setColumnWidth(r,s)),e.rowHeightArr.forEach((s,r)=>t.setRowHeight(r,s)),e.cells.forEach((s,r)=>{t.setCell(r,s)}),t}convertText(e){const t=new Ei;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=C.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 bi;return t.contents=e.text.join(""),e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=C.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new A(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new fi;return e.vertices.forEach(s=>{t.appendVertex(s)}),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,s=new Fi(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=C.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new zi(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new Vi(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new ji(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new Bi(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageDefId=e.imageDefHandle,t.isClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,e.clippingBoundaryPath.forEach(s=>{t.clipBoundary.push(new L(s))}),t.clipBoundaryType=e.clippingBoundaryType,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 nn;return this.processImage(e,t),t}convertWipeout(e){const t=new Di;return this.processImage(e,t),t}convertViewport(e){const t=new Oi;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 Ci;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertXline(e){const t=new Ni;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertBlockReference(e){const t=new Zs(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?C.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection),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}processCommonAttrs(e,t){t.layer=e.layer,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.color=e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName!=null&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=e.isVisible),e.transparency!=null&&(t.transparency=e.transparency)}numberArrayToPointArray(e,t){const s=e.length;let r=0;if(s/2==t?r=2:s/3==t&&(r=3),r==0)return;const i=[];for(let a=0,o=s/r;a<o;++a)i.push({x:e[a*r],y:e[a*r+1],z:r==3?e[a*r+2]:void 0});return i}}class rn extends De{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new K,this._extents=new N}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 an extends De{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)}remove(e){return this.getAt(e)?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,r)=>{s===t&&this._recordsByName.delete(r)}),!0):!1}removeAll(){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 qt(this._recordsByName)}}class Hi extends an{getBtrIdAt(e){for(const[t,s]of this._recordsByName)if(s.blockTableRecordId==e)return s}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class Ui extends De{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class sl{convertLayout(e){const t=new rn;return t.layoutName=e.layoutName,t.tabOrder=e.tabOrder,t.blockTableRecordId=e.ownerObjectId,t.limits.min.copy(e.minLimit),t.limits.max.copy(e.maxLimit),t.extents.min.copy(e.minExtent),t.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,t),t}convertImageDef(e){const t=new Ui;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class Wi extends Pr{parse(e){return new Uo().parseSync(e)}getFonts(e){var i;const t=new Map,s=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(i=e.tables.STYLE)==null||i.entries.forEach(a=>{const o=[];let c=s(a.font);c&&o.push(c),c=s(a.bigFont),c&&o.push(c),t.set(a.name,o)});const r=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,r),Array.from(r)}getFontsInBlock(e,t,s,r){const i=/\\f(.*?)\|/g;e.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.join("").matchAll(i)].forEach(d=>{r.add(d[1].toLowerCase())});const h=s.get(o.styleName);h==null||h.forEach(d=>r.add(d))}else if(a.type=="TEXT"){const o=a,c=s.get(o.styleName);c==null||c.forEach(h=>r.add(h))}else if(a.type=="INSERT"){const c=t[a.name];c&&c.entities&&this.getFontsInBlock(c.entities,t,s,r)}})}async processEntities(e,t,s,r,i){const a=new Gi,o=e.entities,c=o.length,h=new An(c,100-r.value,s),d=t.tables.blockTable.modelSpace,u=t.tables.blockTable;await h.processChunk(async(m,p)=>{for(let y=m;y<p;y++){const _=o[y],x=a.convert(_);if(x){let f=d;_.ownerBlockRecordSoftId!=null&&(f=u.getIdAt(_.ownerBlockRecordSoftId)||f),f.appendEntity(x)}}if(i){let y=r.value+p/c*(100-r.value);y>100&&(y=100),await i(y,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t,s){const r=new Gi,i=e.length;for(let a=0;a<i;a++){const o=e[a],c=r.convert(o);if(c){let h=t;o.ownerBlockRecordSoftId!=null&&(h=s.getIdAt(o.ownerBlockRecordSoftId)||h),h.appendEntity(c)}}}processBlocks(e,t){const s=e.blocks;for(const[r,i]of Object.entries(s)){let a=t.tables.blockTable.getAt(i.name);a||(a=new Se,a.objectId=i.handle,a.name=r,a.origin.copy(i.position),t.tables.blockTable.add(a)),i.entities&&this.processEntitiesInBlock(i.entities,a,t.tables.blockTable)}}processHeader(e,t){const s=e.header;t.cecolor.colorIndex=s.$CECOLOR||256,t.angBase=s.$ANGBASE||0,t.angDir=s.$ANGDIR||0,t.aunits=s.$AUNITS,t.insunits=s.$INSUNITS,t.pdmode=s.$PDMODE||0,t.pdsize=s.$PDSIZE||0}processBlockTables(e,t){var r;const s=(r=e.tables.BLOCK_RECORD)==null?void 0:r.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(i=>{const a=new Se;a.objectId=i.handle,a.name=i.name,t.tables.blockTable.add(a)}))}processObjects(e,t){const s=e.objects.byName,r=new sl;if("LAYOUT"in s){const i=t.dictionaries.layouts;s.LAYOUT.forEach(a=>{const o=r.convertLayout(a);i.setAt(o.layoutName,o)})}if("IMAGEDEF"in s){const i=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(a=>{const o=r.convertImageDef(a);i.setAt(o.objectId,o)})}}processViewports(e,t){var r,i;const s=(i=(r=e.tables)==null?void 0:r.VPORT)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new ia;this.processCommonTableEntryAttrs(a,o),a.circleSides&&(o.circleSides=a.circleSides),o.standardFlag=a.standardFlag,o.center.copy(a.center),o.lowerLeftCorner.copy(a.lowerLeftCorner),o.upperRightCorner.copy(a.upperRightCorner),a.snapBasePoint&&o.snapBase.copy(a.snapBasePoint),a.snapRotationAngle&&(o.snapAngle=a.snapRotationAngle),a.snapSpacing&&o.snapIncrements.copy(a.snapSpacing),a.majorGridLines&&(o.gridMajor=a.majorGridLines),a.gridSpacing&&o.gridIncrements.copy(a.gridSpacing),a.backgroundObjectId&&(o.backgroundObjectId=a.backgroundObjectId),o.gsView.center.copy(a.center),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget),o.gsView.viewTarget.copy(a.viewTarget),a.lensLength&&(o.gsView.lensLength=a.lensLength),a.frontClippingPlane&&(o.gsView.frontClippingPlane=a.frontClippingPlane),a.backClippingPlane&&(o.gsView.backClippingPlane=a.backClippingPlane),a.viewHeight&&(o.gsView.viewHeight=a.viewHeight),a.viewTwistAngle&&(o.gsView.viewTwistAngle=a.viewTwistAngle),a.frozenLayers&&(o.gsView.frozenLayers=a.frozenLayers),a.styleSheet&&(o.gsView.styleSheet=a.styleSheet),a.renderMode&&(o.gsView.renderMode=a.renderMode),a.viewMode&&(o.gsView.viewMode=a.viewMode),a.ucsIconSetting&&(o.gsView.ucsIconSetting=a.ucsIconSetting),a.ucsOrigin&&o.gsView.ucsOrigin.copy(a.ucsOrigin),a.ucsXAxis&&o.gsView.ucsXAxis.copy(a.ucsXAxis),a.ucsYAxis&&o.gsView.ucsYAxis.copy(a.ucsYAxis),a.orthographicType&&(o.gsView.orthographicType=a.orthographicType),a.shadePlotSetting&&(o.gsView.shadePlotSetting=a.shadePlotSetting),a.shadePlotObjectId&&(o.gsView.shadePlotObjectId=a.shadePlotObjectId),a.visualStyleObjectId&&(o.gsView.visualStyleObjectId=a.visualStyleObjectId),a.isDefaultLightingOn&&(o.gsView.isDefaultLightingOn=a.isDefaultLightingOn),a.defaultLightingType&&(o.gsView.defaultLightingType=a.defaultLightingType),a.brightness&&(o.gsView.brightness=a.brightness),a.contrast&&(o.gsView.contrast=a.contrast),a.ambientColor&&(o.gsView.ambientColor=a.ambientColor),t.tables.viewportTable.add(o)})}processLayers(e,t){var r,i;const s=(i=(r=e.tables)==null?void 0:r.LAYER)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new Ne;o.colorIndex=a.colorIndex;const c=new ln({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,c),t.tables.layerTable.add(c)})}processLineTypes(e,t){var r,i;const s=(i=(r=e.tables)==null?void 0:r.LTYPE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new na(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,t.tables.linetypeTable.add(o)})}processTextStyles(e,t){var r;const s=(r=e.tables.STYLE)==null?void 0:r.entries;s&&s.length>0&&s.forEach(i=>{const a=new ra(i);this.processCommonTableEntryAttrs(i,a),t.tables.textStyleTable.add(a)})}processDimStyles(e,t){var r;const s=(r=e.tables.DIMSTYLE)==null?void 0:r.entries;s&&s.length>0&&s.forEach(i=>{const a={name:i.name,ownerId:i.ownerObjectId,dimpost:i.DIMPOST||"",dimapost:i.DIMAPOST||"",dimscale:i.DIMSCALE,dimasz:i.DIMASZ,dimexo:i.DIMEXO,dimdli:i.DIMDLI,dimexe:i.DIMEXE,dimrnd:i.DIMRND,dimdle:i.DIMDLE,dimtp:i.DIMTP,dimtm:i.DIMTM,dimtxt:i.DIMTXT,dimcen:i.DIMCEN,dimtsz:i.DIMTSZ,dimaltf:i.DIMALTF,dimlfac:i.DIMLFAC,dimtvp:i.DIMTVP,dimtfac:i.DIMTFAC,dimgap:i.DIMGAP,dimaltrnd:i.DIMALTRND,dimtol:i.DIMTOL==null||i.DIMTOL==0?0:1,dimlim:i.DIMLIM==null||i.DIMLIM==0?0:1,dimtih:i.DIMTIH==null||i.DIMTIH==0?0:1,dimtoh:i.DIMTOH==null||i.DIMTOH==0?0:1,dimse1:i.DIMSE1==null||i.DIMSE1==0?0:1,dimse2:i.DIMSE2==null||i.DIMSE2==0?0:1,dimtad:i.DIMTAD,dimzin:i.DIMZIN,dimazin:i.DIMAZIN,dimalt:i.DIMALT,dimaltd:i.DIMALTD,dimtofl:i.DIMTOFL,dimsah:i.DIMSAH,dimtix:i.DIMTIX,dimsoxd:i.DIMSOXD,dimclrd:i.DIMCLRD,dimclre:i.DIMCLRE,dimclrt:i.DIMCLRT,dimadec:i.DIMADEC||0,dimunit:i.DIMUNIT||2,dimdec:i.DIMDEC,dimtdec:i.DIMTDEC,dimaltu:i.DIMALTU,dimalttd:i.DIMALTTD,dimaunit:i.DIMAUNIT,dimfrac:i.DIMFRAC,dimlunit:i.DIMLUNIT,dimdsep:i.DIMDSEP,dimtmove:i.DIMTMOVE||0,dimjust:i.DIMJUST,dimsd1:i.DIMSD1,dimsd2:i.DIMSD2,dimtolj:i.DIMTOLJ,dimtzin:i.DIMTZIN,dimaltz:i.DIMALTZ,dimalttz:i.DIMALTTZ,dimfit:i.DIMFIT||0,dimupt:i.DIMUPT,dimatfit:i.DIMATFIT,dimtxsty:i.DIMTXSTY||"Standard",dimldrblk:i.DIMLDRBLK||"",dimblk:i.DIMBLK||"",dimblk1:i.DIMBLK1||"",dimblk2:i.DIMBLK2||"",dimlwd:i.DIMLWD,dimlwe:i.DIMLWE},o=new Ct(a);this.processCommonTableEntryAttrs(i,o),t.tables.dimStyleTable.add(o)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}}var on=(n=>(n.DXF="dxf",n.DWG="dwg",n))(on||{});class pe{constructor(){this.events={registered:new se,unregistered:new se},this._converters=new Map,this.register("dxf",new Wi)}static createInstance(){return pe._instance==null&&(pe._instance=new pe),this._instance}static get instance(){return pe._instance||(pe._instance=new pe),pe._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 Ke extends De{constructor(e,t){e=e||{},et(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const ht=class ht extends Ke{constructor(){super(),this._origin=new w,this._entities=new Map}get isModelSapce(){return this.name.toLowerCase()==ht.MODEL_SPACE_NAME.toLowerCase()}get isPaperSapce(){return this.name.toLowerCase().startsWith(ht.PAPER_SPACE_NAME_PREFIX.toLowerCase())}get origin(){return this._origin}set origin(e){this._origin.copy(e)}appendEntity(e){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 qt(this._entities)}getIdAt(e){return this._entities.get(e)}};ht.MODEL_SPACE_NAME="*Model_Space",ht.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let Se=ht;class Ze extends De{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}add(e){e.database=this.database,this._recordsByName.set(e.name,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this._recordsByName.get(e);return t?(this._recordsById.delete(t.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){return this._recordsByName.has(e)}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){let t;return this._recordsById.forEach((s,r)=>{s.ownerId==e&&(t=this._recordsById.get(r))}),t}newIterator(){return new qt(this._recordsByName)}}class Yi extends Ze{constructor(e){super(e)}get modelSpace(){let e=this.getAt(Se.MODEL_SPACE_NAME);return e||(e=new Se,e.name=Se.MODEL_SPACE_NAME,this.add(e)),e}}class qi extends Ze{constructor(e){super(e)}}class ln extends Ke{constructor(e,t){e=e||{},et(e,{color:new Ne,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(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)==1}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)}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}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 Xi extends Ze{constructor(e){super(e);const t=new Ne;t.color=16777215;const s=new ln({name:"0",standardFlags:0,linetype:Wt,lineWeight:1,isOff:!1,color:t,isPlottable:!0});this.add(s)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class $i extends Ze{constructor(e){super(e)}}class Ki extends Ze{constructor(e){super(e)}get fonts(){const e=new Set,t=r=>{if(r){const i=r.lastIndexOf(".");if(i>=0){const a=r.substring(0,i).toLowerCase();e.add(a)}else e.add(r.toLowerCase())}},s=this.newIterator();for(const r of s)t(r.fileName),t(r.bigFontFileName);return Array.from(e)}}class Zi extends Ze{constructor(e){super(e)}}class nl extends De{constructor(){super(),this.events={entityAppended:new se,entityModified:new se,layerAppended:new se,layerModified:new se,layerErased:new se,openProgress:new se,headerSysVarChanged:new se},this._angBase=0,this._angDir=0,this._aunits=Os.DecimalDegrees,this._celtscale=1,this._cecolor=new Ne,this._insunits=Ds.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Yi(this),dimStyleTable:new qi(this),linetypeTable:new $i(this),textStyleTable:new Ki(this),layerTable:new Xi(this),viewportTable:new Zi(this)},this._dictionaries={layouts:new Hi(this),imageDefs:new an(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 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 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,s=on.DXF){const r=pe.instance.get(s);if(r==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await r.read(e,this,t&&t.minimumChunkSize||10,async(i,a,o,c)=>{if(this.events.openProgress.dispatch({database:this,percentage:i,stage:a,stageStatus:o}),t&&t.fontLoader&&a=="FONT"&&o=="END"){const h=c||this.tables.textStyleTable.fonts;await t.fontLoader.load(h)}})}async openUri(e,t){const r=await(await fetch(e)).blob(),i=new FileReader;i.onload=a=>{var c;const o=(c=a.target)==null?void 0:c.result;o&&this.read(o,t)},i.readAsText(r)}clear(){this.tables.blockTable.removeAll(),this.tables.dimStyleTable.removeAll(),this.tables.layerTable.removeAll(),this.tables.linetypeTable.removeAll(),this.tables.textStyleTable.removeAll(),this.tables.viewportTable.removeAll(),this.dictionaries.layouts.removeAll(),this._currentSpace=void 0}triggerHeaderSysVarChangedEvent(e){this.events.headerSysVarChanged.dispatch({database:this,name:e})}}var Qi=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(Qi||{}),Ji=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(Ji||{}),ea=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(ea||{}),ta=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(ta||{}),sa=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(sa||{});const ls=class ls extends Ke{constructor(e,t){e=e||{},et(e,ls.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)}};ls.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 Ct=ls;class na extends Ke{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}}class ra extends Ke{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 s=t.lastIndexOf(".");return s===-1?t:t.substring(0,s)}return e}}const rl={center:new L,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:Js.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:en.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:tn.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class ia extends Ke{constructor(){super(),this._circleSides=100,this._center=new L,this._lowerLeftCorner=new L(0,0),this._upperRightCorner=new L(1,1),this._snapBase=new L(0,0),this._snapAngle=0,this._snapSpacing=new L(0,0),this._standardFlag=0,this._gridSpacing=new L,this._gridMajor=10,this._gsView=rl}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 aa{constructor(){this.events={layoutSwitched:new se}}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 s=this.getWorkingDatabase(t),r=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(r,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),r=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(r,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),r=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(r,s)}renameLayout(e,t,s){const i=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return i?(i.layoutName=t,!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.has(e)}deleteLayout(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.remove(e)}createLayout(e,t){const s=this.getWorkingDatabase(t),r=new rn;r.layoutName=e,r.tabOrder=s.dictionaries.layouts.maxTabOrder;const i=new Se;return i.name=`*Paper_Space${r.tabOrder}`,s.tables.blockTable.add(i),s.dictionaries.layouts.setAt(e,r),{layout:r,btr:i}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||hn().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function hn(){return os.instance}const hs=class hs{constructor(){this._workingDatabase=null,this._layoutManager=new aa}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}};hs.instance=new hs;let os=hs;g.AcCmColor=Ne,g.AcCmErrors=te,g.AcCmEventDispatcher=ma,g.AcCmEventManager=se,g.AcCmLoader=Aa,g.AcCmLoadingManager=xn,g.AcCmObject=yn,g.AcCmPerformanceCollector=fs,g.AcCmTask=_n,g.AcCmTaskScheduler=fn,g.AcDb3PointAngularDimension=zi,g.AcDbAlignedDimension=Fi,g.AcDbAngleUnits=Os,g.AcDbArc=ui,g.AcDbArcDimension=tl,g.AcDbBatchProcessing=An,g.AcDbBlockReference=Zs,g.AcDbBlockTable=Yi,g.AcDbBlockTableRecord=Se,g.AcDbCircle=mi,g.AcDbCurve=me,g.AcDbDatabase=nl,g.AcDbDatabaseConverter=Pr,g.AcDbDatabaseConverterManager=pe,g.AcDbDiametricDimension=Bi,g.AcDbDictionary=an,g.AcDbDimArrowType=wr,g.AcDbDimStyleTable=qi,g.AcDbDimStyleTableRecord=Ct,g.AcDbDimTextHorizontal=Qi,g.AcDbDimTextVertical=Ji,g.AcDbDimVerticalJustification=sa,g.AcDbDimZeroSuppression=ea,g.AcDbDimZeroSuppressionAngular=ta,g.AcDbDimension=$e,g.AcDbDxfConverter=Wi,g.AcDbEllipse=di,g.AcDbEntity=ge,g.AcDbFileType=on,g.AcDbHatch=yi,g.AcDbHatchPatternType=gi,g.AcDbHatchStyle=pi,g.AcDbHostApplicationServices=os,g.AcDbLayerTable=Xi,g.AcDbLayerTableRecord=ln,g.AcDbLayout=rn,g.AcDbLayoutDictionary=Hi,g.AcDbLayoutManager=aa,g.AcDbLeader=fi,g.AcDbLeaderAnnotationType=_i,g.AcDbLine=xi,g.AcDbLineSpacingStyle=Ri,g.AcDbLinetypeTable=$i,g.AcDbLinetypeTableRecord=na,g.AcDbMText=bi,g.AcDbObject=De,g.AcDbObjectIterator=qt,g.AcDbOrdinateDimension=Vi,g.AcDbOsnapMode=Ge,g.AcDbPoint=Mi,g.AcDbPolyline=Si,g.AcDbRadialDimension=ji,g.AcDbRasterImage=nn,g.AcDbRasterImageClipBoundaryType=vi,g.AcDbRasterImageDef=Ui,g.AcDbRasterImageImageDisplayOpt=Li,g.AcDbRay=Ci,g.AcDbRenderingCache=Le,g.AcDbSpline=sn,g.AcDbSymbolTable=Ze,g.AcDbSymbolTableRecord=Ke,g.AcDbTable=Ai,g.AcDbText=Ei,g.AcDbTextHorizontalMode=Ii,g.AcDbTextStyleTable=Ki,g.AcDbTextStyleTableRecord=ra,g.AcDbTextVerticalMode=Pi,g.AcDbTrace=Ti,g.AcDbUnitsValue=Ds,g.AcDbViewport=Oi,g.AcDbViewportTable=Zi,g.AcDbViewportTableRecord=ia,g.AcDbWipeout=Di,g.AcDbXline=Ni,g.AcGeArea2d=Zt,g.AcGeBox2d=K,g.AcGeBox3d=N,g.AcGeCircArc2d=at,g.AcGeCircArc3d=Ye,g.AcGeCurve2d=it,g.AcGeEllipseArc2d=es,g.AcGeEllipseArc3d=ts,g.AcGeEuler=ii,g.AcGeGeometryUtil=qr,g.AcGeLine2d=ss,g.AcGeLine3d=Oe,g.AcGeLoop2d=li,g.AcGeMathUtil=C,g.AcGeMatrix2d=Xt,g.AcGeMatrix3d=Ue,g.AcGePlane=Lt,g.AcGePoint2d=L,g.AcGePoint3d=w,g.AcGePolyline2d=kt,g.AcGeQuaternion=ke,g.AcGeShape2d=$s,g.AcGeSpline3d=ot,g.AcGeTol=Wr,g.AcGeVector2d=B,g.AcGeVector3d=A,g.AcGiArrowType=Qs,g.AcGiDefaultLightingType=tn,g.AcGiMTextAttachmentPoint=lt,g.AcGiMTextFlowDirection=rs,g.AcGiOrthographicType=en,g.AcGiRenderMode=Js,g.AcGiViewport=is,g.AcTrStringUtil=ba,g.ByBlock=Ar,g.ByLayer=Yt,g.DEBUG_MODE=fa,g.DEFAULT_LINE_TYPE=Wt,g.DEFAULT_TOL=Us,g.DEG2RAD=Ns,g.DefaultLoadingManager=bn,g.FLOAT_TOL=He,g.ORIGIN_POINT_2D=qo,g.ORIGIN_POINT_3D=Hs,g.RAD2DEG=Rs,g.TAU=H,g.acdbHostApplicationServices=hn,g.basisFunction=$t,g.calculateCurveLength=Zr,g.ceilPowerOfTwo=Vr,g.clamp=Ee,g.clone=mt,g.damp=vr,g.defaults=et,g.degToRad=zr,g.euclideanModulo=zs,g.evaluateNurbsPoint=vt,g.floorPowerOfTwo=jr,g.generateChordKnots=$r,g.generateSqrtChordKnots=Kr,g.generateUUID=Tr,g.generateUniformKnots=Xr,g.has=gn,g.intPartLength=Bs,g.interpolateControlPoints=Qr,g.inverseLerp=Mr,g.isBetween=Gr,g.isBetweenAngle=Hr,g.isEmpty=pn,g.isEqual=tt,g.isImperialUnits=Yo,g.isMetricUnits=Wo,g.isPointInPolygon=Ws,g.isPolygonIntersect=Yr,g.isPowerOfTwo=Br,g.lerp=Fs,g.log=ut,g.mapLinear=Sr,g.normalizeAngle=Mt,g.pingpong=Lr,g.radToDeg=Fr,g.randFloat=Dr,g.randFloatSpread=Nr,g.randInt=Or,g.relativeEps=Ur,g.seededRandom=Rr,g.setLogLevel=xa,g.smootherstep=Cr,g.smoothstep=kr,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(g,ce){typeof exports=="object"&&typeof module<"u"?ce(exports):typeof define=="function"&&define.amd?define(["exports"],ce):(g=typeof globalThis<"u"?globalThis:g||self,ce(g["data-model"]={}))})(this,function(g){"use strict";function ce(n,t){for(var e=0;e<t.length;e++){const s=t[e];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in n)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const De={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},_s=[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];function de(n,t,e){return Math.max(t,Math.min(e,n))}const mn=class la{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(de(t,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(t){t==null?this._colorIndex=null:(this._colorIndex=de(t,0,256),this._color=_s[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const e=De[t.toLowerCase()];e!==void 0?(this._colorName=t,this._color=e,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+t)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(t){return this.setRGB(t,t,t),this}setRGB(t,e,s){const r=Math.round(de(t,0,255)),i=Math.round(de(e,0,255)),a=Math.round(de(s,0,255));return this.color=(r<<16)+(i<<8)+a,this}setColorName(t){const e=De[t.toLowerCase()];return e!==void 0?this.color=e:console.warn("Unknown color "+t),this}clone(){const t=new la;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[e,s]of Object.entries(De))if(s===t)return e;return null}getColorIndexByValue(t){const e=_s.length-1;for(let s=1;s<e;++s)if(_s[s]===t)return s;return null}};mn.NAMES=De;let zt=mn;const et={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 ga{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let r=0,i=s.length;r<i;r++)s[r].call(this,t)}}}let st=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const s of this.listeners)s.call(null,t,...e)}};var pa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ya(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var gn={exports:{}};(function(n){(function(t,e){n.exports?n.exports=e():t.log=e()})(pa,function(){var t=function(){},e="undefined",s=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],i={},a=null;function o(_,x){var f=_[x];if(typeof f.bind=="function")return f.bind(_);try{return Function.prototype.bind.call(f,_)}catch{return function(){return Function.prototype.apply.apply(f,[_,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function h(_){return _==="debug"&&(_="log"),typeof console===e?!1:_==="trace"&&s?c:console[_]!==void 0?o(console,_):console.log!==void 0?o(console,"log"):t}function d(){for(var _=this.getLevel(),x=0;x<r.length;x++){var f=r[x];this[f]=x<_?t:this.methodFactory(f,_,this.name)}if(this.log=this.debug,typeof console===e&&_<this.levels.SILENT)return"No console available for logging"}function u(_){return function(){typeof console!==e&&(d.call(this),this[_].apply(this,arguments))}}function m(_,x,f){return h(_)||u.apply(this,arguments)}function p(_,x){var f=this,M,T,S,P="loglevel";typeof _=="string"?P+=":"+_:typeof _=="symbol"&&(P=void 0);function z(N){var V=(r[N]||"silent").toUpperCase();if(!(typeof window===e||!P)){try{window.localStorage[P]=V;return}catch{}try{window.document.cookie=encodeURIComponent(P)+"="+V+";"}catch{}}}function I(){var N;if(!(typeof window===e||!P)){try{N=window.localStorage[P]}catch{}if(typeof N===e)try{var V=window.document.cookie,Jt=encodeURIComponent(P),te=V.indexOf(Jt+"=");te!==-1&&(N=/^([^;]+)/.exec(V.slice(te+Jt.length+1))[1])}catch{}return f.levels[N]===void 0&&(N=void 0),N}}function W(){if(!(typeof window===e||!P)){try{window.localStorage.removeItem(P)}catch{}try{window.document.cookie=encodeURIComponent(P)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function lt(N){var V=N;if(typeof V=="string"&&f.levels[V.toUpperCase()]!==void 0&&(V=f.levels[V.toUpperCase()]),typeof V=="number"&&V>=0&&V<=f.levels.SILENT)return V;throw new TypeError("log.setLevel() called with invalid level: "+N)}f.name=_,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=x||m,f.getLevel=function(){return S??T??M},f.setLevel=function(N,V){return S=lt(N),V!==!1&&z(S),d.call(f)},f.setDefaultLevel=function(N){T=lt(N),I()||f.setLevel(N,!1)},f.resetLevel=function(){S=null,W(),d.call(f)},f.enableAll=function(N){f.setLevel(f.levels.TRACE,N)},f.disableAll=function(N){f.setLevel(f.levels.SILENT,N)},f.rebuild=function(){if(a!==f&&(M=lt(a.getLevel())),d.call(f),a===f)for(var N in i)i[N].rebuild()},M=lt(a?a.getLevel():"WARN");var vt=I();vt!=null&&(S=lt(vt)),d.call(f)}a=new p,a.getLogger=function(_){if(typeof _!="symbol"&&typeof _!="string"||_==="")throw new TypeError("You must supply a name when creating a logger.");var x=i[_];return x||(x=i[_]=new p(_,a.methodFactory)),x};var y=typeof window!==e?window.log:void 0;return a.noConflict=function(){return typeof window!==e&&window.log===a&&(window.log=y),a},a.getLoggers=function(){return i},a.default=a,a})})(gn);var pn=gn.exports;const _a=ya(pn),fa=ce({__proto__:null,default:_a},[pn]),xa=!0,ue=fa;ue.setLevel("debug");const ba=n=>{try{ue.setLevel(n)}catch(t){ue.setLevel("error"),ue.error(t)}};function me(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function ee(n,...t){for(const e of t)if(e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&n[s]===void 0&&(n[s]=e[s]);return n}function yn(n,t){return n!=null&&Object.prototype.hasOwnProperty.call(n,t)}function _n(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function se(n,t){if(n===t)return!0;if(n==null||t==null)return n===t;if(typeof n!=typeof t)return!1;if(typeof n!="object")return n===t;if(Array.isArray(n)!==Array.isArray(t))return!1;if(Array.isArray(n)){if(n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!se(n[r],t[r]))return!1;return!0}const e=Object.keys(n),s=Object.keys(t);if(e.length!==s.length)return!1;for(const r of e)if(!Object.prototype.hasOwnProperty.call(t,r)||!se(n[r],t[r]))return!1;return!0}let fn=class ha{constructor(t,e){this.events={attrChanged:new st,modelChanged:new st},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=t||{};e&&ee(s,e),this.attributes=s,this.changed={}}get(t){return this.attributes[t]}set(t,e,s){if(t==null)return this;let r;typeof t=="object"?(r=t,s=e):(r={},r[t]=e),s||(s={});const i=s.unset,a=s.silent,o=[],c=this._changing;this._changing=!0,c||(this._previousAttributes=me(this.attributes),this.changed={});const h=this.attributes,d=this.changed,u=this._previousAttributes;for(const m in r)e=r[m],se(h[m],e)||o.push(m),se(u[m],e)?delete d[m]:d[m]=e,i?delete h[m]:h[m]=e;if(!a){o.length&&(this._pending=s);for(let m=0;m<o.length;m++)this.events.attrChanged.dispatch({object:this,attrName:o[m],attrValue:h[o[m]],options:s})}if(c)return this;if(!a)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!_n(this.changed):yn(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?me(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,s={};for(const r in t){const i=t[r];se(e[r],i)||(s[r]=i)}return s}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return me(this._previousAttributes)}clone(){const t=me(this.attributes);return new ha(t)}},fs=class Ne{constructor(){this.entries=new Map}static getInstance(){return Ne.instance||(Ne.instance=new Ne),Ne.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 wa{static formatBytes(t,e=2){if(t===0)return"0 B";const s=1024,r=Math.max(0,e),i=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(s)),o=t/Math.pow(s,a);return`${parseFloat(o.toFixed(r))} ${i[a]}`}}class xn{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class bn{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let s=t;for(let r=0;r<e;r++){const i=this.tasks[r];try{s=await new Promise((a,o)=>{setTimeout(async()=>{try{const c=await i.run(s);this.onProgress((r+1)/e,i),a(c)}catch(c){o(c)}},0)})}catch(a){this.onError(a,r,i);return}}this.onComplete(s)}}let wn=class{constructor(t,e,s){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=s}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,s=this.handlers.length;e<s;e+=2){const r=this.handlers[e],i=this.handlers[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return i}return null}};const An=new wn;let Aa=class{constructor(t){this.manager=t!==void 0?t:An,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((s,r)=>{this.load(t,s,e,r)})}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 Pn{constructor(t,e,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(t):setTimeout(t,0)}async processChunk(t){let e=0;const s=async()=>{const r=e,i=Math.min(e+this._chunkSize,this._count);await t(r,i),e=i,e<this._count&&this.scheduleTask(s)};await s()}}var Y,ge,j,U,pe,ht,Z,_t,ct,Ft,ye,_e,Bt,Vt,fe,xe,be,nt,ft,R,jt,we,E,Q,Ae,J,xt,Pe,bt,dt,Ie,Gt,rt,wt,xs,bs,At,Ee,Te,Pt,Se,ws,As,Ht,q,It,X,it,Ps,Is,Es,Ts,Ss,Ms;(Y={})[Y.None=0]="None",Y[Y.Anonymous=1]="Anonymous",Y[Y.NonConstant=2]="NonConstant",Y[Y.Xref=4]="Xref",Y[Y.XrefOverlay=8]="XrefOverlay",Y[Y.ExternallyDependent=16]="ExternallyDependent",Y[Y.ResolvedOrDependent=32]="ResolvedOrDependent",Y[Y.ReferencedXref=64]="ReferencedXref",(ge={})[ge.BYBLOCK=0]="BYBLOCK",ge[ge.BYLAYER=256]="BYLAYER",(j={})[j.Rotated=0]="Rotated",j[j.Aligned=1]="Aligned",j[j.Angular=2]="Angular",j[j.Diameter=3]="Diameter",j[j.Radius=4]="Radius",j[j.Angular3Point=5]="Angular3Point",j[j.Ordinate=6]="Ordinate",j[j.ReferenceIsExclusive=32]="ReferenceIsExclusive",j[j.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",j[j.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(U={})[U.TopLeft=1]="TopLeft",U[U.TopCenter=2]="TopCenter",U[U.TopRight=3]="TopRight",U[U.MiddleLeft=4]="MiddleLeft",U[U.MiddleCenter=5]="MiddleCenter",U[U.MiddleRight=6]="MiddleRight",U[U.BottomLeft=7]="BottomLeft",U[U.BottomCenter=8]="BottomCenter",U[U.BottomRight=9]="BottomRight",(pe={})[pe.AtLeast=1]="AtLeast",pe[pe.Exact=2]="Exact";var In=((ht={})[ht.Center=0]="Center",ht[ht.Above=1]="Above",ht[ht.Outside=2]="Outside",ht[ht.JIS=3]="JIS",ht[ht.Below=4]="Below",ht),ne=((Z={})[Z.Feet=0]="Feet",Z[Z.None=1]="None",Z[Z.Inch=2]="Inch",Z[Z.FeetAndInch=3]="FeetAndInch",Z[Z.Leading=4]="Leading",Z[Z.Trailing=8]="Trailing",Z[Z.LeadingAndTrailing=12]="LeadingAndTrailing",Z),Pa=((_t={})[_t.None=0]="None",_t[_t.Leading=1]="Leading",_t[_t.Trailing=2]="Trailing",_t[_t.LeadingAndTrailing=3]="LeadingAndTrailing",_t),Ia=((ct={})[ct.Center=0]="Center",ct[ct.Left=1]="Left",ct[ct.Right=2]="Right",ct[ct.OverFirst=3]="OverFirst",ct[ct.OverSecond=4]="OverSecond",ct),Ea=((Ft={})[Ft.Bottom=0]="Bottom",Ft[Ft.Center=1]="Center",Ft[Ft.Top=2]="Top",Ft);(ye={})[ye.PatternFill=0]="PatternFill",ye[ye.SolidFill=1]="SolidFill",(_e={})[_e.NonAssociative=0]="NonAssociative",_e[_e.Associative=1]="Associative",(Bt={})[Bt.Normal=0]="Normal",Bt[Bt.Outer=1]="Outer",Bt[Bt.Ignore=2]="Ignore",(Vt={})[Vt.UserDefined=0]="UserDefined",Vt[Vt.Predefined=1]="Predefined",Vt[Vt.Custom=2]="Custom",(fe={})[fe.NotAnnotated=0]="NotAnnotated",fe[fe.Annotated=1]="Annotated",(xe={})[xe.Solid=0]="Solid",xe[xe.Gradient=1]="Gradient",(be={})[be.TwoColor=0]="TwoColor",be[be.OneColor=1]="OneColor";var Ta=((nt={})[nt.Default=0]="Default",nt[nt.External=1]="External",nt[nt.Polyline=2]="Polyline",nt[nt.Derived=4]="Derived",nt[nt.Textbox=8]="Textbox",nt[nt.Outermost=16]="Outermost",nt),Re=((ft={})[ft.Line=1]="Line",ft[ft.Circular=2]="Circular",ft[ft.Elliptic=3]="Elliptic",ft[ft.Spline=4]="Spline",ft),Sa=((R={})[R.Off=0]="Off",R[R.Solid=1]="Solid",R[R.Dashed=2]="Dashed",R[R.Dotted=3]="Dotted",R[R.ShotDash=4]="ShotDash",R[R.MediumDash=5]="MediumDash",R[R.LongDash=6]="LongDash",R[R.DoubleShortDash=7]="DoubleShortDash",R[R.DoubleMediumDash=8]="DoubleMediumDash",R[R.DoubleLongDash=9]="DoubleLongDash",R[R.DoubleMediumLongDash=10]="DoubleMediumLongDash",R[R.SparseDot=11]="SparseDot",R);Sa.Off,(jt={})[jt.Standard=-3]="Standard",jt[jt.ByLayer=-2]="ByLayer",jt[jt.ByBlock=-1]="ByBlock",(we={})[we.English=0]="English",we[we.Metric=1]="Metric",(E={})[E.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",E[E.FRONT_CLIPPING=2]="FRONT_CLIPPING",E[E.BACK_CLIPPING=4]="BACK_CLIPPING",E[E.UCS_FOLLOW=8]="UCS_FOLLOW",E[E.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",E[E.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",E[E.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",E[E.FAST_ZOOM=128]="FAST_ZOOM",E[E.SNAP_MODE=256]="SNAP_MODE",E[E.GRID_MODE=512]="GRID_MODE",E[E.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",E[E.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",E[E.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",E[E.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",E[E.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",E[E.UNUSED=32768]="UNUSED",E[E.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",E[E.VIEWPORT_OFF=131072]="VIEWPORT_OFF",E[E.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",E[E.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",E[E.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",E[E.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(Q={})[Q.OPTIMIZED_2D=0]="OPTIMIZED_2D",Q[Q.WIREFRAME=1]="WIREFRAME",Q[Q.HIDDEN_LINE=2]="HIDDEN_LINE",Q[Q.FLAT_SHADED=3]="FLAT_SHADED",Q[Q.GOURAUD_SHADED=4]="GOURAUD_SHADED",Q[Q.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",Q[Q.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(Ae={})[Ae.UCS_UNCHANGED=0]="UCS_UNCHANGED",Ae[Ae.HAS_OWN_UCS=1]="HAS_OWN_UCS",(J={})[J.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",J[J.TOP=1]="TOP",J[J.BOTTOM=2]="BOTTOM",J[J.FRONT=3]="FRONT",J[J.BACK=4]="BACK",J[J.LEFT=5]="LEFT",J[J.RIGHT=6]="RIGHT",(xt={})[xt.AS_DISPLAYED=0]="AS_DISPLAYED",xt[xt.WIREFRAME=1]="WIREFRAME",xt[xt.HIDDEN=2]="HIDDEN",xt[xt.RENDERED=3]="RENDERED",(Pe={})[Pe.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Pe[Pe.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function k(n,t,e){return n.code===t&&(e==null||n.value===e)}function D(n){let t={};n.rewind();let e=n.next(),s=e.code;if(t.x=e.value,(e=n.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=n.next()).code!==s+20?n.rewind():t.z=e.value,t}let vs=Symbol();function v(n,t){return(e,s,r)=>{let i=n.reduce((c,h)=>{h.pushContext&&c.push({});let d=c[c.length-1];for(let u of typeof h.code=="number"?[h.code]:h.code){let m=d[u]??(d[u]=[]);h.isMultiple&&m.length&&console.warn(`Snippet ${m.at(-1).name} for code(${u}) is shadowed by ${h.name}`),m.push(h)}return c},[{}]),a=!1,o=i.length-1;for(;!k(e,0,"EOF");){let c=function(y,_,x){return y.find((f,M)=>{var T;return M>=x&&((T=f[_])==null?void 0:T.length)})}(i,e.code,o),h=c==null?void 0:c[e.code].at(-1);if(!c||!h){s.rewind();break}h.isMultiple||c[e.code].pop();let{name:d,parser:u,isMultiple:m}=h,p=u==null?void 0:u(e,s,r);if(p===vs){s.rewind();break}if(d){let[y,_]=function(x,f){let M=f.split("."),T=x;for(let S=0;S<M.length-1;++S){let P=M[S];Object.hasOwn(T,P)||(T[P]={}),T=T[P]}return[T,M.at(-1)]}(r,d);m?(Object.hasOwn(y,_)||(y[_]=[]),y[_].push(p)):y[_]=p}h.pushContext&&(o-=1),a=!0,e=s.next()}return t&&Object.setPrototypeOf(r,t),a}}function l({value:n}){return n}function A(n,t){return D(t)}function F({value:n}){return!!n}var En=[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 Tn(n,t){var r;if(!k(n,1001))throw Error("XData must starts with code 1001");let e={appName:n.value,value:[]};n=t.next();let s=[e.value];for(;!k(n,0,"EOF")&&n.code>=1e3;){let i=s.at(-1);switch(n.code){case 1002:n.value==="{"?s.push([]):(s.pop(),(r=s.at(-1))==null||r.push(i));break;case 1e3:case 1004:case 1040:case 1070:case 1071:i.push({type:Et(n.code),value:n.value});break;case 1003:i.push({name:"layer",type:Et(n.code),value:n.value});break;case 1005:i.push({name:"handle",type:Et(n.code),value:n.value});break;case 1010:i.push({type:Et(n.code),value:D(t)});break;case 1011:i.push({name:"worldSpacePosition",type:Et(n.code),value:D(t)});break;case 1012:i.push({name:"worldSpaceDisplacement",type:Et(n.code),value:D(t)});break;case 1013:i.push({name:"worldSpaceDirection",type:Et(n.code),value:D(t)});break;case 1041:i.push({name:"distance",type:Et(n.code),value:n.value});break;case 1042:i.push({name:"scale",type:Et(n.code),value:n.value})}n=t.next()}return t.rewind(),e}function Et(n){switch(n){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 Ls(n,t,e){if(k(t,102))return ze(t,e),!0;switch(t.code){case 0:n.type=t.value;break;case 5:n.handle=t.value;break;case 330:n.ownerDictionarySoftId?n.ownerBlockRecordSoftId=t.value:n.ownerDictionarySoftId=t.value;break;case 360:n.ownerdictionaryHardId=t.value;break;case 67:n.isInPaperSpace=!!t.value;break;case 8:n.layer=t.value;break;case 6:n.lineType=t.value;break;case 347:n.materialObjectHardId=t.value;break;case 62:n.colorIndex=t.value,n.color=En[Math.abs(t.value)];break;case 370:n.lineweight=t.value;break;case 48:n.lineTypeScale=t.value;break;case 60:n.isVisible=!!t.value;break;case 92:n.proxyByte=t.value;break;case 310:n.proxyEntity=t.value;break;case 100:break;case 420:n.color=t.value;break;case 430:n.transparency=t.value;break;case 390:n.plotStyleHardId=t.value;break;case 284:n.shadowMode=t.value;break;case 1001:n.xdata=Tn(t,e);break;default:return!1}return!0}let Ma=0;function Sn(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=Ma++)}(bt={})[bt.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",bt[bt.CAST=1]="CAST",bt[bt.RECEIVE=2]="RECEIVE",bt[bt.IGNORE=3]="IGNORE";let G=[{code:1001,name:"xdata",parser:Tn},{code:284,name:"shadowMode",parser:l},{code:390,name:"plotStyleHardId",parser:l},{code:440,name:"transparency",parser:l},{code:430,name:"colorName",parser:l},{code:420,name:"color",parser:l},{code:310,name:"proxyEntity",isMultiple:!0,parser:l},{code:92,name:"proxyByte",parser:l},{code:60,name:"isVisible",parser:F},{code:48,name:"lineTypeScale",parser:l},{code:370,name:"lineweight",parser:l},{code:62,name:"colorIndex",parser(n,t,e){let s=n.value;return e.color=En[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:l},{code:6,name:"lineType",parser:l},{code:8,name:"layer",parser:l},{code:410,name:"layoutTabName",parser:l},{code:67,name:"isInPaperSpace",parser:F},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:l},{code:102,parser:ze},{code:102,parser:ze},{code:102,parser:ze},{code:5,name:"handle",parser:l}];function ze(n,t){for(n=t.next();!k(n,102)&&!k(n,0,"EOF");)n=t.next()}function Mn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let va={extrusionDirection:{x:0,y:0,z:1}},La=[{code:210,name:"extrusionDirection",parser:A},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:100,name:"subclassMarker",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:A},{code:39,name:"thickness",parser:l},{code:100},...G];class vn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Mn(this,"parser",v(La,va))}}Mn(vn,"ForEntityName","ARC"),(dt={})[dt.NONE=0]="NONE",dt[dt.INVISIBLE=1]="INVISIBLE",dt[dt.CONSTANT=2]="CONSTANT",dt[dt.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",dt[dt.PRESET=8]="PRESET",(Ie={})[Ie.MULTILINE=2]="MULTILINE",Ie[Ie.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(Gt={})[Gt.NONE=0]="NONE",Gt[Gt.MIRRORED_X=2]="MIRRORED_X",Gt[Gt.MIRRORED_Y=4]="MIRRORED_Y";var ka=((rt={})[rt.LEFT=0]="LEFT",rt[rt.CENTER=1]="CENTER",rt[rt.RIGHT=2]="RIGHT",rt[rt.ALIGNED=3]="ALIGNED",rt[rt.MIDDLE=4]="MIDDLE",rt[rt.FIT=5]="FIT",rt),Ca=((wt={})[wt.BASELINE=0]="BASELINE",wt[wt.BOTTOM=1]="BOTTOM",wt[wt.MIDDLE=2]="MIDDLE",wt[wt.TOP=3]="TOP",wt);function Ln(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let kn={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:ka.LEFT,valign:Ca.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Cn=[{code:73,name:"valign",parser:l},{code:100},{code:210,name:"extrusionDirection",parser:A},{code:11,name:"endPoint",parser:A},{code:72,name:"valign",parser:l},{code:72,name:"halign",parser:l},{code:71,name:"generationFlag",parser:l},{code:7,name:"styleName",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"xScale",parser:l},{code:50,name:"rotation",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:A},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class On{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ln(this,"parser",v(Cn,kn))}}function Nn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Ln(On,"ForEntityName","TEXT");let Oa={...kn},Na=[{code:2},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:A},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:F},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedRecord",parser:F},{code:100},{code:280,name:"isLocked",parser:F},{code:74,name:"valign",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:3,name:"prompt",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},...Cn.slice(2)];class Dn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Nn(this,"parser",v(Na,Oa))}}function Rn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Nn(Dn,"ForEntityName","ATTDEF");let Da={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ra=[{code:210,name:"extrusionDirection",parser:A},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:A},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class zn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Rn(this,"parser",v(Ra,Da))}}Rn(zn,"ForEntityName","CIRCLE");let Fe=class{parseEntity(t,e){let s={};for(;!k(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(r,i,a){switch(i.code){case 100:r.subclassMarker=i.value;break;case 280:r.version=i.value;break;case 2:r.name=i.value;break;case 10:r.definitionPoint=D(a);break;case 11:r.textPoint=D(a);break;case 12:r.insertionPoint=D(a);break;case 13:r.subDefinitionPoint1=D(a);break;case 14:r.subDefinitionPoint2=D(a);break;case 15:r.centerPoint=D(a);break;case 16:r.arcPoint=D(a);break;case 70:r.dimensionType=i.value;break;case 71:r.attachmentPoint=i.value;break;case 72:r.textLineSpacingStyle=i.value;break;case 40:r.leaderLength=i.value;break;case 41:r.textLineSpacingFactor=i.value;break;case 42:r.measurement=i.value;break;case 1:r.text=i.value;break;case 50:r.rotationAngle=i.value;break;case 52:r.obliqueAngle=i.value;break;case 53:r.textRotation=i.value;break;case 51:r.ocsRotation=i.value;break;case 210:r.extrusionDirection=D(a);break;case 3:r.styleName=i.value;break;default:Ls(r,i,a)}})(s,e,t),e=t.next()}return s}};function Fn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}bs="DIMENSION",(xs="ForEntityName")in Fe?Object.defineProperty(Fe,xs,{value:bs,enumerable:!0,configurable:!0,writable:!0}):Fe[xs]=bs;let za={extrusionDirection:{x:0,y:0,z:1}},Fa=[{code:42,name:"endAngle",parser:l},{code:41,name:"startAngle",parser:l},{code:40,name:"axisRatio",parser:l},{code:210,name:"extrusionDirection",parser:A},{code:11,name:"majorAxisEndPoint",parser:A},{code:10,name:"center",parser:A},{code:100,name:"subclassMarker",parser:l},...G];class Bn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Fn(this,"parser",v(Fa,za))}}Fn(Bn,"ForEntityName","ELLIPSE");let Vn=[{code:330,name:"sourceBoundaryObjects",parser:l,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:l}],Ba=[{code:11,name:"end",parser:A},{code:10,name:"start",parser:A}],Va=[{code:73,name:"isCCW",parser:F},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:A}],ja=[{code:73,name:"isCCW",parser:F},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"lengthOfMinorAxis",parser:l},{code:11,name:"end",parser:A},{code:10,name:"center",parser:A}],Ga=[{code:13,name:"endTangent",parser:A},{code:12,name:"startTangent",parser:A},{code:11,name:"fitDatum",isMultiple:!0,parser:A},{code:97,name:"numberOfFitData",parser:l},{code:10,name:"controlPoints",isMultiple:!0,parser(n,t){let e={...D(t),weight:1};return(n=t.next()).code===42?e.weight=n.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:l},{code:96,name:"numberOfControlPoints",parser:l},{code:95,name:"numberOfKnots",parser:l},{code:74,name:"isPeriodic",parser:F},{code:73,name:"splineFlag",parser:l},{code:94,name:"degree",parser:l}],Ha={[Re.Line]:Ba,[Re.Circular]:Va,[Re.Elliptic]:ja,[Re.Spline]:Ga},Ua=[...Vn,{code:72,name:"edges",parser(n,t){let e={type:n.value},s=v(Ha[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(n=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:l}],Wa=[...Vn,{code:10,name:"vertices",parser(n,t){let e={...D(t),bulge:0};return(n=t.next()).code===42?e.bulge=n.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:l},{code:73,name:"isClosed",parser:F},{code:72,name:"hasBulge",parser:F}],Ya=[{code:49,name:"dashLengths",parser:l,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:l},{code:45,name:"offset",parser:jn},{code:43,name:"base",parser:jn},{code:53,name:"angle",parser:l}];function jn(n,t){let e=n.code+1,s={x:n.value,y:1};return(n=t.next()).code===e?s.y=n.value:t.rewind(),s}function Gn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let qa={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Xa=[{code:470},{code:463},{code:462,name:"colorTint",parser:l},{code:461,name:"gradientDefinition",parser:l},{code:460,name:"gradientRotation",parser:l},{code:453,name:"numberOfColors",parser:l},{code:452,name:"gradientColorFlag",parser:l},{code:451},{code:450,name:"gradientFlag",parser:l},{code:10,name:"seedPoints",parser:A,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:A},{code:98,name:"numberOfSeedPoints",parser:l},{code:47,name:"pixelSize",parser:l},{code:53,name:"definitionLines",parser:function(n,t){let e={};return v(Ya)(n,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:l},{code:77,name:"isDouble",parser:F},{code:73,name:"isAnnotated",parser:F},{code:41,name:"patternScale",parser:l},{code:52,name:"patternAngle",parser:l},{code:76,name:"patternType",parser:l},{code:75,name:"hatchStyle",parser:l},{code:92,name:"boundaryPaths",parser:function(n,t){let e={boundaryPathTypeFlag:n.value},s=e.boundaryPathTypeFlag&Ta.Polyline;return n=t.next(),s?v(Wa)(n,t,e):v(Ua)(n,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:l},{code:71,name:"associativity",parser:l},{code:63,name:"patternFillColor",parser:l},{code:70,name:"solidFill",parser:l},{code:2,name:"patternName",parser:l},{code:210,name:"extrusionDirection",parser:A},{code:10,name:"elevationPoint",parser:A},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...G];class Hn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Gn(this,"parser",v(Xa,qa))}}Gn(Hn,"ForEntityName","HATCH"),(At={})[At.ShowImage=1]="ShowImage",At[At.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",At[At.UseClippingBoundary=4]="UseClippingBoundary",At[At.TransparencyIsOn=8]="TransparencyIsOn",(Ee={})[Ee.Rectangular=1]="Rectangular",Ee[Ee.Polygonal=2]="Polygonal",(Te={})[Te.Outside=0]="Outside",Te[Te.Inside=1]="Inside";function Un(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let $a={clippingBoundaryPath:[]},Ka=[{code:90,name:"version",parser:l},{code:10,name:"position",parser:A},{code:11,name:"uPixel",parser:A},{code:12,name:"vPixel",parser:A},{code:13,name:"imageSize",parser:A},{code:340,name:"imageDefHandle",parser:l},{code:70,name:"flags",parser:l},{code:280,name:"clipping",parser:l},{code:281,name:"brightness",parser:l},{code:282,name:"contrast",parser:l},{code:283,name:"fade",parser:l},{code:360,name:"imageDefReactorHandle",parser:l},{code:71,name:"clippingBoundaryType",parser:l},{code:91,name:"countBoundaryPoints",parser:l},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:A},{code:290,name:"clipMode",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class ks{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Un(this,"parser",v(Ka,$a))}}function Wn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Un(ks,"ForEntityName","IMAGE");let Za={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Qa=[{code:210,name:"extrusionDirection",parser:A},{code:45,name:"rowSpacing",parser:l},{code:44,name:"columnSpacing",parser:l},{code:71,name:"rowCount",parser:l},{code:70,name:"columnCount",parser:l},{code:50,name:"rotation",parser:l},{code:43,name:"zScale",parser:l},{code:42,name:"yScale",parser:l},{code:41,name:"xScale",parser:l},{code:10,name:"insertionPoint",parser:A},{code:2,name:"name",parser:l},{code:66,name:"isVariableAttributes",parser:F},{code:100,name:"subclassMarker",parser:l},...G];class Yn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Wn(this,"parser",v(Qa,Za))}}function qn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Wn(Yn,"ForEntityName","INSERT");let Ja={isArrowheadEnabled:!0},to=[{code:213,name:"offsetFromAnnotation",parser:A},{code:212,name:"offsetFromBlock",parser:A},{code:211,name:"horizontalDirection",parser:A},{code:210,name:"normal",parser:A},{code:340,name:"associatedAnnotation",parser:l},{code:77,name:"byBlockColor",parser:l},{code:10,name:"vertices",parser:A,isMultiple:!0},{code:76,name:"numberOfVertices",parser:l},{code:41,name:"textWidth",parser:l},{code:40,name:"textHeight",parser:l},{code:75,name:"isHooklineExists",parser:F},{code:74,name:"isHooklineSameDirection",parser:F},{code:73,name:"leaderCreationFlag",parser:l},{code:72,name:"isSpline",parser:F},{code:71,name:"isArrowheadEnabled",parser:F},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Xn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){qn(this,"parser",v(to,Ja))}}qn(Xn,"ForEntityName","LEADER"),(Pt={})[Pt.TextAnnotation=0]="TextAnnotation",Pt[Pt.ToleranceAnnotation=1]="ToleranceAnnotation",Pt[Pt.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Pt[Pt.NoAnnotation=3]="NoAnnotation";function $n(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let eo={thickness:0,extrusionDirection:{x:0,y:0,z:1}},so=[{code:210,name:"extrusionDirection",parser:A},{code:11,name:"endPoint",parser:A},{code:10,name:"startPoint",parser:A},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Kn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){$n(this,"parser",v(so,eo))}}$n(Kn,"ForEntityName","LINE"),(Se={})[Se.IS_CLOSED=1]="IS_CLOSED",Se[Se.PLINE_GEN=128]="PLINE_GEN";let no={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},ro={bulge:0},io=[{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:91,name:"id",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l}],ao=[{code:210,name:"extrusionDirection",parser:A},{code:10,name:"vertices",isMultiple:!0,parser(n,t){let e={};return v(io,ro)(n,t,e),e}},{code:39,name:"thickness",parser:l},{code:38,name:"elevation",parser:l},{code:43,name:"constantWidth",parser:l},{code:70,name:"flag",parser:l},{code:90,name:"numberOfVertices",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Be{parseEntity(t,e){let s={};return v(ao,no)(e,t,s),s}}As="LWPOLYLINE",(ws="ForEntityName")in Be?Object.defineProperty(Be,ws,{value:As,enumerable:!0,configurable:!0,writable:!0}):Be[ws]=As,(Ht={})[Ht.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Ht[Ht.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Ht[Ht.BY_STYLE=5]="BY_STYLE";function oo(n,t){let e={};for(let s of n){let r=t(s);r!=null&&(e[r]??(e[r]=[]),e[r].push(s))}return e}function*Ve(n,t=1/0,e=1){for(let s=n;s!==t;s+=e)yield s}function Lt(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}function Zn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let lo={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},je=[{code:46,name:"annotationHeight",parser:l},{code:101,parser(n,t){(function(e){e.rewind();let s=e.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=e.next();while(s.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:l},{code:49,name:"columnGutter",parser:l},{code:48,name:"columnWidth",parser:l},{code:79,name:"columnAutoHeight",parser:l},{code:78,name:"columnFlowReversed",parser:l},{code:76,name:"columnCount",parser:l},{code:75,name:"columnType",parser:l},{code:441,name:"backgroundFillTransparency",parser:l},{code:63,name:"backgroundFillColor",parser:l},{code:45,name:"fillBoxScale",parser:l},{code:[...Ve(430,440)],name:"backgroundColor",parser:l},{code:[...Ve(420,430)],name:"backgroundColor",parser:l},{code:90,name:"backgroundFill",parser:l},{code:44,name:"lineSpacing",parser:l},{code:73,name:"lineSpacingStyle",parser:l},{code:50,name:"rotation",parser:l},{code:43},{code:42},{code:11,name:"direction",parser:A},{code:210,name:"extrusionDirection",parser:A},{code:7,name:"styleName",parser:l},{code:3,name:"text",isMultiple:!0,parser:l},{code:1,name:"text",isMultiple:!0,parser:l},{code:72,name:"drawingDirection",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:10,name:"insertionPoint",parser:A},{code:100,name:"subclassMarker",parser:l},...G];class Qn{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Zn(this,"parser",v(je,lo))}}function Jn(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Zn(Qn,"ForEntityName","MTEXT");let ho={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},co=[{code:50,name:"angle",parser:l},{code:210,name:"extrusionDirection",parser:A},{code:39,name:"thickness",parser:l},{code:10,name:"position",parser:A},{code:100,name:"subclassMarker",parser:l},...G];class tr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Jn(this,"parser",v(co,ho))}}Jn(tr,"ForEntityName","POINT"),(q={})[q.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",q[q.CURVE_FIT=2]="CURVE_FIT",q[q.SPLINE_FIT=4]="SPLINE_FIT",q[q.POLYLINE_3D=8]="POLYLINE_3D",q[q.POLYGON_3D=16]="POLYGON_3D",q[q.CLOSED_POLYGON=32]="CLOSED_POLYGON",q[q.POLYFACE=64]="POLYFACE",q[q.CONTINUOUS=128]="CONTINUOUS",(It={})[It.NONE=0]="NONE",It[It.QUADRATIC=5]="QUADRATIC",It[It.CUBIC=6]="CUBIC",It[It.BEZIER=8]="BEZIER",(X={})[X.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",X[X.TANGENT_DEFINED=2]="TANGENT_DEFINED",X[X.NOT_USED=4]="NOT_USED",X[X.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",X[X.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",X[X.FOR_POLYLINE=32]="FOR_POLYLINE",X[X.FOR_POLYGON=64]="FOR_POLYGON",X[X.POLYFACE=128]="POLYFACE";function er(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let uo={startWidth:0,endWidth:0,bulge:0},mo=[{code:91,name:"id",parser:l},{code:[...Ve(71,75)],name:"faces",isMultiple:!0,parser:l},{code:50,name:"tangentDirection",parser:l},{code:70,name:"flag",parser:l},{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:30,name:"z",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...G],sr=class{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){er(this,"parser",v(mo,uo))}};function nr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}er(sr,"ForEntityName","VERTEX");let go={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:[]},po=[{code:0,name:"vertices",isMultiple:!0,parser:(n,t)=>k(n,0,"VERTEX")?(n=t.next(),new sr().parseEntity(t,n)):vs},{code:210,name:"extrusionDirection",parser:A},{code:75,name:"smoothType",parser:l},{code:74,name:"surfaceNDensity",parser:l},{code:73,name:"surfaceMDensity",parser:l},{code:72,name:"meshNVertexCount",parser:l},{code:71,name:"meshMVertexCount",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:70,name:"flag",parser:l},{code:39,name:"thickness",parser:l},{code:30,name:"elevation",parser:l},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:l},...G];class rr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nr(this,"parser",v(po,go))}}function ir(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}nr(rr,"ForEntityName","POLYLINE");let yo={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},_o=[{code:10,name:"firstPoint",parser:A},{code:11,name:"unitDirection",parser:A},{code:100,name:"subclassMarker",parser:l},...G];class ar{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ir(this,"parser",v(_o,yo))}}function or(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}ir(ar,"ForEntityName","RAY");let fo={vertices:[],backLineVertices:[]},xo=[{code:360,name:"geometrySettingHardId",parser:l},{code:12,name:"backLineVertices",isMultiple:!0,parser:A},{code:93,name:"numberOfBackLineVertices",parser:l},{code:11,name:"vertices",isMultiple:!0,parser:A},{code:92,name:"verticesCount",parser:l},{code:[63,411],name:"indicatorColor",parser:l},{code:70,name:"indicatorTransparency",parser:l},{code:41,name:"bottomHeight",parser:l},{code:40,name:"topHeight",parser:l},{code:10,name:"verticalDirection",parser:A},{code:1,name:"name",parser:l},{code:91,name:"flag",parser:l},{code:90,name:"state",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class lr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){or(this,"parser",v(xo,fo))}}function hr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}or(lr,"ForEntityName","SECTION");let bo={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},wo=[{code:210,name:"extrusionDirection",parser:A},{code:39,name:"thickness",parser:l},{code:[...Ve(10,14)],name:"points",isMultiple:!0,parser:A},{code:100,name:"subclassMarker",parser:l},...G];class cr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){hr(this,"parser",v(wo,bo))}}hr(cr,"ForEntityName","SOLID"),(it={})[it.NONE=0]="NONE",it[it.CLOSED=1]="CLOSED",it[it.PERIODIC=2]="PERIODIC",it[it.RATIONAL=4]="RATIONAL",it[it.PLANAR=8]="PLANAR",it[it.LINEAR=16]="LINEAR";function dr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Ao={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Po=[{code:11,name:"fitPoints",isMultiple:!0,parser:A},{code:10,name:"controlPoints",isMultiple:!0,parser:A},{code:41,name:"weights",isMultiple:!0,parser:l},{code:40,name:"knots",isMultiple:!0,parser:l},{code:13,name:"endTangent",parser:A},{code:12,name:"startTangent",parser:A},{code:44,name:"fitTolerance",parser:l},{code:43,name:"controlTolerance",parser:l},{code:42,name:"knotTolerance",parser:l},{code:74,name:"numberOfFitPoints",parser:l},{code:73,name:"numberOfControlPoints",parser:l},{code:72,name:"numberOfKnots",parser:l},{code:71,name:"degree",parser:l},{code:70,name:"flag",parser:l},{code:210,name:"normal",parser:A},{code:100,name:"subclassMarker",parser:l},...G];class ur{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){dr(this,"parser",v(Po,Ao))}}dr(ur,"ForEntityName","SPLINE");class Ge{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=Lt(D(t)),e=t.lastReadGroup;break;case 11:s.directionVector=Lt(D(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerDictionaryId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(r,i){let a=!1,o=!1,c={};for(;!r.isEOF()&&i.code!==0&&!o;)switch(i.code){case 171:if(a){o=!0;continue}c.cellType=i.value,a=!0,i=r.next();break;case 172:c.flagValue=i.value,i=r.next();break;case 173:c.mergedValue=i.value,i=r.next();break;case 174:c.autoFit=i.value,i=r.next();break;case 175:c.borderWidth=i.value,i=r.next();break;case 176:c.borderHeight=i.value,i=r.next();break;case 91:c.overrideFlag=i.value,i=r.next();break;case 178:c.virtualEdgeFlag=i.value,i=r.next();break;case 145:c.rotation=i.value,i=r.next();break;case 345:c.fieldObjetId=i.value,i=r.next();break;case 340:c.blockTableRecordId=i.value,i=r.next();break;case 146:c.blockScale=i.value,i=r.next();break;case 177:c.blockAttrNum=i.value,i=r.next();break;case 7:c.textStyle=i.value,i=r.next();break;case 140:c.textHeight=i.value,i=r.next();break;case 170:c.attachmentPoint=i.value,i=r.next();break;case 92:c.extendedCellFlags=i.value,i=r.next();break;case 285:c.rightBorderVisibility=!!(i.value??!0),i=r.next();break;case 286:c.bottomBorderVisibility=!!(i.value??!0),i=r.next();break;case 288:c.leftBorderVisibility=!!(i.value??!0),i=r.next();break;case 289:c.topBorderVisibility=!!(i.value??!0),i=r.next();break;case 301:(function(h,d,u){for(;u.code!==304;)switch(u.code){case 301:case 93:case 90:case 94:u=d.next();break;case 1:h.text=u.value,u=d.next();break;case 300:h.attrText=u.value,u=d.next();break;case 302:h.text=u.value?u.value:h.text,u=d.next();break;default:console.log(`Ignore code: ${u.code}, value: ${u.value}`),u=d.next()}})(c,r,i),i=r.next();break;default:return c}return a=!1,o=!1,c}(t,e)),e=t.lastReadGroup;break;default:Ls(s,e,t),e=t.next()}}return s}}Is="ACAD_TABLE",(Ps="ForEntityName")in Ge?Object.defineProperty(Ge,Ps,{value:Is,enumerable:!0,configurable:!0,writable:!0}):Ge[Ps]=Is;class He{parseEntity(t,e){let s={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(r,i,a){if(a==="EOF")return!1;switch(a.code){case 0:default:return!1;case 100:r.subclassMarker=a.value;break;case 10:r.viewportCenter=Lt(D(i));break;case 40:r.width=a.value;break;case 41:r.height=a.value;break;case 68:r.status=a.value;break;case 69:r.viewportId=a.value;break;case 12:r.displayCenter=D(i);break;case 13:r.snapBase=D(i);break;case 14:r.snapSpacing=D(i);break;case 15:r.gridSpacing=D(i);break;case 16:r.viewDirection=Lt(D(i));break;case 17:r.targetPoint=Lt(D(i));break;case 42:r.perspectiveLensLength=a.value;break;case 43:r.frontClipZ=a.value;break;case 44:r.backClipZ=a.value;break;case 45:r.viewHeight=a.value;break;case 50:r.snapAngle=a.value;break;case 51:r.viewTwistAngle=a.value;break;case 72:r.circleZoomPercent=a.value;break;case 331:r.frozenLayerIds??(r.frozenLayerIds=[]),r.frozenLayerIds.push(a.value);break;case 90:r.statusBitFlags=a.value;break;case 330:r.ownerBlockRecordSoftId=a.value;break;case 340:r.clippingBoundaryId=a.value;break;case 1:r.sheetName=a.value;break;case 281:r.renderMode=a.value;break;case 71:r.ucsPerViewport=a.value;break;case 110:r.ucsOrigin=Lt(D(i));break;case 111:r.ucsXAxis=Lt(D(i));break;case 112:r.ucsYAxis=Lt(D(i));break;case 345:r.ucsId=a.value;break;case 346:r.ucsBaseId=a.value;break;case 79:r.orthographicType=a.value;break;case 146:r.elevation=a.value;break;case 170:r.shadePlotMode=a.value;break;case 61:r.majorGridFrequency=a.value;break;case 332:r.backgroundId=a.value;break;case 333:r.shadePlotId=a.value;break;case 348:r.visualStyleId=a.value;break;case 292:r.isDefaultLighting=!!a.value;break;case 282:r.defaultLightingType=a.value;break;case 141:r.brightness=a.value;break;case 142:r.contrast=a.value;break;case 63:case 421:case 431:r.ambientLightColor=a.value;break;case 361:r.sunId=a.value;break;case 335:case 343:case 344:case 91:r.softPointer=a.value}return!0}(s,t,e)&&Ls(s,e,t),e=t.next()}return s}}Ts="VIEWPORT",(Es="ForEntityName")in He?Object.defineProperty(He,Es,{value:Ts,enumerable:!0,configurable:!0,writable:!0}):He[Es]=Ts;class Ue extends ks{parseEntity(t,e){return super.parseEntity(t,e)}}function mr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Ms="WIPEOUT",(Ss="ForEntityName")in Ue?Object.defineProperty(Ue,Ss,{value:Ms,enumerable:!0,configurable:!0,writable:!0}):Ue[Ss]=Ms;let Io={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Eo=[{code:10,name:"firstPoint",parser:A},{code:11,name:"unitDirection",parser:A},{code:100,name:"subclassMarker",parser:l},...G];class gr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){mr(this,"parser",v(Eo,Io))}}function pr(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}mr(gr,"ForEntityName","XLINE");let To={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},So=[...je.slice(je.findIndex(({name:n})=>n==="columnType"),je.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!k(n,0,"MTEXT"))return vs}},{code:2,name:"definitionTag",parser:l},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:A},{code:340,name:"secondaryAttributesHardId",parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:F},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedEntriesKeep",parser:F},{code:100},{code:280,name:"lockPositionFlag",parser:F},{code:210,name:"extrusionDirection",parser:A},{code:11,name:"alignmentPoint",parser:A},{code:74,name:"verticalJustification",parser:l},{code:72,name:"horizontalJustification",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:7,name:"textStyle",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"scale",parser:l},{code:50,name:"rotation",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:A},{code:39,name:"thickness",parser:l},{code:100},...G];class yr{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){pr(this,"parser",v(So,To))}}pr(yr,"ForEntityName","ATTRIB");let Mo=Object.fromEntries([vn,Dn,yr,zn,Fe,Bn,ks,Yn,Xn,Kn,Be,Qn,tr,rr,ar,lr,cr,ur,Ge,On,Hn,He,Ue,gr].map(n=>[n.ForEntityName,new n]));function _r(n,t){let e=[];for(;!k(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){t.rewind();break}let s=Mo[n.value];if(s){let r=n.value;n=t.next();let i=s.parseEntity(t,n);i.type=r,Sn(i),e.push(i)}else console.warn(`Unsupported ENTITY type: ${n.value}`)}n=t.next()}return e}function vo(n,t){let e={};for(;!k(n,0,"EOF")&&!k(n,0,"ENDSEC");){if(k(n,0,"BLOCK")){let s=Lo(n=t.next(),t);Sn(s),s.name&&(e[s.name]=s)}n=t.next()}return e}function Lo(n,t){let e={};for(;!k(n,0,"EOF");){if(k(n,0,"ENDBLK")){for(n=t.next();!k(n,0,"EOF");){if(k(n,100,"AcDbBlockEnd"))return e;n=t.next()}break}switch(n.code){case 1:e.xrefPath=n.value;break;case 2:e.name=n.value;break;case 3:e.name2=n.value;break;case 5:e.handle=n.value;break;case 8:e.layer=n.value;break;case 10:e.position=D(t);break;case 67:e.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(e.type=n.value);break;case 100:break;case 330:e.ownerHandle=n.value;break;case 0:e.entities=_r(n,t)}n=t.next()}return e}function ko(n,t){let e=null,s={};for(;!k(n,0,"EOF")&&!k(n,0,"ENDSEC");)n.code===9?e=n.value:n.code===10?s[e]=D(t):s[e]=n.value,n=t.next();return s}let Co=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:l},{code:90,name:"version",parser:l},{code:1,name:"fileName",parser:l},{code:10,name:"size",parser:A},{code:11,name:"sizeOfOnePixel",parser:A},{code:280,name:"isLoaded",parser:l},{code:281,name:"resolutionUnits",parser:l},{code:100,name:"subclassMarker",parser:l}],fr=[{code:333,name:"shadePlotId",parser:l},{code:149,name:"imageOriginY",parser:l},{code:148,name:"imageOriginX",parser:l},{code:147,name:"scaleFactor",parser:l},{code:78,name:"shadePlotCustomDPI",parser:l},{code:77,name:"shadePlotResolution",parser:l},{code:76,name:"shadePlotMode",parser:l},{code:75,name:"standardScaleType",parser:l},{code:7,name:"currentStyleSheet",parser:l},{code:74,name:"plotType",parser:l},{code:73,name:"plotRotation",parser:l},{code:72,name:"paperUnit",parser:l},{code:70,name:"layoutFlag",parser:l},{code:143,name:"printScaleDenominator",parser:l},{code:142,name:"printScaleNominator",parser:l},{code:141,name:"windowAreaYMax",parser:l},{code:140,name:"windowAreaYMin",parser:l},{code:49,name:"windowAreaXMax",parser:l},{code:48,name:"windowAreaXMin",parser:l},{code:47,name:"plotOriginY",parser:l},{code:46,name:"plotOriginX",parser:l},{code:45,name:"paperHeight",parser:l},{code:44,name:"paperWidth",parser:l},{code:43,name:"marginTop",parser:l},{code:42,name:"marginRight",parser:l},{code:41,name:"marginBottom",parser:l},{code:40,name:"marginLeft",parser:l},{code:6,name:"plotViewName",parser:l},{code:4,name:"paperSize",parser:l},{code:2,name:"configName",parser:l},{code:1,name:"pageSetupName",parser:l},{code:100,name:"subclassMarker",parser:l}],Oo=[{code:333,name:"shadePlotId",parser:l},{code:346,name:"orthographicUcsId",parser:l},{code:345,name:"namedUcsId",parser:l},{code:331,name:"viewportId",parser:l},{code:330,name:"paperSpaceTableId",parser:l},{code:76,name:"orthographicType",parser:l},{code:17,name:"ucsYAxis",parser:A},{code:16,name:"ucsXAxis",parser:A},{code:13,name:"ucsOrigin",parser:A},{code:146,name:"elevation",parser:l},{code:15,name:"maxExtent",parser:A},{code:14,name:"minExtent",parser:A},{code:12,name:"insertionBase",parser:A},{code:11,name:"maxLimit",parser:A},{code:10,name:"minLimit",parser:A},{code:71,name:"tabOrder",parser:l},{code:70,name:"controlFlag",parser:l},{code:1,name:"layoutName",parser:l},{code:100,name:"subclassMarker",parser:l},...fr],No=[{code:330,name:"ownerObjectId",parser:l},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:l},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:l},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:l}];function xr(n){return n.subclassMarker==="AcDbDictionary"}let Do={LAYOUT:Oo,PLOTSETTINGS:fr,DICTIONARY:[{code:3,name:"entries",parser:(n,t)=>{let e={name:n.value};return(n=t.next()).code===350?e.objectId=n.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:l},{code:280,name:"isHardOwned",parser:F},{code:100,name:"subclassMarker",parser:l}],IMAGEDEF:Co};function Ro(n,t){let e=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let s=n.value,r=Do[s];if(n.code===0&&(r!=null&&r.length)){let i=v([...No,...r]),a={name:s};i(n=t.next(),t,a)?(e.push(a),n=t.peek()):n=t.next()}else n=t.next()}return{byName:oo(e,({name:s})=>s),byTree:function(s){let r=Object.fromEntries(s.map(i=>[i.handle,i]));for(let i of s)(!xr(i)||i.ownerDictionaryIdSoft!=="0")&&(i.ownerDictionaryIdSoft&&(i.ownerDictionarySoft=r[i.ownerDictionaryIdSoft]),i.ownerDictionaryIdHard&&(i.ownerDictionaryHard=r[i.ownerDictionaryIdHard]),i.ownerObjectId&&(i.ownerObject=r[i.ownerObjectId])),function(a,o){xr(a)&&a.entries&&(a.entries=Object.fromEntries(a.entries.map(({name:c,objectId:h})=>[c,o[h]])))}(i,r);return s[0]}(e)}}let re=[{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,parser(n,t){for(;!k(n,0,"EOF")&&!k(n,102,"}");)n=t.next()}},{code:5,name:"handle",parser:l}],zo=v([{code:310,name:"bmpPreview",parser:l},{code:281,name:"scalability",parser:l},{code:280,name:"explodability",parser:l},{code:70,name:"insertionUnits",parser:l},{code:340,name:"layoutObjects",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...re]),Fo=v([...[{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:In.Above,defaultValueImperial:In.Center},{name:"DIMZIN",code:78,defaultValue:ne.Trailing,defaultValueImperial:ne.Feet},{name:"DIMAZIN",code:79,defaultValue:Pa.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:Ia.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Ea.Center},{name:"DIMTZIN",code:284,defaultValue:ne.Trailing,defaultValueImperial:ne.Feet},{name:"DIMALTZ",code:285,defaultValue:ne.Trailing},{name:"DIMALTTZ",code:286,defaultValue:ne.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}].map(n=>({...n,parser:l})),{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},{code:105,name:"handle",parser:l},...re.filter(n=>n.code!==5)]),Bo=v([{code:347,name:"materialObjectId",parser:l},{code:390,name:"plotStyleNameObjectId",parser:l},{code:370,name:"lineweight",parser:l},{code:290,name:"isPlotting",parser:F},{code:6,name:"lineType",parser:l},{code:62,name:"colorIndex",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...re]),Vo=v([{code:9,name:"text",parser:l},{code:45,name:"offsetY",parser:l},{code:44,name:"offsetX",parser:l},{code:50,name:"rotation",parser:l},{code:46,name:"scale",parser:l},{code:340,name:"styleObjectId",parser:l},{code:75,name:"shapeNumber",parser:l},{code:74,name:"elementTypeFlag",parser:l},{code:49,name:"elementLength",parser:l}],{elementTypeFlag:0,elementLength:0}),jo={BLOCK_RECORD:zo,DIMSTYLE:Fo,LAYER:Bo,LTYPE:v([{code:49,name:"pattern",parser(n,t){let e={};return Vo(n,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:l},{code:73,name:"numberOfLineTypes",parser:l},{code:72,parser:l},{code:3,name:"description",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...re]),STYLE:v([{code:1e3,name:"extendedFont",parser:l},{code:1001},{code:4,name:"bigFont",parser:l},{code:3,name:"font",parser:l},{code:42,name:"lastHeight",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:50,name:"obliqueAngle",parser:l},{code:41,name:"widthFactor",parser:l},{code:40,name:"fixedTextHeight",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...re]),VPORT:v([{code:[63,421,431],name:"ambientColor",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLightingOn",parser:F},{code:348,name:"visualStyleObjectId",parser:l},{code:333,name:"shadePlotObjectId",parser:l},{code:332,name:"backgroundObjectId",parser:l},{code:61,name:"majorGridLines",parser:l},{code:170,name:"shadePlotSetting",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:A},{code:111,name:"ucsXAxis",parser:A},{code:110,name:"ucsOrigin",parser:A},{code:74,name:"ucsIconSetting",parser:l},{code:71,name:"viewMode",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"styleSheet",parser:l},{code:[331,441],name:"frozenLayers",parser:l,isMultiple:!0},{code:72,name:"circleSides",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapRotationAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:17,name:"viewTarget",parser:A},{code:16,name:"viewDirectionFromTarget",parser:A},{code:15,name:"gridSpacing",parser:A},{code:14,name:"snapSpacing",parser:A},{code:13,name:"snapBasePoint",parser:A},{code:12,name:"center",parser:A},{code:11,name:"upperRightCorner",parser:A},{code:10,name:"lowerLeftCorner",parser:A},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...re])},Go=v([{code:70,name:"maxNumberOfEntries",parser:l},{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:l},{code:2,name:"name",parser:l}]);function Ho(n,t){var s;let e={};for(;!k(n,0,"EOF")&&!k(n,0,"ENDSEC");){if(k(n,0,"TABLE")){n=t.next();let r={entries:[]};Go(n,t,r),e[r.name]=r}if(k(n,0)&&!k(n,0,"ENDTAB")){let r=n.value;n=t.next();let i=jo[r];if(!i){console.warn(`parseTable: Invalid table name '${r}'`),n=t.next();continue}let a={};i(n,t,a),(s=e[r])==null||s.entries.push(a)}n=t.next()}return e}function We(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class br{next(){if(!this.hasNext())return this._eof?console.warn("Cannot call 'next' after EOF group has been read"):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=wr(t,this._data[this._pointer++]),s={code:t,value:e};return k(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=wr(t.code,this._data[this._pointer+1]),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){We(this,"_pointer",void 0),We(this,"_data",void 0),We(this,"_eof",void 0),We(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=t,this._eof=!1}}function wr(n,t){return n<=9?t:n>=10&&n<=59?parseFloat(t.trim()):n>=60&&n<=99?parseInt(t.trim()):n>=100&&n<=109?t:n>=110&&n<=149?parseFloat(t.trim()):n>=160&&n<=179?parseInt(t.trim()):n>=210&&n<=239?parseFloat(t.trim()):n>=270&&n<=289?parseInt(t.trim()):n>=290&&n<=299?function(e){if(e==="0")return!1;if(e==="1")return!0;throw TypeError("String '"+e+"' cannot be cast to Boolean type")}(t.trim()):n>=300&&n<=369?t:n>=370&&n<=389?parseInt(t.trim()):n>=390&&n<=399?t:n>=400&&n<=409?parseInt(t.trim()):n>=410&&n<=419?t:n>=420&&n<=429?parseInt(t.trim()):n>=430&&n<=439?t:n>=440&&n<=459?parseInt(t.trim()):n>=460&&n<=469?parseFloat(t.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?t:n>=1010&&n<=1059?parseFloat(t.trim()):n>=1060&&n<=1071?parseInt(t.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:n,value:t}),t)}function Cs(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Uo=class{constructor(){Cs(this,"encoding","utf-8"),Cs(this,"encodingFailureFatal",!1)}};class Wo extends EventTarget{parseSync(t){let e=new br(t.split(/\r\n|\r|\n/g));if(!e.hasNext())throw Error("Empty file");return this.parseAll(e)}parseStream(t){let e="",s=this;return new Promise((r,i)=>{t.on("data",a=>{e+=a}),t.on("end",()=>{try{let a=e.split(/\r\n|\r|\n/g),o=new br(a);if(!o.hasNext())throw Error("Empty file");r(s.parseAll(o))}catch(a){i(a)}}),t.on("error",a=>{i(a)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let r=s.body.getReader(),i="";for(;;){let{done:a,value:o}=await r.read();if(a){i+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}i+=this._decoder.decode(o,{stream:!0})}return this.parseSync(i)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!k(s,0,"EOF");)k(s,0,"SECTION")&&(k(s=t.next(),2,"HEADER")?(s=t.next(),e.header=ko(s,t)):k(s,2,"BLOCKS")?(s=t.next(),e.blocks=vo(s,t)):k(s,2,"ENTITIES")?(s=t.next(),e.entities=_r(s,t)):k(s,2,"TABLES")?(s=t.next(),e.tables=Ho(s,t)):k(s,2,"OBJECTS")&&(s=t.next(),e.objects=Ro(s,t))),s=t.next();return e}constructor(t=new Uo){super(),Cs(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}var Os=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(Os||{});class kt{static get instance(){return this._instance||(this._instance=new kt),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,s,r=!0,i,a){const o=[];if(e!=null){const c=this.createKey(e.name,s);let h;if(this.has(c))h=this.get(c);else{const d=e.newIterator();for(const u of d)if(u.color.isByBlock&&s){Ar.copy(u.color),u.color.color=s;const m=u.draw(t);m&&o.push(m),u.color.copy(Ar)}else{const m=u.draw(t);m&&o.push(m)}h=t.group(o),h&&r&&this.set(c,h)}return h&&i&&(h.applyMatrix(i),a&&(a.x!=0||a.y!=0||a.z!=1)&&(i.setFromExtrusionDirection(a),h.applyMatrix(i))),h}else return t.group(o)}}const Ar=new zt,Ye="Continuous",qe="ByLayer",Pr="ByBlock";var Ut=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(Ut||{}),Ns=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(Ns||{});function Yo(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function qo(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}var Ir=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(Ir||{});class Xe{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}[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}}}const Er="Load Database";class tt extends xn{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=fs.getInstance().getEntry(Er),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(t);if(this.progress){const i=r.data;await this.progress(this.data.progress.value,this.data.stage,"END",i),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return e&&(e.data[this.name]=Date.now()-s),r}}class Tr{async read(t,e,s,r){const i={name:Er,data:{total:0},format(){let h="";return Object.keys(this.data).forEach(d=>{d!=="total"&&(h+=`- ${d}: ${this.data[d]} ms
|
|
2
|
+
`)}),h+=`- total: ${this.data.total} ms`,h}};fs.getInstance().collect(i),this.progress=r;const a={value:0},o=new bn;o.setCompleteCallback(()=>this.onFinished()),o.setErrorCallback(()=>this.onFinished()),o.addTask(new tt({stage:"START",step:1,progress:a,task:async h=>h},r)),o.addTask(new tt({stage:"PARSE",step:5,progress:a,task:async h=>({model:await this.parse(h)})},r)),o.addTask(new tt({stage:"FONT",step:5,progress:a,task:async h=>{const d=this.getFonts(h.model);return{model:h.model,data:d}}},r)),o.addTask(new tt({stage:"LTYPE",step:1,progress:a,task:async h=>(this.processLineTypes(h.model,e),h)},r)),o.addTask(new tt({stage:"STYLE",step:1,progress:a,task:async h=>(this.processTextStyles(h.model,e),h)},r)),o.addTask(new tt({stage:"DIMSTYLE",step:1,progress:a,task:async h=>(this.processDimStyles(h.model,e),h)},r)),o.addTask(new tt({stage:"LAYER",step:1,progress:a,task:async h=>(this.processLayers(h.model,e),h)},r)),o.addTask(new tt({stage:"VPORT",step:1,progress:a,task:async h=>(this.processViewports(h.model,e),h)},r)),o.addTask(new tt({stage:"HEADER",step:1,progress:a,task:async h=>(this.processHeader(h.model,e),h)},r)),o.addTask(new tt({stage:"BLOCK_RECORD",step:5,progress:a,task:async h=>(this.processBlockTables(h.model,e),h)},r)),o.addTask(new tt({stage:"OBJECT",step:5,progress:a,task:async h=>(this.processObjects(h.model,e),h)},r)),o.addTask(new tt({stage:"BLOCK",step:5,progress:a,task:async h=>(await this.processBlocks(h.model,e),h)},r)),o.addTask(new tt({stage:"ENTITY",step:100,progress:a,task:async h=>(await this.processEntities(h.model,e,s,a,r),h)},r)),o.addTask(new tt({stage:"END",step:0,progress:a,task:async h=>h},r));const c=Date.now();await o.run(t),i.data.total=Date.now()-c}onFinished(){this.progress&&(this.progress(100,"END","END"),kt.instance.clear())}parse(t){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,s,r,i){throw new Error("Not impelemented yet!")}}const $=["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 Sr=1234567;const Ds=Math.PI/180,Rs=180/Math.PI;function Mr(){const n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return($[n&255]+$[n>>8&255]+$[n>>16&255]+$[n>>24&255]+"-"+$[t&255]+$[t>>8&255]+"-"+$[t>>16&15|64]+$[t>>24&255]+"-"+$[e&63|128]+$[e>>8&255]+"-"+$[e>>16&255]+$[e>>24&255]+$[s&255]+$[s>>8&255]+$[s>>16&255]+$[s>>24&255]).toLowerCase()}function Tt(n,t,e){return Math.max(t,Math.min(e,n))}function zs(n,t){return(n%t+t)%t}function vr(n,t,e,s,r){return s+(n-t)*(r-s)/(e-t)}function Lr(n,t,e){return n!==t?(e-n)/(t-n):0}function Fs(n,t,e){return(1-e)*n+e*t}function kr(n,t,e,s){return Fs(n,t,1-Math.exp(-e*s))}function Cr(n,t=1){return t-Math.abs(zs(n,t*2)-t)}function Or(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function Nr(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function Dr(n,t){return n+Math.floor(Math.random()*(t-n+1))}function Rr(n,t){return n+Math.random()*(t-n)}function zr(n){return n*(.5-Math.random())}function Fr(n){n!==void 0&&(Sr=n);let t=Sr+=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 Br(n){return n*Ds}function Vr(n){return n*Rs}function jr(n){return(n&n-1)===0&&n!==0}function Gr(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Hr(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Me(n){const t=Math.PI*2;return(n%t+t)%t}function Ur(n,t,e){return n>t&&n<e||n>e&&n<t}function Wr(n,t,e,s=!1){return n=Me(n),t=Me(t),e=Me(e),s?t>e?n<=t&&n>=e:n<=t||n>=e:t<e?n>=t&&n<=e:n>=t||n<=e}function Bs(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Yr(n,t=1e-7){const e=Bs(n);return Math.max(Math.pow(10,e)*t,t)}const C={DEG2RAD:Ds,RAD2DEG:Rs,generateUUID:Mr,clamp:Tt,euclideanModulo:zs,mapLinear:vr,inverseLerp:Lr,lerp:Fs,damp:kr,pingpong:Cr,smoothstep:Or,smootherstep:Nr,randInt:Dr,randFloat:Rr,randFloatSpread:zr,seededRandom:Fr,degToRad:Br,radToDeg:Vr,isPowerOfTwo:jr,ceilPowerOfTwo:Gr,floorPowerOfTwo:Hr,normalizeAngle:Me,isBetween:Ur,isBetweenAngle:Wr,intPartLength:Bs,relativeEps:Yr},Vs=class ca{constructor(t,e){this.x=0,this.y=0;const s=+(t!==void 0)+ +(e!==void 0);if(s!==0){if(s===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(s===1){const{x:r,y:i}=t;this.x=r,this.y=i;return}if(s===2){this.x=t,this.y=e;return}throw et.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 ca(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const e=this.x,s=this.y,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6],this.y=r[1]*e+r[4]*s+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const s=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*s-a*r+t.x,this.y=i*r+a*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(C.relativeEps(this.x,t),C.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};Vs.EMPTY=Object.freeze(new Vs(0,0));let B=Vs;const js=class da{constructor(t,e,s,r,i,a,o,c,h){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&s!=null&&r!=null&&i!=null&&a!=null&&o!=null&&c!=null&&h!=null&&this.set(t,e,s,r,i,a,o,c,h)}set(t,e,s,r,i,a,o,c,h){const d=this.elements;return d[0]=t,d[1]=r,d[2]=o,d[3]=e,d[4]=i,d[5]=c,d[6]=s,d[7]=a,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,r=e.elements,i=this.elements,a=s[0],o=s[3],c=s[6],h=s[1],d=s[4],u=s[7],m=s[2],p=s[5],y=s[8],_=r[0],x=r[3],f=r[6],M=r[1],T=r[4],S=r[7],P=r[2],z=r[5],I=r[8];return i[0]=a*_+o*M+c*P,i[3]=a*x+o*T+c*z,i[6]=a*f+o*S+c*I,i[1]=h*_+d*M+u*P,i[4]=h*x+d*T+u*z,i[7]=h*f+d*S+u*I,i[2]=m*_+p*M+y*P,i[5]=m*x+p*T+y*z,i[8]=m*f+p*S+y*I,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],h=t[7],d=t[8];return e*a*d-e*o*h-s*i*d+s*o*c+r*i*h-r*a*c}invert(){const t=this.elements,e=t[0],s=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],h=t[7],d=t[8],u=d*a-o*h,m=o*c-d*i,p=h*i-a*c,y=e*u+s*m+r*p;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/y;return t[0]=u*_,t[1]=(r*h-d*s)*_,t[2]=(o*s-r*a)*_,t[3]=m*_,t[4]=(d*e-r*c)*_,t[5]=(r*i-o*e)*_,t[6]=p*_,t[7]=(s*c-h*e)*_,t[8]=(a*e-s*i)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this}setUvTransform(t,e,s,r,i,a,o){const c=Math.cos(i),h=Math.sin(i);return this.set(s*c,s*h,-s*(c*a+h*o)+a+t,-r*h,r*c,-r*(-h*a+c*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Gs.makeScale(t,e)),this}rotate(t){return this.premultiply(Gs.makeRotation(-t)),this}translate(t,e){return this.premultiply(Gs.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof B?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let r=0;r<9;r++)if(e[r]!==s[r])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new da().fromArray(this.elements)}};js.IDENTITY=Object.freeze(new js);let $e=js;const Gs=new $e,Wt=1e-6,H=2*Math.PI,Xo={x:0,y:0},Hs={x:0,y:0,z:0};class Us{constructor(){this.equalPointTol=Wt,this.equalVectorTol=Wt}equalPoint2d(t,e){return new B(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new w(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Wt){return t<e&&t>-e}static equal(t,e,s=Wt){return Math.abs(t-e)<s}static great(t,e,s=Wt){return t-e>s}static less(t,e,s=Wt){return t-e<s}}const Ws=new Us;function Ys(n,t,e=!1){const s=n.x,r=n.y;let i=!1;const a=t.length;for(let o=0,c=a-1;o<a;c=o++){const h=t[o].x,d=t[o].y,u=t[c].x,m=t[c].y;let p=d>r!=m>r;e&&(p=d>=r!=m>=r),p&&s<(u-h)*(r-d)/(m-d)+h&&(i=!i)}return i}function qr(n,t){if(n.length===0||t.length===0)return!1;const e=new K().setFromPoints(n),s=new K().setFromPoints(t);if(!e.intersectsBox(s))return!1;for(let r=0;r<n.length;){if(Ys(n[r],t,!0))return!0;r<n.length-1&&Ws.equalPoint2d(n[r+1],n[r])&&++r,++r}return!1}const Xr={isPointInPolygon:Ys,isPolygonIntersect:qr};function $r(n,t){const e=[],s=t-1,r=n;for(let i=0;i<=r;i++)e.push(0);for(let i=1;i<=s-r;i++)e.push(i);for(let i=0;i<=r;i++)e.push(s-r+1);return e}function Kr(n,t){const e=t.length-1,s=n,r=[0];let i=0;for(let o=1;o<=e;o++){const c=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],d=t[o][2]-t[o-1][2],u=Math.sqrt(c*c+h*h+d*d);i+=u,r.push(i)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=e-s;o++){const c=r[o]/i;a.push(c*(e-s+1))}for(let o=0;o<=s;o++)a.push(e-s+1);return a}function Zr(n,t){const e=t.length-1,s=n,r=[0];let i=0;for(let o=1;o<=e;o++){const c=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],d=t[o][2]-t[o-1][2],u=Math.sqrt(c*c+h*h+d*d),m=Math.sqrt(u);i+=m,r.push(i)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=e-s;o++){const c=r[o]/i;a.push(c*(e-s+1))}for(let o=0;o<=s;o++)a.push(e-s+1);return a}function Ke(n,t,e,s){if(t===0)return e>=s[n]&&e<s[n+1]?1:0;const r=s[n+t]-s[n],i=s[n+t+1]-s[n+1],a=r>1e-10?(e-s[n])/r:0,o=i>1e-10?(s[n+t+1]-e)/i:0;return a*Ke(n,t-1,e,s)+o*Ke(n+1,t-1,e,s)}function ve(n,t,e,s,r){const i=s.length-1,a=t;if(n=Math.max(e[a],Math.min(e[i+1],n)),Math.abs(n-e[i+1])<1e-8)return[...s[i]];if(Math.abs(n-e[a])<1e-8)return[...s[0]];const o=[0,0,0];let c=0;for(let h=0;h<=i;h++){const d=Ke(h,a,n,e),u=r[h]*d;o[0]+=s[h][0]*u,o[1]+=s[h][1]*u,o[2]+=s[h][2]*u,c+=u}if(c<1e-10){const h=e[e.length-a-1];if(Math.abs(n-h)<1e-8)return[...s[i]];if(Math.abs(n-e[a])<1e-8)return[...s[0]]}return c>1e-10&&(o[0]/=c,o[1]/=c,o[2]/=c),o}function Qr(n,t,e,s){const r=n,i=t[r],a=t[t.length-r-1];let o=0;const c=1e3,h=(a-i)/c;let d=ve(i,n,t,e,s);for(let _=1;_<=c;_++){const x=i+_*h,f=ve(x,n,t,e,s),M=f[0]-d[0],T=f[1]-d[1],S=f[2]-d[2];o+=Math.sqrt(M*M+T*T+S*S),d=f}const u=ve(a,n,t,e,s),m=u[0]-d[0],p=u[1]-d[1],y=u[2]-d[2];return o+=Math.sqrt(m*m+p*p+y*y),o}function $o(n){return n.map(t=>[...t])}class Ct{constructor(t=0,e=0,s=0,r=1){this._x=t,this._y=e,this._z=s,this._w=r}static slerpFlat(t,e,s,r,i,a,o){let c=s[r+0],h=s[r+1],d=s[r+2],u=s[r+3];const m=i[a+0],p=i[a+1],y=i[a+2],_=i[a+3];if(o===0){t[e+0]=c,t[e+1]=h,t[e+2]=d,t[e+3]=u;return}if(o===1){t[e+0]=m,t[e+1]=p,t[e+2]=y,t[e+3]=_;return}if(u!==_||c!==m||h!==p||d!==y){let x=1-o;const f=c*m+h*p+d*y+u*_,M=f>=0?1:-1,T=1-f*f;if(T>Number.EPSILON){const P=Math.sqrt(T),z=Math.atan2(P,f*M);x=Math.sin(x*z)/P,o=Math.sin(o*z)/P}const S=o*M;if(c=c*x+m*S,h=h*x+p*S,d=d*x+y*S,u=u*x+_*S,x===1-o){const P=1/Math.sqrt(c*c+h*h+d*d+u*u);c*=P,h*=P,d*=P,u*=P}}t[e]=c,t[e+1]=h,t[e+2]=d,t[e+3]=u}static multiplyQuaternionsFlat(t,e,s,r,i,a){const o=s[r],c=s[r+1],h=s[r+2],d=s[r+3],u=i[a],m=i[a+1],p=i[a+2],y=i[a+3];return t[e]=o*y+d*u+c*p-h*m,t[e+1]=c*y+d*m+h*u-o*p,t[e+2]=h*y+d*p+o*m-c*u,t[e+3]=d*y-o*u-c*m-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,r){return this._x=t,this._y=e,this._z=s,this._w=r,this._onChangeCallback(),this}clone(){return new Ct(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t.x,r=t.y,i=t.z,a=t.order,o=Math.cos,c=Math.sin,h=o(s/2),d=o(r/2),u=o(i/2),m=c(s/2),p=c(r/2),y=c(i/2);switch(a){case"XYZ":this._x=m*d*u+h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u-m*p*y;break;case"YXZ":this._x=m*d*u+h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u+m*p*y;break;case"ZXY":this._x=m*d*u-h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u-m*p*y;break;case"ZYX":this._x=m*d*u-h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u+m*p*y;break;case"YZX":this._x=m*d*u+h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u-m*p*y;break;case"XZY":this._x=m*d*u-h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u+m*p*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,r=Math.sin(s);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],r=e[4],i=e[8],a=e[1],o=e[5],c=e[9],h=e[2],d=e[6],u=e[10],m=s+o+u;if(m>0){const p=.5/Math.sqrt(m+1);this._w=.25/p,this._x=(d-c)*p,this._y=(i-h)*p,this._z=(a-r)*p}else if(s>o&&s>u){const p=2*Math.sqrt(1+s-o-u);this._w=(d-c)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+h)/p}else if(o>u){const p=2*Math.sqrt(1+o-s-u);this._w=(i-h)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(c+d)/p}else{const p=2*Math.sqrt(1+u-s-o);this._w=(a-r)/p,this._x=(i+h)/p,this._y=(c+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Tt(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const r=Math.min(1,e/s);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,r=t._y,i=t._z,a=t._w,o=e._x,c=e._y,h=e._z,d=e._w;return this._x=s*d+a*o+r*h-i*c,this._y=r*d+a*c+i*o-s*h,this._z=i*d+a*h+s*c-r*o,this._w=a*d-s*o-r*c-i*h,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,r=this._y,i=this._z,a=this._w;let o=a*t._w+s*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=s,this._y=r,this._z=i,this;const c=1-o*o;if(c<=Number.EPSILON){const p=1-e;return this._w=p*a+e*this._w,this._x=p*s+e*this._x,this._y=p*r+e*this._y,this._z=p*i+e*this._z,this.normalize(),this}const h=Math.sqrt(c),d=Math.atan2(h,o),u=Math.sin((1-e)*d)/h,m=Math.sin(e*d)/h;return this._w=a*u+this._w*m,this._x=s*u+this._x*m,this._y=r*u+this._y*m,this._z=i*u+this._z*m,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),r=Math.sqrt(1-s),i=Math.sqrt(s);return this.set(r*Math.sin(t),r*Math.cos(t),i*Math.sin(e),i*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 at=class ua{constructor(t,e,s){this.x=0,this.y=0,this.z=0;const r=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){const{x:i,y:a,z:o}=t;this.x=i,this.y=a,this.z=o||0;return}if(r===3){this.x=t,this.y=e,this.z=s;return}throw et.ILLEGAL_PARAMETERS}}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new ua(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(Jr.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jr.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6]*r,this.y=i[1]*e+i[4]*s+i[7]*r,this.z=i[2]*e+i[5]*s+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const e=this.x,s=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*s+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*s+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*s+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*s+i[10]*r+i[14])*a,this}applyQuaternion(t){const e=this.x,s=this.y,r=this.z,i=t.x,a=t.y,o=t.z,c=t.w,h=2*(a*r-o*s),d=2*(o*e-i*r),u=2*(i*s-a*e);return this.x=e+c*h+a*u-o*d,this.y=s+c*d+o*h-i*u,this.z=r+c*u+i*d-a*h,this}transformDirection(t){const e=this.x,s=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*s+i[8]*r,this.y=i[1]*e+i[5]*s+i[9]*r,this.z=i[2]*e+i[6]*s+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const e=this.dot(t),s=this.length(),r=t.length();return Math.abs(e)===s*r}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,r=t.y,i=t.z,a=e.x,o=e.y,c=e.z;return this.x=r*c-i*o,this.y=i*a-s*c,this.z=s*o-r*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return qs.copy(this).projectOnVector(t),this.sub(qs)}reflect(t){return this.sub(qs.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,r=this.z-t.z;return e*e+s*s+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};at.X_AXIS=Object.freeze(new at(1,0,0)),at.NEGATIVE_X_AXIS=Object.freeze(new at(-1,0,0)),at.Y_AXIS=Object.freeze(new at(0,1,0)),at.NEGATIVE_Y_AXIS=Object.freeze(new at(0,-1,0)),at.Z_AXIS=Object.freeze(new at(0,0,1)),at.NEGATIVE_Z_AXIS=Object.freeze(new at(0,0,-1));let w=at;const qs=new w,Jr=new Ct,Xs=class ma{constructor(t,e,s,r,i,a,o,c,h,d,u,m,p,y,_,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&s!=null&&r!=null&&i!=null&&a!=null&&o!=null&&c!=null&&h!=null&&d!=null&&u!=null&&m!=null&&p!=null&&y!=null&&_!=null&&x!=null&&this.set(t,e,s,r,i,a,o,c,h,d,u,m,p,y,_,x)}set(t,e,s,r,i,a,o,c,h,d,u,m,p,y,_,x){const f=this.elements;return f[0]=t,f[4]=e,f[8]=s,f[12]=r,f[1]=i,f[5]=a,f[9]=o,f[13]=c,f[2]=h,f[6]=d,f[10]=u,f[14]=m,f[3]=p,f[7]=y,f[11]=_,f[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ma().fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Ws.equalPoint3d(t,w.Z_AXIS))this.identity();else{const e=new w(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(w.Y_AXIS,t).normalize():e.crossVectors(w.Z_AXIS,t).normalize();const s=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,s.x,s.y,s.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,r=1/ie.setFromMatrixColumn(t,0).length(),i=1/ie.setFromMatrixColumn(t,1).length(),a=1/ie.setFromMatrixColumn(t,2).length();return e[0]=s[0]*r,e[1]=s[1]*r,e[2]=s[2]*r,e[3]=0,e[4]=s[4]*i,e[5]=s[5]*i,e[6]=s[6]*i,e[7]=0,e[8]=s[8]*a,e[9]=s[9]*a,e[10]=s[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ko,t,Zo)}lookAt(t,e,s){const r=this.elements;return ot.subVectors(t,e),ot.lengthSq()===0&&(ot.z=1),ot.normalize(),Ot.crossVectors(s,ot),Ot.lengthSq()===0&&(Math.abs(s.z)===1?ot.x+=1e-4:ot.z+=1e-4,ot.normalize(),Ot.crossVectors(s,ot)),Ot.normalize(),Ze.crossVectors(ot,Ot),r[0]=Ot.x,r[4]=Ze.x,r[8]=ot.x,r[1]=Ot.y,r[5]=Ze.y,r[9]=ot.y,r[2]=Ot.z,r[6]=Ze.z,r[10]=ot.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,r=e.elements,i=this.elements,a=s[0],o=s[4],c=s[8],h=s[12],d=s[1],u=s[5],m=s[9],p=s[13],y=s[2],_=s[6],x=s[10],f=s[14],M=s[3],T=s[7],S=s[11],P=s[15],z=r[0],I=r[4],W=r[8],lt=r[12],vt=r[1],N=r[5],V=r[9],Jt=r[13],te=r[2],cs=r[6],ds=r[10],us=r[14],ms=r[3],gs=r[7],ps=r[11],ys=r[15];return i[0]=a*z+o*vt+c*te+h*ms,i[4]=a*I+o*N+c*cs+h*gs,i[8]=a*W+o*V+c*ds+h*ps,i[12]=a*lt+o*Jt+c*us+h*ys,i[1]=d*z+u*vt+m*te+p*ms,i[5]=d*I+u*N+m*cs+p*gs,i[9]=d*W+u*V+m*ds+p*ps,i[13]=d*lt+u*Jt+m*us+p*ys,i[2]=y*z+_*vt+x*te+f*ms,i[6]=y*I+_*N+x*cs+f*gs,i[10]=y*W+_*V+x*ds+f*ps,i[14]=y*lt+_*Jt+x*us+f*ys,i[3]=M*z+T*vt+S*te+P*ms,i[7]=M*I+T*N+S*cs+P*gs,i[11]=M*W+T*V+S*ds+P*ps,i[15]=M*lt+T*Jt+S*us+P*ys,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[4],r=t[8],i=t[12],a=t[1],o=t[5],c=t[9],h=t[13],d=t[2],u=t[6],m=t[10],p=t[14],y=t[3],_=t[7],x=t[11],f=t[15];return y*(+i*c*u-r*h*u-i*o*m+s*h*m+r*o*p-s*c*p)+_*(+e*c*p-e*h*m+i*a*m-r*a*p+r*h*d-i*c*d)+x*(+e*h*u-e*o*p-i*a*u+s*a*p+i*o*d-s*h*d)+f*(-r*o*d-e*c*u+e*o*m+r*a*u-s*a*m+s*c*d)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,s){const r=this.elements;return t instanceof w?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],h=t[7],d=t[8],u=t[9],m=t[10],p=t[11],y=t[12],_=t[13],x=t[14],f=t[15],M=u*x*h-_*m*h+_*c*p-o*x*p-u*c*f+o*m*f,T=y*m*h-d*x*h-y*c*p+a*x*p+d*c*f-a*m*f,S=d*_*h-y*u*h+y*o*p-a*_*p-d*o*f+a*u*f,P=y*u*c-d*_*c-y*o*m+a*_*m+d*o*x-a*u*x,z=e*M+s*T+r*S+i*P;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/z;return t[0]=M*I,t[1]=(_*m*i-u*x*i-_*r*p+s*x*p+u*r*f-s*m*f)*I,t[2]=(o*x*i-_*c*i+_*r*h-s*x*h-o*r*f+s*c*f)*I,t[3]=(u*c*i-o*m*i-u*r*h+s*m*h+o*r*p-s*c*p)*I,t[4]=T*I,t[5]=(d*x*i-y*m*i+y*r*p-e*x*p-d*r*f+e*m*f)*I,t[6]=(y*c*i-a*x*i-y*r*h+e*x*h+a*r*f-e*c*f)*I,t[7]=(a*m*i-d*c*i+d*r*h-e*m*h-a*r*p+e*c*p)*I,t[8]=S*I,t[9]=(y*u*i-d*_*i-y*s*p+e*_*p+d*s*f-e*u*f)*I,t[10]=(a*_*i-y*o*i+y*s*h-e*_*h-a*s*f+e*o*f)*I,t[11]=(d*o*i-a*u*i-d*s*h+e*u*h+a*s*p-e*o*p)*I,t[12]=P*I,t[13]=(d*_*r-y*u*r+y*s*m-e*_*m-d*s*x+e*u*x)*I,t[14]=(y*o*r-a*_*r-y*s*c+e*_*c+a*s*x-e*o*x)*I,t[15]=(a*u*r-d*o*r+d*s*c-e*u*c-a*s*m+e*o*m)*I,this}scale(t){const e=this.elements,s=t.x,r=t.y,i=t.z;return e[0]*=s,e[4]*=r,e[8]*=i,e[1]*=s,e[5]*=r,e[9]*=i,e[2]*=s,e[6]*=r,e[10]*=i,e[3]*=s,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,r))}makeTranslation(t,e,s){return t instanceof w?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),r=Math.sin(e),i=1-s,a=t.x,o=t.y,c=t.z,h=i*a,d=i*o;return this.set(h*a+s,h*o-r*c,h*c+r*o,0,h*o+r*c,d*o+s,d*c-r*a,0,h*c-r*o,d*c+r*a,i*c*c+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,r,i,a){return this.set(1,s,i,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,s){const r=this.elements,i=e.x,a=e.y,o=e.z,c=e.w,h=i+i,d=a+a,u=o+o,m=i*h,p=i*d,y=i*u,_=a*d,x=a*u,f=o*u,M=c*h,T=c*d,S=c*u,P=s.x,z=s.y,I=s.z;return r[0]=(1-(_+f))*P,r[1]=(p+S)*P,r[2]=(y-T)*P,r[3]=0,r[4]=(p-S)*z,r[5]=(1-(m+f))*z,r[6]=(x+M)*z,r[7]=0,r[8]=(y+T)*I,r[9]=(x-M)*I,r[10]=(1-(m+_))*I,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,s){const r=this.elements;let i=ie.set(r[0],r[1],r[2]).length();const a=ie.set(r[4],r[5],r[6]).length(),o=ie.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],ut.copy(this);const c=1/i,h=1/a,d=1/o;return ut.elements[0]*=c,ut.elements[1]*=c,ut.elements[2]*=c,ut.elements[4]*=h,ut.elements[5]*=h,ut.elements[6]*=h,ut.elements[8]*=d,ut.elements[9]*=d,ut.elements[10]*=d,e.setFromRotationMatrix(ut),s.x=i,s.y=a,s.z=o,this}equals(t){const e=this.elements,s=t.elements;for(let r=0;r<16;r++)if(e[r]!==s[r])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};Xs.IDENTITY=Object.freeze(new Xs);let Yt=Xs;const ie=new w,ut=new Yt,Ko=new w(0,0,0),Zo=new w(1,1,1),Ot=new w,Ze=new w,ot=new w;class O{constructor(t=void 0,e=void 0){this.min=t==null?new w(1/0,1/0,1/0):new w(t.x,t.y,t.z),this.max=e==null?new w(-1/0,-1/0,-1/0):new w(e.x,e.y,e.z)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint($s.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=$s.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new O().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 w(0,0,0):new w(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new w(0,0,0):new w(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,$s).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:(St[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),St[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),St[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),St[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),St[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),St[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),St[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),St[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(St),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 St=[new w,new w,new w,new w,new w,new w,new w,new w],$s=new w,ti=new B;class K{constructor(t=void 0,e=void 0){this.min=t==null?new B(1/0,1/0):new B(t.x,t.y),this.max=e==null?new B(-1/0,-1/0):new B(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=ti.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new K().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 B(0,0):new B(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new B(0,0):new B(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,ti).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 ei=new w,Qo=new w,Jo=new $e;class Le{constructor(t=new w(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,r){return this.normal.set(t,e,s),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const r=ei.subVectors(s,e).cross(Qo.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||Jo.getNormalMatrix(t),r=this.coplanarPoint(ei).applyMatrix3d(t),i=this.normal.applyMatrix3(s).normalize();return this.constant=-r.dot(i),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 Le().copy(this)}}class L extends B{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((s,r)=>{s.toArray(e,r*2)}),e}}class b extends w{static pointArrayToNumberArray(t,e=!0){const s=e?3:2,r=new Array(t.length*s);return t.forEach((i,a)=>{i.toArray(r,a*s)}),r}}const si=new Yt,ni=new Ct,ri=class un{constructor(t=0,e=0,s=0,r=un.DEFAULT_ORDER){this._x=t,this._y=e,this._z=s,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,r=this._order){return this._x=t,this._y=e,this._z=s,this._order=r,this._onChangeCallback(),this}clone(){return new un(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const r=t.elements,i=r[0],a=r[4],o=r[8],c=r[1],h=r[5],d=r[9],u=r[2],m=r[6],p=r[10];switch(e){case"XYZ":this._y=Math.asin(Tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(Tt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,i));break;case"ZYX":this._y=Math.asin(-Tt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(m,p),this._z=Math.atan2(c,i)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Tt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-d,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,s=!0){return si.makeRotationFromQuaternion(t),this.setFromRotationMatrix(si,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ni.setFromEuler(this),this.setFromQuaternion(ni,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}};ri.DEFAULT_ORDER="XYZ";let ii=ri;class ai{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ks extends ai{translate(t){return this.transform(new $e().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Qe extends Ks{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 K}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let s=0;s<this.loops.length;++s){const r=this.loops[s].getPoints(t);e.push(r)}return e}buildHierarchy(){var t;const e=this.getPoints(100),s=this.calculateBoundaryBoxes(e),r=this.sortBoundaryBoxesByAreas(s),i=new Map,a=r.length;for(let c=0;c<a;c++)i.set(r[c],{index:r[c],children:[]});const o={index:-1,children:[]};for(let c=0;c<a;c++){const h=r[c],d=e[h],u=s[h];let m=c+1;for(;m<a;m++){const p=r[m],y=e[p];if(s[p].containsBox(u)&&Xr.isPointInPolygon(d[C.randInt(0,d.length-1)],y)){(t=i.get(p))==null||t.children.push(i.get(h));break}}m===a&&o.children.push(i.get(h))}return o}calculateBoundaryBoxes(t){const e=[];return t.forEach(s=>{e.push(new K().setFromPoints(s))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((r,i)=>{const a=r.size,o=a.width*a.height;e.push({area:o,index:i})}),e.sort((r,i)=>r.area-i.area);const s=[];return e.forEach(r=>{s.push(r.index)}),s}}class ae extends Ks{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let s,r=this.getPoint(0),i=0;e.push(0);for(let a=1;a<=t;a++)s=this.getPoint(a/t),i+=s.distanceTo(r),e.push(i),r=s;return e}getUtoTmapping(t,e){const s=this.getLengths();let r=0;const i=s.length;let a;e?a=e:a=t*s[i-1];let o=0,c=i-1,h;for(;o<=c;)if(r=Math.floor(o+(c-o)/2),h=s[r]-a,h<0)o=r+1;else if(h>0)c=r-1;else{c=r;break}if(r=c,s[r]===a)return r/(i-1);const d=s[r],u=s[r+1]-d,m=(a-d)/u;return(r+m)/(i-1)}getTangent(t){let e=t-1e-4,s=t+1e-4;e<0&&(e=0),s>1&&(s=1);const r=this.getPoint(e),i=this.getPoint(s),a=new L;return a.copy(i).sub(r).normalize(),a}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}class oe extends ae{constructor(t,e,s,r,i){super();const a=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(r!==void 0)+ +(i!==void 0);if(a==3)typeof t=="object"&&typeof e=="object"&&typeof s=="object"?this.createByThreePoints(t,e,s):this.createByStartEndPointsAndBulge(t,e,s);else if(a==5){const o=t;this.center=new L(o.x,o.y),this.radius=e,this.startAngle=s,this.endAngle=r,this.clockwise=i}else throw et.ILLEGAL_PARAMETERS}createByThreePoints(t,e,s){const r=(I,W)=>({x:(I.x+W.x)/2,y:(I.y+W.y)/2}),i=(I,W)=>(W.y-I.y)/(W.x-I.x),a=I=>-1/I,o=r(t,e),c=r(e,s),h=i(t,e),d=i(e,s),u=a(h),m=a(d),p=(I,W,lt,vt)=>{const N=(vt-W)/(I-lt),V=I*N+W;return{x:N,y:V}},y=o.y-u*o.x,_=c.y-m*c.x,x=p(u,y,m,_),f=Math.sqrt(Math.pow(t.x-x.x,2)+Math.pow(t.y-x.y,2)),M=(I,W)=>Math.atan2(I.y-W.y,I.x-W.x),T=M(t,x),S=M(e,x),P=M(s,x),z=P>T&&P<S||T>P&&T<S||S>P&&S<T;this.center=x,this.radius=f,this.startAngle=T,this.endAngle=P,this.clockwise=!z}createByStartEndPointsAndBulge(t,e,s){let r,i,a;s<0?(r=Math.atan(-s)*4,i=new B(t),a=new B(e)):(r=Math.atan(s)*4,i=new B(e),a=new B(t));const o=new B().subVectors(a,i),c=o.length(),h=new B().addVectors(i,o.multiplyScalar(.5)),d=Math.abs(c/2/Math.tan(r/2)),u=o.normalize();let m;if(r<Math.PI){const p=new B(u.x*Math.cos(Math.PI/2)-u.y*Math.sin(Math.PI/2),u.y*Math.cos(Math.PI/2)+u.x*Math.sin(Math.PI/2));m=h.add(p.multiplyScalar(-d))}else{const p=new B(u.x*Math.cos(Math.PI/2)-u.y*Math.sin(Math.PI/2),u.y*Math.cos(Math.PI/2)+u.x*Math.sin(Math.PI/2));m=h.add(p.multiplyScalar(d))}s<0?(this.startAngle=Math.atan2(i.y-m.y,i.x-m.x),this.endAngle=Math.atan2(a.y-m.y,a.x-m.x)):(this.startAngle=Math.atan2(a.y-m.y,a.x-m.x),this.endAngle=Math.atan2(i.y-m.y,i.x-m.x)),this.clockwise=s<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(t){this._center=new L(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._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==H?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?C.normalizeAngle(this.startAngle-this.endAngle):C.normalizeAngle(this.endAngle-this.startAngle)}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=C.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of e)C.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(i));const s=t.map(i=>i.x),r=t.map(i=>i.y);return new K(new L(Math.min(...s),Math.min(...r)),new L(Math.max(...s),Math.max(...r)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new oe(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const e=this.center.x+this.radius*Math.cos(t),s=this.center.y+this.radius*Math.sin(t);return new L(e,s)}getPoints(t=100){const e=[];let s=this.deltaAngle,r=this.startAngle;if(this.closed&&(s=H,r=0),this.clockwise)for(let i=0;i<=t;i++){const a=r-s*(i/t),o=this.getPointAtAngle(a);e.push(new L(o.x,o.y))}else for(let i=0;i<=t;i++){const a=r+s*(i/t),o=this.getPointAtAngle(a);e.push(new L(o.x,o.y))}return e}}class tl extends ai{translate(t){return this.transform(new Yt().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 ke extends tl{}class Nt extends ke{constructor(t,e){super(),this._start=new b(t),this._end=new b(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 w().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new b((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(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const s=this.delta(qt).normalize();return new b(this._start).addScaledVector(s,t)}else{const s=this.delta(qt).normalize();return new b(this._end).addScaledVector(s,t)}}extend(t,e=!1){if(e){const s=qt.subVectors(this._start,this._end).normalize();this._start=new b(this._start).addScaledVector(s,t)}else{const s=this.delta(qt).normalize();this._end=new b(this._end).addScaledVector(s,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){oi.subVectors(t,this._start),Je.subVectors(this.endPoint,this.startPoint);const s=Je.dot(Je);let r=Je.dot(oi)/s;return e&&(r=C.clamp(r,0,1)),r}closestPointToPoint(t,e,s){const r=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(r).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,s=qt.subVectors(t,this.startPoint).dot(e);return new b().copy(e).multiplyScalar(s).add(this.startPoint)}perpPoint(t){const e=this.direction,s=this.startPoint,r=qt.subVectors(t,s).dot(e),i=qt.copy(e).multiplyScalar(r);return new b().addVectors(s,i)}calculateBoundingBox(){const t=new b(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 b(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 O(t,e)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(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 Nt(this._start.clone(),this._end.clone())}}const qt=new w,oi=new w,Je=new w;class Xt extends ke{static computeCenterPoint(t,e,s){const r=new w().addVectors(t,e).multiplyScalar(.5),i=new w().addVectors(t,s).multiplyScalar(.5),a=new w().subVectors(e,t),o=new w().subVectors(s,t),c=new w().crossVectors(a,o).normalize();if(c.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const h=new w().crossVectors(a,c).normalize(),d=new w().crossVectors(o,c).normalize(),u=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new Nt(r,r.clone().add(u)),y=new Nt(i,i.clone().add(m)),_=new w;return p.closestPointToPoint(y.startPoint,!0,_)?_:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,s){const r=Xt.computeCenterPoint(t,e,s);if(r){const i=r.distanceTo(t),a=new w().subVectors(t,r),o=new w().subVectors(e,r),c=Math.atan2(a.y,a.x),h=Math.atan2(o.y,o.x);return new Xt(r,i,c,h,w.Z_AXIS)}}constructor(t,e,s,r,i,a=w.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=s,this.endAngle=r,this.normal=i,this.refVec=a,(r-s)%H==0?(this.startAngle=0,this.endAngle=H):(this.startAngle=s,this.endAngle=r)}get center(){return this._center}set center(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw et.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==H?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return C.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 w(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new w(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 length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let c=0;c<2*Math.PI;c+=Math.PI/2)C.isBetweenAngle(c,this.startAngle,this.endAngle)&&t.push(c);let e=1/0,s=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(const c of t){const h=this.getPointAtAngle(c);h.x<e&&(e=h.x),h.y<s&&(s=h.y),h.z<r&&(r=h.z),h.x>i&&(i=h.x),h.y>a&&(a=h.y),h.z>o&&(o=h.z)}return new O({x:e,y:s,z:r},{x:i,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let s=this.deltaAngle,r=this.startAngle;this.closed&&(s=H,r=0);for(let i=0;i<=t;i++){const a=r+s*(i/t),o=this.getPointAtAngle(a);e.push(o)}return e}transform(t){const e=Zs.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=Zs.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),e.applyMatrix3d(t),s.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(s),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 Xt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Zs.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,s=this.refVec,r={x:e.y*s.z-e.z*s.y,y:e.z*s.x-e.x*s.z,z:e.x*s.y-e.y*s.x},i=this.center,a=this.radius;return new b(i.x+a*(s.x*Math.cos(t)+r.x*Math.sin(t)),i.y+a*(s.y*Math.cos(t)+r.y*Math.sin(t)),i.z+a*(s.z*Math.cos(t)+r.z*Math.sin(t)))}get plane(){const t=new w(this.center).distanceTo(Hs);return new Le(this.normal,t)}}const Zs=new w;class ts extends ae{constructor(t,e,s,r=0,i=H,a=!1,o=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=s,(i-r)%H==0?(this.startAngle=0,this.endAngle=H):(this.startAngle=r,this.endAngle=i),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw et.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw et.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==H?t:C.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 C.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,s=-1/0,r=-1/0;for(let i=0;i<=100;i++){const a=this.getPoint(i/100);t=Math.min(t,a.x),e=Math.min(e,a.y),s=Math.max(s,a.x),r=Math.max(r,a.y)}return new K({x:t,y:e},{x:s,y:r})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let s=this.endAngle-this.startAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=e;for(;s>e;)s-=e;s<Number.EPSILON&&(r?s=0:s=e),this.clockwise===!0&&!r&&(s===e?s=-e:s=s-e);const i=this.startAngle+t*s;let a=this.center.x+this.majorAxisRadius*Math.cos(i),o=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const c=Math.cos(this.rotation),h=Math.sin(this.rotation),d=a-this.center.x,u=o-this.center.y;a=d*c-u*h+this.center.x,o=d*h+u*c+this.center.y}return new L(a,o)}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 ts(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class es extends ke{constructor(t,e,s,r,i,a=0,o=H){super(),this.center=t,this.normal=e,this.majorAxis=s,this.majorAxisRadius=r,this.minorAxisRadius=i;const c=Math.abs(o-a);Math.abs(c-H)<1e-10||Math.abs(c-2*H)<1e-10?(this.startAngle=0,this.endAngle=H):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw et.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw et.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==H?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-H)<1e-10?H:C.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 w(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new w(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new w().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return Us.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let s=0,r=this.getPointAtAngle(this.startAngle);for(let i=1;i<=t;i++){const a=this.startAngle+i*e,o=this.getPointAtAngle(a),c=o.x-r.x,h=o.y-r.y,d=o.z-r.z;s+=Math.sqrt(c*c+h*h+d*d),r=o}return s}calculateBoundingBox(){if(this.majorAxis.equals(w.X_AXIS)||this.majorAxis.equals(w.Y_AXIS)||this.majorAxis.isParallelTo(w.X_AXIS)||this.majorAxis.isParallelTo(w.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let c=0;c<2*Math.PI;c+=Math.PI/2)C.isBetweenAngle(c,this.startAngle,this.endAngle)&&t.push(c);let e=1/0,s=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(const c of t){const h=this.getPointAtAngle(c);h.x<e&&(e=h.x),h.y<s&&(s=h.y),h.z<r&&(r=h.z),h.x>i&&(i=h.x),h.y>a&&(a=h.y),h.z>o&&(o=h.z)}return new O({x:e,y:s,z:r},{x:i,y:a,z:o})}else{let t=1/0,e=1/0,s=1/0,r=-1/0,i=-1/0,a=-1/0;for(let o=0;o<=100;o++){const c=this.startAngle+this.deltaAngle*(o/100),h=this.getPointAtAngle(c);t=Math.min(t,h.x),e=Math.min(e,h.y),s=Math.min(s,h.z),r=Math.max(r,h.x),i=Math.max(i,h.y),a=Math.max(a,h.z)}return new O({x:t,y:e,z:s},{x:r,y:i,z:a})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let s=this.deltaAngle,r=this.startAngle;this.closed&&(s=H,r=0);for(let i=0;i<=t;i++){const a=r+s*(i/t),o=this.getPointAtAngle(a);e.push(o)}return e}getPointAtAngle(t){const e=Math.cos(t),s=Math.sin(t),r=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),i=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(r);return new b(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const e=new w(t).sub(this.center),s=e.dot(this.majorAxis),r=e.dot(this.minorAxis),i=s/this.majorAxisRadius,a=r/this.minorAxisRadius;return i*i+a*a<=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 es(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new w(this.center).distanceTo(Hs);return new Le(this.normal,t)}}class Ce extends ae{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 L(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 L(e.x,e.y)}else{const e=this._vertices[t-1];return new L(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let s=0;s<e;++s){const r=this._vertices[s];let i=null;if(s<e-1?i=this._vertices[s+1]:s==e-1&&this.closed&&(i=this._vertices[0]),i)if(r.bulge){const a=new oe(r,i,r.bulge);t+=a.length}else t+=new L(r.x,r.y).distanceTo(i)}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 L(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new K().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const s=[];return this.getPoints(t).forEach(r=>s.push(new b().set(r.x,r.y,e))),s}getPoints(t){const e=[],s=this._vertices.length;for(let r=0;r<s;++r){const i=this._vertices[r];if(i.bulge){let a=null;if(r<s-1?a=this._vertices[r+1]:r==s-1&&this.closed&&(a=this._vertices[0]),a){const o=new oe(i,a,i.bulge).getPoints(t),c=o.length;for(let h=0;h<c;++h){const d=o[h];e.push(new L(d.x,d.y))}}}else e.push(new L(i.x,i.y)),r==s-1&&this.closed&&e.push(e[0])}return e}}class ss extends ae{constructor(t,e){super(),this._start=new L(t),this._end=new L(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 L(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new L(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new K(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 ss(this._start.clone(),this._end.clone())}}class li extends ae{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 L(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 K;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(s=>{s.getPoints(t).forEach(r=>{e.push(new L(r.x,r.y))})}),e}}class Qs{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,s,r){this.c0=t,this.c1=s,this.c2=-3*t+3*e-2*s-r,this.c3=2*t-2*e+s+r}initCatmullRom(t,e,s,r,i){this.init(e,s,i*(s-t),i*(r-e))}initNonuniformCatmullRom(t,e,s,r,i,a,o){let c=(e-t)/i-(s-t)/(i+a)+(s-e)/a,h=(s-e)/a-(r-e)/(a+o)+(r-s)/o;c*=a,h*=a,this.init(e,s,c,h)}calc(t){const e=t*t,s=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*s}}class hi extends ke{constructor(t=[],e=!1,s="centripetal",r=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new w,this._px=new Qs,this._py=new Qs,this._pz=new Qs,this._points=t.map(i=>new b(i)),this._closed=e,this._curveType=s,this._tension=r}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 b}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new b}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 b){const s=e,r=this._points,i=r.length;if(i===0)return s.set(0,0,0);if(i===1)return s.copy(r[0]);const a=(i-(this._closed?0:1))*t;let o=Math.floor(a),c=a-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:c===0&&o===i-1&&(o=i-2,c=1);let h,d;this._closed||o>0?h=r[(o-1)%i]:(this._tmp.subVectors(r[0],r[1]).add(r[0]),h=new b(this._tmp.x,this._tmp.y,this._tmp.z));const u=r[o%i],m=r[(o+1)%i];if(this._closed||o+2<i?d=r[(o+2)%i]:(this._tmp.subVectors(r[i-1],r[i-2]).add(r[i-1]),d=new b(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const p=this._curveType==="chordal"?.5:.25;let y=Math.pow(h.distanceToSquared(u),p),_=Math.pow(u.distanceToSquared(m),p),x=Math.pow(m.distanceToSquared(d),p);_<1e-4&&(_=1),y<1e-4&&(y=_),x<1e-4&&(x=_),this._px.initNonuniformCatmullRom(h.x,u.x,m.x,d.x,y,_,x),this._py.initNonuniformCatmullRom(h.y,u.y,m.y,d.y,y,_,x),this._pz.initNonuniformCatmullRom(h.z,u.z,m.z,d.z,y,_,x)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(h.x,u.x,m.x,d.x,this._tension),this._py.initCatmullRom(h.y,u.y,m.y,d.y,this._tension),this._pz.initCatmullRom(h.z,u.z,m.z,d.z,this._tension));return s.set(this._px.calc(c),this._py.calc(c),this._pz.calc(c)),s}getPoints(t){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}setPoints(t){this._points=t.map(e=>new b(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 s=new b;return s.copy(e),s.applyMatrix3d(t),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new O;const t=new O;return this._points.forEach(e=>{t.expandByPoint(e)}),t}}class mt{constructor(t,e,s,r){this._degree=t,this._knots=[...e],this._controlPoints=s.map(i=>({x:i.x,y:i.y,z:i.z})),this._weights=r?[...r]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(s=>[s.x,s.y,s.z]);return ve(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return Qr(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,s,r){return new mt(t,e,s,r)}static byPoints(t,e,s="Uniform"){let r;switch(s){case"Chord":r=Kr(e,t);break;case"SqrtChord":r=Zr(e,t);break;case"Uniform":default:r=$r(e,t.length);break}const i=t.map(o=>({x:o[0],y:o[1],z:o[2]})),a=new Array(i.length).fill(1);return new mt(e,r,i,a)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:s,end:r}=this.getParameterRange();for(let i=0;i<=t;i++){const a=s+(r-s)*(i/t);e.push(this.point(a))}return e}isClosed(t=1e-6){const{start:e,end:s}=this.getParameterRange(),r=this.point(e),i=this.point(s),a=r[0]-i[0],o=r[1]-i[1],c=r[2]-i[2];return Math.sqrt(a*a+o*o+c*c)<t}static createClosedCurve(t,e,s="Chord"){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const r=new hi(t,!0,"centripetal"),i=Math.max(50,t.length*2),a=r.getPoints(i).map(o=>[o.x,o.y,o.z]);return mt.byPoints(a,e,s)}}class Dt extends ke{constructor(t,e,s,r){super();const i=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(r!==void 0);if(i<2||i>4)throw et.ILLEGAL_PARAMETERS;const a=3;if(this._closed=r||!1,Array.isArray(e)){if(this._controlPoints=t,i>=4&&(this._closed=r),this._controlPoints.length<4)throw et.ILLEGAL_PARAMETERS;this._nurbsCurve=mt.byKnotsControlPointsWeights(a,e,this._controlPoints,s)}else{if(this._fitPoints=t,this._knotParameterization=e,i>=3&&(this._closed=s),this._fitPoints.length<4)throw et.ILLEGAL_PARAMETERS;const o=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=mt.byPoints(o,a,this._knotParameterization),this._controlPoints=this._nurbsCurve.controlPoints()}this._closed&&this.buildCurve()}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed)this._nurbsCurve=mt.createClosedCurve(this._fitPoints,3,this._knotParameterization);else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=mt.byPoints(t,3,this._knotParameterization)}this._controlPoints=this._nurbsCurve.controlPoints()}else if(this._controlPoints)if(this._closed){const t=this._knotParameterization||"Chord";this._nurbsCurve=mt.createClosedCurve(this._controlPoints,3,t),this._controlPoints=this._nurbsCurve.controlPoints()}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._nurbsCurve=mt.byKnotsControlPointsWeights(3,t,this._controlPoints,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._nurbsCurve.degree()}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[e],r=this._nurbsCurve.point(s);return new b(r[0],r[1],r[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[t.length-e-1],r=this._nurbsCurve.point(s);return new b(r[0],r[1],r[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,s=t<0||t>=e?e-1:t,r=this._fitPoints[s];return{x:r.x,y:r.y,z:r.z||0}}getControlPointAt(t){const e=this._controlPoints.length,s=t<0||t>=e?e-1:t;return this._controlPoints[s]}getPoints(t=100){const e=this._nurbsCurve,s=[],r=e.knots(),i=this._nurbsCurve.degree(),a=r[i],o=r[r.length-i-1],c=(o-a)/(t-1);for(let h=0;h<t;h++){const d=h===t-1?o:a+h*c,u=e.point(d);s.push(new b(u[0],u[1],u[2]))}return s}getCurvePoints(t,e){const s=[],r=t.knots(),i=r[3],a=(r[r.length-4]-i)/(e-1);for(let o=0;o<e;o++){const c=i+o*a;s.push(t.point(c))}return s}calculateBoundingBox(){const t=this.getPoints(100);return new O().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((s,r)=>{e[r]=[s.x,s.y,s.z||0]}),e}static createClosedSpline(t,e="Uniform"){if(t.length<4)throw new Error("At least 4 points are required for a closed spline");return new Dt(t,e,!0)}}for(var $t=256,ci=[],di=256,ns;$t--;)ci[$t]=($t+256).toString(16).substring(1);function el(n){var t=0,e=11;if(!ns||$t+e>di*2)for(ns="",$t=0;t<di;t++)ns+=ci[Math.random()*256|0];return ns.substring($t,$t+++e)}class Rt{constructor(t,e){t=t||{},ee(t,{objectId:el()}),this._attrs=new fn(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:dn().workingDatabase}set database(t){this._database=t}close(){}}class pt extends Rt{constructor(){super(...arguments),this._layer="0",this._color=new zt,this._lineType=qe,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.name.substring(4)}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 e=this.getLayerColor();e&&e.color&&(t=e)}else this.color.isByBlock||this.color.color!=null&&(t=this.color);return t.color==null?16777215:t.color}get lineType(){return this._lineType}set lineType(t){this._lineType=t||qe}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}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,s,r,i){}transformBy(t){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const t=this.getLineType(),e=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(t);return e?{...e.linetype,color:this.rgbColor}:{name:t,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==qe){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return t.linetype}else return this.lineType==Pr?Ye:this.lineType;return Ye}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}}class Js extends pt{constructor(t){super(),this._blockName=t,this._position=new b,this._rotation=0,this._normal=new w(0,0,1),this._scaleFactors=new b(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)}get geometricExtents(){const t=new O,e=this.blockTableRecord;if(e!=null){const i=e.newIterator();for(const a of i)t.union(a.geometricExtents)}const s=new Ct().setFromEuler(new ii(this.rotation,0,0)),r=new Yt;return r.compose(this.position,s,this.scaleFactors),t.applyMatrix4(r),t}draw(t){const e=[],s=this.blockTableRecord;if(s!=null){const r=this.computeTransformMatrix();return kt.instance.draw(t,s,this.rgbColor,!0,r,this.normal)}else return t.group(e)}computeTransformMatrix(){const t=new Ct;return t.setFromAxisAngle(w.Z_AXIS,this.rotation),new Yt().compose(this._position,t,this._scaleFactors)}}class gt extends pt{}class ui extends gt{constructor(t,e,s,r,i,a,o){super(),this._geo=new es(t,e,s,r,i,a,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(t){return t.ellipticalArc(this._geo,this.lineStyle)}}class mi extends gt{constructor(t,e,s,r){super(),this._geo=new Xt(t,e,s,r,w.Z_AXIS,w.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 startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}transformBy(t){return this._geo.transform(t),this}draw(t){return t.circularArc(this._geo,this.lineStyle)}}class gi extends gt{constructor(t,e,s=w.Z_AXIS){super(),this._geo=new Xt(t,e,0,H,s,w.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}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}draw(t){return t.circularArc(this._geo,this.lineStyle)}}var pi=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(pi||{}),yi=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(yi||{});class _i extends pt{constructor(){super(),this._elevation=0,this._geo=new Qe,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}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}add(t){this._geo.add(t)}get geometricExtents(){const t=this._geo.box;return new O({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}draw(t){return t.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}}var fi=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(fi||{});class xi extends gt{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 b().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 O().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}draw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e,this.lineStyle)}else return t.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Dt(this._vertices,"Uniform"),this._updated=!1)}}class bi extends gt{constructor(t,e){super(),this._geo=new Nt(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}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,r,i){const a=this.startPoint,o=this.endPoint;switch(t){case Ut.EndPoint:i.push(a),i.push(o);break;case Ut.MidPoint:i.push(this.midPoint);break;case Ut.Nearest:{const c=this._geo.project(s);i.push(c)}break;case Ut.Perpendicular:{const c=this._geo.perpPoint(s);i.push(c)}break;case Ut.Tangent:i.push(a);break}}transformBy(t){return this._geo.transform(t),this}draw(t){const e=this.startPoint,s=this.endPoint,r=[new b(e.x,e.y,0),new b(s.x,s.y,0)];return t.lines(r,this.lineStyle)}}var tn=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(tn||{}),rs=(n=>(n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE",n))(rs||{}),le=(n=>(n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n))(le||{}),en=(n=>(n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",n))(en||{}),sn=(n=>(n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT",n))(sn||{}),nn=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(nn||{});class is{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,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 K;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 K;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new is;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}}class wi 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 b,this._attachmentPoint=le.TopLeft,this._direction=new w(1,0,0),this._drawingDirection=rs.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 O}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}draw(t){const e={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},s={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,s)}}class rn extends gt{constructor(t,e,s,r){super();const i=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(r!==void 0);if(i<2||i>4)throw et.ILLEGAL_PARAMETERS;i<=3&&!Array.isArray(e)?this._geo=new Dt(t,e,s):this._geo=new Dt(t,e,s,r)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}draw(t){const e=this._geo.getPoints(100);return t.lines(e,this.lineStyle)}}const sl=new w;class Ai extends Js{constructor(t,e,s){super(t),this._attachmentPoint=le.TopLeft,this._numColumns=s,this._numRows=e,this._columnWidth=new Array(s),this._rowHeight=new Array(e),this._cells=new Array(e*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,s){return this._cells[t*e].text}setTextString(t,e,s){this._cells[t*e].text=s}isEmpty(t,e){return!this._cells[t*e].text}get geometricExtents(){return new O}draw(t){let e=0,s=0;const r=new Uint16Array(this.numColumns*this.numRows*8),i=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let m=0;m<=this.numRows;m++){e-=m>0?this.rowHeight(m-1):0,s=0;for(let p=0;p<=this.numColumns;p++)s+=p>0?this.columnWidth(p-1):0,i[a++]=s,i[a++]=e,i[a++]=0}const o=[],c=new Array(this.numRows*this.numColumns).fill(!1);s=0,a=0;let h=0;for(let m=0;m<this.numColumns;m++){s+=m>0?this.columnWidth(m-1):0,e=0;for(let p=0;p<this.numRows;p++){e+=p>0?this.rowHeight(p-1):0;const y=this.cell(p*this.numColumns+m);if(h=p*this.numColumns+m,y&&!c[h]){const _=y.borderWidth??1,x=y.borderHeight??1;this.fillVisited(c,h,this.numColumns,_,x),r[a++]=m+p*(this.numColumns+1),r[a++]=m+p*(this.numColumns+1)+_;const f=i[r[a-1]*3]-s,M=m+(p+x)*(this.numColumns+1)+_;m+_==this.numColumns&&(r[a++]=m+p*(this.numColumns+1)+_,r[a++]=M);const T=-i[M*3+1]-e;if(p+x==this.numRows&&(r[a++]=m+(p+x)*(this.numColumns+1)+x,r[a++]=m+(p+x)*(this.numColumns+1)),r[a++]=m+(p+x)*(this.numColumns+1),r[a++]=m+p*(this.numColumns+1),y.text){const S=y.attachmentPoint||this.attachmentPoint||le.MiddleCenter,P=this.getTableTextOffset(S,f,T),z={text:y.text,height:y.textHeight,width:f,position:sl.set(s,-e,0).clone().add(P),rotation:this.rotation,attachmentPoint:S},I={...this.getTextStyle(y),color:this.color.color};o.push(t.mtext(z,I))}}}}o.push(t.lineSegments(i,3,r,this.lineStyle));const d=t.group(o),u=new Ct;return u.setFromAxisAngle(w.Z_AXIS,this.rotation),Pi.compose(this.position,u,this.scaleFactors),d.applyMatrix(Pi),d}fillVisited(t,e,s,r,i){if(i==1&&r==1)t[e]=!0;else for(let a=0;a<r;++a)for(let o=0;o<i;++o)t[e+a+o*s]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let s;return t.textStyle&&(s=e.getAt(t.textStyle)),s||(s=e.getAt("STANDARD")||e.getAt("Standard")),s.textStyle}getTableTextOffset(t,e,s){const r=new w;switch(t){case 1:break;case 2:r.setX(e/2);break;case 3:r.setX(e);break;case 4:r.setY(-s/2);break;case 5:r.set(e/2,-s/2,0);break;case 6:r.set(e,-s/2,0);break;case 7:r.setY(-s);break;case 8:r.set(e/2,-s,0);break;case 9:r.set(e,-s,0);break}return r}}const Pi=new Yt;var Ii=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(Ii||{}),Ei=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Ei||{});class Ti extends pt{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new b,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 O}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}draw(t){const e={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:rs.BOTTOM_TO_TOP,attachmentPoint:le.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,s)}}class Si extends gt{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new b,new b,new b,new b]}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 O().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;for(let e=0;e<4;++e)t.push(this.getPointAt(e));return t}draw(t){const e=new Ce(this._vertices,!0),s=new Qe;return s.add(e),t.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}}class Mi extends gt{constructor(){super(),this._elevation=0,this._geo=new Ce}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,s=0,r=-1,i=-1){const a=r<0?void 0:r,o=i<0?void 0:i,c={x:e.x,y:e.y,bulge:s,startWidth:a,endWidth:o};this._geo.addVertexAt(t,c)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new b(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new O({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}draw(t){const e=[];return this._geo.getPoints(100).forEach(r=>e.push(new b().set(r.x,r.y,this.elevation))),t.lines(e,this.lineStyle)}}class vi extends pt{constructor(){super(),this._geo=new b}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new O().expandByPoint(this._geo)}transformBy(t){return this._geo.applyMatrix3d(t),this}draw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}}var Li=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(Li||{}),ki=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(ki||{});class an extends pt{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new b,this._scale=new B(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!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 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 O;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()}draw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e,this.lineStyle)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,s=this._height,r=new K;r.setFromPoints(this._clipBoundary);const i=new L;i.setX(this._position.x-r.min.x*e),i.setY(this._position.y-r.min.y*s),this._clipBoundary.forEach(a=>{const o=a.x*e+i.x,c=a.y*s+i.y;t.push(new b(o,c,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){Ci.copy(t[1]);for(let e=1;e<4;e++)as.copy(t[e]),as.rotateAround(Ci,this._rotation),t[e].setX(as.x),t[e].setY(as.y)}t.push(t[0])}return t}}const Ci=new L,as=new L;class Oi extends gt{constructor(){super(),this._basePoint=new b,this._unitDir=new w}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 O;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}draw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e,this.lineStyle)}}class Ni extends pt{constructor(){super(),this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,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 O}draw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new is;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const s=[];return s.push(e.lines([new b(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new b(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)],this.lineStyle)),s.push(e.lines([new b(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new b(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)],this.lineStyle)),s.push(e.lines([new b(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new b(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)],this.lineStyle)),s.push(e.lines([new b(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new b(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)],this.lineStyle)),s}}class Di extends an{draw(t){const e=this.boundaryPath(),s=new Qe;return s.add(new Ce(e)),t.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}}class Ri extends gt{constructor(){super(),this._basePoint=new b,this._unitDir=new w}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 O;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}draw(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,this.lineStyle)}}var zi=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(zi||{});class Kt extends pt{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new b,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=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 Oe),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}draw(t){if(this.dimBlockId){const e=this.database.tables.blockTable.getAt(this.dimBlockId);if(e)return kt.instance.draw(t,e,this.rgbColor,!1)}return t.group([])}drawFirstArrow(t){const e=this.database.tables.blockTable.getAt(this.firstArrowType);if(e)return kt.instance.draw(t,e,this.rgbColor,!1)}drawSecondArrow(t){const e=this.database.tables.blockTable.getAt(this.secondArrowType);if(e)return kt.instance.draw(t,e,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 t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,s){const r=new b().subVectors(e,t).normalize();return new b(e).addScaledVector(r,s)}findPointOnLine2(t,e,s){const r=t.x+s*Math.cos(e),i=t.y+s*Math.sin(e);return{x:r,y:i}}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():tn.Closed}}class Fi extends Kt{constructor(t,e,s,r,i=null,a=null){super(),this._centerPoint=new b().copy(t),this._xLine1Point=new b().copy(e),this._xLine2Point=new b().copy(s),this._arcPoint=new b().copy(r),this.dimensionText=i,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new O}}class Bi extends Kt{constructor(t,e,s,r=null,i=null){super(),this._dimLinePoint=new b().copy(s),this._xLine1Point=new b().copy(t),this._xLine2Point=new b().copy(e),this._oblique=0,this._rotation=0,this.dimensionText=r,this.dimensionStyleName=i}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 O}get isAppendArrow(){return!1}calculateLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(e,this._dimLinePoint),i=this.findIntersectionPoint(s,this._dimLinePoint),a=new Nt(r,i);return t.push(a),e.endPoint=r,this.adjustExtensionLine(e),t.push(e),s.endPoint=i,this.adjustExtensionLine(s),t.push(s),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,s=this.findPointOnLine2(t,e,100);return new Nt(t,{...s,z:t.z})}findIntersectionPoint(t,e){const s=t.startPoint,r=t.endPoint,i=new w().subVectors(r,s).normalize(),o=new w().subVectors(e,s).dot(i),c=new w().copy(i).multiplyScalar(o);return new w().addVectors(s,c)}}class nl extends Kt{constructor(t,e,s,r,i=null,a=null){super(),this._arcPoint=new b().copy(r),this._xLine1Point=new b().copy(e),this._xLine2Point=new b().copy(s),this._centerPoint=new b().copy(t),this.dimensionText=i,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new O}}class Vi extends Kt{constructor(t,e,s=0,r=null,i=null){super(),this._chordPoint=new b().copy(t),this._farChordPoint=new b().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=r,this.dimensionStyleName=i}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 O}drawLines(t,e){const s=[],r=e.length;return r==1?s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):r==3?(this.sortLines(e),s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(t,e[1])),s.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(i=>{s.push(this.drawLine(t,i))}),s}drawLine(t,e,s){if(s){const r=[e.startPoint,e.endPoint];return t.lines(r,{...this.lineStyle,arrows:s})}else return e.draw(t)}sortLines(t){const e=(s,r)=>s.x!==r.x?s.x-r.x:s.y!==r.y?s.y-r.y:s.z-r.z;t.sort((s,r)=>{const i=e(s.startPoint,r.startPoint);return i!==0?i:e(s.endPoint,r.endPoint)})}}class ji extends Kt{constructor(t,e,s=null,r=null){super(),this._definingPoint=new b().copy(t),this._leaderEndPoint=new b().copy(e),this.dimensionText=s,this.dimensionStyleName=r}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get geometricExtents(){return new O}get arrowLineCount(){return 0}}class Gi extends Kt{constructor(t,e,s,r=null,i=null){super(),this._center=new b().copy(t),this._chordPoint=new b().copy(e),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=i}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 O}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}}class Hi{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return 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=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"||t.type=="LWPOLYLINE"?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}convertArc(t){return new mi(t.center,t.radius,C.degToRad(t.startAngle),C.degToRad(t.endAngle))}convertCirle(t){return new gi(t.center,t.radius)}convertEllipse(t){const e=new w(t.majorAxisEndPoint),s=e.length();return new ui(t.center,w.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new bi(new b(e.x,e.y,e.z||0),new b(s.x,s.y,s.z||0))}convertSpline(t){if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new rn(t.controlPoints,t.knots,t.weights,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new rn(e,"Uniform",!!(t.flag&1))}return null}convertPoint(t){const e=new vi;return e.position=t.position,e}convertSolid(t){const e=new Si;return t.points.forEach((s,r)=>e.setPointAt(r,s)),e.thickness=t.thickness,e}convertPolyline(t){const e=new Mi;return e.closed=!!(t.flag&1),t.vertices.forEach((s,r)=>{e.addVertexAt(r,new L(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),e}convertHatch(t){var r;const e=new _i;return(r=t.definitionLines)==null||r.forEach(i=>{e.definitionLines.push({angle:i.angle,origin:i.base,delta:i.offset,dashPattern:i.numberOfDashLengths>0?i.dashLengths:[]})}),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(i=>{if(i.boundaryPathTypeFlag&2){const o=i,c=new Ce;c.closed=o.isClosed,o.vertices.forEach((h,d)=>{c.addVertexAt(d,{x:h.x,y:h.y,bulge:h.bulge})}),e.add(c)}else{const o=i,c=new li;o.edges.forEach(h=>{if(h.type==1){const d=h;c.add(new ss(d.start,d.end))}else if(h.type==2){const d=h;c.add(new oe(d.center,d.radius,C.degToRad(d.startAngle||0),C.degToRad(d.endAngle||0),!d.isCCW))}else if(h.type==3){const d=h;new B().subVectors(d.end,d.center);const m=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),p=m*d.lengthOfMinorAxis;let y=C.degToRad(d.startAngle||0),_=C.degToRad(d.endAngle||0);const x=Math.atan2(d.end.y,d.end.x);d.isCCW||(y=Math.PI*2-y,_=Math.PI*2-_),c.add(new ts({...d.center,z:0},m,p,y,_,!d.isCCW,x))}else if(h.type==4){const d=h;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const u=d.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let m=!0;const p=d.controlPoints.map(y=>(y.weight==null&&(m=!1),y.weight||1));c.add(new Dt(u,d.knots,m?p:void 0))}else if(d.numberOfFitData>0){const u=d.fitDatum.map(m=>({x:m.x,y:m.y,z:0}));c.add(new Dt(u,"Uniform"))}}}),e.add(c)}}),e}convertTable(t){const e=new Ai(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((s,r)=>e.setColumnWidth(r,s)),t.rowHeightArr.forEach((s,r)=>e.setRowHeight(r,s)),t.cells.forEach((s,r)=>{e.setCell(r,s)}),e}convertText(t){const e=new Ti;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=C.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 wi;return e.contents=t.text.join(""),t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=C.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new w(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new xi;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new Bi(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return s.rotation=C.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new Fi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new ji(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new Gi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new Vi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageDefId=t.imageDefHandle,e.isClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new L(s))}),e.clipBoundaryType=t.clippingBoundaryType,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 an;return this.processImage(t,e),e}convertWipeout(t){const e=new Di;return this.processImage(t,e),e}convertViewport(t){const e=new Ni;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 Oi;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertXline(t){const e=new Ri;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertBlockReference(t){const e=new Js(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?C.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection),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}processCommonAttrs(t,e){e.layer=t.layer,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.color=t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName!=null&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=t.transparency)}numberArrayToPointArray(t,e){const s=t.length;let r=0;if(s/2==e?r=2:s/3==e&&(r=3),r==0)return;const i=[];for(let a=0,o=s/r;a<o;++a)i.push({x:t[a*r],y:t[a*r+1],z:r==3?t[a*r+2]:0});return i}}class on extends Rt{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new K,this._extents=new O}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 ln extends Rt{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)}remove(t){return this.getAt(t)?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,r)=>{s===e&&this._recordsByName.delete(r)}),!0):!1}removeAll(){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 Xe(this._recordsByName)}}class Ui extends ln{getBtrIdAt(t){for(const[e,s]of this._recordsByName)if(s.blockTableRecordId==t)return s}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class Wi extends Rt{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}}class rl{convertLayout(t){const e=new on;return e.layoutName=t.layoutName,e.tabOrder=t.tabOrder,e.blockTableRecordId=t.ownerObjectId,e.limits.min.copy(t.minLimit),e.limits.max.copy(t.maxLimit),e.extents.min.copy(t.minExtent),e.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,e),e}convertImageDef(t){const e=new Wi;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Yi extends Tr{parse(t){return new Wo().parseSync(t)}getFonts(t){var i;const e=new Map,s=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(i=t.tables.STYLE)==null||i.entries.forEach(a=>{const o=[];let c=s(a.font);c&&o.push(c),c=s(a.bigFont),c&&o.push(c),e.set(a.name,o)});const r=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,r),Array.from(r)}getFontsInBlock(t,e,s,r){const i=/\\f(.*?)\|/g;t.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.join("").matchAll(i)].forEach(d=>{r.add(d[1].toLowerCase())});const h=s.get(o.styleName);h==null||h.forEach(d=>r.add(d))}else if(a.type=="TEXT"){const o=a,c=s.get(o.styleName);c==null||c.forEach(h=>r.add(h))}else if(a.type=="INSERT"){const c=e[a.name];c&&c.entities&&this.getFontsInBlock(c.entities,e,s,r)}})}async processEntities(t,e,s,r,i){const a=new Hi,o=t.entities,c=o.length,h=new Pn(c,100-r.value,s),d=e.tables.blockTable.modelSpace,u=e.tables.blockTable;await h.processChunk(async(m,p)=>{for(let y=m;y<p;y++){const _=o[y],x=a.convert(_);if(x){let f=d;_.ownerBlockRecordSoftId!=null&&(f=u.getIdAt(_.ownerBlockRecordSoftId)||f),f.appendEntity(x)}}if(i){let y=r.value+p/c*(100-r.value);y>100&&(y=100),await i(y,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(t,e,s){const r=new Hi,i=t.length;for(let a=0;a<i;a++){const o=t[a],c=r.convert(o);if(c){let h=e;o.ownerBlockRecordSoftId!=null&&(h=s.getIdAt(o.ownerBlockRecordSoftId)||h),h.appendEntity(c)}}}processBlocks(t,e){const s=t.blocks;for(const[r,i]of Object.entries(s)){let a=e.tables.blockTable.getAt(i.name);a||(a=new Mt,a.objectId=i.handle,a.name=r,a.origin.copy(i.position),e.tables.blockTable.add(a)),i.entities&&this.processEntitiesInBlock(i.entities,a,e.tables.blockTable)}}processHeader(t,e){const s=t.header;e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,e.aunits=s.$AUNITS,e.insunits=s.$INSUNITS,e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0}processBlockTables(t,e){var r;const s=(r=t.tables.BLOCK_RECORD)==null?void 0:r.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(i=>{const a=new Mt;a.objectId=i.handle,a.name=i.name,e.tables.blockTable.add(a)}))}processObjects(t,e){const s=t.objects.byName,r=new rl;if("LAYOUT"in s){const i=e.dictionaries.layouts;s.LAYOUT.forEach(a=>{const o=r.convertLayout(a);i.setAt(o.layoutName,o)})}if("IMAGEDEF"in s){const i=e.dictionaries.imageDefs;s.IMAGEDEF.forEach(a=>{const o=r.convertImageDef(a);i.setAt(o.objectId,o)})}}processViewports(t,e){var r,i;const s=(i=(r=t.tables)==null?void 0:r.VPORT)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new aa;this.processCommonTableEntryAttrs(a,o),a.circleSides&&(o.circleSides=a.circleSides),o.standardFlag=a.standardFlag,o.center.copy(a.center),o.lowerLeftCorner.copy(a.lowerLeftCorner),o.upperRightCorner.copy(a.upperRightCorner),a.snapBasePoint&&o.snapBase.copy(a.snapBasePoint),a.snapRotationAngle&&(o.snapAngle=a.snapRotationAngle),a.snapSpacing&&o.snapIncrements.copy(a.snapSpacing),a.majorGridLines&&(o.gridMajor=a.majorGridLines),a.gridSpacing&&o.gridIncrements.copy(a.gridSpacing),a.backgroundObjectId&&(o.backgroundObjectId=a.backgroundObjectId),o.gsView.center.copy(a.center),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget),o.gsView.viewTarget.copy(a.viewTarget),a.lensLength&&(o.gsView.lensLength=a.lensLength),a.frontClippingPlane&&(o.gsView.frontClippingPlane=a.frontClippingPlane),a.backClippingPlane&&(o.gsView.backClippingPlane=a.backClippingPlane),a.viewHeight&&(o.gsView.viewHeight=a.viewHeight),a.viewTwistAngle&&(o.gsView.viewTwistAngle=a.viewTwistAngle),a.frozenLayers&&(o.gsView.frozenLayers=a.frozenLayers),a.styleSheet&&(o.gsView.styleSheet=a.styleSheet),a.renderMode&&(o.gsView.renderMode=a.renderMode),a.viewMode&&(o.gsView.viewMode=a.viewMode),a.ucsIconSetting&&(o.gsView.ucsIconSetting=a.ucsIconSetting),a.ucsOrigin&&o.gsView.ucsOrigin.copy(a.ucsOrigin),a.ucsXAxis&&o.gsView.ucsXAxis.copy(a.ucsXAxis),a.ucsYAxis&&o.gsView.ucsYAxis.copy(a.ucsYAxis),a.orthographicType&&(o.gsView.orthographicType=a.orthographicType),a.shadePlotSetting&&(o.gsView.shadePlotSetting=a.shadePlotSetting),a.shadePlotObjectId&&(o.gsView.shadePlotObjectId=a.shadePlotObjectId),a.visualStyleObjectId&&(o.gsView.visualStyleObjectId=a.visualStyleObjectId),a.isDefaultLightingOn&&(o.gsView.isDefaultLightingOn=a.isDefaultLightingOn),a.defaultLightingType&&(o.gsView.defaultLightingType=a.defaultLightingType),a.brightness&&(o.gsView.brightness=a.brightness),a.contrast&&(o.gsView.contrast=a.contrast),a.ambientColor&&(o.gsView.ambientColor=a.ambientColor),e.tables.viewportTable.add(o)})}processLayers(t,e){var r,i;const s=(i=(r=t.tables)==null?void 0:r.LAYER)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new zt;o.colorIndex=a.colorIndex;const c=new cn({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,c),e.tables.layerTable.add(c)})}processLineTypes(t,e){var r,i;const s=(i=(r=t.tables)==null?void 0:r.LTYPE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new ra(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,e.tables.linetypeTable.add(o)})}processTextStyles(t,e){var r;const s=(r=t.tables.STYLE)==null?void 0:r.entries;s&&s.length>0&&s.forEach(i=>{const a=new ia(i);this.processCommonTableEntryAttrs(i,a),e.tables.textStyleTable.add(a)})}processDimStyles(t,e){var r;const s=(r=t.tables.DIMSTYLE)==null?void 0:r.entries;s&&s.length>0&&s.forEach(i=>{const a={name:i.name,ownerId:i.ownerObjectId,dimpost:i.DIMPOST||"",dimapost:i.DIMAPOST||"",dimscale:i.DIMSCALE,dimasz:i.DIMASZ,dimexo:i.DIMEXO,dimdli:i.DIMDLI,dimexe:i.DIMEXE,dimrnd:i.DIMRND,dimdle:i.DIMDLE,dimtp:i.DIMTP,dimtm:i.DIMTM,dimtxt:i.DIMTXT,dimcen:i.DIMCEN,dimtsz:i.DIMTSZ,dimaltf:i.DIMALTF,dimlfac:i.DIMLFAC,dimtvp:i.DIMTVP,dimtfac:i.DIMTFAC,dimgap:i.DIMGAP,dimaltrnd:i.DIMALTRND,dimtol:i.DIMTOL==null||i.DIMTOL==0?0:1,dimlim:i.DIMLIM==null||i.DIMLIM==0?0:1,dimtih:i.DIMTIH==null||i.DIMTIH==0?0:1,dimtoh:i.DIMTOH==null||i.DIMTOH==0?0:1,dimse1:i.DIMSE1==null||i.DIMSE1==0?0:1,dimse2:i.DIMSE2==null||i.DIMSE2==0?0:1,dimtad:i.DIMTAD,dimzin:i.DIMZIN,dimazin:i.DIMAZIN,dimalt:i.DIMALT,dimaltd:i.DIMALTD,dimtofl:i.DIMTOFL,dimsah:i.DIMSAH,dimtix:i.DIMTIX,dimsoxd:i.DIMSOXD,dimclrd:i.DIMCLRD,dimclre:i.DIMCLRE,dimclrt:i.DIMCLRT,dimadec:i.DIMADEC||0,dimunit:i.DIMUNIT||2,dimdec:i.DIMDEC,dimtdec:i.DIMTDEC,dimaltu:i.DIMALTU,dimalttd:i.DIMALTTD,dimaunit:i.DIMAUNIT,dimfrac:i.DIMFRAC,dimlunit:i.DIMLUNIT,dimdsep:i.DIMDSEP,dimtmove:i.DIMTMOVE||0,dimjust:i.DIMJUST,dimsd1:i.DIMSD1,dimsd2:i.DIMSD2,dimtolj:i.DIMTOLJ,dimtzin:i.DIMTZIN,dimaltz:i.DIMALTZ,dimalttz:i.DIMALTTZ,dimfit:i.DIMFIT||0,dimupt:i.DIMUPT,dimatfit:i.DIMATFIT,dimtxsty:i.DIMTXSTY||"Standard",dimldrblk:i.DIMLDRBLK||"",dimblk:i.DIMBLK||"",dimblk1:i.DIMBLK1||"",dimblk2:i.DIMBLK2||"",dimlwd:i.DIMLWD,dimlwe:i.DIMLWE},o=new Oe(a);this.processCommonTableEntryAttrs(i,o),e.tables.dimStyleTable.add(o)})}processCommonTableEntryAttrs(t,e){e.name=t.name,e.objectId=t.handle,e.ownerId=t.ownerObjectId}}var hn=(n=>(n.DXF="dxf",n.DWG="dwg",n))(hn||{});class yt{constructor(){this.events={registered:new st,unregistered:new st},this._converters=new Map,this.register("dxf",new Yi)}static createInstance(){return yt._instance==null&&(yt._instance=new yt),this._instance}static get instance(){return yt._instance||(yt._instance=new yt),yt._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 Zt extends Rt{constructor(t,e){t=t||{},ee(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const he=class he extends Zt{constructor(){super(),this._origin=new b,this._entities=new Map}get isModelSapce(){return this.name.toLowerCase()==he.MODEL_SPACE_NAME.toLowerCase()}get isPaperSapce(){return this.name.toLowerCase().startsWith(he.PAPER_SPACE_NAME_PREFIX.toLowerCase())}get origin(){return this._origin}set origin(t){this._origin.copy(t)}appendEntity(t){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 Xe(this._entities)}getIdAt(t){return this._entities.get(t)}};he.MODEL_SPACE_NAME="*Model_Space",he.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let Mt=he;class Qt extends Rt{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}add(t){t.database=this.database,this._recordsByName.set(t.name,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this._recordsByName.get(t);return e?(this._recordsById.delete(e.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){return this._recordsByName.has(t)}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){let e;return this._recordsById.forEach((s,r)=>{s.ownerId==t&&(e=this._recordsById.get(r))}),e}newIterator(){return new Xe(this._recordsByName)}}class qi extends Qt{constructor(t){super(t)}get modelSpace(){let t=this.getAt(Mt.MODEL_SPACE_NAME);return t||(t=new Mt,t.name=Mt.MODEL_SPACE_NAME,this.add(t)),t}}class Xi extends Qt{constructor(t){super(t)}}class cn extends Zt{constructor(t,e){t=t||{},ee(t,{color:new zt,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==1}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)}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}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 $i extends Qt{constructor(t){super(t);const e=new zt;e.color=16777215;const s=new cn({name:"0",standardFlags:0,linetype:Ye,lineWeight:1,isOff:!1,color:e,isPlottable:!0});this.add(s)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class Ki extends Qt{constructor(t){super(t)}}class Zi extends Qt{constructor(t){super(t)}get fonts(){const t=new Set,e=r=>{if(r){const i=r.lastIndexOf(".");if(i>=0){const a=r.substring(0,i).toLowerCase();t.add(a)}else t.add(r.toLowerCase())}},s=this.newIterator();for(const r of s)e(r.fileName),e(r.bigFontFileName);return Array.from(t)}}class Qi extends Qt{constructor(t){super(t)}}class il extends Rt{constructor(){super(),this.events={entityAppended:new st,entityModified:new st,layerAppended:new st,layerModified:new st,layerErased:new st,openProgress:new st,headerSysVarChanged:new st},this._angBase=0,this._angDir=0,this._aunits=Os.DecimalDegrees,this._celtscale=1,this._cecolor=new zt,this._insunits=Ns.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new qi(this),dimStyleTable:new Xi(this),linetypeTable:new Ki(this),textStyleTable:new Zi(this),layerTable:new $i(this),viewportTable:new Qi(this)},this._dictionaries={layouts:new Ui(this),imageDefs:new ln(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 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 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,s=hn.DXF){const r=yt.instance.get(s);if(r==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await r.read(t,this,e&&e.minimumChunkSize||10,async(i,a,o,c)=>{if(this.events.openProgress.dispatch({database:this,percentage:i,stage:a,stageStatus:o}),e&&e.fontLoader&&a=="FONT"&&o=="END"){const h=c||this.tables.textStyleTable.fonts;await e.fontLoader.load(h)}})}async openUri(t,e){const r=await(await fetch(t)).blob(),i=new FileReader;i.onload=a=>{var c;const o=(c=a.target)==null?void 0:c.result;o&&this.read(o,e)},i.readAsText(r)}clear(){this.tables.blockTable.removeAll(),this.tables.dimStyleTable.removeAll(),this.tables.layerTable.removeAll(),this.tables.linetypeTable.removeAll(),this.tables.textStyleTable.removeAll(),this.tables.viewportTable.removeAll(),this.dictionaries.layouts.removeAll(),this._currentSpace=void 0}triggerHeaderSysVarChangedEvent(t){this.events.headerSysVarChanged.dispatch({database:this,name:t})}}var Ji=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(Ji||{}),ta=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(ta||{}),ea=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(ea||{}),sa=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(sa||{}),na=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(na||{});const ls=class ls extends Zt{constructor(t,e){t=t||{},ee(t,ls.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)}};ls.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 Oe=ls;class ra extends Zt{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}}class ia extends Zt{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}}const al={center:new L,viewDirectionFromTarget:new b(0,0,1),viewTarget:new b(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:en.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new b(0,0,0),ucsXAxis:new b(1,0,0),ucsYAxis:new b(0,1,0),orthographicType:sn.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:nn.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class aa extends Zt{constructor(){super(),this._circleSides=100,this._center=new L,this._lowerLeftCorner=new L(0,0),this._upperRightCorner=new L(1,1),this._snapBase=new L(0,0),this._snapAngle=0,this._snapSpacing=new L(0,0),this._standardFlag=0,this._gridSpacing=new L,this._gridMajor=10,this._gsView=al}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 oa{constructor(){this.events={layoutSwitched:new st}}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 s=this.getWorkingDatabase(e),r=s.dictionaries.layouts.getIdAt(t);return this.setCurrentLayoutInternal(r,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),r=s.dictionaries.layouts.getBtrIdAt(t);return this.setCurrentLayoutInternal(r,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),r=s.dictionaries.layouts.getAt(t);return this.setCurrentLayoutInternal(r,s)}renameLayout(t,e,s){const i=this.getWorkingDatabase(s).dictionaries.layouts.getAt(t);return i?(i.layoutName=e,!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.has(t)}deleteLayout(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.remove(t)}createLayout(t,e){const s=this.getWorkingDatabase(e),r=new on;r.layoutName=t,r.tabOrder=s.dictionaries.layouts.maxTabOrder;const i=new Mt;return i.name=`*Paper_Space${r.tabOrder}`,s.tables.blockTable.add(i),s.dictionaries.layouts.setAt(t,r),{layout:r,btr:i}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.dictionaries.layouts.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||dn().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function dn(){return os.instance}const hs=class hs{constructor(){this._workingDatabase=null,this._layoutManager=new oa}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}};hs.instance=new hs;let os=hs;g.AcCmColor=zt,g.AcCmErrors=et,g.AcCmEventDispatcher=ga,g.AcCmEventManager=st,g.AcCmLoader=Aa,g.AcCmLoadingManager=wn,g.AcCmObject=fn,g.AcCmPerformanceCollector=fs,g.AcCmTask=xn,g.AcCmTaskScheduler=bn,g.AcDb3PointAngularDimension=Fi,g.AcDbAlignedDimension=Bi,g.AcDbAngleUnits=Os,g.AcDbArc=mi,g.AcDbArcDimension=nl,g.AcDbBatchProcessing=Pn,g.AcDbBlockReference=Js,g.AcDbBlockTable=qi,g.AcDbBlockTableRecord=Mt,g.AcDbCircle=gi,g.AcDbCurve=gt,g.AcDbDatabase=il,g.AcDbDatabaseConverter=Tr,g.AcDbDatabaseConverterManager=yt,g.AcDbDiametricDimension=Vi,g.AcDbDictionary=ln,g.AcDbDimArrowType=Ir,g.AcDbDimStyleTable=Xi,g.AcDbDimStyleTableRecord=Oe,g.AcDbDimTextHorizontal=Ji,g.AcDbDimTextVertical=ta,g.AcDbDimVerticalJustification=na,g.AcDbDimZeroSuppression=ea,g.AcDbDimZeroSuppressionAngular=sa,g.AcDbDimension=Kt,g.AcDbDxfConverter=Yi,g.AcDbEllipse=ui,g.AcDbEntity=pt,g.AcDbFileType=hn,g.AcDbHatch=_i,g.AcDbHatchPatternType=pi,g.AcDbHatchStyle=yi,g.AcDbHostApplicationServices=os,g.AcDbLayerTable=$i,g.AcDbLayerTableRecord=cn,g.AcDbLayout=on,g.AcDbLayoutDictionary=Ui,g.AcDbLayoutManager=oa,g.AcDbLeader=xi,g.AcDbLeaderAnnotationType=fi,g.AcDbLine=bi,g.AcDbLineSpacingStyle=zi,g.AcDbLinetypeTable=Ki,g.AcDbLinetypeTableRecord=ra,g.AcDbMText=wi,g.AcDbObject=Rt,g.AcDbObjectIterator=Xe,g.AcDbOrdinateDimension=ji,g.AcDbOsnapMode=Ut,g.AcDbPoint=vi,g.AcDbPolyline=Mi,g.AcDbRadialDimension=Gi,g.AcDbRasterImage=an,g.AcDbRasterImageClipBoundaryType=Li,g.AcDbRasterImageDef=Wi,g.AcDbRasterImageImageDisplayOpt=ki,g.AcDbRay=Oi,g.AcDbRenderingCache=kt,g.AcDbSpline=rn,g.AcDbSymbolTable=Qt,g.AcDbSymbolTableRecord=Zt,g.AcDbTable=Ai,g.AcDbText=Ti,g.AcDbTextHorizontalMode=Ii,g.AcDbTextStyleTable=Zi,g.AcDbTextStyleTableRecord=ia,g.AcDbTextVerticalMode=Ei,g.AcDbTrace=Si,g.AcDbUnitsValue=Ns,g.AcDbViewport=Ni,g.AcDbViewportTable=Qi,g.AcDbViewportTableRecord=aa,g.AcDbWipeout=Di,g.AcDbXline=Ri,g.AcGeArea2d=Qe,g.AcGeBox2d=K,g.AcGeBox3d=O,g.AcGeCatmullRomCurve3d=hi,g.AcGeCircArc2d=oe,g.AcGeCircArc3d=Xt,g.AcGeCurve2d=ae,g.AcGeEllipseArc2d=ts,g.AcGeEllipseArc3d=es,g.AcGeEuler=ii,g.AcGeGeometryUtil=Xr,g.AcGeLine2d=ss,g.AcGeLine3d=Nt,g.AcGeLoop2d=li,g.AcGeMathUtil=C,g.AcGeMatrix2d=$e,g.AcGeMatrix3d=Yt,g.AcGeNurbsCurve=mt,g.AcGePlane=Le,g.AcGePoint2d=L,g.AcGePoint3d=b,g.AcGePolyline2d=Ce,g.AcGeQuaternion=Ct,g.AcGeShape2d=Ks,g.AcGeSpline3d=Dt,g.AcGeTol=Us,g.AcGeVector2d=B,g.AcGeVector3d=w,g.AcGiArrowType=tn,g.AcGiDefaultLightingType=nn,g.AcGiMTextAttachmentPoint=le,g.AcGiMTextFlowDirection=rs,g.AcGiOrthographicType=sn,g.AcGiRenderMode=en,g.AcGiViewport=is,g.AcTrStringUtil=wa,g.ByBlock=Pr,g.ByLayer=qe,g.DEBUG_MODE=xa,g.DEFAULT_LINE_TYPE=Ye,g.DEFAULT_TOL=Ws,g.DEG2RAD=Ds,g.DefaultLoadingManager=An,g.FLOAT_TOL=Wt,g.ORIGIN_POINT_2D=Xo,g.ORIGIN_POINT_3D=Hs,g.RAD2DEG=Rs,g.TAU=H,g.acdbHostApplicationServices=dn,g.basisFunction=Ke,g.calculateCurveLength=Qr,g.ceilPowerOfTwo=Gr,g.clamp=Tt,g.clone=me,g.damp=kr,g.defaults=ee,g.degToRad=Br,g.euclideanModulo=zs,g.evaluateNurbsPoint=ve,g.floorPowerOfTwo=Hr,g.generateChordKnots=Kr,g.generateSqrtChordKnots=Zr,g.generateUUID=Mr,g.generateUniformKnots=$r,g.has=yn,g.intPartLength=Bs,g.interpolateControlPoints=$o,g.inverseLerp=Lr,g.isBetween=Ur,g.isBetweenAngle=Wr,g.isEmpty=_n,g.isEqual=se,g.isImperialUnits=qo,g.isMetricUnits=Yo,g.isPointInPolygon=Ys,g.isPolygonIntersect=qr,g.isPowerOfTwo=jr,g.lerp=Fs,g.log=ue,g.mapLinear=vr,g.normalizeAngle=Me,g.pingpong=Cr,g.radToDeg=Vr,g.randFloat=Rr,g.randFloatSpread=zr,g.randInt=Dr,g.relativeEps=Yr,g.seededRandom=Fr,g.setLogLevel=ba,g.smootherstep=Nr,g.smoothstep=Or,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|