/*!
* UI development toolkit for HTML5 (OpenUI5)
* (c) Copyright 2009-2018 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./Slider','./library',"./RangeSliderRenderer"],function(q,S,l,R){"use strict";var a=S.extend("sap.ui.commons.RangeSlider",{metadata:{library:"sap.ui.commons",properties:{value2:{type:"float",group:"Appearance",defaultValue:80}}}});a.prototype.onAfterRendering=function(){this.oGrip2=this.getDomRef("grip2");S.prototype.onAfterRendering.apply(this);var v=this.getValue();var V=this.getValue2();if(V>=this.getMax()){V=this.getMax();}else if(V=this.getValue2()){n=this.getValue2();N=this.getOffsetLeft(this.oGrip2)+this.iShiftGrip;if(this.bRtl&&!this.getVertical()){N=this.getBarWidth()-N;}}else if(n<=this.getMin()){n=this.getMin();if(this.getVertical()){N=this.getBarWidth();}else{N=0;}}else{N=(n-this.getMin())/(this.getMax()-this.getMin())*this.getBarWidth();}if(this.bRtl&&!this.getVertical()){N=this.getBarWidth()-N;}this.changeGrip(n,N,this.oGrip);this._oldValue1=n;return this;};a.prototype.setValue2=function(v){this.setProperty('value2',v,true);this._oldValue2=v;if(isNaN(v)){return this;}if(!this.oBar){return this;}var n=parseFloat(v);var N;if(n>=this.getMax()){n=this.getMax();if(this.getVertical()){N=0;}else{N=this.getBarWidth();}}else if(n<=this.getValue()){n=this.getValue();N=this.getOffsetLeft(this.oGrip)+this.iShiftGrip;if(this.bRtl&&!this.getVertical()){N=this.getBarWidth()-N;}}else{N=(n-this.getMin())/(this.getMax()-this.getMin())*this.getBarWidth();}if(this.bRtl&&!this.getVertical()){N=this.getBarWidth()-N;}this.changeGrip(n,N,this.oGrip2);this._oldValue2=n;return this;};a.prototype.getLeftGrip=function(){return this.oGrip;};a.prototype.getRightGrip=function(){return this.oGrip2;};a.prototype.getValueForGrip=function(g){if(g==this.oGrip){return this.getValue();}else{return this.getValue2();}};a.prototype.validateNewPosition=function(n,N,g,m){if(!this.bRtl&&!this.getVertical()){if(g==this.oGrip){if(m){if(n<=this.getMin()||N<=0){n=this.getMin();N=0;}}else{if(n>=this.getValue2()){n=this.getValue2();N=this.getOffsetLeft(this.oGrip2)+this.iShiftGrip;}}}else{if(m){if(n<=this.getValue()){n=this.getValue();N=this.getOffsetLeft(this.oGrip)+this.iShiftGrip;}}else{if(n>=this.getMax()||N>=this.getBarWidth()){n=this.getMax();N=this.getBarWidth();}}}}else{if(g==this.oGrip){if(m){if(n<=this.getMin()||N>=this.getBarWidth()){n=this.getMin();N=this.getBarWidth();}}else{if(n>=this.getValue2()){n=this.getValue2();N=this.getOffsetLeft(this.oGrip2)+this.iShiftGrip;}}}else{if(m){if(n<=this.getValue()){n=this.getValue();N=this.getOffsetLeft(this.oGrip)+this.iShiftGrip;}}else{if(n>=this.getMax()||N<=0){n=this.getMax();N=0;}}}}this.oGrip.setAttribute('aria-valuemax',this.getValue2());this.oGrip2.setAttribute('aria-valuemin',this.getValue());return{fNewValue:n,iNewPos:N};};a.prototype.handleMove=function(e){var d=Math.abs(this.getOffsetLeft(this.oGrip2)-this.getOffsetLeft(this.oGrip));if(!this.bRtl){if(this.oMovingGrip==this.oGrip2&&this.getValue2()==this.getMax()&&(d<2)){this.oMovingGrip=this.oGrip;this.oGrip.focus();}else if(this.oMovingGrip==this.oGrip&&this.getValue()==this.getMin()&&(d<2)){this.oMovingGrip=this.oGrip2;this.oGrip2.focus();}}else{if(this.oMovingGrip==this.oGrip&&this.getValue2()==this.getMin()&&(d<2)){this.oMovingGrip=this.oGrip2;this.oGrip2.focus();}else if(this.oMovingGrip==this.oGrip2&&this.getValue()==this.getMax()&&(d<2)){this.oMovingGrip=this.oGrip;this.oGrip.focus();}}S.prototype.handleMove.apply(this,[e]);};a.prototype.handleFireChange=function(n){var v=this.getValue();var V=this.getValue2();if(v!==this._oldValue1||V!==this._oldValue2){this._oldValue1=v;this._oldValue2=V;this.fireChange({value2:V,value:v});if(!n){this.fireLiveChange({value:v,value2:V});}}};a.prototype.getNearestGrip=function(o){var m;var d=0;var D=0;if(this.getVertical()){d=Math.abs(o-this.getOffsetLeft(this.oGrip2));D=Math.abs(this.getOffsetLeft(this.oGrip)-o);if(d==D){if(o>D){m=this.oGrip;}else{m=this.oGrip2;}}else if(d>=D){m=this.oGrip;}else{m=this.oGrip2;}}else{d=Math.abs(o-this.getOffsetLeft(this.oGrip));D=Math.abs(this.getOffsetLeft(this.oGrip2)-o);if(d==D){if((o>D&&!this.bRtl)||(o