var DvtTimeSelector=function(a,b,c,d,e,f){this.Init(a,b,c,d,e,f)};DvtObj.createSubclass(DvtTimeSelector,DvtContainer,"DvtTimeSelector");DvtTimeSelector.TOK_X="__X__";DvtTimeSelector.TOK_Y="__Y__";DvtTimeSelector.TOK_STARTDATE="__START_DATE__";DvtTimeSelector.TOK_ENDDATE="__END_DATE__";
DvtTimeSelector.prototype.init=function(){this._pxRatio=(this._timeAxisEndDate-this._timeAxisStartDate)/(this._timeAxisEndPixel-this._timeAxisStartPixel);var a=this.getLPos(),b=this.getRPos();a<this._timeAxisStartPixel&&this._container.setX(this._timeAxisStartPixel);b>this._timeAxisEndPixel&&this._container.setWidth(this._timeAxisEndPixel-this.getX());0>=this.getWidth()&&this._container.setWidth(1);this._timeAxis=new DvtTimeAxis(this._timeAxisStartDate,this._timeAxisEndDate,this._timeAxisStartPixel,
this._timeAxisEndPixel,300,10,this._aTimeAxisMonths,this._timeZoneOffset,!0);DvtAgent.isTouchDevice()?(this._Dlo._Chart.addEvtListener(DvtTouchEvent.TOUCHSTART,this._touchHandler,!1,this),this._Dlo._Chart.addEvtListener(DvtTouchEvent.TOUCHMOVE,this._touchHandler,!1,this),this._Dlo._Chart.addEvtListener(DvtTouchEvent.TOUCHEND,this._touchHandler,!1,this)):(this.addEvtListener(DvtMouseEvent.MOUSEOVER,this.mouseOverHandler,!1,this),this.addEvtListener(DvtMouseEvent.MOUSEOUT,this.mouseOutHandler,!1,this),
this.addEvtListener(DvtMouseEvent.MOUSEDOWN,this.mouseDownHandler,!1,this));this._grabberLeft=this.createGrabber(DvtTSGrabber.LEFT);this._grabberRight=this.createGrabber(DvtTSGrabber.RIGHT);this._grabberLeft.setStroke(this.getStroke());this._grabberRight.setStroke(this.getStroke());this._grabberLeft.setVisible(!1);this._grabberRight.setVisible(!1);this._grabberLeft.init();this._grabberRight.init();this._container.addChild(this._grabberLeft);this._container.addChild(this._grabberRight);this.addChild(this._container);
DvtAgent.isTouchDevice()&&this._showSelection();this._container.setPixelHinting(!0);DvtGraphSysUtils.makeDetObject(this._container);this._container._Dlo.setTooltip(this.makeTooltipText());this._standardStroke=this.getStroke();this._selectStroke=this._standardStroke.clone();this._selectStroke.setWidth(2)};DvtTimeSelector.prototype.createGrabber=function(a){var b=null,b=DvtAgent.isTouchDevice()?new DvtMobileTSGrabber(this,a):new DvtTSGrabber(this,a);DvtGraphSysUtils.makeDetObject(b);return b};
DvtTimeSelector.prototype.Init=function(a,b,c,d,e,f){DvtTimeSelector.superclass.Init.call(this,a,"timeselector");this._container=new DvtRect(a,b,c,d,e,f);this._timeAxisEndPixel=this._timeAxisStartPixel=this._timeAxisEndDate=this._timeAxisStartDate=0;this._aTimeAxisMonths=null;this._timeZoneOffset=0;this._timeAxis=this._translatedEnd=this._translatedStart=this._timeSelectorEventJs=this._timeAxisEventJs=null;this._pxRatio=0;this._grabberRight=this._grabberLeft=null;this._isDragging=this._isMouseOver=
!1;this._origRPos=this._origLPos=this._dragY=this._dragX=-1;this._overTarget=this._dragTarget=0;this._selectStroke=this._standardStroke=null;this._targets={};this._dragXMap={};this._dragItems=[]};DvtTimeSelector.prototype.getTimeAxisStartDate=function(){return this._timeAxisStartDate};DvtTimeSelector.prototype.setTimeAxisStartDate=function(a){this._timeAxisStartDate=a};DvtTimeSelector.prototype.getTimeAxisEndDate=function(){return this._timeAxisEndDate};
DvtTimeSelector.prototype.setTimeAxisEndDate=function(a){this._timeAxisEndDate=a};DvtTimeSelector.prototype.getTimeAxisStartPixel=function(){return this._timeAxisStartPixel};DvtTimeSelector.prototype.setTimeAxisStartPixel=function(a){this._timeAxisStartPixel=a};DvtTimeSelector.prototype.getTimeAxisEndPixel=function(){return this._timeAxisEndPixel};DvtTimeSelector.prototype.setTimeAxisEndPixel=function(a){this._timeAxisEndPixel=a};DvtTimeSelector.prototype.getTimeAxisMonths=function(){return this._aTimeAxisMonths};
DvtTimeSelector.prototype.setTimeAxisMonths=function(a){this._aTimeAxisMonths=a};DvtTimeSelector.prototype.getTimeZoneOffset=function(){return this._timeZoneOffset};DvtTimeSelector.prototype.setTimeZoneOffset=function(a){this._timeZoneOffset=a};DvtTimeSelector.prototype.getTimeAxisEventJs=function(){return this._timeAxisEventJs};DvtTimeSelector.prototype.setTimeAxisEventJs=function(a){this._timeAxisEventJs=a};DvtTimeSelector.prototype.getTimeSelectorEventJs=function(){return this._timeSelectorEventJs};
DvtTimeSelector.prototype.setTimeSelectorEventJs=function(a){this._timeSelectorEventJs=a};DvtTimeSelector.prototype.getTranslatedStart=function(){return this._translatedStart};DvtTimeSelector.prototype.setTranslatedStart=function(a){this._translatedStart=a};DvtTimeSelector.prototype.getTranslatedEnd=function(){return this._translatedEnd};DvtTimeSelector.prototype.setTranslatedEnd=function(a){this._translatedEnd=a};
DvtTimeSelector.prototype.isPointInside=function(a,b){return a>=this.getX()&&a<=this.getX()+this.getWidth()&&b>=this.getY()&&b<=this.getY()+this.getHeight()};DvtTimeSelector.prototype._getMouseTarget=function(a,b){var c=0;if(this._isMouseOver||this._isDragging)this._grabberLeft.isPointInside(a,b)?c=2:this._grabberRight.isPointInside(a,b)&&(c=3);0==c&&this.isPointInside(a,b)&&(c=1);return c};
DvtTimeSelector.prototype.mouseOverHandler=function(a){a=this.getCtx().getRelativePosition(a.pageX,a.pageY);a=this._getMouseTarget(a.x,a.y);this._isDragging?0<a&&(this._isMouseOver=!0):0==a||this._isMouseOver&&this._overTarget==a||(this._isMouseOver=!0,this._overTarget=a,1==a&&this._container.setCursor("move"),this._showSelection(a))};
DvtTimeSelector.prototype.mouseOutHandler=function(a){a=this.getCtx().getRelativePosition(a.pageX,a.pageY);a=this._getMouseTarget(a.x,a.y);this._isDragging?(0==a&&(this._isMouseOver=!1),this._overTarget=0):0==a&&0!=this._isMouseOver&&(this._isMouseOver=!1,this._container.setCursor("default"),this._hideSelection())};DvtTimeSelector.prototype._touchHandler=function(a){this._isMouseOver=!0;this.getTouchManager().processAssociatedTouchDefault(a,this)};
DvtTimeSelector.prototype.immediateTouchAttempted=function(a,b){var c=this.getCtx().getRelativePosition(b.pageX,b.pageY),d=c.x,c=c.y,e=this._getMouseTarget(d,c),f=!0;if(0!=e){for(var g=0;g<this._dragItems.length;g++){var h=this._targets[this._dragItems[g]];1==h?f=!1:1<h&&1==e&&(f=!1);h==e&&(f=!1)}f&&(this._dragItems.push(b.identifier),this._targets[b.identifier]=e,this._dragXMap[b.identifier]=d,this._dragStart(e,d,c),this.getTouchManager().saveProcessedTouchDefault(b.identifier,this,this._container,
"timeselector","timeselector"+e,this),a.blockTouchHold())}};DvtTimeSelector.prototype.immediateTouchMoved=function(a,b){var c=this.getCtx().getRelativePosition(b.pageX,b.pageY),d=c.x,c=c.y,e=this._getMouseTarget(d,c);a.preventDefault();if(0!=this._isDragging&&(e=this._targets[b.identifier],null!=e&&0<e)){for(var f=a.touches,g=0;g<this._dragItems.length;g++)for(var h=0;h<f.length;h++);f=this._dragXMap[b.identifier];this._dragTarget=e;this._dragX=f;this._dragMove(d,c)}};
DvtTimeSelector.prototype.immediateTouchEnded=function(a,b){var c=this.getCtx().getRelativePosition(b.pageX,b.pageY),d=c.x,c=c.y;this._getMouseTarget(d,c);if(0!=this._isDragging){var e=DvtArrayUtils.getIndex(this._dragItems,b.identifier);-1!=e&&(this._dragItems.splice(e,1),this._targets[b.identifier]=null,this._dragXMap[b.identifier]=null,this.getTouchManager().removeTooltipInfo(b.identifier));0==this._dragItems.length&&(this._dragItems=[],this._dragEnd(d,c),this._targets={},this._dragXMap={})}};
DvtTimeSelector.prototype.mouseDownHandler=function(a){var b=this.getCtx().getRelativePosition(a.pageX,a.pageY),c=b.x,b=b.y,d=this._getMouseTarget(c,b);this._dragStart(d,c,b);a&&a.preventDefault();this._Dlo._Chart.addEvtListener(DvtMouseEvent.MOUSEMOVE,this.mouseMoveHandler,!1,this);this._Dlo._Chart.addEvtListener(DvtMouseEvent.MOUSEUP,this.mouseUpHandler,!1,this)};
DvtTimeSelector.prototype.mouseUpHandler=function(a){this._Dlo._Chart.removeEvtListener(DvtMouseEvent.MOUSEMOVE,this.mouseMoveHandler,!1,this);this._Dlo._Chart.removeEvtListener(DvtMouseEvent.MOUSEUP,this.mouseUpHandler,!1,this);var b=this.getCtx().getRelativePosition(a.pageX,a.pageY);this._dragEnd(b.x,b.y);0==this._isMouseOver&&this._hideSelection();a&&a.preventDefault()};
DvtTimeSelector.prototype.mouseMoveHandler=function(a){if(0!=this._isDragging){var b=this.getCtx().getRelativePosition(a.pageX,a.pageY);this._dragMove(b.x,b.y);a&&a.preventDefault()}};
DvtTimeSelector.prototype._showSelection=function(a){1==a?(this.setStroke(this._selectStroke),this._grabberLeft.setStroke(this._standardStroke),this._grabberRight.setStroke(this._standardStroke)):2==a?(this.setStroke(this._standardStroke),this._grabberLeft.setStroke(this._selectStroke),this._grabberRight.setStroke(this._standardStroke)):3==a&&(this.setStroke(this._standardStroke),this._grabberLeft.setStroke(this._standardStroke),this._grabberRight.setStroke(this._selectStroke));this._grabberLeft.setVisible(!0);
this._grabberRight.setVisible(!0)};DvtTimeSelector.prototype._hideSelection=function(){this.setStroke(this._standardStroke);this._grabberLeft.setStroke(this._standardStroke);this._grabberRight.setStroke(this._standardStroke);this._grabberLeft.setVisible(!1);this._grabberRight.setVisible(!1)};DvtTimeSelector.prototype._dragStart=function(a,b,c){this._isDragging||(this._isDragging=!0,this._dragX=b,this._origLPos=this.getLPos(),this._origRPos=this.getRPos(),this._dragTarget=a)};
DvtTimeSelector.prototype._dragEnd=function(a,b){if(0!=this._isDragging&&(this._isDragging=!1,this._dragX=-1,this._dragTarget=0,(this._origLPos!=this.getLPos()||this._origRPos!=this.getRPos())&&this._timeSelectorEventJs&&0<this._timeSelectorEventJs.length)){var c=this._timeAxisStartDate+(this.getLPos()-this._timeAxisStartPixel)*this._pxRatio,d=this._timeAxisEndDate-(this._timeAxisEndPixel-this.getRPos())*this._pxRatio,e=new Date,f=new Date;e.setTime(c);f.setTime(d);c=this._timeSelectorEventJs.replace(DvtTimeSelector.TOK_X,
a).replace(DvtTimeSelector.TOK_Y,b).replace(DvtTimeSelector.TOK_STARTDATE,e.getTime()).replace(DvtTimeSelector.TOK_ENDDATE,f.getTime()).match(/'(.*?)'/g)[0].replace(/\'/g,"");AdfPage.PAGE.findComponent(c).getPeer().sendToServerPPR3({source:c,event:"bi_gtse",bi_gtsS:e.getTime(),bi_gtsE:f.getTime()})}};
DvtTimeSelector.prototype._dragMove=function(a,b){if(0!=this._isDragging){var c=a-this._dragX,d=this.getLPos(),e=Math.floor(this.getWidth()),f=this._grabberLeft.getGrabberWidth();1==this._dragTarget?(d=this._origLPos+c,d<this._timeAxisStartPixel&&(d=this._timeAxisStartPixel),d+Math.floor(this.getWidth())>this._timeAxisEndPixel&&(d=this._timeAxisEndPixel-Math.floor(this.getWidth()))):2==this._dragTarget?(d=this._origLPos+c,d<this._timeAxisStartPixel&&(d=this._timeAxisStartPixel),d>this.getRPos()-0&&
(d=this.getRPos()-0),e=this.getRPos()-d):3==this._dragTarget&&(c=this._origRPos+c,c<this.getLPos()+0&&(c=this.getLPos()+0),c>this._timeAxisEndPixel&&(c=this._timeAxisEndPixel),e=c-this.getLPos());0==e&&(e=1);this._container.setX(d);this._container.setWidth(e);c=d-f/2;d=d+Math.floor(this.getWidth())-f/2;this._grabberLeft.setX(c);this._grabberRight.setX(d);d=this.makeTooltipText();this._container._Dlo.setTooltip(d);this._grabberLeft.getContainer()._Dlo.setTooltip(d);this._grabberRight.getContainer()._Dlo.setTooltip(d)}};
DvtTimeSelector.prototype.getLPos=function(){return this.getX()};DvtTimeSelector.prototype.getRPos=function(){return this.getX()+Math.floor(this.getWidth())};DvtTimeSelector.prototype.makeTooltipText=function(){var a=this.getRPos()-this.getLPos();DvtAgent.isRightToLeft()&&(a=this.getLPos()-this.getRPos());var b=this._timeAxis.getLabelAt(this.getLPos(),a),a=this._timeAxis.getLabelAt(this.getRPos(),-a);return DvtAgent.isRightToLeft()?a+" - "+b:b+" - "+a};DvtTimeSelector.prototype.getStroke=function(){return this._container.getStroke()};
DvtTimeSelector.prototype.setStroke=function(a){this._container.setStroke(a)};DvtTimeSelector.prototype.setSolidStroke=function(a,b,c){this._container.setSolidStroke(a,b,c)};DvtTimeSelector.prototype.setFill=function(a){this._container.setFill(a)};DvtTimeSelector.prototype.setSolidFill=function(a,b){this._container.setSolidFill(a,b)};DvtTimeSelector.prototype.getX=function(){return this._container.getX()};DvtTimeSelector.prototype.getY=function(){return this._container.getY()};
DvtTimeSelector.prototype.getWidth=function(){return this._container.getWidth()};DvtTimeSelector.prototype.getHeight=function(){return this._container.getHeight()};DvtTimeSelector.prototype.getTouchManager=function(){return this._touchManager};DvtTimeSelector.prototype.setTouchManager=function(a){this._touchManager=a};