(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Switch = __webpack_require__(1);
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Switch).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dynamics = __webpack_require__(2);
var _dynamics2 = _interopRequireDefault(_dynamics);
var _d3Interpolate = __webpack_require__(3);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _invariant = __webpack_require__(6);
var _invariant2 = _interopRequireDefault(_invariant);
var _react = __webpack_require__(8);
var _react2 = _interopRequireDefault(_react);
var _Switch = __webpack_require__(44);
var _Switch2 = _interopRequireDefault(_Switch);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Switch = function (_React$Component) {
_inherits(Switch, _React$Component);
function Switch(props) {
_classCallCheck(this, Switch);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Switch).call(this, props));
var offset = _this.getCheckedStateOffset(props);
// During a drag, we track the starting mouse position and the current mouse position.
// This allows us to avoid accumulating deltas, and thus avoid accumulating errors.
_this.state = {
currentClientX: 0,
dragging: false,
offset: offset,
startClientX: 0
};
// The state offset should always eventually match the animated properties offset.
// The component should interact with the state offset, while dynamics should interact with
// the animated properties offset.
_this.animatedProperties = {
offset: offset
};
_this.handleAnimationChange = _this.handleAnimationChange.bind(_this);
_this.handleClick = _this.handleClick.bind(_this);
_this.handleHandleClick = _this.handleHandleClick.bind(_this);
_this.handleInputChange = _this.handleInputChange.bind(_this);
_this.handleMouseDown = _this.handleMouseDown.bind(_this);
_this.handleMouseMove = _this.handleMouseMove.bind(_this);
_this.handleMouseUp = _this.handleMouseUp.bind(_this);
return _this;
}
_createClass(Switch, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
// Assume the props change occurred because the checked state changed. Animate back to the
// rest state.
this.startAnimation(nextProps);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var dragging = this.state.dragging;
this.cancelAnimation();
if (dragging) {
this.removeListeners();
}
}
// We should be able to compute the offset from the checked state.
}, {
key: 'getCheckedStateOffset',
value: function getCheckedStateOffset(props) {
var checked = props.checked;
var maxOffset = props.maxOffset;
return checked ? maxOffset : 0;
}
}, {
key: 'addListeners',
value: function addListeners() {
document.addEventListener('mousemove', this.handleMouseMove);
document.addEventListener('mouseup', this.handleMouseUp);
}
}, {
key: 'cancelAnimation',
value: function cancelAnimation() {
_dynamics2.default.stop(this.animatedProperties);
}
}, {
key: 'handleAnimationChange',
value: function handleAnimationChange() {
this.setState({
offset: this.animatedProperties.offset
});
}
}, {
key: 'handleClick',
value: function handleClick(e) {
var _props = this.props;
var checked = _props.checked;
var onChange = _props.onChange;
// Prevent the outer label from receiving the event.
e.preventDefault();
onChange(!checked);
}
// If a click event occurs on the handle, drop the event. The mouseup handler will decide
// whether to consider the mouseup event a "click to toggle" interaction or a "drag end"
// interaction.
}, {
key: 'handleHandleClick',
value: function handleHandleClick(e) {
// Prevent the outer label from receiving the event.
e.preventDefault();
// Prevent the switch click handler from receiving the event.
e.stopPropagation();
}
// If there is an outer label, and it is clicked, the input receives a click event and a change
// event. Because we use the click event to set the checked state (the click event propagates to
// the switch), we can ignore the change event.
}, {
key: 'handleInputChange',
value: function handleInputChange() {}
}, {
key: 'handleMouseDown',
value: function handleMouseDown(e) {
var dragging = this.state.dragging;
(0, _invariant2.default)(!dragging, 'Mouse down handler called inside of a drag');
// Left click only
if (e.button !== 0) {
return;
}
this.cancelAnimation();
this.setState({
currentClientX: e.clientX,
dragging: true,
startClientX: e.clientX
});
// While the drag is ongoing, we set document-level event handlers to capture mousemove and
// mouseup. This way, the drag doesn't end if the user mouses off the handle. These event
// handlers are expensive and global, so we need to make sure we remove them when the drag ends.
this.addListeners();
}
}, {
key: 'handleMouseMove',
value: function handleMouseMove(e) {
var dragging = this.state.dragging;
(0, _invariant2.default)(dragging, 'Mouse move handler called outside of a drag');
this.setState({
currentClientX: e.clientX
});
}
}, {
key: 'handleMouseUp',
value: function handleMouseUp() {
var _props2 = this.props;
var checked = _props2.checked;
var maxOffset = _props2.maxOffset;
var onChange = _props2.onChange;
var _state = this.state;
var currentClientX = _state.currentClientX;
var dragging = _state.dragging;
var offset = _state.offset;
var startClientX = _state.startClientX;
(0, _invariant2.default)(dragging, 'Mouse up handler called outside of a drag');
this.removeListeners();
// If the mouse hasn't changed position by the end of a drag, treat it as a click on the handle.
var deltaX = currentClientX - startClientX;
if (!deltaX) {
this.setState({
dragging: false
});
onChange(!checked);
return;
}
// The checked state is a function of the mouse offset.
var newOffset = offset + deltaX;
var newChecked = newOffset > maxOffset / 2;
this.setState({
dragging: false,
offset: newOffset
});
onChange(newChecked);
}
}, {
key: 'removeListeners',
value: function removeListeners() {
document.removeEventListener('mousemove', this.handleMouseMove);
document.removeEventListener('mouseup', this.handleMouseUp);
}
}, {
key: 'startAnimation',
value: function startAnimation(props) {
var offset = this.state.offset;
this.animatedProperties.offset = offset;
// Note that spring animation always results in a bounce at the end. Choose parameters to
// minimize this bounce.
_dynamics2.default.animate(this.animatedProperties, {
offset: this.getCheckedStateOffset(props)
}, {
change: this.handleAnimationChange,
frequency: 200,
friction: 400,
type: _dynamics2.default.spring
});
}
}, {
key: 'render',
value: function render() {
var _props3 = this.props;
var checked = _props3.checked;
var className = _props3.className;
var disabled = _props3.disabled;
var handleColor = _props3.handleColor;
var maxOffset = _props3.maxOffset;
var offColor = _props3.offColor;
var onColor = _props3.onColor;
var pendingOffColor = _props3.pendingOffColor;
var _state2 = this.state;
var currentClientX = _state2.currentClientX;
var dragging = _state2.dragging;
var offset = _state2.offset;
var startClientX = _state2.startClientX;
// The handle position is a function of the mouse offset.
var deltaX = dragging ? currentClientX - startClientX : 0;
var clampedOffset = Math.min(maxOffset, Math.max(0, offset + deltaX));
var handleTransform = 'translateX(' + clampedOffset + 'px)';
// The interpolation parameter is a function of the mouse offset.
var t = clampedOffset / maxOffset;
// The switch color is a function of the interpolation parameter.
var color = (0, _d3Interpolate.interpolate)(pendingOffColor, onColor)(t);
// The off state size is a function of the interpolation parameter.
var offStateTransform = 'scale(' + (1 - t) + ')';
return _react2.default.createElement(
'div',
{
className: (0, _classnames2.default)(_Switch2.default.switch, disabled && _Switch2.default['switch--disabled'], className),
onClick: this.handleClick,
style: {
backgroundColor: color
}
},
_react2.default.createElement('div', {
className: _Switch2.default.offState,
style: {
backgroundColor: offColor,
msTransform: offStateTransform,
transform: offStateTransform,
WebkitTransform: offStateTransform
}
}),
_react2.default.createElement('div', {
className: _Switch2.default.handle,
onClick: this.handleHandleClick,
onMouseDown: !disabled && this.handleMouseDown,
style: {
backgroundColor: handleColor,
msTransform: handleTransform,
transform: handleTransform,
WebkitTransform: handleTransform
}
}),
_react2.default.createElement('input', {
className: _Switch2.default.input,
checked: checked,
disabled: disabled,
onChange: this.handleInputChange,
type: 'checkbox'
})
);
}
}]);
return Switch;
}(_react2.default.Component);
Switch.defaultProps = {
disabled: false,
handleColor: 'white',
maxOffset: 20,
offColor: 'white',
onColor: '#4cd964',
pendingOffColor: '#e5e5e5'
};
exports.default = Switch;
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;// Generated by CoffeeScript 1.7.1
(function() {
var Color, DecomposedMatrix, DecomposedMatrix2D, InterpolableArray, InterpolableColor, InterpolableObject, InterpolableWithUnit, Matrix, Matrix2D, Set, Vector, addTimeout, animationTick, animations, animationsTimeouts, applyDefaults, applyFrame, applyProperties, baseSVG, cacheFn, cancelTimeout, clone, createInterpolable, defaultValueForKey, degProperties, dynamics, getCurrentProperties, interpolate, isDocumentVisible, isSVGElement, lastTime, leftDelayForTimeout, makeArrayFn, observeVisibilityChange, parseProperties, prefixFor, propertyWithPrefix, pxProperties, rAF, roundf, runLoopPaused, runLoopRunning, runLoopTick, setRealTimeout, slow, slowRatio, startAnimation, startRunLoop, svgProperties, timeBeforeVisibilityChange, timeoutLastId, timeouts, toDashed, transformProperties, transformValueForProperty, unitForProperty,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
isDocumentVisible = function() {
return document.visibilityState === "visible" || (dynamics.tests != null);
};
observeVisibilityChange = (function() {
var fns;
fns = [];
if (typeof document !== "undefined" && document !== null) {
document.addEventListener("visibilitychange", function() {
var fn, _i, _len, _results;
_results = [];
for (_i = 0, _len = fns.length; _i < _len; _i++) {
fn = fns[_i];
_results.push(fn(isDocumentVisible()));
}
return _results;
});
}
return function(fn) {
return fns.push(fn);
};
})();
clone = function(o) {
var k, newO, v;
newO = {};
for (k in o) {
v = o[k];
newO[k] = v;
}
return newO;
};
cacheFn = function(func) {
var data;
data = {};
return function() {
var k, key, result, _i, _len;
key = "";
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
k = arguments[_i];
key += k.toString() + ",";
}
result = data[key];
if (!result) {
data[key] = result = func.apply(this, arguments);
}
return result;
};
};
makeArrayFn = function(fn) {
return function(el) {
var args, i, res;
if (el instanceof Array || el instanceof NodeList || el instanceof HTMLCollection) {
res = (function() {
var _i, _ref, _results;
_results = [];
for (i = _i = 0, _ref = el.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
args = Array.prototype.slice.call(arguments, 1);
args.splice(0, 0, el[i]);
_results.push(fn.apply(this, args));
}
return _results;
}).apply(this, arguments);
return res;
}
return fn.apply(this, arguments);
};
};
applyDefaults = function(options, defaults) {
var k, v, _results;
_results = [];
for (k in defaults) {
v = defaults[k];
_results.push(options[k] != null ? options[k] : options[k] = v);
}
return _results;
};
applyFrame = function(el, properties) {
var k, v, _results;
if ((el.style != null)) {
return applyProperties(el, properties);
} else {
_results = [];
for (k in properties) {
v = properties[k];
_results.push(el[k] = v.format());
}
return _results;
}
};
applyProperties = function(el, properties) {
var isSVG, k, matrix, transforms, v;
properties = parseProperties(properties);
transforms = [];
isSVG = isSVGElement(el);
for (k in properties) {
v = properties[k];
if (transformProperties.contains(k)) {
transforms.push([k, v]);
} else {
if (v.format != null) {
v = v.format();
} else {
v = "" + v + (unitForProperty(k, v));
}
if (isSVG && svgProperties.contains(k)) {
el.setAttribute(k, v);
} else {
el.style[propertyWithPrefix(k)] = v;
}
}
}
if (transforms.length > 0) {
if (isSVG) {
matrix = new Matrix2D();
matrix.applyProperties(transforms);
return el.setAttribute("transform", matrix.decompose().format());
} else {
v = (transforms.map(function(transform) {
return transformValueForProperty(transform[0], transform[1]);
})).join(" ");
return el.style[propertyWithPrefix("transform")] = v;
}
}
};
isSVGElement = function(el) {
var _ref, _ref1;
if ((typeof SVGElement !== "undefined" && SVGElement !== null) && (typeof SVGSVGElement !== "undefined" && SVGSVGElement !== null)) {
return el instanceof SVGElement && !(el instanceof SVGSVGElement);
} else {
return (_ref = (_ref1 = dynamics.tests) != null ? typeof _ref1.isSVG === "function" ? _ref1.isSVG(el) : void 0 : void 0) != null ? _ref : false;
}
};
roundf = function(v, decimal) {
var d;
d = Math.pow(10, decimal);
return Math.round(v * d) / d;
};
Set = (function() {
function Set(array) {
var v, _i, _len;
this.obj = {};
for (_i = 0, _len = array.length; _i < _len; _i++) {
v = array[_i];
this.obj[v] = 1;
}
}
Set.prototype.contains = function(v) {
return this.obj[v] === 1;
};
return Set;
})();
toDashed = function(str) {
return str.replace(/([A-Z])/g, function($1) {
return "-" + $1.toLowerCase();
});
};
pxProperties = new Set('marginTop,marginLeft,marginBottom,marginRight,paddingTop,paddingLeft,paddingBottom,paddingRight,top,left,bottom,right,translateX,translateY,translateZ,perspectiveX,perspectiveY,perspectiveZ,width,height,maxWidth,maxHeight,minWidth,minHeight,borderRadius'.split(','));
degProperties = new Set('rotate,rotateX,rotateY,rotateZ,skew,skewX,skewY,skewZ'.split(','));
transformProperties = new Set('translate,translateX,translateY,translateZ,scale,scaleX,scaleY,scaleZ,rotate,rotateX,rotateY,rotateZ,rotateC,rotateCX,rotateCY,skew,skewX,skewY,skewZ,perspective'.split(','));
svgProperties = new Set('accent-height,ascent,azimuth,baseFrequency,baseline-shift,bias,cx,cy,d,diffuseConstant,divisor,dx,dy,elevation,filterRes,fx,fy,gradientTransform,height,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,letter-spacing,limitingConeAngle,markerHeight,markerWidth,numOctaves,order,overline-position,overline-thickness,pathLength,points,pointsAtX,pointsAtY,pointsAtZ,r,radius,rx,ry,seed,specularConstant,specularExponent,stdDeviation,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,surfaceScale,target,targetX,targetY,transform,underline-position,underline-thickness,viewBox,width,x,x1,x2,y,y1,y2,z'.split(','));
unitForProperty = function(k, v) {
if (typeof v !== 'number') {
return '';
}
if (pxProperties.contains(k)) {
return 'px';
} else if (degProperties.contains(k)) {
return 'deg';
}
return '';
};
transformValueForProperty = function(k, v) {
var match, unit;
match = ("" + v).match(/^([0-9.-]*)([^0-9]*)$/);
if (match != null) {
v = match[1];
unit = match[2];
} else {
v = parseFloat(v);
}
v = roundf(parseFloat(v), 10);
if ((unit == null) || unit === "") {
unit = unitForProperty(k, v);
}
return "" + k + "(" + v + unit + ")";
};
parseProperties = function(properties) {
var axis, match, parsed, property, value, _i, _len, _ref;
parsed = {};
for (property in properties) {
value = properties[property];
if (transformProperties.contains(property)) {
match = property.match(/(translate|rotateC|rotate|skew|scale|perspective)(X|Y|Z|)/);
if (match && match[2].length > 0) {
parsed[property] = value;
} else {
_ref = ['X', 'Y', 'Z'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
axis = _ref[_i];
parsed[match[1] + axis] = value;
}
}
} else {
parsed[property] = value;
}
}
return parsed;
};
defaultValueForKey = function(key) {
var v;
v = key === 'opacity' ? 1 : 0;
return "" + v + (unitForProperty(key, v));
};
getCurrentProperties = function(el, keys) {
var isSVG, key, matrix, properties, style, v, _i, _j, _len, _len1, _ref;
properties = {};
isSVG = isSVGElement(el);
if (el.style != null) {
style = window.getComputedStyle(el, null);
for (_i = 0, _len = keys.length; _i < _len; _i++) {
key = keys[_i];
if (transformProperties.contains(key)) {
if (properties['transform'] == null) {
if (isSVG) {
matrix = new Matrix2D((_ref = el.transform.baseVal.consolidate()) != null ? _ref.matrix : void 0);
} else {
matrix = Matrix.fromTransform(style[propertyWithPrefix('transform')]);
}
properties['transform'] = matrix.decompose();
}
} else {
v = style[key];
if ((v == null) && svgProperties.contains(key)) {
v = el.getAttribute(key);
}
if (v === "" || (v == null)) {
v = defaultValueForKey(key);
}
properties[key] = createInterpolable(v);
}
}
} else {
for (_j = 0, _len1 = keys.length; _j < _len1; _j++) {
key = keys[_j];
properties[key] = createInterpolable(el[key]);
}
}
return properties;
};
createInterpolable = function(value) {
var interpolable, klass, klasses, _i, _len;
klasses = [InterpolableColor, InterpolableArray, InterpolableObject, InterpolableWithUnit];
for (_i = 0, _len = klasses.length; _i < _len; _i++) {
klass = klasses[_i];
interpolable = klass.create(value);
if (interpolable != null) {
return interpolable;
}
}
return null;
};
InterpolableObject = (function() {
function InterpolableObject(obj) {
this.format = __bind(this.format, this);
this.interpolate = __bind(this.interpolate, this);
this.obj = obj;
}
InterpolableObject.prototype.interpolate = function(endInterpolable, t) {
var end, k, newObj, start, v;
start = this.obj;
end = endInterpolable.obj;
newObj = {};
for (k in start) {
v = start[k];
if (v.interpolate != null) {
newObj[k] = v.interpolate(end[k], t);
} else {
newObj[k] = v;
}
}
return new InterpolableObject(newObj);
};
InterpolableObject.prototype.format = function() {
return this.obj;
};
InterpolableObject.create = function(value) {
var k, obj, v;
if (value instanceof Object) {
obj = {};
for (k in value) {
v = value[k];
obj[k] = createInterpolable(v);
}
return new InterpolableObject(obj);
}
return null;
};
return InterpolableObject;
})();
InterpolableWithUnit = (function() {
function InterpolableWithUnit(value, prefix, suffix) {
this.prefix = prefix;
this.suffix = suffix;
this.format = __bind(this.format, this);
this.interpolate = __bind(this.interpolate, this);
this.value = parseFloat(value);
}
InterpolableWithUnit.prototype.interpolate = function(endInterpolable, t) {
var end, start;
start = this.value;
end = endInterpolable.value;
return new InterpolableWithUnit((end - start) * t + start, endInterpolable.prefix || this.prefix, endInterpolable.suffix || this.suffix);
};
InterpolableWithUnit.prototype.format = function() {
if ((this.prefix == null) && (this.suffix == null)) {
return roundf(this.value, 5);
}
return this.prefix + roundf(this.value, 5) + this.suffix;
};
InterpolableWithUnit.create = function(value) {
var match;
if (typeof value !== "string") {
return new InterpolableWithUnit(value);
}
match = ("" + value).match("([^0-9.+-]*)([0-9.+-]+)([^0-9.+-]*)");
if (match != null) {
return new InterpolableWithUnit(match[2], match[1], match[3]);
}
return null;
};
return InterpolableWithUnit;
})();
InterpolableArray = (function() {
function InterpolableArray(values, sep) {
this.values = values;
this.sep = sep;
this.format = __bind(this.format, this);
this.interpolate = __bind(this.interpolate, this);
}
InterpolableArray.prototype.interpolate = function(endInterpolable, t) {
var end, i, newValues, start, _i, _ref;
start = this.values;
end = endInterpolable.values;
newValues = [];
for (i = _i = 0, _ref = Math.min(start.length, end.length); 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
if (start[i].interpolate != null) {
newValues.push(start[i].interpolate(end[i], t));
} else {
newValues.push(start[i]);
}
}
return new InterpolableArray(newValues, this.sep);
};
InterpolableArray.prototype.format = function() {
var values;
values = this.values.map(function(val) {
if (val.format != null) {
return val.format();
} else {
return val;
}
});
if (this.sep != null) {
return values.join(this.sep);
} else {
return values;
}
};
InterpolableArray.createFromArray = function(arr, sep) {
var values;
values = arr.map(function(val) {
return createInterpolable(val) || val;
});
values = values.filter(function(val) {
return val != null;
});
return new InterpolableArray(values, sep);
};
InterpolableArray.create = function(value) {
var arr, sep, seps, _i, _len;
if (value instanceof Array) {
return InterpolableArray.createFromArray(value, null);
}
if (typeof value !== "string") {
return;
}
seps = [' ', ',', '|', ';', '/', ':'];
for (_i = 0, _len = seps.length; _i < _len; _i++) {
sep = seps[_i];
arr = value.split(sep);
if (arr.length > 1) {
return InterpolableArray.createFromArray(arr, sep);
}
}
return null;
};
return InterpolableArray;
})();
Color = (function() {
function Color(rgb, format) {
this.rgb = rgb != null ? rgb : {};
this.format = format;
this.toRgba = __bind(this.toRgba, this);
this.toRgb = __bind(this.toRgb, this);
this.toHex = __bind(this.toHex, this);
}
Color.fromHex = function(hex) {
var hex3, result;
hex3 = hex.match(/^#([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i);
if (hex3 != null) {
hex = "#" + hex3[1] + hex3[1] + hex3[2] + hex3[2] + hex3[3] + hex3[3];
}
result = hex.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);
if (result != null) {
return new Color({
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
a: 1
}, "hex");
}
return null;
};
Color.fromRgb = function(rgb) {
var match, _ref;
match = rgb.match(/^rgba?\(([0-9.]*), ?([0-9.]*), ?([0-9.]*)(?:, ?([0-9.]*))?\)$/);
if (match != null) {
return new Color({
r: parseFloat(match[1]),
g: parseFloat(match[2]),
b: parseFloat(match[3]),
a: parseFloat((_ref = match[4]) != null ? _ref : 1)
}, match[4] != null ? "rgba" : "rgb");
}
return null;
};
Color.componentToHex = function(c) {
var hex;
hex = c.toString(16);
if (hex.length === 1) {
return "0" + hex;
} else {
return hex;
}
};
Color.prototype.toHex = function() {
return "#" + Color.componentToHex(this.rgb.r) + Color.componentToHex(this.rgb.g) + Color.componentToHex(this.rgb.b);
};
Color.prototype.toRgb = function() {
return "rgb(" + this.rgb.r + ", " + this.rgb.g + ", " + this.rgb.b + ")";
};
Color.prototype.toRgba = function() {
return "rgba(" + this.rgb.r + ", " + this.rgb.g + ", " + this.rgb.b + ", " + this.rgb.a + ")";
};
return Color;
})();
InterpolableColor = (function() {
function InterpolableColor(color) {
this.color = color;
this.format = __bind(this.format, this);
this.interpolate = __bind(this.interpolate, this);
}
InterpolableColor.prototype.interpolate = function(endInterpolable, t) {
var end, k, rgb, start, v, _i, _len, _ref;
start = this.color;
end = endInterpolable.color;
rgb = {};
_ref = ['r', 'g', 'b'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
v = Math.round((end.rgb[k] - start.rgb[k]) * t + start.rgb[k]);
rgb[k] = Math.min(255, Math.max(0, v));
}
k = "a";
v = roundf((end.rgb[k] - start.rgb[k]) * t + start.rgb[k], 5);
rgb[k] = Math.min(1, Math.max(0, v));
return new InterpolableColor(new Color(rgb, end.format));
};
InterpolableColor.prototype.format = function() {
if (this.color.format === "hex") {
return this.color.toHex();
} else if (this.color.format === "rgb") {
return this.color.toRgb();
} else if (this.color.format === "rgba") {
return this.color.toRgba();
}
};
InterpolableColor.create = function(value) {
var color;
if (typeof value !== "string") {
return;
}
color = Color.fromHex(value) || Color.fromRgb(value);
if (color != null) {
return new InterpolableColor(color);
}
return null;
};
return InterpolableColor;
})();
DecomposedMatrix2D = (function() {
function DecomposedMatrix2D(props) {
this.props = props;
this.applyRotateCenter = __bind(this.applyRotateCenter, this);
this.format = __bind(this.format, this);
this.interpolate = __bind(this.interpolate, this);
}
DecomposedMatrix2D.prototype.interpolate = function(endMatrix, t) {
var i, k, newProps, _i, _j, _k, _l, _len, _len1, _ref, _ref1, _ref2;
newProps = {};
_ref = ['translate', 'scale', 'rotate'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
newProps[k] = [];
for (i = _j = 0, _ref1 = this.props[k].length; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
newProps[k][i] = (endMatrix.props[k][i] - this.props[k][i]) * t + this.props[k][i];
}
}
for (i = _k = 1; _k <= 2; i = ++_k) {
newProps['rotate'][i] = endMatrix.props['rotate'][i];
}
_ref2 = ['skew'];
for (_l = 0, _len1 = _ref2.length; _l < _len1; _l++) {
k = _ref2[_l];
newProps[k] = (endMatrix.props[k] - this.props[k]) * t + this.props[k];
}
return new DecomposedMatrix2D(newProps);
};
DecomposedMatrix2D.prototype.format = function() {
return "translate(" + (this.props.translate.join(',')) + ") rotate(" + (this.props.rotate.join(',')) + ") skewX(" + this.props.skew + ") scale(" + (this.props.scale.join(',')) + ")";
};
DecomposedMatrix2D.prototype.applyRotateCenter = function(rotateC) {
var i, m, m2d, negativeTranslate, _i, _results;
m = baseSVG.createSVGMatrix();
m = m.translate(rotateC[0], rotateC[1]);
m = m.rotate(this.props.rotate[0]);
m = m.translate(-rotateC[0], -rotateC[1]);
m2d = new Matrix2D(m);
negativeTranslate = m2d.decompose().props.translate;
_results = [];
for (i = _i = 0; _i <= 1; i = ++_i) {
_results.push(this.props.translate[i] -= negativeTranslate[i]);
}
return _results;
};
return DecomposedMatrix2D;
})();
baseSVG = typeof document !== "undefined" && document !== null ? document.createElementNS("http://www.w3.org/2000/svg", "svg") : void 0;
Matrix2D = (function() {
function Matrix2D(m) {
this.m = m;
this.applyProperties = __bind(this.applyProperties, this);
this.decompose = __bind(this.decompose, this);
if (!this.m) {
this.m = baseSVG.createSVGMatrix();
}
}
Matrix2D.prototype.decompose = function() {
var kx, ky, kz, r0, r1;
r0 = new Vector([this.m.a, this.m.b]);
r1 = new Vector([this.m.c, this.m.d]);
kx = r0.length();
kz = r0.dot(r1);
r0 = r0.normalize();
ky = r1.combine(r0, 1, -kz).length();
return new DecomposedMatrix2D({
translate: [this.m.e, this.m.f],
rotate: [Math.atan2(this.m.b, this.m.a) * 180 / Math.PI, this.rotateCX, this.rotateCY],
scale: [kx, ky],
skew: kz / ky * 180 / Math.PI
});
};
Matrix2D.prototype.applyProperties = function(properties) {
var hash, k, props, v, _i, _len, _ref, _ref1;
hash = {};
for (_i = 0, _len = properties.length; _i < _len; _i++) {
props = properties[_i];
hash[props[0]] = props[1];
}
for (k in hash) {
v = hash[k];
if (k === "translateX") {
this.m = this.m.translate(v, 0);
} else if (k === "translateY") {
this.m = this.m.translate(0, v);
} else if (k === "scaleX") {
this.m = this.m.scale(v, 1);
} else if (k === "scaleY") {
this.m = this.m.scale(1, v);
} else if (k === "rotateZ") {
this.m = this.m.rotate(v);
} else if (k === "skewX") {
this.m = this.m.skewX(v);
} else if (k === "skewY") {
this.m = this.m.skewY(v);
}
}
this.rotateCX = (_ref = hash.rotateCX) != null ? _ref : 0;
return this.rotateCY = (_ref1 = hash.rotateCY) != null ? _ref1 : 0;
};
return Matrix2D;
})();
Vector = (function() {
function Vector(els) {
this.els = els;
this.combine = __bind(this.combine, this);
this.normalize = __bind(this.normalize, this);
this.length = __bind(this.length, this);
this.cross = __bind(this.cross, this);
this.dot = __bind(this.dot, this);
this.e = __bind(this.e, this);
}
Vector.prototype.e = function(i) {
if (i < 1 || i > this.els.length) {
return null;
} else {
return this.els[i - 1];
}
};
Vector.prototype.dot = function(vector) {
var V, n, product;
V = vector.els || vector;
product = 0;
n = this.els.length;
if (n !== V.length) {
return null;
}
n += 1;
while (--n) {
product += this.els[n - 1] * V[n - 1];
}
return product;
};
Vector.prototype.cross = function(vector) {
var A, B;
B = vector.els || vector;
if (this.els.length !== 3 || B.length !== 3) {
return null;
}
A = this.els;
return new Vector([(A[1] * B[2]) - (A[2] * B[1]), (A[2] * B[0]) - (A[0] * B[2]), (A[0] * B[1]) - (A[1] * B[0])]);
};
Vector.prototype.length = function() {
var a, e, _i, _len, _ref;
a = 0;
_ref = this.els;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
e = _ref[_i];
a += Math.pow(e, 2);
}
return Math.sqrt(a);
};
Vector.prototype.normalize = function() {
var e, i, length, newElements, _ref;
length = this.length();
newElements = [];
_ref = this.els;
for (i in _ref) {
e = _ref[i];
newElements[i] = e / length;
}
return new Vector(newElements);
};
Vector.prototype.combine = function(b, ascl, bscl) {
var i, result, _i, _ref;
result = [];
for (i = _i = 0, _ref = this.els.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
result[i] = (ascl * this.els[i]) + (bscl * b.els[i]);
}
return new Vector(result);
};
return Vector;
})();
DecomposedMatrix = (function() {
function DecomposedMatrix() {
this.toMatrix = __bind(this.toMatrix, this);
this.format = __bind(this.format, this);
this.interpolate = __bind(this.interpolate, this);
}
DecomposedMatrix.prototype.interpolate = function(decomposedB, t, only) {
var angle, decomposed, decomposedA, i, invscale, invth, k, qa, qb, scale, th, _i, _j, _k, _l, _len, _ref, _ref1;
if (only == null) {
only = null;
}
decomposedA = this;
decomposed = new DecomposedMatrix;
_ref = ['translate', 'scale', 'skew', 'perspective'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
k = _ref[_i];
decomposed[k] = [];
for (i = _j = 0, _ref1 = decomposedA[k].length - 1; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
if ((only == null) || only.indexOf(k) > -1 || only.indexOf("" + k + ['x', 'y', 'z'][i]) > -1) {
decomposed[k][i] = (decomposedB[k][i] - decomposedA[k][i]) * t + decomposedA[k][i];
} else {
decomposed[k][i] = decomposedA[k][i];
}
}
}
if ((only == null) || only.indexOf('rotate') !== -1) {
qa = decomposedA.quaternion;
qb = decomposedB.quaternion;
angle = qa[0] * qb[0] + qa[1] * qb[1] + qa[2] * qb[2] + qa[3] * qb[3];
if (angle < 0.0) {
for (i = _k = 0; _k <= 3; i = ++_k) {
qa[i] = -qa[i];
}
angle = -angle;
}
if (angle + 1.0 > .05) {
if (1.0 - angle >= .05) {
th = Math.acos(angle);
invth = 1.0 / Math.sin(th);
scale = Math.sin(th * (1.0 - t)) * invth;
invscale = Math.sin(th * t) * invth;
} else {
scale = 1.0 - t;
invscale = t;
}
} else {
qb[0] = -qa[1];
qb[1] = qa[0];
qb[2] = -qa[3];
qb[3] = qa[2];
scale = Math.sin(piDouble * (.5 - t));
invscale = Math.sin(piDouble * t);
}
decomposed.quaternion = [];
for (i = _l = 0; _l <= 3; i = ++_l) {
decomposed.quaternion[i] = qa[i] * scale + qb[i] * invscale;
}
} else {
decomposed.quaternion = decomposedA.quaternion;
}
return decomposed;
};
DecomposedMatrix.prototype.format = function() {
return this.toMatrix().toString();
};
DecomposedMatrix.prototype.toMatrix = function() {
var decomposedMatrix, i, j, match, matrix, quaternion, skew, temp, w, x, y, z, _i, _j, _k, _l;
decomposedMatrix = this;
matrix = Matrix.I(4);
for (i = _i = 0; _i <= 3; i = ++_i) {
matrix.els[i][3] = decomposedMatrix.perspective[i];
}
quaternion = decomposedMatrix.quaternion;
x = quaternion[0];
y = quaternion[1];
z = quaternion[2];
w = quaternion[3];
skew = decomposedMatrix.skew;
match = [[1, 0], [2, 0], [2, 1]];
for (i = _j = 2; _j >= 0; i = --_j) {
if (skew[i]) {
temp = Matrix.I(4);
temp.els[match[i][0]][match[i][1]] = skew[i];
matrix = matrix.multiply(temp);
}
}
matrix = matrix.multiply(new Matrix([[1 - 2 * (y * y + z * z), 2 * (x * y - z * w), 2 * (x * z + y * w), 0], [2 * (x * y + z * w), 1 - 2 * (x * x + z * z), 2 * (y * z - x * w), 0], [2 * (x * z - y * w), 2 * (y * z + x * w), 1 - 2 * (x * x + y * y), 0], [0, 0, 0, 1]]));
for (i = _k = 0; _k <= 2; i = ++_k) {
for (j = _l = 0; _l <= 2; j = ++_l) {
matrix.els[i][j] *= decomposedMatrix.scale[i];
}
matrix.els[3][i] = decomposedMatrix.translate[i];
}
return matrix;
};
return DecomposedMatrix;
})();
Matrix = (function() {
function Matrix(els) {
this.els = els;
this.toString = __bind(this.toString, this);
this.decompose = __bind(this.decompose, this);
this.inverse = __bind(this.inverse, this);
this.augment = __bind(this.augment, this);
this.toRightTriangular = __bind(this.toRightTriangular, this);
this.transpose = __bind(this.transpose, this);
this.multiply = __bind(this.multiply, this);
this.dup = __bind(this.dup, this);
this.e = __bind(this.e, this);
}
Matrix.prototype.e = function(i, j) {
if (i < 1 || i > this.els.length || j < 1 || j > this.els[0].length) {
return null;
}
return this.els[i - 1][j - 1];
};
Matrix.prototype.dup = function() {
return new Matrix(this.els);
};
Matrix.prototype.multiply = function(matrix) {
var M, c, cols, elements, i, j, ki, kj, nc, ni, nj, returnVector, sum;
returnVector = matrix.modulus ? true : false;
M = matrix.els || matrix;
if (typeof M[0][0] === 'undefined') {
M = new Matrix(M).els;
}
ni = this.els.length;
ki = ni;
kj = M[0].length;
cols = this.els[0].length;
elements = [];
ni += 1;
while (--ni) {
i = ki - ni;
elements[i] = [];
nj = kj;
nj += 1;
while (--nj) {
j = kj - nj;
sum = 0;
nc = cols;
nc += 1;
while (--nc) {
c = cols - nc;
sum += this.els[i][c] * M[c][j];
}
elements[i][j] = sum;
}
}
M = new Matrix(elements);
if (returnVector) {
return M.col(1);
} else {
return M;
}
};
Matrix.prototype.transpose = function() {
var cols, elements, i, j, ni, nj, rows;
rows = this.els.length;
cols = this.els[0].length;
elements = [];
ni = cols;
ni += 1;
while (--ni) {
i = cols - ni;
elements[i] = [];
nj = rows;
nj += 1;
while (--nj) {
j = rows - nj;
elements[i][j] = this.els[j][i];
}
}
return new Matrix(elements);
};
Matrix.prototype.toRightTriangular = function() {
var M, els, i, j, k, kp, multiplier, n, np, p, _i, _j, _ref, _ref1;
M = this.dup();
n = this.els.length;
k = n;
kp = this.els[0].length;
while (--n) {
i = k - n;
if (M.els[i][i] === 0) {
for (j = _i = _ref = i + 1; _ref <= k ? _i < k : _i > k; j = _ref <= k ? ++_i : --_i) {
if (M.els[j][i] !== 0) {
els = [];
np = kp;
np += 1;
while (--np) {
p = kp - np;
els.push(M.els[i][p] + M.els[j][p]);
}
M.els[i] = els;
break;
}
}
}
if (M.els[i][i] !== 0) {
for (j = _j = _ref1 = i + 1; _ref1 <= k ? _j < k : _j > k; j = _ref1 <= k ? ++_j : --_j) {
multiplier = M.els[j][i] / M.els[i][i];
els = [];
np = kp;
np += 1;
while (--np) {
p = kp - np;
els.push(p <= i ? 0 : M.els[j][p] - M.els[i][p] * multiplier);
}
M.els[j] = els;
}
}
}
return M;
};
Matrix.prototype.augment = function(matrix) {
var M, T, cols, i, j, ki, kj, ni, nj;
M = matrix.els || matrix;
if (typeof M[0][0] === 'undefined') {
M = new Matrix(M).els;
}
T = this.dup();
cols = T.els[0].length;
ni = T.els.length;
ki = ni;
kj = M[0].length;
if (ni !== M.length) {
return null;
}
ni += 1;
while (--ni) {
i = ki - ni;
nj = kj;
nj += 1;
while (--nj) {
j = kj - nj;
T.els[i][cols + j] = M[i][j];
}
}
return T;
};
Matrix.prototype.inverse = function() {
var M, divisor, els, i, inverse_elements, j, ki, kp, new_element, ni, np, p, _i;
ni = this.els.length;
ki = ni;
M = this.augment(Matrix.I(ni)).toRightTriangular();
kp = M.els[0].length;
inverse_elements = [];
ni += 1;
while (--ni) {
i = ni - 1;
els = [];
np = kp;
inverse_elements[i] = [];
divisor = M.els[i][i];
np += 1;
while (--np) {
p = kp - np;
new_element = M.els[i][p] / divisor;
els.push(new_element);
if (p >= ki) {
inverse_elements[i].push(new_element);
}
}
M.els[i] = els;
for (j = _i = 0; 0 <= i ? _i < i : _i > i; j = 0 <= i ? ++_i : --_i) {
els = [];
np = kp;
np += 1;
while (--np) {
p = kp - np;
els.push(M.els[j][p] - M.els[i][p] * M.els[j][i]);
}
M.els[j] = els;
}
}
return new Matrix(inverse_elements);
};
Matrix.I = function(n) {
var els, i, j, k, nj;
els = [];
k = n;
n += 1;
while (--n) {
i = k - n;
els[i] = [];
nj = k;
nj += 1;
while (--nj) {
j = k - nj;
els[i][j] = i === j ? 1 : 0;
}
}
return new Matrix(els);
};
Matrix.prototype.decompose = function() {
var els, i, inversePerspectiveMatrix, j, k, matrix, pdum3, perspective, perspectiveMatrix, quaternion, result, rightHandSide, rotate, row, rowElement, s, scale, skew, t, translate, transposedInversePerspectiveMatrix, type, typeKey, v, w, x, y, z, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
matrix = this;
translate = [];
scale = [];
skew = [];
quaternion = [];
perspective = [];
els = [];
for (i = _i = 0; _i <= 3; i = ++_i) {
els[i] = [];
for (j = _j = 0; _j <= 3; j = ++_j) {
els[i][j] = matrix.els[i][j];
}
}
if (els[3][3] === 0) {
return false;
}
for (i = _k = 0; _k <= 3; i = ++_k) {
for (j = _l = 0; _l <= 3; j = ++_l) {
els[i][j] /= els[3][3];
}
}
perspectiveMatrix = matrix.dup();
for (i = _m = 0; _m <= 2; i = ++_m) {
perspectiveMatrix.els[i][3] = 0;
}
perspectiveMatrix.els[3][3] = 1;
if (els[0][3] !== 0 || els[1][3] !== 0 || els[2][3] !== 0) {
rightHandSide = new Vector(els.slice(0, 4)[3]);
inversePerspectiveMatrix = perspectiveMatrix.inverse();
transposedInversePerspectiveMatrix = inversePerspectiveMatrix.transpose();
perspective = transposedInversePerspectiveMatrix.multiply(rightHandSide).els;
for (i = _n = 0; _n <= 2; i = ++_n) {
els[i][3] = 0;
}
els[3][3] = 1;
} else {
perspective = [0, 0, 0, 1];
}
for (i = _o = 0; _o <= 2; i = ++_o) {
translate[i] = els[3][i];
els[3][i] = 0;
}
row = [];
for (i = _p = 0; _p <= 2; i = ++_p) {
row[i] = new Vector(els[i].slice(0, 3));
}
scale[0] = row[0].length();
row[0] = row[0].normalize();
skew[0] = row[0].dot(row[1]);
row[1] = row[1].combine(row[0], 1.0, -skew[0]);
scale[1] = row[1].length();
row[1] = row[1].normalize();
skew[0] /= scale[1];
skew[1] = row[0].dot(row[2]);
row[2] = row[2].combine(row[0], 1.0, -skew[1]);
skew[2] = row[1].dot(row[2]);
row[2] = row[2].combine(row[1], 1.0, -skew[2]);
scale[2] = row[2].length();
row[2] = row[2].normalize();
skew[1] /= scale[2];
skew[2] /= scale[2];
pdum3 = row[1].cross(row[2]);
if (row[0].dot(pdum3) < 0) {
for (i = _q = 0; _q <= 2; i = ++_q) {
scale[i] *= -1;
for (j = _r = 0; _r <= 2; j = ++_r) {
row[i].els[j] *= -1;
}
}
}
rowElement = function(index, elementIndex) {
return row[index].els[elementIndex];
};
rotate = [];
rotate[1] = Math.asin(-rowElement(0, 2));
if (Math.cos(rotate[1]) !== 0) {
rotate[0] = Math.atan2(rowElement(1, 2), rowElement(2, 2));
rotate[2] = Math.atan2(rowElement(0, 1), rowElement(0, 0));
} else {
rotate[0] = Math.atan2(-rowElement(2, 0), rowElement(1, 1));
rotate[1] = 0;
}
t = rowElement(0, 0) + rowElement(1, 1) + rowElement(2, 2) + 1.0;
if (t > 1e-4) {
s = 0.5 / Math.sqrt(t);
w = 0.25 / s;
x = (rowElement(2, 1) - rowElement(1, 2)) * s;
y = (rowElement(0, 2) - rowElement(2, 0)) * s;
z = (rowElement(1, 0) - rowElement(0, 1)) * s;
} else if ((rowElement(0, 0) > rowElement(1, 1)) && (rowElement(0, 0) > rowElement(2, 2))) {
s = Math.sqrt(1.0 + rowElement(0, 0) - rowElement(1, 1) - rowElement(2, 2)) * 2.0;
x = 0.25 * s;
y = (rowElement(0, 1) + rowElement(1, 0)) / s;
z = (rowElement(0, 2) + rowElement(2, 0)) / s;
w = (rowElement(2, 1) - rowElement(1, 2)) / s;
} else if (rowElement(1, 1) > rowElement(2, 2)) {
s = Math.sqrt(1.0 + rowElement(1, 1) - rowElement(0, 0) - rowElement(2, 2)) * 2.0;
x = (rowElement(0, 1) + rowElement(1, 0)) / s;
y = 0.25 * s;
z = (rowElement(1, 2) + rowElement(2, 1)) / s;
w = (rowElement(0, 2) - rowElement(2, 0)) / s;
} else {
s = Math.sqrt(1.0 + rowElement(2, 2) - rowElement(0, 0) - rowElement(1, 1)) * 2.0;
x = (rowElement(0, 2) + rowElement(2, 0)) / s;
y = (rowElement(1, 2) + rowElement(2, 1)) / s;
z = 0.25 * s;
w = (rowElement(1, 0) - rowElement(0, 1)) / s;
}
quaternion = [x, y, z, w];
result = new DecomposedMatrix;
result.translate = translate;
result.scale = scale;
result.skew = skew;
result.quaternion = quaternion;
result.perspective = perspective;
result.rotate = rotate;
for (typeKey in result) {
type = result[typeKey];
for (k in type) {
v = type[k];
if (isNaN(v)) {
type[k] = 0;
}
}
}
return result;
};
Matrix.prototype.toString = function() {
var i, j, str, _i, _j;
str = 'matrix3d(';
for (i = _i = 0; _i <= 3; i = ++_i) {
for (j = _j = 0; _j <= 3; j = ++_j) {
str += roundf(this.els[i][j], 10);
if (!(i === 3 && j === 3)) {
str += ',';
}
}
}
str += ')';
return str;
};
Matrix.matrixForTransform = cacheFn(function(transform) {
var matrixEl, result, style, _ref, _ref1, _ref2;
matrixEl = document.createElement('div');
matrixEl.style.position = 'absolute';
matrixEl.style.visibility = 'hidden';
matrixEl.style[propertyWithPrefix("transform")] = transform;
document.body.appendChild(matrixEl);
style = window.getComputedStyle(matrixEl, null);
result = (_ref = (_ref1 = style.transform) != null ? _ref1 : style[propertyWithPrefix("transform")]) != null ? _ref : (_ref2 = dynamics.tests) != null ? _ref2.matrixForTransform(transform) : void 0;
document.body.removeChild(matrixEl);
return result;
});
Matrix.fromTransform = function(transform) {
var digits, elements, i, match, matrixElements, _i;
match = transform != null ? transform.match(/matrix3?d?\(([-0-9,e \.]*)\)/) : void 0;
if (match) {
digits = match[1].split(',');
digits = digits.map(parseFloat);
if (digits.length === 6) {
elements = [digits[0], digits[1], 0, 0, digits[2], digits[3], 0, 0, 0, 0, 1, 0, digits[4], digits[5], 0, 1];
} else {
elements = digits;
}
} else {
elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
}
matrixElements = [];
for (i = _i = 0; _i <= 3; i = ++_i) {
matrixElements.push(elements.slice(i * 4, i * 4 + 4));
}
return new Matrix(matrixElements);
};
return Matrix;
})();
prefixFor = cacheFn(function(property) {
var k, prefix, prop, propArray, propertyName, _i, _j, _len, _len1, _ref;
if (document.body.style[property] !== void 0) {
return '';
}
propArray = property.split('-');
propertyName = "";
for (_i = 0, _len = propArray.length; _i < _len; _i++) {
prop = propArray[_i];
propertyName += prop.substring(0, 1).toUpperCase() + prop.substring(1);
}
_ref = ["Webkit", "Moz", "ms"];
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
prefix = _ref[_j];
k = prefix + propertyName;
if (document.body.style[k] !== void 0) {
return prefix;
}
}
return '';
});
propertyWithPrefix = cacheFn(function(property) {
var prefix;
prefix = prefixFor(property);
if (prefix === 'Moz') {
return "" + prefix + (property.substring(0, 1).toUpperCase() + property.substring(1));
}
if (prefix !== '') {
return "-" + (prefix.toLowerCase()) + "-" + (toDashed(property));
}
return toDashed(property);
});
rAF = typeof window !== "undefined" && window !== null ? window.requestAnimationFrame : void 0;
animations = [];
animationsTimeouts = [];
slow = false;
slowRatio = 1;
if (typeof window !== "undefined" && window !== null) {
window.addEventListener('keyup', function(e) {
if (e.keyCode === 68 && e.shiftKey && e.ctrlKey) {
return dynamics.toggleSlow();
}
});
}
if (rAF == null) {
lastTime = 0;
rAF = function(callback) {
var currTime, id, timeToCall;
currTime = Date.now();
timeToCall = Math.max(0, 16 - (currTime - lastTime));
id = window.setTimeout(function() {
return callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
runLoopRunning = false;
runLoopPaused = false;
startRunLoop = function() {
if (!runLoopRunning) {
runLoopRunning = true;
return rAF(runLoopTick);
}
};
runLoopTick = function(t) {
var animation, toRemoveAnimations, _i, _len;
if (runLoopPaused) {
rAF(runLoopTick);
return;
}
toRemoveAnimations = [];
for (_i = 0, _len = animations.length; _i < _len; _i++) {
animation = animations[_i];
if (!animationTick(t, animation)) {
toRemoveAnimations.push(animation);
}
}
animations = animations.filter(function(animation) {
return toRemoveAnimations.indexOf(animation) === -1;
});
if (animations.length === 0) {
return runLoopRunning = false;
} else {
return rAF(runLoopTick);
}
};
animationTick = function(t, animation) {
var key, properties, property, tt, y, _base, _base1, _ref;
if (animation.tStart == null) {
animation.tStart = t;
}
tt = (t - animation.tStart) / animation.options.duration;
y = animation.curve(tt);
properties = {};
if (tt >= 1) {
if (animation.curve.initialForce) {
properties = animation.properties.start;
} else {
properties = animation.properties.end;
}
} else {
_ref = animation.properties.start;
for (key in _ref) {
property = _ref[key];
properties[key] = interpolate(property, animation.properties.end[key], y);
}
}
applyFrame(animation.el, properties);
if (typeof (_base = animation.options).change === "function") {
_base.change(animation.el);
}
if (tt >= 1) {
if (typeof (_base1 = animation.options).complete === "function") {
_base1.complete(animation.el);
}
}
return tt < 1;
};
interpolate = function(start, end, y) {
if ((start != null) && (start.interpolate != null)) {
return start.interpolate(end, y);
}
return null;
};
startAnimation = function(el, properties, options, timeoutId) {
var endProperties, isSVG, k, matrix, startProperties, transforms, v, _base;
if (timeoutId != null) {
animationsTimeouts = animationsTimeouts.filter(function(timeout) {
return timeout.id !== timeoutId;
});
}
dynamics.stop(el, {
timeout: false
});
if (!options.animated) {
dynamics.css(el, properties);
if (typeof options.complete === "function") {
options.complete(this);
}
return;
}
properties = parseProperties(properties);
startProperties = getCurrentProperties(el, Object.keys(properties));
endProperties = {};
transforms = [];
for (k in properties) {
v = properties[k];
if ((el.style != null) && transformProperties.contains(k)) {
transforms.push([k, v]);
} else {
endProperties[k] = createInterpolable(v);
if (endProperties[k] instanceof InterpolableWithUnit && (el.style != null)) {
endProperties[k].prefix = '';
if ((_base = endProperties[k]).suffix == null) {
_base.suffix = unitForProperty(k, 0);
}
}
}
}
if (transforms.length > 0) {
isSVG = isSVGElement(el);
if (isSVG) {
matrix = new Matrix2D();
matrix.applyProperties(transforms);
} else {
v = (transforms.map(function(transform) {
return transformValueForProperty(transform[0], transform[1]);
})).join(" ");
matrix = Matrix.fromTransform(Matrix.matrixForTransform(v));
}
endProperties['transform'] = matrix.decompose();
if (isSVG) {
startProperties.transform.applyRotateCenter([endProperties.transform.props.rotate[1], endProperties.transform.props.rotate[2]]);
}
}
animations.push({
el: el,
properties: {
start: startProperties,
end: endProperties
},
options: options,
curve: options.type.call(options.type, options)
});
return startRunLoop();
};
timeouts = [];
timeoutLastId = 0;
setRealTimeout = function(timeout) {
if (!isDocumentVisible()) {
return;
}
return timeout.realTimeoutId = setTimeout(function() {
timeout.fn();
return cancelTimeout(timeout.id);
}, timeout.delay);
};
addTimeout = function(fn, delay) {
var timeout;
timeoutLastId += 1;
timeout = {
id: timeoutLastId,
tStart: Date.now(),
fn: fn,
delay: delay,
originalDelay: delay
};
setRealTimeout(timeout);
timeouts.push(timeout);
return timeoutLastId;
};
cancelTimeout = function(id) {
return timeouts = timeouts.filter(function(timeout) {
if (timeout.id === id) {
clearTimeout(timeout.realTimeoutId);
}
return timeout.id !== id;
});
};
leftDelayForTimeout = function(time, timeout) {
var consumedDelay;
if (time != null) {
consumedDelay = time - timeout.tStart;
return timeout.originalDelay - consumedDelay;
} else {
return timeout.originalDelay;
}
};
if (typeof window !== "undefined" && window !== null) {
window.addEventListener('unload', function() {});
}
timeBeforeVisibilityChange = null;
observeVisibilityChange(function(visible) {
var animation, difference, timeout, _i, _j, _k, _len, _len1, _len2, _results;
runLoopPaused = !visible;
if (!visible) {
timeBeforeVisibilityChange = Date.now();
_results = [];
for (_i = 0, _len = timeouts.length; _i < _len; _i++) {
timeout = timeouts[_i];
_results.push(clearTimeout(timeout.realTimeoutId));
}
return _results;
} else {
if (runLoopRunning) {
difference = Date.now() - timeBeforeVisibilityChange;
for (_j = 0, _len1 = animations.length; _j < _len1; _j++) {
animation = animations[_j];
if (animation.tStart != null) {
animation.tStart += difference;
}
}
}
for (_k = 0, _len2 = timeouts.length; _k < _len2; _k++) {
timeout = timeouts[_k];
timeout.delay = leftDelayForTimeout(timeBeforeVisibilityChange, timeout);
setRealTimeout(timeout);
}
return timeBeforeVisibilityChange = null;
}
});
dynamics = {};
dynamics.linear = function() {
return function(t) {
return t;
};
};
dynamics.spring = function(options) {
var A1, A2, decal, frequency, friction, s;
if (options == null) {
options = {};
}
applyDefaults(options, arguments.callee.defaults);
frequency = Math.max(1, options.frequency / 20);
friction = Math.pow(20, options.friction / 100);
s = options.anticipationSize / 1000;
decal = Math.max(0, s);
A1 = function(t) {
var M, a, b, x0, x1;
M = 0.8;
x0 = s / (1 - s);
x1 = 0;
b = (x0 - (M * x1)) / (x0 - x1);
a = (M - b) / x0;
return (a * t * options.anticipationStrength / 100) + b;
};
A2 = function(t) {
return Math.pow(friction / 10, -t) * (1 - t);
};
return function(t) {
var A, At, a, angle, b, frictionT, y0, yS;
frictionT = (t / (1 - s)) - (s / (1 - s));
if (t < s) {
yS = (s / (1 - s)) - (s / (1 - s));
y0 = (0 / (1 - s)) - (s / (1 - s));
b = Math.acos(1 / A1(yS));
a = (Math.acos(1 / A1(y0)) - b) / (frequency * (-s));
A = A1;
} else {
A = A2;
b = 0;
a = 1;
}
At = A(frictionT);
angle = frequency * (t - s) * a + b;
return 1 - (At * Math.cos(angle));
};
};
dynamics.bounce = function(options) {
var A, fn, frequency, friction;
if (options == null) {
options = {};
}
applyDefaults(options, arguments.callee.defaults);
frequency = Math.max(1, options.frequency / 20);
friction = Math.pow(20, options.friction / 100);
A = function(t) {
return Math.pow(friction / 10, -t) * (1 - t);
};
fn = function(t) {
var At, a, angle, b;
b = -3.14 / 2;
a = 1;
At = A(t);
angle = frequency * t * a + b;
return At * Math.cos(angle);
};
fn.initialForce = true;
return fn;
};
dynamics.gravity = function(options) {
var L, bounciness, curves, elasticity, fn, getPointInCurve, gravity;
if (options == null) {
options = {};
}
applyDefaults(options, arguments.callee.defaults);
bounciness = Math.min(options.bounciness / 1250, 0.8);
elasticity = options.elasticity / 1000;
gravity = 100;
curves = [];
L = (function() {
var b, curve;
b = Math.sqrt(2 / gravity);
curve = {
a: -b,
b: b,
H: 1
};
if (options.initialForce) {
curve.a = 0;
curve.b = curve.b * 2;
}
while (curve.H > 0.001) {
L = curve.b - curve.a;
curve = {
a: curve.b,
b: curve.b + L * bounciness,
H: curve.H * bounciness * bounciness
};
}
return curve.b;
})();
getPointInCurve = function(a, b, H, t) {
var c, t2;
L = b - a;
t2 = (2 / L) * t - 1 - (a * 2 / L);
c = t2 * t2 * H - H + 1;
if (options.initialForce) {
c = 1 - c;
}
return c;
};
(function() {
var L2, b, curve, _results;
b = Math.sqrt(2 / (gravity * L * L));
curve = {
a: -b,
b: b,
H: 1
};
if (options.initialForce) {
curve.a = 0;
curve.b = curve.b * 2;
}
curves.push(curve);
L2 = L;
_results = [];
while (curve.b < 1 && curve.H > 0.001) {
L2 = curve.b - curve.a;
curve = {
a: curve.b,
b: curve.b + L2 * bounciness,
H: curve.H * elasticity
};
_results.push(curves.push(curve));
}
return _results;
})();
fn = function(t) {
var curve, i, v;
i = 0;
curve = curves[i];
while (!(t >= curve.a && t <= curve.b)) {
i += 1;
curve = curves[i];
if (!curve) {
break;
}
}
if (!curve) {
v = options.initialForce ? 0 : 1;
} else {
v = getPointInCurve(curve.a, curve.b, curve.H, t);
}
return v;
};
fn.initialForce = options.initialForce;
return fn;
};
dynamics.forceWithGravity = function(options) {
if (options == null) {
options = {};
}
applyDefaults(options, arguments.callee.defaults);
options.initialForce = true;
return dynamics.gravity(options);
};
dynamics.bezier = (function() {
var Bezier, Bezier_, yForX;
Bezier_ = function(t, p0, p1, p2, p3) {
return (Math.pow(1 - t, 3) * p0) + (3 * Math.pow(1 - t, 2) * t * p1) + (3 * (1 - t) * Math.pow(t, 2) * p2) + Math.pow(t, 3) * p3;
};
Bezier = function(t, p0, p1, p2, p3) {
return {
x: Bezier_(t, p0.x, p1.x, p2.x, p3.x),
y: Bezier_(t, p0.y, p1.y, p2.y, p3.y)
};
};
yForX = function(xTarget, Bs, returnsToSelf) {
var B, aB, i, lower, percent, upper, x, xTolerance, _i, _len;
B = null;
for (_i = 0, _len = Bs.length; _i < _len; _i++) {
aB = Bs[_i];
if (xTarget >= aB(0).x && xTarget <= aB(1).x) {
B = aB;
}
if (B !== null) {
break;
}
}
if (!B) {
if (returnsToSelf) {
return 0;
} else {
return 1;
}
}
xTolerance = 0.0001;
lower = 0;
upper = 1;
percent = (upper + lower) / 2;
x = B(percent).x;
i = 0;
while (Math.abs(xTarget - x) > xTolerance && i < 100) {
if (xTarget > x) {
lower = percent;
} else {
upper = percent;
}
percent = (upper + lower) / 2;
x = B(percent).x;
i += 1;
}
return B(percent).y;
};
return function(options) {
var Bs, points, returnsToSelf;
if (options == null) {
options = {};
}
points = options.points;
returnsToSelf = false;
Bs = (function() {
var i, k, _fn;
Bs = [];
_fn = function(pointA, pointB) {
var B2;
B2 = function(t) {
return Bezier(t, pointA, pointA.cp[pointA.cp.length - 1], pointB.cp[0], pointB);
};
return Bs.push(B2);
};
for (i in points) {
k = parseInt(i);
if (k >= points.length - 1) {
break;
}
_fn(points[k], points[k + 1]);
}
return Bs;
})();
return function(t) {
if (t === 0) {
return 0;
} else if (t === 1) {
return 1;
} else {
return yForX(t, Bs, returnsToSelf);
}
};
};
})();
dynamics.easeInOut = function(options) {
var friction, _ref;
if (options == null) {
options = {};
}
friction = (_ref = options.friction) != null ? _ref : arguments.callee.defaults.friction;
return dynamics.bezier({
points: [
{
x: 0,
y: 0,
cp: [
{
x: 0.92 - (friction / 1000),
y: 0
}
]
}, {
x: 1,
y: 1,
cp: [
{
x: 0.08 + (friction / 1000),
y: 1
}
]
}
]
});
};
dynamics.easeIn = function(options) {
var friction, _ref;
if (options == null) {
options = {};
}
friction = (_ref = options.friction) != null ? _ref : arguments.callee.defaults.friction;
return dynamics.bezier({
points: [
{
x: 0,
y: 0,
cp: [
{
x: 0.92 - (friction / 1000),
y: 0
}
]
}, {
x: 1,
y: 1,
cp: [
{
x: 1,
y: 1
}
]
}
]
});
};
dynamics.easeOut = function(options) {
var friction, _ref;
if (options == null) {
options = {};
}
friction = (_ref = options.friction) != null ? _ref : arguments.callee.defaults.friction;
return dynamics.bezier({
points: [
{
x: 0,
y: 0,
cp: [
{
x: 0,
y: 0
}
]
}, {
x: 1,
y: 1,
cp: [
{
x: 0.08 + (friction / 1000),
y: 1
}
]
}
]
});
};
dynamics.spring.defaults = {
frequency: 300,
friction: 200,
anticipationSize: 0,
anticipationStrength: 0
};
dynamics.bounce.defaults = {
frequency: 300,
friction: 200
};
dynamics.forceWithGravity.defaults = dynamics.gravity.defaults = {
bounciness: 400,
elasticity: 200
};
dynamics.easeInOut.defaults = dynamics.easeIn.defaults = dynamics.easeOut.defaults = {
friction: 500
};
dynamics.css = makeArrayFn(function(el, properties) {
return applyProperties(el, properties, true);
});
dynamics.animate = makeArrayFn(function(el, properties, options) {
var id;
if (options == null) {
options = {};
}
options = clone(options);
applyDefaults(options, {
type: dynamics.easeInOut,
duration: 1000,
delay: 0,
animated: true
});
options.duration = Math.max(0, options.duration * slowRatio);
options.delay = Math.max(0, options.delay);
if (options.delay === 0) {
return startAnimation(el, properties, options);
} else {
id = dynamics.setTimeout(function() {
return startAnimation(el, properties, options, id);
}, options.delay);
return animationsTimeouts.push({
id: id,
el: el
});
}
});
dynamics.stop = makeArrayFn(function(el, options) {
if (options == null) {
options = {};
}
if (options.timeout == null) {
options.timeout = true;
}
if (options.timeout) {
animationsTimeouts = animationsTimeouts.filter(function(timeout) {
if (timeout.el === el && ((options.filter == null) || options.filter(timeout))) {
dynamics.clearTimeout(timeout.id);
return false;
}
return true;
});
}
return animations = animations.filter(function(animation) {
return animation.el !== el;
});
});
dynamics.setTimeout = function(fn, delay) {
return addTimeout(fn, delay * slowRatio);
};
dynamics.clearTimeout = function(id) {
return cancelTimeout(id);
};
dynamics.toggleSlow = function() {
slow = !slow;
if (slow) {
slowRatio = 3;
} else {
slowRatio = 1;
}
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log("dynamics.js: slow animations " + (slow ? "enabled" : "disabled")) : void 0 : void 0;
};
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = dynamics;
} else if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
return dynamics;
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.dynamics = dynamics;
}
}).call(this);
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? factory(exports, __webpack_require__(4)) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) :
(factory((global.d3_interpolate = global.d3_interpolate || {}),global.d3_color));
}(this, function (exports,d3Color) { 'use strict';
function constant(x) {
return function() {
return x;
};
}
function linear(a, d) {
return function(t) {
return a + t * d;
};
}
function exponential(a, b, y) {
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
return Math.pow(a + t * b, y);
};
}
function interpolateHue(a, b) {
var d = b - a;
return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
}
function gamma(y) {
return (y = +y) === 1 ? nogamma : function(a, b) {
return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
};
}
function nogamma(a, b) {
var d = b - a;
return d ? linear(a, d) : constant(isNaN(a) ? b : a);
}
var rgb$1 = (function gamma$$(y) {
var interpolateColor = gamma(y);
function interpolateRgb(start, end) {
var r = interpolateColor((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r),
g = interpolateColor(start.g, end.g),
b = interpolateColor(start.b, end.b),
opacity = interpolateColor(start.opacity, end.opacity);
return function(t) {
start.r = r(t);
start.g = g(t);
start.b = b(t);
start.opacity = opacity(t);
return start + "";
};
}
interpolateRgb.gamma = gamma$$;
return interpolateRgb;
})(1);
// TODO sparse arrays?
function array(a, b) {
var x = [],
c = [],
na = a ? a.length : 0,
nb = b ? b.length : 0,
n0 = Math.min(na, nb),
i;
for (i = 0; i < n0; ++i) x.push(value(a[i], b[i]));
for (; i < na; ++i) c[i] = a[i];
for (; i < nb; ++i) c[i] = b[i];
return function(t) {
for (i = 0; i < n0; ++i) c[i] = x[i](t);
return c;
};
}
function number(a, b) {
return a = +a, b -= a, function(t) {
return a + b * t;
};
}
function object(a, b) {
var i = {},
c = {},
k;
if (a === null || typeof a !== "object") a = {};
if (b === null || typeof b !== "object") b = {};
for (k in a) {
if (k in b) {
i[k] = value(a[k], b[k]);
} else {
c[k] = a[k];
}
}
for (k in b) {
if (!(k in a)) {
c[k] = b[k];
}
}
return function(t) {
for (k in i) c[k] = i[k](t);
return c;
};
}
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var reB = new RegExp(reA.source, "g");
function zero(b) {
return function() {
return b;
};
}
function one(b) {
return function(t) {
return b(t) + "";
};
}
function string(a, b) {
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
am, // current match in a
bm, // current match in b
bs, // string preceding current number in b, if any
i = -1, // index in s
s = [], // string constants and placeholders
q = []; // number interpolators
// Coerce inputs to strings.
a = a + "", b = b + "";
// Interpolate pairs of numbers in a & b.
while ((am = reA.exec(a))
&& (bm = reB.exec(b))) {
if ((bs = bm.index) > bi) { // a string precedes the next number in b
bs = b.slice(bi, bs);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
if (s[i]) s[i] += bm; // coalesce with previous string
else s[++i] = bm;
} else { // interpolate non-matching numbers
s[++i] = null;
q.push({i: i, x: number(am, bm)});
}
bi = reB.lastIndex;
}
// Add remains of b.
if (bi < b.length) {
bs = b.slice(bi);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
// Special optimization for only a single match.
// Otherwise, interpolate each of the numbers and rejoin the string.
return s.length < 2 ? (q[0]
? one(q[0].x)
: zero(b))
: (b = q.length, function(t) {
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
}
var values = [
function(a, b) {
var t = typeof b, c;
return (t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb$1) : string)
: b instanceof d3Color.color ? rgb$1
: Array.isArray(b) ? array
: t === "object" && isNaN(b) ? object
: number)(a, b);
}
];
function value(a, b) {
var i = values.length, f;
while (--i >= 0 && !(f = values[i](a, b)));
return f;
}
function round(a, b) {
return a = +a, b -= a, function(t) {
return Math.round(a + b * t);
};
}
var rad2deg = 180 / Math.PI;
var identity = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function decompose(a, b, c, d, e, f) {
if (a * d === b * c) return null;
var scaleX = Math.sqrt(a * a + b * b);
a /= scaleX, b /= scaleX;
var skewX = a * c + b * d;
c -= a * skewX, d -= b * skewX;
var scaleY = Math.sqrt(c * c + d * d);
c /= scaleY, d /= scaleY, skewX /= scaleY;
if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
return {
translateX: e,
translateY: f,
rotate: Math.atan2(b, a) * rad2deg,
skewX: Math.atan(skewX) * rad2deg,
scaleX: scaleX,
scaleY: scaleY
};
}
var cssNode;
var cssRoot;
var cssView;
var svgNode;
function parseCss(value) {
if (value === "none") return identity;
if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
cssNode.style.transform = value;
cssRoot.appendChild(cssNode);
value = cssView.getComputedStyle(cssNode, null).getPropertyValue("transform");
cssRoot.removeChild(cssNode);
var m = value.slice(7, -1).split(",");
return decompose(+m[0], +m[1], +m[2], +m[3], +m[4], +m[5]);
}
function parseSvg(value) {
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
svgNode.setAttribute("transform", value == null ? "" : value);
var m = svgNode.transform.baseVal.consolidate().matrix;
return decompose(m.a, m.b, m.c, m.d, m.e, m.f);
}
function interpolateTransform(parse, pxComma, pxParen, degParen) {
function pop(s) {
return s.length ? s.pop() + " " : "";
}
function translate(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push("translate(", null, pxComma, null, pxParen);
q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
} else if (xb || yb) {
s.push("translate(" + xb + pxComma + yb + pxParen);
}
}
function rotate(a, b, s, q) {
if (a !== b) {
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)});
} else if (b) {
s.push(pop(s) + "rotate(" + b + degParen);
}
}
function skewX(a, b, s, q) {
if (a !== b) {
q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)});
} else if (b) {
s.push(pop(s) + "skewX(" + b + degParen);
}
}
function scale(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
} else if (xb !== 1 || yb !== 1) {
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
}
}
return function(a, b) {
var s = [], // string constants and placeholders
q = []; // number interpolators
a = parse(a), b = parse(b);
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
rotate(a.rotate, b.rotate, s, q);
skewX(a.skewX, b.skewX, s, q);
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
a = b = null; // gc
return function(t) {
var i = -1, n = q.length, o;
while (++i < n) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
};
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
var rho = Math.SQRT2;
var rho2 = 2;
var rho4 = 4;
var epsilon2 = 1e-12;
function cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
}
function sinh(x) {
return ((x = Math.exp(x)) - 1 / x) / 2;
}
function tanh(x) {
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
function zoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
dx = ux1 - ux0,
dy = uy1 - uy0,
d2 = dx * dx + dy * dy,
i,
S;
// Special case for u0 ≅ u1.
if (d2 < epsilon2) {
S = Math.log(w1 / w0) / rho;
i = function(t) {
return [
ux0 + t * dx,
uy0 + t * dy,
w0 * Math.exp(rho * t * S)
];
}
}
// General case.
else {
var d1 = Math.sqrt(d2),
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
S = (r1 - r0) / rho;
i = function(t) {
var s = t * S,
coshr0 = cosh(r0),
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
return [
ux0 + u * dx,
uy0 + u * dy,
w0 * coshr0 / cosh(rho * s + r0)
];
}
}
i.duration = S * 1000;
return i;
}
function interpolateHsl(start, end) {
var h = interpolateHue((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
function interpolateHslLong(start, end) {
var h = nogamma((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
function interpolateLab(start, end) {
var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l),
a = nogamma(start.a, end.a),
b = nogamma(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.l = l(t);
start.a = a(t);
start.b = b(t);
start.opacity = opacity(t);
return start + "";
};
}
function interpolateHcl(start, end) {
var h = interpolateHue((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h),
c = nogamma(start.c, end.c),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.c = c(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
function interpolateHclLong(start, end) {
var h = nogamma((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h),
c = nogamma(start.c, end.c),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.c = c(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
var cubehelix$1 = (function gamma(y) {
y = +y;
function interpolateCubehelix(start, end) {
var h = interpolateHue((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(Math.pow(t, y));
start.opacity = opacity(t);
return start + "";
};
}
interpolateCubehelix.gamma = gamma;
return interpolateCubehelix;
})(1);
var cubehelixLong = (function gamma(y) {
y = +y;
function interpolateCubehelixLong(start, end) {
var h = nogamma((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(Math.pow(t, y));
start.opacity = opacity(t);
return start + "";
};
}
interpolateCubehelixLong.gamma = gamma;
return interpolateCubehelixLong;
})(1);
var version = "0.6.0";
exports.version = version;
exports.interpolate = value;
exports.interpolators = values;
exports.interpolateArray = array;
exports.interpolateNumber = number;
exports.interpolateObject = object;
exports.interpolateRound = round;
exports.interpolateString = string;
exports.interpolateTransformCss = interpolateTransformCss;
exports.interpolateTransformSvg = interpolateTransformSvg;
exports.interpolateZoom = zoom;
exports.interpolateRgb = rgb$1;
exports.interpolateHsl = interpolateHsl;
exports.interpolateHslLong = interpolateHslLong;
exports.interpolateLab = interpolateLab;
exports.interpolateHcl = interpolateHcl;
exports.interpolateHclLong = interpolateHclLong;
exports.interpolateCubehelix = cubehelix$1;
exports.interpolateCubehelixLong = cubehelixLong;
}));
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3_color = global.d3_color || {})));
}(this, function (exports) { 'use strict';
function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;
}
function Color() {}
var darker = 0.7;
var brighter = 1 / darker;
var reHex3 = /^#([0-9a-f]{3})$/;
var reHex6 = /^#([0-9a-f]{6})$/;
var reRgbInteger = /^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/;
var reRgbPercent = /^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;
var reRgbaInteger = /^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/;
var reRgbaPercent = /^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/;
var reHslPercent = /^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;
var reHslaPercent = /^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/;
var named = {
aliceblue: 0xf0f8ff,
antiquewhite: 0xfaebd7,
aqua: 0x00ffff,
aquamarine: 0x7fffd4,
azure: 0xf0ffff,
beige: 0xf5f5dc,
bisque: 0xffe4c4,
black: 0x000000,
blanchedalmond: 0xffebcd,
blue: 0x0000ff,
blueviolet: 0x8a2be2,
brown: 0xa52a2a,
burlywood: 0xdeb887,
cadetblue: 0x5f9ea0,
chartreuse: 0x7fff00,
chocolate: 0xd2691e,
coral: 0xff7f50,
cornflowerblue: 0x6495ed,
cornsilk: 0xfff8dc,
crimson: 0xdc143c,
cyan: 0x00ffff,
darkblue: 0x00008b,
darkcyan: 0x008b8b,
darkgoldenrod: 0xb8860b,
darkgray: 0xa9a9a9,
darkgreen: 0x006400,
darkgrey: 0xa9a9a9,
darkkhaki: 0xbdb76b,
darkmagenta: 0x8b008b,
darkolivegreen: 0x556b2f,
darkorange: 0xff8c00,
darkorchid: 0x9932cc,
darkred: 0x8b0000,
darksalmon: 0xe9967a,
darkseagreen: 0x8fbc8f,
darkslateblue: 0x483d8b,
darkslategray: 0x2f4f4f,
darkslategrey: 0x2f4f4f,
darkturquoise: 0x00ced1,
darkviolet: 0x9400d3,
deeppink: 0xff1493,
deepskyblue: 0x00bfff,
dimgray: 0x696969,
dimgrey: 0x696969,
dodgerblue: 0x1e90ff,
firebrick: 0xb22222,
floralwhite: 0xfffaf0,
forestgreen: 0x228b22,
fuchsia: 0xff00ff,
gainsboro: 0xdcdcdc,
ghostwhite: 0xf8f8ff,
gold: 0xffd700,
goldenrod: 0xdaa520,
gray: 0x808080,
green: 0x008000,
greenyellow: 0xadff2f,
grey: 0x808080,
honeydew: 0xf0fff0,
hotpink: 0xff69b4,
indianred: 0xcd5c5c,
indigo: 0x4b0082,
ivory: 0xfffff0,
khaki: 0xf0e68c,
lavender: 0xe6e6fa,
lavenderblush: 0xfff0f5,
lawngreen: 0x7cfc00,
lemonchiffon: 0xfffacd,
lightblue: 0xadd8e6,
lightcoral: 0xf08080,
lightcyan: 0xe0ffff,
lightgoldenrodyellow: 0xfafad2,
lightgray: 0xd3d3d3,
lightgreen: 0x90ee90,
lightgrey: 0xd3d3d3,
lightpink: 0xffb6c1,
lightsalmon: 0xffa07a,
lightseagreen: 0x20b2aa,
lightskyblue: 0x87cefa,
lightslategray: 0x778899,
lightslategrey: 0x778899,
lightsteelblue: 0xb0c4de,
lightyellow: 0xffffe0,
lime: 0x00ff00,
limegreen: 0x32cd32,
linen: 0xfaf0e6,
magenta: 0xff00ff,
maroon: 0x800000,
mediumaquamarine: 0x66cdaa,
mediumblue: 0x0000cd,
mediumorchid: 0xba55d3,
mediumpurple: 0x9370db,
mediumseagreen: 0x3cb371,
mediumslateblue: 0x7b68ee,
mediumspringgreen: 0x00fa9a,
mediumturquoise: 0x48d1cc,
mediumvioletred: 0xc71585,
midnightblue: 0x191970,
mintcream: 0xf5fffa,
mistyrose: 0xffe4e1,
moccasin: 0xffe4b5,
navajowhite: 0xffdead,
navy: 0x000080,
oldlace: 0xfdf5e6,
olive: 0x808000,
olivedrab: 0x6b8e23,
orange: 0xffa500,
orangered: 0xff4500,
orchid: 0xda70d6,
palegoldenrod: 0xeee8aa,
palegreen: 0x98fb98,
paleturquoise: 0xafeeee,
palevioletred: 0xdb7093,
papayawhip: 0xffefd5,
peachpuff: 0xffdab9,
peru: 0xcd853f,
pink: 0xffc0cb,
plum: 0xdda0dd,
powderblue: 0xb0e0e6,
purple: 0x800080,
rebeccapurple: 0x663399,
red: 0xff0000,
rosybrown: 0xbc8f8f,
royalblue: 0x4169e1,
saddlebrown: 0x8b4513,
salmon: 0xfa8072,
sandybrown: 0xf4a460,
seagreen: 0x2e8b57,
seashell: 0xfff5ee,
sienna: 0xa0522d,
silver: 0xc0c0c0,
skyblue: 0x87ceeb,
slateblue: 0x6a5acd,
slategray: 0x708090,
slategrey: 0x708090,
snow: 0xfffafa,
springgreen: 0x00ff7f,
steelblue: 0x4682b4,
tan: 0xd2b48c,
teal: 0x008080,
thistle: 0xd8bfd8,
tomato: 0xff6347,
turquoise: 0x40e0d0,
violet: 0xee82ee,
wheat: 0xf5deb3,
white: 0xffffff,
whitesmoke: 0xf5f5f5,
yellow: 0xffff00,
yellowgreen: 0x9acd32
};
define(Color, color, {
displayable: function() {
return this.rgb().displayable();
},
toString: function() {
return this.rgb() + "";
}
});
function color(format) {
var m;
format = (format + "").trim().toLowerCase();
return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00
: (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
: named.hasOwnProperty(format) ? rgbn(named[format])
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
: null;
}
function rgbn(n) {
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}
function rgba(r, g, b, a) {
if (a <= 0) r = g = b = NaN;
return new Rgb(r, g, b, a);
}
function rgbConvert(o) {
if (!(o instanceof Color)) o = color(o);
if (!o) return new Rgb;
o = o.rgb();
return new Rgb(o.r, o.g, o.b, o.opacity);
}
function rgb(r, g, b, opacity) {
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}
function Rgb(r, g, b, opacity) {
this.r = +r;
this.g = +g;
this.b = +b;
this.opacity = +opacity;
}
define(Rgb, rgb, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
},
toString: function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
}
}));
function hsla(h, s, l, a) {
if (a <= 0) h = s = l = NaN;
else if (l <= 0 || l >= 1) h = s = NaN;
else if (s <= 0) h = NaN;
return new Hsl(h, s, l, a);
}
function hslConvert(o) {
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Color)) o = color(o);
if (!o) return new Hsl;
if (o instanceof Hsl) return o;
o = o.rgb();
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
h = NaN,
s = max - min,
l = (max + min) / 2;
if (s) {
if (r === max) h = (g - b) / s + (g < b) * 6;
else if (g === max) h = (b - r) / s + 2;
else h = (r - g) / s + 4;
s /= l < 0.5 ? max + min : 2 - max - min;
h *= 60;
} else {
s = l > 0 && l < 1 ? 0 : h;
}
return new Hsl(h, s, l, o.opacity);
}
function hsl(h, s, l, opacity) {
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
}
function Hsl(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
define(Hsl, hsl, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
}
}));
/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {
return (h < 60 ? m1 + (m2 - m1) * h / 60
: h < 180 ? m2
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
: m1) * 255;
}
var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;
var Kn = 18;
var Xn = 0.950470;
var Yn = 1;
var Zn = 1.088830;
var t0 = 4 / 29;
var t1 = 6 / 29;
var t2 = 3 * t1 * t1;
var t3 = t1 * t1 * t1;
function labConvert(o) {
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
if (o instanceof Hcl) {
var h = o.h * deg2rad;
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}
if (!(o instanceof Rgb)) o = rgbConvert(o);
var b = rgb2xyz(o.r),
a = rgb2xyz(o.g),
l = rgb2xyz(o.b),
x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}
function lab(l, a, b, opacity) {
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}
function Lab(l, a, b, opacity) {
this.l = +l;
this.a = +a;
this.b = +b;
this.opacity = +opacity;
}
define(Lab, lab, extend(Color, {
brighter: function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
rgb: function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
this.opacity
);
}
}));
function xyz2lab(t) {
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
}
function lab2xyz(t) {
return t > t1 ? t * t * t : t2 * (t - t0);
}
function xyz2rgb(x) {
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
function rgb2xyz(x) {
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}
function hclConvert(o) {
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
if (!(o instanceof Lab)) o = labConvert(o);
var h = Math.atan2(o.b, o.a) * rad2deg;
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}
function hcl(h, c, l, opacity) {
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function Hcl(h, c, l, opacity) {
this.h = +h;
this.c = +c;
this.l = +l;
this.opacity = +opacity;
}
define(Hcl, hcl, extend(Color, {
brighter: function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
},
darker: function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
},
rgb: function() {
return labConvert(this).rgb();
}
}));
var A = -0.14861;
var B = +1.78277;
var C = -0.29227;
var D = -0.90649;
var E = +1.97294;
var ED = E * D;
var EB = E * B;
var BC_DA = B * C - D * A;
function cubehelixConvert(o) {
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Rgb)) o = rgbConvert(o);
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
bl = b - l,
k = (E * (g - l) - C * bl) / D,
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}
function cubehelix(h, s, l, opacity) {
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}
function Cubehelix(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
define(Cubehelix, cubehelix, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
}
}));
var version = "0.4.2";
exports.version = version;
exports.color = color;
exports.rgb = rgb;
exports.hsl = hsl;
exports.lab = lab;
exports.hcl = hcl;
exports.cubehelix = cubehelix;
}));
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
format.replace(/%s/g, function() { return args[argIndex++]; })
);
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
/***/ },
/* 7 */
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(9);
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule React
*/
'use strict';
var _assign = __webpack_require__(10);
var ReactChildren = __webpack_require__(11);
var ReactComponent = __webpack_require__(22);
var ReactClass = __webpack_require__(33);
var ReactDOMFactories = __webpack_require__(38);
var ReactElement = __webpack_require__(14);
var ReactElementValidator = __webpack_require__(39);
var ReactPropTypes = __webpack_require__(41);
var ReactVersion = __webpack_require__(42);
var onlyChild = __webpack_require__(43);
var warning = __webpack_require__(16);
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
var cloneElement = ReactElement.cloneElement;
if (process.env.NODE_ENV !== 'production') {
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
cloneElement = ReactElementValidator.cloneElement;
}
var __spread = _assign;
if (process.env.NODE_ENV !== 'production') {
var warned = false;
__spread = function () {
process.env.NODE_ENV !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
warned = true;
return _assign.apply(null, arguments);
};
}
var React = {
// Modern
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
toArray: ReactChildren.toArray,
only: onlyChild
},
Component: ReactComponent,
createElement: createElement,
cloneElement: cloneElement,
isValidElement: ReactElement.isValidElement,
// Classic
PropTypes: ReactPropTypes,
createClass: ReactClass.createClass,
createFactory: createFactory,
createMixin: function (mixin) {
// Currently a noop. Will be used to validate and trace mixins.
return mixin;
},
// This looks DOM specific but these are actually isomorphic helpers
// since they are just generating DOM strings.
DOM: ReactDOMFactories,
version: ReactVersion,
// Deprecated hook for JSX spread, don't use this for anything.
__spread: __spread
};
module.exports = React;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
/***/ },
/* 10 */
/***/ function(module, exports) {
'use strict';
/* eslint-disable no-unused-vars */
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (e) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildren
*/
'use strict';
var PooledClass = __webpack_require__(12);
var ReactElement = __webpack_require__(14);
var emptyFunction = __webpack_require__(17);
var traverseAllChildren = __webpack_require__(19);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
var userProvidedKeyEscapeRegex = /\/+/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.func = forEachFunction;
this.context = forEachContext;
this.count = 0;
}
ForEachBookKeeping.prototype.destructor = function () {
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func;
var context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;
this.context = mapContext;
this.count = 0;
}
MapBookKeeping.prototype.destructor = function () {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result;
var keyPrefix = bookKeeping.keyPrefix;
var func = bookKeeping.func;
var context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement.isValidElement(mappedChild)) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}
/**
* Maps children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}
function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray
};
module.exports = ReactChildren;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PooledClass
*/
'use strict';
var invariant = __webpack_require__(13);
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fourArgumentPooler = function (a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function (instance) {
var Klass = this;
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : void 0;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
function invariant(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElement
*/
'use strict';
var _assign = __webpack_require__(10);
var ReactCurrentOwner = __webpack_require__(15);
var warning = __webpack_require__(16);
var canDefineProperty = __webpack_require__(18);
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
var specialPropKeyWarningShown, specialPropRefWarningShown;
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, no instanceof check
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} key
* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner
* @param {*} props
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
if (process.env.NODE_ENV !== 'production') {
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
if (canDefineProperty) {
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
});
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
} else {
element._store.validated = false;
element._self = self;
element._source = source;
}
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
};
/**
* Create and return a new ReactElement of the given type.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
*/
ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(
/* eslint-disable no-proto */
config.__proto__ == null || config.__proto__ === Object.prototype,
/* eslint-enable no-proto */
'React.createElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0;
ref = !config.hasOwnProperty('ref') || Object.getOwnPropertyDescriptor(config, 'ref').get ? null : config.ref;
key = !config.hasOwnProperty('key') || Object.getOwnPropertyDescriptor(config, 'key').get ? null : '' + config.key;
} else {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
}
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
if (process.env.NODE_ENV !== 'production') {
// Create dummy `key` and `ref` property to `props` to warn users
// against its use
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
if (!props.hasOwnProperty('key')) {
Object.defineProperty(props, 'key', {
get: function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', typeof type === 'function' && 'displayName' in type ? type.displayName : 'Element') : void 0;
}
return undefined;
},
configurable: true
});
}
if (!props.hasOwnProperty('ref')) {
Object.defineProperty(props, 'ref', {
get: function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', typeof type === 'function' && 'displayName' in type ? type.displayName : 'Element') : void 0;
}
return undefined;
},
configurable: true
});
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
/**
* Return a function that produces ReactElements of a given type.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
*/
ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
// easily accessed on elements. E.g. `