/*
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","../../../../../core/Handles","../../../../../core/handleUtils","../../../../../core/has","../../../../../core/maybe","../../../../../core/reactiveUtils","../ManipulatorType","./config","./Manipulation","./MoveXYAxisManipulation","./MoveXYDiscManipulation","./MoveZManipulation"],(function(i,a,n,e,t,o,s,l,r,u,p,c,h){"use strict";let M=function(u){function M(i){var a;(a=u.call(this)||this)._handles=new n,a._angleDeferred=null,a._interactive=!0;const{tool:e,view:t,snapToScene:o,radius:s}=i;return a._view=t,a.xyManipulation=new c.MoveXYDiscManipulation({tool:e,view:t,snapToScene:o,radius:s}),a.xyAxisManipulation=new p.MoveXYAxisManipulation({tool:e,view:t,radius:s}),a.zManipulation=new h.MoveZManipulation({tool:e,view:t,radius:s}),a.xyManipulation.available=i.xyAvailable,a.xyAxisManipulation.available=i.xyAxisAvailable,a.zManipulation.available=i.zAvailable,a._autoHideXYAxis(),a.forEachManipulator((i=>{a._handles.add(i.events.on("grab-changed",(()=>a._updateManipulatorInteractivity())))})),a}a._inheritsLoose(M,u);var d=M.prototype;return d.destroy=function(){this._handles.destroy(),this.xyManipulation.destroy(),this.xyAxisManipulation.destroy(),this.zManipulation.destroy()},d.createGraphicDragPipeline=function(a,n,t){return e.handlesGroup([this.xyManipulation.createGraphicDragPipeline(((n,e,t,o,s)=>a(i.ManipulationType.XY,n,e,t,o,s)),n,t),this.xyAxisManipulation.createGraphicDragPipeline(((n,e,t,o,s)=>a(i.ManipulationType.XY_AXIS,n,e,t,o,s)),n,t),this.zManipulation.createGraphicDragPipeline(((n,e,t,o,s)=>a(i.ManipulationType.Z,n,e,t,o,s)),n,t)])},d.createDragPipeline=function(a,n,t,o){return e.handlesGroup([this.xyManipulation.createDragPipeline(((n,e,t,o,s)=>a(i.ManipulationType.XY,n,e,t,o,s)),n,t,o),this.xyAxisManipulation.createDragPipeline(((n,e,t,o,s)=>a(i.ManipulationType.XY_AXIS,n,e,t,o,s)),n,t,o),this.zManipulation.createDragPipeline(((n,e,t,o,s)=>a(i.ManipulationType.Z,n,e,t,o,s)),t)])},d.forEachManipulator=function(i){this.xyManipulation.forEachManipulator((a=>i(a,l.ManipulatorType.TRANSLATE_XY))),this.xyAxisManipulation.forEachManipulator((a=>i(a,l.ManipulatorType.TRANSLATE_XY))),this.zManipulation.forEachManipulator((a=>i(a,l.ManipulatorType.TRANSLATE_Z)))},d._autoHideXYAxis=function(){const i=this.xyAxisManipulation,a=this.xyManipulation;if(t("esri-mobile"))return;const n=[];a.forEachManipulator((i=>n.push(i))),i.forEachManipulator((i=>n.push(i)));const e=()=>{const a=[];this.xyAxisVisible?o.isSome(this._angleDeferred)&&(this.angle=this._angleDeferred()):i.forEachManipulator((i=>a.push(i.disableDisplay()))),this._handles.remove(y),this._handles.add(a,y)};for(const t of n)this._handles.add(t.events.on("focus-changed",e));this._view.inputManager&&this._handles.add(s.when((()=>{var i;return null==(i=this._view.inputManager)?void 0:i.latestPointerType}),e)),e()},d._updateManipulatorInteractivity=function(){const i=this.grabbing;this.forEachManipulator((a=>{a.interactive=!i&&this._interactive||a.grabbing}))},M.radiusForSymbol=function(i){const a=o.isSome(i)&&"point-3d"===i.type&&i.symbolLayers;return!!a&&a.length>0&&a.some((i=>"icon"===i.type))?r.DISC_RADIUS_SMALL:r.DISC_RADIUS},a._createClass(M,[{key:"snapToScene",set:function(i){this.xyManipulation.snapToScene=i}},{key:"angle",set:function(i){this._angleDeferred=null,this.xyAxisManipulation.angle=i}},{key:"angleDeferred",set:function(i){this.xyAxisVisible?this.angle=i():this._angleDeferred=i}},{key:"interactive",set:function(i){this._interactive!==i&&(this._interactive=i,this._updateManipulatorInteractivity())}},{key:"radius",set:function(i){this.xyAxisManipulation.radius=i,this.xyManipulation.radius=i,this.zManipulation.radius=i}},{key:"displayScale",set:function(i){this.xyManipulation.displayScale=i,this.xyAxisManipulation.displayScale=i}},{key:"xyAxisVisible",get:function(){const i=this.xyManipulation.someManipulator((i=>i.focused))||this.xyAxisManipulation.someManipulator((i=>i.focused));return this._view.inputManager&&"touch"===this._view.inputManager.latestPointerType||i}}]),M}(u.Manipulation);const y="disable-xy-axis-display";var d;i.ManipulationType=void 0,(d=i.ManipulationType||(i.ManipulationType={}))[d.XY=0]="XY",d[d.XY_AXIS=1]="XY_AXIS",d[d.Z=2]="Z",i.MoveManipulation=M,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
