/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{e as r,f as o,p as n,n as i}from"../../../chunks/vec32.js";import{sv3d as c,sm4d as l}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as a}from"../../../layers/graphics/hydratedFeatures.js";import{manipulatedObjectGeometry as s}from"./editingTools/manipulatedObjectUtils.js";import{computeCentroid as u}from"../layers/graphics/graphicUtils.js";import{ColorMaterial as m}from"../webgl-engine/materials/ColorMaterial.js";import{ShadedColorMaterial as p}from"../webgl-engine/materials/ShadedColorMaterial.js";function g(t,r=4,o=!0){const n=e(t),i=!(t[3]<1);return o?new p({color:n,writeDepth:i,cullFace:2,renderOccluded:r,isDecoration:!0}):new m({color:n,writeDepth:i,cullFace:2,renderOccluded:r,isDecoration:!0})}function d(t,r=4){const o=e(t);return new m({color:o,writeDepth:!0,cullFace:1,renderOccluded:r,isDecoration:!0})}const f=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1}),h=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function j(e,i,a,s){const u=r(c.get(),e,a),m=w(u,o(c.get(),s,u),a,l.get());t(m,m);const p=n(c.get(),i,m);return Math.atan2(p[1],p[0])}function w(e,t,r,n){const l=i(c.get(),e),a=i(c.get(),t),s=o(c.get(),l,a);return n[0]=l[0],n[1]=l[1],n[2]=l[2],n[3]=0,n[4]=a[0],n[5]=a[1],n[6]=a[2],n[7]=0,n[8]=s[0],n[9]=s[1],n[10]=s[2],n[11]=0,n[12]=r[0],n[13]=r[1],n[14]=r[2],n[15]=1,n}function O(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function b(e,t){const r=t.origin;null==r?D(e,s(t)):e.elevationAlignedLocation=r}function D(e,t){if(null==t)return;const r="mesh"===t.type?t.origin:u(t);null!=r&&(e.location=a(r))}export{j as calculateInputRotationTransform,w as calculateTranslateRotateFromBases,g as createManipulatorMaterial,d as createManipulatorOutlineMaterial,O as getGraphicAttachmentOrigin,b as placeAtObject,f as rotateManipulatorDefaults,h as worldScaledManipulatorSettings};
