"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getTodayTime=getTodayTime,exports.getTitleString=getTitleString,exports.getTodayTimeStr=getTodayTimeStr,exports.getMonthName=getMonthName,exports.syncTime=syncTime,exports.getTimeConfig=getTimeConfig,exports.isTimeValidByConfig=isTimeValidByConfig,exports.isTimeValid=isTimeValid,exports.isAllowedDate=isAllowedDate;var _extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_moment=require("moment"),_moment2=_interopRequireDefault(_moment);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var defaultDisabledTime={disabledHours:function(){return[]},disabledMinutes:function(){return[]},disabledSeconds:function(){return[]}};function getTodayTime(e){var t=(0,_moment2.default)();return t.locale(e.locale()).utcOffset(e.utcOffset()),t}function getTitleString(e){return e.format("LL")}function getTodayTimeStr(e){return getTitleString(getTodayTime(e))}function getMonthName(e){var t=e.locale();return e.localeData()["zh-cn"===t?"months":"monthsShort"](e)}function syncTime(e,t){_moment2.default.isMoment(e)&&_moment2.default.isMoment(t)&&(t.hour(e.hour()),t.minute(e.minute()),t.second(e.second()))}function getTimeConfig(e,t){var i=t?t(e):{};return i=(0,_extends3.default)({},defaultDisabledTime,i)}function isTimeValidByConfig(e,t){var i=!1;if(e){var n=e.hour(),o=e.minute(),r=e.second();if(-1===t.disabledHours().indexOf(n))if(-1===t.disabledMinutes(n).indexOf(o))i=-1!==t.disabledSeconds(n,o).indexOf(r);else i=!0;else i=!0}return!i}function isTimeValid(e,t){return isTimeValidByConfig(e,getTimeConfig(e,t))}function isAllowedDate(e,t,i){return(!t||!t(e))&&!(i&&!isTimeValid(e,i))}