/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../../chunks/_rollupPluginBabelHelpers","../../../../../chunks/tslib.es6","../../../../../core/time","../../../../../core/Logger","../../../../../core/accessorSupport/ensureType","../../../../../core/arrayUtils","../../../../../core/has","../../../../../core/accessorSupport/set","../../../../../core/accessorSupport/decorators/subclass","../../../../../chunks/vec3","../../../../../chunks/vec3f64","../../../camera/constraintUtils","../../../camera/constraintUtils/common","../PointToPointAnimationController","../../../webgl-engine/lib/Camera","../../../webgl-engine/lib/Intersector","../../../webgl-engine/lib/verticalOffsetUtils","../../../../animation/easing"],(function(t,e,i,o,a,r,n,s,c,m,l,h,p,u,C,y,b,d,g){"use strict";const v=.6,w=4,M=60,S=14,f=200;t.ZoomStepController=function(t){function i(){var e;return(e=t.apply(this,arguments)||this).zoomLocation=h.create(),e.tmpCamera=new y.Camera,e.tmpRayDir=h.create(),e.tmpCenter=h.create(),e.constraintOptions={selection:u.ConstraintTypes.ALL,interactionType:u.InteractionType.ZOOM,interactionFactor:null,interactionStartCamera:new y.Camera,interactionDirection:null,tiltMode:u.TiltMode.TUMBLE},e}e._inheritsLoose(i,t);var a=i.prototype;return a.zoomStep=function(t,e){if(!this.active)return;const i=this.view.state,{interactionStartCamera:o}=this.constraintOptions;this.animation.finished?o.copyFrom(i.camera):this.animation.cameraAt(1,o),this.tmpCamera.copyFrom(i.camera);const a=b.newIntersector(this.view.state.viewingMode);t>0?(0===this.view.map.ground.opacity?this.intersectionHelper.intersectScreenFreePointFallback(e,this.zoomLocation,T):this.intersectionHelper.intersectScreenFreePointFallback(e,this.zoomLocation),this.intersectionHelper.intersectRay(this.tmpCamera.ray,a,this.tmpCenter)&&(this.tmpCamera.center=this.tmpCenter)):this.intersectionHelper.intersectRay(this.tmpCamera.ray,a,this.zoomLocation)?this.tmpCamera.center=this.zoomLocation:l.copy(this.zoomLocation,this.tmpCamera.center);const r=v**t;let n=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,e[0],e[1],this.view.state.camera,M);l.subtract(R,this.tmpCamera.eye,this.zoomLocation),l.normalize(R,R);const s=Math.max(Math.min(S,1/Math.abs(l.dot(z,R)))*Math.abs(this.view.camera.position.z),f);if(n=n?Math.min(n,s):s,n){const t=h.create();l.subtract(t,this.zoomLocation,this.tmpCamera.eye),n<l.length(t)&&(l.normalize(t,t),l.add(this.zoomLocation,this.tmpCamera.eye,l.scale(t,t,n)))}this._updateCamera(this.tmpCamera,r,this.zoomLocation),this.begin(this.tmpCamera)},a.animationSettings=function(){return{apex:null,duration:o.Milliseconds(600),easing:g.outExpo}},a._updateCamera=function(t,e,i){l.subtract(this.tmpRayDir,i,t.eye);const o=l.length(this.tmpRayDir);let a=o*e;const r=e<=1,n=Math.max(w,1.01*t.nearFar[0]);r&&a<n&&(a=n,e=a/o),Math.abs(o-a)<1e-6||(l.scale(this.tmpRayDir,this.tmpRayDir,e),t.eye=l.subtract(L,i,this.tmpRayDir),t.center=l.lerp(L,t.center,i,1-e),p.applyAll(this.view,t,this.constraintOptions))},i}(C.PointToPointAnimationController),t.ZoomStepController=i.__decorate([m.subclass("esri.views.3d.state.controllers.local.ZoomStepController")],t.ZoomStepController);const L=h.create(),z=h.fromValues(0,0,1),R=h.create(),T={exclude:new Set([d.TERRAIN_ID])};Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
