/*
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/vec2","./constraintUtils/altitude","./constraintUtils/common","./constraintUtils/distance","./constraintUtils/surfaceCollision","./constraintUtils/tilt","../../animation/easing"],(function(t,n,e,i,r,o,a,s){"use strict";function l(t,n,e=u,r=n){let a=!1;r!==n&&r.copyFrom(n),r.computeUp(t.state.viewingMode);for(let o=0;o<T;o++){let n=0;for(const o of C)if(i.hasConstraintType(e.selection,o.type)){const i=Math.abs(o.error(t,r,e));o.apply(t,r,e)&&(a=!0,n+=i)}if(0===n)break}const s=i.hasConstraintType(e.selection,i.ConstraintTypes.COLLISION),l=p(e.interactionType,t);return s&&o.applySurfaceCollisionConstraint(t,r,l)&&(a=!0),a&&r.computeUp(t.state.viewingMode),a}function p(t,n){switch(t){case i.InteractionType.PAN:return o.Mode.EYE_AND_CENTER;case i.InteractionType.ASCEND:return n.state.isGlobal?o.Mode.EYE_AND_CENTER_SCALE:o.Mode.EYE_AND_CENTER;default:return o.Mode.EYE}}function c(t,e){const i="number"==typeof t?t:n.distance(t,e),r=Math.min(1,i/150);return s.inOutCubic(r)}function y(t,n,e){return a.getTiltConstraintError(t,n,e)*n.distance}const C=[{type:i.ConstraintTypes.TILT,error:y,apply:a.applyTiltConstraint},{type:i.ConstraintTypes.ALTITUDE,error:e.getAltitudeConstraintError,apply:e.applyAltitudeConstraint},{type:i.ConstraintTypes.DISTANCE,error:r.getDistanceConstraintError,apply:r.applyDistanceConstraint}],u={selection:i.ConstraintTypes.ALL,interactionType:i.InteractionType.NONE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:i.TiltMode.TUMBLE},T=5;t.applyAltitudeConstraint=e.applyAltitudeConstraint,t.getAltitudeConstraintError=e.getAltitudeConstraintError,Object.defineProperty(t,"ConstraintTypes",{enumerable:!0,get:()=>i.ConstraintTypes}),Object.defineProperty(t,"InteractionType",{enumerable:!0,get:()=>i.InteractionType}),t.applyDistanceConstraint=r.applyDistanceConstraint,t.getDistanceConstraintError=r.getDistanceConstraintError,Object.defineProperty(t,"ApplyCollisionMode",{enumerable:!0,get:()=>o.Mode}),t.applySurfaceCollisionConstraint=o.applySurfaceCollisionConstraint,t.applyTiltConstraint=a.applyTiltConstraint,t.getTiltConstraintError=a.getTiltConstraintError,t.applyAll=l,t.pixelDistanceToInteractionFactor=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
