@splnlss/3d-story-viewer 0.6.0 → 0.8.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 +11 -0
- package/build/assets/viewer/{geojson.worker-QNi-d8kU.js → geojson.worker-D3uq_RbR.js} +1 -1
- package/build/assets/viewer/spark-a62bdfe36d20.wasm +0 -0
- package/build/assets/viewer/{spark-worker-5ec8a483b87c.js → spark-worker-c1a6c013b888.js} +194 -43
- package/build/computeElevation.cjs +1 -1
- package/build/computeElevation.js +2 -2
- package/build/index-D87IZDc6.cjs +1 -0
- package/build/{index-CsZhc21b.js → index-Hz3jbrou.js} +1302 -829
- package/build/main-Bdopx4KL.js +15819 -0
- package/build/main-CaYKxosA.cjs +1 -0
- package/build/spark.module-B1FWS-vq.js +18168 -0
- package/build/spark.module-BUdzSHba.cjs +1 -0
- package/build/types/src/viewer/ContentLayer/GaussianSplatLayer.d.ts +4 -6
- package/build/types/src/viewer/ContentLayer/MeshLayer.d.ts +1 -1
- package/build/types/src/viewer/ContentLayer/TilesLayer.d.ts +4 -2
- package/build/types/src/viewer/ContentLayer/gaussianSplatUtils.d.ts +2 -1
- package/build/types/src/viewer/ContentLayer/index.d.ts +5 -3
- package/build/types/src/viewer/EnvironmentControls.d.ts +18 -12
- package/build/types/src/viewer/GlobeControls.d.ts +9 -6
- package/build/types/src/viewer/GlobeManager.d.ts +2 -1
- package/build/types/src/viewer/Sky.d.ts +5 -2
- package/build/types/src/viewer/TransitionControls.d.ts +2 -1
- package/build/types/src/viewer/index.d.ts +55 -19
- package/build/types/src/viewer/keyboardMovement.d.ts +4 -0
- package/build/types/src/viewer/loadSpark.d.ts +1 -0
- package/build/types/src/viewer/mods.d.ts +1 -0
- package/build/types/src/viewer/shaders/chunks.d.ts +1 -0
- package/build/types/src/viewer/surfacePicking.d.ts +31 -0
- package/build/types/src/viewer/utils.d.ts +6 -4
- package/build/types/src/workers/geojson.worker.d.ts +2 -2
- package/build/types/utils/elevation/gltf.d.ts +2 -1
- package/build/viewer.cjs +1 -1
- package/build/viewer.js +5 -28038
- package/package.json +18 -16
- package/build/assets/viewer/spark-8b93f8c03d97.wasm +0 -0
- package/build/assets/viewer/spark-old-worker-932b4a2c87ca.js +0 -8168
- package/build/assets/viewer/spark-worker-015de49d2d00.wasm +0 -0
- package/build/index-wUFLgXbb.cjs +0 -1
package/README.md
CHANGED
|
@@ -177,3 +177,14 @@ VITE_GOOGLE_MAPS_TOKEN=...
|
|
|
177
177
|
- `utils/mapLayers.js`: example layer definitions
|
|
178
178
|
- `utils/elevation/`: elevation utilities
|
|
179
179
|
- `public/assets/viewer/`: static viewer assets
|
|
180
|
+
# Camera translation speed
|
|
181
|
+
|
|
182
|
+
`viewer.movementSpeed` sets camera-relative translation along the WGS84 ECEF
|
|
183
|
+
basis in metres per second (default `100`). `viewer.boostMultiplier` is the
|
|
184
|
+
dimensionless multiplier while the configured BOOST key is held (default `5`).
|
|
185
|
+
Both are writable number fields. Consumers should supply finite, non-negative
|
|
186
|
+
values. Mouse zoom/orbit and scripted camera transitions are independent.
|
|
187
|
+
|
|
188
|
+
Changing `viewer.keysEnabled` clears held keys and movement flags; resuming
|
|
189
|
+
requires a fresh key press. This lets popovers and text inputs suspend movement
|
|
190
|
+
without leaving the camera moving or resuming from a key typed in the control.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";const t=2e3,s={};function i(...t){t=function(t){const s=t[0];if("string"==typeof s&&s.startsWith("TSL:")){const s=t[1];s&&s.isStackTrace?t[0]+=" "+s.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}(t);t.shift();{const s=t[0];s&&s.isStackTrace}}function e(...t){const e=t.join(" ");e in s||(s[e]=!0,i(...t))}function r(t,s,i){return Math.max(s,Math.min(i,t))}const h=class{constructor(t=0,s=0){this.x=t,this.y=s}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const s=this.x,i=this.y,e=t.elements;return this.x=e[0]*s+e[3]*i+e[6],this.y=e[1]*s+e[4]*i+e[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===s)return Math.PI/2;const i=this.dot(t)/s;return Math.acos(r(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,i=this.y-t.y;return s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this}rotateAround(t,s){const i=Math.cos(s),e=Math.sin(s),r=this.x-t.x,h=this.y-t.y;return this.x=r*i-h*e+t.x,this.y=r*e+h*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};h.prototype.isVector2=!0;class n{constructor(t=0,s=0,i=0,e=1){this.isQuaternion=!0,this._x=t,this._y=s,this._z=i,this._w=e}static slerpFlat(t,s,i,e,r,h,n){let a=i[e+0],o=i[e+1],l=i[e+2],u=i[e+3],y=r[h+0],x=r[h+1],c=r[h+2],m=r[h+3];if(u!==m||a!==y||o!==x||l!==c){let t=a*y+o*x+l*c+u*m;t<0&&(y=-y,x=-x,c=-c,m=-m,t=-t);let s=1-n;if(t<.9995){const i=Math.acos(t),e=Math.sin(i);s=Math.sin(s*i)/e,a=a*s+y*(n=Math.sin(n*i)/e),o=o*s+x*n,l=l*s+c*n,u=u*s+m*n}else{a=a*s+y*n,o=o*s+x*n,l=l*s+c*n,u=u*s+m*n;const t=1/Math.sqrt(a*a+o*o+l*l+u*u);a*=t,o*=t,l*=t,u*=t}}t[s]=a,t[s+1]=o,t[s+2]=l,t[s+3]=u}static multiplyQuaternionsFlat(t,s,i,e,r,h){const n=i[e],a=i[e+1],o=i[e+2],l=i[e+3],u=r[h],y=r[h+1],x=r[h+2],c=r[h+3];return t[s]=n*c+l*u+a*x-o*y,t[s+1]=a*c+l*y+o*u-n*x,t[s+2]=o*c+l*x+n*y-a*u,t[s+3]=l*c-n*u-a*y-o*x,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,i,e){return this._x=t,this._y=s,this._z=i,this._w=e,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t._x,r=t._y,h=t._z,n=t._order,a=Math.cos,o=Math.sin,l=a(e/2),u=a(r/2),y=a(h/2),x=o(e/2),c=o(r/2),m=o(h/2);switch(n){case"XYZ":this._x=x*u*y+l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y-x*c*m;break;case"YXZ":this._x=x*u*y+l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y+x*c*m;break;case"ZXY":this._x=x*u*y-l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y-x*c*m;break;case"ZYX":this._x=x*u*y-l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y+x*c*m;break;case"YZX":this._x=x*u*y+l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y-x*c*m;break;case"XZY":this._x=x*u*y-l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y+x*c*m;break;default:i("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===s&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const i=s/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,i=s[0],e=s[4],r=s[8],h=s[1],n=s[5],a=s[9],o=s[2],l=s[6],u=s[10],y=i+n+u;if(y>0){const t=.5/Math.sqrt(y+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-o)*t,this._z=(h-e)*t}else if(i>n&&i>u){const t=2*Math.sqrt(1+i-n-u);this._w=(l-a)/t,this._x=.25*t,this._y=(e+h)/t,this._z=(r+o)/t}else if(n>u){const t=2*Math.sqrt(1+n-i-u);this._w=(r-o)/t,this._x=(e+h)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+u-i-n);this._w=(h-e)/t,this._x=(r+o)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let i=t.dot(s)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(r(this.dot(t),-1,1)))}rotateTowards(t,s){const i=this.angleTo(t);if(0===i)return this;const e=Math.min(1,s/i);return this.slerp(t,e),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const i=t._x,e=t._y,r=t._z,h=t._w,n=s._x,a=s._y,o=s._z,l=s._w;return this._x=i*l+h*n+e*o-r*a,this._y=e*l+h*a+r*n-i*o,this._z=r*l+h*o+i*a-e*n,this._w=h*l-i*n-e*a-r*o,this._onChangeCallback(),this}slerp(t,s){let i=t._x,e=t._y,r=t._z,h=t._w,n=this.dot(t);n<0&&(i=-i,e=-e,r=-r,h=-h,n=-n);let a=1-s;if(n<.9995){const t=Math.acos(n),o=Math.sin(t);a=Math.sin(a*t)/o,s=Math.sin(s*t)/o,this._x=this._x*a+i*s,this._y=this._y*a+e*s,this._z=this._z*a+r*s,this._w=this._w*a+h*s,this._onChangeCallback()}else this._x=this._x*a+i*s,this._y=this._y*a+e*s,this._z=this._z*a+r*s,this._w=this._w*a+h*s,this.normalize();return this}slerpQuaternions(t,s,i){return this.copy(t).slerp(s,i)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(s),r*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}fromBufferAttribute(t,s){return this._x=t.getX(s),this._y=t.getY(s),this._z=t.getZ(s),this._w=t.getW(s),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const a=class{constructor(t=0,s=0,i=0){this.x=t,this.y=s,this.z=i}set(t,s,i){return void 0===i&&(i=this.z),this.x=t,this.y=s,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(u.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(u.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,i=this.y,e=this.z,r=t.elements;return this.x=r[0]*s+r[3]*i+r[6]*e,this.y=r[1]*s+r[4]*i+r[7]*e,this.z=r[2]*s+r[5]*i+r[8]*e,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const s=this.x,i=this.y,e=this.z,r=t.elements,h=1/(r[3]*s+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*s+r[4]*i+r[8]*e+r[12])*h,this.y=(r[1]*s+r[5]*i+r[9]*e+r[13])*h,this.z=(r[2]*s+r[6]*i+r[10]*e+r[14])*h,this}applyQuaternion(t){const s=this.x,i=this.y,e=this.z,r=t.x,h=t.y,n=t.z,a=t.w,o=2*(h*e-n*i),l=2*(n*s-r*e),u=2*(r*i-h*s);return this.x=s+a*o+h*u-n*l,this.y=i+a*l+n*o-r*u,this.z=e+a*u+r*l-h*o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const s=this.x,i=this.y,e=this.z,r=t.elements;return this.x=r[0]*s+r[4]*i+r[8]*e,this.y=r[1]*s+r[5]*i+r[9]*e,this.z=r[2]*s+r[6]*i+r[10]*e,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this.z=r(this.z,t.z,s.z),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this.z=r(this.z,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this.z=t.z+(s.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const i=t.x,e=t.y,r=t.z,h=s.x,n=s.y,a=s.z;return this.x=e*a-r*n,this.y=r*h-i*a,this.z=i*n-e*h,this}projectOnVector(t){const s=t.lengthSq();if(0===s)return this.set(0,0,0);const i=t.dot(this)/s;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return l.copy(this).projectOnVector(t),this.sub(l)}reflect(t){return this.sub(l.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===s)return Math.PI/2;const i=this.dot(t)/s;return Math.acos(r(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,i=this.y-t.y,e=this.z-t.z;return s*s+i*i+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,s,i){const e=Math.sin(s)*t;return this.x=e*Math.sin(i),this.y=Math.cos(s)*t,this.z=e*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,s,i){return this.x=t*Math.sin(s),this.y=i,this.z=t*Math.cos(s),this}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),e=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=i,this.z=e,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,4*s)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,3*s)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this.z=t.getZ(s),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=2*Math.random()-1,i=Math.sqrt(1-s*s);return this.x=i*Math.cos(t),this.y=s,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};a.prototype.isVector3=!0;let o=a;const l=new o,u=new n,y=class{constructor(t,s,i,e,r,h,n,a,o){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,s,i,e,r,h,n,a,o)}set(t,s,i,e,r,h,n,a,o){const l=this.elements;return l[0]=t,l[1]=e,l[2]=n,l[3]=s,l[4]=r,l[5]=a,l[6]=i,l[7]=h,l[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,i=t.elements;return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=i[4],s[5]=i[5],s[6]=i[6],s[7]=i[7],s[8]=i[8],this}extractBasis(t,s,i){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const i=t.elements,e=s.elements,r=this.elements,h=i[0],n=i[3],a=i[6],o=i[1],l=i[4],u=i[7],y=i[2],x=i[5],c=i[8],m=e[0],z=e[3],d=e[6],M=e[1],p=e[4],w=e[7],_=e[2],f=e[5],g=e[8];return r[0]=h*m+n*M+a*_,r[3]=h*z+n*p+a*f,r[6]=h*d+n*w+a*g,r[1]=o*m+l*M+u*_,r[4]=o*z+l*p+u*f,r[7]=o*d+l*w+u*g,r[2]=y*m+x*M+c*_,r[5]=y*z+x*p+c*f,r[8]=y*d+x*w+c*g,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8];return s*h*l-s*n*o-i*r*l+i*n*a+e*r*o-e*h*a}invert(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8],u=l*h-n*o,y=n*a-l*r,x=o*r-h*a,c=s*u+i*y+e*x;if(0===c)return this.set(0,0,0,0,0,0,0,0,0);const m=1/c;return t[0]=u*m,t[1]=(e*o-l*i)*m,t[2]=(n*i-e*h)*m,t[3]=y*m,t[4]=(l*s-e*a)*m,t[5]=(e*r-n*s)*m,t[6]=x*m,t[7]=(i*a-o*s)*m,t[8]=(h*s-i*r)*m,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t[0]=s[0],t[1]=s[3],t[2]=s[6],t[3]=s[1],t[4]=s[4],t[5]=s[7],t[6]=s[2],t[7]=s[5],t[8]=s[8],this}setUvTransform(t,s,i,e,r,h,n){const a=Math.cos(r),o=Math.sin(r);return this.set(i*a,i*o,-i*(a*h+o*n)+h+t,-e*o,e*a,-e*(-o*h+a*n)+n+s,0,0,1),this}scale(t,s){return e("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(c.makeScale(t,s)),this}rotate(t){return e("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(c.makeRotation(-t)),this}translate(t,s){return e("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(c.makeTranslation(t,s)),this}makeTranslation(t,s){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,-i,0,i,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,i=t.elements;for(let e=0;e<9;e++)if(s[e]!==i[e])return!1;return!0}fromArray(t,s=0){for(let i=0;i<9;i++)this.elements[i]=t[i+s];return this}toArray(t=[],s=0){const i=this.elements;return t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2],t[s+3]=i[3],t[s+4]=i[4],t[s+5]=i[5],t[s+6]=i[6],t[s+7]=i[7],t[s+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}};y.prototype.isMatrix3=!0;let x=y;const c=new x,m=class{constructor(t=0,s=0,i=0,e=1){this.x=t,this.y=s,this.z=i,this.w=e}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,s,i,e){return this.x=t,this.y=s,this.z=i,this.w=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;case 3:this.w=s;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this.w=t.w+s.w,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this.w+=t.w*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this.w=t.w-s.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const s=this.x,i=this.y,e=this.z,r=this.w,h=t.elements;return this.x=h[0]*s+h[4]*i+h[8]*e+h[12]*r,this.y=h[1]*s+h[5]*i+h[9]*e+h[13]*r,this.z=h[2]*s+h[6]*i+h[10]*e+h[14]*r,this.w=h[3]*s+h[7]*i+h[11]*e+h[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const s=Math.sqrt(1-t.w*t.w);return s<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/s,this.y=t.y/s,this.z=t.z/s),this}setAxisAngleFromRotationMatrix(t){let s,i,e,r;const h=.01,n=.1,a=t.elements,o=a[0],l=a[4],u=a[8],y=a[1],x=a[5],c=a[9],m=a[2],z=a[6],d=a[10];if(Math.abs(l-y)<h&&Math.abs(u-m)<h&&Math.abs(c-z)<h){if(Math.abs(l+y)<n&&Math.abs(u+m)<n&&Math.abs(c+z)<n&&Math.abs(o+x+d-3)<n)return this.set(1,0,0,0),this;s=Math.PI;const t=(o+1)/2,a=(x+1)/2,M=(d+1)/2,p=(l+y)/4,w=(u+m)/4,_=(c+z)/4;return t>a&&t>M?t<h?(i=0,e=.707106781,r=.707106781):(i=Math.sqrt(t),e=p/i,r=w/i):a>M?a<h?(i=.707106781,e=0,r=.707106781):(e=Math.sqrt(a),i=p/e,r=_/e):M<h?(i=.707106781,e=.707106781,r=0):(r=Math.sqrt(M),i=w/r,e=_/r),this.set(i,e,r,s),this}let M=Math.sqrt((z-c)*(z-c)+(u-m)*(u-m)+(y-l)*(y-l));return Math.abs(M)<.001&&(M=1),this.x=(z-c)/M,this.y=(u-m)/M,this.z=(y-l)/M,this.w=Math.acos((o+x+d-1)/2),this}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this.w=s[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this.z=r(this.z,t.z,s.z),this.w=r(this.w,t.w,s.w),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this.z=r(this.z,t,s),this.w=r(this.w,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this.w+=(t.w-this.w)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this.z=t.z+(s.z-t.z)*i,this.w=t.w+(s.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this.w=t[s+3],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t[s+3]=this.w,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this.z=t.getZ(s),this.w=t.getW(s),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};m.prototype.isVector4=!0;const z=class s{constructor(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z)}set(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z){const d=this.elements;return d[0]=t,d[4]=s,d[8]=i,d[12]=e,d[1]=r,d[5]=h,d[9]=n,d[13]=a,d[2]=o,d[6]=l,d[10]=u,d[14]=y,d[3]=x,d[7]=c,d[11]=m,d[15]=z,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new s).fromArray(this.elements)}copy(t){const s=this.elements,i=t.elements;return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=i[4],s[5]=i[5],s[6]=i[6],s[7]=i[7],s[8]=i[8],s[9]=i[9],s[10]=i[10],s[11]=i[11],s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15],this}copyPosition(t){const s=this.elements,i=t.elements;return s[12]=i[12],s[13]=i[13],s[14]=i[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}extractBasis(t,s,i){return 0===this.determinantAffine()?(t.set(1,0,0),s.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,s,i){return this.set(t.x,s.x,i.x,0,t.y,s.y,i.y,0,t.z,s.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinantAffine())return this.identity();const s=this.elements,i=t.elements,e=1/M.setFromMatrixColumn(t,0).length(),r=1/M.setFromMatrixColumn(t,1).length(),h=1/M.setFromMatrixColumn(t,2).length();return s[0]=i[0]*e,s[1]=i[1]*e,s[2]=i[2]*e,s[3]=0,s[4]=i[4]*r,s[5]=i[5]*r,s[6]=i[6]*r,s[7]=0,s[8]=i[8]*h,s[9]=i[9]*h,s[10]=i[10]*h,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromEuler(t){const s=this.elements,i=t.x,e=t.y,r=t.z,h=Math.cos(i),n=Math.sin(i),a=Math.cos(e),o=Math.sin(e),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=h*l,i=h*u,e=n*l,r=n*u;s[0]=a*l,s[4]=-a*u,s[8]=o,s[1]=i+e*o,s[5]=t-r*o,s[9]=-n*a,s[2]=r-t*o,s[6]=e+i*o,s[10]=h*a}else if("YXZ"===t.order){const t=a*l,i=a*u,e=o*l,r=o*u;s[0]=t+r*n,s[4]=e*n-i,s[8]=h*o,s[1]=h*u,s[5]=h*l,s[9]=-n,s[2]=i*n-e,s[6]=r+t*n,s[10]=h*a}else if("ZXY"===t.order){const t=a*l,i=a*u,e=o*l,r=o*u;s[0]=t-r*n,s[4]=-h*u,s[8]=e+i*n,s[1]=i+e*n,s[5]=h*l,s[9]=r-t*n,s[2]=-h*o,s[6]=n,s[10]=h*a}else if("ZYX"===t.order){const t=h*l,i=h*u,e=n*l,r=n*u;s[0]=a*l,s[4]=e*o-i,s[8]=t*o+r,s[1]=a*u,s[5]=r*o+t,s[9]=i*o-e,s[2]=-o,s[6]=n*a,s[10]=h*a}else if("YZX"===t.order){const t=h*a,i=h*o,e=n*a,r=n*o;s[0]=a*l,s[4]=r-t*u,s[8]=e*u+i,s[1]=u,s[5]=h*l,s[9]=-n*l,s[2]=-o*l,s[6]=i*u+e,s[10]=t-r*u}else if("XZY"===t.order){const t=h*a,i=h*o,e=n*a,r=n*o;s[0]=a*l,s[4]=-u,s[8]=o*l,s[1]=t*u+r,s[5]=h*l,s[9]=i*u-e,s[2]=e*u-i,s[6]=n*l,s[10]=r*u+t}return s[3]=0,s[7]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(w,t,_)}lookAt(t,s,i){const e=this.elements;return b.subVectors(t,s),0===b.lengthSq()&&(b.z=1),b.normalize(),f.crossVectors(i,b),0===f.lengthSq()&&(1===Math.abs(i.z)?b.x+=1e-4:b.z+=1e-4,b.normalize(),f.crossVectors(i,b)),f.normalize(),g.crossVectors(b,f),e[0]=f.x,e[4]=g.x,e[8]=b.x,e[1]=f.y,e[5]=g.y,e[9]=b.y,e[2]=f.z,e[6]=g.z,e[10]=b.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const i=t.elements,e=s.elements,r=this.elements,h=i[0],n=i[4],a=i[8],o=i[12],l=i[1],u=i[5],y=i[9],x=i[13],c=i[2],m=i[6],z=i[10],d=i[14],M=i[3],p=i[7],w=i[11],_=i[15],f=e[0],g=e[4],b=e[8],v=e[12],S=e[1],A=e[5],k=e[9],C=e[13],E=e[2],Z=e[6],T=e[10],q=e[14],F=e[3],V=e[7],R=e[11],X=e[15];return r[0]=h*f+n*S+a*E+o*F,r[4]=h*g+n*A+a*Z+o*V,r[8]=h*b+n*k+a*T+o*R,r[12]=h*v+n*C+a*q+o*X,r[1]=l*f+u*S+y*E+x*F,r[5]=l*g+u*A+y*Z+x*V,r[9]=l*b+u*k+y*T+x*R,r[13]=l*v+u*C+y*q+x*X,r[2]=c*f+m*S+z*E+d*F,r[6]=c*g+m*A+z*Z+d*V,r[10]=c*b+m*k+z*T+d*R,r[14]=c*v+m*C+z*q+d*X,r[3]=M*f+p*S+w*E+_*F,r[7]=M*g+p*A+w*Z+_*V,r[11]=M*b+p*k+w*T+_*R,r[15]=M*v+p*C+w*q+_*X,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],i=t[4],e=t[8],r=t[12],h=t[1],n=t[5],a=t[9],o=t[13],l=t[2],u=t[6],y=t[10],x=t[14],c=t[3],m=t[7],z=t[11],d=t[15],M=a*x-o*y,p=n*x-o*u,w=n*y-a*u,_=h*x-o*l,f=h*y-a*l,g=h*u-n*l;return s*(m*M-z*p+d*w)-i*(c*M-z*_+d*f)+e*(c*p-m*_+d*g)-r*(c*w-m*f+z*g)}determinantAffine(){const t=this.elements,s=t[0],i=t[4],e=t[8],r=t[1],h=t[5],n=t[9],a=t[2],o=t[6],l=t[10];return s*(h*l-n*o)-i*(r*l-n*a)+e*(r*o-h*a)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,i){const e=this.elements;return t.isVector3?(e[12]=t.x,e[13]=t.y,e[14]=t.z):(e[12]=t,e[13]=s,e[14]=i),this}invert(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8],u=t[9],y=t[10],x=t[11],c=t[12],m=t[13],z=t[14],d=t[15],M=s*n-i*h,p=s*a-e*h,w=s*o-r*h,_=i*a-e*n,f=i*o-r*n,g=e*o-r*a,b=l*m-u*c,v=l*z-y*c,S=l*d-x*c,A=u*z-y*m,k=u*d-x*m,C=y*d-x*z,E=M*C-p*k+w*A+_*S-f*v+g*b;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Z=1/E;return t[0]=(n*C-a*k+o*A)*Z,t[1]=(e*k-i*C-r*A)*Z,t[2]=(m*g-z*f+d*_)*Z,t[3]=(y*f-u*g-x*_)*Z,t[4]=(a*S-h*C-o*v)*Z,t[5]=(s*C-e*S+r*v)*Z,t[6]=(z*w-c*g-d*p)*Z,t[7]=(l*g-y*w+x*p)*Z,t[8]=(h*k-n*S+o*b)*Z,t[9]=(i*S-s*k-r*b)*Z,t[10]=(c*f-m*w+d*M)*Z,t[11]=(u*w-l*f-x*M)*Z,t[12]=(n*v-h*A-a*b)*Z,t[13]=(s*A-i*v+e*b)*Z,t[14]=(m*p-c*_-z*M)*Z,t[15]=(l*_-u*p+y*M)*Z,this}scale(t){const s=this.elements,i=t.x,e=t.y,r=t.z;return s[0]*=i,s[4]*=e,s[8]*=r,s[1]*=i,s[5]*=e,s[9]*=r,s[2]*=i,s[6]*=e,s[10]*=r,s[3]*=i,s[7]*=e,s[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],e=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,i,e))}makeTranslation(t,s,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,i,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,s,-i,0,0,i,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,0,i,0,0,1,0,0,-i,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,-i,0,0,i,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const i=Math.cos(s),e=Math.sin(s),r=1-i,h=t.x,n=t.y,a=t.z,o=r*h,l=r*n;return this.set(o*h+i,o*n-e*a,o*a+e*n,0,o*n+e*a,l*n+i,l*a-e*h,0,o*a-e*n,l*a+e*h,r*a*a+i,0,0,0,0,1),this}makeScale(t,s,i){return this.set(t,0,0,0,0,s,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,s,i,e,r,h){return this.set(1,i,r,0,t,1,h,0,s,e,1,0,0,0,0,1),this}compose(t,s,i){const e=this.elements,r=s._x,h=s._y,n=s._z,a=s._w,o=r+r,l=h+h,u=n+n,y=r*o,x=r*l,c=r*u,m=h*l,z=h*u,d=n*u,M=a*o,p=a*l,w=a*u,_=i.x,f=i.y,g=i.z;return e[0]=(1-(m+d))*_,e[1]=(x+w)*_,e[2]=(c-p)*_,e[3]=0,e[4]=(x-w)*f,e[5]=(1-(y+d))*f,e[6]=(z+M)*f,e[7]=0,e[8]=(c+p)*g,e[9]=(z-M)*g,e[10]=(1-(y+m))*g,e[11]=0,e[12]=t.x,e[13]=t.y,e[14]=t.z,e[15]=1,this}decompose(t,s,i){const e=this.elements;t.x=e[12],t.y=e[13],t.z=e[14];const r=this.determinantAffine();if(0===r)return i.set(1,1,1),s.identity(),this;let h=M.set(e[0],e[1],e[2]).length();const n=M.set(e[4],e[5],e[6]).length(),a=M.set(e[8],e[9],e[10]).length();r<0&&(h=-h),p.copy(this);const o=1/h,l=1/n,u=1/a;return p.elements[0]*=o,p.elements[1]*=o,p.elements[2]*=o,p.elements[4]*=l,p.elements[5]*=l,p.elements[6]*=l,p.elements[8]*=u,p.elements[9]*=u,p.elements[10]*=u,s.setFromRotationMatrix(p),i.x=h,i.y=n,i.z=a,this}makePerspective(s,i,e,r,h,n,a=2e3,o=!1){const l=this.elements,u=2*h/(i-s),y=2*h/(e-r),x=(i+s)/(i-s),c=(e+r)/(e-r);let m,z;if(o)m=h/(n-h),z=n*h/(n-h);else if(a===t)m=-(n+h)/(n-h),z=-2*n*h/(n-h);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);m=-n/(n-h),z=-n*h/(n-h)}return l[0]=u,l[4]=0,l[8]=x,l[12]=0,l[1]=0,l[5]=y,l[9]=c,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=z,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(s,i,e,r,h,n,a=2e3,o=!1){const l=this.elements,u=2/(i-s),y=2/(e-r),x=-(i+s)/(i-s),c=-(e+r)/(e-r);let m,z;if(o)m=1/(n-h),z=n/(n-h);else if(a===t)m=-2/(n-h),z=-(n+h)/(n-h);else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);m=-1/(n-h),z=-h/(n-h)}return l[0]=u,l[4]=0,l[8]=0,l[12]=x,l[1]=0,l[5]=y,l[9]=0,l[13]=c,l[2]=0,l[6]=0,l[10]=m,l[14]=z,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const s=this.elements,i=t.elements;for(let e=0;e<16;e++)if(s[e]!==i[e])return!1;return!0}fromArray(t,s=0){for(let i=0;i<16;i++)this.elements[i]=t[i+s];return this}toArray(t=[],s=0){const i=this.elements;return t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2],t[s+3]=i[3],t[s+4]=i[4],t[s+5]=i[5],t[s+6]=i[6],t[s+7]=i[7],t[s+8]=i[8],t[s+9]=i[9],t[s+10]=i[10],t[s+11]=i[11],t[s+12]=i[12],t[s+13]=i[13],t[s+14]=i[14],t[s+15]=i[15],t}};z.prototype.isMatrix4=!0;let d=z;const M=new o,p=new d,w=new o(0,0,0),_=new o(1,1,1),f=new o,g=new o,b=new o,v=class{constructor(t,s,i,e){this.elements=[1,0,0,1],void 0!==t&&this.set(t,s,i,e)}identity(){return this.set(1,0,0,1),this}fromArray(t,s=0){for(let i=0;i<4;i++)this.elements[i]=t[i+s];return this}set(t,s,i,e){const r=this.elements;return r[0]=t,r[2]=s,r[1]=i,r[3]=e,this}};v.prototype.isMatrix2=!0;"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}})),"undefined"!=typeof window&&(window.__THREE__?i("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");(new x).set(-1,0,0,0,1,0,0,0,1);(new x).set(-1,0,0,0,1,0,0,0,1);const S=.0066943799901413165,A=-12e3,k=1e5,C=Math.PI/180;function E(t,s){if(!Number.isFinite(t))throw new TypeError(`${s} must be a finite number.`);return t}function Z(t,s,i="Geodetic position"){if(E(t,`${i} longitude`),E(s,`${i} latitude`),t<-180||t>180)throw new RangeError(`${i} longitude must be within [-180, 180] degrees.`);if(s<-90||s>90)throw new RangeError(`${i} latitude must be within [-90, 90] degrees.`)}function T(t,s,i){E(t,"Longitude"),E(s,"Latitude"),E(i,"Altitude");const e=s*C,r=t*C,h=Math.sin(e),n=90===Math.abs(s)?0:Math.cos(e),a=6378137/Math.sqrt(1-S*h**2);return[(a+i)*n*Math.cos(r),(a+i)*n*Math.sin(r),(.9933056200098587*a+i)*h]}function q(t,s,i=2){const e=t.length;let r=function(t,s,i,e,r){let h;if(r===function(t,s,i,e){let r=0;for(let h=s,n=i-e;h<i;h+=e)r+=(t[n]-t[h])*(t[h+1]+t[n+1]),n=h;return r}(t,s,i,e)>0)for(let n=s;n<i;n+=e)h=W(n/e|0,t[n],t[n+1],h);else for(let n=i-e;n>=s;n-=e)h=W(n/e|0,t[n],t[n+1],h);h&&H(h,h.next)&&($(h),h=h.next);return h}(t,0,e,i,!0);const h=[];if(!r||r.next===r.prev)return h;let n,a,o;if(t.length>80*i){n=1/0,a=1/0;let s=-1/0,r=-1/0;for(let h=i;h<e;h+=i){const i=t[h],e=t[h+1];i<n&&(n=i),e<a&&(a=e),i>s&&(s=i),e>r&&(r=e)}o=Math.max(s-n,r-a),o=0!==o?32767/o:0}return V(r,h,i,n,a,o,0),h}function F(t,s){if(!t)return t;s||(s=t);let i,e=t;do{if(i=!1,e.steiner||!H(e,e.next)&&0!==I(e.prev,e,e.next))e=e.next;else{if($(e),e=s=e.prev,e===e.next)break;i=!0}}while(i||e!==s);return s}function V(t,s,i,e,r,h,n){if(!t)return;!n&&h&&function(t,s,i,e){let r=t;do{0===r.z&&(r.z=O(r.x,r.y,s,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let s,i=1;do{let e,r=t;t=null;let h=null;for(s=0;r;){s++;let n=r,a=0;for(let t=0;t<i&&(a++,n=n.nextZ,n);t++);let o=i;for(;a>0||o>0&&n;)0!==a&&(0===o||!n||r.z<=n.z)?(e=r,r=r.nextZ,a--):(e=n,n=n.nextZ,o--),h?h.nextZ=e:t=e,e.prevZ=h,h=e;r=n}h.nextZ=null,i*=2}while(s>1)}(r)}(t,e,r,h);let a=t;for(;t.prev!==t.next;){const o=t.prev,l=t.next;if(h?X(t,e,r,h):R(t))s.push(o.i,t.i,l.i),$(t),t=l.next,a=l.next;else if((t=l)===a){n?1===n?V(t=Y(F(t),s),s,i,e,r,h,2):2===n&&L(t,s,i,e,r,h):V(F(t),s,i,e,r,h,1);break}}}function R(t){const s=t.prev,i=t,e=t.next;if(I(s,i,e)>=0)return!1;const r=s.x,h=i.x,n=e.x,a=s.y,o=i.y,l=e.y,u=Math.min(r,h,n),y=Math.min(a,o,l),x=Math.max(r,h,n),c=Math.max(a,o,l);let m=e.next;for(;m!==s;){if(m.x>=u&&m.x<=x&&m.y>=y&&m.y<=c&&P(r,a,h,o,n,l,m.x,m.y)&&I(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function X(t,s,i,e){const r=t.prev,h=t,n=t.next;if(I(r,h,n)>=0)return!1;const a=r.x,o=h.x,l=n.x,u=r.y,y=h.y,x=n.y,c=Math.min(a,o,l),m=Math.min(u,y,x),z=Math.max(a,o,l),d=Math.max(u,y,x),M=O(c,m,s,i,e),p=O(z,d,s,i,e);let w=t.prevZ,_=t.nextZ;for(;w&&w.z>=M&&_&&_.z<=p;){if(w.x>=c&&w.x<=z&&w.y>=m&&w.y<=d&&w!==r&&w!==n&&P(a,u,o,y,l,x,w.x,w.y)&&I(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,_.x>=c&&_.x<=z&&_.y>=m&&_.y<=d&&_!==r&&_!==n&&P(a,u,o,y,l,x,_.x,_.y)&&I(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;w&&w.z>=M;){if(w.x>=c&&w.x<=z&&w.y>=m&&w.y<=d&&w!==r&&w!==n&&P(a,u,o,y,l,x,w.x,w.y)&&I(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=p;){if(_.x>=c&&_.x<=z&&_.y>=m&&_.y<=d&&_!==r&&_!==n&&P(a,u,o,y,l,x,_.x,_.y)&&I(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Y(t,s){let i=t;do{const e=i.prev,r=i.next.next;!H(e,r)&&N(e,i,i.next,r)&&G(e,r)&&G(r,e)&&(s.push(e.i,i.i,r.i),$(i),$(i.next),i=t=r),i=i.next}while(i!==t);return F(i)}function L(t,s,i,e,r,h){let n=t;do{let t=n.next.next;for(;t!==n.prev;){if(n.i!==t.i&&B(n,t)){let a=U(n,t);return n=F(n,n.next),a=F(a,a.next),V(n,s,i,e,r,h,0),void V(a,s,i,e,r,h,0)}t=t.next}n=n.next}while(n!==t)}function O(t,s,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-e)*r|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function P(t,s,i,e,r,h,n,a){return!(t===n&&s===a)&&function(t,s,i,e,r,h,n,a){return(r-n)*(s-a)>=(t-n)*(h-a)&&(t-n)*(e-a)>=(i-n)*(s-a)&&(i-n)*(h-a)>=(r-n)*(e-a)}(t,s,i,e,r,h,n,a)}function B(t,s){return t.next.i!==s.i&&t.prev.i!==s.i&&!function(t,s){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==s.i&&i.next.i!==s.i&&N(i,i.next,t,s))return!0;i=i.next}while(i!==t);return!1}(t,s)&&(G(t,s)&&G(s,t)&&function(t,s){let i=t,e=!1;const r=(t.x+s.x)/2,h=(t.y+s.y)/2;do{i.y>h!=i.next.y>h&&i.next.y!==i.y&&r<(i.next.x-i.x)*(h-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,s)&&(I(t.prev,t,s.prev)||I(t,s.prev,s))||H(t,s)&&I(t.prev,t,t.next)>0&&I(s.prev,s,s.next)>0)}function I(t,s,i){return(s.y-t.y)*(i.x-s.x)-(s.x-t.x)*(i.y-s.y)}function H(t,s){return t.x===s.x&&t.y===s.y}function N(t,s,i,e){const r=j(I(t,s,i)),h=j(I(t,s,e)),n=j(I(i,e,t)),a=j(I(i,e,s));return r!==h&&n!==a||(!(0!==r||!Q(t,i,s))||(!(0!==h||!Q(t,e,s))||(!(0!==n||!Q(i,t,e))||!(0!==a||!Q(i,s,e)))))}function Q(t,s,i){return s.x<=Math.max(t.x,i.x)&&s.x>=Math.min(t.x,i.x)&&s.y<=Math.max(t.y,i.y)&&s.y>=Math.min(t.y,i.y)}function j(t){return t>0?1:t<0?-1:0}function G(t,s){return I(t.prev,t,t.next)<0?I(t,s,t.next)>=0&&I(t,t.prev,s)>=0:I(t,s,t.prev)<0||I(t,t.next,s)<0}function U(t,s){const i=D(t.i,t.x,t.y),e=D(s.i,s.x,s.y),r=t.next,h=s.prev;return t.next=s,s.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,h.next=e,e.prev=h,e}function W(t,s,i,e){const r=D(t,s,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function $(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function D(t,s,i){return{i:t,x:s,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const J=5e4;function K(t){return 255*(t=(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))}function tt(t,s){if(!Array.isArray(t)||t.length<3)throw new TypeError("Every GeoJSON position must contain longitude, latitude, and altitude.");!function(t,s,i,e="Geodetic position"){if(Z(t,s,e),E(i,`${e} altitude`),i<A||i>k)throw new RangeError(`${e} altitude must be within [-12000, 100000] WGS84 ellipsoidal meters.`)}(t[0],t[1],t[2],"GeoJSON position");const i=(new o).fromArray(T(t[0],t[1],t[2])).sub(s);if(i.length()>J)throw new RangeError("GeoJSON feature exceeds the 50000 meter local precision envelope.");return i}function st(t){for(let s=0;s<t.length;s+=3)if(Math.hypot(t[s],t[s+1],t[s+2])>J)throw new RangeError("GeoJSON feature exceeds the 50000 meter local precision envelope.");return new Float32Array(t)}function it(t){const{geometry:s}=t;if(!Array.isArray(null==s?void 0:s.coordinates)||2!==s.coordinates.length)throw new TypeError("Arrow geometry must contain exactly two positions.");const i=(new o).fromArray(T(...s.coordinates[0])),e=tt(s.coordinates[0],i),r=tt(s.coordinates[1],i),h=(new o).fromArray(function(t,s){Z(t,s,"ENU origin");const i=t*C,e=s*C,r=Math.sin(i),h=Math.cos(i),n=Math.sin(e),a=Math.cos(e);return{east:[-r,h,0],north:[-n*h,-n*r,a],up:[a*h,a*r,n]}}(s.coordinates[0][0],s.coordinates[0][1]).up),n=(new o).subVectors(r,e),a=n.length(),l=n.clone().normalize(),u=(new o).crossVectors(h,l).normalize().multiplyScalar(10),y=e.clone(),x=r.clone(),c=y.clone().add(l.clone().multiplyScalar(a*(1-100/a))),m=y.clone().add(u),z=y.clone().sub(u),d=c.clone().add(u.clone()),M=c.clone().sub(u.clone()),p=c.clone().add(u.clone().multiplyScalar(4)),w=c.clone().sub(u.clone().multiplyScalar(4)),_=x,f=st([...m.toArray(),...z.toArray(),...d.toArray(),...d.toArray(),...z.toArray(),...M.toArray(),...p.toArray(),...w.toArray(),..._.toArray()]);return{origin:i.toArray(),meshVertexBuffer:f}}self.addEventListener("message",(async t=>{const{type:s,data:i,color:e}=t.data;try{let t={};switch(s){case"arrow":t=it(i);break;case"perimeter":t=function(t,s){var i,e;const r=null==(e=null==(i=null==t?void 0:t.geometry)?void 0:i.coordinates)?void 0:e[0];if(!Array.isArray(r)||0===r.length)throw new TypeError("Perimeter geometry must contain a non-empty ring.");const h=(new o).fromArray(T(...r[0])),n=[(a=s)>>16&255,a>>8&255,255&a];var a;n[0]=K(n[0]),n[1]=K(n[1]),n[2]=K(n[2]);const l=q(r.flat(),0,r[0].length),u=[],y=[],x=[],c=[];for(let o=0;o<r.length;o++){const t=tt(r[o],h).toArray();u.push(...t),c.push(...n),x.push(...t),y.push(...n),o>0&&(x.push(...t),y.push(...n))}return{origin:h.toArray(),lineVertexBuffer:st(x),lineVertexRGBBuffer:new Uint8Array(y),meshVertexBuffer:st(u),meshVertexRGBBuffer:new Uint8Array(c),meshIndexBuffer:new Uint16Array(l.flat())}}(i,e);break;default:throw new TypeError(`Unsupported GeoJSON feature type: ${String(s)}.`)}self.postMessage({success:!0,code:0,...t})}catch(r){self.postMessage({success:!1,code:1,error:{name:r instanceof Error?r.name:"Error",message:r instanceof Error?r.message:String(r)}})}}))}();
|
|
1
|
+
!function(){"use strict";const t=2e3,s={};function i(...t){t=function(t){const s=t[0];if("string"==typeof s&&s.startsWith("TSL:")){const s=t[1];s&&s.isStackTrace?t[0]+=" "+s.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}(t);t.shift();{const s=t[0];s&&s.isStackTrace}}function e(...t){const e=t.join(" ");e in s||(s[e]=!0,i(...t))}function r(t,s,i){return Math.max(s,Math.min(i,t))}const h=class{constructor(t=0,s=0){this.x=t,this.y=s}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const s=this.x,i=this.y,e=t.elements;return this.x=e[0]*s+e[3]*i+e[6],this.y=e[1]*s+e[4]*i+e[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===s)return Math.PI/2;const i=this.dot(t)/s;return Math.acos(r(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,i=this.y-t.y;return s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this}rotateAround(t,s){const i=Math.cos(s),e=Math.sin(s),r=this.x-t.x,h=this.y-t.y;return this.x=r*i-h*e+t.x,this.y=r*e+h*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};h.prototype.isVector2=!0;class n{constructor(t=0,s=0,i=0,e=1){this.isQuaternion=!0,this._x=t,this._y=s,this._z=i,this._w=e}static slerpFlat(t,s,i,e,r,h,n){let a=i[e+0],o=i[e+1],l=i[e+2],u=i[e+3],y=r[h+0],x=r[h+1],c=r[h+2],m=r[h+3];if(u!==m||a!==y||o!==x||l!==c){let t=a*y+o*x+l*c+u*m;t<0&&(y=-y,x=-x,c=-c,m=-m,t=-t);let s=1-n;if(t<.9995){const i=Math.acos(t),e=Math.sin(i);s=Math.sin(s*i)/e,a=a*s+y*(n=Math.sin(n*i)/e),o=o*s+x*n,l=l*s+c*n,u=u*s+m*n}else{a=a*s+y*n,o=o*s+x*n,l=l*s+c*n,u=u*s+m*n;const t=1/Math.sqrt(a*a+o*o+l*l+u*u);a*=t,o*=t,l*=t,u*=t}}t[s]=a,t[s+1]=o,t[s+2]=l,t[s+3]=u}static multiplyQuaternionsFlat(t,s,i,e,r,h){const n=i[e],a=i[e+1],o=i[e+2],l=i[e+3],u=r[h],y=r[h+1],x=r[h+2],c=r[h+3];return t[s]=n*c+l*u+a*x-o*y,t[s+1]=a*c+l*y+o*u-n*x,t[s+2]=o*c+l*x+n*y-a*u,t[s+3]=l*c-n*u-a*y-o*x,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,i,e){return this._x=t,this._y=s,this._z=i,this._w=e,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t._x,r=t._y,h=t._z,n=t._order,a=Math.cos,o=Math.sin,l=a(e/2),u=a(r/2),y=a(h/2),x=o(e/2),c=o(r/2),m=o(h/2);switch(n){case"XYZ":this._x=x*u*y+l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y-x*c*m;break;case"YXZ":this._x=x*u*y+l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y+x*c*m;break;case"ZXY":this._x=x*u*y-l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y-x*c*m;break;case"ZYX":this._x=x*u*y-l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y+x*c*m;break;case"YZX":this._x=x*u*y+l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y-x*c*m;break;case"XZY":this._x=x*u*y-l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y+x*c*m;break;default:i("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===s&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const i=s/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,i=s[0],e=s[4],r=s[8],h=s[1],n=s[5],a=s[9],o=s[2],l=s[6],u=s[10],y=i+n+u;if(y>0){const t=.5/Math.sqrt(y+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-o)*t,this._z=(h-e)*t}else if(i>n&&i>u){const t=2*Math.sqrt(1+i-n-u);this._w=(l-a)/t,this._x=.25*t,this._y=(e+h)/t,this._z=(r+o)/t}else if(n>u){const t=2*Math.sqrt(1+n-i-u);this._w=(r-o)/t,this._x=(e+h)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+u-i-n);this._w=(h-e)/t,this._x=(r+o)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let i=t.dot(s)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(r(this.dot(t),-1,1)))}rotateTowards(t,s){const i=this.angleTo(t);if(0===i)return this;const e=Math.min(1,s/i);return this.slerp(t,e),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const i=t._x,e=t._y,r=t._z,h=t._w,n=s._x,a=s._y,o=s._z,l=s._w;return this._x=i*l+h*n+e*o-r*a,this._y=e*l+h*a+r*n-i*o,this._z=r*l+h*o+i*a-e*n,this._w=h*l-i*n-e*a-r*o,this._onChangeCallback(),this}slerp(t,s){let i=t._x,e=t._y,r=t._z,h=t._w,n=this.dot(t);n<0&&(i=-i,e=-e,r=-r,h=-h,n=-n);let a=1-s;if(n<.9995){const t=Math.acos(n),o=Math.sin(t);a=Math.sin(a*t)/o,s=Math.sin(s*t)/o,this._x=this._x*a+i*s,this._y=this._y*a+e*s,this._z=this._z*a+r*s,this._w=this._w*a+h*s,this._onChangeCallback()}else this._x=this._x*a+i*s,this._y=this._y*a+e*s,this._z=this._z*a+r*s,this._w=this._w*a+h*s,this.normalize();return this}slerpQuaternions(t,s,i){return this.copy(t).slerp(s,i)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(s),r*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}fromBufferAttribute(t,s){return this._x=t.getX(s),this._y=t.getY(s),this._z=t.getZ(s),this._w=t.getW(s),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const a=class{constructor(t=0,s=0,i=0){this.x=t,this.y=s,this.z=i}set(t,s,i){return void 0===i&&(i=this.z),this.x=t,this.y=s,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(u.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(u.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,i=this.y,e=this.z,r=t.elements;return this.x=r[0]*s+r[3]*i+r[6]*e,this.y=r[1]*s+r[4]*i+r[7]*e,this.z=r[2]*s+r[5]*i+r[8]*e,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const s=this.x,i=this.y,e=this.z,r=t.elements,h=1/(r[3]*s+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*s+r[4]*i+r[8]*e+r[12])*h,this.y=(r[1]*s+r[5]*i+r[9]*e+r[13])*h,this.z=(r[2]*s+r[6]*i+r[10]*e+r[14])*h,this}applyQuaternion(t){const s=this.x,i=this.y,e=this.z,r=t.x,h=t.y,n=t.z,a=t.w,o=2*(h*e-n*i),l=2*(n*s-r*e),u=2*(r*i-h*s);return this.x=s+a*o+h*u-n*l,this.y=i+a*l+n*o-r*u,this.z=e+a*u+r*l-h*o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const s=this.x,i=this.y,e=this.z,r=t.elements;return this.x=r[0]*s+r[4]*i+r[8]*e,this.y=r[1]*s+r[5]*i+r[9]*e,this.z=r[2]*s+r[6]*i+r[10]*e,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this.z=r(this.z,t.z,s.z),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this.z=r(this.z,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this.z=t.z+(s.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const i=t.x,e=t.y,r=t.z,h=s.x,n=s.y,a=s.z;return this.x=e*a-r*n,this.y=r*h-i*a,this.z=i*n-e*h,this}projectOnVector(t){const s=t.lengthSq();if(0===s)return this.set(0,0,0);const i=t.dot(this)/s;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return l.copy(this).projectOnVector(t),this.sub(l)}reflect(t){return this.sub(l.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===s)return Math.PI/2;const i=this.dot(t)/s;return Math.acos(r(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,i=this.y-t.y,e=this.z-t.z;return s*s+i*i+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,s,i){const e=Math.sin(s)*t;return this.x=e*Math.sin(i),this.y=Math.cos(s)*t,this.z=e*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,s,i){return this.x=t*Math.sin(s),this.y=i,this.z=t*Math.cos(s),this}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),e=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=i,this.z=e,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,4*s)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,3*s)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this.z=t.getZ(s),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=2*Math.random()-1,i=Math.sqrt(1-s*s);return this.x=i*Math.cos(t),this.y=s,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};a.prototype.isVector3=!0;let o=a;const l=new o,u=new n,y=class{constructor(t,s,i,e,r,h,n,a,o){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,s,i,e,r,h,n,a,o)}set(t,s,i,e,r,h,n,a,o){const l=this.elements;return l[0]=t,l[1]=e,l[2]=n,l[3]=s,l[4]=r,l[5]=a,l[6]=i,l[7]=h,l[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,i=t.elements;return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=i[4],s[5]=i[5],s[6]=i[6],s[7]=i[7],s[8]=i[8],this}extractBasis(t,s,i){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const i=t.elements,e=s.elements,r=this.elements,h=i[0],n=i[3],a=i[6],o=i[1],l=i[4],u=i[7],y=i[2],x=i[5],c=i[8],m=e[0],z=e[3],d=e[6],M=e[1],p=e[4],w=e[7],_=e[2],f=e[5],g=e[8];return r[0]=h*m+n*M+a*_,r[3]=h*z+n*p+a*f,r[6]=h*d+n*w+a*g,r[1]=o*m+l*M+u*_,r[4]=o*z+l*p+u*f,r[7]=o*d+l*w+u*g,r[2]=y*m+x*M+c*_,r[5]=y*z+x*p+c*f,r[8]=y*d+x*w+c*g,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8];return s*h*l-s*n*o-i*r*l+i*n*a+e*r*o-e*h*a}invert(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8],u=l*h-n*o,y=n*a-l*r,x=o*r-h*a,c=s*u+i*y+e*x;if(0===c)return this.set(0,0,0,0,0,0,0,0,0);const m=1/c;return t[0]=u*m,t[1]=(e*o-l*i)*m,t[2]=(n*i-e*h)*m,t[3]=y*m,t[4]=(l*s-e*a)*m,t[5]=(e*r-n*s)*m,t[6]=x*m,t[7]=(i*a-o*s)*m,t[8]=(h*s-i*r)*m,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t[0]=s[0],t[1]=s[3],t[2]=s[6],t[3]=s[1],t[4]=s[4],t[5]=s[7],t[6]=s[2],t[7]=s[5],t[8]=s[8],this}setUvTransform(t,s,i,e,r,h,n){const a=Math.cos(r),o=Math.sin(r);return this.set(i*a,i*o,-i*(a*h+o*n)+h+t,-e*o,e*a,-e*(-o*h+a*n)+n+s,0,0,1),this}scale(t,s){return e("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(c.makeScale(t,s)),this}rotate(t){return e("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(c.makeRotation(-t)),this}translate(t,s){return e("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(c.makeTranslation(t,s)),this}makeTranslation(t,s){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,-i,0,i,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,i=t.elements;for(let e=0;e<9;e++)if(s[e]!==i[e])return!1;return!0}fromArray(t,s=0){for(let i=0;i<9;i++)this.elements[i]=t[i+s];return this}toArray(t=[],s=0){const i=this.elements;return t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2],t[s+3]=i[3],t[s+4]=i[4],t[s+5]=i[5],t[s+6]=i[6],t[s+7]=i[7],t[s+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}};y.prototype.isMatrix3=!0;let x=y;const c=new x,m=class{constructor(t=0,s=0,i=0,e=1){this.x=t,this.y=s,this.z=i,this.w=e}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,s,i,e){return this.x=t,this.y=s,this.z=i,this.w=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;case 3:this.w=s;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this.w=t.w+s.w,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this.w+=t.w*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this.w=t.w-s.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const s=this.x,i=this.y,e=this.z,r=this.w,h=t.elements;return this.x=h[0]*s+h[4]*i+h[8]*e+h[12]*r,this.y=h[1]*s+h[5]*i+h[9]*e+h[13]*r,this.z=h[2]*s+h[6]*i+h[10]*e+h[14]*r,this.w=h[3]*s+h[7]*i+h[11]*e+h[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const s=Math.sqrt(1-t.w*t.w);return s<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/s,this.y=t.y/s,this.z=t.z/s),this}setAxisAngleFromRotationMatrix(t){let s,i,e,r;const h=.01,n=.1,a=t.elements,o=a[0],l=a[4],u=a[8],y=a[1],x=a[5],c=a[9],m=a[2],z=a[6],d=a[10];if(Math.abs(l-y)<h&&Math.abs(u-m)<h&&Math.abs(c-z)<h){if(Math.abs(l+y)<n&&Math.abs(u+m)<n&&Math.abs(c+z)<n&&Math.abs(o+x+d-3)<n)return this.set(1,0,0,0),this;s=Math.PI;const t=(o+1)/2,a=(x+1)/2,M=(d+1)/2,p=(l+y)/4,w=(u+m)/4,_=(c+z)/4;return t>a&&t>M?t<h?(i=0,e=.707106781,r=.707106781):(i=Math.sqrt(t),e=p/i,r=w/i):a>M?a<h?(i=.707106781,e=0,r=.707106781):(e=Math.sqrt(a),i=p/e,r=_/e):M<h?(i=.707106781,e=.707106781,r=0):(r=Math.sqrt(M),i=w/r,e=_/r),this.set(i,e,r,s),this}let M=Math.sqrt((z-c)*(z-c)+(u-m)*(u-m)+(y-l)*(y-l));return Math.abs(M)<.001&&(M=1),this.x=(z-c)/M,this.y=(u-m)/M,this.z=(y-l)/M,this.w=Math.acos((o+x+d-1)/2),this}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this.w=s[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this.z=r(this.z,t.z,s.z),this.w=r(this.w,t.w,s.w),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this.z=r(this.z,t,s),this.w=r(this.w,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this.w+=(t.w-this.w)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this.z=t.z+(s.z-t.z)*i,this.w=t.w+(s.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this.w=t[s+3],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t[s+3]=this.w,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this.z=t.getZ(s),this.w=t.getW(s),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};m.prototype.isVector4=!0;const z=class s{constructor(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z)}set(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z){const d=this.elements;return d[0]=t,d[4]=s,d[8]=i,d[12]=e,d[1]=r,d[5]=h,d[9]=n,d[13]=a,d[2]=o,d[6]=l,d[10]=u,d[14]=y,d[3]=x,d[7]=c,d[11]=m,d[15]=z,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new s).fromArray(this.elements)}copy(t){const s=this.elements,i=t.elements;return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=i[4],s[5]=i[5],s[6]=i[6],s[7]=i[7],s[8]=i[8],s[9]=i[9],s[10]=i[10],s[11]=i[11],s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15],this}copyPosition(t){const s=this.elements,i=t.elements;return s[12]=i[12],s[13]=i[13],s[14]=i[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}extractBasis(t,s,i){return 0===this.determinantAffine()?(t.set(1,0,0),s.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,s,i){return this.set(t.x,s.x,i.x,0,t.y,s.y,i.y,0,t.z,s.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinantAffine())return this.identity();const s=this.elements,i=t.elements,e=1/M.setFromMatrixColumn(t,0).length(),r=1/M.setFromMatrixColumn(t,1).length(),h=1/M.setFromMatrixColumn(t,2).length();return s[0]=i[0]*e,s[1]=i[1]*e,s[2]=i[2]*e,s[3]=0,s[4]=i[4]*r,s[5]=i[5]*r,s[6]=i[6]*r,s[7]=0,s[8]=i[8]*h,s[9]=i[9]*h,s[10]=i[10]*h,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromEuler(t){const s=this.elements,i=t.x,e=t.y,r=t.z,h=Math.cos(i),n=Math.sin(i),a=Math.cos(e),o=Math.sin(e),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=h*l,i=h*u,e=n*l,r=n*u;s[0]=a*l,s[4]=-a*u,s[8]=o,s[1]=i+e*o,s[5]=t-r*o,s[9]=-n*a,s[2]=r-t*o,s[6]=e+i*o,s[10]=h*a}else if("YXZ"===t.order){const t=a*l,i=a*u,e=o*l,r=o*u;s[0]=t+r*n,s[4]=e*n-i,s[8]=h*o,s[1]=h*u,s[5]=h*l,s[9]=-n,s[2]=i*n-e,s[6]=r+t*n,s[10]=h*a}else if("ZXY"===t.order){const t=a*l,i=a*u,e=o*l,r=o*u;s[0]=t-r*n,s[4]=-h*u,s[8]=e+i*n,s[1]=i+e*n,s[5]=h*l,s[9]=r-t*n,s[2]=-h*o,s[6]=n,s[10]=h*a}else if("ZYX"===t.order){const t=h*l,i=h*u,e=n*l,r=n*u;s[0]=a*l,s[4]=e*o-i,s[8]=t*o+r,s[1]=a*u,s[5]=r*o+t,s[9]=i*o-e,s[2]=-o,s[6]=n*a,s[10]=h*a}else if("YZX"===t.order){const t=h*a,i=h*o,e=n*a,r=n*o;s[0]=a*l,s[4]=r-t*u,s[8]=e*u+i,s[1]=u,s[5]=h*l,s[9]=-n*l,s[2]=-o*l,s[6]=i*u+e,s[10]=t-r*u}else if("XZY"===t.order){const t=h*a,i=h*o,e=n*a,r=n*o;s[0]=a*l,s[4]=-u,s[8]=o*l,s[1]=t*u+r,s[5]=h*l,s[9]=i*u-e,s[2]=e*u-i,s[6]=n*l,s[10]=r*u+t}return s[3]=0,s[7]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(w,t,_)}lookAt(t,s,i){const e=this.elements;return b.subVectors(t,s),0===b.lengthSq()&&(b.z=1),b.normalize(),f.crossVectors(i,b),0===f.lengthSq()&&(1===Math.abs(i.z)?b.x+=1e-4:b.z+=1e-4,b.normalize(),f.crossVectors(i,b)),f.normalize(),g.crossVectors(b,f),e[0]=f.x,e[4]=g.x,e[8]=b.x,e[1]=f.y,e[5]=g.y,e[9]=b.y,e[2]=f.z,e[6]=g.z,e[10]=b.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const i=t.elements,e=s.elements,r=this.elements,h=i[0],n=i[4],a=i[8],o=i[12],l=i[1],u=i[5],y=i[9],x=i[13],c=i[2],m=i[6],z=i[10],d=i[14],M=i[3],p=i[7],w=i[11],_=i[15],f=e[0],g=e[4],b=e[8],v=e[12],S=e[1],A=e[5],k=e[9],C=e[13],E=e[2],Z=e[6],T=e[10],q=e[14],F=e[3],V=e[7],R=e[11],X=e[15];return r[0]=h*f+n*S+a*E+o*F,r[4]=h*g+n*A+a*Z+o*V,r[8]=h*b+n*k+a*T+o*R,r[12]=h*v+n*C+a*q+o*X,r[1]=l*f+u*S+y*E+x*F,r[5]=l*g+u*A+y*Z+x*V,r[9]=l*b+u*k+y*T+x*R,r[13]=l*v+u*C+y*q+x*X,r[2]=c*f+m*S+z*E+d*F,r[6]=c*g+m*A+z*Z+d*V,r[10]=c*b+m*k+z*T+d*R,r[14]=c*v+m*C+z*q+d*X,r[3]=M*f+p*S+w*E+_*F,r[7]=M*g+p*A+w*Z+_*V,r[11]=M*b+p*k+w*T+_*R,r[15]=M*v+p*C+w*q+_*X,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],i=t[4],e=t[8],r=t[12],h=t[1],n=t[5],a=t[9],o=t[13],l=t[2],u=t[6],y=t[10],x=t[14],c=t[3],m=t[7],z=t[11],d=t[15],M=a*x-o*y,p=n*x-o*u,w=n*y-a*u,_=h*x-o*l,f=h*y-a*l,g=h*u-n*l;return s*(m*M-z*p+d*w)-i*(c*M-z*_+d*f)+e*(c*p-m*_+d*g)-r*(c*w-m*f+z*g)}determinantAffine(){const t=this.elements,s=t[0],i=t[4],e=t[8],r=t[1],h=t[5],n=t[9],a=t[2],o=t[6],l=t[10];return s*(h*l-n*o)-i*(r*l-n*a)+e*(r*o-h*a)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,i){const e=this.elements;return t.isVector3?(e[12]=t.x,e[13]=t.y,e[14]=t.z):(e[12]=t,e[13]=s,e[14]=i),this}invert(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8],u=t[9],y=t[10],x=t[11],c=t[12],m=t[13],z=t[14],d=t[15],M=s*n-i*h,p=s*a-e*h,w=s*o-r*h,_=i*a-e*n,f=i*o-r*n,g=e*o-r*a,b=l*m-u*c,v=l*z-y*c,S=l*d-x*c,A=u*z-y*m,k=u*d-x*m,C=y*d-x*z,E=M*C-p*k+w*A+_*S-f*v+g*b;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Z=1/E;return t[0]=(n*C-a*k+o*A)*Z,t[1]=(e*k-i*C-r*A)*Z,t[2]=(m*g-z*f+d*_)*Z,t[3]=(y*f-u*g-x*_)*Z,t[4]=(a*S-h*C-o*v)*Z,t[5]=(s*C-e*S+r*v)*Z,t[6]=(z*w-c*g-d*p)*Z,t[7]=(l*g-y*w+x*p)*Z,t[8]=(h*k-n*S+o*b)*Z,t[9]=(i*S-s*k-r*b)*Z,t[10]=(c*f-m*w+d*M)*Z,t[11]=(u*w-l*f-x*M)*Z,t[12]=(n*v-h*A-a*b)*Z,t[13]=(s*A-i*v+e*b)*Z,t[14]=(m*p-c*_-z*M)*Z,t[15]=(l*_-u*p+y*M)*Z,this}scale(t){const s=this.elements,i=t.x,e=t.y,r=t.z;return s[0]*=i,s[4]*=e,s[8]*=r,s[1]*=i,s[5]*=e,s[9]*=r,s[2]*=i,s[6]*=e,s[10]*=r,s[3]*=i,s[7]*=e,s[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],e=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,i,e))}makeTranslation(t,s,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,i,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,s,-i,0,0,i,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,0,i,0,0,1,0,0,-i,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,-i,0,0,i,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const i=Math.cos(s),e=Math.sin(s),r=1-i,h=t.x,n=t.y,a=t.z,o=r*h,l=r*n;return this.set(o*h+i,o*n-e*a,o*a+e*n,0,o*n+e*a,l*n+i,l*a-e*h,0,o*a-e*n,l*a+e*h,r*a*a+i,0,0,0,0,1),this}makeScale(t,s,i){return this.set(t,0,0,0,0,s,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,s,i,e,r,h){return this.set(1,i,r,0,t,1,h,0,s,e,1,0,0,0,0,1),this}compose(t,s,i){const e=this.elements,r=s._x,h=s._y,n=s._z,a=s._w,o=r+r,l=h+h,u=n+n,y=r*o,x=r*l,c=r*u,m=h*l,z=h*u,d=n*u,M=a*o,p=a*l,w=a*u,_=i.x,f=i.y,g=i.z;return e[0]=(1-(m+d))*_,e[1]=(x+w)*_,e[2]=(c-p)*_,e[3]=0,e[4]=(x-w)*f,e[5]=(1-(y+d))*f,e[6]=(z+M)*f,e[7]=0,e[8]=(c+p)*g,e[9]=(z-M)*g,e[10]=(1-(y+m))*g,e[11]=0,e[12]=t.x,e[13]=t.y,e[14]=t.z,e[15]=1,this}decompose(t,s,i){const e=this.elements;t.x=e[12],t.y=e[13],t.z=e[14];const r=this.determinantAffine();if(0===r)return i.set(1,1,1),s.identity(),this;let h=M.set(e[0],e[1],e[2]).length();const n=M.set(e[4],e[5],e[6]).length(),a=M.set(e[8],e[9],e[10]).length();r<0&&(h=-h),p.copy(this);const o=1/h,l=1/n,u=1/a;return p.elements[0]*=o,p.elements[1]*=o,p.elements[2]*=o,p.elements[4]*=l,p.elements[5]*=l,p.elements[6]*=l,p.elements[8]*=u,p.elements[9]*=u,p.elements[10]*=u,s.setFromRotationMatrix(p),i.x=h,i.y=n,i.z=a,this}makePerspective(s,i,e,r,h,n,a=2e3,o=!1){const l=this.elements,u=2*h/(i-s),y=2*h/(e-r),x=(i+s)/(i-s),c=(e+r)/(e-r);let m,z;if(o)m=h/(n-h),z=n*h/(n-h);else if(a===t)m=-(n+h)/(n-h),z=-2*n*h/(n-h);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);m=-n/(n-h),z=-n*h/(n-h)}return l[0]=u,l[4]=0,l[8]=x,l[12]=0,l[1]=0,l[5]=y,l[9]=c,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=z,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(s,i,e,r,h,n,a=2e3,o=!1){const l=this.elements,u=2/(i-s),y=2/(e-r),x=-(i+s)/(i-s),c=-(e+r)/(e-r);let m,z;if(o)m=1/(n-h),z=n/(n-h);else if(a===t)m=-2/(n-h),z=-(n+h)/(n-h);else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);m=-1/(n-h),z=-h/(n-h)}return l[0]=u,l[4]=0,l[8]=0,l[12]=x,l[1]=0,l[5]=y,l[9]=0,l[13]=c,l[2]=0,l[6]=0,l[10]=m,l[14]=z,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const s=this.elements,i=t.elements;for(let e=0;e<16;e++)if(s[e]!==i[e])return!1;return!0}fromArray(t,s=0){for(let i=0;i<16;i++)this.elements[i]=t[i+s];return this}toArray(t=[],s=0){const i=this.elements;return t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2],t[s+3]=i[3],t[s+4]=i[4],t[s+5]=i[5],t[s+6]=i[6],t[s+7]=i[7],t[s+8]=i[8],t[s+9]=i[9],t[s+10]=i[10],t[s+11]=i[11],t[s+12]=i[12],t[s+13]=i[13],t[s+14]=i[14],t[s+15]=i[15],t}};z.prototype.isMatrix4=!0;let d=z;const M=new o,p=new d,w=new o(0,0,0),_=new o(1,1,1),f=new o,g=new o,b=new o,v=class{constructor(t,s,i,e){this.elements=[1,0,0,1],void 0!==t&&this.set(t,s,i,e)}identity(){return this.set(1,0,0,1),this}fromArray(t,s=0){for(let i=0;i<4;i++)this.elements[i]=t[i+s];return this}set(t,s,i,e){const r=this.elements;return r[0]=t,r[2]=s,r[1]=i,r[3]=e,this}};v.prototype.isMatrix2=!0;"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}})),"undefined"!=typeof window&&(window.__THREE__?i("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186");(new x).set(-1,0,0,0,1,0,0,0,1);(new x).set(-1,0,0,0,1,0,0,0,1);const S=.0066943799901413165,A=-12e3,k=1e5,C=Math.PI/180;function E(t,s){if(!Number.isFinite(t))throw new TypeError(`${s} must be a finite number.`);return t}function Z(t,s,i="Geodetic position"){if(E(t,`${i} longitude`),E(s,`${i} latitude`),t<-180||t>180)throw new RangeError(`${i} longitude must be within [-180, 180] degrees.`);if(s<-90||s>90)throw new RangeError(`${i} latitude must be within [-90, 90] degrees.`)}function T(t,s,i){E(t,"Longitude"),E(s,"Latitude"),E(i,"Altitude");const e=s*C,r=t*C,h=Math.sin(e),n=90===Math.abs(s)?0:Math.cos(e),a=6378137/Math.sqrt(1-S*h**2);return[(a+i)*n*Math.cos(r),(a+i)*n*Math.sin(r),(.9933056200098587*a+i)*h]}function q(t,s,i=2){const e=t.length;let r=function(t,s,i,e,r){let h;if(r===function(t,s,i,e){let r=0;for(let h=s,n=i-e;h<i;h+=e)r+=(t[n]-t[h])*(t[h+1]+t[n+1]),n=h;return r}(t,s,i,e)>0)for(let n=s;n<i;n+=e)h=W(n/e|0,t[n],t[n+1],h);else for(let n=i-e;n>=s;n-=e)h=W(n/e|0,t[n],t[n+1],h);h&&H(h,h.next)&&($(h),h=h.next);return h}(t,0,e,i,!0);const h=[];if(!r||r.next===r.prev)return h;let n,a,o;if(t.length>80*i){n=1/0,a=1/0;let s=-1/0,r=-1/0;for(let h=i;h<e;h+=i){const i=t[h],e=t[h+1];i<n&&(n=i),e<a&&(a=e),i>s&&(s=i),e>r&&(r=e)}o=Math.max(s-n,r-a),o=0!==o?32767/o:0}return V(r,h,i,n,a,o,0),h}function F(t,s){if(!t)return t;s||(s=t);let i,e=t;do{if(i=!1,e.steiner||!H(e,e.next)&&0!==I(e.prev,e,e.next))e=e.next;else{if($(e),e=s=e.prev,e===e.next)break;i=!0}}while(i||e!==s);return s}function V(t,s,i,e,r,h,n){if(!t)return;!n&&h&&function(t,s,i,e){let r=t;do{0===r.z&&(r.z=O(r.x,r.y,s,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let s,i=1;do{let e,r=t;t=null;let h=null;for(s=0;r;){s++;let n=r,a=0;for(let t=0;t<i&&(a++,n=n.nextZ,n);t++);let o=i;for(;a>0||o>0&&n;)0!==a&&(0===o||!n||r.z<=n.z)?(e=r,r=r.nextZ,a--):(e=n,n=n.nextZ,o--),h?h.nextZ=e:t=e,e.prevZ=h,h=e;r=n}h.nextZ=null,i*=2}while(s>1)}(r)}(t,e,r,h);let a=t;for(;t.prev!==t.next;){const o=t.prev,l=t.next;if(h?X(t,e,r,h):R(t))s.push(o.i,t.i,l.i),$(t),t=l.next,a=l.next;else if((t=l)===a){n?1===n?V(t=Y(F(t),s),s,i,e,r,h,2):2===n&&L(t,s,i,e,r,h):V(F(t),s,i,e,r,h,1);break}}}function R(t){const s=t.prev,i=t,e=t.next;if(I(s,i,e)>=0)return!1;const r=s.x,h=i.x,n=e.x,a=s.y,o=i.y,l=e.y,u=Math.min(r,h,n),y=Math.min(a,o,l),x=Math.max(r,h,n),c=Math.max(a,o,l);let m=e.next;for(;m!==s;){if(m.x>=u&&m.x<=x&&m.y>=y&&m.y<=c&&P(r,a,h,o,n,l,m.x,m.y)&&I(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function X(t,s,i,e){const r=t.prev,h=t,n=t.next;if(I(r,h,n)>=0)return!1;const a=r.x,o=h.x,l=n.x,u=r.y,y=h.y,x=n.y,c=Math.min(a,o,l),m=Math.min(u,y,x),z=Math.max(a,o,l),d=Math.max(u,y,x),M=O(c,m,s,i,e),p=O(z,d,s,i,e);let w=t.prevZ,_=t.nextZ;for(;w&&w.z>=M&&_&&_.z<=p;){if(w.x>=c&&w.x<=z&&w.y>=m&&w.y<=d&&w!==r&&w!==n&&P(a,u,o,y,l,x,w.x,w.y)&&I(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,_.x>=c&&_.x<=z&&_.y>=m&&_.y<=d&&_!==r&&_!==n&&P(a,u,o,y,l,x,_.x,_.y)&&I(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;w&&w.z>=M;){if(w.x>=c&&w.x<=z&&w.y>=m&&w.y<=d&&w!==r&&w!==n&&P(a,u,o,y,l,x,w.x,w.y)&&I(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=p;){if(_.x>=c&&_.x<=z&&_.y>=m&&_.y<=d&&_!==r&&_!==n&&P(a,u,o,y,l,x,_.x,_.y)&&I(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Y(t,s){let i=t;do{const e=i.prev,r=i.next.next;!H(e,r)&&N(e,i,i.next,r)&&G(e,r)&&G(r,e)&&(s.push(e.i,i.i,r.i),$(i),$(i.next),i=t=r),i=i.next}while(i!==t);return F(i)}function L(t,s,i,e,r,h){let n=t;do{let t=n.next.next;for(;t!==n.prev;){if(n.i!==t.i&&B(n,t)){let a=U(n,t);return n=F(n,n.next),a=F(a,a.next),V(n,s,i,e,r,h,0),void V(a,s,i,e,r,h,0)}t=t.next}n=n.next}while(n!==t)}function O(t,s,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-e)*r|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function P(t,s,i,e,r,h,n,a){return!(t===n&&s===a)&&function(t,s,i,e,r,h,n,a){return(r-n)*(s-a)>=(t-n)*(h-a)&&(t-n)*(e-a)>=(i-n)*(s-a)&&(i-n)*(h-a)>=(r-n)*(e-a)}(t,s,i,e,r,h,n,a)}function B(t,s){return t.next.i!==s.i&&t.prev.i!==s.i&&!function(t,s){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==s.i&&i.next.i!==s.i&&N(i,i.next,t,s))return!0;i=i.next}while(i!==t);return!1}(t,s)&&(G(t,s)&&G(s,t)&&function(t,s){let i=t,e=!1;const r=(t.x+s.x)/2,h=(t.y+s.y)/2;do{i.y>h!=i.next.y>h&&i.next.y!==i.y&&r<(i.next.x-i.x)*(h-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,s)&&(I(t.prev,t,s.prev)||I(t,s.prev,s))||H(t,s)&&I(t.prev,t,t.next)>0&&I(s.prev,s,s.next)>0)}function I(t,s,i){return(s.y-t.y)*(i.x-s.x)-(s.x-t.x)*(i.y-s.y)}function H(t,s){return t.x===s.x&&t.y===s.y}function N(t,s,i,e){const r=j(I(t,s,i)),h=j(I(t,s,e)),n=j(I(i,e,t)),a=j(I(i,e,s));return r!==h&&n!==a||(!(0!==r||!Q(t,i,s))||(!(0!==h||!Q(t,e,s))||(!(0!==n||!Q(i,t,e))||!(0!==a||!Q(i,s,e)))))}function Q(t,s,i){return s.x<=Math.max(t.x,i.x)&&s.x>=Math.min(t.x,i.x)&&s.y<=Math.max(t.y,i.y)&&s.y>=Math.min(t.y,i.y)}function j(t){return t>0?1:t<0?-1:0}function G(t,s){return I(t.prev,t,t.next)<0?I(t,s,t.next)>=0&&I(t,t.prev,s)>=0:I(t,s,t.prev)<0||I(t,t.next,s)<0}function U(t,s){const i=D(t.i,t.x,t.y),e=D(s.i,s.x,s.y),r=t.next,h=s.prev;return t.next=s,s.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,h.next=e,e.prev=h,e}function W(t,s,i,e){const r=D(t,s,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function $(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function D(t,s,i){return{i:t,x:s,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const J=5e4;function K(t){return 255*(t=(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))}function tt(t,s){if(!Array.isArray(t)||t.length<3)throw new TypeError("Every GeoJSON position must contain longitude, latitude, and altitude.");!function(t,s,i,e="Geodetic position"){if(Z(t,s,e),E(i,`${e} altitude`),i<A||i>k)throw new RangeError(`${e} altitude must be within [-12000, 100000] WGS84 ellipsoidal meters.`)}(t[0],t[1],t[2],"GeoJSON position");const i=(new o).fromArray(T(t[0],t[1],t[2])).sub(s);if(i.length()>J)throw new RangeError("GeoJSON feature exceeds the 50000 meter local precision envelope.");return i}function st(t){for(let s=0;s<t.length;s+=3)if(Math.hypot(t[s],t[s+1],t[s+2])>J)throw new RangeError("GeoJSON feature exceeds the 50000 meter local precision envelope.");return new Float32Array(t)}function it(t){const{geometry:s}=t;if(!Array.isArray(null==s?void 0:s.coordinates)||2!==s.coordinates.length)throw new TypeError("Arrow geometry must contain exactly two positions.");const i=(new o).fromArray(T(...s.coordinates[0])),e=tt(s.coordinates[0],i),r=tt(s.coordinates[1],i),h=(new o).fromArray(function(t,s){Z(t,s,"ENU origin");const i=t*C,e=s*C,r=Math.sin(i),h=Math.cos(i),n=Math.sin(e),a=Math.cos(e);return{east:[-r,h,0],north:[-n*h,-n*r,a],up:[a*h,a*r,n]}}(s.coordinates[0][0],s.coordinates[0][1]).up),n=(new o).subVectors(r,e),a=n.length(),l=n.clone().normalize(),u=(new o).crossVectors(h,l).normalize().multiplyScalar(10),y=e.clone(),x=r.clone(),c=y.clone().add(l.clone().multiplyScalar(a*(1-100/a))),m=y.clone().add(u),z=y.clone().sub(u),d=c.clone().add(u.clone()),M=c.clone().sub(u.clone()),p=c.clone().add(u.clone().multiplyScalar(4)),w=c.clone().sub(u.clone().multiplyScalar(4)),_=x,f=st([...m.toArray(),...z.toArray(),...d.toArray(),...d.toArray(),...z.toArray(),...M.toArray(),...p.toArray(),...w.toArray(),..._.toArray()]);return{origin:i.toArray(),meshVertexBuffer:f}}self.addEventListener("message",(async t=>{const{type:s,data:i,color:e}=t.data;try{let t={};switch(s){case"arrow":t=it(i);break;case"perimeter":t=function(t,s){var i,e;const r=null==(e=null==(i=null==t?void 0:t.geometry)?void 0:i.coordinates)?void 0:e[0];if(!Array.isArray(r)||0===r.length)throw new TypeError("Perimeter geometry must contain a non-empty ring.");const h=(new o).fromArray(T(...r[0])),n=[(a=s)>>16&255,a>>8&255,255&a];var a;n[0]=K(n[0]),n[1]=K(n[1]),n[2]=K(n[2]);const l=q(r.flat(),0,r[0].length),u=[],y=[],x=[],c=[];for(let o=0;o<r.length;o++){const t=tt(r[o],h).toArray();u.push(...t),c.push(...n),x.push(...t),y.push(...n),o>0&&(x.push(...t),y.push(...n))}return{origin:h.toArray(),lineVertexBuffer:st(x),lineVertexRGBBuffer:new Uint8Array(y),meshVertexBuffer:st(u),meshVertexRGBBuffer:new Uint8Array(c),meshIndexBuffer:new Uint16Array(l.flat())}}(i,e);break;default:throw new TypeError(`Unsupported GeoJSON feature type: ${String(s)}.`)}self.postMessage({success:!0,code:0,...t})}catch(r){self.postMessage({success:!1,code:1,error:{name:r instanceof Error?r.name:"Error",message:r instanceof Error?r.message:String(r)}})}}))}();
|
|
Binary file
|
|
@@ -197,6 +197,29 @@
|
|
|
197
197
|
bhatt_lod(lod_base) {
|
|
198
198
|
wasm.gsplatarray_bhatt_lod(this.__wbg_ptr, lod_base);
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* @param {GsplatArray} other
|
|
202
|
+
*/
|
|
203
|
+
concat(other) {
|
|
204
|
+
_assertClass(other, GsplatArray);
|
|
205
|
+
const ret = wasm.gsplatarray_concat(this.__wbg_ptr, other.__wbg_ptr);
|
|
206
|
+
if (ret[1]) {
|
|
207
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @param {number} max_sh
|
|
212
|
+
* @param {number} fractional_bits
|
|
213
|
+
* @returns {Uint8Array}
|
|
214
|
+
*/
|
|
215
|
+
encode_to_spz(max_sh, fractional_bits) {
|
|
216
|
+
const ptr = this.__destroy_into_raw();
|
|
217
|
+
const ret = wasm.gsplatarray_encode_to_spz(ptr, max_sh, fractional_bits);
|
|
218
|
+
if (ret[2]) {
|
|
219
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
220
|
+
}
|
|
221
|
+
return takeFromExternrefTable0(ret[0]);
|
|
222
|
+
}
|
|
200
223
|
/**
|
|
201
224
|
* @returns {boolean}
|
|
202
225
|
*/
|
|
@@ -266,6 +289,15 @@
|
|
|
266
289
|
}
|
|
267
290
|
return takeFromExternrefTable0(ret[0]);
|
|
268
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* @param {any} transform
|
|
294
|
+
*/
|
|
295
|
+
transform(transform) {
|
|
296
|
+
const ret = wasm.gsplatarray_transform(this.__wbg_ptr, transform);
|
|
297
|
+
if (ret[1]) {
|
|
298
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
269
301
|
/**
|
|
270
302
|
* @param {number} arg0
|
|
271
303
|
*/
|
|
@@ -341,6 +373,29 @@
|
|
|
341
373
|
function dispose_lod_tree(lod_id) {
|
|
342
374
|
wasm.dispose_lod_tree(lod_id);
|
|
343
375
|
}
|
|
376
|
+
function dynamic_traverse_lod_trees(max_splats, pixel_scale_limit, _last_pixel_limit, lod_ids, root_pages, view_to_objects, lod_scales, behind_foveates, cone_foveates, cone_fov0s, cone_fovs) {
|
|
377
|
+
const ptr0 = passArray32ToWasm0(lod_ids, wasm.__wbindgen_malloc);
|
|
378
|
+
const len0 = WASM_VECTOR_LEN;
|
|
379
|
+
const ptr1 = passArray32ToWasm0(root_pages, wasm.__wbindgen_malloc);
|
|
380
|
+
const len1 = WASM_VECTOR_LEN;
|
|
381
|
+
const ptr2 = passArrayF32ToWasm0(view_to_objects, wasm.__wbindgen_malloc);
|
|
382
|
+
const len2 = WASM_VECTOR_LEN;
|
|
383
|
+
const ptr3 = passArrayF32ToWasm0(lod_scales, wasm.__wbindgen_malloc);
|
|
384
|
+
const len3 = WASM_VECTOR_LEN;
|
|
385
|
+
const ptr4 = passArrayF32ToWasm0(behind_foveates, wasm.__wbindgen_malloc);
|
|
386
|
+
const len4 = WASM_VECTOR_LEN;
|
|
387
|
+
const ptr5 = passArrayF32ToWasm0(cone_foveates, wasm.__wbindgen_malloc);
|
|
388
|
+
const len5 = WASM_VECTOR_LEN;
|
|
389
|
+
const ptr6 = passArrayF32ToWasm0(cone_fov0s, wasm.__wbindgen_malloc);
|
|
390
|
+
const len6 = WASM_VECTOR_LEN;
|
|
391
|
+
const ptr7 = passArrayF32ToWasm0(cone_fovs, wasm.__wbindgen_malloc);
|
|
392
|
+
const len7 = WASM_VECTOR_LEN;
|
|
393
|
+
const ret = wasm.dynamic_traverse_lod_trees(max_splats, pixel_scale_limit, isLikeNone(_last_pixel_limit) ? 4294967297 : Math.fround(_last_pixel_limit), ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
|
|
394
|
+
if (ret[2]) {
|
|
395
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
396
|
+
}
|
|
397
|
+
return takeFromExternrefTable0(ret[0]);
|
|
398
|
+
}
|
|
344
399
|
function get_lod_tree_level(lod_id, level) {
|
|
345
400
|
const ret = wasm.get_lod_tree_level(lod_id, level);
|
|
346
401
|
if (ret[2]) {
|
|
@@ -456,6 +511,10 @@
|
|
|
456
511
|
const ret = !arg0;
|
|
457
512
|
return ret;
|
|
458
513
|
},
|
|
514
|
+
__wbg___wbindgen_is_function_49868bde5eb1e745: function(arg0) {
|
|
515
|
+
const ret = typeof arg0 === "function";
|
|
516
|
+
return ret;
|
|
517
|
+
},
|
|
459
518
|
__wbg___wbindgen_is_object_40c5a80572e8f9d3: function(arg0) {
|
|
460
519
|
const val = arg0;
|
|
461
520
|
const ret = typeof val === "object" && val !== null;
|
|
@@ -486,10 +545,20 @@
|
|
|
486
545
|
__wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
|
|
487
546
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
488
547
|
},
|
|
548
|
+
__wbg_call_7f2987183bb62793: function() {
|
|
549
|
+
return handleError(function(arg0, arg1) {
|
|
550
|
+
const ret = arg0.call(arg1);
|
|
551
|
+
return ret;
|
|
552
|
+
}, arguments);
|
|
553
|
+
},
|
|
489
554
|
__wbg_csplatarray_new: function(arg0) {
|
|
490
555
|
const ret = CsplatArray.__wrap(arg0);
|
|
491
556
|
return ret;
|
|
492
557
|
},
|
|
558
|
+
__wbg_done_547d467e97529006: function(arg0) {
|
|
559
|
+
const ret = arg0.done;
|
|
560
|
+
return ret;
|
|
561
|
+
},
|
|
493
562
|
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
494
563
|
let deferred0_0;
|
|
495
564
|
let deferred0_1;
|
|
@@ -505,6 +574,12 @@
|
|
|
505
574
|
const ret = arg0[arg1 >>> 0];
|
|
506
575
|
return ret;
|
|
507
576
|
},
|
|
577
|
+
__wbg_get_ed0642c4b9d31ddf: function() {
|
|
578
|
+
return handleError(function(arg0, arg1) {
|
|
579
|
+
const ret = Reflect.get(arg0, arg1);
|
|
580
|
+
return ret;
|
|
581
|
+
}, arguments);
|
|
582
|
+
},
|
|
508
583
|
__wbg_get_f96702c6245e4ef9: function() {
|
|
509
584
|
return handleError(function(arg0, arg1) {
|
|
510
585
|
const ret = Reflect.get(arg0, arg1);
|
|
@@ -543,6 +618,14 @@
|
|
|
543
618
|
const ret = result;
|
|
544
619
|
return ret;
|
|
545
620
|
},
|
|
621
|
+
__wbg_isArray_db61795ad004c139: function(arg0) {
|
|
622
|
+
const ret = Array.isArray(arg0);
|
|
623
|
+
return ret;
|
|
624
|
+
},
|
|
625
|
+
__wbg_iterator_de403ef31815a3e6: function() {
|
|
626
|
+
const ret = Symbol.iterator;
|
|
627
|
+
return ret;
|
|
628
|
+
},
|
|
546
629
|
__wbg_length_0c32cb8543c8e4c8: function(arg0) {
|
|
547
630
|
const ret = arg0.length;
|
|
548
631
|
return ret;
|
|
@@ -559,6 +642,10 @@
|
|
|
559
642
|
const ret = arg0.length;
|
|
560
643
|
return ret;
|
|
561
644
|
},
|
|
645
|
+
__wbg_length_fd4646b401926788: function(arg0) {
|
|
646
|
+
const ret = arg0.length;
|
|
647
|
+
return ret;
|
|
648
|
+
},
|
|
562
649
|
__wbg_new_227d7c05414eb861: function() {
|
|
563
650
|
const ret = new Error();
|
|
564
651
|
return ret;
|
|
@@ -575,10 +662,28 @@
|
|
|
575
662
|
const ret = new Array();
|
|
576
663
|
return ret;
|
|
577
664
|
},
|
|
665
|
+
__wbg_new_from_slice_2580ff33d0d10520: function(arg0, arg1) {
|
|
666
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
667
|
+
return ret;
|
|
668
|
+
},
|
|
669
|
+
__wbg_new_with_length_26bffbe236bf73f9: function(arg0) {
|
|
670
|
+
const ret = new Float32Array(arg0 >>> 0);
|
|
671
|
+
return ret;
|
|
672
|
+
},
|
|
578
673
|
__wbg_new_with_length_41a22191b9bdfd66: function(arg0) {
|
|
579
674
|
const ret = new Uint32Array(arg0 >>> 0);
|
|
580
675
|
return ret;
|
|
581
676
|
},
|
|
677
|
+
__wbg_next_01132ed6134b8ef5: function(arg0) {
|
|
678
|
+
const ret = arg0.next;
|
|
679
|
+
return ret;
|
|
680
|
+
},
|
|
681
|
+
__wbg_next_b3713ec761a9dbfd: function() {
|
|
682
|
+
return handleError(function(arg0) {
|
|
683
|
+
const ret = arg0.next();
|
|
684
|
+
return ret;
|
|
685
|
+
}, arguments);
|
|
686
|
+
},
|
|
582
687
|
__wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
|
|
583
688
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
584
689
|
},
|
|
@@ -598,6 +703,9 @@
|
|
|
598
703
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
599
704
|
arg0[arg1] = arg2;
|
|
600
705
|
},
|
|
706
|
+
__wbg_set_6c60b2e8ad0e9383: function(arg0, arg1, arg2) {
|
|
707
|
+
arg0[arg1 >>> 0] = arg2;
|
|
708
|
+
},
|
|
601
709
|
__wbg_set_81b4174352e6a095: function(arg0, arg1, arg2) {
|
|
602
710
|
arg0.set(arg1, arg2 >>> 0);
|
|
603
711
|
},
|
|
@@ -607,6 +715,9 @@
|
|
|
607
715
|
return ret;
|
|
608
716
|
}, arguments);
|
|
609
717
|
},
|
|
718
|
+
__wbg_set_a98c8da6557e63de: function(arg0, arg1, arg2) {
|
|
719
|
+
arg0.set(getArrayF32FromWasm0(arg1, arg2));
|
|
720
|
+
},
|
|
610
721
|
__wbg_set_index_338a66e40fc45dee: function(arg0, arg1, arg2) {
|
|
611
722
|
arg0[arg1 >>> 0] = arg2 >>> 0;
|
|
612
723
|
},
|
|
@@ -629,14 +740,30 @@
|
|
|
629
740
|
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
630
741
|
return ret;
|
|
631
742
|
},
|
|
743
|
+
__wbg_value_7f6052747ccf940f: function(arg0) {
|
|
744
|
+
const ret = arg0.value;
|
|
745
|
+
return ret;
|
|
746
|
+
},
|
|
632
747
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
633
748
|
const ret = arg0;
|
|
634
749
|
return ret;
|
|
635
750
|
},
|
|
636
751
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
752
|
+
const ret = getArrayF32FromWasm0(arg0, arg1);
|
|
753
|
+
return ret;
|
|
754
|
+
},
|
|
755
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
756
|
+
const ret = getArrayU32FromWasm0(arg0, arg1);
|
|
757
|
+
return ret;
|
|
758
|
+
},
|
|
759
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
637
760
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
638
761
|
return ret;
|
|
639
762
|
},
|
|
763
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
764
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
765
|
+
return ret;
|
|
766
|
+
},
|
|
640
767
|
__wbindgen_init_externref_table: function() {
|
|
641
768
|
const table = wasm.__wbindgen_externrefs;
|
|
642
769
|
const offset = table.grow(4);
|
|
@@ -649,7 +776,7 @@
|
|
|
649
776
|
};
|
|
650
777
|
return {
|
|
651
778
|
__proto__: null,
|
|
652
|
-
"./
|
|
779
|
+
"./spark_rs_bg.js": import0
|
|
653
780
|
};
|
|
654
781
|
}
|
|
655
782
|
const ChunkDecoderFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
@@ -666,6 +793,11 @@
|
|
|
666
793
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
667
794
|
return idx;
|
|
668
795
|
}
|
|
796
|
+
function _assertClass(instance, klass) {
|
|
797
|
+
if (!(instance instanceof klass)) {
|
|
798
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
669
801
|
function debugString(val) {
|
|
670
802
|
const type = typeof val;
|
|
671
803
|
if (type == "number" || type == "boolean" || val == null) {
|
|
@@ -722,6 +854,10 @@ ${val.stack}`;
|
|
|
722
854
|
}
|
|
723
855
|
return className;
|
|
724
856
|
}
|
|
857
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
858
|
+
ptr = ptr >>> 0;
|
|
859
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
860
|
+
}
|
|
725
861
|
function getArrayU16FromWasm0(ptr, len) {
|
|
726
862
|
ptr = ptr >>> 0;
|
|
727
863
|
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
@@ -910,9 +1046,6 @@ ${val.stack}`;
|
|
|
910
1046
|
console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
911
1047
|
}
|
|
912
1048
|
}
|
|
913
|
-
if (module_or_path === void 0) {
|
|
914
|
-
module_or_path = new URL(self.location.href).searchParams.get("wasm");
|
|
915
|
-
}
|
|
916
1049
|
const imports = __wbg_get_imports();
|
|
917
1050
|
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
|
|
918
1051
|
module_or_path = fetch(module_or_path);
|
|
@@ -988,13 +1121,16 @@ ${val.stack}`;
|
|
|
988
1121
|
chunkedLength,
|
|
989
1122
|
sendStatus
|
|
990
1123
|
}) {
|
|
1124
|
+
let readStream;
|
|
1125
|
+
let streamLength = 0;
|
|
991
1126
|
if (fileBytes) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
}
|
|
1127
|
+
readStream = new ReadableStream({
|
|
1128
|
+
start(controller) {
|
|
1129
|
+
controller.enqueue(fileBytes);
|
|
1130
|
+
controller.close();
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
streamLength = fileBytes.length;
|
|
998
1134
|
} else if (url) {
|
|
999
1135
|
const request = new Request(url, {
|
|
1000
1136
|
headers: requestHeader ? new Headers(requestHeader) : void 0,
|
|
@@ -1006,44 +1142,49 @@ ${val.stack}`;
|
|
|
1006
1142
|
`Failed to fetch "${url}": ${response.status} ${response.statusText}`
|
|
1007
1143
|
);
|
|
1008
1144
|
}
|
|
1009
|
-
|
|
1145
|
+
readStream = response.body;
|
|
1010
1146
|
const contentLength = Number.parseInt(
|
|
1011
1147
|
response.headers.get("Content-Length") || "0"
|
|
1012
1148
|
);
|
|
1013
|
-
|
|
1014
|
-
let loaded = 0;
|
|
1015
|
-
while (true) {
|
|
1016
|
-
const { done, value } = await readStream.read();
|
|
1017
|
-
if (done) {
|
|
1018
|
-
readStream.releaseLock();
|
|
1019
|
-
break;
|
|
1020
|
-
}
|
|
1021
|
-
loaded += value.length;
|
|
1022
|
-
sendStatus({ loaded, total });
|
|
1023
|
-
decoder.push(value);
|
|
1024
|
-
}
|
|
1149
|
+
streamLength = Number.isNaN(contentLength) ? 0 : contentLength;
|
|
1025
1150
|
} else if (chunked) {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1151
|
+
readStream = new ReadableStream({
|
|
1152
|
+
async start(controller) {
|
|
1153
|
+
async function readNext() {
|
|
1154
|
+
const readNextChunk = new Promise((resolve) => {
|
|
1155
|
+
nextChunkWaiter = resolve;
|
|
1156
|
+
});
|
|
1157
|
+
sendStatus({ nextChunk: true });
|
|
1158
|
+
const nextChunk2 = await readNextChunk;
|
|
1159
|
+
if (nextChunk2.length === 0) {
|
|
1160
|
+
controller.close();
|
|
1161
|
+
return true;
|
|
1162
|
+
}
|
|
1163
|
+
controller.enqueue(nextChunk2);
|
|
1164
|
+
return false;
|
|
1165
|
+
}
|
|
1166
|
+
let final;
|
|
1167
|
+
do {
|
|
1168
|
+
final = await readNext();
|
|
1169
|
+
} while (!final);
|
|
1036
1170
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
sendStatus({ progress: { loaded, total } });
|
|
1040
|
-
}
|
|
1041
|
-
if (total === 0) {
|
|
1042
|
-
sendStatus({ progress: { loaded, total: loaded } });
|
|
1043
|
-
}
|
|
1171
|
+
});
|
|
1172
|
+
streamLength = chunkedLength ?? 0;
|
|
1044
1173
|
} else {
|
|
1045
1174
|
throw new Error("No url or fileBytes provided");
|
|
1046
1175
|
}
|
|
1176
|
+
const reader = readStream.getReader();
|
|
1177
|
+
let loaded = 0;
|
|
1178
|
+
while (true) {
|
|
1179
|
+
const { done, value } = await reader.read();
|
|
1180
|
+
if (done) {
|
|
1181
|
+
reader.releaseLock();
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
loaded += value.length;
|
|
1185
|
+
sendStatus({ loaded, total: streamLength });
|
|
1186
|
+
decoder.push(value);
|
|
1187
|
+
}
|
|
1047
1188
|
const decoded = decoder.finish();
|
|
1048
1189
|
return decoded;
|
|
1049
1190
|
}
|
|
@@ -1406,7 +1547,8 @@ ${val.stack}`;
|
|
|
1406
1547
|
maxSplats,
|
|
1407
1548
|
pixelScaleLimit,
|
|
1408
1549
|
lastPixelLimit,
|
|
1409
|
-
instances
|
|
1550
|
+
instances,
|
|
1551
|
+
traverseMode
|
|
1410
1552
|
}) {
|
|
1411
1553
|
const keyInstances = Object.entries(instances);
|
|
1412
1554
|
const lodIds = new Uint32Array(
|
|
@@ -1438,7 +1580,8 @@ ${val.stack}`;
|
|
|
1438
1580
|
const coneFoveates = new Float32Array(
|
|
1439
1581
|
keyInstances.map(([_key, instance]) => instance.coneFoveate)
|
|
1440
1582
|
);
|
|
1441
|
-
const
|
|
1583
|
+
const lodFunction = traverseMode === "dynamic" ? dynamic_traverse_lod_trees : traverse_lod_trees;
|
|
1584
|
+
const result = lodFunction(
|
|
1442
1585
|
maxSplats,
|
|
1443
1586
|
pixelScaleLimit,
|
|
1444
1587
|
lastPixelLimit,
|
|
@@ -1497,12 +1640,20 @@ ${val.stack}`;
|
|
|
1497
1640
|
return buffers;
|
|
1498
1641
|
}
|
|
1499
1642
|
async function initialize() {
|
|
1643
|
+
let resolveWaitForModule;
|
|
1644
|
+
const waitForModule = new Promise((resolve) => {
|
|
1645
|
+
resolveWaitForModule = resolve;
|
|
1646
|
+
});
|
|
1500
1647
|
const pending = [];
|
|
1501
1648
|
const bufferMessage = (event) => {
|
|
1649
|
+
if (event.data.name === "init-wasm") {
|
|
1650
|
+
resolveWaitForModule(event.data.module);
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1502
1653
|
pending.push(event);
|
|
1503
1654
|
};
|
|
1504
1655
|
self.addEventListener("message", bufferMessage);
|
|
1505
|
-
await __wbg_init();
|
|
1656
|
+
await __wbg_init({ module_or_path: await waitForModule });
|
|
1506
1657
|
self.removeEventListener("message", bufferMessage);
|
|
1507
1658
|
self.addEventListener("message", onMessage);
|
|
1508
1659
|
for (const event of pending) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./index-
|
|
1
|
+
"use strict";const e=require("./index-D87IZDc6.cjs");module.exports=e.computeElevation;
|