// Version 1.29.4 three-render-objects - https://github.com/vasturiano/three-render-objects !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("three")):"function"==typeof define&&define.amd?define(["three"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).ThreeRenderObjects=t(e.THREE)}(this,(function(e){"use strict";function t(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(r.object.isPerspectiveCamera?E.multiplyScalar(t):r.object.isOrthographicCamera?(r.object.zoom=e.MathUtils.clamp(r.object.zoom/t,r.minZoom,r.maxZoom),m!==r.object.zoom&&r.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),r.staticMoving?j.copy(x):j.y+=(x.y-j.y)*this.dynamicDampingFactor)},this.panCamera=function(){const t=new e.Vector2,n=new e.Vector3,o=new e.Vector3;return function(){if(t.copy(C).sub(P),t.lengthSq()){if(r.object.isOrthographicCamera){const e=(r.object.right-r.object.left)/r.object.zoom/r.domElement.clientWidth,n=(r.object.top-r.object.bottom)/r.object.zoom/r.domElement.clientWidth;t.x*=e,t.y*=n}t.multiplyScalar(E.length()*r.panSpeed),o.copy(E).cross(r.object.up).setLength(t.x),o.add(n.copy(r.object.up).setLength(t.y)),r.object.position.add(o),r.target.add(o),r.staticMoving?P.copy(C):P.add(t.subVectors(C,P).multiplyScalar(r.dynamicDampingFactor))}}}(),this.checkDistances=function(){r.noZoom&&r.noPan||(E.lengthSq()>r.maxDistance*r.maxDistance&&(r.object.position.addVectors(r.target,E.setLength(r.maxDistance)),j.copy(x)),E.lengthSq()d&&(r.dispatchEvent(a),f.copy(r.object.position))):r.object.isOrthographicCamera?(r.object.lookAt(r.target),(f.distanceToSquared(r.object.position)>d||m!==r.object.zoom)&&(r.dispatchEvent(a),f.copy(r.object.position),m=r.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")},this.reset=function(){g=o,b=o,r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.up.copy(r.up0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),E.subVectors(r.object.position,r.target),r.object.lookAt(r.target),r.dispatchEvent(a),f.copy(r.object.position),m=r.object.zoom},this.dispose=function(){r.domElement.removeEventListener("contextmenu",U),r.domElement.removeEventListener("pointerdown",L),r.domElement.removeEventListener("pointercancel",D),r.domElement.removeEventListener("wheel",F),r.domElement.removeEventListener("pointermove",I),r.domElement.removeEventListener("pointerup",A),window.removeEventListener("keydown",z),window.removeEventListener("keyup",V)},this.domElement.addEventListener("contextmenu",U),this.domElement.addEventListener("pointerdown",L),this.domElement.addEventListener("pointercancel",D),this.domElement.addEventListener("wheel",F,{passive:!1}),window.addEventListener("keydown",z),window.addEventListener("keyup",V),this.handleResize(),this.update()}}const u={type:"change"},h={type:"start"},p={type:"end"},d=new e.Ray,f=new e.Plane,m=Math.cos(70*e.MathUtils.DEG2RAD);class g extends e.EventDispatcher{constructor(t,n){super(),this.object=t,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new e.Vector3,this.cursor=new e.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",ne),this._domElementKeyEvents=e},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",ne),this._domElementKeyEvents=null},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(u),r.update(),i=o.NONE},this.update=function(){const n=new e.Vector3,h=(new e.Quaternion).setFromUnitVectors(t.up,new e.Vector3(0,1,0)),p=h.clone().invert(),b=new e.Vector3,v=new e.Quaternion,y=new e.Vector3,w=2*Math.PI;return function(E=null){const S=r.object.position;n.copy(S).sub(r.target),n.applyQuaternion(h),s.setFromVector3(n),r.autoRotate&&i===o.NONE&&L(function(e){return null!==e?2*Math.PI/60*r.autoRotateSpeed*e:2*Math.PI/60/60*r.autoRotateSpeed}(E)),r.enableDamping?(s.theta+=c.theta*r.dampingFactor,s.phi+=c.phi*r.dampingFactor):(s.theta+=c.theta,s.phi+=c.phi);let _=r.minAzimuthAngle,k=r.maxAzimuthAngle;isFinite(_)&&isFinite(k)&&(_<-Math.PI?_+=w:_>Math.PI&&(_-=w),k<-Math.PI?k+=w:k>Math.PI&&(k-=w),s.theta=_<=k?Math.max(_,Math.min(k,s.theta)):s.theta>(_+k)/2?Math.max(_,s.theta):Math.min(k,s.theta)),s.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,s.phi)),s.makeSafe(),!0===r.enableDamping?r.target.addScaledVector(g,r.dampingFactor):r.target.add(g),r.target.sub(r.cursor),r.target.clampLength(r.minTargetRadius,r.maxTargetRadius),r.target.add(r.cursor);let j=!1;if(r.zoomToCursor&&C||r.object.isOrthographicCamera)s.radius=N(s.radius);else{const e=s.radius;s.radius=N(s.radius*l),j=e!=s.radius}if(n.setFromSpherical(s),n.applyQuaternion(p),S.copy(r.target).add(n),r.object.lookAt(r.target),!0===r.enableDamping?(c.theta*=1-r.dampingFactor,c.phi*=1-r.dampingFactor,g.multiplyScalar(1-r.dampingFactor)):(c.set(0,0,0),g.set(0,0,0)),r.zoomToCursor&&C){let o=null;if(r.object.isPerspectiveCamera){const e=n.length();o=N(e*l);const t=e-o;r.object.position.addScaledVector(x,t),r.object.updateMatrixWorld(),j=!!t}else if(r.object.isOrthographicCamera){const t=new e.Vector3(P.x,P.y,0);t.unproject(r.object);const i=r.object.zoom;r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/l)),r.object.updateProjectionMatrix(),j=i!==r.object.zoom;const a=new e.Vector3(P.x,P.y,0);a.unproject(r.object),r.object.position.sub(a).add(t),r.object.updateMatrixWorld(),o=n.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;null!==o&&(this.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(o).add(r.object.position):(d.origin.copy(r.object.position),d.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(d.direction))a||8*(1-v.dot(r.object.quaternion))>a||y.distanceToSquared(r.target)>a)&&(r.dispatchEvent(u),b.copy(r.object.position),v.copy(r.object.quaternion),y.copy(r.target),!0)}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",oe),r.domElement.removeEventListener("pointerdown",G),r.domElement.removeEventListener("pointercancel",$),r.domElement.removeEventListener("wheel",J),r.domElement.removeEventListener("pointermove",W),r.domElement.removeEventListener("pointerup",$);r.domElement.getRootNode().removeEventListener("keydown",ee,{capture:!0}),null!==r._domElementKeyEvents&&(r._domElementKeyEvents.removeEventListener("keydown",ne),r._domElementKeyEvents=null)};const r=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=o.NONE;const a=1e-6,s=new e.Spherical,c=new e.Spherical;let l=1;const g=new e.Vector3,b=new e.Vector2,v=new e.Vector2,y=new e.Vector2,w=new e.Vector2,E=new e.Vector2,S=new e.Vector2,_=new e.Vector2,k=new e.Vector2,j=new e.Vector2,x=new e.Vector3,P=new e.Vector2;let C=!1;const T=[],O={};let M=!1;function R(e){const t=Math.abs(.01*e);return Math.pow(.95,r.zoomSpeed*t)}function L(e){c.theta-=e}function I(e){c.phi-=e}const A=function(){const t=new e.Vector3;return function(e,n){t.setFromMatrixColumn(n,0),t.multiplyScalar(-e),g.add(t)}}(),D=function(){const t=new e.Vector3;return function(e,n){!0===r.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(r.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),z=function(){const t=new e.Vector3;return function(e,n){const o=r.domElement;if(r.object.isPerspectiveCamera){const i=r.object.position;t.copy(i).sub(r.target);let a=t.length();a*=Math.tan(r.object.fov/2*Math.PI/180),A(2*e*a/o.clientHeight,r.object.matrix),D(2*n*a/o.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(A(e*(r.object.right-r.object.left)/r.object.zoom/o.clientWidth,r.object.matrix),D(n*(r.object.top-r.object.bottom)/r.object.zoom/o.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function V(e){r.object.isPerspectiveCamera||r.object.isOrthographicCamera?l/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function F(e){r.object.isPerspectiveCamera||r.object.isOrthographicCamera?l*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(e,t){if(!r.zoomToCursor)return;C=!0;const n=r.domElement.getBoundingClientRect(),o=e-n.left,i=t-n.top,a=n.width,s=n.height;P.x=o/a*2-1,P.y=-i/s*2+1,x.set(P.x,P.y,1).unproject(r.object).sub(r.object.position).normalize()}function N(e){return Math.max(r.minDistance,Math.min(r.maxDistance,e))}function Y(e){b.set(e.clientX,e.clientY)}function B(e){w.set(e.clientX,e.clientY)}function H(e){if(1===T.length)b.set(e.pageX,e.pageY);else{const t=ae(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);b.set(n,r)}}function K(e){if(1===T.length)w.set(e.pageX,e.pageY);else{const t=ae(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);w.set(n,r)}}function X(e){const t=ae(e),n=e.pageX-t.x,r=e.pageY-t.y,o=Math.sqrt(n*n+r*r);_.set(0,o)}function q(e){if(1==T.length)v.set(e.pageX,e.pageY);else{const t=ae(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);v.set(n,r)}y.subVectors(v,b).multiplyScalar(r.rotateSpeed);const t=r.domElement;L(2*Math.PI*y.x/t.clientHeight),I(2*Math.PI*y.y/t.clientHeight),b.copy(v)}function Z(e){if(1===T.length)E.set(e.pageX,e.pageY);else{const t=ae(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);E.set(n,r)}S.subVectors(E,w).multiplyScalar(r.panSpeed),z(S.x,S.y),w.copy(E)}function Q(e){const t=ae(e),n=e.pageX-t.x,o=e.pageY-t.y,i=Math.sqrt(n*n+o*o);k.set(0,i),j.set(0,Math.pow(k.y/_.y,r.zoomSpeed)),V(j.y),_.copy(k);U(.5*(e.pageX+t.x),.5*(e.pageY+t.y))}function G(t){!1!==r.enabled&&(0===T.length&&(r.domElement.setPointerCapture(t.pointerId),r.domElement.addEventListener("pointermove",W),r.domElement.addEventListener("pointerup",$)),function(e){for(let t=0;t0?V(R(j.y)):j.y<0&&F(R(j.y)),_.copy(k),r.update()}(e);break;case o.PAN:if(!1===r.enablePan)return;!function(e){E.set(e.clientX,e.clientY),S.subVectors(E,w).multiplyScalar(r.panSpeed),z(S.x,S.y),w.copy(E),r.update()}(e)}}(e))}function $(e){switch(function(e){delete O[e.pointerId];for(let t=0;t0&&V(R(e.deltaY)),r.update()}(function(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}e.ctrlKey&&!M&&(n.deltaY*=10);return n}(e)),r.dispatchEvent(p))}function ee(e){if("Control"===e.key){M=!0;r.domElement.getRootNode().addEventListener("keyup",te,{passive:!0,capture:!0})}}function te(e){if("Control"===e.key){M=!1;r.domElement.getRootNode().removeEventListener("keyup",te,{passive:!0,capture:!0})}}function ne(e){!1!==r.enabled&&!1!==r.enablePan&&function(e){let t=!1;switch(e.code){case r.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?I(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):z(0,r.keyPanSpeed),t=!0;break;case r.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?I(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):z(0,-r.keyPanSpeed),t=!0;break;case r.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?L(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):z(r.keyPanSpeed,0),t=!0;break;case r.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?L(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):z(-r.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),r.update())}(e)}function re(t){switch(ie(t),T.length){case 1:switch(r.touches.ONE){case e.TOUCH.ROTATE:if(!1===r.enableRotate)return;H(t),i=o.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===r.enablePan)return;K(t),i=o.TOUCH_PAN;break;default:i=o.NONE}break;case 2:switch(r.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===r.enableZoom&&!1===r.enablePan)return;!function(e){r.enableZoom&&X(e),r.enablePan&&K(e)}(t),i=o.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===r.enableZoom&&!1===r.enableRotate)return;!function(e){r.enableZoom&&X(e),r.enableRotate&&H(e)}(t),i=o.TOUCH_DOLLY_ROTATE;break;default:i=o.NONE}break;default:i=o.NONE}i!==o.NONE&&r.dispatchEvent(h)}function oe(e){!1!==r.enabled&&e.preventDefault()}function ie(t){let n=O[t.pointerId];void 0===n&&(n=new e.Vector2,O[t.pointerId]=n),n.set(t.pageX,t.pageY)}function ae(e){const t=e.pointerId===T[0]?T[1]:T[0];return O[t]}r.domElement.addEventListener("contextmenu",oe),r.domElement.addEventListener("pointerdown",G),r.domElement.addEventListener("pointercancel",$),r.domElement.addEventListener("wheel",J,{passive:!1});r.domElement.getRootNode().addEventListener("keydown",ee,{passive:!0,capture:!0}),this.update()}}const b={type:"change"};class v extends e.EventDispatcher{constructor(t,n){super(),this.object=t,this.domElement=n,this.enabled=!0,this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1;const r=this,o=1e-6,i=new e.Quaternion,a=new e.Vector3;this.tmpQuaternion=new e.Quaternion,this.status=0,this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this.moveVector=new e.Vector3(0,0,0),this.rotationVector=new e.Vector3(0,0,0),this.keydown=function(e){if(!e.altKey&&!1!==this.enabled){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this.moveState.forward=1;break;case"KeyS":this.moveState.back=1;break;case"KeyA":this.moveState.left=1;break;case"KeyD":this.moveState.right=1;break;case"KeyR":this.moveState.up=1;break;case"KeyF":this.moveState.down=1;break;case"ArrowUp":this.moveState.pitchUp=1;break;case"ArrowDown":this.moveState.pitchDown=1;break;case"ArrowLeft":this.moveState.yawLeft=1;break;case"ArrowRight":this.moveState.yawRight=1;break;case"KeyQ":this.moveState.rollLeft=1;break;case"KeyE":this.moveState.rollRight=1}this.updateMovementVector(),this.updateRotationVector()}},this.keyup=function(e){if(!1!==this.enabled){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this.moveState.forward=0;break;case"KeyS":this.moveState.back=0;break;case"KeyA":this.moveState.left=0;break;case"KeyD":this.moveState.right=0;break;case"KeyR":this.moveState.up=0;break;case"KeyF":this.moveState.down=0;break;case"ArrowUp":this.moveState.pitchUp=0;break;case"ArrowDown":this.moveState.pitchDown=0;break;case"ArrowLeft":this.moveState.yawLeft=0;break;case"ArrowRight":this.moveState.yawRight=0;break;case"KeyQ":this.moveState.rollLeft=0;break;case"KeyE":this.moveState.rollRight=0}this.updateMovementVector(),this.updateRotationVector()}},this.pointerdown=function(e){if(!1!==this.enabled)if(this.dragToLook)this.status++;else{switch(e.button){case 0:this.moveState.forward=1;break;case 2:this.moveState.back=1}this.updateMovementVector()}},this.pointermove=function(e){if(!1!==this.enabled&&(!this.dragToLook||this.status>0)){const t=this.getContainerDimensions(),n=t.size[0]/2,r=t.size[1]/2;this.moveState.yawLeft=-(e.pageX-t.offset[0]-n)/n,this.moveState.pitchDown=(e.pageY-t.offset[1]-r)/r,this.updateRotationVector()}},this.pointerup=function(e){if(!1!==this.enabled){if(this.dragToLook)this.status--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(e.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0}this.updateMovementVector()}this.updateRotationVector()}},this.pointercancel=function(){!1!==this.enabled&&(this.dragToLook?(this.status=0,this.moveState.yawLeft=this.moveState.pitchDown=0):(this.moveState.forward=0,this.moveState.back=0,this.updateMovementVector()),this.updateRotationVector())},this.contextMenu=function(e){!1!==this.enabled&&e.preventDefault()},this.update=function(e){if(!1===this.enabled)return;const t=e*r.movementSpeed,n=e*r.rollSpeed;r.object.translateX(r.moveVector.x*t),r.object.translateY(r.moveVector.y*t),r.object.translateZ(r.moveVector.z*t),r.tmpQuaternion.set(r.rotationVector.x*n,r.rotationVector.y*n,r.rotationVector.z*n,1).normalize(),r.object.quaternion.multiply(r.tmpQuaternion),(a.distanceToSquared(r.object.position)>o||8*(1-i.dot(r.object.quaternion))>o)&&(r.dispatchEvent(b),i.copy(r.object.quaternion),a.copy(r.object.position))},this.updateMovementVector=function(){const e=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-e+this.moveState.back},this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft},this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}},this.dispose=function(){this.domElement.removeEventListener("contextmenu",s),this.domElement.removeEventListener("pointerdown",l),this.domElement.removeEventListener("pointermove",c),this.domElement.removeEventListener("pointerup",u),this.domElement.removeEventListener("pointercancel",h),window.removeEventListener("keydown",p),window.removeEventListener("keyup",d)};const s=this.contextMenu.bind(this),c=this.pointermove.bind(this),l=this.pointerdown.bind(this),u=this.pointerup.bind(this),h=this.pointercancel.bind(this),p=this.keydown.bind(this),d=this.keyup.bind(this);this.domElement.addEventListener("contextmenu",s),this.domElement.addEventListener("pointerdown",l),this.domElement.addEventListener("pointermove",c),this.domElement.addEventListener("pointerup",u),this.domElement.addEventListener("pointercancel",h),window.addEventListener("keydown",p),window.addEventListener("keyup",d),this.updateMovementVector(),this.updateRotationVector()}}const y={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class w{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const E=new e.OrthographicCamera(-1,1,1,-1,0,1);class S extends e.BufferGeometry{constructor(){super(),this.setAttribute("position",new e.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new e.Float32BufferAttribute([0,2,0,0,2,0],2))}}const _=new S;class k{constructor(t){this._mesh=new e.Mesh(_,t)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,E)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class j extends w{constructor(t,n){super(),this.textureID=void 0!==n?n:"tDiffuse",t instanceof e.ShaderMaterial?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=e.UniformsUtils.clone(t.uniforms),this.material=new e.ShaderMaterial({name:void 0!==t.name?t.name:"unspecified",defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.fsQuad=new k(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class x extends w{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),o=e.state;let i,a;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0),this.inverse?(i=0,a=1):(i=1,a=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),o.buffers.stencil.setFunc(r.ALWAYS,i,4294967295),o.buffers.stencil.setClear(a),o.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.color.setMask(!0),o.buffers.depth.setMask(!0),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(r.EQUAL,1,4294967295),o.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),o.buffers.stencil.setLocked(!0)}}class P extends w{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class C{constructor(t,n){if(this.renderer=t,this._pixelRatio=t.getPixelRatio(),void 0===n){const r=t.getSize(new e.Vector2);this._width=r.width,this._height=r.height,(n=new e.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:e.HalfFloatType})).texture.name="EffectComposer.rt1"}else this._width=n.width,this._height=n.height;this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new j(y),this.copyPass.material.blending=e.NoBlending,this.clock=new e.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t1?r-1:0),i=1;i=0&&o<1?(s=i,c=a):o>=1&&o<2?(s=a,c=i):o>=2&&o<3?(c=i,l=a):o>=3&&o<4?(c=a,l=i):o>=4&&o<5?(s=a,l=i):o>=5&&o<6&&(s=i,l=a);var u=n-i/2;return r(s+u,c+u,l+u)}var N={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var Y=/^#[a-fA-F0-9]{6}$/,B=/^#[a-fA-F0-9]{8}$/,H=/^#[a-fA-F0-9]{3}$/,K=/^#[a-fA-F0-9]{4}$/,X=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,q=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Z=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Q=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function G(e){if("string"!=typeof e)throw new z(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return N[t]?"#"+N[t]:e}(e);if(t.match(Y))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(B)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(H))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(K)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var o=X.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=q.exec(t.substring(0,50));if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])>1?parseFloat(""+i[4])/100:parseFloat(""+i[4])};var a=Z.exec(t);if(a){var s="rgb("+U(parseInt(""+a[1],10),parseInt(""+a[2],10)/100,parseInt(""+a[3],10)/100)+")",c=X.exec(s);if(!c)throw new z(4,t,s);return{red:parseInt(""+c[1],10),green:parseInt(""+c[2],10),blue:parseInt(""+c[3],10)}}var l=Q.exec(t.substring(0,50));if(l){var u="rgb("+U(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",h=X.exec(u);if(!h)throw new z(4,t,u);return{red:parseInt(""+h[1],10),green:parseInt(""+h[2],10),blue:parseInt(""+h[3],10),alpha:parseFloat(""+l[4])>1?parseFloat(""+l[4])/100:parseFloat(""+l[4])}}throw new z(5)}function W(e){return function(e){var t,n=e.red/255,r=e.green/255,o=e.blue/255,i=Math.max(n,r,o),a=Math.min(n,r,o),s=(i+a)/2;if(i===a)return void 0!==e.alpha?{hue:0,saturation:0,lightness:s,alpha:e.alpha}:{hue:0,saturation:0,lightness:s};var c=i-a,l=s>.5?c/(2-i-a):c/(i+a);switch(i){case n:t=(r-o)/c+(r=1?re(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new z(7)}var ie=function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)},ae=function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha},se=function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)},ce=function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha};function le(e){if("object"!=typeof e)throw new z(8);if(ae(e))return oe(e);if(ie(e))return re(e);if(ce(e))return function(e,t,n,r){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return"rgba("+U(e,t,n)+","+r+")";if("object"==typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?ne(e.hue,e.saturation,e.lightness):"rgba("+U(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new z(2)}(e);if(se(e))return function(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return ne(e,t,n);if("object"==typeof e&&void 0===t&&void 0===n)return ne(e.hue,e.saturation,e.lightness);throw new z(1)}(e);throw new z(8)}function ue(e,t,n){return function(){var r=n.concat(Array.prototype.slice.call(arguments));return r.length>=t?e.apply(this,r):ue(e,t,r)}}function he(e){return ue(e,e.length,[])}function pe(e,t,n){return Math.max(e,Math.min(t,n))}he((function(e,t){if("transparent"===t)return t;var n=W(t);return le(O({},n,{hue:n.hue+parseFloat(e)}))})),he((function(e,t){if("transparent"===t)return t;var n=W(t);return le(O({},n,{lightness:pe(0,1,n.lightness-parseFloat(e))}))})),he((function(e,t){if("transparent"===t)return t;var n=W(t);return le(O({},n,{saturation:pe(0,1,n.saturation-parseFloat(e))}))})),he((function(e,t){if("transparent"===t)return t;var n=W(t);return le(O({},n,{lightness:pe(0,1,n.lightness+parseFloat(e))}))}));var de=he((function(e,t,n){if("transparent"===t)return n;if("transparent"===n)return t;if(0===e)return n;var r=G(t),o=O({},r,{alpha:"number"==typeof r.alpha?r.alpha:1}),i=G(n),a=O({},i,{alpha:"number"==typeof i.alpha?i.alpha:1}),s=o.alpha-a.alpha,c=2*parseFloat(e)-1,l=((c*s==-1?c:c+s)/(1+c*s)+1)/2,u=1-l;return oe({red:Math.floor(o.red*l+a.red*u),green:Math.floor(o.green*l+a.green*u),blue:Math.floor(o.blue*l+a.blue*u),alpha:o.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))})}));var fe=he((function(e,t){if("transparent"===t)return t;var n=G(t);return oe(O({},n,{alpha:pe(0,1,(100*("number"==typeof n.alpha?n.alpha:1)+100*parseFloat(e))/100)}))}));he((function(e,t){if("transparent"===t)return t;var n=W(t);return le(O({},n,{saturation:pe(0,1,n.saturation+parseFloat(e))}))})),he((function(e,t){return"transparent"===t?t:le(O({},W(t),{hue:parseFloat(e)}))})),he((function(e,t){return"transparent"===t?t:le(O({},W(t),{lightness:parseFloat(e)}))})),he((function(e,t){return"transparent"===t?t:le(O({},W(t),{saturation:parseFloat(e)}))})),he((function(e,t){return"transparent"===t?t:de(parseFloat(e),"rgb(0, 0, 0)",t)})),he((function(e,t){return"transparent"===t?t:de(parseFloat(e),"rgb(255, 255, 255)",t)})),he((function(e,t){if("transparent"===t)return t;var n=G(t);return oe(O({},n,{alpha:pe(0,1,+(100*("number"==typeof n.alpha?n.alpha:1)-100*parseFloat(e)).toFixed(2)/100)}))}));var me,ge=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-ge.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*ge.Bounce.In(2*e):.5*ge.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),be=function(){return performance.now()},ve=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=be()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?i(e[n],e[n-1],n-r):i(e[o],e[o+1>n?n:o+1],r-o)},Bezier:function(e,t){for(var n=0,r=e.length-1,o=Math.pow,i=ye.Utils.Bernstein,a=0;a<=r;a++)n+=o(1-t,r-a)*o(t,a)*e[a]*i(r,a);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),i=ye.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(r=n*(1+t))),i(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],r-o)):t<0?e[0]-(i(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(i(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):i(e[o?o-1:0],e[o],e[n1;n--)t*=n;return me[e]=t,t}),CatmullRom:function(e,t,n,r,o){var i=.5*(n-e),a=.5*(r-t),s=o*o;return(2*t-2*n+i+a)*(o*s)+(-3*t+3*n-2*i-a)*s+i*o+t}}},we=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ee=new ve,Se=function(){function e(e,t){void 0===t&&(t=Ee),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ge.Linear.None,this._interpolationFunction=ye.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=we.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e<0?0:e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=be()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var o in this._valuesEnd)r[o]=this._valuesEnd[o];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,n,r,o){for(var i in n){var a=e[i],s=Array.isArray(a),c=s?"array":typeof a,l=!s&&Array.isArray(n[i]);if("undefined"!==c&&"function"!==c){if(l){if(0===(g=n[i]).length)continue;for(var u=[a],h=0,p=g.length;hi)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,ec)return 1;var e=Math.trunc(a/s),t=a-e*s,n=Math.min(t/o._duration,1);return 0===n&&a===o._duration?1:n}(),u=this._easingFunction(l);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),0===this._duration||a>=this._duration){if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/s)+1,this._repeat);for(r in isFinite(this._repeat)&&(this._repeat-=h),this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[r]||(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(this._valuesEnd[r])),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,d=this._chainedTweens.length;p=t||n<0||h&&e-l>=i}function m(){var e=Te();if(f(e))return g(e);s=setTimeout(m,function(e){var n=t-(e-c);return h?$e(n,i-(e-l)):n}(e))}function g(e){return s=void 0,p&&r?d(e):(r=o=void 0,a)}function b(){var e=Te(),n=f(e);if(r=arguments,o=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(m,t),u?d(e):a}(c);if(h)return clearTimeout(s),s=setTimeout(m,t),d(c)}return void 0===s&&(s=setTimeout(m,t)),a}return t=Qe(t)||0,je(n)&&(u=!!n.leading,i=(h="maxWait"in n)?We(Qe(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),b.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=o=s=void 0},b.flush=function(){return void 0===s?a:g(Te())},b}function et(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function tt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return nt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nt(e,t){t>e.length&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length,o=new Array(r>3?r-3:0),i=3;i2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,a=e.camera;if(t){var s=new vt.Vector3(0,0,0),c=2*Math.max.apply(Math,r(Object.entries(t).map((function(e){var t=n(e,2),o=t[0],i=t[1];return Math.max.apply(Math,r(i.map((function(e){return Math.abs(s[o]-e)}))))})))),l=(1-2*i/e.height)*a.fov,u=c/Math.atan(l*Math.PI/180),h=u/a.aspect,p=Math.max(u,h);if(p>0){var d=s.clone().sub(a.position).normalize().multiplyScalar(-p);this.cameraPosition(d,s,o)}}return this},getBbox:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0},o=new vt.Box3(new vt.Vector3(0,0,0),new vt.Vector3(0,0,0)),i=e.objects.filter(n);return i.length?(i.forEach((function(e){return o.expandByObject(e)})),Object.assign.apply(Object,r(["x","y","z"].map((function(e){return n={},r=e,i=[o.min[e],o.max[e]],(r=t(r))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,n;var n,r,i}))))):null},getScreenCoords:function(e,t,n,r){var o=new vt.Vector3(t,n,r);return o.project(this.camera()),{x:(o.x+1)*e.width/2,y:-(o.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=new vt.Vector2(t/e.width*2-1,-n/e.height*2+1),i=new vt.Raycaster;return i.setFromCamera(o,e.camera),Object.assign({},i.ray.at(r,new vt.Vector3))},intersectingObjects:function(e,t,n){var r=new vt.Vector2(t/e.width*2-1,-n/e.height*2+1),o=new vt.Raycaster;return o.params.Line.threshold=e.lineHoverPrecision,o.setFromCamera(r,e.camera),o.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new vt.Scene,camera:new vt.PerspectiveCamera,clock:new vt.Clock}},init:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.controlType,i=void 0===o?"trackball":o,a=n.rendererConfig,s=void 0===a?{}:a,c=n.extraRenderers,u=void 0===c?[]:c,h=n.waitForLoadComplete,p=void 0===h||h;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.toolTipElem=document.createElement("div"),t.toolTipElem.classList.add("scene-tooltip"),t.container.appendChild(t.toolTipElem),t.pointerPos=new vt.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach((function(e){return t.container.addEventListener(e,(function(n){if("pointerdown"===e&&(t.isPointerPressed=!0),!t.isPointerDragging&&"pointermove"===n.type&&(n.pressure>0||t.isPointerPressed)&&("touch"!==n.pointerType||void 0===n.movementX||[n.movementX,n.movementY].some((function(e){return Math.abs(e)>1})))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var r=(o=t.container,i=o.getBoundingClientRect(),a=window.pageXOffset||document.documentElement.scrollLeft,s=window.pageYOffset||document.documentElement.scrollTop,{top:i.top+s,left:i.left+a});t.pointerPos.x=n.pageX-r.left,t.pointerPos.y=n.pageY-r.top,t.toolTipElem.style.top="".concat(t.pointerPos.y,"px"),t.toolTipElem.style.left="".concat(t.pointerPos.x,"px"),t.toolTipElem.style.transform="translate(-".concat(t.pointerPos.x/t.width*100,"%, ").concat(t.height-t.pointerPos.y<100?"calc(-100% - 8px)":"21px",")")}var o,i,a,s}),{passive:!0})})),t.container.addEventListener("pointerup",(function(e){t.isPointerPressed=!1,t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag)||requestAnimationFrame((function(){0===e.button&&t.onClick(t.hoverObj||null,e,t.intersectionPoint),2===e.button&&t.onRightClick&&t.onRightClick(t.hoverObj||null,e,t.intersectionPoint)}))}),{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",(function(e){t.onRightClick&&e.preventDefault()})),t.renderer=new vt.WebGLRenderer(Object.assign({antialias:!0,alpha:!0},s)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=u,t.extraRenderers.forEach((function(e){e.domElement.style.position="absolute",e.domElement.style.top="0px",e.domElement.style.pointerEvents="none",t.container.appendChild(e.domElement)})),t.postProcessingComposer=new C(t.renderer),t.postProcessingComposer.addPass(new T(t.scene,t.camera)),t.controls=new{trackball:l,orbit:g,fly:v}[i](t.camera,t.renderer.domElement),"fly"===i&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),"trackball"!==i&&"orbit"!==i||(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",(function(){t.controlsEngaged=!0})),t.controls.addEventListener("change",(function(){t.controlsEngaged&&(t.controlsDragging=!0)})),t.controls.addEventListener("end",(function(){t.controlsEngaged=!1,t.controlsDragging=!1}))),[t.renderer,t.postProcessingComposer].concat(r(t.extraRenderers)).forEach((function(e){return e.setSize(t.width,t.height)})),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new vt.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!p,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&(e.container.style.width="".concat(e.width,"px"),e.container.style.height="".concat(e.height,"px"),[e.renderer,e.postProcessingComposer].concat(r(e.extraRenderers)).forEach((function(t){return t.setSize(e.width,e.height)})),e.camera.aspect=e.width/e.height,e.camera.updateProjectionMatrix()),t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=2.5*e.skyRadius,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new vt.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var n=G(e.backgroundColor).alpha;void 0===n&&(n=1),e.renderer.setClearColor(new vt.Color(fe(1,e.backgroundColor)),n)}function o(){e.loadComplete=e.scene.visible=!0}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?(new vt.TextureLoader).load(e.backgroundImageUrl,(function(t){t.colorSpace=vt.SRGBColorSpace,e.skysphere.material=new vt.MeshBasicMaterial({map:t,side:vt.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&o()})):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&o())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach((function(t){return e.scene.remove(t)})),e.lights.forEach((function(t){return e.scene.add(t)}))),t.hasOwnProperty("objects")&&((t.objects||[]).forEach((function(t){return e.scene.remove(t)})),e.objects.forEach((function(t){return e.scene.add(t)})))}},it=ot.stateInit,at=void 0===it?function(){return{}}:it,st=ot.props,ct=void 0===st?{}:st,lt=ot.methods,ut=void 0===lt?{}:lt,ht=ot.aliases,pt=void 0===ht?{}:ht,dt=ot.init,ft=void 0===dt?function(){}:dt,mt=ot.update,gt=void 0===mt?function(){}:mt,bt=Object.keys(ct).map((function(e){return new rt(e,ct[e])})),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},at instanceof Function?at(e):at,{initialised:!1}),n={};function r(t){return o(t,e),i(),r}var o=function(e,n){ft.call(r,e,t,n),t.initialised=!0},i=Je((function(){t.initialised&&(gt.call(r,t,n),n={})}),1);return bt.forEach((function(e){r[e.name]=function(e){var o=e.name,a=e.triggerUpdate,s=void 0!==a&&a,c=e.onChange,l=void 0===c?function(e,t){}:c,u=e.defaultVal,h=void 0===u?null:u;return function(e){var a=t[o];if(!arguments.length)return a;var c=void 0===e?h:e;return t[o]=c,l.call(r,c,t,a),!n.hasOwnProperty(o)&&(n[o]=a),s&&i(),r}}(e)})),Object.keys(ut).forEach((function(e){r[e]=function(){for(var n,o=arguments.length,i=new Array(o),a=0;a