UNPKG

react-pure-datepicker

Version:
898 lines (724 loc) 886 kB
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = __webpack_require__(4); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(27); var _reactPureDatepickerMin = __webpack_require__(16); var _reactPureDatepickerMin2 = _interopRequireDefault(_reactPureDatepickerMin); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DatepickerContainer = function (_Component) { _inherits(DatepickerContainer, _Component); function DatepickerContainer(props) { _classCallCheck(this, DatepickerContainer); var _this = _possibleConstructorReturn(this, (DatepickerContainer.__proto__ || Object.getPrototypeOf(DatepickerContainer)).call(this, props)); _this.state = { value: '' }; return _this; } _createClass(DatepickerContainer, [{ key: 'render', value: function render() { var _this2 = this; return _react2.default.createElement( 'div', null, _react2.default.createElement(_reactPureDatepickerMin2.default, { value: this.state.value, onChange: function onChange(value) { console.log('value =>', value); _this2.setState({ value: value }); }, applyBtn: true, clearBtn: false, format: 'Y-m-d', returnFormat: 'Y-m-d', weekDaysNamesShort: ['Нд', 'Пн', 'Вт', 'Wed', 'Thu', 'Fri', 'Sat'], beginFromDay: 1, min: new Date('Fri Oct 28 2012 13:08:52 GMT+0300 (EEST)'), max: new Date('Fri Oct 30 2012 13:08:52 GMT+0300 (EEST)') }) ); } }]); return DatepickerContainer; }(_react.Component); var element = document.getElementById('js--datepicker'); if (element instanceof HTMLElement) { (0, _reactDom.render)(_react2.default.createElement(DatepickerContainer, null), element); } /***/ }, /* 1 */ /***/ function(module, exports) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ function makeEmptyFunction(arg) { return function () { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ var emptyFunction = function emptyFunction() {}; emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); emptyFunction.thatReturnsNull = makeEmptyFunction(null); emptyFunction.thatReturnsThis = function () { return this; }; emptyFunction.thatReturnsArgument = function (arg) { return arg; }; module.exports = emptyFunction; /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ 'use strict'; /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var validateFormat = function validateFormat(format) {}; if ((undefined) !== 'production') { validateFormat = function validateFormat(format) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } }; } function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } module.exports = invariant; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ 'use strict'; var emptyFunction = __webpack_require__(1); /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warning = emptyFunction; if ((undefined) !== 'production') { var printWarning = function printWarning(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; warning = function warning(condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } if (format.indexOf('Failed Composite propType: ') === 0) { return; // Ignore CompositeComponent proptype check. } if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } printWarning.apply(undefined, [format].concat(args)); } }; } module.exports = warning; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; if ((undefined) === 'production') { module.exports = __webpack_require__(33); } else { module.exports = __webpack_require__(32); } /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ 'use strict'; var emptyObject = {}; if ((undefined) !== 'production') { Object.freeze(emptyObject); } module.exports = emptyObject; /***/ }, /* 6 */ /***/ function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ 'use strict'; var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about * whether or not they are in a Worker, even if they never include the main * `ReactWorker` dependency. */ var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), canUseViewport: canUseDOM && !!window.screen, isInWorker: !canUseDOM // For now, this is true - might change in the future. }; module.exports = ExecutionEnvironment; /***/ }, /* 7 */ /***/ function(module, exports) { /* object-assign (c) Sindre Sorhus @license MIT */ 'use strict'; /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; /***/ }, /* 8 */ /***/ function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @typechecks */ var emptyFunction = __webpack_require__(1); /** * Upstream version of event listener. Does not take into account specific * nature of platform. */ var EventListener = { /** * Listen to DOM events during the bubble phase. * * @param {DOMEventTarget} target DOM element to register listener on. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ listen: function listen(target, eventType, callback) { if (target.addEventListener) { target.addEventListener(eventType, callback, false); return { remove: function remove() { target.removeEventListener(eventType, callback, false); } }; } else if (target.attachEvent) { target.attachEvent('on' + eventType, callback); return { remove: function remove() { target.detachEvent('on' + eventType, callback); } }; } }, /** * Listen to DOM events during the capture phase. * * @param {DOMEventTarget} target DOM element to register listener on. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. * @param {function} callback Callback function. * @return {object} Object with a `remove` method. */ capture: function capture(target, eventType, callback) { if (target.addEventListener) { target.addEventListener(eventType, callback, true); return { remove: function remove() { target.removeEventListener(eventType, callback, true); } }; } else { if ((undefined) !== 'production') { console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); } return { remove: emptyFunction }; } }, registerDefault: function registerDefault() {} }; module.exports = EventListener; /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ var isTextNode = __webpack_require__(22); /*eslint-disable no-bitwise */ /** * Checks if a given DOM node contains or is another DOM node. */ function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); } else if ('contains' in outerNode) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); } else { return false; } } module.exports = containsNode; /***/ }, /* 11 */ /***/ function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ 'use strict'; /** * @param {DOMElement} node input/textarea to focus */ function focusNode(node) { // IE8 can throw "Can't move focus to the control because it is invisible, // not enabled, or of a type that does not accept the focus." for all kinds of // reasons that are too expensive and fragile to test. try { node.focus(); } catch (e) {} } module.exports = focusNode; /***/ }, /* 12 */ /***/ function(module, exports) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @typechecks */ /* eslint-disable fb-www/typeof-undefined */ /** * Same as document.activeElement but wraps in a try-catch block. In IE it is * not safe to call document.activeElement if there is nothing focused. * * The activeElement will be null only if the document or document body is not * yet defined. * * @param {?DOMDocument} doc Defaults to current document. * @return {?DOMElement} */ function getActiveElement(doc) /*?DOMElement*/{ doc = doc || (typeof document !== 'undefined' ? document : undefined); if (typeof doc === 'undefined') { return null; } try { return doc.activeElement || doc.body; } catch (e) { return doc.body; } } module.exports = getActiveElement; /***/ }, /* 13 */ /***/ function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @typechecks * */ /*eslint-disable no-self-compare */ 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty; /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 // Added the nonzero y check to make Flow happy, but it is redundant return x !== 0 || y !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } } /** * Performs equality by iterating through keys on an object and returning false * when any key has values which are not strictly equal between the arguments. * Returns true when the values of all keys are strictly equal. */ function shallowEqual(objA, objB) { if (is(objA, objB)) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } // Test for A's keys different from B. for (var i = 0; i < keysA.length; i++) { if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { return false; } } return true; } module.exports = shallowEqual; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; if ((undefined) !== 'production') { var invariant = __webpack_require__(2); var warning = __webpack_require__(3); var ReactPropTypesSecret = __webpack_require__(8); var loggedTypeFailures = {}; } /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param {object} typeSpecs Map of name to a ReactPropType * @param {object} values Runtime values that need to be type-checked * @param {string} location e.g. "prop", "context", "child context" * @param {string} componentName Name of the component for error messages. * @param {?Function} getStack Returns the component stack. * @private */ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { if ((undefined) !== 'production') { for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); } catch (ex) { error = ex; } warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error.message] = true; var stack = getStack ? getStack() : ''; warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); } } } } } module.exports = checkPropTypes; /***/ }, /* 15 */ /***/ function(module, exports) { /* object-assign (c) Sindre Sorhus @license MIT */ 'use strict'; /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { !function(e,t){if(true)module.exports=t(__webpack_require__(4),__webpack_require__(31));else if("function"==typeof define&&define.amd)define(["react","react-pure-modal"],t);else{var n="object"==typeof exports?t(require("react"),require("react-pure-modal")):t(e.React,e["react-pure-modal"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(1),f=r(c),d=n(6),h=r(d),p=n(2),y=r(p),m=n(5),v=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getDateClasses=n.getDateClasses.bind(n),n.getMonthClasses=n.getMonthClasses.bind(n),n.getYearClasses=n.getYearClasses.bind(n),n.handleClick=n.handleClick.bind(n),n.hanleApplyBtnClick=n.hanleApplyBtnClick.bind(n),n.openDatepickerModal=n.openDatepickerModal.bind(n),n.handleCloseDatepickerModal=n.handleCloseDatepickerModal.bind(n),n.isInRange=n.isInRange.bind(n),n.clear=n.clear.bind(n),n.getDaysNames=n.getDaysNames.bind(n),n.getComponentState=n.getComponentState.bind(n),n.state=n.getComponentState({},n.props),n}return u(t,e),l(t,null,[{key:"isDateValid",value:function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())}},{key:"getYearsPeriod",value:function(e,t){for(var n=[],r=e+t[0],a=e+t[1];a>=r;)n.push(r),r+=1;return n}},{key:"normalizeDate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";switch(t+"-"+n){case"month-up":return y.default.lastDateInMonth(e);case"month-down":return y.default.firstDateInMonth(e);case"year-up":return new Date(e.getFullYear(),11,31,0,0,0,0);case"year-down":return new Date(e.getFullYear(),0,1,0,0,0,0);default:return new Date(e)}}},{key:"toDate",value:function(e){var t=y.default.parseISOString(e);if(this.isDateValid(t))return y.default.noon(t)}}]),l(t,[{key:"componentWillReceiveProps",value:function(e){this.setState(this.getComponentState(this.props,e))}},{key:"getComponentState",value:function(e,t){var n={},r=t.min,a=t.max,o=t.value,i=t.today,u=t.calendarValue;if(e.value!==o&&(n.value=this.constructor.toDate(o)),e.calendarValue!==u&&(n.calendarValue=this.constructor.toDate(u)),e.today!==i&&(n.today=this.constructor.toDate(i)),e.min!==r&&(n.min=this.constructor.toDate(r)),e.max!==a&&(n.max=this.constructor.toDate(a)),n.calendarValue=t.applyBtn?n.calendarValue||n.value:n.value,Object.keys(n).length>0&&(n.min||n.max)){var s=n.calendarValue||e.calendarValue||n.today||e.today;this.isInRange(s,"date",n.min||!1,n.max||!1)||(n.min&&!n.max?n.calendarValue=n.min:n.max&&!n.min?n.calendarValue=n.max:n.min&&n.max&&(y.default.isSameDay(n.min,n.max)?console.warn("Incorrect min and max. There no dates to choose!"):n.calendarValue=n.min))}return n}},{key:"getDaysNames",value:function(){if(7>this.props.beginFromDay&&this.props.beginFromDay>-1){var e=this.props.weekDaysNamesShort.slice(0,this.props.beginFromDay);return this.props.weekDaysNamesShort.slice(this.props.beginFromDay).concat(e)}return this.props.weekDaysNamesShort}},{key:"getDateClasses",value:function(e,t,n){var r=["date-cell"];return y.default.isWeekendDate(e)&&r.push("weekend"),y.default.isSameMonth(e,n)||r.push("out-month"),t?y.default.isSameDay(e,t)&&r.push("selected"):y.default.isSameDay(e,n)&&r.push("pre-selected"),this.isInRange(e)||r.push("out-min-max"),r.join(" ")}},{key:"getMonthClasses",value:function(e,t,n){var r=["monthName"],a=t?"selected":"pre-selected",o=t||n,i=new Date(o.getFullYear(),this.props.monthsNames.indexOf(e),1,0,0,0,0);return y.default.isSameMonth(i,o)&&r.push(a),this.isInRange(i,"month")||r.push("out-min-max"),r.join(" ")}},{key:"getYearClasses",value:function(e,t,n){var r=["yearName"],a=t?"selected":"pre-selected",o=t||n,i=new Date(e,0,1,0,0,0,0);return y.default.isSameYear(i,o)&&r.push(a),this.isInRange(i,"year")||r.push("out-min-max"),r.join(" ")}},{key:"isInRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.state.min,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.state.max,a=this.constructor.normalizeDate(e,t,"up"),o=this.constructor.normalizeDate(e,t,"down"),i=!n||y.default.isAfter(a,y.default.addDays(n,-1)),u=!r||y.default.isBefore(o,y.default.addDays(r,1));return i&&u}},{key:"hanleApplyBtnClick",value:function(){if(this.props.onChange)return this.props.onChange((0,m.format)(this.state.calendarValue,this.props.returnFormat),this.props.name),this.closeDatepickerModal()}},{key:"handleClick",value:function(e){var t=e.currentTarget.dataset,n=t.year,r=t.month,a=t.day,o=void 0,i=void 0;if(this.state.calendarValue)i=new Date(this.state.calendarValue);else{if(!this.state.today)return void console.warn("Invalid Date value is choosen!");i=new Date(this.state.today)}i=y.default.noon(y.default.resetTimezoneOffset(i)),n&&(o="year",i.setFullYear(n)),r&&(i.setMonth(r),o="month"),a&&(o="date",i.setDate(a));var u=this.isInRange(i),l=this.isInRange(i,o);if((u||l)&&(l&&(this.state.min&&y.default.isBefore(i,this.state.min)&&(i=this.state.min),this.state.max&&y.default.isAfter(i,this.state.max)&&(i=this.state.max)),this.setState(this.getComponentState(this.props,s({},this.props,{calendarValue:i}))),this.props.onChange&&!this.props.applyBtn&&(this.props.onChange((0,m.format)(i,this.props.returnFormat),this.props.name),"date"===o)))return this.closeDatepickerModal()}},{key:"clear",value:function(){this.props.onChange("",this.props.name)}},{key:"handleInput",value:function(){}},{key:"openDatepickerModal",value:function(e){e.currentTarget.blur(),this.props.onFocus&&this.props.onFocus(e),this.refs.datepicker.open()}},{key:"closeDatepickerModal",value:function(){this.refs.datepicker.close()}},{key:"handleCloseDatepickerModal",value:function(){return this.setState({calendarValue:this.state.value}),!0}},{key:"render",value:function(){var e=this,t=this.props,n=t.format,r=t.weekDaysNamesShort,o=t.monthsNames,i=t.years,u=t.className,l=t.placeholder,c=t.inputClassName,d=t.required,p=t.disabled,v=t.beginFromDay,g=a(t,["format","weekDaysNamesShort","monthsNames","years","className","placeholder","inputClassName","required","onFocus","disabled","applyBtn","beginFromDay"]),D=this.state,b=D.value,_=D.calendarValue,k=D.today,M=_||k;if(!M)return console.warn("Invalid Date value is choosen!"),null;var w=this.getDaysNames(),S=r.reduce(function(e,t,n){return e[t]=0===n||6===n,e},{}),C=y.default.firstDateInMonth(M),T=y.default.lastDateInMonth(M),Y=7>v&&v>-1?v:7,N=C.getDay()+(7-Y),O=T.getDay()+(7-Y),I=y.default.dates(y.default.addDays(C,-(N%7)),y.default.addDays(T,6-O%7)),F=M.getFullYear(),x=this.constructor.getYearsPeriod(F,i),j=this.isInRange(this.state.today);return f.default.createElement("div",{className:u},f.default.createElement("input",{type:"text",onFocus:this.openDatepickerModal,disabled:p,className:c,placeholder:l,required:d,onChange:this.handleInput,value:b?(0,m.format)(this.state.value,n):""}),f.default.createElement(h.default,s({width:"500px",header:"Select date",ref:"datepicker",className:"react-pure-calendar-modal",onClose:this.handleCloseDatepickerModal},g),f.default.createElement("div",{className:"react-pure-calendar"},f.default.createElement("div",{className:"calendarWrap"},f.default.createElement("div",{className:"weekdays-names"},w.map(function(e){return f.default.createElement("div",{key:e,className:(S[e]?"weekend":"")+" weekDayNameShort"},e)})),I.map(function(t){var n=t.getDate(),r=t.getMonth(),a=t.getFullYear();return f.default.createElement("div",{key:r+"-"+n,className:e.getDateClasses(t,e.state.calendarValue,M),"data-day-cell":!0,"data-day":n,"data-month":r,"data-year":a,onClick:e.handleClick},n)}),f.default.createElement("br",null),f.default.createElement("br",null),f.default.createElement("button",{onClick:this.handleClick,type:"button","data-btn-today":!0,"data-day":!!this.state.today&&this.state.today.getDate(),"data-month":!!this.state.today&&this.state.today.getMonth(),"data-year":!!this.state.today&&this.state.today.getFullYear(),className:"btn btn-block btn-sm btn-default",disabled:!j,title:j?"":"Today date is out of range"},"Today"),this.props.applyBtn?f.default.createElement("button",{type:"button","data-btn-apply":!0,className:"btn btn-block btn-sm btn-default",onClick:this.hanleApplyBtnClick,disabled:!this.state.calendarValue},"Apply"):null,this.props.clearBtn?f.default.createElement("button",{"data-btn-clear":!0,onClick:this.clear,type:"button",className:"btn btn-block btn-sm btn-default"},"Clear"):null),f.default.createElement("div",{"data-month-section":!0},o.map(function(t,n){return f.default.createElement("div",{key:t,"data-month":n,onClick:e.handleClick,className:e.getMonthClasses(t,e.state.calendarValue,M)},t)})),f.default.createElement("div",{"data-year-section":!0},f.default.createElement("div",{"data-arrow-smaller":!0,"data-year":x[0]+i[0],onClick:this.handleClick,className:this.getYearClasses(x[0]+i[0],this.state.calendarValue,M)},"↑"),x.map(function(t){return f.default.createElement("div",{key:t,"data-year":t,onClick:e.handleClick,className:e.getYearClasses(t,e.state.calendarValue,M)},t)}),f.default.createElement("div",{"data-arrow-bigger":!0,"data-year":x[x.length-1]+i[1],onClick:this.handleClick,className:this.getYearClasses(x[x.length-1]+i[1],this.state.calendarValue,M)},"↓")))))}}]),t}(c.Component);v.defaultProps=v.defaultProps,v.defaultProps={today:y.default.noon(new Date),returnFormat:"Y-m-d H:i:s",format:"d.m.Y",disabled:!1,required:!1,monthsNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekDaysNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekDaysNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],years:[-4,5],beginFromDay:0,clearBtn:!0,applyBtn:!1},t.default=v},function(t,n){t.exports=e},function(e,t,n){function r(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function a(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function o(e,t,n,r,a){if(t>n){var o=n;n=t,t=o}return r(t,e)&&a(n,e)}var i=n(3),u=n(4),s="undefined"==typeof window,l={MS_IN_DAY:864e5,MS_IN_HOUR:36e5,MS_IN_MINUTE:6e4,MS_IN_SECOND:1e3,WEEKEND_DAYS:[6,0],WORK_DAYS:[1,2,3,4,5],ALL_DAYS:[0,1,2,3,4,5,6]},c={utc:r,noon:function(e){var t;return t=e?new Date(e):new Date,t.setHours(12,0,0,0),t},differenceInDates:function(e,t){return u((a(t)-a(e))/l.MS_IN_DAY)},differenceInDays:function(e,t){return u((r(t)-r(e))/l.MS_IN_DAY)},differenceInHours:function(e,t){return u((r(t)-r(e))/l.MS_IN_HOUR)},differenceInMinutes:function(e,t){return u((r(t)-r(e))/l.MS_IN_MINUTE)},differenceInSeconds:function(e,t){return u((r(t)-r(e))/l.MS_IN_SECOND)},differenceInWeekendDays:function(e,t){var n=c.differenceInDays(e,t);return c.weekendDaysInPeriod(e.getDay(),n)},differenceInWorkDays:function(e,t){var n=c.differenceInDays(e,t);return c.workDaysInPeriod(e.getDay(),n)},addYears:function(e,t){var n=new Date(e);return n.setFullYear(n.getFullYear()+t),n},addMonths:function(e,t){var n=new Date(e);return n.setMonth(n.getMonth()+t),n},addDays:function(e,t){var n=new Date(e);return n.setDate(n.getDate()+t),n},addHours:function(e,t){var n=new Date(e);return n.setHours(n.getHours()+t),n},addMinutes:function(e,t){var n=new Date(e);return n.setMinutes(n.getMinutes()+t),n},addSeconds:function(e,t){var n=new Date(e);return n.setSeconds(n.getSeconds()+t),n},addMilliseconds:function(e,t){var n=new Date(e);return n.setMilliseconds(n.getMilliseconds()+t),n},isSameYear:function(e,t){return e&&t&&e.getFullYear()===t.getFullYear()},isSameMonth:function(e,t){return c.isSameYear(e,t)&&e.getMonth()===t.getMonth()},isSameDay:function(e,t){return c.isSameMonth(e,t)&&e.getDate()===t.getDate()},equal:function(e,t){return e&&t&&!(e-t)},min:function(e,t){return 0>e-t?e:t},max:function(e,t){return e-t>0?e:t},dates:function(e,t){if(e>t){var n=t;t=e,e=n}for(var r=[],a=c.differenceInDates(e,t),o=0;a>=o;o++)r.push(c.addDays(e,o));return r},isoDateString:function(e){var t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();return 10>n&&(n="0"+n),10>r&&(r="0"+r),t+"-"+n+"-"+r},parseISOString:function(e){return s?new Date(e):c.resetTimezoneOffset(new Date(e))},resetTimezoneOffset:function(e){return new Date(e.getTime()+6e4*e.getTimezoneOffset())},firstDateInMonth:function(e){var t=new Date(e);return t.setDate(1),t},lastDateInMonth:function(e){var t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),t},isWeekendDay:function(e){return l.WEEKEND_DAYS.indexOf(e)!==-1},isWorkDay:function(e){return!c.isWeekendDay(e)},isWeekendDate:function(e){return c.isWeekendDay(e.getDay())},isWorkDate:function(e){return!c.isWeekendDate(e)},setWeekendDays:function(e){if(!(e instanceof Array))throw Error("Weekend days needs to be an array");l.WEEKEND_DAYS=e,l.WORK_DAYS=i([0,1,2,3,4,5,6],e)},daysInPeriod:function(e,t,n){function r(t){var r=Math.abs(e+t),o=7*Math.ceil(r/7),i=(o+e+t)%7;n.indexOf(i)!==-1&&a++}e instanceof Date&&(e=e.getDay()),n||(n=l.ALL_DAYS);var a=0;if(t<0)for(var o=0;o>t;o--)r(o);else for(var o=0;t>o;o++)r(o);return a},weekendDaysInPeriod:function(e,t){return c.daysInPeriod(e,t,l.WEEKEND_DAYS)},workDaysInPeriod:function(e,t){return c.daysInPeriod(e,t,l.WORK_DAYS)},isAfter:function(e,t){return e.getTime()>t.getTime()},isBefore:function(e,t){return e.getTime()<t.getTime()},isYearAfter:function(e,t){return e.getFullYear()>t.getFullYear()},isMonthAfter:function(e,t){return c.isYearAfter(e,t)||e.getMonth()>t.getMonth()&&c.isSameYear(e,t)},isDayAfter:function(e,t){return c.isMonthAfter(e,t)||e.getDate()>t.getDate()&&c.isSameMonth(e,t)},isYearBefore:function(e,t){return c.isYearAfter(t,e)},isMonthBefore:function(e,t){return c.isMonthAfter(t,e)},isDayBefore:function(e,t){return c.isDayAfter(t,e)},isYearBetween:function(e,t,n){return o(e,t,n,c.isYearBefore,c.isYearAfter)},isMonthBetween:function(e,t,n){return o(e,t,n,c.isMonthBefore,c.isMonthAfter)},isDayBetween:function(e,t,n){return o(e,t,n,c.isDayBefore,c.isDayAfter)},isoWeekDay:function(e){return e.getDay()||7}};e.exports=c},function(e,t){(function(t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function r(e,t){var n=e?e.length:0;return!!n&&s(e,t,0)>-1}function a(e,t,n){for(var r=-1,a=e?e.length:0;++r<a;)if(n(t,e[r]))return!0;return!1}function o(e,t){for(var n=-1,r=e?e.length:0,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}function i(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e}function u(e,t,n,r){for(var a=e.length,o=n+(r?1:-1);r?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function s(e,t,n){if(t!==t)return u(e,l,n);for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1}function l(e){return e!==e}function c(e){return function(t){return e(t)}}function f(e,t){return e.has(t)}function d(e,t){return null==e?void 0:e[t]}function h(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function p(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function y(){this.__data__=Ce?Ce(null):{}}function m(e){return this.has(e)&&delete this.__data__[e]}function v(e){var t=this.__data__;if(Ce){var n=t[e];return n===te?void 0:n}return ve.call(t,e)?t[e]:void 0}function g(e){var t=this.__data__;return Ce?void 0!==t[e]:ve.call(t,e)}function D(e,t){var n=this.__data__;return n[e]=Ce&&void 0===t?te:t,this}function b(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _(){this.__data__=[]}function k(e){var t=this.__data__,n=A(t,e);if(0>n)return!1;var r=t.length-1;return n==r?t.pop():ke.call(t,n,1),!0}function M(e){var t=this.__data__,n=A(t,e);return 0>n?void 0:t[n][1]}function w(e){return A(this.__data__,e)>-1}function S(e,t){var n=this.__data__,r=A(n,e);return 0>r?n.push([e,t]):n[r][1]=t,this}function C(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function T(){this.__data__={hash:new p,map:new(Se||b),string:new p}}function Y(e){return W(this,e).delete(e)}function N(e){return W(this,e).get(e)}function O(e){return W(this,e).has(e)}function I(e,t){return W(this,e).set(e,t),this}function F(e){var t=-1,n=e?e.length:0;for(this.__data__=new C;++t<n;)this.add(e[t])}function x(e){return this.__data__.set(e,te),this}function j(e){return this.__data__.has(e)}function A(e,t){for(var n=e.length;n--;)if(J(e[n][0],t))return n;return-1}function E(e,t,n,i){var u=-1,s=r,l=!0,d=e.length,h=[],p=t.length;if(!d)return h;n&&(t=o(t,c(n))),i?(s=a,l=!1):ee>t.length||(s=f,l=!1,t=new F(t));e:for(;++u<d;){var y=e[u],m=n?n(y):y;if(y=i||0!==y?y:0,l&&m===m){for(var v=p;v--;)if(t[v]===m)continue e;h.push(y)}else s(t,m,i)||h.push(y)}return h}function P(e,t,n,r,a){var o=-1,u=e.length;for(n||(n=V),a||(a=[]);++o<u;){var s=e[o];t>0&&n(s)?t>1?P(s,t-1,n,r,a):i(a,s):r||(a[a.length]=s)}return a}function R(e){if(!Q(e)||z(e))return!1;var t=G(e)||h(e)?De:ue;return t.test(q(e))}function U(e,t){return t=we(void 0===t?e.length-1:t,0),function(){for(var r=arguments,a=-1,o=we(r.length-t,0),i=Array(o);++a<o;)i[a]=r[t+a];a=-1;for(var u=Array(t+1);++a<t;)u[a]=r[a];return u[t]=i,n(e,this,u)}}function W(e,t){var n=e.__data__;return H(t)?n["string"==typeof t?"string":"hash"]:n.map}function B(e,t){var n=d(e,t);return R(n)?n:void 0}function V(e){return Ye(e)||K(e)||!!(Me&&e&&e[Me])}function H(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function z(e){return!!ye&&ye in e}function q(e){if(null!=e){try{return me.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function J(e,t){return e===t||e!==e&&t!==t}function K(e){return $(e)&&ve.call(e,"callee")&&(!_e.call(e,"callee")||ge.call(e)==re)}function L(e){return null!=e&&Z(e.length)&&!G(e)}function $(e){return X(e)&&L(e)}function G(e){var t=Q(e)?ge.call(e):"";return t==ae||t==oe}function Z(e){return"number"==typeof e&&e>-1&&e%1==0&&ne>=e}function Q(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function X(e){return!!e&&"object"==typeof e}var ee=200,te="__lodash_hash_undefined__",ne=9007199254740991,re="[object Arguments]",ae="[object Function]",oe="[object GeneratorFunction]",ie=/[\\^$.*+?()[\]{}|]/g,ue=/^\[object .+?Constructor\]$/,se="object"==typeof t&&t&&t.Object===Object&&t,le="object"==typeof self&&self&&self.Object===Object&&self,ce=se||le||Function("return this")(),fe=Array.prototype,de=Function.prototype,he=Object.prototype,pe=ce["__core-js_shared__"],ye=function(){var e=/[^.]+$/.exec(pe&&pe.keys&&pe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),me=de.toString,ve=he.hasOwnProperty,ge=he.toString,De=RegExp("^"+me.call(ve).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),be=ce.Symbol,_e=he.propertyIsEnumerable,ke=fe.splice,Me=be?be.isConcatSpreadable:void 0,we=Math.max,Se=B(ce,"Map"),Ce=B(Object,"create");p.prototype.clear=y,p.prototype.delete=m,p.prototype.get=v,p.prototype.has=g,p.prototype.set=D,b.prototype.clear=_,b.prototype.delete=k,b.prototype.get=M,b.prototype.has=w,b.prototype.set=S,C.prototype.clear=T,C.prototype.delete=Y,C.prototype.get=N,C.prototype.has=O,C.prototype.set=I,F.prototype.add=F.prototype.push=x,F.prototype.has=j;var Te=U(function(e,t){return $(e)?E(e,P(t,1,$,!0)):[]}),Ye=Array.isArray;e.exports=Te}).call(t,function(){return this}())},function(e,t){"use strict";e.exports=function(e){return 0>e?Math.ceil(e):Math.floor(e)}},function(e,t,n){!function(t,r){e.exports=r(n(1))}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.format=void 0;var u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=r(s),c=n(1),f=r(c),d={second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5},h=function(e){function t(e){a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.updateRelativeTime=n.updateRelativeTime.bind(n),n.checkForRelativeTimeProps=n.checkForRelativeTimeProps.bind(n),n.state={relativeTime:""},n.interval=null,n.currentUnit="",n}return i(t,e),u(t,[{key:"componentWillMount",value:function(){this.checkForRelativeTimeProps(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.checkForRelativeTimeProps(e)}},{key:"getRelativeTimeString",value:function(e,t,n,r){var a=t%100===1||t%10===1?n:n+"s";return"second"===n&&0===e?"just now":"year"===n&&0===e?"this year":"year"===n&&1===e?"last year":(r?"will come in":"")+" "+t+" "+a+" "+(r?"":"ago")}},{key:"getRelativeTimeDiff",value:function(e){var t=e,n=new Date,r=t.getTime(),a=n.getTime(),o=a-r,i=n.getFullYear()-t.getFullYear(),u=Math[o>0?"floor":"ceil"];return{ms:o,seconds:u(o/d.second),minutes:u(o/d.minute),hours:u(o/d.hour),days:u(o/d.day),weeks:u(o/d.week),months:12*i+n.getMonth()-t.getMonth(),years:i}}},{key:"getInterval",value:function(){return this.currentUnit.length?d[this.currentUnit]?d[this.currentUnit]:d.week:10}},{key:"checkForRelativeTimeProps",value:function(e){var t=this;if(e.relativeTime&&this.isDate(e.value)){var n=new Date(e.value);this.updateRelativeTime(n,e.unit),this.interval&&window.clearInterval(this.interval),this.interval=setInterval(function(){return t.updateRelativeTime(n,e.unit)},this.getInterval())}}},{key:"updateRelativeTime",value:function(e,t){var n=this.getRelativeTimeDiff(e),r=this.currentUnit;if(this.currentUnit=t||this.bestFit(n),this.currentUnit!==r)return this.checkForRelativeTimeProps(this.props),!1;var a=n[this.currentUnit+"s"],o=Math.abs(a),i=0>a;if("second"===this.currentUnit){var u=45;45>o&&(u=20),20>o&&(u=5),5>o&&(u=0),0===o&&(u=0),a=i?-u:u,o=Math.abs(a)}return thi