define(["./SwipeHandler","input/Keyboard","input/Mouse","input/TouchScreen","core/Mediator","page/PageEvent","animation/AnimationStateHandler"],function(e,n,t,i,a,o,g){"use strict";function r(r,c){function d(e){return function(){!l()||S.isSliding()||u||e()}}function l(){return r.getCurrentPage().anykeyIsAvailable()&&!f()}function f(){var e=r.stage.getDisableNextWhileAnimations(),n=r.getCurrentPage().getDisableNextWhileAnimations();return!(!e&&!n)&&g.isAnyAnimationPlaying()}function y(){return r.stage.navigation.previousPage(),!0}function b(){c.parameters.asBool("anykeySupport",!1)?r.stage.trigger.bindAnykey(s,d(r.stage.navigation.nextPage)):(r.stage.trigger.bindKey(s,n.Key.SPACE,d(r.stage.navigation.nextPage)),r.stage.trigger.bindKey(s,n.Key.RIGHT,d(r.stage.navigation.nextPage))),r.stage.trigger.bindKey(s,n.Key.LEFT,y),r.stage.trigger.bindKey(s,n.Key.HOME,r.stage.navigation.firstPage),r.stage.trigger.bindKey(s,n.Key.END,d(r.stage.navigation.lastPage))}function v(){r.stage.trigger.bindMouseButton(s,t.Button.LEFT,d(r.stage.navigation.nextPage))}function P(){r.stage.trigger.bindMouseButton(s,t.Button.RIGHT,function(){})}function T(){var e=0;r.stage.trigger.bindTouchGesture(s,i.Gesture.PAN_START,function(n){e=n.clientX,S.onSlideStart(n)}),r.stage.trigger.bindTouchGesture(s,i.Gesture.PAN_LEFT,function(n){(l()||n.clientX>e)&&S.onSlide(n)}),r.stage.trigger.bindTouchGesture(s,i.Gesture.PAN_RIGHT,function(n){n.clientX>e&&S.onSlide(n)}),r.stage.trigger.bindTouchGesture(s,i.Gesture.PAN_END,function(e){S.onSlideEnd(e)})}var S=new e(c.getId(),r,c);return function(){a.subscribe(o.ENTER,function(){u=!0,setTimeout(function(){u=!1},330)})}(),{onLoading:function(){s=this,P(),c.parameters.asBool("keyboardNavigation",!0)&&b(),c.parameters.asBool("nextOnMouseClick",!0)&&v(),c.parameters.asBool("swipeNavigation",!0)&&T()},onStageReady:S.onStageReady,onEnterPage:S.onEnterPage,onNavigationLocked:S.onNavigationLocked,onTransitionFinished:S.onTransitionFinished}}var s,u=!1;return r});