@epigraph/solutions 1.5.0 → 1.5.1

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.
@@ -13172,7 +13172,7 @@ ${r.join(`
13172
13172
  * https://github.com/yomotsu/camera-controls
13173
13173
  * (c) 2017 @yomotsu
13174
13174
  * Released under the MIT License.
13175
- */const Bn={LEFT:1,RIGHT:2,MIDDLE:4},te=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Qc={NONE:0,IN:1,OUT:-1};function Xo(i){return i.isPerspectiveCamera}function io(i){return i.isOrthographicCamera}const eo=Math.PI*2,vw=Math.PI/2,lD=1e-5,Wu=Math.PI/180;function tr(i,e,t){return Math.max(e,Math.min(t,i))}function dn(i,e=lD){return Math.abs(i)<e}function qt(i,e,t=lD){return dn(i-e,t)}function bw(i,e){return Math.round(i/e)*e}function ju(i){return isFinite(i)?i:i<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Xu(i){return Math.abs(i)<Number.MAX_VALUE?i:i*(1/0)}function Kp(i,e,t,n,s=1/0,r){n=Math.max(1e-4,n);const a=2/n,o=a*r,l=1/(1+o+.48*o*o+.235*o*o*o);let c=i-e;const u=e,h=s*n;c=tr(c,-h,h),e=i-c;const d=(t.value+a*c)*r;t.value=(t.value-a*d)*l;let A=e+(c+d)*l;return u-i>0==A>u&&(A=u,t.value=(A-u)/r),A}function xw(i,e,t,n,s=1/0,r,a){n=Math.max(1e-4,n);const o=2/n,l=o*r,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,d=e.z,A=i.x-u,p=i.y-h,g=i.z-d;const m=u,f=h,_=d,y=s*n,E=y*y,v=A*A+p*p+g*g;if(v>E){const P=Math.sqrt(v);A=A/P*y,p=p/P*y,g=g/P*y}u=i.x-A,h=i.y-p,d=i.z-g;const C=(t.x+o*A)*r,x=(t.y+o*p)*r,I=(t.z+o*g)*r;t.x=(t.x-o*C)*c,t.y=(t.y-o*x)*c,t.z=(t.z-o*I)*c,a.x=u+(A+C)*c,a.y=h+(p+x)*c,a.z=d+(g+I)*c;const b=m-i.x,w=f-i.y,S=_-i.z,B=a.x-m,T=a.y-f,D=a.z-_;return b*B+w*T+S*D>0&&(a.x=m,a.y=f,a.z=_,t.x=(a.x-m)/r,t.y=(a.y-f)/r,t.z=(a.z-_)/r),a}function my(i,e){e.set(0,0),i.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=i.length,e.y/=i.length}function _y(i,e){return io(i)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class nY{_listeners={};addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e)}}}const iY="3.1.2",Zp=1/8,sY=/Mac/.test(globalThis?.navigator?.platform);let dt,Cw,ef,yy,Wi,yt,Ft,Lc,Ju,yr,Er,Jo,Iw,ww,hs,Nc,Pc,Sw,Ey,Bw,vy,by,tf;class vh extends nY{static install(e){dt=e.THREE,Cw=Object.freeze(new dt.Vector3(0,0,0)),ef=Object.freeze(new dt.Vector3(0,1,0)),yy=Object.freeze(new dt.Vector3(0,0,1)),Wi=new dt.Vector2,yt=new dt.Vector3,Ft=new dt.Vector3,Lc=new dt.Vector3,Ju=new dt.Vector3,yr=new dt.Vector3,Er=new dt.Vector3,Jo=new dt.Vector3,Iw=new dt.Vector3,ww=new dt.Vector3,hs=new dt.Spherical,Nc=new dt.Spherical,Pc=new dt.Box3,Sw=new dt.Box3,Ey=new dt.Sphere,Bw=new dt.Quaternion,vy=new dt.Quaternion,by=new dt.Matrix4,tf=new dt.Raycaster}static get ACTION(){return te}minPolarAngle=0;maxPolarAngle=Math.PI;minAzimuthAngle=-1/0;maxAzimuthAngle=1/0;minDistance=Number.EPSILON;maxDistance=1/0;infinityDolly=!1;minZoom=.01;maxZoom=1/0;smoothTime=.25;draggingSmoothTime=.125;maxSpeed=1/0;azimuthRotateSpeed=1;polarRotateSpeed=1;dollySpeed=1;dollyDragInverted=!1;truckSpeed=2;dollyToCursor=!1;dragToOffset=!1;boundaryFriction=0;restThreshold=.01;colliderMeshes=[];mouseButtons;touches;cancel=()=>{};lockPointer;unlockPointer;_enabled=!0;_camera;_yAxisUpSpace;_yAxisUpSpaceInverse;_state=te.NONE;_domElement;_viewport=null;_target;_targetEnd;_focalOffset;_focalOffsetEnd;_spherical;_sphericalEnd;_lastDistance;_zoom;_zoomEnd;_lastZoom;_cameraUp0;_target0;_position0;_zoom0;_focalOffset0;_dollyControlCoord;_changedDolly=0;_changedZoom=0;_nearPlaneCorners;_hasRested=!0;_boundary;_boundaryEnclosesCamera=!1;_needsUpdate=!0;_updatedLastTime=!1;_elementRect=new DOMRect;_isDragging=!1;_dragNeedsUpdate=!0;_activePointers=[];_lockedPointer=null;_interactiveArea=new DOMRect(0,0,1,1);_isUserControllingRotate=!1;_isUserControllingDolly=!1;_isUserControllingTruck=!1;_isUserControllingOffset=!1;_isUserControllingZoom=!1;_lastDollyDirection=Qc.NONE;_thetaVelocity={value:0};_phiVelocity={value:0};_radiusVelocity={value:0};_targetVelocity=new dt.Vector3;_focalOffsetVelocity=new dt.Vector3;_zoomVelocity={value:0};set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),typeof dt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new dt.Quaternion().setFromUnitVectors(this._camera.up,ef),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=te.NONE,this._target=new dt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new dt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new dt.Spherical().setFromVector3(yt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new dt.Vector3,new dt.Vector3,new dt.Vector3,new dt.Vector3],this._updateNearPlaneCorners(),this._boundary=new dt.Box3(new dt.Vector3(-1/0,-1/0,-1/0),new dt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new dt.Vector2,this.mouseButtons={left:te.ROTATE,middle:te.DOLLY,right:te.TRUCK,wheel:Xo(this._camera)?te.DOLLY:io(this._camera)?te.ZOOM:te.NONE},this.touches={one:te.TOUCH_ROTATE,two:Xo(this._camera)?te.TOUCH_DOLLY_TRUCK:io(this._camera)?te.TOUCH_ZOOM_TRUCK:te.NONE,three:te.TOUCH_TRUCK};const n=new dt.Vector2,s=new dt.Vector2,r=new dt.Vector2,a=f=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),v=f.clientX/E.width,C=f.clientY/E.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||C<this._interactiveArea.top||C>this._interactiveArea.bottom)return}const _=f.pointerType!=="mouse"?null:(f.buttons&Bn.LEFT)===Bn.LEFT?Bn.LEFT:(f.buttons&Bn.MIDDLE)===Bn.MIDDLE?Bn.MIDDLE:(f.buttons&Bn.RIGHT)===Bn.RIGHT?Bn.RIGHT:null;if(_!==null){const E=this._findPointerByMouseButton(_);E&&this._disposePointer(E)}if((f.buttons&Bn.LEFT)===Bn.LEFT&&this._lockedPointer)return;const y={pointerId:f.pointerId,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:_};this._activePointers.push(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,d(f)},o=f=>{f.cancelable&&f.preventDefault();const _=f.pointerId,y=this._lockedPointer||this._findPointerById(_);if(y){if(y.clientX=f.clientX,y.clientY=f.clientY,y.deltaX=f.movementX,y.deltaY=f.movementY,this._state=0,f.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(f.buttons&Bn.LEFT)===Bn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);A()}},l=f=>{const _=this._findPointerById(f.pointerId);if(!(_&&_===this._lockedPointer)){if(_&&this._disposePointer(_),f.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=te.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=te.NONE;p()}};let c=-1;const u=f=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===te.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),I=f.clientX/x.width,b=f.clientY/x.height;if(I<this._interactiveArea.left||I>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}if(f.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===te.ROTATE||this.mouseButtons.wheel===te.TRUCK){const x=performance.now();c-x<1e3&&this._getClientRect(this._elementRect),c=x}const _=sY?-1:-3,y=f.deltaMode===1&&!f.ctrlKey?f.deltaY/_:f.deltaY/(_*10),E=this.dollyToCursor?(f.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,v=this.dollyToCursor?(f.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(f.ctrlKey?te.ZOOM:this.mouseButtons.wheel){case te.ROTATE:{this._rotateInternal(f.deltaX,f.deltaY),this._isUserControllingRotate=!0;break}case te.TRUCK:{this._truckInternal(f.deltaX,f.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case te.SCREEN_PAN:{this._truckInternal(f.deltaX,f.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case te.OFFSET:{this._truckInternal(f.deltaX,f.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case te.DOLLY:{this._dollyInternal(-y,E,v),this._isUserControllingDolly=!0;break}case te.ZOOM:{this._zoomInternal(-y,E,v),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=f=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===vh.ACTION.NONE){const _=f instanceof PointerEvent?f.pointerId:0,y=this._findPointerById(_);y&&this._disposePointer(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}f.preventDefault()}},d=f=>{if(!this._enabled)return;if(my(this._activePointers,Wi),this._getClientRect(this._elementRect),n.copy(Wi),s.copy(Wi),this._activePointers.length>=2){const y=Wi.x-this._activePointers[1].clientX,E=Wi.y-this._activePointers[1].clientY,v=Math.sqrt(y*y+E*E);r.set(0,v);const C=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,x=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(C,x)}if(this._state=0,!f)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in f&&f.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(f.buttons&Bn.LEFT)===Bn.LEFT&&(this._state=this._state|this.mouseButtons.left),(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&te.TRUCK)===te.TRUCK||(this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&te.DOLLY)===te.DOLLY||(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&te.ZOOM)===te.ZOOM||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},A=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,my(this._activePointers,Wi);const _=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,y=_?-_.deltaX:s.x-Wi.x,E=_?-_.deltaY:s.y-Wi.y;if(s.copy(Wi),((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(y,E),this._isUserControllingRotate=!0),(this._state&te.DOLLY)===te.DOLLY||(this._state&te.ZOOM)===te.ZOOM){const v=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,C=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,x=this.dollyDragInverted?-1:1;(this._state&te.DOLLY)===te.DOLLY?(this._dollyInternal(x*E*Zp,v,C),this._isUserControllingDolly=!0):(this._zoomInternal(x*E*Zp,v,C),this._isUserControllingZoom=!0)}if((this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE){const v=Wi.x-this._activePointers[1].clientX,C=Wi.y-this._activePointers[1].clientY,x=Math.sqrt(v*v+C*C),I=r.y-x;r.set(0,x);const b=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET?(this._dollyInternal(I*Zp,b,w),this._isUserControllingDolly=!0):(this._zoomInternal(I*Zp,b,w),this._isUserControllingZoom=!0)}((this._state&te.TRUCK)===te.TRUCK||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(y,E,!1,!1),this._isUserControllingTruck=!0),((this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(y,E,!1,!0),this._isUserControllingTruck=!0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(y,E,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},p=()=>{my(this._activePointers,Wi),s.copy(Wi),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",m),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),d())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),this._domElement?.ownerDocument.exitPointerLock(),this._domElement?.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement?.ownerDocument.removeEventListener("pointerlockerror",m),this.cancel()};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},m=()=>{this.unlockPointer()};this._addAllEventListeners=f=>{this._domElement=f,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",m))},this.cancel=()=>{this._state!==te.NONE&&(this._state=te.NONE,this._activePointers.length=0,p())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=tr(e.width,0,1),this._interactiveArea.height=tr(e.height,0,1),this._interactiveArea.x=tr(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=tr(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const s=tr(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=tr(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!n||qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0,this._dollyToNoClamp(tr(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=qt(a,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ju).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=tr(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||qt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),yr.multiplyScalar(e),Er.multiplyScalar(-t);const s=yt.copy(yr).add(Er),r=Ft.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){yt.setFromMatrixColumn(this._camera.matrix,0),yt.crossVectors(this._camera.up,yt),yt.multiplyScalar(e);const n=Ft.copy(this._targetEnd).add(yt);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return yt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+yt.x,this._targetEnd.y+yt.y,this._targetEnd.z+yt.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const r=yt.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const a=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,n,s=!1){const o=yt.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?Pc.copy(e):Pc.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=bw(this._sphericalEnd.theta,vw),h=bw(this._sphericalEnd.phi,vw);l.push(this.rotateTo(u,h,t));const d=yt.setFromSpherical(this._sphericalEnd).normalize(),A=Bw.setFromUnitVectors(d,yy),p=qt(Math.abs(d.y),1);p&&A.multiply(vy.setFromAxisAngle(ef,u)),A.multiply(this._yAxisUpSpaceInverse);const g=Sw.makeEmpty();Ft.copy(c.min).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setX(c.max.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setY(c.max.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setZ(c.min.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setZ(c.max.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setY(c.min.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setX(c.min.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).applyQuaternion(A),g.expandByPoint(Ft),g.min.x-=s,g.min.y-=a,g.max.x+=r,g.max.y+=o,A.setFromUnitVectors(yy,d),p&&A.premultiply(vy.invert()),A.premultiply(this._yAxisUpSpace);const m=g.getSize(yt),f=g.getCenter(Ft).applyQuaternion(A);if(Xo(this._camera)){const _=this.getDistanceToFitBox(m.x,m.y,m.z,n);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(io(this._camera)){const _=this._camera,y=_.right-_.left,E=_.top-_.bottom,v=n?Math.max(y/m.x,E/m.y):Math.min(y/m.x,E/m.y);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.zoomTo(v,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],r="isObject3D"in e?vh.createBoundingSphere(e,Ey):Ey.copy(e);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),Xo(this._camera)){const a=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(a,t))}else if(io(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*r.radius,c=Math.min(a/l,o/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,r,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const l=Ft.set(s,r,a),c=yt.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerp(e,t,n,s=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const r=yt.set(...e.target);if("spherical"in e)hs.set(...e.spherical);else{const h=Ft.set(...e.position);hs.setFromVector3(h.sub(r).applyQuaternion(this._yAxisUpSpace))}const a=Lc.set(...t.target);if("spherical"in t)Nc.set(...t.spherical);else{const h=Ft.set(...t.position);Nc.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(r.lerp(a,n));const o=Nc.theta-hs.theta,l=Nc.phi-hs.phi,c=Nc.radius-hs.radius;this._sphericalEnd.set(hs.radius+c*n,hs.phi+l*n,hs.theta+o*n),this._needsUpdate=!0,s||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,s,r,a,o,l,c,u,h,d,A,p=!1){return this.lerp({position:[e,t,n],target:[s,r,a]},{position:[o,l,c],target:[u,h,d]},A,p)}setPosition(e,t,n,s=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,n,s=!1){const r=this.getPosition(yt),a=this.setLookAt(r.x,r.y,r.z,e,t,n,s);return this._sphericalEnd.phi=tr(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,n,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const r=!s||qt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&qt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&qt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),yr.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Er.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Jo.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=yt.set(e,t,n),r=s.distanceTo(this._camera.position),a=s.sub(this._camera.position);yr.multiplyScalar(a.x),Er.multiplyScalar(a.y),Jo.multiplyScalar(a.z),yt.copy(yr).add(Er).add(Jo),yt.z=yt.z+r,this.dollyTo(r,!1),this.setFocalOffset(-yt.x,yt.y,-yt.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new dt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(_y(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,a=this._camera.getEffectiveFOV()*Wu,o=this._camera.aspect;return((s?r>o:r<o)?t:e/o)*.5/Math.tan(a*.5)+n*.5}getDistanceToFitSphere(e){if(_y(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Wu,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:n;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new dt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%eo+eo)%eo,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=eo),this._spherical.theta+=eo*Math.round((this._sphericalEnd.theta-this._spherical.theta)/eo),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!qt(this._camera.up.x,this._cameraUp0.x)||!qt(this._camera.up.y,this._cameraUp0.y)||!qt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,ef),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=yt.subVectors(this._target,this._camera.position).normalize(),t=Ft.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,r=Iw.subVectors(this._targetEnd,this._target),a=ww.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(dn(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Kp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Kp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const h=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Kp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,h,this.maxSpeed,e),this._needsUpdate=!0}if(dn(r.x)&&dn(r.y)&&dn(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const h=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;xw(this._target,this._targetEnd,this._targetVelocity,h,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(dn(a.x)&&dn(a.y)&&dn(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const h=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;xw(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,h,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(dn(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const h=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Kp(this._zoom,this._zoomEnd,this._zoomVelocity,h,1/0,e)}if(this.dollyToCursor){if(Xo(this._camera)&&this._changedDolly!==0){const h=this._spherical.radius-this._lastDistance,d=this._camera,A=this._getCameraDirection(Ju),p=yt.copy(A).cross(d.up).normalize();p.lengthSq()===0&&(p.x=1);const g=Ft.crossVectors(p,A),m=this._sphericalEnd.radius*Math.tan(d.getEffectiveFOV()*Wu*.5),_=(this._sphericalEnd.radius-h-this._sphericalEnd.radius)/this._sphericalEnd.radius,y=Lc.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*m*d.aspect)).add(g.multiplyScalar(this._dollyControlCoord.y*m)),E=yt.copy(this._targetEnd).lerp(y,_),v=this._lastDollyDirection===Qc.IN&&this._spherical.radius<=this.minDistance,C=this._lastDollyDirection===Qc.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(v||C)){this._sphericalEnd.radius-=h,this._spherical.radius-=h;const I=Ft.copy(A).multiplyScalar(-h);E.add(I)}this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedDolly-=h,dn(this._changedDolly)&&(this._changedDolly=0)}else if(io(this._camera)&&this._changedZoom!==0){const h=this._zoom-this._lastZoom,d=this._camera,A=yt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(d.near+d.far)/(d.near-d.far)).unproject(d),p=Ft.set(0,0,-1).applyQuaternion(d.quaternion),g=Lc.copy(A).add(p.multiplyScalar(-A.dot(d.up))),f=-(this._zoom-h-this._zoom)/this._zoom,_=this._getCameraDirection(Ju),y=this._targetEnd.dot(_),E=yt.copy(this._targetEnd).lerp(g,f),v=E.dot(_),C=_.multiplyScalar(v-y);E.sub(C),this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedZoom-=h,dn(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!dn(this._focalOffset.x)||!dn(this._focalOffset.y)||!dn(this._focalOffset.z))&&(this._camera.matrix.compose(this._camera.position,this._camera.quaternion,this._camera.scale),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),Jo.setFromMatrixColumn(this._camera.matrix,2),yr.multiplyScalar(this._focalOffset.x),Er.multiplyScalar(-this._focalOffset.y),Jo.multiplyScalar(this._focalOffset.z),yt.copy(yr).add(Er).add(Jo),this._camera.position.add(yt),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),yt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),dn(t,this.restThreshold)&&dn(n,this.restThreshold)&&dn(s,this.restThreshold)&&dn(r.x,this.restThreshold)&&dn(r.y,this.restThreshold)&&dn(r.z,this.restThreshold)&&dn(a.x,this.restThreshold)&&dn(a.y,this.restThreshold)&&dn(a.z,this.restThreshold)&&dn(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ju(this.maxDistance),minZoom:this.minZoom,maxZoom:ju(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ju(this.maxPolarAngle),minAzimuthAngle:ju(this.minAzimuthAngle),maxAzimuthAngle:ju(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:yt.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Xu(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Xu(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Xu(n.maxPolarAngle),this.minAzimuthAngle=Xu(n.minAzimuthAngle),this.maxAzimuthAngle=Xu(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),hs.setFromVector3(yt.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(hs.theta,hs.phi,t),this.dollyTo(hs.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",iY),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const s=t.lengthSq();if(s===0)return e;const r=Ft.copy(t).add(e),o=this._boundary.clampPoint(r,Lc).sub(r),l=o.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(n===0)return e.add(t).add(o);{const c=1+n*l/t.dot(o);return e.add(Ft.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Xo(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*Wu,s=Math.tan(n*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(io(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,r=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,a,0),this._nearPlaneCorners[3].set(n,a,0)}}_truckInternal=(e,t,n,s)=>{let r,a;if(Xo(this._camera)){const o=yt.copy(this._camera.position).sub(this._target),l=this._camera.getEffectiveFOV()*Wu,c=o.length()*Math.tan(l*.5);r=this.truckSpeed*e*c/this._elementRect.height,a=this.truckSpeed*t*c/this._elementRect.height}else if(io(this._camera)){const o=this._camera;r=this.truckSpeed*e*(o.right-o.left)/o.zoom/this._elementRect.width,a=this.truckSpeed*t*(o.top-o.bottom)/o.zoom/this._elementRect.height}else return;s?(n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(r,0,!0),this.forward(-a,!0)):n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(r,a,!0)};_rotateInternal=(e,t)=>{const n=eo*this.azimuthRotateSpeed*e/this._elementRect.height,s=eo*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(n,s,!0)};_dollyInternal=(e,t,n)=>{const s=Math.pow(.95,-e*this.dollySpeed),r=this._sphericalEnd.radius,a=this._sphericalEnd.radius*s,o=tr(a,this.minDistance,this.maxDistance),l=o-a;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(l,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-r,this._dollyControlCoord.set(t,n)),this._lastDollyDirection=Math.sign(-e)};_zoomInternal=(e,t,n)=>{const s=Math.pow(.95,e*this.dollySpeed),r=this._zoom,a=this._zoom*s;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-r,this._dollyControlCoord.set(t,n))};_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||_y(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ju);by.lookAt(Cw,n,this._camera.up);for(let s=0;s<4;s++){const r=Ft.copy(this._nearPlaneCorners[s]);r.applyMatrix4(by);const a=Lc.addVectors(this._target,r);tf.set(a,n),tf.far=this._spherical.radius+1;const o=tf.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new dt.Sphere){const n=t,s=n.center;Pc.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&Pc.expandByObject(a)}),Pc.getCenter(s);let r=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a;if(!o.geometry)return;const l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let h=0,d=u.count;h<d;h++)yt.fromBufferAttribute(u,h),r=Math.max(r,s.distanceToSquared(yt))}),n.radius=Math.sqrt(r),n}}class Tw{constructor(e){this.__position=new Q,this.__target=new Q,this.setPosition(e.position.x,e.position.y,e.position.z),this.setTarget(e.target.x,e.target.y,e.target.z)}getPosition(){return this.__position}setPosition(e,t,n){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(n)}getTarget(){return this.__target}setTarget(e,t,n){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(n)}}class Gg extends Hb{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainRenderer={},this.__mainCameraControls={},this.__cameraDirection=new Q,this.__cameraSpherical=new Ll,this.__savedCameraState={position:new Q,target:new Q,focalLength:0},this.__currentCameraPosition=new Q,this.__currentTargetPosition=new Q,this.__touchScrollState=null,this.__pointerZoomEnabled=!1}static{this.TAU=Math.PI*2}get cameraActions(){return vh.ACTION}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}getCurrentCameraTransforms(){return this.__cameras.main.getWorldPosition(this.__currentCameraPosition),this.__mainCameraControls.getTarget(this.__currentTargetPosition),{position:this.__currentCameraPosition,target:this.__currentTargetPosition,focalLength:this.__cameras.main.getFocalLength()}}getCurrentCameraRotation(){return{azimuthAngle:this.__mainCameraControls.azimuthAngle,polarAngle:this.__mainCameraControls.polarAngle,distance:this.__mainCameraControls.distance}}getCameraFocalLength(){return this.__cameras.main.getFocalLength()}setCameraFocalLength(e){this.__cameras.main.setFocalLength(e)}async fitCameraToSceneBounds(e=!0){const t=this._appWcRef.getSceneSphericalBounds().clone();if(t.isEmpty()||t.radius<=0)return;let n=this._appWcRef.productSettings.camera.cameraBoundsMultiplier;return this._appWcRef.cameraBoundsMultiplier!==0&&(n=this._appWcRef.cameraBoundsMultiplier),this._appWcRef.aspectRatio<1&&(n=1),t.radius=t.radius*n,await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(){const e=this.__mainCameraControls,t=e.currentAction===e.mouseButtons?.right||e.currentAction===e.touches?.two;this.__cameraSettings.canPan&&t?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):e.currentAction===e.mouseButtons?.left?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"rotate"}):this._appWcRef.eventsManager.cameraControlsStart.fire({type:null})}__onMainCameraControlsControlEnd(){this._appWcRef.eventsManager.inputEnd.fire()}saveCurrentCameraTransforms(){this.__mainCameraControls.getPosition(this.__savedCameraState.position),this.__mainCameraControls.getTarget(this.__savedCameraState.target),this.__savedCameraState.focalLength=this.getCameraFocalLength()}resetCurrentCameraTransformsToLastSavedState(e=!0){this.moveCameraToLocation({newCameraTransforms:this.__savedCameraState,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t}){this._appWcRef.productSettings.camera.canZoom===!1&&(e=null,t=null),e===null&&(e=.001),t===null&&(t=1/0);const n=this._appWcRef.getSceneSphericalBounds().radius;n<0||(this.__mainCameraControls.minDistance=Math.min(e,n),this.__mainCameraControls.maxDistance=n+t)}async zoomIn(e=.1){await this.__mainCameraControls.dolly(e,!0)}async zoomOut(e=.1){await this.__mainCameraControls.dolly(-e,!0)}enableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.ROTATE,this.__mainCameraControls.touches.one=this.cameraActions.TOUCH_ROTATE}disableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.NONE,this.__mainCameraControls.touches.one=this.cameraActions.NONE}enablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY_TRUCK,this.__mainCameraControls.mouseButtons.right=this.cameraActions.TRUCK}disablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.right=this.cameraActions.NONE}enableZoomControls(){if(this._appWcRef.disableZoom){this.disableZoomControls();return}this.__pointerZoomEnabled=!0,this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.DOLLY}disableZoomControls(){this.__pointerZoomEnabled=!1,this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.NONE}enableCameraZoomLimits(e){this.setCameraZoomLimits({minDistance:e.minDistance,maxDistance:e.maxDistance})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:null,maxDistance:null})}enableCameraRotationLimits(e){const{infinitePolarAngle:t,minPolarAngle:n,maxPolarAngle:s,infiniteAzimuthAngle:r,minAzimuthAngle:a,maxAzimuthAngle:o}=e;this.__mainCameraControls.minPolarAngle=t?-1/0:n,this.__mainCameraControls.maxPolarAngle=t?1/0:s,this.__mainCameraControls.minAzimuthAngle=r?-1/0:a,this.__mainCameraControls.maxAzimuthAngle=r?1/0:o}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}updateCameraSettings(e){this.__cameraSettings=JSON.parse(JSON.stringify(e)),this.enableRotationControls();const{canPan:t,canZoom:n}=e;n?this.enableZoomControls():this.disableZoomControls(),t?this.enablePanControls():this.disablePanControls(),this.__mainCameraControls.mouseButtons.middle=this.cameraActions.NONE,this.__mainCameraControls.enabled=!0,this.__cameras.main.setFocalLength(e.focalLength),this.__cameras.main.near=e.nearClip,this.__cameras.main.far=e.farClip,this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e),this._appWcRef.transparentBackground===!1&&(this.__mainRenderer.setClearColor(e.backgroundColor),this.__mainRenderer.setClearAlpha(e.backgroundAlpha))}normalizeAngle(e){return Ki.euclideanModulo(e,Gg.TAU)}absoluteAngle(e,t){const n=e-t;return Ki.euclideanModulo(n+Math.PI,Gg.TAU)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:n=!0,targetCameraControlsRef:s=this.__mainCameraControls,ignoreCameraLimits:r=!1}){e instanceof Tw||(e=new Tw(e));const a=e.getPosition(),o=e.getTarget();if(s.enabled=!1,r===!0)s.setLookAt(a.x,a.y,a.z,o.x,o.y,o.z,n),s.normalizeRotations();else{this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(a,o),this.__cameraDirection.normalize();const l=a.distanceTo(o);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const c=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(s.azimuthAngle)),u=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(s.polarAngle));s.rotate(c,u,n),s.moveTo(o.x,o.y,o.z,n),s.dollyTo(l,n)}t||(s.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:n,transition:s=!0,targetCameraControlsRef:r=this.__mainCameraControls}){e&&r.rotateAzimuthTo(e,s),t&&r.rotatePolarTo(t,s),n&&r.dollyTo(n,s)}async fitCameraToObject({objectToFocus:e,enableTransition:t=!0}){return await this.__mainCameraControls.fitToSphere(e,t)}async wiggleCamera(){const e=this.__mainCameraControls.azimuthAngle,t=[0,.4,-.3,0];for(const n of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+n,!0)}}__onProductSettingsUpdated(){this.updateCameraSettings(this._appWcRef.productSettings.camera),this.fitCameraToSceneBounds()}__onCameraMoveToTransform(e){e.detail.saveFirst&&this.saveCurrentCameraTransforms(),this.moveCameraToLocation({newCameraTransforms:e.detail.cameraTransforms,ignoreCameraLimits:e.detail.ignoreCameraLimits})}__onSceneBoundsChanged(){this.__mainCameraControls.setBoundary(this._appWcRef.getSceneBounds())}__setupTouchScrollDetection(){if(!("ontouchstart"in window||navigator.maxTouchPoints>0))return;const t=this.__mainRenderer.domElement,n=this.__mainCameraControls;t.style.touchAction="pan-y",new MutationObserver(()=>{t.style.touchAction!=="pan-y"&&(t.style.touchAction="pan-y")}).observe(t,{attributeFilter:["style"]});const r=5;t.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(this.__touchScrollState={startX:a.clientX,startY:a.clientY,decided:!1,isVerticalScroll:!1})}),document.addEventListener("pointermove",a=>{if(!(!this.__touchScrollState||a.pointerType!=="touch")){if(!this.__touchScrollState.decided){const o=Math.abs(a.clientX-this.__touchScrollState.startX),l=Math.abs(a.clientY-this.__touchScrollState.startY);if(o<r&&l<r)return;this.__touchScrollState.decided=!0,this.__touchScrollState.isVerticalScroll=l>o,this.__touchScrollState.isVerticalScroll&&n.cancel()}this.__touchScrollState.isVerticalScroll&&a.stopImmediatePropagation()}},{capture:!0}),document.addEventListener("pointerup",a=>{!this.__touchScrollState||a.pointerType!=="touch"||(this.__touchScrollState=null)},{capture:!0})}__onWheel(e){if(!e.ctrlKey||!this.__pointerZoomEnabled)return;e.preventDefault(),e.stopImmediatePropagation();const t=new WheelEvent("wheel",{deltaX:e.deltaX,deltaY:e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,ctrlKey:!1,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:e.bubbles,cancelable:e.cancelable});e.target?.dispatchEvent(t)}__setupTrackpadPinchAsDollyHandler(){this.__mainRenderer.domElement.addEventListener("wheel",this.__onWheel.bind(this),{passive:!1})}__setupEventListeners(){this.__setupTouchScrollDetection(),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart()}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraProductSettingUpdatedEvent.name,this.__onProductSettingsUpdated.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,this.__onCameraMoveToTransform.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.sceneBoundsChanged.name,this.__onSceneBoundsChanged.bind(this))}async setup({mainRenderer:e}){this.__mainRenderer=e;const t=new $n(75,window.innerWidth/window.innerHeight,.1,1e3);this.__cameras={main:t,screenshot:t.clone()},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(1);const n={Vector2:pe,Vector3:Q,Vector4:Mt,Quaternion:Yt,Matrix4:We,Spherical:Ll,Box3:Rn,Sphere:ts,Raycaster:bb};vh.install({THREE:n}),this.__setupTrackpadPinchAsDollyHandler(),this.__mainCameraControls=new vh(this.__cameras.main,e.domElement),this.__setupEventListeners()}}const rY='@font-face{font-family:Helvetica Neue;src:url(https://asset.myepigraph.com/design-assets/fonts/HelveticaNeue/HelveticaNeue-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:PPMori-Regular;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:PPMori-Bold;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter-VariableFont_slnt_wght.ttf) format("truetype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter_18pt-Bold.ttf) format("truetype");font-weight:700;font-style:normal;font-display:swap}',aY={Color:{Black:{25:{$type:"color",$value:"rgba(0, 0, 0, 0.0000)"},50:{$type:"color",$value:"rgba(0, 0, 0, 0.0500)"},100:{$type:"color",$value:"rgba(0, 0, 0, 0.1000)"},200:{$type:"color",$value:"rgba(0, 0, 0, 0.2000)"},300:{$type:"color",$value:"rgba(0, 0, 0, 0.3000)"},400:{$type:"color",$value:"rgba(0, 0, 0, 0.4000)"},500:{$type:"color",$value:"rgba(0, 0, 0, 0.5000)"},600:{$type:"color",$value:"rgba(0, 0, 0, 0.6000)"},700:{$type:"color",$value:"rgba(0, 0, 0, 0.7000)"},800:{$type:"color",$value:"rgba(0, 0, 0, 0.8000)"},900:{$type:"color",$value:"rgba(0, 0, 0, 0.9000)"},1e3:{$type:"color",$value:"#000000"}},White:{25:{$type:"color",$value:"rgba(255, 255, 255, 0.0250)"},50:{$type:"color",$value:"rgba(255, 255, 255, 0.0500)"},100:{$type:"color",$value:"rgba(255, 255, 255, 0.1000)"},200:{$type:"color",$value:"rgba(255, 255, 255, 0.2000)"},300:{$type:"color",$value:"rgba(255, 255, 255, 0.3000)"},400:{$type:"color",$value:"rgba(255, 255, 255, 0.4000)"},500:{$type:"color",$value:"rgba(255, 255, 255, 0.5000)"},600:{$type:"color",$value:"rgba(255, 255, 255, 0.6000)"},700:{$type:"color",$value:"rgba(255, 255, 255, 0.7000)"},800:{$type:"color",$value:"rgba(255, 255, 255, 0.8000)"},900:{$type:"color",$value:"rgba(255, 255, 255, 0.9000)"},1e3:{$type:"color",$value:"#ffffff"}},Green:{100:{$type:"color",$value:"#ebffee"},200:{$type:"color",$value:"#cff7d3"},300:{$type:"color",$value:"#aff4c6"},400:{$type:"color",$value:"#85e0a3"},500:{$type:"color",$value:"#14ae5c"},600:{$type:"color",$value:"#009951"},700:{$type:"color",$value:"#008043"},800:{$type:"color",$value:"#02542d"},900:{$type:"color",$value:"#024023"},1e3:{$type:"color",$value:"#062d1b"}},Red:{100:{$type:"color",$value:"#fee9e7"},200:{$type:"color",$value:"#fdd3d0"},300:{$type:"color",$value:"#fcb3ad"},400:{$type:"color",$value:"#f4776a"},500:{$type:"color",$value:"#ec221f"},600:{$type:"color",$value:"#c00f0c"},700:{$type:"color",$value:"#900b09"},800:{$type:"color",$value:"#690807"},900:{$type:"color",$value:"#4d0b0a"},1e3:{$type:"color",$value:"#300603"}},Yellow:{100:{$type:"color",$value:"#fffbeb"},200:{$type:"color",$value:"#fff1c2"},300:{$type:"color",$value:"#ffe8a3"},400:{$type:"color",$value:"#e8b931"},500:{$type:"color",$value:"#e5a000"},600:{$type:"color",$value:"#bf6a02"},700:{$type:"color",$value:"#975102"},800:{$type:"color",$value:"#682d03"},900:{$type:"color",$value:"#522504"},1e3:{$type:"color",$value:"#401b01"}},Blue:{100:{$type:"color",$value:"#fbfdff"},200:{$type:"color",$value:"#eaf4ff"},300:{$type:"color",$value:"#d5ebff"},400:{$type:"color",$value:"#c0e1ff"},500:{$type:"color",$value:"#91d0ff"},600:{$type:"color",$value:"#0094d5"},700:{$type:"color",$value:"#00679b"},800:{$type:"color",$value:"#003a5a"},900:{$type:"color",$value:"#003a5a"},1e3:{$type:"color",$value:"#002133"}},Slate:{100:{$type:"color",$value:"#f5f5f5"},200:{$type:"color",$value:"#e3e3e3"},300:{$type:"color",$value:"#cdcdcd"},400:{$type:"color",$value:"#b2b2b2"},500:{$type:"color",$value:"#949494"},600:{$type:"color",$value:"#767676"},700:{$type:"color",$value:"#5a5a5a"},800:{$type:"color",$value:"#434343"},900:{$type:"color",$value:"#303030"},1e3:{$type:"color",$value:"#242424"}},Grey:{25:{$type:"color",$value:"#f5f5f5"},50:{$type:"color",$value:"#f2f2f2"},100:{$type:"color",$value:"#e6e6e6"},200:{$type:"color",$value:"#cccccc"},300:{$type:"color",$value:"#b3b3b3"},400:{$type:"color",$value:"#999999"},500:{$type:"color",$value:"#7b7b7b"},600:{$type:"color",$value:"#666666"},700:{$type:"color",$value:"#4d4d4d"},800:{$type:"color",$value:"#333333"},900:{$type:"color",$value:"#1a1a1a"},1e3:{$type:"color",$value:"#0d0d0d"}},GreyAlpha:{25:{$type:"color",$value:"rgba(248, 248, 248, 0.8000)"},100:{$type:"color",$value:"rgba(242, 242, 242, 0.8000)"},500:{$type:"color",$value:"rgba(204, 204, 204, 0.2000)"},700:{$type:"color",$value:"rgba(204, 204, 204, 0.6000)"},800:{$type:"color",$value:"rgba(186, 186, 186, 0.6000)"},900:{$type:"color",$value:"rgba(50, 50, 50, 0.9000)"},"05":{$type:"color",$value:"rgba(253, 253, 253, 0.8000)"}}},Unit:{Space:{0:{$type:"number",$value:"0px"},100:{$type:"number",$value:"4px"},150:{$type:"number",$value:"6px"},200:{$type:"number",$value:"8px"},300:{$type:"number",$value:"12px"},400:{$type:"number",$value:"16px"},500:{$type:"number",$value:"20px"},600:{$type:"number",$value:"24px"},800:{$type:"number",$value:"32px"},1e3:{$type:"number",$value:"40px"},1200:{$type:"number",$value:"48px"},1600:{$type:"number",$value:"64px"},2e3:{$type:"number",$value:"80px"},2400:{$type:"number",$value:"96px"},2800:{$type:"number",$value:"112px"},3200:{$type:"number",$value:"128px"},3600:{$type:"number",$value:"144px"},4e3:{$type:"number",$value:"160px"},4400:{$type:"number",$value:"176px"},4800:{$type:"number",$value:"192px"},5200:{$type:"number",$value:"208px"},5600:{$type:"number",$value:"224px"},6e3:{$type:"number",$value:"240px"},6400:{$type:"number",$value:"256px"},7200:{$type:"number",$value:"288px"},8e3:{$type:"number",$value:"320px"},9600:{$type:"number",$value:"384px"},"0125":{$type:"number",$value:"0.5px"},"025":{$type:"number",$value:"1px"},"0325":{$type:"number",$value:"1.5px"},"050":{$type:"number",$value:"2px"}},Stack:{100:{$type:"number",$value:"-4px"},200:{$type:"number",$value:"-8px"},300:{$type:"number",$value:"-12px"},400:{$type:"number",$value:"-16px"},800:{$type:"number",$value:"-32px"},1e3:{$type:"number",$value:"-40px"},1600:{$type:"number",$value:"-64px"},2400:{$type:"number",$value:"-96px"},3200:{$type:"number",$value:"-128px"},4e3:{$type:"number",$value:"-160px"},4800:{$type:"number",$value:"-192px"},5600:{$type:"number",$value:"-224px"},7200:{$type:"number",$value:"-288px"},9600:{$type:"number",$value:"-384px"},"0125":{$type:"number",$value:"-0.5px"},"025":{$type:"number",$value:"-1px"},"0325":{$type:"number",$value:"-1.5px"},"050":{$type:"number",$value:"-2px"},"075":{$type:"number",$value:"-3px"}},Size:{4:{$type:"number",$value:"4px"},6:{$type:"number",$value:"6px"},8:{$type:"number",$value:"8px"},10:{$type:"number",$value:"10px"},12:{$type:"number",$value:"12px"},14:{$type:"number",$value:"14px"},16:{$type:"number",$value:"16px"},18:{$type:"number",$value:"18px"},20:{$type:"number",$value:"20px"},22:{$type:"number",$value:"22px"},24:{$type:"number",$value:"24px"},28:{$type:"number",$value:"28px"},30:{$type:"number",$value:"30px"},32:{$type:"number",$value:"32px"},40:{$type:"number",$value:"40px"},48:{$type:"number",$value:"48px"},64:{$type:"number",$value:"64px"},80:{$type:"number",$value:"80px"},96:{$type:"number",$value:"96px"},112:{$type:"number",$value:"112px"},128:{$type:"number",$value:"128px"},144:{$type:"number",$value:"144px"},160:{$type:"number",$value:"160px"},176:{$type:"number",$value:"176px"},224:{$type:"number",$value:"224px"}},Resolution:{XxsmallScreenMin:{$type:"number",$value:"375px"},XsmallScreenMin:{$type:"number",$value:"480px"},SmallScreenMin:{$type:"number",$value:"576px"},MediumScreenMin:{$type:"number",$value:"768px"},LargeScreenMin:{$type:"number",$value:"992px"},XlargeScreenMin:{$type:"number",$value:"1200px"},XxlargeScreenMin:{$type:"number",$value:"1400px"},XxxsmallScreenMax:{$type:"number",$value:"374px"},XxsmallScreenMax:{$type:"number",$value:"479px"},XsmallScreenMax:{$type:"number",$value:"575px"},SmallScreenMax:{$type:"number",$value:"767px"},MediumScreenMax:{$type:"number",$value:"991px"},LargeScreenMax:{$type:"number",$value:"1199px"},XlargeScreenMax:{$type:"number",$value:"1399px"},XxlargeScreenMax:{$type:"number",$value:"1920px"}}},Font:{Family:{Main:{$type:"string",$value:"PP Mori"},Body:{$type:"string",$value:"Helvetica LT Pro"},Epigraph:{$type:"string",$value:"PP Mori"}}}},cD={Color:{Brand:{Base:{$type:"color",$value:"#335166",$web:"var(--color-brand-base)"},BaseSecondary:{$type:"color",$value:"#2b4354",$web:"var(--color-brand-base-secondary)"},BaseTertiary:{$type:"color",$value:"#202f3a",$web:"var(--color-brand-base-tertiary)"},Accent:{$type:"color",$value:"#4276cf",$web:"var(--color-brand-accent)"},AccentSecondary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-secondary)"},AccentTertiary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-tertiary)"},Light:{$type:"color",$value:"#f8fbf6",$web:"var(--color-brand-light)"},Dark:{$type:"color",$value:"#111b22",$web:"var(--color-brand-dark)"}}},Font:{Brand:{Heading:{$type:"string",$value:"Helvetica Neue",$web:"var(--font-brand-heading)"},Paragraph:{$type:"string",$value:"Inter",$web:"var(--font-brand-body)"}}},Unit:{Brand:{Radius:{$type:"number",$value:"4px",$web:"var(--unit-brand-radius)"}}}},de={Color:{Surface:{Plain:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.100}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.50}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.25}"},ShadowSecondary:{$value:"{Primitives.Color.Black.200}"}},Fill:{Accent:{$value:"{BrandPrimitives.Color.Brand.Accent}"},AccentHover:{$value:"{BrandPrimitives.Color.Brand.AccentSecondary}"},AccentPress:{$value:"{BrandPrimitives.Color.Brand.AccentTertiary}"},Base:{$value:"{BrandPrimitives.Color.Brand.Base}"},BaseHover:{$value:"{BrandPrimitives.Color.Brand.BaseSecondary}"},BasePress:{$value:"{BrandPrimitives.Color.Brand.BaseTertiary}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.700}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.300}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.100}"},SubtlePrimary:{$value:"{Primitives.Color.GreyAlpha.100}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.25}"},DangerPrimary:{$value:"{Primitives.Color.Red.600}"},Disabled:{$value:"{Primitives.Color.Grey.200}"},HotspotSecondary:{$value:"{Primitives.Color.GreyAlpha.800}"}},Icon:{NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"}},Text:{Invert:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.700}"},Disabled:{$value:"{Primitives.Color.Grey.300}"}},Border:{AltContrast:{$value:"{BrandPrimitives.Color.Brand.Dark}"},SubtlePrimary:{$value:"{Primitives.Color.Grey.300}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.700}"}}},Size:{Text:{Small:{$value:"{Primitives.Unit.Size.16}"},Medium:{$value:"{Primitives.Unit.Size.18}"},Large:{$value:"{Primitives.Unit.Size.20}"}},Icon:{Small:{$value:"{Primitives.Unit.Size.20}"},Medium:{$value:"{Primitives.Unit.Size.24}"},Large:{$value:"{Primitives.Unit.Size.28}"}},Radius:{Medium:{$value:"{Primitives.Unit.Space.150}"},Full:{$value:"{Primitives.Unit.Space.6000}"}},Stroke:{Regular:{$value:"{Primitives.Unit.Space.025}"},Thick:{$value:"{Primitives.Unit.Space.050}"}},Shadow:{None:{$value:"{Primitives.Unit.Space.0}"},Xsmall:{$value:"{Primitives.Unit.Space.025}"},Small:{$value:"{Primitives.Unit.Space.0325}"}},Blur:{Small:{$value:"{Primitives.Unit.Space.100}"}}},Space:{Padding:{Small:{$value:"{Primitives.Unit.Space.300}"},Medium:{$value:"{Primitives.Unit.Space.400}"},Regular:{$value:"{Primitives.Unit.Space.600}"}},Gap:{Small:{$value:"{Primitives.Unit.Space.200}"},Regular:{$value:"{Primitives.Unit.Space.400}"},Xxlarge:{$value:"{Primitives.Unit.Space.800}"}}},Font:{Family:{CustomH:{$value:"{BrandPrimitives.Font.Brand.Heading}"},CustomP:{$value:"{BrandPrimitives.Font.Brand.Paragraph}"},Main:{$value:"Helvetica Neue"}},Tracking:{Normal:{$value:"{Primitives.Unit.Space.0}"}}}};function oe(i){const e=/\{Primitives\.(.*?)}/,t=String(i).match(e),n=/\{BrandPrimitives\.(.*?)}/,s=String(i).match(n);let r=i;if(t){const a=t[1].split(".");r=aY[a[0]][a[1]][a[2]].$value}else if(s){const a=s[1].split("."),o=cD[a[0]][a[1]][a[2]],l=o.$web;r=`${l.substring(0,l.length-1)}, ${o.$value})`}return zi(r)}const Vb={poweredByEpigraphFooterText:"https://asset.myepigraph.com/design-assets/icons/powered-by-epigraph.svg",splashScreenLogo:"https://asset.myepigraph.com/design-assets/icons/default-splash-screen-image.svg",sampleQrCode:"https://asset.myepigraph.com/design-assets/icons/sample-qr-code.png"};function oY(){const i={};for(const[e,t]of Object.entries(cD))for(const[n,s]of Object.entries(t))for(const[r,a]of Object.entries(s)){const o=`${e}${n}${r}`;i[o]={name:zi(a.$web),defaultValue:a.$value,argType:{control:a.$type}}}return i}const lY=oY(),jh={size:{name:"size",defaultValue:"small",argType:{options:["small","medium","large"],control:"select"}},theme:{name:"theme",defaultValue:"light",argType:{options:["light","dark"],control:"select"}},disabled:{name:"disabled",defaultValue:!1,argType:{control:"boolean"}}};var cY=Object.defineProperty,du=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&cY(e,t,s),s};const Jl=class hD extends mh{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=jh.theme.defaultValue.toString(),this.size=jh.size.defaultValue.toString(),hD.ensureFontsAreLoaded(),this.addEventListener("click",this.doClick),this.addEventListener("pointerover",this.doHoverStart),this.addEventListener("pointerleave",this.doHoverEnd)}static{this.styles=[ht`
13175
+ */const Bn={LEFT:1,RIGHT:2,MIDDLE:4},te=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Qc={NONE:0,IN:1,OUT:-1};function Xo(i){return i.isPerspectiveCamera}function io(i){return i.isOrthographicCamera}const eo=Math.PI*2,vw=Math.PI/2,lD=1e-5,Wu=Math.PI/180;function tr(i,e,t){return Math.max(e,Math.min(t,i))}function dn(i,e=lD){return Math.abs(i)<e}function qt(i,e,t=lD){return dn(i-e,t)}function bw(i,e){return Math.round(i/e)*e}function ju(i){return isFinite(i)?i:i<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Xu(i){return Math.abs(i)<Number.MAX_VALUE?i:i*(1/0)}function Kp(i,e,t,n,s=1/0,r){n=Math.max(1e-4,n);const a=2/n,o=a*r,l=1/(1+o+.48*o*o+.235*o*o*o);let c=i-e;const u=e,h=s*n;c=tr(c,-h,h),e=i-c;const d=(t.value+a*c)*r;t.value=(t.value-a*d)*l;let A=e+(c+d)*l;return u-i>0==A>u&&(A=u,t.value=(A-u)/r),A}function xw(i,e,t,n,s=1/0,r,a){n=Math.max(1e-4,n);const o=2/n,l=o*r,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,d=e.z,A=i.x-u,p=i.y-h,g=i.z-d;const m=u,f=h,_=d,y=s*n,E=y*y,v=A*A+p*p+g*g;if(v>E){const P=Math.sqrt(v);A=A/P*y,p=p/P*y,g=g/P*y}u=i.x-A,h=i.y-p,d=i.z-g;const C=(t.x+o*A)*r,x=(t.y+o*p)*r,I=(t.z+o*g)*r;t.x=(t.x-o*C)*c,t.y=(t.y-o*x)*c,t.z=(t.z-o*I)*c,a.x=u+(A+C)*c,a.y=h+(p+x)*c,a.z=d+(g+I)*c;const b=m-i.x,w=f-i.y,S=_-i.z,B=a.x-m,T=a.y-f,D=a.z-_;return b*B+w*T+S*D>0&&(a.x=m,a.y=f,a.z=_,t.x=(a.x-m)/r,t.y=(a.y-f)/r,t.z=(a.z-_)/r),a}function my(i,e){e.set(0,0),i.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=i.length,e.y/=i.length}function _y(i,e){return io(i)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class nY{_listeners={};addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e)}}}const iY="3.1.2",Zp=1/8,sY=/Mac/.test(globalThis?.navigator?.platform);let dt,Cw,ef,yy,Wi,yt,Ft,Lc,Ju,yr,Er,Jo,Iw,ww,hs,Nc,Pc,Sw,Ey,Bw,vy,by,tf;class vh extends nY{static install(e){dt=e.THREE,Cw=Object.freeze(new dt.Vector3(0,0,0)),ef=Object.freeze(new dt.Vector3(0,1,0)),yy=Object.freeze(new dt.Vector3(0,0,1)),Wi=new dt.Vector2,yt=new dt.Vector3,Ft=new dt.Vector3,Lc=new dt.Vector3,Ju=new dt.Vector3,yr=new dt.Vector3,Er=new dt.Vector3,Jo=new dt.Vector3,Iw=new dt.Vector3,ww=new dt.Vector3,hs=new dt.Spherical,Nc=new dt.Spherical,Pc=new dt.Box3,Sw=new dt.Box3,Ey=new dt.Sphere,Bw=new dt.Quaternion,vy=new dt.Quaternion,by=new dt.Matrix4,tf=new dt.Raycaster}static get ACTION(){return te}minPolarAngle=0;maxPolarAngle=Math.PI;minAzimuthAngle=-1/0;maxAzimuthAngle=1/0;minDistance=Number.EPSILON;maxDistance=1/0;infinityDolly=!1;minZoom=.01;maxZoom=1/0;smoothTime=.25;draggingSmoothTime=.125;maxSpeed=1/0;azimuthRotateSpeed=1;polarRotateSpeed=1;dollySpeed=1;dollyDragInverted=!1;truckSpeed=2;dollyToCursor=!1;dragToOffset=!1;boundaryFriction=0;restThreshold=.01;colliderMeshes=[];mouseButtons;touches;cancel=()=>{};lockPointer;unlockPointer;_enabled=!0;_camera;_yAxisUpSpace;_yAxisUpSpaceInverse;_state=te.NONE;_domElement;_viewport=null;_target;_targetEnd;_focalOffset;_focalOffsetEnd;_spherical;_sphericalEnd;_lastDistance;_zoom;_zoomEnd;_lastZoom;_cameraUp0;_target0;_position0;_zoom0;_focalOffset0;_dollyControlCoord;_changedDolly=0;_changedZoom=0;_nearPlaneCorners;_hasRested=!0;_boundary;_boundaryEnclosesCamera=!1;_needsUpdate=!0;_updatedLastTime=!1;_elementRect=new DOMRect;_isDragging=!1;_dragNeedsUpdate=!0;_activePointers=[];_lockedPointer=null;_interactiveArea=new DOMRect(0,0,1,1);_isUserControllingRotate=!1;_isUserControllingDolly=!1;_isUserControllingTruck=!1;_isUserControllingOffset=!1;_isUserControllingZoom=!1;_lastDollyDirection=Qc.NONE;_thetaVelocity={value:0};_phiVelocity={value:0};_radiusVelocity={value:0};_targetVelocity=new dt.Vector3;_focalOffsetVelocity=new dt.Vector3;_zoomVelocity={value:0};set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),typeof dt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new dt.Quaternion().setFromUnitVectors(this._camera.up,ef),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=te.NONE,this._target=new dt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new dt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new dt.Spherical().setFromVector3(yt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new dt.Vector3,new dt.Vector3,new dt.Vector3,new dt.Vector3],this._updateNearPlaneCorners(),this._boundary=new dt.Box3(new dt.Vector3(-1/0,-1/0,-1/0),new dt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new dt.Vector2,this.mouseButtons={left:te.ROTATE,middle:te.DOLLY,right:te.TRUCK,wheel:Xo(this._camera)?te.DOLLY:io(this._camera)?te.ZOOM:te.NONE},this.touches={one:te.TOUCH_ROTATE,two:Xo(this._camera)?te.TOUCH_DOLLY_TRUCK:io(this._camera)?te.TOUCH_ZOOM_TRUCK:te.NONE,three:te.TOUCH_TRUCK};const n=new dt.Vector2,s=new dt.Vector2,r=new dt.Vector2,a=f=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),v=f.clientX/E.width,C=f.clientY/E.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||C<this._interactiveArea.top||C>this._interactiveArea.bottom)return}const _=f.pointerType!=="mouse"?null:(f.buttons&Bn.LEFT)===Bn.LEFT?Bn.LEFT:(f.buttons&Bn.MIDDLE)===Bn.MIDDLE?Bn.MIDDLE:(f.buttons&Bn.RIGHT)===Bn.RIGHT?Bn.RIGHT:null;if(_!==null){const E=this._findPointerByMouseButton(_);E&&this._disposePointer(E)}if((f.buttons&Bn.LEFT)===Bn.LEFT&&this._lockedPointer)return;const y={pointerId:f.pointerId,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:_};this._activePointers.push(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,d(f)},o=f=>{f.cancelable&&f.preventDefault();const _=f.pointerId,y=this._lockedPointer||this._findPointerById(_);if(y){if(y.clientX=f.clientX,y.clientY=f.clientY,y.deltaX=f.movementX,y.deltaY=f.movementY,this._state=0,f.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(f.buttons&Bn.LEFT)===Bn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);A()}},l=f=>{const _=this._findPointerById(f.pointerId);if(!(_&&_===this._lockedPointer)){if(_&&this._disposePointer(_),f.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=te.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=te.NONE;p()}};let c=-1;const u=f=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===te.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),I=f.clientX/x.width,b=f.clientY/x.height;if(I<this._interactiveArea.left||I>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}if(f.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===te.ROTATE||this.mouseButtons.wheel===te.TRUCK){const x=performance.now();c-x<1e3&&this._getClientRect(this._elementRect),c=x}const _=sY?-1:-3,y=f.deltaMode===1&&!f.ctrlKey?f.deltaY/_:f.deltaY/(_*10),E=this.dollyToCursor?(f.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,v=this.dollyToCursor?(f.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(f.ctrlKey?te.ZOOM:this.mouseButtons.wheel){case te.ROTATE:{this._rotateInternal(f.deltaX,f.deltaY),this._isUserControllingRotate=!0;break}case te.TRUCK:{this._truckInternal(f.deltaX,f.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case te.SCREEN_PAN:{this._truckInternal(f.deltaX,f.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case te.OFFSET:{this._truckInternal(f.deltaX,f.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case te.DOLLY:{this._dollyInternal(-y,E,v),this._isUserControllingDolly=!0;break}case te.ZOOM:{this._zoomInternal(-y,E,v),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=f=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===vh.ACTION.NONE){const _=f instanceof PointerEvent?f.pointerId:0,y=this._findPointerById(_);y&&this._disposePointer(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}f.preventDefault()}},d=f=>{if(!this._enabled)return;if(my(this._activePointers,Wi),this._getClientRect(this._elementRect),n.copy(Wi),s.copy(Wi),this._activePointers.length>=2){const y=Wi.x-this._activePointers[1].clientX,E=Wi.y-this._activePointers[1].clientY,v=Math.sqrt(y*y+E*E);r.set(0,v);const C=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,x=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(C,x)}if(this._state=0,!f)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in f&&f.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(f.buttons&Bn.LEFT)===Bn.LEFT&&(this._state=this._state|this.mouseButtons.left),(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&te.TRUCK)===te.TRUCK||(this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&te.DOLLY)===te.DOLLY||(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&te.ZOOM)===te.ZOOM||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},A=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,my(this._activePointers,Wi);const _=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,y=_?-_.deltaX:s.x-Wi.x,E=_?-_.deltaY:s.y-Wi.y;if(s.copy(Wi),((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(y,E),this._isUserControllingRotate=!0),(this._state&te.DOLLY)===te.DOLLY||(this._state&te.ZOOM)===te.ZOOM){const v=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,C=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,x=this.dollyDragInverted?-1:1;(this._state&te.DOLLY)===te.DOLLY?(this._dollyInternal(x*E*Zp,v,C),this._isUserControllingDolly=!0):(this._zoomInternal(x*E*Zp,v,C),this._isUserControllingZoom=!0)}if((this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE){const v=Wi.x-this._activePointers[1].clientX,C=Wi.y-this._activePointers[1].clientY,x=Math.sqrt(v*v+C*C),I=r.y-x;r.set(0,x);const b=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET?(this._dollyInternal(I*Zp,b,w),this._isUserControllingDolly=!0):(this._zoomInternal(I*Zp,b,w),this._isUserControllingZoom=!0)}((this._state&te.TRUCK)===te.TRUCK||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(y,E,!1,!1),this._isUserControllingTruck=!0),((this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(y,E,!1,!0),this._isUserControllingTruck=!0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(y,E,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},p=()=>{my(this._activePointers,Wi),s.copy(Wi),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",m),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),d())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),this._domElement?.ownerDocument.exitPointerLock(),this._domElement?.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement?.ownerDocument.removeEventListener("pointerlockerror",m),this.cancel()};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},m=()=>{this.unlockPointer()};this._addAllEventListeners=f=>{this._domElement=f,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",m))},this.cancel=()=>{this._state!==te.NONE&&(this._state=te.NONE,this._activePointers.length=0,p())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=tr(e.width,0,1),this._interactiveArea.height=tr(e.height,0,1),this._interactiveArea.x=tr(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=tr(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const s=tr(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=tr(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!n||qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0,this._dollyToNoClamp(tr(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=qt(a,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ju).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=tr(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||qt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),yr.multiplyScalar(e),Er.multiplyScalar(-t);const s=yt.copy(yr).add(Er),r=Ft.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){yt.setFromMatrixColumn(this._camera.matrix,0),yt.crossVectors(this._camera.up,yt),yt.multiplyScalar(e);const n=Ft.copy(this._targetEnd).add(yt);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return yt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+yt.x,this._targetEnd.y+yt.y,this._targetEnd.z+yt.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const r=yt.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const a=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,n,s=!1){const o=yt.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?Pc.copy(e):Pc.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=bw(this._sphericalEnd.theta,vw),h=bw(this._sphericalEnd.phi,vw);l.push(this.rotateTo(u,h,t));const d=yt.setFromSpherical(this._sphericalEnd).normalize(),A=Bw.setFromUnitVectors(d,yy),p=qt(Math.abs(d.y),1);p&&A.multiply(vy.setFromAxisAngle(ef,u)),A.multiply(this._yAxisUpSpaceInverse);const g=Sw.makeEmpty();Ft.copy(c.min).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setX(c.max.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setY(c.max.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setZ(c.min.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setZ(c.max.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setY(c.min.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setX(c.min.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).applyQuaternion(A),g.expandByPoint(Ft),g.min.x-=s,g.min.y-=a,g.max.x+=r,g.max.y+=o,A.setFromUnitVectors(yy,d),p&&A.premultiply(vy.invert()),A.premultiply(this._yAxisUpSpace);const m=g.getSize(yt),f=g.getCenter(Ft).applyQuaternion(A);if(Xo(this._camera)){const _=this.getDistanceToFitBox(m.x,m.y,m.z,n);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(io(this._camera)){const _=this._camera,y=_.right-_.left,E=_.top-_.bottom,v=n?Math.max(y/m.x,E/m.y):Math.min(y/m.x,E/m.y);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.zoomTo(v,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],r="isObject3D"in e?vh.createBoundingSphere(e,Ey):Ey.copy(e);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),Xo(this._camera)){const a=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(a,t))}else if(io(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*r.radius,c=Math.min(a/l,o/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,r,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const l=Ft.set(s,r,a),c=yt.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerp(e,t,n,s=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const r=yt.set(...e.target);if("spherical"in e)hs.set(...e.spherical);else{const h=Ft.set(...e.position);hs.setFromVector3(h.sub(r).applyQuaternion(this._yAxisUpSpace))}const a=Lc.set(...t.target);if("spherical"in t)Nc.set(...t.spherical);else{const h=Ft.set(...t.position);Nc.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(r.lerp(a,n));const o=Nc.theta-hs.theta,l=Nc.phi-hs.phi,c=Nc.radius-hs.radius;this._sphericalEnd.set(hs.radius+c*n,hs.phi+l*n,hs.theta+o*n),this._needsUpdate=!0,s||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,s,r,a,o,l,c,u,h,d,A,p=!1){return this.lerp({position:[e,t,n],target:[s,r,a]},{position:[o,l,c],target:[u,h,d]},A,p)}setPosition(e,t,n,s=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,n,s=!1){const r=this.getPosition(yt),a=this.setLookAt(r.x,r.y,r.z,e,t,n,s);return this._sphericalEnd.phi=tr(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,n,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const r=!s||qt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&qt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&qt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),yr.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Er.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Jo.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=yt.set(e,t,n),r=s.distanceTo(this._camera.position),a=s.sub(this._camera.position);yr.multiplyScalar(a.x),Er.multiplyScalar(a.y),Jo.multiplyScalar(a.z),yt.copy(yr).add(Er).add(Jo),yt.z=yt.z+r,this.dollyTo(r,!1),this.setFocalOffset(-yt.x,yt.y,-yt.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new dt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(_y(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,a=this._camera.getEffectiveFOV()*Wu,o=this._camera.aspect;return((s?r>o:r<o)?t:e/o)*.5/Math.tan(a*.5)+n*.5}getDistanceToFitSphere(e){if(_y(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Wu,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:n;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new dt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%eo+eo)%eo,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=eo),this._spherical.theta+=eo*Math.round((this._sphericalEnd.theta-this._spherical.theta)/eo),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!qt(this._camera.up.x,this._cameraUp0.x)||!qt(this._camera.up.y,this._cameraUp0.y)||!qt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,ef),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=yt.subVectors(this._target,this._camera.position).normalize(),t=Ft.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,r=Iw.subVectors(this._targetEnd,this._target),a=ww.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(dn(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Kp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Kp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const h=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Kp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,h,this.maxSpeed,e),this._needsUpdate=!0}if(dn(r.x)&&dn(r.y)&&dn(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const h=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;xw(this._target,this._targetEnd,this._targetVelocity,h,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(dn(a.x)&&dn(a.y)&&dn(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const h=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;xw(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,h,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(dn(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const h=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Kp(this._zoom,this._zoomEnd,this._zoomVelocity,h,1/0,e)}if(this.dollyToCursor){if(Xo(this._camera)&&this._changedDolly!==0){const h=this._spherical.radius-this._lastDistance,d=this._camera,A=this._getCameraDirection(Ju),p=yt.copy(A).cross(d.up).normalize();p.lengthSq()===0&&(p.x=1);const g=Ft.crossVectors(p,A),m=this._sphericalEnd.radius*Math.tan(d.getEffectiveFOV()*Wu*.5),_=(this._sphericalEnd.radius-h-this._sphericalEnd.radius)/this._sphericalEnd.radius,y=Lc.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*m*d.aspect)).add(g.multiplyScalar(this._dollyControlCoord.y*m)),E=yt.copy(this._targetEnd).lerp(y,_),v=this._lastDollyDirection===Qc.IN&&this._spherical.radius<=this.minDistance,C=this._lastDollyDirection===Qc.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(v||C)){this._sphericalEnd.radius-=h,this._spherical.radius-=h;const I=Ft.copy(A).multiplyScalar(-h);E.add(I)}this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedDolly-=h,dn(this._changedDolly)&&(this._changedDolly=0)}else if(io(this._camera)&&this._changedZoom!==0){const h=this._zoom-this._lastZoom,d=this._camera,A=yt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(d.near+d.far)/(d.near-d.far)).unproject(d),p=Ft.set(0,0,-1).applyQuaternion(d.quaternion),g=Lc.copy(A).add(p.multiplyScalar(-A.dot(d.up))),f=-(this._zoom-h-this._zoom)/this._zoom,_=this._getCameraDirection(Ju),y=this._targetEnd.dot(_),E=yt.copy(this._targetEnd).lerp(g,f),v=E.dot(_),C=_.multiplyScalar(v-y);E.sub(C),this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedZoom-=h,dn(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!dn(this._focalOffset.x)||!dn(this._focalOffset.y)||!dn(this._focalOffset.z))&&(this._camera.matrix.compose(this._camera.position,this._camera.quaternion,this._camera.scale),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),Jo.setFromMatrixColumn(this._camera.matrix,2),yr.multiplyScalar(this._focalOffset.x),Er.multiplyScalar(-this._focalOffset.y),Jo.multiplyScalar(this._focalOffset.z),yt.copy(yr).add(Er).add(Jo),this._camera.position.add(yt),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),yt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),dn(t,this.restThreshold)&&dn(n,this.restThreshold)&&dn(s,this.restThreshold)&&dn(r.x,this.restThreshold)&&dn(r.y,this.restThreshold)&&dn(r.z,this.restThreshold)&&dn(a.x,this.restThreshold)&&dn(a.y,this.restThreshold)&&dn(a.z,this.restThreshold)&&dn(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ju(this.maxDistance),minZoom:this.minZoom,maxZoom:ju(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ju(this.maxPolarAngle),minAzimuthAngle:ju(this.minAzimuthAngle),maxAzimuthAngle:ju(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:yt.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Xu(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Xu(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Xu(n.maxPolarAngle),this.minAzimuthAngle=Xu(n.minAzimuthAngle),this.maxAzimuthAngle=Xu(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),hs.setFromVector3(yt.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(hs.theta,hs.phi,t),this.dollyTo(hs.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",iY),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const s=t.lengthSq();if(s===0)return e;const r=Ft.copy(t).add(e),o=this._boundary.clampPoint(r,Lc).sub(r),l=o.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(n===0)return e.add(t).add(o);{const c=1+n*l/t.dot(o);return e.add(Ft.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Xo(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*Wu,s=Math.tan(n*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(io(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,r=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,a,0),this._nearPlaneCorners[3].set(n,a,0)}}_truckInternal=(e,t,n,s)=>{let r,a;if(Xo(this._camera)){const o=yt.copy(this._camera.position).sub(this._target),l=this._camera.getEffectiveFOV()*Wu,c=o.length()*Math.tan(l*.5);r=this.truckSpeed*e*c/this._elementRect.height,a=this.truckSpeed*t*c/this._elementRect.height}else if(io(this._camera)){const o=this._camera;r=this.truckSpeed*e*(o.right-o.left)/o.zoom/this._elementRect.width,a=this.truckSpeed*t*(o.top-o.bottom)/o.zoom/this._elementRect.height}else return;s?(n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(r,0,!0),this.forward(-a,!0)):n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(r,a,!0)};_rotateInternal=(e,t)=>{const n=eo*this.azimuthRotateSpeed*e/this._elementRect.height,s=eo*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(n,s,!0)};_dollyInternal=(e,t,n)=>{const s=Math.pow(.95,-e*this.dollySpeed),r=this._sphericalEnd.radius,a=this._sphericalEnd.radius*s,o=tr(a,this.minDistance,this.maxDistance),l=o-a;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(l,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-r,this._dollyControlCoord.set(t,n)),this._lastDollyDirection=Math.sign(-e)};_zoomInternal=(e,t,n)=>{const s=Math.pow(.95,e*this.dollySpeed),r=this._zoom,a=this._zoom*s;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-r,this._dollyControlCoord.set(t,n))};_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||_y(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ju);by.lookAt(Cw,n,this._camera.up);for(let s=0;s<4;s++){const r=Ft.copy(this._nearPlaneCorners[s]);r.applyMatrix4(by);const a=Lc.addVectors(this._target,r);tf.set(a,n),tf.far=this._spherical.radius+1;const o=tf.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new dt.Sphere){const n=t,s=n.center;Pc.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&Pc.expandByObject(a)}),Pc.getCenter(s);let r=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a;if(!o.geometry)return;const l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let h=0,d=u.count;h<d;h++)yt.fromBufferAttribute(u,h),r=Math.max(r,s.distanceToSquared(yt))}),n.radius=Math.sqrt(r),n}}class Tw{constructor(e){this.__position=new Q,this.__target=new Q,this.setPosition(e.position.x,e.position.y,e.position.z),this.setTarget(e.target.x,e.target.y,e.target.z)}getPosition(){return this.__position}setPosition(e,t,n){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(n)}getTarget(){return this.__target}setTarget(e,t,n){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(n)}}class Gg extends Hb{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainRenderer={},this.__mainCameraControls={},this.__cameraDirection=new Q,this.__cameraSpherical=new Ll,this.__savedCameraState={position:new Q,target:new Q,focalLength:0},this.__currentCameraPosition=new Q,this.__currentTargetPosition=new Q,this.__touchScrollState=null,this.__pointerZoomEnabled=!1}static{this.TAU=Math.PI*2}get cameraActions(){return vh.ACTION}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}getCurrentCameraTransforms(){return this.__cameras.main.getWorldPosition(this.__currentCameraPosition),this.__mainCameraControls.getTarget(this.__currentTargetPosition),{position:this.__currentCameraPosition,target:this.__currentTargetPosition,focalLength:this.__cameras.main.getFocalLength()}}getCurrentCameraRotation(){return{azimuthAngle:this.__mainCameraControls.azimuthAngle,polarAngle:this.__mainCameraControls.polarAngle,distance:this.__mainCameraControls.distance}}getCameraFocalLength(){return this.__cameras.main.getFocalLength()}setCameraFocalLength(e){this.__cameras.main.setFocalLength(e)}async fitCameraToSceneBounds(e=!0){const t=this._appWcRef.getSceneSphericalBounds().clone();if(t.isEmpty()||t.radius<=0)return;let n=this._appWcRef.productSettings.camera.cameraBoundsMultiplier;return this._appWcRef.cameraBoundsMultiplier!==0&&(n=this._appWcRef.cameraBoundsMultiplier),this._appWcRef.aspectRatio<1&&(n=1),t.radius=t.radius*n,await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(){const e=this.__mainCameraControls,t=e.currentAction===e.mouseButtons?.right||e.currentAction===e.touches?.two;this.__cameraSettings.canPan&&t?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):e.currentAction===e.mouseButtons?.left?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"rotate"}):this._appWcRef.eventsManager.cameraControlsStart.fire({type:null})}__onMainCameraControlsControlEnd(){this._appWcRef.eventsManager.inputEnd.fire()}saveCurrentCameraTransforms(){this.__mainCameraControls.getPosition(this.__savedCameraState.position),this.__mainCameraControls.getTarget(this.__savedCameraState.target),this.__savedCameraState.focalLength=this.getCameraFocalLength()}resetCurrentCameraTransformsToLastSavedState(e=!0){this.moveCameraToLocation({newCameraTransforms:this.__savedCameraState,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t}){this._appWcRef.productSettings.camera.canZoom===!1&&(e=null,t=null),e===null&&(e=.001),t===null&&(t=1/0);const n=this._appWcRef.getSceneSphericalBounds().radius;n<0||(this.__mainCameraControls.maxDistance=n+t,this.__mainCameraControls.minDistance=Math.min(n+e,n+t))}async zoomIn(e=.1){await this.__mainCameraControls.dolly(e,!0)}async zoomOut(e=.1){await this.__mainCameraControls.dolly(-e,!0)}enableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.ROTATE,this.__mainCameraControls.touches.one=this.cameraActions.TOUCH_ROTATE}disableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.NONE,this.__mainCameraControls.touches.one=this.cameraActions.NONE}enablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY_TRUCK,this.__mainCameraControls.mouseButtons.right=this.cameraActions.TRUCK}disablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.right=this.cameraActions.NONE}enableZoomControls(){if(this._appWcRef.disableZoom){this.disableZoomControls();return}this.__pointerZoomEnabled=!0,this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.DOLLY}disableZoomControls(){this.__pointerZoomEnabled=!1,this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.NONE}enableCameraZoomLimits(e){this.setCameraZoomLimits({minDistance:e.minDistance,maxDistance:e.maxDistance})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:null,maxDistance:null})}enableCameraRotationLimits(e){const{infinitePolarAngle:t,minPolarAngle:n,maxPolarAngle:s,infiniteAzimuthAngle:r,minAzimuthAngle:a,maxAzimuthAngle:o}=e;this.__mainCameraControls.minPolarAngle=t?-1/0:n,this.__mainCameraControls.maxPolarAngle=t?1/0:s,this.__mainCameraControls.minAzimuthAngle=r?-1/0:a,this.__mainCameraControls.maxAzimuthAngle=r?1/0:o}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}updateCameraSettings(e){this.__cameraSettings=JSON.parse(JSON.stringify(e)),this.enableRotationControls();const{canPan:t,canZoom:n}=e;n?this.enableZoomControls():this.disableZoomControls(),t?this.enablePanControls():this.disablePanControls(),this.__mainCameraControls.mouseButtons.middle=this.cameraActions.NONE,this.__mainCameraControls.enabled=!0,this.__cameras.main.setFocalLength(e.focalLength),this.__cameras.main.near=e.nearClip,this.__cameras.main.far=e.farClip,this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e),this._appWcRef.transparentBackground===!1&&(this.__mainRenderer.setClearColor(e.backgroundColor),this.__mainRenderer.setClearAlpha(e.backgroundAlpha))}normalizeAngle(e){return Ki.euclideanModulo(e,Gg.TAU)}absoluteAngle(e,t){const n=e-t;return Ki.euclideanModulo(n+Math.PI,Gg.TAU)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:n=!0,targetCameraControlsRef:s=this.__mainCameraControls,ignoreCameraLimits:r=!1}){e instanceof Tw||(e=new Tw(e));const a=e.getPosition(),o=e.getTarget();if(s.enabled=!1,r===!0)s.setLookAt(a.x,a.y,a.z,o.x,o.y,o.z,n),s.normalizeRotations();else{this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(a,o),this.__cameraDirection.normalize();const l=a.distanceTo(o);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const c=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(s.azimuthAngle)),u=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(s.polarAngle));s.rotate(c,u,n),s.moveTo(o.x,o.y,o.z,n),s.dollyTo(l,n)}t||(s.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:n,transition:s=!0,targetCameraControlsRef:r=this.__mainCameraControls}){e&&r.rotateAzimuthTo(e,s),t&&r.rotatePolarTo(t,s),n&&r.dollyTo(n,s)}async fitCameraToObject({objectToFocus:e,enableTransition:t=!0}){return await this.__mainCameraControls.fitToSphere(e,t)}async wiggleCamera(){const e=this.__mainCameraControls.azimuthAngle,t=[0,.4,-.3,0];for(const n of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+n,!0)}}__onProductSettingsUpdated(){this.updateCameraSettings(this._appWcRef.productSettings.camera),this.fitCameraToSceneBounds()}__onCameraMoveToTransform(e){e.detail.saveFirst&&this.saveCurrentCameraTransforms(),this.moveCameraToLocation({newCameraTransforms:e.detail.cameraTransforms,ignoreCameraLimits:e.detail.ignoreCameraLimits})}__onSceneBoundsChanged(){this.__mainCameraControls.setBoundary(this._appWcRef.getSceneBounds())}__setupTouchScrollDetection(){if(!("ontouchstart"in window||navigator.maxTouchPoints>0))return;const t=this.__mainRenderer.domElement,n=this.__mainCameraControls;t.style.touchAction="pan-y",new MutationObserver(()=>{t.style.touchAction!=="pan-y"&&(t.style.touchAction="pan-y")}).observe(t,{attributeFilter:["style"]});const r=5;t.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(this.__touchScrollState={startX:a.clientX,startY:a.clientY,decided:!1,isVerticalScroll:!1})}),document.addEventListener("pointermove",a=>{if(!(!this.__touchScrollState||a.pointerType!=="touch")){if(!this.__touchScrollState.decided){const o=Math.abs(a.clientX-this.__touchScrollState.startX),l=Math.abs(a.clientY-this.__touchScrollState.startY);if(o<r&&l<r)return;this.__touchScrollState.decided=!0,this.__touchScrollState.isVerticalScroll=l>o,this.__touchScrollState.isVerticalScroll&&n.cancel()}this.__touchScrollState.isVerticalScroll&&a.stopImmediatePropagation()}},{capture:!0}),document.addEventListener("pointerup",a=>{!this.__touchScrollState||a.pointerType!=="touch"||(this.__touchScrollState=null)},{capture:!0})}__onWheel(e){if(!e.ctrlKey||!this.__pointerZoomEnabled)return;e.preventDefault(),e.stopImmediatePropagation();const t=new WheelEvent("wheel",{deltaX:e.deltaX,deltaY:e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,ctrlKey:!1,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:e.bubbles,cancelable:e.cancelable});e.target?.dispatchEvent(t)}__setupTrackpadPinchAsDollyHandler(){this.__mainRenderer.domElement.addEventListener("wheel",this.__onWheel.bind(this),{passive:!1})}__setupEventListeners(){this.__setupTouchScrollDetection(),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart()}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraProductSettingUpdatedEvent.name,this.__onProductSettingsUpdated.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,this.__onCameraMoveToTransform.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.sceneBoundsChanged.name,this.__onSceneBoundsChanged.bind(this))}async setup({mainRenderer:e}){this.__mainRenderer=e;const t=new $n(75,window.innerWidth/window.innerHeight,.1,1e3);this.__cameras={main:t,screenshot:t.clone()},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(1);const n={Vector2:pe,Vector3:Q,Vector4:Mt,Quaternion:Yt,Matrix4:We,Spherical:Ll,Box3:Rn,Sphere:ts,Raycaster:bb};vh.install({THREE:n}),this.__setupTrackpadPinchAsDollyHandler(),this.__mainCameraControls=new vh(this.__cameras.main,e.domElement),this.__setupEventListeners()}}const rY='@font-face{font-family:Helvetica Neue;src:url(https://asset.myepigraph.com/design-assets/fonts/HelveticaNeue/HelveticaNeue-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:PPMori-Regular;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:PPMori-Bold;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter-VariableFont_slnt_wght.ttf) format("truetype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter_18pt-Bold.ttf) format("truetype");font-weight:700;font-style:normal;font-display:swap}',aY={Color:{Black:{25:{$type:"color",$value:"rgba(0, 0, 0, 0.0000)"},50:{$type:"color",$value:"rgba(0, 0, 0, 0.0500)"},100:{$type:"color",$value:"rgba(0, 0, 0, 0.1000)"},200:{$type:"color",$value:"rgba(0, 0, 0, 0.2000)"},300:{$type:"color",$value:"rgba(0, 0, 0, 0.3000)"},400:{$type:"color",$value:"rgba(0, 0, 0, 0.4000)"},500:{$type:"color",$value:"rgba(0, 0, 0, 0.5000)"},600:{$type:"color",$value:"rgba(0, 0, 0, 0.6000)"},700:{$type:"color",$value:"rgba(0, 0, 0, 0.7000)"},800:{$type:"color",$value:"rgba(0, 0, 0, 0.8000)"},900:{$type:"color",$value:"rgba(0, 0, 0, 0.9000)"},1e3:{$type:"color",$value:"#000000"}},White:{25:{$type:"color",$value:"rgba(255, 255, 255, 0.0250)"},50:{$type:"color",$value:"rgba(255, 255, 255, 0.0500)"},100:{$type:"color",$value:"rgba(255, 255, 255, 0.1000)"},200:{$type:"color",$value:"rgba(255, 255, 255, 0.2000)"},300:{$type:"color",$value:"rgba(255, 255, 255, 0.3000)"},400:{$type:"color",$value:"rgba(255, 255, 255, 0.4000)"},500:{$type:"color",$value:"rgba(255, 255, 255, 0.5000)"},600:{$type:"color",$value:"rgba(255, 255, 255, 0.6000)"},700:{$type:"color",$value:"rgba(255, 255, 255, 0.7000)"},800:{$type:"color",$value:"rgba(255, 255, 255, 0.8000)"},900:{$type:"color",$value:"rgba(255, 255, 255, 0.9000)"},1e3:{$type:"color",$value:"#ffffff"}},Green:{100:{$type:"color",$value:"#ebffee"},200:{$type:"color",$value:"#cff7d3"},300:{$type:"color",$value:"#aff4c6"},400:{$type:"color",$value:"#85e0a3"},500:{$type:"color",$value:"#14ae5c"},600:{$type:"color",$value:"#009951"},700:{$type:"color",$value:"#008043"},800:{$type:"color",$value:"#02542d"},900:{$type:"color",$value:"#024023"},1e3:{$type:"color",$value:"#062d1b"}},Red:{100:{$type:"color",$value:"#fee9e7"},200:{$type:"color",$value:"#fdd3d0"},300:{$type:"color",$value:"#fcb3ad"},400:{$type:"color",$value:"#f4776a"},500:{$type:"color",$value:"#ec221f"},600:{$type:"color",$value:"#c00f0c"},700:{$type:"color",$value:"#900b09"},800:{$type:"color",$value:"#690807"},900:{$type:"color",$value:"#4d0b0a"},1e3:{$type:"color",$value:"#300603"}},Yellow:{100:{$type:"color",$value:"#fffbeb"},200:{$type:"color",$value:"#fff1c2"},300:{$type:"color",$value:"#ffe8a3"},400:{$type:"color",$value:"#e8b931"},500:{$type:"color",$value:"#e5a000"},600:{$type:"color",$value:"#bf6a02"},700:{$type:"color",$value:"#975102"},800:{$type:"color",$value:"#682d03"},900:{$type:"color",$value:"#522504"},1e3:{$type:"color",$value:"#401b01"}},Blue:{100:{$type:"color",$value:"#fbfdff"},200:{$type:"color",$value:"#eaf4ff"},300:{$type:"color",$value:"#d5ebff"},400:{$type:"color",$value:"#c0e1ff"},500:{$type:"color",$value:"#91d0ff"},600:{$type:"color",$value:"#0094d5"},700:{$type:"color",$value:"#00679b"},800:{$type:"color",$value:"#003a5a"},900:{$type:"color",$value:"#003a5a"},1e3:{$type:"color",$value:"#002133"}},Slate:{100:{$type:"color",$value:"#f5f5f5"},200:{$type:"color",$value:"#e3e3e3"},300:{$type:"color",$value:"#cdcdcd"},400:{$type:"color",$value:"#b2b2b2"},500:{$type:"color",$value:"#949494"},600:{$type:"color",$value:"#767676"},700:{$type:"color",$value:"#5a5a5a"},800:{$type:"color",$value:"#434343"},900:{$type:"color",$value:"#303030"},1e3:{$type:"color",$value:"#242424"}},Grey:{25:{$type:"color",$value:"#f5f5f5"},50:{$type:"color",$value:"#f2f2f2"},100:{$type:"color",$value:"#e6e6e6"},200:{$type:"color",$value:"#cccccc"},300:{$type:"color",$value:"#b3b3b3"},400:{$type:"color",$value:"#999999"},500:{$type:"color",$value:"#7b7b7b"},600:{$type:"color",$value:"#666666"},700:{$type:"color",$value:"#4d4d4d"},800:{$type:"color",$value:"#333333"},900:{$type:"color",$value:"#1a1a1a"},1e3:{$type:"color",$value:"#0d0d0d"}},GreyAlpha:{25:{$type:"color",$value:"rgba(248, 248, 248, 0.8000)"},100:{$type:"color",$value:"rgba(242, 242, 242, 0.8000)"},500:{$type:"color",$value:"rgba(204, 204, 204, 0.2000)"},700:{$type:"color",$value:"rgba(204, 204, 204, 0.6000)"},800:{$type:"color",$value:"rgba(186, 186, 186, 0.6000)"},900:{$type:"color",$value:"rgba(50, 50, 50, 0.9000)"},"05":{$type:"color",$value:"rgba(253, 253, 253, 0.8000)"}}},Unit:{Space:{0:{$type:"number",$value:"0px"},100:{$type:"number",$value:"4px"},150:{$type:"number",$value:"6px"},200:{$type:"number",$value:"8px"},300:{$type:"number",$value:"12px"},400:{$type:"number",$value:"16px"},500:{$type:"number",$value:"20px"},600:{$type:"number",$value:"24px"},800:{$type:"number",$value:"32px"},1e3:{$type:"number",$value:"40px"},1200:{$type:"number",$value:"48px"},1600:{$type:"number",$value:"64px"},2e3:{$type:"number",$value:"80px"},2400:{$type:"number",$value:"96px"},2800:{$type:"number",$value:"112px"},3200:{$type:"number",$value:"128px"},3600:{$type:"number",$value:"144px"},4e3:{$type:"number",$value:"160px"},4400:{$type:"number",$value:"176px"},4800:{$type:"number",$value:"192px"},5200:{$type:"number",$value:"208px"},5600:{$type:"number",$value:"224px"},6e3:{$type:"number",$value:"240px"},6400:{$type:"number",$value:"256px"},7200:{$type:"number",$value:"288px"},8e3:{$type:"number",$value:"320px"},9600:{$type:"number",$value:"384px"},"0125":{$type:"number",$value:"0.5px"},"025":{$type:"number",$value:"1px"},"0325":{$type:"number",$value:"1.5px"},"050":{$type:"number",$value:"2px"}},Stack:{100:{$type:"number",$value:"-4px"},200:{$type:"number",$value:"-8px"},300:{$type:"number",$value:"-12px"},400:{$type:"number",$value:"-16px"},800:{$type:"number",$value:"-32px"},1e3:{$type:"number",$value:"-40px"},1600:{$type:"number",$value:"-64px"},2400:{$type:"number",$value:"-96px"},3200:{$type:"number",$value:"-128px"},4e3:{$type:"number",$value:"-160px"},4800:{$type:"number",$value:"-192px"},5600:{$type:"number",$value:"-224px"},7200:{$type:"number",$value:"-288px"},9600:{$type:"number",$value:"-384px"},"0125":{$type:"number",$value:"-0.5px"},"025":{$type:"number",$value:"-1px"},"0325":{$type:"number",$value:"-1.5px"},"050":{$type:"number",$value:"-2px"},"075":{$type:"number",$value:"-3px"}},Size:{4:{$type:"number",$value:"4px"},6:{$type:"number",$value:"6px"},8:{$type:"number",$value:"8px"},10:{$type:"number",$value:"10px"},12:{$type:"number",$value:"12px"},14:{$type:"number",$value:"14px"},16:{$type:"number",$value:"16px"},18:{$type:"number",$value:"18px"},20:{$type:"number",$value:"20px"},22:{$type:"number",$value:"22px"},24:{$type:"number",$value:"24px"},28:{$type:"number",$value:"28px"},30:{$type:"number",$value:"30px"},32:{$type:"number",$value:"32px"},40:{$type:"number",$value:"40px"},48:{$type:"number",$value:"48px"},64:{$type:"number",$value:"64px"},80:{$type:"number",$value:"80px"},96:{$type:"number",$value:"96px"},112:{$type:"number",$value:"112px"},128:{$type:"number",$value:"128px"},144:{$type:"number",$value:"144px"},160:{$type:"number",$value:"160px"},176:{$type:"number",$value:"176px"},224:{$type:"number",$value:"224px"}},Resolution:{XxsmallScreenMin:{$type:"number",$value:"375px"},XsmallScreenMin:{$type:"number",$value:"480px"},SmallScreenMin:{$type:"number",$value:"576px"},MediumScreenMin:{$type:"number",$value:"768px"},LargeScreenMin:{$type:"number",$value:"992px"},XlargeScreenMin:{$type:"number",$value:"1200px"},XxlargeScreenMin:{$type:"number",$value:"1400px"},XxxsmallScreenMax:{$type:"number",$value:"374px"},XxsmallScreenMax:{$type:"number",$value:"479px"},XsmallScreenMax:{$type:"number",$value:"575px"},SmallScreenMax:{$type:"number",$value:"767px"},MediumScreenMax:{$type:"number",$value:"991px"},LargeScreenMax:{$type:"number",$value:"1199px"},XlargeScreenMax:{$type:"number",$value:"1399px"},XxlargeScreenMax:{$type:"number",$value:"1920px"}}},Font:{Family:{Main:{$type:"string",$value:"PP Mori"},Body:{$type:"string",$value:"Helvetica LT Pro"},Epigraph:{$type:"string",$value:"PP Mori"}}}},cD={Color:{Brand:{Base:{$type:"color",$value:"#335166",$web:"var(--color-brand-base)"},BaseSecondary:{$type:"color",$value:"#2b4354",$web:"var(--color-brand-base-secondary)"},BaseTertiary:{$type:"color",$value:"#202f3a",$web:"var(--color-brand-base-tertiary)"},Accent:{$type:"color",$value:"#4276cf",$web:"var(--color-brand-accent)"},AccentSecondary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-secondary)"},AccentTertiary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-tertiary)"},Light:{$type:"color",$value:"#f8fbf6",$web:"var(--color-brand-light)"},Dark:{$type:"color",$value:"#111b22",$web:"var(--color-brand-dark)"}}},Font:{Brand:{Heading:{$type:"string",$value:"Helvetica Neue",$web:"var(--font-brand-heading)"},Paragraph:{$type:"string",$value:"Inter",$web:"var(--font-brand-body)"}}},Unit:{Brand:{Radius:{$type:"number",$value:"4px",$web:"var(--unit-brand-radius)"}}}},de={Color:{Surface:{Plain:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.100}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.50}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.25}"},ShadowSecondary:{$value:"{Primitives.Color.Black.200}"}},Fill:{Accent:{$value:"{BrandPrimitives.Color.Brand.Accent}"},AccentHover:{$value:"{BrandPrimitives.Color.Brand.AccentSecondary}"},AccentPress:{$value:"{BrandPrimitives.Color.Brand.AccentTertiary}"},Base:{$value:"{BrandPrimitives.Color.Brand.Base}"},BaseHover:{$value:"{BrandPrimitives.Color.Brand.BaseSecondary}"},BasePress:{$value:"{BrandPrimitives.Color.Brand.BaseTertiary}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.700}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.300}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.100}"},SubtlePrimary:{$value:"{Primitives.Color.GreyAlpha.100}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.25}"},DangerPrimary:{$value:"{Primitives.Color.Red.600}"},Disabled:{$value:"{Primitives.Color.Grey.200}"},HotspotSecondary:{$value:"{Primitives.Color.GreyAlpha.800}"}},Icon:{NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"}},Text:{Invert:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.700}"},Disabled:{$value:"{Primitives.Color.Grey.300}"}},Border:{AltContrast:{$value:"{BrandPrimitives.Color.Brand.Dark}"},SubtlePrimary:{$value:"{Primitives.Color.Grey.300}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.700}"}}},Size:{Text:{Small:{$value:"{Primitives.Unit.Size.16}"},Medium:{$value:"{Primitives.Unit.Size.18}"},Large:{$value:"{Primitives.Unit.Size.20}"}},Icon:{Small:{$value:"{Primitives.Unit.Size.20}"},Medium:{$value:"{Primitives.Unit.Size.24}"},Large:{$value:"{Primitives.Unit.Size.28}"}},Radius:{Medium:{$value:"{Primitives.Unit.Space.150}"},Full:{$value:"{Primitives.Unit.Space.6000}"}},Stroke:{Regular:{$value:"{Primitives.Unit.Space.025}"},Thick:{$value:"{Primitives.Unit.Space.050}"}},Shadow:{None:{$value:"{Primitives.Unit.Space.0}"},Xsmall:{$value:"{Primitives.Unit.Space.025}"},Small:{$value:"{Primitives.Unit.Space.0325}"}},Blur:{Small:{$value:"{Primitives.Unit.Space.100}"}}},Space:{Padding:{Small:{$value:"{Primitives.Unit.Space.300}"},Medium:{$value:"{Primitives.Unit.Space.400}"},Regular:{$value:"{Primitives.Unit.Space.600}"}},Gap:{Small:{$value:"{Primitives.Unit.Space.200}"},Regular:{$value:"{Primitives.Unit.Space.400}"},Xxlarge:{$value:"{Primitives.Unit.Space.800}"}}},Font:{Family:{CustomH:{$value:"{BrandPrimitives.Font.Brand.Heading}"},CustomP:{$value:"{BrandPrimitives.Font.Brand.Paragraph}"},Main:{$value:"Helvetica Neue"}},Tracking:{Normal:{$value:"{Primitives.Unit.Space.0}"}}}};function oe(i){const e=/\{Primitives\.(.*?)}/,t=String(i).match(e),n=/\{BrandPrimitives\.(.*?)}/,s=String(i).match(n);let r=i;if(t){const a=t[1].split(".");r=aY[a[0]][a[1]][a[2]].$value}else if(s){const a=s[1].split("."),o=cD[a[0]][a[1]][a[2]],l=o.$web;r=`${l.substring(0,l.length-1)}, ${o.$value})`}return zi(r)}const Vb={poweredByEpigraphFooterText:"https://asset.myepigraph.com/design-assets/icons/powered-by-epigraph.svg",splashScreenLogo:"https://asset.myepigraph.com/design-assets/icons/default-splash-screen-image.svg",sampleQrCode:"https://asset.myepigraph.com/design-assets/icons/sample-qr-code.png"};function oY(){const i={};for(const[e,t]of Object.entries(cD))for(const[n,s]of Object.entries(t))for(const[r,a]of Object.entries(s)){const o=`${e}${n}${r}`;i[o]={name:zi(a.$web),defaultValue:a.$value,argType:{control:a.$type}}}return i}const lY=oY(),jh={size:{name:"size",defaultValue:"small",argType:{options:["small","medium","large"],control:"select"}},theme:{name:"theme",defaultValue:"light",argType:{options:["light","dark"],control:"select"}},disabled:{name:"disabled",defaultValue:!1,argType:{control:"boolean"}}};var cY=Object.defineProperty,du=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&cY(e,t,s),s};const Jl=class hD extends mh{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=jh.theme.defaultValue.toString(),this.size=jh.size.defaultValue.toString(),hD.ensureFontsAreLoaded(),this.addEventListener("click",this.doClick),this.addEventListener("pointerover",this.doHoverStart),this.addEventListener("pointerleave",this.doHoverEnd)}static{this.styles=[ht`
13176
13176
  :host {
13177
13177
  font-family: ${oe(de.Font.Family.Main.$value)};
13178
13178
  letter-spacing: 0.5px;
@@ -14480,7 +14480,7 @@ ${r.join(`
14480
14480
  ::part(bullet-active) {
14481
14481
  background: #fff;
14482
14482
  }
14483
- `]}__hideAllMediaCaptions(){for(const e of this.__swiperContainer.swiper.slides){const t=e.querySelector(".media-caption");t&&t.classList.remove("active")}}__showAllMediaCaptions(){for(const e of this.__swiperContainer.swiper.slides){const t=e.querySelector(".media-caption");t&&t.classList.add("active")}}__updatePaginationPositionToCurrentSlide(){const e=this.__swiperContainer.swiper.slides[this.__swiperContainer.swiper.activeIndex??0];if(e){const t=e.querySelector(".media-caption");t&&(this.__swiperContainer.swiper.pagination.el.style.bottom=`calc(${window.getComputedStyle(t).height} + 20px)`)}}firstUpdated(e){super.firstUpdated(e),this.__showAllMediaCaptions(),this.__updatePaginationPositionToCurrentSlide(),this.__swiperContainer&&(this.__swiperContainer.addEventListener("swiperslidechange",(t=>{const n=new CustomEvent("slide-changed",{detail:{newSlideIndex:t.detail[0].activeIndex}});this.dispatchEvent(n),this.__updatePaginationPositionToCurrentSlide()})),this.__swiperContainer.swiper.on("touchStart",()=>{this.__swiperContainer.swiper.pagination.el.style.transition="none",this.__swiperContainer.swiper.pagination.el.style.opacity="0",this.__hideAllMediaCaptions()}),this.__swiperContainer.swiper.on("touchEnd",()=>{this.__swiperContainer.swiper.pagination.el.style.transition="opacity 1.5s",this.__swiperContainer.swiper.pagination.el.style.opacity="1",this.__showAllMediaCaptions()}),this.__swiperContainer.swiper.on("transitionEnd",()=>{this.__swiperContainer.swiper.pagination.el.style.transition="opacity 1.5s",this.__swiperContainer.swiper.pagination.el.style.opacity="1",this.__showAllMediaCaptions()}),this.__swiperContainer.swiper.on("observerUpdate",t=>{t.updateAutoHeight(500)}))}resetToFirstSlide(){this.__swiperContainer.swiper.activeIndex!==0&&this.__swiperContainer.swiper.slideTo(0,0)}updated(e){super.updated(e),e.get("currentIndex")>=0&&this.__swiperContainer.swiper.slideTo(this.currentIndex,400),e.has("disableInteractions")&&(this.__swiperContainer.swiper.allowTouchMove=this.disableInteractions==="false")}render(){return re`
14483
+ `]}__hideAllMediaCaptions(){for(const e of this.__swiperContainer.swiper.slides){const t=e.querySelector(".media-caption");t&&t.classList.remove("active")}}__showAllMediaCaptions(){for(const e of this.__swiperContainer.swiper.slides){const t=e.querySelector(".media-caption");t&&t.classList.add("active")}}__updatePaginationPositionToCurrentSlide(){const e=this.__swiperContainer.swiper.pagination?.el,t=this.__swiperContainer.swiper.slides[this.__swiperContainer.swiper.activeIndex??0];if(t&&e){const n=t.querySelector(".media-caption"),s=n?window.getComputedStyle(n).height:"0px";e.style.bottom=`calc(${s} + 20px)`}}firstUpdated(e){super.firstUpdated(e),this.__showAllMediaCaptions(),this.__updatePaginationPositionToCurrentSlide(),this.__swiperContainer&&(this.__swiperContainer.addEventListener("swiperslidechange",(t=>{const n=new CustomEvent("slide-changed",{detail:{newSlideIndex:t.detail[0].activeIndex}});this.dispatchEvent(n),this.__updatePaginationPositionToCurrentSlide()})),this.__swiperContainer.swiper.on("touchStart",()=>{this.__swiperContainer.swiper.pagination.el.style.transition="none",this.__swiperContainer.swiper.pagination.el.style.opacity="0",this.__hideAllMediaCaptions()}),this.__swiperContainer.swiper.on("touchEnd",()=>{this.__swiperContainer.swiper.pagination.el.style.transition="opacity 1.5s",this.__swiperContainer.swiper.pagination.el.style.opacity="1",this.__showAllMediaCaptions()}),this.__swiperContainer.swiper.on("transitionEnd",()=>{this.__swiperContainer.swiper.pagination.el.style.transition="opacity 1.5s",this.__swiperContainer.swiper.pagination.el.style.opacity="1",this.__showAllMediaCaptions()}),this.__swiperContainer.swiper.on("observerUpdate",t=>{t.updateAutoHeight(500)}))}resetToFirstSlide(){this.__swiperContainer.swiper.activeIndex!==0&&this.__swiperContainer.swiper.slideTo(0,0)}updated(e){super.updated(e),e.get("currentIndex")>=0&&this.__swiperContainer.swiper.slideTo(this.currentIndex,400),e.has("disableInteractions")&&(this.__swiperContainer.swiper.allowTouchMove=this.disableInteractions==="false")}render(){return re`
14484
14484
  ${super.render()}
14485
14485
 
14486
14486
  <swiper-container
@@ -17498,7 +17498,7 @@ void main() {
17498
17498
  ></model-viewer>
17499
17499
 
17500
17500
  ${this.__renderQrModal()}
17501
- `}};xu([zt("#modelViewer")],ac.prototype,"modelViewerElem");xu([zt("#qrModal")],ac.prototype,"qrModalElem");xu([H({attribute:!1})],ac.prototype,"appWcRef");xu([H({type:String,attribute:"glb-src"})],ac.prototype,"glbSrc");xu([H({type:String,attribute:"usdz-src"})],ac.prototype,"usdzSrc");xu([H({type:Boolean,attribute:"debug"})],ac.prototype,"debug");let LJ=ac;class bt{constructor(e,t,n=""){this.__name="app:generic:event",this.__eventsManager=e,this.__name=t,this.__detail=n}get name(){return this.__name}get detail(){return this.__detail}fire(e){const t=new CustomEvent(this.__name,{detail:e??this.__detail});this.__eventsManager.eventHubRef.dispatchEvent(t)}}class NJ extends EventTarget{constructor(e){super(),this._loggerContext="EVENTS MANAGER",window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext}),e?this.eventHubRef=e:this.eventHubRef=this,this.appReadyEventLegacy=new bt(this,"appReady",""),this.appReadyEvent=new bt(this,"epgappready",""),this.appFailedEvent=new bt(this,"epgappfailed",""),this.assetLoadProgress=new bt(this,"assetLoadProgress",""),this.experienceUpdatedEvent=new bt(this,"experienceUpdated",""),this.productSettingUpdatedEvent=new bt(this,"productSettingUpdatedEvent",""),this.cameraProductSettingUpdatedEvent=new bt(this,"cameraProductSettingUpdatedEvent",""),this.productSettingsShadowTypeUpdatedEvent=new bt(this,"productSettingsShadowTypeUpdatedEvent",""),this.productSettingsSavedEvent=new bt(this,"productsettingssavedevent",""),this.structureNodeAddedEvent=new bt(this,"structureNodeAdded",""),this.structureChangedEvent=new bt(this,"structureChanged",""),this.showNodeLoadingIcon=new bt(this,"nodeLoadingShow",""),this.hideNodeLoadingIcon=new bt(this,"nodeLoadingHide",""),this.commentClickedEvent=new bt(this,"commentClicked",""),this.commentsUpdatedEvent=new bt(this,"commentsUpdatedEvent",""),this.commentsVisibilityChanged=new bt(this,"commentsVisibilityChanged",""),this.commentOpenEvent=new bt(this,"commentOpenEvent",""),this.commentClosedEvent=new bt(this,"commentClosedEvent",""),this.commentNextEvent=new bt(this,"commentNextEvent",""),this.commentPreviousEvent=new bt(this,"commentPreviousEvent",""),this.hotspotsUpdatedEvent=new bt(this,"hotspotsUpdated",""),this.hotspotsVisibilityChanged=new bt(this,"hotspotsVisibilityChanged",""),this.hotspotClickedEvent=new bt(this,"hotspotClicked",""),this.hotspotOpenEvent=new bt(this,"hotspotOpen",""),this.hotspotClosedEvent=new bt(this,"hotspotClosed",""),this.hotspotNextEvent=new bt(this,"hotspotNext",""),this.hotspotPreviousEvent=new bt(this,"hotspotPrevious",""),this.sceneBoundsChanged=new bt(this,"sceneBoundsChanged",""),this.dimensionsPositionChanged=new bt(this,"dimensionsPositionChanged",""),this.dimensionsVisibilityChanged=new bt(this,"dimensionsVisibilityChanged",""),this.arModelReadyEvent=new bt(this,"arGlbReady",""),this.frameUpdated=new bt(this,"frameUpdated",""),this.cameraControlsStart=new bt(this,"cameraControlsStart",""),this.inputStart=new bt(this,"inputStart",""),this.inputMove=new bt(this,"inputMove",""),this.inputEnd=new bt(this,"inputEnd",""),this.cameraMoveToTransform=new bt(this,"cameraMoveToTransform",""),this.debugChanged=new bt(this,"debugChanged",""),this.showSettingsChanged=new bt(this,"showSettingsChanged",""),this.webComponentResized=new bt(this,"webcomponentresized")}}class PJ{constructor(e,t){this.__assets=new Map,this.__appWcRef=t,this.__config=e}async initialize(){for(const e in this.__config){const t=new iD(this.__config[e],this.__appWcRef);this.__assets.set(e,t)}}getAssetByName(e){return this.__assets.get(e)}getFirstAsset(){return this.__assets.values().next().value}async unloadUnused(){for(const e of this.__assets.values())await e.renderGltf?.unload(),await e.proxyGltf?.unload()}hasAnyAssetWithSplat(){for(const e of Object.values(this.__config))if(e.renderSplat)return!0;return!1}}class FJ{constructor(e){this.__assetClass=e.assetClass,this.__asset=e.asset,this.__assetId=e.assetId,this.__finish=e.finish,this.__productOptionValue=e.productOptionValue}get assetClass(){return this.__assetClass}get asset(){return this.__asset}get assetId(){return this.__assetId}get finish(){return this.__finish}get productOptionValue(){return this.__productOptionValue}}class kJ{constructor(e,t){this.__productParts=[],this.__id=e.id,this.__name=e.name,this.__productId=t,this.__sku=e.sku,this.__upc=e.upc,this.__asin=e.asin,this.__shopifyVariantId=e.shopifyVariantId,this.__uuid=e.uuid,this.parseProductParts(e.productParts)}get id(){return this.__id}get name(){return this.__name}get productId(){return this.__productId}get sku(){return this.__sku}get upc(){return this.__upc}get asin(){return this.__asin}get shopifyVariantId(){return this.__shopifyVariantId}get uuid(){return this.__uuid}get productParts(){return this.__productParts}parseProductParts(e){for(const t of e){const n=new FJ(t);this.__productParts.push(n)}}}class UJ{constructor(e,t){this.__productVariants=new Map,this.__productVariantNames=new Map,this.__productVariantSkus=new Map,this.__productVariantUpcs=new Map,this.__productVariantAsins=new Map,this.__productVariantShopifyVariantIds=new Map,this.__productVariantUuids=new Map,this.__productId=t;for(const n of e){const s=new kJ(n,this.__productId);s&&this.addProductVariant(s)}}addProductVariant(e){this.__productVariants.set(e.id,e),this.__productVariantNames.set(e.name,e),e.sku&&this.__productVariantSkus.set(e.sku,e),e.upc&&this.__productVariantUpcs.set(e.upc,e),e.asin&&this.__productVariantAsins.set(e.asin,e),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.set(e.shopifyVariantId,e),e.uuid&&this.__productVariantUuids.set(e.uuid,e)}removeProductVariant(e){e.sku&&this.__productVariantSkus.delete(e.sku),e.upc&&this.__productVariantUpcs.delete(e.upc),e.asin&&this.__productVariantAsins.delete(e.asin),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.delete(e.shopifyVariantId),this.__productVariantNames.delete(e.name),this.__productVariants.delete(e.id)}getAllProductVariants(){return Array.from(this.__productVariants.values())}getAllProductVariantIds(){return Array.from(this.__productVariants.keys())}getAllProductVariantNames(){return Array.from(this.__productVariantNames.keys())}getProductVariantById(e){return this.__productVariants.get(e)}getProductVariantByName(e){return this.__productVariantNames.get(e)}getProductVariantBySku(e){return this.__productVariantSkus.get(e)}getProductVariantByUpc(e){return this.__productVariantUpcs.get(e)}getProductVariantByAsin(e){return this.__productVariantAsins.get(e)}getProductVariantByShopifyVariantId(e){return this.__productVariantShopifyVariantIds.get(e)}getProductVariantByUuid(e){return this.__productVariantUuids.get(e)}getProductVariantByIdentifierAndType(e,t){switch(t){case nh.SKU:return this.getProductVariantBySku(e);case nh.SHOPIFY_VARIANT_ID:return this.getProductVariantByShopifyVariantId(e);case nh.ASIN:return this.getProductVariantByAsin(e);case nh.UPC:return this.getProductVariantByUpc(e);case nh.PRODUCT_VARIANT_UUID:return this.getProductVariantByUuid(e);default:return}}}class OJ extends nD{constructor(e){super(e),this._materialVariantMappings={}}async _parseLoadedGltf(){await super._parseLoadedGltf();const e=this.resource?.scene;if(e===void 0||e.children.length<=0)return;const t=e.children[0],n=this.finishNamesFromAsset;for(const s of t.userData.gltfExtensions.KHR_materials_variants.mappings){const r=n[s.variants[0]];this._materialVariantMappings[r]=s.material}}async getMaterialForFinishId(e){return this._materialVariantMappings[e]===void 0?null:await this.resource?.parser.getDependency("material",this._materialVariantMappings[e])}}class GJ{constructor(e){this.__appWcRef=e,this.__materialLibraries=new Map}get materialLibraries(){return this.__materialLibraries}makeEmpty(e={}){const t=Object.keys(e);for(const n of this.__materialLibraries.keys())t.includes(n)||this.__materialLibraries.delete(n)}async addMaterialLibrary(e,t){const n=new OJ({id:e,uri:t,preload:!1,appWcRef:this.__appWcRef});return this.__materialLibraries.set(n.id,n),n}}class zJ{constructor(){this.__defaultValues={postEffect:{ao:!1},render:{envMap:"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/env-maps/neutral.hdr",envMapRotation:{x:0,y:0,z:0},mode:$s.GEO,splatMode:{blurAmount:1,preBlurAmount:1,falloff:1,maxStdDev:Math.sqrt(8),focalAdjustment:1,minPixelRadius:0,maxPixelRadius:512,minAlpha:.5*(1/255),focalDistance:1,apertureAngle:0,clipXY:1.4}},camera:{initial:null,backgroundColor:"#ffffff",backgroundAlpha:1,focalLength:35,nearClip:.01,farClip:1e3,canPan:!0,canZoom:!0,minDistance:2,maxDistance:8,infinitePolarAngle:!1,minPolarAngle:0,maxPolarAngle:6.25,infiniteAzimuthAngle:!0,minAzimuthAngle:0,maxAzimuthAngle:6.25,interactionPromptRepeat:"2:1",cameraBoundsMultiplier:1},renderQuality:{antiAlias:!0},screenshots:{enabled:!1,predefinedCameras:{}},shadows:{shadowType:yl.ACCUMULATIVE,accumulativeShadows:{shadowMaterial:{opacity:.8,alphaTest:.75,color:"#000000",blend:1},shadowParams:{frames:30,scale:10,radius:.8,ambient:.5},light:{direction:{x:3,y:5,z:3}}},contactShadows:{planeLength:3,planeWidth:3,cameraHeight:1,intensity:1,softness:1}},hotspots:{showNavigationButtons:!0}},this.__values=JSON.parse(JSON.stringify(this.__defaultValues))}asJson(){return this.__values}_isObject(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}_mergeDeep(e,t){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n],r=e[n];this._isObject(r)&&this._isObject(s)?e[n]=this._mergeDeep(r,s):s!==void 0&&(e[n]=s)}return e}deepCopyProductSettings(e){const t=JSON.parse(JSON.stringify(this.__defaultValues));this._mergeDeep(t,e),this._mergeDeep(this.__values,t)}get postEffect(){return this.__values.postEffect}get render(){return this.__values.render}get camera(){return this.__values.camera}get renderQuality(){return this.__values.renderQuality}get screenshots(){return this.__values.screenshots}get shadows(){return this.__values.shadows}get hotspots(){return this.__values.hotspots}}class HJ{constructor({nexusApiResultPayload:e,appWcRef:t}){this._loggerContext="EXPERIENCE DATA",this.__needsRootPlug=!1,window.epigraph.logger.info({title:"nexusApiPayload",details:e,contextOverride:this._loggerContext}),this._appWcRef=t,this._data=e,this.__materialLibraryCollection=new GJ(this._appWcRef),this._data.product_data.settings&&this._appWcRef.productSettings.deepCopyProductSettings(this._data.product_data.settings);const n=this._data.product_data.assets;if(Object.values(n).length===1){const s=Object.values(n)[0];s?.proxyGeo?window.epigraph.logger.warn({title:"Single asset experience detected and a proxy was provided. Please ensure that the proxy provided has a root plug in it. Expand for the asset config used...",details:s,contextOverride:"ASSET COLLECTION"}):(s.proxyGeo="https://asset.myepigraph.com/solutions-assets/__PIPELINE__/assets/3d-assets/proxyGeo/null-proxy.glb",this.__needsRootPlug=!0,s.autoGenerateProxyEntity=!0)}}get materialLibraryCollection(){return this.__materialLibraryCollection}get settings(){return this._data.settings}get currentAssetVersion(){return this._data.product_data.product.currentAssetVersion}get productSettings(){return this._data.product_data.settings}get channelName(){return this._data.settings.channel.name}get channelSettings(){return this._data.settings.channel.channel_settings}async __parseMaterialLibraries(){const e=this._data?.brand?.material_libraries;if(!e){this.__materialLibraryCollection.makeEmpty();return}this.__materialLibraryCollection.makeEmpty(e);for(const[t,n]of Object.entries(e))await this.__materialLibraryCollection.addMaterialLibrary(t,n.url)}async __parseAssets(){return this.__assetCollection=new PJ(this._data.product_data.assets,this._appWcRef),await this.__assetCollection.initialize(),this.__needsRootPlug&&this.__assetCollection.getFirstAsset()?.proxyGltf?.plugs.push(new Ro({name:"root@plug",isPrimary:!0,connectionId:"root",position:new Q,rotation:new es})),this.__assetCollection}getAssetCollection(){return this.__assetCollection}__parseProductVariants(){this.__productVariantCollection=new UJ(this._data.product_data.product.productVariants,this._data.product_data.product.id)}get productVariantCollection(){return this.__productVariantCollection}async initialize(){await this.__parseMaterialLibraries(),await this.__parseAssets(),await this.__parseProductVariants()}}var lA=function(){var i=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(u){u.preventDefault(),n(++i%e.children.length)},!1);function t(u){return e.appendChild(u.dom),u}function n(u){for(var h=0;h<e.children.length;h++)e.children[h].style.display=h===u?"block":"none";i=u}var s=(performance||Date).now(),r=s,a=0,o=t(new lA.Panel("FPS","#0ff","#002")),l=t(new lA.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=t(new lA.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:e,addPanel:t,showPanel:n,begin:function(){s=(performance||Date).now()},end:function(){a++;var u=(performance||Date).now();if(l.update(u-s,200),u>=r+1e3&&(o.update(a*1e3/(u-r),100),r=u,a=0,c)){var h=performance.memory;c.update(h.usedJSHeapSize/1048576,h.jsHeapSizeLimit/1048576)}return u},update:function(){s=this.end()},domElement:e,setMode:n}};lA.Panel=function(i,e,t){var n=1/0,s=0,r=Math.round,a=r(window.devicePixelRatio||1),o=80*a,l=48*a,c=3*a,u=2*a,h=3*a,d=15*a,A=74*a,p=30*a,g=document.createElement("canvas");g.width=o,g.height=l,g.style.cssText="width:80px;height:48px";var m=g.getContext("2d");return m.font="bold "+9*a+"px Helvetica,Arial,sans-serif",m.textBaseline="top",m.fillStyle=t,m.fillRect(0,0,o,l),m.fillStyle=e,m.fillText(i,c,u),m.fillRect(h,d,A,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(h,d,A,p),{dom:g,update:function(f,_){n=Math.min(n,f),s=Math.max(s,f),m.fillStyle=t,m.globalAlpha=1,m.fillRect(0,0,o,d),m.fillStyle=e,m.fillText(r(f)+" "+i+" ("+r(n)+"-"+r(s)+")",c,u),m.drawImage(g,h+a,d,A-a,p,h,d,A-a,p),m.fillRect(h+A-a,d,a,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(h+A-a,d,a,r((1-f/_)*p))}}};class Ai extends Qo{constructor(){super(),this._loggerContext="DEBUG MANAGER",this.stats=new lA}static{this.webComponentName="debug-manager"}static setupWebComponent(){window.customElements.get(Ai.webComponentName)||window.customElements.define(Ai.webComponentName,Ai)}static{this.styles=ht`
17501
+ `}};xu([zt("#modelViewer")],ac.prototype,"modelViewerElem");xu([zt("#qrModal")],ac.prototype,"qrModalElem");xu([H({attribute:!1})],ac.prototype,"appWcRef");xu([H({type:String,attribute:"glb-src"})],ac.prototype,"glbSrc");xu([H({type:String,attribute:"usdz-src"})],ac.prototype,"usdzSrc");xu([H({type:Boolean,attribute:"debug"})],ac.prototype,"debug");let LJ=ac;class bt{constructor(e,t,n=""){this.__name="app:generic:event",this.__eventsManager=e,this.__name=t,this.__detail=n}get name(){return this.__name}get detail(){return this.__detail}fire(e){const t=new CustomEvent(this.__name,{detail:e??this.__detail});this.__eventsManager.eventHubRef.dispatchEvent(t)}}class NJ extends EventTarget{constructor(e){super(),this._loggerContext="EVENTS MANAGER",window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext}),e?this.eventHubRef=e:this.eventHubRef=this,this.appReadyEventLegacy=new bt(this,"appReady",""),this.appReadyEvent=new bt(this,"epgappready",""),this.appFailedEvent=new bt(this,"epgappfailed",""),this.assetLoadProgress=new bt(this,"assetLoadProgress",""),this.experienceUpdatedEvent=new bt(this,"experienceUpdated",""),this.productSettingUpdatedEvent=new bt(this,"productSettingUpdatedEvent",""),this.cameraProductSettingUpdatedEvent=new bt(this,"cameraProductSettingUpdatedEvent",""),this.productSettingsShadowTypeUpdatedEvent=new bt(this,"productSettingsShadowTypeUpdatedEvent",""),this.productSettingsSavedEvent=new bt(this,"productsettingssavedevent",""),this.structureNodeAddedEvent=new bt(this,"structureNodeAdded",""),this.structureChangedEvent=new bt(this,"structureChanged",""),this.showNodeLoadingIcon=new bt(this,"nodeLoadingShow",""),this.hideNodeLoadingIcon=new bt(this,"nodeLoadingHide",""),this.commentClickedEvent=new bt(this,"commentClicked",""),this.commentsUpdatedEvent=new bt(this,"commentsUpdatedEvent",""),this.commentsVisibilityChanged=new bt(this,"commentsVisibilityChanged",""),this.commentOpenEvent=new bt(this,"commentOpenEvent",""),this.commentClosedEvent=new bt(this,"commentClosedEvent",""),this.commentNextEvent=new bt(this,"commentNextEvent",""),this.commentPreviousEvent=new bt(this,"commentPreviousEvent",""),this.hotspotsUpdatedEvent=new bt(this,"hotspotsUpdated",""),this.hotspotsVisibilityChanged=new bt(this,"hotspotsVisibilityChanged",""),this.hotspotClickedEvent=new bt(this,"hotspotClicked",""),this.hotspotOpenEvent=new bt(this,"hotspotOpen",""),this.hotspotClosedEvent=new bt(this,"hotspotClosed",""),this.hotspotNextEvent=new bt(this,"hotspotNext",""),this.hotspotPreviousEvent=new bt(this,"hotspotPrevious",""),this.sceneBoundsChanged=new bt(this,"sceneBoundsChanged",""),this.dimensionsPositionChanged=new bt(this,"dimensionsPositionChanged",""),this.dimensionsVisibilityChanged=new bt(this,"dimensionsVisibilityChanged",""),this.arModelReadyEvent=new bt(this,"arGlbReady",""),this.frameUpdated=new bt(this,"frameUpdated",""),this.cameraControlsStart=new bt(this,"cameraControlsStart",""),this.inputStart=new bt(this,"inputStart",""),this.inputMove=new bt(this,"inputMove",""),this.inputEnd=new bt(this,"inputEnd",""),this.cameraMoveToTransform=new bt(this,"cameraMoveToTransform",""),this.debugChanged=new bt(this,"debugChanged",""),this.showSettingsChanged=new bt(this,"showSettingsChanged",""),this.webComponentResized=new bt(this,"webcomponentresized")}}class PJ{constructor(e,t){this.__assets=new Map,this.__appWcRef=t,this.__config=e}async initialize(){for(const e in this.__config){const t=new iD(this.__config[e],this.__appWcRef);this.__assets.set(e,t)}}getAssetByName(e){return this.__assets.get(e)}getFirstAsset(){return this.__assets.values().next().value}async unloadUnused(){for(const e of this.__assets.values())await e.renderGltf?.unload(),await e.proxyGltf?.unload()}hasAnyAssetWithSplat(){for(const e of Object.values(this.__config))if(e.renderSplat)return!0;return!1}}class FJ{constructor(e){this.__assetClass=e.assetClass,this.__asset=e.asset,this.__assetId=e.assetId,this.__finish=e.finish,this.__productOptionValue=e.productOptionValue}get assetClass(){return this.__assetClass}get asset(){return this.__asset}get assetId(){return this.__assetId}get finish(){return this.__finish}get productOptionValue(){return this.__productOptionValue}}class kJ{constructor(e,t){this.__productParts=[],this.__id=e.id,this.__name=e.name,this.__productId=t,this.__sku=e.sku,this.__upc=e.upc,this.__asin=e.asin,this.__shopifyVariantId=e.shopifyVariantId,this.__uuid=e.uuid,this.parseProductParts(e.productParts)}get id(){return this.__id}get name(){return this.__name}get productId(){return this.__productId}get sku(){return this.__sku}get upc(){return this.__upc}get asin(){return this.__asin}get shopifyVariantId(){return this.__shopifyVariantId}get uuid(){return this.__uuid}get productParts(){return this.__productParts}parseProductParts(e){for(const t of e){const n=new FJ(t);this.__productParts.push(n)}}}class UJ{constructor(e,t){this.__productVariants=new Map,this.__productVariantNames=new Map,this.__productVariantSkus=new Map,this.__productVariantUpcs=new Map,this.__productVariantAsins=new Map,this.__productVariantShopifyVariantIds=new Map,this.__productVariantUuids=new Map,this.__productId=t;for(const n of e){const s=new kJ(n,this.__productId);s&&this.addProductVariant(s)}}addProductVariant(e){this.__productVariants.set(e.id,e),this.__productVariantNames.set(e.name,e),e.sku&&this.__productVariantSkus.set(e.sku,e),e.upc&&this.__productVariantUpcs.set(e.upc,e),e.asin&&this.__productVariantAsins.set(e.asin,e),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.set(e.shopifyVariantId,e),e.uuid&&this.__productVariantUuids.set(e.uuid,e)}removeProductVariant(e){e.sku&&this.__productVariantSkus.delete(e.sku),e.upc&&this.__productVariantUpcs.delete(e.upc),e.asin&&this.__productVariantAsins.delete(e.asin),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.delete(e.shopifyVariantId),this.__productVariantNames.delete(e.name),this.__productVariants.delete(e.id)}getAllProductVariants(){return Array.from(this.__productVariants.values())}getAllProductVariantIds(){return Array.from(this.__productVariants.keys())}getAllProductVariantNames(){return Array.from(this.__productVariantNames.keys())}getProductVariantById(e){return this.__productVariants.get(e)}getProductVariantByName(e){return this.__productVariantNames.get(e)}getProductVariantBySku(e){return this.__productVariantSkus.get(e)}getProductVariantByUpc(e){return this.__productVariantUpcs.get(e)}getProductVariantByAsin(e){return this.__productVariantAsins.get(e)}getProductVariantByShopifyVariantId(e){return this.__productVariantShopifyVariantIds.get(e)}getProductVariantByUuid(e){return this.__productVariantUuids.get(e)}getProductVariantByIdentifierAndType(e,t){switch(t){case nh.SKU:return this.getProductVariantBySku(e);case nh.SHOPIFY_VARIANT_ID:return this.getProductVariantByShopifyVariantId(e);case nh.ASIN:return this.getProductVariantByAsin(e);case nh.UPC:return this.getProductVariantByUpc(e);case nh.PRODUCT_VARIANT_UUID:return this.getProductVariantByUuid(e);default:return}}}class OJ extends nD{constructor(e){super(e),this._materialVariantMappings={}}async _parseLoadedGltf(){await super._parseLoadedGltf();const e=this.resource?.scene;if(e===void 0||e.children.length<=0)return;const t=e.children[0],n=this.finishNamesFromAsset;for(const s of t.userData.gltfExtensions.KHR_materials_variants.mappings){const r=n[s.variants[0]];this._materialVariantMappings[r]=s.material}}async getMaterialForFinishId(e){return this._materialVariantMappings[e]===void 0?null:await this.resource?.parser.getDependency("material",this._materialVariantMappings[e])}}class GJ{constructor(e){this.__appWcRef=e,this.__materialLibraries=new Map}get materialLibraries(){return this.__materialLibraries}makeEmpty(e={}){const t=Object.keys(e);for(const n of this.__materialLibraries.keys())t.includes(n)||this.__materialLibraries.delete(n)}async addMaterialLibrary(e,t){const n=new OJ({id:e,uri:t,preload:!1,appWcRef:this.__appWcRef});return this.__materialLibraries.set(n.id,n),n}}class zJ{constructor(){this.__defaultValues={postEffect:{ao:!1},render:{envMap:"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/env-maps/neutral.hdr",envMapRotation:{x:0,y:0,z:0},mode:$s.GEO,splatMode:{blurAmount:1,preBlurAmount:1,falloff:1,maxStdDev:Math.sqrt(8),focalAdjustment:1,minPixelRadius:0,maxPixelRadius:512,minAlpha:.5*(1/255),focalDistance:1,apertureAngle:0,clipXY:1.4}},camera:{initial:null,backgroundColor:"#ffffff",backgroundAlpha:1,focalLength:35,nearClip:.01,farClip:1e3,canPan:!0,canZoom:!0,minDistance:0,maxDistance:8,infinitePolarAngle:!1,minPolarAngle:0,maxPolarAngle:6.25,infiniteAzimuthAngle:!0,minAzimuthAngle:0,maxAzimuthAngle:6.25,interactionPromptRepeat:"2:1",cameraBoundsMultiplier:1},renderQuality:{antiAlias:!0},screenshots:{enabled:!1,predefinedCameras:{}},shadows:{shadowType:yl.ACCUMULATIVE,accumulativeShadows:{shadowMaterial:{opacity:.8,alphaTest:.75,color:"#000000",blend:1},shadowParams:{frames:30,scale:10,radius:.8,ambient:.5},light:{direction:{x:3,y:5,z:3}}},contactShadows:{planeLength:3,planeWidth:3,cameraHeight:1,intensity:1,softness:1}},hotspots:{showNavigationButtons:!0}},this.__values=JSON.parse(JSON.stringify(this.__defaultValues))}asJson(){return this.__values}_isObject(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}_mergeDeep(e,t){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n],r=e[n];this._isObject(r)&&this._isObject(s)?e[n]=this._mergeDeep(r,s):s!==void 0&&(e[n]=s)}return e}deepCopyProductSettings(e){const t=JSON.parse(JSON.stringify(this.__defaultValues));this._mergeDeep(t,e),this._mergeDeep(this.__values,t)}get postEffect(){return this.__values.postEffect}get render(){return this.__values.render}get camera(){return this.__values.camera}get renderQuality(){return this.__values.renderQuality}get screenshots(){return this.__values.screenshots}get shadows(){return this.__values.shadows}get hotspots(){return this.__values.hotspots}}class HJ{constructor({nexusApiResultPayload:e,appWcRef:t}){this._loggerContext="EXPERIENCE DATA",this.__needsRootPlug=!1,window.epigraph.logger.info({title:"nexusApiPayload",details:e,contextOverride:this._loggerContext}),this._appWcRef=t,this._data=e,this.__materialLibraryCollection=new GJ(this._appWcRef),this._data.product_data.settings&&this._appWcRef.productSettings.deepCopyProductSettings(this._data.product_data.settings);const n=this._data.product_data.assets;if(Object.values(n).length===1){const s=Object.values(n)[0];s?.proxyGeo?window.epigraph.logger.warn({title:"Single asset experience detected and a proxy was provided. Please ensure that the proxy provided has a root plug in it. Expand for the asset config used...",details:s,contextOverride:"ASSET COLLECTION"}):(s.proxyGeo="https://asset.myepigraph.com/solutions-assets/__PIPELINE__/assets/3d-assets/proxyGeo/null-proxy.glb",this.__needsRootPlug=!0,s.autoGenerateProxyEntity=!0)}}get materialLibraryCollection(){return this.__materialLibraryCollection}get settings(){return this._data.settings}get currentAssetVersion(){return this._data.product_data.product.currentAssetVersion}get productSettings(){return this._data.product_data.settings}get channelName(){return this._data.settings.channel.name}get channelSettings(){return this._data.settings.channel.channel_settings}async __parseMaterialLibraries(){const e=this._data?.brand?.material_libraries;if(!e){this.__materialLibraryCollection.makeEmpty();return}this.__materialLibraryCollection.makeEmpty(e);for(const[t,n]of Object.entries(e))await this.__materialLibraryCollection.addMaterialLibrary(t,n.url)}async __parseAssets(){return this.__assetCollection=new PJ(this._data.product_data.assets,this._appWcRef),await this.__assetCollection.initialize(),this.__needsRootPlug&&this.__assetCollection.getFirstAsset()?.proxyGltf?.plugs.push(new Ro({name:"root@plug",isPrimary:!0,connectionId:"root",position:new Q,rotation:new es})),this.__assetCollection}getAssetCollection(){return this.__assetCollection}__parseProductVariants(){this.__productVariantCollection=new UJ(this._data.product_data.product.productVariants,this._data.product_data.product.id)}get productVariantCollection(){return this.__productVariantCollection}async initialize(){await this.__parseMaterialLibraries(),await this.__parseAssets(),await this.__parseProductVariants()}}var lA=function(){var i=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(u){u.preventDefault(),n(++i%e.children.length)},!1);function t(u){return e.appendChild(u.dom),u}function n(u){for(var h=0;h<e.children.length;h++)e.children[h].style.display=h===u?"block":"none";i=u}var s=(performance||Date).now(),r=s,a=0,o=t(new lA.Panel("FPS","#0ff","#002")),l=t(new lA.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=t(new lA.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:e,addPanel:t,showPanel:n,begin:function(){s=(performance||Date).now()},end:function(){a++;var u=(performance||Date).now();if(l.update(u-s,200),u>=r+1e3&&(o.update(a*1e3/(u-r),100),r=u,a=0,c)){var h=performance.memory;c.update(h.usedJSHeapSize/1048576,h.jsHeapSizeLimit/1048576)}return u},update:function(){s=this.end()},domElement:e,setMode:n}};lA.Panel=function(i,e,t){var n=1/0,s=0,r=Math.round,a=r(window.devicePixelRatio||1),o=80*a,l=48*a,c=3*a,u=2*a,h=3*a,d=15*a,A=74*a,p=30*a,g=document.createElement("canvas");g.width=o,g.height=l,g.style.cssText="width:80px;height:48px";var m=g.getContext("2d");return m.font="bold "+9*a+"px Helvetica,Arial,sans-serif",m.textBaseline="top",m.fillStyle=t,m.fillRect(0,0,o,l),m.fillStyle=e,m.fillText(i,c,u),m.fillRect(h,d,A,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(h,d,A,p),{dom:g,update:function(f,_){n=Math.min(n,f),s=Math.max(s,f),m.fillStyle=t,m.globalAlpha=1,m.fillRect(0,0,o,d),m.fillStyle=e,m.fillText(r(f)+" "+i+" ("+r(n)+"-"+r(s)+")",c,u),m.drawImage(g,h+a,d,A-a,p,h,d,A-a,p),m.fillRect(h+A-a,d,a,p),m.fillStyle=t,m.globalAlpha=.9,m.fillRect(h+A-a,d,a,r((1-f/_)*p))}}};class Ai extends Qo{constructor(){super(),this._loggerContext="DEBUG MANAGER",this.stats=new lA}static{this.webComponentName="debug-manager"}static setupWebComponent(){window.customElements.get(Ai.webComponentName)||window.customElements.define(Ai.webComponentName,Ai)}static{this.styles=ht`
17502
17502
  .debug-label {
17503
17503
  position: absolute;
17504
17504
  top: 0%;
@@ -17519,7 +17519,7 @@ void main() {
17519
17519
  */class Lr{constructor(e,t,n,s,r="div"){this.parent=e,this.object=t,this.property=n,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(s),this.$name=document.createElement("div"),this.$name.classList.add("name"),Lr.nextNameID=Lr.nextNameID||0,this.$name.id="lil-gui-name-"+ ++Lr.nextNameID,this.$widget=document.createElement(r),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(n)}name(e){return this._name=e,this.$name.innerHTML=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled||(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e)),this}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.object[this.property]=e,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class $J extends Lr{constructor(e,t,n){super(e,t,n,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function Mv(i){let e,t;return(e=i.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=i.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=i.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!t&&"#"+t}const VJ={isPrimitive:!0,match:i=>typeof i=="string",fromHexString:Mv,toHexString:Mv},OA={isPrimitive:!0,match:i=>typeof i=="number",fromHexString:i=>parseInt(i.substring(1),16),toHexString:i=>"#"+i.toString(16).padStart(6,0)},YJ={isPrimitive:!1,match:Array.isArray,fromHexString(i,e,t=1){const n=OA.fromHexString(i);e[0]=(n>>16&255)/255*t,e[1]=(n>>8&255)/255*t,e[2]=(255&n)/255*t},toHexString:([i,e,t],n=1)=>OA.toHexString(i*(n=255/n)<<16^e*n<<8^t*n<<0)},qJ={isPrimitive:!1,match:i=>Object(i)===i,fromHexString(i,e,t=1){const n=OA.fromHexString(i);e.r=(n>>16&255)/255*t,e.g=(n>>8&255)/255*t,e.b=(255&n)/255*t},toHexString:({r:i,g:e,b:t},n=1)=>OA.toHexString(i*(n=255/n)<<16^e*n<<8^t*n<<0)},WJ=[VJ,OA,YJ,qJ];class jJ extends Lr{constructor(e,t,n,s){var r;super(e,t,n,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(r=this.initialValue,WJ.find(a=>a.match(r))),this._rgbScale=s,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const a=Mv(this.$text.value);a&&this._setValueFromHexString(a)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class $0 extends Lr{constructor(e,t,n){super(e,t,n,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",s=>{s.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class XJ extends Lr{constructor(e,t,n,s,r,a){super(e,t,n,"number"),this._initInput(),this.min(s),this.max(r);const o=a!==void 0;this.step(o?a:this._getImplicitStep(),o),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=u=>{const h=parseFloat(this.$input.value);isNaN(h)||(this._snapClampSetValue(h+u),this.$input.value=this.getValue())};let t,n,s,r,a,o=!1;const l=u=>{if(o){const h=u.clientX-t,d=u.clientY-n;Math.abs(d)>5?(u.preventDefault(),this.$input.blur(),o=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(h)>5&&c()}if(!o){const h=u.clientY-s;a-=h*this._step*this._arrowKeyMultiplier(u),r+a>this._max?a=this._max-r:r+a<this._min&&(a=this._min-r),this._snapClampSetValue(r+a)}s=u.clientY},c=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c)};this.$input.addEventListener("input",()=>{let u=parseFloat(this.$input.value);isNaN(u)||(this._stepExplicit&&(u=this._snap(u)),this.setValue(this._clamp(u)))}),this.$input.addEventListener("keydown",u=>{u.code==="Enter"&&this.$input.blur(),u.code==="ArrowUp"&&(u.preventDefault(),e(this._step*this._arrowKeyMultiplier(u))),u.code==="ArrowDown"&&(u.preventDefault(),e(this._step*this._arrowKeyMultiplier(u)*-1))}),this.$input.addEventListener("wheel",u=>{this._inputFocused&&(u.preventDefault(),e(this._step*this._normalizeMouseWheel(u)))},{passive:!1}),this.$input.addEventListener("mousedown",u=>{t=u.clientX,n=s=u.clientY,o=!0,r=this.getValue(),a=0,window.addEventListener("mousemove",l),window.addEventListener("mouseup",c)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=d=>{const A=this.$slider.getBoundingClientRect();let p=(g=d,m=A.left,f=A.right,_=this._min,y=this._max,(g-m)/(f-m)*(y-_)+_);var g,m,f,_,y;this._snapClampSetValue(p)},t=d=>{e(d.clientX)},n=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)};let s,r,a=!1;const o=d=>{d.preventDefault(),this._setDraggingStyle(!0),e(d.touches[0].clientX),a=!1},l=d=>{if(a){const A=d.touches[0].clientX-s,p=d.touches[0].clientY-r;Math.abs(A)>Math.abs(p)?o(d):(window.removeEventListener("touchmove",l),window.removeEventListener("touchend",c))}else d.preventDefault(),e(d.touches[0].clientX)},c=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",l),window.removeEventListener("touchend",c)},u=this._callOnFinishChange.bind(this);let h;this.$slider.addEventListener("mousedown",d=>{this._setDraggingStyle(!0),e(d.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",n)}),this.$slider.addEventListener("touchstart",d=>{d.touches.length>1||(this._hasScrollBar?(s=d.touches[0].clientX,r=d.touches[0].clientY,a=!0):o(d),window.addEventListener("touchmove",l,{passive:!1}),window.addEventListener("touchend",c))},{passive:!1}),this.$slider.addEventListener("wheel",d=>{if(Math.abs(d.deltaX)<Math.abs(d.deltaY)&&this._hasScrollBar)return;d.preventDefault();const A=this._normalizeMouseWheel(d)*this._step;this._snapClampSetValue(this.getValue()+A),this.$input.value=this.getValue(),clearTimeout(h),h=setTimeout(u,400)},{passive:!1})}_setDraggingStyle(e,t="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle("lil-gui-"+t,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:t,deltaY:n}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(t=0,n=-e.wheelDelta/120,n*=this._stepExplicit?1:10),t+-n}_arrowKeyMultiplier(e){let t=this._stepExplicit?1:10;return e.shiftKey?t*=10:e.altKey&&(t/=10),t}_snap(e){const t=Math.round(e/this._step)*this._step;return parseFloat(t.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class JJ extends Lr{constructor(e,t,n,s){super(e,t,n,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(s)?s:Object.values(s),this._names=Array.isArray(s)?s:Object.keys(s),this._names.forEach(r=>{const a=document.createElement("option");a.innerHTML=r,this.$select.appendChild(a)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}}class KJ extends Lr{constructor(e,t,n){super(e,t,n,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",s=>{s.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let XT=!1;class rx{constructor({parent:e,autoPlace:t=e===void 0,container:n,width:s,title:r="Controls",injectStyles:a=!0,touchStyles:o=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",l=>{l.code!=="Enter"&&l.code!=="Space"||(l.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(r),o&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!XT&&a&&((function(l){const c=document.createElement("style");c.innerHTML=l;const u=document.querySelector("head link[rel=stylesheet], head style");u?document.head.insertBefore(c,u):document.head.appendChild(c)})('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),XT=!0),n?n.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),s&&this.domElement.style.setProperty("--width",s+"px"),this.domElement.addEventListener("keydown",l=>l.stopPropagation()),this.domElement.addEventListener("keyup",l=>l.stopPropagation())}add(e,t,n,s,r){if(Object(n)===n)return new JJ(this,e,t,n);const a=e[t];switch(typeof a){case"number":return new XJ(this,e,t,n,s,r);case"boolean":return new $J(this,e,t);case"string":return new KJ(this,e,t);case"function":return new $0(this,e,t)}console.error(`gui.add failed
17520
17520
  property:`,t,`
17521
17521
  object:`,e,`
17522
- value:`,a)}addColor(e,t,n=1){return new jJ(this,e,t,n)}addFolder(e){return new rx({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(n=>{n instanceof $0||n._name in e.controllers&&n.load(e.controllers[n._name])}),t&&e.folders&&this.folders.forEach(n=>{n._title in e.folders&&n.load(e.folders[n._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(n=>{if(!(n instanceof $0)){if(n._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${n._name}"`);t.controllers[n._name]=n.save()}}),e&&this.folders.forEach(n=>{if(n._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${n._title}"`);t.folders[n._title]=n.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const n=r=>{r.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const s=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=s+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}class cA extends Qo{constructor(){super(),this._onExperienceUpdatedHandler=()=>this.__rebuildGui(),this.nullableProductSettings={skipCameraFit:!1},this._isDirty=!1,this._saveSettingsController=null,this.__copySettingButton=null,this.settingsToImport="",this._confirmButton=null,this._loggerContext="SETTINGS MANAGER"}static{this.webComponentName="settings-manager"}static setupWebComponent(){window.customElements.get(cA.webComponentName)||window.customElements.define(cA.webComponentName,cA)}static{this.styles=ht``}firstUpdated(){this.appWcRef.addEventListener(this.events.experienceUpdatedEvent.name,this._onExperienceUpdatedHandler),this.__addGui()}get events(){return this.appWcRef.eventsManager}get productSettings(){return this.appWcRef.productSettings}__addCameraSettingsGui(e){const t=this.productSettings.camera;e.addColor(t,"backgroundColor").name("Background Color").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"backgroundAlpha",0,1).name("Background Alpha").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"focalLength",10,300).name("Focal Length").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"nearClip",0,3).name("Near Clip").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"farClip",0,1e4).name("Far Clip").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"canPan").name("Can Pan").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"canZoom").name("Can Zoom").onFinishChange(n=>{this.__onCanZoomChanged(n),this.__onCameraSettingChanged()}),this.__minDistanceSetting=e.add(t,"minDistance",0,100).name("Min Distance").onFinishChange(()=>this.__onCameraSettingChanged()),this.__maxDistanceSetting=e.add(t,"maxDistance",0,100).name("Max Distance").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"infinitePolarAngle").name("Infinite Polar Angle").onFinishChange(n=>{this.__onInfinitePolarAngleChanged(n),this.__onCameraSettingChanged()}),this.__minPolarAngleSetting=e.add(t,"minPolarAngle",0,6.25).step(.01).name("Min Polar Angle").onFinishChange(()=>this.__onCameraSettingChanged()),this.__maxPolarAngleSetting=e.add(t,"maxPolarAngle",0,6.25).step(.01).name("Max Polar Angle").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"infiniteAzimuthAngle").name("Infinite Azimuth Angle").onFinishChange(n=>{this.__onInfiniteAzimuthAngleChanged(n),this.__onCameraSettingChanged()}),this.__minAzimuthAngleSetting=e.add(t,"minAzimuthAngle",0,6.25).name("Min Azimuth Angle").step(.01).onFinishChange(()=>this.__onCameraSettingChanged()),this.__maxAzimuthAngleSetting=e.add(t,"maxAzimuthAngle",0,6.25).name("Max Azimuth Angle").step(.01).onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"interactionPromptRepeat").name("Interaction Prompt Repeat (Wiggle:Repeat)").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"cameraBoundsMultiplier",0,2).name("Camera Bounds Multiplier").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(this,"startInitialCameraUpdate").name("Change Initial Camera"),this.nullableProductSettings.skipCameraFit=!!this.productSettings.camera.initial?.skipCameraFit,e.add(this.nullableProductSettings,"skipCameraFit").name("Skip Camera Fit On Initial Camera").onFinishChange(n=>{t.initial&&(t.initial.skipCameraFit=n),this.__onCameraSettingChanged()})}__addRenderSettingsGui(e){const t=this.productSettings.render;e.add(t,"mode",[$s.GEO,$s.SPLAT]).name("Render Mode").onFinishChange(r=>{this.__showSplatModeSettingsByRenderMode(r),this.__onSettingChanged()}),this.__splatModeSettingsFolder=e.addFolder("Splat Mode");const n=this.__splatModeSettingsFolder;n.add(t.splatMode,"blurAmount",0,10).name("Blur Amount").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"preBlurAmount",0,10).name("Pre Blur Amount").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"falloff",0,1).name("Falloff").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"maxStdDev",Math.sqrt(5),Math.sqrt(8)).name("Max Std Dev").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"focalAdjustment",.5,3).name("Focal Adjustment").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"minPixelRadius",0,10).name("Min Pixel Radius").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"maxPixelRadius",0,2048).name("Max Pixel Radius").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"minAlpha",0,.1).name("Min Alpha").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"focalDistance",0,100).name("Focal Distance").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"apertureAngle",0,Math.PI/2).name("Aperture Angle").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"clipXY",1,2).name("Clip XY").onFinishChange(()=>this.__onSettingChanged()),n.close(),this.__showSplatModeSettingsByRenderMode(t.mode),e.add(t,"envMap").name("Env Map").onFinishChange(()=>this.__onSettingChanged());const s=e.addFolder("Env Map Rotation");s.add(t.envMapRotation,"x",0,360).name("X").onFinishChange(()=>this.__onSettingChanged()),s.add(t.envMapRotation,"y",0,360).name("Y").onFinishChange(()=>this.__onSettingChanged()),s.add(t.envMapRotation,"z",0,360).name("Z").onFinishChange(()=>this.__onSettingChanged()),s.close()}__showSplatModeSettingsByRenderMode(e){e===$s.SPLAT?this.__splatModeSettingsFolder.show():this.__splatModeSettingsFolder.hide()}__showCorrectShadowSettingsByType(e){switch(this.__accumulativeShadowSettingsFolder.hide(),this.__contactShadowSettingsFolder.hide(),e){case yl.ACCUMULATIVE:this.__accumulativeShadowSettingsFolder.show();break;case yl.CONTACT:this.__contactShadowSettingsFolder.show();break}}__addShadowTypeSettingsGui(e){e.add(this.productSettings.shadows,"shadowType",[yl.NONE,yl.ACCUMULATIVE,yl.CONTACT]).name("Shadow Type").onFinishChange(t=>{this.events.productSettingsShadowTypeUpdatedEvent.fire({shadowType:t}),this.__showCorrectShadowSettingsByType(t),this.__onSettingChanged()})}__addAcuumulativeShadowSettingsGui(e){this.__accumulativeShadowSettingsFolder=e.addFolder("Accumulative Shadow Settings");const t=this.productSettings.shadows.accumulativeShadows,n=t.shadowMaterial;this.__accumulativeShadowSettingsFolder.add(n,"opacity",0,1).name("Opacity").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(n,"alphaTest",0,1).name("Alpha Test").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.addColor(n,"color").name("Color").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(n,"blend",0,40).name("Blend").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"frames",2,100,1).name("Frames").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"scale",.5,30).name("Scale").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"radius",.1,5).name("Radius").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"ambient",0,1).name("Ambient").onFinishChange(()=>this.__onSettingChanged());const s=this.__accumulativeShadowSettingsFolder.addFolder("Light Direction");s.add(t.light.direction,"x",-10,10).name("X").onFinishChange(()=>this.__onSettingChanged()),s.add(t.light.direction,"y",-10,10).name("Y").onFinishChange(()=>this.__onSettingChanged()),s.add(t.light.direction,"z",-10,10).name("Z").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.close()}__addContactShadowSettingsGui(e){this.__contactShadowSettingsFolder=e.addFolder("Contact Shadow Settings");const t=this.productSettings.shadows.contactShadows;this.__contactShadowSettingsFolder.add(t,"planeLength",0,20).name("Plane Length").onFinishChange(n=>{t.planeLength=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"planeWidth",0,20).name("Plane Width").onFinishChange(n=>{t.planeWidth=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"cameraHeight",0,20).name("Camera Height").onFinishChange(n=>{t.cameraHeight=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"intensity",0,3).name("Intensity").onFinishChange(n=>{t.intensity=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"softness",0,3).name("Softness").onFinishChange(n=>{t.softness=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.close()}__addHotspotsSettingsGui(e){const t=this.productSettings.hotspots;e.add(t,"showNavigationButtons").name("Show Navigation Buttons").onFinishChange(()=>this.__onSettingChanged())}__onCanZoomChanged(e){e===!0?(this.__minDistanceSetting?.show(),this.__maxDistanceSetting?.show()):(this.__minDistanceSetting?.hide(),this.__maxDistanceSetting?.hide())}__onInfinitePolarAngleChanged(e){e===!0?(this.__minPolarAngleSetting?.hide(),this.__maxPolarAngleSetting?.hide()):(this.__minPolarAngleSetting?.show(),this.__maxPolarAngleSetting?.show())}__onInfiniteAzimuthAngleChanged(e){e===!0?(this.__minAzimuthAngleSetting?.hide(),this.__maxAzimuthAngleSetting?.hide()):(this.__minAzimuthAngleSetting?.show(),this.__maxAzimuthAngleSetting?.show())}__onSettingChanged(){this.events.productSettingUpdatedEvent.fire(),this._isDirty||(this._isDirty=!0,this._saveSettingsController&&this._saveSettingsController.disable(!1))}__onCameraSettingChanged(){this.events.cameraProductSettingUpdatedEvent.fire(),this.__onSettingChanged()}__rebuildGui(){this._isDirty=!1,this.gui&&this.gui.destroy(),this.__addGui()}async copySettings(){const e=JSON.stringify(this.productSettings.asJson(),null,2);if(await navigator.clipboard.writeText(e).catch(t=>{window.epigraph.logger.error({title:"Failed to copy settings",details:t,contextOverride:this._loggerContext})}),this.__copySettingButton){const t=this.__copySettingButton.$name.innerHTML;this.__copySettingButton.name("Copied!"),setTimeout(()=>{this.__copySettingButton?.name(t)},1500)}}importSettings(){if(!this.settingsToImport){window.epigraph.logger.warn({title:"Import failed",details:"Settings JSON is empty.",contextOverride:this._loggerContext});return}try{const e=JSON.parse(this.settingsToImport);this.productSettings.deepCopyProductSettings(e),this.__rebuildGui(),this.events.experienceUpdatedEvent.fire()}catch(e){window.epigraph.logger.error({title:"Failed to parse settings JSON",details:e,contextOverride:this._loggerContext})}}__addGui(){this.gui=new rx({autoPlace:!1,container:this.appWcRef.appUiContainerElemRef,injectStyles:!1,title:"Experience Settings"});const e=this.gui.addFolder("Import/Export");this.__copySettingButton=e.add(this,"copySettings").name("Copy Settings"),e.add(this,"settingsToImport").name("Paste JSON here"),e.add(this,"importSettings").name("Import Settings"),e.close(),this._saveSettingsController=this.gui.add(this,"saveSettings").name("Save Settings"),this._saveSettingsController?.$widget.classList.add("save-settings-button"),this._saveSettingsController?.disable(!0);const t=this.gui.addFolder("Camera");this.__addCameraSettingsGui(t),t.close();const n=this.gui.addFolder("Render");this.__addRenderSettingsGui(n),n.close();const s=this.gui.addFolder("Shadows");this.__addShadowTypeSettingsGui(s),this.__addAcuumulativeShadowSettingsGui(s),this.__addContactShadowSettingsGui(s),s.close();const r=this.gui.addFolder("Hotspots");this.__addHotspotsSettingsGui(r),r.close(),this.__showCorrectShadowSettingsByType(this.productSettings.shadows.shadowType),this.__onCanZoomChanged(this.productSettings.camera.canZoom),this.__onInfinitePolarAngleChanged(this.productSettings.camera.infinitePolarAngle),this.__onInfiniteAzimuthAngleChanged(this.productSettings.camera.infiniteAzimuthAngle)}startInitialCameraUpdate(){this.appWcRef.enterViewState(),this.hide();const e=document.createElement("epg-button");e.setAttribute("label","Confirm View"),e.setAttribute("left-icon",""),e.setAttribute("right-icon",""),e.style.backgroundColor="#7fa66d",e.style.position="absolute",e.style.top="16px",e.style.right="16px",e.style.zIndex="100",e.style.pointerEvents="auto",e.addEventListener("click",()=>this.confirmInitialCameraUpdate()),this.appWcRef.appUiContainerElemRef.appendChild(e),this._confirmButton=e}confirmInitialCameraUpdate(){this.productSettings.camera.initial=this.appWcRef.cameraManager.getCurrentCameraTransforms(),this.appWcRef.enterDefaultState(),this._confirmButton&&(this._confirmButton.remove(),this._confirmButton=null),this.__onSettingChanged(),this.show()}saveSettings(){this.events.productSettingsSavedEvent.fire({updatedSettings:this.productSettings.asJson()}),this._isDirty=!1,this._saveSettingsController&&this._saveSettingsController.disable(!0)}show(){this.gui?.show()}hide(){this.gui?.hide()}connectedCallback(){super.connectedCallback(),this.show()}disconnectedCallback(){this.hide(),this.appWcRef.removeEventListener(this.events.experienceUpdatedEvent.name,this._onExperienceUpdatedHandler),super.disconnectedCallback()}}class JT{constructor({config:e,appWcRef:t,commentsManagerRef:n}){this.__cameraDirection=new Q,this.__localPosition=new Q,this.__worldPosition=new Q,this.__normals=new Q,this.__screenPosition=new pe,this.__camera={position:new Q,target:new Q,focalLength:35},this.entity=new Rt,this.visited=!1,this.__config=e,this.__appWcRef=t,this.__commentsManager=n,this.updateConfig(e)}static{this.styles=ht`
17522
+ value:`,a)}addColor(e,t,n=1){return new jJ(this,e,t,n)}addFolder(e){return new rx({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(n=>{n instanceof $0||n._name in e.controllers&&n.load(e.controllers[n._name])}),t&&e.folders&&this.folders.forEach(n=>{n._title in e.folders&&n.load(e.folders[n._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(n=>{if(!(n instanceof $0)){if(n._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${n._name}"`);t.controllers[n._name]=n.save()}}),e&&this.folders.forEach(n=>{if(n._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${n._title}"`);t.folders[n._title]=n.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const n=r=>{r.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const s=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=s+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}class cA extends Qo{constructor(){super(),this._onExperienceUpdatedHandler=()=>this.__rebuildGui(),this.nullableProductSettings={skipCameraFit:!1},this._isDirty=!1,this._saveSettingsController=null,this.__copySettingButton=null,this.settingsToImport="",this._confirmButton=null,this._loggerContext="SETTINGS MANAGER"}static{this.webComponentName="settings-manager"}static setupWebComponent(){window.customElements.get(cA.webComponentName)||window.customElements.define(cA.webComponentName,cA)}static{this.styles=ht``}firstUpdated(){this.appWcRef.addEventListener(this.events.experienceUpdatedEvent.name,this._onExperienceUpdatedHandler),this.__addGui()}get events(){return this.appWcRef.eventsManager}get productSettings(){return this.appWcRef.productSettings}__addCameraSettingsGui(e){const t=this.productSettings.camera;e.addColor(t,"backgroundColor").name("Background Color").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"backgroundAlpha",0,1).name("Background Alpha").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"focalLength",10,300).name("Focal Length").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"nearClip",0,3).name("Near Clip").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"farClip",0,1e4).name("Far Clip").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"canPan").name("Can Pan").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"canZoom").name("Can Zoom").onFinishChange(n=>{this.__onCanZoomChanged(n),this.__onCameraSettingChanged()}),this.__minDistanceSetting=e.add(t,"minDistance",0,100).name("Min Distance from Bounds").onFinishChange(()=>this.__onCameraSettingChanged()),this.__maxDistanceSetting=e.add(t,"maxDistance",0,100).name("Max Distance from Bounds").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"infinitePolarAngle").name("Infinite Polar Angle").onFinishChange(n=>{this.__onInfinitePolarAngleChanged(n),this.__onCameraSettingChanged()}),this.__minPolarAngleSetting=e.add(t,"minPolarAngle",0,6.25).step(.01).name("Min Polar Angle").onFinishChange(()=>this.__onCameraSettingChanged()),this.__maxPolarAngleSetting=e.add(t,"maxPolarAngle",0,6.25).step(.01).name("Max Polar Angle").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"infiniteAzimuthAngle").name("Infinite Azimuth Angle").onFinishChange(n=>{this.__onInfiniteAzimuthAngleChanged(n),this.__onCameraSettingChanged()}),this.__minAzimuthAngleSetting=e.add(t,"minAzimuthAngle",0,6.25).name("Min Azimuth Angle").step(.01).onFinishChange(()=>this.__onCameraSettingChanged()),this.__maxAzimuthAngleSetting=e.add(t,"maxAzimuthAngle",0,6.25).name("Max Azimuth Angle").step(.01).onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"interactionPromptRepeat").name("Interaction Prompt Repeat (Wiggle:Repeat)").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(t,"cameraBoundsMultiplier",0,2).name("Camera Bounds Multiplier").onFinishChange(()=>this.__onCameraSettingChanged()),e.add(this,"startInitialCameraUpdate").name("Change Initial Camera"),this.nullableProductSettings.skipCameraFit=!!this.productSettings.camera.initial?.skipCameraFit,e.add(this.nullableProductSettings,"skipCameraFit").name("Skip Camera Fit On Initial Camera").onFinishChange(n=>{t.initial&&(t.initial.skipCameraFit=n),this.__onCameraSettingChanged()})}__addRenderSettingsGui(e){const t=this.productSettings.render;e.add(t,"mode",[$s.GEO,$s.SPLAT]).name("Render Mode").onFinishChange(r=>{this.__showSplatModeSettingsByRenderMode(r),this.__onSettingChanged()}),this.__splatModeSettingsFolder=e.addFolder("Splat Mode");const n=this.__splatModeSettingsFolder;n.add(t.splatMode,"blurAmount",0,10).name("Blur Amount").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"preBlurAmount",0,10).name("Pre Blur Amount").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"falloff",0,1).name("Falloff").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"maxStdDev",Math.sqrt(5),Math.sqrt(8)).name("Max Std Dev").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"focalAdjustment",.5,3).name("Focal Adjustment").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"minPixelRadius",0,10).name("Min Pixel Radius").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"maxPixelRadius",0,2048).name("Max Pixel Radius").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"minAlpha",0,.1).name("Min Alpha").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"focalDistance",0,100).name("Focal Distance").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"apertureAngle",0,Math.PI/2).name("Aperture Angle").onFinishChange(()=>this.__onSettingChanged()),n.add(t.splatMode,"clipXY",1,2).name("Clip XY").onFinishChange(()=>this.__onSettingChanged()),n.close(),this.__showSplatModeSettingsByRenderMode(t.mode),e.add(t,"envMap").name("Env Map").onFinishChange(()=>this.__onSettingChanged());const s=e.addFolder("Env Map Rotation");s.add(t.envMapRotation,"x",0,360).name("X").onFinishChange(()=>this.__onSettingChanged()),s.add(t.envMapRotation,"y",0,360).name("Y").onFinishChange(()=>this.__onSettingChanged()),s.add(t.envMapRotation,"z",0,360).name("Z").onFinishChange(()=>this.__onSettingChanged()),s.close()}__showSplatModeSettingsByRenderMode(e){e===$s.SPLAT?this.__splatModeSettingsFolder.show():this.__splatModeSettingsFolder.hide()}__showCorrectShadowSettingsByType(e){switch(this.__accumulativeShadowSettingsFolder.hide(),this.__contactShadowSettingsFolder.hide(),e){case yl.ACCUMULATIVE:this.__accumulativeShadowSettingsFolder.show();break;case yl.CONTACT:this.__contactShadowSettingsFolder.show();break}}__addShadowTypeSettingsGui(e){e.add(this.productSettings.shadows,"shadowType",[yl.NONE,yl.ACCUMULATIVE,yl.CONTACT]).name("Shadow Type").onFinishChange(t=>{this.events.productSettingsShadowTypeUpdatedEvent.fire({shadowType:t}),this.__showCorrectShadowSettingsByType(t),this.__onSettingChanged()})}__addAcuumulativeShadowSettingsGui(e){this.__accumulativeShadowSettingsFolder=e.addFolder("Accumulative Shadow Settings");const t=this.productSettings.shadows.accumulativeShadows,n=t.shadowMaterial;this.__accumulativeShadowSettingsFolder.add(n,"opacity",0,1).name("Opacity").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(n,"alphaTest",0,1).name("Alpha Test").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.addColor(n,"color").name("Color").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(n,"blend",0,40).name("Blend").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"frames",2,100,1).name("Frames").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"scale",.5,30).name("Scale").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"radius",.1,5).name("Radius").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.add(t.shadowParams,"ambient",0,1).name("Ambient").onFinishChange(()=>this.__onSettingChanged());const s=this.__accumulativeShadowSettingsFolder.addFolder("Light Direction");s.add(t.light.direction,"x",-10,10).name("X").onFinishChange(()=>this.__onSettingChanged()),s.add(t.light.direction,"y",-10,10).name("Y").onFinishChange(()=>this.__onSettingChanged()),s.add(t.light.direction,"z",-10,10).name("Z").onFinishChange(()=>this.__onSettingChanged()),this.__accumulativeShadowSettingsFolder.close()}__addContactShadowSettingsGui(e){this.__contactShadowSettingsFolder=e.addFolder("Contact Shadow Settings");const t=this.productSettings.shadows.contactShadows;this.__contactShadowSettingsFolder.add(t,"planeLength",0,20).name("Plane Length").onFinishChange(n=>{t.planeLength=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"planeWidth",0,20).name("Plane Width").onFinishChange(n=>{t.planeWidth=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"cameraHeight",0,20).name("Camera Height").onFinishChange(n=>{t.cameraHeight=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"intensity",0,3).name("Intensity").onFinishChange(n=>{t.intensity=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.add(t,"softness",0,3).name("Softness").onFinishChange(n=>{t.softness=n,this.__onSettingChanged()}),this.__contactShadowSettingsFolder.close()}__addHotspotsSettingsGui(e){const t=this.productSettings.hotspots;e.add(t,"showNavigationButtons").name("Show Navigation Buttons").onFinishChange(()=>this.__onSettingChanged())}__onCanZoomChanged(e){e===!0?(this.__minDistanceSetting?.show(),this.__maxDistanceSetting?.show()):(this.__minDistanceSetting?.hide(),this.__maxDistanceSetting?.hide())}__onInfinitePolarAngleChanged(e){e===!0?(this.__minPolarAngleSetting?.hide(),this.__maxPolarAngleSetting?.hide()):(this.__minPolarAngleSetting?.show(),this.__maxPolarAngleSetting?.show())}__onInfiniteAzimuthAngleChanged(e){e===!0?(this.__minAzimuthAngleSetting?.hide(),this.__maxAzimuthAngleSetting?.hide()):(this.__minAzimuthAngleSetting?.show(),this.__maxAzimuthAngleSetting?.show())}__onSettingChanged(){this.events.productSettingUpdatedEvent.fire(),this._isDirty||(this._isDirty=!0,this._saveSettingsController&&this._saveSettingsController.disable(!1))}__onCameraSettingChanged(){this.events.cameraProductSettingUpdatedEvent.fire(),this.__onSettingChanged()}__rebuildGui(){this._isDirty=!1,this.gui&&this.gui.destroy(),this.__addGui()}async copySettings(){const e=JSON.stringify(this.productSettings.asJson(),null,2);if(await navigator.clipboard.writeText(e).catch(t=>{window.epigraph.logger.error({title:"Failed to copy settings",details:t,contextOverride:this._loggerContext})}),this.__copySettingButton){const t=this.__copySettingButton.$name.innerHTML;this.__copySettingButton.name("Copied!"),setTimeout(()=>{this.__copySettingButton?.name(t)},1500)}}importSettings(){if(!this.settingsToImport){window.epigraph.logger.warn({title:"Import failed",details:"Settings JSON is empty.",contextOverride:this._loggerContext});return}try{const e=JSON.parse(this.settingsToImport);this.productSettings.deepCopyProductSettings(e),this.__rebuildGui(),this.events.experienceUpdatedEvent.fire()}catch(e){window.epigraph.logger.error({title:"Failed to parse settings JSON",details:e,contextOverride:this._loggerContext})}}__addGui(){this.gui=new rx({autoPlace:!1,container:this.appWcRef.appUiContainerElemRef,injectStyles:!1,title:"Experience Settings"});const e=this.gui.addFolder("Import/Export");this.__copySettingButton=e.add(this,"copySettings").name("Copy Settings"),e.add(this,"settingsToImport").name("Paste JSON here"),e.add(this,"importSettings").name("Import Settings"),e.close(),this._saveSettingsController=this.gui.add(this,"saveSettings").name("Save Settings"),this._saveSettingsController?.$widget.classList.add("save-settings-button"),this._saveSettingsController?.disable(!0);const t=this.gui.addFolder("Camera");this.__addCameraSettingsGui(t),t.close();const n=this.gui.addFolder("Render");this.__addRenderSettingsGui(n),n.close();const s=this.gui.addFolder("Shadows");this.__addShadowTypeSettingsGui(s),this.__addAcuumulativeShadowSettingsGui(s),this.__addContactShadowSettingsGui(s),s.close();const r=this.gui.addFolder("Hotspots");this.__addHotspotsSettingsGui(r),r.close(),this.__showCorrectShadowSettingsByType(this.productSettings.shadows.shadowType),this.__onCanZoomChanged(this.productSettings.camera.canZoom),this.__onInfinitePolarAngleChanged(this.productSettings.camera.infinitePolarAngle),this.__onInfiniteAzimuthAngleChanged(this.productSettings.camera.infiniteAzimuthAngle)}startInitialCameraUpdate(){this.appWcRef.enterViewState(),this.hide();const e=document.createElement("epg-button");e.setAttribute("label","Confirm View"),e.setAttribute("left-icon",""),e.setAttribute("right-icon",""),e.style.backgroundColor="#7fa66d",e.style.position="absolute",e.style.top="16px",e.style.right="16px",e.style.zIndex="100",e.style.pointerEvents="auto",e.addEventListener("click",()=>this.confirmInitialCameraUpdate()),this.appWcRef.appUiContainerElemRef.appendChild(e),this._confirmButton=e}confirmInitialCameraUpdate(){this.productSettings.camera.initial=this.appWcRef.cameraManager.getCurrentCameraTransforms(),this.appWcRef.enterDefaultState(),this._confirmButton&&(this._confirmButton.remove(),this._confirmButton=null),this.__onSettingChanged(),this.show()}saveSettings(){this.events.productSettingsSavedEvent.fire({updatedSettings:this.productSettings.asJson()}),this._isDirty=!1,this._saveSettingsController&&this._saveSettingsController.disable(!0)}show(){this.gui?.show()}hide(){this.gui?.hide()}connectedCallback(){super.connectedCallback(),this.show()}disconnectedCallback(){this.hide(),this.appWcRef.removeEventListener(this.events.experienceUpdatedEvent.name,this._onExperienceUpdatedHandler),super.disconnectedCallback()}}class JT{constructor({config:e,appWcRef:t,commentsManagerRef:n}){this.__cameraDirection=new Q,this.__localPosition=new Q,this.__worldPosition=new Q,this.__normals=new Q,this.__screenPosition=new pe,this.__camera={position:new Q,target:new Q,focalLength:35},this.entity=new Rt,this.visited=!1,this.__config=e,this.__appWcRef=t,this.__commentsManager=n,this.updateConfig(e)}static{this.styles=ht`
17523
17523
  :host {
17524
17524
  * {
17525
17525
  user-select: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [