// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:widgets/TimeSlider/setting/TimeConfig.html":'\x3cdiv class\x3d"time-config-container" data-dojo-attach-point\x3d"timeConfigContainer"\x3e\r\n  \x3cdiv class\x3d"title"\x3e${nls.timeSpan}\x3c/div\x3e\r\n\r\n  \x3cdiv class\x3d"error-info"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"errorIcon" class\x3d"error-icon"\x3e\x3c/div\x3e\r\n    \x3cdiv\x3e${nls.calenderError}\x3c/div\x3e\r\n  \x3c/div\x3e\r\n\r\n  \x3cdiv class\x3d"time-span"\x3e\r\n    \x3cdiv class\x3d"time-items items"\x3e\r\n      \x3cdiv class\x3d"time-tips"\x3e${nls.startTime}\x3c/div\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"startTimeCalendar"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv class\x3d"time-items items"\x3e\r\n      \x3cdiv class\x3d"time-tips"\x3e${nls.endTime}\x3c/div\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"endTimeCalendar"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n\r\n  \x3cdiv class\x3d"title"\x3e${nls.timeDisplay}\x3c/div\x3e\r\n  \x3cdiv class\x3d"time-display"\x3e\r\n    \x3cdiv class\x3d"time-tips"\x3e${nls.interval}\x3c/div\x3e\r\n    \x3cinput type\x3d"text" data-dojo-type\x3d"dijit/form/NumberSpinner" value\x3d"0"  required\x3d"true"\r\n      data-dojo-attach-point\x3d"intervalNumber" data-dojo-props\x3d"smallDelta:1,intermediateChanges:true,constraints: {min:0, places:0},trim:true"\r\n      class\x3d"time-selector calender-number calendar-inputs customdate "\x3e\r\n\r\n    \x3cdiv class\x3d"time-tips"\x3e${nls.unit}\x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"intervalUnits"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n\r\n  \x3cdiv class\x3d"clearFix items"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"displayAllTheData" class\x3d"display-all"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dojo/_base/lang dojo/_base/html jimu/BaseWidgetSetting dijit/_WidgetsInTemplateMixin dojo/on dojo/text!./TimeConfig.html ../utils ./TimeCalendar esri/TimeExtent jimu/dijit/CheckBox dijit/form/Select dijit/form/ValidationTextBox".split(" "),function(l,d,e,m,n,f,p,c,h,k,q,r){return l([m,n],{templateString:p,_KEEP_VALUE_FLAG:!1,postCreate:function(){this.startTimeCalendar=new h({mode:"min",nls:this.nls,map:this.map,config:this.config,parent:this},this.startTimeCalendar);this.endTimeCalendar=
new h({mode:"max",nls:this.nls,map:this.map,config:this.config,parent:this},this.endTimeCalendar);this.own(f(this.startTimeCalendar,"haveloaded,change",d.hitch(this,function(a){this._updateInterval(a.type)})));this.own(f(this.endTimeCalendar,"haveloaded,change",d.hitch(this,function(a){this._updateInterval(a.type)})));this.own(f(this.intervalNumber,"change",d.hitch(this,function(){this._setKeepValueFlag(!0)})));this.intervalUnits=new r({options:c.intervalUnitOptions,"class":"calendar-inputs"},this.intervalUnits);
this.own(f(this.intervalUnits,"change",d.hitch(this,function(){this._setKeepValueFlag(!0)})));this.displayAllTheData=new q({label:this.nls.displayAllData,checked:!1},this.displayAllTheData);this.displayAllTheData.startup();this.startTimeCalendar.startup();this.endTimeCalendar.startup();this.inherited(arguments)},setConfig:function(a){"undefined"!==typeof a.keepValueFlag&&this._setKeepValueFlag(a.keepValueFlag);"undefined"!==typeof a.startTime&&this.startTimeCalendar.setConfig(a.startTime.timeConfig);
"undefined"!==typeof a.endTime&&this.endTimeCalendar.setConfig(a.endTime.timeConfig);if("undefined"!==typeof a.interval)this.intervalNumber.set("value",a.interval.number,!1),this.intervalUnits.set("value",a.interval.units,!1);else{var b=new Date,g=c.getCalendarTime(this.startTimeCalendar.getConfig(),b);b=c.getCalendarTime(this.endTimeCalendar.getConfig(),b);this.findDefaultInterval(new k(g,b))}"undefined"!==typeof a.displayAllData?this.displayAllTheData.setValue(!!a.displayAllData,!1):this.displayAllTheData.setValue(!1,
!1)},updateConfigByLyaers:function(a){"undefined"!==typeof a.startTime&&this.startTimeCalendar.setConfig(a.startTime.timeConfig);"undefined"!==typeof a.endTime&&this.endTimeCalendar.setConfig(a.endTime.timeConfig);this._updateInterval()},_updateInterval:function(a){this._cleanErrorTips();"haveloaded"===a&&(this.intervalNumber.intermediateChanges=!1);if(!1!==this.isValid()&&!this._getKeepValueFlag()){var b=new Date;a=c.getCalendarTime(this.startTimeCalendar.getConfig(),b);b=c.getCalendarTime(this.endTimeCalendar.getConfig(),
b);a=this.findDefaultInterval(new k(new Date(a),new Date(b)));this.intervalNumber.set("value",a.interval,!1);this.intervalUnits.set("value",a.units,!1)}},isValid:function(){var a=new Date,b=c.getCalendarTime(this.startTimeCalendar.getConfig(),a);a=c.getCalendarTime(this.endTimeCalendar.getConfig(),a);if(!c.isValidDate(b))return this.startTimeCalendar.numberSpinner.set("state","Error"),!1;if(!c.isValidDate(a))return this.endTimeCalendar.numberSpinner.set("state","Error"),!1;if(!this.startTimeCalendar.isValid()||
!this.endTimeCalendar.isValid()||!this.intervalNumber.isValid())return!1;var g=e.hasClass(this.timeConfigContainer,"error");if(b.valueOf()>a.valueOf())return g||e.addClass(this.timeConfigContainer,"error"),!1;e.removeClass(this.timeConfigContainer,"error");return!0},_cleanErrorTips:function(){e.removeClass(this.timeConfigContainer,"error")},getConfig:function(){return{keepValueFlag:this._getKeepValueFlag(),startTime:{timeConfig:this.startTimeCalendar.getConfig()},endTime:{timeConfig:this.endTimeCalendar.getConfig()},
interval:{number:this.intervalNumber.getValue(),units:this.intervalUnits.getValue()},displayAllData:this.displayAllTheData.getValue()}},getLayersTimeExtent:function(){return this.parent.getLayersTimeExtent()},_setKeepValueFlag:function(a){this._KEEP_VALUE_FLAG=a},_getKeepValueFlag:function(){return!!this._KEEP_VALUE_FLAG},findDefaultInterval:function(a){a=(a.endTime.getTime()-a.startTime.getTime())/10;if(31104E6<a){a=Math.round(a/31104E6);var b="esriTimeUnitsYears"}else 2592E6<a?(a=Math.round(a/2592E6),
b="esriTimeUnitsMonths"):6048E5<a?(a=Math.round(a/6048E5),b="esriTimeUnitsWeeks"):864E5<a?(a=Math.round(a/864E5),b="esriTimeUnitsDays"):36E5<a?(a=Math.round(a/36E5),b="esriTimeUnitsHours"):6E4<a?(a=Math.round(a/6E4),b="esriTimeUnitsMinutes"):1E3<a?(a=Math.round(a/1E3),b="esriTimeUnitsSeconds"):(a=Math.round(a),b="esriTimeUnitsMilliseconds");return{interval:a,units:b}}})});