@mlightcad/data-model 1.0.1 → 1.0.3
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 +2368 -14796
- package/dist/data-model.umd.cjs +2 -5
- package/package.json +8 -4
- package/README.md +0 -116
- package/lib/database/AcDbDatabaseConverterRegister.d.ts +0 -54
- package/lib/database/AcDbDatabaseConverterRegister.d.ts.map +0 -1
- package/lib/database/AcDbDatabaseConverterRegister.js +0 -84
- package/lib/database/AcDbDatabaseConverterRegister.js.map +0 -1
package/dist/data-model.umd.cjs
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
(function(L,br){typeof exports=="object"&&typeof module<"u"?br(exports):typeof define=="function"&&define.amd?define(["exports"],br):(L=typeof globalThis<"u"?globalThis:L||self,br(L["data-model"]={}))})(this,function(L){"use strict";var br=typeof global=="object"&&global&&global.Object===Object&&global,oh=typeof self=="object"&&self&&self.Object===Object&&self,nn=br||oh||Function("return this")(),rn=nn.Symbol,Za=Object.prototype,lh=Za.hasOwnProperty,ch=Za.toString,$r=rn?rn.toStringTag:void 0;function uh(r){var e=lh.call(r,$r),t=r[$r];try{r[$r]=void 0;var s=!0}catch{}var l=ch.call(r);return s&&(e?r[$r]=t:delete r[$r]),l}var hh=Object.prototype,dh=hh.toString;function fh(r){return dh.call(r)}var mh="[object Null]",gh="[object Undefined]",Qa=rn?rn.toStringTag:void 0;function xr(r){return r==null?r===void 0?gh:mh:Qa&&Qa in Object(r)?uh(r):fh(r)}function Nn(r){return r!=null&&typeof r=="object"}var ph="[object Symbol]";function ks(r){return typeof r=="symbol"||Nn(r)&&xr(r)==ph}function _h(r,e){for(var t=-1,s=r==null?0:r.length,l=Array(s);++t<s;)l[t]=e(r[t],t,r);return l}var sn=Array.isArray,vh=1/0,Ja=rn?rn.prototype:void 0,eo=Ja?Ja.toString:void 0;function to(r){if(typeof r=="string")return r;if(sn(r))return _h(r,to)+"";if(ks(r))return eo?eo.call(r):"";var e=r+"";return e=="0"&&1/r==-vh?"-0":e}function wr(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function no(r){return r}var yh="[object AsyncFunction]",bh="[object Function]",xh="[object GeneratorFunction]",wh="[object Proxy]";function ro(r){if(!wr(r))return!1;var e=xr(r);return e==bh||e==xh||e==yh||e==wh}var Cs=nn["__core-js_shared__"],io=function(){var r=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function Ah(r){return!!io&&io in r}var Ph=Function.prototype,Sh=Ph.toString;function Xn(r){if(r!=null){try{return Sh.call(r)}catch{}try{return r+""}catch{}}return""}var Ih=/[\\^$.*+?()[\]{}|]/g,Eh=/^\[object .+?Constructor\]$/,Th=Function.prototype,Mh=Object.prototype,kh=Th.toString,Ch=Mh.hasOwnProperty,Lh=RegExp("^"+kh.call(Ch).replace(Ih,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nh(r){if(!wr(r)||Ah(r))return!1;var e=ro(r)?Lh:Eh;return e.test(Xn(r))}function Oh(r,e){return r==null?void 0:r[e]}function Zn(r,e){var t=Oh(r,e);return Nh(t)?t:void 0}var Ls=Zn(nn,"WeakMap"),so=Object.create,Dh=function(){function r(){}return function(e){if(!wr(e))return{};if(so)return so(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}();function zh(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function Rh(r,e){var t=-1,s=r.length;for(e||(e=Array(s));++t<s;)e[t]=r[t];return e}var Bh=800,Fh=16,Vh=Date.now;function jh(r){var e=0,t=0;return function(){var s=Vh(),l=Fh-(s-t);if(t=s,l>0){if(++e>=Bh)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}function Uh(r){return function(){return r}}var Vi=function(){try{var r=Zn(Object,"defineProperty");return r({},"",{}),r}catch{}}(),Gh=Vi?function(r,e){return Vi(r,"toString",{configurable:!0,enumerable:!1,value:Uh(e),writable:!0})}:no,Hh=jh(Gh);function $h(r,e){for(var t=-1,s=r==null?0:r.length;++t<s&&e(r[t],t,r)!==!1;);return r}var Wh=9007199254740991,qh=/^(?:0|[1-9]\d*)$/;function Ns(r,e){var t=typeof r;return e=e??Wh,!!e&&(t=="number"||t!="symbol"&&qh.test(r))&&r>-1&&r%1==0&&r<e}function ao(r,e,t){e=="__proto__"&&Vi?Vi(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}function Wr(r,e){return r===e||r!==r&&e!==e}var Kh=Object.prototype,Yh=Kh.hasOwnProperty;function oo(r,e,t){var s=r[e];(!(Yh.call(r,e)&&Wr(s,t))||t===void 0&&!(e in r))&&ao(r,e,t)}function ji(r,e,t,s){var l=!t;t||(t={});for(var c=-1,h=e.length;++c<h;){var v=e[c],b=void 0;b===void 0&&(b=r[v]),l?ao(t,v,b):oo(t,v,b)}return t}var lo=Math.max;function Xh(r,e,t){return e=lo(e===void 0?r.length-1:e,0),function(){for(var s=arguments,l=-1,c=lo(s.length-e,0),h=Array(c);++l<c;)h[l]=s[e+l];l=-1;for(var v=Array(e+1);++l<e;)v[l]=s[l];return v[e]=t(h),zh(r,this,v)}}function Zh(r,e){return Hh(Xh(r,e,no),r+"")}var Qh=9007199254740991;function Os(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Qh}function Ui(r){return r!=null&&Os(r.length)&&!ro(r)}function Jh(r,e,t){if(!wr(t))return!1;var s=typeof e;return(s=="number"?Ui(t)&&Ns(e,t.length):s=="string"&&e in t)?Wr(t[e],r):!1}var ed=Object.prototype;function Gi(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||ed;return r===t}function td(r,e){for(var t=-1,s=Array(r);++t<r;)s[t]=e(t);return s}var nd="[object Arguments]";function co(r){return Nn(r)&&xr(r)==nd}var uo=Object.prototype,rd=uo.hasOwnProperty,id=uo.propertyIsEnumerable,Ds=co(function(){return arguments}())?co:function(r){return Nn(r)&&rd.call(r,"callee")&&!id.call(r,"callee")};function sd(){return!1}var ho=typeof L=="object"&&L&&!L.nodeType&&L,fo=ho&&typeof module=="object"&&module&&!module.nodeType&&module,ad=fo&&fo.exports===ho,mo=ad?nn.Buffer:void 0,od=mo?mo.isBuffer:void 0,qr=od||sd,ld="[object Arguments]",cd="[object Array]",ud="[object Boolean]",hd="[object Date]",dd="[object Error]",fd="[object Function]",md="[object Map]",gd="[object Number]",pd="[object Object]",_d="[object RegExp]",vd="[object Set]",yd="[object String]",bd="[object WeakMap]",xd="[object ArrayBuffer]",wd="[object DataView]",Ad="[object Float32Array]",Pd="[object Float64Array]",Sd="[object Int8Array]",Id="[object Int16Array]",Ed="[object Int32Array]",Td="[object Uint8Array]",Md="[object Uint8ClampedArray]",kd="[object Uint16Array]",Cd="[object Uint32Array]",Ge={};Ge[Ad]=Ge[Pd]=Ge[Sd]=Ge[Id]=Ge[Ed]=Ge[Td]=Ge[Md]=Ge[kd]=Ge[Cd]=!0,Ge[ld]=Ge[cd]=Ge[xd]=Ge[ud]=Ge[wd]=Ge[hd]=Ge[dd]=Ge[fd]=Ge[md]=Ge[gd]=Ge[pd]=Ge[_d]=Ge[vd]=Ge[yd]=Ge[bd]=!1;function Ld(r){return Nn(r)&&Os(r.length)&&!!Ge[xr(r)]}function zs(r){return function(e){return r(e)}}var go=typeof L=="object"&&L&&!L.nodeType&&L,Kr=go&&typeof module=="object"&&module&&!module.nodeType&&module,Nd=Kr&&Kr.exports===go,Rs=Nd&&br.process,Ar=function(){try{var r=Kr&&Kr.require&&Kr.require("util").types;return r||Rs&&Rs.binding&&Rs.binding("util")}catch{}}(),po=Ar&&Ar.isTypedArray,Bs=po?zs(po):Ld,Od=Object.prototype,Dd=Od.hasOwnProperty;function _o(r,e){var t=sn(r),s=!t&&Ds(r),l=!t&&!s&&qr(r),c=!t&&!s&&!l&&Bs(r),h=t||s||l||c,v=h?td(r.length,String):[],b=v.length;for(var p in r)(e||Dd.call(r,p))&&!(h&&(p=="length"||l&&(p=="offset"||p=="parent")||c&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Ns(p,b)))&&v.push(p);return v}function vo(r,e){return function(t){return r(e(t))}}var zd=vo(Object.keys,Object),Rd=Object.prototype,Bd=Rd.hasOwnProperty;function yo(r){if(!Gi(r))return zd(r);var e=[];for(var t in Object(r))Bd.call(r,t)&&t!="constructor"&&e.push(t);return e}function Fs(r){return Ui(r)?_o(r):yo(r)}function Fd(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Vd=Object.prototype,jd=Vd.hasOwnProperty;function Ud(r){if(!wr(r))return Fd(r);var e=Gi(r),t=[];for(var s in r)s=="constructor"&&(e||!jd.call(r,s))||t.push(s);return t}function Hi(r){return Ui(r)?_o(r,!0):Ud(r)}var Gd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hd=/^\w*$/;function $d(r,e){if(sn(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||ks(r)?!0:Hd.test(r)||!Gd.test(r)||e!=null&&r in Object(e)}var Yr=Zn(Object,"create");function Wd(){this.__data__=Yr?Yr(null):{},this.size=0}function qd(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Kd="__lodash_hash_undefined__",Yd=Object.prototype,Xd=Yd.hasOwnProperty;function Zd(r){var e=this.__data__;if(Yr){var t=e[r];return t===Kd?void 0:t}return Xd.call(e,r)?e[r]:void 0}var Qd=Object.prototype,Jd=Qd.hasOwnProperty;function e0(r){var e=this.__data__;return Yr?e[r]!==void 0:Jd.call(e,r)}var t0="__lodash_hash_undefined__";function n0(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Yr&&e===void 0?t0:e,this}function Qn(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var s=r[e];this.set(s[0],s[1])}}Qn.prototype.clear=Wd,Qn.prototype.delete=qd,Qn.prototype.get=Zd,Qn.prototype.has=e0,Qn.prototype.set=n0;function r0(){this.__data__=[],this.size=0}function $i(r,e){for(var t=r.length;t--;)if(Wr(r[t][0],e))return t;return-1}var i0=Array.prototype,s0=i0.splice;function a0(r){var e=this.__data__,t=$i(e,r);if(t<0)return!1;var s=e.length-1;return t==s?e.pop():s0.call(e,t,1),--this.size,!0}function o0(r){var e=this.__data__,t=$i(e,r);return t<0?void 0:e[t][1]}function l0(r){return $i(this.__data__,r)>-1}function c0(r,e){var t=this.__data__,s=$i(t,r);return s<0?(++this.size,t.push([r,e])):t[s][1]=e,this}function fn(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var s=r[e];this.set(s[0],s[1])}}fn.prototype.clear=r0,fn.prototype.delete=a0,fn.prototype.get=o0,fn.prototype.has=l0,fn.prototype.set=c0;var Xr=Zn(nn,"Map");function u0(){this.size=0,this.__data__={hash:new Qn,map:new(Xr||fn),string:new Qn}}function h0(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function Wi(r,e){var t=r.__data__;return h0(e)?t[typeof e=="string"?"string":"hash"]:t.map}function d0(r){var e=Wi(this,r).delete(r);return this.size-=e?1:0,e}function f0(r){return Wi(this,r).get(r)}function m0(r){return Wi(this,r).has(r)}function g0(r,e){var t=Wi(this,r),s=t.size;return t.set(r,e),this.size+=t.size==s?0:1,this}function mn(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var s=r[e];this.set(s[0],s[1])}}mn.prototype.clear=u0,mn.prototype.delete=d0,mn.prototype.get=f0,mn.prototype.has=m0,mn.prototype.set=g0;var p0="Expected a function";function Vs(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(p0);var t=function(){var s=arguments,l=e?e.apply(this,s):s[0],c=t.cache;if(c.has(l))return c.get(l);var h=r.apply(this,s);return t.cache=c.set(l,h)||c,h};return t.cache=new(Vs.Cache||mn),t}Vs.Cache=mn;var _0=500;function v0(r){var e=Vs(r,function(s){return t.size===_0&&t.clear(),s}),t=e.cache;return e}var y0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,b0=/\\(\\)?/g,x0=v0(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(y0,function(t,s,l,c){e.push(l?c.replace(b0,"$1"):s||t)}),e});function w0(r){return r==null?"":to(r)}function A0(r,e){return sn(r)?r:$d(r,e)?[r]:x0(w0(r))}var P0=1/0;function S0(r){if(typeof r=="string"||ks(r))return r;var e=r+"";return e=="0"&&1/r==-P0?"-0":e}function bo(r,e){for(var t=-1,s=e.length,l=r.length;++t<s;)r[l+t]=e[t];return r}var xo=vo(Object.getPrototypeOf,Object);function I0(){this.__data__=new fn,this.size=0}function E0(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function T0(r){return this.__data__.get(r)}function M0(r){return this.__data__.has(r)}var k0=200;function C0(r,e){var t=this.__data__;if(t instanceof fn){var s=t.__data__;if(!Xr||s.length<k0-1)return s.push([r,e]),this.size=++t.size,this;t=this.__data__=new mn(s)}return t.set(r,e),this.size=t.size,this}function gn(r){var e=this.__data__=new fn(r);this.size=e.size}gn.prototype.clear=I0,gn.prototype.delete=E0,gn.prototype.get=T0,gn.prototype.has=M0,gn.prototype.set=C0;function L0(r,e){return r&&ji(e,Fs(e),r)}function N0(r,e){return r&&ji(e,Hi(e),r)}var wo=typeof L=="object"&&L&&!L.nodeType&&L,Ao=wo&&typeof module=="object"&&module&&!module.nodeType&&module,O0=Ao&&Ao.exports===wo,Po=O0?nn.Buffer:void 0,So=Po?Po.allocUnsafe:void 0;function D0(r,e){if(e)return r.slice();var t=r.length,s=So?So(t):new r.constructor(t);return r.copy(s),s}function z0(r,e){for(var t=-1,s=r==null?0:r.length,l=0,c=[];++t<s;){var h=r[t];e(h,t,r)&&(c[l++]=h)}return c}function Io(){return[]}var R0=Object.prototype,B0=R0.propertyIsEnumerable,Eo=Object.getOwnPropertySymbols,js=Eo?function(r){return r==null?[]:(r=Object(r),z0(Eo(r),function(e){return B0.call(r,e)}))}:Io;function F0(r,e){return ji(r,js(r),e)}var V0=Object.getOwnPropertySymbols,To=V0?function(r){for(var e=[];r;)bo(e,js(r)),r=xo(r);return e}:Io;function j0(r,e){return ji(r,To(r),e)}function Mo(r,e,t){var s=e(r);return sn(r)?s:bo(s,t(r))}function Us(r){return Mo(r,Fs,js)}function U0(r){return Mo(r,Hi,To)}var Gs=Zn(nn,"DataView"),Hs=Zn(nn,"Promise"),$s=Zn(nn,"Set"),ko="[object Map]",G0="[object Object]",Co="[object Promise]",Lo="[object Set]",No="[object WeakMap]",Oo="[object DataView]",H0=Xn(Gs),$0=Xn(Xr),W0=Xn(Hs),q0=Xn($s),K0=Xn(Ls),Ft=xr;(Gs&&Ft(new Gs(new ArrayBuffer(1)))!=Oo||Xr&&Ft(new Xr)!=ko||Hs&&Ft(Hs.resolve())!=Co||$s&&Ft(new $s)!=Lo||Ls&&Ft(new Ls)!=No)&&(Ft=function(r){var e=xr(r),t=e==G0?r.constructor:void 0,s=t?Xn(t):"";if(s)switch(s){case H0:return Oo;case $0:return ko;case W0:return Co;case q0:return Lo;case K0:return No}return e});var Y0=Object.prototype,X0=Y0.hasOwnProperty;function Z0(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&X0.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var qi=nn.Uint8Array;function Ws(r){var e=new r.constructor(r.byteLength);return new qi(e).set(new qi(r)),e}function Q0(r,e){var t=e?Ws(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var J0=/\w*$/;function ef(r){var e=new r.constructor(r.source,J0.exec(r));return e.lastIndex=r.lastIndex,e}var Do=rn?rn.prototype:void 0,zo=Do?Do.valueOf:void 0;function tf(r){return zo?Object(zo.call(r)):{}}function nf(r,e){var t=e?Ws(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var rf="[object Boolean]",sf="[object Date]",af="[object Map]",of="[object Number]",lf="[object RegExp]",cf="[object Set]",uf="[object String]",hf="[object Symbol]",df="[object ArrayBuffer]",ff="[object DataView]",mf="[object Float32Array]",gf="[object Float64Array]",pf="[object Int8Array]",_f="[object Int16Array]",vf="[object Int32Array]",yf="[object Uint8Array]",bf="[object Uint8ClampedArray]",xf="[object Uint16Array]",wf="[object Uint32Array]";function Af(r,e,t){var s=r.constructor;switch(e){case df:return Ws(r);case rf:case sf:return new s(+r);case ff:return Q0(r,t);case mf:case gf:case pf:case _f:case vf:case yf:case bf:case xf:case wf:return nf(r,t);case af:return new s;case of:case uf:return new s(r);case lf:return ef(r);case cf:return new s;case hf:return tf(r)}}function Pf(r){return typeof r.constructor=="function"&&!Gi(r)?Dh(xo(r)):{}}var Sf="[object Map]";function If(r){return Nn(r)&&Ft(r)==Sf}var Ro=Ar&&Ar.isMap,Ef=Ro?zs(Ro):If,Tf="[object Set]";function Mf(r){return Nn(r)&&Ft(r)==Tf}var Bo=Ar&&Ar.isSet,kf=Bo?zs(Bo):Mf,Cf=1,Lf=2,Nf=4,Fo="[object Arguments]",Of="[object Array]",Df="[object Boolean]",zf="[object Date]",Rf="[object Error]",Vo="[object Function]",Bf="[object GeneratorFunction]",Ff="[object Map]",Vf="[object Number]",jo="[object Object]",jf="[object RegExp]",Uf="[object Set]",Gf="[object String]",Hf="[object Symbol]",$f="[object WeakMap]",Wf="[object ArrayBuffer]",qf="[object DataView]",Kf="[object Float32Array]",Yf="[object Float64Array]",Xf="[object Int8Array]",Zf="[object Int16Array]",Qf="[object Int32Array]",Jf="[object Uint8Array]",e1="[object Uint8ClampedArray]",t1="[object Uint16Array]",n1="[object Uint32Array]",Ve={};Ve[Fo]=Ve[Of]=Ve[Wf]=Ve[qf]=Ve[Df]=Ve[zf]=Ve[Kf]=Ve[Yf]=Ve[Xf]=Ve[Zf]=Ve[Qf]=Ve[Ff]=Ve[Vf]=Ve[jo]=Ve[jf]=Ve[Uf]=Ve[Gf]=Ve[Hf]=Ve[Jf]=Ve[e1]=Ve[t1]=Ve[n1]=!0,Ve[Rf]=Ve[Vo]=Ve[$f]=!1;function Ki(r,e,t,s,l,c){var h,v=e&Cf,b=e&Lf,p=e&Nf;if(h!==void 0)return h;if(!wr(r))return r;var S=sn(r);if(S){if(h=Z0(r),!v)return Rh(r,h)}else{var x=Ft(r),E=x==Vo||x==Bf;if(qr(r))return D0(r,v);if(x==jo||x==Fo||E&&!l){if(h=b||E?{}:Pf(r),!v)return b?j0(r,N0(h,r)):F0(r,L0(h,r))}else{if(!Ve[x])return l?r:{};h=Af(r,x,v)}}c||(c=new gn);var M=c.get(r);if(M)return M;c.set(r,h),kf(r)?r.forEach(function(j){h.add(Ki(j,e,t,j,r,c))}):Ef(r)&&r.forEach(function(j,F){h.set(F,Ki(j,e,t,F,r,c))});var D=p?b?U0:Us:b?Hi:Fs,R=S?void 0:D(r);return $h(R||r,function(j,F){R&&(F=j,j=r[F]),oo(h,F,Ki(j,e,t,F,r,c))}),h}var r1=4;function Yi(r){return Ki(r,r1)}var i1="__lodash_hash_undefined__";function s1(r){return this.__data__.set(r,i1),this}function a1(r){return this.__data__.has(r)}function Xi(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new mn;++e<t;)this.add(r[e])}Xi.prototype.add=Xi.prototype.push=s1,Xi.prototype.has=a1;function o1(r,e){for(var t=-1,s=r==null?0:r.length;++t<s;)if(e(r[t],t,r))return!0;return!1}function l1(r,e){return r.has(e)}var c1=1,u1=2;function Uo(r,e,t,s,l,c){var h=t&c1,v=r.length,b=e.length;if(v!=b&&!(h&&b>v))return!1;var p=c.get(r),S=c.get(e);if(p&&S)return p==e&&S==r;var x=-1,E=!0,M=t&u1?new Xi:void 0;for(c.set(r,e),c.set(e,r);++x<v;){var D=r[x],R=e[x];if(s)var j=h?s(R,D,x,e,r,c):s(D,R,x,r,e,c);if(j!==void 0){if(j)continue;E=!1;break}if(M){if(!o1(e,function(F,he){if(!l1(M,he)&&(D===F||l(D,F,t,s,c)))return M.push(he)})){E=!1;break}}else if(!(D===R||l(D,R,t,s,c))){E=!1;break}}return c.delete(r),c.delete(e),E}function h1(r){var e=-1,t=Array(r.size);return r.forEach(function(s,l){t[++e]=[l,s]}),t}function d1(r){var e=-1,t=Array(r.size);return r.forEach(function(s){t[++e]=s}),t}var f1=1,m1=2,g1="[object Boolean]",p1="[object Date]",_1="[object Error]",v1="[object Map]",y1="[object Number]",b1="[object RegExp]",x1="[object Set]",w1="[object String]",A1="[object Symbol]",P1="[object ArrayBuffer]",S1="[object DataView]",Go=rn?rn.prototype:void 0,qs=Go?Go.valueOf:void 0;function I1(r,e,t,s,l,c,h){switch(t){case S1:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case P1:return!(r.byteLength!=e.byteLength||!c(new qi(r),new qi(e)));case g1:case p1:case y1:return Wr(+r,+e);case _1:return r.name==e.name&&r.message==e.message;case b1:case w1:return r==e+"";case v1:var v=h1;case x1:var b=s&f1;if(v||(v=d1),r.size!=e.size&&!b)return!1;var p=h.get(r);if(p)return p==e;s|=m1,h.set(r,e);var S=Uo(v(r),v(e),s,l,c,h);return h.delete(r),S;case A1:if(qs)return qs.call(r)==qs.call(e)}return!1}var E1=1,T1=Object.prototype,M1=T1.hasOwnProperty;function k1(r,e,t,s,l,c){var h=t&E1,v=Us(r),b=v.length,p=Us(e),S=p.length;if(b!=S&&!h)return!1;for(var x=b;x--;){var E=v[x];if(!(h?E in e:M1.call(e,E)))return!1}var M=c.get(r),D=c.get(e);if(M&&D)return M==e&&D==r;var R=!0;c.set(r,e),c.set(e,r);for(var j=h;++x<b;){E=v[x];var F=r[E],he=e[E];if(s)var _e=h?s(he,F,E,e,r,c):s(F,he,E,r,e,c);if(!(_e===void 0?F===he||l(F,he,t,s,c):_e)){R=!1;break}j||(j=E=="constructor")}if(R&&!j){var de=r.constructor,H=e.constructor;de!=H&&"constructor"in r&&"constructor"in e&&!(typeof de=="function"&&de instanceof de&&typeof H=="function"&&H instanceof H)&&(R=!1)}return c.delete(r),c.delete(e),R}var C1=1,Ho="[object Arguments]",$o="[object Array]",Zi="[object Object]",L1=Object.prototype,Wo=L1.hasOwnProperty;function N1(r,e,t,s,l,c){var h=sn(r),v=sn(e),b=h?$o:Ft(r),p=v?$o:Ft(e);b=b==Ho?Zi:b,p=p==Ho?Zi:p;var S=b==Zi,x=p==Zi,E=b==p;if(E&&qr(r)){if(!qr(e))return!1;h=!0,S=!1}if(E&&!S)return c||(c=new gn),h||Bs(r)?Uo(r,e,t,s,l,c):I1(r,e,b,t,s,l,c);if(!(t&C1)){var M=S&&Wo.call(r,"__wrapped__"),D=x&&Wo.call(e,"__wrapped__");if(M||D){var R=M?r.value():r,j=D?e.value():e;return c||(c=new gn),l(R,j,t,s,c)}}return E?(c||(c=new gn),k1(r,e,t,s,l,c)):!1}function qo(r,e,t,s,l){return r===e?!0:r==null||e==null||!Nn(r)&&!Nn(e)?r!==r&&e!==e:N1(r,e,t,s,qo,l)}function O1(r,e,t){e=A0(e,r);for(var s=-1,l=e.length,c=!1;++s<l;){var h=S0(e[s]);if(!(c=r!=null&&t(r,h)))break;r=r[h]}return c||++s!=l?c:(l=r==null?0:r.length,!!l&&Os(l)&&Ns(h,l)&&(sn(r)||Ds(r)))}var Ko=Object.prototype,D1=Ko.hasOwnProperty,Zr=Zh(function(r,e){r=Object(r);var t=-1,s=e.length,l=s>2?e[2]:void 0;for(l&&Jh(e[0],e[1],l)&&(s=1);++t<s;)for(var c=e[t],h=Hi(c),v=-1,b=h.length;++v<b;){var p=h[v],S=r[p];(S===void 0||Wr(S,Ko[p])&&!D1.call(r,p))&&(r[p]=c[p])}return r}),z1=Object.prototype,R1=z1.hasOwnProperty;function B1(r,e){return r!=null&&R1.call(r,e)}function F1(r,e){return r!=null&&O1(r,e,B1)}var V1="[object Map]",j1="[object Set]",U1=Object.prototype,G1=U1.hasOwnProperty;function H1(r){if(r==null)return!0;if(Ui(r)&&(sn(r)||typeof r=="string"||typeof r.splice=="function"||qr(r)||Bs(r)||Ds(r)))return!r.length;var e=Ft(r);if(e==V1||e==j1)return!r.size;if(Gi(r))return!yo(r).length;for(var t in r)if(G1.call(r,t))return!1;return!0}function Ks(r,e){return qo(r,e)}function $1(r,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in r)){const c=Object.getOwnPropertyDescriptor(s,l);c&&Object.defineProperty(r,l,c.get?c:{enumerable:!0,get:()=>s[l]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const Qi={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},Ys=[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 Qr(r,e,t){return Math.max(e,Math.min(t,r))}const Yo=class th{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(Qr(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=Qr(e,0,256),this._color=Ys[e],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(e){if(e){const t=Qi[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 l=Math.round(Qr(e,0,255)),c=Math.round(Qr(t,0,255)),h=Math.round(Qr(s,0,255));return this.color=(l<<16)+(c<<8)+h,this}setColorName(e){const t=Qi[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new th;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(Qi))if(s===e)return t;return null}getColorIndexByValue(e){const t=Ys.length-1;for(let s=1;s<t;++s)if(Ys[s]===e)return s;return null}};Yo.NAMES=Qi;let Jn=Yo;const Gt={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 W1{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 l=s.indexOf(t);l!==-1&&s.splice(l,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 l=0,c=s.length;l<c;l++)s[l].call(this,e)}}}let Tt=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 q1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function K1(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Xo={exports:{}};(function(r){(function(e,t){r.exports?r.exports=t():e.log=t()})(q1,function(){var e=function(){},t="undefined",s=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),l=["trace","debug","info","warn","error"],c={},h=null;function v(R,j){var F=R[j];if(typeof F.bind=="function")return F.bind(R);try{return Function.prototype.bind.call(F,R)}catch{return function(){return Function.prototype.apply.apply(F,[R,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function p(R){return R==="debug"&&(R="log"),typeof console===t?!1:R==="trace"&&s?b:console[R]!==void 0?v(console,R):console.log!==void 0?v(console,"log"):e}function S(){for(var R=this.getLevel(),j=0;j<l.length;j++){var F=l[j];this[F]=j<R?e:this.methodFactory(F,R,this.name)}if(this.log=this.debug,typeof console===t&&R<this.levels.SILENT)return"No console available for logging"}function x(R){return function(){typeof console!==t&&(S.call(this),this[R].apply(this,arguments))}}function E(R,j,F){return p(R)||x.apply(this,arguments)}function M(R,j){var F=this,he,_e,de,H="loglevel";typeof R=="string"?H+=":"+R:typeof R=="symbol"&&(H=void 0);function ge(xe){var Ne=(l[xe]||"silent").toUpperCase();if(!(typeof window===t||!H)){try{window.localStorage[H]=Ne;return}catch{}try{window.document.cookie=encodeURIComponent(H)+"="+Ne+";"}catch{}}}function ce(){var xe;if(!(typeof window===t||!H)){try{xe=window.localStorage[H]}catch{}if(typeof xe===t)try{var Ne=window.document.cookie,pt=encodeURIComponent(H),_t=Ne.indexOf(pt+"=");_t!==-1&&(xe=/^([^;]+)/.exec(Ne.slice(_t+pt.length+1))[1])}catch{}return F.levels[xe]===void 0&&(xe=void 0),xe}}function qe(){if(!(typeof window===t||!H)){try{window.localStorage.removeItem(H)}catch{}try{window.document.cookie=encodeURIComponent(H)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Ke(xe){var Ne=xe;if(typeof Ne=="string"&&F.levels[Ne.toUpperCase()]!==void 0&&(Ne=F.levels[Ne.toUpperCase()]),typeof Ne=="number"&&Ne>=0&&Ne<=F.levels.SILENT)return Ne;throw new TypeError("log.setLevel() called with invalid level: "+xe)}F.name=R,F.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},F.methodFactory=j||E,F.getLevel=function(){return de??_e??he},F.setLevel=function(xe,Ne){return de=Ke(xe),Ne!==!1&&ge(de),S.call(F)},F.setDefaultLevel=function(xe){_e=Ke(xe),ce()||F.setLevel(xe,!1)},F.resetLevel=function(){de=null,qe(),S.call(F)},F.enableAll=function(xe){F.setLevel(F.levels.TRACE,xe)},F.disableAll=function(xe){F.setLevel(F.levels.SILENT,xe)},F.rebuild=function(){if(h!==F&&(he=Ke(h.getLevel())),S.call(F),h===F)for(var xe in c)c[xe].rebuild()},he=Ke(h?h.getLevel():"WARN");var $e=ce();$e!=null&&(de=Ke($e)),S.call(F)}h=new M,h.getLogger=function(R){if(typeof R!="symbol"&&typeof R!="string"||R==="")throw new TypeError("You must supply a name when creating a logger.");var j=c[R];return j||(j=c[R]=new M(R,h.methodFactory)),j};var D=typeof window!==t?window.log:void 0;return h.noConflict=function(){return typeof window!==t&&window.log===h&&(window.log=D),h},h.getLoggers=function(){return c},h.default=h,h})})(Xo);var Zo=Xo.exports;const Y1=K1(Zo),X1=$1({__proto__:null,default:Y1},[Zo]),Z1=!0,Jr=X1;Jr.setLevel("debug");const Q1=r=>{try{Jr.setLevel(r)}catch(e){Jr.setLevel("error"),Jr.error(e)}};let Qo=class nh{constructor(e,t){this.events={attrChanged:new Tt,modelChanged:new Tt},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=e||{};t&&Zr(s,t),this.attributes=s,this.changed={}}get(e){return this.attributes[e]}set(e,t,s){if(e==null)return this;let l;typeof e=="object"?(l=e,s=t):(l={},l[e]=t),s||(s={});const c=s.unset,h=s.silent,v=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=Yi(this.attributes),this.changed={});const p=this.attributes,S=this.changed,x=this._previousAttributes;for(const E in l)t=l[E],Ks(p[E],t)||v.push(E),Ks(x[E],t)?delete S[E]:S[E]=t,c?delete p[E]:p[E]=t;if(!h){v.length&&(this._pending=s);for(let E=0;E<v.length;E++)this.events.attrChanged.dispatch({object:this,attrName:v[E],attrValue:p[v[E]],options:s})}if(b)return this;if(!h)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?!H1(this.changed):F1(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?Yi(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,s={};for(const l in e){const c=e[l];Ks(t[l],c)||(s[l]=c)}return s}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return Yi(this._previousAttributes)}clone(){const e=Yi(this.attributes);return new nh(e)}},Xs=class Fi{constructor(){this.entries=new Map}static getInstance(){return Fi.instance||(Fi.instance=new Fi),Fi.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 J1{static formatBytes(e,t=2){if(e===0)return"0 B";const s=1024,l=Math.max(0,t),c=["B","KB","MB","GB","TB"],h=Math.floor(Math.log(e)/Math.log(s)),v=e/Math.pow(s,h);return`${parseFloat(v.toFixed(l))} ${c[h]}`}}class Jo{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}let el=class{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 l=0;l<t;l++){const c=this.tasks[l];try{s=await new Promise((h,v)=>{setTimeout(async()=>{try{const b=await c.run(s);this.onProgress((l+1)/t,c),h(b)}catch(b){v(b)}},0)})}catch(h){this.onError(h,l,c);return}}this.onComplete(s)}},tl=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 l=this.handlers[t],c=this.handlers[t+1];if(l.global&&(l.lastIndex=0),l.test(e))return c}return null}};const nl=new tl;class em{constructor(e){this.manager=e!==void 0?e:nl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((s,l)=>{this.load(e,s,t,l)})}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 rl{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 l=t,c=Math.min(t+this._chunkSize,this._count);await e(l,c),t=c,t<this._count&&this.scheduleTask(s)};await s()}}var ot,ei,et,at,ti,Ht,bt,pn,$t,er,ni,ri,tr,nr,ii,si,ai,Mt,_n,He,rr,oi,ve,xt,li,wt,vn,ci,yn,Wt,ui,ir,kt,bn,Zs,Qs,xn,hi,di,wn,fi,Js,ea,sr,lt,An,ct,Ct,ta,na,ra,ia,sa,aa;(ot={})[ot.None=0]="None",ot[ot.Anonymous=1]="Anonymous",ot[ot.NonConstant=2]="NonConstant",ot[ot.Xref=4]="Xref",ot[ot.XrefOverlay=8]="XrefOverlay",ot[ot.ExternallyDependent=16]="ExternallyDependent",ot[ot.ResolvedOrDependent=32]="ResolvedOrDependent",ot[ot.ReferencedXref=64]="ReferencedXref",(ei={})[ei.BYBLOCK=0]="BYBLOCK",ei[ei.BYLAYER=256]="BYLAYER",(et={})[et.Rotated=0]="Rotated",et[et.Aligned=1]="Aligned",et[et.Angular=2]="Angular",et[et.Diameter=3]="Diameter",et[et.Radius=4]="Radius",et[et.Angular3Point=5]="Angular3Point",et[et.Ordinate=6]="Ordinate",et[et.ReferenceIsExclusive=32]="ReferenceIsExclusive",et[et.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",et[et.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(at={})[at.TopLeft=1]="TopLeft",at[at.TopCenter=2]="TopCenter",at[at.TopRight=3]="TopRight",at[at.MiddleLeft=4]="MiddleLeft",at[at.MiddleCenter=5]="MiddleCenter",at[at.MiddleRight=6]="MiddleRight",at[at.BottomLeft=7]="BottomLeft",at[at.BottomCenter=8]="BottomCenter",at[at.BottomRight=9]="BottomRight",(ti={})[ti.AtLeast=1]="AtLeast",ti[ti.Exact=2]="Exact";var il=((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),Pr=((bt={})[bt.Feet=0]="Feet",bt[bt.None=1]="None",bt[bt.Inch=2]="Inch",bt[bt.FeetAndInch=3]="FeetAndInch",bt[bt.Leading=4]="Leading",bt[bt.Trailing=8]="Trailing",bt[bt.LeadingAndTrailing=12]="LeadingAndTrailing",bt),tm=((pn={})[pn.None=0]="None",pn[pn.Leading=1]="Leading",pn[pn.Trailing=2]="Trailing",pn[pn.LeadingAndTrailing=3]="LeadingAndTrailing",pn),nm=(($t={})[$t.Center=0]="Center",$t[$t.Left=1]="Left",$t[$t.Right=2]="Right",$t[$t.OverFirst=3]="OverFirst",$t[$t.OverSecond=4]="OverSecond",$t),rm=((er={})[er.Bottom=0]="Bottom",er[er.Center=1]="Center",er[er.Top=2]="Top",er);(ni={})[ni.PatternFill=0]="PatternFill",ni[ni.SolidFill=1]="SolidFill",(ri={})[ri.NonAssociative=0]="NonAssociative",ri[ri.Associative=1]="Associative",(tr={})[tr.Normal=0]="Normal",tr[tr.Outer=1]="Outer",tr[tr.Ignore=2]="Ignore",(nr={})[nr.UserDefined=0]="UserDefined",nr[nr.Predefined=1]="Predefined",nr[nr.Custom=2]="Custom",(ii={})[ii.NotAnnotated=0]="NotAnnotated",ii[ii.Annotated=1]="Annotated",(si={})[si.Solid=0]="Solid",si[si.Gradient=1]="Gradient",(ai={})[ai.TwoColor=0]="TwoColor",ai[ai.OneColor=1]="OneColor";var im=((Mt={})[Mt.Default=0]="Default",Mt[Mt.External=1]="External",Mt[Mt.Polyline=2]="Polyline",Mt[Mt.Derived=4]="Derived",Mt[Mt.Textbox=8]="Textbox",Mt[Mt.Outermost=16]="Outermost",Mt),Ji=((_n={})[_n.Line=1]="Line",_n[_n.Circular=2]="Circular",_n[_n.Elliptic=3]="Elliptic",_n[_n.Spline=4]="Spline",_n),sm=((He={})[He.Off=0]="Off",He[He.Solid=1]="Solid",He[He.Dashed=2]="Dashed",He[He.Dotted=3]="Dotted",He[He.ShotDash=4]="ShotDash",He[He.MediumDash=5]="MediumDash",He[He.LongDash=6]="LongDash",He[He.DoubleShortDash=7]="DoubleShortDash",He[He.DoubleMediumDash=8]="DoubleMediumDash",He[He.DoubleLongDash=9]="DoubleLongDash",He[He.DoubleMediumLongDash=10]="DoubleMediumLongDash",He[He.SparseDot=11]="SparseDot",He);sm.Off,(rr={})[rr.Standard=-3]="Standard",rr[rr.ByLayer=-2]="ByLayer",rr[rr.ByBlock=-1]="ByBlock",(oi={})[oi.English=0]="English",oi[oi.Metric=1]="Metric",(ve={})[ve.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",ve[ve.FRONT_CLIPPING=2]="FRONT_CLIPPING",ve[ve.BACK_CLIPPING=4]="BACK_CLIPPING",ve[ve.UCS_FOLLOW=8]="UCS_FOLLOW",ve[ve.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",ve[ve.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",ve[ve.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",ve[ve.FAST_ZOOM=128]="FAST_ZOOM",ve[ve.SNAP_MODE=256]="SNAP_MODE",ve[ve.GRID_MODE=512]="GRID_MODE",ve[ve.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",ve[ve.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",ve[ve.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",ve[ve.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",ve[ve.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",ve[ve.UNUSED=32768]="UNUSED",ve[ve.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",ve[ve.VIEWPORT_OFF=131072]="VIEWPORT_OFF",ve[ve.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",ve[ve.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",ve[ve.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",ve[ve.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(xt={})[xt.OPTIMIZED_2D=0]="OPTIMIZED_2D",xt[xt.WIREFRAME=1]="WIREFRAME",xt[xt.HIDDEN_LINE=2]="HIDDEN_LINE",xt[xt.FLAT_SHADED=3]="FLAT_SHADED",xt[xt.GOURAUD_SHADED=4]="GOURAUD_SHADED",xt[xt.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",xt[xt.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(li={})[li.UCS_UNCHANGED=0]="UCS_UNCHANGED",li[li.HAS_OWN_UCS=1]="HAS_OWN_UCS",(wt={})[wt.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",wt[wt.TOP=1]="TOP",wt[wt.BOTTOM=2]="BOTTOM",wt[wt.FRONT=3]="FRONT",wt[wt.BACK=4]="BACK",wt[wt.LEFT=5]="LEFT",wt[wt.RIGHT=6]="RIGHT",(vn={})[vn.AS_DISPLAYED=0]="AS_DISPLAYED",vn[vn.WIREFRAME=1]="WIREFRAME",vn[vn.HIDDEN=2]="HIDDEN",vn[vn.RENDERED=3]="RENDERED",(ci={})[ci.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",ci[ci.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function Ce(r,e,t){return r.code===e&&(t==null||r.value===t)}function Re(r){let e={};r.rewind();let t=r.next(),s=t.code;if(e.x=t.value,(t=r.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=r.next()).code!==s+20?r.rewind():e.z=t.value,e}let oa=Symbol();function Ee(r,e){return(t,s,l)=>{let c=r.reduce((b,p)=>{p.pushContext&&b.push({});let S=b[b.length-1];for(let x of typeof p.code=="number"?[p.code]:p.code){let E=S[x]??(S[x]=[]);p.isMultiple&&E.length&&console.warn(`Snippet ${E.at(-1).name} for code(${x}) is shadowed by ${p.name}`),E.push(p)}return b},[{}]),h=!1,v=c.length-1;for(;!Ce(t,0,"EOF");){let b=function(D,R,j){return D.find((F,he)=>{var _e;return he>=j&&((_e=F[R])==null?void 0:_e.length)})}(c,t.code,v),p=b==null?void 0:b[t.code].at(-1);if(!b||!p){s.rewind();break}p.isMultiple||b[t.code].pop();let{name:S,parser:x,isMultiple:E}=p,M=x==null?void 0:x(t,s,l);if(M===oa){s.rewind();break}if(S){let[D,R]=function(j,F){let he=F.split("."),_e=j;for(let de=0;de<he.length-1;++de){let H=he[de];Object.hasOwn(_e,H)||(_e[H]={}),_e=_e[H]}return[_e,he.at(-1)]}(l,S);E?(Object.hasOwn(D,R)||(D[R]=[]),D[R].push(M)):D[R]=M}p.pushContext&&(v-=1),h=!0,t=s.next()}return e&&Object.setPrototypeOf(l,e),h}}function y({value:r}){return r}function X(r,e){return Re(e)}function Xe({value:r}){return!!r}var sl=[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 al(r,e){var l;if(!Ce(r,1001))throw Error("XData must starts with code 1001");let t={appName:r.value,value:[]};r=e.next();let s=[t.value];for(;!Ce(r,0,"EOF")&&r.code>=1e3;){let c=s.at(-1);switch(r.code){case 1002:r.value==="{"?s.push([]):(s.pop(),(l=s.at(-1))==null||l.push(c));break;case 1e3:case 1004:case 1040:case 1070:case 1071:c.push({type:Pn(r.code),value:r.value});break;case 1003:c.push({name:"layer",type:Pn(r.code),value:r.value});break;case 1005:c.push({name:"handle",type:Pn(r.code),value:r.value});break;case 1010:c.push({type:Pn(r.code),value:Re(e)});break;case 1011:c.push({name:"worldSpacePosition",type:Pn(r.code),value:Re(e)});break;case 1012:c.push({name:"worldSpaceDisplacement",type:Pn(r.code),value:Re(e)});break;case 1013:c.push({name:"worldSpaceDirection",type:Pn(r.code),value:Re(e)});break;case 1041:c.push({name:"distance",type:Pn(r.code),value:r.value});break;case 1042:c.push({name:"scale",type:Pn(r.code),value:r.value})}r=e.next()}return e.rewind(),t}function Pn(r){switch(r){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 la(r,e,t){if(Ce(e,102))return es(e,t),!0;switch(e.code){case 0:r.type=e.value;break;case 5:r.handle=e.value;break;case 330:r.ownerDictionarySoftId?r.ownerBlockRecordSoftId=e.value:r.ownerDictionarySoftId=e.value;break;case 360:r.ownerdictionaryHardId=e.value;break;case 67:r.isInPaperSpace=!!e.value;break;case 8:r.layer=e.value;break;case 6:r.lineType=e.value;break;case 347:r.materialObjectHardId=e.value;break;case 62:r.colorIndex=e.value,r.color=sl[Math.abs(e.value)];break;case 370:r.lineweight=e.value;break;case 48:r.lineTypeScale=e.value;break;case 60:r.isVisible=!!e.value;break;case 92:r.proxyByte=e.value;break;case 310:r.proxyEntity=e.value;break;case 100:break;case 420:r.color=e.value;break;case 430:r.transparency=e.value;break;case 390:r.plotStyleHardId=e.value;break;case 284:r.shadowMode=e.value;break;case 1001:r.xdata=al(e,t);break;default:return!1}return!0}let am=0;function ol(r){if(!r)throw TypeError("entity cannot be undefined or null");r.handle||(r.handle=am++)}(yn={})[yn.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",yn[yn.CAST=1]="CAST",yn[yn.RECEIVE=2]="RECEIVE",yn[yn.IGNORE=3]="IGNORE";let tt=[{code:1001,name:"xdata",parser:al},{code:284,name:"shadowMode",parser:y},{code:390,name:"plotStyleHardId",parser:y},{code:440,name:"transparency",parser:y},{code:430,name:"colorName",parser:y},{code:420,name:"color",parser:y},{code:310,name:"proxyEntity",isMultiple:!0,parser:y},{code:92,name:"proxyByte",parser:y},{code:60,name:"isVisible",parser:Xe},{code:48,name:"lineTypeScale",parser:y},{code:370,name:"lineweight",parser:y},{code:62,name:"colorIndex",parser(r,e,t){let s=r.value;return t.color=sl[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:y},{code:6,name:"lineType",parser:y},{code:8,name:"layer",parser:y},{code:410,name:"layoutTabName",parser:y},{code:67,name:"isInPaperSpace",parser:Xe},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:y},{code:102,parser:es},{code:102,parser:es},{code:102,parser:es},{code:5,name:"handle",parser:y}];function es(r,e){for(r=e.next();!Ce(r,102)&&!Ce(r,0,"EOF");)r=e.next()}function ll(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let om={extrusionDirection:{x:0,y:0,z:1}},lm=[{code:210,name:"extrusionDirection",parser:X},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:100,name:"subclassMarker",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:X},{code:39,name:"thickness",parser:y},{code:100},...tt];class cl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ll(this,"parser",Ee(lm,om))}}ll(cl,"ForEntityName","ARC"),(Wt={})[Wt.NONE=0]="NONE",Wt[Wt.INVISIBLE=1]="INVISIBLE",Wt[Wt.CONSTANT=2]="CONSTANT",Wt[Wt.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Wt[Wt.PRESET=8]="PRESET",(ui={})[ui.MULTILINE=2]="MULTILINE",ui[ui.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(ir={})[ir.NONE=0]="NONE",ir[ir.MIRRORED_X=2]="MIRRORED_X",ir[ir.MIRRORED_Y=4]="MIRRORED_Y";var cm=((kt={})[kt.LEFT=0]="LEFT",kt[kt.CENTER=1]="CENTER",kt[kt.RIGHT=2]="RIGHT",kt[kt.ALIGNED=3]="ALIGNED",kt[kt.MIDDLE=4]="MIDDLE",kt[kt.FIT=5]="FIT",kt),um=((bn={})[bn.BASELINE=0]="BASELINE",bn[bn.BOTTOM=1]="BOTTOM",bn[bn.MIDDLE=2]="MIDDLE",bn[bn.TOP=3]="TOP",bn);function ul(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let hl={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:cm.LEFT,valign:um.BASELINE,extrusionDirection:{x:0,y:0,z:1}},dl=[{code:73,name:"valign",parser:y},{code:100},{code:210,name:"extrusionDirection",parser:X},{code:11,name:"endPoint",parser:X},{code:72,name:"valign",parser:y},{code:72,name:"halign",parser:y},{code:71,name:"generationFlag",parser:y},{code:7,name:"styleName",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"xScale",parser:y},{code:50,name:"rotation",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:X},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class fl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ul(this,"parser",Ee(dl,hl))}}function ml(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ul(fl,"ForEntityName","TEXT");let hm={...hl},dm=[{code:2},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:X},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Xe},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedRecord",parser:Xe},{code:100},{code:280,name:"isLocked",parser:Xe},{code:74,name:"valign",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:3,name:"prompt",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},...dl.slice(2)];class gl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ml(this,"parser",Ee(dm,hm))}}function pl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ml(gl,"ForEntityName","ATTDEF");let fm={thickness:0,extrusionDirection:{x:0,y:0,z:1}},mm=[{code:210,name:"extrusionDirection",parser:X},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:X},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class _l{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){pl(this,"parser",Ee(mm,fm))}}pl(_l,"ForEntityName","CIRCLE");class ts{parseEntity(e,t){let s={};for(;!Ce(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(l,c,h){switch(c.code){case 100:l.subclassMarker=c.value;break;case 280:l.version=c.value;break;case 2:l.name=c.value;break;case 10:l.definitionPoint=Re(h);break;case 11:l.textPoint=Re(h);break;case 12:l.insertionPoint=Re(h);break;case 13:l.subDefinitionPoint1=Re(h);break;case 14:l.subDefinitionPoint2=Re(h);break;case 15:l.centerPoint=Re(h);break;case 16:l.arcPoint=Re(h);break;case 70:l.dimensionType=c.value;break;case 71:l.attachmentPoint=c.value;break;case 72:l.textLineSpacingStyle=c.value;break;case 40:l.leaderLength=c.value;break;case 41:l.textLineSpacingFactor=c.value;break;case 42:l.measurement=c.value;break;case 1:l.text=c.value;break;case 50:l.rotationAngle=c.value;break;case 52:l.obliqueAngle=c.value;break;case 53:l.textRotation=c.value;break;case 51:l.ocsRotation=c.value;break;case 210:l.extrusionDirection=Re(h);break;case 3:l.styleName=c.value;break;default:la(l,c,h)}})(s,t,e),t=e.next()}return s}}function vl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Qs="DIMENSION",(Zs="ForEntityName")in ts?Object.defineProperty(ts,Zs,{value:Qs,enumerable:!0,configurable:!0,writable:!0}):ts[Zs]=Qs;let gm={extrusionDirection:{x:0,y:0,z:1}},pm=[{code:42,name:"endAngle",parser:y},{code:41,name:"startAngle",parser:y},{code:40,name:"axisRatio",parser:y},{code:210,name:"extrusionDirection",parser:X},{code:11,name:"majorAxisEndPoint",parser:X},{code:10,name:"center",parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class yl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){vl(this,"parser",Ee(pm,gm))}}vl(yl,"ForEntityName","ELLIPSE");let bl=[{code:330,name:"sourceBoundaryObjects",parser:y,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:y}],_m=[{code:11,name:"end",parser:X},{code:10,name:"start",parser:X}],vm=[{code:73,name:"isCCW",parser:Xe},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:X}],ym=[{code:73,name:"isCCW",parser:Xe},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"lengthOfMinorAxis",parser:y},{code:11,name:"end",parser:X},{code:10,name:"center",parser:X}],bm=[{code:13,name:"endTangent",parser:X},{code:12,name:"startTangent",parser:X},{code:11,name:"fitDatum",isMultiple:!0,parser:X},{code:97,name:"numberOfFitData",parser:y},{code:10,name:"controlPoints",isMultiple:!0,parser(r,e){let t={...Re(e),weight:1};return(r=e.next()).code===42?t.weight=r.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:y},{code:96,name:"numberOfControlPoints",parser:y},{code:95,name:"numberOfKnots",parser:y},{code:74,name:"isPeriodic",parser:Xe},{code:73,name:"splineFlag",parser:y},{code:94,name:"degree",parser:y}],xm={[Ji.Line]:_m,[Ji.Circular]:vm,[Ji.Elliptic]:ym,[Ji.Spline]:bm},wm=[...bl,{code:72,name:"edges",parser(r,e){let t={type:r.value},s=Ee(xm[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(r=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:y}],Am=[...bl,{code:10,name:"vertices",parser(r,e){let t={...Re(e),bulge:0};return(r=e.next()).code===42?t.bulge=r.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:y},{code:73,name:"isClosed",parser:Xe},{code:72,name:"hasBulge",parser:Xe}],Pm=[{code:49,name:"dashLengths",parser:y,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:y},{code:45,name:"offset",parser:xl},{code:43,name:"base",parser:xl},{code:53,name:"angle",parser:y}];function xl(r,e){let t=r.code+1,s={x:r.value,y:1};return(r=e.next()).code===t?s.y=r.value:e.rewind(),s}function wl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Sm={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Im=[{code:470},{code:463},{code:462,name:"colorTint",parser:y},{code:461,name:"gradientDefinition",parser:y},{code:460,name:"gradientRotation",parser:y},{code:453,name:"numberOfColors",parser:y},{code:452,name:"gradientColorFlag",parser:y},{code:451},{code:450,name:"gradientFlag",parser:y},{code:10,name:"seedPoints",parser:X,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:X},{code:98,name:"numberOfSeedPoints",parser:y},{code:47,name:"pixelSize",parser:y},{code:53,name:"definitionLines",parser:function(r,e){let t={};return Ee(Pm)(r,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:y},{code:77,name:"isDouble",parser:Xe},{code:73,name:"isAnnotated",parser:Xe},{code:41,name:"patternScale",parser:y},{code:52,name:"patternAngle",parser:y},{code:76,name:"patternType",parser:y},{code:75,name:"hatchStyle",parser:y},{code:92,name:"boundaryPaths",parser:function(r,e){let t={boundaryPathTypeFlag:r.value},s=t.boundaryPathTypeFlag&im.Polyline;return r=e.next(),s?Ee(Am)(r,e,t):Ee(wm)(r,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:y},{code:71,name:"associativity",parser:y},{code:63,name:"patternFillColor",parser:y},{code:70,name:"solidFill",parser:y},{code:2,name:"patternName",parser:y},{code:210,name:"extrusionDirection",parser:X},{code:10,name:"elevationPoint",parser:X},{code:100,name:"subclassMarker",parser:y,pushContext:!0},...tt];class Al{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){wl(this,"parser",Ee(Im,Sm))}}wl(Al,"ForEntityName","HATCH"),(xn={})[xn.ShowImage=1]="ShowImage",xn[xn.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",xn[xn.UseClippingBoundary=4]="UseClippingBoundary",xn[xn.TransparencyIsOn=8]="TransparencyIsOn",(hi={})[hi.Rectangular=1]="Rectangular",hi[hi.Polygonal=2]="Polygonal",(di={})[di.Outside=0]="Outside",di[di.Inside=1]="Inside";function Pl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Em={clippingBoundaryPath:[]},Tm=[{code:90,name:"version",parser:y},{code:10,name:"position",parser:X},{code:11,name:"uPixel",parser:X},{code:12,name:"vPixel",parser:X},{code:13,name:"imageSize",parser:X},{code:340,name:"imageDefHandle",parser:y},{code:70,name:"flags",parser:y},{code:280,name:"clipping",parser:y},{code:281,name:"brightness",parser:y},{code:282,name:"contrast",parser:y},{code:283,name:"fade",parser:y},{code:360,name:"imageDefReactorHandle",parser:y},{code:71,name:"clippingBoundaryType",parser:y},{code:91,name:"countBoundaryPoints",parser:y},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:X},{code:290,name:"clipMode",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class ca{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Pl(this,"parser",Ee(Tm,Em))}}function Sl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Pl(ca,"ForEntityName","IMAGE");let Mm={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},km=[{code:210,name:"extrusionDirection",parser:X},{code:45,name:"rowSpacing",parser:y},{code:44,name:"columnSpacing",parser:y},{code:71,name:"rowCount",parser:y},{code:70,name:"columnCount",parser:y},{code:50,name:"rotation",parser:y},{code:43,name:"zScale",parser:y},{code:42,name:"yScale",parser:y},{code:41,name:"xScale",parser:y},{code:10,name:"insertionPoint",parser:X},{code:2,name:"name",parser:y},{code:66,name:"isVariableAttributes",parser:Xe},{code:100,name:"subclassMarker",parser:y},...tt];class Il{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Sl(this,"parser",Ee(km,Mm))}}function El(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Sl(Il,"ForEntityName","INSERT");let Cm={isArrowheadEnabled:!0},Lm=[{code:213,name:"offsetFromAnnotation",parser:X},{code:212,name:"offsetFromBlock",parser:X},{code:211,name:"horizontalDirection",parser:X},{code:210,name:"normal",parser:X},{code:340,name:"associatedAnnotation",parser:y},{code:77,name:"byBlockColor",parser:y},{code:10,name:"vertices",parser:X,isMultiple:!0},{code:76,name:"numberOfVertices",parser:y},{code:41,name:"textWidth",parser:y},{code:40,name:"textHeight",parser:y},{code:75,name:"isHooklineExists",parser:Xe},{code:74,name:"isHooklineSameDirection",parser:Xe},{code:73,name:"leaderCreationFlag",parser:y},{code:72,name:"isSpline",parser:Xe},{code:71,name:"isArrowheadEnabled",parser:Xe},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class Tl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){El(this,"parser",Ee(Lm,Cm))}}El(Tl,"ForEntityName","LEADER"),(wn={})[wn.TextAnnotation=0]="TextAnnotation",wn[wn.ToleranceAnnotation=1]="ToleranceAnnotation",wn[wn.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",wn[wn.NoAnnotation=3]="NoAnnotation";function Ml(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Nm={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Om=[{code:210,name:"extrusionDirection",parser:X},{code:11,name:"endPoint",parser:X},{code:10,name:"startPoint",parser:X},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class kl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Ml(this,"parser",Ee(Om,Nm))}}Ml(kl,"ForEntityName","LINE"),(fi={})[fi.IS_CLOSED=1]="IS_CLOSED",fi[fi.PLINE_GEN=128]="PLINE_GEN";let Dm={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},zm={bulge:0},Rm=[{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:91,name:"id",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y}],Bm=[{code:210,name:"extrusionDirection",parser:X},{code:10,name:"vertices",isMultiple:!0,parser(r,e){let t={};return Ee(Rm,zm)(r,e,t),t}},{code:39,name:"thickness",parser:y},{code:38,name:"elevation",parser:y},{code:43,name:"constantWidth",parser:y},{code:70,name:"flag",parser:y},{code:90,name:"numberOfVertices",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class ns{parseEntity(e,t){let s={};return Ee(Bm,Dm)(t,e,s),s}}ea="LWPOLYLINE",(Js="ForEntityName")in ns?Object.defineProperty(ns,Js,{value:ea,enumerable:!0,configurable:!0,writable:!0}):ns[Js]=ea,(sr={})[sr.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",sr[sr.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",sr[sr.BY_STYLE=5]="BY_STYLE";function Fm(r,e){let t={};for(let s of r){let l=e(s);l!=null&&(t[l]??(t[l]=[]),t[l].push(s))}return t}function*rs(r,e=1/0,t=1){for(let s=r;s!==e;s+=t)yield s}function On(r){return{x:r.x??0,y:r.y??0,z:r.z??0}}function Cl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Vm={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},is=[{code:46,name:"annotationHeight",parser:y},{code:101,parser(r,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:y},{code:49,name:"columnGutter",parser:y},{code:48,name:"columnWidth",parser:y},{code:79,name:"columnAutoHeight",parser:y},{code:78,name:"columnFlowReversed",parser:y},{code:76,name:"columnCount",parser:y},{code:75,name:"columnType",parser:y},{code:441,name:"backgroundFillTransparency",parser:y},{code:63,name:"backgroundFillColor",parser:y},{code:45,name:"fillBoxScale",parser:y},{code:[...rs(430,440)],name:"backgroundColor",parser:y},{code:[...rs(420,430)],name:"backgroundColor",parser:y},{code:90,name:"backgroundFill",parser:y},{code:44,name:"lineSpacing",parser:y},{code:73,name:"lineSpacingStyle",parser:y},{code:50,name:"rotation",parser:y},{code:43},{code:42},{code:11,name:"direction",parser:X},{code:210,name:"extrusionDirection",parser:X},{code:7,name:"styleName",parser:y},{code:3,name:"text",isMultiple:!0,parser:y},{code:1,name:"text",isMultiple:!0,parser:y},{code:72,name:"drawingDirection",parser:y},{code:71,name:"attachmentPoint",parser:y},{code:41,name:"width",parser:y},{code:40,name:"height",parser:y},{code:10,name:"insertionPoint",parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class Ll{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Cl(this,"parser",Ee(is,Vm))}}function Nl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Cl(Ll,"ForEntityName","MTEXT");let jm={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Um=[{code:50,name:"angle",parser:y},{code:210,name:"extrusionDirection",parser:X},{code:39,name:"thickness",parser:y},{code:10,name:"position",parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class Ol{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Nl(this,"parser",Ee(Um,jm))}}Nl(Ol,"ForEntityName","POINT"),(lt={})[lt.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",lt[lt.CURVE_FIT=2]="CURVE_FIT",lt[lt.SPLINE_FIT=4]="SPLINE_FIT",lt[lt.POLYLINE_3D=8]="POLYLINE_3D",lt[lt.POLYGON_3D=16]="POLYGON_3D",lt[lt.CLOSED_POLYGON=32]="CLOSED_POLYGON",lt[lt.POLYFACE=64]="POLYFACE",lt[lt.CONTINUOUS=128]="CONTINUOUS",(An={})[An.NONE=0]="NONE",An[An.QUADRATIC=5]="QUADRATIC",An[An.CUBIC=6]="CUBIC",An[An.BEZIER=8]="BEZIER",(ct={})[ct.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ct[ct.TANGENT_DEFINED=2]="TANGENT_DEFINED",ct[ct.NOT_USED=4]="NOT_USED",ct[ct.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ct[ct.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ct[ct.FOR_POLYLINE=32]="FOR_POLYLINE",ct[ct.FOR_POLYGON=64]="FOR_POLYGON",ct[ct.POLYFACE=128]="POLYFACE";function Dl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Gm={startWidth:0,endWidth:0,bulge:0},Hm=[{code:91,name:"id",parser:y},{code:[...rs(71,75)],name:"faces",isMultiple:!0,parser:y},{code:50,name:"tangentDirection",parser:y},{code:70,name:"flag",parser:y},{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:30,name:"z",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...tt];class zl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Dl(this,"parser",Ee(Hm,Gm))}}function Rl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Dl(zl,"ForEntityName","VERTEX");let $m={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:[]},Wm=[{code:0,name:"vertices",isMultiple:!0,parser:(r,e)=>Ce(r,0,"VERTEX")?(r=e.next(),new zl().parseEntity(e,r)):oa},{code:210,name:"extrusionDirection",parser:X},{code:75,name:"smoothType",parser:y},{code:74,name:"surfaceNDensity",parser:y},{code:73,name:"surfaceMDensity",parser:y},{code:72,name:"meshNVertexCount",parser:y},{code:71,name:"meshMVertexCount",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:70,name:"flag",parser:y},{code:39,name:"thickness",parser:y},{code:30,name:"elevation",parser:y},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:y},...tt];class Bl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Rl(this,"parser",Ee(Wm,$m))}}function Fl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Rl(Bl,"ForEntityName","POLYLINE");let qm={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Km=[{code:10,name:"firstPoint",parser:X},{code:11,name:"unitDirection",parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class Vl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Fl(this,"parser",Ee(Km,qm))}}function jl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Fl(Vl,"ForEntityName","RAY");let Ym={vertices:[],backLineVertices:[]},Xm=[{code:360,name:"geometrySettingHardId",parser:y},{code:12,name:"backLineVertices",isMultiple:!0,parser:X},{code:93,name:"numberOfBackLineVertices",parser:y},{code:11,name:"vertices",isMultiple:!0,parser:X},{code:92,name:"verticesCount",parser:y},{code:[63,411],name:"indicatorColor",parser:y},{code:70,name:"indicatorTransparency",parser:y},{code:41,name:"bottomHeight",parser:y},{code:40,name:"topHeight",parser:y},{code:10,name:"verticalDirection",parser:X},{code:1,name:"name",parser:y},{code:91,name:"flag",parser:y},{code:90,name:"state",parser:y},{code:100,name:"subclassMarker",parser:y},...tt];class Ul{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){jl(this,"parser",Ee(Xm,Ym))}}function Gl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}jl(Ul,"ForEntityName","SECTION");let Zm={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Qm=[{code:210,name:"extrusionDirection",parser:X},{code:39,name:"thickness",parser:y},{code:[...rs(10,14)],name:"points",isMultiple:!0,parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class Hl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Gl(this,"parser",Ee(Qm,Zm))}}Gl(Hl,"ForEntityName","SOLID"),(Ct={})[Ct.NONE=0]="NONE",Ct[Ct.CLOSED=1]="CLOSED",Ct[Ct.PERIODIC=2]="PERIODIC",Ct[Ct.RATIONAL=4]="RATIONAL",Ct[Ct.PLANAR=8]="PLANAR",Ct[Ct.LINEAR=16]="LINEAR";function $l(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Jm={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},eg=[{code:11,name:"fitPoints",isMultiple:!0,parser:X},{code:10,name:"controlPoints",isMultiple:!0,parser:X},{code:41,name:"weights",isMultiple:!0,parser:y},{code:40,name:"knots",isMultiple:!0,parser:y},{code:13,name:"endTangent",parser:X},{code:12,name:"startTangent",parser:X},{code:44,name:"fitTolerance",parser:y},{code:43,name:"controlTolerance",parser:y},{code:42,name:"knotTolerance",parser:y},{code:74,name:"numberOfFitPoints",parser:y},{code:73,name:"numberOfControlPoints",parser:y},{code:72,name:"numberOfKnots",parser:y},{code:71,name:"degree",parser:y},{code:70,name:"flag",parser:y},{code:210,name:"normal",parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class Wl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){$l(this,"parser",Ee(eg,Jm))}}$l(Wl,"ForEntityName","SPLINE");class ss{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=On(Re(e)),t=e.lastReadGroup;break;case 11:s.directionVector=On(Re(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(l,c){let h=!1,v=!1,b={};for(;!l.isEOF()&&c.code!==0&&!v;)switch(c.code){case 171:if(h){v=!0;continue}b.cellType=c.value,h=!0,c=l.next();break;case 172:b.flagValue=c.value,c=l.next();break;case 173:b.mergedValue=c.value,c=l.next();break;case 174:b.autoFit=c.value,c=l.next();break;case 175:b.borderWidth=c.value,c=l.next();break;case 176:b.borderHeight=c.value,c=l.next();break;case 91:b.overrideFlag=c.value,c=l.next();break;case 178:b.virtualEdgeFlag=c.value,c=l.next();break;case 145:b.rotation=c.value,c=l.next();break;case 345:b.fieldObjetId=c.value,c=l.next();break;case 340:b.blockTableRecordId=c.value,c=l.next();break;case 146:b.blockScale=c.value,c=l.next();break;case 177:b.blockAttrNum=c.value,c=l.next();break;case 7:b.textStyle=c.value,c=l.next();break;case 140:b.textHeight=c.value,c=l.next();break;case 170:b.attachmentPoint=c.value,c=l.next();break;case 92:b.extendedCellFlags=c.value,c=l.next();break;case 285:b.rightBorderVisibility=!!(c.value??!0),c=l.next();break;case 286:b.bottomBorderVisibility=!!(c.value??!0),c=l.next();break;case 288:b.leftBorderVisibility=!!(c.value??!0),c=l.next();break;case 289:b.topBorderVisibility=!!(c.value??!0),c=l.next();break;case 301:(function(p,S,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=S.next();break;case 1:p.text=x.value,x=S.next();break;case 300:p.attrText=x.value,x=S.next();break;case 302:p.text=x.value?x.value:p.text,x=S.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=S.next()}})(b,l,c),c=l.next();break;default:return b}return h=!1,v=!1,b}(e,t)),t=e.lastReadGroup;break;default:la(s,t,e),t=e.next()}}return s}}na="ACAD_TABLE",(ta="ForEntityName")in ss?Object.defineProperty(ss,ta,{value:na,enumerable:!0,configurable:!0,writable:!0}):ss[ta]=na;class as{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(l,c,h){if(h==="EOF")return!1;switch(h.code){case 0:default:return!1;case 100:l.subclassMarker=h.value;break;case 10:l.viewportCenter=On(Re(c));break;case 40:l.width=h.value;break;case 41:l.height=h.value;break;case 68:l.status=h.value;break;case 69:l.viewportId=h.value;break;case 12:l.displayCenter=Re(c);break;case 13:l.snapBase=Re(c);break;case 14:l.snapSpacing=Re(c);break;case 15:l.gridSpacing=Re(c);break;case 16:l.viewDirection=On(Re(c));break;case 17:l.targetPoint=On(Re(c));break;case 42:l.perspectiveLensLength=h.value;break;case 43:l.frontClipZ=h.value;break;case 44:l.backClipZ=h.value;break;case 45:l.viewHeight=h.value;break;case 50:l.snapAngle=h.value;break;case 51:l.viewTwistAngle=h.value;break;case 72:l.circleZoomPercent=h.value;break;case 331:l.frozenLayerIds??(l.frozenLayerIds=[]),l.frozenLayerIds.push(h.value);break;case 90:l.statusBitFlags=h.value;break;case 330:l.ownerBlockRecordSoftId=h.value;break;case 340:l.clippingBoundaryId=h.value;break;case 1:l.sheetName=h.value;break;case 281:l.renderMode=h.value;break;case 71:l.ucsPerViewport=h.value;break;case 110:l.ucsOrigin=On(Re(c));break;case 111:l.ucsXAxis=On(Re(c));break;case 112:l.ucsYAxis=On(Re(c));break;case 345:l.ucsId=h.value;break;case 346:l.ucsBaseId=h.value;break;case 79:l.orthographicType=h.value;break;case 146:l.elevation=h.value;break;case 170:l.shadePlotMode=h.value;break;case 61:l.majorGridFrequency=h.value;break;case 332:l.backgroundId=h.value;break;case 333:l.shadePlotId=h.value;break;case 348:l.visualStyleId=h.value;break;case 292:l.isDefaultLighting=!!h.value;break;case 282:l.defaultLightingType=h.value;break;case 141:l.brightness=h.value;break;case 142:l.contrast=h.value;break;case 63:case 421:case 431:l.ambientLightColor=h.value;break;case 361:l.sunId=h.value;break;case 335:case 343:case 344:case 91:l.softPointer=h.value}return!0}(s,e,t)&&la(s,t,e),t=e.next()}return s}}ia="VIEWPORT",(ra="ForEntityName")in as?Object.defineProperty(as,ra,{value:ia,enumerable:!0,configurable:!0,writable:!0}):as[ra]=ia;class os extends ca{parseEntity(e,t){return super.parseEntity(e,t)}}function ql(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}aa="WIPEOUT",(sa="ForEntityName")in os?Object.defineProperty(os,sa,{value:aa,enumerable:!0,configurable:!0,writable:!0}):os[sa]=aa;let tg={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},ng=[{code:10,name:"firstPoint",parser:X},{code:11,name:"unitDirection",parser:X},{code:100,name:"subclassMarker",parser:y},...tt];class Kl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ql(this,"parser",Ee(ng,tg))}}function Yl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ql(Kl,"ForEntityName","XLINE");let rg={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},ig=[...is.slice(is.findIndex(({name:r})=>r==="columnType"),is.findIndex(({name:r})=>r==="subclassMarker")+1),{code:100},{code:0,parser(r){if(!Ce(r,0,"MTEXT"))return oa}},{code:2,name:"definitionTag",parser:y},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:X},{code:340,name:"secondaryAttributesHardId",parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Xe},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedEntriesKeep",parser:Xe},{code:100},{code:280,name:"lockPositionFlag",parser:Xe},{code:210,name:"extrusionDirection",parser:X},{code:11,name:"alignmentPoint",parser:X},{code:74,name:"verticalJustification",parser:y},{code:72,name:"horizontalJustification",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:7,name:"textStyle",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"scale",parser:y},{code:50,name:"rotation",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:X},{code:39,name:"thickness",parser:y},{code:100},...tt];class Xl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Yl(this,"parser",Ee(ig,rg))}}Yl(Xl,"ForEntityName","ATTRIB");let sg=Object.fromEntries([cl,gl,Xl,_l,ts,yl,ca,Il,Tl,kl,ns,Ll,Ol,Bl,Vl,Ul,Hl,Wl,ss,fl,Al,as,os,Kl].map(r=>[r.ForEntityName,new r]));function Zl(r,e){let t=[];for(;!Ce(r,0,"EOF");){if(r.code===0){if(r.value==="ENDBLK"||r.value==="ENDSEC"){e.rewind();break}let s=sg[r.value];if(s){let l=r.value;r=e.next();let c=s.parseEntity(e,r);c.type=l,ol(c),t.push(c)}else console.warn(`Unsupported ENTITY type: ${r.value}`)}r=e.next()}return t}function ag(r,e){let t={};for(;!Ce(r,0,"EOF")&&!Ce(r,0,"ENDSEC");){if(Ce(r,0,"BLOCK")){let s=og(r=e.next(),e);ol(s),s.name&&(t[s.name]=s)}r=e.next()}return t}function og(r,e){let t={};for(;!Ce(r,0,"EOF");){if(Ce(r,0,"ENDBLK")){for(r=e.next();!Ce(r,0,"EOF");){if(Ce(r,100,"AcDbBlockEnd"))return t;r=e.next()}break}switch(r.code){case 1:t.xrefPath=r.value;break;case 2:t.name=r.value;break;case 3:t.name2=r.value;break;case 5:t.handle=r.value;break;case 8:t.layer=r.value;break;case 10:t.position=Re(e);break;case 67:t.paperSpace=!!r.value&&r.value==1;break;case 70:r.value!==0&&(t.type=r.value);break;case 100:break;case 330:t.ownerHandle=r.value;break;case 0:t.entities=Zl(r,e)}r=e.next()}return t}function lg(r,e){let t=null,s={};for(;!Ce(r,0,"EOF")&&!Ce(r,0,"ENDSEC");)r.code===9?t=r.value:r.code===10?s[t]=Re(e):s[t]=r.value,r=e.next();return s}let cg=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:y},{code:90,name:"version",parser:y},{code:1,name:"fileName",parser:y},{code:10,name:"size",parser:X},{code:11,name:"sizeOfOnePixel",parser:X},{code:280,name:"isLoaded",parser:y},{code:281,name:"resolutionUnits",parser:y},{code:100,name:"subclassMarker",parser:y}],Ql=[{code:333,name:"shadePlotId",parser:y},{code:149,name:"imageOriginY",parser:y},{code:148,name:"imageOriginX",parser:y},{code:147,name:"scaleFactor",parser:y},{code:78,name:"shadePlotCustomDPI",parser:y},{code:77,name:"shadePlotResolution",parser:y},{code:76,name:"shadePlotMode",parser:y},{code:75,name:"standardScaleType",parser:y},{code:7,name:"currentStyleSheet",parser:y},{code:74,name:"plotType",parser:y},{code:73,name:"plotRotation",parser:y},{code:72,name:"paperUnit",parser:y},{code:70,name:"layoutFlag",parser:y},{code:143,name:"printScaleDenominator",parser:y},{code:142,name:"printScaleNominator",parser:y},{code:141,name:"windowAreaYMax",parser:y},{code:140,name:"windowAreaYMin",parser:y},{code:49,name:"windowAreaXMax",parser:y},{code:48,name:"windowAreaXMin",parser:y},{code:47,name:"plotOriginY",parser:y},{code:46,name:"plotOriginX",parser:y},{code:45,name:"paperHeight",parser:y},{code:44,name:"paperWidth",parser:y},{code:43,name:"marginTop",parser:y},{code:42,name:"marginRight",parser:y},{code:41,name:"marginBottom",parser:y},{code:40,name:"marginLeft",parser:y},{code:6,name:"plotViewName",parser:y},{code:4,name:"paperSize",parser:y},{code:2,name:"configName",parser:y},{code:1,name:"pageSetupName",parser:y},{code:100,name:"subclassMarker",parser:y}],ug=[{code:333,name:"shadePlotId",parser:y},{code:346,name:"orthographicUcsId",parser:y},{code:345,name:"namedUcsId",parser:y},{code:331,name:"viewportId",parser:y},{code:330,name:"paperSpaceTableId",parser:y},{code:76,name:"orthographicType",parser:y},{code:17,name:"ucsYAxis",parser:X},{code:16,name:"ucsXAxis",parser:X},{code:13,name:"ucsOrigin",parser:X},{code:146,name:"elevation",parser:y},{code:15,name:"maxExtent",parser:X},{code:14,name:"minExtent",parser:X},{code:12,name:"insertionBase",parser:X},{code:11,name:"maxLimit",parser:X},{code:10,name:"minLimit",parser:X},{code:71,name:"tabOrder",parser:y},{code:70,name:"controlFlag",parser:y},{code:1,name:"layoutName",parser:y},{code:100,name:"subclassMarker",parser:y},...Ql],hg=[{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:y},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:y},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:y}];function Jl(r){return r.subclassMarker==="AcDbDictionary"}let dg={LAYOUT:ug,PLOTSETTINGS:Ql,DICTIONARY:[{code:3,name:"entries",parser:(r,e)=>{let t={name:r.value};return(r=e.next()).code===350?t.objectId=r.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:y},{code:280,name:"isHardOwned",parser:Xe},{code:100,name:"subclassMarker",parser:y}],IMAGEDEF:cg};function fg(r,e){let t=[];for(;r.code!==0||!["EOF","ENDSEC"].includes(r.value);){let s=r.value,l=dg[s];if(r.code===0&&(l!=null&&l.length)){let c=Ee([...hg,...l]),h={name:s};c(r=e.next(),e,h)?(t.push(h),r=e.peek()):r=e.next()}else r=e.next()}return{byName:Fm(t,({name:s})=>s),byTree:function(s){let l=Object.fromEntries(s.map(c=>[c.handle,c]));for(let c of s)(!Jl(c)||c.ownerDictionaryIdSoft!=="0")&&(c.ownerDictionaryIdSoft&&(c.ownerDictionarySoft=l[c.ownerDictionaryIdSoft]),c.ownerDictionaryIdHard&&(c.ownerDictionaryHard=l[c.ownerDictionaryIdHard]),c.ownerObjectId&&(c.ownerObject=l[c.ownerObjectId])),function(h,v){Jl(h)&&h.entries&&(h.entries=Object.fromEntries(h.entries.map(({name:b,objectId:p})=>[b,v[p]])))}(c,l);return s[0]}(t)}}let Sr=[{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102,parser(r,e){for(;!Ce(r,0,"EOF")&&!Ce(r,102,"}");)r=e.next()}},{code:5,name:"handle",parser:y}],mg=Ee([{code:310,name:"bmpPreview",parser:y},{code:281,name:"scalability",parser:y},{code:280,name:"explodability",parser:y},{code:70,name:"insertionUnits",parser:y},{code:340,name:"layoutObjects",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Sr]),gg=Ee([...[{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:il.Above,defaultValueImperial:il.Center},{name:"DIMZIN",code:78,defaultValue:Pr.Trailing,defaultValueImperial:Pr.Feet},{name:"DIMAZIN",code:79,defaultValue:tm.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:nm.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:rm.Center},{name:"DIMTZIN",code:284,defaultValue:Pr.Trailing,defaultValueImperial:Pr.Feet},{name:"DIMALTZ",code:285,defaultValue:Pr.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Pr.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(r=>({...r,parser:y})),{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},{code:105,name:"handle",parser:y},...Sr.filter(r=>r.code!==5)]),pg=Ee([{code:347,name:"materialObjectId",parser:y},{code:390,name:"plotStyleNameObjectId",parser:y},{code:370,name:"lineweight",parser:y},{code:290,name:"isPlotting",parser:Xe},{code:6,name:"lineType",parser:y},{code:62,name:"colorIndex",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Sr]),_g=Ee([{code:9,name:"text",parser:y},{code:45,name:"offsetY",parser:y},{code:44,name:"offsetX",parser:y},{code:50,name:"rotation",parser:y},{code:46,name:"scale",parser:y},{code:340,name:"styleObjectId",parser:y},{code:75,name:"shapeNumber",parser:y},{code:74,name:"elementTypeFlag",parser:y},{code:49,name:"elementLength",parser:y}],{elementTypeFlag:0,elementLength:0}),vg={BLOCK_RECORD:mg,DIMSTYLE:gg,LAYER:pg,LTYPE:Ee([{code:49,name:"pattern",parser(r,e){let t={};return _g(r,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:y},{code:73,name:"numberOfLineTypes",parser:y},{code:72,parser:y},{code:3,name:"description",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Sr]),STYLE:Ee([{code:1e3,name:"extendedFont",parser:y},{code:1001},{code:4,name:"bigFont",parser:y},{code:3,name:"font",parser:y},{code:42,name:"lastHeight",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:50,name:"obliqueAngle",parser:y},{code:41,name:"widthFactor",parser:y},{code:40,name:"fixedTextHeight",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Sr]),VPORT:Ee([{code:[63,421,431],name:"ambientColor",parser:y},{code:142,name:"contrast",parser:y},{code:141,name:"brightness",parser:y},{code:282,name:"defaultLightingType",parser:y},{code:292,name:"isDefaultLightingOn",parser:Xe},{code:348,name:"visualStyleObjectId",parser:y},{code:333,name:"shadePlotObjectId",parser:y},{code:332,name:"backgroundObjectId",parser:y},{code:61,name:"majorGridLines",parser:y},{code:170,name:"shadePlotSetting",parser:y},{code:146,name:"elevation",parser:y},{code:79,name:"orthographicType",parser:y},{code:112,name:"ucsYAxis",parser:X},{code:111,name:"ucsXAxis",parser:X},{code:110,name:"ucsOrigin",parser:X},{code:74,name:"ucsIconSetting",parser:y},{code:71,name:"viewMode",parser:y},{code:281,name:"renderMode",parser:y},{code:1,name:"styleSheet",parser:y},{code:[331,441],name:"frozenLayers",parser:y,isMultiple:!0},{code:72,name:"circleSides",parser:y},{code:51,name:"viewTwistAngle",parser:y},{code:50,name:"snapRotationAngle",parser:y},{code:45,name:"viewHeight",parser:y},{code:44,name:"backClippingPlane",parser:y},{code:43,name:"frontClippingPlane",parser:y},{code:42,name:"lensLength",parser:y},{code:17,name:"viewTarget",parser:X},{code:16,name:"viewDirectionFromTarget",parser:X},{code:15,name:"gridSpacing",parser:X},{code:14,name:"snapSpacing",parser:X},{code:13,name:"snapBasePoint",parser:X},{code:12,name:"center",parser:X},{code:11,name:"upperRightCorner",parser:X},{code:10,name:"lowerLeftCorner",parser:X},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Sr])},yg=Ee([{code:70,name:"maxNumberOfEntries",parser:y},{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:y},{code:2,name:"name",parser:y}]);function bg(r,e){var s;let t={};for(;!Ce(r,0,"EOF")&&!Ce(r,0,"ENDSEC");){if(Ce(r,0,"TABLE")){r=e.next();let l={entries:[]};yg(r,e,l),t[l.name]=l}if(Ce(r,0)&&!Ce(r,0,"ENDTAB")){let l=r.value;r=e.next();let c=vg[l];if(!c){console.warn(`parseTable: Invalid table name '${l}'`),r=e.next();continue}let h={};c(r,e,h),(s=t[l])==null||s.entries.push(h)}r=e.next()}return t}function ls(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class ec{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=tc(e,this._data[this._pointer++]),s={code:e,value:t};return Ce(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=tc(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){ls(this,"_pointer",void 0),ls(this,"_data",void 0),ls(this,"_eof",void 0),ls(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=e,this._eof=!1}}function tc(r,e){return r<=9?e:r>=10&&r<=59?parseFloat(e.trim()):r>=60&&r<=99?parseInt(e.trim()):r>=100&&r<=109?e:r>=110&&r<=149?parseFloat(e.trim()):r>=160&&r<=179?parseInt(e.trim()):r>=210&&r<=239?parseFloat(e.trim()):r>=270&&r<=289?parseInt(e.trim()):r>=290&&r<=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()):r>=300&&r<=369?e:r>=370&&r<=389?parseInt(e.trim()):r>=390&&r<=399?e:r>=400&&r<=409?parseInt(e.trim()):r>=410&&r<=419?e:r>=420&&r<=429?parseInt(e.trim()):r>=430&&r<=439?e:r>=440&&r<=459?parseInt(e.trim()):r>=460&&r<=469?parseFloat(e.trim()):r>=470&&r<=481||r===999||r>=1e3&&r<=1009?e:r>=1010&&r<=1059?parseFloat(e.trim()):r>=1060&&r<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:r,value:e}),e)}function ua(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class xg{constructor(){ua(this,"encoding","utf-8"),ua(this,"encodingFailureFatal",!1)}}class wg extends EventTarget{parseSync(e){let t=new ec(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((l,c)=>{e.on("data",h=>{t+=h}),e.on("end",()=>{try{let h=t.split(/\r\n|\r|\n/g),v=new ec(h);if(!v.hasNext())throw Error("Empty file");l(s.parseAll(v))}catch(h){c(h)}}),e.on("error",h=>{c(h)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let l=s.body.getReader(),c="";for(;;){let{done:h,value:v}=await l.read();if(h){c+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}c+=this._decoder.decode(v,{stream:!0})}return this.parseSync(c)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!Ce(s,0,"EOF");)Ce(s,0,"SECTION")&&(Ce(s=e.next(),2,"HEADER")?(s=e.next(),t.header=lg(s,e)):Ce(s,2,"BLOCKS")?(s=e.next(),t.blocks=ag(s,e)):Ce(s,2,"ENTITIES")?(s=e.next(),t.entities=Zl(s,e)):Ce(s,2,"TABLES")?(s=e.next(),t.tables=bg(s,e)):Ce(s,2,"OBJECTS")&&(s=e.next(),t.objects=fg(s,e))),s=e.next();return t}constructor(e=new xg){super(),ua(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var ha=(r=>(r[r.DecimalDegrees=0]="DecimalDegrees",r[r.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",r[r.Gradians=2]="Gradians",r[r.Radians=3]="Radians",r[r.SurveyorsUnits=4]="SurveyorsUnits",r))(ha||{});class Dn{static get instance(){return this._instance||(this._instance=new Dn),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,l=!0,c,h){const v=[];if(t!=null){const b=this.createKey(t.name,s);let p;if(this.has(b))p=this.get(b);else{const S=t.newIterator();for(const x of S)if(x.color.isByBlock&&s){nc.copy(x.color),x.color.color=s;const E=x.draw(e);E&&v.push(E),x.color.copy(nc)}else{const E=x.draw(e);E&&v.push(E)}p=e.group(v),p&&l&&this.set(b,p)}return p&&c&&(p.applyMatrix(c),h&&(h.x!=0||h.y!=0||h.z!=1)&&(c.setFromExtrusionDirection(h),p.applyMatrix(c))),p}else return e.group(v)}}const nc=new Jn,cs="Continuous",us="ByLayer",rc="ByBlock";var ar=(r=>(r[r.EndPoint=1]="EndPoint",r[r.MidPoint=2]="MidPoint",r[r.Center=3]="Center",r[r.Node=4]="Node",r[r.Quadrant=5]="Quadrant",r[r.Insertion=7]="Insertion",r[r.Perpendicular=8]="Perpendicular",r[r.Tangent=9]="Tangent",r[r.Nearest=10]="Nearest",r[r.Centroid=11]="Centroid",r))(ar||{}),da=(r=>(r[r.Undefined=0]="Undefined",r[r.Inches=1]="Inches",r[r.Feet=2]="Feet",r[r.Miles=3]="Miles",r[r.Millimeters=4]="Millimeters",r[r.Centimeters=5]="Centimeters",r[r.Meters=6]="Meters",r[r.Kilometers=7]="Kilometers",r[r.Microinches=8]="Microinches",r[r.Mils=9]="Mils",r[r.Yards=10]="Yards",r[r.Angstroms=11]="Angstroms",r[r.Nanometers=12]="Nanometers",r[r.Microns=13]="Microns",r[r.Decimeters=14]="Decimeters",r[r.Dekameters=15]="Dekameters",r[r.Hectometers=16]="Hectometers",r[r.Gigameters=17]="Gigameters",r[r.Astronomical=18]="Astronomical",r[r.LightYears=19]="LightYears",r[r.Parsecs=20]="Parsecs",r[r.USSurveyFeet=21]="USSurveyFeet",r[r.USSurveyInch=22]="USSurveyInch",r[r.USSurveyYard=23]="USSurveyYard",r[r.USSurveyMile=24]="USSurveyMile",r[r.Max=24]="Max",r))(da||{});function Ag(r){return r==4||r==5||r==6||r==7||r==12||r==13||r==14||r==15||r==16||r==17}function Pg(r){return r==1||r==2||r==3||r==8||r==9||r==10||r==21}var ic=(r=>(r.ClosedFilled="",r.Dot="_DOT",r.DotSmall="_DOTSMALL",r.DotBlank="_DOTBLANK",r.Origin="_ORIGIN",r.Origin2="_ORIGIN2",r.Open="_OPEN",r.Open90="_OPEN90",r.Open30="_OPEN30",r.Closed="_CLOSED",r.Small="_SMALL",r.None="_NONE",r.Oblique="_OBLIQUE",r.BoxFilled="_BOXFILLED",r.Box="_BOXBLANK",r.ClosedBlank="_CLOSEDBLANK",r.DatumBlank="_DATUMBLANK",r.DatumFilled="_DATUMFILLED",r.Integral="_INTEGRAL",r.ArchTick="_ARCHTICK",r))(ic||{});class hs{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 sc="Load Database";class Pt extends Jo{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=Xs.getInstance().getEntry(sc),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const l=await this.data.task(e);if(this.progress){const c=l.data;await this.progress(this.data.progress.value,this.data.stage,"END",c),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),l}}class ac{async read(e,t,s,l){const c={name:sc,data:{total:0},format(){let p="";return Object.keys(this.data).forEach(S=>{S!=="total"&&(p+=`- ${S}: ${this.data[S]} ms
|
|
2
|
-
`)}),p+=`- total: ${this.data.total} ms`,p}};Xs.getInstance().collect(c),this.progress=l;const h={value:0},v=new el;v.setCompleteCallback(()=>this.onFinished()),v.setErrorCallback(()=>this.onFinished()),v.addTask(new Pt({stage:"START",step:1,progress:h,task:async p=>p},l)),v.addTask(new Pt({stage:"PARSE",step:5,progress:h,task:async p=>({model:await this.parse(p)})},l)),v.addTask(new Pt({stage:"FONT",step:5,progress:h,task:async p=>{const S=this.getFonts(p.model);return{model:p.model,data:S}}},l)),v.addTask(new Pt({stage:"LTYPE",step:1,progress:h,task:async p=>(this.processLineTypes(p.model,t),p)},l)),v.addTask(new Pt({stage:"STYLE",step:1,progress:h,task:async p=>(this.processTextStyles(p.model,t),p)},l)),v.addTask(new Pt({stage:"DIMSTYLE",step:1,progress:h,task:async p=>(this.processDimStyles(p.model,t),p)},l)),v.addTask(new Pt({stage:"LAYER",step:1,progress:h,task:async p=>(this.processLayers(p.model,t),p)},l)),v.addTask(new Pt({stage:"VPORT",step:1,progress:h,task:async p=>(this.processViewports(p.model,t),p)},l)),v.addTask(new Pt({stage:"HEADER",step:1,progress:h,task:async p=>(this.processHeader(p.model,t),p)},l)),v.addTask(new Pt({stage:"BLOCK_RECORD",step:5,progress:h,task:async p=>(this.processBlockTables(p.model,t),p)},l)),v.addTask(new Pt({stage:"OBJECT",step:5,progress:h,task:async p=>(this.processObjects(p.model,t),p)},l)),v.addTask(new Pt({stage:"BLOCK",step:5,progress:h,task:async p=>(await this.processBlocks(p.model,t),p)},l)),v.addTask(new Pt({stage:"ENTITY",step:100,progress:h,task:async p=>(await this.processEntities(p.model,t,s,h,l),p)},l)),v.addTask(new Pt({stage:"END",step:0,progress:h,task:async p=>p},l));const b=Date.now();await v.run(e),c.data.total=Date.now()-b}onFinished(){this.progress&&(this.progress(100,"END","END"),Dn.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,l,c){throw new Error("Not impelemented yet!")}}const mt=["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 oc=1234567;const fa=Math.PI/180,ma=180/Math.PI;function lc(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(mt[r&255]+mt[r>>8&255]+mt[r>>16&255]+mt[r>>24&255]+"-"+mt[e&255]+mt[e>>8&255]+"-"+mt[e>>16&15|64]+mt[e>>24&255]+"-"+mt[t&63|128]+mt[t>>8&255]+"-"+mt[t>>16&255]+mt[t>>24&255]+mt[s&255]+mt[s>>8&255]+mt[s>>16&255]+mt[s>>24&255]).toLowerCase()}function Sn(r,e,t){return Math.max(e,Math.min(t,r))}function ga(r,e){return(r%e+e)%e}function cc(r,e,t,s,l){return s+(r-e)*(l-s)/(t-e)}function uc(r,e,t){return r!==e?(t-r)/(e-r):0}function pa(r,e,t){return(1-t)*r+t*e}function hc(r,e,t,s){return pa(r,e,1-Math.exp(-t*s))}function dc(r,e=1){return e-Math.abs(ga(r,e*2)-e)}function fc(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function mc(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function gc(r,e){return r+Math.floor(Math.random()*(e-r+1))}function pc(r,e){return r+Math.random()*(e-r)}function _c(r){return r*(.5-Math.random())}function vc(r){r!==void 0&&(oc=r);let e=oc+=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 yc(r){return r*fa}function bc(r){return r*ma}function xc(r){return(r&r-1)===0&&r!==0}function wc(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Ac(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function mi(r){const e=Math.PI*2;return(r%e+e)%e}function Pc(r,e,t){return r>e&&r<t||r>t&&r<e}function Sc(r,e,t,s=!1){return r=mi(r),e=mi(e),t=mi(t),s?e>t?r<=e&&r>=t:r<=e||r>=t:e<t?r>=e&&r<=t:r>=e||r<=t}function _a(r){return r=Math.abs(r),r<1?0:Math.ceil(Math.log10(Math.abs(r)+1))}function Ic(r,e=1e-7){const t=_a(r);return Math.max(Math.pow(10,t)*e,e)}const Oe={DEG2RAD:fa,RAD2DEG:ma,generateUUID:lc,clamp:Sn,euclideanModulo:ga,mapLinear:cc,inverseLerp:uc,lerp:pa,damp:hc,pingpong:dc,smoothstep:fc,smootherstep:mc,randInt:gc,randFloat:pc,randFloatSpread:_c,seededRandom:vc,degToRad:yc,radToDeg:bc,isPowerOfTwo:xc,ceilPowerOfTwo:wc,floorPowerOfTwo:Ac,normalizeAngle:mi,isBetween:Pc,isBetweenAngle:Sc,intPartLength:_a,relativeEps:Ic},va=class rh{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:l,y:c}=e;this.x=l,this.y=c;return}if(s===2){this.x=e,this.y=t;return}throw Gt.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 rh(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,l=e.elements;return this.x=l[0]*t+l[3]*s+l[6],this.y=l[1]*t+l[4]*s+l[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),l=Math.sin(t),c=this.x-e.x,h=this.y-e.y;return this.x=c*s-h*l+e.x,this.y=c*l+h*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(Oe.relativeEps(this.x,e),Oe.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};va.EMPTY=Object.freeze(new va(0,0));let Ze=va;const ya=class ih{constructor(e,t,s,l,c,h,v,b,p){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&s!=null&&l!=null&&c!=null&&h!=null&&v!=null&&b!=null&&p!=null&&this.set(e,t,s,l,c,h,v,b,p)}set(e,t,s,l,c,h,v,b,p){const S=this.elements;return S[0]=e,S[1]=l,S[2]=v,S[3]=t,S[4]=c,S[5]=b,S[6]=s,S[7]=h,S[8]=p,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,l=t.elements,c=this.elements,h=s[0],v=s[3],b=s[6],p=s[1],S=s[4],x=s[7],E=s[2],M=s[5],D=s[8],R=l[0],j=l[3],F=l[6],he=l[1],_e=l[4],de=l[7],H=l[2],ge=l[5],ce=l[8];return c[0]=h*R+v*he+b*H,c[3]=h*j+v*_e+b*ge,c[6]=h*F+v*de+b*ce,c[1]=p*R+S*he+x*H,c[4]=p*j+S*_e+x*ge,c[7]=p*F+S*de+x*ce,c[2]=E*R+M*he+D*H,c[5]=E*j+M*_e+D*ge,c[8]=E*F+M*de+D*ce,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],l=e[2],c=e[3],h=e[4],v=e[5],b=e[6],p=e[7],S=e[8];return t*h*S-t*v*p-s*c*S+s*v*b+l*c*p-l*h*b}invert(){const e=this.elements,t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],v=e[5],b=e[6],p=e[7],S=e[8],x=S*h-v*p,E=v*b-S*c,M=p*c-h*b,D=t*x+s*E+l*M;if(D===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/D;return e[0]=x*R,e[1]=(l*p-S*s)*R,e[2]=(v*s-l*h)*R,e[3]=E*R,e[4]=(S*t-l*b)*R,e[5]=(l*c-v*t)*R,e[6]=M*R,e[7]=(s*b-p*t)*R,e[8]=(h*t-s*c)*R,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,l,c,h,v){const b=Math.cos(c),p=Math.sin(c);return this.set(s*b,s*p,-s*(b*h+p*v)+h+e,-l*p,l*b,-l*(-p*h+b*v)+v+t,0,0,1),this}scale(e,t){return this.premultiply(ba.makeScale(e,t)),this}rotate(e){return this.premultiply(ba.makeRotation(-e)),this}translate(e,t){return this.premultiply(ba.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof Ze?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),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 l=0;l<9;l++)if(t[l]!==s[l])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 ih().fromArray(this.elements)}};ya.IDENTITY=Object.freeze(new ya);let ds=ya;const ba=new ds,or=1e-6,ut=2*Math.PI,Sg={x:0,y:0},xa={x:0,y:0,z:0};class Ec{constructor(){this.equalPointTol=or,this.equalVectorTol=or}equalPoint2d(e,t){return new Ze(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new Z(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=or){return e<t&&e>-t}static equal(e,t,s=or){return Math.abs(e-t)<s}static great(e,t,s=or){return e-t>s}static less(e,t,s=or){return e-t<s}}const wa=new Ec;function Aa(r,e,t=!1){const s=r.x,l=r.y;let c=!1;const h=e.length;for(let v=0,b=h-1;v<h;b=v++){const p=e[v].x,S=e[v].y,x=e[b].x,E=e[b].y;let M=S>l!=E>l;t&&(M=S>=l!=E>=l),M&&s<(x-p)*(l-S)/(E-S)+p&&(c=!c)}return c}function Tc(r,e){if(r.length===0||e.length===0)return!1;const t=new gt().setFromPoints(r),s=new gt().setFromPoints(e);if(!t.intersectsBox(s))return!1;for(let l=0;l<r.length;){if(Aa(r[l],e,!0))return!0;l<r.length-1&&wa.equalPoint2d(r[l+1],r[l])&&++l,++l}return!1}const Mc={isPointInPolygon:Aa,isPolygonIntersect:Tc};class zn{constructor(e=0,t=0,s=0,l=1){this._x=e,this._y=t,this._z=s,this._w=l}static slerpFlat(e,t,s,l,c,h,v){let b=s[l+0],p=s[l+1],S=s[l+2],x=s[l+3];const E=c[h+0],M=c[h+1],D=c[h+2],R=c[h+3];if(v===0){e[t+0]=b,e[t+1]=p,e[t+2]=S,e[t+3]=x;return}if(v===1){e[t+0]=E,e[t+1]=M,e[t+2]=D,e[t+3]=R;return}if(x!==R||b!==E||p!==M||S!==D){let j=1-v;const F=b*E+p*M+S*D+x*R,he=F>=0?1:-1,_e=1-F*F;if(_e>Number.EPSILON){const H=Math.sqrt(_e),ge=Math.atan2(H,F*he);j=Math.sin(j*ge)/H,v=Math.sin(v*ge)/H}const de=v*he;if(b=b*j+E*de,p=p*j+M*de,S=S*j+D*de,x=x*j+R*de,j===1-v){const H=1/Math.sqrt(b*b+p*p+S*S+x*x);b*=H,p*=H,S*=H,x*=H}}e[t]=b,e[t+1]=p,e[t+2]=S,e[t+3]=x}static multiplyQuaternionsFlat(e,t,s,l,c,h){const v=s[l],b=s[l+1],p=s[l+2],S=s[l+3],x=c[h],E=c[h+1],M=c[h+2],D=c[h+3];return e[t]=v*D+S*x+b*M-p*E,e[t+1]=b*D+S*E+p*x-v*M,e[t+2]=p*D+S*M+v*E-b*x,e[t+3]=S*D-v*x-b*E-p*M,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,s,l){return this._x=e,this._y=t,this._z=s,this._w=l,this._onChangeCallback(),this}clone(){return new zn(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,l=e.y,c=e.z,h=e.order,v=Math.cos,b=Math.sin,p=v(s/2),S=v(l/2),x=v(c/2),E=b(s/2),M=b(l/2),D=b(c/2);switch(h){case"XYZ":this._x=E*S*x+p*M*D,this._y=p*M*x-E*S*D,this._z=p*S*D+E*M*x,this._w=p*S*x-E*M*D;break;case"YXZ":this._x=E*S*x+p*M*D,this._y=p*M*x-E*S*D,this._z=p*S*D-E*M*x,this._w=p*S*x+E*M*D;break;case"ZXY":this._x=E*S*x-p*M*D,this._y=p*M*x+E*S*D,this._z=p*S*D+E*M*x,this._w=p*S*x-E*M*D;break;case"ZYX":this._x=E*S*x-p*M*D,this._y=p*M*x+E*S*D,this._z=p*S*D-E*M*x,this._w=p*S*x+E*M*D;break;case"YZX":this._x=E*S*x+p*M*D,this._y=p*M*x+E*S*D,this._z=p*S*D-E*M*x,this._w=p*S*x-E*M*D;break;case"XZY":this._x=E*S*x-p*M*D,this._y=p*M*x-E*S*D,this._z=p*S*D+E*M*x,this._w=p*S*x+E*M*D;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,l=Math.sin(s);return this._x=e.x*l,this._y=e.y*l,this._z=e.z*l,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],l=t[4],c=t[8],h=t[1],v=t[5],b=t[9],p=t[2],S=t[6],x=t[10],E=s+v+x;if(E>0){const M=.5/Math.sqrt(E+1);this._w=.25/M,this._x=(S-b)*M,this._y=(c-p)*M,this._z=(h-l)*M}else if(s>v&&s>x){const M=2*Math.sqrt(1+s-v-x);this._w=(S-b)/M,this._x=.25*M,this._y=(l+h)/M,this._z=(c+p)/M}else if(v>x){const M=2*Math.sqrt(1+v-s-x);this._w=(c-p)/M,this._x=(l+h)/M,this._y=.25*M,this._z=(b+S)/M}else{const M=2*Math.sqrt(1+x-s-v);this._w=(h-l)/M,this._x=(c+p)/M,this._y=(b+S)/M,this._z=.25*M}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(Sn(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const l=Math.min(1,t/s);return this.slerp(e,l),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,l=e._y,c=e._z,h=e._w,v=t._x,b=t._y,p=t._z,S=t._w;return this._x=s*S+h*v+l*p-c*b,this._y=l*S+h*b+c*v-s*p,this._z=c*S+h*p+s*b-l*v,this._w=h*S-s*v-l*b-c*p,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const s=this._x,l=this._y,c=this._z,h=this._w;let v=h*e._w+s*e._x+l*e._y+c*e._z;if(v<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,v=-v):this.copy(e),v>=1)return this._w=h,this._x=s,this._y=l,this._z=c,this;const b=1-v*v;if(b<=Number.EPSILON){const M=1-t;return this._w=M*h+t*this._w,this._x=M*s+t*this._x,this._y=M*l+t*this._y,this._z=M*c+t*this._z,this.normalize(),this}const p=Math.sqrt(b),S=Math.atan2(p,v),x=Math.sin((1-t)*S)/p,E=Math.sin(t*S)/p;return this._w=h*x+this._w*E,this._x=s*x+this._x*E,this._y=l*x+this._y*E,this._z=c*x+this._z*E,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(),l=Math.sqrt(1-s),c=Math.sqrt(s);return this.set(l*Math.sin(e),l*Math.cos(e),c*Math.sin(t),c*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 Lt=class sh{constructor(e,t,s){this.x=0,this.y=0,this.z=0;const l=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(l!==0){if(l===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(l===1){const{x:c,y:h,z:v}=e;this.x=c,this.y=h,this.z=v||0;return}if(l===3){this.x=e,this.y=t,this.z=s;return}throw Gt.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 sh(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(kc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(kc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,l=this.z,c=e.elements;return this.x=c[0]*t+c[3]*s+c[6]*l,this.y=c[1]*t+c[4]*s+c[7]*l,this.z=c[2]*t+c[5]*s+c[8]*l,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix3d(e){const t=this.x,s=this.y,l=this.z,c=e.elements,h=1/(c[3]*t+c[7]*s+c[11]*l+c[15]);return this.x=(c[0]*t+c[4]*s+c[8]*l+c[12])*h,this.y=(c[1]*t+c[5]*s+c[9]*l+c[13])*h,this.z=(c[2]*t+c[6]*s+c[10]*l+c[14])*h,this}applyQuaternion(e){const t=this.x,s=this.y,l=this.z,c=e.x,h=e.y,v=e.z,b=e.w,p=2*(h*l-v*s),S=2*(v*t-c*l),x=2*(c*s-h*t);return this.x=t+b*p+h*x-v*S,this.y=s+b*S+v*p-c*x,this.z=l+b*x+c*S-h*p,this}transformDirection(e){const t=this.x,s=this.y,l=this.z,c=e.elements;return this.x=c[0]*t+c[4]*s+c[8]*l,this.y=c[1]*t+c[5]*s+c[9]*l,this.z=c[2]*t+c[6]*s+c[10]*l,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(),l=e.length();return Math.abs(t)===s*l}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,l=e.y,c=e.z,h=t.x,v=t.y,b=t.z;return this.x=l*b-c*v,this.y=c*h-s*b,this.z=s*v-l*h,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 Pa.copy(this).projectOnVector(e),this.sub(Pa)}reflect(e){return this.sub(Pa.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,l=this.z-e.z;return t*t+s*s+l*l}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(),l=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=l,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}};Lt.X_AXIS=Object.freeze(new Lt(1,0,0)),Lt.NEGATIVE_X_AXIS=Object.freeze(new Lt(-1,0,0)),Lt.Y_AXIS=Object.freeze(new Lt(0,1,0)),Lt.NEGATIVE_Y_AXIS=Object.freeze(new Lt(0,-1,0)),Lt.Z_AXIS=Object.freeze(new Lt(0,0,1)),Lt.NEGATIVE_Z_AXIS=Object.freeze(new Lt(0,0,-1));let Z=Lt;const Pa=new Z,kc=new zn,Sa=class ah{constructor(e,t,s,l,c,h,v,b,p,S,x,E,M,D,R,j){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&s!=null&&l!=null&&c!=null&&h!=null&&v!=null&&b!=null&&p!=null&&S!=null&&x!=null&&E!=null&&M!=null&&D!=null&&R!=null&&j!=null&&this.set(e,t,s,l,c,h,v,b,p,S,x,E,M,D,R,j)}set(e,t,s,l,c,h,v,b,p,S,x,E,M,D,R,j){const F=this.elements;return F[0]=e,F[4]=t,F[8]=s,F[12]=l,F[1]=c,F[5]=h,F[9]=v,F[13]=b,F[2]=p,F[6]=S,F[10]=x,F[14]=E,F[3]=M,F[7]=D,F[11]=R,F[15]=j,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ah().fromArray(this.elements)}copy(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(wa.equalPoint3d(e,Z.Z_AXIS))this.identity();else{const t=new Z(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(Z.Y_AXIS,e).normalize():t.crossVectors(Z.Z_AXIS,e).normalize();const 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,l=1/Ir.setFromMatrixColumn(e,0).length(),c=1/Ir.setFromMatrixColumn(e,1).length(),h=1/Ir.setFromMatrixColumn(e,2).length();return t[0]=s[0]*l,t[1]=s[1]*l,t[2]=s[2]*l,t[3]=0,t[4]=s[4]*c,t[5]=s[5]*c,t[6]=s[6]*c,t[7]=0,t[8]=s[8]*h,t[9]=s[9]*h,t[10]=s[10]*h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ig,e,Eg)}lookAt(e,t,s){const l=this.elements;return Nt.subVectors(e,t),Nt.lengthSq()===0&&(Nt.z=1),Nt.normalize(),Rn.crossVectors(s,Nt),Rn.lengthSq()===0&&(Math.abs(s.z)===1?Nt.x+=1e-4:Nt.z+=1e-4,Nt.normalize(),Rn.crossVectors(s,Nt)),Rn.normalize(),fs.crossVectors(Nt,Rn),l[0]=Rn.x,l[4]=fs.x,l[8]=Nt.x,l[1]=Rn.y,l[5]=fs.y,l[9]=Nt.y,l[2]=Rn.z,l[6]=fs.z,l[10]=Nt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,l=t.elements,c=this.elements,h=s[0],v=s[4],b=s[8],p=s[12],S=s[1],x=s[5],E=s[9],M=s[13],D=s[2],R=s[6],j=s[10],F=s[14],he=s[3],_e=s[7],de=s[11],H=s[15],ge=l[0],ce=l[4],qe=l[8],Ke=l[12],$e=l[1],xe=l[5],Ne=l[9],pt=l[13],_t=l[2],Ot=l[6],nt=l[10],ht=l[14],J=l[3],Me=l[7],dt=l[11],Tn=l[15];return c[0]=h*ge+v*$e+b*_t+p*J,c[4]=h*ce+v*xe+b*Ot+p*Me,c[8]=h*qe+v*Ne+b*nt+p*dt,c[12]=h*Ke+v*pt+b*ht+p*Tn,c[1]=S*ge+x*$e+E*_t+M*J,c[5]=S*ce+x*xe+E*Ot+M*Me,c[9]=S*qe+x*Ne+E*nt+M*dt,c[13]=S*Ke+x*pt+E*ht+M*Tn,c[2]=D*ge+R*$e+j*_t+F*J,c[6]=D*ce+R*xe+j*Ot+F*Me,c[10]=D*qe+R*Ne+j*nt+F*dt,c[14]=D*Ke+R*pt+j*ht+F*Tn,c[3]=he*ge+_e*$e+de*_t+H*J,c[7]=he*ce+_e*xe+de*Ot+H*Me,c[11]=he*qe+_e*Ne+de*nt+H*dt,c[15]=he*Ke+_e*pt+de*ht+H*Tn,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],l=e[8],c=e[12],h=e[1],v=e[5],b=e[9],p=e[13],S=e[2],x=e[6],E=e[10],M=e[14],D=e[3],R=e[7],j=e[11],F=e[15];return D*(+c*b*x-l*p*x-c*v*E+s*p*E+l*v*M-s*b*M)+R*(+t*b*M-t*p*E+c*h*E-l*h*M+l*p*S-c*b*S)+j*(+t*p*x-t*v*M-c*h*x+s*h*M+c*v*S-s*p*S)+F*(-l*v*S-t*b*x+t*v*E+l*h*x-s*h*E+s*b*S)}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 l=this.elements;return e instanceof Z?(l[12]=e.x,l[13]=e.y,l[14]=e.z):(l[12]=e,l[13]=t,l[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],v=e[5],b=e[6],p=e[7],S=e[8],x=e[9],E=e[10],M=e[11],D=e[12],R=e[13],j=e[14],F=e[15],he=x*j*p-R*E*p+R*b*M-v*j*M-x*b*F+v*E*F,_e=D*E*p-S*j*p-D*b*M+h*j*M+S*b*F-h*E*F,de=S*R*p-D*x*p+D*v*M-h*R*M-S*v*F+h*x*F,H=D*x*b-S*R*b-D*v*E+h*R*E+S*v*j-h*x*j,ge=t*he+s*_e+l*de+c*H;if(ge===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const ce=1/ge;return e[0]=he*ce,e[1]=(R*E*c-x*j*c-R*l*M+s*j*M+x*l*F-s*E*F)*ce,e[2]=(v*j*c-R*b*c+R*l*p-s*j*p-v*l*F+s*b*F)*ce,e[3]=(x*b*c-v*E*c-x*l*p+s*E*p+v*l*M-s*b*M)*ce,e[4]=_e*ce,e[5]=(S*j*c-D*E*c+D*l*M-t*j*M-S*l*F+t*E*F)*ce,e[6]=(D*b*c-h*j*c-D*l*p+t*j*p+h*l*F-t*b*F)*ce,e[7]=(h*E*c-S*b*c+S*l*p-t*E*p-h*l*M+t*b*M)*ce,e[8]=de*ce,e[9]=(D*x*c-S*R*c-D*s*M+t*R*M+S*s*F-t*x*F)*ce,e[10]=(h*R*c-D*v*c+D*s*p-t*R*p-h*s*F+t*v*F)*ce,e[11]=(S*v*c-h*x*c-S*s*p+t*x*p+h*s*M-t*v*M)*ce,e[12]=H*ce,e[13]=(S*R*l-D*x*l+D*s*E-t*R*E-S*s*j+t*x*j)*ce,e[14]=(D*v*l-h*R*l-D*s*b+t*R*b+h*s*j-t*v*j)*ce,e[15]=(h*x*l-S*v*l+S*s*b-t*x*b-h*s*E+t*v*E)*ce,this}scale(e){const t=this.elements,s=e.x,l=e.y,c=e.z;return t[0]*=s,t[4]*=l,t[8]*=c,t[1]*=s,t[5]*=l,t[9]*=c,t[2]*=s,t[6]*=l,t[10]*=c,t[3]*=s,t[7]*=l,t[11]*=c,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],l=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,l))}makeTranslation(e,t,s){return e instanceof Z?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,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),l=Math.sin(t),c=1-s,h=e.x,v=e.y,b=e.z,p=c*h,S=c*v;return this.set(p*h+s,p*v-l*b,p*b+l*v,0,p*v+l*b,S*v+s,S*b-l*h,0,p*b-l*v,S*b+l*h,c*b*b+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,l,c,h){return this.set(1,s,c,0,e,1,h,0,t,l,1,0,0,0,0,1),this}compose(e,t,s){const l=this.elements,c=t.x,h=t.y,v=t.z,b=t.w,p=c+c,S=h+h,x=v+v,E=c*p,M=c*S,D=c*x,R=h*S,j=h*x,F=v*x,he=b*p,_e=b*S,de=b*x,H=s.x,ge=s.y,ce=s.z;return l[0]=(1-(R+F))*H,l[1]=(M+de)*H,l[2]=(D-_e)*H,l[3]=0,l[4]=(M-de)*ge,l[5]=(1-(E+F))*ge,l[6]=(j+he)*ge,l[7]=0,l[8]=(D+_e)*ce,l[9]=(j-he)*ce,l[10]=(1-(E+R))*ce,l[11]=0,l[12]=e.x,l[13]=e.y,l[14]=e.z,l[15]=1,this}decompose(e,t,s){const l=this.elements;let c=Ir.set(l[0],l[1],l[2]).length();const h=Ir.set(l[4],l[5],l[6]).length(),v=Ir.set(l[8],l[9],l[10]).length();this.determinant()<0&&(c=-c),e.x=l[12],e.y=l[13],e.z=l[14],qt.copy(this);const b=1/c,p=1/h,S=1/v;return qt.elements[0]*=b,qt.elements[1]*=b,qt.elements[2]*=b,qt.elements[4]*=p,qt.elements[5]*=p,qt.elements[6]*=p,qt.elements[8]*=S,qt.elements[9]*=S,qt.elements[10]*=S,t.setFromRotationMatrix(qt),s.x=c,s.y=h,s.z=v,this}equals(e){const t=this.elements,s=e.elements;for(let l=0;l<16;l++)if(t[l]!==s[l])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}};Sa.IDENTITY=Object.freeze(new Sa);let lr=Sa;const Ir=new Z,qt=new lr,Ig=new Z(0,0,0),Eg=new Z(1,1,1),Rn=new Z,fs=new Z,Nt=new Z;class Fe{constructor(e=void 0,t=void 0){this.min=e==null?new Z(1/0,1/0,1/0):new Z(e.x,e.y,e.z),this.max=t==null?new Z(-1/0,-1/0,-1/0):new Z(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t+=3)this.expandByPoint(Ia.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=Ia.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new Fe().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,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,Ia).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:(In[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(e),In[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(e),In[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(e),In[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(e),In[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(e),In[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(e),In[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(e),In[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(e),this.setFromPoints(In),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 In=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],Ia=new Z,Cc=new Ze;class gt{constructor(e=void 0,t=void 0){this.min=e==null?new Ze(1/0,1/0):new Ze(e.x,e.y),this.max=t==null?new Ze(-1/0,-1/0):new Ze(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=Cc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new gt().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Ze(0,0):new Ze(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Ze(0,0):new Ze(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Cc).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 Lc=new Z,Tg=new Z,Mg=new ds;class gi{constructor(e=new Z(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,s,l){return this.normal.set(e,t,s),this.constant=l,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const l=Lc.subVectors(s,t).cross(Tg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(l,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||Mg.getNormalMatrix(e),l=this.coplanarPoint(Lc).applyMatrix3d(e),c=this.normal.applyMatrix3(s).normalize();return this.constant=-l.dot(c),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 gi().copy(this)}}class Te extends Ze{static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((s,l)=>{s.toArray(t,l*2)}),t}}class Q extends Z{static pointArrayToNumberArray(e,t=!0){const s=t?3:2,l=new Array(e.length*s);return e.forEach((c,h)=>{c.toArray(l,h*s)}),l}}const Nc=new lr,Oc=new zn,Dc=class Xa{constructor(e=0,t=0,s=0,l=Xa.DEFAULT_ORDER){this._x=e,this._y=t,this._z=s,this._order=l}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,l=this._order){return this._x=e,this._y=t,this._z=s,this._order=l,this._onChangeCallback(),this}clone(){return new Xa(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 l=e.elements,c=l[0],h=l[4],v=l[8],b=l[1],p=l[5],S=l[9],x=l[2],E=l[6],M=l[10];switch(t){case"XYZ":this._y=Math.asin(Sn(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(-S,M),this._z=Math.atan2(-h,c)):(this._x=Math.atan2(E,p),this._z=0);break;case"YXZ":this._x=Math.asin(-Sn(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(v,M),this._z=Math.atan2(b,p)):(this._y=Math.atan2(-x,c),this._z=0);break;case"ZXY":this._x=Math.asin(Sn(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-h,p)):(this._y=0,this._z=Math.atan2(b,c));break;case"ZYX":this._y=Math.asin(-Sn(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(E,M),this._z=Math.atan2(b,c)):(this._x=0,this._z=Math.atan2(-h,p));break;case"YZX":this._z=Math.asin(Sn(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-S,p),this._y=Math.atan2(-x,c)):(this._x=0,this._y=Math.atan2(v,M));break;case"XZY":this._z=Math.asin(-Sn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(E,p),this._y=Math.atan2(v,c)):(this._x=Math.atan2(-S,M),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 Nc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Nc,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Oc.setFromEuler(this),this.setFromQuaternion(Oc,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}};Dc.DEFAULT_ORDER="XYZ";let zc=Dc;class Rc{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ea extends Rc{translate(e){return this.transform(new ds().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class ms extends Ea{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 gt}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const t=[];for(let s=0;s<this.loops.length;++s){const l=this.loops[s].getPoints(e);t.push(l)}return t}buildHierarchy(){var e;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),l=this.sortBoundaryBoxesByAreas(s),c=new Map,h=l.length;for(let b=0;b<h;b++)c.set(l[b],{index:l[b],children:[]});const v={index:-1,children:[]};for(let b=0;b<h;b++){const p=l[b],S=t[p],x=s[p];let E=b+1;for(;E<h;E++){const M=l[E],D=t[M];if(s[M].containsBox(x)&&Mc.isPointInPolygon(S[Oe.randInt(0,S.length-1)],D)){(e=c.get(M))==null||e.children.push(c.get(p));break}}E===h&&v.children.push(c.get(p))}return v}calculateBoundaryBoxes(e){const t=[];return e.forEach(s=>{t.push(new gt().setFromPoints(s))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((l,c)=>{const h=l.size,v=h.width*h.height;t.push({area:v,index:c})}),t.sort((l,c)=>l.area-c.area);const s=[];return t.forEach(l=>{s.push(l.index)}),s}}class Er extends Ea{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,l=this.getPoint(0),c=0;t.push(0);for(let h=1;h<=e;h++)s=this.getPoint(h/e),c+=s.distanceTo(l),t.push(c),l=s;return t}getUtoTmapping(e,t){const s=this.getLengths();let l=0;const c=s.length;let h;t?h=t:h=e*s[c-1];let v=0,b=c-1,p;for(;v<=b;)if(l=Math.floor(v+(b-v)/2),p=s[l]-h,p<0)v=l+1;else if(p>0)b=l-1;else{b=l;break}if(l=b,s[l]===h)return l/(c-1);const S=s[l],x=s[l+1]-S,E=(h-S)/x;return(l+E)/(c-1)}getTangent(e){let t=e-1e-4,s=e+1e-4;t<0&&(t=0),s>1&&(s=1);const l=this.getPoint(t),c=this.getPoint(s),h=new Te;return h.copy(c).sub(l).normalize(),h}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}}class Tr extends Er{constructor(e,t,s,l,c){super();const h=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(l!==void 0)+ +(c!==void 0);if(h==3)typeof e=="object"&&typeof t=="object"&&typeof s=="object"?this.createByThreePoints(e,t,s):this.createByStartEndPointsAndBulge(e,t,s);else if(h==5){const v=e;this.center=new Te(v.x,v.y),this.radius=t,this.startAngle=s,this.endAngle=l,this.clockwise=c}else throw Gt.ILLEGAL_PARAMETERS}createByThreePoints(e,t,s){const l=(ce,qe)=>({x:(ce.x+qe.x)/2,y:(ce.y+qe.y)/2}),c=(ce,qe)=>(qe.y-ce.y)/(qe.x-ce.x),h=ce=>-1/ce,v=l(e,t),b=l(t,s),p=c(e,t),S=c(t,s),x=h(p),E=h(S),M=(ce,qe,Ke,$e)=>{const xe=($e-qe)/(ce-Ke),Ne=ce*xe+qe;return{x:xe,y:Ne}},D=v.y-x*v.x,R=b.y-E*b.x,j=M(x,D,E,R),F=Math.sqrt(Math.pow(e.x-j.x,2)+Math.pow(e.y-j.y,2)),he=(ce,qe)=>Math.atan2(ce.y-qe.y,ce.x-qe.x),_e=he(e,j),de=he(t,j),H=he(s,j),ge=H>_e&&H<de||_e>H&&_e<de||de>H&&de<_e;this.center=j,this.radius=F,this.startAngle=_e,this.endAngle=H,this.clockwise=!ge}createByStartEndPointsAndBulge(e,t,s){let l,c,h;s<0?(l=Math.atan(-s)*4,c=new Ze(e),h=new Ze(t)):(l=Math.atan(s)*4,c=new Ze(t),h=new Ze(e));const v=new Ze().subVectors(h,c),b=v.length(),p=new Ze().addVectors(c,v.multiplyScalar(.5)),S=Math.abs(b/2/Math.tan(l/2)),x=v.normalize();let E;if(l<Math.PI){const M=new Ze(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=p.add(M.multiplyScalar(-S))}else{const M=new Ze(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=p.add(M.multiplyScalar(S))}s<0?(this.startAngle=Math.atan2(c.y-E.y,c.x-E.x),this.endAngle=Math.atan2(h.y-E.y,h.x-E.x)):(this.startAngle=Math.atan2(h.y-E.y,h.x-E.x),this.endAngle=Math.atan2(c.y-E.y,c.x-E.x)),this.clockwise=s<0,this.center=E,this.radius=h.sub(E).length()}get center(){return this._center}set center(e){this._center=new Te(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==ut?e:Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?Oe.normalizeAngle(this.startAngle-this.endAngle):Oe.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=Oe.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 c of t)Oe.isBetweenAngle(c,this.startAngle,this.endAngle,this.clockwise)&&e.push(this.getPointAtAngle(c));const s=e.map(c=>c.x),l=e.map(c=>c.y);return new gt(new Te(Math.min(...s),Math.min(...l)),new Te(Math.max(...s),Math.max(...l)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new Tr(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 Te(t,s)}getPoints(e=100){const t=[];let s=this.deltaAngle,l=this.startAngle;if(this.closed&&(s=ut,l=0),this.clockwise)for(let c=0;c<=e;c++){const h=l-s*(c/e),v=this.getPointAtAngle(h);t.push(new Te(v.x,v.y))}else for(let c=0;c<=e;c++){const h=l+s*(c/e),v=this.getPointAtAngle(h);t.push(new Te(v.x,v.y))}return t}}class kg extends Rc{translate(e){return this.transform(new lr().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 gs extends kg{}class Bn extends gs{constructor(e,t){super(),this._start=new Q(e),this._end=new Q(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new Z().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new Q((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(cr).normalize();return new Q(this._start).addScaledVector(s,e)}else{const s=this.delta(cr).normalize();return new Q(this._end).addScaledVector(s,e)}}extend(e,t=!1){if(t){const s=cr.subVectors(this._start,this._end).normalize();this._start=new Q(this._start).addScaledVector(s,e)}else{const s=this.delta(cr).normalize();this._end=new Q(this._end).addScaledVector(s,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){Bc.subVectors(e,this._start),ps.subVectors(this.endPoint,this.startPoint);const s=ps.dot(ps);let l=ps.dot(Bc)/s;return t&&(l=Oe.clamp(l,0,1)),l}closestPointToPoint(e,t,s){const l=this.closestPointToPointParameter(e,t);return this.delta(s).multiplyScalar(l).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=cr.subVectors(e,this.startPoint).dot(t);return new Q().copy(t).multiplyScalar(s).add(this.startPoint)}perpPoint(e){const t=this.direction,s=this.startPoint,l=cr.subVectors(e,s).dot(t),c=cr.copy(t).multiplyScalar(l);return new Q().addVectors(s,c)}calculateBoundingBox(){const e=new Q(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 Q(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 Fe(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 Bn(this._start.clone(),this._end.clone())}}const cr=new Z,Bc=new Z,ps=new Z;class ur extends gs{static computeCenterPoint(e,t,s){const l=new Z().addVectors(e,t).multiplyScalar(.5),c=new Z().addVectors(e,s).multiplyScalar(.5),h=new Z().subVectors(t,e),v=new Z().subVectors(s,e),b=new Z().crossVectors(h,v).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const p=new Z().crossVectors(h,b).normalize(),S=new Z().crossVectors(v,b).normalize(),x=p.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),E=S.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),M=new Bn(l,l.clone().add(x)),D=new Bn(c,c.clone().add(E)),R=new Z;return M.closestPointToPoint(D.startPoint,!0,R)?R:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(e,t,s){const l=ur.computeCenterPoint(e,t,s);if(l){const c=l.distanceTo(e),h=new Z().subVectors(e,l),v=new Z().subVectors(t,l),b=Math.atan2(h.y,h.x),p=Math.atan2(v.y,v.x);return new ur(l,c,b,p,Z.Z_AXIS)}}constructor(e,t,s,l,c,h=Z.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=s,this.endAngle=l,this.normal=c,this.refVec=h,(l-s)%ut==0?(this.startAngle=0,this.endAngle=ut):(this.startAngle=s,this.endAngle=l)}get center(){return this._center}set center(e){this._center=new Q(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw Gt.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==ut?e:Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Oe.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new Z(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Oe.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,s=1/0,l=1/0,c=-1/0,h=-1/0,v=-1/0;for(const b of e){const p=this.getPointAtAngle(b);p.x<t&&(t=p.x),p.y<s&&(s=p.y),p.z<l&&(l=p.z),p.x>c&&(c=p.x),p.y>h&&(h=p.y),p.z>v&&(v=p.z)}return new Fe({x:t,y:s,z:l},{x:c,y:h,z:v})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let s=this.deltaAngle,l=this.startAngle;this.closed&&(s=ut,l=0);for(let c=0;c<=e;c++){const h=l+s*(c/e),v=this.getPointAtAngle(h);t.push(v)}return t}transform(e){const t=Ta.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=Ta.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 ur(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(Ta.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,s=this.refVec,l={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},c=this.center,h=this.radius;return new Q(c.x+h*(s.x*Math.cos(e)+l.x*Math.sin(e)),c.y+h*(s.y*Math.cos(e)+l.y*Math.sin(e)),c.z+h*(s.z*Math.cos(e)+l.z*Math.sin(e)))}get plane(){const e=new Z(this.center).distanceTo(xa);return new gi(this.normal,e)}}const Ta=new Z;class _s extends Er{constructor(e,t,s,l=0,c=ut,h=!1,v=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=s,(c-l)%ut==0?(this.startAngle=0,this.endAngle=ut):(this.startAngle=l,this.endAngle=c),this.clockwise=h,this.rotation=v}get center(){return this._center}set center(e){this._center=new Q(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Gt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Gt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==ut?e:Oe.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 Oe.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,l=-1/0;for(let c=0;c<=100;c++){const h=this.getPoint(c/100);e=Math.min(e,h.x),t=Math.min(t,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y)}return new gt({x:e,y:t},{x:s,y:l})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let s=this.endAngle-this.startAngle;const l=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=t;for(;s>t;)s-=t;s<Number.EPSILON&&(l?s=0:s=t),this.clockwise===!0&&!l&&(s===t?s=-t:s=s-t);const c=this.startAngle+e*s;let h=this.center.x+this.majorAxisRadius*Math.cos(c),v=this.center.y+this.minorAxisRadius*Math.sin(c);if(this.rotation!==0){const b=Math.cos(this.rotation),p=Math.sin(this.rotation),S=h-this.center.x,x=v-this.center.y;h=S*b-x*p+this.center.x,v=S*p+x*b+this.center.y}return new Te(h,v)}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 _s(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}function Cg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Fc={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){var t={},s=this;new Function("try {return this===window;}catch(e){ return false;}");var l=new Function("try {return this===global;}catch(e){return false;}"),c=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(l()&&c(),l()||c()){var h=s;if(c()){var v=function(b,p){var S=s;return b.split(".").forEach(function(x){S&&(S=S[x])}),S?S[p]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var p=v(b.data.className,b.data.methodName);if(!p)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:p.apply(null,b.data.args),id:b.data.id})}}}}return function(b,p,S){p.geom=p.geom||{},p.exe=p.exe||{},p.eval=p.eval||{},p.core=p.core||{},p.promhx=p.promhx||{};var x={},E=function(){return Me.__string_rec(this,"")};function M(n,i){function a(){}a.prototype=n;var o=new a;for(var u in i)o[u]=i[u];return i.toString!==Object.prototype.toString&&(o.toString=i.toString),o}var D=function(){};x.HxOverrides=D,D.__name__=["HxOverrides"],D.strDate=function(n){var i=n.length;switch(i){case 8:var a=n.split(":"),o=new Date;return o.setTime(0),o.setUTCHours(a[0]),o.setUTCMinutes(a[1]),o.setUTCSeconds(a[2]),o;case 10:var u=n.split("-");return new Date(u[0],u[1]-1,u[2],0,0,0);case 19:var d=n.split(" "),m=d[0].split("-"),g=d[1].split(":");return new Date(m[0],m[1]-1,m[2],g[0],g[1],g[2]);default:throw new J("Invalid date format : "+n)}},D.cca=function(n,i){var a=n.charCodeAt(i);if(a==a)return a},D.substr=function(n,i,a){return i!=null&&i!=0&&a!=null&&a<0?"":(a==null&&(a=n.length),i<0?(i=n.length+i,i<0&&(i=0)):a<0&&(a=n.length+a-i),n.substr(i,a))},D.iter=function(n){return{cur:0,arr:n,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var R=function(){};x.Lambda=R,R.__name__=["Lambda"],R.fold=function(n,i,a){for(var o=Zt(n)();o.hasNext();){var u=o.next();a=i(u,a)}return a};var j=function(){this.length=0};x.List=j,j.__name__=["List"],j.prototype={add:function(n){var i=[n];this.h==null?this.h=i:this.q[1]=i,this.q=i,this.length++},pop:function(){if(this.h==null)return null;var n=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,n},isEmpty:function(){return this.h==null},__class__:j},Math.__name__=["Math"];var F=function(){};x.Reflect=F,F.__name__=["Reflect"],F.field=function(n,i){try{return n[i]}catch(a){return a instanceof J&&(a=a.val),null}},F.callMethod=function(n,i,a){return i.apply(n,a)},F.fields=function(n){var i=[];if(n!=null){var a=Object.prototype.hasOwnProperty;for(var o in n)o!="__id__"&&o!="hx__closures__"&&a.call(n,o)&&i.push(o)}return i},F.isFunction=function(n){return typeof n=="function"&&!(n.__name__||n.__ename__)},F.deleteField=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)?(delete n[i],!0):!1};var he=function(){};x.Std=he,he.__name__=["Std"],he.string=function(n){return Me.__string_rec(n,"")},he.parseFloat=function(n){return parseFloat(n)};var _e=function(){this.b=""};x.StringBuf=_e,_e.__name__=["StringBuf"],_e.prototype={add:function(n){this.b+=he.string(n)},__class__:_e};var de=function(){};x.StringTools=de,de.__name__=["StringTools"],de.fastCodeAt=function(n,i){return n.charCodeAt(i)};var H=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};H.TNull=["TNull",0],H.TNull.toString=E,H.TNull.__enum__=H,H.TInt=["TInt",1],H.TInt.toString=E,H.TInt.__enum__=H,H.TFloat=["TFloat",2],H.TFloat.toString=E,H.TFloat.__enum__=H,H.TBool=["TBool",3],H.TBool.toString=E,H.TBool.__enum__=H,H.TObject=["TObject",4],H.TObject.toString=E,H.TObject.__enum__=H,H.TFunction=["TFunction",5],H.TFunction.toString=E,H.TFunction.__enum__=H,H.TClass=function(n){var i=["TClass",6,n];return i.__enum__=H,i.toString=E,i},H.TEnum=function(n){var i=["TEnum",7,n];return i.__enum__=H,i.toString=E,i},H.TUnknown=["TUnknown",8],H.TUnknown.toString=E,H.TUnknown.__enum__=H;var ge=function(){};x.Type=ge,ge.__name__=["Type"],ge.getClassName=function(n){var i=n.__name__;return i==null?null:i.join(".")},ge.getEnumName=function(n){var i=n.__ename__;return i.join(".")},ge.resolveClass=function(n){var i=x[n];return i==null||!i.__name__?null:i},ge.resolveEnum=function(n){var i=x[n];return i==null||!i.__ename__?null:i},ge.createEmptyInstance=function(n){function i(){}return i.prototype=n.prototype,new i},ge.createEnum=function(n,i,a){var o=F.field(n,i);if(o==null)throw new J("No such constructor "+i);if(F.isFunction(o)){if(a==null)throw new J("Constructor "+i+" need parameters");return F.callMethod(n,o,a)}if(a!=null&&a.length!=0)throw new J("Constructor "+i+" does not need parameters");return o},ge.getEnumConstructs=function(n){var i=n.__constructs__;return i.slice()},ge.typeof=function(n){var i=typeof n;switch(i){case"boolean":return H.TBool;case"string":return H.TClass(String);case"number":return Math.ceil(n)==n%2147483648?H.TInt:H.TFloat;case"object":if(n==null)return H.TNull;var a=n.__enum__;if(a!=null)return H.TEnum(a);var o=Me.getClass(n);return o!=null?H.TClass(o):H.TObject;case"function":return n.__name__||n.__ename__?H.TObject:H.TFunction;case"undefined":return H.TNull;default:return H.TUnknown}};var ce=function(){};x["haxe.IMap"]=ce,ce.__name__=["haxe","IMap"];var qe=function(n,i){this.high=n,this.low=i};x["haxe._Int64.___Int64"]=qe,qe.__name__=["haxe","_Int64","___Int64"],qe.prototype={__class__:qe};var Ke=function(){this.buf=new _e,this.cache=[],this.useCache=Ke.USE_CACHE,this.useEnumIndex=Ke.USE_ENUM_INDEX,this.shash=new _t,this.scount=0};x["haxe.Serializer"]=Ke,Ke.__name__=["haxe","Serializer"],Ke.prototype={toString:function(){return this.buf.b},serializeString:function(n){var i=this.shash.get(n);if(i!=null){this.buf.b+="R",i==null?this.buf.b+="null":this.buf.b+=""+i;return}this.shash.set(n,this.scount++),this.buf.b+="y",n=encodeURIComponent(n),n.length==null?this.buf.b+="null":this.buf.b+=""+n.length,this.buf.b+=":",n==null?this.buf.b+="null":this.buf.b+=""+n},serializeRef:function(n){for(var i=typeof n,a=0,o=this.cache.length;a<o;){var u=a++,d=this.cache[u];if(typeof d==i&&d==n)return this.buf.b+="r",u==null?this.buf.b+="null":this.buf.b+=""+u,!0}return this.cache.push(n),!1},serializeFields:function(n){for(var i=0,a=F.fields(n);i<a.length;){var o=a[i];++i,this.serializeString(o),this.serialize(F.field(n,o))}this.buf.b+="g"},serialize:function(n){{var i=ge.typeof(n);switch(i[1]){case 0:this.buf.b+="n";break;case 1:var a=n;if(a==0){this.buf.b+="z";return}this.buf.b+="i",a==null?this.buf.b+="null":this.buf.b+=""+a;break;case 2:var o=n;isNaN(o)?this.buf.b+="k":isFinite(o)?(this.buf.b+="d",o==null?this.buf.b+="null":this.buf.b+=""+o):o<0?this.buf.b+="m":this.buf.b+="p";break;case 3:n?this.buf.b+="t":this.buf.b+="f";break;case 6:var u=i[2];if(u==String){this.serializeString(n);return}if(this.useCache&&this.serializeRef(n))return;switch(u){case Array:var d=0;this.buf.b+="a";for(var m=n.length,g=0;g<m;){var _=g++;n[_]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(n[_]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case j:this.buf.b+="l";for(var w=n,P=w.h,A=null;P!=null;){var I;A=P[0],P=P[1],I=A,this.serialize(I)}this.buf.b+="h";break;case Date:var T=n;this.buf.b+="v",this.buf.add(T.getTime());break;case _t:this.buf.b+="b";for(var k=n,O=k.keys();O.hasNext();){var N=O.next();this.serializeString(N),this.serialize(Ha[N]!=null?k.getReserved(N):k.h[N])}this.buf.b+="h";break;case xe:this.buf.b+="q";for(var B=n,z=B.keys();z.hasNext();){var V=z.next();this.buf.b+=":",V==null?this.buf.b+="null":this.buf.b+=""+V,this.serialize(B.h[V])}this.buf.b+="h";break;case Ne:this.buf.b+="M";for(var U=n,W=U.keys();W.hasNext();){var ee=W.next(),$=F.field(ee,"__id__");F.deleteField(ee,"__id__"),this.serialize(ee),ee.__id__=$,this.serialize(U.h[ee.__id__])}this.buf.b+="h";break;case Ot:for(var G=n,K=0,te=G.length-2,ne=new _e,se=Ke.BASE64;K<te;){var le=G.get(K++),ae=G.get(K++),ue=G.get(K++);ne.add(se.charAt(le>>2)),ne.add(se.charAt((le<<4|ae>>4)&63)),ne.add(se.charAt((ae<<2|ue>>6)&63)),ne.add(se.charAt(ue&63))}if(K==te){var ie=G.get(K++),fe=G.get(K++);ne.add(se.charAt(ie>>2)),ne.add(se.charAt((ie<<4|fe>>4)&63)),ne.add(se.charAt(fe<<2&63))}else if(K==te+1){var q=G.get(K++);ne.add(se.charAt(q>>2)),ne.add(se.charAt(q<<4&63))}var pe=ne.b;this.buf.b+="s",pe.length==null?this.buf.b+="null":this.buf.b+=""+pe.length,this.buf.b+=":",pe==null?this.buf.b+="null":this.buf.b+=""+pe;break;default:this.useCache&&this.cache.pop(),n.hxSerialize!=null?(this.buf.b+="C",this.serializeString(ge.getClassName(u)),this.useCache&&this.cache.push(n),n.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(ge.getClassName(u)),this.useCache&&this.cache.push(n),this.serializeFields(n))}break;case 4:if(Me.__instanceof(n,ju)){var Pe=ge.getClassName(n);this.buf.b+="A",this.serializeString(Pe)}else if(Me.__instanceof(n,Uu))this.buf.b+="B",this.serializeString(ge.getEnumName(n));else{if(this.useCache&&this.serializeRef(n))return;this.buf.b+="o",this.serializeFields(n)}break;case 7:var Ue=i[2];if(this.useCache){if(this.serializeRef(n))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(ge.getEnumName(Ue)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=he.string(n[1])):this.serializeString(n[0]),this.buf.b+=":";var Ye=n.length;this.buf.b+=he.string(Ye-2);for(var Be=2;Be<Ye;){var Qe=Be++;this.serialize(n[Qe])}this.useCache&&this.cache.push(n);break;case 5:throw new J("Cannot serialize function");default:throw new J("Cannot serialize "+he.string(n))}}},__class__:Ke};var $e=function(n){this.buf=n,this.length=n.length,this.pos=0,this.scache=[],this.cache=[];var i=$e.DEFAULT_RESOLVER;i==null&&(i=ge,$e.DEFAULT_RESOLVER=i),this.setResolver(i)};x["haxe.Unserializer"]=$e,$e.__name__=["haxe","Unserializer"],$e.initCodes=function(){for(var n=[],i=0,a=$e.BASE64.length;i<a;){var o=i++;n[$e.BASE64.charCodeAt(o)]=o}return n},$e.prototype={setResolver:function(n){n==null?this.resolver={resolveClass:function(i){return null},resolveEnum:function(i){return null}}:this.resolver=n},get:function(n){return this.buf.charCodeAt(n)},readDigits:function(){for(var n=0,i=!1,a=this.pos;;){var o=this.buf.charCodeAt(this.pos);if(o!=o)break;if(o==45){if(this.pos!=a)break;i=!0,this.pos++;continue}if(o<48||o>57)break;n=n*10+(o-48),this.pos++}return i&&(n*=-1),n},readFloat:function(){for(var n=this.pos;;){var i=this.buf.charCodeAt(this.pos);if(i>=43&&i<58||i==101||i==69)this.pos++;else break}return he.parseFloat(D.substr(this.buf,n,this.pos-n))},unserializeObject:function(n){for(;;){if(this.pos>=this.length)throw new J("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var i=this.unserialize();if(typeof i!="string")throw new J("Invalid object key");var a=this.unserialize();n[i]=a}this.pos++},unserializeEnum:function(n,i){if(this.get(this.pos++)!=58)throw new J("Invalid enum format");var a=this.readDigits();if(a==0)return ge.createEnum(n,i);for(var o=[];a-- >0;)o.push(this.unserialize());return ge.createEnum(n,i,o)},unserialize:function(){var n=this.get(this.pos++);switch(n){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var i=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<i)throw new J("Invalid string length");var a=D.substr(this.buf,this.pos,i);return this.pos+=i,a=decodeURIComponent(a.split("+").join(" ")),this.scache.push(a),a;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var o=[];for(this.cache.push(o);;){var u=this.buf.charCodeAt(this.pos);if(u==104){this.pos++;break}if(u==117){this.pos++;var d=this.readDigits();o[o.length+d-1]=null}else o.push(this.unserialize())}return o;case 111:var m={};return this.cache.push(m),this.unserializeObject(m),m;case 114:var g=this.readDigits();if(g<0||g>=this.cache.length)throw new J("Invalid reference");return this.cache[g];case 82:var _=this.readDigits();if(_<0||_>=this.scache.length)throw new J("Invalid string reference");return this.scache[_];case 120:throw new J(this.unserialize());case 99:var w=this.unserialize(),P=this.resolver.resolveClass(w);if(P==null)throw new J("Class not found "+w);var A=ge.createEmptyInstance(P);return this.cache.push(A),this.unserializeObject(A),A;case 119:var I=this.unserialize(),T=this.resolver.resolveEnum(I);if(T==null)throw new J("Enum not found "+I);var k=this.unserializeEnum(T,this.unserialize());return this.cache.push(k),k;case 106:var O=this.unserialize(),N=this.resolver.resolveEnum(O);if(N==null)throw new J("Enum not found "+O);this.pos++;var B=this.readDigits(),z=ge.getEnumConstructs(N)[B];if(z==null)throw new J("Unknown enum index "+O+"@"+B);var V=this.unserializeEnum(N,z);return this.cache.push(V),V;case 108:var U=new j;for(this.cache.push(U),this.buf;this.buf.charCodeAt(this.pos)!=104;)U.add(this.unserialize());return this.pos++,U;case 98:var W=new _t;for(this.cache.push(W),this.buf;this.buf.charCodeAt(this.pos)!=104;){var ee=this.unserialize();W.set(ee,this.unserialize())}return this.pos++,W;case 113:var $=new xe;this.cache.push($),this.buf;for(var G=this.get(this.pos++);G==58;){var K=this.readDigits();$.set(K,this.unserialize()),G=this.get(this.pos++)}if(G!=104)throw new J("Invalid IntMap format");return $;case 77:var te=new Ne;for(this.cache.push(te),this.buf;this.buf.charCodeAt(this.pos)!=104;){var ne=this.unserialize();te.set(ne,this.unserialize())}return this.pos++,te;case 118:var se;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var le=D.substr(this.buf,this.pos,19);se=D.strDate(le),this.pos+=19}else{var ae=this.readFloat(),ue=new Date;ue.setTime(ae),se=ue}return this.cache.push(se),se;case 115:var ie=this.readDigits(),fe=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<ie)throw new J("Invalid bytes length");var q=$e.CODES;q==null&&(q=$e.initCodes(),$e.CODES=q);var pe=this.pos,Pe=ie&3,Ue;Ue=(ie>>2)*3+(Pe>=2?Pe-1:0);for(var Ye=pe+(ie-Pe),Be=Ot.alloc(Ue),Qe=0;pe<Ye;){var It=q[de.fastCodeAt(fe,pe++)],Ut=q[de.fastCodeAt(fe,pe++)];Be.set(Qe++,It<<2|Ut>>4);var At=q[de.fastCodeAt(fe,pe++)];Be.set(Qe++,Ut<<4|At>>2);var yt=q[de.fastCodeAt(fe,pe++)];Be.set(Qe++,At<<6|yt)}if(Pe>=2){var Et=q[de.fastCodeAt(fe,pe++)],Bt=q[de.fastCodeAt(fe,pe++)];if(Be.set(Qe++,Et<<2|Bt>>4),Pe==3){var Qt=q[de.fastCodeAt(fe,pe++)];Be.set(Qe++,Bt<<4|Qt>>2)}}return this.pos+=ie,this.cache.push(Be),Be;case 67:var dn=this.unserialize(),Jt=this.resolver.resolveClass(dn);if(Jt==null)throw new J("Class not found "+dn);var en=ge.createEmptyInstance(Jt);if(this.cache.push(en),en.hxUnserialize(this),this.get(this.pos++)!=103)throw new J("Invalid custom data");return en;case 65:var tn=this.unserialize(),Cn=this.resolver.resolveClass(tn);if(Cn==null)throw new J("Class not found "+tn);return Cn;case 66:var Gr=this.unserialize(),_r=this.resolver.resolveEnum(Gr);if(_r==null)throw new J("Enum not found "+Gr);return _r}throw this.pos--,new J("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:$e};var xe=function(){this.h={}};x["haxe.ds.IntMap"]=xe,xe.__name__=["haxe","ds","IntMap"],xe.__interfaces__=[ce],xe.prototype={set:function(n,i){this.h[n]=i},remove:function(n){return this.h.hasOwnProperty(n)?(delete this.h[n],!0):!1},keys:function(){var n=[];for(var i in this.h)this.h.hasOwnProperty(i)&&n.push(i|0);return D.iter(n)},__class__:xe};var Ne=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Ne,Ne.__name__=["haxe","ds","ObjectMap"],Ne.__interfaces__=[ce],Ne.prototype={set:function(n,i){var a=n.__id__||(n.__id__=++Ne.count);this.h[a]=i,this.h.__keys__[a]=n},keys:function(){var n=[];for(var i in this.h.__keys__)this.h.hasOwnProperty(i)&&n.push(this.h.__keys__[i]);return D.iter(n)},__class__:Ne};var pt=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};pt.Some=function(n){var i=["Some",0,n];return i.__enum__=pt,i.toString=E,i},pt.None=["None",1],pt.None.toString=E,pt.None.__enum__=pt;var _t=function(){this.h={}};x["haxe.ds.StringMap"]=_t,_t.__name__=["haxe","ds","StringMap"],_t.__interfaces__=[ce],_t.prototype={set:function(n,i){Ha[n]!=null?this.setReserved(n,i):this.h[n]=i},get:function(n){return Ha[n]!=null?this.getReserved(n):this.h[n]},setReserved:function(n,i){this.rh==null&&(this.rh={}),this.rh["$"+n]=i},getReserved:function(n){return this.rh==null?null:this.rh["$"+n]},keys:function(){var n=this.arrayKeys();return D.iter(n)},arrayKeys:function(){var n=[];for(var i in this.h)this.h.hasOwnProperty(i)&&n.push(i);if(this.rh!=null)for(var i in this.rh)i.charCodeAt(0)==36&&n.push(i.substr(1));return n},__class__:_t};var Ot=function(n){this.length=n.byteLength,this.b=new $a(n),this.b.bufferValue=n,n.hxBytes=this,n.bytes=this.b};x["haxe.io.Bytes"]=Ot,Ot.__name__=["haxe","io","Bytes"],Ot.alloc=function(n){return new Ot(new Ms(n))},Ot.prototype={get:function(n){return this.b[n]},set:function(n,i){this.b[n]=i&255},__class__:Ot};var nt=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};nt.Blocked=["Blocked",0],nt.Blocked.toString=E,nt.Blocked.__enum__=nt,nt.Overflow=["Overflow",1],nt.Overflow.toString=E,nt.Overflow.__enum__=nt,nt.OutsideBounds=["OutsideBounds",2],nt.OutsideBounds.toString=E,nt.OutsideBounds.__enum__=nt,nt.Custom=function(n){var i=["Custom",3,n];return i.__enum__=nt,i.toString=E,i};var ht=function(){};x["haxe.io.FPHelper"]=ht,ht.__name__=["haxe","io","FPHelper"],ht.i32ToFloat=function(n){var i=1-(n>>>31<<1),a=n>>>23&255,o=n&8388607;return o==0&&a==0?0:i*(1+Math.pow(2,-23)*o)*Math.pow(2,a-127)},ht.floatToI32=function(n){if(n==0)return 0;var i;n<0?i=-n:i=n;var a=Math.floor(Math.log(i)/.6931471805599453);a<-127?a=-127:a>128&&(a=128);var o=Math.round((i/Math.pow(2,a)-1)*8388608)&8388607;return(n<0?-2147483648:0)|a+127<<23|o},ht.i64ToDouble=function(n,i){var a=1-(i>>>31<<1),o=(i>>20&2047)-1023,u=(i&1048575)*4294967296+(n>>>31)*2147483648+(n&2147483647);return u==0&&o==-1023?0:a*(1+Math.pow(2,-52)*u)*Math.pow(2,o)},ht.doubleToI64=function(n){var i=ht.i64tmp;if(n==0)i.low=0,i.high=0;else{var a;n<0?a=-n:a=n;var o=Math.floor(Math.log(a)/.6931471805599453),u,d=(a/Math.pow(2,o)-1)*4503599627370496;u=Math.round(d);var m=u|0,g=u/4294967296|0;i.low=m,i.high=(n<0?-2147483648:0)|o+1023<<20|g}return i};var J=function(n){Error.call(this),this.val=n,this.message=String(n),Error.captureStackTrace&&Error.captureStackTrace(this,J)};x["js._Boot.HaxeError"]=J,J.__name__=["js","_Boot","HaxeError"],J.__super__=Error,J.prototype=M(Error.prototype,{__class__:J});var Me=function(){};x["js.Boot"]=Me,Me.__name__=["js","Boot"],Me.getClass=function(n){if(n instanceof Array&&n.__enum__==null)return Array;var i=n.__class__;if(i!=null)return i;var a=Me.__nativeClassName(n);return a!=null?Me.__resolveNativeClass(a):null},Me.__string_rec=function(n,i){if(n==null)return"null";if(i.length>=5)return"<...>";var a=typeof n;switch(a=="function"&&(n.__name__||n.__ename__)&&(a="object"),a){case"object":if(n instanceof Array){if(n.__enum__){if(n.length==2)return n[0];var o=n[0]+"(";i+=" ";for(var u=2,d=n.length;u<d;){var m=u++;m!=2?o+=","+Me.__string_rec(n[m],i):o+=Me.__string_rec(n[m],i)}return o+")"}var g=n.length,_="[";i+=" ";for(var w=0;w<g;){var P=w++;_+=(P>0?",":"")+Me.__string_rec(n[P],i)}return _+="]",_}var A;try{A=n.toString}catch(N){return N instanceof J&&(N=N.val),"???"}if(A!=null&&A!=Object.toString&&typeof A=="function"){var I=n.toString();if(I!="[object Object]")return I}var T=null,k=`{
|
|
3
|
-
`;i+=" ";var O=n.hasOwnProperty!=null;for(var T in n)O&&!n.hasOwnProperty(T)||T=="prototype"||T=="__class__"||T=="__super__"||T=="__interfaces__"||T=="__properties__"||(k.length!=2&&(k+=`,
|
|
4
|
-
`),k+=i+T+" : "+Me.__string_rec(n[T],i));return i=i.substring(1),k+=`
|
|
5
|
-
`+i+"}",k;case"function":return"<function>";case"string":return n;default:return String(n)}},Me.__interfLoop=function(n,i){if(n==null)return!1;if(n==i)return!0;var a=n.__interfaces__;if(a!=null)for(var o=0,u=a.length;o<u;){var d=o++,m=a[d];if(m==i||Me.__interfLoop(m,i))return!0}return Me.__interfLoop(n.__super__,i)},Me.__instanceof=function(n,i){if(i==null)return!1;switch(i){case Vg:return(n|0)===n;case Fu:return typeof n=="number";case Vu:return typeof n=="boolean";case String:return typeof n=="string";case Array:return n instanceof Array&&n.__enum__==null;case jg:return!0;default:if(n!=null){if(typeof i=="function"){if(n instanceof i||Me.__interfLoop(Me.getClass(n),i))return!0}else if(typeof i=="object"&&Me.__isNativeObj(i)&&n instanceof i)return!0}else return!1;return i==ju&&n.__name__!=null||i==Uu&&n.__ename__!=null?!0:n.__enum__==i}},Me.__nativeClassName=function(n){var i=Me.__toStr.call(n).slice(8,-1);return i=="Object"||i=="Function"||i=="Math"||i=="JSON"?null:i},Me.__isNativeObj=function(n){return Me.__nativeClassName(n)!=null},Me.__resolveNativeClass=function(n){return S[n]};var dt=function(n){if(n instanceof Array&&n.__enum__==null)this.a=n,this.byteLength=n.length;else{var i=n;this.a=[];for(var a=0;a<i;){var o=a++;this.a[o]=0}this.byteLength=i}};x["js.html.compat.ArrayBuffer"]=dt,dt.__name__=["js","html","compat","ArrayBuffer"],dt.sliceImpl=function(n,i){var a=new $a(this,n,i==null?null:i-n),o=new Ms(a.byteLength),u=new $a(o);return u.set(a),o},dt.prototype={slice:function(n,i){return new dt(this.a.slice(n,i))},__class__:dt};var Tn=function(n,i,a){if(this.buf=n,i==null?this.offset=0:this.offset=i,a==null?this.length=n.byteLength-this.offset:this.length=a,this.offset<0||this.length<0||this.offset+this.length>n.byteLength)throw new J(nt.OutsideBounds)};x["js.html.compat.DataView"]=Tn,Tn.__name__=["js","html","compat","DataView"],Tn.prototype={getInt8:function(n){var i=this.buf.a[this.offset+n];return i>=128?i-256:i},getUint8:function(n){return this.buf.a[this.offset+n]},getInt16:function(n,i){var a=this.getUint16(n,i);return a>=32768?a-65536:a},getUint16:function(n,i){return i?this.buf.a[this.offset+n]|this.buf.a[this.offset+n+1]<<8:this.buf.a[this.offset+n]<<8|this.buf.a[this.offset+n+1]},getInt32:function(n,i){var a=this.offset+n,o=this.buf.a[a++],u=this.buf.a[a++],d=this.buf.a[a++],m=this.buf.a[a++];return i?o|u<<8|d<<16|m<<24:m|d<<8|u<<16|o<<24},getUint32:function(n,i){var a=this.getInt32(n,i);return a<0?a+4294967296:a},getFloat32:function(n,i){return ht.i32ToFloat(this.getInt32(n,i))},getFloat64:function(n,i){var a=this.getInt32(n,i),o=this.getInt32(n+4,i);return ht.i64ToDouble(i?a:o,i?o:a)},setInt8:function(n,i){i<0?this.buf.a[n+this.offset]=i+128&255:this.buf.a[n+this.offset]=i&255},setUint8:function(n,i){this.buf.a[n+this.offset]=i&255},setInt16:function(n,i,a){this.setUint16(n,i<0?i+65536:i,a)},setUint16:function(n,i,a){var o=n+this.offset;a?(this.buf.a[o]=i&255,this.buf.a[o++]=i>>8&255):(this.buf.a[o++]=i>>8&255,this.buf.a[o]=i&255)},setInt32:function(n,i,a){this.setUint32(n,i,a)},setUint32:function(n,i,a){var o=n+this.offset;a?(this.buf.a[o++]=i&255,this.buf.a[o++]=i>>8&255,this.buf.a[o++]=i>>16&255,this.buf.a[o++]=i>>>24):(this.buf.a[o++]=i>>>24,this.buf.a[o++]=i>>16&255,this.buf.a[o++]=i>>8&255,this.buf.a[o++]=i&255)},setFloat32:function(n,i,a){this.setUint32(n,ht.floatToI32(i),a)},setFloat64:function(n,i,a){var o=ht.doubleToI64(i);a?(this.setUint32(n,o.low),this.setUint32(n,o.high)):(this.setUint32(n,o.high),this.setUint32(n,o.low))},__class__:Tn};var ln=function(){};x["js.html.compat.Uint8Array"]=ln,ln.__name__=["js","html","compat","Uint8Array"],ln._new=function(n,i,a){var o;if(typeof n=="number"){o=[];for(var u=0;u<n;){var d=u++;o[d]=0}o.byteLength=o.length,o.byteOffset=0,o.buffer=new dt(o)}else if(Me.__instanceof(n,dt)){var m=n;i==null&&(i=0),a==null&&(a=m.byteLength-i),i==0?o=m.a:o=m.a.slice(i,i+a),o.byteLength=o.length,o.byteOffset=i,o.buffer=m}else if(n instanceof Array&&n.__enum__==null)o=n.slice(),o.byteLength=o.length,o.byteOffset=0,o.buffer=new dt(o);else throw new J("TODO "+he.string(n));return o.subarray=ln._subarray,o.set=ln._set,o},ln._set=function(n,i){var a=this;if(Me.__instanceof(n.buffer,dt)){var o=n;if(n.byteLength+i>a.byteLength)throw new J("set() outside of range");for(var u=0,d=n.byteLength;u<d;){var m=u++;a[m+i]=o[m]}}else if(n instanceof Array&&n.__enum__==null){var g=n;if(g.length+i>a.byteLength)throw new J("set() outside of range");for(var _=0,w=g.length;_<w;){var P=_++;a[P+i]=g[P]}}else throw new J("TODO")},ln._subarray=function(n,i){var a=this,o=ln._new(a.slice(n,i));return o.byteOffset=n,o};var Ie=function(n){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,n!=null&&Ie.link(n,this,function(i){return i})};x["promhx.base.AsyncBase"]=Ie,Ie.__name__=["promhx","base","AsyncBase"],Ie.link=function(n,i,a){n._update.push({async:i,linkf:function(o){i.handleResolve(a(o))}}),Ie.immediateLinkUpdate(n,i,a)},Ie.immediateLinkUpdate=function(n,i,a){if(n._errored&&!n._errorPending&&!(n._error.length>0)&&i.handleError(n._errorVal),n._resolved&&!n._pending)try{i.handleResolve(a(n._val))}catch(o){o instanceof J&&(o=o.val),i.handleError(o)}},Ie.linkAll=function(n,i){for(var a=function(d,m,g){if(d.length==0||Ie.allFulfilled(d)){for(var _,w=[],P=Zt(n)();P.hasNext();){var A=P.next();w.push(A==m?g:A._val)}_=w,i.handleResolve(_)}},o=Zt(n)();o.hasNext();){var u=o.next();u._update.push({async:i,linkf:function(d,m,g){return function(_){d(m,g,_)}}(a,function(d){for(var m,g=[],_=Zt(n)();_.hasNext();){var w=_.next();w!=u&&g.push(w)}return m=g,m}(),u)})}Ie.allFulfilled(n)&&i.handleResolve(function(d){for(var m,g=[],_=Zt(n)();_.hasNext();){var w=_.next();g.push(w._val)}return m=g,m}())},Ie.pipeLink=function(n,i,a){var o=!1,u=function(d){if(!o){o=!0;var m=a(d);m._update.push({async:i,linkf:Rt(i,i.handleResolve)}),Ie.immediateLinkUpdate(m,i,function(g){return g})}};if(n._update.push({async:i,linkf:u}),n._resolved&&!n._pending)try{u(n._val)}catch(d){d instanceof J&&(d=d.val),i.handleError(d)}},Ie.allResolved=function(n){for(var i=Zt(n)();i.hasNext();){var a=i.next();if(!a._resolved)return!1}return!0},Ie.allFulfilled=function(n){for(var i=Zt(n)();i.hasNext();){var a=i.next();if(!a._fulfilled)return!1}return!0},Ie.prototype={catchError:function(n){return this._error.push(n),this},errorThen:function(n){return this._errorMap=n,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(n){this._resolve(n)},_resolve:function(n){var i=this;this._pending?Ae.enqueue(function(a,o){return function(){a(o)}}(Rt(this,this._resolve),n)):(this._resolved=!0,this._pending=!0,Ae.queue.add(function(){i._val=n;for(var a=0,o=i._update;a<o.length;){var u=o[a];++a;try{u.linkf(n)}catch(d){d instanceof J&&(d=d.val),u.async.handleError(d)}}i._fulfilled=!0,i._pending=!1}),Ae.continueOnNextLoop())},handleError:function(n){this._handleError(n)},_handleError:function(n){var i=this,a=function(o){if(i._error.length>0)for(var u=0,d=i._error;u<d.length;){var m=d[u];++u,m(o)}else if(i._update.length>0)for(var g=0,_=i._update;g<_.length;){var w=_[g];++g,w.async.handleError(o)}else throw new J(o);i._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=n,Ae.queue.add(function(){if(i._errorMap!=null)try{i._resolve(i._errorMap(n))}catch(o){o instanceof J&&(o=o.val),a(o)}else a(n)}),Ae.continueOnNextLoop())},then:function(n){var i=new Ie(null);return Ie.link(this,i,n),i},unlink:function(n){var i=this;Ae.queue.add(function(){i._update=i._update.filter(function(a){return a.async!=n})}),Ae.continueOnNextLoop()},isLinked:function(n){for(var i=!1,a=0,o=this._update;a<o.length;){var u=o[a];if(++a,u.async==n)return!0}return i},__class__:Ie};var Lr=p.promhx.Deferred=function(){Ie.call(this)};x["promhx.Deferred"]=Lr,Lr.__name__=["promhx","Deferred"],Lr.__super__=Ie,Lr.prototype=M(Ie.prototype,{resolve:function(n){this.handleResolve(n)},throwError:function(n){this.handleError(n)},promise:function(){return new vt(this)},stream:function(){return new We(this)},publicStream:function(){return new Vn(this)},__class__:Lr});var vt=p.promhx.Promise=function(n){Ie.call(this,n),this._rejected=!1};x["promhx.Promise"]=vt,vt.__name__=["promhx","Promise"],vt.whenAll=function(n){var i=new vt(null);return Ie.linkAll(n,i),i},vt.promise=function(n){var i=new vt;return i.handleResolve(n),i},vt.__super__=Ie,vt.prototype=M(Ie.prototype,{isRejected:function(){return this._rejected},reject:function(n){this._rejected=!0,this.handleError(n)},handleResolve:function(n){if(this._resolved){var i="Promise has already been resolved";throw new J(Nr.AlreadyResolved(i))}this._resolve(n)},then:function(n){var i=new vt(null);return Ie.link(this,i,n),i},unlink:function(n){var i=this;Ae.queue.add(function(){if(i._fulfilled)i._update=i._update.filter(function(o){return o.async!=n});else{var a="Downstream Promise is not fullfilled";i.handleError(Nr.DownstreamNotFullfilled(a))}}),Ae.continueOnNextLoop()},handleError:function(n){this._rejected=!0,this._handleError(n)},pipe:function(n){var i=new vt(null);return Ie.pipeLink(this,i,n),i},errorPipe:function(n){var i=new vt;return this.catchError(function(a){var o=n(a);o.then(Rt(i,i._resolve))}),this.then(Rt(i,i._resolve)),i},__class__:vt});var We=p.promhx.Stream=function(n){Ie.call(this,n),this._end_promise=new vt};x["promhx.Stream"]=We,We.__name__=["promhx","Stream"],We.foreach=function(n){for(var i=new We(null),a=Zt(n)();a.hasNext();){var o=a.next();i.handleResolve(o)}return i.end(),i},We.wheneverAll=function(n){var i=new We(null);return Ie.linkAll(n,i),i},We.concatAll=function(n){for(var i=new We(null),a=Zt(n)();a.hasNext();){var o=a.next();i.concat(o)}return i},We.mergeAll=function(n){for(var i=new We(null),a=Zt(n)();a.hasNext();){var o=a.next();i.merge(o)}return i},We.stream=function(n){var i=new We(null);return i.handleResolve(n),i},We.__super__=Ie,We.prototype=M(Ie.prototype,{then:function(n){var i=new We(null);return Ie.link(this,i,n),this._end_promise._update.push({async:i._end_promise,linkf:function(a){i.end()}}),i},detachStream:function(n){for(var i=[],a=!1,o=0,u=this._update;o<u.length;){var d=u[o];++o,d.async==n?(this._end_promise._update=this._end_promise._update.filter(function(m){return m.async!=n._end_promise}),a=!0):i.push(d)}return this._update=i,a},first:function(){var n=new vt(null);return this.then(function(i){n._resolved||n.handleResolve(i)}),n},handleResolve:function(n){!this._end&&!this._pause&&this._resolve(n)},pause:function(n){n==null&&(n=!this._pause),this._pause=n},pipe:function(n){var i=new We(null);return Ie.pipeLink(this,i,n),this._end_promise.then(function(a){i.end()}),i},errorPipe:function(n){var i=new We(null);return this.catchError(function(a){var o=n(a);o.then(Rt(i,i._resolve)),o._end_promise.then((Ga=i._end_promise,Rt(Ga,Ga._resolve)))}),this.then(Rt(i,i._resolve)),this._end_promise.then(function(a){i.end()}),i},handleEnd:function(){if(this._pending)Ae.queue.add(Rt(this,this.handleEnd)),Ae.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var n;this._resolved?n=pt.Some(this._val):n=pt.None,this._end_promise.handleResolve(n),this._update=[],this._error=[]}},end:function(){return Ae.queue.add(Rt(this,this.handleEnd)),Ae.continueOnNextLoop(),this},endThen:function(n){return this._end_promise.then(n)},filter:function(n){var i=new We(null);return this._update.push({async:i,linkf:function(a){n(a)&&i.handleResolve(a)}}),Ie.immediateLinkUpdate(this,i,function(a){return a}),i},concat:function(n){var i=new We(null);return this._update.push({async:i,linkf:Rt(i,i.handleResolve)}),Ie.immediateLinkUpdate(this,i,function(a){return a}),this._end_promise.then(function(a){n.pipe(function(o){return i.handleResolve(o),i}),n._end_promise.then(function(o){i.end()})}),i},merge:function(n){var i=new We(null);return this._update.push({async:i,linkf:Rt(i,i.handleResolve)}),n._update.push({async:i,linkf:Rt(i,i.handleResolve)}),Ie.immediateLinkUpdate(this,i,function(a){return a}),Ie.immediateLinkUpdate(n,i,function(a){return a}),i},__class__:We});var Vn=p.promhx.PublicStream=function(n){We.call(this,n)};x["promhx.PublicStream"]=Vn,Vn.__name__=["promhx","PublicStream"],Vn.publicstream=function(n){var i=new Vn(null);return i.handleResolve(n),i},Vn.__super__=We,Vn.prototype=M(We.prototype,{resolve:function(n){this.handleResolve(n)},throwError:function(n){this.handleError(n)},update:function(n){this.handleResolve(n)},__class__:Vn});var Ae=function(){};x["promhx.base.EventLoop"]=Ae,Ae.__name__=["promhx","base","EventLoop"],Ae.enqueue=function(n){Ae.queue.add(n),Ae.continueOnNextLoop()},Ae.set_nextLoop=function(n){if(Ae.nextLoop!=null)throw new J("nextLoop has already been set");return Ae.nextLoop=n,Ae.nextLoop},Ae.queueEmpty=function(){return Ae.queue.isEmpty()},Ae.finish=function(n){n==null&&(n=1e3);for(var i=null;n-- >0&&(i=Ae.queue.pop())!=null;)i();return Ae.queue.isEmpty()},Ae.clear=function(){Ae.queue=new j},Ae.f=function(){var n=Ae.queue.pop();n!=null&&n(),Ae.queue.isEmpty()||Ae.continueOnNextLoop()},Ae.continueOnNextLoop=function(){Ae.nextLoop!=null?Ae.nextLoop(Ae.f):setImmediate(Ae.f)};var Nr=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};Nr.AlreadyResolved=function(n){var i=["AlreadyResolved",0,n];return i.__enum__=Nr,i.toString=E,i},Nr.DownstreamNotFullfilled=function(n){var i=["DownstreamNotFullfilled",1,n];return i.__enum__=Nr,i.toString=E,i};var Es=function(){};x["verb.Verb"]=Es,Es.__name__=["verb","Verb"],Es.main=function(){b.log("verb 2.1.0")};var Y=function(){};x["verb.core.ArrayExtensions"]=Y,Y.__name__=["verb","core","ArrayExtensions"],Y.alloc=function(n,i){if(!(i<0))for(;n.length<i;)n.push(null)},Y.reversed=function(n){var i=n.slice();return i.reverse(),i},Y.last=function(n){return n[n.length-1]},Y.first=function(n){return n[0]},Y.spliceAndInsert=function(n,i,a,o){n.splice(i,a),n.splice(i,0,o)},Y.left=function(n){if(n.length==0)return[];var i=Math.ceil(n.length/2);return n.slice(0,i)},Y.right=function(n){if(n.length==0)return[];var i=Math.ceil(n.length/2);return n.slice(i)},Y.rightWithPivot=function(n){if(n.length==0)return[];var i=Math.ceil(n.length/2);return n.slice(i-1)},Y.unique=function(n,i){if(n.length==0)return[];for(var a=[n.pop()];n.length>0;){for(var o=n.pop(),u=!0,d=0;d<a.length;){var m=a[d];if(++d,i(o,m)){u=!1;break}}u&&a.push(o)}return a};var ze=function(){};x["verb.core.Binomial"]=ze,ze.__name__=["verb","core","Binomial"],ze.get=function(n,i){if(i==0)return 1;if(n==0||i>n)return 0;if(i>n-i&&(i=n-i),ze.memo_exists(n,i))return ze.get_memo(n,i);for(var a=1,o=n,u=1,d=i+1;u<d;){var m=u++;if(ze.memo_exists(o,m)){n--,a=ze.get_memo(o,m);continue}a*=n--,a/=m,ze.memoize(o,m,a)}return a},ze.get_no_memo=function(n,i){if(i==0)return 1;if(n==0||i>n)return 0;i>n-i&&(i=n-i);for(var a=1,o=1,u=i+1;o<u;){var d=o++;a*=n--,a/=d}return a},ze.memo_exists=function(n,i){return ze.memo.h.hasOwnProperty(n)&&ze.memo.h[n].h.hasOwnProperty(i)},ze.get_memo=function(n,i){return ze.memo.h[n].h[i]},ze.memoize=function(n,i,a){ze.memo.h.hasOwnProperty(n)||ze.memo.set(n,new xe),ze.memo.h[n].h[i]=a};var Dt=p.core.BoundingBox=function(n){this.max=null,this.min=null,this.dim=3,this.initialized=!1,n!=null&&this.addRange(n)};x["verb.core.BoundingBox"]=Dt,Dt.__name__=["verb","core","BoundingBox"],Dt.intervalsOverlap=function(n,i,a,o,u){u==null&&(u=-1);var d;u<-.5?d=re.TOLERANCE:d=u;var m=Math.min(n,i)-d,g=Math.max(n,i)+d,_=Math.min(a,o)-d,w=Math.max(a,o)+d;return m>=_&&m<=w||g>=_&&g<=w||_>=m&&_<=g||w>=m&&w<=g},Dt.prototype={fromPoint:function(n){return new Dt([n])},add:function(n){if(!this.initialized)return this.dim=n.length,this.min=n.slice(0),this.max=n.slice(0),this.initialized=!0,this;for(var i=0,a=this.dim;i<a;){var o=i++;n[o]>this.max[o]&&(this.max[o]=n[o]),n[o]<this.min[o]&&(this.min[o]=n[o])}return this},addRange:function(n){for(var i=n.length,a=0;a<i;){var o=a++;this.add(n[o])}return this},contains:function(n,i){return i==null&&(i=-1),this.initialized?this.intersects(new Dt([n]),i):!1},intersects:function(n,i){if(i==null&&(i=-1),!this.initialized||!n.initialized)return!1;for(var a=this.min,o=this.max,u=n.min,d=n.max,m=0,g=this.dim;m<g;){var _=m++;if(!Dt.intervalsOverlap(a[_],o[_],u[_],d[_],i))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var n=0,i=0,a=0,o=this.dim;a<o;){var u=a++,d=this.getAxisLength(u);d>n&&(n=d,i=u)}return i},getAxisLength:function(n){return n<0||n>this.dim-1?0:Math.abs(this.min[n]-this.max[n])},intersect:function(n,i){if(!this.initialized)return null;var a=this.min,o=this.max,u=n.min,d=n.max;if(!this.intersects(n,i))return null;for(var m=[],g=[],_=0,w=this.dim;_<w;){var P=_++;m.push(Math.min(o[P],d[P])),g.push(Math.max(a[P],u[P]))}return new Dt([g,m])},__class__:Dt};var re=p.core.Constants=function(){};x["verb.core.Constants"]=re,re.__name__=["verb","core","Constants"];var Je=p.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=Je,Je.__name__=["verb","core","SerializableBase"],Je.prototype={serialize:function(){var n=new Ke;return n.serialize(this),n.toString()},__class__:Je};var vi=p.core.Plane=function(n,i){this.origin=n,this.normal=i};x["verb.core.Plane"]=vi,vi.__name__=["verb","core","Plane"],vi.__super__=Je,vi.prototype=M(Je.prototype,{__class__:vi});var Or=p.core.Ray=function(n,i){this.origin=n,this.dir=i};x["verb.core.Ray"]=Or,Or.__name__=["verb","core","Ray"],Or.__super__=Je,Or.prototype=M(Je.prototype,{__class__:Or});var je=p.core.NurbsCurveData=function(n,i,a){this.degree=n,this.controlPoints=a,this.knots=i};x["verb.core.NurbsCurveData"]=je,je.__name__=["verb","core","NurbsCurveData"],je.__super__=Je,je.prototype=M(Je.prototype,{__class__:je});var rt=p.core.NurbsSurfaceData=function(n,i,a,o,u){this.degreeU=n,this.degreeV=i,this.knotsU=a,this.knotsV=o,this.controlPoints=u};x["verb.core.NurbsSurfaceData"]=rt,rt.__name__=["verb","core","NurbsSurfaceData"],rt.__super__=Je,rt.prototype=M(Je.prototype,{__class__:rt});var Yt=p.core.MeshData=function(n,i,a,o){this.faces=n,this.points=i,this.normals=a,this.uvs=o};x["verb.core.MeshData"]=Yt,Yt.__name__=["verb","core","MeshData"],Yt.empty=function(){return new Yt([],[],[],[])},Yt.__super__=Je,Yt.prototype=M(Je.prototype,{__class__:Yt});var yi=p.core.PolylineData=function(n,i){this.points=n,this.params=i};x["verb.core.PolylineData"]=yi,yi.__name__=["verb","core","PolylineData"],yi.__super__=Je,yi.prototype=M(Je.prototype,{__class__:yi});var bi=p.core.VolumeData=function(n,i,a,o,u,d,m){this.degreeU=n,this.degreeV=i,this.degreeW=a,this.knotsU=o,this.knotsV=u,this.knotsW=d,this.controlPoints=m};x["verb.core.VolumeData"]=bi,bi.__name__=["verb","core","VolumeData"],bi.__super__=Je,bi.prototype=M(Je.prototype,{__class__:bi});var it=p.core.Pair=function(n,i){this.item0=n,this.item1=i};x["verb.core.Pair"]=it,it.__name__=["verb","core","Pair"],it.prototype={__class__:it};var St=p.core.Interval=function(n,i){this.min=n,this.max=i};x["verb.core.Interval"]=St,St.__name__=["verb","core","Interval"],St.prototype={__class__:St};var gr=p.core.CurveCurveIntersection=function(n,i,a,o){this.point0=n,this.point1=i,this.u0=a,this.u1=o};x["verb.core.CurveCurveIntersection"]=gr,gr.__name__=["verb","core","CurveCurveIntersection"],gr.prototype={__class__:gr};var xi=p.core.CurveSurfaceIntersection=function(n,i,a,o){this.u=n,this.uv=i,this.curvePoint=a,this.surfacePoint=o};x["verb.core.CurveSurfaceIntersection"]=xi,xi.__name__=["verb","core","CurveSurfaceIntersection"],xi.prototype={__class__:xi};var jn=p.core.MeshIntersectionPoint=function(n,i,a,o,u){this.visited=!1,this.adj=null,this.opp=null,this.uv0=n,this.uv1=i,this.point=a,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=jn,jn.__name__=["verb","core","MeshIntersectionPoint"],jn.prototype={__class__:jn};var wi=p.core.PolylineMeshIntersection=function(n,i,a,o,u){this.point=n,this.u=i,this.uv=a,this.polylineIndex=o,this.faceIndex=u};x["verb.core.PolylineMeshIntersection"]=wi,wi.__name__=["verb","core","PolylineMeshIntersection"],wi.prototype={__class__:wi};var Ai=p.core.SurfaceSurfaceIntersectionPoint=function(n,i,a,o){this.uv0=n,this.uv1=i,this.point=a,this.dist=o};x["verb.core.SurfaceSurfaceIntersectionPoint"]=Ai,Ai.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],Ai.prototype={__class__:Ai};var Pi=p.core.TriSegmentIntersection=function(n,i,a,o){this.point=n,this.s=i,this.t=a,this.p=o};x["verb.core.TriSegmentIntersection"]=Pi,Pi.__name__=["verb","core","TriSegmentIntersection"],Pi.prototype={__class__:Pi};var Dr=p.core.CurveTriPoint=function(n,i,a){this.u=n,this.point=i,this.uv=a};x["verb.core.CurveTriPoint"]=Dr,Dr.__name__=["verb","core","CurveTriPoint"],Dr.prototype={__class__:Dr};var Vt=function(n,i,a,o,u){u==null&&(u=!1),o==null&&(o=-1),this.uv=a,this.point=n,this.normal=i,this.id=o,this.degen=u};x["verb.core.SurfacePoint"]=Vt,Vt.__name__=["verb","core","SurfacePoint"],Vt.fromUv=function(n,i){return new Vt(null,null,[n,i])},Vt.prototype={__class__:Vt};var Ts=p.core.CurvePoint=function(n,i){this.u=n,this.pt=i};x["verb.core.CurvePoint"]=Ts,Ts.__name__=["verb","core","CurvePoint"],Ts.prototype={__class__:Ts};var Si=p.core.KdTree=function(n,i){this.dim=3,this.points=n,this.distanceFunction=i,this.dim=n[0].point.length,this.root=this.buildTree(n,0,null)};x["verb.core.KdTree"]=Si,Si.__name__=["verb","core","KdTree"],Si.prototype={buildTree:function(n,i,a){var o=i%this.dim,u,d;return n.length==0?null:n.length==1?new Rr(n[0],o,a):(n.sort(function(m,g){var _=m.point[o]-g.point[o];return _==0?0:_>0?1:-1}),u=Math.floor(n.length/2),d=new Rr(n[u],o,a),d.left=this.buildTree(n.slice(0,u),i+1,d),d.right=this.buildTree(n.slice(u+1),i+1,d),d)},nearest:function(n,i,a){var o=this,u=new Ii(function(A){return-A.item1}),d,m=null;m=function(A){for(var I,T=A.dimension,k=o.distanceFunction(n,A.kdPoint.point),O,N=[],B=0,z=o.dim;B<z;)B++,N.push(0);O=N;for(var V,U,W=function(K,te){u.push(new it(K,te)),u.size()>i&&u.pop()},ee=0,$=o.dim;ee<$;){var G=ee++;G==A.dimension?O[G]=n[G]:O[G]=A.kdPoint.point[G]}if(V=o.distanceFunction(O,A.kdPoint.point),A.right==null&&A.left==null){(u.size()<i||k<u.peek().item1)&&W(A,k);return}A.right==null?I=A.left:A.left==null?I=A.right:n[T]<A.kdPoint.point[T]?I=A.left:I=A.right,m(I),(u.size()<i||k<u.peek().item1)&&W(A,k),(u.size()<i||Math.abs(V)<u.peek().item1)&&(I==A.left?U=A.right:U=A.left,U!=null&&m(U))},d=m;for(var g=0;g<i;)g++,u.push(new it(null,a));d(this.root);for(var _=[],w=0;w<i;){var P=w++;u.content[P].item0!=null&&_.push(new it(u.content[P].item0.kdPoint,u.content[P].item1))}return _},__class__:Si};var Ii=function(n){this.content=[],this.scoreFunction=n};x["verb.core.BinaryHeap"]=Ii,Ii.__name__=["verb","core","BinaryHeap"],Ii.prototype={push:function(n){this.content.push(n),this.bubbleUp(this.content.length-1)},pop:function(){var n=this.content[0],i=this.content.pop();return this.content.length>0&&(this.content[0]=i,this.sinkDown(0)),n},peek:function(){return this.content[0]},remove:function(n){for(var i=this.content.length,a=0;a<i;){var o=a++;if(this.content[o]==n){var u=this.content.pop();o!=i-1&&(this.content[o]=u,this.scoreFunction(u)<this.scoreFunction(n)?this.bubbleUp(o):this.sinkDown(o));return}}throw new J("Node not found.")},size:function(){return this.content.length},bubbleUp:function(n){for(var i=this.content[n];n>0;){var a=Math.floor((n+1)/2)-1,o=this.content[a];if(this.scoreFunction(i)<this.scoreFunction(o))this.content[a]=i,this.content[n]=o,n=a;else break}},sinkDown:function(n){for(var i=this.content.length,a=this.content[n],o=this.scoreFunction(a);;){var u=(n+1)*2,d=u-1,m=-1,g=0;if(d<i){var _=this.content[d];g=this.scoreFunction(_),g<o&&(m=d)}if(u<i){var w=this.content[u],P=this.scoreFunction(w);P<(m==-1?o:g)&&(m=u)}if(m!=-1)this.content[n]=this.content[m],this.content[m]=a,n=m;else break}},__class__:Ii};var zr=p.core.KdPoint=function(n,i){this.point=n,this.obj=i};x["verb.core.KdPoint"]=zr,zr.__name__=["verb","core","KdPoint"],zr.prototype={__class__:zr};var Rr=p.core.KdNode=function(n,i,a){this.kdPoint=n,this.left=null,this.right=null,this.parent=a,this.dimension=i};x["verb.core.KdNode"]=Rr,Rr.__name__=["verb","core","KdNode"],Rr.prototype={__class__:Rr};var Mn=function(){};x["verb.eval.IBoundingBoxTree"]=Mn,Mn.__name__=["verb","eval","IBoundingBoxTree"],Mn.prototype={__class__:Mn};var cn=function(n,i){this._boundingBox=null,this._curve=n,i==null&&(i=f.domain(this._curve.knots)/64),this._knotTol=i};x["verb.core.LazyCurveBoundingBoxTree"]=cn,cn.__name__=["verb","core","LazyCurveBoundingBoxTree"],cn.__interfaces__=[Mn],cn.prototype={split:function(){var n=Y.first(this._curve.knots),i=Y.last(this._curve.knots),a=i-n,o=ft.curveSplit(this._curve,(i+n)/2+a*.1*Math.random());return new it(new cn(o[0],this._knotTol),new cn(o[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Dt(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(n){return f.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:cn};var un=function(n,i){if(this._boundingBox=null,this._mesh=n,i==null){for(var a=[],o=0,u=n.faces.length;o<u;){var d=o++;a.push(d)}i=a}this._faceIndices=i};x["verb.core.LazyMeshBoundingBoxTree"]=un,un.__name__=["verb","core","LazyMeshBoundingBoxTree"],un.__interfaces__=[Mn],un.prototype={split:function(){var n=st.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),i=Y.left(n),a=Y.right(n);return new it(new un(this._mesh,i),new un(this._mesh,a))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=st.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(n){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:un};var hn=function(n,i){this._boundingBox=null,this._polyline=n,i==null&&(i=new St(0,n.points.length!=0?n.points.length-1:0)),this._interval=i};x["verb.core.LazyPolylineBoundingBoxTree"]=hn,hn.__name__=["verb","core","LazyPolylineBoundingBoxTree"],hn.__interfaces__=[Mn],hn.prototype={split:function(){var n=this._interval.min,i=this._interval.max,a=n+Math.ceil((i-n)/2),o=new St(n,a),u=new St(a,i);return new it(new hn(this._polyline,o),new hn(this._polyline,u))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Dt(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(n){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:hn};var Un=function(n,i,a,o){i==null&&(i=!1),this._boundingBox=null,this._surface=n,this._splitV=i,a==null&&(a=f.domain(n.knotsU)/16),o==null&&(o=f.domain(n.knotsV)/16),this._knotTolU=a,this._knotTolV=o};x["verb.core.LazySurfaceBoundingBoxTree"]=Un,Un.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Un.__interfaces__=[Mn],Un.prototype={split:function(){var n,i;this._splitV?(n=Y.first(this._surface.knotsV),i=Y.last(this._surface.knotsV)):(n=Y.first(this._surface.knotsU),i=Y.last(this._surface.knotsU));var a=(n+i)/2,o=ft.surfaceSplit(this._surface,a,this._splitV);return new it(new Un(o[0],!this._splitV,this._knotTolU,this._knotTolV),new Un(o[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Dt;for(var n=0,i=this._surface.controlPoints;n<i.length;){var a=i[n];++n,this._boundingBox.addRange(C.dehomogenize1d(a))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(n){return f.domain(this._surface.knotsV)<this._knotTolV&&f.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Un};var Le=p.core.Mat=function(){};x["verb.core.Mat"]=Le,Le.__name__=["verb","core","Mat"],Le.mul=function(n,i){for(var a=[],o=0,u=i.length;o<u;){var d=o++;a.push(f.mul(n,i[d]))}return a},Le.mult=function(n,i){var a,o,u,d,m,g,_,w;a=n.length,o=i.length,u=i[0].length,d=[];for(var P=a-1,A=0,I=0;P>=0;){for(m=[],g=n[P],I=u-1;I>=0;){for(_=g[o-1]*i[o-1][I],A=o-2;A>=1;)w=A-1,_+=g[A]*i[A][I]+g[w]*i[w][I],A-=2;A==0&&(_+=g[0]*i[0][I]),m[I]=_,I--}d[P]=m,P--}return d},Le.add=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(f.add(n[d],i[d]))}return a},Le.div=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(f.div(n[d],i))}return a},Le.sub=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(f.sub(n[d],i[d]))}return a},Le.dot=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(f.dot(n[d],i))}return a},Le.identity=function(n){for(var i=f.zeros2d(n,n),a=0;a<n;){var o=a++;i[o][o]=1}return i},Le.transpose=function(n){if(n.length==0)return[];for(var i=[],a=0,o=n[0].length;a<o;){var u=a++;i.push(function(d){for(var m,g=[],_=0,w=n.length;_<w;){var P=_++;g.push(n[P][u])}return m=g,m}())}return i},Le.solve=function(n,i){return Le.LUsolve(Le.LU(n),i)},Le.LUsolve=function(n,i){var a,o,u=n.LU,d=u.length,m=i.slice(),g=n.P,_,w,P;for(a=d-1;a!=-1;)m[a]=i[a],--a;for(a=0;a<d;){for(_=g[a],g[a]!=a&&(P=m[a],m[a]=m[_],m[_]=P),w=u[a],o=0;o<a;)m[a]-=m[o]*w[o],++o;++a}for(a=d-1;a>=0;){for(w=u[a],o=a+1;o<d;)m[a]-=m[o]*w[o],++o;m[a]/=w[a],--a}return m},Le.LU=function(n){for(var i,a,o,u,d,m,g,_,w,P=[],A=0,I=n.length;A<I;){var T=A++;P.push(n[T].slice())}n=P;var k=n.length,O=k-1,N=[];for(o=0;o<k;){for(g=o,m=n[o],w=Math.abs(m[o]),a=o+1;a<k;)u=Math.abs(n[a][o]),w<u&&(w=u,g=a),++a;for(N[o]=g,g!=o&&(n[o]=n[g],n[g]=m,m=n[o]),d=m[o],i=o+1;i<k;)n[i][o]/=d,++i;for(i=o+1;i<k;){for(_=n[i],a=o+1;a<O;)_[a]-=_[o]*m[a],++a,_[a]-=_[o]*m[a],++a;a==O&&(_[a]-=_[o]*m[a]),++i}++o}return new Ei(n,N)};var Ei=function(n,i){this.LU=n,this.P=i};x["verb.core._Mat.LUDecomp"]=Ei,Ei.__name__=["verb","core","_Mat","LUDecomp"],Ei.prototype={__class__:Ei};var st=p.core.Mesh=function(){};x["verb.core.Mesh"]=st,st.__name__=["verb","core","Mesh"],st.getTriangleNorm=function(n,i){var a=n[i[0]],o=n[i[1]],u=n[i[2]],d=f.sub(o,a),m=f.sub(u,a),g=f.cross(d,m);return f.mul(1/f.norm(g),g)},st.makeMeshAabb=function(n,i){for(var a=new Dt,o=0;o<i.length;){var u=i[o];++o,a.add(n.points[n.faces[u][0]]),a.add(n.points[n.faces[u][1]]),a.add(n.points[n.faces[u][2]])}return a},st.sortTrianglesOnLongestAxis=function(n,i,a){for(var o=n.getLongestAxis(),u=[],d=0;d<a.length;){var m=a[d];++d;var g=st.getMinCoordOnAxis(i.points,i.faces[m],o);u.push(new it(g,m))}u.sort(function(I,T){var k=I.item0,O=T.item0;return k==O?0:k>O?1:-1});for(var _=[],w=0,P=u.length;w<P;){var A=w++;_.push(u[A].item1)}return _},st.getMinCoordOnAxis=function(n,i,a){for(var o=1/0,u=0;u<3;){var d=u++,m=n[i[d]][a];m<o&&(o=m)}return o},st.getTriangleCentroid=function(n,i){for(var a=[0,0,0],o=0;o<3;)for(var u=o++,d=0;d<3;){var m=d++;a[m]+=n[i[u]][m]}for(var g=0;g<3;){var _=g++;a[_]/=3}return a},st.triangleUVFromPoint=function(n,i,a){var o=n.faces[i],u=n.points[o[0]],d=n.points[o[1]],m=n.points[o[2]],g=n.uvs[o[0]],_=n.uvs[o[1]],w=n.uvs[o[2]],P=f.sub(u,a),A=f.sub(d,a),I=f.sub(m,a),T=f.norm(f.cross(f.sub(u,d),f.sub(u,m))),k=f.norm(f.cross(A,I))/T,O=f.norm(f.cross(I,P))/T,N=f.norm(f.cross(P,A))/T;return f.add(f.mul(k,g),f.add(f.mul(O,_),f.mul(N,w)))};var Gn=function(n,i){if(this._empty=!1,this._face=-1,i==null){for(var a=[],o=0,u=n.faces.length;o<u;){var d=o++;a.push(d)}i=a}if(this._boundingBox=st.makeMeshAabb(n,i),i.length<1){this._empty=!0;return}else if(i.length<2){this._face=i[0];return}var m=st.sortTrianglesOnLongestAxis(this._boundingBox,n,i),g=Y.left(m),_=Y.right(m);this._children=new it(new Gn(n,g),new Gn(n,_))};x["verb.core.MeshBoundingBoxTree"]=Gn,Gn.__name__=["verb","core","MeshBoundingBoxTree"],Gn.__interfaces__=[Mn],Gn.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(n){return this._children==null},empty:function(){return this._empty},__class__:Gn};var Xt=p.core.Minimizer=function(){};x["verb.core.Minimizer"]=Xt,Xt.__name__=["verb","core","Minimizer"],Xt.uncmin=function(n,i,a,o,u){a==null&&(a=1e-8),o==null&&(o=function(ee){return Xt.numericalGradient(n,ee)}),u==null&&(u=1e3),i=i.slice(0);var d=i.length,m=n(i),g=m,_;if(isNaN(m))throw new J("uncmin: f(x0) is a NaN!");a=Math.max(a,re.EPSILON);var w,P,A,I=Le.identity(d),T=0,k=[],O,N,B,z,V,U,W="";for(P=o(i);T<u;){if(!f.all(f.finite(P))){W="Gradient has Infinity or NaN";break}if(w=f.neg(Le.dot(I,P)),!f.all(f.finite(w))){W="Search direction has Infinity or NaN";break}if(U=f.norm(w),U<a){W="Newton step smaller than tol";break}for(V=1,_=f.dot(P,w),O=i;T<u&&!(V*U<a);){if(k=f.mul(V,w),O=f.add(i,k),g=n(O),g-m>=.1*V*_||isNaN(g)){V*=.5,++T;continue}break}if(V*U<a){W="Line search step size smaller than tol";break}if(T==u){W="maxit reached during line search";break}A=o(O),N=f.sub(A,P),z=f.dot(N,k),B=Le.dot(I,N),I=Le.sub(Le.add(I,Le.mul((z+f.dot(N,B))/(z*z),Xt.tensor(k,k))),Le.div(Le.add(Xt.tensor(B,k),Xt.tensor(k,B)),z)),i=O,m=g,P=A,++T}return new Ti(i,m,P,I,T,W)},Xt.numericalGradient=function(n,i){var a=i.length,o=n(i);if(o==NaN)throw new J("gradient: f(x) is a NaN!");for(var u=i.slice(0),d,m,g=[],_,w=.001,P,A,I,T=0,k,O,N,B=0;B<a;)for(var z=B++,V=Math.max(1e-6*o,1e-8);;){if(++T,T>20)throw new J("Numerical gradient fails");if(u[z]=i[z]+V,d=n(u),u[z]=i[z]-V,m=n(u),u[z]=i[z],isNaN(d)||isNaN(m)){V/=16;continue}if(g[z]=(d-m)/(2*V),P=i[z]-V,A=i[z],I=i[z]+V,k=(d-o)/V,O=(o-m)/V,N=f.max([Math.abs(g[z]),Math.abs(o),Math.abs(d),Math.abs(m),Math.abs(P),Math.abs(A),Math.abs(I),1e-8]),_=Math.min(f.max([Math.abs(k-g[z]),Math.abs(O-g[z]),Math.abs(k-O)])/N,V/N),_>w)V/=16;else break}return g},Xt.tensor=function(n,i){for(var a=n.length,o=i.length,u=[],d,m,g=a-1;g>=0;){d=[],m=n[g];for(var _=o-1;_>=3;)d[_]=m*i[_],--_,d[_]=m*i[_],--_,d[_]=m*i[_],--_,d[_]=m*i[_],--_;for(;_>=0;)d[_]=m*i[_],--_;u[g]=d,g--}return u};var Ti=function(n,i,a,o,u,d){this.solution=n,this.value=i,this.gradient=a,this.invHessian=o,this.iterations=u,this.message=d};x["verb.core.MinimizationResult"]=Ti,Ti.__name__=["verb","core","MinimizationResult"],Ti.prototype={__class__:Ti};var Br=function(){};x["verb.core.ISerializable"]=Br,Br.__name__=["verb","core","ISerializable"],Br.prototype={__class__:Br};var Ua=p.core.Deserializer=function(){};x["verb.core.Deserializer"]=Ua,Ua.__name__=["verb","core","Deserializer"],Ua.deserialize=function(n){var i=new $e(n),a=i.unserialize();return a};var zt=p.core.Trig=function(){};x["verb.core.Trig"]=zt,zt.__name__=["verb","core","Trig"],zt.isPointInPlane=function(n,i,a){return Math.abs(f.dot(f.sub(n,i.origin),i.normal))<a},zt.distToSegment=function(n,i,a){var o=zt.segmentClosestPoint(i,n,a,0,1);return f.dist(i,o.pt)},zt.rayClosestPoint=function(n,i,a){var o=f.sub(n,i),u=f.dot(o,a),d=f.add(i,f.mul(u,a));return d},zt.distToRay=function(n,i,a){var o=zt.rayClosestPoint(n,i,a),u=f.sub(o,n);return f.norm(u)},zt.threePointsAreFlat=function(n,i,a,o){var u=f.sub(i,n),d=f.sub(a,n),m=f.cross(u,d),g=f.dot(m,m);return g<o},zt.segmentClosestPoint=function(n,i,a,o,u){var d=f.sub(a,i),m=f.norm(d);if(m<re.EPSILON)return{u:o,pt:i};var g=i,_=f.mul(1/m,d),w=f.sub(n,g),P=f.dot(w,_);return P<0?{u:o,pt:i}:P>m?{u,pt:a}:{u:o+(u-o)*P/m,pt:f.add(g,f.mul(P,_))}};var f=p.core.Vec=function(){};x["verb.core.Vec"]=f,f.__name__=["verb","core","Vec"],f.angleBetween=function(n,i){return Math.acos(f.dot(n,i)/(f.norm(n)*f.norm(i)))},f.positiveAngleBetween=function(n,i,a){var o=f.cross(n,i),u=f.norm(n),d=f.norm(i),m=u*d,g=f.dot(n,i),_=f.norm(o)/m,w=g/m,P=Math.atan2(_,w),A=f.dot(a,o);return Math.abs(A)<re.EPSILON||A>0?P:-P},f.signedAngleBetween=function(n,i,a){var o=f.cross(n,i),u=f.norm(n),d=f.norm(i),m=u*d,g=f.dot(n,i),_=f.norm(o)/m,w=g/m,P=Math.atan2(_,w),A=f.dot(a,o);return A>0?P:2*Math.PI-P},f.angleBetweenNormalized2d=function(n,i){var a=n[0]*i[1]-n[1]*i[0];return Math.atan2(a,f.dot(n,i))},f.domain=function(n){return Y.last(n)-Y.first(n)},f.range=function(n){for(var i=[],a=0,o=0;o<n;)o++,i.push(a),a+=1;return i},f.span=function(n,i,a){if(a==null)return[];if(a<re.EPSILON)return[];if(n>i&&a>0)return[];if(i>n&&a<0)return[];for(var o=[],u=n;u<=i;)o.push(u),u+=a;return o},f.neg=function(n){return n.map(function(i){return-i})},f.min=function(n){return R.fold(n,function(i,a){return Math.min(i,a)},1/0)},f.max=function(n){return R.fold(n,function(i,a){return Math.max(i,a)},-1/0)},f.all=function(n){return R.fold(n,function(i,a){return a&&i},!0)},f.finite=function(n){return n.map(function(i){return isFinite(i)})},f.onRay=function(n,i,a){return f.add(n,f.mul(a,i))},f.lerp=function(n,i,a){return f.add(f.mul(n,i),f.mul(1-n,a))},f.normalized=function(n){return f.div(n,f.norm(n))},f.cross=function(n,i){return[n[1]*i[2]-n[2]*i[1],n[2]*i[0]-n[0]*i[2],n[0]*i[1]-n[1]*i[0]]},f.dist=function(n,i){return f.norm(f.sub(n,i))},f.distSquared=function(n,i){return f.normSquared(f.sub(n,i))},f.sum=function(n){return R.fold(n,function(i,a){return a+i},0)},f.addAll=function(n){var i=Zt(n)();if(!i.hasNext())return null;var a=i.next().length;return R.fold(n,function(o,u){return f.add(u,o)},f.rep(a,0))},f.addAllMutate=function(n){for(var i=n[0],a=1,o=n.length;a<o;){var u=a++;f.addMutate(i,n[u])}},f.addMulMutate=function(n,i,a){for(var o=0,u=n.length;o<u;){var d=o++;n[d]=n[d]+i*a[d]}},f.subMulMutate=function(n,i,a){for(var o=0,u=n.length;o<u;){var d=o++;n[d]=n[d]-i*a[d]}},f.addMutate=function(n,i){for(var a=0,o=n.length;a<o;){var u=a++;n[u]=n[u]+i[u]}},f.subMutate=function(n,i){for(var a=0,o=n.length;a<o;){var u=a++;n[u]=n[u]-i[u]}},f.mulMutate=function(n,i){for(var a=0,o=i.length;a<o;){var u=a++;i[u]=i[u]*n}},f.norm=function(n){var i=f.normSquared(n);return i!=0?Math.sqrt(i):i},f.normSquared=function(n){return R.fold(n,function(i,a){return a+i*i},0)},f.rep=function(n,i){for(var a=[],o=0;o<n;)o++,a.push(i);return a},f.zeros1d=function(n){for(var i=[],a=0;a<n;)a++,i.push(0);return i},f.zeros2d=function(n,i){for(var a=[],o=0;o<n;)o++,a.push(f.zeros1d(i));return a},f.zeros3d=function(n,i,a){for(var o=[],u=0;u<n;)u++,o.push(f.zeros2d(i,a));return o},f.dot=function(n,i){for(var a=0,o=0,u=n.length;o<u;){var d=o++;a+=n[d]*i[d]}return a},f.add=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(n[d]+i[d])}return a},f.mul=function(n,i){for(var a=[],o=0,u=i.length;o<u;){var d=o++;a.push(n*i[d])}return a},f.div=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(n[d]/i)}return a},f.sub=function(n,i){for(var a=[],o=0,u=n.length;o<u;){var d=o++;a.push(n[d]-i[d])}return a},f.isZero=function(n){for(var i=0,a=n.length;i<a;){var o=i++;if(Math.abs(n[o])>re.TOLERANCE)return!1}return!0},f.sortedSetUnion=function(n,i){for(var a=[],o=0,u=0;o<n.length||u<i.length;){if(o>=n.length){a.push(i[u]),u++;continue}else if(u>=i.length){a.push(n[o]),o++;continue}var d=n[o]-i[u];if(Math.abs(d)<re.EPSILON){a.push(n[o]),o++,u++;continue}if(d>0){a.push(i[u]),u++;continue}a.push(n[o]),o++}return a},f.sortedSetSub=function(n,i){for(var a=[],o=0,u=0;o<n.length;){if(u>=i.length){a.push(n[o]),o++;continue}if(Math.abs(n[o]-i[u])<re.EPSILON){o++,u++;continue}a.push(n[o]),o++}return a};var be=p.eval.Analyze=function(){};x["verb.eval.Analyze"]=be,be.__name__=["verb","eval","Analyze"],be.knotMultiplicities=function(n){for(var i=[new Fr(n[0],0)],a=i[0],o=0;o<n.length;){var u=n[o];++o,Math.abs(u-a.knot)>re.EPSILON&&(a=new Fr(u,0),i.push(a)),a.inc()}return i},be.isRationalSurfaceClosed=function(n,i){i==null&&(i=!0);var a;i?a=n.controlPoints:a=Le.transpose(n.controlPoints);for(var o=0,u=a[0].length;o<u;){var d=o++,m=f.dist(Y.first(a)[d],Y.last(a)[d])<re.EPSILON;if(!m)return!1}return!0},be.rationalSurfaceClosestPoint=function(n,i){var a=be.rationalSurfaceClosestParam(n,i);return C.rationalSurfacePoint(n,a[0],a[1])},be.rationalSurfaceClosestParam=function(n,i){for(var a=5,o=0,u,d=1e-4,m=5e-4,g,_=n.knotsU[0],w=Y.last(n.knotsU),P=n.knotsV[0],A=Y.last(n.knotsV),I=be.isRationalSurfaceClosed(n),T=be.isRationalSurfaceClosed(n,!1),k,O=De.rationalSurfaceAdaptive(n,new Hn),N=1/0,B=0,z=O.points.length;B<z;){var V=B++,U=O.points[V],W=f.normSquared(f.sub(i,U));W<N&&(N=W,k=O.uvs[V])}for(var ee=function(Ue){return C.rationalSurfaceDerivatives(n,Ue[0],Ue[1],2)},$=function(Ue,Ye,Be){var Qe=Ye[1][0],It=Ye[0][1],Ut=Ye[2][0],At=Ye[0][2],yt=Ye[1][1],Et=Ye[1][1],Bt=f.dot(Qe,Be),Qt=f.dot(It,Be),dn=[-Bt,-Qt],Jt=f.dot(Qe,Qe)+f.dot(Ut,Be),en=f.dot(Qe,It)+f.dot(yt,Be),tn=f.dot(Qe,It)+f.dot(Et,Be),Cn=f.dot(It,It)+f.dot(At,Be),Gr=[[Jt,en],[tn,Cn]],_r=Le.solve(Gr,dn);return f.add(_r,Ue)};o<a;){u=ee(k),g=f.sub(u[0][0],i);var G=f.norm(g),K=f.dot(u[1][0],g),te=f.norm(u[1][0])*G,ne=f.dot(u[0][1],g),se=f.norm(u[0][1])*G,le=K/te,ae=ne/se,ue=G<d,ie=le<m,fe=ae<m;if(ue&&ie&&fe)return k;var q=$(k,u,g);q[0]<_?I?q=[w-(q[0]-_),q[1]]:q=[_+re.EPSILON,q[1]]:q[0]>w&&(I?q=[_+(q[0]-w),q[1]]:q=[w-re.EPSILON,q[1]]),q[1]<P?T?q=[q[0],A-(q[1]-P)]:q=[q[0],P+re.EPSILON]:q[1]>A&&(T?q=[q[0],P+(q[0]-A)]:q=[q[0],A-re.EPSILON]);var pe=f.norm(f.mul(q[0]-k[0],u[1][0])),Pe=f.norm(f.mul(q[1]-k[1],u[0][1]));if(pe+Pe<d)return k;k=q,o++}return k},be.rationalCurveClosestPoint=function(n,i){return C.rationalCurvePoint(n,be.rationalCurveClosestParam(n,i))},be.rationalCurveClosestParam=function(n,i){for(var a=1/0,o=0,u=De.rationalCurveRegularSample(n,n.controlPoints.length*n.degree,!0),d=0,m=u.length-1;d<m;){var g=d++,_=u[g][0],w=u[g+1][0],P=u[g].slice(1),A=u[g+1].slice(1),I=zt.segmentClosestPoint(i,P,A,_,w),T=f.norm(f.sub(i,I.pt));T<a&&(a=T,o=I.u)}for(var k=5,O=0,N,B=1e-4,z=5e-4,V,U=n.knots[0],W=Y.last(n.knots),ee=f.normSquared(f.sub(n.controlPoints[0],Y.last(n.controlPoints)))<re.EPSILON,$=o,G=function(q){return C.rationalCurveDerivatives(n,q,2)},K=function(q,pe,Pe){var Ue=f.dot(pe[1],Pe),Ye=f.dot(pe[2],Pe),Be=f.dot(pe[1],pe[1]),Qe=Ye+Be;return q-Ue/Qe};O<k;){N=G($),V=f.sub(N[0],i);var te=f.norm(V),ne=f.dot(N[1],V),se=f.norm(N[1])*te,le=ne/se,ae=te<B,ue=Math.abs(le)<z;if(ae&&ue)return $;var ie=K($,N,V);ie<U?ee?ie=W-(ie-U):ie=U:ie>W&&(ee?ie=U+(ie-W):ie=W);var fe=f.norm(f.mul(ie-$,N[1]));if(fe<B)return $;$=ie,O++}return $},be.rationalCurveParamAtArcLength=function(n,i,a,o,u){if(a==null&&(a=.001),i<re.EPSILON)return n.knots[0];var d;o!=null?d=o:d=ye.decomposeCurveIntoBeziers(n);var m=0;d[m];var g=-re.EPSILON,_;for(u!=null?_=u:_=[];g<i&&m<d.length;){if(m<_.length?_[m]=_[m]:_[m]=be.rationalBezierCurveArcLength(n),g+=_[m],i<g+re.EPSILON)return be.rationalBezierCurveParamAtArcLength(n,i,a,_[m]);m++}return-1},be.rationalBezierCurveParamAtArcLength=function(n,i,a,o){if(i<0)return n.knots[0];var u;if(o!=null?u=o:u=be.rationalBezierCurveArcLength(n),i>u)return Y.last(n.knots);var d=n.knots[0],m=0,g=Y.last(n.knots),_=u,w=0,P=0,A;for(a!=null?A=a:A=re.TOLERANCE*2;_-m>A;)w=(d+g)/2,P=be.rationalBezierCurveArcLength(n,w),P>i?(g=w,_=P):(d=w,m=P);return(d+g)/2},be.rationalCurveArcLength=function(n,i,a){a==null&&(a=16),i==null?i=Y.last(n.knots):i=i;for(var o=ye.decomposeCurveIntoBeziers(n),u=0,d=o[0],m=0;u<o.length&&d.knots[0]+re.EPSILON<i;){var g=Math.min(Y.last(d.knots),i);m+=be.rationalBezierCurveArcLength(d,g,a),d=o[++u]}return m},be.rationalBezierCurveArcLength=function(n,i,a){a==null&&(a=16);var o;i==null?o=Y.last(n.knots):o=i;for(var u=(o-n.knots[0])/2,d=0,m=n.degree+a,g,_,w=0;w<m;){var P=w++;g=u*be.Tvalues[m][P]+u+n.knots[0],_=C.rationalCurveDerivatives(n,g,1),d+=be.Cvalues[m][P]*f.norm(_[1])}return u*d};var Fr=p.eval.KnotMultiplicity=function(n,i){this.knot=n,this.mult=i};x["verb.eval.KnotMultiplicity"]=Fr,Fr.__name__=["verb","eval","KnotMultiplicity"],Fr.prototype={inc:function(){this.mult++},__class__:Fr};var jt=p.eval.Check=function(){};x["verb.eval.Check"]=jt,jt.__name__=["verb","eval","Check"],jt.isValidKnotVector=function(n,i){if(n.length==0||n.length<(i+1)*2)return!1;for(var a=Y.first(n),o=0,u=i+1;o<u;){var d=o++;if(Math.abs(n[d]-a)>re.EPSILON)return!1}a=Y.last(n);for(var m=n.length-i-1,g=n.length;m<g;){var _=m++;if(Math.abs(n[_]-a)>re.EPSILON)return!1}return jt.isNonDecreasing(n)},jt.isNonDecreasing=function(n){for(var i=Y.first(n),a=0,o=n.length;a<o;){var u=a++;if(n[u]<i-re.EPSILON)return!1;i=n[u]}return!0},jt.isValidNurbsCurveData=function(n){if(n.controlPoints==null)throw new J("Control points array cannot be null!");if(n.degree==null)throw new J("Degree cannot be null!");if(n.degree<1)throw new J("Degree must be greater than 1!");if(n.knots==null)throw new J("Knots cannot be null!");if(n.knots.length!=n.controlPoints.length+n.degree+1)throw new J("controlPoints.length + degree + 1 must equal knots.length!");if(!jt.isValidKnotVector(n.knots,n.degree))throw new J("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return n},jt.isValidNurbsSurfaceData=function(n){if(n.controlPoints==null)throw new J("Control points array cannot be null!");if(n.degreeU==null)throw new J("DegreeU cannot be null!");if(n.degreeV==null)throw new J("DegreeV cannot be null!");if(n.degreeU<1)throw new J("DegreeU must be greater than 1!");if(n.degreeV<1)throw new J("DegreeV must be greater than 1!");if(n.knotsU==null)throw new J("KnotsU cannot be null!");if(n.knotsV==null)throw new J("KnotsV cannot be null!");if(n.knotsU.length!=n.controlPoints.length+n.degreeU+1)throw new J("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(n.knotsV.length!=n.controlPoints[0].length+n.degreeV+1)throw new J("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!jt.isValidKnotVector(n.knotsU,n.degreeU)||!jt.isValidKnotVector(n.knotsV,n.degreeV))throw new J("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return n};var ft=p.eval.Divide=function(){};x["verb.eval.Divide"]=ft,ft.__name__=["verb","eval","Divide"],ft.surfaceSplit=function(n,i,a){a==null&&(a=!1);var o,u,d;a?(d=n.controlPoints,o=n.knotsV,u=n.degreeV):(d=Le.transpose(n.controlPoints),o=n.knotsU,u=n.degreeU);for(var m,g=[],_=0,w=u+1;_<w;)_++,g.push(i);m=g;for(var P=[],A=[],I=C.knotSpan(u,i,o),T=null,k=0;k<d.length;){var O=d[k];++k,T=ye.curveKnotRefine(new je(u,o,O),m),P.push(T.controlPoints.slice(0,I+1)),A.push(T.controlPoints.slice(I+1))}var N=T.knots.slice(0,I+u+2),B=T.knots.slice(I+1);return a?[new rt(n.degreeU,u,n.knotsU.slice(),N,P),new rt(n.degreeU,u,n.knotsU.slice(),B,A)]:(P=Le.transpose(P),A=Le.transpose(A),[new rt(u,n.degreeV,N,n.knotsV.slice(),P),new rt(u,n.degreeV,B,n.knotsV.slice(),A)])},ft.curveSplit=function(n,i){var a=n.degree;n.controlPoints;for(var o=n.knots,u,d=[],m=0,g=a+1;m<g;)m++,d.push(i);u=d;var _=ye.curveKnotRefine(n,u),w=C.knotSpan(a,i,o),P=_.knots.slice(0,w+a+2),A=_.knots.slice(w+1),I=_.controlPoints.slice(0,w+1),T=_.controlPoints.slice(w+1);return[new je(a,P,I),new je(a,A,T)]},ft.rationalCurveByEqualArcLength=function(n,i){var a=be.rationalCurveArcLength(n),o=a/i;return ft.rationalCurveByArcLength(n,o)},ft.rationalCurveByArcLength=function(n,i){var a=ye.decomposeCurveIntoBeziers(n),o=a.map(function(I){return be.rationalBezierCurveArcLength(I)}),u=f.sum(o),d=[new Vr(n.knots[0],0)];if(i>u)return d;for(var m=i,g=0,_=m,w=0,P=0,A;g<a.length;){for(w+=o[g];_<w+re.EPSILON;)A=be.rationalBezierCurveParamAtArcLength(a[g],_-P,re.TOLERANCE,o[g]),d.push(new Vr(A,_)),_+=m;P+=o[g],g++}return d};var Vr=p.eval.CurveLengthSample=function(n,i){this.u=n,this.len=i};x["verb.eval.CurveLengthSample"]=Vr,Vr.__name__=["verb","eval","CurveLengthSample"],Vr.prototype={__class__:Vr};var C=p.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(n,i){var a=C.rationalCurveDerivatives(n,i,1);return a[1]},C.rationalSurfaceNormal=function(n,i,a){var o=C.rationalSurfaceDerivatives(n,i,a,1);return f.cross(o[1][0],o[0][1])},C.rationalSurfaceDerivatives=function(n,i,a,o){o==null&&(o=1);for(var u=C.surfaceDerivatives(n,i,a,o),d=C.rational2d(u),m=C.weight2d(u),g=[],_=d[0][0].length,w=0,P=o+1;w<P;){var A=w++;g.push([]);for(var I=0,T=o-A+1;I<T;){for(var k=I++,O=d[A][k],N=1,B=k+1;N<B;){var z=N++;f.subMulMutate(O,ze.get(k,z)*m[0][z],g[A][k-z])}for(var V=1,U=A+1;V<U;){var W=V++;f.subMulMutate(O,ze.get(A,W)*m[W][0],g[A-W][k]);for(var ee=f.zeros1d(_),$=1,G=k+1;$<G;){var K=$++;f.addMulMutate(ee,ze.get(k,K)*m[W][K],g[A-W][k-K])}f.subMulMutate(O,ze.get(A,W),ee)}f.mulMutate(1/m[0][0],O),g[A].push(O)}}return g},C.rationalSurfacePoint=function(n,i,a){return C.dehomogenize(C.surfacePoint(n,i,a))},C.rationalCurveDerivatives=function(n,i,a){a==null&&(a=1);for(var o=C.curveDerivatives(n,i,a),u=C.rational1d(o),d=C.weight1d(o),m=[],g=0,_=a+1;g<_;){for(var w=g++,P=u[w],A=1,I=w+1;A<I;){var T=A++;f.subMulMutate(P,ze.get(w,T)*d[T],m[w-T])}f.mulMutate(1/d[0],P),m.push(P)}return m},C.rationalCurvePoint=function(n,i){return C.dehomogenize(C.curvePoint(n,i))},C.surfaceDerivatives=function(n,i,a,o){var u=n.knotsU.length-n.degreeU-2,d=n.knotsV.length-n.degreeV-2;return C.surfaceDerivativesGivenNM(u,d,n,i,a,o)},C.surfaceDerivativesGivenNM=function(n,i,a,o,u,d){var m=a.degreeU,g=a.degreeV,_=a.controlPoints,w=a.knotsU,P=a.knotsV;if(!C.areValidRelations(m,_.length,w.length)||!C.areValidRelations(g,_[0].length,P.length))throw new J("Invalid relations between control points, knot vector, and n");var A=_[0][0].length,I;d<m?I=d:I=m;var T;d<g?T=d:T=g;for(var k=f.zeros3d(d+1,d+1,A),O=C.knotSpanGivenN(n,m,o,w),N=C.knotSpanGivenN(i,g,u,P),B=C.derivativeBasisFunctionsGivenNI(O,o,m,n,w),z=C.derivativeBasisFunctionsGivenNI(N,u,g,i,P),V=f.zeros2d(g+1,A),U=0,W=0,ee=I+1;W<ee;){for(var $=W++,G=0,K=g+1;G<K;){var te=G++;V[te]=f.zeros1d(A);for(var ne=0,se=m+1;ne<se;){var le=ne++;f.addMulMutate(V[te],B[$][le],_[O-m+le][N-g+te])}}var ae=d-$;ae<T?U=ae:U=T;for(var ue=0,ie=U+1;ue<ie;){var fe=ue++;k[$][fe]=f.zeros1d(A);for(var q=0,pe=g+1;q<pe;){var Pe=q++;f.addMulMutate(k[$][fe],z[fe][Pe],V[Pe])}}}return k},C.surfacePoint=function(n,i,a){var o=n.knotsU.length-n.degreeU-2,u=n.knotsV.length-n.degreeV-2;return C.surfacePointGivenNM(o,u,n,i,a)},C.surfacePointGivenNM=function(n,i,a,o,u){var d=a.degreeU,m=a.degreeV,g=a.controlPoints,_=a.knotsU,w=a.knotsV;if(!C.areValidRelations(d,g.length,_.length)||!C.areValidRelations(m,g[0].length,w.length))throw new J("Invalid relations between control points, knot vector, and n");for(var P=g[0][0].length,A=C.knotSpanGivenN(n,d,o,_),I=C.knotSpanGivenN(i,m,u,w),T=C.basisFunctionsGivenKnotSpanIndex(A,o,d,_),k=C.basisFunctionsGivenKnotSpanIndex(I,u,m,w),O=A-d,N=I,B=f.zeros1d(P),z=f.zeros1d(P),V=0,U=m+1;V<U;){var W=V++;z=f.zeros1d(P),N=I-m+W;for(var ee=0,$=d+1;ee<$;){var G=ee++;f.addMulMutate(z,T[G],g[O+G][N])}f.addMulMutate(B,k[W],z)}return B},C.curveRegularSamplePoints=function(n,i){for(var a=C.curveDerivatives(n,n.knots[0],n.degree),o=1/i,u=o*o,d=a[0],m=f.mul(o,a[1]),g=f.mul(u*.5,a[2]),_=f.mul(u*o*.5,a[3]),w=f.add(g,g),P=f.add(_,_),A=f.mul(.3333333333333333,_),I=[],T=0,k=i+1;T<k;)T++,I.push(C.dehomogenize(d)),f.addAllMutate([d,m,g,A]),f.addAllMutate([m,w,_]),f.addAllMutate([w,P]),f.addAllMutate([g,_]);return I},C.curveRegularSamplePoints2=function(n,i){for(var a=C.curveDerivatives(n,n.knots[0],n.degree),o=1/i,u=o*o,d=a[0],m=f.mul(o,a[1]),g=f.mul(u*.5,a[2]),_=f.mul(u*o*.5,a[3]),w=f.add(g,g),P=f.add(_,_),A=f.mul(.3333333333333333,_),I=[],T=0,k=i+1;T<k;)T++,I.push(C.dehomogenize(d)),f.addAllMutate([d,m,g,A]),f.addAllMutate([m,w,_]),f.addAllMutate([w,P]),f.addAllMutate([g,_]);return I},C.rationalSurfaceRegularSampleDerivatives=function(n,i,a,o){for(var u=C.surfaceRegularSampleDerivatives(n,i,a,o),d=[],m=i+1,g=a+1,_=o+1,w=0;w<m;){var P=w++,A=[];d.push(A);for(var I=0;I<g;){for(var T=I++,k=u[P][T],O=C.rational2d(k),N=C.weight2d(k),B=[],z=O[0][0].length,V=0;V<_;){var U=V++;B.push([]);for(var W=0,ee=_-U;W<ee;){for(var $=W++,G=O[U][$],K=1,te=$+1;K<te;){var ne=K++;f.subMulMutate(G,ze.get($,ne)*N[0][ne],B[U][$-ne])}for(var se=1,le=U+1;se<le;){var ae=se++;f.subMulMutate(G,ze.get(U,ae)*N[ae][0],B[U-ae][$]);for(var ue=f.zeros1d(z),ie=1,fe=$+1;ie<fe;){var q=ie++;f.addMulMutate(ue,ze.get($,q)*N[ae][q],B[U-ae][$-q])}f.subMulMutate(G,ze.get(U,ae),ue)}f.mulMutate(1/N[0][0],G),B[U].push(G)}}A.push(B)}}return d},C.surfaceRegularSampleDerivatives=function(n,i,a,o){var u=n.degreeU,d=n.degreeV,m=n.controlPoints,g=n.knotsU,_=n.knotsV,w=m[0][0].length;(Y.last(g)-g[0])/i,(Y.last(_)-_[0])/a;for(var P=C.regularlySpacedDerivativeBasisFunctions(u,g,i),A=P.item0,I=P.item1,T=C.regularlySpacedDerivativeBasisFunctions(d,_,a),k=T.item0,O=T.item1,N=[],B=i+1,z=a+1,V=0;V<B;){var U=V++,W=[];N.push(W);for(var ee=0;ee<z;){var $=ee++;W.push(C.surfaceDerivativesGivenBasesKnotSpans(u,d,m,A[U],k[$],I[U],O[$],w,o))}}return N},C.rationalSurfaceRegularSamplePoints=function(n,i,a){return C.dehomogenize2d(C.surfaceRegularSamplePoints(n,i,a))},C.surfaceRegularSamplePoints=function(n,i,a){var o=n.degreeU,u=n.degreeV,d=n.controlPoints,m=n.knotsU,g=n.knotsV,_=d[0][0].length;(Y.last(m)-m[0])/i,(Y.last(g)-g[0])/a;for(var w=C.regularlySpacedBasisFunctions(o,m,i),P=w.item0,A=w.item1,I=C.regularlySpacedBasisFunctions(u,g,a),T=I.item0,k=I.item1,O=[],N=i+1,B=a+1,z=0;z<N;){var V=z++,U=[];O.push(U);for(var W=0;W<B;){var ee=W++;U.push(C.surfacePointGivenBasesKnotSpans(o,u,d,P[V],T[ee],A[V],k[ee],_))}}return O},C.regularlySpacedBasisFunctions=function(n,i,a){for(var o=i.length-n-2,u=(Y.last(i)-i[0])/a,d=[],m=[],g=i[0],_=C.knotSpanGivenN(o,n,g,i),w=a+1,P=0;P<w;){for(P++;g>=i[_+1];)_++;m.push(_),d.push(C.basisFunctionsGivenKnotSpanIndex(_,g,n,i)),g+=u}return new it(m,d)},C.regularlySpacedDerivativeBasisFunctions=function(n,i,a){for(var o=i.length-n-2,u=(Y.last(i)-i[0])/a,d=[],m=[],g=i[0],_=C.knotSpanGivenN(o,n,g,i),w=a+1,P=0;P<w;){for(P++;g>=i[_+1];)_++;m.push(_),d.push(C.derivativeBasisFunctionsGivenNI(_,g,n,o,i)),g+=u}return new it(m,d)},C.surfacePointGivenBasesKnotSpans=function(n,i,a,o,u,d,m,g){for(var _=f.zeros1d(g),w,P=o-n,A=u-i,I=0,T=i+1;I<T;){var k=I++;w=f.zeros1d(g);for(var O=0,N=n+1;O<N;){var B=O++;f.addMulMutate(w,d[B],a[P+B][A])}A++,f.addMulMutate(_,m[k],w)}return _},C.surfaceDerivativesGivenBasesKnotSpans=function(n,i,a,o,u,d,m,g,_){var w=a[0][0].length,P;_<n?P=_:P=n;var A;_<i?A=_:A=i;for(var I=f.zeros3d(P+1,A+1,w),T=f.zeros2d(i+1,w),k=0,O=0,N=P+1;O<N;){for(var B=O++,z=0,V=i+1;z<V;){var U=z++;T[U]=f.zeros1d(w);for(var W=0,ee=n+1;W<ee;){var $=W++;f.addMulMutate(T[U],d[B][$],a[o-n+$][u-i+U])}}var G=_-B;G<A?k=G:k=A;for(var K=0,te=k+1;K<te;){var ne=K++;I[B][ne]=f.zeros1d(w);for(var se=0,le=i+1;se<le;){var ae=se++;f.addMulMutate(I[B][ne],m[ne][ae],T[ae])}}}return I},C.curveDerivatives=function(n,i,a){var o=n.knots.length-n.degree-2;return C.curveDerivativesGivenN(o,n,i,a)},C.curveDerivativesGivenN=function(n,i,a,o){var u=i.degree,d=i.controlPoints,m=i.knots;if(!C.areValidRelations(u,d.length,m.length))throw new J("Invalid relations between control points, knot vector, and n");var g=d[0].length,_;o<u?_=o:_=u;for(var w=f.zeros2d(o+1,g),P=C.knotSpanGivenN(n,u,a,m),A=C.derivativeBasisFunctionsGivenNI(P,a,u,_,m),I=0,T=_+1;I<T;)for(var k=I++,O=0,N=u+1;O<N;){var B=O++;f.addMulMutate(w[k],A[k][B],d[P-u+B])}return w},C.curvePoint=function(n,i){var a=n.knots.length-n.degree-2;return C.curvePointGivenN(a,n,i)},C.areValidRelations=function(n,i,a){return i+n+1-a==0},C.curvePointGivenN=function(n,i,a){var o=i.degree,u=i.controlPoints,d=i.knots;if(!C.areValidRelations(o,u.length,d.length))throw new J("Invalid relations between control points, knot Array, and n");for(var m=C.knotSpanGivenN(n,o,a,d),g=C.basisFunctionsGivenKnotSpanIndex(m,a,o,d),_=f.zeros1d(u[0].length),w=0,P=o+1;w<P;){var A=w++;f.addMulMutate(_,g[A],u[m-o+A])}return _},C.volumePoint=function(n,i,a,o){var u=n.knotsU.length-n.degreeU-2,d=n.knotsV.length-n.degreeV-2,m=n.knotsW.length-n.degreeW-2;return C.volumePointGivenNML(n,u,d,m,i,a,o)},C.volumePointGivenNML=function(n,i,a,o,u,d,m){if(!C.areValidRelations(n.degreeU,n.controlPoints.length,n.knotsU.length)||!C.areValidRelations(n.degreeV,n.controlPoints[0].length,n.knotsV.length)||!C.areValidRelations(n.degreeW,n.controlPoints[0][0].length,n.knotsW.length))throw new J("Invalid relations between control points and knot vector");for(var g=n.controlPoints,_=n.degreeU,w=n.degreeV,P=n.degreeW,A=n.knotsU,I=n.knotsV,T=n.knotsW,k=g[0][0][0].length,O=C.knotSpanGivenN(i,_,u,A),N=C.knotSpanGivenN(a,w,d,I),B=C.knotSpanGivenN(o,P,m,T),z=C.basisFunctionsGivenKnotSpanIndex(O,u,_,A),V=C.basisFunctionsGivenKnotSpanIndex(N,d,w,I),U=C.basisFunctionsGivenKnotSpanIndex(B,m,P,T),W=O-_,ee=f.zeros1d(k),$=f.zeros1d(k),G=f.zeros1d(k),K=0,te=P+1;K<te;){var ne=K++;G=f.zeros1d(k);for(var se=B-P+ne,le=0,ae=w+1;le<ae;){var ue=le++;$=f.zeros1d(k);for(var ie=N-w+ue,fe=0,q=_+1;fe<q;){var pe=fe++;f.addMulMutate($,z[pe],g[W+pe][ie][se])}f.addMulMutate(G,V[ue],$)}f.addMulMutate(ee,U[ne],G)}return ee},C.derivativeBasisFunctions=function(n,i,a){var o=C.knotSpan(i,n,a),u=a.length-1,d=u-i-1;return C.derivativeBasisFunctionsGivenNI(o,n,i,d,a)},C.derivativeBasisFunctionsGivenNI=function(n,i,a,o,u){var d=f.zeros2d(a+1,a+1),m=f.zeros1d(a+1),g=f.zeros1d(a+1),_=0,w=0;d[0][0]=1;for(var P=1,A=a+1;P<A;){var I=P++;m[I]=i-u[n+1-I],g[I]=u[n+I]-i,_=0;for(var T=0;T<I;){var k=T++;d[I][k]=g[k+1]+m[I-k],w=d[k][I-1]/d[I][k],d[k][I]=_+g[k+1]*w,_=m[I-k]*w}d[I][I]=_}for(var O=f.zeros2d(o+1,a+1),N=f.zeros2d(2,a+1),B=0,z=1,V=0,U=0,W=0,ee=0,$=0,G=0,K=a+1;G<K;){var te=G++;O[0][te]=d[te][a]}for(var ne=0,se=a+1;ne<se;){var le=ne++;B=0,z=1,N[0][0]=1;for(var ae=1,ue=o+1;ae<ue;){var ie=ae++;V=0,U=le-ie,W=a-ie,le>=ie&&(N[z][0]=N[B][0]/d[W+1][U],V=N[z][0]*d[U][W]),U>=-1?ee=1:ee=-U,le-1<=W?$=ie-1:$=a-le;for(var fe=ee,q=$+1;fe<q;){var pe=fe++;N[z][pe]=(N[B][pe]-N[B][pe-1])/d[W+1][U+pe],V+=N[z][pe]*d[U+pe][W]}le<=W&&(N[z][ie]=-N[B][ie-1]/d[W+1][le],V+=N[z][ie]*d[le][W]),O[ie][le]=V;var Pe=B;B=z,z=Pe}}for(var Ue=a,Ye=1,Be=o+1;Ye<Be;){for(var Qe=Ye++,It=0,Ut=a+1;It<Ut;){var At=It++;O[Qe][At]*=Ue}Ue*=a-Qe}return O},C.basisFunctions=function(n,i,a){var o=C.knotSpan(i,n,a);return C.basisFunctionsGivenKnotSpanIndex(o,n,i,a)},C.basisFunctionsGivenKnotSpanIndex=function(n,i,a,o){var u=f.zeros1d(a+1),d=f.zeros1d(a+1),m=f.zeros1d(a+1),g=0,_=0;u[0]=1;for(var w=1,P=a+1;w<P;){var A=w++;d[A]=i-o[n+1-A],m[A]=o[n+A]-i,g=0;for(var I=0;I<A;){var T=I++;_=u[T]/(m[T+1]+d[A-T]),u[T]=g+m[T+1]*_,g=d[A-T]*_}u[A]=g}return u},C.knotSpan=function(n,i,a){return C.knotSpanGivenN(a.length-n-2,n,i,a)},C.knotSpanGivenN=function(n,i,a,o){if(a>o[n+1]-re.EPSILON)return n;if(a<o[i]+re.EPSILON)return i;for(var u=i,d=n+1,m=Math.floor((u+d)/2);a<o[m]||a>=o[m+1];)a<o[m]?d=m:u=m,m=Math.floor((u+d)/2);return m},C.dehomogenize=function(n){for(var i=n.length,a=[],o=n[i-1],u=n.length-1,d=0;d<u;){var m=d++;a.push(n[m]/o)}return a},C.rational1d=function(n){var i=n[0].length-1;return n.map(function(a){return a.slice(0,i)})},C.rational2d=function(n){return n.map(C.rational1d)},C.weight1d=function(n){var i=n[0].length-1;return n.map(function(a){return a[i]})},C.weight2d=function(n){return n.map(C.weight1d)},C.dehomogenize1d=function(n){return n.map(C.dehomogenize)},C.dehomogenize2d=function(n){return n.map(C.dehomogenize1d)},C.homogenize1d=function(n,i){var a=n.length,o=n[0].length,u=[],d=0,m=[],g;i!=null?g=i:g=f.rep(n.length,1);for(var _=0;_<a;){var w=_++,P=[];m=n[w],d=g[w];for(var A=0;A<o;){var I=A++;P.push(m[I]*d)}P.push(d),u.push(P)}return u},C.homogenize2d=function(n,i){var a=n.length,o=[],u;if(i!=null)u=i;else{for(var d=[],m=0;m<a;)m++,d.push(f.rep(n[0].length,1));u=d}for(var g=0;g<a;){var _=g++;o.push(C.homogenize1d(n[_],u[_]))}return o};var oe=p.eval.Intersect=function(){};x["verb.eval.Intersect"]=oe,oe.__name__=["verb","eval","Intersect"],oe.surfaces=function(n,i,a){var o=De.rationalSurfaceAdaptive(n),u=De.rationalSurfaceAdaptive(i),d=oe.meshes(o,u),m=d.map(function(g){return g.map(function(_){return oe.surfacesAtPointWithEstimate(n,i,_.uv0,_.uv1,a)})});return m.map(function(g){return me.rationalInterpCurve(g.map(function(_){return _.point}),3)})},oe.surfacesAtPointWithEstimate=function(n,i,a,o,u){var d,m,g,_,w,P,A,I,T,k,O,N,B,z=5,V=0;do{if(d=C.rationalSurfaceDerivatives(n,a[0],a[1],1),m=d[0][0],_=d[1][0],w=d[0][1],g=f.normalized(f.cross(_,w)),P=f.dot(g,m),A=C.rationalSurfaceDerivatives(i,o[0],o[1],1),I=A[0][0],k=A[1][0],O=A[0][1],T=f.normalized(f.cross(k,O)),N=f.dot(T,I),B=f.distSquared(m,I),B<u*u)break;var U=f.normalized(f.cross(g,T)),W=f.dot(U,m),ee=oe.threePlanes(g,P,T,N,U,W);if(ee==null)throw new J("panic!");var $=f.sub(ee,m),G=f.sub(ee,I),K=f.cross(_,g),te=f.cross(w,g),ne=f.cross(k,T),se=f.cross(O,T),le=f.dot(te,$)/f.dot(te,_),ae=f.dot(K,$)/f.dot(K,w),ue=f.dot(se,G)/f.dot(se,k),ie=f.dot(ne,G)/f.dot(ne,O);a=f.add([le,ae],a),o=f.add([ue,ie],o),V++}while(V<z);return new Ai(a,o,m,B)},oe.meshes=function(n,i,a,o){a==null&&(a=new un(n)),o==null&&(o=new un(i));var u=oe.boundingBoxTrees(a,o,0),d=Y.unique(u.map(function(m){return oe.triangles(n,m.item0,i,m.item1)}).filter(function(m){return m!=null}).filter(function(m){return f.distSquared(m.min.point,m.max.point)>re.EPSILON}),function(m,g){var _=f.sub(m.min.uv0,g.min.uv0),w=f.dot(_,_),P=f.sub(m.max.uv0,g.max.uv0),A=f.dot(P,P),I=f.sub(m.min.uv0,g.max.uv0),T=f.dot(I,I),k=f.sub(m.max.uv0,g.min.uv0),O=f.dot(k,k);return w<re.EPSILON&&A<re.EPSILON||T<re.EPSILON&&O<re.EPSILON});return oe.makeMeshIntersectionPolylines(d)},oe.meshSlices=function(n,i,a,o){for(var u=new Gn(n),d=u.boundingBox(),m=d.min[0],g=d.min[1],_=d.max[0],w=d.max[1],P=f.span(i,a,o),A=[],I=0;I<P.length;){var T=P[I];++I;var k=[[m,g,T],[_,g,T],[_,w,T],[m,w,T]],O=[[0,0],[1,0],[1,1],[0,1]],N=[[0,1,2],[0,2,3]],B=new Yt(N,k,null,O);A.push(oe.meshes(n,B,u))}return A},oe.makeMeshIntersectionPolylines=function(n){if(n.length==0)return[];for(var i=0;i<n.length;){var a=n[i];++i,a.max.opp=a.min,a.min.opp=a.max}for(var o=oe.kdTreeFromSegments(n),u=[],d=0;d<n.length;){var m=n[d];++d,u.push(m.min),u.push(m.max)}for(var g=0;g<u.length;){var _=u[g];if(++g,_.adj==null){var w=oe.lookupAdjacentSegment(_,o,n.length);w!=null&&w.adj==null&&(_.adj=w,w.adj=_)}}var P=u.filter(function(z){return z.adj==null});P.length==0&&(P=u);for(var A=[],I=0,T=!1;P.length!=0;){var k=P.pop();if(!k.visited){for(var O=[],N=k;N!=null&&!(N.visited||(N.visited=!0,N.opp.visited=!0,O.push(N),I+=2,N=N.opp.adj,N==k)););O.length>0&&(O.push(O[O.length-1].opp),A.push(O))}if(P.length==0&&u.length>0&&(T||I<u.length)){T=!0;var B=u.pop();P.push(B)}}return A},oe.kdTreeFromSegments=function(n){for(var i=[],a=0;a<n.length;){var o=n[a];++a,i.push(new zr(o.min.point,o.min)),i.push(new zr(o.max.point,o.max))}return new Si(i,f.distSquared)},oe.lookupAdjacentSegment=function(n,i,a){var o=i.nearest(n.point,a,re.EPSILON).filter(function(u){return n!=u.item0.obj}).map(function(u){return u.item0.obj});return o.length==1?o[0]:null},oe.curveAndSurface=function(n,i,a,o,u){a==null&&(a=.001),o!=null?o=o:o=new cn(n),u!=null?u=u:u=new Un(i);var d=oe.boundingBoxTrees(o,u,a);return Y.unique(d.map(function(m){var g=m.item0,_=m.item1,w=Y.first(g.knots),P=Y.last(g.knots),A=(w+P)/2,I=Y.first(_.knotsU),T=Y.last(_.knotsU),k=Y.first(_.knotsV),O=Y.last(_.knotsV),N=[(I+T)/2,(k+O)/2];return oe.curveAndSurfaceWithEstimate(g,_,[A].concat(N),a)}).filter(function(m){return f.distSquared(m.curvePoint,m.surfacePoint)<a*a}),function(m,g){return Math.abs(m.u-g.u)<.5*a})},oe.curveAndSurfaceWithEstimate=function(n,i,a,o){o==null&&(o=.001);var u=function(_){var w=C.rationalCurvePoint(n,_[0]),P=C.rationalSurfacePoint(i,_[1],_[2]),A=f.sub(w,P);return f.dot(A,A)},d=function(_){var w=C.rationalCurveDerivatives(n,_[0],1),P=C.rationalSurfaceDerivatives(i,_[1],_[2],1),A=f.sub(P[0][0],w[0]),I=f.mul(-1,w[1]),T=P[1][0],k=P[0][1];return[2*f.dot(I,A),2*f.dot(T,A),2*f.dot(k,A)]},m=Xt.uncmin(u,a,o*o,d),g=m.solution;return new xi(g[0],[g[1],g[2]],C.rationalCurvePoint(n,g[0]),C.rationalSurfacePoint(i,g[1],g[2]))},oe.polylineAndMesh=function(n,i,a){for(var o=oe.boundingBoxTrees(new hn(n),new un(i),a),u=[],d=0;d<o.length;){var m=o[d];++d;var g=m.item0,_=m.item1,w=oe.segmentWithTriangle(n.points[g],n.points[g+1],i.points,i.faces[_]);if(w!=null){var P=w.point,A=f.lerp(w.p,[n.params[g]],[n.params[g+1]])[0],I=st.triangleUVFromPoint(i,_,P);u.push(new wi(P,A,I,g,_))}}return u},oe.boundingBoxTrees=function(n,i,a){a==null&&(a=1e-9);var o=[],u=[];o.push(n),u.push(i);for(var d=[];o.length>0;){var m=o.pop(),g=u.pop();if(!(m.empty()||g.empty())&&m.boundingBox().intersects(g.boundingBox(),a)){var _=m.indivisible(a),w=g.indivisible(a);if(_&&w){d.push(new it(m.yield(),g.yield()));continue}else if(_&&!w){var P=g.split();o.push(m),u.push(P.item1),o.push(m),u.push(P.item0);continue}else if(!_&&w){var A=m.split();o.push(A.item1),u.push(g),o.push(A.item0),u.push(g);continue}var I=m.split(),T=g.split();o.push(I.item1),u.push(T.item1),o.push(I.item1),u.push(T.item0),o.push(I.item0),u.push(T.item1),o.push(I.item0),u.push(T.item0)}}return d},oe.curves=function(n,i,a){var o=oe.boundingBoxTrees(new cn(n),new cn(i),0);return Y.unique(o.map(function(u){return oe.curvesWithEstimate(n,i,Y.first(u.item0.knots),Y.first(u.item1.knots),a)}).filter(function(u){return f.distSquared(u.point0,u.point1)<a}),function(u,d){return Math.abs(u.u0-d.u0)<a*5})},oe.curvesWithEstimate=function(n,i,a,o,u){var d=function(I){var T=C.rationalCurvePoint(n,I[0]),k=C.rationalCurvePoint(i,I[1]),O=f.sub(T,k);return f.dot(O,O)},m=function(I){var T=C.rationalCurveDerivatives(n,I[0],1),k=C.rationalCurveDerivatives(i,I[1],1),O=f.sub(T[0],k[0]),N=T[1],B=f.mul(-1,k[1]);return[2*f.dot(N,O),2*f.dot(B,O)]},g=Xt.uncmin(d,[a,o],u*u,m),_=g.solution[0],w=g.solution[1],P=C.rationalCurvePoint(n,_),A=C.rationalCurvePoint(i,w);return new gr(P,A,_,w)},oe.triangles=function(n,i,a,o){var u=n.faces[i],d=a.faces[o],m=st.getTriangleNorm(n.points,u),g=st.getTriangleNorm(a.points,d),_=n.points[u[0]],w=a.points[d[0]],P=oe.planes(_,m,w,g);if(P==null)return null;var A=oe.clipRayInCoplanarTriangle(P,n,i);if(A==null)return null;var I=oe.clipRayInCoplanarTriangle(P,a,o);if(I==null)return null;var T=oe.mergeTriangleClipIntervals(A,I,n,i,a,o);return T==null?null:new St(new jn(T.min.uv0,T.min.uv1,T.min.point,i,o),new jn(T.max.uv0,T.max.uv1,T.max.point,i,o))},oe.clipRayInCoplanarTriangle=function(n,i,a){for(var o=i.faces[a],u=[i.points[o[0]],i.points[o[1]],i.points[o[2]]],d=[i.uvs[o[0]],i.uvs[o[1]],i.uvs[o[2]]],m=[f.sub(d[1],d[0]),f.sub(d[2],d[1]),f.sub(d[0],d[2])],g=[f.sub(u[1],u[0]),f.sub(u[2],u[1]),f.sub(u[0],u[2])],_=g.map(f.normalized),w=g.map(f.norm),P=null,A=null,I=0;I<3;){var T=I++,k=u[T],O=_[T],N=oe.rays(k,O,n.origin,n.dir);if(N!=null){var B=N.u0,z=N.u1;B<-re.EPSILON||B>w[T]+re.EPSILON||((P==null||z<P.u)&&(P=new Dr(z,f.onRay(n.origin,n.dir,z),f.onRay(d[T],m[T],B/w[T]))),(A==null||z>A.u)&&(A=new Dr(z,f.onRay(n.origin,n.dir,z),f.onRay(d[T],m[T],B/w[T]))))}}return A==null||P==null?null:new St(P,A)},oe.mergeTriangleClipIntervals=function(n,i,a,o,u,d){if(i.min.u>n.max.u+re.EPSILON||n.min.u>i.max.u+re.EPSILON)return null;var m;n.min.u>i.min.u?m=new it(n.min,0):m=new it(i.min,1);var g;n.max.u<i.max.u?g=new it(n.max,0):g=new it(i.max,1);var _=new St(new jn(null,null,m.item0.point,o,d),new jn(null,null,g.item0.point,o,d));return m.item1==0?(_.min.uv0=m.item0.uv,_.min.uv1=st.triangleUVFromPoint(u,d,m.item0.point)):(_.min.uv0=st.triangleUVFromPoint(a,o,m.item0.point),_.min.uv1=m.item0.uv),g.item1==0?(_.max.uv0=g.item0.uv,_.max.uv1=st.triangleUVFromPoint(u,d,g.item0.point)):(_.max.uv0=st.triangleUVFromPoint(a,o,g.item0.point),_.max.uv1=g.item0.uv),_},oe.planes=function(n,i,a,o){var u=f.cross(i,o);if(f.dot(u,u)<re.EPSILON)return null;var d=0,m=Math.abs(u[0]),g=Math.abs(u[1]),_=Math.abs(u[2]);g>m&&(d=1,m=g),_>m&&(d=2,m=_);var w,P,A,I;d==0?(w=i[1],P=i[2],A=o[1],I=o[2]):d==1?(w=i[0],P=i[2],A=o[0],I=o[2]):(w=i[0],P=i[1],A=o[0],I=o[1]);var T=-f.dot(n,i),k=-f.dot(a,o),O=w*I-P*A,N=(P*k-T*I)/O,B=(T*A-w*k)/O,z;return d==0?z=[0,N,B]:d==1?z=[N,0,B]:z=[N,B,0],new Or(z,f.normalized(u))},oe.threePlanes=function(n,i,a,o,u,d){var m=f.cross(a,u),g=f.dot(n,m);if(Math.abs(g)<re.EPSILON)return null;var _=f.sub(f.mul(d,a),f.mul(o,u)),w=f.add(f.mul(i,m),f.cross(n,_));return f.mul(1/g,w)},oe.polylines=function(n,i,a){for(var o=oe.boundingBoxTrees(new hn(n),new hn(i),a),u=[],d=0;d<o.length;){var m=o[d];++d;var g=m.item0,_=m.item1,w=oe.segments(n.points[g],n.points[g+1],i.points[_],i.points[_+1],a);w!=null&&(w.u0=f.lerp(w.u0,[n.params[g]],[n.params[g+1]])[0],w.u1=f.lerp(w.u1,[i.params[_]],[i.params[_+1]])[0],u.push(w))}return u},oe.segments=function(n,i,a,o,u){var d=f.sub(i,n),m=Math.sqrt(f.dot(d,d)),g=f.mul(1/m,d),_=f.sub(o,a),w=Math.sqrt(f.dot(_,_)),P=f.mul(1/w,_),A=oe.rays(n,g,a,P);if(A!=null){var I=Math.min(Math.max(0,A.u0/m),1),T=Math.min(Math.max(0,A.u1/w),1),k=f.onRay(n,d,I),O=f.onRay(a,_,T),N=f.distSquared(k,O);if(N<u*u)return new gr(k,O,I,T)}return null},oe.rays=function(n,i,a,o){var u=f.dot(i,o),d=f.dot(i,a),m=f.dot(i,n),g=f.dot(o,a),_=f.dot(o,n),w=f.dot(i,i),P=f.dot(o,o),A=w*P-u*u;if(Math.abs(A)<re.EPSILON)return null;var I=u*(d-m)-w*(g-_),T=I/A,k=(d-m+T*u)/w,O=f.onRay(n,i,k),N=f.onRay(a,o,T);return new gr(O,N,k,T)},oe.segmentWithTriangle=function(n,i,a,o){var u=a[o[0]],d=a[o[1]],m=a[o[2]],g=f.sub(d,u),_=f.sub(m,u),w=f.cross(g,_),P=f.sub(i,n),A=f.sub(n,u),I=-f.dot(w,A),T=f.dot(w,P);if(Math.abs(T)<re.EPSILON)return null;var k=I/T;if(k<0||k>1)return null;var O=f.add(n,f.mul(k,P)),N=f.dot(g,_),B=f.dot(g,g),z=f.dot(_,_),V=f.sub(O,u),U=f.dot(V,g),W=f.dot(V,_),ee=N*N-B*z;if(Math.abs(ee)<re.EPSILON)return null;var $=(N*W-z*U)/ee,G=(N*U-B*W)/ee;return $>1+re.EPSILON||G>1+re.EPSILON||G<-re.EPSILON||$<-re.EPSILON||$+G>1+re.EPSILON?null:new Pi(O,$,G,k)},oe.segmentAndPlane=function(n,i,a,o){var u=f.dot(o,f.sub(i,n));if(Math.abs(u)<re.EPSILON)return null;var d=f.dot(o,f.sub(a,n)),m=d/u;return m>1+re.EPSILON||m<-re.EPSILON?null:{p:m}};var me=p.eval.Make=function(){};x["verb.eval.Make"]=me,me.__name__=["verb","eval","Make"],me.rationalTranslationalSurface=function(n,i){for(var a=C.rationalCurvePoint(i,Y.first(i.knots)),o=Y.first(i.knots),u=Y.last(i.knots),d=2*i.controlPoints.length,m=(u-o)/(d-1),g=[],_=0;_<d;){var w=_++,P=f.sub(C.rationalCurvePoint(i,o+w*m),a),A=ye.rationalCurveTransform(n,[[1,0,0,P[0]],[0,1,0,P[1]],[0,0,1,P[2]],[0,0,0,1]]);g.push(A)}return me.loftedSurface(g)},me.surfaceBoundaryCurves=function(n){var i=me.surfaceIsocurve(n,Y.first(n.knotsU),!1),a=me.surfaceIsocurve(n,Y.last(n.knotsU),!1),o=me.surfaceIsocurve(n,Y.first(n.knotsV),!0),u=me.surfaceIsocurve(n,Y.last(n.knotsV),!0);return[i,a,o,u]},me.surfaceIsocurve=function(n,i,a){a==null&&(a=!1);var o;a?o=n.knotsV:o=n.knotsU;var u;a?u=n.degreeV:u=n.degreeU;for(var d=be.knotMultiplicities(o),m=-1,g=0,_=d.length;g<_;){var w=g++;if(Math.abs(i-d[w].knot)<re.EPSILON){m=w;break}}var P=u+1;m>=0&&(P=P-d[m].mult);var A;P>0?A=ye.surfaceKnotRefine(n,f.rep(P,i),a):A=n;var I=C.knotSpan(u,i,o);return Math.abs(i-Y.first(o))<re.EPSILON?I=0:Math.abs(i-Y.last(o))<re.EPSILON&&(I=(a?A.controlPoints[0].length:A.controlPoints.length)-1),a?new je(A.degreeU,A.knotsU,function(T){for(var k,O=[],N=0,B=A.controlPoints;N<B.length;){var z=B[N];++N,O.push(z[I])}return k=O,k}()):new je(A.degreeV,A.knotsV,A.controlPoints[I])},me.loftedSurface=function(n,i){n=ye.unifyCurveKnotVectors(n);var a=n[0].degree;i==null&&(i=3),i>n.length-1&&(i=n.length-1);for(var o=n[0].knots,u=[],d=[],m=0,g=n[0].controlPoints.length;m<g;){var _=[m++],w=n.map(function(A){return function(I){return I.controlPoints[A[0]]}}(_)),P=me.rationalInterpCurve(w,i,!0);d.push(P.controlPoints),u=P.knots}return new rt(a,i,o,u,d)},me.clonedCurve=function(n){return new je(n.degree,n.knots.slice(),n.controlPoints.map(function(i){return i.slice()}))},me.rationalBezierCurve=function(n,i){for(var a=n.length-1,o=[],u=0,d=a+1;u<d;)u++,o.push(0);for(var m=0,g=a+1;m<g;)m++,o.push(1);return i==null&&(i=f.rep(n.length,1)),new je(a,o,C.homogenize1d(n,i))},me.fourPointSurface=function(n,i,a,o,u){u==null&&(u=3);for(var d=u,m=[],g=0,_=u+1;g<_;){for(var w=g++,P=[],A=0,I=u+1;A<I;){var T=A++,k=1-w/d,O=f.lerp(k,n,i),N=f.lerp(k,o,a),B=f.lerp(1-T/d,O,N);B.push(1),P.push(B)}m.push(P)}var z=f.rep(u+1,0),V=f.rep(u+1,1);return new rt(u,u,z.concat(V),z.concat(V),m)},me.ellipseArc=function(n,i,a,o,u){var d=f.norm(i),m=f.norm(a);i=f.normalized(i),a=f.normalized(a),u<o&&(u=2*Math.PI+o);var g=u-o,_=0;g<=Math.PI/2?_=1:g<=Math.PI?_=2:g<=3*Math.PI/2?_=3:_=4;var w=g/_,P=Math.cos(w/2),A=f.add(n,f.add(f.mul(d*Math.cos(o),i),f.mul(m*Math.sin(o),a))),I=f.sub(f.mul(Math.cos(o),a),f.mul(Math.sin(o),i)),T=[],k=f.zeros1d(2*_+3),O=0,N=o,B=f.zeros1d(_*2);T[0]=A,B[0]=1;for(var z=1,V=_+1;z<V;){var U=z++;N+=w;var W=f.add(n,f.add(f.mul(d*Math.cos(N),i),f.mul(m*Math.sin(N),a)));B[O+2]=1,T[O+2]=W;var ee=f.sub(f.mul(Math.cos(N),a),f.mul(Math.sin(N),i)),$=oe.rays(A,f.mul(1/f.norm(I),I),W,f.mul(1/f.norm(ee),ee)),G=f.add(A,f.mul($.u0,I));B[O+1]=P,T[O+1]=G,O+=2,U<_&&(A=W,I=ee)}for(var K=2*_+1,te=0;te<3;){var ne=te++;k[ne]=0,k[ne+K]=1}switch(_){case 2:k[3]=k[4]=.5;break;case 3:k[3]=k[4]=.3333333333333333,k[5]=k[6]=.6666666666666666;break;case 4:k[3]=k[4]=.25,k[5]=k[6]=.5,k[7]=k[8]=.75;break}return new je(2,k,C.homogenize1d(T,B))},me.arc=function(n,i,a,o,u,d){return me.ellipseArc(n,f.mul(o,f.normalized(i)),f.mul(o,f.normalized(a)),u,d)},me.polyline=function(n){for(var i=[0,0],a=0,o=0,u=n.length-1;o<u;){var d=o++;a+=f.dist(n[d],n[d+1]),i.push(a)}i.push(a),i=f.mul(1/a,i);for(var m,g=[],_=0,w=n.length;_<w;)_++,g.push(1);return m=g,new je(1,i,C.homogenize1d(n.slice(0),m))},me.extrudedSurface=function(n,i,a){for(var o=[[],[],[]],u=[[],[],[]],d=C.dehomogenize1d(a.controlPoints),m=C.weight1d(a.controlPoints),g=f.mul(i,n),_=f.mul(.5*i,n),w=0,P=d.length;w<P;){var A=w++;o[2][A]=d[A],o[1][A]=f.add(_,d[A]),o[0][A]=f.add(g,d[A]),u[0][A]=m[A],u[1][A]=m[A],u[2][A]=m[A]}return new rt(2,a.degree,[0,0,0,1,1,1],a.knots,C.homogenize2d(o,u))},me.cylindricalSurface=function(n,i,a,o,u){var d=f.cross(n,i),m=me.arc(a,i,d,u,0,2*Math.PI);return me.extrudedSurface(n,o,m)},me.revolvedSurface=function(n,i,a,o){var u=C.dehomogenize1d(n.controlPoints),d=C.weight1d(n.controlPoints),m,g;o<=Math.PI/2?(m=1,g=f.zeros1d(6+2*(m-1))):o<=Math.PI?(m=2,g=f.zeros1d(6+2*(m-1)),g[3]=g[4]=.5):o<=3*Math.PI/2?(m=3,g=f.zeros1d(6+2*(m-1)),g[3]=g[4]=.3333333333333333,g[5]=g[6]=.6666666666666666):(m=4,g=f.zeros1d(6+2*(m-1)),g[3]=g[4]=.25,g[5]=g[6]=.5,g[7]=g[8]=.75);for(var _=o/m,w=3+2*(m-1),P=0;P<3;){var A=P++;g[A]=0,g[w+A]=1}for(var I=Math.cos(_/2),T=0,k=f.zeros1d(m+1),O=f.zeros1d(m+1),N=f.zeros3d(2*m+1,u.length,3),B=f.zeros2d(2*m+1,u.length),z=1,V=m+1;z<V;){var U=z++;T+=_,O[U]=Math.cos(T),k[U]=Math.sin(T)}for(var W=0,ee=u.length;W<ee;){var $=W++,G=zt.rayClosestPoint(u[$],i,a),K=f.sub(u[$],G),te=f.norm(K),ne=f.cross(a,K);te>re.EPSILON&&(K=f.mul(1/te,K),ne=f.mul(1/te,ne)),N[0][$]=u[$];var se=u[$];B[0][$]=d[$];for(var le=ne,ae=0,ue=1,ie=m+1;ue<ie;){var fe=ue++,q;te==0?q=G:q=f.add(G,f.add(f.mul(te*O[fe],K),f.mul(te*k[fe],ne))),N[ae+2][$]=q,B[ae+2][$]=d[$];var pe=f.sub(f.mul(O[fe],ne),f.mul(k[fe],K));if(te==0)N[ae+1][$]=G;else{var Pe=oe.rays(se,f.mul(1/f.norm(le),le),q,f.mul(1/f.norm(pe),pe)),Ue=f.add(se,f.mul(Pe.u0,le));N[ae+1][$]=Ue}B[ae+1][$]=I*d[$],ae+=2,fe<m&&(se=q,le=pe)}}return new rt(2,n.degree,g,n.knots,C.homogenize2d(N,B))},me.sphericalSurface=function(n,i,a,o){var u=me.arc(n,f.mul(-1,i),a,o,0,Math.PI);return me.revolvedSurface(u,n,i,2*Math.PI)},me.conicalSurface=function(n,i,a,o,u){var d=2*Math.PI,m=1,g=[f.add(a,f.mul(o,n)),f.add(a,f.mul(u,i))],_=[0,0,1,1],w=[1,1],P=new je(m,_,C.homogenize1d(g,w));return me.revolvedSurface(P,a,n,d)},me.rationalInterpCurve=function(n,i,a,o,u){if(a==null&&(a=!1),i==null&&(i=3),n.length<i+1)throw new J("You need to supply at least degree + 1 points! You only supplied "+n.length+" points.");for(var d=[0],m=1,g=n.length;m<g;){var _=m++,w=f.norm(f.sub(n[_],n[_-1])),P=d[d.length-1];d.push(P+w)}for(var A=d[d.length-1],I=0,T=d.length;I<T;){var k=I++;d[k]=d[k]/A}var O=f.rep(i+1,0),N=o!=null&&u!=null,B;N?B=0:B=1;var z;N?z=d.length-i+1:z=d.length-i;for(var V=B;V<z;){for(var U=V++,W=0,ee=0;ee<i;){var $=ee++;W+=d[U+$]}O.push(1/i*W)}var G=O.concat(f.rep(i+1,1)),K=[],te;N?te=n.length+1:te=n.length-1;var ne;N?ne=n.length-(i-1):ne=n.length-(i+1);for(var se=0;se<d.length;){var le=d[se];++se;var ae=C.knotSpanGivenN(te,i,le,G),ue=C.basisFunctionsGivenKnotSpanIndex(ae,le,i,G),ie=ae-i,fe=f.zeros1d(ie),q=f.zeros1d(ne-ie);K.push(fe.concat(ue).concat(q))}if(N){var pe=K[0].length-2,Pe=[-1,1].concat(f.zeros1d(pe)),Ue=f.zeros1d(pe).concat([-1,1]);Y.spliceAndInsert(K,1,0,Pe),Y.spliceAndInsert(K,K.length-1,0,Ue)}for(var Ye=n[0].length,Be=[],Qe=(1-G[G.length-i-2])/i,It=G[i+1]/i,Ut=0;Ut<Ye;){var At=[Ut++],yt;if(!N)yt=n.map(function(tn){return function(Cn){return Cn[tn[0]]}}(At));else{yt=[n[0][At[0]]],yt.push(It*o[At[0]]);for(var Et=1,Bt=n.length-1;Et<Bt;){var Qt=Et++;yt.push(n[Qt][At[0]])}yt.push(Qe*u[At[0]]),yt.push(Y.last(n)[At[0]])}var dn=Le.solve(K,yt);Be.push(dn)}var Jt=Le.transpose(Be);if(!a){var en=f.rep(Jt.length,1);Jt=C.homogenize1d(Jt,en)}return new je(i,G,Jt)};var ye=p.eval.Modify=function(){};x["verb.eval.Modify"]=ye,ye.__name__=["verb","eval","Modify"],ye.curveReverse=function(n){return new je(n.degree,ye.knotsReverse(n.knots),Y.reversed(n.controlPoints))},ye.surfaceReverse=function(n,i){return i==null&&(i=!1),i?new rt(n.degreeU,n.degreeV,n.knotsU,ye.knotsReverse(n.knotsV),function(a){for(var o,u=[],d=0,m=n.controlPoints;d<m.length;){var g=m[d];++d,u.push(Y.reversed(g))}return o=u,o}()):new rt(n.degreeU,n.degreeV,ye.knotsReverse(n.knotsU),n.knotsV,Y.reversed(n.controlPoints))},ye.knotsReverse=function(n){var i=Y.first(n);Y.last(n);for(var a=[i],o=n.length,u=1;u<o;){var d=u++;a.push(a[d-1]+(n[o-d]-n[o-d-1]))}return a},ye.unifyCurveKnotVectors=function(n){n=n.map(me.clonedCurve);for(var i=R.fold(n,function(G,K){return ye.imax(G.degree,K)},0),a=0,o=n.length;a<o;){var u=a++;n[u].degree<i&&(n[u]=ye.curveElevateDegree(n[u],i))}for(var d,m=[],g=0;g<n.length;){var _=n[g];++g,m.push(new St(Y.first(_.knots),Y.last(_.knots)))}d=m;for(var w=0,P=n.length;w<P;){var A=w++,I=[d[A].min];n[A].knots=n[A].knots.map(function(G){return function(K){return K-G[0]}}(I))}for(var T=d.map(function(G){return G.max-G.min}),k=R.fold(T,function(G,K){return Math.max(G,K)},0),O=0,N=n.length;O<N;){var B=O++,z=[k/T[B]];n[B].knots=n[B].knots.map(function(G){return function(K){return K*G[0]}}(z))}for(var V=R.fold(n,function(G,K){return f.sortedSetUnion(G.knots,K)},[]),U=0,W=n.length;U<W;){var ee=U++,$=f.sortedSetSub(V,n[ee].knots);$.length==0&&(n[ee]=n[ee]),n[ee]=ye.curveKnotRefine(n[ee],$)}return n},ye.imin=function(n,i){return n<i?n:i},ye.imax=function(n,i){return n>i?n:i},ye.curveElevateDegree=function(n,i){if(i<=n.degree)return n;var a=n.knots.length-n.degree-2,o=n.degree,u=n.knots,d=n.controlPoints,m=i-n.degree,g=n.controlPoints[0].length,_=f.zeros2d(o+m+1,o+1),w=[],P=[],A=[],I=a+o+1,T=i,k=Math.floor(T/2),O=[],N=[];_[0][0]=1,_[T][o]=1;for(var B=1,z=k+1;B<z;)for(var V=B++,U=1/ze.get(T,V),W=ye.imin(o,V),ee=ye.imax(0,V-m),$=W+1;ee<$;){var G=ee++;_[V][G]=U*ze.get(o,G)*ze.get(m,V-G)}for(var K=k+1;K<T;)for(var te=K++,ne=ye.imin(o,te),se=ye.imax(0,te-m),le=ne+1;se<le;){var ae=se++;_[te][ae]=_[T-te][o-ae]}var ue=T+1,ie=-1,fe=o,q=o+1,pe=1,Pe=u[0];O[0]=d[0];for(var Ue=0,Ye=T+1;Ue<Ye;){var Be=Ue++;N[Be]=Pe}for(var Qe=0,It=o+1;Qe<It;){var Ut=Qe++;w[Ut]=d[Ut]}for(;q<I;){for(var At=q;q<I&&u[q]==u[q+1];)q=q+1;var yt=q-At+1,Et=u[q],Bt=ie;ie=o-yt;var Qt;Bt>0?Qt=Math.floor((Bt+2)/2):Qt=1;var dn;if(ie>0?dn=Math.floor(T-(ie+1)/2):dn=T,ie>0){for(var Jt=Et-Pe,en=[],tn=o;tn>yt;)en[tn-yt-1]=Jt/(u[fe+tn]-Pe),tn--;for(var Cn=1,Gr=ie+1;Cn<Gr;){for(var _r=Cn++,Ug=ie-_r,Wa=yt+_r,vr=o;vr>=Wa;)w[vr]=f.add(f.mul(en[vr-Wa],w[vr]),f.mul(1-en[vr-Wa],w[vr-1])),vr--;A[Ug]=w[o]}}for(var Gu=Qt,Gg=T+1;Gu<Gg;){var Hr=Gu++;P[Hr]=f.zeros1d(g);for(var Hg=ye.imin(o,Hr),Hu=ye.imax(0,Hr-m),$g=Hg+1;Hu<$g;){var $u=Hu++;P[Hr]=f.add(P[Hr],f.mul(_[Hr][$u],w[$u]))}}if(Bt>1)for(var qa=ue-2,Ka=ue,Wu=Et-Pe,Wg=(Et-N[ue-1])/Wu,qu=1;qu<Bt;){for(var Ya=qu++,Ln=qa,yr=Ka,Yn=yr-ue+1;yr-Ln>Ya;){if(Ln<pe){var qg=(Et-N[Ln])/(Pe-N[Ln]);O[Ln]=f.lerp(qg,O[Ln],O[Ln-1])}if(yr>=Qt){if(yr-Ya<=ue-T+Bt){var Kg=(Et-N[yr-Ya])/Wu;P[Yn]=f.lerp(Kg,P[Yn],P[Yn+1])}}else P[Yn]=f.lerp(Wg,P[Yn],P[Yn+1]);Ln=Ln+1,yr=yr-1,Yn=Yn-1}qa=qa-1,Ka=Ka+1}if(fe!=o)for(var Ku=0,Yg=T-Bt;Ku<Yg;)Ku++,N[ue]=Pe,ue=ue+1;for(var Yu=Qt,Xg=dn+1;Yu<Xg;){var Zg=Yu++;O[pe]=P[Zg],pe=pe+1}if(q<I){for(var Xu=0;Xu<ie;){var Zu=Xu++;w[Zu]=A[Zu]}for(var Qu=ie,Qg=o+1;Qu<Qg;){var Ju=Qu++;w[Ju]=d[q-o+Ju]}fe=q,q=q+1,Pe=Et}else for(var eh=0,Jg=T+1;eh<Jg;){var ep=eh++;N[ue+ep]=Et}}return new je(i,N,O)},ye.rationalSurfaceTransform=function(n,i){for(var a=C.dehomogenize2d(n.controlPoints),o=0,u=a.length;o<u;)for(var d=o++,m=0,g=a[d].length;m<g;){var _=m++,w=a[d][_];w.push(1),a[d][_]=Le.dot(i,w).slice(0,w.length-1)}return new rt(n.degreeU,n.degreeV,n.knotsU.slice(),n.knotsV.slice(),C.homogenize2d(a,C.weight2d(n.controlPoints)))},ye.rationalCurveTransform=function(n,i){for(var a=C.dehomogenize1d(n.controlPoints),o=0,u=a.length;o<u;){var d=o++,m=a[d];m.push(1),a[d]=Le.dot(i,m).slice(0,m.length-1)}return new je(n.degree,n.knots.slice(),C.homogenize1d(a,C.weight1d(n.controlPoints)))},ye.surfaceKnotRefine=function(n,i,a){var o=[],u,d,m;a?(m=n.controlPoints,u=n.knotsV,d=n.degreeV):(m=Le.transpose(n.controlPoints),u=n.knotsU,d=n.degreeU);for(var g=null,_=0;_<m.length;){var w=m[_];++_,g=ye.curveKnotRefine(new je(d,u,w),i),o.push(g.controlPoints)}var P=g.knots;return a?new rt(n.degreeU,n.degreeV,n.knotsU.slice(),P,o):(o=Le.transpose(o),new rt(n.degreeU,n.degreeV,P,n.knotsV.slice(),o))},ye.decomposeCurveIntoBeziers=function(n){for(var i=n.degree,a=n.controlPoints,o=n.knots,u=be.knotMultiplicities(o),d=i+1,m=0;m<u.length;){var g=u[m];if(++m,g.mult<d){var _=f.rep(d-g.mult,g.knot),w=ye.curveKnotRefine(new je(i,o,a),_);o=w.knots,a=w.controlPoints}}o.length/d-1;for(var P=d*2,A=[],I=0;I<a.length;){var T=o.slice(I,I+P),k=a.slice(I,I+d);A.push(new je(i,T,k)),I+=d}return A},ye.curveKnotRefine=function(n,i){if(i.length==0)return me.clonedCurve(n);for(var a=n.degree,o=n.controlPoints,u=n.knots,d=o.length-1,m=d+a+1,g=i.length-1,_=C.knotSpan(a,i[0],u),w=C.knotSpan(a,i[g],u),P=[],A=[],I=0,T=_-a+1;I<T;){var k=I++;P[k]=o[k]}for(var O=w-1,N=d+1;O<N;){var B=O++;P[B+g+1]=o[B]}for(var z=0,V=_+1;z<V;){var U=z++;A[U]=u[U]}for(var W=w+a,ee=m+1;W<ee;){var $=W++;A[$+g+1]=u[$]}for(var G=w+a-1,K=w+a+g,te=g;te>=0;){for(;i[te]<=u[G]&&G>_;)P[K-a-1]=o[G-a-1],A[K]=u[G],K=K-1,G=G-1;P[K-a-1]=P[K-a];for(var ne=1,se=a+1;ne<se;){var le=ne++,ae=K-a+le,ue=A[K+le]-i[te];Math.abs(ue)<re.EPSILON?P[ae-1]=P[ae]:(ue=ue/(A[K+le]-u[G-a+le]),P[ae-1]=f.add(f.mul(ue,P[ae-1]),f.mul(1-ue,P[ae])))}A[K]=i[te],K=K-1,te--}return new je(a,A,P)},ye.curveKnotInsert=function(n,i,a){for(var o=n.degree,u=n.controlPoints,d=n.knots,m=0,g=u.length,_=C.knotSpan(o,i,d),w=[],P=[],A=[],I=1,T=_+1;I<T;){var k=I++;P[k]=d[k]}for(var O=1,N=a+1;O<N;){var B=O++;P[_+B]=i}for(var z=_+1,V=d.length;z<V;){var U=z++;P[U+a]=d[U]}for(var W=0,ee=_-o+1;W<ee;){var $=W++;A[$]=u[$]}for(var G=_-m;G<g;){var K=G++;A[K+a]=u[K]}for(var te=0,ne=o-m+1;te<ne;){var se=te++;w[se]=u[_-o+se]}for(var le=0,ae=0,ue=1,ie=a+1;ue<ie;){var fe=ue++;le=_-o+fe;for(var q=0,pe=o-fe-m+1;q<pe;){var Pe=q++;ae=(i-d[le+Pe])/(d[Pe+_+1]-d[le+Pe]),w[Pe]=f.add(f.mul(ae,w[Pe+1]),f.mul(1-ae,w[Pe]))}A[le]=w[0],A[_+a-fe-m]=w[o-fe-m]}for(var Ue=le+1,Ye=_-m;Ue<Ye;){var Be=Ue++;A[Be]=w[Be-le]}return new je(o,P,A)};var De=p.eval.Tess=function(){};x["verb.eval.Tess"]=De,De.__name__=["verb","eval","Tess"],De.rationalCurveRegularSample=function(n,i,a){return De.rationalCurveRegularSampleRange(n,n.knots[0],Y.last(n.knots),i,a)},De.rationalCurveRegularSampleRange=function(n,i,a,o,u){o<1&&(o=2);for(var d=[],m=(a-i)/(o-1),g=0,_=0;_<o;){var w=_++;g=i+m*w,u?d.push([g].concat(C.rationalCurvePoint(n,g))):d.push(C.rationalCurvePoint(n,g))}return d},De.rationalCurveAdaptiveSample=function(n,i,a){if(a==null&&(a=!1),i==null&&(i=1e-6),n.degree==1)if(a){for(var o=[],u=0,d=n.controlPoints.length;u<d;){var m=u++;o.push([n.knots[m+1]].concat(C.dehomogenize(n.controlPoints[m])))}return o}else return n.controlPoints.map(C.dehomogenize);return De.rationalCurveAdaptiveSampleRange(n,n.knots[0],Y.last(n.knots),i,a)},De.rationalCurveAdaptiveSampleRange=function(n,i,a,o,u){var d=C.rationalCurvePoint(n,i),m=C.rationalCurvePoint(n,a),g=.5+.2*Math.random(),_=i+(a-i)*g,w=C.rationalCurvePoint(n,_),P=f.sub(d,m),A=f.sub(d,w);if(f.dot(P,P)<o&&f.dot(A,A)>o||!zt.threePointsAreFlat(d,w,m,o)){var I=i+(a-i)*.5,T=De.rationalCurveAdaptiveSampleRange(n,i,I,o,u),k=De.rationalCurveAdaptiveSampleRange(n,I,a,o,u);return T.slice(0,-1).concat(k)}else return u?[[i].concat(d),[a].concat(m)]:[d,m]},De.rationalSurfaceNaive=function(n,i,a){i<1&&(i=1),a<1&&(a=1),n.degreeU,n.degreeV,n.controlPoints;for(var o=n.knotsU,u=n.knotsV,d=Y.last(o)-o[0],m=Y.last(u)-u[0],g=d/i,_=m/a,w=[],P=[],A=[],I=0,T=i+1;I<T;)for(var k=I++,O=0,N=a+1;O<N;){var B=O++,z=k*g,V=B*_;P.push([z,V]);var U=C.rationalSurfaceDerivatives(n,z,V,1),W=U[0][0];w.push(W);var ee=f.normalized(f.cross(U[1][0],U[0][1]));A.push(ee)}for(var $=[],G=0;G<i;)for(var K=G++,te=0;te<a;){var ne=te++,se=K*(a+1)+ne,le=(K+1)*(a+1)+ne,ae=le+1,ue=se+1,ie=[se,le,ae],fe=[se,ae,ue];$.push(ie),$.push(fe)}return new Yt($,w,A,P)},De.divideRationalSurfaceAdaptive=function(n,i){i==null&&(i=new Hn),i.minDivsU!=null?i.minDivsU=i.minDivsU:i.minDivsU=1,i.minDivsV!=null?i.minDivsU=i.minDivsV:i.minDivsU=1,i.refine!=null?i.refine=i.refine:i.refine=!0;var a=(n.controlPoints.length-1)*2,o=(n.controlPoints[0].length-1)*2,u;i.minDivsU>a?u=i.minDivsU=i.minDivsU:u=i.minDivsU=a;var d;i.minDivsV>o?d=i.minDivsV=i.minDivsV:d=i.minDivsV=o;for(var m=Y.last(n.knotsU),g=n.knotsU[0],_=Y.last(n.knotsV),w=n.knotsV[0],P=(m-g)/u,A=(_-w)/d,I=[],T=[],k=0,O=d+1;k<O;){for(var N=k++,B=[],z=0,V=u+1;z<V;){var U=z++,W=g+P*U,ee=w+A*N,$=C.rationalSurfaceDerivatives(n,W,ee,1),G=f.normalized(f.cross($[0][1],$[1][0]));B.push(new Vt($[0][0],G,[W,ee],-1,f.isZero(G)))}T.push(B)}for(var K=0;K<d;)for(var te=K++,ne=0;ne<u;){var se=ne++,le=[T[d-te-1][se],T[d-te-1][se+1],T[d-te][se+1],T[d-te][se]];I.push(new kn(n,le))}if(!i.refine)return I;for(var ae=0;ae<d;)for(var ue=ae++,ie=0;ie<u;){var fe=ie++,q=ue*u+fe,pe=De.north(q,ue,fe,u,d,I),Pe=De.east(q,ue,fe,u,d,I),Ue=De.south(q,ue,fe,u,d,I),Ye=De.west(q,ue,fe,u,d,I);I[q].neighbors=[Ue,Pe,pe,Ye],I[q].divide(i)}return I},De.north=function(n,i,a,o,u,d){return i==0?null:d[n-o]},De.south=function(n,i,a,o,u,d){return i==u-1?null:d[n+o]},De.east=function(n,i,a,o,u,d){return a==o-1?null:d[n+1]},De.west=function(n,i,a,o,u,d){return a==0?null:d[n-1]},De.triangulateAdaptiveRefinementNodeTree=function(n){for(var i=Yt.empty(),a=0;a<n.length;){var o=n[a];++a,o.triangulate(i)}return i},De.rationalSurfaceAdaptive=function(n,i){i!=null?i=i:i=new Hn;var a=De.divideRationalSurfaceAdaptive(n,i);return De.triangulateAdaptiveRefinementNodeTree(a)};var Hn=p.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=Hn,Hn.__name__=["verb","eval","AdaptiveRefinementOptions"],Hn.prototype={__class__:Hn};var kn=p.core.AdaptiveRefinementNode=function(n,i,a){if(this.srf=n,a==null?this.neighbors=[null,null,null,null]:this.neighbors=a,this.corners=i,this.corners==null){var o=n.knotsU[0],u=Y.last(n.knotsU),d=n.knotsV[0],m=Y.last(n.knotsV);this.corners=[Vt.fromUv(o,d),Vt.fromUv(u,d),Vt.fromUv(u,m),Vt.fromUv(o,m)]}};x["verb.eval.AdaptiveRefinementNode"]=kn,kn.__name__=["verb","eval","AdaptiveRefinementNode"],kn.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var n=0;n<4;){var i=n++;if(this.corners[i].point==null){var a=this.corners[i];this.evalSrf(a.uv[0],a.uv[1],a)}}},evalSrf:function(n,i,a){var o=C.rationalSurfaceDerivatives(this.srf,n,i,1),u=o[0][0],d=f.cross(o[0][1],o[1][0]),m=f.isZero(d);return m||(d=f.normalized(d)),a!=null?(a.degen=m,a.point=u,a.normal=d,a):new Vt(u,d,[n,i],-1,m)},getEdgeCorners:function(n){if(this.isLeaf())return[this.corners[n]];if(this.horizontal)switch(n){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(n){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(n){var i=[this.corners[n]];if(this.neighbors[n]==null)return i;var a=this.neighbors[n].getEdgeCorners((n+2)%4),o=n%2,u=re.EPSILON,d=this,m=[function(_){return _.uv[0]>d.corners[0].uv[0]+u&&_.uv[0]<d.corners[2].uv[0]-u},function(_){return _.uv[1]>d.corners[0].uv[1]+u&&_.uv[1]<d.corners[2].uv[1]-u}],g=a.filter(m[o]);return g.reverse(),i.concat(g)},midpoint:function(n){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[n]!=null)return this.midPoints[n];switch(n){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[n]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var n=this.corners.length,i=0;i<n;){var a=i++;if(this.corners[a],this.corners[a].degen){var o=this.corners[(a+1)%n],u=this.corners[(a+3)%n];o.degen?this.corners[a].normal=u.normal:this.corners[a].normal=o.normal}}},shouldDivide:function(n,i){if(i<n.minDepth)return!0;if(i>=n.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=f.normSquared(f.sub(this.corners[0].normal,this.corners[1].normal))>n.normTol||f.normSquared(f.sub(this.corners[2].normal,this.corners[3].normal))>n.normTol,this.splitHoriz=f.normSquared(f.sub(this.corners[1].normal,this.corners[2].normal))>n.normTol||f.normSquared(f.sub(this.corners[3].normal,this.corners[0].normal))>n.normTol,this.splitVert||this.splitHoriz)return!0;var a=this.center();return f.normSquared(f.sub(a.normal,this.corners[0].normal))>n.normTol||f.normSquared(f.sub(a.normal,this.corners[1].normal))>n.normTol||f.normSquared(f.sub(a.normal,this.corners[2].normal))>n.normTol||f.normSquared(f.sub(a.normal,this.corners[3].normal))>n.normTol},divide:function(n){n==null&&(n=new Hn),n.normTol==null&&(n.normTol=.085),n.minDepth==null&&(n.minDepth=0),n.maxDepth==null&&(n.maxDepth=10),this._divide(n,0,!0)},_divide:function(n,i,a){if(this.evalCorners(),!!this.shouldDivide(n,i)){if(i++,this.splitVert&&!this.splitHoriz?a=!1:!this.splitVert&&this.splitHoriz&&(a=!0),this.horizontal=a,this.horizontal){var o=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],u=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new kn(this.srf,o),new kn(this.srf,u)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],m=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new kn(this.srf,d),new kn(this.srf,m)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var g=0,_=this.children;g<_.length;){var w=_[g];++g,w._divide(n,i,!a)}}},triangulate:function(n){if(n==null&&(n=Yt.empty()),this.isLeaf())return this.triangulateLeaf(n);for(var i=0,a=this.children;i<a.length;){var o=a[i];if(++i,o==null)break;o.triangulate(n)}return n},triangulateLeaf:function(n){for(var i=n.points.length,a=[],o=[],u=0,d=0;d<4;){var m=d++,g=this.getAllCorners(m);g.length==2&&(u=m+1);for(var _=0,w=g.length;_<w;){var P=_++;a.push(g[P])}}for(var A=0;A<a.length;){var I=a[A];if(++A,I.id!=-1){o.push(I.id);continue}n.uvs.push(I.uv),n.points.push(I.point),n.normals.push(I.normal),I.id=i,o.push(i),i++}if(a.length==4)return n.faces.push([o[0],o[3],o[1]]),n.faces.push([o[3],o[2],o[1]]),n;if(a.length==5){var T=o.length;return n.faces.push([o[u],o[(u+2)%T],o[(u+1)%T]]),n.faces.push([o[(u+4)%T],o[(u+3)%T],o[u]]),n.faces.push([o[u],o[(u+3)%T],o[(u+2)%T]]),n}var k=this.center();n.uvs.push(k.uv),n.points.push(k.point),n.normals.push(k.normal);for(var O=n.points.length-1,N=0,B=a.length-1;N<a.length;)n.faces.push([O,o[N],o[B]]),B=N++;return n},__class__:kn};var we=p.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=we,we.__name__=["verb","exe","Dispatcher"],we.init=function(){we._init||(we._workerPool=new $n(we.THREADS),we._init=!0)},we.dispatchMethod=function(n,i,a){we.init();var o=new Lr,u=function(d){o.resolve(d)};return we._workerPool.addWork(ge.getClassName(n),i,a,u),new vt(o)};var $n=p.exe.WorkerPool=function(n,i){i==null&&(i="verb.js"),n==null&&(n=1),this._callbacks=new xe,this._working=new xe,this._pool=[],this._queue=[];for(var a=0;a<n;){a++;var o;try{o=new Worker($n.basePath+i)}catch(u){u instanceof J&&(u=u.val),o=new Worker($n.basePath+i.substring(0,-3)+".min.js")}this._pool.push(o)}};x["verb.exe.WorkerPool"]=$n,$n.__name__=["verb","exe","WorkerPool"],$n.prototype={addWork:function(n,i,a,o){var u=new pr(n,i,a);this._callbacks.set(u.id,o),this._queue.push(u),this.processQueue()},processQueue:function(){for(var n=this;this._queue.length>0&&this._pool.length>0;){var i=this._queue.shift(),a=[i.id],o=[this._pool.shift()];this._working.h[a[0]]=o[0],o[0].onmessage=function(u,d){return function(m){n._working.remove(d[0]),n._pool.push(u[0]);try{n._callbacks.h.hasOwnProperty(d[0])&&(n._callbacks.h[d[0]](m.data.result),n._callbacks.remove(d[0]))}catch(g){g instanceof J&&(g=g.val),b.log(g)}n.processQueue()}}(o,a),o[0].postMessage(i)}},__class__:$n};var pr=function(n,i,a){this.className=n,this.methodName=i,this.args=a,this.id=pr.uuid++};x["verb.exe._WorkerPool.Work"]=pr,pr.__name__=["verb","exe","_WorkerPool","Work"],pr.prototype={__class__:pr};var jr=function(){};x["verb.geom.ICurve"]=jr,jr.__name__=["verb","geom","ICurve"],jr.__interfaces__=[Br],jr.prototype={__class__:jr};var ke=p.geom.NurbsCurve=function(n){this._data=jt.isValidNurbsCurveData(n)};x["verb.geom.NurbsCurve"]=ke,ke.__name__=["verb","geom","NurbsCurve"],ke.__interfaces__=[jr],ke.byKnotsControlPointsWeights=function(n,i,a,o){return new ke(new je(n,i.slice(),C.homogenize1d(a,o)))},ke.byPoints=function(n,i){return i==null&&(i=3),new ke(me.rationalInterpCurve(n,i))},ke.__super__=Je,ke.prototype=M(Je.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return C.dehomogenize1d(this._data.controlPoints)},weights:function(){return C.weight1d(this._data.controlPoints)},asNurbs:function(){return new je(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new ke(this._data)},domain:function(){return new St(Y.first(this._data.knots),Y.last(this._data.knots))},transform:function(n){return new ke(ye.rationalCurveTransform(this._data,n))},transformAsync:function(n){return we.dispatchMethod(ye,"rationalCurveTransform",[this._data,n]).then(function(i){return new ke(i)})},point:function(n){return C.rationalCurvePoint(this._data,n)},pointAsync:function(n){return we.dispatchMethod(C,"rationalCurvePoint",[this._data,n])},tangent:function(n){return C.rationalCurveTangent(this._data,n)},tangentAsync:function(n){return we.dispatchMethod(C,"rationalCurveTangent",[this._data,n])},derivatives:function(n,i){return i==null&&(i=1),C.rationalCurveDerivatives(this._data,n,i)},derivativesAsync:function(n,i){return i==null&&(i=1),we.dispatchMethod(C,"rationalCurveDerivatives",[this._data,n,i])},closestPoint:function(n){return be.rationalCurveClosestPoint(this._data,n)},closestPointAsync:function(n){return we.dispatchMethod(be,"rationalCurveClosestPoint",[this._data,n])},closestParam:function(n){return be.rationalCurveClosestParam(this._data,n)},closestParamAsync:function(n){return we.dispatchMethod(be,"rationalCurveClosestParam",[this._data,n])},length:function(){return be.rationalCurveArcLength(this._data)},lengthAsync:function(){return we.dispatchMethod(be,"rationalCurveArcLength",[this._data])},lengthAtParam:function(n){return be.rationalCurveArcLength(this._data,n)},lengthAtParamAsync:function(){return we.dispatchMethod(be,"rationalCurveArcLength",[this._data])},paramAtLength:function(n,i){return be.rationalCurveParamAtArcLength(this._data,n,i)},paramAtLengthAsync:function(n,i){return we.dispatchMethod(be,"rationalCurveParamAtArcLength",[this._data,n,i])},divideByEqualArcLength:function(n){return ft.rationalCurveByEqualArcLength(this._data,n)},divideByEqualArcLengthAsync:function(n){return we.dispatchMethod(ft,"rationalCurveByEqualArcLength",[this._data,n])},divideByArcLength:function(n){return ft.rationalCurveByArcLength(this._data,n)},divideByArcLengthAsync:function(n){return we.dispatchMethod(ft,"rationalCurveByArcLength",[this._data,n])},split:function(n){return ft.curveSplit(this._data,n).map(function(i){return new ke(i)})},splitAsync:function(n){return we.dispatchMethod(ft,"curveSplit",[this._data,n]).then(function(i){return i.map(function(a){return new ke(a)})})},reverse:function(){return new ke(ye.curveReverse(this._data))},reverseAsync:function(){return we.dispatchMethod(ye,"curveReverse",[this._data]).then(function(n){return new ke(n)})},tessellate:function(n){return De.rationalCurveAdaptiveSample(this._data,n,!1)},tessellateAsync:function(n){return we.dispatchMethod(De,"rationalCurveAdaptiveSample",[this._data,n,!1])},__class__:ke});var Wn=p.geom.Arc=function(n,i,a,o,u,d){ke.call(this,me.arc(n,i,a,o,u,d)),this._center=n,this._xaxis=i,this._yaxis=a,this._radius=o,this._minAngle=u,this._maxAngle=d};x["verb.geom.Arc"]=Wn,Wn.__name__=["verb","geom","Arc"],Wn.__super__=ke,Wn.prototype=M(ke.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Wn});var Mi=p.geom.BezierCurve=function(n,i){ke.call(this,me.rationalBezierCurve(n,i))};x["verb.geom.BezierCurve"]=Mi,Mi.__name__=["verb","geom","BezierCurve"],Mi.__super__=ke,Mi.prototype=M(ke.prototype,{__class__:Mi});var ki=p.geom.Circle=function(n,i,a,o){Wn.call(this,n,i,a,o,0,Math.PI*2)};x["verb.geom.Circle"]=ki,ki.__name__=["verb","geom","Circle"],ki.__super__=Wn,ki.prototype=M(Wn.prototype,{__class__:ki});var Ur=function(){};x["verb.geom.ISurface"]=Ur,Ur.__name__=["verb","geom","ISurface"],Ur.__interfaces__=[Br],Ur.prototype={__class__:Ur};var Se=p.geom.NurbsSurface=function(n){this._data=jt.isValidNurbsSurfaceData(n)};x["verb.geom.NurbsSurface"]=Se,Se.__name__=["verb","geom","NurbsSurface"],Se.__interfaces__=[Ur],Se.byKnotsControlPointsWeights=function(n,i,a,o,u,d){return new Se(new rt(n,i,a,o,C.homogenize2d(u,d)))},Se.byCorners=function(n,i,a,o){return new Se(me.fourPointSurface(n,i,a,o))},Se.byLoftingCurves=function(n,i){return new Se(me.loftedSurface(function(a){for(var o,u=[],d=0;d<n.length;){var m=n[d];++d,u.push(m.asNurbs())}return o=u,o}(),i))},Se.__super__=Je,Se.prototype=M(Je.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return C.dehomogenize2d(this._data.controlPoints)},weights:function(){return C.weight2d(this._data.controlPoints)},asNurbs:function(){return new rt(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Se(this.asNurbs())},domainU:function(){return new St(Y.first(this._data.knotsU),Y.last(this._data.knotsU))},domainV:function(){return new St(Y.first(this._data.knotsV),Y.last(this._data.knotsV))},point:function(n,i){return C.rationalSurfacePoint(this._data,n,i)},pointAsync:function(n,i){return we.dispatchMethod(C,"rationalSurfacePoint",[this._data,n,i])},normal:function(n,i){return C.rationalSurfaceNormal(this._data,n,i)},normalAsync:function(n,i){return we.dispatchMethod(C,"rationalSurfaceNormal",[this._data,n,i])},derivatives:function(n,i,a){return a==null&&(a=1),C.rationalSurfaceDerivatives(this._data,n,i,a)},derivativesAsync:function(n,i,a){return a==null&&(a=1),we.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,n,i,a])},closestParam:function(n){return be.rationalSurfaceClosestParam(this._data,n)},closestParamAsync:function(n){return we.dispatchMethod(be,"rationalSurfaceClosestParam",[this._data,n])},closestPoint:function(n){return be.rationalSurfaceClosestPoint(this._data,n)},closestPointAsync:function(n){return we.dispatchMethod(be,"rationalSurfaceClosestPoint",[this._data,n])},split:function(n,i){return i==null&&(i=!1),ft.surfaceSplit(this._data,n,i).map(function(a){return new Se(a)})},splitAsync:function(n,i){return i==null&&(i=!1),we.dispatchMethod(ft,"surfaceSplit",[this._data,n,i]).then(function(a){return a.map(function(o){return new Se(o)})})},reverse:function(n){return n==null&&(n=!1),new Se(ye.surfaceReverse(this._data,n))},reverseAsync:function(n){return n==null&&(n=!1),we.dispatchMethod(ye,"surfaceReverse",[this._data,n]).then(function(i){return new Se(i)})},isocurve:function(n,i){return i==null&&(i=!1),new ke(me.surfaceIsocurve(this._data,n,i))},isocurveAsync:function(n,i){return i==null&&(i=!1),we.dispatchMethod(me,"surfaceIsocurve",[this._data,n,i]).then(function(a){return new ke(a)})},boundaries:function(n){return me.surfaceBoundaryCurves(this._data).map(function(i){return new ke(i)})},boundariesAsync:function(n){return we.dispatchMethod(me,"surfaceBoundaryCurves",[this._data]).then(function(i){return i.map(function(a){return new ke(a)})})},tessellate:function(n){return De.rationalSurfaceAdaptive(this._data,n)},tessellateAsync:function(n){return we.dispatchMethod(De,"rationalSurfaceAdaptive",[this._data,n])},transform:function(n){return new Se(ye.rationalSurfaceTransform(this._data,n))},transformAsync:function(n){return we.dispatchMethod(ye,"rationalSurfaceTransform",[this._data,n]).then(function(i){return new Se(i)})},__class__:Se});var Ci=p.geom.ConicalSurface=function(n,i,a,o,u){Se.call(this,me.conicalSurface(n,i,a,o,u)),this._axis=n,this._xaxis=i,this._base=a,this._height=o,this._radius=u};x["verb.geom.ConicalSurface"]=Ci,Ci.__name__=["verb","geom","ConicalSurface"],Ci.__super__=Se,Ci.prototype=M(Se.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:Ci});var Li=p.geom.CylindricalSurface=function(n,i,a,o,u){Se.call(this,me.cylindricalSurface(n,i,a,o,u)),this._axis=n,this._xaxis=i,this._base=a,this._height=o,this._radius=u};x["verb.geom.CylindricalSurface"]=Li,Li.__name__=["verb","geom","CylindricalSurface"],Li.__super__=Se,Li.prototype=M(Se.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:Li});var qn=p.geom.EllipseArc=function(n,i,a,o,u){ke.call(this,me.ellipseArc(n,i,a,o,u)),this._center=n,this._xaxis=i,this._yaxis=a,this._minAngle=o,this._maxAngle=u};x["verb.geom.EllipseArc"]=qn,qn.__name__=["verb","geom","EllipseArc"],qn.__super__=ke,qn.prototype=M(ke.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:qn});var Ni=p.geom.Ellipse=function(n,i,a){qn.call(this,n,i,a,0,Math.PI*2)};x["verb.geom.Ellipse"]=Ni,Ni.__name__=["verb","geom","Ellipse"],Ni.__super__=qn,Ni.prototype=M(qn.prototype,{__class__:Ni});var Oi=p.geom.ExtrudedSurface=function(n,i){Se.call(this,me.extrudedSurface(f.normalized(i),f.norm(i),n.asNurbs())),this._profile=n,this._direction=i};x["verb.geom.ExtrudedSurface"]=Oi,Oi.__name__=["verb","geom","ExtrudedSurface"],Oi.__super__=Se,Oi.prototype=M(Se.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:Oi});var Kn=p.geom.Intersect=function(){};x["verb.geom.Intersect"]=Kn,Kn.__name__=["verb","geom","Intersect"],Kn.curves=function(n,i,a){return a==null&&(a=.001),oe.curves(n.asNurbs(),i.asNurbs(),a)},Kn.curvesAsync=function(n,i,a){return a==null&&(a=.001),we.dispatchMethod(oe,"curves",[n.asNurbs(),i.asNurbs(),a])},Kn.curveAndSurface=function(n,i,a){return a==null&&(a=.001),oe.curveAndSurface(n.asNurbs(),i.asNurbs(),a)},Kn.curveAndSurfaceAsync=function(n,i,a){return a==null&&(a=.001),we.dispatchMethod(oe,"curveAndSurface",[n.asNurbs(),i.asNurbs(),a])},Kn.surfaces=function(n,i,a){return a==null&&(a=.001),oe.surfaces(n.asNurbs(),i.asNurbs(),a).map(function(o){return new ke(o)})},Kn.surfacesAsync=function(n,i,a){return a==null&&(a=.001),we.dispatchMethod(oe,"surfaces",[n.asNurbs(),i.asNurbs(),a]).then(function(o){return o.map(function(u){return new ke(u)})})};var Di=p.geom.Line=function(n,i){ke.call(this,me.polyline([n,i])),this._start=n,this._end=i};x["verb.geom.Line"]=Di,Di.__name__=["verb","geom","Line"],Di.__super__=ke,Di.prototype=M(ke.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:Di});var zi=p.geom.RevolvedSurface=function(n,i,a,o){Se.call(this,me.revolvedSurface(n.asNurbs(),i,a,o)),this._profile=n,this._center=i,this._axis=a,this._angle=o};x["verb.geom.RevolvedSurface"]=zi,zi.__name__=["verb","geom","RevolvedSurface"],zi.__super__=Se,zi.prototype=M(Se.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:zi});var Ri=p.geom.SphericalSurface=function(n,i){Se.call(this,me.sphericalSurface(n,[0,0,1],[1,0,0],i)),this._center=n,this._radius=i};x["verb.geom.SphericalSurface"]=Ri,Ri.__name__=["verb","geom","SphericalSurface"],Ri.__super__=Se,Ri.prototype=M(Se.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:Ri});var Bi=p.geom.SweptSurface=function(n,i){Se.call(this,me.rationalTranslationalSurface(n.asNurbs(),i.asNurbs())),this._profile=n,this._rail=i};x["verb.geom.SweptSurface"]=Bi,Bi.__name__=["verb","geom","SweptSurface"],Bi.__super__=Se,Bi.prototype=M(Se.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:Bi});function Zt(n){return n instanceof Array?function(){return D.iter(n)}:typeof n.iterator=="function"?Rt(n,n.iterator):n.iterator}var Ga,Fg=0;function Rt(n,i){if(i==null)return null;i.__id__==null&&(i.__id__=Fg++);var a;return n.hx__closures__==null?n.hx__closures__={}:a=n.hx__closures__[i.__id__],a==null&&(a=function(){return a.method.apply(a.scope,arguments)},a.scope=n,a.method=i,n.hx__closures__[i.__id__]=a),a}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var Vg=x.Int={__name__:["Int"]},jg=x.Dynamic={__name__:["Dynamic"]},Fu=x.Float=Number;Fu.__name__=["Float"];var Vu=x.Bool=Boolean;Vu.__ename__=["Bool"];var ju=x.Class={__name__:["Class"]},Uu={};Array.prototype.map==null&&(Array.prototype.map=function(n){for(var i=[],a=0,o=this.length;a<o;){var u=a++;i[u]=n(this[u])}return i}),Array.prototype.filter==null&&(Array.prototype.filter=function(n){for(var i=[],a=0,o=this.length;a<o;){var u=a++,d=this[u];n(d)&&i.push(d)}return i});var Ha={},Ms=S.ArrayBuffer||dt;Ms.prototype.slice==null&&(Ms.prototype.slice=dt.sliceImpl),S.DataView;var $a=S.Uint8Array||ln._new;(function(n,i){if(n.setImmediate)return;var a=1,o={},u=!1,d=n.document,m;function g(z){return o[a]=_.apply(i,z),a++}function _(z){var V=[].slice.call(arguments,1);return function(){typeof z=="function"?z.apply(i,V):new Function(""+z)()}}function w(z){if(u)setTimeout(_(w,z),0);else{var V=o[z];if(V){u=!0;try{V()}finally{P(z),u=!1}}}}function P(z){delete o[z]}function A(){m=function(){var z=g(arguments);return process.nextTick(_(w,z)),z}}function I(){if(n.postMessage&&!n.importScripts){var z=!0,V=n.onmessage;return n.onmessage=function(){z=!1},n.postMessage("","*"),n.onmessage=V,z}}function T(){var z="setImmediate$"+Math.random()+"$",V=function(U){U.source===n&&typeof U.data=="string"&&U.data.indexOf(z)===0&&w(+U.data.slice(z.length))};n.addEventListener?n.addEventListener("message",V,!1):n.attachEvent("onmessage",V),m=function(){var U=g(arguments);return n.postMessage(z+U,"*"),U}}function k(){var z=new MessageChannel;z.port1.onmessage=function(V){var U=V.data;w(U)},m=function(){var V=g(arguments);return z.port2.postMessage(V),V}}function O(){var z=d.documentElement;m=function(){var V=g(arguments),U=d.createElement("script");return U.onreadystatechange=function(){w(V),U.onreadystatechange=null,z.removeChild(U),U=null},z.appendChild(U),V}}function N(){m=function(){var z=g(arguments);return setTimeout(_(w,z),0),z}}var B=Object.getPrototypeOf&&Object.getPrototypeOf(n);B=B&&B.setTimeout?B:n,{}.toString.call(n.process)==="[object process]"?A():I()?T():n.MessageChannel?k():d&&"onreadystatechange"in d.createElement("script")?O():N(),B.setImmediate=m,B.clearImmediate=P})(new Function("return this")()),Ke.USE_CACHE=!1,Ke.USE_ENUM_INDEX=!1,Ke.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",$e.DEFAULT_RESOLVER=ge,$e.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Ne.count=0,ht.i64tmp=function(n){var i,a=new qe(0,0);return i=a,i}(),Me.__toStr={}.toString,ln.BYTES_PER_ELEMENT=1,Ae.queue=new j,ze.memo=new xe,re.TOLERANCE=1e-6,re.EPSILON=1e-10,re.VERSION="2.0.0",be.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],be.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],we.THREADS=1,we._init=!1,$n.basePath="",pr.uuid=0,Es.main()}(typeof console<"u"?console:{log:function(){}},t,typeof h<"u"?h:typeof s<"u"?s:typeof self<"u"?self:this),t})})(Fc);var Lg=Fc.exports;const Ma=Cg(Lg);class vs extends gs{constructor(e,t,s,l,c,h=0,v=ut){super(),this.center=e,this.normal=t,this.majorAxis=s,this.majorAxisRadius=l,this.minorAxisRadius=c,(v-h)%ut==0?(this.startAngle=0,this.endAngle=ut):(this.startAngle=h,this.endAngle=v)}get center(){return this._center}set center(e){this._center=new Q(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Gt.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Gt.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==ut?e:Oe.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Oe.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new Z(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new Z().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return this.toVerbEllipseArc().length()}calculateBoundingBox(){if(this.majorAxis.equals(Z.X_AXIS)||this.majorAxis.equals(Z.Y_AXIS)||this.majorAxis.isParallelTo(Z.X_AXIS)||this.majorAxis.isParallelTo(Z.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Oe.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,s=1/0,l=1/0,c=-1/0,h=-1/0,v=-1/0;for(const b of e){const p=this.getPointAtAngle(b);p.x<t&&(t=p.x),p.y<s&&(s=p.y),p.z<l&&(l=p.z),p.x>c&&(c=p.x),p.y>h&&(h=p.y),p.z>v&&(v=p.z)}return new Fe({x:t,y:s,z:l},{x:c,y:h,z:v})}else{let e=1/0,t=1/0,s=1/0,l=-1/0,c=-1/0,h=-1/0;for(let v=0;v<=100;v++){const b=this.startAngle+this.deltaAngle*(v/100),p=this.getPointAtAngle(b);e=Math.min(e,p.x),t=Math.min(t,p.y),s=Math.min(s,p.z),l=Math.max(l,p.x),c=Math.max(c,p.y),h=Math.max(h,p.z)}return new Fe({x:e,y:t,z:s},{x:l,y:c,z:h})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let s=this.deltaAngle,l=this.startAngle;this.closed&&(s=ut,l=0);for(let c=0;c<=e;c++){const h=l+s*(c/e),v=this.getPointAtAngle(h);t.push(v)}return t}getPointAtAngle(e){const t=Math.cos(e),s=Math.sin(e),l=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),c=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(l);return new Q(this.center.x+c.x,this.center.y+c.y,this.center.z+c.z)}contains(e){const t=new Z(e).sub(this.center),s=t.dot(this.majorAxis),l=t.dot(this.minorAxis),c=s/this.majorAxisRadius,h=l/this.minorAxisRadius;return c*c+h*h<=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 vs(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new Z(this.center).distanceTo(xa);return new gi(this.normal,e)}toVerbEllipseArc(){const e=new Array(3);this.center.toArray(e);const t=new Array(3);this.majorAxis.clone().multiplyScalar(this.majorAxisRadius).toArray(t);const s=new Array(3);return this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).toArray(s),new Ma.geom.EllipseArc(e,t,s,this.startAngle,this.endAngle)}}class pi extends Er{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new Te(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new Te(t.x,t.y)}else{const t=this._vertices[e-1];return new Te(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let s=0;s<t;++s){const l=this._vertices[s];let c=null;if(s<t-1?c=this._vertices[s+1]:s==t-1&&this.closed&&(c=this._vertices[0]),c)if(l.bulge){const h=new Tr(l,c,l.bulge);e+=h.length}else e+=new Te(l.x,l.y).distanceTo(c)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}getPointAt(e){const t=this._vertices[e];return new Te(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new gt().setFromPoints(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(e,t){const s=[];return this.getPoints(e).forEach(l=>s.push(new Q().set(l.x,l.y,t))),s}getPoints(e){const t=[],s=this._vertices.length;for(let l=0;l<s;++l){const c=this._vertices[l];if(c.bulge){let h=null;if(l<s-1?h=this._vertices[l+1]:l==s-1&&this.closed&&(h=this._vertices[0]),h){const v=new Tr(c,h,c.bulge).getPoints(e),b=v.length;for(let p=0;p<b;++p){const S=v[p];t.push(new Te(S.x,S.y))}}}else t.push(new Te(c.x,c.y)),l==s-1&&this.closed&&t.push(t[0])}return t}}class ys extends Er{constructor(e,t){super(),this._start=new Te(e),this._end=new Te(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new Te(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new Te(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new gt(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 ys(this._start.clone(),this._end.clone())}}class Vc extends Er{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new Te(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new gt;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(l=>{t.push(new Te(l.x,l.y))})}),t}}class Mr extends gs{constructor(e,t,s){super();const l=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(l!=2&&l!=3)throw Gt.ILLEGAL_PARAMETERS;const c=3;if(this._closed=!1,l==2&&!Array.isArray(t)){this._fitPoints=e,this._knotParameterization=t;const h=this.toVerbPoints(this._fitPoints);this._nurbsCurve=Ma.geom.NurbsCurve.byPoints(h,c),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{this._controlPoints=e;const h=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Ma.geom.NurbsCurve.byKnotsControlPointsWeights(c,t,h,s)}}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],l=this._nurbsCurve.point(s);return new Q(l[0],l[1],l[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[e.length-t-1],l=this._nurbsCurve.point(s);return new Q(l[0],l[1],l[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,l=this._fitPoints[s];return{x:l.x,y:l.y,z:l.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=[],l=t.knots(),c=this._nurbsCurve.degree(),h=l[c],v=(l[l.length-c-1]-h)/(e-1);for(let b=0;b<e;b++){const p=h+b*v,S=t.point(p);s.push(new Q(S[0],S[1],S[2]))}return s}getCurvePoints(e,t){const s=[],l=e.knots(),c=l[3],h=(l[l.length-4]-c)/(t-1);for(let v=0;v<t;v++){const b=c+v*h;s.push(e.point(b))}return s}calculateBoundingBox(){const e=this.getPoints(100);return new Fe().setFromPoints(e)}get closed(){return this._closed}set closed(e){this._boundingBoxNeedsUpdate=!0,this._closed=e}transform(e){return this._boundingBoxNeedsUpdate=!0,this}toVerbPoints(e){const t=new Array(e.length);return e.forEach((s,l)=>{t[l]=[s.x,s.y,s.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((s,l)=>{t[l]={x:s[0],y:s[1],z:s[2]}}),t}}for(var hr=256,jc=[],Uc=256,bs;hr--;)jc[hr]=(hr+256).toString(16).substring(1);function Ng(r){var e=0,t=11;if(!bs||hr+t>Uc*2)for(bs="",hr=0;e<Uc;e++)bs+=jc[Math.random()*256|0];return bs.substring(hr,hr+++t)}class Fn{constructor(e,t){e=e||{},Zr(e,{objectId:Ng()}),this._attrs=new Qo(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:ja().workingDatabase}set database(e){this._database=e}close(){}}class an extends Fn{constructor(){super(...arguments),this._layer="0",this._color=new Jn,this._lineType=us,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||us}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,l,c){}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==us){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==rc?cs:this.lineType;return cs}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 ka extends an{constructor(e){super(),this._blockName=e,this._position=new Q,this._rotation=0,this._normal=new Z(0,0,1),this._scaleFactors=new Q(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 Fe,t=this.blockTableRecord;if(t!=null){const c=t.newIterator();for(const h of c)e.union(h.geometricExtents)}const s=new zn().setFromEuler(new zc(this.rotation,0,0)),l=new lr;return l.compose(this.position,s,this.scaleFactors),e.applyMatrix4(l),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const l=this.computeTransformMatrix();return Dn.instance.draw(e,s,this.rgbColor,!0,l,this.normal)}else return e.group(t)}computeTransformMatrix(){const e=new zn;return e.setFromAxisAngle(Z.Z_AXIS,this.rotation),new lr().compose(this._position,e,this._scaleFactors)}}class Kt extends an{}class Gc extends Kt{constructor(e,t,s,l,c,h,v){super(),this._geo=new vs(e,t,s,l,c,h,v)}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 Hc extends Kt{constructor(e,t,s,l){super(),this._geo=new ur(e,t,s,l,Z.Z_AXIS,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get 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 $c extends Kt{constructor(e,t,s=Z.Z_AXIS){super(),this._geo=new ur(e,t,0,ut,s,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}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 Wc=(r=>(r[r.UserDefined=0]="UserDefined",r[r.Predefined=1]="Predefined",r[r.Custom=2]="Custom",r))(Wc||{}),qc=(r=>(r[r.Normal=0]="Normal",r[r.Outer=1]="Outer",r[r.Ignore=2]="Ignore",r))(qc||{});class Kc extends an{constructor(){super(),this._elevation=0,this._geo=new ms,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 Fe({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 Yc=(r=>(r[r.MText=0]="MText",r[r.Fcf=1]="Fcf",r[r.BlockReference=2]="BlockReference",r[r.NoAnnotation=3]="NoAnnotation",r))(Yc||{});class Xc extends Kt{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 Q().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 Fe().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 Mr(this._vertices,"Uniform"),this._updated=!1)}}class Zc extends Kt{constructor(e,t){super(),this._geo=new Bn(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,l,c){const h=this.startPoint,v=this.endPoint;switch(e){case ar.EndPoint:c.push(h),c.push(v);break;case ar.MidPoint:c.push(this.midPoint);break;case ar.Nearest:{const b=this._geo.project(s);c.push(b)}break;case ar.Perpendicular:{const b=this._geo.perpPoint(s);c.push(b)}break;case ar.Tangent:c.push(h);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,l=[new Q(t.x,t.y,0),new Q(s.x,s.y,0)];return e.lines(l,this.lineStyle)}}var Ca=(r=>(r.ClosedFilled="",r.Dot="_DOT",r.DotSmall="_DOTSMALL",r.DotBlank="_DOTBLANK",r.Origin="_ORIGIN",r.Origin2="_ORIGIN2",r.Open="_OPEN",r.Open90="_OPEN90",r.Open30="_OPEN30",r.Closed="_CLOSED",r.Small="_SMALL",r.None="_NONE",r.Oblique="_OBLIQUE",r.BoxFilled="_BOXFILLED",r.Box="_BOXBLANK",r.ClosedBlank="_CLOSEDBLANK",r.DatumBlank="_DATUMBLANK",r.DatumFilled="_DATUMFILLED",r.Integral="_INTEGRAL",r.ArchTick="_ARCHTICK",r))(Ca||{}),xs=(r=>(r[r.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",r[r.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",r[r.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",r[r.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",r[r.BY_STYLE=5]="BY_STYLE",r))(xs||{}),kr=(r=>(r[r.TopLeft=1]="TopLeft",r[r.TopCenter=2]="TopCenter",r[r.TopRight=3]="TopRight",r[r.MiddleLeft=4]="MiddleLeft",r[r.MiddleCenter=5]="MiddleCenter",r[r.MiddleRight=6]="MiddleRight",r[r.BottomLeft=7]="BottomLeft",r[r.BottomCenter=8]="BottomCenter",r[r.BottomRight=9]="BottomRight",r))(kr||{}),La=(r=>(r[r.OPTIMIZED_2D=0]="OPTIMIZED_2D",r[r.WIREFRAME=1]="WIREFRAME",r[r.HIDDEN_LINE=2]="HIDDEN_LINE",r[r.FLAT_SHADED=3]="FLAT_SHADED",r[r.GOURAUD_SHADED=4]="GOURAUD_SHADED",r[r.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",r[r.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",r))(La||{}),Na=(r=>(r[r.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",r[r.TOP=1]="TOP",r[r.BOTTOM=2]="BOTTOM",r[r.FRONT=3]="FRONT",r[r.BACK=4]="BACK",r[r.LEFT=5]="LEFT",r[r.RIGHT=6]="RIGHT",r))(Na||{}),Oa=(r=>(r[r.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",r[r.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",r))(Oa||{});class ws{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new Q,this._height=0,this._width=0,this._viewCenter=new Q,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 gt;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 gt;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new ws;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 Qc extends an{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 Q,this._attachmentPoint=kr.TopLeft,this._direction=new Z(1,0,0),this._drawingDirection=xs.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 Fe}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 Da extends Kt{constructor(e,t,s){super();const l=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(l!=2&&l!=3)throw Gt.ILLEGAL_PARAMETERS;l==2&&!Array.isArray(t)?this._geo=new Mr(e,t):this._geo=new Mr(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 Og=new Z;class Jc extends ka{constructor(e,t,s){super(e),this._attachmentPoint=kr.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 Fe}draw(e){let t=0,s=0;const l=new Uint16Array(this.numColumns*this.numRows*8),c=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let h=0;for(let E=0;E<=this.numRows;E++){t-=E>0?this.rowHeight(E-1):0,s=0;for(let M=0;M<=this.numColumns;M++)s+=M>0?this.columnWidth(M-1):0,c[h++]=s,c[h++]=t,c[h++]=0}const v=[],b=new Array(this.numRows*this.numColumns).fill(!1);s=0,h=0;let p=0;for(let E=0;E<this.numColumns;E++){s+=E>0?this.columnWidth(E-1):0,t=0;for(let M=0;M<this.numRows;M++){t+=M>0?this.rowHeight(M-1):0;const D=this.cell(M*this.numColumns+E);if(p=M*this.numColumns+E,D&&!b[p]){const R=D.borderWidth??1,j=D.borderHeight??1;this.fillVisited(b,p,this.numColumns,R,j),l[h++]=E+M*(this.numColumns+1),l[h++]=E+M*(this.numColumns+1)+R;const F=c[l[h-1]*3]-s,he=E+(M+j)*(this.numColumns+1)+R;E+R==this.numColumns&&(l[h++]=E+M*(this.numColumns+1)+R,l[h++]=he);const _e=-c[he*3+1]-t;if(M+j==this.numRows&&(l[h++]=E+(M+j)*(this.numColumns+1)+j,l[h++]=E+(M+j)*(this.numColumns+1)),l[h++]=E+(M+j)*(this.numColumns+1),l[h++]=E+M*(this.numColumns+1),D.text){const de=D.attachmentPoint||this.attachmentPoint||kr.MiddleCenter,H=this.getTableTextOffset(de,F,_e),ge={text:D.text,height:D.textHeight,width:F,position:Og.set(s,-t,0).clone().add(H),rotation:this.rotation,attachmentPoint:de},ce={...this.getTextStyle(D),color:this.color.color};v.push(e.mtext(ge,ce))}}}}v.push(e.lineSegments(c,3,l,this.lineStyle));const S=e.group(v),x=new zn;return x.setFromAxisAngle(Z.Z_AXIS,this.rotation),eu.compose(this.position,x,this.scaleFactors),S.applyMatrix(eu),S}fillVisited(e,t,s,l,c){if(c==1&&l==1)e[t]=!0;else for(let h=0;h<l;++h)for(let v=0;v<c;++v)e[t+h+v*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 l=new Z;switch(e){case 1:break;case 2:l.setX(t/2);break;case 3:l.setX(t);break;case 4:l.setY(-s/2);break;case 5:l.set(t/2,-s/2,0);break;case 6:l.set(t,-s/2,0);break;case 7:l.setY(-s);break;case 8:l.set(t/2,-s,0);break;case 9:l.set(t,-s,0);break}return l}}const eu=new lr;var tu=(r=>(r[r.LEFT=0]="LEFT",r[r.CENTER=1]="CENTER",r[r.RIGHT=2]="RIGHT",r[r.ALIGNED=3]="ALIGNED",r[r.MIDDLE=4]="MIDDLE",r[r.FIT=5]="FIT",r))(tu||{}),nu=(r=>(r[r.BASELINE=0]="BASELINE",r[r.BOTTOM=1]="BOTTOM",r[r.MIDDLE=2]="MIDDLE",r[r.TOP=3]="TOP",r))(nu||{});class ru extends an{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new Q,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 Fe}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:xs.BOTTOM_TO_TOP,attachmentPoint:kr.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class iu extends Kt{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new Q,new Q,new Q,new Q]}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 Fe().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 pi(this._vertices,!0),s=new ms;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}}class su extends Kt{constructor(){super(),this._elevation=0,this._geo=new pi}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,l=-1,c=-1){const h=l<0?void 0:l,v=c<0?void 0:c,b={x:t.x,y:t.y,bulge:s,startWidth:h,endWidth:v};this._geo.addVertexAt(e,b)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new Q(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new Fe({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(l=>t.push(new Q().set(l.x,l.y,this.elevation))),e.lines(t,this.lineStyle)}}class au extends an{constructor(){super(),this._geo=new Q}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new Fe().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 ou=(r=>(r[r.Invalid=0]="Invalid",r[r.Rect=1]="Rect",r[r.Poly=2]="Poly",r))(ou||{}),lu=(r=>(r[r.Show=1]="Show",r[r.ShowUnAligned=2]="ShowUnAligned",r[r.Clip=4]="Clip",r[r.Transparent=8]="Transparent",r))(lu||{});class za extends an{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new Q,this._scale=new Ze(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 Fe;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,l=new gt;l.setFromPoints(this._clipBoundary);const c=new Te;c.setX(this._position.x-l.min.x*t),c.setY(this._position.y-l.min.y*s),this._clipBoundary.forEach(h=>{const v=h.x*t+c.x,b=h.y*s+c.y;e.push(new Q(v,b,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){cu.copy(e[1]);for(let t=1;t<4;t++)As.copy(e[t]),As.rotateAround(cu,this._rotation),e[t].setX(As.x),e[t].setY(As.y)}e.push(e[0])}return e}}const cu=new Te,As=new Te;class uu extends Kt{constructor(){super(),this._basePoint=new Q,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Fe;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 hu extends an{constructor(){super(),this._centerPoint=new Q,this._height=0,this._width=0,this._viewCenter=new Q,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 Fe}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 ws;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 Q(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new Q(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new Q(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new Q(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new Q(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new Q(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new Q(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new Q(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}}class du extends za{draw(e){const t=this.boundaryPath(),s=new ms;return s.add(new pi(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}}class fu extends Kt{constructor(){super(),this._basePoint=new Q,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Fe;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 mu=(r=>(r[r.AtLeast=1]="AtLeast",r[r.Exactly=2]="Exactly",r))(mu||{});class dr extends an{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new Q,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 _i),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 Dn.instance.draw(e,t,this.rgbColor,!1)}return e.group([])}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return Dn.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return Dn.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 l=new Q().subVectors(t,e).normalize();return new Q(t).addScaledVector(l,s)}findPointOnLine2(e,t,s){const l=e.x+s*Math.cos(t),c=e.y+s*Math.sin(t);return{x:l,y:c}}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():Ca.Closed}}class gu extends dr{constructor(e,t,s,l,c=null,h=null){super(),this._centerPoint=new Q().copy(e),this._xLine1Point=new Q().copy(t),this._xLine2Point=new Q().copy(s),this._arcPoint=new Q().copy(l),this.dimensionText=c,this.dimensionStyleName=h}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 Fe}}class pu extends dr{constructor(e,t,s,l=null,c=null){super(),this._dimLinePoint=new Q().copy(s),this._xLine1Point=new Q().copy(e),this._xLine2Point=new Q().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=l,this.dimensionStyleName=c}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 Fe}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),l=this.findIntersectionPoint(t,this._dimLinePoint),c=this.findIntersectionPoint(s,this._dimLinePoint),h=new Bn(l,c);return e.push(h),t.endPoint=l,this.adjustExtensionLine(t),e.push(t),s.endPoint=c,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new Bn(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,l=e.endPoint,c=new Z().subVectors(l,s).normalize(),v=new Z().subVectors(t,s).dot(c),b=new Z().copy(c).multiplyScalar(v);return new Z().addVectors(s,b)}}class Dg extends dr{constructor(e,t,s,l,c=null,h=null){super(),this._arcPoint=new Q().copy(l),this._xLine1Point=new Q().copy(t),this._xLine2Point=new Q().copy(s),this._centerPoint=new Q().copy(e),this.dimensionText=c,this.dimensionStyleName=h}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 Fe}}class _u extends dr{constructor(e,t,s=0,l=null,c=null){super(),this._chordPoint=new Q().copy(e),this._farChordPoint=new Q().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=l,this.dimensionStyleName=c}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 Fe}drawLines(e,t){const s=[],l=t.length;return l==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):l==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(c=>{s.push(this.drawLine(e,c))}),s}drawLine(e,t,s){if(s){const l=[t.startPoint,t.endPoint];return e.lines(l,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,l)=>s.x!==l.x?s.x-l.x:s.y!==l.y?s.y-l.y:s.z-l.z;e.sort((s,l)=>{const c=t(s.startPoint,l.startPoint);return c!==0?c:t(s.endPoint,l.endPoint)})}}class vu extends dr{constructor(e,t,s=null,l=null){super(),this._definingPoint=new Q().copy(e),this._leaderEndPoint=new Q().copy(t),this.dimensionText=s,this.dimensionStyleName=l}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 Fe}get arrowLineCount(){return 0}}class yu extends dr{constructor(e,t,s,l=null,c=null){super(),this._center=new Q().copy(e),this._chordPoint=new Q().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=l,this.dimensionStyleName=c}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 Fe}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}}class bu{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 Hc(e.center,e.radius,Oe.degToRad(e.startAngle),Oe.degToRad(e.endAngle))}convertCirle(e){return new $c(e.center,e.radius)}convertEllipse(e){const t=new Z(e.majorAxisEndPoint),s=t.length();return new Gc(e.center,Z.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new Zc(new Q(t.x,t.y,t.z||0),new Q(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){const t=new Da(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 Da(t,"Uniform");return s.closed=!!(e.flag&1),s}}return null}convertPoint(e){const t=new au;return t.position=e.position,t}convertSolid(e){const t=new iu;return e.points.forEach((s,l)=>t.setPointAt(l,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new su;return t.closed=!!(e.flag&1),e.vertices.forEach((s,l)=>{t.addVertexAt(l,new Te(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var l;const t=new Kc;return(l=e.definitionLines)==null||l.forEach(c=>{t.definitionLines.push({angle:c.angle,origin:c.base,delta:c.offset,dashPattern:c.numberOfDashLengths>0?c.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(c=>{if(c.boundaryPathTypeFlag&2){const v=c,b=new pi;b.closed=v.isClosed,v.vertices.forEach((p,S)=>{b.addVertexAt(S,{x:p.x,y:p.y,bulge:p.bulge})}),t.add(b)}else{const v=c,b=new Vc;v.edges.forEach(p=>{if(p.type==1){const S=p;b.add(new ys(S.start,S.end))}else if(p.type==2){const S=p;b.add(new Tr(S.center,S.radius,Oe.degToRad(S.startAngle||0),Oe.degToRad(S.endAngle||0),!S.isCCW))}else if(p.type==3){const S=p;new Ze().subVectors(S.end,S.center);const E=Math.sqrt(Math.pow(S.end.x,2)+Math.pow(S.end.y,2)),M=E*S.lengthOfMinorAxis;let D=Oe.degToRad(S.startAngle||0),R=Oe.degToRad(S.endAngle||0);const j=Math.atan2(S.end.y,S.end.x);S.isCCW||(D=Math.PI*2-D,R=Math.PI*2-R),b.add(new _s({...S.center,z:0},E,M,D,R,!S.isCCW,j))}else if(p.type==4){const S=p;if(S.numberOfControlPoints>0&&S.numberOfKnots>0){const x=S.controlPoints.map(D=>({x:D.x,y:D.y,z:0}));let E=!0;const M=S.controlPoints.map(D=>(D.weight==null&&(E=!1),D.weight||1));b.add(new Mr(x,S.knots,E?M:void 0))}else if(S.numberOfFitData>0){const x=S.fitDatum.map(E=>({x:E.x,y:E.y,z:0}));b.add(new Mr(x,"Uniform"))}}}),t.add(b)}}),t}convertTable(e){const t=new Jc(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,l)=>t.setColumnWidth(l,s)),e.rowHeightArr.forEach((s,l)=>t.setRowHeight(l,s)),e.cells.forEach((s,l)=>{t.setCell(l,s)}),t}convertText(e){const t=new ru;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=Oe.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 Qc;return t.contents=e.text.join(""),e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=Oe.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new Z(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new Xc;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 pu(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=Oe.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new gu(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new vu(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new yu(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new _u(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 Te(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 za;return this.processImage(e,t),t}convertWipeout(e){const t=new du;return this.processImage(e,t),t}convertViewport(e){const t=new hu;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 uu;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertXline(e){const t=new fu;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertBlockReference(e){const t=new ka(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?Oe.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 l=0;if(s/2==t?l=2:s/3==t&&(l=3),l==0)return;const c=[];for(let h=0,v=s/l;h<v;++h)c.push({x:e[h*l],y:e[h*l+1],z:l==3?e[h*l+2]:void 0});return c}}class Ra extends Fn{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new gt,this._extents=new Fe}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 Ba extends Fn{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,l)=>{s===t&&this._recordsByName.delete(l)}),!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 hs(this._recordsByName)}}class xu extends Ba{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 wu extends Fn{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class zg{convertLayout(e){const t=new Ra;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 wu;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class Au extends ac{parse(e){return new wg().parseSync(e)}getFonts(e){var c;const t=new Map,s=h=>{if(h){const v=h.lastIndexOf(".");return v>=0?h.substring(0,v).toLowerCase():h.toLowerCase()}};(c=e.tables.STYLE)==null||c.entries.forEach(h=>{const v=[];let b=s(h.font);b&&v.push(b),b=s(h.bigFont),b&&v.push(b),t.set(h.name,v)});const l=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,l),Array.from(l)}getFontsInBlock(e,t,s,l){const c=/\\f(.*?)\|/g;e.forEach(h=>{if(h.type=="MTEXT"){const v=h;[...v.text.join("").matchAll(c)].forEach(S=>{l.add(S[1].toLowerCase())});const p=s.get(v.styleName);p==null||p.forEach(S=>l.add(S))}else if(h.type=="TEXT"){const v=h,b=s.get(v.styleName);b==null||b.forEach(p=>l.add(p))}else if(h.type=="INSERT"){const b=t[h.name];b&&b.entities&&this.getFontsInBlock(b.entities,t,s,l)}})}async processEntities(e,t,s,l,c){const h=new bu,v=e.entities,b=v.length,p=new rl(b,100-l.value,s),S=t.tables.blockTable.modelSpace,x=t.tables.blockTable;await p.processChunk(async(E,M)=>{for(let D=E;D<M;D++){const R=v[D],j=h.convert(R);if(j){let F=S;R.ownerBlockRecordSoftId!=null&&(F=x.getIdAt(R.ownerBlockRecordSoftId)||F),F.appendEntity(j)}}if(c){let D=l.value+M/b*(100-l.value);D>100&&(D=100),await c(D,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t,s){const l=new bu,c=e.length;for(let h=0;h<c;h++){const v=e[h],b=l.convert(v);if(b){let p=t;v.ownerBlockRecordSoftId!=null&&(p=s.getIdAt(v.ownerBlockRecordSoftId)||p),p.appendEntity(b)}}}processBlocks(e,t){const s=e.blocks;for(const[l,c]of Object.entries(s)){let h=t.tables.blockTable.getAt(c.name);h||(h=new En,h.objectId=c.handle,h.name=l,h.origin.copy(c.position),t.tables.blockTable.add(h)),c.entities&&this.processEntitiesInBlock(c.entities,h,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 l;const s=(l=e.tables.BLOCK_RECORD)==null?void 0:l.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(c=>{const h=new En;h.objectId=c.handle,h.name=c.name,t.tables.blockTable.add(h)}))}processObjects(e,t){const s=e.objects.byName,l=new zg;if("LAYOUT"in s){const c=t.dictionaries.layouts;s.LAYOUT.forEach(h=>{const v=l.convertLayout(h);c.setAt(v.layoutName,v)})}if("IMAGEDEF"in s){const c=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(h=>{const v=l.convertImageDef(h);c.setAt(v.objectId,v)})}}processViewports(e,t){var l,c;const s=(c=(l=e.tables)==null?void 0:l.VPORT)==null?void 0:c.entries;s&&s.length>0&&s.forEach(h=>{const v=new Ru;this.processCommonTableEntryAttrs(h,v),h.circleSides&&(v.circleSides=h.circleSides),v.standardFlag=h.standardFlag,v.center.copy(h.center),v.lowerLeftCorner.copy(h.lowerLeftCorner),v.upperRightCorner.copy(h.upperRightCorner),h.snapBasePoint&&v.snapBase.copy(h.snapBasePoint),h.snapRotationAngle&&(v.snapAngle=h.snapRotationAngle),h.snapSpacing&&v.snapIncrements.copy(h.snapSpacing),h.majorGridLines&&(v.gridMajor=h.majorGridLines),h.gridSpacing&&v.gridIncrements.copy(h.gridSpacing),h.backgroundObjectId&&(v.backgroundObjectId=h.backgroundObjectId),v.gsView.center.copy(h.center),v.gsView.viewDirectionFromTarget.copy(h.viewDirectionFromTarget),v.gsView.viewTarget.copy(h.viewTarget),h.lensLength&&(v.gsView.lensLength=h.lensLength),h.frontClippingPlane&&(v.gsView.frontClippingPlane=h.frontClippingPlane),h.backClippingPlane&&(v.gsView.backClippingPlane=h.backClippingPlane),h.viewHeight&&(v.gsView.viewHeight=h.viewHeight),h.viewTwistAngle&&(v.gsView.viewTwistAngle=h.viewTwistAngle),h.frozenLayers&&(v.gsView.frozenLayers=h.frozenLayers),h.styleSheet&&(v.gsView.styleSheet=h.styleSheet),h.renderMode&&(v.gsView.renderMode=h.renderMode),h.viewMode&&(v.gsView.viewMode=h.viewMode),h.ucsIconSetting&&(v.gsView.ucsIconSetting=h.ucsIconSetting),h.ucsOrigin&&v.gsView.ucsOrigin.copy(h.ucsOrigin),h.ucsXAxis&&v.gsView.ucsXAxis.copy(h.ucsXAxis),h.ucsYAxis&&v.gsView.ucsYAxis.copy(h.ucsYAxis),h.orthographicType&&(v.gsView.orthographicType=h.orthographicType),h.shadePlotSetting&&(v.gsView.shadePlotSetting=h.shadePlotSetting),h.shadePlotObjectId&&(v.gsView.shadePlotObjectId=h.shadePlotObjectId),h.visualStyleObjectId&&(v.gsView.visualStyleObjectId=h.visualStyleObjectId),h.isDefaultLightingOn&&(v.gsView.isDefaultLightingOn=h.isDefaultLightingOn),h.defaultLightingType&&(v.gsView.defaultLightingType=h.defaultLightingType),h.brightness&&(v.gsView.brightness=h.brightness),h.contrast&&(v.gsView.contrast=h.contrast),h.ambientColor&&(v.gsView.ambientColor=h.ambientColor),t.tables.viewportTable.add(v)})}processLayers(e,t){var l,c;const s=(c=(l=e.tables)==null?void 0:l.LAYER)==null?void 0:c.entries;s&&s.length>0&&s.forEach(h=>{const v=new Jn;v.colorIndex=h.colorIndex;const b=new Va({name:h.name,standardFlags:h.standardFlag,linetype:h.lineType,lineWeight:h.lineweight,isOff:h.colorIndex<0,color:v,isPlottable:h.isPlotting});this.processCommonTableEntryAttrs(h,b),t.tables.layerTable.add(b)})}processLineTypes(e,t){var l,c;const s=(c=(l=e.tables)==null?void 0:l.LTYPE)==null?void 0:c.entries;s&&s.length>0&&s.forEach(h=>{const v=new Du(h);this.processCommonTableEntryAttrs(h,v),v.name=h.name,t.tables.linetypeTable.add(v)})}processTextStyles(e,t){var l;const s=(l=e.tables.STYLE)==null?void 0:l.entries;s&&s.length>0&&s.forEach(c=>{const h=new zu(c);this.processCommonTableEntryAttrs(c,h),t.tables.textStyleTable.add(h)})}processDimStyles(e,t){var l;const s=(l=e.tables.DIMSTYLE)==null?void 0:l.entries;s&&s.length>0&&s.forEach(c=>{const h={name:c.name,ownerId:c.ownerObjectId,dimpost:c.DIMPOST||"",dimapost:c.DIMAPOST||"",dimscale:c.DIMSCALE,dimasz:c.DIMASZ,dimexo:c.DIMEXO,dimdli:c.DIMDLI,dimexe:c.DIMEXE,dimrnd:c.DIMRND,dimdle:c.DIMDLE,dimtp:c.DIMTP,dimtm:c.DIMTM,dimtxt:c.DIMTXT,dimcen:c.DIMCEN,dimtsz:c.DIMTSZ,dimaltf:c.DIMALTF,dimlfac:c.DIMLFAC,dimtvp:c.DIMTVP,dimtfac:c.DIMTFAC,dimgap:c.DIMGAP,dimaltrnd:c.DIMALTRND,dimtol:c.DIMTOL==null||c.DIMTOL==0?0:1,dimlim:c.DIMLIM==null||c.DIMLIM==0?0:1,dimtih:c.DIMTIH==null||c.DIMTIH==0?0:1,dimtoh:c.DIMTOH==null||c.DIMTOH==0?0:1,dimse1:c.DIMSE1==null||c.DIMSE1==0?0:1,dimse2:c.DIMSE2==null||c.DIMSE2==0?0:1,dimtad:c.DIMTAD,dimzin:c.DIMZIN,dimazin:c.DIMAZIN,dimalt:c.DIMALT,dimaltd:c.DIMALTD,dimtofl:c.DIMTOFL,dimsah:c.DIMSAH,dimtix:c.DIMTIX,dimsoxd:c.DIMSOXD,dimclrd:c.DIMCLRD,dimclre:c.DIMCLRE,dimclrt:c.DIMCLRT,dimadec:c.DIMADEC||0,dimunit:c.DIMUNIT||2,dimdec:c.DIMDEC,dimtdec:c.DIMTDEC,dimaltu:c.DIMALTU,dimalttd:c.DIMALTTD,dimaunit:c.DIMAUNIT,dimfrac:c.DIMFRAC,dimlunit:c.DIMLUNIT,dimdsep:c.DIMDSEP,dimtmove:c.DIMTMOVE||0,dimjust:c.DIMJUST,dimsd1:c.DIMSD1,dimsd2:c.DIMSD2,dimtolj:c.DIMTOLJ,dimtzin:c.DIMTZIN,dimaltz:c.DIMALTZ,dimalttz:c.DIMALTTZ,dimfit:c.DIMFIT||0,dimupt:c.DIMUPT,dimatfit:c.DIMATFIT,dimtxsty:c.DIMTXSTY||"Standard",dimldrblk:c.DIMLDRBLK||"",dimblk:c.DIMBLK||"",dimblk1:c.DIMBLK1||"",dimblk2:c.DIMBLK2||"",dimlwd:c.DIMLWD,dimlwe:c.DIMLWE},v=new _i(h);this.processCommonTableEntryAttrs(c,v),t.tables.dimStyleTable.add(v)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}}var Fa=(r=>(r.DXF="dxf",r.DWG="dwg",r))(Fa||{});class on{constructor(){this.events={registered:new Tt,unregistered:new Tt},this._converters=new Map,this.register("dxf",new Au)}static createInstance(){return on._instance==null&&(on._instance=new on),this._instance}static get instance(){return on._instance||(on._instance=new on),on._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 fr extends Fn{constructor(e,t){e=e||{},Zr(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const Cr=class Cr extends fr{constructor(){super(),this._origin=new Q,this._entities=new Map}get isModelSapce(){return this.name.toLowerCase()==Cr.MODEL_SPACE_NAME.toLowerCase()}get isPaperSapce(){return this.name.toLowerCase().startsWith(Cr.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 hs(this._entities)}getIdAt(e){return this._entities.get(e)}};Cr.MODEL_SPACE_NAME="*Model_Space",Cr.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let En=Cr;class mr extends Fn{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,l)=>{s.ownerId==e&&(t=this._recordsById.get(l))}),t}newIterator(){return new hs(this._recordsByName)}}class Pu extends mr{constructor(e){super(e)}get modelSpace(){let e=this.getAt(En.MODEL_SPACE_NAME);return e||(e=new En,e.name=En.MODEL_SPACE_NAME,this.add(e)),e}}class Su extends mr{constructor(e){super(e)}}class Va extends fr{constructor(e,t){e=e||{},Zr(e,{color:new Jn,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 Iu extends mr{constructor(e){super(e);const t=new Jn;t.color=16777215;const s=new Va({name:"0",standardFlags:0,linetype:cs,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 Eu extends mr{constructor(e){super(e)}}class Tu extends mr{constructor(e){super(e)}get fonts(){const e=new Set,t=l=>{if(l){const c=l.lastIndexOf(".");if(c>=0){const h=l.substring(0,c).toLowerCase();e.add(h)}else e.add(l.toLowerCase())}},s=this.newIterator();for(const l of s)t(l.fileName),t(l.bigFontFileName);return Array.from(e)}}class Mu extends mr{constructor(e){super(e)}}class Rg extends Fn{constructor(){super(),this.events={entityAppended:new Tt,entityModified:new Tt,layerAppended:new Tt,layerModified:new Tt,layerErased:new Tt,openProgress:new Tt,headerSysVarChanged:new Tt},this._angBase=0,this._angDir=0,this._aunits=ha.DecimalDegrees,this._celtscale=1,this._cecolor=new Jn,this._insunits=da.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Pu(this),dimStyleTable:new Su(this),linetypeTable:new Eu(this),textStyleTable:new Tu(this),layerTable:new Iu(this),viewportTable:new Mu(this)},this._dictionaries={layouts:new xu(this),imageDefs:new Ba(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=Fa.DXF){const l=on.instance.get(s);if(l==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await l.read(e,this,t&&t.minimumChunkSize||10,async(c,h,v,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:c,stage:h,stageStatus:v}),t&&t.fontLoader&&h=="FONT"&&v=="END"){const p=b||this.tables.textStyleTable.fonts;await t.fontLoader.load(p)}})}async openUri(e,t){const l=await(await fetch(e)).blob(),c=new FileReader;c.onload=h=>{var b;const v=(b=h.target)==null?void 0:b.result;v&&this.read(v,t)},c.readAsText(l)}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 ku=(r=>(r[r.Center=0]="Center",r[r.Left=1]="Left",r[r.Right=2]="Right",r[r.OverFirst=3]="OverFirst",r[r.OverSecond=4]="OverSecond",r))(ku||{}),Cu=(r=>(r[r.Center=0]="Center",r[r.Above=1]="Above",r[r.Outside=2]="Outside",r[r.JIS=3]="JIS",r[r.Below=4]="Below",r))(Cu||{}),Lu=(r=>(r[r.Feet=0]="Feet",r[r.None=1]="None",r[r.Inch=2]="Inch",r[r.FeetAndInch=3]="FeetAndInch",r[r.Leading=4]="Leading",r[r.Trailing=8]="Trailing",r[r.LeadingAndTrailing=12]="LeadingAndTrailing",r))(Lu||{}),Nu=(r=>(r[r.None=0]="None",r[r.Leading=1]="Leading",r[r.Trailing=2]="Trailing",r[r.LeadingAndTrailing=3]="LeadingAndTrailing",r))(Nu||{}),Ou=(r=>(r[r.Bottom=0]="Bottom",r[r.Middle=1]="Middle",r[r.Top=2]="Top",r))(Ou||{});const Ss=class Ss extends fr{constructor(e,t){e=e||{},Zr(e,Ss.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)}};Ss.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 _i=Ss;class Du extends fr{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 zu extends fr{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 Bg={center:new Te,viewDirectionFromTarget:new Q(0,0,1),viewTarget:new Q(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:La.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new Q(0,0,0),ucsXAxis:new Q(1,0,0),ucsYAxis:new Q(0,1,0),orthographicType:Na.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Oa.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class Ru extends fr{constructor(){super(),this._circleSides=100,this._center=new Te,this._lowerLeftCorner=new Te(0,0),this._upperRightCorner=new Te(1,1),this._snapBase=new Te(0,0),this._snapAngle=0,this._snapSpacing=new Te(0,0),this._standardFlag=0,this._gridSpacing=new Te,this._gridMajor=10,this._gsView=Bg}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 Bu{constructor(){this.events={layoutSwitched:new Tt}}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),l=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(l,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),l=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(l,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),l=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(l,s)}renameLayout(e,t,s){const c=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return c?(c.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),l=new Ra;l.layoutName=e,l.tabOrder=s.dictionaries.layouts.maxTabOrder;const c=new En;return c.name=`*Paper_Space${l.tabOrder}`,s.tables.blockTable.add(c),s.dictionaries.layouts.setAt(e,l),{layout:l,btr:c}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||ja().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function ja(){return Ps.instance}const Is=class Is{constructor(){this._workingDatabase=null,this._layoutManager=new Bu}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}};Is.instance=new Is;let Ps=Is;L.AcCmColor=Jn,L.AcCmErrors=Gt,L.AcCmEventDispatcher=W1,L.AcCmEventManager=Tt,L.AcCmLoader=em,L.AcCmLoadingManager=tl,L.AcCmObject=Qo,L.AcCmPerformanceCollector=Xs,L.AcCmTask=Jo,L.AcCmTaskScheduler=el,L.AcDb3PointAngularDimension=gu,L.AcDbAlignedDimension=pu,L.AcDbAngleUnits=ha,L.AcDbArc=Hc,L.AcDbArcDimension=Dg,L.AcDbBatchProcessing=rl,L.AcDbBlockReference=ka,L.AcDbBlockTable=Pu,L.AcDbBlockTableRecord=En,L.AcDbCircle=$c,L.AcDbCurve=Kt,L.AcDbDatabase=Rg,L.AcDbDatabaseConverter=ac,L.AcDbDatabaseConverterManager=on,L.AcDbDiametricDimension=_u,L.AcDbDictionary=Ba,L.AcDbDimArrowType=ic,L.AcDbDimStyleTable=Su,L.AcDbDimStyleTableRecord=_i,L.AcDbDimTextHorizontal=ku,L.AcDbDimTextVertical=Cu,L.AcDbDimVerticalJustification=Ou,L.AcDbDimZeroSuppression=Lu,L.AcDbDimZeroSuppressionAngular=Nu,L.AcDbDimension=dr,L.AcDbDxfConverter=Au,L.AcDbEllipse=Gc,L.AcDbEntity=an,L.AcDbFileType=Fa,L.AcDbHatch=Kc,L.AcDbHatchPatternType=Wc,L.AcDbHatchStyle=qc,L.AcDbHostApplicationServices=Ps,L.AcDbLayerTable=Iu,L.AcDbLayerTableRecord=Va,L.AcDbLayout=Ra,L.AcDbLayoutDictionary=xu,L.AcDbLayoutManager=Bu,L.AcDbLeader=Xc,L.AcDbLeaderAnnotationType=Yc,L.AcDbLine=Zc,L.AcDbLineSpacingStyle=mu,L.AcDbLinetypeTable=Eu,L.AcDbLinetypeTableRecord=Du,L.AcDbMText=Qc,L.AcDbObject=Fn,L.AcDbObjectIterator=hs,L.AcDbOrdinateDimension=vu,L.AcDbOsnapMode=ar,L.AcDbPoint=au,L.AcDbPolyline=su,L.AcDbRadialDimension=yu,L.AcDbRasterImage=za,L.AcDbRasterImageClipBoundaryType=ou,L.AcDbRasterImageDef=wu,L.AcDbRasterImageImageDisplayOpt=lu,L.AcDbRay=uu,L.AcDbRenderingCache=Dn,L.AcDbSpline=Da,L.AcDbSymbolTable=mr,L.AcDbSymbolTableRecord=fr,L.AcDbTable=Jc,L.AcDbText=ru,L.AcDbTextHorizontalMode=tu,L.AcDbTextStyleTable=Tu,L.AcDbTextStyleTableRecord=zu,L.AcDbTextVerticalMode=nu,L.AcDbTrace=iu,L.AcDbUnitsValue=da,L.AcDbViewport=hu,L.AcDbViewportTable=Mu,L.AcDbViewportTableRecord=Ru,L.AcDbWipeout=du,L.AcDbXline=fu,L.AcGeArea2d=ms,L.AcGeBox2d=gt,L.AcGeBox3d=Fe,L.AcGeCircArc2d=Tr,L.AcGeCircArc3d=ur,L.AcGeCurve2d=Er,L.AcGeEllipseArc2d=_s,L.AcGeEllipseArc3d=vs,L.AcGeEuler=zc,L.AcGeGeometryUtil=Mc,L.AcGeLine2d=ys,L.AcGeLine3d=Bn,L.AcGeLoop2d=Vc,L.AcGeMathUtil=Oe,L.AcGeMatrix2d=ds,L.AcGeMatrix3d=lr,L.AcGePlane=gi,L.AcGePoint2d=Te,L.AcGePoint3d=Q,L.AcGePolyline2d=pi,L.AcGeQuaternion=zn,L.AcGeShape2d=Ea,L.AcGeSpline3d=Mr,L.AcGeTol=Ec,L.AcGeVector2d=Ze,L.AcGeVector3d=Z,L.AcGiArrowType=Ca,L.AcGiDefaultLightingType=Oa,L.AcGiMTextAttachmentPoint=kr,L.AcGiMTextFlowDirection=xs,L.AcGiOrthographicType=Na,L.AcGiRenderMode=La,L.AcGiViewport=ws,L.AcTrStringUtil=J1,L.ByBlock=rc,L.ByLayer=us,L.DEBUG_MODE=Z1,L.DEFAULT_LINE_TYPE=cs,L.DEFAULT_TOL=wa,L.DEG2RAD=fa,L.DefaultLoadingManager=nl,L.FLOAT_TOL=or,L.ORIGIN_POINT_2D=Sg,L.ORIGIN_POINT_3D=xa,L.RAD2DEG=ma,L.TAU=ut,L.acdbHostApplicationServices=ja,L.ceilPowerOfTwo=wc,L.clamp=Sn,L.damp=hc,L.degToRad=yc,L.euclideanModulo=ga,L.floorPowerOfTwo=Ac,L.generateUUID=lc,L.intPartLength=_a,L.inverseLerp=uc,L.isBetween=Pc,L.isBetweenAngle=Sc,L.isImperialUnits=Pg,L.isMetricUnits=Ag,L.isPointInPolygon=Aa,L.isPolygonIntersect=Tc,L.isPowerOfTwo=xc,L.lerp=pa,L.log=Jr,L.mapLinear=cc,L.normalizeAngle=mi,L.pingpong=dc,L.radToDeg=bc,L.randFloat=pc,L.randFloatSpread=_c,L.randInt=gc,L.relativeEps=Ic,L.seededRandom=vc,L.setLogLevel=Q1,L.smootherstep=mc,L.smoothstep=fc,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(u,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("@mlightcad/common"),require("lodash-es"),require("@mlightcad/geometry-engine"),require("@mlightcad/graphic-interface")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common","lodash-es","@mlightcad/geometry-engine","@mlightcad/graphic-interface"],P):(u=typeof globalThis<"u"?globalThis:u||self,P(u["data-model"]={},u.common,u.lodashEs,u.geometryEngine,u.graphicInterface))})(this,function(u,P,je,c,B){"use strict";class vt{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 i=t,a=Math.min(t+this._chunkSize,this._count);await e(i,a),t=a,t<this._count&&this.scheduleTask(s)};await s()}}var v,Se,T,D,Te,H,N,$,z,le,Ee,Le,he,ue,De,ve,ke,G,Z,x,pe,Oe,g,M,Ce,F,J,Ne,Q,W,Me,me,V,ee,at,ot,te,Fe,Re,re,Be,ct,dt,ge,k,se,O,j,lt,ht,ut,pt,mt,gt;(v={})[v.None=0]="None",v[v.Anonymous=1]="Anonymous",v[v.NonConstant=2]="NonConstant",v[v.Xref=4]="Xref",v[v.XrefOverlay=8]="XrefOverlay",v[v.ExternallyDependent=16]="ExternallyDependent",v[v.ResolvedOrDependent=32]="ResolvedOrDependent",v[v.ReferencedXref=64]="ReferencedXref",(Se={})[Se.BYBLOCK=0]="BYBLOCK",Se[Se.BYLAYER=256]="BYLAYER",(T={})[T.Rotated=0]="Rotated",T[T.Aligned=1]="Aligned",T[T.Angular=2]="Angular",T[T.Diameter=3]="Diameter",T[T.Radius=4]="Radius",T[T.Angular3Point=5]="Angular3Point",T[T.Ordinate=6]="Ordinate",T[T.ReferenceIsExclusive=32]="ReferenceIsExclusive",T[T.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",T[T.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(D={})[D.TopLeft=1]="TopLeft",D[D.TopCenter=2]="TopCenter",D[D.TopRight=3]="TopRight",D[D.MiddleLeft=4]="MiddleLeft",D[D.MiddleCenter=5]="MiddleCenter",D[D.MiddleRight=6]="MiddleRight",D[D.BottomLeft=7]="BottomLeft",D[D.BottomCenter=8]="BottomCenter",D[D.BottomRight=9]="BottomRight",(Te={})[Te.AtLeast=1]="AtLeast",Te[Te.Exact=2]="Exact";var kt=((H={})[H.Center=0]="Center",H[H.Above=1]="Above",H[H.Outside=2]="Outside",H[H.JIS=3]="JIS",H[H.Below=4]="Below",H),Ie=((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),Os=(($={})[$.None=0]="None",$[$.Leading=1]="Leading",$[$.Trailing=2]="Trailing",$[$.LeadingAndTrailing=3]="LeadingAndTrailing",$),Cs=((z={})[z.Center=0]="Center",z[z.Left=1]="Left",z[z.Right=2]="Right",z[z.OverFirst=3]="OverFirst",z[z.OverSecond=4]="OverSecond",z),Ns=((le={})[le.Bottom=0]="Bottom",le[le.Center=1]="Center",le[le.Top=2]="Top",le);(Ee={})[Ee.PatternFill=0]="PatternFill",Ee[Ee.SolidFill=1]="SolidFill",(Le={})[Le.NonAssociative=0]="NonAssociative",Le[Le.Associative=1]="Associative",(he={})[he.Normal=0]="Normal",he[he.Outer=1]="Outer",he[he.Ignore=2]="Ignore",(ue={})[ue.UserDefined=0]="UserDefined",ue[ue.Predefined=1]="Predefined",ue[ue.Custom=2]="Custom",(De={})[De.NotAnnotated=0]="NotAnnotated",De[De.Annotated=1]="Annotated",(ve={})[ve.Solid=0]="Solid",ve[ve.Gradient=1]="Gradient",(ke={})[ke.TwoColor=0]="TwoColor",ke[ke.OneColor=1]="OneColor";var Ms=((G={})[G.Default=0]="Default",G[G.External=1]="External",G[G.Polyline=2]="Polyline",G[G.Derived=4]="Derived",G[G.Textbox=8]="Textbox",G[G.Outermost=16]="Outermost",G),He=((Z={})[Z.Line=1]="Line",Z[Z.Circular=2]="Circular",Z[Z.Elliptic=3]="Elliptic",Z[Z.Spline=4]="Spline",Z),Fs=((x={})[x.Off=0]="Off",x[x.Solid=1]="Solid",x[x.Dashed=2]="Dashed",x[x.Dotted=3]="Dotted",x[x.ShotDash=4]="ShotDash",x[x.MediumDash=5]="MediumDash",x[x.LongDash=6]="LongDash",x[x.DoubleShortDash=7]="DoubleShortDash",x[x.DoubleMediumDash=8]="DoubleMediumDash",x[x.DoubleLongDash=9]="DoubleLongDash",x[x.DoubleMediumLongDash=10]="DoubleMediumLongDash",x[x.SparseDot=11]="SparseDot",x);Fs.Off,(pe={})[pe.Standard=-3]="Standard",pe[pe.ByLayer=-2]="ByLayer",pe[pe.ByBlock=-1]="ByBlock",(Oe={})[Oe.English=0]="English",Oe[Oe.Metric=1]="Metric",(g={})[g.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",g[g.FRONT_CLIPPING=2]="FRONT_CLIPPING",g[g.BACK_CLIPPING=4]="BACK_CLIPPING",g[g.UCS_FOLLOW=8]="UCS_FOLLOW",g[g.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",g[g.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",g[g.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",g[g.FAST_ZOOM=128]="FAST_ZOOM",g[g.SNAP_MODE=256]="SNAP_MODE",g[g.GRID_MODE=512]="GRID_MODE",g[g.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",g[g.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",g[g.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",g[g.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",g[g.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",g[g.UNUSED=32768]="UNUSED",g[g.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",g[g.VIEWPORT_OFF=131072]="VIEWPORT_OFF",g[g.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",g[g.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",g[g.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",g[g.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(M={})[M.OPTIMIZED_2D=0]="OPTIMIZED_2D",M[M.WIREFRAME=1]="WIREFRAME",M[M.HIDDEN_LINE=2]="HIDDEN_LINE",M[M.FLAT_SHADED=3]="FLAT_SHADED",M[M.GOURAUD_SHADED=4]="GOURAUD_SHADED",M[M.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",M[M.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(Ce={})[Ce.UCS_UNCHANGED=0]="UCS_UNCHANGED",Ce[Ce.HAS_OWN_UCS=1]="HAS_OWN_UCS",(F={})[F.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",F[F.TOP=1]="TOP",F[F.BOTTOM=2]="BOTTOM",F[F.FRONT=3]="FRONT",F[F.BACK=4]="BACK",F[F.LEFT=5]="LEFT",F[F.RIGHT=6]="RIGHT",(J={})[J.AS_DISPLAYED=0]="AS_DISPLAYED",J[J.WIREFRAME=1]="WIREFRAME",J[J.HIDDEN=2]="HIDDEN",J[J.RENDERED=3]="RENDERED",(Ne={})[Ne.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ne[Ne.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function A(r,e,t){return r.code===e&&(t==null||r.value===t)}function w(r){let e={};r.rewind();let t=r.next(),s=t.code;if(e.x=t.value,(t=r.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=r.next()).code!==s+20?r.rewind():e.z=t.value,e}let ft=Symbol();function b(r,e){return(t,s,i)=>{let a=r.reduce((h,l)=>{l.pushContext&&h.push({});let m=h[h.length-1];for(let _ of typeof l.code=="number"?[l.code]:l.code){let f=m[_]??(m[_]=[]);l.isMultiple&&f.length&&console.warn(`Snippet ${f.at(-1).name} for code(${_}) is shadowed by ${l.name}`),f.push(l)}return h},[{}]),o=!1,d=a.length-1;for(;!A(t,0,"EOF");){let h=function(y,L,C){return y.find((K,de)=>{var q;return de>=C&&((q=K[L])==null?void 0:q.length)})}(a,t.code,d),l=h==null?void 0:h[t.code].at(-1);if(!h||!l){s.rewind();break}l.isMultiple||h[t.code].pop();let{name:m,parser:_,isMultiple:f}=l,I=_==null?void 0:_(t,s,i);if(I===ft){s.rewind();break}if(m){let[y,L]=function(C,K){let de=K.split("."),q=C;for(let xe=0;xe<de.length-1;++xe){let Ve=de[xe];Object.hasOwn(q,Ve)||(q[Ve]={}),q=q[Ve]}return[q,de.at(-1)]}(i,m);f?(Object.hasOwn(y,L)||(y[L]=[]),y[L].push(I)):y[L]=I}l.pushContext&&(d-=1),o=!0,t=s.next()}return e&&Object.setPrototypeOf(i,e),o}}function n({value:r}){return r}function p(r,e){return w(e)}function S({value:r}){return!!r}var Ot=[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 Ct(r,e){var i;if(!A(r,1001))throw Error("XData must starts with code 1001");let t={appName:r.value,value:[]};r=e.next();let s=[t.value];for(;!A(r,0,"EOF")&&r.code>=1e3;){let a=s.at(-1);switch(r.code){case 1002:r.value==="{"?s.push([]):(s.pop(),(i=s.at(-1))==null||i.push(a));break;case 1e3:case 1004:case 1040:case 1070:case 1071:a.push({type:ne(r.code),value:r.value});break;case 1003:a.push({name:"layer",type:ne(r.code),value:r.value});break;case 1005:a.push({name:"handle",type:ne(r.code),value:r.value});break;case 1010:a.push({type:ne(r.code),value:w(e)});break;case 1011:a.push({name:"worldSpacePosition",type:ne(r.code),value:w(e)});break;case 1012:a.push({name:"worldSpaceDisplacement",type:ne(r.code),value:w(e)});break;case 1013:a.push({name:"worldSpaceDirection",type:ne(r.code),value:w(e)});break;case 1041:a.push({name:"distance",type:ne(r.code),value:r.value});break;case 1042:a.push({name:"scale",type:ne(r.code),value:r.value})}r=e.next()}return e.rewind(),t}function ne(r){switch(r){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 _t(r,e,t){if(A(e,102))return ze(e,t),!0;switch(e.code){case 0:r.type=e.value;break;case 5:r.handle=e.value;break;case 330:r.ownerDictionarySoftId?r.ownerBlockRecordSoftId=e.value:r.ownerDictionarySoftId=e.value;break;case 360:r.ownerdictionaryHardId=e.value;break;case 67:r.isInPaperSpace=!!e.value;break;case 8:r.layer=e.value;break;case 6:r.lineType=e.value;break;case 347:r.materialObjectHardId=e.value;break;case 62:r.colorIndex=e.value,r.color=Ot[Math.abs(e.value)];break;case 370:r.lineweight=e.value;break;case 48:r.lineTypeScale=e.value;break;case 60:r.isVisible=!!e.value;break;case 92:r.proxyByte=e.value;break;case 310:r.proxyEntity=e.value;break;case 100:break;case 420:r.color=e.value;break;case 430:r.transparency=e.value;break;case 390:r.plotStyleHardId=e.value;break;case 284:r.shadowMode=e.value;break;case 1001:r.xdata=Ct(e,t);break;default:return!1}return!0}let Rs=0;function Nt(r){if(!r)throw TypeError("entity cannot be undefined or null");r.handle||(r.handle=Rs++)}(Q={})[Q.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Q[Q.CAST=1]="CAST",Q[Q.RECEIVE=2]="RECEIVE",Q[Q.IGNORE=3]="IGNORE";let E=[{code:1001,name:"xdata",parser:Ct},{code:284,name:"shadowMode",parser:n},{code:390,name:"plotStyleHardId",parser:n},{code:440,name:"transparency",parser:n},{code:430,name:"colorName",parser:n},{code:420,name:"color",parser:n},{code:310,name:"proxyEntity",isMultiple:!0,parser:n},{code:92,name:"proxyByte",parser:n},{code:60,name:"isVisible",parser:S},{code:48,name:"lineTypeScale",parser:n},{code:370,name:"lineweight",parser:n},{code:62,name:"colorIndex",parser(r,e,t){let s=r.value;return t.color=Ot[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:n},{code:6,name:"lineType",parser:n},{code:8,name:"layer",parser:n},{code:410,name:"layoutTabName",parser:n},{code:67,name:"isInPaperSpace",parser:S},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:n},{code:102,parser:ze},{code:102,parser:ze},{code:102,parser:ze},{code:5,name:"handle",parser:n}];function ze(r,e){for(r=e.next();!A(r,102)&&!A(r,0,"EOF");)r=e.next()}function Mt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Bs={extrusionDirection:{x:0,y:0,z:1}},Gs=[{code:210,name:"extrusionDirection",parser:p},{code:51,name:"endAngle",parser:n},{code:50,name:"startAngle",parser:n},{code:100,name:"subclassMarker",parser:n},{code:40,name:"radius",parser:n},{code:10,name:"center",parser:p},{code:39,name:"thickness",parser:n},{code:100},...E];class Ft{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Mt(this,"parser",b(Gs,Bs))}}Mt(Ft,"ForEntityName","ARC"),(W={})[W.NONE=0]="NONE",W[W.INVISIBLE=1]="INVISIBLE",W[W.CONSTANT=2]="CONSTANT",W[W.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",W[W.PRESET=8]="PRESET",(Me={})[Me.MULTILINE=2]="MULTILINE",Me[Me.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(me={})[me.NONE=0]="NONE",me[me.MIRRORED_X=2]="MIRRORED_X",me[me.MIRRORED_Y=4]="MIRRORED_Y";var Vs=((V={})[V.LEFT=0]="LEFT",V[V.CENTER=1]="CENTER",V[V.RIGHT=2]="RIGHT",V[V.ALIGNED=3]="ALIGNED",V[V.MIDDLE=4]="MIDDLE",V[V.FIT=5]="FIT",V),js=((ee={})[ee.BASELINE=0]="BASELINE",ee[ee.BOTTOM=1]="BOTTOM",ee[ee.MIDDLE=2]="MIDDLE",ee[ee.TOP=3]="TOP",ee);function Rt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Bt={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Vs.LEFT,valign:js.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Gt=[{code:73,name:"valign",parser:n},{code:100},{code:210,name:"extrusionDirection",parser:p},{code:11,name:"endPoint",parser:p},{code:72,name:"valign",parser:n},{code:72,name:"halign",parser:n},{code:71,name:"generationFlag",parser:n},{code:7,name:"styleName",parser:n},{code:51,name:"obliqueAngle",parser:n},{code:41,name:"xScale",parser:n},{code:50,name:"rotation",parser:n},{code:1,name:"text",parser:n},{code:40,name:"textHeight",parser:n},{code:10,name:"startPoint",parser:p},{code:39,name:"thickness",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class Vt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Rt(this,"parser",b(Gt,Bt))}}function jt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Rt(Vt,"ForEntityName","TEXT");let Hs={...Bt},zs=[{code:2},{code:40,name:"annotationScale",parser:n},{code:10,name:"alignmentPoint",parser:p},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:n},{code:70,name:"numberOfSecondaryAttributes",parser:n},{code:70,name:"isReallyLocked",parser:S},{code:70,name:"mtextFlag",parser:n},{code:280,name:"isDuplicatedRecord",parser:S},{code:100},{code:280,name:"isLocked",parser:S},{code:74,name:"valign",parser:n},{code:73},{code:70,name:"attributeFlag",parser:n},{code:2,name:"tag",parser:n},{code:3,name:"prompt",parser:n},{code:280},{code:100,name:"subclassMarker",parser:n},...Gt.slice(2)];class Ht{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){jt(this,"parser",b(zs,Hs))}}function zt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}jt(Ht,"ForEntityName","ATTDEF");let Ws={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ys=[{code:210,name:"extrusionDirection",parser:p},{code:40,name:"radius",parser:n},{code:10,name:"center",parser:p},{code:39,name:"thickness",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class Wt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){zt(this,"parser",b(Ys,Ws))}}zt(Wt,"ForEntityName","CIRCLE");class We{parseEntity(e,t){let s={};for(;!A(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(i,a,o){switch(a.code){case 100:i.subclassMarker=a.value;break;case 280:i.version=a.value;break;case 2:i.name=a.value;break;case 10:i.definitionPoint=w(o);break;case 11:i.textPoint=w(o);break;case 12:i.insertionPoint=w(o);break;case 13:i.subDefinitionPoint1=w(o);break;case 14:i.subDefinitionPoint2=w(o);break;case 15:i.centerPoint=w(o);break;case 16:i.arcPoint=w(o);break;case 70:i.dimensionType=a.value;break;case 71:i.attachmentPoint=a.value;break;case 72:i.textLineSpacingStyle=a.value;break;case 40:i.leaderLength=a.value;break;case 41:i.textLineSpacingFactor=a.value;break;case 42:i.measurement=a.value;break;case 1:i.text=a.value;break;case 50:i.rotationAngle=a.value;break;case 52:i.obliqueAngle=a.value;break;case 53:i.textRotation=a.value;break;case 51:i.ocsRotation=a.value;break;case 210:i.extrusionDirection=w(o);break;case 3:i.styleName=a.value;break;default:_t(i,a,o)}})(s,t,e),t=e.next()}return s}}function Yt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ot="DIMENSION",(at="ForEntityName")in We?Object.defineProperty(We,at,{value:ot,enumerable:!0,configurable:!0,writable:!0}):We[at]=ot;let Us={extrusionDirection:{x:0,y:0,z:1}},Xs=[{code:42,name:"endAngle",parser:n},{code:41,name:"startAngle",parser:n},{code:40,name:"axisRatio",parser:n},{code:210,name:"extrusionDirection",parser:p},{code:11,name:"majorAxisEndPoint",parser:p},{code:10,name:"center",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class Ut{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Yt(this,"parser",b(Xs,Us))}}Yt(Ut,"ForEntityName","ELLIPSE");let Xt=[{code:330,name:"sourceBoundaryObjects",parser:n,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:n}],Ks=[{code:11,name:"end",parser:p},{code:10,name:"start",parser:p}],qs=[{code:73,name:"isCCW",parser:S},{code:51,name:"endAngle",parser:n},{code:50,name:"startAngle",parser:n},{code:40,name:"radius",parser:n},{code:10,name:"center",parser:p}],$s=[{code:73,name:"isCCW",parser:S},{code:51,name:"endAngle",parser:n},{code:50,name:"startAngle",parser:n},{code:40,name:"lengthOfMinorAxis",parser:n},{code:11,name:"end",parser:p},{code:10,name:"center",parser:p}],Zs=[{code:13,name:"endTangent",parser:p},{code:12,name:"startTangent",parser:p},{code:11,name:"fitDatum",isMultiple:!0,parser:p},{code:97,name:"numberOfFitData",parser:n},{code:10,name:"controlPoints",isMultiple:!0,parser(r,e){let t={...w(e),weight:1};return(r=e.next()).code===42?t.weight=r.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:n},{code:96,name:"numberOfControlPoints",parser:n},{code:95,name:"numberOfKnots",parser:n},{code:74,name:"isPeriodic",parser:S},{code:73,name:"splineFlag",parser:n},{code:94,name:"degree",parser:n}],Js={[He.Line]:Ks,[He.Circular]:qs,[He.Elliptic]:$s,[He.Spline]:Zs},Qs=[...Xt,{code:72,name:"edges",parser(r,e){let t={type:r.value},s=b(Js[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(r=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:n}],en=[...Xt,{code:10,name:"vertices",parser(r,e){let t={...w(e),bulge:0};return(r=e.next()).code===42?t.bulge=r.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:n},{code:73,name:"isClosed",parser:S},{code:72,name:"hasBulge",parser:S}],tn=[{code:49,name:"dashLengths",parser:n,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:n},{code:45,name:"offset",parser:Kt},{code:43,name:"base",parser:Kt},{code:53,name:"angle",parser:n}];function Kt(r,e){let t=r.code+1,s={x:r.value,y:1};return(r=e.next()).code===t?s.y=r.value:e.rewind(),s}function qt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let rn={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},sn=[{code:470},{code:463},{code:462,name:"colorTint",parser:n},{code:461,name:"gradientDefinition",parser:n},{code:460,name:"gradientRotation",parser:n},{code:453,name:"numberOfColors",parser:n},{code:452,name:"gradientColorFlag",parser:n},{code:451},{code:450,name:"gradientFlag",parser:n},{code:10,name:"seedPoints",parser:p,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:p},{code:98,name:"numberOfSeedPoints",parser:n},{code:47,name:"pixelSize",parser:n},{code:53,name:"definitionLines",parser:function(r,e){let t={};return b(tn)(r,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:n},{code:77,name:"isDouble",parser:S},{code:73,name:"isAnnotated",parser:S},{code:41,name:"patternScale",parser:n},{code:52,name:"patternAngle",parser:n},{code:76,name:"patternType",parser:n},{code:75,name:"hatchStyle",parser:n},{code:92,name:"boundaryPaths",parser:function(r,e){let t={boundaryPathTypeFlag:r.value},s=t.boundaryPathTypeFlag&Ms.Polyline;return r=e.next(),s?b(en)(r,e,t):b(Qs)(r,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:n},{code:71,name:"associativity",parser:n},{code:63,name:"patternFillColor",parser:n},{code:70,name:"solidFill",parser:n},{code:2,name:"patternName",parser:n},{code:210,name:"extrusionDirection",parser:p},{code:10,name:"elevationPoint",parser:p},{code:100,name:"subclassMarker",parser:n,pushContext:!0},...E];class $t{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){qt(this,"parser",b(sn,rn))}}qt($t,"ForEntityName","HATCH"),(te={})[te.ShowImage=1]="ShowImage",te[te.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",te[te.UseClippingBoundary=4]="UseClippingBoundary",te[te.TransparencyIsOn=8]="TransparencyIsOn",(Fe={})[Fe.Rectangular=1]="Rectangular",Fe[Fe.Polygonal=2]="Polygonal",(Re={})[Re.Outside=0]="Outside",Re[Re.Inside=1]="Inside";function Zt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let nn={clippingBoundaryPath:[]},an=[{code:90,name:"version",parser:n},{code:10,name:"position",parser:p},{code:11,name:"uPixel",parser:p},{code:12,name:"vPixel",parser:p},{code:13,name:"imageSize",parser:p},{code:340,name:"imageDefHandle",parser:n},{code:70,name:"flags",parser:n},{code:280,name:"clipping",parser:n},{code:281,name:"brightness",parser:n},{code:282,name:"contrast",parser:n},{code:283,name:"fade",parser:n},{code:360,name:"imageDefReactorHandle",parser:n},{code:71,name:"clippingBoundaryType",parser:n},{code:91,name:"countBoundaryPoints",parser:n},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:p},{code:290,name:"clipMode",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class bt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Zt(this,"parser",b(an,nn))}}function Jt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Zt(bt,"ForEntityName","IMAGE");let on={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},cn=[{code:210,name:"extrusionDirection",parser:p},{code:45,name:"rowSpacing",parser:n},{code:44,name:"columnSpacing",parser:n},{code:71,name:"rowCount",parser:n},{code:70,name:"columnCount",parser:n},{code:50,name:"rotation",parser:n},{code:43,name:"zScale",parser:n},{code:42,name:"yScale",parser:n},{code:41,name:"xScale",parser:n},{code:10,name:"insertionPoint",parser:p},{code:2,name:"name",parser:n},{code:66,name:"isVariableAttributes",parser:S},{code:100,name:"subclassMarker",parser:n},...E];class Qt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Jt(this,"parser",b(cn,on))}}function er(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Jt(Qt,"ForEntityName","INSERT");let dn={isArrowheadEnabled:!0},ln=[{code:213,name:"offsetFromAnnotation",parser:p},{code:212,name:"offsetFromBlock",parser:p},{code:211,name:"horizontalDirection",parser:p},{code:210,name:"normal",parser:p},{code:340,name:"associatedAnnotation",parser:n},{code:77,name:"byBlockColor",parser:n},{code:10,name:"vertices",parser:p,isMultiple:!0},{code:76,name:"numberOfVertices",parser:n},{code:41,name:"textWidth",parser:n},{code:40,name:"textHeight",parser:n},{code:75,name:"isHooklineExists",parser:S},{code:74,name:"isHooklineSameDirection",parser:S},{code:73,name:"leaderCreationFlag",parser:n},{code:72,name:"isSpline",parser:S},{code:71,name:"isArrowheadEnabled",parser:S},{code:3,name:"styleName",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class tr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){er(this,"parser",b(ln,dn))}}er(tr,"ForEntityName","LEADER"),(re={})[re.TextAnnotation=0]="TextAnnotation",re[re.ToleranceAnnotation=1]="ToleranceAnnotation",re[re.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",re[re.NoAnnotation=3]="NoAnnotation";function rr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let hn={thickness:0,extrusionDirection:{x:0,y:0,z:1}},un=[{code:210,name:"extrusionDirection",parser:p},{code:11,name:"endPoint",parser:p},{code:10,name:"startPoint",parser:p},{code:39,name:"thickness",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class sr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){rr(this,"parser",b(un,hn))}}rr(sr,"ForEntityName","LINE"),(Be={})[Be.IS_CLOSED=1]="IS_CLOSED",Be[Be.PLINE_GEN=128]="PLINE_GEN";let pn={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},mn={bulge:0},gn=[{code:42,name:"bulge",parser:n},{code:41,name:"endWidth",parser:n},{code:40,name:"startWidth",parser:n},{code:91,name:"id",parser:n},{code:20,name:"y",parser:n},{code:10,name:"x",parser:n}],fn=[{code:210,name:"extrusionDirection",parser:p},{code:10,name:"vertices",isMultiple:!0,parser(r,e){let t={};return b(gn,mn)(r,e,t),t}},{code:39,name:"thickness",parser:n},{code:38,name:"elevation",parser:n},{code:43,name:"constantWidth",parser:n},{code:70,name:"flag",parser:n},{code:90,name:"numberOfVertices",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class Ye{parseEntity(e,t){let s={};return b(fn,pn)(t,e,s),s}}dt="LWPOLYLINE",(ct="ForEntityName")in Ye?Object.defineProperty(Ye,ct,{value:dt,enumerable:!0,configurable:!0,writable:!0}):Ye[ct]=dt,(ge={})[ge.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",ge[ge.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",ge[ge.BY_STYLE=5]="BY_STYLE";function _n(r,e){let t={};for(let s of r){let i=e(s);i!=null&&(t[i]??(t[i]=[]),t[i].push(s))}return t}function*Ue(r,e=1/0,t=1){for(let s=r;s!==e;s+=t)yield s}function ae(r){return{x:r.x??0,y:r.y??0,z:r.z??0}}function nr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let bn={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Xe=[{code:46,name:"annotationHeight",parser:n},{code:101,parser(r,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:n},{code:49,name:"columnGutter",parser:n},{code:48,name:"columnWidth",parser:n},{code:79,name:"columnAutoHeight",parser:n},{code:78,name:"columnFlowReversed",parser:n},{code:76,name:"columnCount",parser:n},{code:75,name:"columnType",parser:n},{code:441,name:"backgroundFillTransparency",parser:n},{code:63,name:"backgroundFillColor",parser:n},{code:45,name:"fillBoxScale",parser:n},{code:[...Ue(430,440)],name:"backgroundColor",parser:n},{code:[...Ue(420,430)],name:"backgroundColor",parser:n},{code:90,name:"backgroundFill",parser:n},{code:44,name:"lineSpacing",parser:n},{code:73,name:"lineSpacingStyle",parser:n},{code:50,name:"rotation",parser:n},{code:43},{code:42},{code:11,name:"direction",parser:p},{code:210,name:"extrusionDirection",parser:p},{code:7,name:"styleName",parser:n},{code:3,name:"text",isMultiple:!0,parser:n},{code:1,name:"text",isMultiple:!0,parser:n},{code:72,name:"drawingDirection",parser:n},{code:71,name:"attachmentPoint",parser:n},{code:41,name:"width",parser:n},{code:40,name:"height",parser:n},{code:10,name:"insertionPoint",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class ir{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){nr(this,"parser",b(Xe,bn))}}function ar(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}nr(ir,"ForEntityName","MTEXT");let An={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},yn=[{code:50,name:"angle",parser:n},{code:210,name:"extrusionDirection",parser:p},{code:39,name:"thickness",parser:n},{code:10,name:"position",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class or{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ar(this,"parser",b(yn,An))}}ar(or,"ForEntityName","POINT"),(k={})[k.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",k[k.CURVE_FIT=2]="CURVE_FIT",k[k.SPLINE_FIT=4]="SPLINE_FIT",k[k.POLYLINE_3D=8]="POLYLINE_3D",k[k.POLYGON_3D=16]="POLYGON_3D",k[k.CLOSED_POLYGON=32]="CLOSED_POLYGON",k[k.POLYFACE=64]="POLYFACE",k[k.CONTINUOUS=128]="CONTINUOUS",(se={})[se.NONE=0]="NONE",se[se.QUADRATIC=5]="QUADRATIC",se[se.CUBIC=6]="CUBIC",se[se.BEZIER=8]="BEZIER",(O={})[O.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",O[O.TANGENT_DEFINED=2]="TANGENT_DEFINED",O[O.NOT_USED=4]="NOT_USED",O[O.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",O[O.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",O[O.FOR_POLYLINE=32]="FOR_POLYLINE",O[O.FOR_POLYGON=64]="FOR_POLYGON",O[O.POLYFACE=128]="POLYFACE";function cr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let In={startWidth:0,endWidth:0,bulge:0},wn=[{code:91,name:"id",parser:n},{code:[...Ue(71,75)],name:"faces",isMultiple:!0,parser:n},{code:50,name:"tangentDirection",parser:n},{code:70,name:"flag",parser:n},{code:42,name:"bulge",parser:n},{code:41,name:"endWidth",parser:n},{code:40,name:"startWidth",parser:n},{code:30,name:"z",parser:n},{code:20,name:"y",parser:n},{code:10,name:"x",parser:n},{code:100,name:"subclassMarker",parser:n},{code:100},...E];class dr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){cr(this,"parser",b(wn,In))}}function lr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}cr(dr,"ForEntityName","VERTEX");let Pn={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:[]},xn=[{code:0,name:"vertices",isMultiple:!0,parser:(r,e)=>A(r,0,"VERTEX")?(r=e.next(),new dr().parseEntity(e,r)):ft},{code:210,name:"extrusionDirection",parser:p},{code:75,name:"smoothType",parser:n},{code:74,name:"surfaceNDensity",parser:n},{code:73,name:"surfaceMDensity",parser:n},{code:72,name:"meshNVertexCount",parser:n},{code:71,name:"meshMVertexCount",parser:n},{code:41,name:"endWidth",parser:n},{code:40,name:"startWidth",parser:n},{code:70,name:"flag",parser:n},{code:39,name:"thickness",parser:n},{code:30,name:"elevation",parser:n},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:n},...E];class hr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){lr(this,"parser",b(xn,Pn))}}function ur(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}lr(hr,"ForEntityName","POLYLINE");let Sn={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Tn=[{code:10,name:"firstPoint",parser:p},{code:11,name:"unitDirection",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class pr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ur(this,"parser",b(Tn,Sn))}}function mr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ur(pr,"ForEntityName","RAY");let En={vertices:[],backLineVertices:[]},Ln=[{code:360,name:"geometrySettingHardId",parser:n},{code:12,name:"backLineVertices",isMultiple:!0,parser:p},{code:93,name:"numberOfBackLineVertices",parser:n},{code:11,name:"vertices",isMultiple:!0,parser:p},{code:92,name:"verticesCount",parser:n},{code:[63,411],name:"indicatorColor",parser:n},{code:70,name:"indicatorTransparency",parser:n},{code:41,name:"bottomHeight",parser:n},{code:40,name:"topHeight",parser:n},{code:10,name:"verticalDirection",parser:p},{code:1,name:"name",parser:n},{code:91,name:"flag",parser:n},{code:90,name:"state",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class gr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){mr(this,"parser",b(Ln,En))}}function fr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}mr(gr,"ForEntityName","SECTION");let Dn={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},vn=[{code:210,name:"extrusionDirection",parser:p},{code:39,name:"thickness",parser:n},{code:[...Ue(10,14)],name:"points",isMultiple:!0,parser:p},{code:100,name:"subclassMarker",parser:n},...E];class _r{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){fr(this,"parser",b(vn,Dn))}}fr(_r,"ForEntityName","SOLID"),(j={})[j.NONE=0]="NONE",j[j.CLOSED=1]="CLOSED",j[j.PERIODIC=2]="PERIODIC",j[j.RATIONAL=4]="RATIONAL",j[j.PLANAR=8]="PLANAR",j[j.LINEAR=16]="LINEAR";function br(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let kn={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},On=[{code:11,name:"fitPoints",isMultiple:!0,parser:p},{code:10,name:"controlPoints",isMultiple:!0,parser:p},{code:41,name:"weights",isMultiple:!0,parser:n},{code:40,name:"knots",isMultiple:!0,parser:n},{code:13,name:"endTangent",parser:p},{code:12,name:"startTangent",parser:p},{code:44,name:"fitTolerance",parser:n},{code:43,name:"controlTolerance",parser:n},{code:42,name:"knotTolerance",parser:n},{code:74,name:"numberOfFitPoints",parser:n},{code:73,name:"numberOfControlPoints",parser:n},{code:72,name:"numberOfKnots",parser:n},{code:71,name:"degree",parser:n},{code:70,name:"flag",parser:n},{code:210,name:"normal",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class Ar{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){br(this,"parser",b(On,kn))}}br(Ar,"ForEntityName","SPLINE");class Ke{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=ae(w(e)),t=e.lastReadGroup;break;case 11:s.directionVector=ae(w(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(i,a){let o=!1,d=!1,h={};for(;!i.isEOF()&&a.code!==0&&!d;)switch(a.code){case 171:if(o){d=!0;continue}h.cellType=a.value,o=!0,a=i.next();break;case 172:h.flagValue=a.value,a=i.next();break;case 173:h.mergedValue=a.value,a=i.next();break;case 174:h.autoFit=a.value,a=i.next();break;case 175:h.borderWidth=a.value,a=i.next();break;case 176:h.borderHeight=a.value,a=i.next();break;case 91:h.overrideFlag=a.value,a=i.next();break;case 178:h.virtualEdgeFlag=a.value,a=i.next();break;case 145:h.rotation=a.value,a=i.next();break;case 345:h.fieldObjetId=a.value,a=i.next();break;case 340:h.blockTableRecordId=a.value,a=i.next();break;case 146:h.blockScale=a.value,a=i.next();break;case 177:h.blockAttrNum=a.value,a=i.next();break;case 7:h.textStyle=a.value,a=i.next();break;case 140:h.textHeight=a.value,a=i.next();break;case 170:h.attachmentPoint=a.value,a=i.next();break;case 92:h.extendedCellFlags=a.value,a=i.next();break;case 285:h.rightBorderVisibility=!!(a.value??!0),a=i.next();break;case 286:h.bottomBorderVisibility=!!(a.value??!0),a=i.next();break;case 288:h.leftBorderVisibility=!!(a.value??!0),a=i.next();break;case 289:h.topBorderVisibility=!!(a.value??!0),a=i.next();break;case 301:(function(l,m,_){for(;_.code!==304;)switch(_.code){case 301:case 93:case 90:case 94:_=m.next();break;case 1:l.text=_.value,_=m.next();break;case 300:l.attrText=_.value,_=m.next();break;case 302:l.text=_.value?_.value:l.text,_=m.next();break;default:console.log(`Ignore code: ${_.code}, value: ${_.value}`),_=m.next()}})(h,i,a),a=i.next();break;default:return h}return o=!1,d=!1,h}(e,t)),t=e.lastReadGroup;break;default:_t(s,t,e),t=e.next()}}return s}}ht="ACAD_TABLE",(lt="ForEntityName")in Ke?Object.defineProperty(Ke,lt,{value:ht,enumerable:!0,configurable:!0,writable:!0}):Ke[lt]=ht;class qe{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(i,a,o){if(o==="EOF")return!1;switch(o.code){case 0:default:return!1;case 100:i.subclassMarker=o.value;break;case 10:i.viewportCenter=ae(w(a));break;case 40:i.width=o.value;break;case 41:i.height=o.value;break;case 68:i.status=o.value;break;case 69:i.viewportId=o.value;break;case 12:i.displayCenter=w(a);break;case 13:i.snapBase=w(a);break;case 14:i.snapSpacing=w(a);break;case 15:i.gridSpacing=w(a);break;case 16:i.viewDirection=ae(w(a));break;case 17:i.targetPoint=ae(w(a));break;case 42:i.perspectiveLensLength=o.value;break;case 43:i.frontClipZ=o.value;break;case 44:i.backClipZ=o.value;break;case 45:i.viewHeight=o.value;break;case 50:i.snapAngle=o.value;break;case 51:i.viewTwistAngle=o.value;break;case 72:i.circleZoomPercent=o.value;break;case 331:i.frozenLayerIds??(i.frozenLayerIds=[]),i.frozenLayerIds.push(o.value);break;case 90:i.statusBitFlags=o.value;break;case 330:i.ownerBlockRecordSoftId=o.value;break;case 340:i.clippingBoundaryId=o.value;break;case 1:i.sheetName=o.value;break;case 281:i.renderMode=o.value;break;case 71:i.ucsPerViewport=o.value;break;case 110:i.ucsOrigin=ae(w(a));break;case 111:i.ucsXAxis=ae(w(a));break;case 112:i.ucsYAxis=ae(w(a));break;case 345:i.ucsId=o.value;break;case 346:i.ucsBaseId=o.value;break;case 79:i.orthographicType=o.value;break;case 146:i.elevation=o.value;break;case 170:i.shadePlotMode=o.value;break;case 61:i.majorGridFrequency=o.value;break;case 332:i.backgroundId=o.value;break;case 333:i.shadePlotId=o.value;break;case 348:i.visualStyleId=o.value;break;case 292:i.isDefaultLighting=!!o.value;break;case 282:i.defaultLightingType=o.value;break;case 141:i.brightness=o.value;break;case 142:i.contrast=o.value;break;case 63:case 421:case 431:i.ambientLightColor=o.value;break;case 361:i.sunId=o.value;break;case 335:case 343:case 344:case 91:i.softPointer=o.value}return!0}(s,e,t)&&_t(s,t,e),t=e.next()}return s}}pt="VIEWPORT",(ut="ForEntityName")in qe?Object.defineProperty(qe,ut,{value:pt,enumerable:!0,configurable:!0,writable:!0}):qe[ut]=pt;class $e extends bt{parseEntity(e,t){return super.parseEntity(e,t)}}function yr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}gt="WIPEOUT",(mt="ForEntityName")in $e?Object.defineProperty($e,mt,{value:gt,enumerable:!0,configurable:!0,writable:!0}):$e[mt]=gt;let Cn={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Nn=[{code:10,name:"firstPoint",parser:p},{code:11,name:"unitDirection",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class Ir{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){yr(this,"parser",b(Nn,Cn))}}function wr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}yr(Ir,"ForEntityName","XLINE");let Mn={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},Fn=[...Xe.slice(Xe.findIndex(({name:r})=>r==="columnType"),Xe.findIndex(({name:r})=>r==="subclassMarker")+1),{code:100},{code:0,parser(r){if(!A(r,0,"MTEXT"))return ft}},{code:2,name:"definitionTag",parser:n},{code:40,name:"annotationScale",parser:n},{code:10,name:"alignmentPoint",parser:p},{code:340,name:"secondaryAttributesHardId",parser:n},{code:70,name:"numberOfSecondaryAttributes",parser:n},{code:70,name:"isReallyLocked",parser:S},{code:70,name:"mtextFlag",parser:n},{code:280,name:"isDuplicatedEntriesKeep",parser:S},{code:100},{code:280,name:"lockPositionFlag",parser:S},{code:210,name:"extrusionDirection",parser:p},{code:11,name:"alignmentPoint",parser:p},{code:74,name:"verticalJustification",parser:n},{code:72,name:"horizontalJustification",parser:n},{code:71,name:"textGenerationFlag",parser:n},{code:7,name:"textStyle",parser:n},{code:51,name:"obliqueAngle",parser:n},{code:41,name:"scale",parser:n},{code:50,name:"rotation",parser:n},{code:73},{code:70,name:"attributeFlag",parser:n},{code:2,name:"tag",parser:n},{code:280},{code:100,name:"subclassMarker",parser:n},{code:1,name:"text",parser:n},{code:40,name:"textHeight",parser:n},{code:10,name:"startPoint",parser:p},{code:39,name:"thickness",parser:n},{code:100},...E];class Pr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){wr(this,"parser",b(Fn,Mn))}}wr(Pr,"ForEntityName","ATTRIB");let Rn=Object.fromEntries([Ft,Ht,Pr,Wt,We,Ut,bt,Qt,tr,sr,Ye,ir,or,hr,pr,gr,_r,Ar,Ke,Vt,$t,qe,$e,Ir].map(r=>[r.ForEntityName,new r]));function xr(r,e){let t=[];for(;!A(r,0,"EOF");){if(r.code===0){if(r.value==="ENDBLK"||r.value==="ENDSEC"){e.rewind();break}let s=Rn[r.value];if(s){let i=r.value;r=e.next();let a=s.parseEntity(e,r);a.type=i,Nt(a),t.push(a)}else console.warn(`Unsupported ENTITY type: ${r.value}`)}r=e.next()}return t}function Bn(r,e){let t={};for(;!A(r,0,"EOF")&&!A(r,0,"ENDSEC");){if(A(r,0,"BLOCK")){let s=Gn(r=e.next(),e);Nt(s),s.name&&(t[s.name]=s)}r=e.next()}return t}function Gn(r,e){let t={};for(;!A(r,0,"EOF");){if(A(r,0,"ENDBLK")){for(r=e.next();!A(r,0,"EOF");){if(A(r,100,"AcDbBlockEnd"))return t;r=e.next()}break}switch(r.code){case 1:t.xrefPath=r.value;break;case 2:t.name=r.value;break;case 3:t.name2=r.value;break;case 5:t.handle=r.value;break;case 8:t.layer=r.value;break;case 10:t.position=w(e);break;case 67:t.paperSpace=!!r.value&&r.value==1;break;case 70:r.value!==0&&(t.type=r.value);break;case 100:break;case 330:t.ownerHandle=r.value;break;case 0:t.entities=xr(r,e)}r=e.next()}return t}function Vn(r,e){let t=null,s={};for(;!A(r,0,"EOF")&&!A(r,0,"ENDSEC");)r.code===9?t=r.value:r.code===10?s[t]=w(e):s[t]=r.value,r=e.next();return s}let jn=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:n},{code:90,name:"version",parser:n},{code:1,name:"fileName",parser:n},{code:10,name:"size",parser:p},{code:11,name:"sizeOfOnePixel",parser:p},{code:280,name:"isLoaded",parser:n},{code:281,name:"resolutionUnits",parser:n},{code:100,name:"subclassMarker",parser:n}],Sr=[{code:333,name:"shadePlotId",parser:n},{code:149,name:"imageOriginY",parser:n},{code:148,name:"imageOriginX",parser:n},{code:147,name:"scaleFactor",parser:n},{code:78,name:"shadePlotCustomDPI",parser:n},{code:77,name:"shadePlotResolution",parser:n},{code:76,name:"shadePlotMode",parser:n},{code:75,name:"standardScaleType",parser:n},{code:7,name:"currentStyleSheet",parser:n},{code:74,name:"plotType",parser:n},{code:73,name:"plotRotation",parser:n},{code:72,name:"paperUnit",parser:n},{code:70,name:"layoutFlag",parser:n},{code:143,name:"printScaleDenominator",parser:n},{code:142,name:"printScaleNominator",parser:n},{code:141,name:"windowAreaYMax",parser:n},{code:140,name:"windowAreaYMin",parser:n},{code:49,name:"windowAreaXMax",parser:n},{code:48,name:"windowAreaXMin",parser:n},{code:47,name:"plotOriginY",parser:n},{code:46,name:"plotOriginX",parser:n},{code:45,name:"paperHeight",parser:n},{code:44,name:"paperWidth",parser:n},{code:43,name:"marginTop",parser:n},{code:42,name:"marginRight",parser:n},{code:41,name:"marginBottom",parser:n},{code:40,name:"marginLeft",parser:n},{code:6,name:"plotViewName",parser:n},{code:4,name:"paperSize",parser:n},{code:2,name:"configName",parser:n},{code:1,name:"pageSetupName",parser:n},{code:100,name:"subclassMarker",parser:n}],Hn=[{code:333,name:"shadePlotId",parser:n},{code:346,name:"orthographicUcsId",parser:n},{code:345,name:"namedUcsId",parser:n},{code:331,name:"viewportId",parser:n},{code:330,name:"paperSpaceTableId",parser:n},{code:76,name:"orthographicType",parser:n},{code:17,name:"ucsYAxis",parser:p},{code:16,name:"ucsXAxis",parser:p},{code:13,name:"ucsOrigin",parser:p},{code:146,name:"elevation",parser:n},{code:15,name:"maxExtent",parser:p},{code:14,name:"minExtent",parser:p},{code:12,name:"insertionBase",parser:p},{code:11,name:"maxLimit",parser:p},{code:10,name:"minLimit",parser:p},{code:71,name:"tabOrder",parser:n},{code:70,name:"controlFlag",parser:n},{code:1,name:"layoutName",parser:n},{code:100,name:"subclassMarker",parser:n},...Sr],zn=[{code:330,name:"ownerObjectId",parser:n},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:n},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:n},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:n}];function Tr(r){return r.subclassMarker==="AcDbDictionary"}let Wn={LAYOUT:Hn,PLOTSETTINGS:Sr,DICTIONARY:[{code:3,name:"entries",parser:(r,e)=>{let t={name:r.value};return(r=e.next()).code===350?t.objectId=r.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:n},{code:280,name:"isHardOwned",parser:S},{code:100,name:"subclassMarker",parser:n}],IMAGEDEF:jn};function Yn(r,e){let t=[];for(;r.code!==0||!["EOF","ENDSEC"].includes(r.value);){let s=r.value,i=Wn[s];if(r.code===0&&(i!=null&&i.length)){let a=b([...zn,...i]),o={name:s};a(r=e.next(),e,o)?(t.push(o),r=e.peek()):r=e.next()}else r=e.next()}return{byName:_n(t,({name:s})=>s),byTree:function(s){let i=Object.fromEntries(s.map(a=>[a.handle,a]));for(let a of s)(!Tr(a)||a.ownerDictionaryIdSoft!=="0")&&(a.ownerDictionaryIdSoft&&(a.ownerDictionarySoft=i[a.ownerDictionaryIdSoft]),a.ownerDictionaryIdHard&&(a.ownerDictionaryHard=i[a.ownerDictionaryIdHard]),a.ownerObjectId&&(a.ownerObject=i[a.ownerObjectId])),function(o,d){Tr(o)&&o.entries&&(o.entries=Object.fromEntries(o.entries.map(({name:h,objectId:l})=>[h,d[l]])))}(a,i);return s[0]}(t)}}let we=[{code:100,name:"subclassMarker",parser:n},{code:330,name:"ownerObjectId",parser:n},{code:102,parser(r,e){for(;!A(r,0,"EOF")&&!A(r,102,"}");)r=e.next()}},{code:5,name:"handle",parser:n}],Un=b([{code:310,name:"bmpPreview",parser:n},{code:281,name:"scalability",parser:n},{code:280,name:"explodability",parser:n},{code:70,name:"insertionUnits",parser:n},{code:340,name:"layoutObjects",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),Xn=b([...[{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:kt.Above,defaultValueImperial:kt.Center},{name:"DIMZIN",code:78,defaultValue:Ie.Trailing,defaultValueImperial:Ie.Feet},{name:"DIMAZIN",code:79,defaultValue:Os.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:Cs.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Ns.Center},{name:"DIMTZIN",code:284,defaultValue:Ie.Trailing,defaultValueImperial:Ie.Feet},{name:"DIMALTZ",code:285,defaultValue:Ie.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Ie.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(r=>({...r,parser:n})),{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},{code:105,name:"handle",parser:n},...we.filter(r=>r.code!==5)]),Kn=b([{code:347,name:"materialObjectId",parser:n},{code:390,name:"plotStyleNameObjectId",parser:n},{code:370,name:"lineweight",parser:n},{code:290,name:"isPlotting",parser:S},{code:6,name:"lineType",parser:n},{code:62,name:"colorIndex",parser:n},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),qn=b([{code:9,name:"text",parser:n},{code:45,name:"offsetY",parser:n},{code:44,name:"offsetX",parser:n},{code:50,name:"rotation",parser:n},{code:46,name:"scale",parser:n},{code:340,name:"styleObjectId",parser:n},{code:75,name:"shapeNumber",parser:n},{code:74,name:"elementTypeFlag",parser:n},{code:49,name:"elementLength",parser:n}],{elementTypeFlag:0,elementLength:0}),$n={BLOCK_RECORD:Un,DIMSTYLE:Xn,LAYER:Kn,LTYPE:b([{code:49,name:"pattern",parser(r,e){let t={};return qn(r,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:n},{code:73,name:"numberOfLineTypes",parser:n},{code:72,parser:n},{code:3,name:"description",parser:n},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),STYLE:b([{code:1e3,name:"extendedFont",parser:n},{code:1001},{code:4,name:"bigFont",parser:n},{code:3,name:"font",parser:n},{code:42,name:"lastHeight",parser:n},{code:71,name:"textGenerationFlag",parser:n},{code:50,name:"obliqueAngle",parser:n},{code:41,name:"widthFactor",parser:n},{code:40,name:"fixedTextHeight",parser:n},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),VPORT:b([{code:[63,421,431],name:"ambientColor",parser:n},{code:142,name:"contrast",parser:n},{code:141,name:"brightness",parser:n},{code:282,name:"defaultLightingType",parser:n},{code:292,name:"isDefaultLightingOn",parser:S},{code:348,name:"visualStyleObjectId",parser:n},{code:333,name:"shadePlotObjectId",parser:n},{code:332,name:"backgroundObjectId",parser:n},{code:61,name:"majorGridLines",parser:n},{code:170,name:"shadePlotSetting",parser:n},{code:146,name:"elevation",parser:n},{code:79,name:"orthographicType",parser:n},{code:112,name:"ucsYAxis",parser:p},{code:111,name:"ucsXAxis",parser:p},{code:110,name:"ucsOrigin",parser:p},{code:74,name:"ucsIconSetting",parser:n},{code:71,name:"viewMode",parser:n},{code:281,name:"renderMode",parser:n},{code:1,name:"styleSheet",parser:n},{code:[331,441],name:"frozenLayers",parser:n,isMultiple:!0},{code:72,name:"circleSides",parser:n},{code:51,name:"viewTwistAngle",parser:n},{code:50,name:"snapRotationAngle",parser:n},{code:45,name:"viewHeight",parser:n},{code:44,name:"backClippingPlane",parser:n},{code:43,name:"frontClippingPlane",parser:n},{code:42,name:"lensLength",parser:n},{code:17,name:"viewTarget",parser:p},{code:16,name:"viewDirectionFromTarget",parser:p},{code:15,name:"gridSpacing",parser:p},{code:14,name:"snapSpacing",parser:p},{code:13,name:"snapBasePoint",parser:p},{code:12,name:"center",parser:p},{code:11,name:"upperRightCorner",parser:p},{code:10,name:"lowerLeftCorner",parser:p},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we])},Zn=b([{code:70,name:"maxNumberOfEntries",parser:n},{code:100,name:"subclassMarker",parser:n},{code:330,name:"ownerObjectId",parser:n},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:n},{code:2,name:"name",parser:n}]);function Jn(r,e){var s;let t={};for(;!A(r,0,"EOF")&&!A(r,0,"ENDSEC");){if(A(r,0,"TABLE")){r=e.next();let i={entries:[]};Zn(r,e,i),t[i.name]=i}if(A(r,0)&&!A(r,0,"ENDTAB")){let i=r.value;r=e.next();let a=$n[i];if(!a){console.warn(`parseTable: Invalid table name '${i}'`),r=e.next();continue}let o={};a(r,e,o),(s=t[i])==null||s.entries.push(o)}r=e.next()}return t}function Ze(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class Er{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=Lr(e,this._data[this._pointer++]),s={code:e,value:t};return A(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=Lr(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){Ze(this,"_pointer",void 0),Ze(this,"_data",void 0),Ze(this,"_eof",void 0),Ze(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=e,this._eof=!1}}function Lr(r,e){return r<=9?e:r>=10&&r<=59?parseFloat(e.trim()):r>=60&&r<=99?parseInt(e.trim()):r>=100&&r<=109?e:r>=110&&r<=149?parseFloat(e.trim()):r>=160&&r<=179?parseInt(e.trim()):r>=210&&r<=239?parseFloat(e.trim()):r>=270&&r<=289?parseInt(e.trim()):r>=290&&r<=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()):r>=300&&r<=369?e:r>=370&&r<=389?parseInt(e.trim()):r>=390&&r<=399?e:r>=400&&r<=409?parseInt(e.trim()):r>=410&&r<=419?e:r>=420&&r<=429?parseInt(e.trim()):r>=430&&r<=439?e:r>=440&&r<=459?parseInt(e.trim()):r>=460&&r<=469?parseFloat(e.trim()):r>=470&&r<=481||r===999||r>=1e3&&r<=1009?e:r>=1010&&r<=1059?parseFloat(e.trim()):r>=1060&&r<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:r,value:e}),e)}function At(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class Qn{constructor(){At(this,"encoding","utf-8"),At(this,"encodingFailureFatal",!1)}}class ei extends EventTarget{parseSync(e){let t=new Er(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((i,a)=>{e.on("data",o=>{t+=o}),e.on("end",()=>{try{let o=t.split(/\r\n|\r|\n/g),d=new Er(o);if(!d.hasNext())throw Error("Empty file");i(s.parseAll(d))}catch(o){a(o)}}),e.on("error",o=>{a(o)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let i=s.body.getReader(),a="";for(;;){let{done:o,value:d}=await i.read();if(o){a+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}a+=this._decoder.decode(d,{stream:!0})}return this.parseSync(a)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!A(s,0,"EOF");)A(s,0,"SECTION")&&(A(s=e.next(),2,"HEADER")?(s=e.next(),t.header=Vn(s,e)):A(s,2,"BLOCKS")?(s=e.next(),t.blocks=Bn(s,e)):A(s,2,"ENTITIES")?(s=e.next(),t.entities=xr(s,e)):A(s,2,"TABLES")?(s=e.next(),t.tables=Jn(s,e)):A(s,2,"OBJECTS")&&(s=e.next(),t.objects=Yn(s,e))),s=e.next();return t}constructor(e=new Qn){super(),At(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var yt=(r=>(r[r.DecimalDegrees=0]="DecimalDegrees",r[r.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",r[r.Gradians=2]="Gradians",r[r.Radians=3]="Radians",r[r.SurveyorsUnits=4]="SurveyorsUnits",r))(yt||{});class oe{static get instance(){return this._instance||(this._instance=new oe),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,i=!0,a,o){const d=[];if(t!=null){const h=this.createKey(t.name,s);let l;if(this.has(h))l=this.get(h);else{const m=t.newIterator();for(const _ of m)if(_.color.isByBlock&&s){Dr.copy(_.color),_.color.color=s;const f=_.draw(e);f&&d.push(f),_.color.copy(Dr)}else{const f=_.draw(e);f&&d.push(f)}l=e.group(d),l&&i&&this.set(h,l)}return l&&a&&(l.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),l.applyMatrix(a))),l}else return e.group(d)}}const Dr=new P.AcCmColor,Je="Continuous",Qe="ByLayer",vr="ByBlock";var fe=(r=>(r[r.EndPoint=1]="EndPoint",r[r.MidPoint=2]="MidPoint",r[r.Center=3]="Center",r[r.Node=4]="Node",r[r.Quadrant=5]="Quadrant",r[r.Insertion=7]="Insertion",r[r.Perpendicular=8]="Perpendicular",r[r.Tangent=9]="Tangent",r[r.Nearest=10]="Nearest",r[r.Centroid=11]="Centroid",r))(fe||{}),It=(r=>(r[r.Undefined=0]="Undefined",r[r.Inches=1]="Inches",r[r.Feet=2]="Feet",r[r.Miles=3]="Miles",r[r.Millimeters=4]="Millimeters",r[r.Centimeters=5]="Centimeters",r[r.Meters=6]="Meters",r[r.Kilometers=7]="Kilometers",r[r.Microinches=8]="Microinches",r[r.Mils=9]="Mils",r[r.Yards=10]="Yards",r[r.Angstroms=11]="Angstroms",r[r.Nanometers=12]="Nanometers",r[r.Microns=13]="Microns",r[r.Decimeters=14]="Decimeters",r[r.Dekameters=15]="Dekameters",r[r.Hectometers=16]="Hectometers",r[r.Gigameters=17]="Gigameters",r[r.Astronomical=18]="Astronomical",r[r.LightYears=19]="LightYears",r[r.Parsecs=20]="Parsecs",r[r.USSurveyFeet=21]="USSurveyFeet",r[r.USSurveyInch=22]="USSurveyInch",r[r.USSurveyYard=23]="USSurveyYard",r[r.USSurveyMile=24]="USSurveyMile",r[r.Max=24]="Max",r))(It||{});function ti(r){return r==4||r==5||r==6||r==7||r==12||r==13||r==14||r==15||r==16||r==17}function ri(r){return r==1||r==2||r==3||r==8||r==9||r==10||r==21}var kr=(r=>(r.ClosedFilled="",r.Dot="_DOT",r.DotSmall="_DOTSMALL",r.DotBlank="_DOTBLANK",r.Origin="_ORIGIN",r.Origin2="_ORIGIN2",r.Open="_OPEN",r.Open90="_OPEN90",r.Open30="_OPEN30",r.Closed="_CLOSED",r.Small="_SMALL",r.None="_NONE",r.Oblique="_OBLIQUE",r.BoxFilled="_BOXFILLED",r.Box="_BOXBLANK",r.ClosedBlank="_CLOSEDBLANK",r.DatumBlank="_DATUMBLANK",r.DatumFilled="_DATUMFILLED",r.Integral="_INTEGRAL",r.ArchTick="_ARCHTICK",r))(kr||{});class et{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 Or="Load Database";class R extends P.AcCmTask{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=P.AcCmPerformanceCollector.getInstance().getEntry(Or),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const i=await this.data.task(e);if(this.progress){const a=i.data;await this.progress(this.data.progress.value,this.data.stage,"END",a),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),i}}class Cr{async read(e,t,s,i){const a={name:Or,data:{total:0},format(){let l="";return Object.keys(this.data).forEach(m=>{m!=="total"&&(l+=`- ${m}: ${this.data[m]} ms
|
|
2
|
+
`)}),l+=`- total: ${this.data.total} ms`,l}};P.AcCmPerformanceCollector.getInstance().collect(a),this.progress=i;const o={value:0},d=new P.AcCmTaskScheduler;d.setCompleteCallback(()=>this.onFinished()),d.setErrorCallback(()=>this.onFinished()),d.addTask(new R({stage:"START",step:1,progress:o,task:async l=>l},i)),d.addTask(new R({stage:"PARSE",step:5,progress:o,task:async l=>({model:await this.parse(l)})},i)),d.addTask(new R({stage:"FONT",step:5,progress:o,task:async l=>{const m=this.getFonts(l.model);return{model:l.model,data:m}}},i)),d.addTask(new R({stage:"LTYPE",step:1,progress:o,task:async l=>(this.processLineTypes(l.model,t),l)},i)),d.addTask(new R({stage:"STYLE",step:1,progress:o,task:async l=>(this.processTextStyles(l.model,t),l)},i)),d.addTask(new R({stage:"DIMSTYLE",step:1,progress:o,task:async l=>(this.processDimStyles(l.model,t),l)},i)),d.addTask(new R({stage:"LAYER",step:1,progress:o,task:async l=>(this.processLayers(l.model,t),l)},i)),d.addTask(new R({stage:"VPORT",step:1,progress:o,task:async l=>(this.processViewports(l.model,t),l)},i)),d.addTask(new R({stage:"HEADER",step:1,progress:o,task:async l=>(this.processHeader(l.model,t),l)},i)),d.addTask(new R({stage:"BLOCK_RECORD",step:5,progress:o,task:async l=>(this.processBlockTables(l.model,t),l)},i)),d.addTask(new R({stage:"OBJECT",step:5,progress:o,task:async l=>(this.processObjects(l.model,t),l)},i)),d.addTask(new R({stage:"BLOCK",step:5,progress:o,task:async l=>(await this.processBlocks(l.model,t),l)},i)),d.addTask(new R({stage:"ENTITY",step:100,progress:o,task:async l=>(await this.processEntities(l.model,t,s,o,i),l)},i)),d.addTask(new R({stage:"END",step:0,progress:o,task:async l=>l},i));const h=Date.now();await d.run(e),a.data.total=Date.now()-h}onFinished(){this.progress&&(this.progress(100,"END","END"),oe.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,i,a){throw new Error("Not impelemented yet!")}}for(var _e=256,Nr=[],Mr=256,tt;_e--;)Nr[_e]=(_e+256).toString(16).substring(1);function si(r){var e=0,t=11;if(!tt||_e+t>Mr*2)for(tt="",_e=0;e<Mr;e++)tt+=Nr[Math.random()*256|0];return tt.substring(_e,_e+++t)}class ce{constructor(e,t){e=e||{},je.defaults(e,{objectId:si()}),this._attrs=new P.AcCmObject(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:Dt().workingDatabase}set database(e){this._database=e}close(){}}class U extends ce{constructor(){super(...arguments),this._layer="0",this._color=new P.AcCmColor,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(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||Qe}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,i,a){}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==Qe){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==vr?Je:this.lineType;return Je}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 wt extends U{constructor(e){super(),this._blockName=e,this._position=new c.AcGePoint3d,this._rotation=0,this._normal=new c.AcGeVector3d(0,0,1),this._scaleFactors=new c.AcGePoint3d(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 c.AcGeBox3d,t=this.blockTableRecord;if(t!=null){const a=t.newIterator();for(const o of a)e.union(o.geometricExtents)}const s=new c.AcGeQuaternion().setFromEuler(new c.AcGeEuler(this.rotation,0,0)),i=new c.AcGeMatrix3d;return i.compose(this.position,s,this.scaleFactors),e.applyMatrix4(i),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const i=this.computeTransformMatrix();return oe.instance.draw(e,s,this.rgbColor,!0,i,this.normal)}else return e.group(t)}computeTransformMatrix(){const e=new c.AcGeQuaternion;return e.setFromAxisAngle(c.AcGeVector3d.Z_AXIS,this.rotation),new c.AcGeMatrix3d().compose(this._position,e,this._scaleFactors)}}class Y extends U{}class Fr extends Y{constructor(e,t,s,i,a,o,d){super(),this._geo=new c.AcGeEllipseArc3d(e,t,s,i,a,o,d)}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 Rr extends Y{constructor(e,t,s,i){super(),this._geo=new c.AcGeCircArc3d(e,t,s,i,c.AcGeVector3d.Z_AXIS,c.AcGeVector3d.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 Br extends Y{constructor(e,t,s=c.AcGeVector3d.Z_AXIS){super(),this._geo=new c.AcGeCircArc3d(e,t,0,c.TAU,s,c.AcGeVector3d.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 Gr=(r=>(r[r.UserDefined=0]="UserDefined",r[r.Predefined=1]="Predefined",r[r.Custom=2]="Custom",r))(Gr||{}),Vr=(r=>(r[r.Normal=0]="Normal",r[r.Outer=1]="Outer",r[r.Ignore=2]="Ignore",r))(Vr||{});class jr extends U{constructor(){super(),this._elevation=0,this._geo=new c.AcGeArea2d,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 c.AcGeBox3d({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 Hr=(r=>(r[r.MText=0]="MText",r[r.Fcf=1]="Fcf",r[r.BlockReference=2]="BlockReference",r[r.NoAnnotation=3]="NoAnnotation",r))(Hr||{});class zr extends Y{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 c.AcGePoint3d().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 c.AcGeBox3d().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 c.AcGeSpline3d(this._vertices,"Uniform"),this._updated=!1)}}class Wr extends Y{constructor(e,t){super(),this._geo=new c.AcGeLine3d(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,i,a){const o=this.startPoint,d=this.endPoint;switch(e){case fe.EndPoint:a.push(o),a.push(d);break;case fe.MidPoint:a.push(this.midPoint);break;case fe.Nearest:{const h=this._geo.project(s);a.push(h)}break;case fe.Perpendicular:{const h=this._geo.perpPoint(s);a.push(h)}break;case fe.Tangent:a.push(o);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,i=[new c.AcGePoint3d(t.x,t.y,0),new c.AcGePoint3d(s.x,s.y,0)];return e.lines(i,this.lineStyle)}}class Yr extends U{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 c.AcGePoint3d,this._attachmentPoint=B.AcGiMTextAttachmentPoint.TopLeft,this._direction=new c.AcGeVector3d(1,0,0),this._drawingDirection=B.AcGiMTextFlowDirection.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 c.AcGeBox3d}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 Pt extends Y{constructor(e,t,s){super();const i=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(i!=2&&i!=3)throw P.AcCmErrors.ILLEGAL_PARAMETERS;i==2&&!Array.isArray(t)?this._geo=new c.AcGeSpline3d(e,t):this._geo=new c.AcGeSpline3d(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 ni=new c.AcGeVector3d;class Ur extends wt{constructor(e,t,s){super(e),this._attachmentPoint=B.AcGiMTextAttachmentPoint.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 c.AcGeBox3d}draw(e){let t=0,s=0;const i=new Uint16Array(this.numColumns*this.numRows*8),a=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let o=0;for(let f=0;f<=this.numRows;f++){t-=f>0?this.rowHeight(f-1):0,s=0;for(let I=0;I<=this.numColumns;I++)s+=I>0?this.columnWidth(I-1):0,a[o++]=s,a[o++]=t,a[o++]=0}const d=[],h=new Array(this.numRows*this.numColumns).fill(!1);s=0,o=0;let l=0;for(let f=0;f<this.numColumns;f++){s+=f>0?this.columnWidth(f-1):0,t=0;for(let I=0;I<this.numRows;I++){t+=I>0?this.rowHeight(I-1):0;const y=this.cell(I*this.numColumns+f);if(l=I*this.numColumns+f,y&&!h[l]){const L=y.borderWidth??1,C=y.borderHeight??1;this.fillVisited(h,l,this.numColumns,L,C),i[o++]=f+I*(this.numColumns+1),i[o++]=f+I*(this.numColumns+1)+L;const K=a[i[o-1]*3]-s,de=f+(I+C)*(this.numColumns+1)+L;f+L==this.numColumns&&(i[o++]=f+I*(this.numColumns+1)+L,i[o++]=de);const q=-a[de*3+1]-t;if(I+C==this.numRows&&(i[o++]=f+(I+C)*(this.numColumns+1)+C,i[o++]=f+(I+C)*(this.numColumns+1)),i[o++]=f+(I+C)*(this.numColumns+1),i[o++]=f+I*(this.numColumns+1),y.text){const xe=y.attachmentPoint||this.attachmentPoint||B.AcGiMTextAttachmentPoint.MiddleCenter,Ve=this.getTableTextOffset(xe,K,q),di={text:y.text,height:y.textHeight,width:K,position:ni.set(s,-t,0).clone().add(Ve),rotation:this.rotation,attachmentPoint:xe},li={...this.getTextStyle(y),color:this.color.color};d.push(e.mtext(di,li))}}}}d.push(e.lineSegments(a,3,i,this.lineStyle));const m=e.group(d),_=new c.AcGeQuaternion;return _.setFromAxisAngle(c.AcGeVector3d.Z_AXIS,this.rotation),Xr.compose(this.position,_,this.scaleFactors),m.applyMatrix(Xr),m}fillVisited(e,t,s,i,a){if(a==1&&i==1)e[t]=!0;else for(let o=0;o<i;++o)for(let d=0;d<a;++d)e[t+o+d*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 i=new c.AcGeVector3d;switch(e){case 1:break;case 2:i.setX(t/2);break;case 3:i.setX(t);break;case 4:i.setY(-s/2);break;case 5:i.set(t/2,-s/2,0);break;case 6:i.set(t,-s/2,0);break;case 7:i.setY(-s);break;case 8:i.set(t/2,-s,0);break;case 9:i.set(t,-s,0);break}return i}}const Xr=new c.AcGeMatrix3d;var Kr=(r=>(r[r.LEFT=0]="LEFT",r[r.CENTER=1]="CENTER",r[r.RIGHT=2]="RIGHT",r[r.ALIGNED=3]="ALIGNED",r[r.MIDDLE=4]="MIDDLE",r[r.FIT=5]="FIT",r))(Kr||{}),qr=(r=>(r[r.BASELINE=0]="BASELINE",r[r.BOTTOM=1]="BOTTOM",r[r.MIDDLE=2]="MIDDLE",r[r.TOP=3]="TOP",r))(qr||{});class $r extends U{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new c.AcGePoint3d,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 c.AcGeBox3d}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:B.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:B.AcGiMTextAttachmentPoint.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class Zr extends Y{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new c.AcGePoint3d,new c.AcGePoint3d,new c.AcGePoint3d,new c.AcGePoint3d]}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 c.AcGeBox3d().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 c.AcGePolyline2d(this._vertices,!0),s=new c.AcGeArea2d;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}}class Jr extends Y{constructor(){super(),this._elevation=0,this._geo=new c.AcGePolyline2d}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,i=-1,a=-1){const o=i<0?void 0:i,d=a<0?void 0:a,h={x:t.x,y:t.y,bulge:s,startWidth:o,endWidth:d};this._geo.addVertexAt(e,h)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new c.AcGePoint3d(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new c.AcGeBox3d({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(i=>t.push(new c.AcGePoint3d().set(i.x,i.y,this.elevation))),e.lines(t,this.lineStyle)}}class Qr extends U{constructor(){super(),this._geo=new c.AcGePoint3d}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new c.AcGeBox3d().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 es=(r=>(r[r.Invalid=0]="Invalid",r[r.Rect=1]="Rect",r[r.Poly=2]="Poly",r))(es||{}),ts=(r=>(r[r.Show=1]="Show",r[r.ShowUnAligned=2]="ShowUnAligned",r[r.Clip=4]="Clip",r[r.Transparent=8]="Transparent",r))(ts||{});class xt extends U{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new c.AcGePoint3d,this._scale=new c.AcGeVector2d(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 c.AcGeBox3d;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,i=new c.AcGeBox2d;i.setFromPoints(this._clipBoundary);const a=new c.AcGePoint2d;a.setX(this._position.x-i.min.x*t),a.setY(this._position.y-i.min.y*s),this._clipBoundary.forEach(o=>{const d=o.x*t+a.x,h=o.y*s+a.y;e.push(new c.AcGePoint3d(d,h,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){rs.copy(e[1]);for(let t=1;t<4;t++)rt.copy(e[t]),rt.rotateAround(rs,this._rotation),e[t].setX(rt.x),e[t].setY(rt.y)}e.push(e[0])}return e}}const rs=new c.AcGePoint2d,rt=new c.AcGePoint2d;class ss extends Y{constructor(){super(),this._basePoint=new c.AcGePoint3d,this._unitDir=new c.AcGeVector3d}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 c.AcGeBox3d;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 ns extends U{constructor(){super(),this._centerPoint=new c.AcGePoint3d,this._height=0,this._width=0,this._viewCenter=new c.AcGePoint3d,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 c.AcGeBox3d}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 B.AcGiViewport;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 c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}}class is extends xt{draw(e){const t=this.boundaryPath(),s=new c.AcGeArea2d;return s.add(new c.AcGePolyline2d(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}}class as extends Y{constructor(){super(),this._basePoint=new c.AcGePoint3d,this._unitDir=new c.AcGeVector3d}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 c.AcGeBox3d;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 os=(r=>(r[r.AtLeast=1]="AtLeast",r[r.Exactly=2]="Exactly",r))(os||{});class be extends U{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new c.AcGePoint3d,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 Ge),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 oe.instance.draw(e,t,this.rgbColor,!1)}return e.group([])}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return oe.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return oe.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 i=new c.AcGePoint3d().subVectors(t,e).normalize();return new c.AcGePoint3d(t).addScaledVector(i,s)}findPointOnLine2(e,t,s){const i=e.x+s*Math.cos(t),a=e.y+s*Math.sin(t);return{x:i,y:a}}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():B.AcGiArrowType.Closed}}class cs extends be{constructor(e,t,s,i,a=null,o=null){super(),this._centerPoint=new c.AcGePoint3d().copy(e),this._xLine1Point=new c.AcGePoint3d().copy(t),this._xLine2Point=new c.AcGePoint3d().copy(s),this._arcPoint=new c.AcGePoint3d().copy(i),this.dimensionText=a,this.dimensionStyleName=o}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 c.AcGeBox3d}}class ds extends be{constructor(e,t,s,i=null,a=null){super(),this._dimLinePoint=new c.AcGePoint3d().copy(s),this._xLine1Point=new c.AcGePoint3d().copy(e),this._xLine2Point=new c.AcGePoint3d().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=i,this.dimensionStyleName=a}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 c.AcGeBox3d}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),i=this.findIntersectionPoint(t,this._dimLinePoint),a=this.findIntersectionPoint(s,this._dimLinePoint),o=new c.AcGeLine3d(i,a);return e.push(o),t.endPoint=i,this.adjustExtensionLine(t),e.push(t),s.endPoint=a,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new c.AcGeLine3d(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,i=e.endPoint,a=new c.AcGeVector3d().subVectors(i,s).normalize(),d=new c.AcGeVector3d().subVectors(t,s).dot(a),h=new c.AcGeVector3d().copy(a).multiplyScalar(d);return new c.AcGeVector3d().addVectors(s,h)}}class ii extends be{constructor(e,t,s,i,a=null,o=null){super(),this._arcPoint=new c.AcGePoint3d().copy(i),this._xLine1Point=new c.AcGePoint3d().copy(t),this._xLine2Point=new c.AcGePoint3d().copy(s),this._centerPoint=new c.AcGePoint3d().copy(e),this.dimensionText=a,this.dimensionStyleName=o}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 c.AcGeBox3d}}class ls extends be{constructor(e,t,s=0,i=null,a=null){super(),this._chordPoint=new c.AcGePoint3d().copy(e),this._farChordPoint=new c.AcGePoint3d().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=i,this.dimensionStyleName=a}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 c.AcGeBox3d}drawLines(e,t){const s=[],i=t.length;return i==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):i==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(a=>{s.push(this.drawLine(e,a))}),s}drawLine(e,t,s){if(s){const i=[t.startPoint,t.endPoint];return e.lines(i,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,i)=>s.x!==i.x?s.x-i.x:s.y!==i.y?s.y-i.y:s.z-i.z;e.sort((s,i)=>{const a=t(s.startPoint,i.startPoint);return a!==0?a:t(s.endPoint,i.endPoint)})}}class hs extends be{constructor(e,t,s=null,i=null){super(),this._definingPoint=new c.AcGePoint3d().copy(e),this._leaderEndPoint=new c.AcGePoint3d().copy(t),this.dimensionText=s,this.dimensionStyleName=i}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 c.AcGeBox3d}get arrowLineCount(){return 0}}class us extends be{constructor(e,t,s,i=null,a=null){super(),this._center=new c.AcGePoint3d().copy(e),this._chordPoint=new c.AcGePoint3d().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=i,this.dimensionStyleName=a}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 c.AcGeBox3d}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}}class ps{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 Rr(e.center,e.radius,c.AcGeMathUtil.degToRad(e.startAngle),c.AcGeMathUtil.degToRad(e.endAngle))}convertCirle(e){return new Br(e.center,e.radius)}convertEllipse(e){const t=new c.AcGeVector3d(e.majorAxisEndPoint),s=t.length();return new Fr(e.center,c.AcGeVector3d.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new Wr(new c.AcGePoint3d(t.x,t.y,t.z||0),new c.AcGePoint3d(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){const t=new Pt(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 Pt(t,"Uniform");return s.closed=!!(e.flag&1),s}}return null}convertPoint(e){const t=new Qr;return t.position=e.position,t}convertSolid(e){const t=new Zr;return e.points.forEach((s,i)=>t.setPointAt(i,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new Jr;return t.closed=!!(e.flag&1),e.vertices.forEach((s,i)=>{t.addVertexAt(i,new c.AcGePoint2d(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var i;const t=new jr;return(i=e.definitionLines)==null||i.forEach(a=>{t.definitionLines.push({angle:a.angle,origin:a.base,delta:a.offset,dashPattern:a.numberOfDashLengths>0?a.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(a=>{if(a.boundaryPathTypeFlag&2){const d=a,h=new c.AcGePolyline2d;h.closed=d.isClosed,d.vertices.forEach((l,m)=>{h.addVertexAt(m,{x:l.x,y:l.y,bulge:l.bulge})}),t.add(h)}else{const d=a,h=new c.AcGeLoop2d;d.edges.forEach(l=>{if(l.type==1){const m=l;h.add(new c.AcGeLine2d(m.start,m.end))}else if(l.type==2){const m=l;h.add(new c.AcGeCircArc2d(m.center,m.radius,c.AcGeMathUtil.degToRad(m.startAngle||0),c.AcGeMathUtil.degToRad(m.endAngle||0),!m.isCCW))}else if(l.type==3){const m=l;new c.AcGeVector2d().subVectors(m.end,m.center);const f=Math.sqrt(Math.pow(m.end.x,2)+Math.pow(m.end.y,2)),I=f*m.lengthOfMinorAxis;let y=c.AcGeMathUtil.degToRad(m.startAngle||0),L=c.AcGeMathUtil.degToRad(m.endAngle||0);const C=Math.atan2(m.end.y,m.end.x);m.isCCW||(y=Math.PI*2-y,L=Math.PI*2-L),h.add(new c.AcGeEllipseArc2d({...m.center,z:0},f,I,y,L,!m.isCCW,C))}else if(l.type==4){const m=l;if(m.numberOfControlPoints>0&&m.numberOfKnots>0){const _=m.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let f=!0;const I=m.controlPoints.map(y=>(y.weight==null&&(f=!1),y.weight||1));h.add(new c.AcGeSpline3d(_,m.knots,f?I:void 0))}else if(m.numberOfFitData>0){const _=m.fitDatum.map(f=>({x:f.x,y:f.y,z:0}));h.add(new c.AcGeSpline3d(_,"Uniform"))}}}),t.add(h)}}),t}convertTable(e){const t=new Ur(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,i)=>t.setColumnWidth(i,s)),e.rowHeightArr.forEach((s,i)=>t.setRowHeight(i,s)),e.cells.forEach((s,i)=>{t.setCell(i,s)}),t}convertText(e){const t=new $r;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=c.AcGeMathUtil.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 Yr;return t.contents=e.text.join(""),e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=c.AcGeMathUtil.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new c.AcGeVector3d(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new zr;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 ds(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=c.AcGeMathUtil.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new cs(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new hs(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new us(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new ls(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 c.AcGePoint2d(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 xt;return this.processImage(e,t),t}convertWipeout(e){const t=new is;return this.processImage(e,t),t}convertViewport(e){const t=new ns;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 ss;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertXline(e){const t=new as;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertBlockReference(e){const t=new wt(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.AcGeMathUtil.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 i=0;if(s/2==t?i=2:s/3==t&&(i=3),i==0)return;const a=[];for(let o=0,d=s/i;o<d;++o)a.push({x:e[o*i],y:e[o*i+1],z:i==3?e[o*i+2]:void 0});return a}}class St extends ce{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new c.AcGeBox2d,this._extents=new c.AcGeBox3d}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 Tt extends ce{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,i)=>{s===t&&this._recordsByName.delete(i)}),!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 et(this._recordsByName)}}class ms extends Tt{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 gs extends ce{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class ai{convertLayout(e){const t=new St;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 gs;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class fs extends Cr{parse(e){return new ei().parseSync(e)}getFonts(e){var a;const t=new Map,s=o=>{if(o){const d=o.lastIndexOf(".");return d>=0?o.substring(0,d).toLowerCase():o.toLowerCase()}};(a=e.tables.STYLE)==null||a.entries.forEach(o=>{const d=[];let h=s(o.font);h&&d.push(h),h=s(o.bigFont),h&&d.push(h),t.set(o.name,d)});const i=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,i),Array.from(i)}getFontsInBlock(e,t,s,i){const a=/\\f(.*?)\|/g;e.forEach(o=>{if(o.type=="MTEXT"){const d=o;[...d.text.join("").matchAll(a)].forEach(m=>{i.add(m[1].toLowerCase())});const l=s.get(d.styleName);l==null||l.forEach(m=>i.add(m))}else if(o.type=="TEXT"){const d=o,h=s.get(d.styleName);h==null||h.forEach(l=>i.add(l))}else if(o.type=="INSERT"){const h=t[o.name];h&&h.entities&&this.getFontsInBlock(h.entities,t,s,i)}})}async processEntities(e,t,s,i,a){const o=new ps,d=e.entities,h=d.length,l=new vt(h,100-i.value,s),m=t.tables.blockTable.modelSpace,_=t.tables.blockTable;await l.processChunk(async(f,I)=>{for(let y=f;y<I;y++){const L=d[y],C=o.convert(L);if(C){let K=m;L.ownerBlockRecordSoftId!=null&&(K=_.getIdAt(L.ownerBlockRecordSoftId)||K),K.appendEntity(C)}}if(a){let y=i.value+I/h*(100-i.value);y>100&&(y=100),await a(y,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t,s){const i=new ps,a=e.length;for(let o=0;o<a;o++){const d=e[o],h=i.convert(d);if(h){let l=t;d.ownerBlockRecordSoftId!=null&&(l=s.getIdAt(d.ownerBlockRecordSoftId)||l),l.appendEntity(h)}}}processBlocks(e,t){const s=e.blocks;for(const[i,a]of Object.entries(s)){let o=t.tables.blockTable.getAt(a.name);o||(o=new ie,o.objectId=a.handle,o.name=i,o.origin.copy(a.position),t.tables.blockTable.add(o)),a.entities&&this.processEntitiesInBlock(a.entities,o,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 i;const s=(i=e.tables.BLOCK_RECORD)==null?void 0:i.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(a=>{const o=new ie;o.objectId=a.handle,o.name=a.name,t.tables.blockTable.add(o)}))}processObjects(e,t){const s=e.objects.byName,i=new ai;if("LAYOUT"in s){const a=t.dictionaries.layouts;s.LAYOUT.forEach(o=>{const d=i.convertLayout(o);a.setAt(d.layoutName,d)})}if("IMAGEDEF"in s){const a=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(o=>{const d=i.convertImageDef(o);a.setAt(d.objectId,d)})}}processViewports(e,t){var i,a;const s=(a=(i=e.tables)==null?void 0:i.VPORT)==null?void 0:a.entries;s&&s.length>0&&s.forEach(o=>{const d=new vs;this.processCommonTableEntryAttrs(o,d),o.circleSides&&(d.circleSides=o.circleSides),d.standardFlag=o.standardFlag,d.center.copy(o.center),d.lowerLeftCorner.copy(o.lowerLeftCorner),d.upperRightCorner.copy(o.upperRightCorner),o.snapBasePoint&&d.snapBase.copy(o.snapBasePoint),o.snapRotationAngle&&(d.snapAngle=o.snapRotationAngle),o.snapSpacing&&d.snapIncrements.copy(o.snapSpacing),o.majorGridLines&&(d.gridMajor=o.majorGridLines),o.gridSpacing&&d.gridIncrements.copy(o.gridSpacing),o.backgroundObjectId&&(d.backgroundObjectId=o.backgroundObjectId),d.gsView.center.copy(o.center),d.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget),d.gsView.viewTarget.copy(o.viewTarget),o.lensLength&&(d.gsView.lensLength=o.lensLength),o.frontClippingPlane&&(d.gsView.frontClippingPlane=o.frontClippingPlane),o.backClippingPlane&&(d.gsView.backClippingPlane=o.backClippingPlane),o.viewHeight&&(d.gsView.viewHeight=o.viewHeight),o.viewTwistAngle&&(d.gsView.viewTwistAngle=o.viewTwistAngle),o.frozenLayers&&(d.gsView.frozenLayers=o.frozenLayers),o.styleSheet&&(d.gsView.styleSheet=o.styleSheet),o.renderMode&&(d.gsView.renderMode=o.renderMode),o.viewMode&&(d.gsView.viewMode=o.viewMode),o.ucsIconSetting&&(d.gsView.ucsIconSetting=o.ucsIconSetting),o.ucsOrigin&&d.gsView.ucsOrigin.copy(o.ucsOrigin),o.ucsXAxis&&d.gsView.ucsXAxis.copy(o.ucsXAxis),o.ucsYAxis&&d.gsView.ucsYAxis.copy(o.ucsYAxis),o.orthographicType&&(d.gsView.orthographicType=o.orthographicType),o.shadePlotSetting&&(d.gsView.shadePlotSetting=o.shadePlotSetting),o.shadePlotObjectId&&(d.gsView.shadePlotObjectId=o.shadePlotObjectId),o.visualStyleObjectId&&(d.gsView.visualStyleObjectId=o.visualStyleObjectId),o.isDefaultLightingOn&&(d.gsView.isDefaultLightingOn=o.isDefaultLightingOn),o.defaultLightingType&&(d.gsView.defaultLightingType=o.defaultLightingType),o.brightness&&(d.gsView.brightness=o.brightness),o.contrast&&(d.gsView.contrast=o.contrast),o.ambientColor&&(d.gsView.ambientColor=o.ambientColor),t.tables.viewportTable.add(d)})}processLayers(e,t){var i,a;const s=(a=(i=e.tables)==null?void 0:i.LAYER)==null?void 0:a.entries;s&&s.length>0&&s.forEach(o=>{const d=new P.AcCmColor;d.colorIndex=o.colorIndex;const h=new Lt({name:o.name,standardFlags:o.standardFlag,linetype:o.lineType,lineWeight:o.lineweight,isOff:o.colorIndex<0,color:d,isPlottable:o.isPlotting});this.processCommonTableEntryAttrs(o,h),t.tables.layerTable.add(h)})}processLineTypes(e,t){var i,a;const s=(a=(i=e.tables)==null?void 0:i.LTYPE)==null?void 0:a.entries;s&&s.length>0&&s.forEach(o=>{const d=new Ls(o);this.processCommonTableEntryAttrs(o,d),d.name=o.name,t.tables.linetypeTable.add(d)})}processTextStyles(e,t){var i;const s=(i=e.tables.STYLE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new Ds(a);this.processCommonTableEntryAttrs(a,o),t.tables.textStyleTable.add(o)})}processDimStyles(e,t){var i;const s=(i=e.tables.DIMSTYLE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o={name:a.name,ownerId:a.ownerObjectId,dimpost:a.DIMPOST||"",dimapost:a.DIMAPOST||"",dimscale:a.DIMSCALE,dimasz:a.DIMASZ,dimexo:a.DIMEXO,dimdli:a.DIMDLI,dimexe:a.DIMEXE,dimrnd:a.DIMRND,dimdle:a.DIMDLE,dimtp:a.DIMTP,dimtm:a.DIMTM,dimtxt:a.DIMTXT,dimcen:a.DIMCEN,dimtsz:a.DIMTSZ,dimaltf:a.DIMALTF,dimlfac:a.DIMLFAC,dimtvp:a.DIMTVP,dimtfac:a.DIMTFAC,dimgap:a.DIMGAP,dimaltrnd:a.DIMALTRND,dimtol:a.DIMTOL==null||a.DIMTOL==0?0:1,dimlim:a.DIMLIM==null||a.DIMLIM==0?0:1,dimtih:a.DIMTIH==null||a.DIMTIH==0?0:1,dimtoh:a.DIMTOH==null||a.DIMTOH==0?0:1,dimse1:a.DIMSE1==null||a.DIMSE1==0?0:1,dimse2:a.DIMSE2==null||a.DIMSE2==0?0:1,dimtad:a.DIMTAD,dimzin:a.DIMZIN,dimazin:a.DIMAZIN,dimalt:a.DIMALT,dimaltd:a.DIMALTD,dimtofl:a.DIMTOFL,dimsah:a.DIMSAH,dimtix:a.DIMTIX,dimsoxd:a.DIMSOXD,dimclrd:a.DIMCLRD,dimclre:a.DIMCLRE,dimclrt:a.DIMCLRT,dimadec:a.DIMADEC||0,dimunit:a.DIMUNIT||2,dimdec:a.DIMDEC,dimtdec:a.DIMTDEC,dimaltu:a.DIMALTU,dimalttd:a.DIMALTTD,dimaunit:a.DIMAUNIT,dimfrac:a.DIMFRAC,dimlunit:a.DIMLUNIT,dimdsep:a.DIMDSEP,dimtmove:a.DIMTMOVE||0,dimjust:a.DIMJUST,dimsd1:a.DIMSD1,dimsd2:a.DIMSD2,dimtolj:a.DIMTOLJ,dimtzin:a.DIMTZIN,dimaltz:a.DIMALTZ,dimalttz:a.DIMALTTZ,dimfit:a.DIMFIT||0,dimupt:a.DIMUPT,dimatfit:a.DIMATFIT,dimtxsty:a.DIMTXSTY||"Standard",dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},d=new Ge(o);this.processCommonTableEntryAttrs(a,d),t.tables.dimStyleTable.add(d)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}}var Et=(r=>(r.DXF="dxf",r.DWG="dwg",r))(Et||{});class X{constructor(){this.events={registered:new P.AcCmEventManager,unregistered:new P.AcCmEventManager},this._converters=new Map,this.register("dxf",new fs)}static createInstance(){return X._instance==null&&(X._instance=new X),this._instance}static get instance(){return X._instance||(X._instance=new X),X._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 Ae extends ce{constructor(e,t){e=e||{},je.defaults(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const Pe=class Pe extends Ae{constructor(){super(),this._origin=new c.AcGePoint3d,this._entities=new Map}get isModelSapce(){return this.name.toLowerCase()==Pe.MODEL_SPACE_NAME.toLowerCase()}get isPaperSapce(){return this.name.toLowerCase().startsWith(Pe.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 et(this._entities)}getIdAt(e){return this._entities.get(e)}};Pe.MODEL_SPACE_NAME="*Model_Space",Pe.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let ie=Pe;class ye extends ce{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,i)=>{s.ownerId==e&&(t=this._recordsById.get(i))}),t}newIterator(){return new et(this._recordsByName)}}class _s extends ye{constructor(e){super(e)}get modelSpace(){let e=this.getAt(ie.MODEL_SPACE_NAME);return e||(e=new ie,e.name=ie.MODEL_SPACE_NAME,this.add(e)),e}}class bs extends ye{constructor(e){super(e)}}class Lt extends Ae{constructor(e,t){e=e||{},je.defaults(e,{color:new P.AcCmColor,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 As extends ye{constructor(e){super(e);const t=new P.AcCmColor;t.color=16777215;const s=new Lt({name:"0",standardFlags:0,linetype:Je,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 ys extends ye{constructor(e){super(e)}}class Is extends ye{constructor(e){super(e)}get fonts(){const e=new Set,t=i=>{if(i){const a=i.lastIndexOf(".");if(a>=0){const o=i.substring(0,a).toLowerCase();e.add(o)}else e.add(i.toLowerCase())}},s=this.newIterator();for(const i of s)t(i.fileName),t(i.bigFontFileName);return Array.from(e)}}class ws extends ye{constructor(e){super(e)}}class oi extends ce{constructor(){super(),this.events={entityAppended:new P.AcCmEventManager,entityModified:new P.AcCmEventManager,layerAppended:new P.AcCmEventManager,layerModified:new P.AcCmEventManager,layerErased:new P.AcCmEventManager,openProgress:new P.AcCmEventManager,headerSysVarChanged:new P.AcCmEventManager},this._angBase=0,this._angDir=0,this._aunits=yt.DecimalDegrees,this._celtscale=1,this._cecolor=new P.AcCmColor,this._insunits=It.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new _s(this),dimStyleTable:new bs(this),linetypeTable:new ys(this),textStyleTable:new Is(this),layerTable:new As(this),viewportTable:new ws(this)},this._dictionaries={layouts:new ms(this),imageDefs:new Tt(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=Et.DXF){const i=X.instance.get(s);if(i==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await i.read(e,this,t&&t.minimumChunkSize||10,async(a,o,d,h)=>{if(this.events.openProgress.dispatch({database:this,percentage:a,stage:o,stageStatus:d}),t&&t.fontLoader&&o=="FONT"&&d=="END"){const l=h||this.tables.textStyleTable.fonts;await t.fontLoader.load(l)}})}async openUri(e,t){const i=await(await fetch(e)).blob(),a=new FileReader;a.onload=o=>{var h;const d=(h=o.target)==null?void 0:h.result;d&&this.read(d,t)},a.readAsText(i)}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 Ps=(r=>(r[r.Center=0]="Center",r[r.Left=1]="Left",r[r.Right=2]="Right",r[r.OverFirst=3]="OverFirst",r[r.OverSecond=4]="OverSecond",r))(Ps||{}),xs=(r=>(r[r.Center=0]="Center",r[r.Above=1]="Above",r[r.Outside=2]="Outside",r[r.JIS=3]="JIS",r[r.Below=4]="Below",r))(xs||{}),Ss=(r=>(r[r.Feet=0]="Feet",r[r.None=1]="None",r[r.Inch=2]="Inch",r[r.FeetAndInch=3]="FeetAndInch",r[r.Leading=4]="Leading",r[r.Trailing=8]="Trailing",r[r.LeadingAndTrailing=12]="LeadingAndTrailing",r))(Ss||{}),Ts=(r=>(r[r.None=0]="None",r[r.Leading=1]="Leading",r[r.Trailing=2]="Trailing",r[r.LeadingAndTrailing=3]="LeadingAndTrailing",r))(Ts||{}),Es=(r=>(r[r.Bottom=0]="Bottom",r[r.Middle=1]="Middle",r[r.Top=2]="Top",r))(Es||{});const nt=class nt extends Ae{constructor(e,t){e=e||{},je.defaults(e,nt.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)}};nt.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 Ge=nt;class Ls extends Ae{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 Ds extends Ae{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 ci={center:new c.AcGePoint2d,viewDirectionFromTarget:new c.AcGePoint3d(0,0,1),viewTarget:new c.AcGePoint3d(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:B.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new c.AcGePoint3d(0,0,0),ucsXAxis:new c.AcGePoint3d(1,0,0),ucsYAxis:new c.AcGePoint3d(0,1,0),orthographicType:B.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:B.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class vs extends Ae{constructor(){super(),this._circleSides=100,this._center=new c.AcGePoint2d,this._lowerLeftCorner=new c.AcGePoint2d(0,0),this._upperRightCorner=new c.AcGePoint2d(1,1),this._snapBase=new c.AcGePoint2d(0,0),this._snapAngle=0,this._snapSpacing=new c.AcGePoint2d(0,0),this._standardFlag=0,this._gridSpacing=new c.AcGePoint2d,this._gridMajor=10,this._gsView=ci}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 ks{constructor(){this.events={layoutSwitched:new P.AcCmEventManager}}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),i=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(i,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),i=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(i,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),i=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(i,s)}renameLayout(e,t,s){const a=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return a?(a.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),i=new St;i.layoutName=e,i.tabOrder=s.dictionaries.layouts.maxTabOrder;const a=new ie;return a.name=`*Paper_Space${i.tabOrder}`,s.tables.blockTable.add(a),s.dictionaries.layouts.setAt(e,i),{layout:i,btr:a}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||Dt().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function Dt(){return st.instance}const it=class it{constructor(){this._workingDatabase=null,this._layoutManager=new ks}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}};it.instance=new it;let st=it;u.AcDb3PointAngularDimension=cs,u.AcDbAlignedDimension=ds,u.AcDbAngleUnits=yt,u.AcDbArc=Rr,u.AcDbArcDimension=ii,u.AcDbBatchProcessing=vt,u.AcDbBlockReference=wt,u.AcDbBlockTable=_s,u.AcDbBlockTableRecord=ie,u.AcDbCircle=Br,u.AcDbCurve=Y,u.AcDbDatabase=oi,u.AcDbDatabaseConverter=Cr,u.AcDbDatabaseConverterManager=X,u.AcDbDiametricDimension=ls,u.AcDbDictionary=Tt,u.AcDbDimArrowType=kr,u.AcDbDimStyleTable=bs,u.AcDbDimStyleTableRecord=Ge,u.AcDbDimTextHorizontal=Ps,u.AcDbDimTextVertical=xs,u.AcDbDimVerticalJustification=Es,u.AcDbDimZeroSuppression=Ss,u.AcDbDimZeroSuppressionAngular=Ts,u.AcDbDimension=be,u.AcDbDxfConverter=fs,u.AcDbEllipse=Fr,u.AcDbEntity=U,u.AcDbFileType=Et,u.AcDbHatch=jr,u.AcDbHatchPatternType=Gr,u.AcDbHatchStyle=Vr,u.AcDbHostApplicationServices=st,u.AcDbLayerTable=As,u.AcDbLayerTableRecord=Lt,u.AcDbLayout=St,u.AcDbLayoutDictionary=ms,u.AcDbLayoutManager=ks,u.AcDbLeader=zr,u.AcDbLeaderAnnotationType=Hr,u.AcDbLine=Wr,u.AcDbLineSpacingStyle=os,u.AcDbLinetypeTable=ys,u.AcDbLinetypeTableRecord=Ls,u.AcDbMText=Yr,u.AcDbObject=ce,u.AcDbObjectIterator=et,u.AcDbOrdinateDimension=hs,u.AcDbOsnapMode=fe,u.AcDbPoint=Qr,u.AcDbPolyline=Jr,u.AcDbRadialDimension=us,u.AcDbRasterImage=xt,u.AcDbRasterImageClipBoundaryType=es,u.AcDbRasterImageDef=gs,u.AcDbRasterImageImageDisplayOpt=ts,u.AcDbRay=ss,u.AcDbRenderingCache=oe,u.AcDbSpline=Pt,u.AcDbSymbolTable=ye,u.AcDbSymbolTableRecord=Ae,u.AcDbTable=Ur,u.AcDbText=$r,u.AcDbTextHorizontalMode=Kr,u.AcDbTextStyleTable=Is,u.AcDbTextStyleTableRecord=Ds,u.AcDbTextVerticalMode=qr,u.AcDbTrace=Zr,u.AcDbUnitsValue=It,u.AcDbViewport=ns,u.AcDbViewportTable=ws,u.AcDbViewportTableRecord=vs,u.AcDbWipeout=is,u.AcDbXline=as,u.ByBlock=vr,u.ByLayer=Qe,u.DEFAULT_LINE_TYPE=Je,u.acdbHostApplicationServices=Dt,u.isImperialUnits=ri,u.isMetricUnits=ti,Object.keys(P).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(u,r)&&Object.defineProperty(u,r,{enumerable:!0,get:()=>P[r]})}),Object.keys(c).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(u,r)&&Object.defineProperty(u,r,{enumerable:!0,get:()=>c[r]})}),Object.keys(B).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(u,r)&&Object.defineProperty(u,r,{enumerable:!0,get:()=>B[r]})}),Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|