/*
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","../../../ViewingMode","../../state/controllers/GamepadKeyboardController","../../../input/InputHandler"],(function(e,t,r,a,o){"use strict";var n;!function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e[e.FORWARD=2]="FORWARD",e[e.BACKWARD=3]="BACKWARD",e[e.UP=4]="UP",e[e.DOWN=5]="DOWN",e[e.HEADINGLEFT=6]="HEADINGLEFT",e[e.HEADINGRIGHT=7]="HEADINGRIGHT",e[e.TILTUP=8]="TILTUP",e[e.TILTDOWN=9]="TILTDOWN",e[e.ZOOMIN=10]="ZOOMIN",e[e.ZOOMOUT=11]="ZOOMOUT"}(n||(n={}));let i=function(e){function o(t,a){var o;return(o=e.call(this,!0)||this).view=t,o.disableMovements={pan:!0,zoom:!1,ascend:!0,rotate:!1,mode:r.ViewingMode.Local},o.keyToNumber={[a.left]:n.LEFT,[a.right]:n.RIGHT,[a.forward]:n.FORWARD,[a.backward]:n.BACKWARD,[a.up]:n.UP,[a.down]:n.DOWN,[a.headingLeft]:n.HEADINGLEFT,[a.headingRight]:n.HEADINGRIGHT,[a.tiltUp]:n.TILTUP,[a.tiltDown]:n.TILTDOWN,[a.zoomIn]:n.ZOOMIN,[a.zoomOut]:n.ZOOMOUT},o.registerIncoming("key-down",null,(e=>o._handleKeyDown(e))),o.registerIncoming("key-up",null,(e=>o._handleKeyUp(e))),o.registerIncoming("blur",null,(()=>o._handleBlur())),o}t._inheritsLoose(o,e);var i=o.prototype;return i._handleKeyDown=function(e){if(e.data.native.ctrlKey||e.data.native.metaKey)return;const t=this.keyToNumber[e.data.key];null!=t&&(this.cameraControllerKeyboard&&this.cameraControllerKeyboard.active||(this.cameraControllerKeyboard=new a.GamepadKeyboardController({view:this.view,disableMovements:this.disableMovements}),this.view.state.switchCameraController(this.cameraControllerKeyboard)),this.cameraControllerKeyboard.active&&(this.cameraControllerKeyboard.activateDirection(t),e.stopPropagation()))},i._handleBlur=function(){this.cameraControllerKeyboard&&this.cameraControllerKeyboard.active&&(this.cameraControllerKeyboard.finishController(),this.cameraControllerKeyboard=null)},i._handleKeyUp=function(e){if(e.data.native.ctrlKey||e.data.native.metaKey)return;const t=this.keyToNumber[e.data.key];null!=t&&this.cameraControllerKeyboard&&this.cameraControllerKeyboard.active&&(this.cameraControllerKeyboard.deactivateDirection(t),e.stopPropagation())},o}(o.InputHandler);e.KeyboardNavigation=i,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
