@mlightcad/geometry-engine
Version:
The geometry-engine package provides comprehensive geometric entities, mathematical operations, and transformations for 2D and 3D space. This package mimics AutoCAD ObjectARX's AcGe (Geometry) classes and provides the mathematical foundation for CAD opera
1 lines • 221 kB
JavaScript
(function(H,ee){typeof exports=="object"&&typeof module<"u"?ee(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],ee):(H=typeof globalThis<"u"?globalThis:H||self,ee(H["geometry-engine"]={},H.common))})(this,function(H,ee){"use strict";const Qt=["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 Ur=1234567;const hr=Math.PI/180,lr=180/Math.PI;function Rr(){const N=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(Qt[N&255]+Qt[N>>8&255]+Qt[N>>16&255]+Qt[N>>24&255]+"-"+Qt[e&255]+Qt[e>>8&255]+"-"+Qt[e>>16&15|64]+Qt[e>>24&255]+"-"+Qt[i&63|128]+Qt[i>>8&255]+"-"+Qt[i>>16&255]+Qt[i>>24&255]+Qt[a&255]+Qt[a>>8&255]+Qt[a>>16&255]+Qt[a>>24&255]).toLowerCase()}function Be(N,e,i){return Math.max(e,Math.min(i,N))}function ur(N,e){return(N%e+e)%e}function Vr(N,e,i,a,l){return a+(N-e)*(l-a)/(i-e)}function Dr(N,e,i){return N!==e?(i-N)/(e-N):0}function cr(N,e,i){return(1-i)*N+i*e}function Fr(N,e,i,a){return cr(N,e,1-Math.exp(-i*a))}function Or(N,e=1){return e-Math.abs(ur(N,e*2)-e)}function qr(N,e,i){return N<=e?0:N>=i?1:(N=(N-e)/(i-e),N*N*(3-2*N))}function Gr(N,e,i){return N<=e?0:N>=i?1:(N=(N-e)/(i-e),N*N*N*(N*(N*6-15)+10))}function Kr(N,e){return N+Math.floor(Math.random()*(e-N+1))}function jr(N,e){return N+Math.random()*(e-N)}function Xr(N){return N*(.5-Math.random())}function Wr(N){N!==void 0&&(Ur=N);let e=Ur+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Zr(N){return N*hr}function Yr(N){return N*lr}function Hr(N){return(N&N-1)===0&&N!==0}function Qr(N){return Math.pow(2,Math.ceil(Math.log(N)/Math.LN2))}function Jr(N){return Math.pow(2,Math.floor(Math.log(N)/Math.LN2))}function An(N){const e=Math.PI*2;return(N%e+e)%e}function $r(N,e,i){return N>e&&N<i||N>i&&N<e}function ti(N,e,i,a=!1){return N=An(N),e=An(e),i=An(i),a?e>i?N<=e&&N>=i:N<=e||N>=i:e<i?N>=e&&N<=i:N>=e||N<=i}function vr(N){return N=Math.abs(N),N<1?0:Math.ceil(Math.log10(Math.abs(N)+1))}function ei(N,e=1e-7){const i=vr(N);return Math.max(Math.pow(10,i)*e,e)}const Ct={DEG2RAD:hr,RAD2DEG:lr,generateUUID:Rr,clamp:Be,euclideanModulo:ur,mapLinear:Vr,inverseLerp:Dr,lerp:cr,damp:Fr,pingpong:Or,smoothstep:qr,smootherstep:Gr,randInt:Kr,randFloat:jr,randFloatSpread:Xr,seededRandom:Wr,degToRad:Zr,radToDeg:Yr,isPowerOfTwo:Hr,ceilPowerOfTwo:Qr,floorPowerOfTwo:Jr,normalizeAngle:An,isBetween:$r,isBetweenAngle:ti,intPartLength:vr,relativeEps:ei},En=class En{constructor(e,i){this.x=0,this.y=0;const a=+(e!==void 0)+ +(i!==void 0);if(a!==0){if(a===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(a===1){const{x:l,y:_}=e;this.x=l,this.y=_;return}if(a===2){this.x=e,this.y=i;return}throw ee.AcCmErrors.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,i){return this.x=e,this.y=i,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,i){switch(e){case 0:this.x=i;break;case 1:this.y=i;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 En(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,i){return this.x=e.x+i.x,this.y=e.y+i.y,this}addScaledVector(e,i){return this.x+=e.x*i,this.y+=e.y*i,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,i){return this.x=e.x-i.x,this.y=e.y-i.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 i=this.x,a=this.y,l=e.elements;return this.x=l[0]*i+l[3]*a+l[6],this.y=l[1]*i+l[4]*a+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,i){return this.x=Math.max(e.x,Math.min(i.x,this.x)),this.y=Math.max(e.y,Math.min(i.y,this.y)),this}clampScalar(e,i){return this.x=Math.max(e,Math.min(i,this.x)),this.y=Math.max(e,Math.min(i,this.y)),this}clampLength(e,i){const a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(i,a)))}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 i=Math.sqrt(this.lengthSq()*e.lengthSq());if(i===0)return Math.PI/2;const a=this.dot(e)/i;return Math.acos(Math.max(-1,Math.min(1,a)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,a=this.y-e.y;return i*i+a*a}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,i){return this.x+=(e.x-this.x)*i,this.y+=(e.y-this.y)*i,this}lerpVectors(e,i,a){return this.x=e.x+(i.x-e.x)*a,this.y=e.y+(i.y-e.y)*a,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,i=0){return this.x=e[i],this.y=e[i+1],this}toArray(e=[],i=0){return e[i]=this.x,e[i+1]=this.y,e}rotateAround(e,i){const a=Math.cos(i),l=Math.sin(i),_=this.x-e.x,g=this.y-e.y;return this.x=_*a-g*l+e.x,this.y=_*l+g*a+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(Ct.relativeEps(this.x,e),Ct.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};En.EMPTY=Object.freeze(new En(0,0));let Tt=En;const Nn=class Nn{constructor(e,i,a,l,_,g,p,x,f){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&i!=null&&a!=null&&l!=null&&_!=null&&g!=null&&p!=null&&x!=null&&f!=null&&this.set(e,i,a,l,_,g,p,x,f)}set(e,i,a,l,_,g,p,x,f){const M=this.elements;return M[0]=e,M[1]=l,M[2]=p,M[3]=i,M[4]=_,M[5]=x,M[6]=a,M[7]=g,M[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const i=this.elements,a=e.elements;return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i[4]=a[4],i[5]=a[5],i[6]=a[6],i[7]=a[7],i[8]=a[8],this}extractBasis(e,i,a){return e.setFromMatrix3Column(this,0),i.setFromMatrix3Column(this,1),a.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const i=e.elements;return this.set(i[0],i[4],i[8],i[1],i[5],i[9],i[2],i[6],i[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,i){const a=e.elements,l=i.elements,_=this.elements,g=a[0],p=a[3],x=a[6],f=a[1],M=a[4],y=a[7],I=a[2],C=a[5],U=a[8],q=l[0],Z=l[3],j=l[6],wt=l[1],Pt=l[4],mt=l[7],Y=l[2],ct=l[5],lt=l[8];return _[0]=g*q+p*wt+x*Y,_[3]=g*Z+p*Pt+x*ct,_[6]=g*j+p*mt+x*lt,_[1]=f*q+M*wt+y*Y,_[4]=f*Z+M*Pt+y*ct,_[7]=f*j+M*mt+y*lt,_[2]=I*q+C*wt+U*Y,_[5]=I*Z+C*Pt+U*ct,_[8]=I*j+C*mt+U*lt,this}multiplyScalar(e){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=e,i[4]*=e,i[7]*=e,i[2]*=e,i[5]*=e,i[8]*=e,this}determinant(){const e=this.elements,i=e[0],a=e[1],l=e[2],_=e[3],g=e[4],p=e[5],x=e[6],f=e[7],M=e[8];return i*g*M-i*p*f-a*_*M+a*p*x+l*_*f-l*g*x}invert(){const e=this.elements,i=e[0],a=e[1],l=e[2],_=e[3],g=e[4],p=e[5],x=e[6],f=e[7],M=e[8],y=M*g-p*f,I=p*x-M*_,C=f*_-g*x,U=i*y+a*I+l*C;if(U===0)return this.set(0,0,0,0,0,0,0,0,0);const q=1/U;return e[0]=y*q,e[1]=(l*f-M*a)*q,e[2]=(p*a-l*g)*q,e[3]=I*q,e[4]=(M*i-l*x)*q,e[5]=(l*_-p*i)*q,e[6]=C*q,e[7]=(a*x-f*i)*q,e[8]=(g*i-a*_)*q,this}transpose(){let e;const i=this.elements;return e=i[1],i[1]=i[3],i[3]=e,e=i[2],i[2]=i[6],i[6]=e,e=i[5],i[5]=i[7],i[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const i=this.elements;return e.elements[0]=i[0],e.elements[1]=i[3],e.elements[2]=i[6],e.elements[3]=i[1],e.elements[4]=i[4],e.elements[5]=i[7],e.elements[6]=i[2],e.elements[7]=i[5],e.elements[8]=i[8],this}setUvTransform(e,i,a,l,_,g,p){const x=Math.cos(_),f=Math.sin(_);return this.set(a*x,a*f,-a*(x*g+f*p)+g+e,-l*f,l*x,-l*(-f*g+x*p)+p+i,0,0,1),this}scale(e,i){return this.premultiply(_r.makeScale(e,i)),this}rotate(e){return this.premultiply(_r.makeRotation(-e)),this}translate(e,i){return this.premultiply(_r.makeTranslation(e,i)),this}makeTranslation(e,i){return e instanceof Tt?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,i,0,0,1),this}makeRotation(e){const i=Math.cos(e),a=Math.sin(e);return this.set(i,-a,0,a,i,0,0,0,1),this}makeScale(e,i){return this.set(e,0,0,0,i,0,0,0,1),this}equals(e){const i=this.elements,a=e.elements;for(let l=0;l<9;l++)if(i[l]!==a[l])return!1;return!0}fromArray(e,i=0){for(let a=0;a<9;a++)this.elements[a]=e[a+i];return this}toArray(e=[],i=0){const a=this.elements;return e[i]=a[0],e[i+1]=a[1],e[i+2]=a[2],e[i+3]=a[3],e[i+4]=a[4],e[i+5]=a[5],e[i+6]=a[6],e[i+7]=a[7],e[i+8]=a[8],e}clone(){return new Nn().fromArray(this.elements)}};Nn.IDENTITY=Object.freeze(new Nn);let sn=Nn;const _r=new sn,He=1e-6,Lt=2*Math.PI,Bi={x:0,y:0},dr={x:0,y:0,z:0};class fr{constructor(){this.equalPointTol=He,this.equalVectorTol=He}equalPoint2d(e,i){return new Tt(e).sub(i).length()<this.equalPointTol}equalPoint3d(e,i){return new Q(e).sub(i).length()<this.equalPointTol}static equalToZero(e,i=He){return e<i&&e>-i}static equal(e,i,a=He){return Math.abs(e-i)<a}static great(e,i,a=He){return e-i>a}static less(e,i,a=He){return e-i<a}}const mr=new fr;function gr(N,e,i=!1){const a=N.x,l=N.y;let _=!1;const g=e.length;for(let p=0,x=g-1;p<g;x=p++){const f=e[p].x,M=e[p].y,y=e[x].x,I=e[x].y;let C=M>l!=I>l;i&&(C=M>=l!=I>=l),C&&a<(y-f)*(l-M)/(I-M)+f&&(_=!_)}return _}function ni(N,e){if(N.length===0||e.length===0)return!1;const i=new de().setFromPoints(N),a=new de().setFromPoints(e);if(!i.intersectsBox(a))return!1;for(let l=0;l<N.length;){if(gr(N[l],e,!0))return!0;l<N.length-1&&mr.equalPoint2d(N[l+1],N[l])&&++l,++l}return!1}const ri={isPointInPolygon:gr,isPolygonIntersect:ni};function ii(N,e){const i=[],a=e-1,l=N;for(let _=0;_<=l;_++)i.push(0);for(let _=1;_<=a-l;_++)i.push(_);for(let _=0;_<=l;_++)i.push(a-l+1);return i}function si(N,e){const i=e.length-1,a=N,l=[0];let _=0;for(let p=1;p<=i;p++){const x=e[p][0]-e[p-1][0],f=e[p][1]-e[p-1][1],M=e[p][2]-e[p-1][2],y=Math.sqrt(x*x+f*f+M*M);_+=y,l.push(_)}const g=[];for(let p=0;p<=a;p++)g.push(0);for(let p=1;p<=i-a;p++){const x=l[p]/_;g.push(x*(i-a+1))}for(let p=0;p<=a;p++)g.push(i-a+1);return g}function ai(N,e){const i=e.length-1,a=N,l=[0];let _=0;for(let p=1;p<=i;p++){const x=e[p][0]-e[p-1][0],f=e[p][1]-e[p-1][1],M=e[p][2]-e[p-1][2],y=Math.sqrt(x*x+f*f+M*M),I=Math.sqrt(y);_+=I,l.push(_)}const g=[];for(let p=0;p<=a;p++)g.push(0);for(let p=1;p<=i-a;p++){const x=l[p]/_;g.push(x*(i-a+1))}for(let p=0;p<=a;p++)g.push(i-a+1);return g}function nr(N,e,i,a){if(e===0)return i>=a[N]&&i<a[N+1]?1:0;const l=a[N+e]-a[N],_=a[N+e+1]-a[N+1],g=l>1e-10?(i-a[N])/l:0,p=_>1e-10?(a[N+e+1]-i)/_:0;return g*nr(N,e-1,i,a)+p*nr(N+1,e-1,i,a)}function Pn(N,e,i,a,l){const _=a.length-1,g=e;if(N=Math.max(i[g],Math.min(i[_+1],N)),Math.abs(N-i[_+1])<1e-8)return[...a[_]];if(Math.abs(N-i[g])<1e-8)return[...a[0]];const p=[0,0,0];let x=0;for(let f=0;f<=_;f++){const M=nr(f,g,N,i),y=l[f]*M;p[0]+=a[f][0]*y,p[1]+=a[f][1]*y,p[2]+=a[f][2]*y,x+=y}if(x<1e-10){const f=i[i.length-g-1];if(Math.abs(N-f)<1e-8)return[...a[_]];if(Math.abs(N-i[g])<1e-8)return[...a[0]]}return x>1e-10&&(p[0]/=x,p[1]/=x,p[2]/=x),p}function oi(N,e,i,a){const l=N,_=e[l],g=e[e.length-l-1];let p=0;const x=1e3,f=(g-_)/x;let M=Pn(_,N,e,i,a);for(let q=1;q<=x;q++){const Z=_+q*f,j=Pn(Z,N,e,i,a),wt=j[0]-M[0],Pt=j[1]-M[1],mt=j[2]-M[2];p+=Math.sqrt(wt*wt+Pt*Pt+mt*mt),M=j}const y=Pn(g,N,e,i,a),I=y[0]-M[0],C=y[1]-M[1],U=y[2]-M[2];return p+=Math.sqrt(I*I+C*C+U*U),p}function Ti(N){return N.map(e=>[...e])}class Mn{constructor(e=0,i=0,a=0,l=1){this._x=e,this._y=i,this._z=a,this._w=l}static slerpFlat(e,i,a,l,_,g,p){let x=a[l+0],f=a[l+1],M=a[l+2],y=a[l+3];const I=_[g+0],C=_[g+1],U=_[g+2],q=_[g+3];if(p===0){e[i+0]=x,e[i+1]=f,e[i+2]=M,e[i+3]=y;return}if(p===1){e[i+0]=I,e[i+1]=C,e[i+2]=U,e[i+3]=q;return}if(y!==q||x!==I||f!==C||M!==U){let Z=1-p;const j=x*I+f*C+M*U+y*q,wt=j>=0?1:-1,Pt=1-j*j;if(Pt>Number.EPSILON){const Y=Math.sqrt(Pt),ct=Math.atan2(Y,j*wt);Z=Math.sin(Z*ct)/Y,p=Math.sin(p*ct)/Y}const mt=p*wt;if(x=x*Z+I*mt,f=f*Z+C*mt,M=M*Z+U*mt,y=y*Z+q*mt,Z===1-p){const Y=1/Math.sqrt(x*x+f*f+M*M+y*y);x*=Y,f*=Y,M*=Y,y*=Y}}e[i]=x,e[i+1]=f,e[i+2]=M,e[i+3]=y}static multiplyQuaternionsFlat(e,i,a,l,_,g){const p=a[l],x=a[l+1],f=a[l+2],M=a[l+3],y=_[g],I=_[g+1],C=_[g+2],U=_[g+3];return e[i]=p*U+M*y+x*C-f*I,e[i+1]=x*U+M*I+f*y-p*C,e[i+2]=f*U+M*C+p*I-x*y,e[i+3]=M*U-p*y-x*I-f*C,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,i,a,l){return this._x=e,this._y=i,this._z=a,this._w=l,this._onChangeCallback(),this}clone(){return new Mn(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,i=!0){const a=e.x,l=e.y,_=e.z,g=e.order,p=Math.cos,x=Math.sin,f=p(a/2),M=p(l/2),y=p(_/2),I=x(a/2),C=x(l/2),U=x(_/2);switch(g){case"XYZ":this._x=I*M*y+f*C*U,this._y=f*C*y-I*M*U,this._z=f*M*U+I*C*y,this._w=f*M*y-I*C*U;break;case"YXZ":this._x=I*M*y+f*C*U,this._y=f*C*y-I*M*U,this._z=f*M*U-I*C*y,this._w=f*M*y+I*C*U;break;case"ZXY":this._x=I*M*y-f*C*U,this._y=f*C*y+I*M*U,this._z=f*M*U+I*C*y,this._w=f*M*y-I*C*U;break;case"ZYX":this._x=I*M*y-f*C*U,this._y=f*C*y+I*M*U,this._z=f*M*U-I*C*y,this._w=f*M*y+I*C*U;break;case"YZX":this._x=I*M*y+f*C*U,this._y=f*C*y+I*M*U,this._z=f*M*U-I*C*y,this._w=f*M*y-I*C*U;break;case"XZY":this._x=I*M*y-f*C*U,this._y=f*C*y-I*M*U,this._z=f*M*U+I*C*y,this._w=f*M*y+I*C*U;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+g)}return i===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,i){const a=i/2,l=Math.sin(a);return this._x=e.x*l,this._y=e.y*l,this._z=e.z*l,this._w=Math.cos(a),this._onChangeCallback(),this}setFromRotationMatrix(e){const i=e.elements,a=i[0],l=i[4],_=i[8],g=i[1],p=i[5],x=i[9],f=i[2],M=i[6],y=i[10],I=a+p+y;if(I>0){const C=.5/Math.sqrt(I+1);this._w=.25/C,this._x=(M-x)*C,this._y=(_-f)*C,this._z=(g-l)*C}else if(a>p&&a>y){const C=2*Math.sqrt(1+a-p-y);this._w=(M-x)/C,this._x=.25*C,this._y=(l+g)/C,this._z=(_+f)/C}else if(p>y){const C=2*Math.sqrt(1+p-a-y);this._w=(_-f)/C,this._x=(l+g)/C,this._y=.25*C,this._z=(x+M)/C}else{const C=2*Math.sqrt(1+y-a-p);this._w=(g-l)/C,this._x=(_+f)/C,this._y=(x+M)/C,this._z=.25*C}return this._onChangeCallback(),this}setFromUnitVectors(e,i){let a=e.dot(i)+1;return a<Number.EPSILON?(a=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=a):(this._x=0,this._y=-e.z,this._z=e.y,this._w=a)):(this._x=e.y*i.z-e.z*i.y,this._y=e.z*i.x-e.x*i.z,this._z=e.x*i.y-e.y*i.x,this._w=a),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Be(this.dot(e),-1,1)))}rotateTowards(e,i){const a=this.angleTo(e);if(a===0)return this;const l=Math.min(1,i/a);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,i){const a=e._x,l=e._y,_=e._z,g=e._w,p=i._x,x=i._y,f=i._z,M=i._w;return this._x=a*M+g*p+l*f-_*x,this._y=l*M+g*x+_*p-a*f,this._z=_*M+g*f+a*x-l*p,this._w=g*M-a*p-l*x-_*f,this._onChangeCallback(),this}slerp(e,i){if(i===0)return this;if(i===1)return this.copy(e);const a=this._x,l=this._y,_=this._z,g=this._w;let p=g*e._w+a*e._x+l*e._y+_*e._z;if(p<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,p=-p):this.copy(e),p>=1)return this._w=g,this._x=a,this._y=l,this._z=_,this;const x=1-p*p;if(x<=Number.EPSILON){const C=1-i;return this._w=C*g+i*this._w,this._x=C*a+i*this._x,this._y=C*l+i*this._y,this._z=C*_+i*this._z,this.normalize(),this}const f=Math.sqrt(x),M=Math.atan2(f,p),y=Math.sin((1-i)*M)/f,I=Math.sin(i*M)/f;return this._w=g*y+this._w*I,this._x=a*y+this._x*I,this._y=l*y+this._y*I,this._z=_*y+this._z*I,this._onChangeCallback(),this}slerpQuaternions(e,i,a){return this.copy(e).slerp(i,a)}random(){const e=2*Math.PI*Math.random(),i=2*Math.PI*Math.random(),a=Math.random(),l=Math.sqrt(1-a),_=Math.sqrt(a);return this.set(l*Math.sin(e),l*Math.cos(e),_*Math.sin(i),_*Math.cos(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,i=0){return this._x=e[i],this._y=e[i+1],this._z=e[i+2],this._w=e[i+3],this._onChangeCallback(),this}toArray(e=[],i=0){return e[i]=this._x,e[i+1]=this._y,e[i+2]=this._z,e[i+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Wt=class Wt{constructor(e,i,a){this.x=0,this.y=0,this.z=0;const l=+(e!==void 0)+ +(i!==void 0)+ +(a!==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:_,y:g,z:p}=e;this.x=_,this.y=g,this.z=p||0;return}if(l===3){this.x=e,this.y=i,this.z=a;return}throw ee.AcCmErrors.ILLEGAL_PARAMETERS}}set(e,i,a){return a===void 0&&(a=this.z),this.x=e,this.y=i,this.z=a,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,i){switch(e){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;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 Wt(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,i){return this.x=e.x+i.x,this.y=e.y+i.y,this.z=e.z+i.z,this}addScaledVector(e,i){return this.x+=e.x*i,this.y+=e.y*i,this.z+=e.z*i,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,i){return this.x=e.x-i.x,this.y=e.y-i.y,this.z=e.z-i.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,i){return this.x=e.x*i.x,this.y=e.y*i.y,this.z=e.z*i.z,this}applyEuler(e){return this.applyQuaternion(hi.setFromEuler(e))}applyAxisAngle(e,i){return this.applyQuaternion(hi.setFromAxisAngle(e,i))}applyMatrix3(e){const i=this.x,a=this.y,l=this.z,_=e.elements;return this.x=_[0]*i+_[3]*a+_[6]*l,this.y=_[1]*i+_[4]*a+_[7]*l,this.z=_[2]*i+_[5]*a+_[8]*l,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const i=this.x,a=this.y,l=this.z,_=e.elements,g=1/(_[3]*i+_[7]*a+_[11]*l+_[15]);return this.x=(_[0]*i+_[4]*a+_[8]*l+_[12])*g,this.y=(_[1]*i+_[5]*a+_[9]*l+_[13])*g,this.z=(_[2]*i+_[6]*a+_[10]*l+_[14])*g,this}applyQuaternion(e){const i=this.x,a=this.y,l=this.z,_=e.x,g=e.y,p=e.z,x=e.w,f=2*(g*l-p*a),M=2*(p*i-_*l),y=2*(_*a-g*i);return this.x=i+x*f+g*y-p*M,this.y=a+x*M+p*f-_*y,this.z=l+x*y+_*M-g*f,this}transformDirection(e){const i=this.x,a=this.y,l=this.z,_=e.elements;return this.x=_[0]*i+_[4]*a+_[8]*l,this.y=_[1]*i+_[5]*a+_[9]*l,this.z=_[2]*i+_[6]*a+_[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,i){return this.x=Math.max(e.x,Math.min(i.x,this.x)),this.y=Math.max(e.y,Math.min(i.y,this.y)),this.z=Math.max(e.z,Math.min(i.z,this.z)),this}clampScalar(e,i){return this.x=Math.max(e,Math.min(i,this.x)),this.y=Math.max(e,Math.min(i,this.y)),this.z=Math.max(e,Math.min(i,this.z)),this}clampLength(e,i){const a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(i,a)))}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 i=this.dot(e),a=this.length(),l=e.length();return Math.abs(i)===a*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,i){return this.x+=(e.x-this.x)*i,this.y+=(e.y-this.y)*i,this.z+=(e.z-this.z)*i,this}lerpVectors(e,i,a){return this.x=e.x+(i.x-e.x)*a,this.y=e.y+(i.y-e.y)*a,this.z=e.z+(i.z-e.z)*a,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,i){const a=e.x,l=e.y,_=e.z,g=i.x,p=i.y,x=i.z;return this.x=l*x-_*p,this.y=_*g-a*x,this.z=a*p-l*g,this}projectOnVector(e){const i=e.lengthSq();if(i===0)return this.set(0,0,0);const a=e.dot(this)/i;return this.copy(e).multiplyScalar(a)}projectOnPlane(e){return pr.copy(this).projectOnVector(e),this.sub(pr)}reflect(e){return this.sub(pr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const i=Math.sqrt(this.lengthSq()*e.lengthSq());if(i===0)return Math.PI/2;const a=this.dot(e)/i;return Math.acos(Math.max(-1,Math.min(1,a)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,a=this.y-e.y,l=this.z-e.z;return i*i+a*a+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 i=e.elements;return this.x=i[12],this.y=i[13],this.z=i[14],this}setFromMatrixScale(e){const i=this.setFromMatrixColumn(e,0).length(),a=this.setFromMatrixColumn(e,1).length(),l=this.setFromMatrixColumn(e,2).length();return this.x=i,this.y=a,this.z=l,this}setFromMatrixColumn(e,i){return this.fromArray(e.elements,i*4)}setFromMatrix3Column(e,i){return this.fromArray(e.elements,i*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,i=0){return this.x=e[i],this.y=e[i+1],this.z=e[i+2],this}toArray(e=[],i=0){return e[i]=this.x,e[i+1]=this.y,e[i+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,i=Math.random()*2-1,a=Math.sqrt(1-i*i);return this.x=a*Math.cos(e),this.y=i,this.z=a*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Wt.ORIGIN=Object.freeze(new Wt(0,0,0)),Wt.X_AXIS=Object.freeze(new Wt(1,0,0)),Wt.NEGATIVE_X_AXIS=Object.freeze(new Wt(-1,0,0)),Wt.Y_AXIS=Object.freeze(new Wt(0,1,0)),Wt.NEGATIVE_Y_AXIS=Object.freeze(new Wt(0,-1,0)),Wt.Z_AXIS=Object.freeze(new Wt(0,0,1)),Wt.NEGATIVE_Z_AXIS=Object.freeze(new Wt(0,0,-1));let Q=Wt;const pr=new Q,hi=new Mn,Bn=class Bn{constructor(e,i,a,l,_,g,p,x,f,M,y,I,C,U,q,Z){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&i!=null&&a!=null&&l!=null&&_!=null&&g!=null&&p!=null&&x!=null&&f!=null&&M!=null&&y!=null&&I!=null&&C!=null&&U!=null&&q!=null&&Z!=null&&this.set(e,i,a,l,_,g,p,x,f,M,y,I,C,U,q,Z)}set(e,i,a,l,_,g,p,x,f,M,y,I,C,U,q,Z){const j=this.elements;return j[0]=e,j[4]=i,j[8]=a,j[12]=l,j[1]=_,j[5]=g,j[9]=p,j[13]=x,j[2]=f,j[6]=M,j[10]=y,j[14]=I,j[3]=C,j[7]=U,j[11]=q,j[15]=Z,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 Bn().fromArray(this.elements)}copy(e){const i=this.elements,a=e.elements;return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i[4]=a[4],i[5]=a[5],i[6]=a[6],i[7]=a[7],i[8]=a[8],i[9]=a[9],i[10]=a[10],i[11]=a[11],i[12]=a[12],i[13]=a[13],i[14]=a[14],i[15]=a[15],this}copyPosition(e){const i=this.elements,a=e.elements;return i[12]=a[12],i[13]=a[13],i[14]=a[14],this}setFromMatrix3(e){const i=e.elements;return this.set(i[0],i[3],i[6],0,i[1],i[4],i[7],0,i[2],i[5],i[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(mr.equalPoint3d(e,Q.Z_AXIS))this.identity();else{const i=new Q(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?i.crossVectors(Q.Y_AXIS,e).normalize():i.crossVectors(Q.Z_AXIS,e).normalize();const a=e.clone().cross(i).normalize();this.set(i.x,i.y,i.z,0,a.x,a.y,a.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,i,a){return e.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),a.setFromMatrixColumn(this,2),this}makeBasis(e,i,a){return this.set(e.x,i.x,a.x,0,e.y,i.y,a.y,0,e.z,i.z,a.z,0,0,0,0,1),this}extractRotation(e){const i=this.elements,a=e.elements,l=1/on.setFromMatrixColumn(e,0).length(),_=1/on.setFromMatrixColumn(e,1).length(),g=1/on.setFromMatrixColumn(e,2).length();return i[0]=a[0]*l,i[1]=a[1]*l,i[2]=a[2]*l,i[3]=0,i[4]=a[4]*_,i[5]=a[5]*_,i[6]=a[6]*_,i[7]=0,i[8]=a[8]*g,i[9]=a[9]*g,i[10]=a[10]*g,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Li,e,Ui)}lookAt(e,i,a){const l=this.elements;return ae.subVectors(e,i),ae.lengthSq()===0&&(ae.z=1),ae.normalize(),De.crossVectors(a,ae),De.lengthSq()===0&&(Math.abs(a.z)===1?ae.x+=1e-4:ae.z+=1e-4,ae.normalize(),De.crossVectors(a,ae)),De.normalize(),rr.crossVectors(ae,De),l[0]=De.x,l[4]=rr.x,l[8]=ae.x,l[1]=De.y,l[5]=rr.y,l[9]=ae.y,l[2]=De.z,l[6]=rr.z,l[10]=ae.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,i){const a=e.elements,l=i.elements,_=this.elements,g=a[0],p=a[4],x=a[8],f=a[12],M=a[1],y=a[5],I=a[9],C=a[13],U=a[2],q=a[6],Z=a[10],j=a[14],wt=a[3],Pt=a[7],mt=a[11],Y=a[15],ct=l[0],lt=l[4],Vt=l[8],Xt=l[12],Dt=l[1],jt=l[5],Jt=l[9],oe=l[13],he=l[2],le=l[6],Ot=l[10],Zt=l[14],X=l[3],bt=l[7],Yt=l[11],Se=l[15];return _[0]=g*ct+p*Dt+x*he+f*X,_[4]=g*lt+p*jt+x*le+f*bt,_[8]=g*Vt+p*Jt+x*Ot+f*Yt,_[12]=g*Xt+p*oe+x*Zt+f*Se,_[1]=M*ct+y*Dt+I*he+C*X,_[5]=M*lt+y*jt+I*le+C*bt,_[9]=M*Vt+y*Jt+I*Ot+C*Yt,_[13]=M*Xt+y*oe+I*Zt+C*Se,_[2]=U*ct+q*Dt+Z*he+j*X,_[6]=U*lt+q*jt+Z*le+j*bt,_[10]=U*Vt+q*Jt+Z*Ot+j*Yt,_[14]=U*Xt+q*oe+Z*Zt+j*Se,_[3]=wt*ct+Pt*Dt+mt*he+Y*X,_[7]=wt*lt+Pt*jt+mt*le+Y*bt,_[11]=wt*Vt+Pt*Jt+mt*Ot+Y*Yt,_[15]=wt*Xt+Pt*oe+mt*Zt+Y*Se,this}multiplyScalar(e){const i=this.elements;return i[0]*=e,i[4]*=e,i[8]*=e,i[12]*=e,i[1]*=e,i[5]*=e,i[9]*=e,i[13]*=e,i[2]*=e,i[6]*=e,i[10]*=e,i[14]*=e,i[3]*=e,i[7]*=e,i[11]*=e,i[15]*=e,this}determinant(){const e=this.elements,i=e[0],a=e[4],l=e[8],_=e[12],g=e[1],p=e[5],x=e[9],f=e[13],M=e[2],y=e[6],I=e[10],C=e[14],U=e[3],q=e[7],Z=e[11],j=e[15];return U*(+_*x*y-l*f*y-_*p*I+a*f*I+l*p*C-a*x*C)+q*(+i*x*C-i*f*I+_*g*I-l*g*C+l*f*M-_*x*M)+Z*(+i*f*y-i*p*C-_*g*y+a*g*C+_*p*M-a*f*M)+j*(-l*p*M-i*x*y+i*p*I+l*g*y-a*g*I+a*x*M)}transpose(){const e=this.elements;let i;return i=e[1],e[1]=e[4],e[4]=i,i=e[2],e[2]=e[8],e[8]=i,i=e[6],e[6]=e[9],e[9]=i,i=e[3],e[3]=e[12],e[12]=i,i=e[7],e[7]=e[13],e[13]=i,i=e[11],e[11]=e[14],e[14]=i,this}setPosition(e,i,a){const l=this.elements;return e instanceof Q?(l[12]=e.x,l[13]=e.y,l[14]=e.z):(l[12]=e,l[13]=i,l[14]=a),this}invert(){const e=this.elements,i=e[0],a=e[1],l=e[2],_=e[3],g=e[4],p=e[5],x=e[6],f=e[7],M=e[8],y=e[9],I=e[10],C=e[11],U=e[12],q=e[13],Z=e[14],j=e[15],wt=y*Z*f-q*I*f+q*x*C-p*Z*C-y*x*j+p*I*j,Pt=U*I*f-M*Z*f-U*x*C+g*Z*C+M*x*j-g*I*j,mt=M*q*f-U*y*f+U*p*C-g*q*C-M*p*j+g*y*j,Y=U*y*x-M*q*x-U*p*I+g*q*I+M*p*Z-g*y*Z,ct=i*wt+a*Pt+l*mt+_*Y;if(ct===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const lt=1/ct;return e[0]=wt*lt,e[1]=(q*I*_-y*Z*_-q*l*C+a*Z*C+y*l*j-a*I*j)*lt,e[2]=(p*Z*_-q*x*_+q*l*f-a*Z*f-p*l*j+a*x*j)*lt,e[3]=(y*x*_-p*I*_-y*l*f+a*I*f+p*l*C-a*x*C)*lt,e[4]=Pt*lt,e[5]=(M*Z*_-U*I*_+U*l*C-i*Z*C-M*l*j+i*I*j)*lt,e[6]=(U*x*_-g*Z*_-U*l*f+i*Z*f+g*l*j-i*x*j)*lt,e[7]=(g*I*_-M*x*_+M*l*f-i*I*f-g*l*C+i*x*C)*lt,e[8]=mt*lt,e[9]=(U*y*_-M*q*_-U*a*C+i*q*C+M*a*j-i*y*j)*lt,e[10]=(g*q*_-U*p*_+U*a*f-i*q*f-g*a*j+i*p*j)*lt,e[11]=(M*p*_-g*y*_-M*a*f+i*y*f+g*a*C-i*p*C)*lt,e[12]=Y*lt,e[13]=(M*q*l-U*y*l+U*a*I-i*q*I-M*a*Z+i*y*Z)*lt,e[14]=(U*p*l-g*q*l-U*a*x+i*q*x+g*a*Z-i*p*Z)*lt,e[15]=(g*y*l-M*p*l+M*a*x-i*y*x-g*a*I+i*p*I)*lt,this}scale(e){const i=this.elements,a=e.x,l=e.y,_=e.z;return i[0]*=a,i[4]*=l,i[8]*=_,i[1]*=a,i[5]*=l,i[9]*=_,i[2]*=a,i[6]*=l,i[10]*=_,i[3]*=a,i[7]*=l,i[11]*=_,this}getMaxScaleOnAxis(){const e=this.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=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(i,a,l))}makeTranslation(e,i,a){return e instanceof Q?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,i,0,0,1,a,0,0,0,1),this}makeRotationX(e){const i=Math.cos(e),a=Math.sin(e);return this.set(1,0,0,0,0,i,-a,0,0,a,i,0,0,0,0,1),this}makeRotationY(e){const i=Math.cos(e),a=Math.sin(e);return this.set(i,0,a,0,0,1,0,0,-a,0,i,0,0,0,0,1),this}makeRotationZ(e){const i=Math.cos(e),a=Math.sin(e);return this.set(i,-a,0,0,a,i,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,i){const a=Math.cos(i),l=Math.sin(i),_=1-a,g=e.x,p=e.y,x=e.z,f=_*g,M=_*p;return this.set(f*g+a,f*p-l*x,f*x+l*p,0,f*p+l*x,M*p+a,M*x-l*g,0,f*x-l*p,M*x+l*g,_*x*x+a,0,0,0,0,1),this}makeScale(e,i,a){return this.set(e,0,0,0,0,i,0,0,0,0,a,0,0,0,0,1),this}makeShear(e,i,a,l,_,g){return this.set(1,a,_,0,e,1,g,0,i,l,1,0,0,0,0,1),this}compose(e,i,a){const l=this.elements,_=i.x,g=i.y,p=i.z,x=i.w,f=_+_,M=g+g,y=p+p,I=_*f,C=_*M,U=_*y,q=g*M,Z=g*y,j=p*y,wt=x*f,Pt=x*M,mt=x*y,Y=a.x,ct=a.y,lt=a.z;return l[0]=(1-(q+j))*Y,l[1]=(C+mt)*Y,l[2]=(U-Pt)*Y,l[3]=0,l[4]=(C-mt)*ct,l[5]=(1-(I+j))*ct,l[6]=(Z+wt)*ct,l[7]=0,l[8]=(U+Pt)*lt,l[9]=(Z-wt)*lt,l[10]=(1-(I+q))*lt,l[11]=0,l[12]=e.x,l[13]=e.y,l[14]=e.z,l[15]=1,this}decompose(e,i,a){const l=this.elements;let _=on.set(l[0],l[1],l[2]).length();const g=on.set(l[4],l[5],l[6]).length(),p=on.set(l[8],l[9],l[10]).length();this.determinant()<0&&(_=-_),e.x=l[12],e.y=l[13],e.z=l[14],pe.copy(this);const f=1/_,M=1/g,y=1/p;return pe.elements[0]*=f,pe.elements[1]*=f,pe.elements[2]*=f,pe.elements[4]*=M,pe.elements[5]*=M,pe.elements[6]*=M,pe.elements[8]*=y,pe.elements[9]*=y,pe.elements[10]*=y,i.setFromRotationMatrix(pe),a.x=_,a.y=g,a.z=p,this}equals(e){const i=this.elements,a=e.elements;for(let l=0;l<16;l++)if(i[l]!==a[l])return!1;return!0}fromArray(e,i=0){for(let a=0;a<16;a++)this.elements[a]=e[a+i];return this}toArray(e=[],i=0){const a=this.elements;return e[i]=a[0],e[i+1]=a[1],e[i+2]=a[2],e[i+3]=a[3],e[i+4]=a[4],e[i+5]=a[5],e[i+6]=a[6],e[i+7]=a[7],e[i+8]=a[8],e[i+9]=a[9],e[i+10]=a[10],e[i+11]=a[11],e[i+12]=a[12],e[i+13]=a[13],e[i+14]=a[14],e[i+15]=a[15],e}};Bn.IDENTITY=Object.freeze(new Bn);let an=Bn;const on=new Q,pe=new an,Li=new Q(0,0,0),Ui=new Q(1,1,1),De=new Q,rr=new Q,ae=new Q;class ze{constructor(e=void 0,i=void 0){this.min=e==null?new Q(1/0,1/0,1/0):new Q(e.x,e.y,e.z),this.max=i==null?new Q(-1/0,-1/0,-1/0):new Q(i.x,i.y,i.z)}set(e,i){return this.min.copy(e),this.max.copy(i),this}setFromArray(e){this.makeEmpty();for(let i=0,a=e.length;i<a;i+=3)this.expandByPoint(yr.fromArray(e,i));return this}setFromPoints(e){this.makeEmpty();for(let i=0,a=e.length;i<a;i++)this.expandByPoint(e[i]);return this}setFromCenterAndSize(e,i){const a=yr.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(a),this.max.copy(e).add(a),this}clone(){return new ze().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 Q(0,0,0):new Q(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Q(0,0,0):new Q(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,i){return i.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 i,a;return e.normal.x>0?(i=e.normal.x*this.min.x,a=e.normal.x*this.max.x):(i=e.normal.x*this.max.x,a=e.normal.x*this.min.x),e.normal.y>0?(i+=e.normal.y*this.min.y,a+=e.normal.y*this.max.y):(i+=e.normal.y*this.max.y,a+=e.normal.y*this.min.y),e.normal.z>0?(i+=e.normal.z*this.min.z,a+=e.normal.z*this.max.z):(i+=e.normal.z*this.max.z,a+=e.normal.z*this.min.z),i<=-e.constant&&a>=-e.constant}clampPoint(e,i){return i.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yr).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Te[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Te[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Te[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Te[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Te[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Te[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Te[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Te[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Te),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Te=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],yr=new Q,li=new Tt;class de{constructor(e=void 0,i=void 0){this.min=e==null?new Tt(1/0,1/0):new Tt(e.x,e.y),this.max=i==null?new Tt(-1/0,-1/0):new Tt(i.x,i.y)}set(e,i){return this.min.copy(e),this.max.copy(i),this}setFromPoints(e){this.makeEmpty();for(let i=0,a=e.length;i<a;i++)this.expandByPoint(e[i]);return this}setFromCenterAndSize(e,i){const a=li.copy(i).multiplyScalar(.5);return this.min.copy(e).sub(a),this.max.copy(e).add(a),this}clone(){return new de().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 Tt(0,0):new Tt(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Tt(0,0):new Tt(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,i){return i.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,i){return i.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,li).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 ui=new Q,Ri=new Q,Vi=new sn;class zn{constructor(e=new Q(1,0,0),i=0){this.normal=e,this.constant=i}set(e,i){return this.normal.copy(e),this.constant=i,this}setComponents(e,i,a,l){return this.normal.set(e,i,a),this.constant=l,this}setFromNormalAndCoplanarPoint(e,i){return this.normal.copy(e),this.constant=-i.dot(this.normal),this}setFromCoplanarPoints(e,i,a){const l=ui.subVectors(a,i).cross(Ri.subVectors(e,i)).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,i){return i.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,i){const a=i||Vi.getNormalMatrix(e),l=this.coplanarPoint(ui).applyMatrix4(e),_=this.normal.applyMatrix3(a).normalize();return this.constant=-l.dot(_),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 zn().copy(this)}}class Ut extends Tt{static pointArrayToNumberArray(e){const i=new Array(e.length*2);return e.forEach((a,l)=>{a.toArray(i,l*2)}),i}}class St extends Q{static pointArrayToNumberArray(e,i=!0){const a=i?3:2,l=new Array(e.length*a);return e.forEach((_,g)=>{_.toArray(l,g*a)}),l}}const ci=new an,vi=new Mn,Tn=class Tn{constructor(e=0,i=0,a=0,l=Tn.DEFAULT_ORDER){this._x=e,this._y=i,this._z=a,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,i,a,l=this._order){return this._x=e,this._y=i,this._z=a,this._order=l,this._onChangeCallback(),this}clone(){return new Tn(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,i=this._order,a=!0){const l=e.elements,_=l[0],g=l[4],p=l[8],x=l[1],f=l[5],M=l[9],y=l[2],I=l[6],C=l[10];switch(i){case"XYZ":this._y=Math.asin(Be(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-M,C),this._z=Math.atan2(-g,_)):(this._x=Math.atan2(I,f),this._z=0);break;case"YXZ":this._x=Math.asin(-Be(M,-1,1)),Math.abs(M)<.9999999?(this._y=Math.atan2(p,C),this._z=Math.atan2(x,f)):(this._y=Math.atan2(-y,_),this._z=0);break;case"ZXY":this._x=Math.asin(Be(I,-1,1)),Math.abs(I)<.9999999?(this._y=Math.atan2(-y,C),this._z=Math.atan2(-g,f)):(this._y=0,this._z=Math.atan2(x,_));break;case"ZYX":this._y=Math.asin(-Be(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(I,C),this._z=Math.atan2(x,_)):(this._x=0,this._z=Math.atan2(-g,f));break;case"YZX":this._z=Math.asin(Be(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(-M,f),this._y=Math.atan2(-y,_)):(this._x=0,this._y=Math.atan2(p,C));break;case"XZY":this._z=Math.asin(-Be(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(I,f),this._y=Math.atan2(p,_)):(this._x=Math.atan2(-M,C),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+i)}return this._order=i,a===!0&&this._onChangeCallback(),this}setFromQuaternion(e,i,a=!0){return ci.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ci,i,a)}setFromVector3(e,i=this._order){return this.set(e.x,e.y,e.z,i)}reorder(e){return vi.setFromEuler(this),this.setFromQuaternion(vi,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=[],i=0){return e[i]=this._x,e[i+1]=this._y,e[i+2]=this._z,e[i+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}};Tn.DEFAULT_ORDER="XYZ";let wr=Tn;class _i{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class br extends _i{translate(e){return this.transform(new sn().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Di extends br{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new de}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const i=[];for(let a=0;a<this.loops.length;++a){const _=this.loops[a].getPoints(e);i.push(_)}return i}buildHierarchy(){var p;const e=this.getPoints(100),i=this.calculateBoundaryBoxes(e),a=this.sortBoundaryBoxesByAreas(i),l=new Map,_=a.length;for(let x=0;x<_;x++)l.set(a[x],{index:a[x],children:[]});const g={index:-1,children:[]};for(let x=0;x<_;x++){const f=a[x],M=e[f],y=i[f];let I=x+1;for(;I<_;I++){const C=a[I],U=e[C];if(i[C].containsBox(y)&&ri.isPointInPolygon(M[Ct.randInt(0,M.length-1)],U)){(p=l.get(C))==null||p.children.push(l.get(f));break}}I===_&&g.children.push(l.get(f))}return g}get area(){if(this._loops.length===0)return 0;let e=0;for(let i=0;i<this._loops.length;i++){const l=this._loops[i].getPoints(128),_=this.polygonArea(l);i===0?e+=Math.abs(_):e-=Math.abs(_)}return e}polygonArea(e){const i=e.length;if(i<3)return 0;let a=0;for(let l=0,_=i-1;l<i;_=l++){const g=e[_],p=e[l];a+=g.x*p.y-p.x*g.y}return a*.5}calculateBoundaryBoxes(e){const i=[];return e.forEach(a=>{i.push(new de().setFromPoints(a))}),i}sortBoundaryBoxesByAreas(e){const i=[];e.forEach((l,_)=>{const g=l.size,p=g.width*g.height;i.push({area:p,index:_})}),i.sort((l,_)=>l.area-_.area);const a=[];return i.forEach(l=>{a.push(l.index)}),a}}class hn extends br{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const i=this.getUtoTmapping(e);return this.getPoint(i)}getPoints(e=5){const i=[];for(let a=0;a<=e;a++)i.push(this.getPoint(a/e));return i}getSpacedPoints(e=5){const i=[];for(let a=0;a<=e;a++)i.push(this.getPointAt(a/e));return i}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const i=[];let a,l=this.getPoint(0),_=0;i.push(0);for(let g=1;g<=e;g++)a=this.getPoint(g/e),_+=a.distanceTo(l),i.push(_),l=a;return i}getUtoTmapping(e,i){const a=this.getLengths();let l=0;const _=a.length;let g;i?g=i:g=e*a[_-1];let p=0,x=_-1,f;for(;p<=x;)if(l=Math.floor(p+(x-p)/2),f=a[l]-g,f<0)p=l+1;else if(f>0)x=l-1;else{x=l;break}if(l=x,a[l]===g)return l/(_-1);const M=a[l],I=a[l+1]-M,C=(g-M)/I;return(l+C)/(_-1)}getTangent(e){let a=e-1e-4,l=e+1e-4;a<0&&(a=0),l>1&&(l=1);const _=this.getPoint(a),g=this.getPoint(l),p=new Ut;return p.copy(g).sub(_).normalize(),p}getTangentAt(e){const i=this.getUtoTmapping(e);return this.getTangent(i)}}class Sn extends hn{constructor(e,i,a,l,_){super();const g=+(e!==void 0)+ +(i!==void 0)+ +(a!==void 0)+ +(l!==void 0)+ +(_!==void 0);if(g==3)typeof e=="object"&&typeof i=="object"&&typeof a=="object"?this.createByThreePoints(e,i,a):this.createByStartEndPointsAndBulge(e,i,a);else if(g==5){const p=e;this.center=new Ut(p.x,p.y),this.radius=i,this._clockwise=_,this._startAngle=this._clockwise?this._mirrorAngle(Ct.normalizeAngle(a)):Ct.normalizeAngle(a),this._endAngle=this._clockwise?this._mirrorAngle(Ct.normalizeAngle(l)):Ct.normalizeAngle(l)}else throw ee.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(e,i,a){const l=(lt,Vt)=>({x:(lt.x+Vt.x)/2,y:(lt.y+Vt.y)/2}),_=(lt,Vt)=>(Vt.y-lt.y)/(Vt.x-lt.x),g=lt=>-1/lt,p=l(e,i),x=l(i,a),f=_(e,i),M=_(i,a),y=g(f),I=g(M),C=(lt,Vt,Xt,Dt)=>{const jt=(Dt-Vt)/(lt-Xt),Jt=lt*jt+Vt;return{x:jt,y:Jt}},U=p.y-y*p.x,q=x.y-I*x.x,Z=C(y,U,I,q),j=Math.sqrt(Math.pow(e.x-Z.x,2)+Math.pow(e.y-Z.y,2)),wt=(lt,Vt)=>Math.atan2(lt.y-Vt.y,lt.x-Vt.x),Pt=wt(e,Z),mt=wt(i,Z),Y=wt(a,Z),ct=Y>Pt&&Y<mt||Pt>Y&&Pt<mt||mt>Y&&mt<Pt;this.center=Z,this.radius=j,this._clockwise=!ct,this._startAngle=Pt,this._endAngle=Y}createByStartEndPointsAndBulge(e,i,a){let l,_,g;a<0?(l=Math.atan(-a)*4,_=new Tt(e),g=new Tt(i)):(l=Math.atan(a)*4,_=new Tt(i),g=new Tt(e));const p=new Tt().subVectors(g,_),x=p.length(),f=new Tt().addVectors(_,p.multiplyScalar(.5)),M=Math.abs(x/2/Math.tan(l/2)),y=p.normalize();let I;if(l<Math.PI){const C=new Tt(y.x*Math.cos(Math.PI/2)-y.y*Math.sin(Math.PI/2),y.y*Math.cos(Math.PI/2)+y.x*Math.sin(Math.PI/2));I=f.add(C.multiplyScalar(-M))}else{const C=new Tt(y.x*Math.cos(Math.PI/2)-y.y*Math.sin(Math.PI/2),y.y*Math.cos(Math.PI/2)+y.x*Math.sin(Math.PI/2));I=f.add(C.multiplyScalar(M))}a<0?(this._startAngle=Math.atan2(_.y-I.y,_.x-I.x),this._endAngle=Math.atan2(g.y-I.y,g.x-I.x)):(this._startAngle=Math.atan2(g.y-I.y,g.x-I.x),this._endAngle=Math.atan2(_.y-I.y,_.x-I.x)),this._clockwise=a<0,this.center=I,this.radius=g.sub(I).length()}get center(){return this._center}set center(e){this._center=new Ut(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(e){this._startAngle=this._clockwise?this._mirrorAngle(Ct.normalizeAngle(e)):Ct.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(e){const i=this.startAngle==0&&e==Lt?e:Ct.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(i):i,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(e){return(360-e*180/Math.PI)%360*Math.PI/180}_getInternalAngle(e){return this._clockwise?this._mirrorAngle(e):e}get deltaAngle(){const e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return this.clockwise?Ct.normalizeAngle(e-i):Ct.normalizeAngle(i-e)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle),a=Ct.normalizeAngle((e+i)/2),l=this._clockwise?this._mirrorAngle(a):a;return this.getPointAtAngle(l)}get closed(){const e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return Math.abs(i-e)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],i=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const _ of i){const g=this._getInternalAngle(_);Ct.isBetweenAngle(g,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&e.push(this.getPointAtAngle(_))}const a=e.map(_=>_.x),l=e.map(_=>_.y);return new de(new Ut(Math.min(...a),Math.min(...l)),new Ut(Math.max(...a),Math.max