/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{applyAltitudeConstraint as t,getAltitudeConstraintError as o}from"./constraintUtils/altitude.js";import{hasConstraintType as r}from"./constraintUtils/common.js";import{ConstraintOptions as n}from"./constraintUtils/ConstraintOptions.js";import{applyDistanceConstraint as i,getDistanceConstraintError as e}from"./constraintUtils/distance.js";import{applySurfaceCollisionConstraint as s}from"./constraintUtils/surfaceCollision.js";import{applyTiltConstraint as a,getTiltConstraintError as c}from"./constraintUtils/tilt.js";import{inOutCubic as p}from"../../animation/easing.js";function l(t,o,n=U,i=o){i!==o&&i.copyFrom(o),i.computeUp(t.state.viewingMode);let e=!1;for(let s=0;s<j;s++){let o=0;for(const s of y)if(r(n.selection,s.type)){const r=Math.abs(s.error(t,i,n));s.apply(t,i,n)&&(e=!0,o+=r)}if(0===o)break}const a=r(n.selection,8),c=m(n.interactionType,t);return a&&s(t,i,c)&&(e=!0),e&&i.computeUp(t.state.viewingMode),e}function m(t,o){switch(t){case 4:return 1;case 5:return o.state.isGlobal?2:1;default:return 0}}function f(t){const o=Math.min(1,t/150);return p(o)}function u(t,o,r){return c(t,o,r)*o.distance}const y=[{type:1,error:u,apply:a},{type:2,error:o,apply:t},{type:4,error:e,apply:i}],U=new n,j=5;export{l as applyAll,f as pixelDistanceToInteractionFactor};
