@mlightcad/geometry-engine 3.2.24 → 3.2.25
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/LICENSE +21 -21
- package/README.md +174 -174
- package/dist/geometry-engine.js +628 -595
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/math/AcGeEuler.js +1 -1
- package/lib/math/AcGeEuler.js.map +1 -1
- package/lib/math/AcGeMatrix3d.js +1 -1
- package/lib/math/AcGeMatrix3d.js.map +1 -1
- package/lib/math/AcGeQuaternion.js +2 -2
- package/lib/math/AcGeQuaternion.js.map +1 -1
- package/lib/util/AcGeOcsUtil.d.ts +7 -0
- package/lib/util/AcGeOcsUtil.d.ts.map +1 -0
- package/lib/util/AcGeOcsUtil.js +33 -0
- package/lib/util/AcGeOcsUtil.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],N):(f=typeof globalThis<"u"?globalThis:f||self,N(f["geometry-engine"]={},f.common))})(this,function(f,N){"use strict";const j=["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 Kt=1234567;const Bt=Math.PI/180,kt=180/Math.PI;function Qt(){const m=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,e=Math.random()*4294967295|0;return(j[m&255]+j[m>>8&255]+j[m>>16&255]+j[m>>24&255]+"-"+j[t&255]+j[t>>8&255]+"-"+j[t>>16&15|64]+j[t>>24&255]+"-"+j[s&63|128]+j[s>>8&255]+"-"+j[s>>16&255]+j[s>>24&255]+j[e&255]+j[e>>8&255]+j[e>>16&255]+j[e>>24&255]).toLowerCase()}function Y(m,t,s){return Math.max(t,Math.min(s,m))}function Rt(m,t){return(m%t+t)%t}function $t(m,t,s,e,n){return e+(m-t)*(n-e)/(s-t)}function Wt(m,t,s){return m!==t?(s-m)/(t-m):0}function Tt(m,t,s){return(1-s)*m+s*t}function Ht(m,t,s,e){return Tt(m,t,1-Math.exp(-s*e))}function Jt(m,t=1){return t-Math.abs(Rt(m,t*2)-t)}function ts(m,t,s){return m<=t?0:m>=s?1:(m=(m-t)/(s-t),m*m*(3-2*m))}function ss(m,t,s){return m<=t?0:m>=s?1:(m=(m-t)/(s-t),m*m*m*(m*(m*6-15)+10))}function es(m,t){return m+Math.floor(Math.random()*(t-m+1))}function ns(m,t){return m+Math.random()*(t-m)}function is(m){return m*(.5-Math.random())}function rs(m){m!==void 0&&(Kt=m);let t=Kt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function os(m){return m*Bt}function hs(m){return m*kt}function as(m){return(m&m-1)===0&&m!==0}function cs(m){return Math.pow(2,Math.ceil(Math.log(m)/Math.LN2))}function ls(m){return Math.pow(2,Math.floor(Math.log(m)/Math.LN2))}function nt(m){const t=Math.PI*2;return(m%t+t)%t}function us(m,t,s){return m>t&&m<s||m>s&&m<t}function ds(m,t,s,e=!1){return m=nt(m),t=nt(t),s=nt(s),e?t>s?m<=t&&m>=s:m<=t||m>=s:t<s?m>=t&&m<=s:m>=t||m<=s}function Nt(m){return m=Math.abs(m),m<1?0:Math.ceil(Math.log10(Math.abs(m)+1))}function ms(m,t=1e-7){const s=Nt(m);return Math.max(Math.pow(10,s)*t,t)}const P={DEG2RAD:Bt,RAD2DEG:kt,generateUUID:Qt,clamp:Y,euclideanModulo:Rt,mapLinear:$t,inverseLerp:Wt,lerp:Tt,damp:Ht,pingpong:Jt,smoothstep:ts,smootherstep:ss,randInt:es,randFloat:ns,randFloatSpread:is,seededRandom:rs,degToRad:os,radToDeg:hs,isPowerOfTwo:as,ceilPowerOfTwo:cs,floorPowerOfTwo:ls,normalizeAngle:nt,isBetween:us,isBetweenAngle:ds,intPartLength:Nt,relativeEps:ms},gt=class gt{constructor(t,s){this.x=0,this.y=0;const e=+(t!==void 0)+ +(s!==void 0);if(e!==0){if(e===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(e===1){const{x:n,y:i}=t;this.x=n,this.y=i;return}if(e===2){this.x=t,this.y=s;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new gt(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const s=this.x,e=this.y,n=t.elements;return this.x=n[0]*s+n[3]*e+n[6],this.y=n[1]*s+n[4]*e+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y;return s*s+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}rotateAround(t,s){const e=Math.cos(s),n=Math.sin(s),i=this.x-t.x,r=this.y-t.y;return this.x=i*e-r*n+t.x,this.y=i*n+r*e+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(P.relativeEps(this.x,t),P.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};gt.EMPTY=Object.freeze(new gt(0,0));let B=gt;const yt=class yt{constructor(t,s,e,n,i,r,o,a,h){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&o!=null&&a!=null&&h!=null&&this.set(t,s,e,n,i,r,o,a,h)}set(t,s,e,n,i,r,o,a,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=o,c[3]=s,c[4]=i,c[5]=a,c[6]=e,c[7]=r,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],this}extractBasis(t,s,e){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],o=e[3],a=e[6],h=e[1],c=e[4],l=e[7],d=e[2],u=e[5],g=e[8],y=n[0],x=n[3],A=n[6],M=n[1],p=n[4],S=n[7],C=n[2],k=n[5],w=n[8];return i[0]=r*y+o*M+a*C,i[3]=r*x+o*p+a*k,i[6]=r*A+o*S+a*w,i[1]=h*y+c*M+l*C,i[4]=h*x+c*p+l*k,i[7]=h*A+c*S+l*w,i[2]=d*y+u*M+g*C,i[5]=d*x+u*p+g*k,i[8]=d*A+u*S+g*w,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],o=t[5],a=t[6],h=t[7],c=t[8];return s*r*c-s*o*h-e*i*c+e*o*a+n*i*h-n*r*a}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],o=t[5],a=t[6],h=t[7],c=t[8],l=c*r-o*h,d=o*a-c*i,u=h*i-r*a,g=s*l+e*d+n*u;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/g;return t[0]=l*y,t[1]=(n*h-c*e)*y,t[2]=(o*e-n*r)*y,t[3]=d*y,t[4]=(c*s-n*a)*y,t[5]=(n*i-o*s)*y,t[6]=u*y,t[7]=(e*a-h*s)*y,t[8]=(r*s-e*i)*y,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t.elements[0]=s[0],t.elements[1]=s[3],t.elements[2]=s[6],t.elements[3]=s[1],t.elements[4]=s[4],t.elements[5]=s[7],t.elements[6]=s[2],t.elements[7]=s[5],t.elements[8]=s[8],this}setUvTransform(t,s,e,n,i,r,o){const a=Math.cos(i),h=Math.sin(i);return this.set(e*a,e*h,-e*(a*r+h*o)+r+t,-n*h,n*a,-n*(-h*r+a*o)+o+s,0,0,1),this}scale(t,s){return this.premultiply(jt.makeScale(t,s)),this}rotate(t){return this.premultiply(jt.makeRotation(-t)),this}translate(t,s){return this.premultiply(jt.makeTranslation(t,s)),this}makeTranslation(t,s){return t instanceof B?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,e,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<9;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<9;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t}clone(){return new yt().fromArray(this.elements)}};yt.IDENTITY=Object.freeze(new yt);let J=yt;const jt=new J,Q=1e-6,I=2*Math.PI,Ss={x:0,y:0},Lt={x:0,y:0,z:0};class it{constructor(){this.equalPointTol=Q,this.equalVectorTol=Q}clone(){const t=new it;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t}equalPoint2d(t,s){return new B(t).sub(s).length()<this.equalPointTol}equalPoint3d(t,s){return new _(t).sub(s).length()<this.equalPointTol}static equalToZero(t,s=Q){return t<s&&t>-s}static equal(t,s,e=Q){return Math.abs(t-s)<e}static great(t,s,e=Q){return t-s>e}static less(t,s,e=Q){return t-s<e}}const Vt=new it;function Ut(m,t,s=!1){const e=m.x,n=m.y;let i=!1;const r=t.length;for(let o=0,a=r-1;o<r;a=o++){const h=t[o].x,c=t[o].y,l=t[a].x,d=t[a].y;let u=c>n!=d>n;s&&(u=c>=n!=d>=n),u&&e<(l-h)*(n-c)/(d-c)+h&&(i=!i)}return i}function gs(m,t){if(m.length===0||t.length===0)return!1;const s=new q().setFromPoints(m),e=new q().setFromPoints(t);if(!s.intersectsBox(e))return!1;for(let n=0;n<m.length;){if(Ut(m[n],t,!0))return!0;n<m.length-1&&Vt.equalPoint2d(m[n+1],m[n])&&++n,++n}return!1}const ys={isPointInPolygon:Ut,isPolygonIntersect:gs};function Es(m,t){const s=[],e=t-1,n=m;for(let i=0;i<=n;i++)s.push(0);for(let i=1;i<=e-n;i++)s.push(i);for(let i=0;i<=n;i++)s.push(e-n+1);return s}function Is(m,t){const s=t.length-1,e=m,n=[0];let i=0;for(let o=1;o<=s;o++){const a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],c=t[o][2]-t[o-1][2],l=Math.sqrt(a*a+h*h+c*c);i+=l,n.push(i)}const r=[];for(let o=0;o<=e;o++)r.push(0);for(let o=1;o<=s-e;o++){const a=n[o]/i;r.push(a*(s-e+1))}for(let o=0;o<=e;o++)r.push(s-e+1);return r}function xs(m,t="Uniform"){const s=m.length;if(s===0)return[];if(s===1)return[0];const e=s-1;if(t==="Uniform")return new Array(s).fill(0).map((r,o)=>o/e);const n=[0];let i=0;for(let r=1;r<=e;r++){const o=m[r][0]-m[r-1][0],a=m[r][1]-m[r-1][1],h=m[r][2]-m[r-1][2],c=Math.sqrt(o*o+a*a+h*h),l=t==="SqrtChord"?Math.sqrt(c):c;i+=l,n.push(i)}return i<1e-12?new Array(s).fill(0).map((r,o)=>o/e):n.map(r=>r/i)}function _s(m,t){const s=t.length-1,e=m,n=s+e+1,i=new Array(n+1).fill(0),r=t[t.length-1];for(let o=n-e;o<=n;o++)i[o]=r;for(let o=1;o<=s-e;o++){let a=0;for(let h=o;h<o+e;h++)a+=t[h];i[o+e]=a/e}return i}function Bs(m,t){const s=t.length-1,e=m,n=[0];let i=0;for(let o=1;o<=s;o++){const a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],c=t[o][2]-t[o-1][2],l=Math.sqrt(a*a+h*h+c*c),d=Math.sqrt(l);i+=d,n.push(i)}const r=[];for(let o=0;o<=e;o++)r.push(0);for(let o=1;o<=s-e;o++){const a=n[o]/i;r.push(a*(s-e+1))}for(let o=0;o<=e;o++)r.push(s-e+1);return r}function qt(m,t){const s=m.length,e=m.map(r=>r.slice()),n=t.slice();for(let r=0;r<s;r++){let o=r,a=Math.abs(e[r][r]);for(let h=r+1;h<s;h++){const c=Math.abs(e[h][r]);c>a&&(a=c,o=h)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==r){const h=e[r];e[r]=e[o],e[o]=h;const c=n[r];n[r]=n[o],n[o]=c}for(let h=r+1;h<s;h++){const c=e[h][r]/e[r][r];if(!(Math.abs(c)<1e-14)){for(let l=r;l<s;l++)e[h][l]-=c*e[r][l];n[h]-=c*n[r]}}}const i=new Array(s).fill(0);for(let r=s-1;r>=0;r--){let o=n[r];for(let a=r+1;a<s;a++)o-=e[r][a]*i[a];i[r]=o/e[r][r]}return i}function Ft(m,t,s="Uniform",e,n){if(m.length===0)return{controlPoints:[],knots:[],weights:[]};const i=m.map(E=>[E[0],E[1],E[2]??0]),r=!!e,o=!!n,a=(r?1:0)+(o?1:0),h=i.length-1,c=h+a;if(c<t)throw new Error("Not enough points to interpolate a curve of this degree.");const l=xs(i,s),d=l.slice();r&&d.unshift(l[0]),o&&d.push(l[l.length-1]);const u=_s(t,d),g=c+1,y=new Array(g),x=new Array(g),A=new Array(g),M=new Array(g);let p=0;y[p]=new Array(g).fill(0),y[p][0]=1,x[p]=i[0][0],A[p]=i[0][1],M[p]=i[0][2],p++;for(let E=1;E<=h-1;E++){const V=l[E];y[p]=new Array(g).fill(0);for(let v=0;v<=c;v++)y[p][v]=rt(v,t,V,u);x[p]=i[E][0],A[p]=i[E][1],M[p]=i[E][2],p++}if(y[p]=new Array(g).fill(0),y[p][c]=1,x[p]=i[h][0],A[p]=i[h][1],M[p]=i[h][2],p++,r){const E=u[t+1]-u[0],V=E!==0?t/E:0;y[p]=new Array(g).fill(0),y[p][0]=-V,y[p][1]=V,x[p]=(e==null?void 0:e[0])??0,A[p]=(e==null?void 0:e[1])??0,M[p]=(e==null?void 0:e[2])??0,p++}if(o){const E=u[c+t+1]-u[c],V=E!==0?t/E:0;y[p]=new Array(g).fill(0),y[p][c-1]=-V,y[p][c]=V,x[p]=(n==null?void 0:n[0])??0,A[p]=(n==null?void 0:n[1])??0,M[p]=(n==null?void 0:n[2])??0,p++}const S=qt(y,x),C=qt(y,A),k=qt(y,M),w=new Array(g);for(let E=0;E<g;E++)w[E]=[S[E],C[E],k[E]];const R=new Array(g).fill(1);return{controlPoints:w,knots:u,weights:R}}function rt(m,t,s,e){if(t===0)return s>=e[m]&&s<e[m+1]?1:0;const n=e[m+t]-e[m],i=e[m+t+1]-e[m+1],r=n>1e-10?(s-e[m])/n:0,o=i>1e-10?(e[m+t+1]-s)/i:0;return r*rt(m,t-1,s,e)+o*rt(m+1,t-1,s,e)}function ot(m,t,s,e,n){const i=e.length-1,r=t;if(m=Math.max(s[r],Math.min(s[i+1],m)),Math.abs(m-s[i+1])<1e-8)return[...e[i]];if(Math.abs(m-s[r])<1e-8)return[...e[0]];const o=[0,0,0];let a=0;for(let h=0;h<=i;h++){const c=rt(h,r,m,s),l=n[h]*c;o[0]+=e[h][0]*l,o[1]+=e[h][1]*l,o[2]+=e[h][2]*l,a+=l}if(Math.abs(a)<1e-10){const h=s[s.length-r-1];if(Math.abs(m-h)<1e-8)return[...e[i]];if(Math.abs(m-s[r])<1e-8)return[...e[0]]}return Math.abs(a)>=1e-10&&(o[0]/=a,o[1]/=a,o[2]/=a),o}function As(m,t,s,e){const n=m,i=t[n],r=t[t.length-n-1];let o=0;const a=1e3,h=(r-i)/a;let c=ot(i,m,t,s,e);for(let y=1;y<=a;y++){const x=i+y*h,A=ot(x,m,t,s,e),M=A[0]-c[0],p=A[1]-c[1],S=A[2]-c[2];o+=Math.sqrt(M*M+p*p+S*S),c=A}const l=ot(r,m,t,s,e),d=l[0]-c[0],u=l[1]-c[1],g=l[2]-c[2];return o+=Math.sqrt(d*d+u*u+g*g),o}function ks(m,t=3,s="Uniform",e,n){return m.length===0?[]:Ft(m,t,s,e,n).controlPoints}class ht{constructor(t=0,s=0,e=0,n=1){this._x=t,this._y=s,this._z=e,this._w=n}static slerpFlat(t,s,e,n,i,r,o){let a=e[n+0],h=e[n+1],c=e[n+2],l=e[n+3];const d=i[r+0],u=i[r+1],g=i[r+2],y=i[r+3];if(o===0){t[s+0]=a,t[s+1]=h,t[s+2]=c,t[s+3]=l;return}if(o===1){t[s+0]=d,t[s+1]=u,t[s+2]=g,t[s+3]=y;return}if(l!==y||a!==d||h!==u||c!==g){let x=1-o;const A=a*d+h*u+c*g+l*y,M=A>=0?1:-1,p=1-A*A;if(p>Number.EPSILON){const C=Math.sqrt(p),k=Math.atan2(C,A*M);x=Math.sin(x*k)/C,o=Math.sin(o*k)/C}const S=o*M;if(a=a*x+d*S,h=h*x+u*S,c=c*x+g*S,l=l*x+y*S,x===1-o){const C=1/Math.sqrt(a*a+h*h+c*c+l*l);a*=C,h*=C,c*=C,l*=C}}t[s]=a,t[s+1]=h,t[s+2]=c,t[s+3]=l}static multiplyQuaternionsFlat(t,s,e,n,i,r){const o=e[n],a=e[n+1],h=e[n+2],c=e[n+3],l=i[r],d=i[r+1],u=i[r+2],g=i[r+3];return t[s]=o*g+c*l+a*u-h*d,t[s+1]=a*g+c*d+h*l-o*u,t[s+2]=h*g+c*u+o*d-a*l,t[s+3]=c*g-o*l-a*d-h*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,e,n){return this._x=t,this._y=s,this._z=e,this._w=n,this._onChangeCallback(),this}clone(){return new ht(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t.x,n=t.y,i=t.z,r=t.order,o=Math.cos,a=Math.sin,h=o(e/2),c=o(n/2),l=o(i/2),d=a(e/2),u=a(n/2),g=a(i/2);switch(r){case"XYZ":this._x=d*c*l+h*u*g,this._y=h*u*l-d*c*g,this._z=h*c*g+d*u*l,this._w=h*c*l-d*u*g;break;case"YXZ":this._x=d*c*l+h*u*g,this._y=h*u*l-d*c*g,this._z=h*c*g-d*u*l,this._w=h*c*l+d*u*g;break;case"ZXY":this._x=d*c*l-h*u*g,this._y=h*u*l+d*c*g,this._z=h*c*g+d*u*l,this._w=h*c*l-d*u*g;break;case"ZYX":this._x=d*c*l-h*u*g,this._y=h*u*l+d*c*g,this._z=h*c*g-d*u*l,this._w=h*c*l+d*u*g;break;case"YZX":this._x=d*c*l+h*u*g,this._y=h*u*l+d*c*g,this._z=h*c*g-d*u*l,this._w=h*c*l-d*u*g;break;case"XZY":this._x=d*c*l-h*u*g,this._y=h*u*l-d*c*g,this._z=h*c*g+d*u*l,this._w=h*c*l+d*u*g;break}return s===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const e=s/2,n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,e=s[0],n=s[4],i=s[8],r=s[1],o=s[5],a=s[9],h=s[2],c=s[6],l=s[10],d=e+o+l;if(d>0){const u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(c-a)*u,this._y=(i-h)*u,this._z=(r-n)*u}else if(e>o&&e>l){const u=2*Math.sqrt(1+e-o-l);this._w=(c-a)/u,this._x=.25*u,this._y=(n+r)/u,this._z=(i+h)/u}else if(o>l){const u=2*Math.sqrt(1+o-e-l);this._w=(i-h)/u,this._x=(n+r)/u,this._y=.25*u,this._z=(a+c)/u}else{const u=2*Math.sqrt(1+l-e-o);this._w=(r-n)/u,this._x=(i+h)/u,this._y=(a+c)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let e=t.dot(s)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=e),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Y(this.dot(t),-1,1)))}rotateTowards(t,s){const e=this.angleTo(t);if(e===0)return this;const n=Math.min(1,s/e);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const e=t._x,n=t._y,i=t._z,r=t._w,o=s._x,a=s._y,h=s._z,c=s._w;return this._x=e*c+r*o+n*h-i*a,this._y=n*c+r*a+i*o-e*h,this._z=i*c+r*h+e*a-n*o,this._w=r*c-e*o-n*a-i*h,this._onChangeCallback(),this}slerp(t,s){if(s===0)return this;if(s===1)return this.copy(t);const e=this._x,n=this._y,i=this._z,r=this._w;let o=r*t._w+e*t._x+n*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=r,this._x=e,this._y=n,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const u=1-s;return this._w=u*r+s*this._w,this._x=u*e+s*this._x,this._y=u*n+s*this._y,this._z=u*i+s*this._z,this.normalize(),this}const h=Math.sqrt(a),c=Math.atan2(h,o),l=Math.sin((1-s)*c)/h,d=Math.sin(s*c)/h;return this._w=r*l+this._w*d,this._x=e*l+this._x*d,this._y=n*l+this._y*d,this._z=i*l+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,s,e){return this.copy(t).slerp(s,e)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(s),i*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const T=class T{constructor(t,s,e){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:i,y:r,z:o}=t;this.x=i,this.y=r,this.z=o||0;return}if(n===3){this.x=t,this.y=s,this.z=e;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}set(t,s,e){return e===void 0&&(e=this.z),this.x=t,this.y=s,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new T(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(fs.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(fs.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[3]*e+i[6]*n,this.y=i[1]*s+i[4]*e+i[7]*n,this.z=i[2]*s+i[5]*e+i[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const s=this.x,e=this.y,n=this.z,i=t.elements,r=1/(i[3]*s+i[7]*e+i[11]*n+i[15]);return this.x=(i[0]*s+i[4]*e+i[8]*n+i[12])*r,this.y=(i[1]*s+i[5]*e+i[9]*n+i[13])*r,this.z=(i[2]*s+i[6]*e+i[10]*n+i[14])*r,this}applyQuaternion(t){const s=this.x,e=this.y,n=this.z,i=t.x,r=t.y,o=t.z,a=t.w,h=2*(r*n-o*e),c=2*(o*s-i*n),l=2*(i*e-r*s);return this.x=s+a*h+r*l-o*c,this.y=e+a*c+o*h-i*l,this.z=n+a*l+i*c-r*h,this}transformDirection(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[4]*e+i[8]*n,this.y=i[1]*s+i[5]*e+i[9]*n,this.z=i[2]*s+i[6]*e+i[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this.z=Math.max(t.z,Math.min(s.z,this.z)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this.z=Math.max(t,Math.min(s,this.z)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const s=this.dot(t),e=this.length(),n=t.length();return Math.abs(s)===e*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this.z=t.z+(s.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const e=t.x,n=t.y,i=t.z,r=s.x,o=s.y,a=s.z;return this.x=n*a-i*o,this.y=i*r-e*a,this.z=e*o-n*r,this}projectOnVector(t){const s=t.lengthSq();if(s===0)return this.set(0,0,0);const e=t.dot(this)/s;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return vt.copy(this).projectOnVector(t),this.sub(vt)}reflect(t){return this.sub(vt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return s*s+e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=e,this.z=n,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,s*4)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,s*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=Math.random()*2-1,e=Math.sqrt(1-s*s);return this.x=e*Math.cos(t),this.y=s,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};T.ORIGIN=Object.freeze(new T(0,0,0)),T.X_AXIS=Object.freeze(new T(1,0,0)),T.NEGATIVE_X_AXIS=Object.freeze(new T(-1,0,0)),T.Y_AXIS=Object.freeze(new T(0,1,0)),T.NEGATIVE_Y_AXIS=Object.freeze(new T(0,-1,0)),T.Z_AXIS=Object.freeze(new T(0,0,1)),T.NEGATIVE_Z_AXIS=Object.freeze(new T(0,0,-1));let _=T;const vt=new _,fs=new ht,xt=class xt{constructor(t,s,e,n,i,r,o,a,h,c,l,d,u,g,y,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&o!=null&&a!=null&&h!=null&&c!=null&&l!=null&&d!=null&&u!=null&&g!=null&&y!=null&&x!=null&&this.set(t,s,e,n,i,r,o,a,h,c,l,d,u,g,y,x)}set(t,s,e,n,i,r,o,a,h,c,l,d,u,g,y,x){const A=this.elements;return A[0]=t,A[4]=s,A[8]=e,A[12]=n,A[1]=i,A[5]=r,A[9]=o,A[13]=a,A[2]=h,A[6]=c,A[10]=l,A[14]=d,A[3]=u,A[7]=g,A[11]=y,A[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new xt().fromArray(this.elements)}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],this}copyPosition(t){const s=this.elements,e=t.elements;return s[12]=e[12],s[13]=e[13],s[14]=e[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Vt.equalPoint3d(t,_.Z_AXIS))this.identity();else{const s=new _(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?s.crossVectors(_.Y_AXIS,t).normalize():s.crossVectors(_.Z_AXIS,t).normalize();const e=t.clone().cross(s).normalize();this.set(s.x,s.y,s.z,0,e.x,e.y,e.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,s,e){return t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}makeBasis(t,s,e){return this.set(t.x,s.x,e.x,0,t.y,s.y,e.y,0,t.z,s.z,e.z,0,0,0,0,1),this}extractRotation(t){const s=this.elements,e=t.elements,n=1/tt.setFromMatrixColumn(t,0).length(),i=1/tt.setFromMatrixColumn(t,1).length(),r=1/tt.setFromMatrixColumn(t,2).length();return s[0]=e[0]*n,s[1]=e[1]*n,s[2]=e[2]*n,s[3]=0,s[4]=e[4]*i,s[5]=e[5]*i,s[6]=e[6]*i,s[7]=0,s[8]=e[8]*r,s[9]=e[9]*r,s[10]=e[10]*r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Rs,t,Ts)}lookAt(t,s,e){const n=this.elements;return U.subVectors(t,s),U.lengthSq()===0&&(U.z=1),U.normalize(),G.crossVectors(e,U),G.lengthSq()===0&&(Math.abs(e.z)===1?U.x+=1e-4:U.z+=1e-4,U.normalize(),G.crossVectors(e,U)),G.normalize(),At.crossVectors(U,G),n[0]=G.x,n[4]=At.x,n[8]=U.x,n[1]=G.y,n[5]=At.y,n[9]=U.y,n[2]=G.z,n[6]=At.z,n[10]=U.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],o=e[4],a=e[8],h=e[12],c=e[1],l=e[5],d=e[9],u=e[13],g=e[2],y=e[6],x=e[10],A=e[14],M=e[3],p=e[7],S=e[11],C=e[15],k=n[0],w=n[4],R=n[8],E=n[12],V=n[1],v=n[5],et=n[9],wt=n[13],zt=n[2],Mt=n[6],Pt=n[10],bt=n[14],Ct=n[3],St=n[7],Et=n[11],It=n[15];return i[0]=r*k+o*V+a*zt+h*Ct,i[4]=r*w+o*v+a*Mt+h*St,i[8]=r*R+o*et+a*Pt+h*Et,i[12]=r*E+o*wt+a*bt+h*It,i[1]=c*k+l*V+d*zt+u*Ct,i[5]=c*w+l*v+d*Mt+u*St,i[9]=c*R+l*et+d*Pt+u*Et,i[13]=c*E+l*wt+d*bt+u*It,i[2]=g*k+y*V+x*zt+A*Ct,i[6]=g*w+y*v+x*Mt+A*St,i[10]=g*R+y*et+x*Pt+A*Et,i[14]=g*E+y*wt+x*bt+A*It,i[3]=M*k+p*V+S*zt+C*Ct,i[7]=M*w+p*v+S*Mt+C*St,i[11]=M*R+p*et+S*Pt+C*Et,i[15]=M*E+p*wt+S*bt+C*It,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[4],n=t[8],i=t[12],r=t[1],o=t[5],a=t[9],h=t[13],c=t[2],l=t[6],d=t[10],u=t[14],g=t[3],y=t[7],x=t[11],A=t[15];return g*(+i*a*l-n*h*l-i*o*d+e*h*d+n*o*u-e*a*u)+y*(+s*a*u-s*h*d+i*r*d-n*r*u+n*h*c-i*a*c)+x*(+s*h*l-s*o*u-i*r*l+e*r*u+i*o*c-e*h*c)+A*(-n*o*c-s*a*l+s*o*d+n*r*l-e*r*d+e*a*c)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,e){const n=this.elements;return t instanceof _?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=s,n[14]=e),this}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],o=t[5],a=t[6],h=t[7],c=t[8],l=t[9],d=t[10],u=t[11],g=t[12],y=t[13],x=t[14],A=t[15],M=l*x*h-y*d*h+y*a*u-o*x*u-l*a*A+o*d*A,p=g*d*h-c*x*h-g*a*u+r*x*u+c*a*A-r*d*A,S=c*y*h-g*l*h+g*o*u-r*y*u-c*o*A+r*l*A,C=g*l*a-c*y*a-g*o*d+r*y*d+c*o*x-r*l*x,k=s*M+e*p+n*S+i*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/k;return t[0]=M*w,t[1]=(y*d*i-l*x*i-y*n*u+e*x*u+l*n*A-e*d*A)*w,t[2]=(o*x*i-y*a*i+y*n*h-e*x*h-o*n*A+e*a*A)*w,t[3]=(l*a*i-o*d*i-l*n*h+e*d*h+o*n*u-e*a*u)*w,t[4]=p*w,t[5]=(c*x*i-g*d*i+g*n*u-s*x*u-c*n*A+s*d*A)*w,t[6]=(g*a*i-r*x*i-g*n*h+s*x*h+r*n*A-s*a*A)*w,t[7]=(r*d*i-c*a*i+c*n*h-s*d*h-r*n*u+s*a*u)*w,t[8]=S*w,t[9]=(g*l*i-c*y*i-g*e*u+s*y*u+c*e*A-s*l*A)*w,t[10]=(r*y*i-g*o*i+g*e*h-s*y*h-r*e*A+s*o*A)*w,t[11]=(c*o*i-r*l*i-c*e*h+s*l*h+r*e*u-s*o*u)*w,t[12]=C*w,t[13]=(c*y*n-g*l*n+g*e*d-s*y*d-c*e*x+s*l*x)*w,t[14]=(g*o*n-r*y*n-g*e*a+s*y*a+r*e*x-s*o*x)*w,t[15]=(r*l*n-c*o*n+c*e*a-s*l*a-r*e*d+s*o*d)*w,this}scale(t){const s=this.elements,e=t.x,n=t.y,i=t.z;return s[0]*=e,s[4]*=n,s[8]*=i,s[1]*=e,s[5]*=n,s[9]*=i,s[2]*=e,s[6]*=n,s[10]*=i,s[3]*=e,s[7]*=n,s[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,e,n))}makeTranslation(t,s,e){return t instanceof _?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,e,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,s,-e,0,0,e,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,0,e,0,0,1,0,0,-e,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,0,e,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const e=Math.cos(s),n=Math.sin(s),i=1-e,r=t.x,o=t.y,a=t.z,h=i*r,c=i*o;return this.set(h*r+e,h*o-n*a,h*a+n*o,0,h*o+n*a,c*o+e,c*a-n*r,0,h*a-n*o,c*a+n*r,i*a*a+e,0,0,0,0,1),this}makeScale(t,s,e){return this.set(t,0,0,0,0,s,0,0,0,0,e,0,0,0,0,1),this}makeShear(t,s,e,n,i,r){return this.set(1,e,i,0,t,1,r,0,s,n,1,0,0,0,0,1),this}compose(t,s,e){const n=this.elements,i=s.x,r=s.y,o=s.z,a=s.w,h=i+i,c=r+r,l=o+o,d=i*h,u=i*c,g=i*l,y=r*c,x=r*l,A=o*l,M=a*h,p=a*c,S=a*l,C=e.x,k=e.y,w=e.z;return n[0]=(1-(y+A))*C,n[1]=(u+S)*C,n[2]=(g-p)*C,n[3]=0,n[4]=(u-S)*k,n[5]=(1-(d+A))*k,n[6]=(x+M)*k,n[7]=0,n[8]=(g+p)*w,n[9]=(x-M)*w,n[10]=(1-(d+y))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,s,e){const n=this.elements;let i=tt.set(n[0],n[1],n[2]).length();const r=tt.set(n[4],n[5],n[6]).length(),o=tt.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],X.copy(this);const h=1/i,c=1/r,l=1/o;return X.elements[0]*=h,X.elements[1]*=h,X.elements[2]*=h,X.elements[4]*=c,X.elements[5]*=c,X.elements[6]*=c,X.elements[8]*=l,X.elements[9]*=l,X.elements[10]*=l,s.setFromRotationMatrix(X),e.x=i,e.y=r,e.z=o,this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<16;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<16;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t[s+9]=e[9],t[s+10]=e[10],t[s+11]=e[11],t[s+12]=e[12],t[s+13]=e[13],t[s+14]=e[14],t[s+15]=e[15],t}};xt.IDENTITY=Object.freeze(new xt);let $=xt;const tt=new _,X=new $,Rs=new _(0,0,0),Ts=new _(1,1,1),G=new _,At=new _,U=new _;class D{constructor(t=void 0,s=void 0){this.min=t==null?new _(1/0,1/0,1/0):new _(t.x,t.y,t.z),this.max=s==null?new _(-1/0,-1/0,-1/0):new _(s.x,s.y,s.z)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromArray(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s+=3)this.expandByPoint(Xt.fromArray(t,s));return this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=Xt.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new D().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let s,e;return t.normal.x>0?(s=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(s=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(s+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(s+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(s+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(s+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),s<=-t.constant&&e>=-t.constant}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Xt).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Z[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Z[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Z[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Z[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Z[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Z[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Z[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Z[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Z),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Z=[new _,new _,new _,new _,new _,new _,new _,new _],Xt=new _,ps=new B;class q{constructor(t=void 0,s=void 0){this.min=t==null?new B(1/0,1/0):new B(t.x,t.y),this.max=s==null?new B(-1/0,-1/0):new B(s.x,s.y)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=ps.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new q().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new B(0,0):new B(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new B(0,0):new B(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ps).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const ws=new _,Ns=new _,js=new J;class at{constructor(t=new _(1,0,0),s=0){this.normal=t,this.constant=s}set(t,s){return this.normal.copy(t),this.constant=s,this}setComponents(t,s,e,n){return this.normal.set(t,s,e),this.constant=n,this}setFromNormalAndCoplanarPoint(t,s){return this.normal.copy(t),this.constant=-s.dot(this.normal),this}setFromCoplanarPoints(t,s,e){const n=ws.subVectors(e,s).cross(Ns.subVectors(t,s)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,s){return s.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,s){const e=s||js.getNormalMatrix(t),n=this.coplanarPoint(ws).applyMatrix4(t),i=this.normal.applyMatrix3(e).normalize();return this.constant=-n.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new at().copy(this)}}class b extends B{clone(){return new b(this.x,this.y)}static pointArrayToNumberArray(t){const s=new Array(t.length*2);return t.forEach((e,n)=>{e.toArray(s,n*2)}),s}}class z extends _{clone(){return new z(this.x,this.y,this.z)}static pointArrayToNumberArray(t,s=!0){const e=s?3:2,n=new Array(t.length*e);return t.forEach((i,r)=>{i.toArray(n,r*e)}),n}}const zs=new $,Ms=new ht,_t=class _t{constructor(t=0,s=0,e=0,n=_t.DEFAULT_ORDER){this._x=t,this._y=s,this._z=e,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,s,e,n=this._order){return this._x=t,this._y=s,this._z=e,this._order=n,this._onChangeCallback(),this}clone(){return new _t(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,s=this._order,e=!0){const n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],h=n[5],c=n[9],l=n[2],d=n[6],u=n[10];switch(s){case"XYZ":this._y=Math.asin(Y(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-r,i)):(this._x=Math.atan2(d,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Y(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-l,i),this._z=0);break;case"ZXY":this._x=Math.asin(Y(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-l,u),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-Y(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(Y(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-l,i)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Y(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(d,h),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-c,u),this._y=0);break}return this._order=s,e===!0&&this._onChangeCallback(),this}setFromQuaternion(t,s,e=!0){return zs.makeRotationFromQuaternion(t),this.setFromRotationMatrix(zs,s,e)}setFromVector3(t,s=this._order){return this.set(t.x,t.y,t.z,s)}reorder(t){return Ms.setFromEuler(this),this.setFromQuaternion(Ms,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};_t.DEFAULT_ORDER="XYZ";let Dt=_t;class Ps{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Yt extends Ps{translate(t){return this.transform(new J().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Zt extends Yt{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new q}transform(t){return this._loops.forEach(s=>{s.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){const t=new Zt;return this._loops.forEach(s=>{t.add(s.clone())}),t}getPoints(t){const s=[];for(let e=0;e<this.loops.length;++e){const i=this.loops[e].getPoints(t);s.push(i)}return s}buildHierarchy(){var o;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),e=this.sortBoundaryBoxesByAreas(s),n=new Map,i=e.length;for(let a=0;a<i;a++)n.set(e[a],{index:e[a],children:[]});const r={index:-1,children:[]};for(let a=0;a<i;a++){const h=e[a],c=t[h],l=s[h];let d=a+1;for(;d<i;d++){const u=e[d],g=t[u];if(s[u].containsBox(l)&&ys.isPointInPolygon(c[P.randInt(0,c.length-1)],g)){(o=n.get(u))==null||o.children.push(n.get(h));break}}d===i&&r.children.push(n.get(h))}return r}get area(){if(this._loops.length===0)return 0;let t=0;for(let s=0;s<this._loops.length;s++){const n=this._loops[s].getPoints(128),i=this.polygonArea(n);s===0?t+=Math.abs(i):t-=Math.abs(i)}return t}polygonArea(t){const s=t.length;if(s<3)return 0;let e=0;for(let n=0,i=s-1;n<s;i=n++){const r=t[i],o=t[n];e+=r.x*o.y-o.x*r.y}return e*.5}calculateBoundaryBoxes(t){const s=[];return t.forEach(e=>{s.push(new q().setFromPoints(e))}),s}sortBoundaryBoxesByAreas(t){const s=[];t.forEach((n,i)=>{const r=n.size,o=r.width*r.height;s.push({area:o,index:i})}),s.sort((n,i)=>n.area-i.area);const e=[];return s.forEach(n=>{e.push(n.index)}),e}}class st extends Yt{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const s=this.getUtoTmapping(t);return this.getPoint(s)}getPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}getSpacedPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPointAt(e/t));return s}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const s=[];let e,n=this.getPoint(0),i=0;s.push(0);for(let r=1;r<=t;r++)e=this.getPoint(r/t),i+=e.distanceTo(n),s.push(i),n=e;return s}getUtoTmapping(t,s){const e=this.getLengths();let n=0;const i=e.length;let r;s?r=s:r=t*e[i-1];let o=0,a=i-1,h;for(;o<=a;)if(n=Math.floor(o+(a-o)/2),h=e[n]-r,h<0)o=n+1;else if(h>0)a=n-1;else{a=n;break}if(n=a,e[n]===r)return n/(i-1);const c=e[n],d=e[n+1]-c,u=(r-c)/d;return(n+u)/(i-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const i=this.getPoint(e),r=this.getPoint(n),o=new b;return o.copy(r).sub(i).normalize(),o}getTangentAt(t){const s=this.getUtoTmapping(t);return this.getTangent(s)}}class O extends st{constructor(t,s,e,n,i){super();const r=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(i!==void 0);if(r==3)typeof t=="object"&&typeof s=="object"&&typeof e=="object"?this.createByThreePoints(t,s,e):this.createByStartEndPointsAndBulge(t,s,e);else if(r==5){const o=t;this.center=new b(o.x,o.y),this.radius=s,this._clockwise=i,this._startAngle=this._clockwise?this._mirrorAngle(P.normalizeAngle(e)):P.normalizeAngle(e),this._endAngle=this._clockwise?this._mirrorAngle(P.normalizeAngle(n)):P.normalizeAngle(n)}else throw N.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(t,s,e){const n=(w,R)=>({x:(w.x+R.x)/2,y:(w.y+R.y)/2}),i=(w,R)=>(R.y-w.y)/(R.x-w.x),r=w=>-1/w,o=n(t,s),a=n(s,e),h=i(t,s),c=i(s,e),l=r(h),d=r(c),u=(w,R,E,V)=>{const v=(V-R)/(w-E),et=w*v+R;return{x:v,y:et}},g=o.y-l*o.x,y=a.y-d*a.x,x=u(l,g,d,y),A=Math.sqrt(Math.pow(t.x-x.x,2)+Math.pow(t.y-x.y,2)),M=(w,R)=>Math.atan2(w.y-R.y,w.x-R.x),p=M(t,x),S=M(s,x),C=M(e,x),k=C>p&&C<S||p>C&&p<S||S>C&&S<p;this.center=x,this.radius=A,this._clockwise=!k,this._startAngle=p,this._endAngle=C}createByStartEndPointsAndBulge(t,s,e){let n,i,r;e<0?(n=Math.atan(-e)*4,i=new B(t),r=new B(s)):(n=Math.atan(e)*4,i=new B(s),r=new B(t));const o=new B().subVectors(r,i),a=o.length(),h=new B().addVectors(i,o.multiplyScalar(.5)),c=Math.abs(a/2/Math.tan(n/2)),l=o.normalize(),d=e<0?-Math.PI/2:Math.PI/2,u=new B(l.x*Math.cos(d)-l.y*Math.sin(d),l.y*Math.cos(d)+l.x*Math.sin(d));let g;n<Math.PI?e<0?g=h.add(u.multiplyScalar(c)):g=h.add(u.multiplyScalar(-c)):e<0?g=h.add(u.multiplyScalar(-c)):g=h.add(u.multiplyScalar(c)),e<0?(this._startAngle=Math.atan2(i.y-g.y,i.x-g.x),this._endAngle=Math.atan2(r.y-g.y,r.x-g.x)):(this._startAngle=Math.atan2(r.y-g.y,r.x-g.x),this._endAngle=Math.atan2(i.y-g.y,i.x-g.x)),this._clockwise=e<0,this.center=g,this.radius=r.sub(g).length()}get center(){return this._center}set center(t){this._center=new b(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(P.normalizeAngle(t)):P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const s=this.startAngle==0&&t==I?t:P.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(s):s,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),s=this._getInternalAngle(this.endAngle);return this.clockwise?P.normalizeAngle(t-s):P.normalizeAngle(s-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),s=this._clockwise?P.normalizeAngle(t-this.deltaAngle/2):P.normalizeAngle(t+this.deltaAngle/2),e=this._clockwise?this._mirrorAngle(s):s;return this.getPointAtAngle(e)}get closed(){const t=this._getInternalAngle(this.startAngle),s=this._getInternalAngle(this.endAngle);return Math.abs(s-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of s){const r=this._getInternalAngle(i);P.isBetweenAngle(r,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(i))}const e=t.map(i=>i.x),n=t.map(i=>i.y);return new q(new b(Math.min(...e),Math.min(...n)),new b(Math.max(...e),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){const s=t,e=this.center.clone().applyMatrix2d(s),n=this.startPoint.clone().applyMatrix2d(s);if(this.closed)return this.center=e,this.radius=e.distanceTo(n),this._startAngle=Math.atan2(n.y-e.y,n.x-e.x),this._endAngle=this._startAngle,this._clockwise=s.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;const i=this.midPoint.clone().applyMatrix2d(s),r=this.endPoint.clone().applyMatrix2d(s),o=new O(n,i,r),a=s.determinant()<0?!this.clockwise:this.clockwise,h=c=>{const l=P.normalizeAngle(c);return a?this._mirrorAngle(l):l};return this.center=o.center,this.radius=o.radius,this.clockwise=a,this.startAngle=h(Math.atan2(n.y-o.center.y,n.x-o.center.x)),this.endAngle=h(Math.atan2(r.y-o.center.y,r.x-o.center.x)),this._boundingBoxNeedsUpdate=!0,this}clone(){return new O(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const s=this._getInternalAngle(t),e=this.center.x+this.radius*Math.cos(s),n=this.center.y+this.radius*Math.sin(s);return new b(e,n)}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this._getInternalAngle(this.startAngle);if(this.closed&&(e=I,n=0),this.clockwise)for(let i=0;i<=t;i++){const r=n-e*(i/t),o=this._clockwise?this._mirrorAngle(r):r,a=this.getPointAtAngle(o);s.push(new b(a.x,a.y))}else for(let i=0;i<=t;i++){const r=n+e*(i/t),o=this._clockwise?this._mirrorAngle(r):r,a=this.getPointAtAngle(o);s.push(new b(a.x,a.y))}return s}}class Ls extends Ps{translate(t){return this.transform(new $().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class ct extends Ls{}class lt extends ct{constructor(t,s){super(),this._start=new z(t),this._end=new z(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new _().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new z((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,s){return this.delta(s).multiplyScalar(t).add(this._start)}atLength(t,s=!1){if(s){const e=this.delta(W).normalize();return new z(this._start).addScaledVector(e,t)}else{const e=this.delta(W).normalize();return new z(this._end).addScaledVector(e,t)}}extend(t,s=!1){if(s){const e=W.subVectors(this._start,this._end).normalize();this._start=new z(this._start).addScaledVector(e,t)}else{const e=this.delta(W).normalize();this._end=new z(this._end).addScaledVector(e,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,s){bs.subVectors(t,this._start),ft.subVectors(this.endPoint,this.startPoint);const e=ft.dot(ft);let i=ft.dot(bs)/e;return s&&(i=P.clamp(i,0,1)),i}closestPointToPoint(t,s,e){const n=this.closestPointToPointParameter(t,s);return this.delta(e).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const s=this.direction,n=W.subVectors(t,this.startPoint).dot(s);return new z().copy(s).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const s=this.direction,e=this.startPoint,i=W.subVectors(t,e).dot(s),r=W.copy(s).multiplyScalar(i);return new z().addVectors(e,r)}calculateBoundingBox(){const t=new z(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),s=new z(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 D(t,s)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new lt(this._start.clone(),this._end.clone())}}const W=new _,bs=new _,ft=new _;class ut extends ct{static computeCenterPoint(t,s,e){const n=new _().addVectors(t,s).multiplyScalar(.5),i=new _().addVectors(t,e).multiplyScalar(.5),r=new _().subVectors(s,t),o=new _().subVectors(e,t),a=new _().crossVectors(r,o).normalize();if(a.lengthSq()===0)return null;const h=new _().crossVectors(r,a).normalize(),c=new _().crossVectors(o,a).normalize(),l=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),u=new lt(n,n.clone().add(l)),g=new lt(i,i.clone().add(d)),y=new _;return u.closestPointToPoint(g.startPoint,!0,y)?y:null}static createByThreePoints(t,s,e){const n=ut.computeCenterPoint(t,s,e);if(n){const i=n.distanceTo(t),r=new _().subVectors(t,n),o=new _().subVectors(s,n),a=Math.atan2(r.y,r.x),h=Math.atan2(o.y,o.x);return new ut(n,i,a,h,_.Z_AXIS)}}constructor(t,s,e,n,i,r=_.X_AXIS){super(),this.center=t,this.radius=s,this.startAngle=e,this.endAngle=n,this.normal=i,this.refVec=r,(n-e)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=e,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new z(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return P.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new _(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,s=this.deltaAngle;this.closed&&(t=0,s=I);const e=t+s*.5;return this.getPointAtAngle(e)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const s=new _(t.x,t.y,t.z||0),e=this.center,n=this.normal,r=s.clone().sub(e).dot(n),a=s.clone().sub(n.clone().multiplyScalar(r)).clone().sub(e);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const h=e.clone().add(a),c=this.getAngle(h.clone()),l=this.startAngle,d=this.deltaAngle;let u=P.normalizeAngle(c-l);u<0&&(u=0),u>d&&(u=d);const g=this.getPointAtAngle(l+u),y=g.distanceTo(s),x=this.startPoint.distanceTo(s),A=this.endPoint.distanceTo(s);return x<y&&x<=A?this.startPoint.clone():A<y&&A<x?this.endPoint.clone():g}tangentPoints(t){const s=[],e=new _(t.x,t.y,t.z||0),n=this.center,i=this.normal,r=this.radius,a=e.clone().sub(n).dot(i),h=e.clone().sub(i.clone().multiplyScalar(a)),c=n.clone(),d=h.clone().sub(c).length();if(d<r)return s;const u=Math.acos(r/d),g=this.getAngle(h.clone()),y=[g+u,g-u];for(const x of y){const A=P.normalizeAngle(x-this.startAngle);A>=0&&A<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+A))}return s}nearestTangentPoint(t){const s=this.tangentPoints(t);if(s.length===0)return null;const e=new z(t.x,t.y,t.z||0);return s.length===1||s[0].distanceTo(e)<s[1].distanceTo(e)?s[0]:s[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)P.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,o=-1/0;for(const a of t){const h=this.getPointAtAngle(a);h.x<s&&(s=h.x),h.y<e&&(e=h.y),h.z<n&&(n=h.z),h.x>i&&(i=h.x),h.y>r&&(r=h.y),h.z>o&&(o=h.z)}return new D({x:s,y:e,z:n},{x:i,y:r,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),o=this.getPointAtAngle(r);s.push(o)}return s}transform(t){const s=this.center.clone().applyMatrix4(t),e=this.startPoint.clone().applyMatrix4(t),n=this.endPoint.clone().applyMatrix4(t),i=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(t),r=new _(e).sub(s).normalize(),o=s.distanceTo(e);let a=new _().crossVectors(new _(e).sub(s),new _(i).sub(s)).normalize();a.lengthSq()===0&&(a=this.normal.clone().transformDirection(t));const h=c=>{const l=new _(c).sub(s);return Math.atan2(l.dot(Cs.crossVectors(a,r)),l.dot(r))};return this.center=s,this.radius=o,this.normal=a,this.refVec=r,this.startAngle=0,this.endAngle=this.closed?I:h(n),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ut(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Cs.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const s=this.normal,e=this.refVec,n={x:s.y*e.z-s.z*e.y,y:s.z*e.x-s.x*e.z,z:s.x*e.y-s.y*e.x},i=this.center,r=this.radius;return new z(i.x+r*(e.x*Math.cos(t)+n.x*Math.sin(t)),i.y+r*(e.y*Math.cos(t)+n.y*Math.sin(t)),i.z+r*(e.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new _(this.center).distanceTo(Lt);return new at(this.normal,t)}}const Cs=new _;class H extends st{constructor(t,s,e,n=0,i=I,r=!1,o=0){super(),this.center=t,this.majorAxisRadius=s,this.minorAxisRadius=e,(i-n)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=n,this.endAngle=i),this.clockwise=r,this.rotation=o}get center(){return this._center}set center(t){this._center=new z(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return P.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let s=1/0,e=1/0,n=-1/0,i=-1/0;for(let r=0;r<=100;r++){const o=this.getPoint(r/100);s=Math.min(s,o.x),e=Math.min(e,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y)}return new q({x:s,y:e},{x:n,y:i})}get closed(){return this.deltaAngle==0}getPoint(t){const s=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;for(;e<0;)e+=s;for(;e>s;)e-=s;e<Number.EPSILON&&(n?e=0:e=s),this.clockwise===!0&&!n&&(e===s?e=-s:e=e-s);const i=this.startAngle+t*e;let r=this.center.x+this.majorAxisRadius*Math.cos(i),o=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const a=Math.cos(this.rotation),h=Math.sin(this.rotation),c=r-this.center.x,l=o-this.center.y;r=c*a-l*h+this.center.x,o=c*h+l*a+this.center.y}return new b(r,o)}transform(t){const s=t,e=new b(this.center).applyMatrix2d(s),n=new z(e.x,e.y,this.center.z),i=this.getPointAtAngle(0).clone().applyMatrix2d(s),r=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(s),o=new b(i).sub(e),a=new b(r).sub(e),h=o.length(),c=a.length(),l=Math.atan2(o.y,o.x),d=o.clone().normalize(),u=a.clone().normalize(),g=A=>{const M=new b(A).sub(e),p=M.dot(d),S=M.dot(u);return P.normalizeAngle(Math.atan2(S/c,p/h))},y=s.determinant()<0?!this.clockwise:this.clockwise,x=this.closed?new H(n,h,c,0,I,y,l):new H(n,h,c,g(this.startPoint.clone().applyMatrix2d(s)),g(this.endPoint.clone().applyMatrix2d(s)),y,l);return this.center=x.center,this.majorAxisRadius=x.majorAxisRadius,this.minorAxisRadius=x.minorAxisRadius,this._startAngle=x._startAngle,this._endAngle=x._endAngle,this._clockwise=x._clockwise,this.rotation=x.rotation,this._boundingBoxNeedsUpdate=!0,this}getPointAtAngle(t){return this.getPoint(this.closed?t/I:P.normalizeAngle(t-this.startAngle)/this.deltaAngle)}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new H(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class dt extends ct{constructor(t,s,e,n,i,r=0,o=I){super(),this.center=t,this.normal=s,this.majorAxis=e,this.majorAxisRadius=n,this.minorAxisRadius=i;const a=Math.abs(o-r);Math.abs(a-I)<1e-10||Math.abs(a-2*I)<1e-10?(this.startAngle=0,this.endAngle=I):(this.startAngle=r,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new z(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-I)<1e-10?I:P.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new _(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new _().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,s=this.deltaAngle;(this.closed||Math.abs(s-I)<1e-10)&&(t=0,s=I);const e=t+s/2;return this.getPointAtAngle(e)}get isCircular(){return it.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,s=this.deltaAngle/t;let e=0,n=this.getPointAtAngle(this.startAngle);for(let i=1;i<=t;i++){const r=this.startAngle+i*s,o=this.getPointAtAngle(r),a=o.x-n.x,h=o.y-n.y,c=o.z-n.z;e+=Math.sqrt(a*a+h*h+c*c),n=o}return e}get area(){const t=this.majorAxisRadius,s=this.minorAxisRadius,e=this.startAngle,n=e+this.deltaAngle;if(Math.abs(this.deltaAngle-I)<1e-10)return Math.PI*t*s;const i=t*s/2*(n-e-(Math.sin(n)*Math.cos(n)-Math.sin(e)*Math.cos(e)));return Math.abs(i)}calculateBoundingBox(){if(this.majorAxis.equals(_.X_AXIS)||this.majorAxis.equals(_.Y_AXIS)||this.majorAxis.isParallelTo(_.X_AXIS)||this.majorAxis.isParallelTo(_.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)P.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,o=-1/0;for(const a of t){const h=this.getPointAtAngle(a);h.x<s&&(s=h.x),h.y<e&&(e=h.y),h.z<n&&(n=h.z),h.x>i&&(i=h.x),h.y>r&&(r=h.y),h.z>o&&(o=h.z)}return new D({x:s,y:e,z:n},{x:i,y:r,z:o})}else{let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,o=-1/0;for(let a=0;a<=100;a++){const h=this.startAngle+this.deltaAngle*(a/100),c=this.getPointAtAngle(h);s=Math.min(s,c.x),e=Math.min(e,c.y),n=Math.min(n,c.z),i=Math.max(i,c.x),r=Math.max(r,c.y),o=Math.max(o,c.z)}return new D({x:s,y:e,z:n},{x:i,y:r,z:o})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),o=this.getPointAtAngle(r);s.push(o)}return s}getPointAtAngle(t){const s=Math.cos(t),e=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e),i=this.majorAxis.clone().multiplyScalar(s*this.majorAxisRadius).add(n);return new z(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const s=new _(t).sub(this.center),e=s.dot(this.majorAxis),n=s.dot(this.minorAxis),i=e/this.majorAxisRadius,r=n/this.minorAxisRadius;return i*i+r*r<=1}transform(t){const s=t,e=this.center.clone().applyMatrix4(s),n=this.getPointAtAngle(0).clone().applyMatrix4(s),i=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(s),r=new _(n).sub(e),o=new _(i).sub(e),a=r.length(),h=o.length(),c=r.clone().normalize(),l=new _().crossVectors(r,o).normalize();let d=new _().crossVectors(l,c).normalize();d.dot(o)<0&&(l.negate(),d=new _().crossVectors(l,c).normalize());const u=y=>{const x=new _(y).sub(e),A=x.dot(c),M=x.dot(d);return P.normalizeAngle(Math.atan2(M/h,A/a))},g=this.closed?new dt(e,l,c,a,h,0,I):new dt(e,l,c,a,h,u(this.startPoint.clone().applyMatrix4(s)),u(this.endPoint.clone().applyMatrix4(s)));return this.center=g.center,this.normal=g.normal,this.majorAxis=g.majorAxis,this.majorAxisRadius=g.majorAxisRadius,this.minorAxisRadius=g.minorAxisRadius,this._startAngle=g._startAngle,this._endAngle=g._endAngle,this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new dt(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new _(this.center).distanceTo(Lt);return new at(this.normal,t)}}class Gt extends st{constructor(t=null,s=!1){super(),this._vertices=t||new Array,this._closed=s}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new b(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const s=this._vertices[0];return new b(s.x,s.y)}else{const s=this._vertices[t-1];return new b(s.x,s.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const s=this._vertices.length;for(let e=0;e<s;++e){const n=this._vertices[e];let i=null;if(e<s-1?i=this._vertices[e+1]:e==s-1&&this.closed&&(i=this._vertices[0]),i)if(n.bulge){const r=new O(n,i,n.bulge);t+=r.length}else t+=new b(n.x,n.y).distanceTo(i)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,s){t<=0?this._vertices.unshift(s):this._vertices.splice(t,0,s),this._boundingBoxNeedsUpdate=!0}removeVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error(`Index ${t} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0}reset(t,s){t?s!==void 0&&s>=0&&s<this._vertices.length&&(this._vertices=this._vertices.slice(0,s),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(t){const s=this._vertices[t];return new b(s.x,s.y)}calculateBoundingBox(){const t=this.getPoints(100);return new q().setFromPoints(t)}transform(t){const s=t.determinant()<0;return this._vertices.forEach(e=>{const n=new b(e).applyMatrix2d(t);e.x=n.x,e.y=n.y,s&&e.bulge!=null&&(e.bulge=-e.bulge)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Gt(this._vertices.map(t=>({...t})),this._closed)}getPoints3d(t,s){const e=[];return this.getPoints(t).forEach(i=>e.push(new z().set(i.x,i.y,s))),e}getPoints(t){const s=[],e=this._vertices.length;for(let n=0;n<e;++n){const i=this._vertices[n];if(i.bulge){let r=null;if(n<e-1?r=this._vertices[n+1]:n==e-1&&this.closed&&(r=this._vertices[0]),r){const a=new O(i,r,i.bulge).getPoints(t),h=a.length;for(let c=0;c<h;++c){const l=a[c];s.push(new b(l.x,l.y))}}}else s.push(new b(i.x,i.y)),n==e-1&&this.closed&&s.push(s[0])}return s}}class mt extends st{constructor(t,s){super(),this._start=new b(t),this._end=new b(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new b(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),s=new b(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new q(t,s)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new mt(this._start.clone(),this._end.clone())}}class F extends st{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}static buildFromEdges(t,s=.001){if(t.length===0)return[];const e=[...t],n=[],i=s*s,r=(o,a)=>{const h=o.x-a.x,c=o.y-a.y;return h*h+c*c<=i};for(;e.length>0;){const o=[],a=e.shift();o.push(a);const h=F.getEdgeStartPoint(a);let c=F.getEdgeEndPoint(a);if(!r(h,c))for(;e.length>0;){const l=F.findConnectingEdge(e,c,i);if(l.index<0)break;let d=e.splice(l.index,1)[0];if(l.reverse&&(d=F.reverseEdge(d)),o.push(d),c=F.getEdgeEndPoint(d),r(c,h))break}n.push(new F(o))}return n}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new b(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(s=>{t+=s.length}),t}calculateBoundingBox(){const t=this.getPoints(100),s=new q;return s.setFromPoints(t),s}transform(t){const s=new $().set(t.elements[0],t.elements[3],0,t.elements[6],t.elements[1],t.elements[4],0,t.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(e=>{e instanceof K?e.transform(s):e.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new F(this._curves.map(t=>t.clone()))}get closed(){return!0}getPoints(t){const s=[];return this.curves.forEach(e=>{e.getPoints(t).forEach(n=>{s.push(new b(n.x,n.y))})}),s}static findConnectingEdge(t,s,e){let n=-1,i=!1,r=Number.POSITIVE_INFINITY;for(let o=0;o<t.length;o++){const a=t[o],h=F.getEdgeStartPoint(a),c=F.getEdgeEndPoint(a),l=s.x-h.x,d=s.y-h.y,u=l*l+d*d;u<r&&(r=u,n=o,i=!1);const g=s.x-c.x,y=s.y-c.y,x=g*g+y*y;x<r&&(r=x,n=o,i=!0)}return r>e?{index:-1,reverse:!1}:{index:n,reverse:i}}static getEdgeStartPoint(t){const s=t.startPoint;return new b(s.x,s.y)}static getEdgeEndPoint(t){const s=t.endPoint;return new b(s.x,s.y)}static reverseEdge(t){return t instanceof mt?new mt(t.endPoint,t.startPoint):t instanceof O?new O(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof H?new H(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof K?F.reverseSplineEdge(t):t}static reverseSplineEdge(t){const s=[...t.controlPoints].reverse(),e=t.knots,n=e[0],i=e[e.length-1],r=e.map(h=>n+i-h).reverse(),o=t.weights,a=o.length>0?[...o].reverse():void 0;return new K(s,r,a,t.degree,t.closed)}}class Ot{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,s,e,n){this.c0=t,this.c1=e,this.c2=-3*t+3*s-2*e-n,this.c3=2*t-2*s+e+n}initCatmullRom(t,s,e,n,i){this.init(s,e,i*(e-t),i*(n-s))}initNonuniformCatmullRom(t,s,e,n,i,r,o){let a=(s-t)/i-(e-t)/(i+r)+(e-s)/r,h=(e-s)/r-(n-s)/(r+o)+(n-e)/o;a*=r,h*=r,this.init(s,e,a,h)}calc(t){const s=t*t,e=s*t;return this.c0+this.c1*t+this.c2*s+this.c3*e}}class pt extends ct{constructor(t=[],s=!1,e="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new _,this._px=new Ot,this._py=new Ot,this._pz=new Ot,this._points=t.map(i=>new z(i)),this._closed=s,this._curveType=e,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new z}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new z}get length(){if(this._points.length<2)return 0;let t=0;for(let s=1;s<this._points.length;s++)t+=this._points[s-1].distanceTo(this._points[s]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,s=new z){const e=s,n=this._points,i=n.length;if(i===0)return e.set(0,0,0);if(i===1)return e.copy(n[0]);const r=(i-(this._closed?0:1))*t;let o=Math.floor(r),a=r-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:a===0&&o===i-1&&(o=i-2,a=1);let h,c;this._closed||o>0?h=n[(o-1)%i]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),h=new z(this._tmp.x,this._tmp.y,this._tmp.z));const l=n[o%i],d=n[(o+1)%i];if(this._closed||o+2<i?c=n[(o+2)%i]:(this._tmp.subVectors(n[i-1],n[i-2]).add(n[i-1]),c=new z(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const u=this._curveType==="chordal"?.5:.25;let g=Math.pow(h.distanceToSquared(l),u),y=Math.pow(l.distanceToSquared(d),u),x=Math.pow(d.distanceToSquared(c),u);y<1e-4&&(y=1),g<1e-4&&(g=y),x<1e-4&&(x=y),this._px.initNonuniformCatmullRom(h.x,l.x,d.x,c.x,g,y,x),this._py.initNonuniformCatmullRom(h.y,l.y,d.y,c.y,g,y,x),this._pz.initNonuniformCatmullRom(h.z,l.z,d.z,c.z,g,y,x)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(h.x,l.x,d.x,c.x,this._tension),this._py.initCatmullRom(h.y,l.y,d.y,c.y,this._tension),this._pz.initCatmullRom(h.z,l.z,d.z,c.z,this._tension));return e.set(this._px.calc(a),this._py.calc(a),this._pz.calc(a)),e}getPoints(t){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}setPoints(t){this._points=t.map(s=>new z(s)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}clone(){return new pt(this._points.map(t=>t.clone()),this._closed,this._curveType,this._tension)}transform(t){return this._points=this._points.map(s=>{const e=new z;return e.copy(s),e.applyMatrix4(t),e}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new D;const t=new D;return this._points.forEach(s=>{t.expandByPoint(s)}),t}}class L{constructor(t,s,e,n){this._degree=t,this._knots=[...s],this._controlPoints=e.map(i=>({x:i.x,y:i.y,z:i.z})),this._weights=n?[...n]:new Array(e.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}clone(){return new L(this._degree,this._knots,this._controlPoints,this._weights)}point(t){const s=this._controlPoints.map(e=>[e.x,e.y,e.z]);return ot(t,this._degree,this._knots,s,this._weights)}length(){const t=this._controlPoints.map(s=>[s.x,s.y,s.z]);return As(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,s,e,n){return new L(t,s,e,n)}static byPoints(t,s,e="Uniform",n,i){const r=Ft(t,s,e,n,i),o=r.controlPoints.map(a=>({x:a[0],y:a[1],z:a[2]}));return new L(s,r.knots,o,r.weights)}getParameterRange(){const t=this._knots[this._degree],s=this._knots[this._knots.length-this._degree-1];return{start:t,end:s}}getPoints(t){const s=[],{start:e,end:n}=this.getParameterRange();for(let i=0;i<=t;i++){const r=e+(n-e)*(i/t);s.push(this.point(r))}return s}isClosed(t=1e-6){const{start:s,end:e}=this.getParameterRange(),n=this.point(s),i=this.point(e),r=n[0]-i[0],o=n[1]-i[1],a=n[2]-i[2];return Math.sqrt(r*r+o*o+a*a)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const s=new pt(t,!0,"centripetal"),e=Math.max(50,t.length*2);return s.getPoints(e)}static createClosedCurve(t,s,e="Chord"){const i=this.createFitPointsForClosedCurve(t).map(r=>[r.x,r.y,r.z]);return L.byPoints(i,s,e)}}class K extends ct{constructor(t,s,e,n,i,r){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(s)){if(o<2||o>5)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._controlPoints=t;let a,h=3,c=!1;if(o>=3&&(Array.isArray(e)?(a=e,o>=4&&(h=n||3),o>=5&&(c=i)):e!==void 0&&(h=e||3,o>=4&&(c=n))),e===void 0&&o>=4&&(h=n||3,o>=5&&(c=i)),this._degree=h,this._closed=c,this._controlPoints.length<this._degree+1)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._nurbsCurve=L.byKnotsControlPointsWeights(this._degree,s,this._controlPoints,a)}else{if(o<2||o>6)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._fitPoints=t,this._knotParameterization=s,o>=3&&(this._degree=e||3);const a=typeof n=="boolean";o>=4&&a&&(this._closed=n),a?(o>=5&&(this._startTangent=i),o>=6&&(this._endTangent=r)):(o>=4&&(this._startTangent=n),o>=5&&(this._endTangent=i)),this._closed&&(this._startTangent=void 0,this._endTangent=void 0);const h=(this._startTangent?1:0)+(this._endTangent?1:0);if(this._fitPoints.length+h<this._degree+1)throw N.AcCmErrors.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=L.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const c=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=L.byPoints(c,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(c=>[c.x,c.y,c.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=L.createFitPointsForClosedCurve(this._fitPoints),s=this.toNurbsPoints(t);this._nurbsCurve=L.byPoints(s,this._degree,this._knotParameterization)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=L.byPoints(t,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(t=>[t.x,t.y,t.z||0]))}else if(this._controlPoints)if(this._closed){const t=L.createFitPointsForClosedCurve(this._controlPoints),s=this.toNurbsPoints(t);this._nurbsCurve=L.byPoints(s,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(e=>[e.x,e.y,e.z||0]))}else{const t=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=L.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,s)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get fitPoints(){var t;return(t=this._fitPoints)==null?void 0:t.map(s=>({x:s.x,y:s.y,z:s.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[s],n=this._nurbsCurve.point(e);return new z(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[t.length-s-1],n=this._nurbsCurve.point(e);return new z(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const s=this._fitPoints.length,e=t<0||t>=s?s-1:t,n=this._fitPoints[e];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const s=this._controlPoints.length,e=t<0||t>=s?s-1:t;return this._controlPoints[e]}getPoints(t=100){const s=this._nurbsCurve,e=[],n=s.knots(),i=this._nurbsCurve.degree(),r=n[i],o=n[n.length-i-1],a=(o-r)/(t-1);for(let h=0;h<t;h++){const c=h===t-1?o:r+h*a,l=s.point(c);e.push(new z(l[0],l[1],l[2]))}return e}getCurvePoints(t,s){const e=[],n=t.knots(),i=t.degree(),r=n[i],a=(n[n.length-i-1]-r)/(s-1);for(let h=0;h<s;h++){const c=r+h*a;e.push(t.point(c))}return e}calculateBoundingBox(){const t=this.getPoints(100);return new D().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(s=>new z(s).applyMatrix4(t)),this._startTangent&&(this._startTangent=new z(this._startTangent).transformDirection(t)),this._endTangent&&(this._endTangent=new z(this._endTangent).transformDirection(t)),this.buildCurve();else{const s=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(n=>new z(n).applyMatrix4(t)),this._nurbsCurve=L.byKnotsControlPointsWeights(this._degree,s,this._controlPoints,e.length>0?e:void 0)}return this._boundingBoxNeedsUpdate=!0,this}clone(){return this._fitPoints&&this._knotParameterization?new K(this._fitPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._knotParameterization,this._degree,this._closed,this._startTangent?{x:this._startTangent.x,y:this._startTangent.y,z:this._startTangent.z||0}:void 0,this._endTangent?{x:this._endTangent.x,y:this._endTangent.y,z:this._endTangent.z||0}:void 0):new K(this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)}toNurbsPoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]=[e.x,e.y,e.z||0]}),s}toGePoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]={x:e[0],y:e[1],z:e[2]}}),s}toNurbsPoint(t){return[t.x,t.y,t.z||0]}static createClosedSpline(t,s="Uniform",e=3){if(t.length<e+1)throw new Error(`At least ${e+1} points are required for a degree ${e} closed spline`);return new K(t,s,e,!0)}}f.AcGeArea2d=Zt,f.AcGeBox2d=q,f.AcGeBox3d=D,f.AcGeCatmullRomCurve3d=pt,f.AcGeCircArc2d=O,f.AcGeCircArc3d=ut,f.AcGeCurve2d=st,f.AcGeEllipseArc2d=H,f.AcGeEllipseArc3d=dt,f.AcGeEuler=Dt,f.AcGeGeometryUtil=ys,f.AcGeLine2d=mt,f.AcGeLine3d=lt,f.AcGeLoop2d=F,f.AcGeMathUtil=P,f.AcGeMatrix2d=J,f.AcGeMatrix3d=$,f.AcGeNurbsCurve=L,f.AcGePlane=at,f.AcGePoint2d=b,f.AcGePoint3d=z,f.AcGePolyline2d=Gt,f.AcGeQuaternion=ht,f.AcGeShape2d=Yt,f.AcGeSpline3d=K,f.AcGeTol=it,f.AcGeVector2d=B,f.AcGeVector3d=_,f.DEFAULT_TOL=Vt,f.DEG2RAD=Bt,f.FLOAT_TOL=Q,f.ORIGIN_POINT_2D=Ss,f.ORIGIN_POINT_3D=Lt,f.RAD2DEG=kt,f.TAU=I,f.basisFunction=rt,f.calculateCurveLength=As,f.ceilPowerOfTwo=cs,f.clamp=Y,f.computeParameterValues=xs,f.damp=Ht,f.degToRad=os,f.euclideanModulo=Rt,f.evaluateNurbsPoint=ot,f.floorPowerOfTwo=ls,f.generateAveragedKnots=_s,f.generateChordKnots=Is,f.generateSqrtChordKnots=Bs,f.generateUUID=Qt,f.generateUniformKnots=Es,f.intPartLength=Nt,f.interpolateControlPoints=ks,f.interpolateNurbsCurve=Ft,f.inverseLerp=Wt,f.isBetween=us,f.isBetweenAngle=ds,f.isPointInPolygon=Ut,f.isPolygonIntersect=gs,f.isPowerOfTwo=as,f.lerp=Tt,f.mapLinear=$t,f.normalizeAngle=nt,f.pingpong=Jt,f.radToDeg=hs,f.randFloat=ns,f.randFloatSpread=is,f.randInt=es,f.relativeEps=ms,f.seededRandom=rs,f.smootherstep=ss,f.smoothstep=ts,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(A,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],N):(A=typeof globalThis<"u"?globalThis:A||self,N(A["geometry-engine"]={},A.common))})(this,function(A,N){"use strict";const V=["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 Wt=1234567;const Bt=Math.PI/180,kt=180/Math.PI;function $t(){const u=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,e=Math.random()*4294967295|0;return(V[u&255]+V[u>>8&255]+V[u>>16&255]+V[u>>24&255]+"-"+V[t&255]+V[t>>8&255]+"-"+V[t>>16&15|64]+V[t>>24&255]+"-"+V[s&63|128]+V[s>>8&255]+"-"+V[s>>16&255]+V[s>>24&255]+V[e&255]+V[e>>8&255]+V[e>>16&255]+V[e>>24&255]).toLowerCase()}function Y(u,t,s){return Math.max(t,Math.min(s,u))}function Rt(u,t){return(u%t+t)%t}function Ht(u,t,s,e,n){return e+(u-t)*(n-e)/(s-t)}function Jt(u,t,s){return u!==t?(s-u)/(t-u):0}function Tt(u,t,s){return(1-s)*u+s*t}function ts(u,t,s,e){return Tt(u,t,1-Math.exp(-s*e))}function ss(u,t=1){return t-Math.abs(Rt(u,t*2)-t)}function es(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*(3-2*u))}function ns(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*u*(u*(u*6-15)+10))}function is(u,t){return u+Math.floor(Math.random()*(t-u+1))}function rs(u,t){return u+Math.random()*(t-u)}function os(u){return u*(.5-Math.random())}function hs(u){u!==void 0&&(Wt=u);let t=Wt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function as(u){return u*Bt}function cs(u){return u*kt}function ls(u){return(u&u-1)===0&&u!==0}function us(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function ds(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function nt(u){const t=Math.PI*2;return(u%t+t)%t}function ms(u,t,s){return u>t&&u<s||u>s&&u<t}function gs(u,t,s,e=!1){return u=nt(u),t=nt(t),s=nt(s),e?t>s?u<=t&&u>=s:u<=t||u>=s:t<s?u>=t&&u<=s:u>=t||u<=s}function Nt(u){return u=Math.abs(u),u<1?0:Math.ceil(Math.log10(Math.abs(u)+1))}function ys(u,t=1e-7){const s=Nt(u);return Math.max(Math.pow(10,s)*t,t)}const P={DEG2RAD:Bt,RAD2DEG:kt,generateUUID:$t,clamp:Y,euclideanModulo:Rt,mapLinear:Ht,inverseLerp:Jt,lerp:Tt,damp:ts,pingpong:ss,smoothstep:es,smootherstep:ns,randInt:is,randFloat:rs,randFloatSpread:os,seededRandom:hs,degToRad:as,radToDeg:cs,isPowerOfTwo:ls,ceilPowerOfTwo:us,floorPowerOfTwo:ds,normalizeAngle:nt,isBetween:ms,isBetweenAngle:gs,intPartLength:Nt,relativeEps:ys},gt=class gt{constructor(t,s){this.x=0,this.y=0;const e=+(t!==void 0)+ +(s!==void 0);if(e!==0){if(e===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(e===1){const{x:n,y:i}=t;this.x=n,this.y=i;return}if(e===2){this.x=t,this.y=s;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new gt(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const s=this.x,e=this.y,n=t.elements;return this.x=n[0]*s+n[3]*e+n[6],this.y=n[1]*s+n[4]*e+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y;return s*s+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}rotateAround(t,s){const e=Math.cos(s),n=Math.sin(s),i=this.x-t.x,r=this.y-t.y;return this.x=i*e-r*n+t.x,this.y=i*n+r*e+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(P.relativeEps(this.x,t),P.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};gt.EMPTY=Object.freeze(new gt(0,0));let B=gt;const yt=class yt{constructor(t,s,e,n,i,r,o,a,h){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&o!=null&&a!=null&&h!=null&&this.set(t,s,e,n,i,r,o,a,h)}set(t,s,e,n,i,r,o,a,h){const c=this.elements;return c[0]=t,c[1]=n,c[2]=o,c[3]=s,c[4]=i,c[5]=a,c[6]=e,c[7]=r,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],this}extractBasis(t,s,e){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],o=e[3],a=e[6],h=e[1],c=e[4],l=e[7],m=e[2],d=e[5],g=e[8],y=n[0],x=n[3],f=n[6],M=n[1],p=n[4],S=n[7],C=n[2],k=n[5],w=n[8];return i[0]=r*y+o*M+a*C,i[3]=r*x+o*p+a*k,i[6]=r*f+o*S+a*w,i[1]=h*y+c*M+l*C,i[4]=h*x+c*p+l*k,i[7]=h*f+c*S+l*w,i[2]=m*y+d*M+g*C,i[5]=m*x+d*p+g*k,i[8]=m*f+d*S+g*w,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],o=t[5],a=t[6],h=t[7],c=t[8];return s*r*c-s*o*h-e*i*c+e*o*a+n*i*h-n*r*a}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],o=t[5],a=t[6],h=t[7],c=t[8],l=c*r-o*h,m=o*a-c*i,d=h*i-r*a,g=s*l+e*m+n*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/g;return t[0]=l*y,t[1]=(n*h-c*e)*y,t[2]=(o*e-n*r)*y,t[3]=m*y,t[4]=(c*s-n*a)*y,t[5]=(n*i-o*s)*y,t[6]=d*y,t[7]=(e*a-h*s)*y,t[8]=(r*s-e*i)*y,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t.elements[0]=s[0],t.elements[1]=s[3],t.elements[2]=s[6],t.elements[3]=s[1],t.elements[4]=s[4],t.elements[5]=s[7],t.elements[6]=s[2],t.elements[7]=s[5],t.elements[8]=s[8],this}setUvTransform(t,s,e,n,i,r,o){const a=Math.cos(i),h=Math.sin(i);return this.set(e*a,e*h,-e*(a*r+h*o)+r+t,-n*h,n*a,-n*(-h*r+a*o)+o+s,0,0,1),this}scale(t,s){return this.premultiply(Vt.makeScale(t,s)),this}rotate(t){return this.premultiply(Vt.makeRotation(-t)),this}translate(t,s){return this.premultiply(Vt.makeTranslation(t,s)),this}makeTranslation(t,s){return t instanceof B?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,e,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<9;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<9;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t}clone(){return new yt().fromArray(this.elements)}};yt.IDENTITY=Object.freeze(new yt);let J=yt;const Vt=new J,W=1e-6,I=2*Math.PI,Rs={x:0,y:0},jt={x:0,y:0,z:0};class it{constructor(){this.equalPointTol=W,this.equalVectorTol=W}clone(){const t=new it;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t}equalPoint2d(t,s){return new B(t).sub(s).length()<this.equalPointTol}equalPoint3d(t,s){return new _(t).sub(s).length()<this.equalPointTol}static equalToZero(t,s=W){return t<s&&t>-s}static equal(t,s,e=W){return Math.abs(t-s)<e}static great(t,s,e=W){return t-s>e}static less(t,s,e=W){return t-s<e}}const Lt=new it;class rt{constructor(t=0,s=0,e=0,n=1){this._x=t,this._y=s,this._z=e,this._w=n}static slerpFlat(t,s,e,n,i,r,o){let a=e[n+0],h=e[n+1],c=e[n+2],l=e[n+3];const m=i[r+0],d=i[r+1],g=i[r+2],y=i[r+3];if(o===0){t[s+0]=a,t[s+1]=h,t[s+2]=c,t[s+3]=l;return}if(o===1){t[s+0]=m,t[s+1]=d,t[s+2]=g,t[s+3]=y;return}if(l!==y||a!==m||h!==d||c!==g){let x=1-o;const f=a*m+h*d+c*g+l*y,M=f>=0?1:-1,p=1-f*f;if(p>Number.EPSILON){const C=Math.sqrt(p),k=Math.atan2(C,f*M);x=Math.sin(x*k)/C,o=Math.sin(o*k)/C}const S=o*M;if(a=a*x+m*S,h=h*x+d*S,c=c*x+g*S,l=l*x+y*S,x===1-o){const C=1/Math.sqrt(a*a+h*h+c*c+l*l);a*=C,h*=C,c*=C,l*=C}}t[s]=a,t[s+1]=h,t[s+2]=c,t[s+3]=l}static multiplyQuaternionsFlat(t,s,e,n,i,r){const o=e[n],a=e[n+1],h=e[n+2],c=e[n+3],l=i[r],m=i[r+1],d=i[r+2],g=i[r+3];return t[s]=o*g+c*l+a*d-h*m,t[s+1]=a*g+c*m+h*l-o*d,t[s+2]=h*g+c*d+o*m-a*l,t[s+3]=c*g-o*l-a*m-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,e,n){return this._x=t,this._y=s,this._z=e,this._w=n,this._onChangeCallback(),this}clone(){return new rt(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t.x,n=t.y,i=t.z,r=t.order,o=Math.cos,a=Math.sin,h=o(e/2),c=o(n/2),l=o(i/2),m=a(e/2),d=a(n/2),g=a(i/2);switch(r){case"XYZ":this._x=m*c*l+h*d*g,this._y=h*d*l-m*c*g,this._z=h*c*g+m*d*l,this._w=h*c*l-m*d*g;break;case"YXZ":this._x=m*c*l+h*d*g,this._y=h*d*l-m*c*g,this._z=h*c*g-m*d*l,this._w=h*c*l+m*d*g;break;case"ZXY":this._x=m*c*l-h*d*g,this._y=h*d*l+m*c*g,this._z=h*c*g+m*d*l,this._w=h*c*l-m*d*g;break;case"ZYX":this._x=m*c*l-h*d*g,this._y=h*d*l+m*c*g,this._z=h*c*g-m*d*l,this._w=h*c*l+m*d*g;break;case"YZX":this._x=m*c*l+h*d*g,this._y=h*d*l+m*c*g,this._z=h*c*g-m*d*l,this._w=h*c*l-m*d*g;break;case"XZY":this._x=m*c*l-h*d*g,this._y=h*d*l-m*c*g,this._z=h*c*g+m*d*l,this._w=h*c*l+m*d*g;break}return s===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const e=s/2,n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,e=s[0],n=s[4],i=s[8],r=s[1],o=s[5],a=s[9],h=s[2],c=s[6],l=s[10],m=e+o+l;if(m>0){const d=.5/Math.sqrt(m+1);this._w=.25/d,this._x=(c-a)*d,this._y=(i-h)*d,this._z=(r-n)*d}else if(e>o&&e>l){const d=2*Math.sqrt(1+e-o-l);this._w=(c-a)/d,this._x=.25*d,this._y=(n+r)/d,this._z=(i+h)/d}else if(o>l){const d=2*Math.sqrt(1+o-e-l);this._w=(i-h)/d,this._x=(n+r)/d,this._y=.25*d,this._z=(a+c)/d}else{const d=2*Math.sqrt(1+l-e-o);this._w=(r-n)/d,this._x=(i+h)/d,this._y=(a+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let e=t.dot(s)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=e),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Y(this.dot(t),-1,1)))}rotateTowards(t,s){const e=this.angleTo(t);if(e===0)return this;const n=Math.min(1,s/e);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const e=t._x,n=t._y,i=t._z,r=t._w,o=s._x,a=s._y,h=s._z,c=s._w;return this._x=e*c+r*o+n*h-i*a,this._y=n*c+r*a+i*o-e*h,this._z=i*c+r*h+e*a-n*o,this._w=r*c-e*o-n*a-i*h,this._onChangeCallback(),this}slerp(t,s){if(s===0)return this;if(s===1)return this.copy(t);const e=this._x,n=this._y,i=this._z,r=this._w;let o=r*t._w+e*t._x+n*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=r,this._x=e,this._y=n,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const d=1-s;return this._w=d*r+s*this._w,this._x=d*e+s*this._x,this._y=d*n+s*this._y,this._z=d*i+s*this._z,this.normalize(),this}const h=Math.sqrt(a),c=Math.atan2(h,o),l=Math.sin((1-s)*c)/h,m=Math.sin(s*c)/h;return this._w=r*l+this._w*m,this._x=e*l+this._x*m,this._y=n*l+this._y*m,this._z=i*l+this._z*m,this._onChangeCallback(),this}slerpQuaternions(t,s,e){return this.copy(t).slerp(s,e)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(s),i*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const T=class T{constructor(t,s,e){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:i,y:r,z:o}=t;this.x=i,this.y=r,this.z=o||0;return}if(n===3){this.x=t,this.y=s,this.z=e;return}throw N.AcCmErrors.ILLEGAL_PARAMETERS}}set(t,s,e){return e===void 0&&(e=this.z),this.x=t,this.y=s,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new T(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(xs.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(xs.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[3]*e+i[6]*n,this.y=i[1]*s+i[4]*e+i[7]*n,this.z=i[2]*s+i[5]*e+i[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const s=this.x,e=this.y,n=this.z,i=t.elements,r=1/(i[3]*s+i[7]*e+i[11]*n+i[15]);return this.x=(i[0]*s+i[4]*e+i[8]*n+i[12])*r,this.y=(i[1]*s+i[5]*e+i[9]*n+i[13])*r,this.z=(i[2]*s+i[6]*e+i[10]*n+i[14])*r,this}applyQuaternion(t){const s=this.x,e=this.y,n=this.z,i=t.x,r=t.y,o=t.z,a=t.w,h=2*(r*n-o*e),c=2*(o*s-i*n),l=2*(i*e-r*s);return this.x=s+a*h+r*l-o*c,this.y=e+a*c+o*h-i*l,this.z=n+a*l+i*c-r*h,this}transformDirection(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[4]*e+i[8]*n,this.y=i[1]*s+i[5]*e+i[9]*n,this.z=i[2]*s+i[6]*e+i[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this.z=Math.max(t.z,Math.min(s.z,this.z)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this.z=Math.max(t,Math.min(s,this.z)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const s=this.dot(t),e=this.length(),n=t.length();return Math.abs(s)===e*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this.z=t.z+(s.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const e=t.x,n=t.y,i=t.z,r=s.x,o=s.y,a=s.z;return this.x=n*a-i*o,this.y=i*r-e*a,this.z=e*o-n*r,this}projectOnVector(t){const s=t.lengthSq();if(s===0)return this.set(0,0,0);const e=t.dot(this)/s;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return Ut.copy(this).projectOnVector(t),this.sub(Ut)}reflect(t){return this.sub(Ut.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return s*s+e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=e,this.z=n,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,s*4)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,s*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=Math.random()*2-1,e=Math.sqrt(1-s*s);return this.x=e*Math.cos(t),this.y=s,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};T.ORIGIN=Object.freeze(new T(0,0,0)),T.X_AXIS=Object.freeze(new T(1,0,0)),T.NEGATIVE_X_AXIS=Object.freeze(new T(-1,0,0)),T.Y_AXIS=Object.freeze(new T(0,1,0)),T.NEGATIVE_Y_AXIS=Object.freeze(new T(0,-1,0)),T.Z_AXIS=Object.freeze(new T(0,0,1)),T.NEGATIVE_Z_AXIS=Object.freeze(new T(0,0,-1));let _=T;const Ut=new _,xs=new rt,xt=class xt{constructor(t,s,e,n,i,r,o,a,h,c,l,m,d,g,y,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&o!=null&&a!=null&&h!=null&&c!=null&&l!=null&&m!=null&&d!=null&&g!=null&&y!=null&&x!=null&&this.set(t,s,e,n,i,r,o,a,h,c,l,m,d,g,y,x)}set(t,s,e,n,i,r,o,a,h,c,l,m,d,g,y,x){const f=this.elements;return f[0]=t,f[4]=s,f[8]=e,f[12]=n,f[1]=i,f[5]=r,f[9]=o,f[13]=a,f[2]=h,f[6]=c,f[10]=l,f[14]=m,f[3]=d,f[7]=g,f[11]=y,f[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new xt().fromArray(this.elements)}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],this}copyPosition(t){const s=this.elements,e=t.elements;return s[12]=e[12],s[13]=e[13],s[14]=e[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Lt.equalPoint3d(t,_.Z_AXIS))this.identity();else{const s=new _(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?s.crossVectors(_.Y_AXIS,t).normalize():s.crossVectors(_.Z_AXIS,t).normalize();const e=t.clone().cross(s).normalize();this.set(s.x,s.y,s.z,0,e.x,e.y,e.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,s,e){return t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}makeBasis(t,s,e){return this.set(t.x,s.x,e.x,0,t.y,s.y,e.y,0,t.z,s.z,e.z,0,0,0,0,1),this}extractRotation(t){const s=this.elements,e=t.elements,n=1/tt.setFromMatrixColumn(t,0).length(),i=1/tt.setFromMatrixColumn(t,1).length(),r=1/tt.setFromMatrixColumn(t,2).length();return s[0]=e[0]*n,s[1]=e[1]*n,s[2]=e[2]*n,s[3]=0,s[4]=e[4]*i,s[5]=e[5]*i,s[6]=e[6]*i,s[7]=0,s[8]=e[8]*r,s[9]=e[9]*r,s[10]=e[10]*r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ts,t,Ns)}lookAt(t,s,e){const n=this.elements;return U.subVectors(t,s),U.lengthSq()===0&&(U.z=1),U.normalize(),G.crossVectors(e,U),G.lengthSq()===0&&(Math.abs(e.z)===1?U.x+=1e-4:U.z+=1e-4,U.normalize(),G.crossVectors(e,U)),G.normalize(),At.crossVectors(U,G),n[0]=G.x,n[4]=At.x,n[8]=U.x,n[1]=G.y,n[5]=At.y,n[9]=U.y,n[2]=G.z,n[6]=At.z,n[10]=U.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],o=e[4],a=e[8],h=e[12],c=e[1],l=e[5],m=e[9],d=e[13],g=e[2],y=e[6],x=e[10],f=e[14],M=e[3],p=e[7],S=e[11],C=e[15],k=n[0],w=n[4],R=n[8],E=n[12],L=n[1],v=n[5],et=n[9],wt=n[13],zt=n[2],Mt=n[6],Pt=n[10],bt=n[14],Ct=n[3],St=n[7],Et=n[11],It=n[15];return i[0]=r*k+o*L+a*zt+h*Ct,i[4]=r*w+o*v+a*Mt+h*St,i[8]=r*R+o*et+a*Pt+h*Et,i[12]=r*E+o*wt+a*bt+h*It,i[1]=c*k+l*L+m*zt+d*Ct,i[5]=c*w+l*v+m*Mt+d*St,i[9]=c*R+l*et+m*Pt+d*Et,i[13]=c*E+l*wt+m*bt+d*It,i[2]=g*k+y*L+x*zt+f*Ct,i[6]=g*w+y*v+x*Mt+f*St,i[10]=g*R+y*et+x*Pt+f*Et,i[14]=g*E+y*wt+x*bt+f*It,i[3]=M*k+p*L+S*zt+C*Ct,i[7]=M*w+p*v+S*Mt+C*St,i[11]=M*R+p*et+S*Pt+C*Et,i[15]=M*E+p*wt+S*bt+C*It,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[4],n=t[8],i=t[12],r=t[1],o=t[5],a=t[9],h=t[13],c=t[2],l=t[6],m=t[10],d=t[14],g=t[3],y=t[7],x=t[11],f=t[15];return g*(+i*a*l-n*h*l-i*o*m+e*h*m+n*o*d-e*a*d)+y*(+s*a*d-s*h*m+i*r*m-n*r*d+n*h*c-i*a*c)+x*(+s*h*l-s*o*d-i*r*l+e*r*d+i*o*c-e*h*c)+f*(-n*o*c-s*a*l+s*o*m+n*r*l-e*r*m+e*a*c)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,e){const n=this.elements;return t instanceof _?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=s,n[14]=e),this}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],o=t[5],a=t[6],h=t[7],c=t[8],l=t[9],m=t[10],d=t[11],g=t[12],y=t[13],x=t[14],f=t[15],M=l*x*h-y*m*h+y*a*d-o*x*d-l*a*f+o*m*f,p=g*m*h-c*x*h-g*a*d+r*x*d+c*a*f-r*m*f,S=c*y*h-g*l*h+g*o*d-r*y*d-c*o*f+r*l*f,C=g*l*a-c*y*a-g*o*m+r*y*m+c*o*x-r*l*x,k=s*M+e*p+n*S+i*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/k;return t[0]=M*w,t[1]=(y*m*i-l*x*i-y*n*d+e*x*d+l*n*f-e*m*f)*w,t[2]=(o*x*i-y*a*i+y*n*h-e*x*h-o*n*f+e*a*f)*w,t[3]=(l*a*i-o*m*i-l*n*h+e*m*h+o*n*d-e*a*d)*w,t[4]=p*w,t[5]=(c*x*i-g*m*i+g*n*d-s*x*d-c*n*f+s*m*f)*w,t[6]=(g*a*i-r*x*i-g*n*h+s*x*h+r*n*f-s*a*f)*w,t[7]=(r*m*i-c*a*i+c*n*h-s*m*h-r*n*d+s*a*d)*w,t[8]=S*w,t[9]=(g*l*i-c*y*i-g*e*d+s*y*d+c*e*f-s*l*f)*w,t[10]=(r*y*i-g*o*i+g*e*h-s*y*h-r*e*f+s*o*f)*w,t[11]=(c*o*i-r*l*i-c*e*h+s*l*h+r*e*d-s*o*d)*w,t[12]=C*w,t[13]=(c*y*n-g*l*n+g*e*m-s*y*m-c*e*x+s*l*x)*w,t[14]=(g*o*n-r*y*n-g*e*a+s*y*a+r*e*x-s*o*x)*w,t[15]=(r*l*n-c*o*n+c*e*a-s*l*a-r*e*m+s*o*m)*w,this}scale(t){const s=this.elements,e=t.x,n=t.y,i=t.z;return s[0]*=e,s[4]*=n,s[8]*=i,s[1]*=e,s[5]*=n,s[9]*=i,s[2]*=e,s[6]*=n,s[10]*=i,s[3]*=e,s[7]*=n,s[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,e,n))}makeTranslation(t,s,e){return t instanceof _?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,e,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,s,-e,0,0,e,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,0,e,0,0,1,0,0,-e,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,0,e,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const e=Math.cos(s),n=Math.sin(s),i=1-e,r=t.x,o=t.y,a=t.z,h=i*r,c=i*o;return this.set(h*r+e,h*o-n*a,h*a+n*o,0,h*o+n*a,c*o+e,c*a-n*r,0,h*a-n*o,c*a+n*r,i*a*a+e,0,0,0,0,1),this}makeScale(t,s,e){return this.set(t,0,0,0,0,s,0,0,0,0,e,0,0,0,0,1),this}makeShear(t,s,e,n,i,r){return this.set(1,e,i,0,t,1,r,0,s,n,1,0,0,0,0,1),this}compose(t,s,e){const n=this.elements,i=s.x,r=s.y,o=s.z,a=s.w,h=i+i,c=r+r,l=o+o,m=i*h,d=i*c,g=i*l,y=r*c,x=r*l,f=o*l,M=a*h,p=a*c,S=a*l,C=e.x,k=e.y,w=e.z;return n[0]=(1-(y+f))*C,n[1]=(d+S)*C,n[2]=(g-p)*C,n[3]=0,n[4]=(d-S)*k,n[5]=(1-(m+f))*k,n[6]=(x+M)*k,n[7]=0,n[8]=(g+p)*w,n[9]=(x-M)*w,n[10]=(1-(m+y))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,s,e){const n=this.elements;let i=tt.set(n[0],n[1],n[2]).length();const r=tt.set(n[4],n[5],n[6]).length(),o=tt.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],D.copy(this);const h=1/i,c=1/r,l=1/o;return D.elements[0]*=h,D.elements[1]*=h,D.elements[2]*=h,D.elements[4]*=c,D.elements[5]*=c,D.elements[6]*=c,D.elements[8]*=l,D.elements[9]*=l,D.elements[10]*=l,s.setFromRotationMatrix(D),e.x=i,e.y=r,e.z=o,this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<16;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<16;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t[s+9]=e[9],t[s+10]=e[10],t[s+11]=e[11],t[s+12]=e[12],t[s+13]=e[13],t[s+14]=e[14],t[s+15]=e[15],t}};xt.IDENTITY=Object.freeze(new xt);let Z=xt;const tt=new _,D=new Z,Ts=new _(0,0,0),Ns=new _(1,1,1),G=new _,At=new _,U=new _;class X{constructor(t=void 0,s=void 0){this.min=t==null?new _(1/0,1/0,1/0):new _(t.x,t.y,t.z),this.max=s==null?new _(-1/0,-1/0,-1/0):new _(s.x,s.y,s.z)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromArray(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s+=3)this.expandByPoint(qt.fromArray(t,s));return this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=qt.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new X().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new _(0,0,0):new _(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let s,e;return t.normal.x>0?(s=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(s=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(s+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(s+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(s+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(s+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),s<=-t.constant&&e>=-t.constant}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,qt).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(O[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),O[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),O[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),O[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),O[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),O[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),O[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),O[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(O),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const O=[new _,new _,new _,new _,new _,new _,new _,new _],qt=new _,_s=new B;class q{constructor(t=void 0,s=void 0){this.min=t==null?new B(1/0,1/0):new B(t.x,t.y),this.max=s==null?new B(-1/0,-1/0):new B(s.x,s.y)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=_s.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new q().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new B(0,0):new B(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new B(0,0):new B(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,_s).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const As=new _,Vs=new _,js=new J;class ot{constructor(t=new _(1,0,0),s=0){this.normal=t,this.constant=s}set(t,s){return this.normal.copy(t),this.constant=s,this}setComponents(t,s,e,n){return this.normal.set(t,s,e),this.constant=n,this}setFromNormalAndCoplanarPoint(t,s){return this.normal.copy(t),this.constant=-s.dot(this.normal),this}setFromCoplanarPoints(t,s,e){const n=As.subVectors(e,s).cross(Vs.subVectors(t,s)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,s){return s.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,s){const e=s||js.getNormalMatrix(t),n=this.coplanarPoint(As).applyMatrix4(t),i=this.normal.applyMatrix3(e).normalize();return this.constant=-n.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new ot().copy(this)}}class b extends B{clone(){return new b(this.x,this.y)}static pointArrayToNumberArray(t){const s=new Array(t.length*2);return t.forEach((e,n)=>{e.toArray(s,n*2)}),s}}class z extends _{clone(){return new z(this.x,this.y,this.z)}static pointArrayToNumberArray(t,s=!0){const e=s?3:2,n=new Array(t.length*e);return t.forEach((i,r)=>{i.toArray(n,r*e)}),n}}const fs=new Z,ps=new rt,_t=class _t{constructor(t=0,s=0,e=0,n=_t.DEFAULT_ORDER){this._x=t,this._y=s,this._z=e,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,s,e,n=this._order){return this._x=t,this._y=s,this._z=e,this._order=n,this._onChangeCallback(),this}clone(){return new _t(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,s=this._order,e=!0){const n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],h=n[5],c=n[9],l=n[2],m=n[6],d=n[10];switch(s){case"XYZ":this._y=Math.asin(Y(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,i)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Y(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-l,i),this._z=0);break;case"ZXY":this._x=Math.asin(Y(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-Y(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(m,d),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(Y(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-l,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Y(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-c,d),this._y=0);break}return this._order=s,e===!0&&this._onChangeCallback(),this}setFromQuaternion(t,s,e=!0){return fs.makeRotationFromQuaternion(t),this.setFromRotationMatrix(fs,s,e)}setFromVector3(t,s=this._order){return this.set(t.x,t.y,t.z,s)}reorder(t){return ps.setFromEuler(this),this.setFromQuaternion(ps,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};_t.DEFAULT_ORDER="XYZ";let Ft=_t;function vt(u,t,s=!1){const e=u.x,n=u.y;let i=!1;const r=t.length;for(let o=0,a=r-1;o<r;a=o++){const h=t[o].x,c=t[o].y,l=t[a].x,m=t[a].y;let d=c>n!=m>n;s&&(d=c>=n!=m>=n),d&&e<(l-h)*(n-c)/(m-c)+h&&(i=!i)}return i}function ws(u,t){if(u.length===0||t.length===0)return!1;const s=new q().setFromPoints(u),e=new q().setFromPoints(t);if(!s.intersectsBox(e))return!1;for(let n=0;n<u.length;){if(vt(u[n],t,!0))return!0;n<u.length-1&&Lt.equalPoint2d(u[n+1],u[n])&&++n,++n}return!1}const zs={isPointInPolygon:vt,isPolygonIntersect:ws};function Ls(u,t){const s=[],e=t-1,n=u;for(let i=0;i<=n;i++)s.push(0);for(let i=1;i<=e-n;i++)s.push(i);for(let i=0;i<=n;i++)s.push(e-n+1);return s}function Us(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let o=1;o<=s;o++){const a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],c=t[o][2]-t[o-1][2],l=Math.sqrt(a*a+h*h+c*c);i+=l,n.push(i)}const r=[];for(let o=0;o<=e;o++)r.push(0);for(let o=1;o<=s-e;o++){const a=n[o]/i;r.push(a*(s-e+1))}for(let o=0;o<=e;o++)r.push(s-e+1);return r}function Ms(u,t="Uniform"){const s=u.length;if(s===0)return[];if(s===1)return[0];const e=s-1;if(t==="Uniform")return new Array(s).fill(0).map((r,o)=>o/e);const n=[0];let i=0;for(let r=1;r<=e;r++){const o=u[r][0]-u[r-1][0],a=u[r][1]-u[r-1][1],h=u[r][2]-u[r-1][2],c=Math.sqrt(o*o+a*a+h*h),l=t==="SqrtChord"?Math.sqrt(c):c;i+=l,n.push(i)}return i<1e-12?new Array(s).fill(0).map((r,o)=>o/e):n.map(r=>r/i)}function Ps(u,t){const s=t.length-1,e=u,n=s+e+1,i=new Array(n+1).fill(0),r=t[t.length-1];for(let o=n-e;o<=n;o++)i[o]=r;for(let o=1;o<=s-e;o++){let a=0;for(let h=o;h<o+e;h++)a+=t[h];i[o+e]=a/e}return i}function qs(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let o=1;o<=s;o++){const a=t[o][0]-t[o-1][0],h=t[o][1]-t[o-1][1],c=t[o][2]-t[o-1][2],l=Math.sqrt(a*a+h*h+c*c),m=Math.sqrt(l);i+=m,n.push(i)}const r=[];for(let o=0;o<=e;o++)r.push(0);for(let o=1;o<=s-e;o++){const a=n[o]/i;r.push(a*(s-e+1))}for(let o=0;o<=e;o++)r.push(s-e+1);return r}function Dt(u,t){const s=u.length,e=u.map(r=>r.slice()),n=t.slice();for(let r=0;r<s;r++){let o=r,a=Math.abs(e[r][r]);for(let h=r+1;h<s;h++){const c=Math.abs(e[h][r]);c>a&&(a=c,o=h)}if(a<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==r){const h=e[r];e[r]=e[o],e[o]=h;const c=n[r];n[r]=n[o],n[o]=c}for(let h=r+1;h<s;h++){const c=e[h][r]/e[r][r];if(!(Math.abs(c)<1e-14)){for(let l=r;l<s;l++)e[h][l]-=c*e[r][l];n[h]-=c*n[r]}}}const i=new Array(s).fill(0);for(let r=s-1;r>=0;r--){let o=n[r];for(let a=r+1;a<s;a++)o-=e[r][a]*i[a];i[r]=o/e[r][r]}return i}function Xt(u,t,s="Uniform",e,n){if(u.length===0)return{controlPoints:[],knots:[],weights:[]};const i=u.map(E=>[E[0],E[1],E[2]??0]),r=!!e,o=!!n,a=(r?1:0)+(o?1:0),h=i.length-1,c=h+a;if(c<t)throw new Error("Not enough points to interpolate a curve of this degree.");const l=Ms(i,s),m=l.slice();r&&m.unshift(l[0]),o&&m.push(l[l.length-1]);const d=Ps(t,m),g=c+1,y=new Array(g),x=new Array(g),f=new Array(g),M=new Array(g);let p=0;y[p]=new Array(g).fill(0),y[p][0]=1,x[p]=i[0][0],f[p]=i[0][1],M[p]=i[0][2],p++;for(let E=1;E<=h-1;E++){const L=l[E];y[p]=new Array(g).fill(0);for(let v=0;v<=c;v++)y[p][v]=ht(v,t,L,d);x[p]=i[E][0],f[p]=i[E][1],M[p]=i[E][2],p++}if(y[p]=new Array(g).fill(0),y[p][c]=1,x[p]=i[h][0],f[p]=i[h][1],M[p]=i[h][2],p++,r){const E=d[t+1]-d[0],L=E!==0?t/E:0;y[p]=new Array(g).fill(0),y[p][0]=-L,y[p][1]=L,x[p]=(e==null?void 0:e[0])??0,f[p]=(e==null?void 0:e[1])??0,M[p]=(e==null?void 0:e[2])??0,p++}if(o){const E=d[c+t+1]-d[c],L=E!==0?t/E:0;y[p]=new Array(g).fill(0),y[p][c-1]=-L,y[p][c]=L,x[p]=(n==null?void 0:n[0])??0,f[p]=(n==null?void 0:n[1])??0,M[p]=(n==null?void 0:n[2])??0,p++}const S=Dt(y,x),C=Dt(y,f),k=Dt(y,M),w=new Array(g);for(let E=0;E<g;E++)w[E]=[S[E],C[E],k[E]];const R=new Array(g).fill(1);return{controlPoints:w,knots:d,weights:R}}function ht(u,t,s,e){if(t===0)return s>=e[u]&&s<e[u+1]?1:0;const n=e[u+t]-e[u],i=e[u+t+1]-e[u+1],r=n>1e-10?(s-e[u])/n:0,o=i>1e-10?(e[u+t+1]-s)/i:0;return r*ht(u,t-1,s,e)+o*ht(u+1,t-1,s,e)}function at(u,t,s,e,n){const i=e.length-1,r=t;if(u=Math.max(s[r],Math.min(s[i+1],u)),Math.abs(u-s[i+1])<1e-8)return[...e[i]];if(Math.abs(u-s[r])<1e-8)return[...e[0]];const o=[0,0,0];let a=0;for(let h=0;h<=i;h++){const c=ht(h,r,u,s),l=n[h]*c;o[0]+=e[h][0]*l,o[1]+=e[h][1]*l,o[2]+=e[h][2]*l,a+=l}if(Math.abs(a)<1e-10){const h=s[s.length-r-1];if(Math.abs(u-h)<1e-8)return[...e[i]];if(Math.abs(u-s[r])<1e-8)return[...e[0]]}return Math.abs(a)>=1e-10&&(o[0]/=a,o[1]/=a,o[2]/=a),o}function bs(u,t,s,e){const n=u,i=t[n],r=t[t.length-n-1];let o=0;const a=1e3,h=(r-i)/a;let c=at(i,u,t,s,e);for(let y=1;y<=a;y++){const x=i+y*h,f=at(x,u,t,s,e),M=f[0]-c[0],p=f[1]-c[1],S=f[2]-c[2];o+=Math.sqrt(M*M+p*p+S*S),c=f}const l=at(r,u,t,s,e),m=l[0]-c[0],d=l[1]-c[1],g=l[2]-c[2];return o+=Math.sqrt(m*m+d*d+g*g),o}function Fs(u,t=3,s="Uniform",e,n){return u.length===0?[]:Xt(u,t,s,e,n).controlPoints}const Cs=new Z,Ss=new _,vs=new _,Ds=new _,Yt=new z;function Es(u){return new Z().setFromExtrusionDirection(new _(u.x,u.y,u.z))}function Xs(u){return Cs.setFromExtrusionDirection(new _(u.x,u.y,u.z)),Cs.extractBasis(Ss,vs,Ds),Ss.clone()}function Ys(u,t){return new z(u.x,u.y,u.z??0).applyMatrix4(Es(t))}function Zt(u,t){return new z(u.x,u.y,u.z??0).applyMatrix4(Es(t).invert())}function Zs(u,t,s){const e=Zt(u,s),n=Zt(t,s);return Yt.set(n.x-e.x,n.y-e.y,(n.z??0)-(e.z??0)),P.normalizeAngle(Math.atan2(Yt.y,Yt.x))}class Is{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ot extends Is{translate(t){return this.transform(new J().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Gt extends Ot{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new q}transform(t){return this._loops.forEach(s=>{s.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){const t=new Gt;return this._loops.forEach(s=>{t.add(s.clone())}),t}getPoints(t){const s=[];for(let e=0;e<this.loops.length;++e){const i=this.loops[e].getPoints(t);s.push(i)}return s}buildHierarchy(){var o;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),e=this.sortBoundaryBoxesByAreas(s),n=new Map,i=e.length;for(let a=0;a<i;a++)n.set(e[a],{index:e[a],children:[]});const r={index:-1,children:[]};for(let a=0;a<i;a++){const h=e[a],c=t[h],l=s[h];let m=a+1;for(;m<i;m++){const d=e[m],g=t[d];if(s[d].containsBox(l)&&zs.isPointInPolygon(c[P.randInt(0,c.length-1)],g)){(o=n.get(d))==null||o.children.push(n.get(h));break}}m===i&&r.children.push(n.get(h))}return r}get area(){if(this._loops.length===0)return 0;let t=0;for(let s=0;s<this._loops.length;s++){const n=this._loops[s].getPoints(128),i=this.polygonArea(n);s===0?t+=Math.abs(i):t-=Math.abs(i)}return t}polygonArea(t){const s=t.length;if(s<3)return 0;let e=0;for(let n=0,i=s-1;n<s;i=n++){const r=t[i],o=t[n];e+=r.x*o.y-o.x*r.y}return e*.5}calculateBoundaryBoxes(t){const s=[];return t.forEach(e=>{s.push(new q().setFromPoints(e))}),s}sortBoundaryBoxesByAreas(t){const s=[];t.forEach((n,i)=>{const r=n.size,o=r.width*r.height;s.push({area:o,index:i})}),s.sort((n,i)=>n.area-i.area);const e=[];return s.forEach(n=>{e.push(n.index)}),e}}class st extends Ot{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const s=this.getUtoTmapping(t);return this.getPoint(s)}getPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}getSpacedPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPointAt(e/t));return s}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const s=[];let e,n=this.getPoint(0),i=0;s.push(0);for(let r=1;r<=t;r++)e=this.getPoint(r/t),i+=e.distanceTo(n),s.push(i),n=e;return s}getUtoTmapping(t,s){const e=this.getLengths();let n=0;const i=e.length;let r;s?r=s:r=t*e[i-1];let o=0,a=i-1,h;for(;o<=a;)if(n=Math.floor(o+(a-o)/2),h=e[n]-r,h<0)o=n+1;else if(h>0)a=n-1;else{a=n;break}if(n=a,e[n]===r)return n/(i-1);const c=e[n],m=e[n+1]-c,d=(r-c)/m;return(n+d)/(i-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const i=this.getPoint(e),r=this.getPoint(n),o=new b;return o.copy(r).sub(i).normalize(),o}getTangentAt(t){const s=this.getUtoTmapping(t);return this.getTangent(s)}}class K extends st{constructor(t,s,e,n,i){super();const r=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(i!==void 0);if(r==3)typeof t=="object"&&typeof s=="object"&&typeof e=="object"?this.createByThreePoints(t,s,e):this.createByStartEndPointsAndBulge(t,s,e);else if(r==5){const o=t;this.center=new b(o.x,o.y),this.radius=s,this._clockwise=i,this._startAngle=this._clockwise?this._mirrorAngle(P.normalizeAngle(e)):P.normalizeAngle(e),this._endAngle=this._clockwise?this._mirrorAngle(P.normalizeAngle(n)):P.normalizeAngle(n)}else throw N.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(t,s,e){const n=(w,R)=>({x:(w.x+R.x)/2,y:(w.y+R.y)/2}),i=(w,R)=>(R.y-w.y)/(R.x-w.x),r=w=>-1/w,o=n(t,s),a=n(s,e),h=i(t,s),c=i(s,e),l=r(h),m=r(c),d=(w,R,E,L)=>{const v=(L-R)/(w-E),et=w*v+R;return{x:v,y:et}},g=o.y-l*o.x,y=a.y-m*a.x,x=d(l,g,m,y),f=Math.sqrt(Math.pow(t.x-x.x,2)+Math.pow(t.y-x.y,2)),M=(w,R)=>Math.atan2(w.y-R.y,w.x-R.x),p=M(t,x),S=M(s,x),C=M(e,x),k=C>p&&C<S||p>C&&p<S||S>C&&S<p;this.center=x,this.radius=f,this._clockwise=!k,this._startAngle=p,this._endAngle=C}createByStartEndPointsAndBulge(t,s,e){let n,i,r;e<0?(n=Math.atan(-e)*4,i=new B(t),r=new B(s)):(n=Math.atan(e)*4,i=new B(s),r=new B(t));const o=new B().subVectors(r,i),a=o.length(),h=new B().addVectors(i,o.multiplyScalar(.5)),c=Math.abs(a/2/Math.tan(n/2)),l=o.normalize(),m=e<0?-Math.PI/2:Math.PI/2,d=new B(l.x*Math.cos(m)-l.y*Math.sin(m),l.y*Math.cos(m)+l.x*Math.sin(m));let g;n<Math.PI?e<0?g=h.add(d.multiplyScalar(c)):g=h.add(d.multiplyScalar(-c)):e<0?g=h.add(d.multiplyScalar(-c)):g=h.add(d.multiplyScalar(c)),e<0?(this._startAngle=Math.atan2(i.y-g.y,i.x-g.x),this._endAngle=Math.atan2(r.y-g.y,r.x-g.x)):(this._startAngle=Math.atan2(r.y-g.y,r.x-g.x),this._endAngle=Math.atan2(i.y-g.y,i.x-g.x)),this._clockwise=e<0,this.center=g,this.radius=r.sub(g).length()}get center(){return this._center}set center(t){this._center=new b(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(P.normalizeAngle(t)):P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const s=this.startAngle==0&&t==I?t:P.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(s):s,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),s=this._getInternalAngle(this.endAngle);return this.clockwise?P.normalizeAngle(t-s):P.normalizeAngle(s-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),s=this._clockwise?P.normalizeAngle(t-this.deltaAngle/2):P.normalizeAngle(t+this.deltaAngle/2),e=this._clockwise?this._mirrorAngle(s):s;return this.getPointAtAngle(e)}get closed(){const t=this._getInternalAngle(this.startAngle),s=this._getInternalAngle(this.endAngle);return Math.abs(s-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of s){const r=this._getInternalAngle(i);P.isBetweenAngle(r,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(i))}const e=t.map(i=>i.x),n=t.map(i=>i.y);return new q(new b(Math.min(...e),Math.min(...n)),new b(Math.max(...e),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){const s=t,e=this.center.clone().applyMatrix2d(s),n=this.startPoint.clone().applyMatrix2d(s);if(this.closed)return this.center=e,this.radius=e.distanceTo(n),this._startAngle=Math.atan2(n.y-e.y,n.x-e.x),this._endAngle=this._startAngle,this._clockwise=s.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;const i=this.midPoint.clone().applyMatrix2d(s),r=this.endPoint.clone().applyMatrix2d(s),o=new K(n,i,r),a=s.determinant()<0?!this.clockwise:this.clockwise,h=c=>{const l=P.normalizeAngle(c);return a?this._mirrorAngle(l):l};return this.center=o.center,this.radius=o.radius,this.clockwise=a,this.startAngle=h(Math.atan2(n.y-o.center.y,n.x-o.center.x)),this.endAngle=h(Math.atan2(r.y-o.center.y,r.x-o.center.x)),this._boundingBoxNeedsUpdate=!0,this}clone(){return new K(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const s=this._getInternalAngle(t),e=this.center.x+this.radius*Math.cos(s),n=this.center.y+this.radius*Math.sin(s);return new b(e,n)}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this._getInternalAngle(this.startAngle);if(this.closed&&(e=I,n=0),this.clockwise)for(let i=0;i<=t;i++){const r=n-e*(i/t),o=this._clockwise?this._mirrorAngle(r):r,a=this.getPointAtAngle(o);s.push(new b(a.x,a.y))}else for(let i=0;i<=t;i++){const r=n+e*(i/t),o=this._clockwise?this._mirrorAngle(r):r,a=this.getPointAtAngle(o);s.push(new b(a.x,a.y))}return s}}class Os extends Is{translate(t){return this.transform(new Z().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class ct extends Os{}class lt extends ct{constructor(t,s){super(),this._start=new z(t),this._end=new z(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new _().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new z((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,s){return this.delta(s).multiplyScalar(t).add(this._start)}atLength(t,s=!1){if(s){const e=this.delta($).normalize();return new z(this._start).addScaledVector(e,t)}else{const e=this.delta($).normalize();return new z(this._end).addScaledVector(e,t)}}extend(t,s=!1){if(s){const e=$.subVectors(this._start,this._end).normalize();this._start=new z(this._start).addScaledVector(e,t)}else{const e=this.delta($).normalize();this._end=new z(this._end).addScaledVector(e,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,s){Bs.subVectors(t,this._start),ft.subVectors(this.endPoint,this.startPoint);const e=ft.dot(ft);let i=ft.dot(Bs)/e;return s&&(i=P.clamp(i,0,1)),i}closestPointToPoint(t,s,e){const n=this.closestPointToPointParameter(t,s);return this.delta(e).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const s=this.direction,n=$.subVectors(t,this.startPoint).dot(s);return new z().copy(s).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const s=this.direction,e=this.startPoint,i=$.subVectors(t,e).dot(s),r=$.copy(s).multiplyScalar(i);return new z().addVectors(e,r)}calculateBoundingBox(){const t=new z(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),s=new z(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 X(t,s)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new lt(this._start.clone(),this._end.clone())}}const $=new _,Bs=new _,ft=new _;class ut extends ct{static computeCenterPoint(t,s,e){const n=new _().addVectors(t,s).multiplyScalar(.5),i=new _().addVectors(t,e).multiplyScalar(.5),r=new _().subVectors(s,t),o=new _().subVectors(e,t),a=new _().crossVectors(r,o).normalize();if(a.lengthSq()===0)return null;const h=new _().crossVectors(r,a).normalize(),c=new _().crossVectors(o,a).normalize(),l=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=new lt(n,n.clone().add(l)),g=new lt(i,i.clone().add(m)),y=new _;return d.closestPointToPoint(g.startPoint,!0,y)?y:null}static createByThreePoints(t,s,e){const n=ut.computeCenterPoint(t,s,e);if(n){const i=n.distanceTo(t),r=new _().subVectors(t,n),o=new _().subVectors(s,n),a=Math.atan2(r.y,r.x),h=Math.atan2(o.y,o.x);return new ut(n,i,a,h,_.Z_AXIS)}}constructor(t,s,e,n,i,r=_.X_AXIS){super(),this.center=t,this.radius=s,this.startAngle=e,this.endAngle=n,this.normal=i,this.refVec=r,(n-e)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=e,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new z(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return P.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new _(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,s=this.deltaAngle;this.closed&&(t=0,s=I);const e=t+s*.5;return this.getPointAtAngle(e)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const s=new _(t.x,t.y,t.z||0),e=this.center,n=this.normal,r=s.clone().sub(e).dot(n),a=s.clone().sub(n.clone().multiplyScalar(r)).clone().sub(e);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const h=e.clone().add(a),c=this.getAngle(h.clone()),l=this.startAngle,m=this.deltaAngle;let d=P.normalizeAngle(c-l);d<0&&(d=0),d>m&&(d=m);const g=this.getPointAtAngle(l+d),y=g.distanceTo(s),x=this.startPoint.distanceTo(s),f=this.endPoint.distanceTo(s);return x<y&&x<=f?this.startPoint.clone():f<y&&f<x?this.endPoint.clone():g}tangentPoints(t){const s=[],e=new _(t.x,t.y,t.z||0),n=this.center,i=this.normal,r=this.radius,a=e.clone().sub(n).dot(i),h=e.clone().sub(i.clone().multiplyScalar(a)),c=n.clone(),m=h.clone().sub(c).length();if(m<r)return s;const d=Math.acos(r/m),g=this.getAngle(h.clone()),y=[g+d,g-d];for(const x of y){const f=P.normalizeAngle(x-this.startAngle);f>=0&&f<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+f))}return s}nearestTangentPoint(t){const s=this.tangentPoints(t);if(s.length===0)return null;const e=new z(t.x,t.y,t.z||0);return s.length===1||s[0].distanceTo(e)<s[1].distanceTo(e)?s[0]:s[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)P.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,o=-1/0;for(const a of t){const h=this.getPointAtAngle(a);h.x<s&&(s=h.x),h.y<e&&(e=h.y),h.z<n&&(n=h.z),h.x>i&&(i=h.x),h.y>r&&(r=h.y),h.z>o&&(o=h.z)}return new X({x:s,y:e,z:n},{x:i,y:r,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),o=this.getPointAtAngle(r);s.push(o)}return s}transform(t){const s=this.center.clone().applyMatrix4(t),e=this.startPoint.clone().applyMatrix4(t),n=this.endPoint.clone().applyMatrix4(t),i=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(t),r=new _(e).sub(s).normalize(),o=s.distanceTo(e);let a=new _().crossVectors(new _(e).sub(s),new _(i).sub(s)).normalize();a.lengthSq()===0&&(a=this.normal.clone().transformDirection(t));const h=c=>{const l=new _(c).sub(s);return Math.atan2(l.dot(ks.crossVectors(a,r)),l.dot(r))};return this.center=s,this.radius=o,this.normal=a,this.refVec=r,this.startAngle=0,this.endAngle=this.closed?I:h(n),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ut(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(ks.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const s=this.normal,e=this.refVec,n={x:s.y*e.z-s.z*e.y,y:s.z*e.x-s.x*e.z,z:s.x*e.y-s.y*e.x},i=this.center,r=this.radius;return new z(i.x+r*(e.x*Math.cos(t)+n.x*Math.sin(t)),i.y+r*(e.y*Math.cos(t)+n.y*Math.sin(t)),i.z+r*(e.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new _(this.center).distanceTo(jt);return new ot(this.normal,t)}}const ks=new _;class H extends st{constructor(t,s,e,n=0,i=I,r=!1,o=0){super(),this.center=t,this.majorAxisRadius=s,this.minorAxisRadius=e,(i-n)%I==0?(this.startAngle=0,this.endAngle=I):(this.startAngle=n,this.endAngle=i),this.clockwise=r,this.rotation=o}get center(){return this._center}set center(t){this._center=new z(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return P.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let s=1/0,e=1/0,n=-1/0,i=-1/0;for(let r=0;r<=100;r++){const o=this.getPoint(r/100);s=Math.min(s,o.x),e=Math.min(e,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y)}return new q({x:s,y:e},{x:n,y:i})}get closed(){return this.deltaAngle==0}getPoint(t){const s=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;for(;e<0;)e+=s;for(;e>s;)e-=s;e<Number.EPSILON&&(n?e=0:e=s),this.clockwise===!0&&!n&&(e===s?e=-s:e=e-s);const i=this.startAngle+t*e;let r=this.center.x+this.majorAxisRadius*Math.cos(i),o=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const a=Math.cos(this.rotation),h=Math.sin(this.rotation),c=r-this.center.x,l=o-this.center.y;r=c*a-l*h+this.center.x,o=c*h+l*a+this.center.y}return new b(r,o)}transform(t){const s=t,e=new b(this.center).applyMatrix2d(s),n=new z(e.x,e.y,this.center.z),i=this.getPointAtAngle(0).clone().applyMatrix2d(s),r=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(s),o=new b(i).sub(e),a=new b(r).sub(e),h=o.length(),c=a.length(),l=Math.atan2(o.y,o.x),m=o.clone().normalize(),d=a.clone().normalize(),g=f=>{const M=new b(f).sub(e),p=M.dot(m),S=M.dot(d);return P.normalizeAngle(Math.atan2(S/c,p/h))},y=s.determinant()<0?!this.clockwise:this.clockwise,x=this.closed?new H(n,h,c,0,I,y,l):new H(n,h,c,g(this.startPoint.clone().applyMatrix2d(s)),g(this.endPoint.clone().applyMatrix2d(s)),y,l);return this.center=x.center,this.majorAxisRadius=x.majorAxisRadius,this.minorAxisRadius=x.minorAxisRadius,this._startAngle=x._startAngle,this._endAngle=x._endAngle,this._clockwise=x._clockwise,this.rotation=x.rotation,this._boundingBoxNeedsUpdate=!0,this}getPointAtAngle(t){return this.getPoint(this.closed?t/I:P.normalizeAngle(t-this.startAngle)/this.deltaAngle)}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new H(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class dt extends ct{constructor(t,s,e,n,i,r=0,o=I){super(),this.center=t,this.normal=s,this.majorAxis=e,this.majorAxisRadius=n,this.minorAxisRadius=i;const a=Math.abs(o-r);Math.abs(a-I)<1e-10||Math.abs(a-2*I)<1e-10?(this.startAngle=0,this.endAngle=I):(this.startAngle=r,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new z(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==I?t:P.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-I)<1e-10?I:P.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new _(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new _(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new _().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,s=this.deltaAngle;(this.closed||Math.abs(s-I)<1e-10)&&(t=0,s=I);const e=t+s/2;return this.getPointAtAngle(e)}get isCircular(){return it.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,s=this.deltaAngle/t;let e=0,n=this.getPointAtAngle(this.startAngle);for(let i=1;i<=t;i++){const r=this.startAngle+i*s,o=this.getPointAtAngle(r),a=o.x-n.x,h=o.y-n.y,c=o.z-n.z;e+=Math.sqrt(a*a+h*h+c*c),n=o}return e}get area(){const t=this.majorAxisRadius,s=this.minorAxisRadius,e=this.startAngle,n=e+this.deltaAngle;if(Math.abs(this.deltaAngle-I)<1e-10)return Math.PI*t*s;const i=t*s/2*(n-e-(Math.sin(n)*Math.cos(n)-Math.sin(e)*Math.cos(e)));return Math.abs(i)}calculateBoundingBox(){if(this.majorAxis.equals(_.X_AXIS)||this.majorAxis.equals(_.Y_AXIS)||this.majorAxis.isParallelTo(_.X_AXIS)||this.majorAxis.isParallelTo(_.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)P.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,o=-1/0;for(const a of t){const h=this.getPointAtAngle(a);h.x<s&&(s=h.x),h.y<e&&(e=h.y),h.z<n&&(n=h.z),h.x>i&&(i=h.x),h.y>r&&(r=h.y),h.z>o&&(o=h.z)}return new X({x:s,y:e,z:n},{x:i,y:r,z:o})}else{let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,o=-1/0;for(let a=0;a<=100;a++){const h=this.startAngle+this.deltaAngle*(a/100),c=this.getPointAtAngle(h);s=Math.min(s,c.x),e=Math.min(e,c.y),n=Math.min(n,c.z),i=Math.max(i,c.x),r=Math.max(r,c.y),o=Math.max(o,c.z)}return new X({x:s,y:e,z:n},{x:i,y:r,z:o})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=I,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),o=this.getPointAtAngle(r);s.push(o)}return s}getPointAtAngle(t){const s=Math.cos(t),e=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e),i=this.majorAxis.clone().multiplyScalar(s*this.majorAxisRadius).add(n);return new z(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const s=new _(t).sub(this.center),e=s.dot(this.majorAxis),n=s.dot(this.minorAxis),i=e/this.majorAxisRadius,r=n/this.minorAxisRadius;return i*i+r*r<=1}transform(t){const s=t,e=this.center.clone().applyMatrix4(s),n=this.getPointAtAngle(0).clone().applyMatrix4(s),i=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(s),r=new _(n).sub(e),o=new _(i).sub(e),a=r.length(),h=o.length(),c=r.clone().normalize(),l=new _().crossVectors(r,o).normalize();let m=new _().crossVectors(l,c).normalize();m.dot(o)<0&&(l.negate(),m=new _().crossVectors(l,c).normalize());const d=y=>{const x=new _(y).sub(e),f=x.dot(c),M=x.dot(m);return P.normalizeAngle(Math.atan2(M/h,f/a))},g=this.closed?new dt(e,l,c,a,h,0,I):new dt(e,l,c,a,h,d(this.startPoint.clone().applyMatrix4(s)),d(this.endPoint.clone().applyMatrix4(s)));return this.center=g.center,this.normal=g.normal,this.majorAxis=g.majorAxis,this.majorAxisRadius=g.majorAxisRadius,this.minorAxisRadius=g.minorAxisRadius,this._startAngle=g._startAngle,this._endAngle=g._endAngle,this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new dt(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new _(this.center).distanceTo(jt);return new ot(this.normal,t)}}class Kt extends st{constructor(t=null,s=!1){super(),this._vertices=t||new Array,this._closed=s}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new b(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const s=this._vertices[0];return new b(s.x,s.y)}else{const s=this._vertices[t-1];return new b(s.x,s.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const s=this._vertices.length;for(let e=0;e<s;++e){const n=this._vertices[e];let i=null;if(e<s-1?i=this._vertices[e+1]:e==s-1&&this.closed&&(i=this._vertices[0]),i)if(n.bulge){const r=new K(n,i,n.bulge);t+=r.length}else t+=new b(n.x,n.y).distanceTo(i)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,s){t<=0?this._vertices.unshift(s):this._vertices.splice(t,0,s),this._boundingBoxNeedsUpdate=!0}removeVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error(`Index ${t} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0}reset(t,s){t?s!==void 0&&s>=0&&s<this._vertices.length&&(this._vertices=this._vertices.slice(0,s),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(t){const s=this._vertices[t];return new b(s.x,s.y)}calculateBoundingBox(){const t=this.getPoints(100);return new q().setFromPoints(t)}transform(t){const s=t.determinant()<0;return this._vertices.forEach(e=>{const n=new b(e).applyMatrix2d(t);e.x=n.x,e.y=n.y,s&&e.bulge!=null&&(e.bulge=-e.bulge)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new Kt(this._vertices.map(t=>({...t})),this._closed)}getPoints3d(t,s){const e=[];return this.getPoints(t).forEach(i=>e.push(new z().set(i.x,i.y,s))),e}getPoints(t){const s=[],e=this._vertices.length;for(let n=0;n<e;++n){const i=this._vertices[n];if(i.bulge){let r=null;if(n<e-1?r=this._vertices[n+1]:n==e-1&&this.closed&&(r=this._vertices[0]),r){const a=new K(i,r,i.bulge).getPoints(t),h=a.length;for(let c=0;c<h;++c){const l=a[c];s.push(new b(l.x,l.y))}}}else s.push(new b(i.x,i.y)),n==e-1&&this.closed&&s.push(s[0])}return s}}class mt extends st{constructor(t,s){super(),this._start=new b(t),this._end=new b(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new b(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),s=new b(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new q(t,s)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new mt(this._start.clone(),this._end.clone())}}class F extends st{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}static buildFromEdges(t,s=.001){if(t.length===0)return[];const e=[...t],n=[],i=s*s,r=(o,a)=>{const h=o.x-a.x,c=o.y-a.y;return h*h+c*c<=i};for(;e.length>0;){const o=[],a=e.shift();o.push(a);const h=F.getEdgeStartPoint(a);let c=F.getEdgeEndPoint(a);if(!r(h,c))for(;e.length>0;){const l=F.findConnectingEdge(e,c,i);if(l.index<0)break;let m=e.splice(l.index,1)[0];if(l.reverse&&(m=F.reverseEdge(m)),o.push(m),c=F.getEdgeEndPoint(m),r(c,h))break}n.push(new F(o))}return n}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new b(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(s=>{t+=s.length}),t}calculateBoundingBox(){const t=this.getPoints(100),s=new q;return s.setFromPoints(t),s}transform(t){const s=new Z().set(t.elements[0],t.elements[3],0,t.elements[6],t.elements[1],t.elements[4],0,t.elements[7],0,0,1,0,0,0,0,1);return this._curves.forEach(e=>{e instanceof Q?e.transform(s):e.transform(t)}),this._boundingBoxNeedsUpdate=!0,this}clone(){return new F(this._curves.map(t=>t.clone()))}get closed(){return!0}getPoints(t){const s=[];return this.curves.forEach(e=>{e.getPoints(t).forEach(n=>{s.push(new b(n.x,n.y))})}),s}static findConnectingEdge(t,s,e){let n=-1,i=!1,r=Number.POSITIVE_INFINITY;for(let o=0;o<t.length;o++){const a=t[o],h=F.getEdgeStartPoint(a),c=F.getEdgeEndPoint(a),l=s.x-h.x,m=s.y-h.y,d=l*l+m*m;d<r&&(r=d,n=o,i=!1);const g=s.x-c.x,y=s.y-c.y,x=g*g+y*y;x<r&&(r=x,n=o,i=!0)}return r>e?{index:-1,reverse:!1}:{index:n,reverse:i}}static getEdgeStartPoint(t){const s=t.startPoint;return new b(s.x,s.y)}static getEdgeEndPoint(t){const s=t.endPoint;return new b(s.x,s.y)}static reverseEdge(t){return t instanceof mt?new mt(t.endPoint,t.startPoint):t instanceof K?new K(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof H?new H(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof Q?F.reverseSplineEdge(t):t}static reverseSplineEdge(t){const s=[...t.controlPoints].reverse(),e=t.knots,n=e[0],i=e[e.length-1],r=e.map(h=>n+i-h).reverse(),o=t.weights,a=o.length>0?[...o].reverse():void 0;return new Q(s,r,a,t.degree,t.closed)}}class Qt{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,s,e,n){this.c0=t,this.c1=e,this.c2=-3*t+3*s-2*e-n,this.c3=2*t-2*s+e+n}initCatmullRom(t,s,e,n,i){this.init(s,e,i*(e-t),i*(n-s))}initNonuniformCatmullRom(t,s,e,n,i,r,o){let a=(s-t)/i-(e-t)/(i+r)+(e-s)/r,h=(e-s)/r-(n-s)/(r+o)+(n-e)/o;a*=r,h*=r,this.init(s,e,a,h)}calc(t){const s=t*t,e=s*t;return this.c0+this.c1*t+this.c2*s+this.c3*e}}class pt extends ct{constructor(t=[],s=!1,e="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new _,this._px=new Qt,this._py=new Qt,this._pz=new Qt,this._points=t.map(i=>new z(i)),this._closed=s,this._curveType=e,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new z}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new z}get length(){if(this._points.length<2)return 0;let t=0;for(let s=1;s<this._points.length;s++)t+=this._points[s-1].distanceTo(this._points[s]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,s=new z){const e=s,n=this._points,i=n.length;if(i===0)return e.set(0,0,0);if(i===1)return e.copy(n[0]);const r=(i-(this._closed?0:1))*t;let o=Math.floor(r),a=r-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:a===0&&o===i-1&&(o=i-2,a=1);let h,c;this._closed||o>0?h=n[(o-1)%i]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),h=new z(this._tmp.x,this._tmp.y,this._tmp.z));const l=n[o%i],m=n[(o+1)%i];if(this._closed||o+2<i?c=n[(o+2)%i]:(this._tmp.subVectors(n[i-1],n[i-2]).add(n[i-1]),c=new z(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const d=this._curveType==="chordal"?.5:.25;let g=Math.pow(h.distanceToSquared(l),d),y=Math.pow(l.distanceToSquared(m),d),x=Math.pow(m.distanceToSquared(c),d);y<1e-4&&(y=1),g<1e-4&&(g=y),x<1e-4&&(x=y),this._px.initNonuniformCatmullRom(h.x,l.x,m.x,c.x,g,y,x),this._py.initNonuniformCatmullRom(h.y,l.y,m.y,c.y,g,y,x),this._pz.initNonuniformCatmullRom(h.z,l.z,m.z,c.z,g,y,x)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(h.x,l.x,m.x,c.x,this._tension),this._py.initCatmullRom(h.y,l.y,m.y,c.y,this._tension),this._pz.initCatmullRom(h.z,l.z,m.z,c.z,this._tension));return e.set(this._px.calc(a),this._py.calc(a),this._pz.calc(a)),e}getPoints(t){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}setPoints(t){this._points=t.map(s=>new z(s)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}clone(){return new pt(this._points.map(t=>t.clone()),this._closed,this._curveType,this._tension)}transform(t){return this._points=this._points.map(s=>{const e=new z;return e.copy(s),e.applyMatrix4(t),e}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new X;const t=new X;return this._points.forEach(s=>{t.expandByPoint(s)}),t}}class j{constructor(t,s,e,n){this._degree=t,this._knots=[...s],this._controlPoints=e.map(i=>({x:i.x,y:i.y,z:i.z})),this._weights=n?[...n]:new Array(e.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}clone(){return new j(this._degree,this._knots,this._controlPoints,this._weights)}point(t){const s=this._controlPoints.map(e=>[e.x,e.y,e.z]);return at(t,this._degree,this._knots,s,this._weights)}length(){const t=this._controlPoints.map(s=>[s.x,s.y,s.z]);return bs(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,s,e,n){return new j(t,s,e,n)}static byPoints(t,s,e="Uniform",n,i){const r=Xt(t,s,e,n,i),o=r.controlPoints.map(a=>({x:a[0],y:a[1],z:a[2]}));return new j(s,r.knots,o,r.weights)}getParameterRange(){const t=this._knots[this._degree],s=this._knots[this._knots.length-this._degree-1];return{start:t,end:s}}getPoints(t){const s=[],{start:e,end:n}=this.getParameterRange();for(let i=0;i<=t;i++){const r=e+(n-e)*(i/t);s.push(this.point(r))}return s}isClosed(t=1e-6){const{start:s,end:e}=this.getParameterRange(),n=this.point(s),i=this.point(e),r=n[0]-i[0],o=n[1]-i[1],a=n[2]-i[2];return Math.sqrt(r*r+o*o+a*a)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const s=new pt(t,!0,"centripetal"),e=Math.max(50,t.length*2);return s.getPoints(e)}static createClosedCurve(t,s,e="Chord"){const i=this.createFitPointsForClosedCurve(t).map(r=>[r.x,r.y,r.z]);return j.byPoints(i,s,e)}}class Q extends ct{constructor(t,s,e,n,i,r){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(s)){if(o<2||o>5)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._controlPoints=t;let a,h=3,c=!1;if(o>=3&&(Array.isArray(e)?(a=e,o>=4&&(h=n||3),o>=5&&(c=i)):e!==void 0&&(h=e||3,o>=4&&(c=n))),e===void 0&&o>=4&&(h=n||3,o>=5&&(c=i)),this._degree=h,this._closed=c,this._controlPoints.length<this._degree+1)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._nurbsCurve=j.byKnotsControlPointsWeights(this._degree,s,this._controlPoints,a)}else{if(o<2||o>6)throw N.AcCmErrors.ILLEGAL_PARAMETERS;this._fitPoints=t,this._knotParameterization=s,o>=3&&(this._degree=e||3);const a=typeof n=="boolean";o>=4&&a&&(this._closed=n),a?(o>=5&&(this._startTangent=i),o>=6&&(this._endTangent=r)):(o>=4&&(this._startTangent=n),o>=5&&(this._endTangent=i)),this._closed&&(this._startTangent=void 0,this._endTangent=void 0);const h=(this._startTangent?1:0)+(this._endTangent?1:0);if(this._fitPoints.length+h<this._degree+1)throw N.AcCmErrors.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=j.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const c=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=j.byPoints(c,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(c=>[c.x,c.y,c.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=j.createFitPointsForClosedCurve(this._fitPoints),s=this.toNurbsPoints(t);this._nurbsCurve=j.byPoints(s,this._degree,this._knotParameterization)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=j.byPoints(t,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(t=>[t.x,t.y,t.z||0]))}else if(this._controlPoints)if(this._closed){const t=j.createFitPointsForClosedCurve(this._controlPoints),s=this.toNurbsPoints(t);this._nurbsCurve=j.byPoints(s,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(e=>[e.x,e.y,e.z||0]))}else{const t=this._nurbsCurve.knots(),s=this._nurbsCurve.weights();this._nurbsCurve=j.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,s)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get fitPoints(){var t;return(t=this._fitPoints)==null?void 0:t.map(s=>({x:s.x,y:s.y,z:s.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[s],n=this._nurbsCurve.point(e);return new z(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[t.length-s-1],n=this._nurbsCurve.point(e);return new z(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const s=this._fitPoints.length,e=t<0||t>=s?s-1:t,n=this._fitPoints[e];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const s=this._controlPoints.length,e=t<0||t>=s?s-1:t;return this._controlPoints[e]}getPoints(t=100){const s=this._nurbsCurve,e=[],n=s.knots(),i=this._nurbsCurve.degree(),r=n[i],o=n[n.length-i-1],a=(o-r)/(t-1);for(let h=0;h<t;h++){const c=h===t-1?o:r+h*a,l=s.point(c);e.push(new z(l[0],l[1],l[2]))}return e}getCurvePoints(t,s){const e=[],n=t.knots(),i=t.degree(),r=n[i],a=(n[n.length-i-1]-r)/(s-1);for(let h=0;h<s;h++){const c=r+h*a;e.push(t.point(c))}return e}calculateBoundingBox(){const t=this.getPoints(100);return new X().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){if(this._fitPoints&&this._knotParameterization)this._fitPoints=this._fitPoints.map(s=>new z(s).applyMatrix4(t)),this._startTangent&&(this._startTangent=new z(this._startTangent).transformDirection(t)),this._endTangent&&(this._endTangent=new z(this._endTangent).transformDirection(t)),this.buildCurve();else{const s=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._controlPoints=this._controlPoints.map(n=>new z(n).applyMatrix4(t)),this._nurbsCurve=j.byKnotsControlPointsWeights(this._degree,s,this._controlPoints,e.length>0?e:void 0)}return this._boundingBoxNeedsUpdate=!0,this}clone(){return this._fitPoints&&this._knotParameterization?new Q(this._fitPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._knotParameterization,this._degree,this._closed,this._startTangent?{x:this._startTangent.x,y:this._startTangent.y,z:this._startTangent.z||0}:void 0,this._endTangent?{x:this._endTangent.x,y:this._endTangent.y,z:this._endTangent.z||0}:void 0):new Q(this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0})),this._nurbsCurve.knots(),this._nurbsCurve.weights(),this._degree,this._closed)}toNurbsPoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]=[e.x,e.y,e.z||0]}),s}toGePoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]={x:e[0],y:e[1],z:e[2]}}),s}toNurbsPoint(t){return[t.x,t.y,t.z||0]}static createClosedSpline(t,s="Uniform",e=3){if(t.length<e+1)throw new Error(`At least ${e+1} points are required for a degree ${e} closed spline`);return new Q(t,s,e,!0)}}A.AcGeArea2d=Gt,A.AcGeBox2d=q,A.AcGeBox3d=X,A.AcGeCatmullRomCurve3d=pt,A.AcGeCircArc2d=K,A.AcGeCircArc3d=ut,A.AcGeCurve2d=st,A.AcGeEllipseArc2d=H,A.AcGeEllipseArc3d=dt,A.AcGeEuler=Ft,A.AcGeGeometryUtil=zs,A.AcGeLine2d=mt,A.AcGeLine3d=lt,A.AcGeLoop2d=F,A.AcGeMathUtil=P,A.AcGeMatrix2d=J,A.AcGeMatrix3d=Z,A.AcGeNurbsCurve=j,A.AcGePlane=ot,A.AcGePoint2d=b,A.AcGePoint3d=z,A.AcGePolyline2d=Kt,A.AcGeQuaternion=rt,A.AcGeShape2d=Ot,A.AcGeSpline3d=Q,A.AcGeTol=it,A.AcGeVector2d=B,A.AcGeVector3d=_,A.DEFAULT_TOL=Lt,A.DEG2RAD=Bt,A.FLOAT_TOL=W,A.ORIGIN_POINT_2D=Rs,A.ORIGIN_POINT_3D=jt,A.RAD2DEG=kt,A.TAU=I,A.basisFunction=ht,A.calculateCurveLength=bs,A.ceilPowerOfTwo=us,A.clamp=Y,A.computeParameterValues=Ms,A.damp=ts,A.degToRad=as,A.euclideanModulo=Rt,A.evaluateNurbsPoint=at,A.floorPowerOfTwo=ds,A.generateAveragedKnots=Ps,A.generateChordKnots=Us,A.generateSqrtChordKnots=qs,A.generateUUID=$t,A.generateUniformKnots=Ls,A.getOcsAngle=Zs,A.getOcsReferenceVector=Xs,A.intPartLength=Nt,A.interpolateControlPoints=Fs,A.interpolateNurbsCurve=Xt,A.inverseLerp=Jt,A.isBetween=ms,A.isBetweenAngle=gs,A.isPointInPolygon=vt,A.isPolygonIntersect=ws,A.isPowerOfTwo=ls,A.lerp=Tt,A.mapLinear=Ht,A.normalizeAngle=nt,A.pingpong=ss,A.radToDeg=cs,A.randFloat=rs,A.randFloatSpread=os,A.randInt=is,A.relativeEps=ys,A.seededRandom=hs,A.smootherstep=ns,A.smoothstep=es,A.transformOcsPointToWcs=Ys,A.transformWcsPointToOcs=Zt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/lib/math/AcGeEuler.js
CHANGED
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
import { clamp } from '../util';
|
|
28
|
+
import { clamp } from '../util/AcGeMathUtil';
|
|
29
29
|
import { AcGeMatrix3d } from './AcGeMatrix3d';
|
|
30
30
|
import { AcGeQuaternion } from './AcGeQuaternion';
|
|
31
31
|
var _matrix = /*@__PURE__*/ new AcGeMatrix3d();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcGeEuler.js","sourceRoot":"","sources":["../../src/math/AcGeEuler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AcGeEuler.js","sourceRoot":"","sources":["../../src/math/AcGeEuler.ts"],"names":[],"mappings":"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"}
|
package/lib/math/AcGeMatrix3d.js
CHANGED