), or a non-functional component.\n');
var invalidTypeForTimingProp = exports.invalidTypeForTimingProp = function invalidTypeForTimingProp(args) {
return console.error('\n>> Error, via react-flip-move <<\n\nThe prop you provided for \'' + args.prop + '\' is invalid. It needs to be a positive integer, or a string that can be resolved to a number. The value you provided is \'' + args.value + '\'.\n\nAs a result, the default value for this parameter will be used, which is \'' + args.defaultValue + '\'.\n');
};
var deprecatedDisableAnimations = exports.deprecatedDisableAnimations = warnOnce('\n>> Warning, via react-flip-move <<\n\nThe \'disableAnimations\' prop you provided is deprecated. Please switch to use \'disableAllAnimations\'.\n\nThis will become a silent error in future versions of react-flip-move.\n');
var invalidEnterLeavePreset = exports.invalidEnterLeavePreset = function invalidEnterLeavePreset(args) {
return console.error('\n>> Error, via react-flip-move <<\n\nThe enter/leave preset you provided is invalid. We don\'t currently have a \'' + args.value + ' preset.\'\n\nAcceptable values are ' + args.acceptableValues + '. The default value of \'' + args.defaultValue + '\' will be used.\n');
};
/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var enterPresets = exports.enterPresets = {
elevator: {
from: { transform: 'scale(0)', opacity: '0' },
to: { transform: '', opacity: '' }
},
fade: {
from: { opacity: '0' },
to: { opacity: '' }
},
accordionVertical: {
from: { transform: 'scaleY(0)', transformOrigin: 'center top' },
to: { transform: '', transformOrigin: 'center top' }
},
accordionHorizontal: {
from: { transform: 'scaleX(0)', transformOrigin: 'left center' },
to: { transform: '', transformOrigin: 'left center' }
},
none: null
};
/**
* React Flip Move | enterLeavePresets
* (c) 2016-present Joshua Comeau
*
* This contains the master list of presets available for enter/leave animations,
* along with the mapping between preset and styles.
*/
var leavePresets = exports.leavePresets = {
elevator: {
from: { transform: 'scale(1)', opacity: '1' },
to: { transform: 'scale(0)', opacity: '0' }
},
fade: {
from: { opacity: '1' },
to: { opacity: '0' }
},
accordionVertical: {
from: { transform: 'scaleY(1)', transformOrigin: 'center top' },
to: { transform: 'scaleY(0)', transformOrigin: 'center top' }
},
accordionHorizontal: {
from: { transform: 'scaleX(1)', transformOrigin: 'left center' },
to: { transform: 'scaleX(0)', transformOrigin: 'left center' }
},
none: null
};
// For now, appearPresets will be identical to enterPresets.
// Assigning a custom export in case we ever want to add appear-specific ones.
var appearPresets = exports.appearPresets = enterPresets;
// Embarrassingly enough, v2.0 launched with typo'ed preset names.
// To avoid penning a new major version over something so inconsequential,
// we're supporting both spellings. In a future version, these alternatives
// may be deprecated.
// $FlowFixMe
enterPresets.accordianVertical = enterPresets.accordionVertical;
// $FlowFixMe
enterPresets.accordianHorizontal = enterPresets.accordionHorizontal;
// $FlowFixMe
leavePresets.accordianVertical = leavePresets.accordionVertical;
// $FlowFixMe
leavePresets.accordianHorizontal = leavePresets.accordionHorizontal;
var defaultPreset = exports.defaultPreset = 'elevator';
var disablePreset = exports.disablePreset = 'none';
/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createTransitionString = exports.getNativeNode = exports.updateHeightPlaceholder = exports.removeNodeFromDOMFlow = exports.getPositionDelta = exports.getRelativeBoundingBox = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
/**
* React Flip Move
* (c) 2016-present Joshua Comeau
*
* These methods read from and write to the DOM.
* They almost always have side effects, and will hopefully become the
* only spot in the codebase with impure functions.
*/
exports.applyStylesToDOMNode = applyStylesToDOMNode;
exports.whichTransitionEvent = whichTransitionEvent;
var _reactDom = __webpack_require__(133);
var _helpers = __webpack_require__(44);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function applyStylesToDOMNode(_ref) {
var domNode = _ref.domNode,
styles = _ref.styles;
// Can't just do an object merge because domNode.styles is no regular object.
// Need to do it this way for the engine to fire its `set` listeners.
Object.keys(styles).forEach(function (key) {
domNode.style.setProperty((0, _helpers.hyphenate)(key), styles[key]);
});
}
// Modified from Modernizr
function whichTransitionEvent() {
var transitions = {
transition: 'transitionend',
'-o-transition': 'oTransitionEnd',
'-moz-transition': 'transitionend',
'-webkit-transition': 'webkitTransitionEnd'
};
// If we're running in a browserless environment (eg. SSR), it doesn't apply.
// Return a placeholder string, for consistent type return.
if (typeof document === 'undefined') return '';
var el = document.createElement('fakeelement');
var match = Object.keys(transitions).find(function (t) {
return el.style.getPropertyValue(t) !== undefined;
});
// If no `transition` is found, we must be running in a browser so ancient,
// React itself won't run. Return an empty string, for consistent type return
return match ? transitions[match] : '';
}
var getRelativeBoundingBox = exports.getRelativeBoundingBox = function getRelativeBoundingBox(_ref2) {
var childDomNode = _ref2.childDomNode,
parentDomNode = _ref2.parentDomNode,
getPosition = _ref2.getPosition;
var parentBox = getPosition(parentDomNode);
var _getPosition = getPosition(childDomNode),
top = _getPosition.top,
left = _getPosition.left,
right = _getPosition.right,
bottom = _getPosition.bottom,
width = _getPosition.width,
height = _getPosition.height;
return {
top: top - parentBox.top,
left: left - parentBox.left,
right: parentBox.right - right,
bottom: parentBox.bottom - bottom,
width: width,
height: height
};
};
/** getPositionDelta
* This method returns the delta between two bounding boxes, to figure out
* how many pixels on each axis the element has moved.
*
*/
var getPositionDelta = exports.getPositionDelta = function getPositionDelta(_ref3) {
var childDomNode = _ref3.childDomNode,
childBoundingBox = _ref3.childBoundingBox,
parentBoundingBox = _ref3.parentBoundingBox,
getPosition = _ref3.getPosition;
// TEMP: A mystery bug is sometimes causing unnecessary boundingBoxes to
var defaultBox = { top: 0, left: 0, right: 0, bottom: 0, height: 0, width: 0 };
// Our old box is its last calculated position, derived on mount or at the
// start of the previous animation.
var oldRelativeBox = childBoundingBox || defaultBox;
var parentBox = parentBoundingBox || defaultBox;
// Our new box is the new final resting place: Where we expect it to wind up
// after the animation. First we get the box in absolute terms (AKA relative
// to the viewport), and then we calculate its relative box (relative to the
// parent container)
var newAbsoluteBox = getPosition(childDomNode);
var newRelativeBox = {
top: newAbsoluteBox.top - parentBox.top,
left: newAbsoluteBox.left - parentBox.left
};
return [oldRelativeBox.left - newRelativeBox.left, oldRelativeBox.top - newRelativeBox.top];
};
/** removeNodeFromDOMFlow
* This method does something very sneaky: it removes a DOM node from the
* document flow, but without actually changing its on-screen position.
*
* It works by calculating where the node is, and then applying styles
* so that it winds up being positioned absolutely, but in exactly the
* same place.
*
* This is a vital part of the FLIP technique.
*/
var removeNodeFromDOMFlow = exports.removeNodeFromDOMFlow = function removeNodeFromDOMFlow(childData, verticalAlignment) {
var domNode = childData.domNode,
boundingBox = childData.boundingBox;
if (!domNode || !boundingBox) {
return;
}
// For this to work, we have to offset any given `margin`.
var computed = window.getComputedStyle(domNode);
// We need to clean up margins, by converting and removing suffix:
// eg. '21px' -> 21
var marginAttrs = ['margin-top', 'margin-left', 'margin-right'];
var margins = marginAttrs.reduce(function (acc, margin) {
var propertyVal = computed.getPropertyValue(margin);
return _extends({}, acc, _defineProperty({}, margin, Number(propertyVal.replace('px', ''))));
}, {});
// If we're bottom-aligned, we need to add the height of the child to its
// top offset. This is because, when the container is bottom-aligned, its
// height shrinks from the top, not the bottom. We're removing this node
// from the flow, so the top is going to drop by its height.
var topOffset = verticalAlignment === 'bottom' ? boundingBox.top - boundingBox.height : boundingBox.top;
var styles = {
position: 'absolute',
top: topOffset - margins['margin-top'] + 'px',
left: boundingBox.left - margins['margin-left'] + 'px',
right: boundingBox.right - margins['margin-right'] + 'px'
};
applyStylesToDOMNode({ domNode: domNode, styles: styles });
};
/** updateHeightPlaceholder
* An optional property to FlipMove is a `maintainContainerHeight` boolean.
* This property creates a node that fills space, so that the parent
* container doesn't collapse when its children are removed from the
* document flow.
*/
var updateHeightPlaceholder = exports.updateHeightPlaceholder = function updateHeightPlaceholder(_ref4) {
var domNode = _ref4.domNode,
parentData = _ref4.parentData,
getPosition = _ref4.getPosition;
var parentDomNode = parentData.domNode;
var parentBoundingBox = parentData.boundingBox;
if (!parentDomNode || !parentBoundingBox) {
return;
}
// We need to find the height of the container *without* the placeholder.
// Since it's possible that the placeholder might already be present,
// we first set its height to 0.
// This allows the container to collapse down to the size of just its
// content (plus container padding or borders if any).
applyStylesToDOMNode({ domNode: domNode, styles: { height: '0' } });
// Find the distance by which the container would be collapsed by elements
// leaving. We compare the freshly-available parent height with the original,
// cached container height.
var originalParentHeight = parentBoundingBox.height;
var collapsedParentHeight = getPosition(parentDomNode).height;
var reductionInHeight = originalParentHeight - collapsedParentHeight;
// If the container has become shorter, update the padding element's
// height to take up the difference. Otherwise set its height to zero,
// so that it has no effect.
var styles = {
height: reductionInHeight > 0 ? reductionInHeight + 'px' : '0'
};
applyStylesToDOMNode({ domNode: domNode, styles: styles });
};
var getNativeNode = exports.getNativeNode = function getNativeNode(element) {
// When running in a windowless environment, abort!
if (typeof HTMLElement === 'undefined') {
return null;
}
// `element` may already be a native node.
if (element instanceof HTMLElement) {
return element;
}
// While ReactDOM's `findDOMNode` is discouraged, it's the only
// publicly-exposed way to find the underlying DOM node for
// composite components.
var foundNode = (0, _reactDom.findDOMNode)(element);
if (!(foundNode instanceof HTMLElement)) {
// Text nodes are not supported
return null;
}
return foundNode;
};
var createTransitionString = exports.createTransitionString = function createTransitionString(index, props) {
var delay = props.delay,
duration = props.duration;
var staggerDurationBy = props.staggerDurationBy,
staggerDelayBy = props.staggerDelayBy,
easing = props.easing;
delay += index * staggerDelayBy;
duration += index * staggerDurationBy;
var cssProperties = ['transform', 'opacity'];
return cssProperties.map(function (prop) {
return prop + ' ' + duration + 'ms ' + easing + ' ' + delay + 'ms';
}).join(', ');
};
/***/ }),
/* 133 */
/***/ (function(module, exports) {
module.exports = require("react-dom");
/***/ }),
/* 134 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Autosize 3.0.21
license: MIT
http://www.jacklmoore.com/autosize
*/
(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod);
global.autosize = mod.exports;
}
})(this, function (exports, module) {
'use strict';
var map = typeof Map === "function" ? new Map() : (function () {
var keys = [];
var values = [];
return {
has: function has(key) {
return keys.indexOf(key) > -1;
},
get: function get(key) {
return values[keys.indexOf(key)];
},
set: function set(key, value) {
if (keys.indexOf(key) === -1) {
keys.push(key);
values.push(value);
}
},
'delete': function _delete(key) {
var index = keys.indexOf(key);
if (index > -1) {
keys.splice(index, 1);
values.splice(index, 1);
}
}
};
})();
var createEvent = function createEvent(name) {
return new Event(name, { bubbles: true });
};
try {
new Event('test');
} catch (e) {
// IE does not support `new Event()`
createEvent = function (name) {
var evt = document.createEvent('Event');
evt.initEvent(name, true, false);
return evt;
};
}
function assign(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
var heightOffset = null;
var clientWidth = ta.clientWidth;
var cachedHeight = null;
function init() {
var style = window.getComputedStyle(ta, null);
if (style.resize === 'vertical') {
ta.style.resize = 'none';
} else if (style.resize === 'both') {
ta.style.resize = 'horizontal';
}
if (style.boxSizing === 'content-box') {
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
// Fix when a textarea is not on document body and heightOffset is Not a Number
if (isNaN(heightOffset)) {
heightOffset = 0;
}
update();
}
function changeOverflow(value) {
{
// Chrome/Safari-specific fix:
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
// made available by removing the scrollbar. The following forces the necessary text reflow.
var width = ta.style.width;
ta.style.width = '0px';
// Force reflow:
/* jshint ignore:start */
ta.offsetWidth;
/* jshint ignore:end */
ta.style.width = width;
}
ta.style.overflowY = value;
}
function getParentOverflows(el) {
var arr = [];
while (el && el.parentNode && el.parentNode instanceof Element) {
if (el.parentNode.scrollTop) {
arr.push({
node: el.parentNode,
scrollTop: el.parentNode.scrollTop
});
}
el = el.parentNode;
}
return arr;
}
function resize() {
var originalHeight = ta.style.height;
var overflows = getParentOverflows(ta);
var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
ta.style.height = 'auto';
var endHeight = ta.scrollHeight + heightOffset;
if (ta.scrollHeight === 0) {
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
ta.style.height = originalHeight;
return;
}
ta.style.height = endHeight + 'px';
// used to check if an update is actually necessary on window.resize
clientWidth = ta.clientWidth;
// prevents scroll-position jumping
overflows.forEach(function (el) {
el.node.scrollTop = el.scrollTop;
});
if (docTop) {
document.documentElement.scrollTop = docTop;
}
}
function update() {
resize();
var styleHeight = Math.round(parseFloat(ta.style.height));
var computed = window.getComputedStyle(ta, null);
// Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be allowed.
if (actualHeight !== styleHeight) {
if (computed.overflowY === 'hidden') {
changeOverflow('scroll');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
} else {
// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
if (computed.overflowY !== 'hidden') {
changeOverflow('hidden');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
}
if (cachedHeight !== actualHeight) {
cachedHeight = actualHeight;
var evt = createEvent('autosize:resized');
try {
ta.dispatchEvent(evt);
} catch (err) {
// Firefox will throw an error on dispatchEvent for a detached element
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
}
}
}
var pageResize = function pageResize() {
if (ta.clientWidth !== clientWidth) {
update();
}
};
var destroy = (function (style) {
window.removeEventListener('resize', pageResize, false);
ta.removeEventListener('input', update, false);
ta.removeEventListener('keyup', update, false);
ta.removeEventListener('autosize:destroy', destroy, false);
ta.removeEventListener('autosize:update', update, false);
Object.keys(style).forEach(function (key) {
ta.style[key] = style[key];
});
map['delete'](ta);
}).bind(ta, {
height: ta.style.height,
resize: ta.style.resize,
overflowY: ta.style.overflowY,
overflowX: ta.style.overflowX,
wordWrap: ta.style.wordWrap
});
ta.addEventListener('autosize:destroy', destroy, false);
// IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those events.
// There is no way that I know of to detect something like 'cut' in IE9.
if ('onpropertychange' in ta && 'oninput' in ta) {
ta.addEventListener('keyup', update, false);
}
window.addEventListener('resize', pageResize, false);
ta.addEventListener('input', update, false);
ta.addEventListener('autosize:update', update, false);
ta.style.overflowX = 'hidden';
ta.style.wordWrap = 'break-word';
map.set(ta, {
destroy: destroy,
update: update
});
init();
}
function destroy(ta) {
var methods = map.get(ta);
if (methods) {
methods.destroy();
}
}
function update(ta) {
var methods = map.get(ta);
if (methods) {
methods.update();
}
}
var autosize = null;
// Do nothing in Node.js environment and IE8 (or lower)
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
autosize = function (el) {
return el;
};
autosize.destroy = function (el) {
return el;
};
autosize.update = function (el) {
return el;
};
} else {
autosize = function (el, options) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
return assign(x, options);
});
}
return el;
};
autosize.destroy = function (el) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], destroy);
}
return el;
};
autosize.update = function (el) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], update);
}
return el;
};
}
module.exports = autosize;
});
/***/ }),
/* 135 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (language) {
return new _polyglot2.default({
phrases: i18nMap[language] || i18nMap.en,
locale: language
});
};
var _polyglot = __webpack_require__(136);
var _polyglot2 = _interopRequireDefault(_polyglot);
var _zhCN = __webpack_require__(137);
var _zhCN2 = _interopRequireDefault(_zhCN);
var _zhTW = __webpack_require__(138);
var _zhTW2 = _interopRequireDefault(_zhTW);
var _en = __webpack_require__(139);
var _en2 = _interopRequireDefault(_en);
var _esES = __webpack_require__(140);
var _esES2 = _interopRequireDefault(_esES);
var _fr = __webpack_require__(141);
var _fr2 = _interopRequireDefault(_fr);
var _ru = __webpack_require__(142);
var _ru2 = _interopRequireDefault(_ru);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var i18nMap = {
'zh': _zhCN2.default,
'zh-CN': _zhCN2.default,
'zh-TW': _zhTW2.default,
'en': _en2.default,
'es-ES': _esES2.default,
'fr': _fr2.default,
'ru': _ru2.default
};
/***/ }),
/* 136 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// (c) 2012 Airbnb, Inc.
//
// polyglot.js may be freely distributed under the terms of the BSD
// license. For all licensing information, details, and documention:
// http://airbnb.github.com/polyglot.js
//
//
// Polyglot.js is an I18n helper library written in JavaScript, made to
// work both in the browser and in Node. It provides a simple solution for
// interpolation and pluralization, based off of Airbnb's
// experience adding I18n functionality to its Backbone.js and Node apps.
//
// Polylglot is agnostic to your translation backend. It doesn't perform any
// translation; it simply gives you a way to manage translated phrases from
// your client- or server-side JavaScript application.
//
(function(root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
return factory(root);
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === 'object') {
module.exports = factory(root);
} else {
root.Polyglot = factory(root);
}
}(this, function(root) {
'use strict';
// ### Polyglot class constructor
function Polyglot(options) {
options = options || {};
this.phrases = {};
this.extend(options.phrases || {});
this.currentLocale = options.locale || 'en';
this.allowMissing = !!options.allowMissing;
this.warn = options.warn || warn;
}
// ### Version
Polyglot.VERSION = '0.4.3';
// ### polyglot.locale([locale])
//
// Get or set locale. Internally, Polyglot only uses locale for pluralization.
Polyglot.prototype.locale = function(newLocale) {
if (newLocale) this.currentLocale = newLocale;
return this.currentLocale;
};
// ### polyglot.extend(phrases)
//
// Use `extend` to tell Polyglot how to translate a given key.
//
// polyglot.extend({
// "hello": "Hello",
// "hello_name": "Hello, %{name}"
// });
//
// The key can be any string. Feel free to call `extend` multiple times;
// it will override any phrases with the same key, but leave existing phrases
// untouched.
//
// It is also possible to pass nested phrase objects, which get flattened
// into an object with the nested keys concatenated using dot notation.
//
// polyglot.extend({
// "nav": {
// "hello": "Hello",
// "hello_name": "Hello, %{name}",
// "sidebar": {
// "welcome": "Welcome"
// }
// }
// });
//
// console.log(polyglot.phrases);
// // {
// // 'nav.hello': 'Hello',
// // 'nav.hello_name': 'Hello, %{name}',
// // 'nav.sidebar.welcome': 'Welcome'
// // }
//
// `extend` accepts an optional second argument, `prefix`, which can be used
// to prefix every key in the phrases object with some string, using dot
// notation.
//
// polyglot.extend({
// "hello": "Hello",
// "hello_name": "Hello, %{name}"
// }, "nav");
//
// console.log(polyglot.phrases);
// // {
// // 'nav.hello': 'Hello',
// // 'nav.hello_name': 'Hello, %{name}'
// // }
//
// This feature is used internally to support nested phrase objects.
Polyglot.prototype.extend = function(morePhrases, prefix) {
var phrase;
for (var key in morePhrases) {
if (morePhrases.hasOwnProperty(key)) {
phrase = morePhrases[key];
if (prefix) key = prefix + '.' + key;
if (typeof phrase === 'object') {
this.extend(phrase, key);
} else {
this.phrases[key] = phrase;
}
}
}
};
// ### polyglot.clear()
//
// Clears all phrases. Useful for special cases, such as freeing
// up memory if you have lots of phrases but no longer need to
// perform any translation. Also used internally by `replace`.
Polyglot.prototype.clear = function() {
this.phrases = {};
};
// ### polyglot.replace(phrases)
//
// Completely replace the existing phrases with a new set of phrases.
// Normally, just use `extend` to add more phrases, but under certain
// circumstances, you may want to make sure no old phrases are lying around.
Polyglot.prototype.replace = function(newPhrases) {
this.clear();
this.extend(newPhrases);
};
// ### polyglot.t(key, options)
//
// The most-used method. Provide a key, and `t` will return the
// phrase.
//
// polyglot.t("hello");
// => "Hello"
//
// The phrase value is provided first by a call to `polyglot.extend()` or
// `polyglot.replace()`.
//
// Pass in an object as the second argument to perform interpolation.
//
// polyglot.t("hello_name", {name: "Spike"});
// => "Hello, Spike"
//
// If you like, you can provide a default value in case the phrase is missing.
// Use the special option key "_" to specify a default.
//
// polyglot.t("i_like_to_write_in_language", {
// _: "I like to write in %{language}.",
// language: "JavaScript"
// });
// => "I like to write in JavaScript."
//
Polyglot.prototype.t = function(key, options) {
var phrase, result;
options = options == null ? {} : options;
// allow number as a pluralization shortcut
if (typeof options === 'number') {
options = {smart_count: options};
}
if (typeof this.phrases[key] === 'string') {
phrase = this.phrases[key];
} else if (typeof options._ === 'string') {
phrase = options._;
} else if (this.allowMissing) {
phrase = key;
} else {
this.warn('Missing translation for key: "'+key+'"');
result = key;
}
if (typeof phrase === 'string') {
options = clone(options);
result = choosePluralForm(phrase, this.currentLocale, options.smart_count);
result = interpolate(result, options);
}
return result;
};
// ### polyglot.has(key)
//
// Check if polyglot has a translation for given key
Polyglot.prototype.has = function(key) {
return key in this.phrases;
};
// #### Pluralization methods
// The string that separates the different phrase possibilities.
var delimeter = '||||';
// Mapping from pluralization group plural logic.
var pluralTypes = {
chinese: function(n) { return 0; },
german: function(n) { return n !== 1 ? 1 : 0; },
french: function(n) { return n > 1 ? 1 : 0; },
russian: function(n) { return n % 10 === 1 && n % 100 !== 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2; },
czech: function(n) { return (n === 1) ? 0 : (n >= 2 && n <= 4) ? 1 : 2; },
polish: function(n) { return (n === 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2); },
icelandic: function(n) { return (n % 10 !== 1 || n % 100 === 11) ? 1 : 0; }
};
// Mapping from pluralization group to individual locales.
var pluralTypeToLanguages = {
chinese: ['fa', 'id', 'ja', 'ko', 'lo', 'ms', 'th', 'tr', 'zh'],
german: ['da', 'de', 'en', 'es', 'fi', 'el', 'he', 'hu', 'it', 'nl', 'no', 'pt', 'sv'],
french: ['fr', 'tl', 'pt-br'],
russian: ['hr', 'ru'],
czech: ['cs'],
polish: ['pl'],
icelandic: ['is']
};
function langToTypeMap(mapping) {
var type, langs, l, ret = {};
for (type in mapping) {
if (mapping.hasOwnProperty(type)) {
langs = mapping[type];
for (l in langs) {
ret[langs[l]] = type;
}
}
}
return ret;
}
// Trim a string.
function trim(str){
var trimRe = /^\s+|\s+$/g;
return str.replace(trimRe, '');
}
// Based on a phrase text that contains `n` plural forms separated
// by `delimeter`, a `locale`, and a `count`, choose the correct
// plural form, or none if `count` is `null`.
function choosePluralForm(text, locale, count){
var ret, texts, chosenText;
if (count != null && text) {
texts = text.split(delimeter);
chosenText = texts[pluralTypeIndex(locale, count)] || texts[0];
ret = trim(chosenText);
} else {
ret = text;
}
return ret;
}
function pluralTypeName(locale) {
var langToPluralType = langToTypeMap(pluralTypeToLanguages);
return langToPluralType[locale] || langToPluralType.en;
}
function pluralTypeIndex(locale, count) {
return pluralTypes[pluralTypeName(locale)](count);
}
// ### interpolate
//
// Does the dirty work. Creates a `RegExp` object for each
// interpolation placeholder.
function interpolate(phrase, options) {
for (var arg in options) {
if (arg !== '_' && options.hasOwnProperty(arg)) {
// We create a new `RegExp` each time instead of using a more-efficient
// string replace so that the same argument can be replaced multiple times
// in the same phrase.
phrase = phrase.replace(new RegExp('%\\{'+arg+'\\}', 'g'), options[arg]);
}
}
return phrase;
}
// ### warn
//
// Provides a warning in the console if a phrase key is missing.
function warn(message) {
root.console && root.console.warn && root.console.warn('WARNING: ' + message);
}
// ### clone
//
// Clone an object.
function clone(source) {
var ret = {};
for (var prop in source) {
ret[prop] = source[prop];
}
return ret;
}
return Polyglot;
}));
/***/ }),
/* 137 */
/***/ (function(module, exports) {
module.exports = {"init":"Gitalk 加载中 ...","no-found-related":"未找到相关的 %{link} 进行评论","please-contact":"请联系 %{user} 初始化创建","init-issue":"初始化 Issue","leave-a-comment":"说点什么","preview":"预览","edit":"编辑","comment":"评论","support-markdown":"支持 Markdown 语法","login-with-github":"使用 GitHub 登录","first-comment-person":"来做第一个留言的人吧!","commented":"发表于","load-more":"加载更多","counts":"%{counts} 条评论","sort-asc":"从旧到新排序","sort-desc":"从新到旧排序","logout":"注销","anonymous":"未登录用户"}
/***/ }),
/* 138 */
/***/ (function(module, exports) {
module.exports = {"init":"Gitalk 載入中…","no-found-related":"未找到相關的 %{link}","please-contact":"請聯絡 %{user} 初始化評論","init-issue":"初始化 Issue","leave-a-comment":"寫點什麼","preview":"預覽","edit":"編輯","comment":"評論","support-markdown":"支援 Markdown 語法","login-with-github":"使用 GitHub 登入","first-comment-person":"成為首個留言的人吧!","commented":"評論於","load-more":"載入更多","counts":"%{counts} 筆評論","sort-asc":"從舊至新排序","sort-desc":"從新至舊排序","logout":"登出","anonymous":"訪客"}
/***/ }),
/* 139 */
/***/ (function(module, exports) {
module.exports = {"init":"Gitalking ...","no-found-related":"Related %{link} not found","please-contact":"Please contact %{user} to initialize the comment","init-issue":"Init Issue","leave-a-comment":"Leave a comment","preview":"Preview","edit":"Edit","comment":"Comment","support-markdown":"Markdown is supported","login-with-github":"Login with GitHub","first-comment-person":"Be the first guy leaving a comment!","commented":"commented","load-more":"Load more","counts":"%{counts} comment |||| %{counts} comments","sort-asc":"Sort by Oldest","sort-desc":"Sort by Latest","logout":"Logout","anonymous":"Anonymous"}
/***/ }),
/* 140 */
/***/ (function(module, exports) {
module.exports = {"init":"Gitalking ...","no-found-related":"Link %{link} no encontrado","please-contact":"Por favor contacta con %{user} para inicializar el comentario","init-issue":"Iniciar Issue","leave-a-comment":"Deja un comentario","preview":"Avance","edit":"Editar","comment":"Comentario","support-markdown":"Markdown es soportado","login-with-github":"Entrar con GitHub","first-comment-person":"Sé el primero en dejar un comentario!","commented":"comentó","load-more":"Cargar más","counts":"%{counts} comentario |||| %{counts} comentarios","sort-asc":"Ordenar por Antiguos","sort-desc":"Ordenar por Recientes","logout":"Salir","anonymous":"Anónimo"}
/***/ }),
/* 141 */
/***/ (function(module, exports) {
module.exports = {"init":"Gitalking ...","no-found-related":"Lien %{link} non trouvé","please-contact":"S’il vous plaît contactez %{user} pour initialiser les commentaires","init-issue":"Initialisation des issues","leave-a-comment":"Laisser un commentaire","preview":"Aperçu","edit":"Modifier","comment":"Commentaire","support-markdown":"Markdown est supporté","login-with-github":"Se connecter avec GitHub","first-comment-person":"Être le premier à laisser un commentaire !","commented":"commenter","load-more":"Charger plus","counts":"%{counts} commentaire |||| %{counts} commentaires","sort-asc":"Trier par plus ancien","sort-desc":"Trier par plus récent","logout":"Déconnexion","anonymous":"Anonyme"}
/***/ }),
/* 142 */
/***/ (function(module, exports) {
module.exports = {"init":"Gitalking ...","no-found-related":"Связанные %{link} не найдены","please-contact":"Пожалуйста, свяжитесь с %{user} чтобы инициализировать комментарий","init-issue":"Выпуск инициализации","leave-a-comment":"Оставить комментарий","preview":"Предварительный просмотр","edit":"Pедактировать","comment":"Комментарий","support-markdown":"Поддерживается Markdown","login-with-github":"Вход через GitHub","first-comment-person":"Будьте первым, кто оставил комментарий","commented":"прокомментированный","load-more":"Загрузить ещё","counts":"%{counts} комментарий |||| %{counts} комментарьев","sort-asc":"Сортировать по старым","sort-desc":"Сортировать по последним","logout":"Выход","anonymous":"Анонимный"}
/***/ }),
/* 143 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 144 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(145), __esModule: true };
/***/ }),
/* 145 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(146);
module.exports = __webpack_require__(0).Object.keys;
/***/ }),
/* 146 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(22);
var $keys = __webpack_require__(20);
__webpack_require__(62)('keys', function () {
return function keys(it) {
return $keys(toObject(it));
};
});
/***/ }),
/* 147 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _isIterable2 = __webpack_require__(148);
var _isIterable3 = _interopRequireDefault(_isIterable2);
var _getIterator2 = __webpack_require__(151);
var _getIterator3 = _interopRequireDefault(_getIterator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if ((0, _isIterable3.default)(Object(arr))) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
/***/ }),
/* 148 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(149), __esModule: true };
/***/ }),
/* 149 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(26);
__webpack_require__(17);
module.exports = __webpack_require__(150);
/***/ }),
/* 150 */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(37);
var ITERATOR = __webpack_require__(2)('iterator');
var Iterators = __webpack_require__(14);
module.exports = __webpack_require__(0).isIterable = function (it) {
var O = Object(it);
return O[ITERATOR] !== undefined
|| '@@iterator' in O
// eslint-disable-next-line no-prototype-builtins
|| Iterators.hasOwnProperty(classof(O));
};
/***/ }),
/* 151 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(152), __esModule: true };
/***/ }),
/* 152 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(26);
__webpack_require__(17);
module.exports = __webpack_require__(153);
/***/ }),
/* 153 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(5);
var get = __webpack_require__(38);
module.exports = __webpack_require__(0).getIterator = function (it) {
var iterFn = get(it);
if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
return anObject(iterFn.call(it));
};
/***/ }),
/* 154 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(155);
/***/ }),
/* 155 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
var bind = __webpack_require__(71);
var Axios = __webpack_require__(157);
var defaults = __webpack_require__(45);
/**
* Create an instance of Axios
*
* @param {Object} defaultConfig The default config for the instance
* @return {Axios} A new instance of Axios
*/
function createInstance(defaultConfig) {
var context = new Axios(defaultConfig);
var instance = bind(Axios.prototype.request, context);
// Copy axios.prototype to instance
utils.extend(instance, Axios.prototype, context);
// Copy context to instance
utils.extend(instance, context);
return instance;
}
// Create the default instance to be exported
var axios = createInstance(defaults);
// Expose Axios class to allow class inheritance
axios.Axios = Axios;
// Factory for creating new instances
axios.create = function create(instanceConfig) {
return createInstance(utils.merge(defaults, instanceConfig));
};
// Expose Cancel & CancelToken
axios.Cancel = __webpack_require__(75);
axios.CancelToken = __webpack_require__(171);
axios.isCancel = __webpack_require__(74);
// Expose all/spread
axios.all = function all(promises) {
return Promise.all(promises);
};
axios.spread = __webpack_require__(172);
module.exports = axios;
// Allow use of default import syntax in TypeScript
module.exports.default = axios;
/***/ }),
/* 156 */
/***/ (function(module, exports) {
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh
* @license MIT
*/
// The _isBuffer check is for Safari 5-7 support, because it's missing
// Object.prototype.constructor. Remove this eventually
module.exports = function (obj) {
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
}
function isBuffer (obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}
// For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
}
/***/ }),
/* 157 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(45);
var utils = __webpack_require__(3);
var InterceptorManager = __webpack_require__(166);
var dispatchRequest = __webpack_require__(167);
var isAbsoluteURL = __webpack_require__(169);
var combineURLs = __webpack_require__(170);
/**
* Create a new instance of Axios
*
* @param {Object} instanceConfig The default config for the instance
*/
function Axios(instanceConfig) {
this.defaults = instanceConfig;
this.interceptors = {
request: new InterceptorManager(),
response: new InterceptorManager()
};
}
/**
* Dispatch a request
*
* @param {Object} config The config specific for this request (merged with this.defaults)
*/
Axios.prototype.request = function request(config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof config === 'string') {
config = utils.merge({
url: arguments[0]
}, arguments[1]);
}
config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
config.method = config.method.toLowerCase();
// Support baseURL config
if (config.baseURL && !isAbsoluteURL(config.url)) {
config.url = combineURLs(config.baseURL, config.url);
}
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];
var promise = Promise.resolve(config);
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
chain.unshift(interceptor.fulfilled, interceptor.rejected);
});
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
chain.push(interceptor.fulfilled, interceptor.rejected);
});
while (chain.length) {
promise = promise.then(chain.shift(), chain.shift());
}
return promise;
};
// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url
}));
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, data, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url,
data: data
}));
};
});
module.exports = Axios;
/***/ }),
/* 158 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
module.exports = function normalizeHeaderName(headers, normalizedName) {
utils.forEach(headers, function processHeader(value, name) {
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
headers[normalizedName] = value;
delete headers[name];
}
});
};
/***/ }),
/* 159 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var createError = __webpack_require__(73);
/**
* Resolve or reject a Promise based on response status.
*
* @param {Function} resolve A function that resolves the promise.
* @param {Function} reject A function that rejects the promise.
* @param {object} response The response.
*/
module.exports = function settle(resolve, reject, response) {
var validateStatus = response.config.validateStatus;
// Note: status is not exposed by XDomainRequest
if (!response.status || !validateStatus || validateStatus(response.status)) {
resolve(response);
} else {
reject(createError(
'Request failed with status code ' + response.status,
response.config,
null,
response.request,
response
));
}
};
/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Update an Error with the specified config, error code, and response.
*
* @param {Error} error The error to update.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [request] The request.
* @param {Object} [response] The response.
* @returns {Error} The error.
*/
module.exports = function enhanceError(error, config, code, request, response) {
error.config = config;
if (code) {
error.code = code;
}
error.request = request;
error.response = response;
return error;
};
/***/ }),
/* 161 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
function encode(val) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']');
}
/**
* Build a URL by appending params to the end
*
* @param {string} url The base of the url (e.g., http://www.google.com)
* @param {object} [params] The params to be appended
* @returns {string} The formatted url
*/
module.exports = function buildURL(url, params, paramsSerializer) {
/*eslint no-param-reassign:0*/
if (!params) {
return url;
}
var serializedParams;
if (paramsSerializer) {
serializedParams = paramsSerializer(params);
} else if (utils.isURLSearchParams(params)) {
serializedParams = params.toString();
} else {
var parts = [];
utils.forEach(params, function serialize(val, key) {
if (val === null || typeof val === 'undefined') {
return;
}
if (utils.isArray(val)) {
key = key + '[]';
}
if (!utils.isArray(val)) {
val = [val];
}
utils.forEach(val, function parseValue(v) {
if (utils.isDate(v)) {
v = v.toISOString();
} else if (utils.isObject(v)) {
v = JSON.stringify(v);
}
parts.push(encode(key) + '=' + encode(v));
});
});
serializedParams = parts.join('&');
}
if (serializedParams) {
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
}
return url;
};
/***/ }),
/* 162 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
/**
* Parse headers into an object
*
* ```
* Date: Wed, 27 Aug 2014 08:58:49 GMT
* Content-Type: application/json
* Connection: keep-alive
* Transfer-Encoding: chunked
* ```
*
* @param {String} headers Headers needing to be parsed
* @returns {Object} Headers parsed into an object
*/
module.exports = function parseHeaders(headers) {
var parsed = {};
var key;
var val;
var i;
if (!headers) { return parsed; }
utils.forEach(headers.split('\n'), function parser(line) {
i = line.indexOf(':');
key = utils.trim(line.substr(0, i)).toLowerCase();
val = utils.trim(line.substr(i + 1));
if (key) {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
});
return parsed;
};
/***/ }),
/* 163 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
module.exports = (
utils.isStandardBrowserEnv() ?
// Standard browser envs have full support of the APIs needed to test
// whether the request URL is of the same origin as current location.
(function standardBrowserEnv() {
var msie = /(msie|trident)/i.test(navigator.userAgent);
var urlParsingNode = document.createElement('a');
var originURL;
/**
* Parse a URL to discover it's components
*
* @param {String} url The URL to be parsed
* @returns {Object}
*/
function resolveURL(url) {
var href = url;
if (msie) {
// IE needs attribute set twice to normalize properties
urlParsingNode.setAttribute('href', href);
href = urlParsingNode.href;
}
urlParsingNode.setAttribute('href', href);
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
return {
href: urlParsingNode.href,
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
host: urlParsingNode.host,
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
hostname: urlParsingNode.hostname,
port: urlParsingNode.port,
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
urlParsingNode.pathname :
'/' + urlParsingNode.pathname
};
}
originURL = resolveURL(window.location.href);
/**
* Determine if a URL shares the same origin as the current location
*
* @param {String} requestURL The URL to test
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
return function isURLSameOrigin(requestURL) {
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
return (parsed.protocol === originURL.protocol &&
parsed.host === originURL.host);
};
})() :
// Non standard browser envs (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return function isURLSameOrigin() {
return true;
};
})()
);
/***/ }),
/* 164 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function E() {
this.message = 'String contains an invalid character';
}
E.prototype = new Error;
E.prototype.code = 5;
E.prototype.name = 'InvalidCharacterError';
function btoa(input) {
var str = String(input);
var output = '';
for (
// initialize result and counter
var block, charCode, idx = 0, map = chars;
// if the next str index does not exist:
// change the mapping table to "="
// check if d has no fractional digits
str.charAt(idx | 0) || (map = '=', idx % 1);
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
) {
charCode = str.charCodeAt(idx += 3 / 4);
if (charCode > 0xFF) {
throw new E();
}
block = block << 8 | charCode;
}
return output;
}
module.exports = btoa;
/***/ }),
/* 165 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
module.exports = (
utils.isStandardBrowserEnv() ?
// Standard browser envs support document.cookie
(function standardBrowserEnv() {
return {
write: function write(name, value, expires, path, domain, secure) {
var cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
if (utils.isNumber(expires)) {
cookie.push('expires=' + new Date(expires).toGMTString());
}
if (utils.isString(path)) {
cookie.push('path=' + path);
}
if (utils.isString(domain)) {
cookie.push('domain=' + domain);
}
if (secure === true) {
cookie.push('secure');
}
document.cookie = cookie.join('; ');
},
read: function read(name) {
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
},
remove: function remove(name) {
this.write(name, '', Date.now() - 86400000);
}
};
})() :
// Non standard browser env (web workers, react-native) lack needed support.
(function nonStandardBrowserEnv() {
return {
write: function write() {},
read: function read() { return null; },
remove: function remove() {}
};
})()
);
/***/ }),
/* 166 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
function InterceptorManager() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a `Promise`
* @param {Function} rejected The function to handle `reject` for a `Promise`
*
* @return {Number} An ID used to remove interceptor later
*/
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
this.handlers.push({
fulfilled: fulfilled,
rejected: rejected
});
return this.handlers.length - 1;
};
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*/
InterceptorManager.prototype.eject = function eject(id) {
if (this.handlers[id]) {
this.handlers[id] = null;
}
};
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*/
InterceptorManager.prototype.forEach = function forEach(fn) {
utils.forEach(this.handlers, function forEachHandler(h) {
if (h !== null) {
fn(h);
}
});
};
module.exports = InterceptorManager;
/***/ }),
/* 167 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
var transformData = __webpack_require__(168);
var isCancel = __webpack_require__(74);
var defaults = __webpack_require__(45);
/**
* Throws a `Cancel` if cancellation has been requested.
*/
function throwIfCancellationRequested(config) {
if (config.cancelToken) {
config.cancelToken.throwIfRequested();
}
}
/**
* Dispatch a request to the server using the configured adapter.
*
* @param {object} config The config that is to be used for the request
* @returns {Promise} The Promise to be fulfilled
*/
module.exports = function dispatchRequest(config) {
throwIfCancellationRequested(config);
// Ensure headers exist
config.headers = config.headers || {};
// Transform request data
config.data = transformData(
config.data,
config.headers,
config.transformRequest
);
// Flatten headers
config.headers = utils.merge(
config.headers.common || {},
config.headers[config.method] || {},
config.headers || {}
);
utils.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
function cleanHeaderConfig(method) {
delete config.headers[method];
}
);
var adapter = config.adapter || defaults.adapter;
return adapter(config).then(function onAdapterResolution(response) {
throwIfCancellationRequested(config);
// Transform response data
response.data = transformData(
response.data,
response.headers,
config.transformResponse
);
return response;
}, function onAdapterRejection(reason) {
if (!isCancel(reason)) {
throwIfCancellationRequested(config);
// Transform response data
if (reason && reason.response) {
reason.response.data = transformData(
reason.response.data,
reason.response.headers,
config.transformResponse
);
}
}
return Promise.reject(reason);
});
};
/***/ }),
/* 168 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = __webpack_require__(3);
/**
* Transform the data for a request or a response
*
* @param {Object|String} data The data to be transformed
* @param {Array} headers The headers for the request or response
* @param {Array|Function} fns A single function or Array of functions
* @returns {*} The resulting transformed data
*/
module.exports = function transformData(data, headers, fns) {
/*eslint no-param-reassign:0*/
utils.forEach(fns, function transform(fn) {
data = fn(data, headers);
});
return data;
};
/***/ }),
/* 169 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Determines whether the specified URL is absolute
*
* @param {string} url The URL to test
* @returns {boolean} True if the specified URL is absolute, otherwise false
*/
module.exports = function isAbsoluteURL(url) {
// A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
// by any combination of letters, digits, plus, period, or hyphen.
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
};
/***/ }),
/* 170 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Creates a new URL by combining the specified URLs
*
* @param {string} baseURL The base URL
* @param {string} relativeURL The relative URL
* @returns {string} The combined URL
*/
module.exports = function combineURLs(baseURL, relativeURL) {
return relativeURL
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
: baseURL;
};
/***/ }),
/* 171 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Cancel = __webpack_require__(75);
/**
* A `CancelToken` is an object that can be used to request cancellation of an operation.
*
* @class
* @param {Function} executor The executor function.
*/
function CancelToken(executor) {
if (typeof executor !== 'function') {
throw new TypeError('executor must be a function.');
}
var resolvePromise;
this.promise = new Promise(function promiseExecutor(resolve) {
resolvePromise = resolve;
});
var token = this;
executor(function cancel(message) {
if (token.reason) {
// Cancellation has already been requested
return;
}
token.reason = new Cancel(message);
resolvePromise(token.reason);
});
}
/**
* Throws a `Cancel` if cancellation has been requested.
*/
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
if (this.reason) {
throw this.reason;
}
};
/**
* Returns an object that contains a new `CancelToken` and a function that, when called,
* cancels the `CancelToken`.
*/
CancelToken.source = function source() {
var cancel;
var token = new CancelToken(function executor(c) {
cancel = c;
});
return {
token: token,
cancel: cancel
};
};
module.exports = CancelToken;
/***/ }),
/* 172 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Syntactic sugar for invoking a function and expanding an array for arguments.
*
* Common use case would be to use `Function.prototype.apply`.
*
* ```js
* function f(x, y, z) {}
* var args = [1, 2, 3];
* f.apply(null, args);
* ```
*
* With `spread` this example can be re-written.
*
* ```js
* spread(function(x, y, z) {})([1, 2, 3]);
* ```
*
* @param {Function} callback
* @returns {Function}
*/
module.exports = function spread(callback) {
return function wrap(arr) {
return callback.apply(null, arr);
};
};
/***/ }),
/* 173 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(9);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (_ref) {
var className = _ref.className,
getRef = _ref.getRef,
onClick = _ref.onClick,
onMouseDown = _ref.onMouseDown,
text = _ref.text,
isLoading = _ref.isLoading;
return _react2.default.createElement(
"button",
{
ref: function ref(el) {
return getRef && getRef(el);
},
className: "gt-btn " + className,
onClick: onClick,
onMouseDown: onMouseDown },
_react2.default.createElement(
"span",
{ className: "gt-btn-text" },
text
),
isLoading && _react2.default.createElement("span", { className: "gt-btn-loading gt-spinner" })
);
};
/***/ }),
/* 174 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(9);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (_ref) {
var className = _ref.className,
onClick = _ref.onClick,
text = _ref.text;
return _react2.default.createElement(
"a",
{ className: "gt-action " + className, onClick: onClick },
_react2.default.createElement(
"span",
{ className: "gt-action-text" },
text
)
);
};
/***/ }),
/* 175 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getPrototypeOf = __webpack_require__(61);
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = __webpack_require__(63);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(64);
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = __webpack_require__(65);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(69);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(9);
var _react2 = _interopRequireDefault(_react);
var _avatar = __webpack_require__(76);
var _avatar2 = _interopRequireDefault(_avatar);
var _svg = __webpack_require__(77);
var _svg2 = _interopRequireDefault(_svg);
var _distance_in_words_to_now = __webpack_require__(184);
var _distance_in_words_to_now2 = _interopRequireDefault(_distance_in_words_to_now);
var _index = __webpack_require__(197);
var _index2 = _interopRequireDefault(_index);
var _index3 = __webpack_require__(198);
var _index4 = _interopRequireDefault(_index3);
var _index5 = __webpack_require__(199);
var _index6 = _interopRequireDefault(_index5);
var _index7 = __webpack_require__(200);
var _index8 = _interopRequireDefault(_index7);
var _index9 = __webpack_require__(201);
var _index10 = _interopRequireDefault(_index9);
__webpack_require__(202);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ZHCN = (0, _index2.default)();
var ZHTW = (0, _index4.default)();
var ES = (0, _index6.default)();
var FR = (0, _index8.default)();
var RU = (0, _index10.default)();
if (typeof window !== 'undefined') {
window.GT_i18n_distanceInWordsLocaleMap = {
zh: ZHCN,
'zh-CN': ZHCN,
'zh-TW': ZHTW,
'es-ES': ES,
fr: FR,
ru: RU
};
}
var Comment = function (_Component) {
(0, _inherits3.default)(Comment, _Component);
function Comment() {
(0, _classCallCheck3.default)(this, Comment);
return (0, _possibleConstructorReturn3.default)(this, (Comment.__proto__ || (0, _getPrototypeOf2.default)(Comment)).apply(this, arguments));
}
(0, _createClass3.default)(Comment, [{
key: 'render',
value: function render() {
var _props = this.props,
comment = _props.comment,
user = _props.user,
language = _props.language,
_props$commentedText = _props.commentedText,
commentedText = _props$commentedText === undefined ? '' : _props$commentedText,
_props$admin = _props.admin,
admin = _props$admin === undefined ? [] : _props$admin,
replyCallback = _props.replyCallback,
likeCallback = _props.likeCallback;
var enableEdit = user && comment.user.login === user.login;
var isAdmin = ~[].concat(admin).map(function (a) {
return a.toLowerCase();
}).indexOf(comment.user.login.toLowerCase());
var reactions = comment.reactions;
var reactionTotalCount = '';
if (reactions && reactions.totalCount) {
reactionTotalCount = reactions.totalCount;
if (reactions.totalCount === 100 && reactions.pageInfo && reactions.pageInfo.hasNextPage) {
reactionTotalCount = '100+';
}
}
return _react2.default.createElement(
'div',
{ className: 'gt-comment ' + (isAdmin ? 'gt-comment-admin' : '') },
_react2.default.createElement(_avatar2.default, {
className: 'gt-comment-avatar',
src: comment.user && comment.user.avatar_url
}),
_react2.default.createElement(
'div',
{ className: 'gt-comment-content' },
_react2.default.createElement(
'div',
{ className: 'gt-comment-header' },
_react2.default.createElement(
'a',
{
className: 'gt-comment-username',
href: comment.user && comment.user.html_url
},
comment.user && comment.user.login
),
_react2.default.createElement(
'span',
{ className: 'gt-comment-text' },
commentedText
),
_react2.default.createElement(
'span',
{ className: 'gt-comment-date' },
(0, _distance_in_words_to_now2.default)(comment.created_at, {
addSuffix: true,
locale: {
distanceInWords: window.GT_i18n_distanceInWordsLocaleMap[language]
}
})
),
reactions && _react2.default.createElement(
'a',
{ className: 'gt-comment-like', onClick: likeCallback },
reactions.viewerHasReacted ? _react2.default.createElement(_svg2.default, {
className: 'gt-ico-heart',
name: 'heart_on',
text: reactionTotalCount
}) : _react2.default.createElement(_svg2.default, {
className: 'gt-ico-heart',
name: 'heart',
text: reactionTotalCount
})
),
enableEdit ? _react2.default.createElement(
'a',
{
href: comment.html_url,
className: 'gt-comment-edit',
target: '_blank'
},
_react2.default.createElement(_svg2.default, { className: 'gt-ico-edit', name: 'edit' })
) : _react2.default.createElement(
'a',
{ className: 'gt-comment-reply', onClick: replyCallback },
_react2.default.createElement(_svg2.default, { className: 'gt-ico-reply', name: 'reply' })
)
),
_react2.default.createElement('div', {
className: 'gt-comment-body markdown-body',
dangerouslySetInnerHTML: {
__html: comment.body_html
}
})
)
);
}
}]);
return Comment;
}(_react.Component);
exports.default = Comment;
/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {
var map = {
"./arrow_down.svg": 177,
"./edit.svg": 178,
"./github.svg": 179,
"./heart.svg": 180,
"./heart_on.svg": 181,
"./reply.svg": 182,
"./tip.svg": 183
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
var id = map[req];
if(!(id + 1)) // check for number or string
throw new Error("Cannot find module '" + req + "'.");
return id;
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 176;
/***/ }),
/* 177 */
/***/ (function(module, exports) {
module.exports = ""
/***/ }),
/* 178 */
/***/ (function(module, exports) {
module.exports = "\n"
/***/ }),
/* 179 */
/***/ (function(module, exports) {
module.exports = "\n"
/***/ }),
/* 180 */
/***/ (function(module, exports) {
module.exports = "\n"
/***/ }),
/* 181 */
/***/ (function(module, exports) {
module.exports = "\n"
/***/ }),
/* 182 */
/***/ (function(module, exports) {
module.exports = "\n"
/***/ }),
/* 183 */
/***/ (function(module, exports) {
module.exports = "\n"
/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {
var distanceInWords = __webpack_require__(185)
/**
* @category Common Helpers
* @summary Return the distance between the given date and now in words.
*
* @description
* Return the distance between the given date and now in words.
*
* | Distance to now | Result |
* |-------------------------------------------------------------------|---------------------|
* | 0 ... 30 secs | less than a minute |
* | 30 secs ... 1 min 30 secs | 1 minute |
* | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
* | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
* | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
* | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
* | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
* | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
* | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
* | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
* | 1 yr ... 1 yr 3 months | about 1 year |
* | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
* | 1 yr 9 months ... 2 yrs | almost 2 years |
* | N yrs ... N yrs 3 months | about N years |
* | N yrs 3 months ... N yrs 9 months | over N years |
* | N yrs 9 months ... N+1 yrs | almost N+1 years |
*
* With `options.includeSeconds == true`:
* | Distance to now | Result |
* |---------------------|----------------------|
* | 0 secs ... 5 secs | less than 5 seconds |
* | 5 secs ... 10 secs | less than 10 seconds |
* | 10 secs ... 20 secs | less than 20 seconds |
* | 20 secs ... 40 secs | half a minute |
* | 40 secs ... 60 secs | less than a minute |
* | 60 secs ... 90 secs | 1 minute |
*
* @param {Date|String|Number} date - the given date
* @param {Object} [options] - the object with options
* @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed
* @param {Boolean} [options.addSuffix=false] - result specifies if the second date is earlier or later than the first
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the distance in words
*
* @example
* // If today is 1 January 2015, what is the distance to 2 July 2014?
* var result = distanceInWordsToNow(
* new Date(2014, 6, 2)
* )
* //=> '6 months'
*
* @example
* // If now is 1 January 2015 00:00:00,
* // what is the distance to 1 January 2015 00:00:15, including seconds?
* var result = distanceInWordsToNow(
* new Date(2015, 0, 1, 0, 0, 15),
* {includeSeconds: true}
* )
* //=> 'less than 20 seconds'
*
* @example
* // If today is 1 January 2015,
* // what is the distance to 1 January 2016, with a suffix?
* var result = distanceInWordsToNow(
* new Date(2016, 0, 1),
* {addSuffix: true}
* )
* //=> 'in about 1 year'
*
* @example
* // If today is 1 January 2015,
* // what is the distance to 1 August 2016 in Esperanto?
* var eoLocale = require('date-fns/locale/eo')
* var result = distanceInWordsToNow(
* new Date(2016, 7, 1),
* {locale: eoLocale}
* )
* //=> 'pli ol 1 jaro'
*/
function distanceInWordsToNow (dirtyDate, dirtyOptions) {
return distanceInWords(Date.now(), dirtyDate, dirtyOptions)
}
module.exports = distanceInWordsToNow
/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {
var compareDesc = __webpack_require__(186)
var parse = __webpack_require__(16)
var differenceInSeconds = __webpack_require__(188)
var differenceInMonths = __webpack_require__(190)
var enLocale = __webpack_require__(193)
var MINUTES_IN_DAY = 1440
var MINUTES_IN_ALMOST_TWO_DAYS = 2520
var MINUTES_IN_MONTH = 43200
var MINUTES_IN_TWO_MONTHS = 86400
/**
* @category Common Helpers
* @summary Return the distance between the given dates in words.
*
* @description
* Return the distance between the given dates in words.
*
* | Distance between dates | Result |
* |-------------------------------------------------------------------|---------------------|
* | 0 ... 30 secs | less than a minute |
* | 30 secs ... 1 min 30 secs | 1 minute |
* | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
* | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
* | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
* | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
* | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
* | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
* | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
* | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
* | 1 yr ... 1 yr 3 months | about 1 year |
* | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
* | 1 yr 9 months ... 2 yrs | almost 2 years |
* | N yrs ... N yrs 3 months | about N years |
* | N yrs 3 months ... N yrs 9 months | over N years |
* | N yrs 9 months ... N+1 yrs | almost N+1 years |
*
* With `options.includeSeconds == true`:
* | Distance between dates | Result |
* |------------------------|----------------------|
* | 0 secs ... 5 secs | less than 5 seconds |
* | 5 secs ... 10 secs | less than 10 seconds |
* | 10 secs ... 20 secs | less than 20 seconds |
* | 20 secs ... 40 secs | half a minute |
* | 40 secs ... 60 secs | less than a minute |
* | 60 secs ... 90 secs | 1 minute |
*
* @param {Date|String|Number} dateToCompare - the date to compare with
* @param {Date|String|Number} date - the other date
* @param {Object} [options] - the object with options
* @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed
* @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the distance in words
*
* @example
* // What is the distance between 2 July 2014 and 1 January 2015?
* var result = distanceInWords(
* new Date(2014, 6, 2),
* new Date(2015, 0, 1)
* )
* //=> '6 months'
*
* @example
* // What is the distance between 1 January 2015 00:00:15
* // and 1 January 2015 00:00:00, including seconds?
* var result = distanceInWords(
* new Date(2015, 0, 1, 0, 0, 15),
* new Date(2015, 0, 1, 0, 0, 0),
* {includeSeconds: true}
* )
* //=> 'less than 20 seconds'
*
* @example
* // What is the distance from 1 January 2016
* // to 1 January 2015, with a suffix?
* var result = distanceInWords(
* new Date(2016, 0, 1),
* new Date(2015, 0, 1),
* {addSuffix: true}
* )
* //=> 'about 1 year ago'
*
* @example
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
* var eoLocale = require('date-fns/locale/eo')
* var result = distanceInWords(
* new Date(2016, 7, 1),
* new Date(2015, 0, 1),
* {locale: eoLocale}
* )
* //=> 'pli ol 1 jaro'
*/
function distanceInWords (dirtyDateToCompare, dirtyDate, dirtyOptions) {
var options = dirtyOptions || {}
var comparison = compareDesc(dirtyDateToCompare, dirtyDate)
var locale = options.locale
var localize = enLocale.distanceInWords.localize
if (locale && locale.distanceInWords && locale.distanceInWords.localize) {
localize = locale.distanceInWords.localize
}
var localizeOptions = {
addSuffix: Boolean(options.addSuffix),
comparison: comparison
}
var dateLeft, dateRight
if (comparison > 0) {
dateLeft = parse(dirtyDateToCompare)
dateRight = parse(dirtyDate)
} else {
dateLeft = parse(dirtyDate)
dateRight = parse(dirtyDateToCompare)
}
var seconds = differenceInSeconds(dateRight, dateLeft)
var offset = dateRight.getTimezoneOffset() - dateLeft.getTimezoneOffset()
var minutes = Math.round(seconds / 60) - offset
var months
// 0 up to 2 mins
if (minutes < 2) {
if (options.includeSeconds) {
if (seconds < 5) {
return localize('lessThanXSeconds', 5, localizeOptions)
} else if (seconds < 10) {
return localize('lessThanXSeconds', 10, localizeOptions)
} else if (seconds < 20) {
return localize('lessThanXSeconds', 20, localizeOptions)
} else if (seconds < 40) {
return localize('halfAMinute', null, localizeOptions)
} else if (seconds < 60) {
return localize('lessThanXMinutes', 1, localizeOptions)
} else {
return localize('xMinutes', 1, localizeOptions)
}
} else {
if (minutes === 0) {
return localize('lessThanXMinutes', 1, localizeOptions)
} else {
return localize('xMinutes', minutes, localizeOptions)
}
}
// 2 mins up to 0.75 hrs
} else if (minutes < 45) {
return localize('xMinutes', minutes, localizeOptions)
// 0.75 hrs up to 1.5 hrs
} else if (minutes < 90) {
return localize('aboutXHours', 1, localizeOptions)
// 1.5 hrs up to 24 hrs
} else if (minutes < MINUTES_IN_DAY) {
var hours = Math.round(minutes / 60)
return localize('aboutXHours', hours, localizeOptions)
// 1 day up to 1.75 days
} else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
return localize('xDays', 1, localizeOptions)
// 1.75 days up to 30 days
} else if (minutes < MINUTES_IN_MONTH) {
var days = Math.round(minutes / MINUTES_IN_DAY)
return localize('xDays', days, localizeOptions)
// 1 month up to 2 months
} else if (minutes < MINUTES_IN_TWO_MONTHS) {
months = Math.round(minutes / MINUTES_IN_MONTH)
return localize('aboutXMonths', months, localizeOptions)
}
months = differenceInMonths(dateRight, dateLeft)
// 2 months up to 12 months
if (months < 12) {
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH)
return localize('xMonths', nearestMonth, localizeOptions)
// 1 year up to max Date
} else {
var monthsSinceStartOfYear = months % 12
var years = Math.floor(months / 12)
// N years up to 1 years 3 months
if (monthsSinceStartOfYear < 3) {
return localize('aboutXYears', years, localizeOptions)
// N years 3 months up to N years 9 months
} else if (monthsSinceStartOfYear < 9) {
return localize('overXYears', years, localizeOptions)
// N years 9 months up to N year 12 months
} else {
return localize('almostXYears', years + 1, localizeOptions)
}
}
}
module.exports = distanceInWords
/***/ }),
/* 186 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(16)
/**
* @category Common Helpers
* @summary Compare the two dates reverse chronologically and return -1, 0 or 1.
*
* @description
* Compare the two dates and return -1 if the first date is after the second,
* 1 if the first date is before the second or 0 if dates are equal.
*
* @param {Date|String|Number} dateLeft - the first date to compare
* @param {Date|String|Number} dateRight - the second date to compare
* @returns {Number} the result of the comparison
*
* @example
* // Compare 11 February 1987 and 10 July 1989 reverse chronologically:
* var result = compareDesc(
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* )
* //=> 1
*
* @example
* // Sort the array of dates in reverse chronological order:
* var result = [
* new Date(1995, 6, 2),
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* ].sort(compareDesc)
* //=> [
* // Sun Jul 02 1995 00:00:00,
* // Mon Jul 10 1989 00:00:00,
* // Wed Feb 11 1987 00:00:00
* // ]
*/
function compareDesc (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var timeLeft = dateLeft.getTime()
var dateRight = parse(dirtyDateRight)
var timeRight = dateRight.getTime()
if (timeLeft > timeRight) {
return -1
} else if (timeLeft < timeRight) {
return 1
} else {
return 0
}
}
module.exports = compareDesc
/***/ }),
/* 187 */
/***/ (function(module, exports) {
/**
* @category Common Helpers
* @summary Is the given argument an instance of Date?
*
* @description
* Is the given argument an instance of Date?
*
* @param {*} argument - the argument to check
* @returns {Boolean} the given argument is an instance of Date
*
* @example
* // Is 'mayonnaise' a Date?
* var result = isDate('mayonnaise')
* //=> false
*/
function isDate (argument) {
return argument instanceof Date
}
module.exports = isDate
/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {
var differenceInMilliseconds = __webpack_require__(189)
/**
* @category Second Helpers
* @summary Get the number of seconds between the given dates.
*
* @description
* Get the number of seconds between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of seconds
*
* @example
* // How many seconds are between
* // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
* var result = differenceInSeconds(
* new Date(2014, 6, 2, 12, 30, 20, 0),
* new Date(2014, 6, 2, 12, 30, 7, 999)
* )
* //=> 12
*/
function differenceInSeconds (dirtyDateLeft, dirtyDateRight) {
var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / 1000
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}
module.exports = differenceInSeconds
/***/ }),
/* 189 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(16)
/**
* @category Millisecond Helpers
* @summary Get the number of milliseconds between the given dates.
*
* @description
* Get the number of milliseconds between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of milliseconds
*
* @example
* // How many milliseconds are between
* // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
* var result = differenceInMilliseconds(
* new Date(2014, 6, 2, 12, 30, 21, 700),
* new Date(2014, 6, 2, 12, 30, 20, 600)
* )
* //=> 1100
*/
function differenceInMilliseconds (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
return dateLeft.getTime() - dateRight.getTime()
}
module.exports = differenceInMilliseconds
/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(16)
var differenceInCalendarMonths = __webpack_require__(191)
var compareAsc = __webpack_require__(192)
/**
* @category Month Helpers
* @summary Get the number of full months between the given dates.
*
* @description
* Get the number of full months between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full months
*
* @example
* // How many full months are between 31 January 2014 and 1 September 2014?
* var result = differenceInMonths(
* new Date(2014, 8, 1),
* new Date(2014, 0, 31)
* )
* //=> 7
*/
function differenceInMonths (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var sign = compareAsc(dateLeft, dateRight)
var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight))
dateLeft.setMonth(dateLeft.getMonth() - sign * difference)
// Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full
// If so, result must be decreased by 1 in absolute value
var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign
return sign * (difference - isLastMonthNotFull)
}
module.exports = differenceInMonths
/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(16)
/**
* @category Month Helpers
* @summary Get the number of calendar months between the given dates.
*
* @description
* Get the number of calendar months between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar months
*
* @example
* // How many calendar months are between 31 January 2014 and 1 September 2014?
* var result = differenceInCalendarMonths(
* new Date(2014, 8, 1),
* new Date(2014, 0, 31)
* )
* //=> 8
*/
function differenceInCalendarMonths (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear()
var monthDiff = dateLeft.getMonth() - dateRight.getMonth()
return yearDiff * 12 + monthDiff
}
module.exports = differenceInCalendarMonths
/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(16)
/**
* @category Common Helpers
* @summary Compare the two dates and return -1, 0 or 1.
*
* @description
* Compare the two dates and return 1 if the first date is after the second,
* -1 if the first date is before the second or 0 if dates are equal.
*
* @param {Date|String|Number} dateLeft - the first date to compare
* @param {Date|String|Number} dateRight - the second date to compare
* @returns {Number} the result of the comparison
*
* @example
* // Compare 11 February 1987 and 10 July 1989:
* var result = compareAsc(
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* )
* //=> -1
*
* @example
* // Sort the array of dates:
* var result = [
* new Date(1995, 6, 2),
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* ].sort(compareAsc)
* //=> [
* // Wed Feb 11 1987 00:00:00,
* // Mon Jul 10 1989 00:00:00,
* // Sun Jul 02 1995 00:00:00
* // ]
*/
function compareAsc (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var timeLeft = dateLeft.getTime()
var dateRight = parse(dirtyDateRight)
var timeRight = dateRight.getTime()
if (timeLeft < timeRight) {
return -1
} else if (timeLeft > timeRight) {
return 1
} else {
return 0
}
}
module.exports = compareAsc
/***/ }),
/* 193 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(194)
var buildFormatLocale = __webpack_require__(195)
/**
* @category Locales
* @summary English locale.
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 194 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'less than a second',
other: 'less than {{count}} seconds'
},
xSeconds: {
one: '1 second',
other: '{{count}} seconds'
},
halfAMinute: 'half a minute',
lessThanXMinutes: {
one: 'less than a minute',
other: 'less than {{count}} minutes'
},
xMinutes: {
one: '1 minute',
other: '{{count}} minutes'
},
aboutXHours: {
one: 'about 1 hour',
other: 'about {{count}} hours'
},
xHours: {
one: '1 hour',
other: '{{count}} hours'
},
xDays: {
one: '1 day',
other: '{{count}} days'
},
aboutXMonths: {
one: 'about 1 month',
other: 'about {{count}} months'
},
xMonths: {
one: '1 month',
other: '{{count}} months'
},
aboutXYears: {
one: 'about 1 year',
other: 'about {{count}} years'
},
xYears: {
one: '1 year',
other: '{{count}} years'
},
overXYears: {
one: 'over 1 year',
other: 'over {{count}} years'
},
almostXYears: {
one: 'almost 1 year',
other: 'almost {{count}} years'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'in ' + result
} else {
return result + ' ago'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 195 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(196)
function buildFormatLocale () {
// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var months3char = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
var monthsFull = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
var weekdays2char = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
var weekdays3char = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
var weekdaysFull = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var rem100 = number % 100
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + 'st'
case 2:
return number + 'nd'
case 3:
return number + 'rd'
}
}
return number + 'th'
}
module.exports = buildFormatLocale
/***/ }),
/* 196 */
/***/ (function(module, exports) {
var commonFormatterKeys = [
'M', 'MM', 'Q', 'D', 'DD', 'DDD', 'DDDD', 'd',
'E', 'W', 'WW', 'YY', 'YYYY', 'GG', 'GGGG',
'H', 'HH', 'h', 'hh', 'm', 'mm',
's', 'ss', 'S', 'SS', 'SSS',
'Z', 'ZZ', 'X', 'x'
]
function buildFormattingTokensRegExp (formatters) {
var formatterKeys = []
for (var key in formatters) {
if (formatters.hasOwnProperty(key)) {
formatterKeys.push(key)
}
}
var formattingTokens = commonFormatterKeys
.concat(formatterKeys)
.sort()
.reverse()
var formattingTokensRegExp = new RegExp(
'(\\[[^\\[]*\\])|(\\\\)?' + '(' + formattingTokens.join('|') + '|.)', 'g'
)
return formattingTokensRegExp
}
module.exports = buildFormattingTokensRegExp
/***/ }),
/* 197 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: '不到 1 秒',
other: '不到 {{count}} 秒'
},
xSeconds: {
one: '1 秒',
other: '{{count}} 秒'
},
halfAMinute: '半分钟',
lessThanXMinutes: {
one: '不到 1 分钟',
other: '不到 {{count}} 分钟'
},
xMinutes: {
one: '1 分钟',
other: '{{count}} 分钟'
},
xHours: {
one: '1 小时',
other: '{{count}} 小时'
},
aboutXHours: {
one: '大约 1 小时',
other: '大约 {{count}} 小时'
},
xDays: {
one: '1 天',
other: '{{count}} 天'
},
aboutXMonths: {
one: '大约 1 个月',
other: '大约 {{count}} 个月'
},
xMonths: {
one: '1 个月',
other: '{{count}} 个月'
},
aboutXYears: {
one: '大约 1 年',
other: '大约 {{count}} 年'
},
xYears: {
one: '1 年',
other: '{{count}} 年'
},
overXYears: {
one: '超过 1 年',
other: '超过 {{count}} 年'
},
almostXYears: {
one: '将近 1 年',
other: '将近 {{count}} 年'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return result + '内'
} else {
return result + '前'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 198 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: '少於 1 秒',
other: '少於 {{count}} 秒'
},
xSeconds: {
one: '1 秒',
other: '{{count}} 秒'
},
halfAMinute: '半分鐘',
lessThanXMinutes: {
one: '少於 1 分鐘',
other: '少於 {{count}} 分鐘'
},
xMinutes: {
one: '1 分鐘',
other: '{{count}} 分鐘'
},
xHours: {
one: '1 小時',
other: '{{count}} 小時'
},
aboutXHours: {
one: '大約 1 小時',
other: '大約 {{count}} 小時'
},
xDays: {
one: '1 天',
other: '{{count}} 天'
},
aboutXMonths: {
one: '大約 1 個月',
other: '大約 {{count}} 個月'
},
xMonths: {
one: '1 個月',
other: '{{count}} 個月'
},
aboutXYears: {
one: '大約 1 年',
other: '大約 {{count}} 年'
},
xYears: {
one: '1 年',
other: '{{count}} 年'
},
overXYears: {
one: '超過 1 年',
other: '超過 {{count}} 年'
},
almostXYears: {
one: '將近 1 年',
other: '將近 {{count}} 年'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return result + '內'
} else {
return result + '前'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 199 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'menos de un segundo',
other: 'menos de {{count}} segundos'
},
xSeconds: {
one: '1 segundo',
other: '{{count}} segundos'
},
halfAMinute: 'medio minuto',
lessThanXMinutes: {
one: 'menos de un minuto',
other: 'menos de {{count}} minutos'
},
xMinutes: {
one: '1 minuto',
other: '{{count}} minutos'
},
aboutXHours: {
one: 'alrededor de 1 hora',
other: 'alrededor de {{count}} horas'
},
xHours: {
one: '1 hora',
other: '{{count}} horas'
},
xDays: {
one: '1 día',
other: '{{count}} días'
},
aboutXMonths: {
one: 'alrededor de 1 mes',
other: 'alrededor de {{count}} meses'
},
xMonths: {
one: '1 mes',
other: '{{count}} meses'
},
aboutXYears: {
one: 'alrededor de 1 año',
other: 'alrededor de {{count}} años'
},
xYears: {
one: '1 año',
other: '{{count}} años'
},
overXYears: {
one: 'más de 1 año',
other: 'más de {{count}} años'
},
almostXYears: {
one: 'casi 1 año',
other: 'casi {{count}} años'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'en ' + result
} else {
return 'hace ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 200 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'moins d’une seconde',
other: 'moins de {{count}} secondes'
},
xSeconds: {
one: '1 seconde',
other: '{{count}} secondes'
},
halfAMinute: '30 secondes',
lessThanXMinutes: {
one: 'moins d’une minute',
other: 'moins de {{count}} minutes'
},
xMinutes: {
one: '1 minute',
other: '{{count}} minutes'
},
aboutXHours: {
one: 'environ 1 heure',
other: 'environ {{count}} heures'
},
xHours: {
one: '1 heure',
other: '{{count}} heures'
},
xDays: {
one: '1 jour',
other: '{{count}} jours'
},
aboutXMonths: {
one: 'environ 1 mois',
other: 'environ {{count}} mois'
},
xMonths: {
one: '1 mois',
other: '{{count}} mois'
},
aboutXYears: {
one: 'environ 1 an',
other: 'environ {{count}} ans'
},
xYears: {
one: '1 an',
other: '{{count}} ans'
},
overXYears: {
one: 'plus d’un an',
other: 'plus de {{count}} ans'
},
almostXYears: {
one: 'presqu’un an',
other: 'presque {{count}} ans'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'dans ' + result
} else {
return 'il y a ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 201 */
/***/ (function(module, exports) {
function declension (scheme, count) {
// scheme for count=1 exists
if (scheme.one !== undefined && count === 1) {
return scheme.one
}
var rem10 = count % 10
var rem100 = count % 100
// 1, 21, 31, ...
if (rem10 === 1 && rem100 !== 11) {
return scheme.singularNominative.replace('{{count}}', count)
// 2, 3, 4, 22, 23, 24, 32 ...
} else if ((rem10 >= 2 && rem10 <= 4) && (rem100 < 10 || rem100 > 20)) {
return scheme.singularGenitive.replace('{{count}}', count)
// 5, 6, 7, 8, 9, 10, 11, ...
} else {
return scheme.pluralGenitive.replace('{{count}}', count)
}
}
function buildLocalizeTokenFn (scheme) {
return function (count, options) {
if (options.addSuffix) {
if (options.comparison > 0) {
if (scheme.future) {
return declension(scheme.future, count)
} else {
return 'через ' + declension(scheme.regular, count)
}
} else {
if (scheme.past) {
return declension(scheme.past, count)
} else {
return declension(scheme.regular, count) + ' назад'
}
}
} else {
return declension(scheme.regular, count)
}
}
}
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: buildLocalizeTokenFn({
regular: {
one: 'меньше секунды',
singularNominative: 'меньше {{count}} секунды',
singularGenitive: 'меньше {{count}} секунд',
pluralGenitive: 'меньше {{count}} секунд'
},
future: {
one: 'меньше, чем через секунду',
singularNominative: 'меньше, чем через {{count}} секунду',
singularGenitive: 'меньше, чем через {{count}} секунды',
pluralGenitive: 'меньше, чем через {{count}} секунд'
}
}),
xSeconds: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} секунда',
singularGenitive: '{{count}} секунды',
pluralGenitive: '{{count}} секунд'
},
past: {
singularNominative: '{{count}} секунду назад',
singularGenitive: '{{count}} секунды назад',
pluralGenitive: '{{count}} секунд назад'
},
future: {
singularNominative: 'через {{count}} секунду',
singularGenitive: 'через {{count}} секунды',
pluralGenitive: 'через {{count}} секунд'
}
}),
halfAMinute: function (_, options) {
if (options.addSuffix) {
if (options.comparison > 0) {
return 'через полминуты'
} else {
return 'полминуты назад'
}
}
return 'полминуты'
},
lessThanXMinutes: buildLocalizeTokenFn({
regular: {
one: 'меньше минуты',
singularNominative: 'меньше {{count}} минуты',
singularGenitive: 'меньше {{count}} минут',
pluralGenitive: 'меньше {{count}} минут'
},
future: {
one: 'меньше, чем через минуту',
singularNominative: 'меньше, чем через {{count}} минуту',
singularGenitive: 'меньше, чем через {{count}} минуты',
pluralGenitive: 'меньше, чем через {{count}} минут'
}
}),
xMinutes: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} минута',
singularGenitive: '{{count}} минуты',
pluralGenitive: '{{count}} минут'
},
past: {
singularNominative: '{{count}} минуту назад',
singularGenitive: '{{count}} минуты назад',
pluralGenitive: '{{count}} минут назад'
},
future: {
singularNominative: 'через {{count}} минуту',
singularGenitive: 'через {{count}} минуты',
pluralGenitive: 'через {{count}} минут'
}
}),
aboutXHours: buildLocalizeTokenFn({
regular: {
singularNominative: 'около {{count}} часа',
singularGenitive: 'около {{count}} часов',
pluralGenitive: 'около {{count}} часов'
},
future: {
singularNominative: 'приблизительно через {{count}} час',
singularGenitive: 'приблизительно через {{count}} часа',
pluralGenitive: 'приблизительно через {{count}} часов'
}
}),
xHours: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} час',
singularGenitive: '{{count}} часа',
pluralGenitive: '{{count}} часов'
}
}),
xDays: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} день',
singularGenitive: '{{count}} дня',
pluralGenitive: '{{count}} дней'
}
}),
aboutXMonths: buildLocalizeTokenFn({
regular: {
singularNominative: 'около {{count}} месяца',
singularGenitive: 'около {{count}} месяцев',
pluralGenitive: 'около {{count}} месяцев'
},
future: {
singularNominative: 'приблизительно через {{count}} месяц',
singularGenitive: 'приблизительно через {{count}} месяца',
pluralGenitive: 'приблизительно через {{count}} месяцев'
}
}),
xMonths: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} месяц',
singularGenitive: '{{count}} месяца',
pluralGenitive: '{{count}} месяцев'
}
}),
aboutXYears: buildLocalizeTokenFn({
regular: {
singularNominative: 'около {{count}} года',
singularGenitive: 'около {{count}} лет',
pluralGenitive: 'около {{count}} лет'
},
future: {
singularNominative: 'приблизительно через {{count}} год',
singularGenitive: 'приблизительно через {{count}} года',
pluralGenitive: 'приблизительно через {{count}} лет'
}
}),
xYears: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} год',
singularGenitive: '{{count}} года',
pluralGenitive: '{{count}} лет'
}
}),
overXYears: buildLocalizeTokenFn({
regular: {
singularNominative: 'больше {{count}} года',
singularGenitive: 'больше {{count}} лет',
pluralGenitive: 'больше {{count}} лет'
},
future: {
singularNominative: 'больше, чем через {{count}} год',
singularGenitive: 'больше, чем через {{count}} года',
pluralGenitive: 'больше, чем через {{count}} лет'
}
}),
almostXYears: buildLocalizeTokenFn({
regular: {
singularNominative: 'почти {{count}} год',
singularGenitive: 'почти {{count}} года',
pluralGenitive: 'почти {{count}} лет'
},
future: {
singularNominative: 'почти через {{count}} год',
singularGenitive: 'почти через {{count}} года',
pluralGenitive: 'почти через {{count}} лет'
}
})
}
function localize (token, count, options) {
options = options || {}
return distanceInWordsLocale[token](count, options)
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 202 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var GT_ACCESS_TOKEN = exports.GT_ACCESS_TOKEN = 'GT_ACCESS_TOKEN';
var GT_VERSION = exports.GT_VERSION = "1.5.0"; // eslint-disable-line
var GT_COMMENT = exports.GT_COMMENT = 'GT_COMMENT';
/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = __webpack_require__(205);
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _util = __webpack_require__(70);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getQL = function getQL(vars, pagerDirection) {
var cursorDirection = pagerDirection === 'last' ? 'before' : 'after';
var ql = '\n query getIssueAndComments(\n $owner: String!,\n $repo: String!,\n $id: Int!,\n $cursor: String,\n $pageSize: Int!\n ) {\n repository(owner: $owner, name: $repo) {\n issue(number: $id) {\n title\n url\n bodyHTML\n createdAt\n comments(' + pagerDirection + ': $pageSize, ' + cursorDirection + ': $cursor) {\n totalCount\n pageInfo {\n ' + (pagerDirection === 'last' ? 'hasPreviousPage' : 'hasNextPage') + '\n ' + (cursorDirection === 'before' ? 'startCursor' : 'endCursor') + '\n }\n nodes {\n id\n databaseId\n author {\n avatarUrl\n login\n url\n }\n bodyHTML\n body\n createdAt\n reactions(first: 100, content: HEART) {\n totalCount\n viewerHasReacted\n pageInfo{\n hasNextPage\n }\n nodes {\n id\n databaseId\n user {\n login\n }\n }\n }\n }\n }\n }\n }\n }\n ';
if (vars.cursor === null) delete vars.cursor;
return {
operationName: 'getIssueAndComments',
query: ql,
variables: vars
};
};
function getComments(issue) {
var _this = this;
var _options = this.options,
owner = _options.owner,
repo = _options.repo,
perPage = _options.perPage,
pagerDirection = _options.pagerDirection,
defaultAuthor = _options.defaultAuthor;
var _state = this.state,
cursor = _state.cursor,
comments = _state.comments;
return _util.axiosGithub.post('/graphql', getQL({
owner: owner,
repo: repo,
id: issue.number,
pageSize: perPage,
cursor: cursor
}, pagerDirection), {
headers: {
Authorization: 'bearer ' + this.accessToken
}
}).then(function (res) {
var data = res.data.data.repository.issue.comments;
var items = data.nodes.map(function (node) {
var author = node.author || defaultAuthor;
return {
id: node.databaseId,
gId: node.id,
user: {
avatar_url: author.avatarUrl,
login: author.login,
html_url: author.url
},
created_at: node.createdAt,
body_html: node.bodyHTML,
body: node.body,
html_url: 'https://github.com/' + owner + '/' + repo + '/issues/' + issue.number + '#issuecomment-' + node.databaseId,
reactions: node.reactions
};
});
var cs = void 0;
if (pagerDirection === 'last') {
cs = [].concat((0, _toConsumableArray3.default)(items), (0, _toConsumableArray3.default)(comments));
} else {
cs = [].concat((0, _toConsumableArray3.default)(comments), (0, _toConsumableArray3.default)(items));
}
var isLoadOver = data.pageInfo.hasPreviousPage === false || data.pageInfo.hasNextPage === false;
_this.setState({
comments: cs,
isLoadOver: isLoadOver,
cursor: data.pageInfo.startCursor || data.pageInfo.endCursor
});
return cs;
});
}
exports.default = getComments;
/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _from = __webpack_require__(206);
var _from2 = _interopRequireDefault(_from);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
} else {
return (0, _from2.default)(arr);
}
};
/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(207), __esModule: true };
/***/ }),
/* 207 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(17);
__webpack_require__(208);
module.exports = __webpack_require__(0).Array.from;
/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ctx = __webpack_require__(12);
var $export = __webpack_require__(4);
var toObject = __webpack_require__(22);
var call = __webpack_require__(54);
var isArrayIter = __webpack_require__(55);
var toLength = __webpack_require__(33);
var createProperty = __webpack_require__(209);
var getIterFn = __webpack_require__(38);
$export($export.S + $export.F * !__webpack_require__(60)(function (iter) { Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var aLen = arguments.length;
var mapfn = aLen > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var index = 0;
var iterFn = getIterFn(O);
var length, result, step, iterator;
if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
// if object isn't iterable or it's array with default iterator - use simple case
if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
}
} else {
length = toLength(O.length);
for (result = new C(length); length > index; index++) {
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
result.length = index;
return result;
}
});
/***/ }),
/* 209 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $defineProperty = __webpack_require__(6);
var createDesc = __webpack_require__(19);
module.exports = function (object, index, value) {
if (index in object) $defineProperty.f(object, index, createDesc(0, value));
else object[index] = value;
};
/***/ })
/******/ ]);
});
//# sourceMappingURL=gitalk-component.js.map