three-live 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/three-author-engine.js +28 -26
- package/dist/three-author.cjs +29 -27
- package/dist/three-author.d.ts +22 -0
- package/dist/three-author.js +29 -27
- package/dist/three-convert.cjs +21 -19
- package/dist/three-convert.d.ts +22 -0
- package/dist/three-convert.js +21 -19
- package/dist/three-live-animation.cjs +4 -4
- package/dist/three-live-animation.d.ts +22 -0
- package/dist/three-live-animation.js +4 -4
- package/dist/three-live-animation.min.js +4 -4
- package/dist/three-live-cad.cjs +2 -2
- package/dist/three-live-cad.d.ts +22 -0
- package/dist/three-live-cad.js +2 -2
- package/dist/three-live-cad.min.js +2 -2
- package/dist/three-live-element.cjs +5 -3
- package/dist/three-live-element.d.ts +22 -0
- package/dist/three-live-element.js +5 -3
- package/dist/three-live-full.cjs +48 -46
- package/dist/three-live-full.js +47 -45
- package/dist/three-live-full.min.js +48 -46
- package/dist/three-live-studio.cjs +10 -10
- package/dist/three-live-studio.d.ts +22 -0
- package/dist/three-live-studio.js +10 -10
- package/dist/three-live-studio.min.js +10 -10
- package/dist/three-live-viewer.cjs +5 -3
- package/dist/three-live-viewer.d.ts +22 -0
- package/dist/three-live-viewer.js +5 -3
- package/dist/three-live-viewer.min.js +5 -3
- package/dist/three-live.cjs +23 -21
- package/dist/three-live.js +25 -23
- package/dist/three-live.min.js +23 -21
- package/dist/three-view.cjs +8 -6
- package/dist/three-view.d.ts +22 -0
- package/dist/three-view.js +8 -6
- package/dist/three-xr.cjs +24 -22
- package/dist/three-xr.d.ts +22 -0
- package/dist/three-xr.js +24 -22
- package/package.json +1 -1
package/dist/three-live-cad.cjs
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
"use strict";var Te=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var Tn=Object.prototype.hasOwnProperty;var Ln=(M,L)=>{for(var A in L)Te(M,A,{get:L[A],enumerable:!0})},En=(M,L,A,he)=>{if(L&&typeof L=="object"||typeof L=="function")for(let ne of Cn(L))!Tn.call(M,ne)&&ne!==A&&Te(M,ne,{get:()=>L[ne],enumerable:!(he=kn(L,ne))||he.enumerable});return M};var Rn=M=>En(Te({},"__esModule",{value:!0}),M);var zn={};Ln(zn,{MAX_BSP_DEPTH:()=>an,MAX_CSG_TRIANGLES:()=>cn,MAX_SHAPE_POINTS:()=>ln,MAX_TEXT_GEOMETRY_CHARS:()=>un,cadPlugin:()=>Le,installCadExtension:()=>Pe});module.exports=Rn(zn);var Se="__THREE_LIVE_REGISTRY__";function fe(){let M=typeof globalThis<"u"?globalThis:{};if(!M[Se]){let L={plugins:[],decoders:new Map};try{Object.defineProperty(M,Se,{value:L,writable:!1,configurable:!1,enumerable:!1})}catch{M[Se]=L}}return M[Se]}var Vn=fe().plugins;function on(M){let L=fe();L.workerExtensionInstallers||(L.workerExtensionInstallers=[]),L.workerExtensionInstallers.includes(M)||L.workerExtensionInstallers.push(M)}function rn(M){let L=fe().plugins;L.some(A=>A.name===M.name)||L.push(M),M.onRegister?.()}var cn=8192,an=2048,un=128,ln=4096;function Pe(M,L){if(!M||!M.BufferGeometry)return null;let A=M.Vector2,he=M.Vector3,ne=M.Quaternion,Me=M.Matrix4,hn=M.Matrix3,mn=M.Color,D=M.BufferAttribute,se=M.BufferGeometry,yn=M.Material,Ee=M.MeshStandardMaterial,xe=M.Mesh,me=8192,oe=2048,Re=128,we=4096,Y=(t,e)=>{let n=t==null?NaN:Number(t);return Number.isFinite(n)?n:e};class be{constructor(e){this.currentPoint=new A(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){let s=Number(e)||0,r=Number(n)||0;return this.currentPoint.set(s,r),this.segments.push({type:"move",pts:[s,r]}),this}lineTo(e,n){let s=Number(e)||0,r=Number(n)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,r),this.segments.push({type:"line",pts:[s,r]}),this}quadraticCurveTo(e,n,s,r){let i=this.currentPoint.x,a=this.currentPoint.y,u=Number(e)||0,h=Number(n)||0,o=Number(s)||0,m=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[i,a]}),this.currentPoint.set(o,m),this.segments.push({type:"quad",pts:[i,a,u,h,o,m]}),this}bezierCurveTo(e,n,s,r,i,a){let u=this.currentPoint.x,h=this.currentPoint.y,o=Number(e)||0,m=Number(n)||0,l=Number(s)||0,c=Number(r)||0,f=Number(i)||0,x=Number(a)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,h]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[u,h,o,m,l,c,f,x]}),this}absarc(e,n,s,r,i,a=!1){return this.absellipse(e,n,s,s,r,i,a,0)}arc(e,n,s,r,i,a=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),s,r,i,a)}absellipse(e,n,s,r,i,a,u=!1,h=0){let o=Number(e)||0,m=Number(n)||0,l=Math.max(0,Number(s)||0),c=Math.max(0,Number(r)||0),f=Number(i)||0,x=Number(a)||0,p=u?1:0,b=Number(h)||0;this.segments.push({type:"arc",pts:[o,m,l,c,f,x,p,b]});let y=Math.cos(b),g=Math.sin(b),S=l*Math.cos(x),d=c*Math.sin(x);return this.currentPoint.set(o+S*y-d*g,m+S*g+d*y),this}ellipse(e,n,s,r,i,a,u=!1,h=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),s,r,i,a,u,h)}closePath(){if(this.segments.length>0){let e=this.segments[0],n=0,s=0;if(e.type==="arc"){let r=e.pts[0],i=e.pts[1],a=e.pts[2],u=e.pts[3],h=e.pts[4],o=e.pts[7],m=Math.cos(o),l=Math.sin(o),c=a*Math.cos(h),f=u*Math.sin(h);n=r+c*m-f*l,s=i+c*l+f*m}else n=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-n,this.currentPoint.y-s)>1e-6&&this.lineTo(n,s)}return this}getPoints(e=12){let n=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],r=(i,a)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-i,u.y-a)<1e-6)return}s.push(new A(i,a))};for(let i of this.segments){let a=i.pts;if(i.type==="move"||i.type==="line")r(a[0],a[1]);else if(i.type==="quad"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5];r(u,h);for(let f=1;f<=n;f++){let x=f/n,p=1-x;r(p*p*u+2*p*x*o+x*x*l,p*p*h+2*p*x*m+x*x*c)}}else if(i.type==="cubic"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5],f=a[6],x=a[7];r(u,h);for(let p=1;p<=n;p++){let b=p/n,y=1-b,g=y*y,S=b*b;r(g*y*u+3*g*b*o+3*y*S*l+S*b*f,g*y*h+3*g*b*m+3*y*S*c+S*b*x)}}else if(i.type==="arc"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5],f=a[6]!==0,x=a[7],p=Math.PI*2,b=c-l,y=Math.abs(b)<1e-9;for(;b<0;)b+=p;for(;b>p;)b-=p;b<1e-9&&(b=y?0:p),f&&!y&&(b=b===p?-p:b-p);let g=Math.cos(x),S=Math.sin(x),d=Math.max(2,n);for(let w=0;w<=d;w++){let P=w/d,G=l+P*b,C=o*Math.cos(G),E=m*Math.sin(G);r(u+C*g-E*S,h+C*S+E*g)}}}if(s.length>2){let i=s[0],a=s[s.length-1];Math.hypot(i.x-a.x,i.y-a.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}}class pe extends be{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(n=>n.getPoints(e))}}}function ge(t){let e=0,n=t.length;for(let s=0,r=n-1;s<n;r=s++)e+=t[r].x*t[s].y-t[s].x*t[r].y;return e*.5}function fn(t,e,n,s,r,i,a,u){let h=a-n,o=u-s,m=r-n,l=i-s,c=t-n,f=e-s,x=h*h+o*o,p=h*m+o*l,b=h*c+o*f,y=m*m+l*l,g=m*c+l*f,S=x*y-p*p;if(Math.abs(S)<1e-12)return!1;let d=1/S,w=(y*b-p*g)*d,P=(x*g-p*b)*d;return w>=-1e-7&&P>=-1e-7&&w+P<=1+1e-7}function ze(t,e){let n=t.slice();ge(n)<0&&n.reverse();let s=n.map(h=>new A(h.x,h.y)),r=n.map((h,o)=>o),i=[];for(let h of e){if(!h||h.length<3)continue;let o=h.slice();ge(o)>0&&o.reverse();let m=[],l=-1/0,c=0;for(let f=0;f<o.length;f++){let x=o[f],p=s.length;s.push(new A(x.x,x.y)),m.push(p),x.x>l&&(l=x.x,c=f)}i.push({pts:o,indices:m,maxX:l,maxIdx:c})}i.sort((h,o)=>o.maxX-h.maxX);let a=(h,o,m)=>(o.x-h.x)*(m.y-h.y)-(o.y-h.y)*(m.x-h.x),u=(h,o,m)=>{for(let l=0;l<m.length;l++){let c=m[l],f=m[(l+1)%m.length];if(a(h,o,c)*a(h,o,f)<0&&a(c,f,h)*a(c,f,o)<0)return!0}return!1};for(let h of i){let o=h.pts[h.maxIdx],m=o.x,l=r.length,c=r.map(y=>s[y]),f=y=>Math.hypot(c[y].x-m,c[y].y-o.y),x=c.map((y,g)=>g).sort((y,g)=>+(c[y].x<m)-+(c[g].x<m)||f(y)-f(g)),p=x[0];for(let y of x){let g=c[y],S=c[(y+l-1)%l],d=c[(y+1)%l],w=a(g,d,o)>=0,P=a(S,g,o)>=0;if((a(S,g,d)>=0?w&&P:w||P)&&!u(o,g,c)&&!i.some(C=>u(o,g,C.pts))){p=y;break}}let b=[];for(let y=0;y<=p;y++)b.push(r[y]);for(let y=0;y<=h.indices.length;y++){let g=h.indices[(h.maxIdx+y)%h.indices.length];b.push(g)}for(let y=p;y<r.length;y++)b.push(r[y]);r=b}return{merged:r.map(h=>s[h]),mergedIndices:r,allVertices:s}}function Ie(t,e){let n=[],s=t.slice();if(s.length<3)return n;let r=s.length*s.length+64,i=0;for(;s.length>2&&r-- >0;){let a=s.length,u=s[(i+a-1)%a],h=s[i%a],o=s[(i+1)%a],m=e[u],l=e[h],c=e[o];if((l.x-m.x)*(c.y-m.y)-(l.y-m.y)*(c.x-m.x)>1e-9){let x=!0;for(let p=0;p<a;p++){let b=s[p];if(b===u||b===h||b===o)continue;let y=e[b];if(fn(y.x,y.y,m.x,m.y,l.x,l.y,c.x,c.y)&&Math.hypot(y.x-m.x,y.y-m.y)>=1e-6&&Math.hypot(y.x-l.x,y.y-l.y)>=1e-6&&Math.hypot(y.x-c.x,y.y-c.y)>=1e-6){x=!1;break}}if(x){n.push([u,h,o]),s.splice(i%a,1),i=Math.max(0,i%a-1);continue}}i++,i>=a*2&&(n.push([u,h,o]),s.splice((i-1)%a,1),i=0)}return n}function Ve(t,e){let n=t instanceof pe?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},s=n.shape.length;for(let r of n.holes)s+=r.length;if(s>we)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${we})`);return n}class xn extends se{constructor(e=new pe,n=12){super();let s=Array.isArray(e)?e:[e],r=[],i=[],a=[],u=[];for(let h of s){if(!(h instanceof be))continue;let o=Ve(h,n);if(o.shape.length<3)continue;let{mergedIndices:m,allVertices:l}=ze(o.shape,o.holes),c=Ie(m,l),f=r.length/3,x=1/0,p=1/0,b=-1/0,y=-1/0;for(let d of l)d.x<x&&(x=d.x),d.y<p&&(p=d.y),d.x>b&&(b=d.x),d.y>y&&(y=d.y);let g=Math.max(1e-6,b-x),S=Math.max(1e-6,y-p);for(let d of l)r.push(d.x,d.y,0),i.push(0,0,1),a.push((d.x-x)/g,(d.y-p)/S);for(let[d,w,P]of c)u.push(f+d,f+w,f+P)}this.setAttribute("position",new D(O(r),3)),this.setAttribute("normal",new D(O(i),3)),this.setAttribute("uv",new D(O(a),2)),this.setIndex(u)}}function O(t){let e=t.length,n=new Float32Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}function bn(t){let e=t.length,n=[];for(let s=0;s<e;s++){let r=t[(s+e-1)%e],i=t[s],a=t[(s+1)%e],u=i.x-r.x,h=i.y-r.y,o=Math.hypot(u,h)||1;u/=o,h/=o;let m=a.x-i.x,l=a.y-i.y,c=Math.hypot(m,l)||1;m/=c,l/=c;let f=h,x=-u,p=l,b=-m,y=f+p,g=x+b,S=Math.hypot(y,g);if(S>1e-6){y/=S,g/=S;let d=Math.max(.35,y*f+g*x);n.push(new A(y/d,g/d))}else n.push(new A(f,x))}return n}class pn extends se{constructor(e=new pe,n={}){super();let s=Array.isArray(e)?e:[e],r=Math.max(1,Math.min(64,Math.floor(Y(n.curveSegments,12)))),i=Y(n.depth??n.amount,1),a=Math.max(1,Math.min(32,Math.floor(Y(n.steps,1)))),u=!!(n.bevelEnabled??!1),h=u?Math.max(0,Y(n.bevelThickness,.06)):0,o=u?Math.max(0,Y(n.bevelSize,h*.8)):0,m=u?Y(n.bevelOffset,0):0,l=u?Math.max(1,Math.min(8,Math.floor(Y(n.bevelSegments,2)))):0,c=[],f=[],x=[],p=[];for(let b of s){if(!(b instanceof be))continue;let y=Ve(b,r);if(y.shape.length<3)continue;let g=y.shape.slice();ge(g)<0&&g.reverse();let S=[];for(let v of y.holes){if(v.length<3)continue;let k=v.slice();ge(k)>0&&k.reverse(),S.push(k)}let{mergedIndices:d,allVertices:w}=ze(g,S),P=Ie(d,w),G=[g,...S],C=[];for(let v of G){let k=bn(v);for(let T of k)C.push(T)}let E=1/0,V=1/0,I=-1/0,B=-1/0;for(let v of w)v.x<E&&(E=v.x),v.y<V&&(V=v.y),v.x>I&&(I=v.x),v.y>B&&(B=v.y);let _=Math.max(1e-6,I-E),H=Math.max(1e-6,B-V),re=-h,ie=i+h,j=c.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;c.push(R,z,re),f.push(0,0,-1),x.push((R-E)/_,(z-V)/H)}for(let[v,k,T]of P)p.push(j+v,j+T,j+k);let $=c.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;c.push(R,z,ie),f.push(0,0,1),x.push((R-E)/_,(z-V)/H)}for(let[v,k,T]of P)p.push($+v,$+k,$+T);let N=[];if(u&&l>0)for(let v=0;v<l;v++){let T=v/l*Math.PI/2;N.push({z:-h*Math.cos(T),expand:m+o*Math.sin(T)})}for(let v=0;v<=a;v++){let k=v/a;N.push({z:k*i,expand:m+o})}if(u&&l>0)for(let v=1;v<=l;v++){let T=v/l*Math.PI/2;N.push({z:i+h*Math.sin(T),expand:m+o*Math.cos(T)})}let F=0;for(let v of G){let k=v.length;for(let T=0;T<N.length-1;T++){let R=N[T],z=N[T+1];for(let X=0;X<k;X++){let q=(X+1)%k,Z=v[X],U=v[q],Q=C[F+X],K=C[F+q],J=Z.x+Q.x*R.expand,ee=Z.y+Q.y*R.expand,te=U.x+K.x*R.expand,W=U.y+K.y*R.expand,wn=U.x+K.x*z.expand,Gn=U.y+K.y*z.expand,We=Z.x+Q.x*z.expand,je=Z.y+Q.y*z.expand,$e=te-J,Ze=W-ee,Ue=0,Qe=We-J,Ke=je-ee,Je=z.z-R.z,ce=Ze*Je-Ue*Ke,ae=Ue*Qe-$e*Je,ue=$e*Ke-Ze*Qe,Ce=Math.hypot(ce,ae,ue)||1;ce/=Ce,ae/=Ce,ue/=Ce;let le=c.length/3;c.push(J,ee,R.z,te,W,R.z,wn,Gn,z.z,We,je,z.z),f.push(ce,ae,ue,ce,ae,ue,ce,ae,ue,ce,ae,ue);let en=X/k,nn=(X+1)/k,tn=T/(N.length-1),sn=(T+1)/(N.length-1);x.push(en,tn,nn,tn,nn,sn,en,sn),p.push(le,le+1,le+2,le,le+2,le+3)}}F+=k}}this.setAttribute("position",new D(O(c),3)),this.setAttribute("normal",new D(O(f),3)),this.setAttribute("uv",new D(O(x),2)),this.setIndex(p)}}function _e(t){return{x:t.x,y:t.y,z:t.z,nx:t.nx,ny:t.ny,nz:t.nz,u:t.u,v:t.v}}function gn(t){return{x:t.x,y:t.y,z:t.z,nx:-t.nx,ny:-t.ny,nz:-t.nz,u:t.u,v:t.v}}function dn(t,e,n){let s=t.nx+(e.nx-t.nx)*n,r=t.ny+(e.ny-t.ny)*n,i=t.nz+(e.nz-t.nz)*n,a=Math.hypot(s,r,i)||1;return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n,z:t.z+(e.z-t.z)*n,nx:s/a,ny:r/a,nz:i/a,u:t.u+(e.u-t.u)*n,v:t.v+(e.v-t.v)*n}}function vn(t){if(t.length<3)return null;let e=t[0],n=t[1],s=t[2],r=n.x-e.x,i=n.y-e.y,a=n.z-e.z,u=s.x-e.x,h=s.y-e.y,o=s.z-e.z,m=i*o-a*h,l=a*u-r*o,c=r*h-i*u,f=Math.hypot(m,l,c);if(f<1e-9)return null;m/=f,l/=f,c/=f;let x=m*e.x+l*e.y+c*e.z;return{vertices:t,nx:m,ny:l,nz:c,w:x}}function Sn(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=gn(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let Ae=1e-5,Ne=0,Ge=1,de=2,Xe=3;function De(t,e,n,s,r,i,a,u,h){let o=0,m=[];for(let l=0;l<r.vertices.length;l++){let c=r.vertices[l],f=t*c.x+e*c.y+n*c.z-s,x=f<-Ae?de:f>Ae?Ge:Ne;o|=x,m.push(x)}switch(o){case Ne:{t*r.nx+e*r.ny+n*r.nz>0?i.push(r):a.push(r);break}case Ge:u.push(r);break;case de:h.push(r);break;case Xe:{let l=[],c=[],f=r.vertices.length;for(let g=0;g<f;g++){let S=(g+1)%f,d=m[g],w=m[S],P=r.vertices[g],G=r.vertices[S];if(d!==de&&l.push(P),d!==Ge&&c.push(d!==de?_e(P):P),(d|w)===Xe){let C=G.x-P.x,E=G.y-P.y,V=G.z-P.z,I=t*C+e*E+n*V,B=Math.abs(I)>1e-12?(s-(t*P.x+e*P.y+n*P.z))/I:.5,_=dn(P,G,Math.max(0,Math.min(1,B)));l.push(_),c.push(_e(_))}}let{nx:x,ny:p,nz:b,w:y}=r;l.length>=3&&u.push({vertices:l,nx:x,ny:p,nz:b,w:y}),c.length>=3&&h.push({vertices:c,nx:x,ny:p,nz:b,w:y});break}default:break}}class ye{constructor(e,n=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,n)}invert(){for(let n=0;n<this.polygons.length;n++)Sn(this.polygons[n]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,n=0){if(!this.hasPlane||e.length===0)return e.slice();if(n>=oe)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${oe})`);let s=[],r=[];for(let i=0;i<e.length;i++)De(this.nx,this.ny,this.nz,this.w,e[i],s,r,s,r);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,n+1)),this.back?r=r.length>0?this.back.clipPolygons(r,n+1):[]:r=[],s.concat(r)}clipTo(e,n=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),n<oe&&(this.front&&this.front.clipTo(e,n+1),this.back&&this.back.clipTo(e,n+1))}allPolygons(e=[]){for(let n=0;n<this.polygons.length;n++)e.push(this.polygons[n]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,n=0){if(!e.length)return;if(!this.hasPlane){let i=e[e.length>>1];this.nx=i.nx,this.ny=i.ny,this.nz=i.nz,this.w=i.w,this.hasPlane=!0}if(n>=oe)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${oe})`);let s=[],r=[];for(let i=0;i<e.length;i++)De(this.nx,this.ny,this.nz,this.w,e[i],this.polygons,this.polygons,s,r);s.length>0&&(this.front||(this.front=new ye),this.front.build(s,n+1)),r.length>0&&(this.back||(this.back=new ye),this.back.build(r,n+1))}}function Oe(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let n=t.attributes.position;if(!n||n.count===0)return[];let s=t.attributes.normal,r=t.attributes.uv,i=t.index?t.index.array:null,a=Math.floor(i?i.length/3:n.count/3);if(a>me)throw new RangeError(`SecurityError: CSG input triangle count (${a}) exceeds MAX_CSG_TRIANGLES (${me})`);let u=e?e.elements:null,h=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,o=u?new hn().getNormalMatrix(e).elements:null,m=c=>{let f=n.getX(c),x=n.getY(c),p=n.getZ(c),b=s?s.getX(c):NaN,y=s?s.getY(c):NaN,g=s?s.getZ(c):NaN;if(u&&o){let w=u[0]*f+u[4]*x+u[8]*p+u[12],P=u[1]*f+u[5]*x+u[9]*p+u[13],G=u[2]*f+u[6]*x+u[10]*p+u[14];f=w,x=P,p=G;let C=o[0]*b+o[3]*y+o[6]*g,E=o[1]*b+o[4]*y+o[7]*g,V=o[2]*b+o[5]*y+o[8]*g,I=Math.hypot(C,E,V)||1;b=C/I,y=E/I,g=V/I}let S=r?r.getX(c):0,d=r?r.getY(c):0;return{x:f,y:x,z:p,nx:b,ny:y,nz:g,u:S,v:d}},l=[];for(let c=0;c<a;c++){let f=i?i[c*3]:c*3,x=i?i[c*3+1]:c*3+1,p=i?i[c*3+2]:c*3+2,b=vn(h?[m(f),m(p),m(x)]:[m(f),m(x),m(p)]);b&&l.push(b)}return l}function Pn(t){let e=[],n=[],s=[],r=[];for(let a of t){let u=a.vertices;if(u.length<3)continue;let h=e.length/3;for(let o of u)e.push(o.x,o.y,o.z),Number.isFinite(o.nx)&&o.nx*o.nx+o.ny*o.ny+o.nz*o.nz>.5?n.push(o.nx,o.ny,o.nz):n.push(a.nx,a.ny,a.nz),s.push(o.u,o.v);for(let o=1;o<u.length-1;o++)r.push(h,h+o,h+o+1)}let i=new se;return i.setAttribute("position",new D(O(e),3)),i.setAttribute("normal",new D(O(n),3)),i.setAttribute("uv",new D(O(s),2)),i.setIndex(r),i._csgPolygons=t,i}function Mn(t,e,n){if(t.length+e.length>me)throw new RangeError(`SecurityError: Combined CSG triangle count (${t.length+e.length}) exceeds MAX_CSG_TRIANGLES (${me})`);if(t.length===0)return n==="union"?e:[];if(e.length===0)return n==="intersect"?[]:t;let s=1/0,r=1/0,i=1/0,a=-1/0,u=-1/0,h=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let p=0;p<x.length;p++){let b=x[p];b.x<s&&(s=b.x),b.y<r&&(r=b.y),b.z<i&&(i=b.z),b.x>a&&(a=b.x),b.y>u&&(u=b.y),b.z>h&&(h=b.z)}}s-=1e-4,r-=1e-4,i-=1e-4,a+=1e-4,u+=1e-4,h+=1e-4;let o=[],m=[];for(let f=0;f<t.length;f++){let x=t[f],p=x.vertices,b=1/0,y=1/0,g=1/0,S=-1/0,d=-1/0,w=-1/0;for(let P=0;P<p.length;P++){let G=p[P];G.x<b&&(b=G.x),G.y<y&&(y=G.y),G.z<g&&(g=G.z),G.x>S&&(S=G.x),G.y>d&&(d=G.y),G.z>w&&(w=G.z)}S<s||b>a||d<r||y>u||w<i||g>h?m.push(x):o.push(x)}if(o.length===0)return n==="union"?t.concat(e):n==="subtract"?t:[];let l=new ye(o),c=new ye(e);return n==="union"?(l.clipTo(c),c.clipTo(l),c.invert(),c.clipTo(l),c.invert(),l.build(c.allPolygons()),m.concat(l.allPolygons())):n==="subtract"?(l.invert(),l.clipTo(c),c.clipTo(l),c.invert(),c.clipTo(l),c.invert(),l.build(c.allPolygons()),l.invert(),m.concat(l.allPolygons())):(l.invert(),c.clipTo(l),c.invert(),l.clipTo(c),c.clipTo(l),l.build(c.allPolygons()),l.invert(),l.allPolygons())}function Be(t,e,n,s=null,r=null){let i=Oe(t,s),a=Oe(e,r);return Pn(Mn(i,a,n))}function ke(t,e,n){let s=t instanceof xe||!!t?.isMesh,r=e instanceof xe||!!e?.isMesh,i=s?t.geometry:t,a=r?e.geometry:e,u=null;if(r)if(e.updateMatrix(),s){t.updateMatrix();let l=new Me().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),c=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,f=new Me().compose(new he(0,0,0),new ne(-t.quaternion.x/c,-t.quaternion.y/c,-t.quaternion.z/c,t.quaternion.w/c),new he(1,1,1)),x=new Me().makeTranslation(-t.position.x,-t.position.y,-t.position.z);u=l.multiply(f).multiply(x).multiply(e.matrix)}else u=e.matrix;let h=Be(i,a,n,null,u),o=s?t.material:new Ee,m=new xe(h,o);return s&&(m.position.copy(t.position),m.quaternion.copy(t.quaternion),m.scale.copy(t.scale),m.name=t.name),m}let ve={toGeometry:Be,subtract(t,e){return ke(t,e,"subtract")},union(t,e){return ke(t,e,"union")},intersect(t,e){return ke(t,e,"intersect")}},Ye={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class He extends se{constructor(e="",n={}){super();let s=String(e??"").slice(0,Re),r=Math.max(.005,Math.min(100,Y(n.size,.2))),i=!!(n.bevelEnabled??!1),a=i?Math.max(0,Math.min(2,Y(n.bevelThickness,r*.04))):0,u=i?Math.max(0,Math.min(2,Y(n.bevelSize,r*.03))):0,h=Math.max(.001,Math.min(20,Y(n.depth??n.height,r*.2)))+a*2,o=r*.085+u,m=r*.68,l=r*.82,c=[],f=[],x=[],p=[],b=(S,d,w,P,G,C,E)=>{let V=w-S,I=P-d,B=Math.hypot(V,I),_=1,H=0;B>1e-6&&(_=V/B,H=I/B);let re=-H*G,ie=_*G,j=_*G*.6,$=H*G*.6,N=S-j+re,F=d-$+ie,v=S-j-re,k=d-$-ie,T=w+j-re,R=P+$-ie,z=w+j+re,X=P+$+ie,q=(Z,U,Q,K,J,ee,te)=>{let W=c.length/3;c.push(Z[0],Z[1],Z[2],U[0],U[1],U[2],Q[0],Q[1],Q[2],K[0],K[1],K[2]),f.push(J,ee,te,J,ee,te,J,ee,te,J,ee,te),x.push(0,0,1,0,1,1,0,1),p.push(W,W+1,W+2,W,W+2,W+3)};q([N,F,E],[v,k,E],[T,R,E],[z,X,E],0,0,1),q([v,k,C],[N,F,C],[z,X,C],[T,R,C],0,0,-1),q([N,F,C],[v,k,C],[v,k,E],[N,F,E],-_,-H,0),q([T,R,C],[z,X,C],[z,X,E],[T,R,E],_,H,0),q([v,k,C],[T,R,C],[T,R,E],[v,k,E],H,-_,0),q([z,X,C],[N,F,C],[N,F,E],[z,X,E],-H,_,0)},y=0,g=0;for(let S=0;S<s.length;S++){let d=s[S];if(d===`
|
|
18
|
-
`){y=0,g-=r*1.35;continue}if(d===" "||d===" "){y+=
|
|
17
|
+
"use strict";var Te=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var Tn=Object.prototype.hasOwnProperty;var Ln=(M,L)=>{for(var A in L)Te(M,A,{get:L[A],enumerable:!0})},En=(M,L,A,ue)=>{if(L&&typeof L=="object"||typeof L=="function")for(let J of Cn(L))!Tn.call(M,J)&&J!==A&&Te(M,J,{get:()=>L[J],enumerable:!(ue=kn(L,J))||ue.enumerable});return M};var Rn=M=>En(Te({},"__esModule",{value:!0}),M);var zn={};Ln(zn,{MAX_BSP_DEPTH:()=>an,MAX_CSG_TRIANGLES:()=>cn,MAX_SHAPE_POINTS:()=>ln,MAX_TEXT_GEOMETRY_CHARS:()=>un,cadPlugin:()=>Le,installCadExtension:()=>Se});module.exports=Rn(zn);var ve="__THREE_LIVE_REGISTRY__";function me(){let M=typeof globalThis<"u"?globalThis:{};if(!M[ve]){let L={plugins:[],decoders:new Map};try{Object.defineProperty(M,ve,{value:L,writable:!1,configurable:!1,enumerable:!1})}catch{M[ve]=L}}return M[ve]}var _n=me().plugins;function on(M){let L=me();L.workerExtensionInstallers||(L.workerExtensionInstallers=[]),L.workerExtensionInstallers.includes(M)||L.workerExtensionInstallers.push(M)}function rn(M){let L=me().plugins;L.some(A=>A.name===M.name)||L.push(M),M.onRegister?.()}var cn=8192,an=2048,un=128,ln=4096;function Se(M,L){if(!M||!M.BufferGeometry)return null;let A=M.Vector2,ue=M.Vector3,J=M.Quaternion,Pe=M.Matrix4,hn=M.Matrix3,mn=M.Color,Me=M.BufferAttribute,ne=M.BufferGeometry,yn=M.Material,Ee=M.MeshStandardMaterial,ye=M.Mesh,le=8192,te=2048,Re=128,we=4096,D=(n,e)=>{let t=n==null?NaN:Number(n);return Number.isFinite(t)?t:e};class fe{constructor(e){this.currentPoint=new A(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){let s=Number(e)||0,r=Number(t)||0;return this.currentPoint.set(s,r),this.segments.push({type:"move",pts:[s,r]}),this}lineTo(e,t){let s=Number(e)||0,r=Number(t)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,r),this.segments.push({type:"line",pts:[s,r]}),this}quadraticCurveTo(e,t,s,r){let a=this.currentPoint.x,c=this.currentPoint.y,u=Number(e)||0,l=Number(t)||0,o=Number(s)||0,m=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,c]}),this.currentPoint.set(o,m),this.segments.push({type:"quad",pts:[a,c,u,l,o,m]}),this}bezierCurveTo(e,t,s,r,a,c){let u=this.currentPoint.x,l=this.currentPoint.y,o=Number(e)||0,m=Number(t)||0,h=Number(s)||0,i=Number(r)||0,f=Number(a)||0,x=Number(c)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,l]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[u,l,o,m,h,i,f,x]}),this}absarc(e,t,s,r,a,c=!1){return this.absellipse(e,t,s,s,r,a,c,0)}arc(e,t,s,r,a,c=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),s,r,a,c)}absellipse(e,t,s,r,a,c,u=!1,l=0){let o=Number(e)||0,m=Number(t)||0,h=Math.max(0,Number(s)||0),i=Math.max(0,Number(r)||0),f=Number(a)||0,x=Number(c)||0,p=u?1:0,b=Number(l)||0;this.segments.push({type:"arc",pts:[o,m,h,i,f,x,p,b]});let y=Math.cos(b),g=Math.sin(b),S=h*Math.cos(x),d=i*Math.sin(x);return this.currentPoint.set(o+S*y-d*g,m+S*g+d*y),this}ellipse(e,t,s,r,a,c,u=!1,l=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),s,r,a,c,u,l)}closePath(){if(this.segments.length>0){let e=this.segments[0],t=0,s=0;if(e.type==="arc"){let r=e.pts[0],a=e.pts[1],c=e.pts[2],u=e.pts[3],l=e.pts[4],o=e.pts[7],m=Math.cos(o),h=Math.sin(o),i=c*Math.cos(l),f=u*Math.sin(l);t=r+i*m-f*h,s=a+i*h+f*m}else t=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-t,this.currentPoint.y-s)>1e-6&&this.lineTo(t,s)}return this}getPoints(e=12){let t=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],r=(a,c)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-a,u.y-c)<1e-6)return}s.push(new A(a,c))};for(let a of this.segments){let c=a.pts;if(a.type==="move"||a.type==="line")r(c[0],c[1]);else if(a.type==="quad"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5];r(u,l);for(let f=1;f<=t;f++){let x=f/t,p=1-x;r(p*p*u+2*p*x*o+x*x*h,p*p*l+2*p*x*m+x*x*i)}}else if(a.type==="cubic"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5],f=c[6],x=c[7];r(u,l);for(let p=1;p<=t;p++){let b=p/t,y=1-b,g=y*y,S=b*b;r(g*y*u+3*g*b*o+3*y*S*h+S*b*f,g*y*l+3*g*b*m+3*y*S*i+S*b*x)}}else if(a.type==="arc"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5],f=c[6]!==0,x=c[7],p=Math.PI*2,b=i-h,y=Math.abs(b)<1e-9;for(;b<0;)b+=p;for(;b>p;)b-=p;b<1e-9&&(b=y?0:p),f&&!y&&(b=b===p?-p:b-p);let g=Math.cos(x),S=Math.sin(x),d=Math.max(2,t);for(let w=0;w<=d;w++){let P=w/d,G=h+P*b,C=o*Math.cos(G),E=m*Math.sin(G);r(u+C*g-E*S,l+C*S+E*g)}}}if(s.length>2){let a=s[0],c=s[s.length-1];Math.hypot(a.x-c.x,a.y-c.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}}class xe extends fe{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(t=>t.getPoints(e))}}}function be(n){let e=0,t=n.length;for(let s=0,r=t-1;s<t;r=s++)e+=n[r].x*n[s].y-n[s].x*n[r].y;return e*.5}function fn(n,e,t,s,r,a,c,u){let l=c-t,o=u-s,m=r-t,h=a-s,i=n-t,f=e-s,x=l*l+o*o,p=l*m+o*h,b=l*i+o*f,y=m*m+h*h,g=m*i+h*f,S=x*y-p*p;if(Math.abs(S)<1e-12)return!1;let d=1/S,w=(y*b-p*g)*d,P=(x*g-p*b)*d;return w>=-1e-7&&P>=-1e-7&&w+P<=1+1e-7}function ze(n,e){let t=n.slice();be(t)<0&&t.reverse();let s=t.map(l=>new A(l.x,l.y)),r=t.map((l,o)=>o),a=[];for(let l of e){if(!l||l.length<3)continue;let o=l.slice();be(o)>0&&o.reverse();let m=[],h=-1/0,i=0;for(let f=0;f<o.length;f++){let x=o[f],p=s.length;s.push(new A(x.x,x.y)),m.push(p),x.x>h&&(h=x.x,i=f)}a.push({pts:o,indices:m,maxX:h,maxIdx:i})}a.sort((l,o)=>o.maxX-l.maxX);let c=(l,o,m)=>(o.x-l.x)*(m.y-l.y)-(o.y-l.y)*(m.x-l.x),u=(l,o,m)=>{for(let h=0;h<m.length;h++){let i=m[h],f=m[(h+1)%m.length];if(c(l,o,i)*c(l,o,f)<0&&c(i,f,l)*c(i,f,o)<0)return!0}return!1};for(let l of a){let o=l.pts[l.maxIdx],m=o.x,h=r.length,i=r.map(y=>s[y]),f=y=>Math.hypot(i[y].x-m,i[y].y-o.y),x=i.map((y,g)=>g).sort((y,g)=>+(i[y].x<m)-+(i[g].x<m)||f(y)-f(g)),p=x[0];for(let y of x){let g=i[y],S=i[(y+h-1)%h],d=i[(y+1)%h],w=c(g,d,o)>=0,P=c(S,g,o)>=0;if((c(S,g,d)>=0?w&&P:w||P)&&!u(o,g,i)&&!a.some(C=>u(o,g,C.pts))){p=y;break}}let b=[];for(let y=0;y<=p;y++)b.push(r[y]);for(let y=0;y<=l.indices.length;y++){let g=l.indices[(l.maxIdx+y)%l.indices.length];b.push(g)}for(let y=p;y<r.length;y++)b.push(r[y]);r=b}return{merged:r.map(l=>s[l]),mergedIndices:r,allVertices:s}}function Ie(n,e){let t=[],s=n.slice();if(s.length<3)return t;let r=s.length*s.length+64,a=0;for(;s.length>2&&r-- >0;){let c=s.length,u=s[(a+c-1)%c],l=s[a%c],o=s[(a+1)%c],m=e[u],h=e[l],i=e[o];if((h.x-m.x)*(i.y-m.y)-(h.y-m.y)*(i.x-m.x)>1e-9){let x=!0;for(let p=0;p<c;p++){let b=s[p];if(b===u||b===l||b===o)continue;let y=e[b];if(fn(y.x,y.y,m.x,m.y,h.x,h.y,i.x,i.y)&&Math.hypot(y.x-m.x,y.y-m.y)>=1e-6&&Math.hypot(y.x-h.x,y.y-h.y)>=1e-6&&Math.hypot(y.x-i.x,y.y-i.y)>=1e-6){x=!1;break}}if(x){t.push([u,l,o]),s.splice(a%c,1),a=Math.max(0,a%c-1);continue}}a++,a>=c*2&&(t.push([u,l,o]),s.splice((a-1)%c,1),a=0)}return t}function _e(n,e){let t=n instanceof xe?n.extractPoints(e):{shape:n.getPoints(e),holes:[]},s=t.shape.length;for(let r of t.holes)s+=r.length;if(s>we)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${we})`);return t}class xn extends ne{constructor(e=new xe,t=12){super();let s=Array.isArray(e)?e:[e],r=[],a=[],c=[],u=[];for(let l of s){if(!(l instanceof fe))continue;let o=_e(l,t);if(o.shape.length<3)continue;let{mergedIndices:m,allVertices:h}=ze(o.shape,o.holes),i=Ie(m,h),f=r.length/3,x=1/0,p=1/0,b=-1/0,y=-1/0;for(let d of h)d.x<x&&(x=d.x),d.y<p&&(p=d.y),d.x>b&&(b=d.x),d.y>y&&(y=d.y);let g=Math.max(1e-6,b-x),S=Math.max(1e-6,y-p);for(let d of h)r.push(d.x,d.y,0),a.push(0,0,1),c.push((d.x-x)/g,(d.y-p)/S);for(let[d,w,P]of i)u.push(f+d,f+w,f+P)}pe(this,r,a,c,u)}}function pe(n,e,t,s,r){return n.setAttribute("position",new Me(e,3)),n.setAttribute("normal",new Me(t,3)),n.setAttribute("uv",new Me(s,2)),n.setIndex(r),n}function bn(n){let e=n.length,t=[];for(let s=0;s<e;s++){let r=n[(s+e-1)%e],a=n[s],c=n[(s+1)%e],u=a.x-r.x,l=a.y-r.y,o=Math.hypot(u,l)||1;u/=o,l/=o;let m=c.x-a.x,h=c.y-a.y,i=Math.hypot(m,h)||1;m/=i,h/=i;let f=l,x=-u,p=h,b=-m,y=f+p,g=x+b,S=Math.hypot(y,g);if(S>1e-6){y/=S,g/=S;let d=Math.max(.35,y*f+g*x);t.push(new A(y/d,g/d))}else t.push(new A(f,x))}return t}class pn extends ne{constructor(e=new xe,t={}){super();let s=Array.isArray(e)?e:[e],r=Math.max(1,Math.min(64,Math.floor(D(t.curveSegments,12)))),a=D(t.depth??t.amount,1),c=Math.max(1,Math.min(32,Math.floor(D(t.steps,1)))),u=!!(t.bevelEnabled??!1),l=u?Math.max(0,D(t.bevelThickness,.06)):0,o=u?Math.max(0,D(t.bevelSize,l*.8)):0,m=u?D(t.bevelOffset,0):0,h=u?Math.max(1,Math.min(8,Math.floor(D(t.bevelSegments,2)))):0,i=[],f=[],x=[],p=[];for(let b of s){if(!(b instanceof fe))continue;let y=_e(b,r);if(y.shape.length<3)continue;let g=y.shape.slice();be(g)<0&&g.reverse();let S=[];for(let v of y.holes){if(v.length<3)continue;let k=v.slice();be(k)>0&&k.reverse(),S.push(k)}let{mergedIndices:d,allVertices:w}=ze(g,S),P=Ie(d,w),G=[g,...S],C=[];for(let v of G){let k=bn(v);for(let T of k)C.push(T)}let E=1/0,_=1/0,I=-1/0,B=-1/0;for(let v of w)v.x<E&&(E=v.x),v.y<_&&(_=v.y),v.x>I&&(I=v.x),v.y>B&&(B=v.y);let V=Math.max(1e-6,I-E),O=Math.max(1e-6,B-_),se=-l,oe=a+l,j=i.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;i.push(R,z,se),f.push(0,0,-1),x.push((R-E)/V,(z-_)/O)}for(let[v,k,T]of P)p.push(j+v,j+T,j+k);let q=i.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;i.push(R,z,oe),f.push(0,0,1),x.push((R-E)/V,(z-_)/O)}for(let[v,k,T]of P)p.push(q+v,q+k,q+T);let N=[];if(u&&h>0)for(let v=0;v<h;v++){let T=v/h*Math.PI/2;N.push({z:-l*Math.cos(T),expand:m+o*Math.sin(T)})}for(let v=0;v<=c;v++){let k=v/c;N.push({z:k*a,expand:m+o})}if(u&&h>0)for(let v=1;v<=h;v++){let T=v/h*Math.PI/2;N.push({z:a+l*Math.sin(T),expand:m+o*Math.cos(T)})}let Y=0;for(let v of G){let k=v.length;for(let T=0;T<N.length-1;T++){let R=N[T],z=N[T+1];for(let X=0;X<k;X++){let F=(X+1)%k,W=v[X],$=v[F],U=C[Y+X],Z=C[Y+F],K=W.x+U.x*R.expand,Q=W.y+U.y*R.expand,ee=$.x+Z.x*R.expand,H=$.y+Z.y*R.expand,wn=$.x+Z.x*z.expand,Gn=$.y+Z.y*z.expand,qe=W.x+U.x*z.expand,We=W.y+U.y*z.expand,$e=ee-K,Ue=H-Q,Ze=0,Ke=qe-K,Qe=We-Q,Je=z.z-R.z,re=Ue*Je-Ze*Qe,ie=Ze*Ke-$e*Je,ce=$e*Qe-Ue*Ke,Ce=Math.hypot(re,ie,ce)||1;re/=Ce,ie/=Ce,ce/=Ce;let ae=i.length/3;i.push(K,Q,R.z,ee,H,R.z,wn,Gn,z.z,qe,We,z.z),f.push(re,ie,ce,re,ie,ce,re,ie,ce,re,ie,ce);let en=X/k,nn=(X+1)/k,tn=T/(N.length-1),sn=(T+1)/(N.length-1);x.push(en,tn,nn,tn,nn,sn,en,sn),p.push(ae,ae+1,ae+2,ae,ae+2,ae+3)}}Y+=k}}pe(this,i,f,x,p)}}function Ve(n){return{x:n.x,y:n.y,z:n.z,nx:n.nx,ny:n.ny,nz:n.nz,u:n.u,v:n.v}}function gn(n){return{x:n.x,y:n.y,z:n.z,nx:-n.nx,ny:-n.ny,nz:-n.nz,u:n.u,v:n.v}}function dn(n,e,t){let s=n.nx+(e.nx-n.nx)*t,r=n.ny+(e.ny-n.ny)*t,a=n.nz+(e.nz-n.nz)*t,c=Math.hypot(s,r,a)||1;return{x:n.x+(e.x-n.x)*t,y:n.y+(e.y-n.y)*t,z:n.z+(e.z-n.z)*t,nx:s/c,ny:r/c,nz:a/c,u:n.u+(e.u-n.u)*t,v:n.v+(e.v-n.v)*t}}function vn(n){if(n.length<3)return null;let e=n[0],t=n[1],s=n[2],r=t.x-e.x,a=t.y-e.y,c=t.z-e.z,u=s.x-e.x,l=s.y-e.y,o=s.z-e.z,m=a*o-c*l,h=c*u-r*o,i=r*l-a*u,f=Math.hypot(m,h,i);if(f<1e-9)return null;m/=f,h/=f,i/=f;let x=m*e.x+h*e.y+i*e.z;return{vertices:n,nx:m,ny:h,nz:i,w:x}}function Sn(n){n.vertices.reverse();for(let e=0;e<n.vertices.length;e++)n.vertices[e]=gn(n.vertices[e]);n.nx=-n.nx,n.ny=-n.ny,n.nz=-n.nz,n.w=-n.w}let Ae=1e-5,Ne=0,Ge=1,ge=2,Xe=3;function Be(n,e,t,s,r,a,c,u,l){let o=0,m=[];for(let h=0;h<r.vertices.length;h++){let i=r.vertices[h],f=n*i.x+e*i.y+t*i.z-s,x=f<-Ae?ge:f>Ae?Ge:Ne;o|=x,m.push(x)}switch(o){case Ne:{n*r.nx+e*r.ny+t*r.nz>0?a.push(r):c.push(r);break}case Ge:u.push(r);break;case ge:l.push(r);break;case Xe:{let h=[],i=[],f=r.vertices.length;for(let g=0;g<f;g++){let S=(g+1)%f,d=m[g],w=m[S],P=r.vertices[g],G=r.vertices[S];if(d!==ge&&h.push(P),d!==Ge&&i.push(d!==ge?Ve(P):P),(d|w)===Xe){let C=G.x-P.x,E=G.y-P.y,_=G.z-P.z,I=n*C+e*E+t*_,B=Math.abs(I)>1e-12?(s-(n*P.x+e*P.y+t*P.z))/I:.5,V=dn(P,G,Math.max(0,Math.min(1,B)));h.push(V),i.push(Ve(V))}}let{nx:x,ny:p,nz:b,w:y}=r;h.length>=3&&u.push({vertices:h,nx:x,ny:p,nz:b,w:y}),i.length>=3&&l.push({vertices:i,nx:x,ny:p,nz:b,w:y});break}default:break}}class he{constructor(e,t=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,t)}invert(){for(let t=0;t<this.polygons.length;t++)Sn(this.polygons[t]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,t=0){if(!this.hasPlane||e.length===0)return e.slice();if(t>=te)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${te})`);let s=[],r=[];for(let a=0;a<e.length;a++)Be(this.nx,this.ny,this.nz,this.w,e[a],s,r,s,r);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,t+1)),this.back?r=r.length>0?this.back.clipPolygons(r,t+1):[]:r=[],s.concat(r)}clipTo(e,t=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),t<te&&(this.front&&this.front.clipTo(e,t+1),this.back&&this.back.clipTo(e,t+1))}allPolygons(e=[]){for(let t=0;t<this.polygons.length;t++)e.push(this.polygons[t]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,t=0){if(!e.length)return;if(!this.hasPlane){let a=e[e.length>>1];this.nx=a.nx,this.ny=a.ny,this.nz=a.nz,this.w=a.w,this.hasPlane=!0}if(t>=te)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${te})`);let s=[],r=[];for(let a=0;a<e.length;a++)Be(this.nx,this.ny,this.nz,this.w,e[a],this.polygons,this.polygons,s,r);s.length>0&&(this.front||(this.front=new he),this.front.build(s,t+1)),r.length>0&&(this.back||(this.back=new he),this.back.build(r,t+1))}}function De(n,e){if(!e&&n._csgPolygons)return n._csgPolygons;let t=n.attributes.position;if(!t||t.count===0)return[];let s=n.attributes.normal,r=n.attributes.uv,a=n.index?n.index.array:null,c=Math.floor(a?a.length/3:t.count/3);if(c>le)throw new RangeError(`SecurityError: CSG input triangle count (${c}) exceeds MAX_CSG_TRIANGLES (${le})`);let u=e?e.elements:null,l=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,o=u?new hn().getNormalMatrix(e).elements:null,m=i=>{let f=t.getX(i),x=t.getY(i),p=t.getZ(i),b=s?s.getX(i):NaN,y=s?s.getY(i):NaN,g=s?s.getZ(i):NaN;if(u&&o){let w=u[0]*f+u[4]*x+u[8]*p+u[12],P=u[1]*f+u[5]*x+u[9]*p+u[13],G=u[2]*f+u[6]*x+u[10]*p+u[14];f=w,x=P,p=G;let C=o[0]*b+o[3]*y+o[6]*g,E=o[1]*b+o[4]*y+o[7]*g,_=o[2]*b+o[5]*y+o[8]*g,I=Math.hypot(C,E,_)||1;b=C/I,y=E/I,g=_/I}let S=r?r.getX(i):0,d=r?r.getY(i):0;return{x:f,y:x,z:p,nx:b,ny:y,nz:g,u:S,v:d}},h=[];for(let i=0;i<c;i++){let f=a?a[i*3]:i*3,x=a?a[i*3+1]:i*3+1,p=a?a[i*3+2]:i*3+2,b=vn(l?[m(f),m(p),m(x)]:[m(f),m(x),m(p)]);b&&h.push(b)}return h}function Pn(n){let e=[],t=[],s=[],r=[];for(let c of n){let u=c.vertices;if(u.length<3)continue;let l=e.length/3;for(let o of u)e.push(o.x,o.y,o.z),Number.isFinite(o.nx)&&o.nx*o.nx+o.ny*o.ny+o.nz*o.nz>.5?t.push(o.nx,o.ny,o.nz):t.push(c.nx,c.ny,c.nz),s.push(o.u,o.v);for(let o=1;o<u.length-1;o++)r.push(l,l+o,l+o+1)}let a=pe(new ne,e,t,s,r);return a._csgPolygons=n,a}function Mn(n,e,t){if(n.length+e.length>le)throw new RangeError(`SecurityError: Combined CSG triangle count (${n.length+e.length}) exceeds MAX_CSG_TRIANGLES (${le})`);if(n.length===0)return t==="union"?e:[];if(e.length===0)return t==="intersect"?[]:n;let s=1/0,r=1/0,a=1/0,c=-1/0,u=-1/0,l=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let p=0;p<x.length;p++){let b=x[p];b.x<s&&(s=b.x),b.y<r&&(r=b.y),b.z<a&&(a=b.z),b.x>c&&(c=b.x),b.y>u&&(u=b.y),b.z>l&&(l=b.z)}}s-=1e-4,r-=1e-4,a-=1e-4,c+=1e-4,u+=1e-4,l+=1e-4;let o=[],m=[];for(let f=0;f<n.length;f++){let x=n[f],p=x.vertices,b=1/0,y=1/0,g=1/0,S=-1/0,d=-1/0,w=-1/0;for(let P=0;P<p.length;P++){let G=p[P];G.x<b&&(b=G.x),G.y<y&&(y=G.y),G.z<g&&(g=G.z),G.x>S&&(S=G.x),G.y>d&&(d=G.y),G.z>w&&(w=G.z)}S<s||b>c||d<r||y>u||w<a||g>l?m.push(x):o.push(x)}if(o.length===0)return t==="union"?n.concat(e):t==="subtract"?n:[];let h=new he(o),i=new he(e);return t==="union"?(h.clipTo(i),i.clipTo(h),i.invert(),i.clipTo(h),i.invert(),h.build(i.allPolygons()),m.concat(h.allPolygons())):t==="subtract"?(h.invert(),h.clipTo(i),i.clipTo(h),i.invert(),i.clipTo(h),i.invert(),h.build(i.allPolygons()),h.invert(),m.concat(h.allPolygons())):(h.invert(),i.clipTo(h),i.invert(),h.clipTo(i),i.clipTo(h),h.build(i.allPolygons()),h.invert(),h.allPolygons())}function Oe(n,e,t,s=null,r=null){let a=De(n,s),c=De(e,r);return Pn(Mn(a,c,t))}function ke(n,e,t){let s=n instanceof ye||!!n?.isMesh,r=e instanceof ye||!!e?.isMesh,a=s?n.geometry:n,c=r?e.geometry:e,u=null;if(r)if(e.updateMatrix(),s){n.updateMatrix();let h=new Pe().makeScale(1/(n.scale.x||1),1/(n.scale.y||1),1/(n.scale.z||1)),i=Math.hypot(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w)||1,f=new Pe().compose(new ue(0,0,0),new J(-n.quaternion.x/i,-n.quaternion.y/i,-n.quaternion.z/i,n.quaternion.w/i),new ue(1,1,1)),x=new Pe().makeTranslation(-n.position.x,-n.position.y,-n.position.z);u=h.multiply(f).multiply(x).multiply(e.matrix)}else u=e.matrix;let l=Oe(a,c,t,null,u),o=s?n.material:new Ee,m=new ye(l,o);return s&&(m.position.copy(n.position),m.quaternion.copy(n.quaternion),m.scale.copy(n.scale),m.name=n.name),m}let de={toGeometry:Oe,subtract(n,e){return ke(n,e,"subtract")},union(n,e){return ke(n,e,"union")},intersect(n,e){return ke(n,e,"intersect")}},Ye={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class Fe extends ne{constructor(e="",t={}){super();let s=String(e??"").slice(0,Re),r=Math.max(.005,Math.min(100,D(t.size,.2))),a=!!(t.bevelEnabled??!1),c=a?Math.max(0,Math.min(2,D(t.bevelThickness,r*.04))):0,u=a?Math.max(0,Math.min(2,D(t.bevelSize,r*.03))):0,l=Math.max(.001,Math.min(20,D(t.depth??t.height,r*.2)))+c*2,o=r*.085+u,m=r*.68,h=r*.82,i=[],f=[],x=[],p=[],b=(S,d,w,P,G,C,E)=>{let _=w-S,I=P-d,B=Math.hypot(_,I),V=1,O=0;B>1e-6&&(V=_/B,O=I/B);let se=-O*G,oe=V*G,j=V*G*.6,q=O*G*.6,N=S-j+se,Y=d-q+oe,v=S-j-se,k=d-q-oe,T=w+j-se,R=P+q-oe,z=w+j+se,X=P+q+oe,F=(W,$,U,Z,K,Q,ee)=>{let H=i.length/3;i.push(W[0],W[1],W[2],$[0],$[1],$[2],U[0],U[1],U[2],Z[0],Z[1],Z[2]),f.push(K,Q,ee,K,Q,ee,K,Q,ee,K,Q,ee),x.push(0,0,1,0,1,1,0,1),p.push(H,H+1,H+2,H,H+2,H+3)};F([N,Y,E],[v,k,E],[T,R,E],[z,X,E],0,0,1),F([v,k,C],[N,Y,C],[z,X,C],[T,R,C],0,0,-1),F([N,Y,C],[v,k,C],[v,k,E],[N,Y,E],-V,-O,0),F([T,R,C],[z,X,C],[z,X,E],[T,R,E],V,O,0),F([v,k,C],[T,R,C],[T,R,E],[v,k,E],O,-V,0),F([z,X,C],[N,Y,C],[N,Y,E],[z,X,E],-O,V,0)},y=0,g=0;for(let S=0;S<s.length;S++){let d=s[S];if(d===`
|
|
18
|
+
`){y=0,g-=r*1.35;continue}if(d===" "||d===" "){y+=h*(d===" "?.75:3);continue}if(d==="\r")continue;let w=d.toUpperCase(),P=d!==w&&d>="a"&&d<="z",G=Ye[w]??Ye["?"],C=P?r*.76:r,E=P?m*.88:m;for(let _ of G)for(let I=0;I<_.length-1;I++){let B=_[I],V=_[I+1];b(y+B[0]*E,g+B[1]*C,y+V[0]*E,g+V[1]*C,o,-l*.5,l*.5)}y+=P?h*.88:h}pe(this,i,f,x,p),t.center!==!1?this.center():this.computeBoundingBox()}}function He(n){if(!n)return;let e=n,t=n.userData?.xr?.text;if(t!=null&&t!==!1){let r=e.geometry?.attributes?.position;if((!r||r.count===0)&&n.userData._textApplied!==!0){let a="",c=.08,u=.015,l;if(typeof t=="string"||typeof t=="number")a=String(t);else if(typeof t=="object"){let o=t;a=String(o.text??o.value??""),o.size!==void 0&&(c=Number(o.size)||.08),(o.depth!==void 0||o.height!==void 0)&&(u=Number(o.depth??o.height)||c*.2),(typeof o.color=="string"||typeof o.color=="number")&&(l=o.color)}a.trim().length>0&&(e.geometry=new Fe(a,{size:c,depth:u}),n.userData._textApplied=!0,e.material instanceof yn?l!==void 0&&n.userData._autoTextColorApplied!==!0&&(e.material.color=new mn(l),n.userData._autoTextColorApplied=!0):e.material=new Ee({color:l??16317180}))}}let s=n.userData?.csg;if(s&&typeof s=="object"&&n.userData._csgApplied!==!0&&e.geometry instanceof ne&&e.geometry.attributes.position?.count>0){n.userData._csgApplied=!0;let r=Array.isArray(s)?s:[s],a=e.geometry;for(let c of r){if(!c||typeof c!="object")continue;let u=c,l=String(u.op??u.operation??"subtract"),o=l==="union"||l==="intersect"?l:"subtract",m=u.target??u.mesh??u.geometry;if(m instanceof ye||m instanceof ne)try{let h=o==="union"?de.union(e,m):o==="intersect"?de.intersect(e,m):de.subtract(e,m);e.geometry!==a&&e.geometry.dispose?.(),e.geometry=h.geometry}catch(h){typeof console<"u"&&console.warn("[three-live] userData.csg skipped:",h)}}}}let je={Path:fe,Shape:xe,ShapeGeometry:xn,ExtrudeGeometry:pn,TextGeometry:Fe,CSG:de,MAX_CSG_TRIANGLES:le,MAX_BSP_DEPTH:te,MAX_TEXT_GEOMETRY_CHARS:Re,MAX_SHAPE_POINTS:we,materializeDeclarativeGeometry:He};return L&&typeof L=="object"&&(L.authorNamespace||(L.authorNamespace={}),Object.assign(L.authorNamespace,je),L.materializeDeclarativeGeometry=He),je}var Le={name:"cad",onRegister(){on(Se);let M=me(),L=M.threeNamespace??(typeof globalThis<"u"?globalThis.THREE:void 0);L&&Se(L,M)}};rn(Le);
|
package/dist/three-live-cad.d.ts
CHANGED
|
@@ -169,6 +169,18 @@ export interface ThreeLiveAttributes {
|
|
|
169
169
|
'shadow-softness'?: number | string;
|
|
170
170
|
/** Tone mapping mode ("neutral", "aces", "agx", "reinhard", "none"). */
|
|
171
171
|
'tone-mapping'?: string;
|
|
172
|
+
/** Dual-Kawase bloom intensity (0.0 to 5.0). */
|
|
173
|
+
'bloom'?: number | string;
|
|
174
|
+
/** Luminance threshold for bloom extraction (default: 0.8). */
|
|
175
|
+
'bloom-threshold'?: number | string;
|
|
176
|
+
/** Blur radius multiplier for bloom passes (default: 0.5). */
|
|
177
|
+
'bloom-radius'?: number | string;
|
|
178
|
+
/** Declarative silhouette outline toggle or config. */
|
|
179
|
+
'outline'?: boolean | string;
|
|
180
|
+
/** Highlight the currently `selected-mesh` with a silhouette outline. */
|
|
181
|
+
'outline-selected'?: boolean | string;
|
|
182
|
+
/** Silhouette outline CSS hex color (default: "#38bdf8"). */
|
|
183
|
+
'outline-color'?: string;
|
|
172
184
|
/** Enable or disable interactive camera orbit/pan/zoom controls (default: true). */
|
|
173
185
|
'camera-controls'?: boolean | string;
|
|
174
186
|
/** Automatically start keyframe animation playback. */
|
|
@@ -210,6 +222,16 @@ export interface ThreeLiveAttributes {
|
|
|
210
222
|
// React 19 / JSX Event Listeners
|
|
211
223
|
onload?: (e: CustomEvent<{model: GLBData}>) => void;
|
|
212
224
|
onerror?: (e: CustomEvent<{error: any}>) => void;
|
|
225
|
+
'onthree-load'?: (
|
|
226
|
+
e: CustomEvent<{model: GLBData; source?: 'src' | 'model'}>,
|
|
227
|
+
) => void;
|
|
228
|
+
'onthree-error'?: (
|
|
229
|
+
e: CustomEvent<{error: any; message: string; stage: string}>,
|
|
230
|
+
) => void;
|
|
231
|
+
'onthree-context-lost'?: (e: CustomEvent<{originalEvent?: Event}>) => void;
|
|
232
|
+
'onthree-context-restored'?: (
|
|
233
|
+
e: CustomEvent<{originalEvent?: Event}>,
|
|
234
|
+
) => void;
|
|
213
235
|
onmeshclick?: (e: CustomEvent<HitDetail>) => void;
|
|
214
236
|
'oncamera-change'?: (e: CustomEvent<CameraDetail>) => void;
|
|
215
237
|
'onvariant-applied'?: (e: CustomEvent<{variantName: string | null}>) => void;
|
package/dist/three-live-cad.js
CHANGED
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
var de="__THREE_LIVE_REGISTRY__";function me(){let L=typeof globalThis<"u"?globalThis:{};if(!L[de]){let E={plugins:[],decoders:new Map};try{Object.defineProperty(L,de,{value:E,writable:!1,configurable:!1,enumerable:!1})}catch{L[de]=E}}return L[de]}var Gn=me().plugins;function nn(L){let E=me();E.workerExtensionInstallers||(E.workerExtensionInstallers=[]),E.workerExtensionInstallers.includes(L)||E.workerExtensionInstallers.push(L)}function tn(L){let E=me().plugins;E.some(Y=>Y.name===L.name)||E.push(L),L.onRegister?.()}var Sn=8192,Pn=2048,Mn=128,wn=4096;function Ge(L,E){if(!L||!L.BufferGeometry)return null;let Y=L.Vector2,ke=L.Vector3,on=L.Quaternion,ve=L.Matrix4,rn=L.Matrix3,cn=L.Color,X=L.BufferAttribute,te=L.BufferGeometry,an=L.Material,Ce=L.MeshStandardMaterial,ye=L.Mesh,le=8192,se=2048,Te=128,Se=4096,B=(t,e)=>{let n=t==null?NaN:Number(t);return Number.isFinite(n)?n:e};class fe{constructor(e){this.currentPoint=new Y(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){let s=Number(e)||0,r=Number(n)||0;return this.currentPoint.set(s,r),this.segments.push({type:"move",pts:[s,r]}),this}lineTo(e,n){let s=Number(e)||0,r=Number(n)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,r),this.segments.push({type:"line",pts:[s,r]}),this}quadraticCurveTo(e,n,s,r){let i=this.currentPoint.x,a=this.currentPoint.y,u=Number(e)||0,h=Number(n)||0,o=Number(s)||0,m=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[i,a]}),this.currentPoint.set(o,m),this.segments.push({type:"quad",pts:[i,a,u,h,o,m]}),this}bezierCurveTo(e,n,s,r,i,a){let u=this.currentPoint.x,h=this.currentPoint.y,o=Number(e)||0,m=Number(n)||0,l=Number(s)||0,c=Number(r)||0,f=Number(i)||0,x=Number(a)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,h]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[u,h,o,m,l,c,f,x]}),this}absarc(e,n,s,r,i,a=!1){return this.absellipse(e,n,s,s,r,i,a,0)}arc(e,n,s,r,i,a=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),s,r,i,a)}absellipse(e,n,s,r,i,a,u=!1,h=0){let o=Number(e)||0,m=Number(n)||0,l=Math.max(0,Number(s)||0),c=Math.max(0,Number(r)||0),f=Number(i)||0,x=Number(a)||0,p=u?1:0,b=Number(h)||0;this.segments.push({type:"arc",pts:[o,m,l,c,f,x,p,b]});let y=Math.cos(b),g=Math.sin(b),S=l*Math.cos(x),d=c*Math.sin(x);return this.currentPoint.set(o+S*y-d*g,m+S*g+d*y),this}ellipse(e,n,s,r,i,a,u=!1,h=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),s,r,i,a,u,h)}closePath(){if(this.segments.length>0){let e=this.segments[0],n=0,s=0;if(e.type==="arc"){let r=e.pts[0],i=e.pts[1],a=e.pts[2],u=e.pts[3],h=e.pts[4],o=e.pts[7],m=Math.cos(o),l=Math.sin(o),c=a*Math.cos(h),f=u*Math.sin(h);n=r+c*m-f*l,s=i+c*l+f*m}else n=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-n,this.currentPoint.y-s)>1e-6&&this.lineTo(n,s)}return this}getPoints(e=12){let n=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],r=(i,a)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-i,u.y-a)<1e-6)return}s.push(new Y(i,a))};for(let i of this.segments){let a=i.pts;if(i.type==="move"||i.type==="line")r(a[0],a[1]);else if(i.type==="quad"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5];r(u,h);for(let f=1;f<=n;f++){let x=f/n,p=1-x;r(p*p*u+2*p*x*o+x*x*l,p*p*h+2*p*x*m+x*x*c)}}else if(i.type==="cubic"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5],f=a[6],x=a[7];r(u,h);for(let p=1;p<=n;p++){let b=p/n,y=1-b,g=y*y,S=b*b;r(g*y*u+3*g*b*o+3*y*S*l+S*b*f,g*y*h+3*g*b*m+3*y*S*c+S*b*x)}}else if(i.type==="arc"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5],f=a[6]!==0,x=a[7],p=Math.PI*2,b=c-l,y=Math.abs(b)<1e-9;for(;b<0;)b+=p;for(;b>p;)b-=p;b<1e-9&&(b=y?0:p),f&&!y&&(b=b===p?-p:b-p);let g=Math.cos(x),S=Math.sin(x),d=Math.max(2,n);for(let M=0;M<=d;M++){let P=M/d,w=l+P*b,k=o*Math.cos(w),T=m*Math.sin(w);r(u+k*g-T*S,h+k*S+T*g)}}}if(s.length>2){let i=s[0],a=s[s.length-1];Math.hypot(i.x-a.x,i.y-a.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}}class xe extends fe{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(n=>n.getPoints(e))}}}function be(t){let e=0,n=t.length;for(let s=0,r=n-1;s<n;r=s++)e+=t[r].x*t[s].y-t[s].x*t[r].y;return e*.5}function un(t,e,n,s,r,i,a,u){let h=a-n,o=u-s,m=r-n,l=i-s,c=t-n,f=e-s,x=h*h+o*o,p=h*m+o*l,b=h*c+o*f,y=m*m+l*l,g=m*c+l*f,S=x*y-p*p;if(Math.abs(S)<1e-12)return!1;let d=1/S,M=(y*b-p*g)*d,P=(x*g-p*b)*d;return M>=-1e-7&&P>=-1e-7&&M+P<=1+1e-7}function Le(t,e){let n=t.slice();be(n)<0&&n.reverse();let s=n.map(h=>new Y(h.x,h.y)),r=n.map((h,o)=>o),i=[];for(let h of e){if(!h||h.length<3)continue;let o=h.slice();be(o)>0&&o.reverse();let m=[],l=-1/0,c=0;for(let f=0;f<o.length;f++){let x=o[f],p=s.length;s.push(new Y(x.x,x.y)),m.push(p),x.x>l&&(l=x.x,c=f)}i.push({pts:o,indices:m,maxX:l,maxIdx:c})}i.sort((h,o)=>o.maxX-h.maxX);let a=(h,o,m)=>(o.x-h.x)*(m.y-h.y)-(o.y-h.y)*(m.x-h.x),u=(h,o,m)=>{for(let l=0;l<m.length;l++){let c=m[l],f=m[(l+1)%m.length];if(a(h,o,c)*a(h,o,f)<0&&a(c,f,h)*a(c,f,o)<0)return!0}return!1};for(let h of i){let o=h.pts[h.maxIdx],m=o.x,l=r.length,c=r.map(y=>s[y]),f=y=>Math.hypot(c[y].x-m,c[y].y-o.y),x=c.map((y,g)=>g).sort((y,g)=>+(c[y].x<m)-+(c[g].x<m)||f(y)-f(g)),p=x[0];for(let y of x){let g=c[y],S=c[(y+l-1)%l],d=c[(y+1)%l],M=a(g,d,o)>=0,P=a(S,g,o)>=0;if((a(S,g,d)>=0?M&&P:M||P)&&!u(o,g,c)&&!i.some(k=>u(o,g,k.pts))){p=y;break}}let b=[];for(let y=0;y<=p;y++)b.push(r[y]);for(let y=0;y<=h.indices.length;y++){let g=h.indices[(h.maxIdx+y)%h.indices.length];b.push(g)}for(let y=p;y<r.length;y++)b.push(r[y]);r=b}return{merged:r.map(h=>s[h]),mergedIndices:r,allVertices:s}}function Ee(t,e){let n=[],s=t.slice();if(s.length<3)return n;let r=s.length*s.length+64,i=0;for(;s.length>2&&r-- >0;){let a=s.length,u=s[(i+a-1)%a],h=s[i%a],o=s[(i+1)%a],m=e[u],l=e[h],c=e[o];if((l.x-m.x)*(c.y-m.y)-(l.y-m.y)*(c.x-m.x)>1e-9){let x=!0;for(let p=0;p<a;p++){let b=s[p];if(b===u||b===h||b===o)continue;let y=e[b];if(un(y.x,y.y,m.x,m.y,l.x,l.y,c.x,c.y)&&Math.hypot(y.x-m.x,y.y-m.y)>=1e-6&&Math.hypot(y.x-l.x,y.y-l.y)>=1e-6&&Math.hypot(y.x-c.x,y.y-c.y)>=1e-6){x=!1;break}}if(x){n.push([u,h,o]),s.splice(i%a,1),i=Math.max(0,i%a-1);continue}}i++,i>=a*2&&(n.push([u,h,o]),s.splice((i-1)%a,1),i=0)}return n}function Re(t,e){let n=t instanceof xe?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},s=n.shape.length;for(let r of n.holes)s+=r.length;if(s>Se)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${Se})`);return n}class ln extends te{constructor(e=new xe,n=12){super();let s=Array.isArray(e)?e:[e],r=[],i=[],a=[],u=[];for(let h of s){if(!(h instanceof fe))continue;let o=Re(h,n);if(o.shape.length<3)continue;let{mergedIndices:m,allVertices:l}=Le(o.shape,o.holes),c=Ee(m,l),f=r.length/3,x=1/0,p=1/0,b=-1/0,y=-1/0;for(let d of l)d.x<x&&(x=d.x),d.y<p&&(p=d.y),d.x>b&&(b=d.x),d.y>y&&(y=d.y);let g=Math.max(1e-6,b-x),S=Math.max(1e-6,y-p);for(let d of l)r.push(d.x,d.y,0),i.push(0,0,1),a.push((d.x-x)/g,(d.y-p)/S);for(let[d,M,P]of c)u.push(f+d,f+M,f+P)}this.setAttribute("position",new X(D(r),3)),this.setAttribute("normal",new X(D(i),3)),this.setAttribute("uv",new X(D(a),2)),this.setIndex(u)}}function D(t){let e=t.length,n=new Float32Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}function hn(t){let e=t.length,n=[];for(let s=0;s<e;s++){let r=t[(s+e-1)%e],i=t[s],a=t[(s+1)%e],u=i.x-r.x,h=i.y-r.y,o=Math.hypot(u,h)||1;u/=o,h/=o;let m=a.x-i.x,l=a.y-i.y,c=Math.hypot(m,l)||1;m/=c,l/=c;let f=h,x=-u,p=l,b=-m,y=f+p,g=x+b,S=Math.hypot(y,g);if(S>1e-6){y/=S,g/=S;let d=Math.max(.35,y*f+g*x);n.push(new Y(y/d,g/d))}else n.push(new Y(f,x))}return n}class mn extends te{constructor(e=new xe,n={}){super();let s=Array.isArray(e)?e:[e],r=Math.max(1,Math.min(64,Math.floor(B(n.curveSegments,12)))),i=B(n.depth??n.amount,1),a=Math.max(1,Math.min(32,Math.floor(B(n.steps,1)))),u=!!(n.bevelEnabled??!1),h=u?Math.max(0,B(n.bevelThickness,.06)):0,o=u?Math.max(0,B(n.bevelSize,h*.8)):0,m=u?B(n.bevelOffset,0):0,l=u?Math.max(1,Math.min(8,Math.floor(B(n.bevelSegments,2)))):0,c=[],f=[],x=[],p=[];for(let b of s){if(!(b instanceof fe))continue;let y=Re(b,r);if(y.shape.length<3)continue;let g=y.shape.slice();be(g)<0&&g.reverse();let S=[];for(let v of y.holes){if(v.length<3)continue;let G=v.slice();be(G)>0&&G.reverse(),S.push(G)}let{mergedIndices:d,allVertices:M}=Le(g,S),P=Ee(d,M),w=[g,...S],k=[];for(let v of w){let G=hn(v);for(let C of G)k.push(C)}let T=1/0,V=1/0,I=-1/0,O=-1/0;for(let v of M)v.x<T&&(T=v.x),v.y<V&&(V=v.y),v.x>I&&(I=v.x),v.y>O&&(O=v.y);let _=Math.max(1e-6,I-T),H=Math.max(1e-6,O-V),oe=-h,re=i+h,j=c.length/3;for(let v=0;v<M.length;v++){let G=M[v],C=k[v]??new Y(0,0),R=G.x+C.x*m,z=G.y+C.y*m;c.push(R,z,oe),f.push(0,0,-1),x.push((R-T)/_,(z-V)/H)}for(let[v,G,C]of P)p.push(j+v,j+C,j+G);let $=c.length/3;for(let v=0;v<M.length;v++){let G=M[v],C=k[v]??new Y(0,0),R=G.x+C.x*m,z=G.y+C.y*m;c.push(R,z,re),f.push(0,0,1),x.push((R-T)/_,(z-V)/H)}for(let[v,G,C]of P)p.push($+v,$+G,$+C);let A=[];if(u&&l>0)for(let v=0;v<l;v++){let C=v/l*Math.PI/2;A.push({z:-h*Math.cos(C),expand:m+o*Math.sin(C)})}for(let v=0;v<=a;v++){let G=v/a;A.push({z:G*i,expand:m+o})}if(u&&l>0)for(let v=1;v<=l;v++){let C=v/l*Math.PI/2;A.push({z:i+h*Math.sin(C),expand:m+o*Math.cos(C)})}let F=0;for(let v of w){let G=v.length;for(let C=0;C<A.length-1;C++){let R=A[C],z=A[C+1];for(let N=0;N<G;N++){let q=(N+1)%G,Z=v[N],U=v[q],Q=k[F+N],K=k[F+q],J=Z.x+Q.x*R.expand,ee=Z.y+Q.y*R.expand,ne=U.x+K.x*R.expand,W=U.y+K.y*R.expand,dn=U.x+K.x*z.expand,vn=U.y+K.y*z.expand,He=Z.x+Q.x*z.expand,Fe=Z.y+Q.y*z.expand,qe=ne-J,We=W-ee,je=0,$e=He-J,Ze=Fe-ee,Ue=z.z-R.z,ie=We*Ue-je*Ze,ce=je*$e-qe*Ue,ae=qe*Ze-We*$e,we=Math.hypot(ie,ce,ae)||1;ie/=we,ce/=we,ae/=we;let ue=c.length/3;c.push(J,ee,R.z,ne,W,R.z,dn,vn,z.z,He,Fe,z.z),f.push(ie,ce,ae,ie,ce,ae,ie,ce,ae,ie,ce,ae);let Qe=N/G,Ke=(N+1)/G,Je=C/(A.length-1),en=(C+1)/(A.length-1);x.push(Qe,Je,Ke,Je,Ke,en,Qe,en),p.push(ue,ue+1,ue+2,ue,ue+2,ue+3)}}F+=G}}this.setAttribute("position",new X(D(c),3)),this.setAttribute("normal",new X(D(f),3)),this.setAttribute("uv",new X(D(x),2)),this.setIndex(p)}}function ze(t){return{x:t.x,y:t.y,z:t.z,nx:t.nx,ny:t.ny,nz:t.nz,u:t.u,v:t.v}}function yn(t){return{x:t.x,y:t.y,z:t.z,nx:-t.nx,ny:-t.ny,nz:-t.nz,u:t.u,v:t.v}}function fn(t,e,n){let s=t.nx+(e.nx-t.nx)*n,r=t.ny+(e.ny-t.ny)*n,i=t.nz+(e.nz-t.nz)*n,a=Math.hypot(s,r,i)||1;return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n,z:t.z+(e.z-t.z)*n,nx:s/a,ny:r/a,nz:i/a,u:t.u+(e.u-t.u)*n,v:t.v+(e.v-t.v)*n}}function xn(t){if(t.length<3)return null;let e=t[0],n=t[1],s=t[2],r=n.x-e.x,i=n.y-e.y,a=n.z-e.z,u=s.x-e.x,h=s.y-e.y,o=s.z-e.z,m=i*o-a*h,l=a*u-r*o,c=r*h-i*u,f=Math.hypot(m,l,c);if(f<1e-9)return null;m/=f,l/=f,c/=f;let x=m*e.x+l*e.y+c*e.z;return{vertices:t,nx:m,ny:l,nz:c,w:x}}function bn(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=yn(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let Ie=1e-5,Ve=0,Pe=1,pe=2,_e=3;function Ae(t,e,n,s,r,i,a,u,h){let o=0,m=[];for(let l=0;l<r.vertices.length;l++){let c=r.vertices[l],f=t*c.x+e*c.y+n*c.z-s,x=f<-Ie?pe:f>Ie?Pe:Ve;o|=x,m.push(x)}switch(o){case Ve:{t*r.nx+e*r.ny+n*r.nz>0?i.push(r):a.push(r);break}case Pe:u.push(r);break;case pe:h.push(r);break;case _e:{let l=[],c=[],f=r.vertices.length;for(let g=0;g<f;g++){let S=(g+1)%f,d=m[g],M=m[S],P=r.vertices[g],w=r.vertices[S];if(d!==pe&&l.push(P),d!==Pe&&c.push(d!==pe?ze(P):P),(d|M)===_e){let k=w.x-P.x,T=w.y-P.y,V=w.z-P.z,I=t*k+e*T+n*V,O=Math.abs(I)>1e-12?(s-(t*P.x+e*P.y+n*P.z))/I:.5,_=fn(P,w,Math.max(0,Math.min(1,O)));l.push(_),c.push(ze(_))}}let{nx:x,ny:p,nz:b,w:y}=r;l.length>=3&&u.push({vertices:l,nx:x,ny:p,nz:b,w:y}),c.length>=3&&h.push({vertices:c,nx:x,ny:p,nz:b,w:y});break}default:break}}class he{constructor(e,n=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,n)}invert(){for(let n=0;n<this.polygons.length;n++)bn(this.polygons[n]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,n=0){if(!this.hasPlane||e.length===0)return e.slice();if(n>=se)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${se})`);let s=[],r=[];for(let i=0;i<e.length;i++)Ae(this.nx,this.ny,this.nz,this.w,e[i],s,r,s,r);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,n+1)),this.back?r=r.length>0?this.back.clipPolygons(r,n+1):[]:r=[],s.concat(r)}clipTo(e,n=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),n<se&&(this.front&&this.front.clipTo(e,n+1),this.back&&this.back.clipTo(e,n+1))}allPolygons(e=[]){for(let n=0;n<this.polygons.length;n++)e.push(this.polygons[n]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,n=0){if(!e.length)return;if(!this.hasPlane){let i=e[e.length>>1];this.nx=i.nx,this.ny=i.ny,this.nz=i.nz,this.w=i.w,this.hasPlane=!0}if(n>=se)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${se})`);let s=[],r=[];for(let i=0;i<e.length;i++)Ae(this.nx,this.ny,this.nz,this.w,e[i],this.polygons,this.polygons,s,r);s.length>0&&(this.front||(this.front=new he),this.front.build(s,n+1)),r.length>0&&(this.back||(this.back=new he),this.back.build(r,n+1))}}function Ne(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let n=t.attributes.position;if(!n||n.count===0)return[];let s=t.attributes.normal,r=t.attributes.uv,i=t.index?t.index.array:null,a=Math.floor(i?i.length/3:n.count/3);if(a>le)throw new RangeError(`SecurityError: CSG input triangle count (${a}) exceeds MAX_CSG_TRIANGLES (${le})`);let u=e?e.elements:null,h=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,o=u?new rn().getNormalMatrix(e).elements:null,m=c=>{let f=n.getX(c),x=n.getY(c),p=n.getZ(c),b=s?s.getX(c):NaN,y=s?s.getY(c):NaN,g=s?s.getZ(c):NaN;if(u&&o){let M=u[0]*f+u[4]*x+u[8]*p+u[12],P=u[1]*f+u[5]*x+u[9]*p+u[13],w=u[2]*f+u[6]*x+u[10]*p+u[14];f=M,x=P,p=w;let k=o[0]*b+o[3]*y+o[6]*g,T=o[1]*b+o[4]*y+o[7]*g,V=o[2]*b+o[5]*y+o[8]*g,I=Math.hypot(k,T,V)||1;b=k/I,y=T/I,g=V/I}let S=r?r.getX(c):0,d=r?r.getY(c):0;return{x:f,y:x,z:p,nx:b,ny:y,nz:g,u:S,v:d}},l=[];for(let c=0;c<a;c++){let f=i?i[c*3]:c*3,x=i?i[c*3+1]:c*3+1,p=i?i[c*3+2]:c*3+2,b=xn(h?[m(f),m(p),m(x)]:[m(f),m(x),m(p)]);b&&l.push(b)}return l}function pn(t){let e=[],n=[],s=[],r=[];for(let a of t){let u=a.vertices;if(u.length<3)continue;let h=e.length/3;for(let o of u)e.push(o.x,o.y,o.z),Number.isFinite(o.nx)&&o.nx*o.nx+o.ny*o.ny+o.nz*o.nz>.5?n.push(o.nx,o.ny,o.nz):n.push(a.nx,a.ny,a.nz),s.push(o.u,o.v);for(let o=1;o<u.length-1;o++)r.push(h,h+o,h+o+1)}let i=new te;return i.setAttribute("position",new X(D(e),3)),i.setAttribute("normal",new X(D(n),3)),i.setAttribute("uv",new X(D(s),2)),i.setIndex(r),i._csgPolygons=t,i}function gn(t,e,n){if(t.length+e.length>le)throw new RangeError(`SecurityError: Combined CSG triangle count (${t.length+e.length}) exceeds MAX_CSG_TRIANGLES (${le})`);if(t.length===0)return n==="union"?e:[];if(e.length===0)return n==="intersect"?[]:t;let s=1/0,r=1/0,i=1/0,a=-1/0,u=-1/0,h=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let p=0;p<x.length;p++){let b=x[p];b.x<s&&(s=b.x),b.y<r&&(r=b.y),b.z<i&&(i=b.z),b.x>a&&(a=b.x),b.y>u&&(u=b.y),b.z>h&&(h=b.z)}}s-=1e-4,r-=1e-4,i-=1e-4,a+=1e-4,u+=1e-4,h+=1e-4;let o=[],m=[];for(let f=0;f<t.length;f++){let x=t[f],p=x.vertices,b=1/0,y=1/0,g=1/0,S=-1/0,d=-1/0,M=-1/0;for(let P=0;P<p.length;P++){let w=p[P];w.x<b&&(b=w.x),w.y<y&&(y=w.y),w.z<g&&(g=w.z),w.x>S&&(S=w.x),w.y>d&&(d=w.y),w.z>M&&(M=w.z)}S<s||b>a||d<r||y>u||M<i||g>h?m.push(x):o.push(x)}if(o.length===0)return n==="union"?t.concat(e):n==="subtract"?t:[];let l=new he(o),c=new he(e);return n==="union"?(l.clipTo(c),c.clipTo(l),c.invert(),c.clipTo(l),c.invert(),l.build(c.allPolygons()),m.concat(l.allPolygons())):n==="subtract"?(l.invert(),l.clipTo(c),c.clipTo(l),c.invert(),c.clipTo(l),c.invert(),l.build(c.allPolygons()),l.invert(),m.concat(l.allPolygons())):(l.invert(),c.clipTo(l),c.invert(),l.clipTo(c),c.clipTo(l),l.build(c.allPolygons()),l.invert(),l.allPolygons())}function Xe(t,e,n,s=null,r=null){let i=Ne(t,s),a=Ne(e,r);return pn(gn(i,a,n))}function Me(t,e,n){let s=t instanceof ye||!!t?.isMesh,r=e instanceof ye||!!e?.isMesh,i=s?t.geometry:t,a=r?e.geometry:e,u=null;if(r)if(e.updateMatrix(),s){t.updateMatrix();let l=new ve().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),c=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,f=new ve().compose(new ke(0,0,0),new on(-t.quaternion.x/c,-t.quaternion.y/c,-t.quaternion.z/c,t.quaternion.w/c),new ke(1,1,1)),x=new ve().makeTranslation(-t.position.x,-t.position.y,-t.position.z);u=l.multiply(f).multiply(x).multiply(e.matrix)}else u=e.matrix;let h=Xe(i,a,n,null,u),o=s?t.material:new Ce,m=new ye(h,o);return s&&(m.position.copy(t.position),m.quaternion.copy(t.quaternion),m.scale.copy(t.scale),m.name=t.name),m}let ge={toGeometry:Xe,subtract(t,e){return Me(t,e,"subtract")},union(t,e){return Me(t,e,"union")},intersect(t,e){return Me(t,e,"intersect")}},De={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class Oe extends te{constructor(e="",n={}){super();let s=String(e??"").slice(0,Te),r=Math.max(.005,Math.min(100,B(n.size,.2))),i=!!(n.bevelEnabled??!1),a=i?Math.max(0,Math.min(2,B(n.bevelThickness,r*.04))):0,u=i?Math.max(0,Math.min(2,B(n.bevelSize,r*.03))):0,h=Math.max(.001,Math.min(20,B(n.depth??n.height,r*.2)))+a*2,o=r*.085+u,m=r*.68,l=r*.82,c=[],f=[],x=[],p=[],b=(S,d,M,P,w,k,T)=>{let V=M-S,I=P-d,O=Math.hypot(V,I),_=1,H=0;O>1e-6&&(_=V/O,H=I/O);let oe=-H*w,re=_*w,j=_*w*.6,$=H*w*.6,A=S-j+oe,F=d-$+re,v=S-j-oe,G=d-$-re,C=M+j-oe,R=P+$-re,z=M+j+oe,N=P+$+re,q=(Z,U,Q,K,J,ee,ne)=>{let W=c.length/3;c.push(Z[0],Z[1],Z[2],U[0],U[1],U[2],Q[0],Q[1],Q[2],K[0],K[1],K[2]),f.push(J,ee,ne,J,ee,ne,J,ee,ne,J,ee,ne),x.push(0,0,1,0,1,1,0,1),p.push(W,W+1,W+2,W,W+2,W+3)};q([A,F,T],[v,G,T],[C,R,T],[z,N,T],0,0,1),q([v,G,k],[A,F,k],[z,N,k],[C,R,k],0,0,-1),q([A,F,k],[v,G,k],[v,G,T],[A,F,T],-_,-H,0),q([C,R,k],[z,N,k],[z,N,T],[C,R,T],_,H,0),q([v,G,k],[C,R,k],[C,R,T],[v,G,T],H,-_,0),q([z,N,k],[A,F,k],[A,F,T],[z,N,T],-H,_,0)},y=0,g=0;for(let S=0;S<s.length;S++){let d=s[S];if(d===`
|
|
18
|
-
`){y=0,g-=r*1.35;continue}if(d===" "||d===" "){y+=
|
|
17
|
+
var ge="__THREE_LIVE_REGISTRY__";function le(){let L=typeof globalThis<"u"?globalThis:{};if(!L[ge]){let E={plugins:[],decoders:new Map};try{Object.defineProperty(L,ge,{value:E,writable:!1,configurable:!1,enumerable:!1})}catch{L[ge]=E}}return L[ge]}var Gn=le().plugins;function nn(L){let E=le();E.workerExtensionInstallers||(E.workerExtensionInstallers=[]),E.workerExtensionInstallers.includes(L)||E.workerExtensionInstallers.push(L)}function tn(L){let E=le().plugins;E.some(D=>D.name===L.name)||E.push(L),L.onRegister?.()}var Sn=8192,Pn=2048,Mn=128,wn=4096;function Ge(L,E){if(!L||!L.BufferGeometry)return null;let D=L.Vector2,ke=L.Vector3,on=L.Quaternion,de=L.Matrix4,rn=L.Matrix3,cn=L.Color,ve=L.BufferAttribute,ee=L.BufferGeometry,an=L.Material,Ce=L.MeshStandardMaterial,he=L.Mesh,ae=8192,ne=2048,Te=128,Se=4096,B=(n,e)=>{let t=n==null?NaN:Number(n);return Number.isFinite(t)?t:e};class me{constructor(e){this.currentPoint=new D(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){let s=Number(e)||0,r=Number(t)||0;return this.currentPoint.set(s,r),this.segments.push({type:"move",pts:[s,r]}),this}lineTo(e,t){let s=Number(e)||0,r=Number(t)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,r),this.segments.push({type:"line",pts:[s,r]}),this}quadraticCurveTo(e,t,s,r){let a=this.currentPoint.x,c=this.currentPoint.y,u=Number(e)||0,l=Number(t)||0,o=Number(s)||0,m=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,c]}),this.currentPoint.set(o,m),this.segments.push({type:"quad",pts:[a,c,u,l,o,m]}),this}bezierCurveTo(e,t,s,r,a,c){let u=this.currentPoint.x,l=this.currentPoint.y,o=Number(e)||0,m=Number(t)||0,h=Number(s)||0,i=Number(r)||0,f=Number(a)||0,x=Number(c)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,l]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[u,l,o,m,h,i,f,x]}),this}absarc(e,t,s,r,a,c=!1){return this.absellipse(e,t,s,s,r,a,c,0)}arc(e,t,s,r,a,c=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),s,r,a,c)}absellipse(e,t,s,r,a,c,u=!1,l=0){let o=Number(e)||0,m=Number(t)||0,h=Math.max(0,Number(s)||0),i=Math.max(0,Number(r)||0),f=Number(a)||0,x=Number(c)||0,p=u?1:0,b=Number(l)||0;this.segments.push({type:"arc",pts:[o,m,h,i,f,x,p,b]});let y=Math.cos(b),g=Math.sin(b),S=h*Math.cos(x),d=i*Math.sin(x);return this.currentPoint.set(o+S*y-d*g,m+S*g+d*y),this}ellipse(e,t,s,r,a,c,u=!1,l=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),s,r,a,c,u,l)}closePath(){if(this.segments.length>0){let e=this.segments[0],t=0,s=0;if(e.type==="arc"){let r=e.pts[0],a=e.pts[1],c=e.pts[2],u=e.pts[3],l=e.pts[4],o=e.pts[7],m=Math.cos(o),h=Math.sin(o),i=c*Math.cos(l),f=u*Math.sin(l);t=r+i*m-f*h,s=a+i*h+f*m}else t=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-t,this.currentPoint.y-s)>1e-6&&this.lineTo(t,s)}return this}getPoints(e=12){let t=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],r=(a,c)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-a,u.y-c)<1e-6)return}s.push(new D(a,c))};for(let a of this.segments){let c=a.pts;if(a.type==="move"||a.type==="line")r(c[0],c[1]);else if(a.type==="quad"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5];r(u,l);for(let f=1;f<=t;f++){let x=f/t,p=1-x;r(p*p*u+2*p*x*o+x*x*h,p*p*l+2*p*x*m+x*x*i)}}else if(a.type==="cubic"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5],f=c[6],x=c[7];r(u,l);for(let p=1;p<=t;p++){let b=p/t,y=1-b,g=y*y,S=b*b;r(g*y*u+3*g*b*o+3*y*S*h+S*b*f,g*y*l+3*g*b*m+3*y*S*i+S*b*x)}}else if(a.type==="arc"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5],f=c[6]!==0,x=c[7],p=Math.PI*2,b=i-h,y=Math.abs(b)<1e-9;for(;b<0;)b+=p;for(;b>p;)b-=p;b<1e-9&&(b=y?0:p),f&&!y&&(b=b===p?-p:b-p);let g=Math.cos(x),S=Math.sin(x),d=Math.max(2,t);for(let M=0;M<=d;M++){let P=M/d,w=h+P*b,k=o*Math.cos(w),T=m*Math.sin(w);r(u+k*g-T*S,l+k*S+T*g)}}}if(s.length>2){let a=s[0],c=s[s.length-1];Math.hypot(a.x-c.x,a.y-c.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}}class ye extends me{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(t=>t.getPoints(e))}}}function fe(n){let e=0,t=n.length;for(let s=0,r=t-1;s<t;r=s++)e+=n[r].x*n[s].y-n[s].x*n[r].y;return e*.5}function un(n,e,t,s,r,a,c,u){let l=c-t,o=u-s,m=r-t,h=a-s,i=n-t,f=e-s,x=l*l+o*o,p=l*m+o*h,b=l*i+o*f,y=m*m+h*h,g=m*i+h*f,S=x*y-p*p;if(Math.abs(S)<1e-12)return!1;let d=1/S,M=(y*b-p*g)*d,P=(x*g-p*b)*d;return M>=-1e-7&&P>=-1e-7&&M+P<=1+1e-7}function Le(n,e){let t=n.slice();fe(t)<0&&t.reverse();let s=t.map(l=>new D(l.x,l.y)),r=t.map((l,o)=>o),a=[];for(let l of e){if(!l||l.length<3)continue;let o=l.slice();fe(o)>0&&o.reverse();let m=[],h=-1/0,i=0;for(let f=0;f<o.length;f++){let x=o[f],p=s.length;s.push(new D(x.x,x.y)),m.push(p),x.x>h&&(h=x.x,i=f)}a.push({pts:o,indices:m,maxX:h,maxIdx:i})}a.sort((l,o)=>o.maxX-l.maxX);let c=(l,o,m)=>(o.x-l.x)*(m.y-l.y)-(o.y-l.y)*(m.x-l.x),u=(l,o,m)=>{for(let h=0;h<m.length;h++){let i=m[h],f=m[(h+1)%m.length];if(c(l,o,i)*c(l,o,f)<0&&c(i,f,l)*c(i,f,o)<0)return!0}return!1};for(let l of a){let o=l.pts[l.maxIdx],m=o.x,h=r.length,i=r.map(y=>s[y]),f=y=>Math.hypot(i[y].x-m,i[y].y-o.y),x=i.map((y,g)=>g).sort((y,g)=>+(i[y].x<m)-+(i[g].x<m)||f(y)-f(g)),p=x[0];for(let y of x){let g=i[y],S=i[(y+h-1)%h],d=i[(y+1)%h],M=c(g,d,o)>=0,P=c(S,g,o)>=0;if((c(S,g,d)>=0?M&&P:M||P)&&!u(o,g,i)&&!a.some(k=>u(o,g,k.pts))){p=y;break}}let b=[];for(let y=0;y<=p;y++)b.push(r[y]);for(let y=0;y<=l.indices.length;y++){let g=l.indices[(l.maxIdx+y)%l.indices.length];b.push(g)}for(let y=p;y<r.length;y++)b.push(r[y]);r=b}return{merged:r.map(l=>s[l]),mergedIndices:r,allVertices:s}}function Ee(n,e){let t=[],s=n.slice();if(s.length<3)return t;let r=s.length*s.length+64,a=0;for(;s.length>2&&r-- >0;){let c=s.length,u=s[(a+c-1)%c],l=s[a%c],o=s[(a+1)%c],m=e[u],h=e[l],i=e[o];if((h.x-m.x)*(i.y-m.y)-(h.y-m.y)*(i.x-m.x)>1e-9){let x=!0;for(let p=0;p<c;p++){let b=s[p];if(b===u||b===l||b===o)continue;let y=e[b];if(un(y.x,y.y,m.x,m.y,h.x,h.y,i.x,i.y)&&Math.hypot(y.x-m.x,y.y-m.y)>=1e-6&&Math.hypot(y.x-h.x,y.y-h.y)>=1e-6&&Math.hypot(y.x-i.x,y.y-i.y)>=1e-6){x=!1;break}}if(x){t.push([u,l,o]),s.splice(a%c,1),a=Math.max(0,a%c-1);continue}}a++,a>=c*2&&(t.push([u,l,o]),s.splice((a-1)%c,1),a=0)}return t}function Re(n,e){let t=n instanceof ye?n.extractPoints(e):{shape:n.getPoints(e),holes:[]},s=t.shape.length;for(let r of t.holes)s+=r.length;if(s>Se)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${Se})`);return t}class ln extends ee{constructor(e=new ye,t=12){super();let s=Array.isArray(e)?e:[e],r=[],a=[],c=[],u=[];for(let l of s){if(!(l instanceof me))continue;let o=Re(l,t);if(o.shape.length<3)continue;let{mergedIndices:m,allVertices:h}=Le(o.shape,o.holes),i=Ee(m,h),f=r.length/3,x=1/0,p=1/0,b=-1/0,y=-1/0;for(let d of h)d.x<x&&(x=d.x),d.y<p&&(p=d.y),d.x>b&&(b=d.x),d.y>y&&(y=d.y);let g=Math.max(1e-6,b-x),S=Math.max(1e-6,y-p);for(let d of h)r.push(d.x,d.y,0),a.push(0,0,1),c.push((d.x-x)/g,(d.y-p)/S);for(let[d,M,P]of i)u.push(f+d,f+M,f+P)}xe(this,r,a,c,u)}}function xe(n,e,t,s,r){return n.setAttribute("position",new ve(e,3)),n.setAttribute("normal",new ve(t,3)),n.setAttribute("uv",new ve(s,2)),n.setIndex(r),n}function hn(n){let e=n.length,t=[];for(let s=0;s<e;s++){let r=n[(s+e-1)%e],a=n[s],c=n[(s+1)%e],u=a.x-r.x,l=a.y-r.y,o=Math.hypot(u,l)||1;u/=o,l/=o;let m=c.x-a.x,h=c.y-a.y,i=Math.hypot(m,h)||1;m/=i,h/=i;let f=l,x=-u,p=h,b=-m,y=f+p,g=x+b,S=Math.hypot(y,g);if(S>1e-6){y/=S,g/=S;let d=Math.max(.35,y*f+g*x);t.push(new D(y/d,g/d))}else t.push(new D(f,x))}return t}class mn extends ee{constructor(e=new ye,t={}){super();let s=Array.isArray(e)?e:[e],r=Math.max(1,Math.min(64,Math.floor(B(t.curveSegments,12)))),a=B(t.depth??t.amount,1),c=Math.max(1,Math.min(32,Math.floor(B(t.steps,1)))),u=!!(t.bevelEnabled??!1),l=u?Math.max(0,B(t.bevelThickness,.06)):0,o=u?Math.max(0,B(t.bevelSize,l*.8)):0,m=u?B(t.bevelOffset,0):0,h=u?Math.max(1,Math.min(8,Math.floor(B(t.bevelSegments,2)))):0,i=[],f=[],x=[],p=[];for(let b of s){if(!(b instanceof me))continue;let y=Re(b,r);if(y.shape.length<3)continue;let g=y.shape.slice();fe(g)<0&&g.reverse();let S=[];for(let v of y.holes){if(v.length<3)continue;let G=v.slice();fe(G)>0&&G.reverse(),S.push(G)}let{mergedIndices:d,allVertices:M}=Le(g,S),P=Ee(d,M),w=[g,...S],k=[];for(let v of w){let G=hn(v);for(let C of G)k.push(C)}let T=1/0,_=1/0,I=-1/0,X=-1/0;for(let v of M)v.x<T&&(T=v.x),v.y<_&&(_=v.y),v.x>I&&(I=v.x),v.y>X&&(X=v.y);let V=Math.max(1e-6,I-T),O=Math.max(1e-6,X-_),te=-l,se=a+l,j=i.length/3;for(let v=0;v<M.length;v++){let G=M[v],C=k[v]??new D(0,0),R=G.x+C.x*m,z=G.y+C.y*m;i.push(R,z,te),f.push(0,0,-1),x.push((R-T)/V,(z-_)/O)}for(let[v,G,C]of P)p.push(j+v,j+C,j+G);let q=i.length/3;for(let v=0;v<M.length;v++){let G=M[v],C=k[v]??new D(0,0),R=G.x+C.x*m,z=G.y+C.y*m;i.push(R,z,se),f.push(0,0,1),x.push((R-T)/V,(z-_)/O)}for(let[v,G,C]of P)p.push(q+v,q+G,q+C);let A=[];if(u&&h>0)for(let v=0;v<h;v++){let C=v/h*Math.PI/2;A.push({z:-l*Math.cos(C),expand:m+o*Math.sin(C)})}for(let v=0;v<=c;v++){let G=v/c;A.push({z:G*a,expand:m+o})}if(u&&h>0)for(let v=1;v<=h;v++){let C=v/h*Math.PI/2;A.push({z:a+l*Math.sin(C),expand:m+o*Math.cos(C)})}let Y=0;for(let v of w){let G=v.length;for(let C=0;C<A.length-1;C++){let R=A[C],z=A[C+1];for(let N=0;N<G;N++){let F=(N+1)%G,W=v[N],$=v[F],U=k[Y+N],Z=k[Y+F],K=W.x+U.x*R.expand,Q=W.y+U.y*R.expand,J=$.x+Z.x*R.expand,H=$.y+Z.y*R.expand,dn=$.x+Z.x*z.expand,vn=$.y+Z.y*z.expand,Fe=W.x+U.x*z.expand,He=W.y+U.y*z.expand,je=J-K,qe=H-Q,We=0,$e=Fe-K,Ue=He-Q,Ze=z.z-R.z,oe=qe*Ze-We*Ue,re=We*$e-je*Ze,ie=je*Ue-qe*$e,we=Math.hypot(oe,re,ie)||1;oe/=we,re/=we,ie/=we;let ce=i.length/3;i.push(K,Q,R.z,J,H,R.z,dn,vn,z.z,Fe,He,z.z),f.push(oe,re,ie,oe,re,ie,oe,re,ie,oe,re,ie);let Ke=N/G,Qe=(N+1)/G,Je=C/(A.length-1),en=(C+1)/(A.length-1);x.push(Ke,Je,Qe,Je,Qe,en,Ke,en),p.push(ce,ce+1,ce+2,ce,ce+2,ce+3)}}Y+=G}}xe(this,i,f,x,p)}}function ze(n){return{x:n.x,y:n.y,z:n.z,nx:n.nx,ny:n.ny,nz:n.nz,u:n.u,v:n.v}}function yn(n){return{x:n.x,y:n.y,z:n.z,nx:-n.nx,ny:-n.ny,nz:-n.nz,u:n.u,v:n.v}}function fn(n,e,t){let s=n.nx+(e.nx-n.nx)*t,r=n.ny+(e.ny-n.ny)*t,a=n.nz+(e.nz-n.nz)*t,c=Math.hypot(s,r,a)||1;return{x:n.x+(e.x-n.x)*t,y:n.y+(e.y-n.y)*t,z:n.z+(e.z-n.z)*t,nx:s/c,ny:r/c,nz:a/c,u:n.u+(e.u-n.u)*t,v:n.v+(e.v-n.v)*t}}function xn(n){if(n.length<3)return null;let e=n[0],t=n[1],s=n[2],r=t.x-e.x,a=t.y-e.y,c=t.z-e.z,u=s.x-e.x,l=s.y-e.y,o=s.z-e.z,m=a*o-c*l,h=c*u-r*o,i=r*l-a*u,f=Math.hypot(m,h,i);if(f<1e-9)return null;m/=f,h/=f,i/=f;let x=m*e.x+h*e.y+i*e.z;return{vertices:n,nx:m,ny:h,nz:i,w:x}}function bn(n){n.vertices.reverse();for(let e=0;e<n.vertices.length;e++)n.vertices[e]=yn(n.vertices[e]);n.nx=-n.nx,n.ny=-n.ny,n.nz=-n.nz,n.w=-n.w}let Ie=1e-5,_e=0,Pe=1,be=2,Ve=3;function Ae(n,e,t,s,r,a,c,u,l){let o=0,m=[];for(let h=0;h<r.vertices.length;h++){let i=r.vertices[h],f=n*i.x+e*i.y+t*i.z-s,x=f<-Ie?be:f>Ie?Pe:_e;o|=x,m.push(x)}switch(o){case _e:{n*r.nx+e*r.ny+t*r.nz>0?a.push(r):c.push(r);break}case Pe:u.push(r);break;case be:l.push(r);break;case Ve:{let h=[],i=[],f=r.vertices.length;for(let g=0;g<f;g++){let S=(g+1)%f,d=m[g],M=m[S],P=r.vertices[g],w=r.vertices[S];if(d!==be&&h.push(P),d!==Pe&&i.push(d!==be?ze(P):P),(d|M)===Ve){let k=w.x-P.x,T=w.y-P.y,_=w.z-P.z,I=n*k+e*T+t*_,X=Math.abs(I)>1e-12?(s-(n*P.x+e*P.y+t*P.z))/I:.5,V=fn(P,w,Math.max(0,Math.min(1,X)));h.push(V),i.push(ze(V))}}let{nx:x,ny:p,nz:b,w:y}=r;h.length>=3&&u.push({vertices:h,nx:x,ny:p,nz:b,w:y}),i.length>=3&&l.push({vertices:i,nx:x,ny:p,nz:b,w:y});break}default:break}}class ue{constructor(e,t=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,t)}invert(){for(let t=0;t<this.polygons.length;t++)bn(this.polygons[t]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,t=0){if(!this.hasPlane||e.length===0)return e.slice();if(t>=ne)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ne})`);let s=[],r=[];for(let a=0;a<e.length;a++)Ae(this.nx,this.ny,this.nz,this.w,e[a],s,r,s,r);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,t+1)),this.back?r=r.length>0?this.back.clipPolygons(r,t+1):[]:r=[],s.concat(r)}clipTo(e,t=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),t<ne&&(this.front&&this.front.clipTo(e,t+1),this.back&&this.back.clipTo(e,t+1))}allPolygons(e=[]){for(let t=0;t<this.polygons.length;t++)e.push(this.polygons[t]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,t=0){if(!e.length)return;if(!this.hasPlane){let a=e[e.length>>1];this.nx=a.nx,this.ny=a.ny,this.nz=a.nz,this.w=a.w,this.hasPlane=!0}if(t>=ne)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${ne})`);let s=[],r=[];for(let a=0;a<e.length;a++)Ae(this.nx,this.ny,this.nz,this.w,e[a],this.polygons,this.polygons,s,r);s.length>0&&(this.front||(this.front=new ue),this.front.build(s,t+1)),r.length>0&&(this.back||(this.back=new ue),this.back.build(r,t+1))}}function Ne(n,e){if(!e&&n._csgPolygons)return n._csgPolygons;let t=n.attributes.position;if(!t||t.count===0)return[];let s=n.attributes.normal,r=n.attributes.uv,a=n.index?n.index.array:null,c=Math.floor(a?a.length/3:t.count/3);if(c>ae)throw new RangeError(`SecurityError: CSG input triangle count (${c}) exceeds MAX_CSG_TRIANGLES (${ae})`);let u=e?e.elements:null,l=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,o=u?new rn().getNormalMatrix(e).elements:null,m=i=>{let f=t.getX(i),x=t.getY(i),p=t.getZ(i),b=s?s.getX(i):NaN,y=s?s.getY(i):NaN,g=s?s.getZ(i):NaN;if(u&&o){let M=u[0]*f+u[4]*x+u[8]*p+u[12],P=u[1]*f+u[5]*x+u[9]*p+u[13],w=u[2]*f+u[6]*x+u[10]*p+u[14];f=M,x=P,p=w;let k=o[0]*b+o[3]*y+o[6]*g,T=o[1]*b+o[4]*y+o[7]*g,_=o[2]*b+o[5]*y+o[8]*g,I=Math.hypot(k,T,_)||1;b=k/I,y=T/I,g=_/I}let S=r?r.getX(i):0,d=r?r.getY(i):0;return{x:f,y:x,z:p,nx:b,ny:y,nz:g,u:S,v:d}},h=[];for(let i=0;i<c;i++){let f=a?a[i*3]:i*3,x=a?a[i*3+1]:i*3+1,p=a?a[i*3+2]:i*3+2,b=xn(l?[m(f),m(p),m(x)]:[m(f),m(x),m(p)]);b&&h.push(b)}return h}function pn(n){let e=[],t=[],s=[],r=[];for(let c of n){let u=c.vertices;if(u.length<3)continue;let l=e.length/3;for(let o of u)e.push(o.x,o.y,o.z),Number.isFinite(o.nx)&&o.nx*o.nx+o.ny*o.ny+o.nz*o.nz>.5?t.push(o.nx,o.ny,o.nz):t.push(c.nx,c.ny,c.nz),s.push(o.u,o.v);for(let o=1;o<u.length-1;o++)r.push(l,l+o,l+o+1)}let a=xe(new ee,e,t,s,r);return a._csgPolygons=n,a}function gn(n,e,t){if(n.length+e.length>ae)throw new RangeError(`SecurityError: Combined CSG triangle count (${n.length+e.length}) exceeds MAX_CSG_TRIANGLES (${ae})`);if(n.length===0)return t==="union"?e:[];if(e.length===0)return t==="intersect"?[]:n;let s=1/0,r=1/0,a=1/0,c=-1/0,u=-1/0,l=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let p=0;p<x.length;p++){let b=x[p];b.x<s&&(s=b.x),b.y<r&&(r=b.y),b.z<a&&(a=b.z),b.x>c&&(c=b.x),b.y>u&&(u=b.y),b.z>l&&(l=b.z)}}s-=1e-4,r-=1e-4,a-=1e-4,c+=1e-4,u+=1e-4,l+=1e-4;let o=[],m=[];for(let f=0;f<n.length;f++){let x=n[f],p=x.vertices,b=1/0,y=1/0,g=1/0,S=-1/0,d=-1/0,M=-1/0;for(let P=0;P<p.length;P++){let w=p[P];w.x<b&&(b=w.x),w.y<y&&(y=w.y),w.z<g&&(g=w.z),w.x>S&&(S=w.x),w.y>d&&(d=w.y),w.z>M&&(M=w.z)}S<s||b>c||d<r||y>u||M<a||g>l?m.push(x):o.push(x)}if(o.length===0)return t==="union"?n.concat(e):t==="subtract"?n:[];let h=new ue(o),i=new ue(e);return t==="union"?(h.clipTo(i),i.clipTo(h),i.invert(),i.clipTo(h),i.invert(),h.build(i.allPolygons()),m.concat(h.allPolygons())):t==="subtract"?(h.invert(),h.clipTo(i),i.clipTo(h),i.invert(),i.clipTo(h),i.invert(),h.build(i.allPolygons()),h.invert(),m.concat(h.allPolygons())):(h.invert(),i.clipTo(h),i.invert(),h.clipTo(i),i.clipTo(h),h.build(i.allPolygons()),h.invert(),h.allPolygons())}function Xe(n,e,t,s=null,r=null){let a=Ne(n,s),c=Ne(e,r);return pn(gn(a,c,t))}function Me(n,e,t){let s=n instanceof he||!!n?.isMesh,r=e instanceof he||!!e?.isMesh,a=s?n.geometry:n,c=r?e.geometry:e,u=null;if(r)if(e.updateMatrix(),s){n.updateMatrix();let h=new de().makeScale(1/(n.scale.x||1),1/(n.scale.y||1),1/(n.scale.z||1)),i=Math.hypot(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w)||1,f=new de().compose(new ke(0,0,0),new on(-n.quaternion.x/i,-n.quaternion.y/i,-n.quaternion.z/i,n.quaternion.w/i),new ke(1,1,1)),x=new de().makeTranslation(-n.position.x,-n.position.y,-n.position.z);u=h.multiply(f).multiply(x).multiply(e.matrix)}else u=e.matrix;let l=Xe(a,c,t,null,u),o=s?n.material:new Ce,m=new he(l,o);return s&&(m.position.copy(n.position),m.quaternion.copy(n.quaternion),m.scale.copy(n.scale),m.name=n.name),m}let pe={toGeometry:Xe,subtract(n,e){return Me(n,e,"subtract")},union(n,e){return Me(n,e,"union")},intersect(n,e){return Me(n,e,"intersect")}},Be={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class De extends ee{constructor(e="",t={}){super();let s=String(e??"").slice(0,Te),r=Math.max(.005,Math.min(100,B(t.size,.2))),a=!!(t.bevelEnabled??!1),c=a?Math.max(0,Math.min(2,B(t.bevelThickness,r*.04))):0,u=a?Math.max(0,Math.min(2,B(t.bevelSize,r*.03))):0,l=Math.max(.001,Math.min(20,B(t.depth??t.height,r*.2)))+c*2,o=r*.085+u,m=r*.68,h=r*.82,i=[],f=[],x=[],p=[],b=(S,d,M,P,w,k,T)=>{let _=M-S,I=P-d,X=Math.hypot(_,I),V=1,O=0;X>1e-6&&(V=_/X,O=I/X);let te=-O*w,se=V*w,j=V*w*.6,q=O*w*.6,A=S-j+te,Y=d-q+se,v=S-j-te,G=d-q-se,C=M+j-te,R=P+q-se,z=M+j+te,N=P+q+se,F=(W,$,U,Z,K,Q,J)=>{let H=i.length/3;i.push(W[0],W[1],W[2],$[0],$[1],$[2],U[0],U[1],U[2],Z[0],Z[1],Z[2]),f.push(K,Q,J,K,Q,J,K,Q,J,K,Q,J),x.push(0,0,1,0,1,1,0,1),p.push(H,H+1,H+2,H,H+2,H+3)};F([A,Y,T],[v,G,T],[C,R,T],[z,N,T],0,0,1),F([v,G,k],[A,Y,k],[z,N,k],[C,R,k],0,0,-1),F([A,Y,k],[v,G,k],[v,G,T],[A,Y,T],-V,-O,0),F([C,R,k],[z,N,k],[z,N,T],[C,R,T],V,O,0),F([v,G,k],[C,R,k],[C,R,T],[v,G,T],O,-V,0),F([z,N,k],[A,Y,k],[A,Y,T],[z,N,T],-O,V,0)},y=0,g=0;for(let S=0;S<s.length;S++){let d=s[S];if(d===`
|
|
18
|
+
`){y=0,g-=r*1.35;continue}if(d===" "||d===" "){y+=h*(d===" "?.75:3);continue}if(d==="\r")continue;let M=d.toUpperCase(),P=d!==M&&d>="a"&&d<="z",w=Be[M]??Be["?"],k=P?r*.76:r,T=P?m*.88:m;for(let _ of w)for(let I=0;I<_.length-1;I++){let X=_[I],V=_[I+1];b(y+X[0]*T,g+X[1]*k,y+V[0]*T,g+V[1]*k,o,-l*.5,l*.5)}y+=P?h*.88:h}xe(this,i,f,x,p),t.center!==!1?this.center():this.computeBoundingBox()}}function Oe(n){if(!n)return;let e=n,t=n.userData?.xr?.text;if(t!=null&&t!==!1){let r=e.geometry?.attributes?.position;if((!r||r.count===0)&&n.userData._textApplied!==!0){let a="",c=.08,u=.015,l;if(typeof t=="string"||typeof t=="number")a=String(t);else if(typeof t=="object"){let o=t;a=String(o.text??o.value??""),o.size!==void 0&&(c=Number(o.size)||.08),(o.depth!==void 0||o.height!==void 0)&&(u=Number(o.depth??o.height)||c*.2),(typeof o.color=="string"||typeof o.color=="number")&&(l=o.color)}a.trim().length>0&&(e.geometry=new De(a,{size:c,depth:u}),n.userData._textApplied=!0,e.material instanceof an?l!==void 0&&n.userData._autoTextColorApplied!==!0&&(e.material.color=new cn(l),n.userData._autoTextColorApplied=!0):e.material=new Ce({color:l??16317180}))}}let s=n.userData?.csg;if(s&&typeof s=="object"&&n.userData._csgApplied!==!0&&e.geometry instanceof ee&&e.geometry.attributes.position?.count>0){n.userData._csgApplied=!0;let r=Array.isArray(s)?s:[s],a=e.geometry;for(let c of r){if(!c||typeof c!="object")continue;let u=c,l=String(u.op??u.operation??"subtract"),o=l==="union"||l==="intersect"?l:"subtract",m=u.target??u.mesh??u.geometry;if(m instanceof he||m instanceof ee)try{let h=o==="union"?pe.union(e,m):o==="intersect"?pe.intersect(e,m):pe.subtract(e,m);e.geometry!==a&&e.geometry.dispose?.(),e.geometry=h.geometry}catch(h){typeof console<"u"&&console.warn("[three-live] userData.csg skipped:",h)}}}}let Ye={Path:me,Shape:ye,ShapeGeometry:ln,ExtrudeGeometry:mn,TextGeometry:De,CSG:pe,MAX_CSG_TRIANGLES:ae,MAX_BSP_DEPTH:ne,MAX_TEXT_GEOMETRY_CHARS:Te,MAX_SHAPE_POINTS:Se,materializeDeclarativeGeometry:Oe};return E&&typeof E=="object"&&(E.authorNamespace||(E.authorNamespace={}),Object.assign(E.authorNamespace,Ye),E.materializeDeclarativeGeometry=Oe),Ye}var sn={name:"cad",onRegister(){nn(Ge);let L=le(),E=L.threeNamespace??(typeof globalThis<"u"?globalThis.THREE:void 0);E&&Ge(E,L)}};tn(sn);export{Pn as MAX_BSP_DEPTH,Sn as MAX_CSG_TRIANGLES,wn as MAX_SHAPE_POINTS,Mn as MAX_TEXT_GEOMETRY_CHARS,sn as cadPlugin,Ge as installCadExtension};
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
"use strict";var ThreeLiveCAD=(()=>{var Te=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var Tn=Object.prototype.hasOwnProperty;var Ln=(M,L)=>{for(var A in L)Te(M,A,{get:L[A],enumerable:!0})},En=(M,L,A,he)=>{if(L&&typeof L=="object"||typeof L=="function")for(let ne of Cn(L))!Tn.call(M,ne)&&ne!==A&&Te(M,ne,{get:()=>L[ne],enumerable:!(he=kn(L,ne))||he.enumerable});return M};var Rn=M=>En(Te({},"__esModule",{value:!0}),M);var zn={};Ln(zn,{MAX_BSP_DEPTH:()=>an,MAX_CSG_TRIANGLES:()=>cn,MAX_SHAPE_POINTS:()=>ln,MAX_TEXT_GEOMETRY_CHARS:()=>un,cadPlugin:()=>Le,installCadExtension:()=>Pe});var Se="__THREE_LIVE_REGISTRY__";function fe(){let M=typeof globalThis<"u"?globalThis:{};if(!M[Se]){let L={plugins:[],decoders:new Map};try{Object.defineProperty(M,Se,{value:L,writable:!1,configurable:!1,enumerable:!1})}catch{M[Se]=L}}return M[Se]}var Vn=fe().plugins;function on(M){let L=fe();L.workerExtensionInstallers||(L.workerExtensionInstallers=[]),L.workerExtensionInstallers.includes(M)||L.workerExtensionInstallers.push(M)}function rn(M){let L=fe().plugins;L.some(A=>A.name===M.name)||L.push(M),M.onRegister?.()}var cn=8192,an=2048,un=128,ln=4096;function Pe(M,L){if(!M||!M.BufferGeometry)return null;let A=M.Vector2,he=M.Vector3,ne=M.Quaternion,Me=M.Matrix4,hn=M.Matrix3,mn=M.Color,D=M.BufferAttribute,se=M.BufferGeometry,yn=M.Material,Ee=M.MeshStandardMaterial,xe=M.Mesh,me=8192,oe=2048,Re=128,we=4096,Y=(t,e)=>{let n=t==null?NaN:Number(t);return Number.isFinite(n)?n:e};class be{constructor(e){this.currentPoint=new A(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){let s=Number(e)||0,r=Number(n)||0;return this.currentPoint.set(s,r),this.segments.push({type:"move",pts:[s,r]}),this}lineTo(e,n){let s=Number(e)||0,r=Number(n)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,r),this.segments.push({type:"line",pts:[s,r]}),this}quadraticCurveTo(e,n,s,r){let i=this.currentPoint.x,a=this.currentPoint.y,u=Number(e)||0,h=Number(n)||0,o=Number(s)||0,m=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[i,a]}),this.currentPoint.set(o,m),this.segments.push({type:"quad",pts:[i,a,u,h,o,m]}),this}bezierCurveTo(e,n,s,r,i,a){let u=this.currentPoint.x,h=this.currentPoint.y,o=Number(e)||0,m=Number(n)||0,l=Number(s)||0,c=Number(r)||0,f=Number(i)||0,x=Number(a)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,h]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[u,h,o,m,l,c,f,x]}),this}absarc(e,n,s,r,i,a=!1){return this.absellipse(e,n,s,s,r,i,a,0)}arc(e,n,s,r,i,a=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),s,r,i,a)}absellipse(e,n,s,r,i,a,u=!1,h=0){let o=Number(e)||0,m=Number(n)||0,l=Math.max(0,Number(s)||0),c=Math.max(0,Number(r)||0),f=Number(i)||0,x=Number(a)||0,p=u?1:0,b=Number(h)||0;this.segments.push({type:"arc",pts:[o,m,l,c,f,x,p,b]});let y=Math.cos(b),g=Math.sin(b),S=l*Math.cos(x),d=c*Math.sin(x);return this.currentPoint.set(o+S*y-d*g,m+S*g+d*y),this}ellipse(e,n,s,r,i,a,u=!1,h=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(n)||0),s,r,i,a,u,h)}closePath(){if(this.segments.length>0){let e=this.segments[0],n=0,s=0;if(e.type==="arc"){let r=e.pts[0],i=e.pts[1],a=e.pts[2],u=e.pts[3],h=e.pts[4],o=e.pts[7],m=Math.cos(o),l=Math.sin(o),c=a*Math.cos(h),f=u*Math.sin(h);n=r+c*m-f*l,s=i+c*l+f*m}else n=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-n,this.currentPoint.y-s)>1e-6&&this.lineTo(n,s)}return this}getPoints(e=12){let n=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],r=(i,a)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-i,u.y-a)<1e-6)return}s.push(new A(i,a))};for(let i of this.segments){let a=i.pts;if(i.type==="move"||i.type==="line")r(a[0],a[1]);else if(i.type==="quad"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5];r(u,h);for(let f=1;f<=n;f++){let x=f/n,p=1-x;r(p*p*u+2*p*x*o+x*x*l,p*p*h+2*p*x*m+x*x*c)}}else if(i.type==="cubic"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5],f=a[6],x=a[7];r(u,h);for(let p=1;p<=n;p++){let b=p/n,y=1-b,g=y*y,S=b*b;r(g*y*u+3*g*b*o+3*y*S*l+S*b*f,g*y*h+3*g*b*m+3*y*S*c+S*b*x)}}else if(i.type==="arc"){let u=a[0],h=a[1],o=a[2],m=a[3],l=a[4],c=a[5],f=a[6]!==0,x=a[7],p=Math.PI*2,b=c-l,y=Math.abs(b)<1e-9;for(;b<0;)b+=p;for(;b>p;)b-=p;b<1e-9&&(b=y?0:p),f&&!y&&(b=b===p?-p:b-p);let g=Math.cos(x),S=Math.sin(x),d=Math.max(2,n);for(let w=0;w<=d;w++){let P=w/d,G=l+P*b,C=o*Math.cos(G),E=m*Math.sin(G);r(u+C*g-E*S,h+C*S+E*g)}}}if(s.length>2){let i=s[0],a=s[s.length-1];Math.hypot(i.x-a.x,i.y-a.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}}class pe extends be{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(n=>n.getPoints(e))}}}function ge(t){let e=0,n=t.length;for(let s=0,r=n-1;s<n;r=s++)e+=t[r].x*t[s].y-t[s].x*t[r].y;return e*.5}function fn(t,e,n,s,r,i,a,u){let h=a-n,o=u-s,m=r-n,l=i-s,c=t-n,f=e-s,x=h*h+o*o,p=h*m+o*l,b=h*c+o*f,y=m*m+l*l,g=m*c+l*f,S=x*y-p*p;if(Math.abs(S)<1e-12)return!1;let d=1/S,w=(y*b-p*g)*d,P=(x*g-p*b)*d;return w>=-1e-7&&P>=-1e-7&&w+P<=1+1e-7}function ze(t,e){let n=t.slice();ge(n)<0&&n.reverse();let s=n.map(h=>new A(h.x,h.y)),r=n.map((h,o)=>o),i=[];for(let h of e){if(!h||h.length<3)continue;let o=h.slice();ge(o)>0&&o.reverse();let m=[],l=-1/0,c=0;for(let f=0;f<o.length;f++){let x=o[f],p=s.length;s.push(new A(x.x,x.y)),m.push(p),x.x>l&&(l=x.x,c=f)}i.push({pts:o,indices:m,maxX:l,maxIdx:c})}i.sort((h,o)=>o.maxX-h.maxX);let a=(h,o,m)=>(o.x-h.x)*(m.y-h.y)-(o.y-h.y)*(m.x-h.x),u=(h,o,m)=>{for(let l=0;l<m.length;l++){let c=m[l],f=m[(l+1)%m.length];if(a(h,o,c)*a(h,o,f)<0&&a(c,f,h)*a(c,f,o)<0)return!0}return!1};for(let h of i){let o=h.pts[h.maxIdx],m=o.x,l=r.length,c=r.map(y=>s[y]),f=y=>Math.hypot(c[y].x-m,c[y].y-o.y),x=c.map((y,g)=>g).sort((y,g)=>+(c[y].x<m)-+(c[g].x<m)||f(y)-f(g)),p=x[0];for(let y of x){let g=c[y],S=c[(y+l-1)%l],d=c[(y+1)%l],w=a(g,d,o)>=0,P=a(S,g,o)>=0;if((a(S,g,d)>=0?w&&P:w||P)&&!u(o,g,c)&&!i.some(C=>u(o,g,C.pts))){p=y;break}}let b=[];for(let y=0;y<=p;y++)b.push(r[y]);for(let y=0;y<=h.indices.length;y++){let g=h.indices[(h.maxIdx+y)%h.indices.length];b.push(g)}for(let y=p;y<r.length;y++)b.push(r[y]);r=b}return{merged:r.map(h=>s[h]),mergedIndices:r,allVertices:s}}function Ie(t,e){let n=[],s=t.slice();if(s.length<3)return n;let r=s.length*s.length+64,i=0;for(;s.length>2&&r-- >0;){let a=s.length,u=s[(i+a-1)%a],h=s[i%a],o=s[(i+1)%a],m=e[u],l=e[h],c=e[o];if((l.x-m.x)*(c.y-m.y)-(l.y-m.y)*(c.x-m.x)>1e-9){let x=!0;for(let p=0;p<a;p++){let b=s[p];if(b===u||b===h||b===o)continue;let y=e[b];if(fn(y.x,y.y,m.x,m.y,l.x,l.y,c.x,c.y)&&Math.hypot(y.x-m.x,y.y-m.y)>=1e-6&&Math.hypot(y.x-l.x,y.y-l.y)>=1e-6&&Math.hypot(y.x-c.x,y.y-c.y)>=1e-6){x=!1;break}}if(x){n.push([u,h,o]),s.splice(i%a,1),i=Math.max(0,i%a-1);continue}}i++,i>=a*2&&(n.push([u,h,o]),s.splice((i-1)%a,1),i=0)}return n}function Ve(t,e){let n=t instanceof pe?t.extractPoints(e):{shape:t.getPoints(e),holes:[]},s=n.shape.length;for(let r of n.holes)s+=r.length;if(s>we)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${we})`);return n}class xn extends se{constructor(e=new pe,n=12){super();let s=Array.isArray(e)?e:[e],r=[],i=[],a=[],u=[];for(let h of s){if(!(h instanceof be))continue;let o=Ve(h,n);if(o.shape.length<3)continue;let{mergedIndices:m,allVertices:l}=ze(o.shape,o.holes),c=Ie(m,l),f=r.length/3,x=1/0,p=1/0,b=-1/0,y=-1/0;for(let d of l)d.x<x&&(x=d.x),d.y<p&&(p=d.y),d.x>b&&(b=d.x),d.y>y&&(y=d.y);let g=Math.max(1e-6,b-x),S=Math.max(1e-6,y-p);for(let d of l)r.push(d.x,d.y,0),i.push(0,0,1),a.push((d.x-x)/g,(d.y-p)/S);for(let[d,w,P]of c)u.push(f+d,f+w,f+P)}this.setAttribute("position",new D(O(r),3)),this.setAttribute("normal",new D(O(i),3)),this.setAttribute("uv",new D(O(a),2)),this.setIndex(u)}}function O(t){let e=t.length,n=new Float32Array(e);for(let s=0;s<e;s++)n[s]=t[s];return n}function bn(t){let e=t.length,n=[];for(let s=0;s<e;s++){let r=t[(s+e-1)%e],i=t[s],a=t[(s+1)%e],u=i.x-r.x,h=i.y-r.y,o=Math.hypot(u,h)||1;u/=o,h/=o;let m=a.x-i.x,l=a.y-i.y,c=Math.hypot(m,l)||1;m/=c,l/=c;let f=h,x=-u,p=l,b=-m,y=f+p,g=x+b,S=Math.hypot(y,g);if(S>1e-6){y/=S,g/=S;let d=Math.max(.35,y*f+g*x);n.push(new A(y/d,g/d))}else n.push(new A(f,x))}return n}class pn extends se{constructor(e=new pe,n={}){super();let s=Array.isArray(e)?e:[e],r=Math.max(1,Math.min(64,Math.floor(Y(n.curveSegments,12)))),i=Y(n.depth??n.amount,1),a=Math.max(1,Math.min(32,Math.floor(Y(n.steps,1)))),u=!!(n.bevelEnabled??!1),h=u?Math.max(0,Y(n.bevelThickness,.06)):0,o=u?Math.max(0,Y(n.bevelSize,h*.8)):0,m=u?Y(n.bevelOffset,0):0,l=u?Math.max(1,Math.min(8,Math.floor(Y(n.bevelSegments,2)))):0,c=[],f=[],x=[],p=[];for(let b of s){if(!(b instanceof be))continue;let y=Ve(b,r);if(y.shape.length<3)continue;let g=y.shape.slice();ge(g)<0&&g.reverse();let S=[];for(let v of y.holes){if(v.length<3)continue;let k=v.slice();ge(k)>0&&k.reverse(),S.push(k)}let{mergedIndices:d,allVertices:w}=ze(g,S),P=Ie(d,w),G=[g,...S],C=[];for(let v of G){let k=bn(v);for(let T of k)C.push(T)}let E=1/0,V=1/0,I=-1/0,B=-1/0;for(let v of w)v.x<E&&(E=v.x),v.y<V&&(V=v.y),v.x>I&&(I=v.x),v.y>B&&(B=v.y);let _=Math.max(1e-6,I-E),H=Math.max(1e-6,B-V),re=-h,ie=i+h,j=c.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;c.push(R,z,re),f.push(0,0,-1),x.push((R-E)/_,(z-V)/H)}for(let[v,k,T]of P)p.push(j+v,j+T,j+k);let $=c.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;c.push(R,z,ie),f.push(0,0,1),x.push((R-E)/_,(z-V)/H)}for(let[v,k,T]of P)p.push($+v,$+k,$+T);let N=[];if(u&&l>0)for(let v=0;v<l;v++){let T=v/l*Math.PI/2;N.push({z:-h*Math.cos(T),expand:m+o*Math.sin(T)})}for(let v=0;v<=a;v++){let k=v/a;N.push({z:k*i,expand:m+o})}if(u&&l>0)for(let v=1;v<=l;v++){let T=v/l*Math.PI/2;N.push({z:i+h*Math.sin(T),expand:m+o*Math.cos(T)})}let F=0;for(let v of G){let k=v.length;for(let T=0;T<N.length-1;T++){let R=N[T],z=N[T+1];for(let X=0;X<k;X++){let q=(X+1)%k,Z=v[X],U=v[q],Q=C[F+X],K=C[F+q],J=Z.x+Q.x*R.expand,ee=Z.y+Q.y*R.expand,te=U.x+K.x*R.expand,W=U.y+K.y*R.expand,wn=U.x+K.x*z.expand,Gn=U.y+K.y*z.expand,We=Z.x+Q.x*z.expand,je=Z.y+Q.y*z.expand,$e=te-J,Ze=W-ee,Ue=0,Qe=We-J,Ke=je-ee,Je=z.z-R.z,ce=Ze*Je-Ue*Ke,ae=Ue*Qe-$e*Je,ue=$e*Ke-Ze*Qe,Ce=Math.hypot(ce,ae,ue)||1;ce/=Ce,ae/=Ce,ue/=Ce;let le=c.length/3;c.push(J,ee,R.z,te,W,R.z,wn,Gn,z.z,We,je,z.z),f.push(ce,ae,ue,ce,ae,ue,ce,ae,ue,ce,ae,ue);let en=X/k,nn=(X+1)/k,tn=T/(N.length-1),sn=(T+1)/(N.length-1);x.push(en,tn,nn,tn,nn,sn,en,sn),p.push(le,le+1,le+2,le,le+2,le+3)}}F+=k}}this.setAttribute("position",new D(O(c),3)),this.setAttribute("normal",new D(O(f),3)),this.setAttribute("uv",new D(O(x),2)),this.setIndex(p)}}function _e(t){return{x:t.x,y:t.y,z:t.z,nx:t.nx,ny:t.ny,nz:t.nz,u:t.u,v:t.v}}function gn(t){return{x:t.x,y:t.y,z:t.z,nx:-t.nx,ny:-t.ny,nz:-t.nz,u:t.u,v:t.v}}function dn(t,e,n){let s=t.nx+(e.nx-t.nx)*n,r=t.ny+(e.ny-t.ny)*n,i=t.nz+(e.nz-t.nz)*n,a=Math.hypot(s,r,i)||1;return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n,z:t.z+(e.z-t.z)*n,nx:s/a,ny:r/a,nz:i/a,u:t.u+(e.u-t.u)*n,v:t.v+(e.v-t.v)*n}}function vn(t){if(t.length<3)return null;let e=t[0],n=t[1],s=t[2],r=n.x-e.x,i=n.y-e.y,a=n.z-e.z,u=s.x-e.x,h=s.y-e.y,o=s.z-e.z,m=i*o-a*h,l=a*u-r*o,c=r*h-i*u,f=Math.hypot(m,l,c);if(f<1e-9)return null;m/=f,l/=f,c/=f;let x=m*e.x+l*e.y+c*e.z;return{vertices:t,nx:m,ny:l,nz:c,w:x}}function Sn(t){t.vertices.reverse();for(let e=0;e<t.vertices.length;e++)t.vertices[e]=gn(t.vertices[e]);t.nx=-t.nx,t.ny=-t.ny,t.nz=-t.nz,t.w=-t.w}let Ae=1e-5,Ne=0,Ge=1,de=2,Xe=3;function De(t,e,n,s,r,i,a,u,h){let o=0,m=[];for(let l=0;l<r.vertices.length;l++){let c=r.vertices[l],f=t*c.x+e*c.y+n*c.z-s,x=f<-Ae?de:f>Ae?Ge:Ne;o|=x,m.push(x)}switch(o){case Ne:{t*r.nx+e*r.ny+n*r.nz>0?i.push(r):a.push(r);break}case Ge:u.push(r);break;case de:h.push(r);break;case Xe:{let l=[],c=[],f=r.vertices.length;for(let g=0;g<f;g++){let S=(g+1)%f,d=m[g],w=m[S],P=r.vertices[g],G=r.vertices[S];if(d!==de&&l.push(P),d!==Ge&&c.push(d!==de?_e(P):P),(d|w)===Xe){let C=G.x-P.x,E=G.y-P.y,V=G.z-P.z,I=t*C+e*E+n*V,B=Math.abs(I)>1e-12?(s-(t*P.x+e*P.y+n*P.z))/I:.5,_=dn(P,G,Math.max(0,Math.min(1,B)));l.push(_),c.push(_e(_))}}let{nx:x,ny:p,nz:b,w:y}=r;l.length>=3&&u.push({vertices:l,nx:x,ny:p,nz:b,w:y}),c.length>=3&&h.push({vertices:c,nx:x,ny:p,nz:b,w:y});break}default:break}}class ye{constructor(e,n=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,n)}invert(){for(let n=0;n<this.polygons.length;n++)Sn(this.polygons[n]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,n=0){if(!this.hasPlane||e.length===0)return e.slice();if(n>=oe)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${oe})`);let s=[],r=[];for(let i=0;i<e.length;i++)De(this.nx,this.ny,this.nz,this.w,e[i],s,r,s,r);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,n+1)),this.back?r=r.length>0?this.back.clipPolygons(r,n+1):[]:r=[],s.concat(r)}clipTo(e,n=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),n<oe&&(this.front&&this.front.clipTo(e,n+1),this.back&&this.back.clipTo(e,n+1))}allPolygons(e=[]){for(let n=0;n<this.polygons.length;n++)e.push(this.polygons[n]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,n=0){if(!e.length)return;if(!this.hasPlane){let i=e[e.length>>1];this.nx=i.nx,this.ny=i.ny,this.nz=i.nz,this.w=i.w,this.hasPlane=!0}if(n>=oe)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${oe})`);let s=[],r=[];for(let i=0;i<e.length;i++)De(this.nx,this.ny,this.nz,this.w,e[i],this.polygons,this.polygons,s,r);s.length>0&&(this.front||(this.front=new ye),this.front.build(s,n+1)),r.length>0&&(this.back||(this.back=new ye),this.back.build(r,n+1))}}function Oe(t,e){if(!e&&t._csgPolygons)return t._csgPolygons;let n=t.attributes.position;if(!n||n.count===0)return[];let s=t.attributes.normal,r=t.attributes.uv,i=t.index?t.index.array:null,a=Math.floor(i?i.length/3:n.count/3);if(a>me)throw new RangeError(`SecurityError: CSG input triangle count (${a}) exceeds MAX_CSG_TRIANGLES (${me})`);let u=e?e.elements:null,h=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,o=u?new hn().getNormalMatrix(e).elements:null,m=c=>{let f=n.getX(c),x=n.getY(c),p=n.getZ(c),b=s?s.getX(c):NaN,y=s?s.getY(c):NaN,g=s?s.getZ(c):NaN;if(u&&o){let w=u[0]*f+u[4]*x+u[8]*p+u[12],P=u[1]*f+u[5]*x+u[9]*p+u[13],G=u[2]*f+u[6]*x+u[10]*p+u[14];f=w,x=P,p=G;let C=o[0]*b+o[3]*y+o[6]*g,E=o[1]*b+o[4]*y+o[7]*g,V=o[2]*b+o[5]*y+o[8]*g,I=Math.hypot(C,E,V)||1;b=C/I,y=E/I,g=V/I}let S=r?r.getX(c):0,d=r?r.getY(c):0;return{x:f,y:x,z:p,nx:b,ny:y,nz:g,u:S,v:d}},l=[];for(let c=0;c<a;c++){let f=i?i[c*3]:c*3,x=i?i[c*3+1]:c*3+1,p=i?i[c*3+2]:c*3+2,b=vn(h?[m(f),m(p),m(x)]:[m(f),m(x),m(p)]);b&&l.push(b)}return l}function Pn(t){let e=[],n=[],s=[],r=[];for(let a of t){let u=a.vertices;if(u.length<3)continue;let h=e.length/3;for(let o of u)e.push(o.x,o.y,o.z),Number.isFinite(o.nx)&&o.nx*o.nx+o.ny*o.ny+o.nz*o.nz>.5?n.push(o.nx,o.ny,o.nz):n.push(a.nx,a.ny,a.nz),s.push(o.u,o.v);for(let o=1;o<u.length-1;o++)r.push(h,h+o,h+o+1)}let i=new se;return i.setAttribute("position",new D(O(e),3)),i.setAttribute("normal",new D(O(n),3)),i.setAttribute("uv",new D(O(s),2)),i.setIndex(r),i._csgPolygons=t,i}function Mn(t,e,n){if(t.length+e.length>me)throw new RangeError(`SecurityError: Combined CSG triangle count (${t.length+e.length}) exceeds MAX_CSG_TRIANGLES (${me})`);if(t.length===0)return n==="union"?e:[];if(e.length===0)return n==="intersect"?[]:t;let s=1/0,r=1/0,i=1/0,a=-1/0,u=-1/0,h=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let p=0;p<x.length;p++){let b=x[p];b.x<s&&(s=b.x),b.y<r&&(r=b.y),b.z<i&&(i=b.z),b.x>a&&(a=b.x),b.y>u&&(u=b.y),b.z>h&&(h=b.z)}}s-=1e-4,r-=1e-4,i-=1e-4,a+=1e-4,u+=1e-4,h+=1e-4;let o=[],m=[];for(let f=0;f<t.length;f++){let x=t[f],p=x.vertices,b=1/0,y=1/0,g=1/0,S=-1/0,d=-1/0,w=-1/0;for(let P=0;P<p.length;P++){let G=p[P];G.x<b&&(b=G.x),G.y<y&&(y=G.y),G.z<g&&(g=G.z),G.x>S&&(S=G.x),G.y>d&&(d=G.y),G.z>w&&(w=G.z)}S<s||b>a||d<r||y>u||w<i||g>h?m.push(x):o.push(x)}if(o.length===0)return n==="union"?t.concat(e):n==="subtract"?t:[];let l=new ye(o),c=new ye(e);return n==="union"?(l.clipTo(c),c.clipTo(l),c.invert(),c.clipTo(l),c.invert(),l.build(c.allPolygons()),m.concat(l.allPolygons())):n==="subtract"?(l.invert(),l.clipTo(c),c.clipTo(l),c.invert(),c.clipTo(l),c.invert(),l.build(c.allPolygons()),l.invert(),m.concat(l.allPolygons())):(l.invert(),c.clipTo(l),c.invert(),l.clipTo(c),c.clipTo(l),l.build(c.allPolygons()),l.invert(),l.allPolygons())}function Be(t,e,n,s=null,r=null){let i=Oe(t,s),a=Oe(e,r);return Pn(Mn(i,a,n))}function ke(t,e,n){let s=t instanceof xe||!!t?.isMesh,r=e instanceof xe||!!e?.isMesh,i=s?t.geometry:t,a=r?e.geometry:e,u=null;if(r)if(e.updateMatrix(),s){t.updateMatrix();let l=new Me().makeScale(1/(t.scale.x||1),1/(t.scale.y||1),1/(t.scale.z||1)),c=Math.hypot(t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w)||1,f=new Me().compose(new he(0,0,0),new ne(-t.quaternion.x/c,-t.quaternion.y/c,-t.quaternion.z/c,t.quaternion.w/c),new he(1,1,1)),x=new Me().makeTranslation(-t.position.x,-t.position.y,-t.position.z);u=l.multiply(f).multiply(x).multiply(e.matrix)}else u=e.matrix;let h=Be(i,a,n,null,u),o=s?t.material:new Ee,m=new xe(h,o);return s&&(m.position.copy(t.position),m.quaternion.copy(t.quaternion),m.scale.copy(t.scale),m.name=t.name),m}let ve={toGeometry:Be,subtract(t,e){return ke(t,e,"subtract")},union(t,e){return ke(t,e,"union")},intersect(t,e){return ke(t,e,"intersect")}},Ye={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class He extends se{constructor(e="",n={}){super();let s=String(e??"").slice(0,Re),r=Math.max(.005,Math.min(100,Y(n.size,.2))),i=!!(n.bevelEnabled??!1),a=i?Math.max(0,Math.min(2,Y(n.bevelThickness,r*.04))):0,u=i?Math.max(0,Math.min(2,Y(n.bevelSize,r*.03))):0,h=Math.max(.001,Math.min(20,Y(n.depth??n.height,r*.2)))+a*2,o=r*.085+u,m=r*.68,l=r*.82,c=[],f=[],x=[],p=[],b=(S,d,w,P,G,C,E)=>{let V=w-S,I=P-d,B=Math.hypot(V,I),_=1,H=0;B>1e-6&&(_=V/B,H=I/B);let re=-H*G,ie=_*G,j=_*G*.6,$=H*G*.6,N=S-j+re,F=d-$+ie,v=S-j-re,k=d-$-ie,T=w+j-re,R=P+$-ie,z=w+j+re,X=P+$+ie,q=(Z,U,Q,K,J,ee,te)=>{let W=c.length/3;c.push(Z[0],Z[1],Z[2],U[0],U[1],U[2],Q[0],Q[1],Q[2],K[0],K[1],K[2]),f.push(J,ee,te,J,ee,te,J,ee,te,J,ee,te),x.push(0,0,1,0,1,1,0,1),p.push(W,W+1,W+2,W,W+2,W+3)};q([N,F,E],[v,k,E],[T,R,E],[z,X,E],0,0,1),q([v,k,C],[N,F,C],[z,X,C],[T,R,C],0,0,-1),q([N,F,C],[v,k,C],[v,k,E],[N,F,E],-_,-H,0),q([T,R,C],[z,X,C],[z,X,E],[T,R,E],_,H,0),q([v,k,C],[T,R,C],[T,R,E],[v,k,E],H,-_,0),q([z,X,C],[N,F,C],[N,F,E],[z,X,E],-H,_,0)},y=0,g=0;for(let S=0;S<s.length;S++){let d=s[S];if(d===`
|
|
18
|
-
`){y=0,g-=r*1.35;continue}if(d===" "||d===" "){y+=
|
|
17
|
+
"use strict";var ThreeLiveCAD=(()=>{var Te=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var Tn=Object.prototype.hasOwnProperty;var Ln=(M,L)=>{for(var A in L)Te(M,A,{get:L[A],enumerable:!0})},En=(M,L,A,ue)=>{if(L&&typeof L=="object"||typeof L=="function")for(let J of Cn(L))!Tn.call(M,J)&&J!==A&&Te(M,J,{get:()=>L[J],enumerable:!(ue=kn(L,J))||ue.enumerable});return M};var Rn=M=>En(Te({},"__esModule",{value:!0}),M);var zn={};Ln(zn,{MAX_BSP_DEPTH:()=>an,MAX_CSG_TRIANGLES:()=>cn,MAX_SHAPE_POINTS:()=>ln,MAX_TEXT_GEOMETRY_CHARS:()=>un,cadPlugin:()=>Le,installCadExtension:()=>Se});var ve="__THREE_LIVE_REGISTRY__";function me(){let M=typeof globalThis<"u"?globalThis:{};if(!M[ve]){let L={plugins:[],decoders:new Map};try{Object.defineProperty(M,ve,{value:L,writable:!1,configurable:!1,enumerable:!1})}catch{M[ve]=L}}return M[ve]}var _n=me().plugins;function on(M){let L=me();L.workerExtensionInstallers||(L.workerExtensionInstallers=[]),L.workerExtensionInstallers.includes(M)||L.workerExtensionInstallers.push(M)}function rn(M){let L=me().plugins;L.some(A=>A.name===M.name)||L.push(M),M.onRegister?.()}var cn=8192,an=2048,un=128,ln=4096;function Se(M,L){if(!M||!M.BufferGeometry)return null;let A=M.Vector2,ue=M.Vector3,J=M.Quaternion,Pe=M.Matrix4,hn=M.Matrix3,mn=M.Color,Me=M.BufferAttribute,ne=M.BufferGeometry,yn=M.Material,Ee=M.MeshStandardMaterial,ye=M.Mesh,le=8192,te=2048,Re=128,we=4096,D=(n,e)=>{let t=n==null?NaN:Number(n);return Number.isFinite(t)?t:e};class fe{constructor(e){this.currentPoint=new A(0,0),this.segments=[],Array.isArray(e)&&e.length>0&&this.fromPoints(e)}fromPoints(e){if(!e.length)return this;this.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){let s=Number(e)||0,r=Number(t)||0;return this.currentPoint.set(s,r),this.segments.push({type:"move",pts:[s,r]}),this}lineTo(e,t){let s=Number(e)||0,r=Number(t)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[this.currentPoint.x,this.currentPoint.y]}),this.currentPoint.set(s,r),this.segments.push({type:"line",pts:[s,r]}),this}quadraticCurveTo(e,t,s,r){let a=this.currentPoint.x,c=this.currentPoint.y,u=Number(e)||0,l=Number(t)||0,o=Number(s)||0,m=Number(r)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[a,c]}),this.currentPoint.set(o,m),this.segments.push({type:"quad",pts:[a,c,u,l,o,m]}),this}bezierCurveTo(e,t,s,r,a,c){let u=this.currentPoint.x,l=this.currentPoint.y,o=Number(e)||0,m=Number(t)||0,h=Number(s)||0,i=Number(r)||0,f=Number(a)||0,x=Number(c)||0;return this.segments.length===0&&this.segments.push({type:"move",pts:[u,l]}),this.currentPoint.set(f,x),this.segments.push({type:"cubic",pts:[u,l,o,m,h,i,f,x]}),this}absarc(e,t,s,r,a,c=!1){return this.absellipse(e,t,s,s,r,a,c,0)}arc(e,t,s,r,a,c=!1){return this.absarc(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),s,r,a,c)}absellipse(e,t,s,r,a,c,u=!1,l=0){let o=Number(e)||0,m=Number(t)||0,h=Math.max(0,Number(s)||0),i=Math.max(0,Number(r)||0),f=Number(a)||0,x=Number(c)||0,p=u?1:0,b=Number(l)||0;this.segments.push({type:"arc",pts:[o,m,h,i,f,x,p,b]});let y=Math.cos(b),g=Math.sin(b),S=h*Math.cos(x),d=i*Math.sin(x);return this.currentPoint.set(o+S*y-d*g,m+S*g+d*y),this}ellipse(e,t,s,r,a,c,u=!1,l=0){return this.absellipse(this.currentPoint.x+(Number(e)||0),this.currentPoint.y+(Number(t)||0),s,r,a,c,u,l)}closePath(){if(this.segments.length>0){let e=this.segments[0],t=0,s=0;if(e.type==="arc"){let r=e.pts[0],a=e.pts[1],c=e.pts[2],u=e.pts[3],l=e.pts[4],o=e.pts[7],m=Math.cos(o),h=Math.sin(o),i=c*Math.cos(l),f=u*Math.sin(l);t=r+i*m-f*h,s=a+i*h+f*m}else t=e.pts[0],s=e.pts[1];Math.hypot(this.currentPoint.x-t,this.currentPoint.y-s)>1e-6&&this.lineTo(t,s)}return this}getPoints(e=12){let t=Math.max(1,Math.min(128,Math.floor(Number(e)||12))),s=[],r=(a,c)=>{if(s.length>0){let u=s[s.length-1];if(Math.hypot(u.x-a,u.y-c)<1e-6)return}s.push(new A(a,c))};for(let a of this.segments){let c=a.pts;if(a.type==="move"||a.type==="line")r(c[0],c[1]);else if(a.type==="quad"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5];r(u,l);for(let f=1;f<=t;f++){let x=f/t,p=1-x;r(p*p*u+2*p*x*o+x*x*h,p*p*l+2*p*x*m+x*x*i)}}else if(a.type==="cubic"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5],f=c[6],x=c[7];r(u,l);for(let p=1;p<=t;p++){let b=p/t,y=1-b,g=y*y,S=b*b;r(g*y*u+3*g*b*o+3*y*S*h+S*b*f,g*y*l+3*g*b*m+3*y*S*i+S*b*x)}}else if(a.type==="arc"){let u=c[0],l=c[1],o=c[2],m=c[3],h=c[4],i=c[5],f=c[6]!==0,x=c[7],p=Math.PI*2,b=i-h,y=Math.abs(b)<1e-9;for(;b<0;)b+=p;for(;b>p;)b-=p;b<1e-9&&(b=y?0:p),f&&!y&&(b=b===p?-p:b-p);let g=Math.cos(x),S=Math.sin(x),d=Math.max(2,t);for(let w=0;w<=d;w++){let P=w/d,G=h+P*b,C=o*Math.cos(G),E=m*Math.sin(G);r(u+C*g-E*S,l+C*S+E*g)}}}if(s.length>2){let a=s[0],c=s[s.length-1];Math.hypot(a.x-c.x,a.y-c.y)<1e-6&&s.pop()}return s}getSpacedPoints(e=12){return this.getPoints(e)}}class xe extends fe{constructor(e){super(e),this.holes=[]}extractPoints(e=12){return{shape:this.getPoints(e),holes:this.holes.map(t=>t.getPoints(e))}}}function be(n){let e=0,t=n.length;for(let s=0,r=t-1;s<t;r=s++)e+=n[r].x*n[s].y-n[s].x*n[r].y;return e*.5}function fn(n,e,t,s,r,a,c,u){let l=c-t,o=u-s,m=r-t,h=a-s,i=n-t,f=e-s,x=l*l+o*o,p=l*m+o*h,b=l*i+o*f,y=m*m+h*h,g=m*i+h*f,S=x*y-p*p;if(Math.abs(S)<1e-12)return!1;let d=1/S,w=(y*b-p*g)*d,P=(x*g-p*b)*d;return w>=-1e-7&&P>=-1e-7&&w+P<=1+1e-7}function ze(n,e){let t=n.slice();be(t)<0&&t.reverse();let s=t.map(l=>new A(l.x,l.y)),r=t.map((l,o)=>o),a=[];for(let l of e){if(!l||l.length<3)continue;let o=l.slice();be(o)>0&&o.reverse();let m=[],h=-1/0,i=0;for(let f=0;f<o.length;f++){let x=o[f],p=s.length;s.push(new A(x.x,x.y)),m.push(p),x.x>h&&(h=x.x,i=f)}a.push({pts:o,indices:m,maxX:h,maxIdx:i})}a.sort((l,o)=>o.maxX-l.maxX);let c=(l,o,m)=>(o.x-l.x)*(m.y-l.y)-(o.y-l.y)*(m.x-l.x),u=(l,o,m)=>{for(let h=0;h<m.length;h++){let i=m[h],f=m[(h+1)%m.length];if(c(l,o,i)*c(l,o,f)<0&&c(i,f,l)*c(i,f,o)<0)return!0}return!1};for(let l of a){let o=l.pts[l.maxIdx],m=o.x,h=r.length,i=r.map(y=>s[y]),f=y=>Math.hypot(i[y].x-m,i[y].y-o.y),x=i.map((y,g)=>g).sort((y,g)=>+(i[y].x<m)-+(i[g].x<m)||f(y)-f(g)),p=x[0];for(let y of x){let g=i[y],S=i[(y+h-1)%h],d=i[(y+1)%h],w=c(g,d,o)>=0,P=c(S,g,o)>=0;if((c(S,g,d)>=0?w&&P:w||P)&&!u(o,g,i)&&!a.some(C=>u(o,g,C.pts))){p=y;break}}let b=[];for(let y=0;y<=p;y++)b.push(r[y]);for(let y=0;y<=l.indices.length;y++){let g=l.indices[(l.maxIdx+y)%l.indices.length];b.push(g)}for(let y=p;y<r.length;y++)b.push(r[y]);r=b}return{merged:r.map(l=>s[l]),mergedIndices:r,allVertices:s}}function Ie(n,e){let t=[],s=n.slice();if(s.length<3)return t;let r=s.length*s.length+64,a=0;for(;s.length>2&&r-- >0;){let c=s.length,u=s[(a+c-1)%c],l=s[a%c],o=s[(a+1)%c],m=e[u],h=e[l],i=e[o];if((h.x-m.x)*(i.y-m.y)-(h.y-m.y)*(i.x-m.x)>1e-9){let x=!0;for(let p=0;p<c;p++){let b=s[p];if(b===u||b===l||b===o)continue;let y=e[b];if(fn(y.x,y.y,m.x,m.y,h.x,h.y,i.x,i.y)&&Math.hypot(y.x-m.x,y.y-m.y)>=1e-6&&Math.hypot(y.x-h.x,y.y-h.y)>=1e-6&&Math.hypot(y.x-i.x,y.y-i.y)>=1e-6){x=!1;break}}if(x){t.push([u,l,o]),s.splice(a%c,1),a=Math.max(0,a%c-1);continue}}a++,a>=c*2&&(t.push([u,l,o]),s.splice((a-1)%c,1),a=0)}return t}function _e(n,e){let t=n instanceof xe?n.extractPoints(e):{shape:n.getPoints(e),holes:[]},s=t.shape.length;for(let r of t.holes)s+=r.length;if(s>we)throw new RangeError(`SecurityError: shape point count (${s}) exceeds MAX_SHAPE_POINTS (${we})`);return t}class xn extends ne{constructor(e=new xe,t=12){super();let s=Array.isArray(e)?e:[e],r=[],a=[],c=[],u=[];for(let l of s){if(!(l instanceof fe))continue;let o=_e(l,t);if(o.shape.length<3)continue;let{mergedIndices:m,allVertices:h}=ze(o.shape,o.holes),i=Ie(m,h),f=r.length/3,x=1/0,p=1/0,b=-1/0,y=-1/0;for(let d of h)d.x<x&&(x=d.x),d.y<p&&(p=d.y),d.x>b&&(b=d.x),d.y>y&&(y=d.y);let g=Math.max(1e-6,b-x),S=Math.max(1e-6,y-p);for(let d of h)r.push(d.x,d.y,0),a.push(0,0,1),c.push((d.x-x)/g,(d.y-p)/S);for(let[d,w,P]of i)u.push(f+d,f+w,f+P)}pe(this,r,a,c,u)}}function pe(n,e,t,s,r){return n.setAttribute("position",new Me(e,3)),n.setAttribute("normal",new Me(t,3)),n.setAttribute("uv",new Me(s,2)),n.setIndex(r),n}function bn(n){let e=n.length,t=[];for(let s=0;s<e;s++){let r=n[(s+e-1)%e],a=n[s],c=n[(s+1)%e],u=a.x-r.x,l=a.y-r.y,o=Math.hypot(u,l)||1;u/=o,l/=o;let m=c.x-a.x,h=c.y-a.y,i=Math.hypot(m,h)||1;m/=i,h/=i;let f=l,x=-u,p=h,b=-m,y=f+p,g=x+b,S=Math.hypot(y,g);if(S>1e-6){y/=S,g/=S;let d=Math.max(.35,y*f+g*x);t.push(new A(y/d,g/d))}else t.push(new A(f,x))}return t}class pn extends ne{constructor(e=new xe,t={}){super();let s=Array.isArray(e)?e:[e],r=Math.max(1,Math.min(64,Math.floor(D(t.curveSegments,12)))),a=D(t.depth??t.amount,1),c=Math.max(1,Math.min(32,Math.floor(D(t.steps,1)))),u=!!(t.bevelEnabled??!1),l=u?Math.max(0,D(t.bevelThickness,.06)):0,o=u?Math.max(0,D(t.bevelSize,l*.8)):0,m=u?D(t.bevelOffset,0):0,h=u?Math.max(1,Math.min(8,Math.floor(D(t.bevelSegments,2)))):0,i=[],f=[],x=[],p=[];for(let b of s){if(!(b instanceof fe))continue;let y=_e(b,r);if(y.shape.length<3)continue;let g=y.shape.slice();be(g)<0&&g.reverse();let S=[];for(let v of y.holes){if(v.length<3)continue;let k=v.slice();be(k)>0&&k.reverse(),S.push(k)}let{mergedIndices:d,allVertices:w}=ze(g,S),P=Ie(d,w),G=[g,...S],C=[];for(let v of G){let k=bn(v);for(let T of k)C.push(T)}let E=1/0,_=1/0,I=-1/0,B=-1/0;for(let v of w)v.x<E&&(E=v.x),v.y<_&&(_=v.y),v.x>I&&(I=v.x),v.y>B&&(B=v.y);let V=Math.max(1e-6,I-E),O=Math.max(1e-6,B-_),se=-l,oe=a+l,j=i.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;i.push(R,z,se),f.push(0,0,-1),x.push((R-E)/V,(z-_)/O)}for(let[v,k,T]of P)p.push(j+v,j+T,j+k);let q=i.length/3;for(let v=0;v<w.length;v++){let k=w[v],T=C[v]??new A(0,0),R=k.x+T.x*m,z=k.y+T.y*m;i.push(R,z,oe),f.push(0,0,1),x.push((R-E)/V,(z-_)/O)}for(let[v,k,T]of P)p.push(q+v,q+k,q+T);let N=[];if(u&&h>0)for(let v=0;v<h;v++){let T=v/h*Math.PI/2;N.push({z:-l*Math.cos(T),expand:m+o*Math.sin(T)})}for(let v=0;v<=c;v++){let k=v/c;N.push({z:k*a,expand:m+o})}if(u&&h>0)for(let v=1;v<=h;v++){let T=v/h*Math.PI/2;N.push({z:a+l*Math.sin(T),expand:m+o*Math.cos(T)})}let Y=0;for(let v of G){let k=v.length;for(let T=0;T<N.length-1;T++){let R=N[T],z=N[T+1];for(let X=0;X<k;X++){let F=(X+1)%k,W=v[X],$=v[F],U=C[Y+X],Z=C[Y+F],K=W.x+U.x*R.expand,Q=W.y+U.y*R.expand,ee=$.x+Z.x*R.expand,H=$.y+Z.y*R.expand,wn=$.x+Z.x*z.expand,Gn=$.y+Z.y*z.expand,qe=W.x+U.x*z.expand,We=W.y+U.y*z.expand,$e=ee-K,Ue=H-Q,Ze=0,Ke=qe-K,Qe=We-Q,Je=z.z-R.z,re=Ue*Je-Ze*Qe,ie=Ze*Ke-$e*Je,ce=$e*Qe-Ue*Ke,Ce=Math.hypot(re,ie,ce)||1;re/=Ce,ie/=Ce,ce/=Ce;let ae=i.length/3;i.push(K,Q,R.z,ee,H,R.z,wn,Gn,z.z,qe,We,z.z),f.push(re,ie,ce,re,ie,ce,re,ie,ce,re,ie,ce);let en=X/k,nn=(X+1)/k,tn=T/(N.length-1),sn=(T+1)/(N.length-1);x.push(en,tn,nn,tn,nn,sn,en,sn),p.push(ae,ae+1,ae+2,ae,ae+2,ae+3)}}Y+=k}}pe(this,i,f,x,p)}}function Ve(n){return{x:n.x,y:n.y,z:n.z,nx:n.nx,ny:n.ny,nz:n.nz,u:n.u,v:n.v}}function gn(n){return{x:n.x,y:n.y,z:n.z,nx:-n.nx,ny:-n.ny,nz:-n.nz,u:n.u,v:n.v}}function dn(n,e,t){let s=n.nx+(e.nx-n.nx)*t,r=n.ny+(e.ny-n.ny)*t,a=n.nz+(e.nz-n.nz)*t,c=Math.hypot(s,r,a)||1;return{x:n.x+(e.x-n.x)*t,y:n.y+(e.y-n.y)*t,z:n.z+(e.z-n.z)*t,nx:s/c,ny:r/c,nz:a/c,u:n.u+(e.u-n.u)*t,v:n.v+(e.v-n.v)*t}}function vn(n){if(n.length<3)return null;let e=n[0],t=n[1],s=n[2],r=t.x-e.x,a=t.y-e.y,c=t.z-e.z,u=s.x-e.x,l=s.y-e.y,o=s.z-e.z,m=a*o-c*l,h=c*u-r*o,i=r*l-a*u,f=Math.hypot(m,h,i);if(f<1e-9)return null;m/=f,h/=f,i/=f;let x=m*e.x+h*e.y+i*e.z;return{vertices:n,nx:m,ny:h,nz:i,w:x}}function Sn(n){n.vertices.reverse();for(let e=0;e<n.vertices.length;e++)n.vertices[e]=gn(n.vertices[e]);n.nx=-n.nx,n.ny=-n.ny,n.nz=-n.nz,n.w=-n.w}let Ae=1e-5,Ne=0,Ge=1,ge=2,Xe=3;function Be(n,e,t,s,r,a,c,u,l){let o=0,m=[];for(let h=0;h<r.vertices.length;h++){let i=r.vertices[h],f=n*i.x+e*i.y+t*i.z-s,x=f<-Ae?ge:f>Ae?Ge:Ne;o|=x,m.push(x)}switch(o){case Ne:{n*r.nx+e*r.ny+t*r.nz>0?a.push(r):c.push(r);break}case Ge:u.push(r);break;case ge:l.push(r);break;case Xe:{let h=[],i=[],f=r.vertices.length;for(let g=0;g<f;g++){let S=(g+1)%f,d=m[g],w=m[S],P=r.vertices[g],G=r.vertices[S];if(d!==ge&&h.push(P),d!==Ge&&i.push(d!==ge?Ve(P):P),(d|w)===Xe){let C=G.x-P.x,E=G.y-P.y,_=G.z-P.z,I=n*C+e*E+t*_,B=Math.abs(I)>1e-12?(s-(n*P.x+e*P.y+t*P.z))/I:.5,V=dn(P,G,Math.max(0,Math.min(1,B)));h.push(V),i.push(Ve(V))}}let{nx:x,ny:p,nz:b,w:y}=r;h.length>=3&&u.push({vertices:h,nx:x,ny:p,nz:b,w:y}),i.length>=3&&l.push({vertices:i,nx:x,ny:p,nz:b,w:y});break}default:break}}class he{constructor(e,t=0){this.nx=0,this.ny=0,this.nz=0,this.w=0,this.hasPlane=!1,this.polygons=[],this.front=null,this.back=null,e&&e.length>0&&this.build(e,t)}invert(){for(let t=0;t<this.polygons.length;t++)Sn(this.polygons[t]);this.nx=-this.nx,this.ny=-this.ny,this.nz=-this.nz,this.w=-this.w,this.front&&this.front.invert(),this.back&&this.back.invert();let e=this.front;this.front=this.back,this.back=e}clipPolygons(e,t=0){if(!this.hasPlane||e.length===0)return e.slice();if(t>=te)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${te})`);let s=[],r=[];for(let a=0;a<e.length;a++)Be(this.nx,this.ny,this.nz,this.w,e[a],s,r,s,r);return this.front&&s.length>0&&(s=this.front.clipPolygons(s,t+1)),this.back?r=r.length>0?this.back.clipPolygons(r,t+1):[]:r=[],s.concat(r)}clipTo(e,t=0){this.polygons.length>0&&(this.polygons=e.clipPolygons(this.polygons,0)),t<te&&(this.front&&this.front.clipTo(e,t+1),this.back&&this.back.clipTo(e,t+1))}allPolygons(e=[]){for(let t=0;t<this.polygons.length;t++)e.push(this.polygons[t]);return this.front&&this.front.allPolygons(e),this.back&&this.back.allPolygons(e),e}build(e,t=0){if(!e.length)return;if(!this.hasPlane){let a=e[e.length>>1];this.nx=a.nx,this.ny=a.ny,this.nz=a.nz,this.w=a.w,this.hasPlane=!0}if(t>=te)throw new RangeError(`SecurityError: CSG BSP depth exceeds MAX_BSP_DEPTH (${te})`);let s=[],r=[];for(let a=0;a<e.length;a++)Be(this.nx,this.ny,this.nz,this.w,e[a],this.polygons,this.polygons,s,r);s.length>0&&(this.front||(this.front=new he),this.front.build(s,t+1)),r.length>0&&(this.back||(this.back=new he),this.back.build(r,t+1))}}function De(n,e){if(!e&&n._csgPolygons)return n._csgPolygons;let t=n.attributes.position;if(!t||t.count===0)return[];let s=n.attributes.normal,r=n.attributes.uv,a=n.index?n.index.array:null,c=Math.floor(a?a.length/3:t.count/3);if(c>le)throw new RangeError(`SecurityError: CSG input triangle count (${c}) exceeds MAX_CSG_TRIANGLES (${le})`);let u=e?e.elements:null,l=u?u[0]*(u[5]*u[10]-u[9]*u[6])-u[4]*(u[1]*u[10]-u[9]*u[2])+u[8]*(u[1]*u[6]-u[5]*u[2])<0:!1,o=u?new hn().getNormalMatrix(e).elements:null,m=i=>{let f=t.getX(i),x=t.getY(i),p=t.getZ(i),b=s?s.getX(i):NaN,y=s?s.getY(i):NaN,g=s?s.getZ(i):NaN;if(u&&o){let w=u[0]*f+u[4]*x+u[8]*p+u[12],P=u[1]*f+u[5]*x+u[9]*p+u[13],G=u[2]*f+u[6]*x+u[10]*p+u[14];f=w,x=P,p=G;let C=o[0]*b+o[3]*y+o[6]*g,E=o[1]*b+o[4]*y+o[7]*g,_=o[2]*b+o[5]*y+o[8]*g,I=Math.hypot(C,E,_)||1;b=C/I,y=E/I,g=_/I}let S=r?r.getX(i):0,d=r?r.getY(i):0;return{x:f,y:x,z:p,nx:b,ny:y,nz:g,u:S,v:d}},h=[];for(let i=0;i<c;i++){let f=a?a[i*3]:i*3,x=a?a[i*3+1]:i*3+1,p=a?a[i*3+2]:i*3+2,b=vn(l?[m(f),m(p),m(x)]:[m(f),m(x),m(p)]);b&&h.push(b)}return h}function Pn(n){let e=[],t=[],s=[],r=[];for(let c of n){let u=c.vertices;if(u.length<3)continue;let l=e.length/3;for(let o of u)e.push(o.x,o.y,o.z),Number.isFinite(o.nx)&&o.nx*o.nx+o.ny*o.ny+o.nz*o.nz>.5?t.push(o.nx,o.ny,o.nz):t.push(c.nx,c.ny,c.nz),s.push(o.u,o.v);for(let o=1;o<u.length-1;o++)r.push(l,l+o,l+o+1)}let a=pe(new ne,e,t,s,r);return a._csgPolygons=n,a}function Mn(n,e,t){if(n.length+e.length>le)throw new RangeError(`SecurityError: Combined CSG triangle count (${n.length+e.length}) exceeds MAX_CSG_TRIANGLES (${le})`);if(n.length===0)return t==="union"?e:[];if(e.length===0)return t==="intersect"?[]:n;let s=1/0,r=1/0,a=1/0,c=-1/0,u=-1/0,l=-1/0;for(let f=0;f<e.length;f++){let x=e[f].vertices;for(let p=0;p<x.length;p++){let b=x[p];b.x<s&&(s=b.x),b.y<r&&(r=b.y),b.z<a&&(a=b.z),b.x>c&&(c=b.x),b.y>u&&(u=b.y),b.z>l&&(l=b.z)}}s-=1e-4,r-=1e-4,a-=1e-4,c+=1e-4,u+=1e-4,l+=1e-4;let o=[],m=[];for(let f=0;f<n.length;f++){let x=n[f],p=x.vertices,b=1/0,y=1/0,g=1/0,S=-1/0,d=-1/0,w=-1/0;for(let P=0;P<p.length;P++){let G=p[P];G.x<b&&(b=G.x),G.y<y&&(y=G.y),G.z<g&&(g=G.z),G.x>S&&(S=G.x),G.y>d&&(d=G.y),G.z>w&&(w=G.z)}S<s||b>c||d<r||y>u||w<a||g>l?m.push(x):o.push(x)}if(o.length===0)return t==="union"?n.concat(e):t==="subtract"?n:[];let h=new he(o),i=new he(e);return t==="union"?(h.clipTo(i),i.clipTo(h),i.invert(),i.clipTo(h),i.invert(),h.build(i.allPolygons()),m.concat(h.allPolygons())):t==="subtract"?(h.invert(),h.clipTo(i),i.clipTo(h),i.invert(),i.clipTo(h),i.invert(),h.build(i.allPolygons()),h.invert(),m.concat(h.allPolygons())):(h.invert(),i.clipTo(h),i.invert(),h.clipTo(i),i.clipTo(h),h.build(i.allPolygons()),h.invert(),h.allPolygons())}function Oe(n,e,t,s=null,r=null){let a=De(n,s),c=De(e,r);return Pn(Mn(a,c,t))}function ke(n,e,t){let s=n instanceof ye||!!n?.isMesh,r=e instanceof ye||!!e?.isMesh,a=s?n.geometry:n,c=r?e.geometry:e,u=null;if(r)if(e.updateMatrix(),s){n.updateMatrix();let h=new Pe().makeScale(1/(n.scale.x||1),1/(n.scale.y||1),1/(n.scale.z||1)),i=Math.hypot(n.quaternion.x,n.quaternion.y,n.quaternion.z,n.quaternion.w)||1,f=new Pe().compose(new ue(0,0,0),new J(-n.quaternion.x/i,-n.quaternion.y/i,-n.quaternion.z/i,n.quaternion.w/i),new ue(1,1,1)),x=new Pe().makeTranslation(-n.position.x,-n.position.y,-n.position.z);u=h.multiply(f).multiply(x).multiply(e.matrix)}else u=e.matrix;let l=Oe(a,c,t,null,u),o=s?n.material:new Ee,m=new ye(l,o);return s&&(m.position.copy(n.position),m.quaternion.copy(n.quaternion),m.scale.copy(n.scale),m.name=n.name),m}let de={toGeometry:Oe,subtract(n,e){return ke(n,e,"subtract")},union(n,e){return ke(n,e,"union")},intersect(n,e){return ke(n,e,"intersect")}},Ye={0:[[[.15,0],[.85,0],[.85,1],[.15,1],[.15,0]]],1:[[[.3,.8],[.5,1],[.5,0]],[[.2,0],[.8,0]]],2:[[[.15,.8],[.3,1],[.7,1],[.85,.8],[.85,.55],[.15,0],[.85,0]]],3:[[[.15,.85],[.3,1],[.75,1],[.85,.75],[.5,.5],[.85,.25],[.75,0],[.3,0],[.15,.15]]],4:[[[.7,0],[.7,1],[.15,.35],[.9,.35]]],5:[[[.85,1],[.2,1],[.15,.55],[.75,.55],[.85,.3],[.75,0],[.2,0]]],6:[[[.8,.9],[.5,1],[.15,.7],[.15,.15],[.5,0],[.85,.2],[.85,.45],[.5,.55],[.15,.45]]],7:[[[.15,1],[.85,1],[.35,0]]],8:[[[.2,.5],[.15,.75],[.3,1],[.7,1],[.85,.75],[.8,.5],[.2,.5],[.15,.2],[.3,0],[.7,0],[.85,.2],[.8,.5]]],9:[[[.85,.55],[.5,.45],[.15,.55],[.15,.85],[.5,1],[.85,.85],[.85,.2],[.5,0],[.2,.1]]],A:[[[.1,0],[.5,1],[.9,0]],[[.25,.35],[.75,.35]]],B:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.7,.5],[.85,.25],[.7,0],[.15,0]]],C:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.65,0],[.85,.2]]],D:[[[.15,0],[.15,1],[.65,1],[.85,.75],[.85,.25],[.65,0],[.15,0]]],E:[[[.85,1],[.15,1],[.15,0],[.85,0]],[[.15,.5],[.7,.5]]],F:[[[.85,1],[.15,1],[.15,0]],[[.15,.5],[.7,.5]]],G:[[[.85,.8],[.65,1],[.3,1],[.15,.75],[.15,.25],[.3,0],[.85,0],[.85,.45],[.55,.45]]],H:[[[.15,0],[.15,1]],[[.85,0],[.85,1]],[[.15,.5],[.85,.5]]],I:[[[.25,1],[.75,1]],[[.5,1],[.5,0]],[[.25,0],[.75,0]]],J:[[[.8,1],[.8,.25],[.6,0],[.3,0],[.15,.25]]],K:[[[.15,0],[.15,1]],[[.85,1],[.15,.45],[.85,0]]],L:[[[.15,1],[.15,0],[.85,0]]],M:[[[.1,0],[.1,1],[.5,.35],[.9,1],[.9,0]]],N:[[[.15,0],[.15,1],[.85,0],[.85,1]]],O:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]]],P:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]]],Q:[[[.3,0],[.7,0],[.85,.25],[.85,.75],[.7,1],[.3,1],[.15,.75],[.15,.25],[.3,0]],[[.55,.3],[.9,-.05]]],R:[[[.15,0],[.15,1],[.7,1],[.85,.75],[.7,.5],[.15,.5]],[[.55,.5],[.85,0]]],S:[[[.85,.85],[.65,1],[.3,1],[.15,.75],[.85,.25],[.7,0],[.3,0],[.15,.15]]],T:[[[.1,1],[.9,1]],[[.5,1],[.5,0]]],U:[[[.15,1],[.15,.25],[.35,0],[.65,0],[.85,.25],[.85,1]]],V:[[[.1,1],[.5,0],[.9,1]]],W:[[[.05,1],[.25,0],[.5,.65],[.75,0],[.95,1]]],X:[[[.15,1],[.85,0]],[[.85,1],[.15,0]]],Y:[[[.15,1],[.5,.5],[.85,1]],[[.5,.5],[.5,0]]],Z:[[[.15,1],[.85,1],[.15,0],[.85,0]]],".":[[[.45,0],[.55,0],[.55,.12],[.45,.12],[.45,0]]],",":[[[.5,.15],[.4,-.1]]],":":[[[.45,.1],[.55,.1]],[[.45,.7],[.55,.7]]],"-":[[[.2,.5],[.8,.5]]],"+":[[[.2,.5],[.8,.5]],[[.5,.2],[.5,.8]]],"=":[[[.2,.35],[.8,.35]],[[.2,.65],[.8,.65]]],"/":[[[.2,0],[.8,1]]],"!":[[[.5,1],[.5,.28]],[[.5,.1],[.5,0]]],"?":[[[.2,.8],[.35,1],[.7,1],[.85,.75],[.5,.45],[.5,.28]],[[.5,.1],[.5,0]]],"(":[[[.65,1],[.35,.65],[.35,.35],[.65,0]]],")":[[[.35,1],[.65,.65],[.65,.35],[.35,0]]],"%":[[[.2,0],[.8,1]],[[.2,.8],[.35,.8],[.35,.95],[.2,.95],[.2,.8]],[[.65,.05],[.8,.05],[.8,.2],[.65,.2],[.65,.05]]],"#":[[[.32,0],[.32,1]],[[.68,0],[.68,1]],[[.12,.35],[.88,.35]],[[.12,.65],[.88,.65]]],$:[[[.8,.8],[.6,.92],[.3,.92],[.18,.72],[.82,.28],[.7,.08],[.4,.08],[.2,.2]],[[.5,1],[.5,0]]],_:[[[.1,0],[.9,0]]],"[":[[[.65,1],[.3,1],[.3,0],[.65,0]]],"]":[[[.35,1],[.7,1],[.7,0],[.35,0]]],"<":[[[.75,.85],[.25,.5],[.75,.15]]],">":[[[.25,.85],[.75,.5],[.25,.15]]],"*":[[[.5,.2],[.5,.8]],[[.2,.35],[.8,.65]],[[.2,.65],[.8,.35]]],"\\":[[[.2,1],[.8,0]]]};class Fe extends ne{constructor(e="",t={}){super();let s=String(e??"").slice(0,Re),r=Math.max(.005,Math.min(100,D(t.size,.2))),a=!!(t.bevelEnabled??!1),c=a?Math.max(0,Math.min(2,D(t.bevelThickness,r*.04))):0,u=a?Math.max(0,Math.min(2,D(t.bevelSize,r*.03))):0,l=Math.max(.001,Math.min(20,D(t.depth??t.height,r*.2)))+c*2,o=r*.085+u,m=r*.68,h=r*.82,i=[],f=[],x=[],p=[],b=(S,d,w,P,G,C,E)=>{let _=w-S,I=P-d,B=Math.hypot(_,I),V=1,O=0;B>1e-6&&(V=_/B,O=I/B);let se=-O*G,oe=V*G,j=V*G*.6,q=O*G*.6,N=S-j+se,Y=d-q+oe,v=S-j-se,k=d-q-oe,T=w+j-se,R=P+q-oe,z=w+j+se,X=P+q+oe,F=(W,$,U,Z,K,Q,ee)=>{let H=i.length/3;i.push(W[0],W[1],W[2],$[0],$[1],$[2],U[0],U[1],U[2],Z[0],Z[1],Z[2]),f.push(K,Q,ee,K,Q,ee,K,Q,ee,K,Q,ee),x.push(0,0,1,0,1,1,0,1),p.push(H,H+1,H+2,H,H+2,H+3)};F([N,Y,E],[v,k,E],[T,R,E],[z,X,E],0,0,1),F([v,k,C],[N,Y,C],[z,X,C],[T,R,C],0,0,-1),F([N,Y,C],[v,k,C],[v,k,E],[N,Y,E],-V,-O,0),F([T,R,C],[z,X,C],[z,X,E],[T,R,E],V,O,0),F([v,k,C],[T,R,C],[T,R,E],[v,k,E],O,-V,0),F([z,X,C],[N,Y,C],[N,Y,E],[z,X,E],-O,V,0)},y=0,g=0;for(let S=0;S<s.length;S++){let d=s[S];if(d===`
|
|
18
|
+
`){y=0,g-=r*1.35;continue}if(d===" "||d===" "){y+=h*(d===" "?.75:3);continue}if(d==="\r")continue;let w=d.toUpperCase(),P=d!==w&&d>="a"&&d<="z",G=Ye[w]??Ye["?"],C=P?r*.76:r,E=P?m*.88:m;for(let _ of G)for(let I=0;I<_.length-1;I++){let B=_[I],V=_[I+1];b(y+B[0]*E,g+B[1]*C,y+V[0]*E,g+V[1]*C,o,-l*.5,l*.5)}y+=P?h*.88:h}pe(this,i,f,x,p),t.center!==!1?this.center():this.computeBoundingBox()}}function He(n){if(!n)return;let e=n,t=n.userData?.xr?.text;if(t!=null&&t!==!1){let r=e.geometry?.attributes?.position;if((!r||r.count===0)&&n.userData._textApplied!==!0){let a="",c=.08,u=.015,l;if(typeof t=="string"||typeof t=="number")a=String(t);else if(typeof t=="object"){let o=t;a=String(o.text??o.value??""),o.size!==void 0&&(c=Number(o.size)||.08),(o.depth!==void 0||o.height!==void 0)&&(u=Number(o.depth??o.height)||c*.2),(typeof o.color=="string"||typeof o.color=="number")&&(l=o.color)}a.trim().length>0&&(e.geometry=new Fe(a,{size:c,depth:u}),n.userData._textApplied=!0,e.material instanceof yn?l!==void 0&&n.userData._autoTextColorApplied!==!0&&(e.material.color=new mn(l),n.userData._autoTextColorApplied=!0):e.material=new Ee({color:l??16317180}))}}let s=n.userData?.csg;if(s&&typeof s=="object"&&n.userData._csgApplied!==!0&&e.geometry instanceof ne&&e.geometry.attributes.position?.count>0){n.userData._csgApplied=!0;let r=Array.isArray(s)?s:[s],a=e.geometry;for(let c of r){if(!c||typeof c!="object")continue;let u=c,l=String(u.op??u.operation??"subtract"),o=l==="union"||l==="intersect"?l:"subtract",m=u.target??u.mesh??u.geometry;if(m instanceof ye||m instanceof ne)try{let h=o==="union"?de.union(e,m):o==="intersect"?de.intersect(e,m):de.subtract(e,m);e.geometry!==a&&e.geometry.dispose?.(),e.geometry=h.geometry}catch(h){typeof console<"u"&&console.warn("[three-live] userData.csg skipped:",h)}}}}let je={Path:fe,Shape:xe,ShapeGeometry:xn,ExtrudeGeometry:pn,TextGeometry:Fe,CSG:de,MAX_CSG_TRIANGLES:le,MAX_BSP_DEPTH:te,MAX_TEXT_GEOMETRY_CHARS:Re,MAX_SHAPE_POINTS:we,materializeDeclarativeGeometry:He};return L&&typeof L=="object"&&(L.authorNamespace||(L.authorNamespace={}),Object.assign(L.authorNamespace,je),L.materializeDeclarativeGeometry=He),je}var Le={name:"cad",onRegister(){on(Se);let M=me(),L=M.threeNamespace??(typeof globalThis<"u"?globalThis.THREE:void 0);L&&Se(L,M)}};rn(Le);return Rn(zn);})();
|