lingo3d-vanilla
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
1 lines • 506 kB
JavaScript
"use strict";(self.webpackChunklingo3d_vanilla=self.webpackChunklingo3d_vanilla||[]).push([[450],{6938:(t,e,n)=>{n.d(e,{S:()=>i});const i=new WeakMap},8450:(t,e,n)=>{n.r(e),n.d(e,{default:()=>Ot});var i=n(9401),r=n(8753),a=n(7002),s=n(6568),o=n(8892),l=n(6760),c=n(6938);const u=a.Kj0.prototype.raycast;function h(t,e,n){return null===t?null:(t.distance=t.point.distanceTo(n.ray.origin),t.object=e,t.distance<n.near||t.distance>n.far?null:t)}n(650),n(5488);const d=1.25,p=65535,f=Math.pow(2,-24);class m{constructor(){}}function g(t,e,n){return n.min.x=e[t],n.min.y=e[t+1],n.min.z=e[t+2],n.max.x=e[t+3],n.max.y=e[t+4],n.max.z=e[t+5],n}function _(t){let e=-1,n=-1/0;for(let i=0;i<3;i++){const r=t[i+3]-t[i];r>n&&(n=r,e=i)}return e}function v(t,e){e.set(t)}function x(t,e,n){let i,r;for(let a=0;a<3;a++){const s=a+3;i=t[a],r=e[a],n[a]=i<r?i:r,i=t[s],r=e[s],n[s]=i>r?i:r}}function y(t,e,n){for(let i=0;i<3;i++){const r=e[t+2*i],a=e[t+2*i+1],s=r-a,o=r+a;s<n[i]&&(n[i]=s),o>n[i+3]&&(n[i+3]=o)}}function b(t){const e=t[3]-t[0],n=t[4]-t[1],i=t[5]-t[2];return 2*(e*n+n*i+i*e)}function M(t,e,n,i,r=null){let a=1/0,s=1/0,o=1/0,l=-1/0,c=-1/0,u=-1/0,h=1/0,d=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0;const _=null!==r;for(let v=6*e,x=6*(e+n);v<x;v+=6){const e=t[v+0],n=t[v+1],i=e-n,r=e+n;i<a&&(a=i),r>l&&(l=r),_&&e<h&&(h=e),_&&e>f&&(f=e);const x=t[v+2],y=t[v+3],b=x-y,M=x+y;b<s&&(s=b),M>c&&(c=M),_&&x<d&&(d=x),_&&x>m&&(m=x);const w=t[v+4],S=t[v+5],T=w-S,E=w+S;T<o&&(o=T),E>u&&(u=E),_&&w<p&&(p=w),_&&w>g&&(g=w)}i[0]=a,i[1]=s,i[2]=o,i[3]=l,i[4]=c,i[5]=u,_&&(r[0]=h,r[1]=d,r[2]=p,r[3]=f,r[4]=m,r[5]=g)}const w=32,S=(t,e)=>t.candidate-e.candidate,T=new Array(w).fill().map((()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0}))),E=new Float32Array(6);function A(t,e){function n(t){g&&g(t/A)}function i(e,r,a,f=null,g=0){if(!P&&g>=c&&(P=!0,u&&(console.warn(`MeshBVH: Max depth of ${c} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),a<=h||g>=c)return n(r+a),e.offset=r,e.count=a,e;const A=function(t,e,n,i,r,a){let s=-1,o=0;if(0===a)s=_(e),-1!==s&&(o=(e[s]+e[s+3])/2);else if(1===a)s=_(t),-1!==s&&(o=function(t,e,n,i){let r=0;for(let a=e,s=e+n;a<s;a++)r+=t[6*a+2*i];return r/n}(n,i,r,s));else if(2===a){const a=b(t);let l=d*r;const c=6*i,u=6*(i+r);for(let t=0;t<3;t++){const i=e[t],h=(e[t+3]-i)/w;if(r<8){const e=[...T];e.length=r;let i=0;for(let r=c;r<u;r+=6,i++){const a=e[i];a.candidate=n[r+2*t],a.count=0;const{bounds:s,leftCacheBounds:o,rightCacheBounds:l}=a;for(let t=0;t<3;t++)l[t]=1/0,l[t+3]=-1/0,o[t]=1/0,o[t+3]=-1/0,s[t]=1/0,s[t+3]=-1/0;y(r,n,s)}e.sort(S);let h=r;for(let t=0;t<h;t++){const n=e[t];for(;t+1<h&&e[t+1].candidate===n.candidate;)e.splice(t+1,1),h--}for(let r=c;r<u;r+=6){const i=n[r+2*t];for(let t=0;t<h;t++){const a=e[t];i>=a.candidate?y(r,n,a.rightCacheBounds):(y(r,n,a.leftCacheBounds),a.count++)}}for(let n=0;n<h;n++){const i=e[n],c=i.count,u=r-i.count,h=i.leftCacheBounds,p=i.rightCacheBounds;let f=0;0!==c&&(f=b(h)/a);let m=0;0!==u&&(m=b(p)/a);const g=1+d*(f*c+m*u);g<l&&(s=t,l=g,o=i.candidate)}}else{for(let t=0;t<w;t++){const e=T[t];e.count=0,e.candidate=i+h+t*h;const n=e.bounds;for(let t=0;t<3;t++)n[t]=1/0,n[t+3]=-1/0}for(let r=c;r<u;r+=6){let e=~~((n[r+2*t]-i)/h);e>=w&&(e=31);const a=T[e];a.count++,y(r,n,a.bounds)}const e=T[31];v(e.bounds,e.rightCacheBounds);for(let t=30;t>=0;t--){const e=T[t],n=T[t+1];x(e.bounds,n.rightCacheBounds,e.rightCacheBounds)}let p=0;for(let n=0;n<31;n++){const e=T[n],i=e.count,c=e.bounds,u=T[n+1].rightCacheBounds;0!==i&&(0===p?v(c,E):x(c,E,E)),p+=i;let h=0,f=0;0!==p&&(h=b(E)/a);const m=r-p;0!==m&&(f=b(u)/a);const g=1+d*(h*p+f*m);g<l&&(s=t,l=g,o=e.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${a} used.`);return{axis:s,pos:o}}(e.boundingData,f,o,r,a,p);if(-1===A.axis)return n(r+a),e.offset=r,e.count=a,e;const C=function(t,e,n,i,r){let a=n,s=n+i-1;const o=r.pos,l=2*r.axis;for(;;){for(;a<=s&&e[6*a+l]<o;)a++;for(;a<=s&&e[6*s+l]>=o;)s--;if(!(a<s))return a;for(let n=0;n<3;n++){let i=t[3*a+n];t[3*a+n]=t[3*s+n],t[3*s+n]=i;let r=e[6*a+2*n+0];e[6*a+2*n+0]=e[6*s+2*n+0],e[6*s+2*n+0]=r;let o=e[6*a+2*n+1];e[6*a+2*n+1]=e[6*s+2*n+1],e[6*s+2*n+1]=o}a++,s--}}(l,o,r,a,A);if(C===r||C===r+a)n(r+a),e.offset=r,e.count=a;else{e.splitAxis=A.axis;const t=new m,n=r,l=C-r;e.left=t,t.boundingData=new Float32Array(6),M(o,n,l,t.boundingData,s),i(t,n,l,s,g+1);const c=new m,u=C,h=a-l;e.right=c,c.boundingData=new Float32Array(6),M(o,u,h,c.boundingData,s),i(c,u,h,s,g+1)}return e}!function(t,e){if(!t.index){const n=t.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let r;r=n>65535?new Uint32Array(new i(4*n)):new Uint16Array(new i(2*n)),t.setIndex(new a.TlE(r,1));for(let t=0;t<n;t++)r[t]=t}}(t,e);const r=new Float32Array(6),s=new Float32Array(6),o=function(t,e){const n=t.attributes.position,i=t.index.array,r=i.length/3,a=new Float32Array(6*r),s=n.normalized,o=n.array,l=n.offset||0;let c=3;n.isInterleavedBufferAttribute&&(c=n.data.stride);const u=["getX","getY","getZ"];for(let h=0;h<r;h++){const t=3*h,r=6*h;let d,p,m;s?(d=i[t+0],p=i[t+1],m=i[t+2]):(d=i[t+0]*c+l,p=i[t+1]*c+l,m=i[t+2]*c+l);for(let i=0;i<3;i++){let t,l,c;s?(t=n[u[i]](d),l=n[u[i]](p),c=n[u[i]](m)):(t=o[d+i],l=o[p+i],c=o[m+i]);let h=t;l<h&&(h=l),c<h&&(h=c);let g=t;l>g&&(g=l),c>g&&(g=c);const _=(g-h)/2,v=2*i;a[r+v+0]=h+_,a[r+v+1]=_+(Math.abs(h)+_)*f,h<e[i]&&(e[i]=h),g>e[i+3]&&(e[i+3]=g)}}return a}(t,r),l=t.index.array,c=e.maxDepth,u=e.verbose,h=e.maxLeafTris,p=e.strategy,g=e.onProgress,A=t.index.count/3;let P=!1;const C=[],L=function(t){if(!t.groups||!t.groups.length)return[{offset:0,count:t.index.count/3}];const e=[],n=new Set;for(const r of t.groups)n.add(r.start),n.add(r.start+r.count);const i=Array.from(n.values()).sort(((t,e)=>t-e));for(let r=0;r<i.length-1;r++){const t=i[r],n=i[r+1];e.push({offset:t/3,count:(n-t)/3})}return e}(t);if(1===L.length){const t=L[0],e=new m;e.boundingData=r,function(t,e,n,i){let r=1/0,a=1/0,s=1/0,o=-1/0,l=-1/0,c=-1/0;for(let u=6*e,h=6*(e+n);u<h;u+=6){const e=t[u+0];e<r&&(r=e),e>o&&(o=e);const n=t[u+2];n<a&&(a=n),n>l&&(l=n);const i=t[u+4];i<s&&(s=i),i>c&&(c=i)}i[0]=r,i[1]=a,i[2]=s,i[3]=o,i[4]=l,i[5]=c}(o,t.offset,t.count,s),i(e,t.offset,t.count,s),C.push(e)}else for(let a of L){const t=new m;t.boundingData=new Float32Array(6),M(o,a.offset,a.count,t.boundingData,s),i(t,a.offset,a.count,s),C.push(t)}return C}class P{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let n=1/0,i=-1/0;for(let r=0,a=t.length;r<a;r++){const a=t[r][e];n=a<n?a:n,i=a>i?a:i}this.min=n,this.max=i}setFromPoints(t,e){let n=1/0,i=-1/0;for(let r=0,a=e.length;r<a;r++){const a=e[r],s=t.dot(a);n=s<n?s:n,i=s>i?s:i}this.min=n,this.max=i}isSeparated(t){return this.min>t.max||t.min>this.max}}P.prototype.setFromBox=function(){const t=new a.Pa4;return function(e,n){const i=n.min,r=n.max;let a=1/0,s=-1/0;for(let o=0;o<=1;o++)for(let n=0;n<=1;n++)for(let l=0;l<=1;l++){t.x=i.x*o+r.x*(1-o),t.y=i.y*n+r.y*(1-n),t.z=i.z*l+r.z*(1-l);const c=e.dot(t);a=Math.min(c,a),s=Math.max(c,s)}this.min=a,this.max=s}}();!function(){const t=new P}();const C=function(){const t=new a.Pa4,e=new a.Pa4,n=new a.Pa4;return function(i,r,a){const s=i.start,o=t,l=r.start,c=e;n.subVectors(s,l),t.subVectors(i.end,i.start),e.subVectors(r.end,r.start);const u=n.dot(c),h=c.dot(o),d=c.dot(c),p=n.dot(o),f=o.dot(o)*d-h*h;let m,g;m=0!==f?(u*h-p*d)/f:0,g=(u+m*h)/d,a.x=m,a.y=g}}(),L=function(){const t=new a.FM8,e=new a.Pa4,n=new a.Pa4;return function(i,r,a,s){C(i,r,t);let o=t.x,l=t.y;if(o>=0&&o<=1&&l>=0&&l<=1)return i.at(o,a),void r.at(l,s);if(o>=0&&o<=1)return l<0?r.at(0,s):r.at(1,s),void i.closestPointToPoint(s,!0,a);if(l>=0&&l<=1)return o<0?i.at(0,a):i.at(1,a),void r.closestPointToPoint(a,!0,s);{let t,c;t=o<0?i.start:i.end,c=l<0?r.start:r.end;const u=e,h=n;return i.closestPointToPoint(c,!0,e),r.closestPointToPoint(t,!0,n),u.distanceToSquared(c)<=h.distanceToSquared(t)?(a.copy(u),void s.copy(c)):(a.copy(t),void s.copy(h))}}}(),R=function(){const t=new a.Pa4,e=new a.Pa4,n=new a.JOQ,i=new a.Zzh;return function(r,a){const{radius:s,center:o}=r,{a:l,b:c,c:u}=a;i.start=l,i.end=c;if(i.closestPointToPoint(o,!0,t).distanceTo(o)<=s)return!0;i.start=l,i.end=u;if(i.closestPointToPoint(o,!0,t).distanceTo(o)<=s)return!0;i.start=c,i.end=u;if(i.closestPointToPoint(o,!0,t).distanceTo(o)<=s)return!0;const h=a.getPlane(n);if(Math.abs(h.distanceToPoint(o))<=s){const t=h.projectPoint(o,e);if(a.containsPoint(t))return!0}return!1}}();function D(t){return Math.abs(t)<1e-15}class I extends a.CJI{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map((()=>new a.Pa4)),this.satBounds=new Array(4).fill().map((()=>new P)),this.points=[this.a,this.b,this.c],this.sphere=new a.aLr,this.plane=new a.JOQ,this.needsUpdate=!0}intersectsSphere(t){return R(t,this)}update(){const t=this.a,e=this.b,n=this.c,i=this.points,r=this.satAxes,a=this.satBounds,s=r[0],o=a[0];this.getNormal(s),o.setFromPoints(s,i);const l=r[1],c=a[1];l.subVectors(t,e),c.setFromPoints(l,i);const u=r[2],h=a[2];u.subVectors(e,n),h.setFromPoints(u,i);const d=r[3],p=a[3];d.subVectors(n,t),p.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(s,t),this.needsUpdate=!1}}I.prototype.closestPointToSegment=function(){const t=new a.Pa4,e=new a.Pa4,n=new a.Zzh;return function(i,r=null,a=null){const{start:s,end:o}=i,l=this.points;let c,u=1/0;for(let h=0;h<3;h++){const s=(h+1)%3;n.start.copy(l[h]),n.end.copy(l[s]),L(n,i,t,e),c=t.distanceToSquared(e),c<u&&(u=c,r&&r.copy(t),a&&a.copy(e))}return this.closestPointToPoint(s,t),c=s.distanceToSquared(t),c<u&&(u=c,r&&r.copy(t),a&&a.copy(s)),this.closestPointToPoint(o,t),c=o.distanceToSquared(t),c<u&&(u=c,r&&r.copy(t),a&&a.copy(o)),Math.sqrt(u)}}(),I.prototype.intersectsTriangle=function(){const t=new I,e=new Array(3),n=new Array(3),i=new P,r=new P,s=new a.Pa4,o=new a.Pa4,l=new a.Pa4,c=new a.Pa4,u=new a.Zzh,h=new a.Zzh,d=new a.Zzh;return function(a,p=null){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(t.copy(a),t.update(),a=t);const f=this.plane,m=a.plane;if(Math.abs(f.normal.dot(m.normal))>1-1e-10){const t=this.satBounds,o=this.satAxes;n[0]=a.a,n[1]=a.b,n[2]=a.c;for(let e=0;e<4;e++){const r=t[e],a=o[e];if(i.setFromPoints(a,n),r.isSeparated(i))return!1}const l=a.satBounds,c=a.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let n=0;n<4;n++){const t=l[n],r=c[n];if(i.setFromPoints(r,e),t.isSeparated(i))return!1}for(let a=0;a<4;a++){const t=o[a];for(let a=0;a<4;a++){const o=c[a];if(s.crossVectors(t,o),i.setFromPoints(s,e),r.setFromPoints(s,n),i.isSeparated(r))return!1}}return p&&(console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}{const t=this.points;let e=!1,n=0;for(let a=0;a<3;a++){const i=t[a],r=t[(a+1)%3];u.start.copy(i),u.end.copy(r),u.delta(o);const s=e?h.start:h.end,l=D(m.distanceToPoint(i));if(D(m.normal.dot(o))&&l){h.copy(u),n=2;break}if((m.intersectLine(u,s)||l)&&!D(s.distanceTo(r))){if(n++,e)break;e=!0}}if(1===n&&this.containsPoint(h.end))return p&&(p.start.copy(h.end),p.end.copy(h.end)),!0;if(2!==n)return!1;const i=a.points;let r=!1,s=0;for(let a=0;a<3;a++){const t=i[a],e=i[(a+1)%3];u.start.copy(t),u.end.copy(e),u.delta(l);const n=r?d.start:d.end,o=D(f.distanceToPoint(t));if(D(f.normal.dot(l))&&o){d.copy(u),s=2;break}if((f.intersectLine(u,n)||o)&&!D(n.distanceTo(e))){if(s++,r)break;r=!0}}if(1===s&&this.containsPoint(d.end))return p&&(p.start.copy(d.end),p.end.copy(d.end)),!0;if(2!==s)return!1;if(h.delta(o),d.delta(l),o.dot(l)<0){let t=d.start;d.start=d.end,d.end=t}const g=h.start.dot(o),_=h.end.dot(o),v=d.start.dot(o),x=d.end.dot(o),y=_<v,b=g<x;return(g===x||v===_||y!==b)&&(p&&(c.subVectors(h.start,d.start),c.dot(o)>0?p.start.copy(h.start):p.start.copy(d.start),c.subVectors(h.end,d.end),c.dot(o)<0?p.end.copy(h.end):p.end.copy(d.end)),!0)}}}(),I.prototype.distanceToPoint=function(){const t=new a.Pa4;return function(e){return this.closestPointToPoint(e,t),e.distanceTo(t)}}(),I.prototype.distanceToTriangle=function(){const t=new a.Pa4,e=new a.Pa4,n=["a","b","c"],i=new a.Zzh,r=new a.Zzh;return function(a,s=null,o=null){const l=s||o?i:null;if(this.intersectsTriangle(a,l))return(s||o)&&(s&&l.getCenter(s),o&&l.getCenter(o)),0;let c=1/0;for(let e=0;e<3;e++){let i;const r=n[e],l=a[r];this.closestPointToPoint(l,t),i=l.distanceToSquared(t),i<c&&(c=i,s&&s.copy(t),o&&o.copy(l));const u=this[r];a.closestPointToPoint(u,t),i=u.distanceToSquared(t),i<c&&(c=i,s&&s.copy(u),o&&o.copy(t))}for(let u=0;u<3;u++){const l=n[u],h=n[(u+1)%3];i.set(this[l],this[h]);for(let u=0;u<3;u++){const l=n[u],h=n[(u+1)%3];r.set(a[l],a[h]),L(i,r,t,e);const d=t.distanceToSquared(e);d<c&&(c=d,s&&s.copy(t),o&&o.copy(e))}}return Math.sqrt(c)}}();class O extends a.ZzF{constructor(...t){super(...t),this.isOrientedBox=!0,this.matrix=new a.yGw,this.invMatrix=new a.yGw,this.points=new Array(8).fill().map((()=>new a.Pa4)),this.satAxes=new Array(3).fill().map((()=>new a.Pa4)),this.satBounds=new Array(3).fill().map((()=>new P)),this.alignedSatBounds=new Array(3).fill().map((()=>new P)),this.needsUpdate=!1}set(t,e,n){super.set(t,e),this.matrix.copy(n),this.needsUpdate=!0}copy(t){super.copy(t),this.matrix.copy(t.matrix),this.needsUpdate=!0}}O.prototype.update=function(){const t=this.matrix,e=this.min,n=this.max,i=this.points;for(let l=0;l<=1;l++)for(let r=0;r<=1;r++)for(let a=0;a<=1;a++){const s=i[1*l|2*r|4*a];s.x=l?n.x:e.x,s.y=r?n.y:e.y,s.z=a?n.z:e.z,s.applyMatrix4(t)}const r=this.satBounds,a=this.satAxes,s=i[0];for(let l=0;l<3;l++){const t=a[l],e=r[l],n=i[1<<l];t.subVectors(s,n),e.setFromPoints(t,i)}const o=this.alignedSatBounds;o[0].setFromPointsField(i,"x"),o[1].setFromPointsField(i,"y"),o[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1},O.prototype.intersectsBox=function(){const t=new P;return function(e){this.needsUpdate&&this.update();const n=e.min,i=e.max,r=this.satBounds,a=this.satAxes,s=this.alignedSatBounds;if(t.min=n.x,t.max=i.x,s[0].isSeparated(t))return!1;if(t.min=n.y,t.max=i.y,s[1].isSeparated(t))return!1;if(t.min=n.z,t.max=i.z,s[2].isSeparated(t))return!1;for(let o=0;o<3;o++){const n=a[o],i=r[o];if(t.setFromBox(n,e),i.isSeparated(t))return!1}return!0}}(),O.prototype.intersectsTriangle=function(){const t=new I,e=new Array(3),n=new P,i=new P,r=new a.Pa4;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(t.copy(a),t.update(),a=t);const s=this.satBounds,o=this.satAxes;e[0]=a.a,e[1]=a.b,e[2]=a.c;for(let t=0;t<3;t++){const i=s[t],r=o[t];if(n.setFromPoints(r,e),i.isSeparated(n))return!1}const l=a.satBounds,c=a.satAxes,u=this.points;for(let t=0;t<3;t++){const e=l[t],i=c[t];if(n.setFromPoints(i,u),e.isSeparated(n))return!1}for(let t=0;t<3;t++){const a=o[t];for(let t=0;t<4;t++){const s=c[t];if(r.crossVectors(a,s),n.setFromPoints(r,e),i.setFromPoints(r,u),n.isSeparated(i))return!1}}return!0}}(),O.prototype.closestPointToPoint=function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),e},O.prototype.distanceToPoint=function(){const t=new a.Pa4;return function(e){return this.closestPointToPoint(e,t),e.distanceTo(t)}}(),O.prototype.distanceToBox=function(){const t=["x","y","z"],e=new Array(12).fill().map((()=>new a.Zzh)),n=new Array(12).fill().map((()=>new a.Zzh)),i=new a.Pa4,r=new a.Pa4;return function(a,s=0,o=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(a))return(o||l)&&(a.getCenter(r),this.closestPointToPoint(r,i),a.closestPointToPoint(i,r),o&&o.copy(i),l&&l.copy(r)),0;const c=s*s,u=a.min,h=a.max,d=this.points;let p=1/0;for(let t=0;t<8;t++){const e=d[t];r.copy(e).clamp(u,h);const n=e.distanceToSquared(r);if(n<p&&(p=n,o&&o.copy(e),l&&l.copy(r),n<c))return Math.sqrt(n)}let f=0;for(let i=0;i<3;i++)for(let r=0;r<=1;r++)for(let a=0;a<=1;a++){const s=(i+1)%3,o=(i+2)%3,l=1<<i|r<<s|a<<o,c=d[r<<s|a<<o],p=d[l];e[f].set(c,p);const m=t[i],g=t[s],_=t[o],v=n[f],x=v.start,y=v.end;x[m]=u[m],x[g]=r?u[g]:h[g],x[_]=a?u[_]:h[g],y[m]=h[m],y[g]=r?u[g]:h[g],y[_]=a?u[_]:h[g],f++}for(let t=0;t<=1;t++)for(let e=0;e<=1;e++)for(let n=0;n<=1;n++){r.x=t?h.x:u.x,r.y=e?h.y:u.y,r.z=n?h.z:u.z,this.closestPointToPoint(r,i);const a=r.distanceToSquared(i);if(a<p&&(p=a,o&&o.copy(i),l&&l.copy(r),a<c))return Math.sqrt(a)}for(let t=0;t<12;t++){const a=e[t];for(let t=0;t<12;t++){const e=n[t];L(a,e,i,r);const s=i.distanceToSquared(r);if(s<p&&(p=s,o&&o.copy(i),l&&l.copy(r),s<c))return Math.sqrt(s)}}return Math.sqrt(p)}}();const N=new a.Pa4,U=new a.Pa4,z=new a.Pa4,B=new a.FM8,F=new a.FM8,V=new a.FM8,k=new a.Pa4;function G(t,e,n,i,r,s,o){N.fromBufferAttribute(e,i),U.fromBufferAttribute(e,r),z.fromBufferAttribute(e,s);const l=function(t,e,n,i,r,s){let o;return o=s===a._Li?t.intersectTriangle(i,n,e,!0,r):t.intersectTriangle(e,n,i,s!==a.ehD,r),null===o?null:{distance:t.origin.distanceTo(r),point:r.clone()}}(t,N,U,z,k,o);if(l){n&&(B.fromBufferAttribute(n,i),F.fromBufferAttribute(n,r),V.fromBufferAttribute(n,s),l.uv=a.CJI.getUV(k,N,U,z,B,F,V,new a.FM8));const t={a:i,b:r,c:s,normal:new a.Pa4,materialIndex:0};a.CJI.getNormal(N,U,z,t.normal),l.face=t,l.faceIndex=i}return l}function H(t,e,n,i,r){const a=3*i,s=t.index.getX(a),o=t.index.getX(a+1),l=t.index.getX(a+2),c=G(n,t.attributes.position,t.attributes.uv,s,o,l,e);return c?(c.faceIndex=i,r&&r.push(c),c):null}function W(t,e,n,i){const r=t.a,a=t.b,s=t.c;let o=e,l=e+1,c=e+2;n&&(o=n.getX(e),l=n.getX(e+1),c=n.getX(e+2)),r.x=i.getX(o),r.y=i.getY(o),r.z=i.getZ(o),a.x=i.getX(l),a.y=i.getY(l),a.z=i.getZ(l),s.x=i.getX(c),s.y=i.getY(c),s.z=i.getZ(c)}function j(t,e,n,i,r,a,s){const o=n.index,l=n.attributes.position;for(let c=t,u=e+t;c<u;c++)if(W(s,3*c,o,l),s.needsUpdate=!0,i(s,c,r,a))return!0;return!1}class q{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){const t=this._primitives;return 0===t.length?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}}function X(t,e){return 65535===e[t+15]}function Y(t,e){return e[t+6]}function Z(t,e){return e[t+14]}function J(t){return t+8}function K(t,e){return e[t+6]}const $=new a.ZzF,Q=new a.Pa4,tt=["x","y","z"];function et(t,e,n,i,r){let a=2*t,s=lt,o=ct,l=ut;if(X(a,o)){!function(t,e,n,i,r,a){for(let s=i,o=i+r;s<o;s++)H(t,e,n,s,a)}(e,n,i,Y(t,l),Z(a,o),r)}else{const a=J(t);at(a,s,i,Q)&&et(a,e,n,i,r);const o=K(t,l);at(o,s,i,Q)&&et(o,e,n,i,r)}}function nt(t,e,n,i){let r=2*t,a=lt,s=ct,o=ut;if(X(r,s)){return function(t,e,n,i,r){let a=1/0,s=null;for(let o=i,l=i+r;o<l;o++){const i=H(t,e,n,o);i&&i.distance<a&&(s=i,a=i.distance)}return s}(e,n,i,Y(t,o),Z(r,s))}{const r=function(t,e){return e[t+7]}(t,o),s=tt[r],l=i.direction[s]>=0;let c,u;l?(c=J(t),u=K(t,o)):(c=K(t,o),u=J(t));const h=at(c,a,i,Q)?nt(c,e,n,i):null;if(h){const t=h.point[s];if(l?t<=a[u+r]:t>=a[u+r+3])return h}const d=at(u,a,i,Q)?nt(u,e,n,i):null;return h&&d?h.distance<=d.distance?h:d:h||d||null}}const it=function(){let t,e;const n=[],i=new q((()=>new a.ZzF));return function(...a){t=i.getPrimitive(),e=i.getPrimitive(),n.push(t,e);const s=r(...a);i.releasePrimitive(t),i.releasePrimitive(e),n.pop(),n.pop();const o=n.length;return o>0&&(e=n[o-1],t=n[o-2]),s};function r(n,i,a,s,o=null,l=0,c=0){function u(t){let e=2*t,n=ct,i=ut;for(;!X(e,n);)e=2*(t=J(t));return Y(t,i)}function h(t){let e=2*t,n=ct,i=ut;for(;!X(e,n);)e=2*(t=K(t,i));return Y(t,i)+Z(e,n)}let d=2*n,p=lt,f=ct,m=ut;if(X(d,f)){const e=Y(n,m),i=Z(d,f);return g(n,p,t),s(e,i,!1,c,l+n,t)}{const d=J(n),_=K(n,m);let v,x,y,b,M=d,w=_;if(o&&(y=t,b=e,g(M,p,y),g(w,p,b),v=o(y),x=o(b),x<v)){M=_,w=d;const t=v;v=x,x=t,y=b}y||(y=t,g(M,p,y));const S=a(y,X(2*M,f),v,c+1,l+M);let T;if(2===S){const t=u(M);T=s(t,h(M)-t,!0,c+1,l+M,y)}else T=S&&r(M,i,a,s,o,l,c+1);if(T)return!0;b=e,g(w,p,b);const E=a(b,X(2*w,f),x,c+1,l+w);let A;if(2===E){const t=u(w);A=s(t,h(w)-t,!0,c+1,l+w,b)}else A=E&&r(w,i,a,s,o,l,c+1);return!!A}}}(),rt=function(){const t=new I,e=new I,n=new a.yGw,i=new O,r=new O;return function a(s,o,l,c,u=null){let h=2*s,d=lt,p=ct,f=ut;null===u&&(l.boundingBox||l.computeBoundingBox(),i.set(l.boundingBox.min,l.boundingBox.max,c),u=i);if(!X(h,p)){const t=s+8,e=f[s+6];g(t,d,$);if(u.intersectsBox($)&&a(t,o,l,c,u))return!0;g(e,d,$);return!!(u.intersectsBox($)&&a(e,o,l,c,u))}{const i=o,a=i.index,u=i.attributes.position,m=l.index,_=l.attributes.position,v=Y(s,f),x=Z(h,p);if(n.copy(c).invert(),l.boundsTree){g(s,d,r),r.matrix.copy(n),r.needsUpdate=!0;return l.boundsTree.shapecast({intersectsBounds:t=>r.intersectsBox(t),intersectsTriangle:t=>{t.a.applyMatrix4(c),t.b.applyMatrix4(c),t.c.applyMatrix4(c),t.needsUpdate=!0;for(let n=3*v,i=3*(x+v);n<i;n+=3)if(W(e,n,a,u),e.needsUpdate=!0,t.intersectsTriangle(e))return!0;return!1}})}for(let r=3*v,s=x+3*v;r<s;r+=3){W(t,r,a,u),t.a.applyMatrix4(n),t.b.applyMatrix4(n),t.c.applyMatrix4(n),t.needsUpdate=!0;for(let n=0,i=m.count;n<i;n+=3)if(W(e,n,m,_),e.needsUpdate=!0,t.intersectsTriangle(e))return!0}}}}();function at(t,e,n,i){return g(t,e,$),n.intersectBox($,i)}const st=[];let ot,lt,ct,ut;function ht(t){ot&&st.push(ot),ot=t,lt=new Float32Array(t),ct=new Uint16Array(t),ut=new Uint32Array(t)}function dt(){ot=null,lt=null,ct=null,ut=null,st.length&&ht(st.pop())}const pt=Symbol("skip tree generation"),ft=new a.ZzF,mt=new a.ZzF,gt=new a.yGw,_t=new O,vt=new O,xt=new a.Pa4,yt=new a.Pa4,bt=new a.Pa4,Mt=new a.Pa4,wt=new a.Pa4,St=new a.ZzF,Tt=new q((()=>new I));class Et{static serialize(t,e={}){if(e.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),Et.serialize(arguments[0],{cloneBuffers:void 0===arguments[2]||arguments[2]});e={cloneBuffers:!0,...e};const n=t.geometry,i=t._roots,r=n.getIndex();let a;return a=e.cloneBuffers?{roots:i.map((t=>t.slice())),index:r.array.slice()}:{roots:i,index:r.array},a}static deserialize(t,e,n={}){if("boolean"==typeof n)return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),Et.deserialize(arguments[0],arguments[1],{setIndex:void 0===arguments[2]||arguments[2]});n={setIndex:!0,...n};const{index:i,roots:r}=t,s=new Et(e,{...n,[pt]:!0});if(s._roots=r,n.setIndex){const n=e.getIndex();if(null===n){const n=new a.TlE(t.index,1,!1);e.setIndex(n)}else n.array!==i&&(n.array.set(i),n.needsUpdate=!0)}return s}constructor(t,e={}){if(!t.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");if((e=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[pt]:!1},e)).useSharedArrayBuffer&&"undefined"==typeof SharedArrayBuffer)throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,e[pt]||(this._roots=function(t,e){const n=A(t,e);let i,r,a;const s=[],o=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let u=0;u<n.length;u++){const t=n[u],e=new o(32*l(t));i=new Float32Array(e),r=new Uint32Array(e),a=new Uint16Array(e),c(0,t),s.push(e)}return s;function l(t){return t.count?1:1+l(t.left)+l(t.right)}function c(t,e){const n=t/4,s=t/2,o=!!e.count,l=e.boundingData;for(let r=0;r<6;r++)i[n+r]=l[r];if(o){const i=e.offset,o=e.count;return r[n+6]=i,a[s+14]=o,a[s+15]=p,t+32}{const i=e.left,a=e.right,s=e.splitAxis;let o;if(o=c(t+32,i),o/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[n+6]=o/4,o=c(o,a),r[n+7]=s,o}}}(t,e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new a.ZzF))),this.geometry=t}refit(t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=this.geometry,n=e.index.array,i=e.attributes.position;let r,a,s,o,l=0;const c=this._roots;for(let h=0,d=c.length;h<d;h++)r=c[h],a=new Uint32Array(r),s=new Uint16Array(r),o=new Float32Array(r),u(0,l),l+=r.byteLength;function u(e,r,l=!1){const c=2*e;if(s[c+15]===p){const t=a[e+6];let r=1/0,l=1/0,u=1/0,h=-1/0,d=-1/0,p=-1/0;for(let e=3*t,a=3*(t+s[c+14]);e<a;e++){const t=n[e],a=i.getX(t),s=i.getY(t),o=i.getZ(t);a<r&&(r=a),a>h&&(h=a),s<l&&(l=s),s>d&&(d=s),o<u&&(u=o),o>p&&(p=o)}return(o[e+0]!==r||o[e+1]!==l||o[e+2]!==u||o[e+3]!==h||o[e+4]!==d||o[e+5]!==p)&&(o[e+0]=r,o[e+1]=l,o[e+2]=u,o[e+3]=h,o[e+4]=d,o[e+5]=p,!0)}{const n=e+8,i=a[e+6],s=n+r,c=i+r;let h=l,d=!1,p=!1;t?h||(d=t.has(s),p=t.has(c),h=!d&&!p):(d=!0,p=!0);const f=h||p;let m=!1;(h||d)&&(m=u(n,r,h));let g=!1;f&&(g=u(i,r,h));const _=m||g;if(_)for(let t=0;t<3;t++){const r=n+t,a=i+t,s=o[r],l=o[r+3],c=o[a],u=o[a+3];o[e+t]=s<c?s:c,o[e+t+3]=l>u?l:u}return _}}}traverse(t,e=0){const n=this._roots[e],i=new Uint32Array(n),r=new Uint16Array(n);!function e(a,s=0){const o=2*a,l=r[o+15]===p;if(l){const e=i[a+6],c=r[o+14];t(s,l,new Float32Array(n,4*a,6),e,c)}else{const r=a+8,o=i[a+6],c=i[a+7];t(s,l,new Float32Array(n,4*a,6),c)||(e(r,s+1),e(o,s+1))}}(0)}raycast(t,e=a.Wl3){const n=this._roots,i=this.geometry,r=[],s=e.isMaterial,o=Array.isArray(e),l=i.groups,c=s?e.side:e;for(let a=0,u=n.length;a<u;a++){const s=o?e[l[a].materialIndex].side:c,u=r.length;if(ht(n[a]),et(0,i,s,t,r),dt(),o){const t=l[a].materialIndex;for(let e=u,n=r.length;e<n;e++)r[e].face.materialIndex=t}}return r}raycastFirst(t,e=a.Wl3){const n=this._roots,i=this.geometry,r=e.isMaterial,s=Array.isArray(e);let o=null;const l=i.groups,c=r?e.side:e;for(let a=0,u=n.length;a<u;a++){const r=s?e[l[a].materialIndex].side:c;ht(n[a]);const u=nt(0,i,r,t);dt(),null!=u&&(null==o||u.distance<o.distance)&&(o=u,s&&(u.face.materialIndex=l[a].materialIndex))}return o}intersectsGeometry(t,e){const n=this.geometry;let i=!1;for(const r of this._roots)if(ht(r),i=rt(0,n,t,e),dt(),i)break;return i}shapecast(t,e,n){const i=this.geometry;if(t instanceof Function){if(e){const t=e;e=(e,n,i,r)=>{const a=3*n;return t(e,a,a+1,a+2,i,r)}}t={boundsTraverseOrder:n,intersectsBounds:t,intersectsTriangle:e,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const r=Tt.getPrimitive();let{boundsTraverseOrder:a,intersectsBounds:s,intersectsRange:o,intersectsTriangle:l}=t;if(o&&l){const t=o;o=(e,n,a,s,o)=>!!t(e,n,a,s,o)||j(e,n,i,l,a,s,r)}else o||(o=l?(t,e,n,a)=>j(t,e,i,l,n,a,r):(t,e,n)=>n);let c=!1,u=0;for(const h of this._roots){if(ht(h),c=it(0,i,s,o,a,u),dt(),c)break;u+=h.byteLength}return Tt.releasePrimitive(r),c}bvhcast(t,e,n){let{intersectsRanges:i,intersectsTriangles:r}=n;const a=this.geometry.index,s=this.geometry.attributes.position,o=t.geometry.index,l=t.geometry.attributes.position;gt.copy(e).invert();const c=Tt.getPrimitive(),u=Tt.getPrimitive();if(r){function d(t,n,i,h,d,p,f,m){for(let g=i,_=i+h;g<_;g++){W(u,3*g,o,l),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let e=t,i=t+n;e<i;e++)if(W(c,3*e,a,s),c.needsUpdate=!0,r(c,u,e,g,d,p,f,m))return!0}return!1}if(i){const p=i;i=function(t,e,n,i,r,a,s,o){return!!p(t,e,n,i,r,a,s,o)||d(t,e,n,i,r,a,s,o)}}else i=d}t.getBoundingBox(mt),mt.applyMatrix4(e);const h=this.shapecast({intersectsBounds:t=>mt.intersectsBox(t),intersectsRange:(e,n,r,a,s,o)=>(ft.copy(o),ft.applyMatrix4(gt),t.shapecast({intersectsBounds:t=>ft.intersectsBox(t),intersectsRange:(t,r,o,l,c)=>i(e,n,t,r,a,s,l,c)}))});return Tt.releasePrimitive(c),Tt.releasePrimitive(u),h}intersectsBox(t,e){return _t.set(t.min,t.max,e),_t.needsUpdate=!0,this.shapecast({intersectsBounds:t=>_t.intersectsBox(t),intersectsTriangle:t=>_t.intersectsTriangle(t)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,n={},i={},r=0,a=1/0){t.boundingBox||t.computeBoundingBox(),_t.set(t.boundingBox.min,t.boundingBox.max,e),_t.needsUpdate=!0;const s=this.geometry,o=s.attributes.position,l=s.index,c=t.attributes.position,u=t.index,h=Tt.getPrimitive(),d=Tt.getPrimitive();let p=yt,f=bt,m=null,g=null;i&&(m=Mt,g=wt);let _=1/0,v=null,x=null;return gt.copy(e).invert(),vt.matrix.copy(gt),this.shapecast({boundsTraverseOrder:t=>_t.distanceToBox(t),intersectsBounds:(t,e,n)=>n<_&&n<a&&(e&&(vt.min.copy(t.min),vt.max.copy(t.max),vt.needsUpdate=!0),!0),intersectsRange:(n,i)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:t=>vt.distanceToBox(t),intersectsBounds:(t,e,n)=>n<_&&n<a,intersectsRange:(t,a)=>{for(let s=3*t,y=3*(t+a);s<y;s+=3){W(d,s,u,c),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let t=3*n,e=3*(n+i);t<e;t+=3){W(h,t,l,o),h.needsUpdate=!0;const e=h.distanceToTriangle(d,p,m);if(e<_&&(f.copy(p),g&&g.copy(m),_=e,v=t/3,x=s/3),e<r)return!0}}}});for(let t=0,a=u?u.count:c.count;t<a;t+=3){W(d,t,u,c),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let e=3*n,a=3*(n+i);e<a;e+=3){W(h,e,l,o),h.needsUpdate=!0;const n=h.distanceToTriangle(d,p,m);if(n<_&&(f.copy(p),g&&g.copy(m),_=n,v=e/3,x=t/3),n<r)return!0}}}}),Tt.releasePrimitive(h),Tt.releasePrimitive(d),_===1/0?null:(n.point?n.point.copy(f):n.point=f.clone(),n.distance=_,n.faceIndex=v,i&&(i.point?i.point.copy(g):i.point=g.clone(),i.point.applyMatrix4(gt),f.applyMatrix4(gt),i.distance=f.sub(i.point).length(),i.faceIndex=x),n)}closestPointToPoint(t,e={},n=0,i=1/0){const r=n*n,a=i*i;let s=1/0,o=null;if(this.shapecast({boundsTraverseOrder:e=>(xt.copy(t).clamp(e.min,e.max),xt.distanceToSquared(t)),intersectsBounds:(t,e,n)=>n<s&&n<a,intersectsTriangle:(e,n)=>{e.closestPointToPoint(t,xt);const i=t.distanceToSquared(xt);return i<s&&(yt.copy(xt),s=i,o=n),i<r}}),s===1/0)return null;const l=Math.sqrt(s);return e.point?e.point.copy(yt):e.point=yt.clone(),e.distance=l,e.faceIndex=o,e}getBoundingBox(t){t.makeEmpty();return this._roots.forEach((e=>{g(0,new Float32Array(e),St),t.union(St)})),t}}const At=new(n(7691).ci),Pt=new WeakMap;a.Kj0.prototype.raycast=function(t,e){if(this.geometry.boundsTree){if(void 0===this.material)return;const n=this.geometry.boundsTree;if(!0===t.firstHitOnly){const i=h(n.raycastFirst(t.ray,this.material),this,t);i&&e.push(i)}else{const i=n.raycast(ray,this.material);for(let n=0,r=i.length;n<r;n++){const r=h(i[n],this,t);r&&e.push(r)}}}else u.call(this,t,e)};const Ct=new class{constructor(){var t,e,n;n=void 0,(e="worker")in(t=this)?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n;const i=new Blob(['/*! For license information please see main.js.LICENSE.txt */\n(()=>{var t={9181:(t,e,n)=>{var i=n(1045),r=n(7632),a=TypeError;t.exports=function(t){if(i(t))return t;throw a(r(t)+" is not a function")}},2091:(t,e,n)=>{var i=n(1045),r=String,a=TypeError;t.exports=function(t){if("object"==typeof t||i(t))return t;throw a("Can\'t set "+r(t)+" as a prototype")}},1571:(t,e,n)=>{var i=n(7809),r=String,a=TypeError;t.exports=function(t){if(i(t))return t;throw a(r(t)+" is not an object")}},6280:t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},5861:(t,e,n)=>{"use strict";var i,r,a,s=n(6280),o=n(2931),l=n(2383),c=n(1045),u=n(7809),h=n(1163),d=n(6837),p=n(7632),f=n(6493),m=n(4405),g=n(4317).f,_=n(8931),v=n(2573),x=n(7046),y=n(9140),M=n(858),b=n(7417),S=b.enforce,w=b.get,T=l.Int8Array,E=T&&T.prototype,A=l.Uint8ClampedArray,C=A&&A.prototype,L=T&&v(T),P=E&&v(E),R=Object.prototype,D=l.TypeError,I=y("toStringTag"),N=M("TYPED_ARRAY_TAG"),O=s&&!!x&&"Opera"!==d(l.opera),U=!1,z={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},F={BigInt64Array:8,BigUint64Array:8},B=function(t){var e=v(t);if(u(e)){var n=w(e);return n&&h(n,"TypedArrayConstructor")?n.TypedArrayConstructor:B(e)}},V=function(t){if(!u(t))return!1;var e=d(t);return h(z,e)||h(F,e)};for(i in z)(a=(r=l[i])&&r.prototype)?S(a).TypedArrayConstructor=r:O=!1;for(i in F)(a=(r=l[i])&&r.prototype)&&(S(a).TypedArrayConstructor=r);if((!O||!c(L)||L===Function.prototype)&&(L=function(){throw D("Incorrect invocation")},O))for(i in z)l[i]&&x(l[i],L);if((!O||!P||P===R)&&(P=L.prototype,O))for(i in z)l[i]&&x(l[i].prototype,P);if(O&&v(C)!==P&&x(C,P),o&&!h(P,I))for(i in U=!0,g(P,I,{get:function(){return u(this)?this[N]:void 0}}),z)l[i]&&f(l[i],N,i);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:O,TYPED_ARRAY_TAG:U&&N,aTypedArray:function(t){if(V(t))return t;throw D("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!x||_(L,t)))return t;throw D(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,i){if(o){if(n)for(var r in z){var a=l[r];if(a&&h(a.prototype,t))try{delete a.prototype[t]}catch(n){try{a.prototype[t]=e}catch(t){}}}P[t]&&!n||m(P,t,n?e:O&&E[t]||e,i)}},exportTypedArrayStaticMethod:function(t,e,n){var i,r;if(o){if(x){if(n)for(i in z)if((r=l[i])&&h(r,t))try{delete r[t]}catch(t){}if(L[t]&&!n)return;try{return m(L,t,n?e:O&&L[t]||e)}catch(t){}}for(i in z)!(r=l[i])||r[t]&&!n||m(r,t,e)}},getTypedArrayConstructor:B,isView:function(t){if(!u(t))return!1;var e=d(t);return"DataView"===e||h(z,e)||h(F,e)},isTypedArray:V,TypedArray:L,TypedArrayPrototype:P}},9730:(t,e,n)=>{var i=n(3943),r=n(2398),a=n(567),s=Array,o=Math.max;t.exports=function(t,e,n){for(var l=r(t),c=i(e,l),u=i(void 0===n?l:n,l),h=s(o(u-c,0)),d=0;c<u;c++,d++)a(h,d,t[c]);return h.length=d,h}},5416:(t,e,n)=>{var i=n(9730),r=Math.floor,a=function(t,e){var n=t.length,l=r(n/2);return n<8?s(t,e):o(t,a(i(t,0,l),e),a(i(t,l),e),e)},s=function(t,e){for(var n,i,r=t.length,a=1;a<r;){for(i=a,n=t[a];i&&e(t[i-1],n)>0;)t[i]=t[--i];i!==a++&&(t[i]=n)}return t},o=function(t,e,n,i){for(var r=e.length,a=n.length,s=0,o=0;s<r||o<a;)t[s+o]=s<r&&o<a?i(e[s],n[o])<=0?e[s++]:n[o++]:s<r?e[s++]:n[o++];return t};t.exports=a},6027:(t,e,n)=>{var i=n(9720),r=i({}.toString),a=i("".slice);t.exports=function(t){return a(r(t),8,-1)}},6837:(t,e,n)=>{var i=n(1247),r=n(1045),a=n(6027),s=n(9140)("toStringTag"),o=Object,l="Arguments"==a(function(){return arguments}());t.exports=i?a:function(t){var e,n,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=o(t),s))?n:l?a(e):"Object"==(i=a(e))&&r(e.callee)?"Arguments":i}},4667:(t,e,n)=>{var i=n(4141);t.exports=!i((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},6493:(t,e,n)=>{var i=n(2931),r=n(4317),a=n(2499);t.exports=i?function(t,e,n){return r.f(t,e,a(1,n))}:function(t,e,n){return t[e]=n,t}},2499:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},567:(t,e,n)=>{"use strict";var i=n(7277),r=n(4317),a=n(2499);t.exports=function(t,e,n){var s=i(e);s in t?r.f(t,s,a(0,n)):t[s]=n}},4405:(t,e,n)=>{var i=n(1045),r=n(4317),a=n(2511),s=n(5784);t.exports=function(t,e,n,o){o||(o={});var l=o.enumerable,c=void 0!==o.name?o.name:e;if(i(n)&&a(n,c,o),o.global)l?t[e]=n:s(e,n);else{try{o.unsafe?t[e]&&(l=!0):delete t[e]}catch(t){}l?t[e]=n:r.f(t,e,{value:n,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},5784:(t,e,n)=>{var i=n(2383),r=Object.defineProperty;t.exports=function(t,e){try{r(i,t,{value:e,configurable:!0,writable:!0})}catch(n){i[t]=e}return e}},2931:(t,e,n)=>{var i=n(4141);t.exports=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},6459:(t,e,n)=>{var i=n(2383),r=n(7809),a=i.document,s=r(a)&&r(a.createElement);t.exports=function(t){return s?a.createElement(t):{}}},3975:(t,e,n)=>{var i=n(9376).match(/firefox\\/(\\d+)/i);t.exports=!!i&&+i[1]},8482:(t,e,n)=>{var i=n(9376);t.exports=/MSIE|Trident/.test(i)},9376:(t,e,n)=>{var i=n(7300);t.exports=i("navigator","userAgent")||""},583:(t,e,n)=>{var i,r,a=n(2383),s=n(9376),o=a.process,l=a.Deno,c=o&&o.versions||l&&l.version,u=c&&c.v8;u&&(r=(i=u.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!r&&s&&(!(i=s.match(/Edge\\/(\\d+)/))||i[1]>=74)&&(i=s.match(/Chrome\\/(\\d+)/))&&(r=+i[1]),t.exports=r},3701:(t,e,n)=>{var i=n(9376).match(/AppleWebKit\\/(\\d+)\\./);t.exports=!!i&&+i[1]},4141:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},1153:(t,e,n)=>{var i=n(4141);t.exports=!i((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},9107:(t,e,n)=>{var i=n(1153),r=Function.prototype.call;t.exports=i?r.bind(r):function(){return r.apply(r,arguments)}},9684:(t,e,n)=>{var i=n(2931),r=n(1163),a=Function.prototype,s=i&&Object.getOwnPropertyDescriptor,o=r(a,"name"),l=o&&"something"===function(){}.name,c=o&&(!i||i&&s(a,"name").configurable);t.exports={EXISTS:o,PROPER:l,CONFIGURABLE:c}},9720:(t,e,n)=>{var i=n(1153),r=Function.prototype,a=r.bind,s=r.call,o=i&&a.bind(s,s);t.exports=i?function(t){return t&&o(t)}:function(t){return t&&function(){return s.apply(t,arguments)}}},7300:(t,e,n)=>{var i=n(2383),r=n(1045),a=function(t){return r(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?a(i[t]):i[t]&&i[t][e]}},466:(t,e,n)=>{var i=n(9181),r=n(7323);t.exports=function(t,e){var n=t[e];return r(n)?void 0:i(n)}},2383:(t,e,n)=>{var i=function(t){return t&&t.Math==Math&&t};t.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},1163:(t,e,n)=>{var i=n(9720),r=n(4569),a=i({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return a(r(t),e)}},8164:t=>{t.exports={}},688:(t,e,n)=>{var i=n(2931),r=n(4141),a=n(6459);t.exports=!i&&!r((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},4554:(t,e,n)=>{var i=n(9720),r=n(1045),a=n(4480),s=i(Function.toString);r(a.inspectSource)||(a.inspectSource=function(t){return s(t)}),t.exports=a.inspectSource},7417:(t,e,n)=>{var i,r,a,s=n(1849),o=n(2383),l=n(9720),c=n(7809),u=n(6493),h=n(1163),d=n(4480),p=n(6033),f=n(8164),m="Object already initialized",g=o.TypeError,_=o.WeakMap;if(s||d.state){var v=d.state||(d.state=new _),x=l(v.get),y=l(v.has),M=l(v.set);i=function(t,e){if(y(v,t))throw g(m);return e.facade=t,M(v,t,e),e},r=function(t){return x(v,t)||{}},a=function(t){return y(v,t)}}else{var b=p("state");f[b]=!0,i=function(t,e){if(h(t,b))throw g(m);return e.facade=t,u(t,b,e),e},r=function(t){return h(t,b)?t[b]:{}},a=function(t){return h(t,b)}}t.exports={set:i,get:r,has:a,enforce:function(t){return a(t)?r(t):i(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=r(e)).type!==t)throw g("Incompatible receiver, "+t+" required");return n}}}},1045:t=>{t.exports=function(t){return"function"==typeof t}},7323:t=>{t.exports=function(t){return null==t}},7809:(t,e,n)=>{var i=n(1045),r="object"==typeof document&&document.all,a=void 0===r&&void 0!==r;t.exports=a?function(t){return"object"==typeof t?null!==t:i(t)||t===r}:function(t){return"object"==typeof t?null!==t:i(t)}},4726:t=>{t.exports=!1},6894:(t,e,n)=>{var i=n(7300),r=n(1045),a=n(8931),s=n(2048),o=Object;t.exports=s?function(t){return"symbol"==typeof t}:function(t){var e=i("Symbol");return r(e)&&a(e.prototype,o(t))}},2398:(t,e,n)=>{var i=n(2844);t.exports=function(t){return i(t.length)}},2511:(t,e,n)=>{var i=n(4141),r=n(1045),a=n(1163),s=n(2931),o=n(9684).CONFIGURABLE,l=n(4554),c=n(7417),u=c.enforce,h=c.get,d=Object.defineProperty,p=s&&!i((function(){return 8!==d((function(){}),"length",{value:8}).length})),f=String(String).split("String"),m=t.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\\(([^)]*)\\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!a(t,"name")||o&&t.name!==e)&&(s?d(t,"name",{value:e,configurable:!0}):t.name=e),p&&n&&a(n,"arity")&&t.length!==n.arity&&d(t,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var i=u(t);return a(i,"source")||(i.source=f.join("string"==typeof e?e:"")),t};Function.prototype.toString=m((function(){return r(this)&&h(this).source||l(this)}),"toString")},3709:t=>{var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var i=+t;return(i>0?n:e)(i)}},4317:(t,e,n)=>{var i=n(2931),r=n(688),a=n(5957),s=n(1571),o=n(7277),l=TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor;e.f=i?a?function(t,e,n){if(s(t),e=o(e),s(n),"function"==typeof t&&"prototype"===e&&"value"in n&&"writable"in n&&!n.writable){var i=u(t,e);i&&i.writable&&(t[e]=n.value,n={configurable:"configurable"in n?n.configurable:i.configurable,enumerable:"enumerable"in n?n.enumerable:i.enumerable,writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(s(t),e=o(e),s(n),r)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw l("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},2573:(t,e,n)=>{var i=n(1163),r=n(1045),a=n(4569),s=n(6033),o=n(4667),l=s("IE_PROTO"),c=Object,u=c.prototype;t.exports=o?c.getPrototypeOf:function(t){var e=a(t);if(i(e,l))return e[l];var n=e.constructor;return r(n)&&e instanceof n?n.prototype:e instanceof c?u:null}},8931:(t,e,n)=>{var i=n(9720);t.exports=i({}.isPrototypeOf)},7046:(t,e,n)=>{var i=n(9720),r=n(1571),a=n(2091);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=i(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array}catch(t){}return function(n,i){return r(n),a(i),e?t(n,i):n.__proto__=i,n}}():void 0)},8434:(t,e,n)=>{var i=n(9107),r=n(1045),a=n(7809),s=TypeError;t.exports=function(t,e){var n,o;if("string"===e&&r(n=t.toString)&&!a(o=i(n,t)))return o;if(r(n=t.valueOf)&&!a(o=i(n,t)))return o;if("string"!==e&&r(n=t.toString)&&!a(o=i(n,t)))return o;throw s("Can\'t convert object to primitive value")}},6827:(t,e,n)=>{var i=n(7323),r=TypeError;t.exports=function(t){if(i(t))throw r("Can\'t call method on "+t);return t}},6033:(t,e,n)=>{var i=n(6402),r=n(858),a=i("keys");t.exports=function(t){return a[t]||(a[t]=r(t))}},4480:(t,e,n)=>{var i=n(2383),r=n(5784),a="__core-js_shared__",s=i[a]||r(a,{});t.exports=s},6402:(t,e,n)=>{var i=n(4726),r=n(4480);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.25.1",mode:i?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.1/LICENSE",source:"https://github.com/zloirock/core-js"})},5793:(t,e,n)=>{var i=n(583),r=n(4141);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},3943:(t,e,n)=>{var i=n(152),r=Math.max,a=Math.min;t.exports=function(t,e){var n=i(t);return n<0?r(n+e,0):a(n,e)}},152:(t,e,n)=>{var i=n(3709);t.exports=function(t){var e=+t;return e!=e||0===e?0:i(e)}},2844:(t,e,n)=>{var i=n(152),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},4569:(t,e,n)=>{var i=n(6827),r=Object;t.exports=function(t){return r(i(t))}},5276:(t,e,n)=>{var i=n(8090),r=RangeError;t.exports=function(t,e){var n=i(t);if(n%e)throw r("Wrong offset");return n}},8090:(t,e,n)=>{var i=n(152),r=RangeError;t.exports=function(t){var e=i(t);if(e<0)throw r("The argument can\'t be less than 0");return e}},55:(t,e,n)=>{var i=n(9107),r=n(7809),a=n(6894),s=n(466),o=n(8434),l=n(9140),c=TypeError,u=l("toPrimitive");t.exports=function(t,e){if(!r(t)||a(t))return t;var n,l=s(t,u);if(l){if(void 0===e&&(e="default"),n=i(l,t,e),!r(n)||a(n))return n;throw c("Can\'t convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}},7277:(t,e,n)=>{var i=n(55),r=n(6894);t.exports=function(t){var e=i(t,"string");return r(e)?e:e+""}},1247:(t,e,n)=>{var i={};i[n(9140)("toStringTag")]="z",t.exports="[object z]"===String(i)},7632:t=>{var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},858:(t,e,n)=>{var i=n(9720),r=0,a=Math.random(),s=i(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+s(++r+a,36)}},2048:(t,e,n)=>{var i=n(5793);t.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},5957:(t,e,n)=>{var i=n(2931),r=n(4141);t.exports=i&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},1849:(t,e,n)=>{var i=n(2383),r=n(1045),a=i.WeakMap;t.exports=r(a)&&/native code/.test(String(a))},9140:(t,e,n)=>{var i=n(2383),r=n(6402),a=n(1163),s=n(858),o=n(5793),l=n(2048),c=r("wks"),u=i.Symbol,h=u&&u.for,d=l?u:u&&u.withoutSetter||s;t.exports=function(t){if(!a(c,t)||!o&&"string"!=typeof c[t]){var e="Symbol."+t;o&&a(u,t)?c[t]=u[t]:c[t]=l&&h?h(e):d(e)}return c[t]}},650:(t,e,n)=>{"use strict";var i=n(2383),r=n(9107),a=n(5861),s=n(2398),o=n(5276),l=n(4569),c=n(4141),u=i.RangeError,h=i.Int8Array,d=h&&h.prototype,p=d&&d.set,f=a.aTypedArray,m=a.exportTypedArrayMethod,g=!c((function(){var t=new Uint8ClampedArray(2);return r(p,t,{length:1,0:3},1),3!==t[1]})),_=g&&a.NATIVE_ARRAY_BUFFER_VIEWS&&c((function(){var t=new h(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]}));m("set",(function(t){f(this);var e=o(arguments.length>1?arguments[1]:void 0,1),n=l(t);if(g)return r(p,this,n,e);var i=this.length,a=s(n),c=0;if(a+e>i)throw u("Wrong length");for(;c<a;)this[e+c]=n[c++]}),!g||_)},5488:(t,e,n)=>{"use strict";var i=n(2383),r=n(9720),a=n(4141),s=n(9181),o=n(5416),l=n(5861),c=n(3975),u=n(8482),h=n(583),d=n(3701),p=l.aTypedArray,f=l.exportTypedArrayMethod,m=i.Uint16Array,g=m&&r(m.prototype.sort),_=!(!g||a((function(){g(new m(2),null)}))&&a((function(){g(new m(2),{})}))),v=!!g&&!a((function(){if(h)return h<74;if(c)return c<67;if(u)return!0;if(d)return d<602;var t,e,n=new m(516),i=Array(516);for(t=0;t<516;t++)e=t%4,n[t]=515-t,i[t]=t-2*e+3;for(g(n,(function(t,e){return(t/4|0)-(e/4|0)})),t=0;t<516;t++)if(n[t]!==i[t])return!0}));f("sort",(function(t){return void 0!==t&&s(t),v?g(this,t):o(p(this),function(t){return function(e,n){return void 0!==t?+t(e,n)||0:n!=n?-1:e!=e?1:0===e&&0===n?1/e>0&&1/n<0?1:-1:e>n}}(t))}),!v||_)}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";n(650),n(5488);const t=100,e=301,i=302,r=306,a=1e3,s=1001,o=1002,l=1003,c=1006,u=1008,h=1009,d=1014,p=1015,f=1016,m=1020,g=1023,_=1026,v=1027,x=33776,y=33777,M=33778,b=33779,S=2300,w=2301,T=2302,E=3e3,A=3001,C="srgb",L="srgb-linear",P=7680,R="300 es",D=1035;class I{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const N=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],O=Math.PI/180,U=180/Math.PI;function z(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(N[255&t]+N[t>>8&255]+N[t>>16&255]+N[t>>24&255]+"-"+N[255&e]+N[e>>8&255]+"-"+N[e>>16&15|64]+N[e>>24&255]+"-"+N[63&n|128]+N[n>>8&255]+"-"+N[n>>16&255]+N[n>>24&255]+N[255&i]+N[i>>8&255]+N[i>>16&255]+N[i>>24&255]).toLowerCase()}function F(t,e,n){return Math.max(e,Math.min(n,t))}function B(t,e,n){return(1-n)*t+n*e}function V(t){return 0==(t&t-1)&&0!==t}function G(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function H(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function k(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class W{constructor(t=0,e=0){W.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}retur