+
+
this.apply()} />
-
);
}
+
apply() {
if (this.props.data) {
let text = this.refs.text.value.trim();
diff --git a/app/components/UpdateNodeForm.jsx b/app/components/UpdateNodeForm.jsx
index fc90acb..e5b9181 100644
--- a/app/components/UpdateNodeForm.jsx
+++ b/app/components/UpdateNodeForm.jsx
@@ -35,6 +35,7 @@ export default class UpdateNodeForm extends BaseComponent {
this.apply(color)} />
-
-
-
+
+
);
}
diff --git a/app/components/__tests__/ChangeColorInput-test.jsx b/app/components/__tests__/ChangeColorInput-test.jsx
index ccc4be2..6abc629 100644
--- a/app/components/__tests__/ChangeColorInput-test.jsx
+++ b/app/components/__tests__/ChangeColorInput-test.jsx
@@ -62,7 +62,7 @@ describe("ChangeColorInput", () => {
wrapper.setState({ displayColorPicker: true });
let picker = wrapper.find(CompactPicker);
let pickerOnChange = picker.props().onChange;
- pickerOnChange({ hex: "def" });
+ pickerOnChange({ hex: "#def" });
expect(onChange.mock.calls.length).toBe(1);
expect(onChange.mock.calls[0][0]).toBe("#def");
diff --git a/app/components/__tests__/DeleteSelectedButton-test.js b/app/components/__tests__/DeleteSelectedButton-test.js
new file mode 100644
index 0000000..494da13
--- /dev/null
+++ b/app/components/__tests__/DeleteSelectedButton-test.js
@@ -0,0 +1,27 @@
+jest.unmock('../DeleteSelectedButton');
+
+import React from "react";
+import { shallow } from "enzyme";
+import DeleteSelectedButton from '../DeleteSelectedButton';
+
+describe('DeleteSelectedButton', function(){
+ let doDeleteMock = jest.fn();
+ let wrapper = shallow(
+
);
+
+ it('sets correct class names on div', () => {
+ expect(wrapper.hasClass('editForm')).toEqual(true);
+ expect(wrapper.hasClass('form-inline')).toEqual(true);
+ expect(wrapper.hasClass('nodeDelete')).toEqual(true);
+ expect(wrapper.hasClass('edgeDelete')).toEqual(false);
+ });
+
+ it('clicking on button triggers doDelete', () => {
+ wrapper.find('button').simulate('click');
+ expect(doDeleteMock.mock.calls.length).toEqual(1);
+ });
+
+
+});
diff --git a/app/main.jsx b/app/main.jsx
index bd40316..e7fb7f3 100644
--- a/app/main.jsx
+++ b/app/main.jsx
@@ -202,6 +202,7 @@ class Oligrapher {
}
deleteSelection() {
+ console.log("hey");
this.root.dispatchProps.dispatch(deleteSelection(this.getSelection()));
}
diff --git a/app/styles/oligrapher.editor.css b/app/styles/oligrapher.editor.css
index 254193b..93a42ee 100755
--- a/app/styles/oligrapher.editor.css
+++ b/app/styles/oligrapher.editor.css
@@ -57,12 +57,14 @@ button#toggleEditTools {
top: 15px;
left: 60px;
width:250px;
+ pointer-events: none;
}
#buttons .buttonGroup {
display: inline-block;
margin-right: 10px;
margin-bottom: 10px;
+ pointer-events: all;
}
#addNodeInput {
@@ -79,6 +81,18 @@ button#toggleEditTools {
display: block;
}
+#deleteSelected {
+ position: absolute;
+}
+
+.editForm.nodeDelete {
+ margin-top: 120px;
+}
+
+.editForm.edgeDelete {
+ margin-top: 80px;
+}
+
.editForm {
position: absolute;
display: inline-block;
diff --git a/build/oligrapher.js b/build/oligrapher.js
index 6e746d8..8c28483 100644
--- a/build/oligrapher.js
+++ b/build/oligrapher.js
@@ -65,11 +65,7 @@ return /******/ (function(modules) { // webpackBootstrap
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- 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; }; })();
-
- 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'); } }
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -81,51 +77,55 @@ return /******/ (function(modules) { // webpackBootstrap
var _redux = __webpack_require__(155);
- var _reactRedux = __webpack_require__(164);
+ var _reactRedux = __webpack_require__(168);
- var _reduxLogger = __webpack_require__(173);
+ var _reduxLogger = __webpack_require__(181);
var _reduxLogger2 = _interopRequireDefault(_reduxLogger);
- var _reduxThunk = __webpack_require__(174);
+ var _reduxThunk = __webpack_require__(182);
var _reduxThunk2 = _interopRequireDefault(_reduxThunk);
- var _componentsRoot = __webpack_require__(175);
+ var _Root = __webpack_require__(183);
- var _componentsRoot2 = _interopRequireDefault(_componentsRoot);
+ var _Root2 = _interopRequireDefault(_Root);
- var _reducers = __webpack_require__(469);
+ var _reducers = __webpack_require__(446);
var _reducers2 = _interopRequireDefault(_reducers);
- var _actions = __webpack_require__(177);
+ var _actions = __webpack_require__(185);
+
+ var _Graph = __webpack_require__(186);
- var _modelsGraph = __webpack_require__(178);
+ var _Graph2 = _interopRequireDefault(_Graph);
- var _modelsGraph2 = _interopRequireDefault(_modelsGraph);
+ var _merge = __webpack_require__(188);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _merge2 = _interopRequireDefault(_merge);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _assign = __webpack_require__(250);
- var _lodashObjectAssign = __webpack_require__(242);
+ var _assign2 = _interopRequireDefault(_assign);
- var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
+ var _difference = __webpack_require__(270);
- var _lodashArrayDifference = __webpack_require__(262);
+ var _difference2 = _interopRequireDefault(_difference);
- var _lodashArrayDifference2 = _interopRequireDefault(_lodashArrayDifference);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- __webpack_require__(481);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Oligrapher = (function () {
+ __webpack_require__(459);
+
+ var Oligrapher = function () {
function Oligrapher() {
var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, Oligrapher);
- config = (0, _lodashObjectMerge2['default'])({
+ config = (0, _merge2.default)({
isEditor: false,
isLocked: true,
logActions: false,
@@ -135,15 +135,15 @@ return /******/ (function(modules) { // webpackBootstrap
this.rootElement = config.root;
- var createStoreWithMiddleware = undefined;
+ var createStoreWithMiddleware = void 0;
if (config.logActions) {
- var logger = (0, _reduxLogger2['default'])();
- createStoreWithMiddleware = (0, _redux.applyMiddleware)(_reduxThunk2['default'], logger)(_redux.createStore);
- this.store = createStoreWithMiddleware(_reducers2['default']);
+ var logger = (0, _reduxLogger2.default)();
+ createStoreWithMiddleware = (0, _redux.applyMiddleware)(_reduxThunk2.default, logger)(_redux.createStore);
+ this.store = createStoreWithMiddleware(_reducers2.default);
} else {
- createStoreWithMiddleware = (0, _redux.applyMiddleware)(_reduxThunk2['default'])(_redux.createStore);
- this.store = createStoreWithMiddleware(_reducers2['default']);
+ createStoreWithMiddleware = (0, _redux.applyMiddleware)(_reduxThunk2.default)(_redux.createStore);
+ this.store = createStoreWithMiddleware(_reducers2.default);
}
this._render(config);
@@ -158,11 +158,11 @@ return /******/ (function(modules) { // webpackBootstrap
this.props = props;
- _reactDom2['default'].render(_react2['default'].createElement(
+ _reactDom2.default.render(_react2.default.createElement(
_reactRedux.Provider,
{ store: this.store },
- _react2['default'].createElement(_componentsRoot2['default'], _extends({}, props, {
- ref: function (c) {
+ _react2.default.createElement(_Root2.default, _extends({}, props, {
+ ref: function ref(c) {
return _this.root = c;
} }))
), this.rootElement);
@@ -175,7 +175,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'update',
value: function update(newProps) {
- var props = (0, _lodashObjectAssign2['default'])({}, this.props, newProps);
+ var props = (0, _assign2.default)({}, this.props, newProps);
this._render(props);
}
}, {
@@ -232,7 +232,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
}, {
key: 'showAnnotation',
- value: (function (_showAnnotation) {
+ value: function (_showAnnotation) {
function showAnnotation(_x) {
return _showAnnotation.apply(this, arguments);
}
@@ -242,7 +242,7 @@ return /******/ (function(modules) { // webpackBootstrap
};
return showAnnotation;
- })(function (index) {
+ }(function (index) {
this.root.dispatchProps.dispatch(showAnnotation(index));
})
}, {
@@ -266,7 +266,7 @@ return /******/ (function(modules) { // webpackBootstrap
var nodeIds = Object.keys(this.root.getWrappedInstance().props.graph.nodes);
this.root.dispatchProps.dispatch((0, _actions.addNode)(node));
var newNodeIds = Object.keys(this.root.getWrappedInstance().props.graph.nodes);
- return (0, _lodashArrayDifference2['default'])(newNodeIds, nodeIds);
+ return (0, _difference2.default)(newNodeIds, nodeIds);
}
}, {
key: 'addEdge',
@@ -274,7 +274,7 @@ return /******/ (function(modules) { // webpackBootstrap
var edgeIds = Object.keys(this.root.getWrappedInstance().props.graph.edges);
this.root.dispatchProps.dispatch((0, _actions.addEdge)(edge));
var newEdgeIds = Object.keys(this.root.getWrappedInstance().props.graph.edges);
- return (0, _lodashArrayDifference2['default'])(newEdgeIds, edgeIds);
+ return (0, _difference2.default)(newEdgeIds, edgeIds);
}
}, {
key: 'addCaption',
@@ -282,7 +282,7 @@ return /******/ (function(modules) { // webpackBootstrap
var captionIds = Object.keys(this.root.getWrappedInstance().props.graph.captions);
this.root.dispatchProps.dispatch((0, _actions.addCaption)(caption));
var newCaptionIds = Object.keys(this.root.getWrappedInstance().props.graph.captions);
- return (0, _lodashArrayDifference2['default'])(newCaptionIds, captionIds);
+ return (0, _difference2.default)(newCaptionIds, captionIds);
}
}, {
key: 'addSurroundingNodes',
@@ -290,7 +290,7 @@ return /******/ (function(modules) { // webpackBootstrap
var nodeIds = Object.keys(this.root.getWrappedInstance().props.graph.nodes);
this.root.dispatchProps.dispatch((0, _actions.addSurroundingNodes)(centerId, nodes));
var newNodeIds = Object.keys(this.root.getWrappedInstance().props.graph.nodes);
- return (0, _lodashArrayDifference2['default'])(newNodeIds, nodeIds);
+ return (0, _difference2.default)(newNodeIds, nodeIds);
}
}, {
key: 'deleteNode',
@@ -316,7 +316,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'getHighlights',
value: function getHighlights() {
- return _modelsGraph2['default'].highlightedOnly(this.root.getWrappedInstance().props.graph);
+ return _Graph2.default.highlightedOnly(this.root.getWrappedInstance().props.graph);
}
}, {
key: 'setHighlights',
@@ -345,6 +345,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'deleteSelection',
value: function deleteSelection() {
+ console.log("hey");
this.root.dispatchProps.dispatch((0, _actions.deleteSelection)(this.getSelection()));
}
}, {
@@ -378,7 +379,7 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Oligrapher;
- })();
+ }();
;
@@ -19321,34 +19322,49 @@ return /******/ (function(modules) { // webpackBootstrap
'use strict';
exports.__esModule = true;
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined;
var _createStore = __webpack_require__(156);
var _createStore2 = _interopRequireDefault(_createStore);
- var _utilsCombineReducers = __webpack_require__(158);
+ var _combineReducers = __webpack_require__(163);
- var _utilsCombineReducers2 = _interopRequireDefault(_utilsCombineReducers);
+ var _combineReducers2 = _interopRequireDefault(_combineReducers);
- var _utilsBindActionCreators = __webpack_require__(161);
+ var _bindActionCreators = __webpack_require__(165);
- var _utilsBindActionCreators2 = _interopRequireDefault(_utilsBindActionCreators);
+ var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators);
- var _utilsApplyMiddleware = __webpack_require__(162);
+ var _applyMiddleware = __webpack_require__(166);
- var _utilsApplyMiddleware2 = _interopRequireDefault(_utilsApplyMiddleware);
+ var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware);
- var _utilsCompose = __webpack_require__(163);
+ var _compose = __webpack_require__(167);
- var _utilsCompose2 = _interopRequireDefault(_utilsCompose);
+ var _compose2 = _interopRequireDefault(_compose);
- exports.createStore = _createStore2['default'];
- exports.combineReducers = _utilsCombineReducers2['default'];
- exports.bindActionCreators = _utilsBindActionCreators2['default'];
- exports.applyMiddleware = _utilsApplyMiddleware2['default'];
- exports.compose = _utilsCompose2['default'];
+ var _warning = __webpack_require__(164);
+
+ var _warning2 = _interopRequireDefault(_warning);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ /*
+ * This is a dummy function to check if the function name has been altered by minification.
+ * If the function has been minified and NODE_ENV !== 'production', warn the user.
+ */
+ function isCrushed() {}
+
+ if (false) {
+ (0, _warning2["default"])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
+ }
+
+ exports.createStore = _createStore2["default"];
+ exports.combineReducers = _combineReducers2["default"];
+ exports.bindActionCreators = _bindActionCreators2["default"];
+ exports.applyMiddleware = _applyMiddleware2["default"];
+ exports.compose = _compose2["default"];
/***/ },
/* 156 */
@@ -19357,13 +19373,18 @@ return /******/ (function(modules) { // webpackBootstrap
'use strict';
exports.__esModule = true;
- exports['default'] = createStore;
+ exports.ActionTypes = undefined;
+ exports["default"] = createStore;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _isPlainObject = __webpack_require__(157);
+
+ var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
+
+ var _symbolObservable = __webpack_require__(161);
- var _utilsIsPlainObject = __webpack_require__(157);
+ var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
- var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* These are private action types reserved by Redux.
@@ -19371,11 +19392,10 @@ return /******/ (function(modules) { // webpackBootstrap
* If the current state is undefined, you must return the initial state.
* Do not reference these action types directly in your code.
*/
- var ActionTypes = {
+ var ActionTypes = exports.ActionTypes = {
INIT: '@@redux/INIT'
};
- exports.ActionTypes = ActionTypes;
/**
* Creates a Redux store that holds the state tree.
* The only way to change the data in the store is to call `dispatch()` on it.
@@ -19393,20 +19413,46 @@ return /******/ (function(modules) { // webpackBootstrap
* If you use `combineReducers` to produce the root reducer function, this must be
* an object with the same shape as `combineReducers` keys.
*
+ * @param {Function} enhancer The store enhancer. You may optionally specify it
+ * to enhance the store with third-party capabilities such as middleware,
+ * time travel, persistence, etc. The only store enhancer that ships with Redux
+ * is `applyMiddleware()`.
+ *
* @returns {Store} A Redux store that lets you read the state, dispatch actions
* and subscribe to changes.
*/
+ function createStore(reducer, initialState, enhancer) {
+ var _ref2;
+
+ if (typeof initialState === 'function' && typeof enhancer === 'undefined') {
+ enhancer = initialState;
+ initialState = undefined;
+ }
+
+ if (typeof enhancer !== 'undefined') {
+ if (typeof enhancer !== 'function') {
+ throw new Error('Expected the enhancer to be a function.');
+ }
+
+ return enhancer(createStore)(reducer, initialState);
+ }
- function createStore(reducer, initialState) {
if (typeof reducer !== 'function') {
throw new Error('Expected the reducer to be a function.');
}
var currentReducer = reducer;
var currentState = initialState;
- var listeners = [];
+ var currentListeners = [];
+ var nextListeners = currentListeners;
var isDispatching = false;
+ function ensureCanMutateNextListeners() {
+ if (nextListeners === currentListeners) {
+ nextListeners = currentListeners.slice();
+ }
+ }
+
/**
* Reads the state tree managed by the store.
*
@@ -19421,21 +19467,44 @@ return /******/ (function(modules) { // webpackBootstrap
* and some part of the state tree may potentially have changed. You may then
* call `getState()` to read the current state tree inside the callback.
*
+ * You may call `dispatch()` from a change listener, with the following
+ * caveats:
+ *
+ * 1. The subscriptions are snapshotted just before every `dispatch()` call.
+ * If you subscribe or unsubscribe while the listeners are being invoked, this
+ * will not have any effect on the `dispatch()` that is currently in progress.
+ * However, the next `dispatch()` call, whether nested or not, will use a more
+ * recent snapshot of the subscription list.
+ *
+ * 2. The listener should not expect to see all state changes, as the state
+ * might have been updated multiple times during a nested `dispatch()` before
+ * the listener is called. It is, however, guaranteed that all subscribers
+ * registered before the `dispatch()` started will be called with the latest
+ * state by the time it exits.
+ *
* @param {Function} listener A callback to be invoked on every dispatch.
* @returns {Function} A function to remove this change listener.
*/
function subscribe(listener) {
- listeners.push(listener);
+ if (typeof listener !== 'function') {
+ throw new Error('Expected listener to be a function.');
+ }
+
var isSubscribed = true;
+ ensureCanMutateNextListeners();
+ nextListeners.push(listener);
+
return function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
- var index = listeners.indexOf(listener);
- listeners.splice(index, 1);
+
+ ensureCanMutateNextListeners();
+ var index = nextListeners.indexOf(listener);
+ nextListeners.splice(index, 1);
};
}
@@ -19465,7 +19534,7 @@ return /******/ (function(modules) { // webpackBootstrap
* return something else (for example, a Promise you can await).
*/
function dispatch(action) {
- if (!_utilsIsPlainObject2['default'](action)) {
+ if (!(0, _isPlainObject2["default"])(action)) {
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
}
@@ -19484,9 +19553,11 @@ return /******/ (function(modules) { // webpackBootstrap
isDispatching = false;
}
- listeners.slice().forEach(function (listener) {
- return listener();
- });
+ var listeners = currentListeners = nextListeners;
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i]();
+ }
+
return action;
}
@@ -19501,106 +19572,303 @@ return /******/ (function(modules) { // webpackBootstrap
* @returns {void}
*/
function replaceReducer(nextReducer) {
+ if (typeof nextReducer !== 'function') {
+ throw new Error('Expected the nextReducer to be a function.');
+ }
+
currentReducer = nextReducer;
dispatch({ type: ActionTypes.INIT });
}
+ /**
+ * Interoperability point for observable/reactive libraries.
+ * @returns {observable} A minimal observable of state changes.
+ * For more information, see the observable proposal:
+ * https://github.com/zenparsing/es-observable
+ */
+ function observable() {
+ var _ref;
+
+ var outerSubscribe = subscribe;
+ return _ref = {
+ /**
+ * The minimal observable subscription method.
+ * @param {Object} observer Any object that can be used as an observer.
+ * The observer object should have a `next` method.
+ * @returns {subscription} An object with an `unsubscribe` method that can
+ * be used to unsubscribe the observable from the store, and prevent further
+ * emission of values from the observable.
+ */
+
+ subscribe: function subscribe(observer) {
+ if (typeof observer !== 'object') {
+ throw new TypeError('Expected the observer to be an object.');
+ }
+
+ function observeState() {
+ if (observer.next) {
+ observer.next(getState());
+ }
+ }
+
+ observeState();
+ var unsubscribe = outerSubscribe(observeState);
+ return { unsubscribe: unsubscribe };
+ }
+ }, _ref[_symbolObservable2["default"]] = function () {
+ return this;
+ }, _ref;
+ }
+
// When a store is created, an "INIT" action is dispatched so that every
// reducer returns their initial state. This effectively populates
// the initial state tree.
dispatch({ type: ActionTypes.INIT });
- return {
+ return _ref2 = {
dispatch: dispatch,
subscribe: subscribe,
getState: getState,
replaceReducer: replaceReducer
- };
+ }, _ref2[_symbolObservable2["default"]] = observable, _ref2;
}
/***/ },
/* 157 */
-/***/ function(module, exports) {
+/***/ function(module, exports, __webpack_require__) {
- 'use strict';
+ var getPrototype = __webpack_require__(158),
+ isHostObject = __webpack_require__(159),
+ isObjectLike = __webpack_require__(160);
- exports.__esModule = true;
- exports['default'] = isPlainObject;
- var fnToString = function fnToString(fn) {
- return Function.prototype.toString.call(fn);
- };
+ /** `Object#toString` result references. */
+ var objectTag = '[object Object]';
+
+ /** Used for built-in method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to resolve the decompiled source of functions. */
+ var funcToString = Function.prototype.toString;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Used to infer the `Object` constructor. */
+ var objectCtorString = funcToString.call(Object);
/**
- * @param {any} obj The object to inspect.
- * @returns {boolean} True if the argument appears to be a plain object.
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
*/
+ var objectToString = objectProto.toString;
- function isPlainObject(obj) {
- if (!obj || typeof obj !== 'object') {
+ /**
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.8.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object,
+ * else `false`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * _.isPlainObject(new Foo);
+ * // => false
+ *
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
+ *
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
+ */
+ function isPlainObject(value) {
+ if (!isObjectLike(value) ||
+ objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
-
- var proto = typeof obj.constructor === 'function' ? Object.getPrototypeOf(obj) : Object.prototype;
-
+ var proto = getPrototype(value);
if (proto === null) {
return true;
}
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
+ return (typeof Ctor == 'function' &&
+ Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
+ }
+
+ module.exports = isPlainObject;
+
+
+/***/ },
+/* 158 */
+/***/ function(module, exports) {
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeGetPrototype = Object.getPrototypeOf;
+
+ /**
+ * Gets the `[[Prototype]]` of `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {null|Object} Returns the `[[Prototype]]`.
+ */
+ function getPrototype(value) {
+ return nativeGetPrototype(Object(value));
+ }
+
+ module.exports = getPrototype;
+
+
+/***/ },
+/* 159 */
+/***/ function(module, exports) {
+
+ /**
+ * Checks if `value` is a host object in IE < 9.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
+ */
+ function isHostObject(value) {
+ // Many host objects are `Object` objects that can coerce to strings
+ // despite having improperly defined `toString` methods.
+ var result = false;
+ if (value != null && typeof value.toString != 'function') {
+ try {
+ result = !!(value + '');
+ } catch (e) {}
+ }
+ return result;
+ }
- var constructor = proto.constructor;
+ module.exports = isHostObject;
- return typeof constructor === 'function' && constructor instanceof constructor && fnToString(constructor) === fnToString(Object);
+
+/***/ },
+/* 160 */
+/***/ function(module, exports) {
+
+ /**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+ function isObjectLike(value) {
+ return !!value && typeof value == 'object';
}
- module.exports = exports['default'];
+ module.exports = isObjectLike;
+
/***/ },
-/* 158 */
+/* 161 */
/***/ function(module, exports, __webpack_require__) {
+ /* WEBPACK VAR INJECTION */(function(global) {/* global window */
'use strict';
- exports.__esModule = true;
- exports['default'] = combineReducers;
+ module.exports = __webpack_require__(162)(global || window || this);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
- var _createStore = __webpack_require__(156);
+/***/ },
+/* 162 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ module.exports = function symbolObservablePonyfill(root) {
+ var result;
+ var Symbol = root.Symbol;
- var _utilsIsPlainObject = __webpack_require__(157);
+ if (typeof Symbol === 'function') {
+ if (Symbol.observable) {
+ result = Symbol.observable;
+ } else {
+ result = Symbol('observable');
+ Symbol.observable = result;
+ }
+ } else {
+ result = '@@observable';
+ }
- var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
+ return result;
+ };
- var _utilsMapValues = __webpack_require__(159);
- var _utilsMapValues2 = _interopRequireDefault(_utilsMapValues);
+/***/ },
+/* 163 */
+/***/ function(module, exports, __webpack_require__) {
- var _utilsPick = __webpack_require__(160);
+ 'use strict';
- var _utilsPick2 = _interopRequireDefault(_utilsPick);
+ exports.__esModule = true;
+ exports["default"] = combineReducers;
- /* eslint-disable no-console */
+ var _createStore = __webpack_require__(156);
+
+ var _isPlainObject = __webpack_require__(157);
+
+ var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
+
+ var _warning = __webpack_require__(164);
+
+ var _warning2 = _interopRequireDefault(_warning);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getUndefinedStateErrorMessage(key, action) {
var actionType = action && action.type;
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
- return 'Reducer "' + key + '" returned undefined handling ' + actionName + '. ' + 'To ignore an action, you must explicitly return the previous state.';
+ return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.';
}
- function getUnexpectedStateKeyWarningMessage(inputState, outputState, action) {
- var reducerKeys = Object.keys(outputState);
+ function getUnexpectedStateShapeWarningMessage(inputState, reducers, action) {
+ var reducerKeys = Object.keys(reducers);
var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'initialState argument passed to createStore' : 'previous state received by the reducer';
if (reducerKeys.length === 0) {
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
}
- if (!_utilsIsPlainObject2['default'](inputState)) {
- return 'The ' + argumentName + ' has unexpected type of "' + ({}).toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
+ if (!(0, _isPlainObject2["default"])(inputState)) {
+ return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
}
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
- return reducerKeys.indexOf(key) < 0;
+ return !reducers.hasOwnProperty(key);
});
if (unexpectedKeys.length > 0) {
@@ -19640,122 +19908,95 @@ return /******/ (function(modules) { // webpackBootstrap
* @returns {Function} A reducer function that invokes every reducer inside the
* passed object, and builds a state object with the same shape.
*/
-
function combineReducers(reducers) {
- var finalReducers = _utilsPick2['default'](reducers, function (val) {
- return typeof val === 'function';
- });
- var sanityError;
+ var reducerKeys = Object.keys(reducers);
+ var finalReducers = {};
+ for (var i = 0; i < reducerKeys.length; i++) {
+ var key = reducerKeys[i];
+ if (typeof reducers[key] === 'function') {
+ finalReducers[key] = reducers[key];
+ }
+ }
+ var finalReducerKeys = Object.keys(finalReducers);
+ var sanityError;
try {
assertReducerSanity(finalReducers);
} catch (e) {
sanityError = e;
}
- var defaultState = _utilsMapValues2['default'](finalReducers, function () {
- return undefined;
- });
-
- return function combination(state, action) {
- if (state === undefined) state = defaultState;
+ return function combination() {
+ var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+ var action = arguments[1];
if (sanityError) {
throw sanityError;
}
+ if (false) {
+ var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action);
+ if (warningMessage) {
+ (0, _warning2["default"])(warningMessage);
+ }
+ }
+
var hasChanged = false;
- var finalState = _utilsMapValues2['default'](finalReducers, function (reducer, key) {
+ var nextState = {};
+ for (var i = 0; i < finalReducerKeys.length; i++) {
+ var key = finalReducerKeys[i];
+ var reducer = finalReducers[key];
var previousStateForKey = state[key];
var nextStateForKey = reducer(previousStateForKey, action);
if (typeof nextStateForKey === 'undefined') {
var errorMessage = getUndefinedStateErrorMessage(key, action);
throw new Error(errorMessage);
}
+ nextState[key] = nextStateForKey;
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
- return nextStateForKey;
- });
-
- if (false) {
- var warningMessage = getUnexpectedStateKeyWarningMessage(state, finalState, action);
- if (warningMessage) {
- console.error(warningMessage);
- }
}
-
- return hasChanged ? finalState : state;
+ return hasChanged ? nextState : state;
};
}
- module.exports = exports['default'];
-
/***/ },
-/* 159 */
+/* 164 */
/***/ function(module, exports) {
- /**
- * Applies a function to every key-value pair inside an object.
- *
- * @param {Object} obj The source object.
- * @param {Function} fn The mapper function that receives the value and the key.
- * @returns {Object} A new object that contains the mapped values for the keys.
- */
- "use strict";
+ 'use strict';
exports.__esModule = true;
- exports["default"] = mapValues;
-
- function mapValues(obj, fn) {
- return Object.keys(obj).reduce(function (result, key) {
- result[key] = fn(obj[key], key);
- return result;
- }, {});
- }
-
- module.exports = exports["default"];
-
-/***/ },
-/* 160 */
-/***/ function(module, exports) {
-
+ exports["default"] = warning;
/**
- * Picks key-value pairs from an object where values satisfy a predicate.
+ * Prints a warning in the console if it exists.
*
- * @param {Object} obj The object to pick from.
- * @param {Function} fn The predicate the values must satisfy to be copied.
- * @returns {Object} The object with the values that satisfied the predicate.
+ * @param {String} message The warning message.
+ * @returns {void}
*/
- "use strict";
-
- exports.__esModule = true;
- exports["default"] = pick;
-
- function pick(obj, fn) {
- return Object.keys(obj).reduce(function (result, key) {
- if (fn(obj[key])) {
- result[key] = obj[key];
- }
- return result;
- }, {});
+ function warning(message) {
+ /* eslint-disable no-console */
+ if (typeof console !== 'undefined' && typeof console.error === 'function') {
+ console.error(message);
+ }
+ /* eslint-enable no-console */
+ try {
+ // This error was thrown as a convenience so that if you enable
+ // "break on all exceptions" in your console,
+ // it would pause the execution at this line.
+ throw new Error(message);
+ /* eslint-disable no-empty */
+ } catch (e) {}
+ /* eslint-enable no-empty */
}
- module.exports = exports["default"];
-
/***/ },
-/* 161 */
-/***/ function(module, exports, __webpack_require__) {
+/* 165 */
+/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
- exports['default'] = bindActionCreators;
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
- var _utilsMapValues = __webpack_require__(159);
-
- var _utilsMapValues2 = _interopRequireDefault(_utilsMapValues);
-
+ exports["default"] = bindActionCreators;
function bindActionCreator(actionCreator, dispatch) {
return function () {
return dispatch(actionCreator.apply(undefined, arguments));
@@ -19783,26 +20024,29 @@ return /******/ (function(modules) { // webpackBootstrap
* function as `actionCreators`, the return value will also be a single
* function.
*/
-
function bindActionCreators(actionCreators, dispatch) {
if (typeof actionCreators === 'function') {
return bindActionCreator(actionCreators, dispatch);
}
- if (typeof actionCreators !== 'object' || actionCreators === null || actionCreators === undefined) {
- // eslint-disable-line no-eq-null
+ if (typeof actionCreators !== 'object' || actionCreators === null) {
throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
}
- return _utilsMapValues2['default'](actionCreators, function (actionCreator) {
- return bindActionCreator(actionCreator, dispatch);
- });
+ var keys = Object.keys(actionCreators);
+ var boundActionCreators = {};
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ var actionCreator = actionCreators[key];
+ if (typeof actionCreator === 'function') {
+ boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
+ }
+ }
+ return boundActionCreators;
}
- module.exports = exports['default'];
-
/***/ },
-/* 162 */
+/* 166 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -19811,14 +20055,14 @@ return /******/ (function(modules) { // webpackBootstrap
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- exports['default'] = applyMiddleware;
+ exports["default"] = applyMiddleware;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
- var _compose = __webpack_require__(163);
+ var _compose = __webpack_require__(167);
var _compose2 = _interopRequireDefault(_compose);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
/**
* Creates a store enhancer that applies middleware to the dispatch method
* of the Redux store. This is handy for a variety of tasks, such as expressing
@@ -19835,15 +20079,14 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {...Function} middlewares The middleware chain to be applied.
* @returns {Function} A store enhancer applying the middleware.
*/
-
function applyMiddleware() {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
- return function (next) {
- return function (reducer, initialState) {
- var store = next(reducer, initialState);
+ return function (createStore) {
+ return function (reducer, initialState, enhancer) {
+ var store = createStore(reducer, initialState, enhancer);
var _dispatch = store.dispatch;
var chain = [];
@@ -19856,7 +20099,7 @@ return /******/ (function(modules) { // webpackBootstrap
chain = middlewares.map(function (middleware) {
return middleware(middlewareAPI);
});
- _dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch);
+ _dispatch = _compose2["default"].apply(undefined, chain)(store.dispatch);
return _extends({}, store, {
dispatch: _dispatch
@@ -19865,88 +20108,111 @@ return /******/ (function(modules) { // webpackBootstrap
};
}
- module.exports = exports['default'];
-
/***/ },
-/* 163 */
+/* 167 */
/***/ function(module, exports) {
- /**
- * Composes single-argument functions from right to left.
- *
- * @param {...Function} funcs The functions to compose.
- * @returns {Function} A function obtained by composing functions from right to
- * left. For example, compose(f, g, h) is identical to arg => f(g(h(arg))).
- */
"use strict";
exports.__esModule = true;
exports["default"] = compose;
+ /**
+ * Composes single-argument functions from right to left. The rightmost
+ * function can take multiple arguments as it provides the signature for
+ * the resulting composite function.
+ *
+ * @param {...Function} funcs The functions to compose.
+ * @returns {Function} A function obtained by composing the argument functions
+ * from right to left. For example, compose(f, g, h) is identical to doing
+ * (...args) => f(g(h(...args))).
+ */
function compose() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
- return function (arg) {
- return funcs.reduceRight(function (composed, f) {
- return f(composed);
- }, arg);
- };
- }
+ if (funcs.length === 0) {
+ return function (arg) {
+ return arg;
+ };
+ } else {
+ var _ret = function () {
+ var last = funcs[funcs.length - 1];
+ var rest = funcs.slice(0, -1);
+ return {
+ v: function v() {
+ return rest.reduceRight(function (composed, f) {
+ return f(composed);
+ }, last.apply(undefined, arguments));
+ }
+ };
+ }();
- module.exports = exports["default"];
+ if (typeof _ret === "object") return _ret.v;
+ }
+ }
/***/ },
-/* 164 */
+/* 168 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
+ exports.connect = exports.Provider = undefined;
- function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
+ var _Provider = __webpack_require__(169);
- var _componentsProvider = __webpack_require__(165);
+ var _Provider2 = _interopRequireDefault(_Provider);
- exports.Provider = _interopRequire(_componentsProvider);
+ var _connect = __webpack_require__(172);
- var _componentsConnect = __webpack_require__(167);
+ var _connect2 = _interopRequireDefault(_connect);
- exports.connect = _interopRequire(_componentsConnect);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ exports.Provider = _Provider2["default"];
+ exports.connect = _connect2["default"];
/***/ },
-/* 165 */
+/* 169 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
+ exports["default"] = undefined;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _react = __webpack_require__(2);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _storeShape = __webpack_require__(170);
- 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 _storeShape2 = _interopRequireDefault(_storeShape);
- var _react = __webpack_require__(2);
+ var _warning = __webpack_require__(171);
+
+ var _warning2 = _interopRequireDefault(_warning);
- var _utilsStoreShape = __webpack_require__(166);
+ 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; }
- var _utilsStoreShape2 = _interopRequireDefault(_utilsStoreShape);
+ 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 didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
-
didWarnAboutReceivingStore = true;
- console.error( // eslint-disable-line no-console
- '
does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/rackt/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
+
+ (0, _warning2["default"])(' does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}
- var Provider = (function (_Component) {
+ var Provider = function (_Component) {
_inherits(Provider, _Component);
Provider.prototype.getChildContext = function getChildContext() {
@@ -19956,18 +20222,11 @@ return /******/ (function(modules) { // webpackBootstrap
function Provider(props, context) {
_classCallCheck(this, Provider);
- _Component.call(this, props, context);
- this.store = props.store;
- }
-
- Provider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
- var store = this.store;
- var nextStore = nextProps.store;
+ var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
- if (store !== nextStore) {
- warnAboutReceivingStore();
- }
- };
+ _this.store = props.store;
+ return _this;
+ }
Provider.prototype.render = function render() {
var children = this.props.children;
@@ -19976,21 +20235,31 @@ return /******/ (function(modules) { // webpackBootstrap
};
return Provider;
- })(_react.Component);
+ }(_react.Component);
+
+ exports["default"] = Provider;
- exports['default'] = Provider;
+ if (false) {
+ Provider.prototype.componentWillReceiveProps = function (nextProps) {
+ var store = this.store;
+ var nextStore = nextProps.store;
+
+ if (store !== nextStore) {
+ warnAboutReceivingStore();
+ }
+ };
+ }
Provider.propTypes = {
- store: _utilsStoreShape2['default'].isRequired,
+ store: _storeShape2["default"].isRequired,
children: _react.PropTypes.element.isRequired
};
Provider.childContextTypes = {
- store: _utilsStoreShape2['default'].isRequired
+ store: _storeShape2["default"].isRequired
};
- module.exports = exports['default'];
/***/ },
-/* 166 */
+/* 170 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -19999,62 +20268,93 @@ return /******/ (function(modules) { // webpackBootstrap
var _react = __webpack_require__(2);
- exports['default'] = _react.PropTypes.shape({
+ exports["default"] = _react.PropTypes.shape({
subscribe: _react.PropTypes.func.isRequired,
dispatch: _react.PropTypes.func.isRequired,
getState: _react.PropTypes.func.isRequired
});
- module.exports = exports['default'];
/***/ },
-/* 167 */
-/***/ function(module, exports, __webpack_require__) {
+/* 171 */
+/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
+ exports["default"] = warning;
+ /**
+ * Prints a warning in the console if it exists.
+ *
+ * @param {String} message The warning message.
+ * @returns {void}
+ */
+ function warning(message) {
+ /* eslint-disable no-console */
+ if (typeof console !== 'undefined' && typeof console.error === 'function') {
+ console.error(message);
+ }
+ /* eslint-enable no-console */
+ try {
+ // This error was thrown as a convenience so that you can use this stack
+ // to find the callsite that caused this warning to fire.
+ throw new Error(message);
+ /* eslint-disable no-empty */
+ } catch (e) {}
+ /* eslint-enable no-empty */
+ }
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
- exports['default'] = connect;
+/***/ },
+/* 172 */
+/***/ function(module, exports, __webpack_require__) {
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- 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; }
+ exports.__esModule = true;
+ exports["default"] = connect;
var _react = __webpack_require__(2);
- var _react2 = _interopRequireDefault(_react);
+ var _storeShape = __webpack_require__(170);
- var _utilsStoreShape = __webpack_require__(166);
+ var _storeShape2 = _interopRequireDefault(_storeShape);
- var _utilsStoreShape2 = _interopRequireDefault(_utilsStoreShape);
+ var _shallowEqual = __webpack_require__(173);
- var _utilsShallowEqual = __webpack_require__(168);
+ var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
- var _utilsShallowEqual2 = _interopRequireDefault(_utilsShallowEqual);
+ var _wrapActionCreators = __webpack_require__(174);
- var _utilsIsPlainObject = __webpack_require__(169);
+ var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators);
- var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
+ var _warning = __webpack_require__(171);
- var _utilsWrapActionCreators = __webpack_require__(170);
+ var _warning2 = _interopRequireDefault(_warning);
- var _utilsWrapActionCreators2 = _interopRequireDefault(_utilsWrapActionCreators);
+ var _isPlainObject = __webpack_require__(175);
- var _hoistNonReactStatics = __webpack_require__(171);
+ var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
+
+ var _hoistNonReactStatics = __webpack_require__(179);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
- var _invariant = __webpack_require__(172);
+ var _invariant = __webpack_require__(180);
var _invariant2 = _interopRequireDefault(_invariant);
- var defaultMapStateToProps = function defaultMapStateToProps() {
+ 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 defaultMapStateToProps = function defaultMapStateToProps(state) {
return {};
- };
+ }; // eslint-disable-line no-unused-vars
var defaultMapDispatchToProps = function defaultMapDispatchToProps(dispatch) {
return { dispatch: dispatch };
};
@@ -20066,6 +20366,16 @@ return /******/ (function(modules) { // webpackBootstrap
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
+ var errorObject = { value: null };
+ function tryCatch(fn, ctx) {
+ try {
+ return fn.apply(ctx);
+ } catch (e) {
+ errorObject.value = e;
+ return errorObject;
+ }
+ }
+
// Helps track hot reloading.
var nextVersion = 0;
@@ -20073,101 +20383,134 @@ return /******/ (function(modules) { // webpackBootstrap
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
var shouldSubscribe = Boolean(mapStateToProps);
- var finalMapStateToProps = mapStateToProps || defaultMapStateToProps;
- var finalMapDispatchToProps = _utilsIsPlainObject2['default'](mapDispatchToProps) ? _utilsWrapActionCreators2['default'](mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps;
+ var mapState = mapStateToProps || defaultMapStateToProps;
+
+ var mapDispatch = undefined;
+ if (typeof mapDispatchToProps === 'function') {
+ mapDispatch = mapDispatchToProps;
+ } else if (!mapDispatchToProps) {
+ mapDispatch = defaultMapDispatchToProps;
+ } else {
+ mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps);
+ }
+
var finalMergeProps = mergeProps || defaultMergeProps;
- var shouldUpdateStateProps = finalMapStateToProps.length > 1;
- var shouldUpdateDispatchProps = finalMapDispatchToProps.length > 1;
var _options$pure = options.pure;
var pure = _options$pure === undefined ? true : _options$pure;
var _options$withRef = options.withRef;
var withRef = _options$withRef === undefined ? false : _options$withRef;
+ var checkMergedEquals = pure && finalMergeProps !== defaultMergeProps;
+
// Helps track hot reloading.
var version = nextVersion++;
- function computeStateProps(store, props) {
- var state = store.getState();
- var stateProps = shouldUpdateStateProps ? finalMapStateToProps(state, props) : finalMapStateToProps(state);
+ return function wrapWithConnect(WrappedComponent) {
+ var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
- _invariant2['default'](_utilsIsPlainObject2['default'](stateProps), '`mapStateToProps` must return an object. Instead received %s.', stateProps);
- return stateProps;
- }
+ function checkStateShape(props, methodName) {
+ if (!(0, _isPlainObject2["default"])(props)) {
+ (0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.'));
+ }
+ }
- function computeDispatchProps(store, props) {
- var dispatch = store.dispatch;
+ function computeMergedProps(stateProps, dispatchProps, parentProps) {
+ var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
+ if (false) {
+ checkStateShape(mergedProps, 'mergeProps');
+ }
+ return mergedProps;
+ }
- var dispatchProps = shouldUpdateDispatchProps ? finalMapDispatchToProps(dispatch, props) : finalMapDispatchToProps(dispatch);
+ var Connect = function (_Component) {
+ _inherits(Connect, _Component);
- _invariant2['default'](_utilsIsPlainObject2['default'](dispatchProps), '`mapDispatchToProps` must return an object. Instead received %s.', dispatchProps);
- return dispatchProps;
- }
+ Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
+ return !pure || this.haveOwnPropsChanged || this.hasStoreStateChanged;
+ };
- function _computeNextState(stateProps, dispatchProps, parentProps) {
- var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
- _invariant2['default'](_utilsIsPlainObject2['default'](mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps);
- return mergedProps;
- }
+ function Connect(props, context) {
+ _classCallCheck(this, Connect);
- return function wrapWithConnect(WrappedComponent) {
- var Connect = (function (_Component) {
- _inherits(Connect, _Component);
+ var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
- Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
- if (!pure) {
- this.updateStateProps(nextProps);
- this.updateDispatchProps(nextProps);
- this.updateState(nextProps);
- return true;
- }
+ _this.version = version;
+ _this.store = props.store || context.store;
- var storeChanged = nextState.storeState !== this.state.storeState;
- var propsChanged = !_utilsShallowEqual2['default'](nextProps, this.props);
- var mapStateProducedChange = false;
- var dispatchPropsChanged = false;
+ (0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a , ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".'));
- if (storeChanged || propsChanged && shouldUpdateStateProps) {
- mapStateProducedChange = this.updateStateProps(nextProps);
+ var storeState = _this.store.getState();
+ _this.state = { storeState: storeState };
+ _this.clearCache();
+ return _this;
+ }
+
+ Connect.prototype.computeStateProps = function computeStateProps(store, props) {
+ if (!this.finalMapStateToProps) {
+ return this.configureFinalMapState(store, props);
}
- if (propsChanged && shouldUpdateDispatchProps) {
- dispatchPropsChanged = this.updateDispatchProps(nextProps);
+ var state = store.getState();
+ var stateProps = this.doStatePropsDependOnOwnProps ? this.finalMapStateToProps(state, props) : this.finalMapStateToProps(state);
+
+ if (false) {
+ checkStateShape(stateProps, 'mapStateToProps');
}
+ return stateProps;
+ };
- if (propsChanged || mapStateProducedChange || dispatchPropsChanged) {
- this.updateState(nextProps);
- return true;
+ Connect.prototype.configureFinalMapState = function configureFinalMapState(store, props) {
+ var mappedState = mapState(store.getState(), props);
+ var isFactory = typeof mappedState === 'function';
+
+ this.finalMapStateToProps = isFactory ? mappedState : mapState;
+ this.doStatePropsDependOnOwnProps = this.finalMapStateToProps.length !== 1;
+
+ if (isFactory) {
+ return this.computeStateProps(store, props);
}
- return false;
+ if (false) {
+ checkStateShape(mappedState, 'mapStateToProps');
+ }
+ return mappedState;
};
- function Connect(props, context) {
- _classCallCheck(this, Connect);
+ Connect.prototype.computeDispatchProps = function computeDispatchProps(store, props) {
+ if (!this.finalMapDispatchToProps) {
+ return this.configureFinalMapDispatch(store, props);
+ }
- _Component.call(this, props, context);
- this.version = version;
- this.store = props.store || context.store;
+ var dispatch = store.dispatch;
- _invariant2['default'](this.store, 'Could not find "store" in either the context or ' + ('props of "' + this.constructor.displayName + '". ') + 'Either wrap the root component in a , ' + ('or explicitly pass "store" as a prop to "' + this.constructor.displayName + '".'));
+ var dispatchProps = this.doDispatchPropsDependOnOwnProps ? this.finalMapDispatchToProps(dispatch, props) : this.finalMapDispatchToProps(dispatch);
- this.stateProps = computeStateProps(this.store, props);
- this.dispatchProps = computeDispatchProps(this.store, props);
- this.state = { storeState: null };
- this.updateState();
- }
+ if (false) {
+ checkStateShape(dispatchProps, 'mapDispatchToProps');
+ }
+ return dispatchProps;
+ };
- Connect.prototype.computeNextState = function computeNextState() {
- var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
+ Connect.prototype.configureFinalMapDispatch = function configureFinalMapDispatch(store, props) {
+ var mappedDispatch = mapDispatch(store.dispatch, props);
+ var isFactory = typeof mappedDispatch === 'function';
- return _computeNextState(this.stateProps, this.dispatchProps, props);
- };
+ this.finalMapDispatchToProps = isFactory ? mappedDispatch : mapDispatch;
+ this.doDispatchPropsDependOnOwnProps = this.finalMapDispatchToProps.length !== 1;
- Connect.prototype.updateStateProps = function updateStateProps() {
- var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
+ if (isFactory) {
+ return this.computeDispatchProps(store, props);
+ }
- var nextStateProps = computeStateProps(this.store, props);
- if (_utilsShallowEqual2['default'](nextStateProps, this.stateProps)) {
+ if (false) {
+ checkStateShape(mappedDispatch, 'mapDispatchToProps');
+ }
+ return mappedDispatch;
+ };
+
+ Connect.prototype.updateStatePropsIfNeeded = function updateStatePropsIfNeeded() {
+ var nextStateProps = this.computeStateProps(this.store, this.props);
+ if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) {
return false;
}
@@ -20175,11 +20518,9 @@ return /******/ (function(modules) { // webpackBootstrap
return true;
};
- Connect.prototype.updateDispatchProps = function updateDispatchProps() {
- var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
-
- var nextDispatchProps = computeDispatchProps(this.store, props);
- if (_utilsShallowEqual2['default'](nextDispatchProps, this.dispatchProps)) {
+ Connect.prototype.updateDispatchPropsIfNeeded = function updateDispatchPropsIfNeeded() {
+ var nextDispatchProps = this.computeDispatchProps(this.store, this.props);
+ if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) {
return false;
}
@@ -20187,10 +20528,14 @@ return /******/ (function(modules) { // webpackBootstrap
return true;
};
- Connect.prototype.updateState = function updateState() {
- var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
+ Connect.prototype.updateMergedPropsIfNeeded = function updateMergedPropsIfNeeded() {
+ var nextMergedProps = computeMergedProps(this.stateProps, this.dispatchProps, this.props);
+ if (this.mergedProps && checkMergedEquals && (0, _shallowEqual2["default"])(nextMergedProps, this.mergedProps)) {
+ return false;
+ }
- this.nextState = this.computeNextState(props);
+ this.mergedProps = nextMergedProps;
+ return true;
};
Connect.prototype.isSubscribed = function isSubscribed() {
@@ -20215,8 +20560,28 @@ return /******/ (function(modules) { // webpackBootstrap
this.trySubscribe();
};
+ Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
+ if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) {
+ this.haveOwnPropsChanged = true;
+ }
+ };
+
Connect.prototype.componentWillUnmount = function componentWillUnmount() {
this.tryUnsubscribe();
+ this.clearCache();
+ };
+
+ Connect.prototype.clearCache = function clearCache() {
+ this.dispatchProps = null;
+ this.stateProps = null;
+ this.mergedProps = null;
+ this.haveOwnPropsChanged = true;
+ this.hasStoreStateChanged = true;
+ this.haveStatePropsBeenPrecalculated = false;
+ this.statePropsPrecalculationError = null;
+ this.renderedElement = null;
+ this.finalMapDispatchToProps = null;
+ this.finalMapStateToProps = null;
};
Connect.prototype.handleChange = function handleChange() {
@@ -20224,32 +20589,99 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}
- this.setState({
- storeState: this.store.getState()
- });
+ var storeState = this.store.getState();
+ var prevStoreState = this.state.storeState;
+ if (pure && prevStoreState === storeState) {
+ return;
+ }
+
+ if (pure && !this.doStatePropsDependOnOwnProps) {
+ var haveStatePropsChanged = tryCatch(this.updateStatePropsIfNeeded, this);
+ if (!haveStatePropsChanged) {
+ return;
+ }
+ if (haveStatePropsChanged === errorObject) {
+ this.statePropsPrecalculationError = errorObject.value;
+ }
+ this.haveStatePropsBeenPrecalculated = true;
+ }
+
+ this.hasStoreStateChanged = true;
+ this.setState({ storeState: storeState });
};
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
- _invariant2['default'](withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.');
+ (0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.');
return this.refs.wrappedInstance;
};
Connect.prototype.render = function render() {
- var ref = withRef ? 'wrappedInstance' : null;
- return _react2['default'].createElement(WrappedComponent, _extends({}, this.nextState, { ref: ref }));
+ var haveOwnPropsChanged = this.haveOwnPropsChanged;
+ var hasStoreStateChanged = this.hasStoreStateChanged;
+ var haveStatePropsBeenPrecalculated = this.haveStatePropsBeenPrecalculated;
+ var statePropsPrecalculationError = this.statePropsPrecalculationError;
+ var renderedElement = this.renderedElement;
+
+ this.haveOwnPropsChanged = false;
+ this.hasStoreStateChanged = false;
+ this.haveStatePropsBeenPrecalculated = false;
+ this.statePropsPrecalculationError = null;
+
+ if (statePropsPrecalculationError) {
+ throw statePropsPrecalculationError;
+ }
+
+ var shouldUpdateStateProps = true;
+ var shouldUpdateDispatchProps = true;
+ if (pure && renderedElement) {
+ shouldUpdateStateProps = hasStoreStateChanged || haveOwnPropsChanged && this.doStatePropsDependOnOwnProps;
+ shouldUpdateDispatchProps = haveOwnPropsChanged && this.doDispatchPropsDependOnOwnProps;
+ }
+
+ var haveStatePropsChanged = false;
+ var haveDispatchPropsChanged = false;
+ if (haveStatePropsBeenPrecalculated) {
+ haveStatePropsChanged = true;
+ } else if (shouldUpdateStateProps) {
+ haveStatePropsChanged = this.updateStatePropsIfNeeded();
+ }
+ if (shouldUpdateDispatchProps) {
+ haveDispatchPropsChanged = this.updateDispatchPropsIfNeeded();
+ }
+
+ var haveMergedPropsChanged = true;
+ if (haveStatePropsChanged || haveDispatchPropsChanged || haveOwnPropsChanged) {
+ haveMergedPropsChanged = this.updateMergedPropsIfNeeded();
+ } else {
+ haveMergedPropsChanged = false;
+ }
+
+ if (!haveMergedPropsChanged && renderedElement) {
+ return renderedElement;
+ }
+
+ if (withRef) {
+ this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, {
+ ref: 'wrappedInstance'
+ }));
+ } else {
+ this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps);
+ }
+
+ return this.renderedElement;
};
return Connect;
- })(_react.Component);
+ }(_react.Component);
- Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
+ Connect.displayName = connectDisplayName;
Connect.WrappedComponent = WrappedComponent;
Connect.contextTypes = {
- store: _utilsStoreShape2['default']
+ store: _storeShape2["default"]
};
Connect.propTypes = {
- store: _utilsStoreShape2['default']
+ store: _storeShape2["default"]
};
if (false) {
@@ -20260,30 +20692,23 @@ return /******/ (function(modules) { // webpackBootstrap
// We are hot reloading!
this.version = version;
-
- // Update the state and bindings.
this.trySubscribe();
- this.updateStateProps();
- this.updateDispatchProps();
- this.updateState();
+ this.clearCache();
};
}
- return _hoistNonReactStatics2['default'](Connect, WrappedComponent);
+ return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent);
};
}
- module.exports = exports['default'];
-
/***/ },
-/* 168 */
+/* 173 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = shallowEqual;
-
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
@@ -20307,64 +20732,183 @@ return /******/ (function(modules) { // webpackBootstrap
return true;
}
- module.exports = exports["default"];
-
/***/ },
-/* 169 */
-/***/ function(module, exports) {
+/* 174 */
+/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- exports['default'] = isPlainObject;
- var fnToString = function fnToString(fn) {
- return Function.prototype.toString.call(fn);
- };
+ exports["default"] = wrapActionCreators;
+
+ var _redux = __webpack_require__(155);
+
+ function wrapActionCreators(actionCreators) {
+ return function (dispatch) {
+ return (0, _redux.bindActionCreators)(actionCreators, dispatch);
+ };
+ }
+
+/***/ },
+/* 175 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var getPrototype = __webpack_require__(176),
+ isHostObject = __webpack_require__(177),
+ isObjectLike = __webpack_require__(178);
+
+ /** `Object#toString` result references. */
+ var objectTag = '[object Object]';
+
+ /** Used for built-in method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to resolve the decompiled source of functions. */
+ var funcToString = Function.prototype.toString;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Used to infer the `Object` constructor. */
+ var objectCtorString = funcToString.call(Object);
/**
- * @param {any} obj The object to inspect.
- * @returns {boolean} True if the argument appears to be a plain object.
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
*/
+ var objectToString = objectProto.toString;
- function isPlainObject(obj) {
- if (!obj || typeof obj !== 'object') {
+ /**
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.8.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object,
+ * else `false`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * _.isPlainObject(new Foo);
+ * // => false
+ *
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
+ *
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
+ */
+ function isPlainObject(value) {
+ if (!isObjectLike(value) ||
+ objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
-
- var proto = typeof obj.constructor === 'function' ? Object.getPrototypeOf(obj) : Object.prototype;
-
+ var proto = getPrototype(value);
if (proto === null) {
return true;
}
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
+ return (typeof Ctor == 'function' &&
+ Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
+ }
+
+ module.exports = isPlainObject;
- var constructor = proto.constructor;
- return typeof constructor === 'function' && constructor instanceof constructor && fnToString(constructor) === fnToString(Object);
+/***/ },
+/* 176 */
+/***/ function(module, exports) {
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeGetPrototype = Object.getPrototypeOf;
+
+ /**
+ * Gets the `[[Prototype]]` of `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {null|Object} Returns the `[[Prototype]]`.
+ */
+ function getPrototype(value) {
+ return nativeGetPrototype(Object(value));
}
- module.exports = exports['default'];
+ module.exports = getPrototype;
+
/***/ },
-/* 170 */
-/***/ function(module, exports, __webpack_require__) {
+/* 177 */
+/***/ function(module, exports) {
- 'use strict';
+ /**
+ * Checks if `value` is a host object in IE < 9.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
+ */
+ function isHostObject(value) {
+ // Many host objects are `Object` objects that can coerce to strings
+ // despite having improperly defined `toString` methods.
+ var result = false;
+ if (value != null && typeof value.toString != 'function') {
+ try {
+ result = !!(value + '');
+ } catch (e) {}
+ }
+ return result;
+ }
- exports.__esModule = true;
- exports['default'] = wrapActionCreators;
+ module.exports = isHostObject;
- var _redux = __webpack_require__(155);
- function wrapActionCreators(actionCreators) {
- return function (dispatch) {
- return _redux.bindActionCreators(actionCreators, dispatch);
- };
+/***/ },
+/* 178 */
+/***/ function(module, exports) {
+
+ /**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+ function isObjectLike(value) {
+ return !!value && typeof value == 'object';
}
- module.exports = exports['default'];
+ module.exports = isObjectLike;
+
/***/ },
-/* 171 */
+/* 179 */
/***/ function(module, exports) {
/**
@@ -20393,11 +20937,25 @@ return /******/ (function(modules) { // webpackBootstrap
arity: true
};
- module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
- var keys = Object.getOwnPropertyNames(sourceComponent);
- for (var i=0; i= 0;
};
}
-
// /includeAction
// deprecated ifAction helper
-
function ifAction(rawActions) {
console.error('Deprecation Warning: Please change `ifAction` to `includeAction`');
return includeAction(rawActions);
}
-
// /ifAction
// excludeAction helper
-
function excludeAction() {
var rawActions = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
@@ -21580,19 +22211,18 @@ return /******/ (function(modules) { // webpackBootstrap
return actions.indexOf(action.type) < 0;
};
}
-
// /excludeAction
- // old present state is in the future now
/***/ },
-/* 177 */
+/* 185 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
+ exports.TOGGLE_SETTINGS = exports.TOGGLE_HELP_SCREEN = exports.SET_SETTINGS = exports.SET_TITLE = exports.MOVE_ANNOTATION = exports.TOGGLE_ANNOTATIONS = exports.CREATE_ANNOTATION = exports.DELETE_ANNOTATION = exports.UPDATE_ANNOTATION = exports.SHOW_ANNOTATION = exports.LOAD_ANNOTATIONS = exports.SET_NODE_RESULTS = exports.TOGGLE_ADD_FORM = exports.TOGGLE_EDIT_TOOLS = exports.SET_HIGHLIGHTS = exports.DELETE_ALL = exports.LAYOUT_CIRCLE = exports.PRUNE_GRAPH = exports.UPDATE_CAPTION = exports.UPDATE_EDGE = exports.UPDATE_NODE = exports.DELETE_SELECTION = exports.DELETE_CAPTION = exports.DELETE_EDGE = exports.DELETE_NODE = exports.ADD_INTERLOCKS = exports.ADD_SURROUNDING_NODES = exports.ADD_CAPTION = exports.ADD_EDGE = exports.ADD_NODE = exports.DESELECT_ALL = exports.SWAP_CAPTION_SELECTION = exports.SWAP_EDGE_SELECTION = exports.SWAP_NODE_SELECTION = exports.SWAP_CAPTION_HIGHLIGHT = exports.SWAP_EDGE_HIGHLIGHT = exports.SWAP_NODE_HIGHLIGHT = exports.MOVE_CAPTION = exports.MOVE_EDGE = exports.MOVE_NODE = exports.RESET_ZOOM = exports.ZOOM_OUT = exports.ZOOM_IN = exports.NEW_GRAPH = exports.SHOW_GRAPH = exports.LOAD_GRAPH = undefined;
exports.loadGraph = loadGraph;
exports.newGraph = newGraph;
exports.zoomIn = zoomIn;
@@ -21641,109 +22271,63 @@ return /******/ (function(modules) { // webpackBootstrap
exports.toggleHelpScreen = toggleHelpScreen;
exports.toggleSettings = toggleSettings;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _Graph = __webpack_require__(186);
- var _modelsGraph = __webpack_require__(178);
+ var _Graph2 = _interopRequireDefault(_Graph);
- var _modelsGraph2 = _interopRequireDefault(_modelsGraph);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
* action types
*/
- var LOAD_GRAPH = 'LOAD_GRAPH';
- exports.LOAD_GRAPH = LOAD_GRAPH;
- var SHOW_GRAPH = 'SHOW_GRAPH';
- exports.SHOW_GRAPH = SHOW_GRAPH;
- var NEW_GRAPH = 'NEW_GRAPH';
- exports.NEW_GRAPH = NEW_GRAPH;
- var ZOOM_IN = 'ZOOM_IN';
- exports.ZOOM_IN = ZOOM_IN;
- var ZOOM_OUT = 'ZOOM_OUT';
- exports.ZOOM_OUT = ZOOM_OUT;
- var RESET_ZOOM = 'RESET_ZOOM';
- exports.RESET_ZOOM = RESET_ZOOM;
- var MOVE_NODE = 'MOVE_NODE';
- exports.MOVE_NODE = MOVE_NODE;
- var MOVE_EDGE = 'MOVE_EDGE';
- exports.MOVE_EDGE = MOVE_EDGE;
- var MOVE_CAPTION = 'MOVE_CAPTION';
- exports.MOVE_CAPTION = MOVE_CAPTION;
- var SWAP_NODE_HIGHLIGHT = 'SWAP_NODE_HIGHLIGHT';
- exports.SWAP_NODE_HIGHLIGHT = SWAP_NODE_HIGHLIGHT;
- var SWAP_EDGE_HIGHLIGHT = 'SWAP_EDGE_HIGHLIGHT';
- exports.SWAP_EDGE_HIGHLIGHT = SWAP_EDGE_HIGHLIGHT;
- var SWAP_CAPTION_HIGHLIGHT = 'SWAP_CAPTION_HIGHLIGHT';
- exports.SWAP_CAPTION_HIGHLIGHT = SWAP_CAPTION_HIGHLIGHT;
- var SWAP_NODE_SELECTION = 'SWAP_NODE_SELECTION';
- exports.SWAP_NODE_SELECTION = SWAP_NODE_SELECTION;
- var SWAP_EDGE_SELECTION = 'SWAP_EDGE_SELECTION';
- exports.SWAP_EDGE_SELECTION = SWAP_EDGE_SELECTION;
- var SWAP_CAPTION_SELECTION = 'SWAP_CAPTION_SELECTION';
- exports.SWAP_CAPTION_SELECTION = SWAP_CAPTION_SELECTION;
- var DESELECT_ALL = 'DESELECT_ALL';
- exports.DESELECT_ALL = DESELECT_ALL;
- var ADD_NODE = 'ADD_NODE';
- exports.ADD_NODE = ADD_NODE;
- var ADD_EDGE = 'ADD_EDGE';
- exports.ADD_EDGE = ADD_EDGE;
- var ADD_CAPTION = 'ADD_CAPTION';
- exports.ADD_CAPTION = ADD_CAPTION;
- var ADD_SURROUNDING_NODES = 'ADD_SURROUNDING_NODES';
- exports.ADD_SURROUNDING_NODES = ADD_SURROUNDING_NODES;
- var ADD_INTERLOCKS = 'ADD_INTERLOCKS';
- exports.ADD_INTERLOCKS = ADD_INTERLOCKS;
- var DELETE_NODE = 'DELETE_NODE';
- exports.DELETE_NODE = DELETE_NODE;
- var DELETE_EDGE = 'DELETE_EDGE';
- exports.DELETE_EDGE = DELETE_EDGE;
- var DELETE_CAPTION = 'DELETE_CAPTION';
- exports.DELETE_CAPTION = DELETE_CAPTION;
- var DELETE_SELECTION = 'DELETE_SELECTION';
- exports.DELETE_SELECTION = DELETE_SELECTION;
- var UPDATE_NODE = 'UPDATE_NODE';
- exports.UPDATE_NODE = UPDATE_NODE;
- var UPDATE_EDGE = 'UPDATE_EDGE';
- exports.UPDATE_EDGE = UPDATE_EDGE;
- var UPDATE_CAPTION = 'UPDATE_CAPTION';
- exports.UPDATE_CAPTION = UPDATE_CAPTION;
- var PRUNE_GRAPH = 'PRUNE_GRAPH';
- exports.PRUNE_GRAPH = PRUNE_GRAPH;
- var LAYOUT_CIRCLE = 'LAYOUT_CIRCLE';
- exports.LAYOUT_CIRCLE = LAYOUT_CIRCLE;
- var DELETE_ALL = 'DELETE_ALL';
- exports.DELETE_ALL = DELETE_ALL;
- var SET_HIGHLIGHTS = 'SET_HIGHLIGHTS';
- exports.SET_HIGHLIGHTS = SET_HIGHLIGHTS;
- var TOGGLE_EDIT_TOOLS = 'TOGGLE_EDIT_TOOLS';
- exports.TOGGLE_EDIT_TOOLS = TOGGLE_EDIT_TOOLS;
- var TOGGLE_ADD_FORM = 'TOGGLE_ADD_FORM';
- exports.TOGGLE_ADD_FORM = TOGGLE_ADD_FORM;
- var SET_NODE_RESULTS = 'SET_NODE_RESULTS';
- exports.SET_NODE_RESULTS = SET_NODE_RESULTS;
- var LOAD_ANNOTATIONS = 'LOAD_ANNOTATIONS';
- exports.LOAD_ANNOTATIONS = LOAD_ANNOTATIONS;
- var SHOW_ANNOTATION = 'SHOW_ANNOTATION';
- exports.SHOW_ANNOTATION = SHOW_ANNOTATION;
- var UPDATE_ANNOTATION = 'UPDATE_ANNOTATION';
- exports.UPDATE_ANNOTATION = UPDATE_ANNOTATION;
- var DELETE_ANNOTATION = 'DELETE_ANNOTATION';
- exports.DELETE_ANNOTATION = DELETE_ANNOTATION;
- var CREATE_ANNOTATION = 'CREATE_ANNOTATION';
- exports.CREATE_ANNOTATION = CREATE_ANNOTATION;
- var TOGGLE_ANNOTATIONS = 'TOGGLE_ANNOTATIONS';
- exports.TOGGLE_ANNOTATIONS = TOGGLE_ANNOTATIONS;
- var MOVE_ANNOTATION = 'MOVE_ANNOTATION';
- exports.MOVE_ANNOTATION = MOVE_ANNOTATION;
- var SET_TITLE = 'SET_TITLE';
- exports.SET_TITLE = SET_TITLE;
- var SET_SETTINGS = 'SET_SETTINGS';
- exports.SET_SETTINGS = SET_SETTINGS;
- var TOGGLE_HELP_SCREEN = 'TOGGLE_HELP_SCREEN';
- exports.TOGGLE_HELP_SCREEN = TOGGLE_HELP_SCREEN;
- var TOGGLE_SETTINGS = 'TOGGLE_SETTINGS';
-
- exports.TOGGLE_SETTINGS = TOGGLE_SETTINGS;
+ var LOAD_GRAPH = exports.LOAD_GRAPH = 'LOAD_GRAPH';
+ var SHOW_GRAPH = exports.SHOW_GRAPH = 'SHOW_GRAPH';
+ var NEW_GRAPH = exports.NEW_GRAPH = 'NEW_GRAPH';
+ var ZOOM_IN = exports.ZOOM_IN = 'ZOOM_IN';
+ var ZOOM_OUT = exports.ZOOM_OUT = 'ZOOM_OUT';
+ var RESET_ZOOM = exports.RESET_ZOOM = 'RESET_ZOOM';
+ var MOVE_NODE = exports.MOVE_NODE = 'MOVE_NODE';
+ var MOVE_EDGE = exports.MOVE_EDGE = 'MOVE_EDGE';
+ var MOVE_CAPTION = exports.MOVE_CAPTION = 'MOVE_CAPTION';
+ var SWAP_NODE_HIGHLIGHT = exports.SWAP_NODE_HIGHLIGHT = 'SWAP_NODE_HIGHLIGHT';
+ var SWAP_EDGE_HIGHLIGHT = exports.SWAP_EDGE_HIGHLIGHT = 'SWAP_EDGE_HIGHLIGHT';
+ var SWAP_CAPTION_HIGHLIGHT = exports.SWAP_CAPTION_HIGHLIGHT = 'SWAP_CAPTION_HIGHLIGHT';
+ var SWAP_NODE_SELECTION = exports.SWAP_NODE_SELECTION = 'SWAP_NODE_SELECTION';
+ var SWAP_EDGE_SELECTION = exports.SWAP_EDGE_SELECTION = 'SWAP_EDGE_SELECTION';
+ var SWAP_CAPTION_SELECTION = exports.SWAP_CAPTION_SELECTION = 'SWAP_CAPTION_SELECTION';
+ var DESELECT_ALL = exports.DESELECT_ALL = 'DESELECT_ALL';
+ var ADD_NODE = exports.ADD_NODE = 'ADD_NODE';
+ var ADD_EDGE = exports.ADD_EDGE = 'ADD_EDGE';
+ var ADD_CAPTION = exports.ADD_CAPTION = 'ADD_CAPTION';
+ var ADD_SURROUNDING_NODES = exports.ADD_SURROUNDING_NODES = 'ADD_SURROUNDING_NODES';
+ var ADD_INTERLOCKS = exports.ADD_INTERLOCKS = 'ADD_INTERLOCKS';
+ var DELETE_NODE = exports.DELETE_NODE = 'DELETE_NODE';
+ var DELETE_EDGE = exports.DELETE_EDGE = 'DELETE_EDGE';
+ var DELETE_CAPTION = exports.DELETE_CAPTION = 'DELETE_CAPTION';
+ var DELETE_SELECTION = exports.DELETE_SELECTION = 'DELETE_SELECTION';
+ var UPDATE_NODE = exports.UPDATE_NODE = 'UPDATE_NODE';
+ var UPDATE_EDGE = exports.UPDATE_EDGE = 'UPDATE_EDGE';
+ var UPDATE_CAPTION = exports.UPDATE_CAPTION = 'UPDATE_CAPTION';
+ var PRUNE_GRAPH = exports.PRUNE_GRAPH = 'PRUNE_GRAPH';
+ var LAYOUT_CIRCLE = exports.LAYOUT_CIRCLE = 'LAYOUT_CIRCLE';
+ var DELETE_ALL = exports.DELETE_ALL = 'DELETE_ALL';
+ var SET_HIGHLIGHTS = exports.SET_HIGHLIGHTS = 'SET_HIGHLIGHTS';
+ var TOGGLE_EDIT_TOOLS = exports.TOGGLE_EDIT_TOOLS = 'TOGGLE_EDIT_TOOLS';
+ var TOGGLE_ADD_FORM = exports.TOGGLE_ADD_FORM = 'TOGGLE_ADD_FORM';
+ var SET_NODE_RESULTS = exports.SET_NODE_RESULTS = 'SET_NODE_RESULTS';
+ var LOAD_ANNOTATIONS = exports.LOAD_ANNOTATIONS = 'LOAD_ANNOTATIONS';
+ var SHOW_ANNOTATION = exports.SHOW_ANNOTATION = 'SHOW_ANNOTATION';
+ var UPDATE_ANNOTATION = exports.UPDATE_ANNOTATION = 'UPDATE_ANNOTATION';
+ var DELETE_ANNOTATION = exports.DELETE_ANNOTATION = 'DELETE_ANNOTATION';
+ var CREATE_ANNOTATION = exports.CREATE_ANNOTATION = 'CREATE_ANNOTATION';
+ var TOGGLE_ANNOTATIONS = exports.TOGGLE_ANNOTATIONS = 'TOGGLE_ANNOTATIONS';
+ var MOVE_ANNOTATION = exports.MOVE_ANNOTATION = 'MOVE_ANNOTATION';
+ var SET_TITLE = exports.SET_TITLE = 'SET_TITLE';
+ var SET_SETTINGS = exports.SET_SETTINGS = 'SET_SETTINGS';
+ var TOGGLE_HELP_SCREEN = exports.TOGGLE_HELP_SCREEN = 'TOGGLE_HELP_SCREEN';
+ var TOGGLE_SETTINGS = exports.TOGGLE_SETTINGS = 'TOGGLE_SETTINGS';
+
/*
* action creators
*/
@@ -21753,7 +22337,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
function newGraph() {
- var graph = _modelsGraph2['default'].defaults();
+ var graph = _Graph2.default.defaults();
return { type: NEW_GRAPH, graph: graph };
}
@@ -21841,9 +22425,7 @@ return /******/ (function(modules) { // webpackBootstrap
dispatch(addInterlocks(node1Id, node2Id, data));
});
};
- }
-
- ;
+ };
function addInterlocks(node1Id, node2Id, data) {
return { type: ADD_INTERLOCKS, node1Id: node1Id, node2Id: node2Id, data: data };
@@ -21957,86 +22539,90 @@ return /******/ (function(modules) { // webpackBootstrap
}
/***/ },
-/* 178 */
+/* 186 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
-
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ 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 _Node = __webpack_require__(179);
+ var _Node = __webpack_require__(187);
var _Node2 = _interopRequireDefault(_Node);
- var _Edge = __webpack_require__(240);
+ var _Edge = __webpack_require__(248);
var _Edge2 = _interopRequireDefault(_Edge);
- var _Caption = __webpack_require__(241);
+ var _Caption = __webpack_require__(249);
var _Caption2 = _interopRequireDefault(_Caption);
- var _Helpers = __webpack_require__(214);
+ var _Helpers = __webpack_require__(222);
var _Helpers2 = _interopRequireDefault(_Helpers);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _merge9 = __webpack_require__(188);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _merge10 = _interopRequireDefault(_merge9);
- var _lodashObjectAssign = __webpack_require__(242);
+ var _assign5 = __webpack_require__(250);
- var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
+ var _assign6 = _interopRequireDefault(_assign5);
+
+ var _values = __webpack_require__(252);
+
+ var _values2 = _interopRequireDefault(_values);
- var _lodashObjectValues = __webpack_require__(244);
+ var _intersection = __webpack_require__(254);
- var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues);
+ var _intersection2 = _interopRequireDefault(_intersection);
- var _lodashArrayIntersection = __webpack_require__(246);
+ var _flatten = __webpack_require__(261);
- var _lodashArrayIntersection2 = _interopRequireDefault(_lodashArrayIntersection);
+ var _flatten2 = _interopRequireDefault(_flatten);
- var _lodashArrayFlatten = __webpack_require__(253);
+ var _cloneDeep = __webpack_require__(264);
- var _lodashArrayFlatten2 = _interopRequireDefault(_lodashArrayFlatten);
+ var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
- var _lodashLangCloneDeep = __webpack_require__(256);
+ var _omit = __webpack_require__(265);
- var _lodashLangCloneDeep2 = _interopRequireDefault(_lodashLangCloneDeep);
+ var _omit2 = _interopRequireDefault(_omit);
- var _lodashObjectOmit = __webpack_require__(257);
+ var _difference = __webpack_require__(270);
- var _lodashObjectOmit2 = _interopRequireDefault(_lodashObjectOmit);
+ var _difference2 = _interopRequireDefault(_difference);
- var _lodashArrayDifference = __webpack_require__(262);
+ var _compact = __webpack_require__(271);
- var _lodashArrayDifference2 = _interopRequireDefault(_lodashArrayDifference);
+ var _compact2 = _interopRequireDefault(_compact);
- var _lodashArrayCompact = __webpack_require__(263);
+ var _size = __webpack_require__(272);
- var _lodashArrayCompact2 = _interopRequireDefault(_lodashArrayCompact);
+ var _size2 = _interopRequireDefault(_size);
- var _lodashCollectionSize = __webpack_require__(264);
+ var _includes = __webpack_require__(273);
- var _lodashCollectionSize2 = _interopRequireDefault(_lodashCollectionSize);
+ var _includes2 = _interopRequireDefault(_includes);
- var _lodashCollectionIncludes = __webpack_require__(265);
+ var _isNumber = __webpack_require__(221);
- var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes);
+ var _isNumber2 = _interopRequireDefault(_isNumber);
- var _lodashLangIsNumber = __webpack_require__(213);
+ var _springy = __webpack_require__(274);
- var _lodashLangIsNumber2 = _interopRequireDefault(_lodashLangIsNumber);
+ var _springy2 = _interopRequireDefault(_springy);
- var Graph = (function () {
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+ var Graph = function () {
function Graph() {
_classCallCheck(this, Graph);
}
@@ -22053,12 +22639,12 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'setDefaults',
value: function setDefaults(graph) {
- return (0, _lodashObjectMerge2['default'])({}, this.defaults(), graph);
+ return (0, _merge10.default)({}, this.defaults(), graph);
}
}, {
key: 'hasContent',
value: function hasContent(graph) {
- return (0, _lodashObjectValues2['default'])(graph.nodes).length + (0, _lodashObjectValues2['default'])(graph.edges).length + (0, _lodashObjectValues2['default'])(graph.captions).length > 0;
+ return (0, _values2.default)(graph.nodes).length + (0, _values2.default)(graph.edges).length + (0, _values2.default)(graph.captions).length > 0;
}
// PREPARE DATA DURING LOAD
@@ -22074,51 +22660,51 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'prepareCaptions',
value: function prepareCaptions(graph) {
// list unpositioned captions on left side
- var ary = (0, _lodashObjectValues2['default'])(graph.captions).filter(function (c) {
+ var ary = (0, _values2.default)(graph.captions).filter(function (c) {
return !(c.display.x && c.display.y);
});
- var minX = Math.min.apply(Math, _toConsumableArray((0, _lodashObjectValues2['default'])(graph.nodes).map(function (n) {
+ var minX = Math.min.apply(Math, _toConsumableArray((0, _values2.default)(graph.nodes).map(function (n) {
return n.display.x;
})));
- var minY = Math.min.apply(Math, _toConsumableArray((0, _lodashObjectValues2['default'])(graph.nodes).map(function (n) {
+ var minY = Math.min.apply(Math, _toConsumableArray((0, _values2.default)(graph.nodes).map(function (n) {
return n.display.y;
})));
var captions = ary.reduce(function (result, c, i) {
- result[c.id] = (0, _lodashObjectMerge2['default'])({}, c, { display: { x: minX - 200, y: minY + i * 50 } });
+ result[c.id] = (0, _merge10.default)({}, c, { display: { x: minX - 200, y: minY + i * 50 } });
return result;
}, {});
// set defaults
- var newGraph = (0, _lodashObjectMerge2['default'])({}, graph, {
- captions: (0, _lodashObjectValues2['default'])(graph.captions).reduce(function (result, caption) {
- return (0, _lodashObjectMerge2['default'])({}, result, _defineProperty({}, caption.id, _Caption2['default'].setDefaults(caption)));
+ var newGraph = (0, _merge10.default)({}, graph, {
+ captions: (0, _values2.default)(graph.captions).reduce(function (result, caption) {
+ return (0, _merge10.default)({}, result, _defineProperty({}, caption.id, _Caption2.default.setDefaults(caption)));
}, {})
});
- return (0, _lodashObjectMerge2['default'])({}, newGraph, { captions: captions });
+ return (0, _merge10.default)({}, newGraph, { captions: captions });
}
}, {
key: 'prepareEdges',
value: function prepareEdges(graph, edges) {
var _this = this;
- edges = edges || (0, _lodashObjectValues2['default'])(graph.edges);
+ edges = edges || (0, _values2.default)(graph.edges);
- return (0, _lodashObjectMerge2['default'])({}, graph, {
+ return (0, _merge10.default)({}, graph, {
edges: edges.reduce(function (result, edge) {
- return (0, _lodashObjectMerge2['default'])({}, result, _defineProperty({}, edge.id, _this.updateEdgePosition(_Edge2['default'].setDefaults(edge), graph)));
+ return (0, _merge10.default)({}, result, _defineProperty({}, edge.id, _this.updateEdgePosition(_Edge2.default.setDefaults(edge), graph)));
}, {})
});
}
}, {
key: 'prepareNodes',
value: function prepareNodes(graph) {
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes).reduce(function (result, node) {
- return (0, _lodashObjectMerge2['default'])({}, result, _defineProperty({}, node.id, _Node2['default'].setDefaults(node)));
+ var nodes = (0, _values2.default)(graph.nodes).reduce(function (result, node) {
+ return (0, _merge10.default)({}, result, _defineProperty({}, node.id, _Node2.default.setDefaults(node)));
}, {});
- return (0, _lodashObjectMerge2['default'])({}, graph, { nodes: nodes });
+ return (0, _merge10.default)({}, graph, { nodes: nodes });
}
}, {
key: 'prepareLayout',
@@ -22132,19 +22718,19 @@ return /******/ (function(modules) { // webpackBootstrap
value: function circleLayout(graph) {
var allNodes = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
- var nodes = allNodes ? (0, _lodashObjectValues2['default'])(graph.nodes) : (0, _lodashObjectValues2['default'])(graph.nodes).filter(function (n) {
- return !_Node2['default'].hasPosition(n);
+ var nodes = allNodes ? (0, _values2.default)(graph.nodes) : (0, _values2.default)(graph.nodes).filter(function (n) {
+ return !_Node2.default.hasPosition(n);
});
var radius = Math.pow(nodes.length * 70, 0.85);
- return (0, _lodashObjectMerge2['default'])({}, graph, { nodes: this.arrangeNodesInCircle(nodes, 0, 0, radius) });
+ return (0, _merge10.default)({}, graph, { nodes: this.arrangeNodesInCircle(nodes, 0, 0, radius) });
}
}, {
key: 'arrangeNodesInCircle',
value: function arrangeNodesInCircle(nodes, x, y, radius) {
- return (0, _lodashObjectValues2['default'])(nodes).reduce(function (result, node, i) {
- var angle = 2 * Math.PI * (i / (0, _lodashObjectValues2['default'])(nodes).length);
- return (0, _lodashObjectMerge2['default'])({}, result, _defineProperty({}, node.id, (0, _lodashObjectMerge2['default'])({}, node, { display: {
+ return (0, _values2.default)(nodes).reduce(function (result, node, i) {
+ var angle = 2 * Math.PI * (i / (0, _values2.default)(nodes).length);
+ return (0, _merge10.default)({}, result, _defineProperty({}, node.id, (0, _merge10.default)({}, node, { display: {
x: x + Math.cos(angle) * radius,
y: y + Math.sin(angle) * radius
} })));
@@ -22156,8 +22742,8 @@ return /******/ (function(modules) { // webpackBootstrap
var steps = arguments.length <= 1 || arguments[1] === undefined ? 500 : arguments[1];
// only use force layout if there are unpositioned nodes
- if (!(0, _lodashObjectValues2['default'])(graph.nodes).find(function (n) {
- return !((0, _lodashLangIsNumber2['default'])(n.display.x) && (0, _lodashLangIsNumber2['default'])(n.display.y));
+ if (!(0, _values2.default)(graph.nodes).find(function (n) {
+ return !((0, _isNumber2.default)(n.display.x) && (0, _isNumber2.default)(n.display.y));
})) {
return graph;
}
@@ -22172,7 +22758,7 @@ return /******/ (function(modules) { // webpackBootstrap
layout.tick(0.01);
}
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
layout.eachNode(function (node, point) {
newGraph.nodes[node.data.label].display.x = point.p.x * 100;
@@ -22190,22 +22776,22 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'buildForceLayout',
value: function buildForceLayout(graph) {
- return graph;
-
- // let gr = new Springy.Graph();
+ var gr = new _springy2.default.Graph();
- // let nodeIds = Object.keys(graph.nodes);
- // let edges = values(graph.edges).map(e => [e.node1_id, e.node2_id]);
+ var nodeIds = Object.keys(graph.nodes);
+ var edges = (0, _values2.default)(graph.edges).map(function (e) {
+ return [e.node1_id, e.node2_id];
+ });
- // gr.addNodes(...nodeIds);
- // gr.addEdges(...edges);
+ gr.addNodes.apply(gr, _toConsumableArray(nodeIds));
+ gr.addEdges.apply(gr, _toConsumableArray(edges));
- // let stiffness = 200.0;
- // let repulsion = 300.0;
- // let damping = 0.5;
- // let minEnergyThreshold = 0.1;
+ var stiffness = 200.0;
+ var repulsion = 300.0;
+ var damping = 0.5;
+ var minEnergyThreshold = 0.1;
- // return new Springy.Layout.ForceDirected(gr, stiffness, repulsion, damping, minEnergyThreshold);
+ return new _springy2.default.Layout.ForceDirected(gr, stiffness, repulsion, damping, minEnergyThreshold);
}
}, {
key: 'updateEdgePosition',
@@ -22214,7 +22800,7 @@ return /******/ (function(modules) { // webpackBootstrap
var n1 = graph.nodes[edge.node1_id];
var n2 = graph.nodes[edge.node2_id];
- return (0, _lodashObjectMerge2['default'])({}, edge, { display: {
+ return (0, _merge10.default)({}, edge, { display: {
x1: n1.display.x,
y1: n1.display.y,
x2: n2.display.x,
@@ -22234,13 +22820,13 @@ return /******/ (function(modules) { // webpackBootstrap
var edges = this.edgesConnectedToNode(graph, nodeId);
// update the node
- graph = (0, _lodashObjectMerge2['default'])({}, graph, { nodes: _defineProperty({}, nodeId, { display: { x: x, y: y } }) });
+ graph = (0, _merge10.default)({}, graph, { nodes: _defineProperty({}, nodeId, { display: { x: x, y: y } }) });
// then update the edges
- return (0, _lodashObjectMerge2['default'])({}, graph, { edges: edges.reduce(function (result, edge) {
+ return (0, _merge10.default)({}, graph, { edges: edges.reduce(function (result, edge) {
var nodeNum = edge.node1_id == nodeId ? 1 : 2;
var newEdge = _this2.moveEdgeNode(edge, nodeNum, x, y);
- return (0, _lodashObjectMerge2['default'])({}, result, _defineProperty({}, edge.id, _this2.updateEdgePosition(newEdge, graph)));
+ return (0, _merge10.default)({}, result, _defineProperty({}, edge.id, _this2.updateEdgePosition(newEdge, graph)));
}, {}) });
}
}, {
@@ -22286,17 +22872,17 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_deselectAll',
value: function _deselectAll(graph) {
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes).reduce(function (result, node) {
- result[node.id] = (0, _lodashObjectMerge2['default'])({}, node, { display: { status: "normal" } });
+ var nodes = (0, _values2.default)(graph.nodes).reduce(function (result, node) {
+ result[node.id] = (0, _merge10.default)({}, node, { display: { status: "normal" } });
return result;
}, {});
- var edges = (0, _lodashObjectValues2['default'])(graph.edges).reduce(function (result, edge) {
- result[edge.id] = (0, _lodashObjectMerge2['default'])({}, edge, { display: { status: "normal" } });
+ var edges = (0, _values2.default)(graph.edges).reduce(function (result, edge) {
+ result[edge.id] = (0, _merge10.default)({}, edge, { display: { status: "normal" } });
return result;
}, {});
- return (0, _lodashObjectMerge2['default'])({}, graph, { nodes: nodes, edges: edges });
+ return (0, _merge10.default)({}, graph, { nodes: nodes, edges: edges });
}
// CONTENT CREATION API
@@ -22304,33 +22890,33 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'addNode',
value: function addNode(graph, node) {
- node = (0, _lodashObjectMerge2['default'])({}, _Node2['default'].setDefaults(node), { display: { x: 0, y: 0 } });
- return (0, _lodashObjectMerge2['default'])({}, graph, { nodes: _defineProperty({}, node.id, node) });
+ node = (0, _merge10.default)({}, _Node2.default.setDefaults(node), { display: { x: 0, y: 0 } });
+ return (0, _merge10.default)({}, graph, { nodes: _defineProperty({}, node.id, node) });
}
}, {
key: 'addEdge',
value: function addEdge(graph, edge) {
- edge = this.updateEdgePosition(_Edge2['default'].setDefaults(edge), graph);
- return (0, _lodashObjectMerge2['default'])({}, graph, { edges: _defineProperty({}, edge.id, edge) });
+ edge = this.updateEdgePosition(_Edge2.default.setDefaults(edge), graph);
+ return (0, _merge10.default)({}, graph, { edges: _defineProperty({}, edge.id, edge) });
}
}, {
key: 'addCaption',
value: function addCaption(graph, caption) {
- caption = _Caption2['default'].setDefaults(caption);
- return (0, _lodashObjectMerge2['default'])({}, graph, { captions: _defineProperty({}, caption.id, caption) });
+ caption = _Caption2.default.setDefaults(caption);
+ return (0, _merge10.default)({}, graph, { captions: _defineProperty({}, caption.id, caption) });
}
}, {
key: 'addSurroundingNodes',
value: function addSurroundingNodes(graph, centerId, nodes) {
var preparedNodes = nodes.map(function (n) {
- return _Node2['default'].setDefaults(n);
+ return _Node2.default.setDefaults(n);
});
var centerNode = graph.nodes[centerId];
var x = centerNode.display.x ? centerNode.display.x : 0;
var y = centerNode.display.y ? centerNode.display.y : 0;
var radius = Math.max(150, nodes.length * 150 / (2 * Math.PI));
var newNodes = this.arrangeNodesInCircle(preparedNodes, x, y, radius);
- return (0, _lodashObjectMerge2['default'])({}, graph, { nodes: newNodes });
+ return (0, _merge10.default)({}, graph, { nodes: newNodes });
}
}, {
key: 'addInterlocks',
@@ -22356,11 +22942,11 @@ return /******/ (function(modules) { // webpackBootstrap
nodes = nodes.reduce(function (result, node, i) {
node.display.x = midX + Math.cos(angle) * (-(num - 1) * spacing / 2 + i * spacing);
node.display.y = midY + Math.sin(angle) * (-(num - 1) * spacing / 2 + i * spacing);
- (0, _lodashObjectAssign2['default'])(result, _defineProperty({}, node.id, _Node2['default'].setDefaults(node)));
+ (0, _assign6.default)(result, _defineProperty({}, node.id, _Node2.default.setDefaults(node)));
return result;
}, {});
- var graphWithNodes = (0, _lodashObjectMerge2['default'])({}, graph, { nodes: nodes });
+ var graphWithNodes = (0, _merge10.default)({}, graph, { nodes: nodes });
edges.forEach(function (edge, i) {
graphWithNodes = _this3.addEdge(graphWithNodes, edge);
@@ -22374,7 +22960,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'deleteNode',
value: function deleteNode(graph, nodeId) {
- var newGraph = (0, _lodashObjectMerge2['default'])({}, graph);
+ var newGraph = (0, _merge10.default)({}, graph);
var edges = this.edgesConnectedToNode(graph, nodeId);
delete newGraph.nodes[nodeId];
@@ -22387,7 +22973,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'deleteEdge',
value: function deleteEdge(graph, edgeId) {
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
delete newGraph.edges[edgeId];
@@ -22396,7 +22982,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'deleteCaption',
value: function deleteCaption(graph, captionId) {
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
delete newGraph.captions[captionId];
@@ -22407,8 +22993,8 @@ return /******/ (function(modules) { // webpackBootstrap
value: function deleteNodes(graph, nodeIds) {
var _this4 = this;
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
- var edgeIds = (0, _lodashArrayFlatten2['default'])(nodeIds.map(function (id) {
+ var newGraph = (0, _cloneDeep2.default)(graph);
+ var edgeIds = (0, _flatten2.default)(nodeIds.map(function (id) {
return _this4.edgesConnectedToNode(graph, id).map(function (edge) {
return edge.id;
});
@@ -22426,7 +23012,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'deleteEdges',
value: function deleteEdges(graph, edgeIds) {
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
edgeIds.forEach(function (id) {
return delete newGraph.edges[id];
@@ -22437,7 +23023,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'deleteCaptions',
value: function deleteCaptions(graph, captionIds) {
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
captionIds.forEach(function (id) {
return delete newGraph.captions[id];
@@ -22451,42 +23037,43 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'updateNode',
value: function updateNode(graph, nodeId, data) {
- var node = _Node2['default'].setDefaults(_Helpers2['default'].compactObject((0, _lodashObjectMerge2['default'])({}, graph.nodes[nodeId], (0, _lodashObjectOmit2['default'])(data, "id"))));
+ var node = _Node2.default.setDefaults(_Helpers2.default.compactObject((0, _merge10.default)({}, graph.nodes[nodeId], (0, _omit2.default)(data, "id"))));
- var nodes = (0, _lodashObjectAssign2['default'])({}, graph.nodes, _defineProperty({}, nodeId, node));
+ var nodes = (0, _assign6.default)({}, graph.nodes, _defineProperty({}, nodeId, node));
- return (0, _lodashObjectAssign2['default'])({}, graph, { nodes: nodes });
+ return (0, _assign6.default)({}, graph, { nodes: nodes });
}
}, {
key: 'updateEdge',
value: function updateEdge(graph, edgeId, data) {
- var edge = _Edge2['default'].setDefaults(_Helpers2['default'].compactObject((0, _lodashObjectMerge2['default'])({}, graph.edges[edgeId], (0, _lodashObjectOmit2['default'])(data, "id"))));
+ var edge = _Edge2.default.setDefaults(_Helpers2.default.compactObject((0, _merge10.default)({}, graph.edges[edgeId], (0, _omit2.default)(data, "id"))));
- var edges = (0, _lodashObjectAssign2['default'])({}, graph.edges, _defineProperty({}, edgeId, edge));
+ var edges = (0, _assign6.default)({}, graph.edges, _defineProperty({}, edgeId, edge));
- return (0, _lodashObjectAssign2['default'])({}, graph, { edges: edges });
+ return (0, _assign6.default)({}, graph, { edges: edges });
}
}, {
key: 'updateCaption',
value: function updateCaption(graph, captionId, data) {
- var caption = _Caption2['default'].setDefaults(_Helpers2['default'].compactObject((0, _lodashObjectMerge2['default'])({}, graph.captions[captionId], (0, _lodashObjectOmit2['default'])(data, "id"))));
+ var caption = _Caption2.default.setDefaults(_Helpers2.default.compactObject((0, _merge10.default)({}, graph.captions[captionId], (0, _omit2.default)(data, "id"))));
- var captions = (0, _lodashObjectAssign2['default'])({}, graph.captions, _defineProperty({}, captionId, caption));
+ var captions = (0, _assign6.default)({}, graph.captions, _defineProperty({}, captionId, caption));
- return (0, _lodashObjectAssign2['default'])({}, graph, { captions: captions });
+ return (0, _assign6.default)({}, graph, { captions: captions });
}
// GRAPH FILTERS
// removes unconnected nodes
+
}, {
key: 'prune',
value: function prune(graph) {
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
- var connectedNodeIds = (0, _lodashArrayFlatten2['default'])((0, _lodashObjectValues2['default'])(newGraph.edges).map(function (edge) {
+ var newGraph = (0, _cloneDeep2.default)(graph);
+ var connectedNodeIds = (0, _flatten2.default)((0, _values2.default)(newGraph.edges).map(function (edge) {
return [edge.node1_id, edge.node2_id];
}));
- var orphanNodeIds = (0, _lodashArrayDifference2['default'])(Object.keys(newGraph.nodes).map(function (nodeId) {
+ var orphanNodeIds = (0, _difference2.default)(Object.keys(newGraph.nodes).map(function (nodeId) {
return parseInt(nodeId);
}), connectedNodeIds);
orphanNodeIds.forEach(function (nodeId) {
@@ -22497,21 +23084,21 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'highlightedOnly',
value: function highlightedOnly(graph) {
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes).filter(function (node) {
+ var nodes = (0, _values2.default)(graph.nodes).filter(function (node) {
return node.display.status == "highlighted";
}).reduce(function (result, node) {
result[node.id] = node;
return result;
}, {});
- var edges = (0, _lodashObjectValues2['default'])(graph.edges).filter(function (edge) {
+ var edges = (0, _values2.default)(graph.edges).filter(function (edge) {
return edge.display.status == "highlighted";
}).reduce(function (result, edge) {
result[edge.id] = edge;
return result;
}, {});
- var captions = (0, _lodashObjectValues2['default'])(graph.captions).filter(function (caption) {
+ var captions = (0, _values2.default)(graph.captions).filter(function (caption) {
return caption.display.status == "highlighted";
}).reduce(function (result, caption) {
result[caption.id] = caption;
@@ -22523,15 +23110,15 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'edgesConnectedToNode',
value: function edgesConnectedToNode(graph, nodeId) {
- return (0, _lodashObjectValues2['default'])(graph.edges).filter(function (edge) {
+ return (0, _values2.default)(graph.edges).filter(function (edge) {
return edge.node1_id == nodeId || edge.node2_id == nodeId;
});
}
}, {
key: 'edgesBetweenNodes',
value: function edgesBetweenNodes(graph, nodeIds) {
- return (0, _lodashObjectValues2['default'])(graph.edges).filter(function (edge) {
- return (0, _lodashArrayIntersection2['default'])([edge.node1_id, edge.node2_id], nodeIds).length == 2;
+ return (0, _values2.default)(graph.edges).filter(function (edge) {
+ return (0, _intersection2.default)([edge.node1_id, edge.node2_id], nodeIds).length == 2;
});
}
@@ -22543,7 +23130,7 @@ return /******/ (function(modules) { // webpackBootstrap
var num = arguments.length <= 1 || arguments[1] === undefined ? 2 : arguments[1];
// count edges for each node
- var edgeCount = (0, _lodashObjectValues2['default'])(graph.edges).reduce(function (result, edge) {
+ var edgeCount = (0, _values2.default)(graph.edges).reduce(function (result, edge) {
result[edge.node1_id] = (result[edge.node1_id] || 0) + 1;
result[edge.node2_id] = (result[edge.node2_id] || 0) + 1;
return result;
@@ -22561,7 +23148,7 @@ return /******/ (function(modules) { // webpackBootstrap
var num = arguments.length <= 1 || arguments[1] === undefined ? 20 : arguments[1];
// count edges for each node
- var edgeCount = (0, _lodashObjectValues2['default'])(graph.edges).reduce(function (result, edge) {
+ var edgeCount = (0, _values2.default)(graph.edges).reduce(function (result, edge) {
result[edge.node1_id] = (result[edge.node1_id] || 0) + 1;
result[edge.node2_id] = (result[edge.node2_id] || 0) + 1;
return result;
@@ -22576,16 +23163,17 @@ return /******/ (function(modules) { // webpackBootstrap
}
// limits graph to set of nodes and the edges between them
+
}, {
key: 'limitGraphToNodeIds',
value: function limitGraphToNodeIds(graph, nodeIds) {
- var filteredGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var filteredGraph = (0, _cloneDeep2.default)(graph);
filteredGraph.nodes = nodeIds.reduce(function (result, nodeId) {
- return (0, _lodashObjectMerge2['default'])(result, _defineProperty({}, nodeId, graph.nodes[nodeId]));
+ return (0, _merge10.default)(result, _defineProperty({}, nodeId, graph.nodes[nodeId]));
}, {});
filteredGraph.edges = this.edgesBetweenNodes(graph, nodeIds).reduce(function (result, edge) {
- return (0, _lodashObjectMerge2['default'])(result, _defineProperty({}, edge.id, edge));
+ return (0, _merge10.default)(result, _defineProperty({}, edge.id, edge));
}, {});
return filteredGraph;
@@ -22607,7 +23195,7 @@ return /******/ (function(modules) { // webpackBootstrap
var captionIds = highlights.captionIds;
var otherwise = otherwiseFaded ? "faded" : "normal";
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
// cast all ids to strings
nodeIds = nodeIds.map(function (id) {
@@ -22620,16 +23208,16 @@ return /******/ (function(modules) { // webpackBootstrap
return String(id);
});
- (0, _lodashObjectValues2['default'])(newGraph.nodes).forEach(function (node) {
- newGraph.nodes[node.id].display.status = (0, _lodashCollectionIncludes2['default'])(nodeIds, String(node.id)) ? "highlighted" : otherwise;
+ (0, _values2.default)(newGraph.nodes).forEach(function (node) {
+ newGraph.nodes[node.id].display.status = (0, _includes2.default)(nodeIds, String(node.id)) ? "highlighted" : otherwise;
});
- (0, _lodashObjectValues2['default'])(newGraph.edges).forEach(function (edge) {
- newGraph.edges[edge.id].display.status = (0, _lodashCollectionIncludes2['default'])(edgeIds, String(edge.id)) ? "highlighted" : otherwise;
+ (0, _values2.default)(newGraph.edges).forEach(function (edge) {
+ newGraph.edges[edge.id].display.status = (0, _includes2.default)(edgeIds, String(edge.id)) ? "highlighted" : otherwise;
});
- (0, _lodashObjectValues2['default'])(newGraph.captions).forEach(function (caption) {
- newGraph.captions[caption.id].display.status = (0, _lodashCollectionIncludes2['default'])(captionIds, String(caption.id)) ? "highlighted" : otherwise;
+ (0, _values2.default)(newGraph.captions).forEach(function (caption) {
+ newGraph.captions[caption.id].display.status = (0, _includes2.default)(captionIds, String(caption.id)) ? "highlighted" : otherwise;
});
return newGraph;
@@ -22637,17 +23225,17 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'clearHighlights',
value: function clearHighlights(graph) {
- var newGraph = (0, _lodashLangCloneDeep2['default'])(graph);
+ var newGraph = (0, _cloneDeep2.default)(graph);
- (0, _lodashObjectValues2['default'])(newGraph.nodes).forEach(function (node) {
+ (0, _values2.default)(newGraph.nodes).forEach(function (node) {
delete newGraph.nodes[node.id].display.status;
});
- (0, _lodashObjectValues2['default'])(newGraph.edges).forEach(function (edge) {
+ (0, _values2.default)(newGraph.edges).forEach(function (edge) {
delete newGraph.edges[edge.id].display.status;
});
- (0, _lodashObjectValues2['default'])(newGraph.captions).forEach(function (caption) {
+ (0, _values2.default)(newGraph.captions).forEach(function (caption) {
delete newGraph.captions[caption.id].display.status;
});
@@ -22657,18 +23245,19 @@ return /******/ (function(modules) { // webpackBootstrap
// ETC
// groups multiple edges between the same nodes (regardless of direction) into one edge
+
}, {
key: 'bundleEdges',
value: function bundleEdges(graph) {
- var edges = (0, _lodashObjectValues2['default'])(graph.edges).reduce(function (result, edge) {
+ var edges = (0, _values2.default)(graph.edges).reduce(function (result, edge) {
var idHash = [edge.node1_id, edge.node2_id].sort()[0].toString() + ":" + [edge.node1_id, edge.node2_id].sort()[1].toString();
result[idHash] = edge; // Edge.combine(edge, result[idHash]);
return result;
}, {});
- var bundledGraph = (0, _lodashLangCloneDeep2['default'])(graph);
- bundledGraph.edges = (0, _lodashObjectValues2['default'])(edges).reduce(function (result, edge) {
- return (0, _lodashObjectMerge2['default'])(result, _defineProperty({}, edge.id, edge));
+ var bundledGraph = (0, _cloneDeep2.default)(graph);
+ bundledGraph.edges = (0, _values2.default)(edges).reduce(function (result, edge) {
+ return (0, _merge10.default)(result, _defineProperty({}, edge.id, edge));
}, {});
return bundledGraph;
@@ -22676,15 +23265,15 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'calculateCenter',
value: function calculateCenter(graph) {
- if ((0, _lodashCollectionSize2['default'])(graph.nodes) == 0) {
+ if ((0, _size2.default)(graph.nodes) == 0) {
return { x: 0, y: 0 };
}
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes);
- var xs = (0, _lodashArrayCompact2['default'])(nodes.map(function (i) {
+ var nodes = (0, _values2.default)(graph.nodes);
+ var xs = (0, _compact2.default)(nodes.map(function (i) {
return i.display.x;
}));
- var ys = (0, _lodashArrayCompact2['default'])(nodes.map(function (i) {
+ var ys = (0, _compact2.default)(nodes.map(function (i) {
return i.display.y;
}));
@@ -22704,8 +23293,8 @@ return /******/ (function(modules) { // webpackBootstrap
return graph;
}
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes).map(function (node) {
- return (0, _lodashObjectMerge2['default'])({}, node, { display: {
+ var nodes = (0, _values2.default)(graph.nodes).map(function (node) {
+ return (0, _merge10.default)({}, node, { display: {
x: node.display.x - center.x,
y: node.display.y - center.y
} });
@@ -22714,18 +23303,18 @@ return /******/ (function(modules) { // webpackBootstrap
return result;
}, {});
- return Graph.prepareEdges((0, _lodashObjectMerge2['default'])({}, graph, { nodes: nodes }));
+ return Graph.prepareEdges((0, _merge10.default)({}, graph, { nodes: nodes }));
}
}, {
key: 'calculateMaxRadiusFromCenter',
value: function calculateMaxRadiusFromCenter(graph) {
- if ((0, _lodashCollectionSize2['default'])(graph.nodes) == 0) {
+ if ((0, _size2.default)(graph.nodes) == 0) {
return 0;
}
var center = this.calculateCenter(graph);
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes).filter(function (n) {
- return _Node2['default'].hasPosition(n);
+ var nodes = (0, _values2.default)(graph.nodes).filter(function (n) {
+ return _Node2.default.hasPosition(n);
});
var dists = nodes.map(function (i) {
return Math.sqrt(Math.pow(i.display.x - center.x, 2) + Math.pow(i.display.y - center.y, 2));
@@ -22748,11 +23337,11 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'moveEdgeNode',
value: function moveEdgeNode(edge, nodeNum, x, y) {
var angle = this.calculateEdgeAngle(edge);
- var newEdge = (0, _lodashObjectMerge2['default'])({}, edge, { display: nodeNum == 1 ? { x1: x, y1: y } : { x2: x, y2: y } });
+ var newEdge = (0, _merge10.default)({}, edge, { display: nodeNum == 1 ? { x1: x, y1: y } : { x2: x, y2: y } });
var newAngle = this.calculateEdgeAngle(newEdge);
var deltaAngle = newAngle - angle;
var rotatedPoint = this.rotatePoint(edge.display.cx, edge.display.cy, deltaAngle);
- return (0, _lodashObjectMerge2['default'])(newEdge, { display: { cx: rotatedPoint.x, cy: rotatedPoint.y } });
+ return (0, _merge10.default)(newEdge, { display: { cx: rotatedPoint.x, cy: rotatedPoint.y } });
}
}, {
key: 'rotatePoint',
@@ -22764,35 +23353,35 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Graph;
- })();
+ }();
module.exports = Graph;
/***/ },
-/* 179 */
+/* 187 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
+ var _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; }; }();
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _merge = __webpack_require__(188);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _merge2 = _interopRequireDefault(_merge);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _isNumber = __webpack_require__(221);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _isNumber2 = _interopRequireDefault(_isNumber);
- var _lodashLangIsNumber = __webpack_require__(213);
+ var _Helpers = __webpack_require__(222);
- var _lodashLangIsNumber2 = _interopRequireDefault(_lodashLangIsNumber);
+ var _Helpers2 = _interopRequireDefault(_Helpers);
- var _Helpers = __webpack_require__(214);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _Helpers2 = _interopRequireDefault(_Helpers);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Node = (function () {
+ var Node = function () {
function Node() {
_classCallCheck(this, Node);
}
@@ -22801,7 +23390,7 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'defaults',
value: function defaults() {
return {
- id: _Helpers2['default'].generateId(),
+ id: _Helpers2.default.generateId(),
display: {
x: 0,
y: 0,
@@ -22813,26 +23402,26 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'setDefaults',
value: function setDefaults(node) {
- return (0, _lodashObjectMerge2['default'])({}, this.defaults(), node);
+ return (0, _merge2.default)({}, this.defaults(), node);
}
}, {
key: 'hasPosition',
value: function hasPosition(node) {
- return (0, _lodashLangIsNumber2['default'])(node.display.x) && (0, _lodashLangIsNumber2['default'])(node.display.y);
+ return (0, _isNumber2.default)(node.display.x) && (0, _isNumber2.default)(node.display.y);
}
}]);
return Node;
- })();
+ }();
module.exports = Node;
/***/ },
-/* 180 */
+/* 188 */
/***/ function(module, exports, __webpack_require__) {
- var baseMerge = __webpack_require__(181),
- createAssigner = __webpack_require__(208);
+ var baseMerge = __webpack_require__(189),
+ createAssigner = __webpack_require__(216);
/**
* Recursively merges own enumerable properties of the source object(s), that
@@ -22888,17 +23477,17 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 181 */
+/* 189 */
/***/ function(module, exports, __webpack_require__) {
- var arrayEach = __webpack_require__(182),
- baseMergeDeep = __webpack_require__(183),
- isArray = __webpack_require__(191),
- isArrayLike = __webpack_require__(186),
- isObject = __webpack_require__(195),
- isObjectLike = __webpack_require__(190),
- isTypedArray = __webpack_require__(203),
- keys = __webpack_require__(206);
+ var arrayEach = __webpack_require__(190),
+ baseMergeDeep = __webpack_require__(191),
+ isArray = __webpack_require__(199),
+ isArrayLike = __webpack_require__(194),
+ isObject = __webpack_require__(203),
+ isObjectLike = __webpack_require__(198),
+ isTypedArray = __webpack_require__(211),
+ keys = __webpack_require__(214);
/**
* The base implementation of `_.merge` without support for argument juggling,
@@ -22950,7 +23539,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 182 */
+/* 190 */
/***/ function(module, exports) {
/**
@@ -22978,16 +23567,16 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 183 */
+/* 191 */
/***/ function(module, exports, __webpack_require__) {
- var arrayCopy = __webpack_require__(184),
- isArguments = __webpack_require__(185),
- isArray = __webpack_require__(191),
- isArrayLike = __webpack_require__(186),
- isPlainObject = __webpack_require__(196),
- isTypedArray = __webpack_require__(203),
- toPlainObject = __webpack_require__(204);
+ var arrayCopy = __webpack_require__(192),
+ isArguments = __webpack_require__(193),
+ isArray = __webpack_require__(199),
+ isArrayLike = __webpack_require__(194),
+ isPlainObject = __webpack_require__(204),
+ isTypedArray = __webpack_require__(211),
+ toPlainObject = __webpack_require__(212);
/**
* A specialized version of `baseMerge` for arrays and objects which performs
@@ -23051,7 +23640,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 184 */
+/* 192 */
/***/ function(module, exports) {
/**
@@ -23077,11 +23666,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 185 */
+/* 193 */
/***/ function(module, exports, __webpack_require__) {
- var isArrayLike = __webpack_require__(186),
- isObjectLike = __webpack_require__(190);
+ var isArrayLike = __webpack_require__(194),
+ isObjectLike = __webpack_require__(198);
/** Used for native method references. */
var objectProto = Object.prototype;
@@ -23117,11 +23706,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 186 */
+/* 194 */
/***/ function(module, exports, __webpack_require__) {
- var getLength = __webpack_require__(187),
- isLength = __webpack_require__(189);
+ var getLength = __webpack_require__(195),
+ isLength = __webpack_require__(197);
/**
* Checks if `value` is array-like.
@@ -23138,10 +23727,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 187 */
+/* 195 */
/***/ function(module, exports, __webpack_require__) {
- var baseProperty = __webpack_require__(188);
+ var baseProperty = __webpack_require__(196);
/**
* Gets the "length" property value of `object`.
@@ -23159,7 +23748,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 188 */
+/* 196 */
/***/ function(module, exports) {
/**
@@ -23179,7 +23768,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 189 */
+/* 197 */
/***/ function(module, exports) {
/**
@@ -23205,7 +23794,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 190 */
+/* 198 */
/***/ function(module, exports) {
/**
@@ -23223,12 +23812,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 191 */
+/* 199 */
/***/ function(module, exports, __webpack_require__) {
- var getNative = __webpack_require__(192),
- isLength = __webpack_require__(189),
- isObjectLike = __webpack_require__(190);
+ var getNative = __webpack_require__(200),
+ isLength = __webpack_require__(197),
+ isObjectLike = __webpack_require__(198);
/** `Object#toString` result references. */
var arrayTag = '[object Array]';
@@ -23269,10 +23858,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 192 */
+/* 200 */
/***/ function(module, exports, __webpack_require__) {
- var isNative = __webpack_require__(193);
+ var isNative = __webpack_require__(201);
/**
* Gets the native function at `key` of `object`.
@@ -23291,11 +23880,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 193 */
+/* 201 */
/***/ function(module, exports, __webpack_require__) {
- var isFunction = __webpack_require__(194),
- isObjectLike = __webpack_require__(190);
+ var isFunction = __webpack_require__(202),
+ isObjectLike = __webpack_require__(198);
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
@@ -23345,10 +23934,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 194 */
+/* 202 */
/***/ function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(195);
+ var isObject = __webpack_require__(203);
/** `Object#toString` result references. */
var funcTag = '[object Function]';
@@ -23389,7 +23978,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 195 */
+/* 203 */
/***/ function(module, exports) {
/**
@@ -23423,12 +24012,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 196 */
+/* 204 */
/***/ function(module, exports, __webpack_require__) {
- var baseForIn = __webpack_require__(197),
- isArguments = __webpack_require__(185),
- isObjectLike = __webpack_require__(190);
+ var baseForIn = __webpack_require__(205),
+ isArguments = __webpack_require__(193),
+ isObjectLike = __webpack_require__(198);
/** `Object#toString` result references. */
var objectTag = '[object Object]';
@@ -23500,11 +24089,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 197 */
+/* 205 */
/***/ function(module, exports, __webpack_require__) {
- var baseFor = __webpack_require__(198),
- keysIn = __webpack_require__(201);
+ var baseFor = __webpack_require__(206),
+ keysIn = __webpack_require__(209);
/**
* The base implementation of `_.forIn` without support for callback
@@ -23523,10 +24112,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 198 */
+/* 206 */
/***/ function(module, exports, __webpack_require__) {
- var createBaseFor = __webpack_require__(199);
+ var createBaseFor = __webpack_require__(207);
/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
@@ -23546,10 +24135,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 199 */
+/* 207 */
/***/ function(module, exports, __webpack_require__) {
- var toObject = __webpack_require__(200);
+ var toObject = __webpack_require__(208);
/**
* Creates a base function for `_.forIn` or `_.forInRight`.
@@ -23579,10 +24168,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 200 */
+/* 208 */
/***/ function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(195);
+ var isObject = __webpack_require__(203);
/**
* Converts `value` to an object if it's not one.
@@ -23599,14 +24188,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 201 */
+/* 209 */
/***/ function(module, exports, __webpack_require__) {
- var isArguments = __webpack_require__(185),
- isArray = __webpack_require__(191),
- isIndex = __webpack_require__(202),
- isLength = __webpack_require__(189),
- isObject = __webpack_require__(195);
+ var isArguments = __webpack_require__(193),
+ isArray = __webpack_require__(199),
+ isIndex = __webpack_require__(210),
+ isLength = __webpack_require__(197),
+ isObject = __webpack_require__(203);
/** Used for native method references. */
var objectProto = Object.prototype;
@@ -23669,7 +24258,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 202 */
+/* 210 */
/***/ function(module, exports) {
/** Used to detect unsigned integer values. */
@@ -23699,11 +24288,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 203 */
+/* 211 */
/***/ function(module, exports, __webpack_require__) {
- var isLength = __webpack_require__(189),
- isObjectLike = __webpack_require__(190);
+ var isLength = __webpack_require__(197),
+ isObjectLike = __webpack_require__(198);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
@@ -23779,11 +24368,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 204 */
+/* 212 */
/***/ function(module, exports, __webpack_require__) {
- var baseCopy = __webpack_require__(205),
- keysIn = __webpack_require__(201);
+ var baseCopy = __webpack_require__(213),
+ keysIn = __webpack_require__(209);
/**
* Converts `value` to a plain object flattening inherited enumerable
@@ -23816,7 +24405,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 205 */
+/* 213 */
/***/ function(module, exports) {
/**
@@ -23845,13 +24434,13 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 206 */
+/* 214 */
/***/ function(module, exports, __webpack_require__) {
- var getNative = __webpack_require__(192),
- isArrayLike = __webpack_require__(186),
- isObject = __webpack_require__(195),
- shimKeys = __webpack_require__(207);
+ var getNative = __webpack_require__(200),
+ isArrayLike = __webpack_require__(194),
+ isObject = __webpack_require__(203),
+ shimKeys = __webpack_require__(215);
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = getNative(Object, 'keys');
@@ -23896,14 +24485,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 207 */
+/* 215 */
/***/ function(module, exports, __webpack_require__) {
- var isArguments = __webpack_require__(185),
- isArray = __webpack_require__(191),
- isIndex = __webpack_require__(202),
- isLength = __webpack_require__(189),
- keysIn = __webpack_require__(201);
+ var isArguments = __webpack_require__(193),
+ isArray = __webpack_require__(199),
+ isIndex = __webpack_require__(210),
+ isLength = __webpack_require__(197),
+ keysIn = __webpack_require__(209);
/** Used for native method references. */
var objectProto = Object.prototype;
@@ -23943,12 +24532,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 208 */
+/* 216 */
/***/ function(module, exports, __webpack_require__) {
- var bindCallback = __webpack_require__(209),
- isIterateeCall = __webpack_require__(211),
- restParam = __webpack_require__(212);
+ var bindCallback = __webpack_require__(217),
+ isIterateeCall = __webpack_require__(219),
+ restParam = __webpack_require__(220);
/**
* Creates a `_.assign`, `_.defaults`, or `_.merge` function.
@@ -23990,10 +24579,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 209 */
+/* 217 */
/***/ function(module, exports, __webpack_require__) {
- var identity = __webpack_require__(210);
+ var identity = __webpack_require__(218);
/**
* A specialized version of `baseCallback` which only supports `this` binding
@@ -24035,7 +24624,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 210 */
+/* 218 */
/***/ function(module, exports) {
/**
@@ -24061,12 +24650,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 211 */
+/* 219 */
/***/ function(module, exports, __webpack_require__) {
- var isArrayLike = __webpack_require__(186),
- isIndex = __webpack_require__(202),
- isObject = __webpack_require__(195);
+ var isArrayLike = __webpack_require__(194),
+ isIndex = __webpack_require__(210),
+ isObject = __webpack_require__(203);
/**
* Checks if the provided arguments are from an iteratee call.
@@ -24095,7 +24684,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 212 */
+/* 220 */
/***/ function(module, exports) {
/** Used as the `TypeError` message for "Functions" methods. */
@@ -24159,10 +24748,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 213 */
+/* 221 */
/***/ function(module, exports, __webpack_require__) {
- var isObjectLike = __webpack_require__(190);
+ var isObjectLike = __webpack_require__(198);
/** `Object#toString` result references. */
var numberTag = '[object Number]';
@@ -24206,57 +24795,57 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 214 */
+/* 222 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
- var _shortid = __webpack_require__(215);
+ var _shortid = __webpack_require__(223);
var _shortid2 = _interopRequireDefault(_shortid);
- var _lodashLangClone = __webpack_require__(224);
+ var _clone = __webpack_require__(232);
- var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone);
+ var _clone2 = _interopRequireDefault(_clone);
- var _lodashCollectionEach = __webpack_require__(232);
+ var _each = __webpack_require__(240);
- var _lodashCollectionEach2 = _interopRequireDefault(_lodashCollectionEach);
+ var _each2 = _interopRequireDefault(_each);
- var _lodashLangIsEmpty = __webpack_require__(237);
+ var _isEmpty = __webpack_require__(245);
- var _lodashLangIsEmpty2 = _interopRequireDefault(_lodashLangIsEmpty);
+ var _isEmpty2 = _interopRequireDefault(_isEmpty);
- var _lodashLangIsNumber = __webpack_require__(213);
+ var _isNumber = __webpack_require__(221);
- var _lodashLangIsNumber2 = _interopRequireDefault(_lodashLangIsNumber);
+ var _isNumber2 = _interopRequireDefault(_isNumber);
- var _lodashLangIsBoolean = __webpack_require__(239);
+ var _isBoolean = __webpack_require__(247);
- var _lodashLangIsBoolean2 = _interopRequireDefault(_lodashLangIsBoolean);
+ var _isBoolean2 = _interopRequireDefault(_isBoolean);
- var _lodashLangIsArray = __webpack_require__(191);
+ var _isArray = __webpack_require__(199);
- var _lodashLangIsArray2 = _interopRequireDefault(_lodashLangIsArray);
+ var _isArray2 = _interopRequireDefault(_isArray);
+
+ var _isPlainObject = __webpack_require__(204);
- var _lodashLangIsPlainObject = __webpack_require__(196);
+ var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
- var _lodashLangIsPlainObject2 = _interopRequireDefault(_lodashLangIsPlainObject);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var compact = function compact(o) {
- var cloned = (0, _lodashLangClone2['default'])(o);
+ var cloned = (0, _clone2.default)(o);
- if ((0, _lodashLangIsArray2['default'])(cloned) || (0, _lodashLangIsPlainObject2['default'])(cloned)) {
- (0, _lodashCollectionEach2['default'])(cloned, function (v, k) {
+ if ((0, _isArray2.default)(cloned) || (0, _isPlainObject2.default)(cloned)) {
+ (0, _each2.default)(cloned, function (v, k) {
var newV = compact(v);
- if ((0, _lodashLangIsEmpty2['default'])(newV) && !(0, _lodashLangIsNumber2['default'])(newV) && !(0, _lodashLangIsBoolean2['default'])(newV)) {
+ if ((0, _isEmpty2.default)(newV) && !(0, _isNumber2.default)(newV) && !(0, _isBoolean2.default)(newV)) {
delete cloned[k];
} else {
cloned[k] = newV;
@@ -24267,47 +24856,46 @@ return /******/ (function(modules) { // webpackBootstrap
return cloned;
};
- exports['default'] = {
+ exports.default = {
generateId: function generateId() {
- return _shortid2['default'].generate();
+ return _shortid2.default.generate();
},
compactObject: compact
};
- module.exports = exports['default'];
/***/ },
-/* 215 */
+/* 223 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- module.exports = __webpack_require__(216);
+ module.exports = __webpack_require__(224);
/***/ },
-/* 216 */
+/* 224 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var alphabet = __webpack_require__(217);
- var encode = __webpack_require__(219);
- var decode = __webpack_require__(221);
- var isValid = __webpack_require__(222);
+ var alphabet = __webpack_require__(225);
+ var encode = __webpack_require__(227);
+ var decode = __webpack_require__(229);
+ var isValid = __webpack_require__(230);
// Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.
// This number should be updated every year or so to keep the generated id short.
// To regenerate `new Date() - 0` and bump the version. Always bump the version!
- var REDUCE_TIME = 1426452414093;
+ var REDUCE_TIME = 1459707606518;
// don't change unless we change the algos or REDUCE_TIME
// must be an integer and less than 16
- var version = 5;
+ var version = 6;
// if you are using cluster or multiple servers use this to make each instance
// has a unique value for worker
// Note: I don't know if this is automatically set when using third
// party cluster solutions such as pm2.
- var clusterWorkerId = __webpack_require__(223) || 0;
+ var clusterWorkerId = __webpack_require__(231) || 0;
// Counter is used when shortid is called multiple times in one second.
var counter;
@@ -24390,12 +24978,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 217 */
+/* 225 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var randomFromSeed = __webpack_require__(218);
+ var randomFromSeed = __webpack_require__(226);
var ORIGINAL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-';
var alphabet;
@@ -24494,7 +25082,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 218 */
+/* 226 */
/***/ function(module, exports) {
'use strict';
@@ -24525,12 +25113,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 219 */
+/* 227 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var randomByte = __webpack_require__(220);
+ var randomByte = __webpack_require__(228);
function encode(lookup, number) {
var loopCounter = 0;
@@ -24550,12 +25138,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 220 */
+/* 228 */
/***/ function(module, exports) {
'use strict';
- var crypto = window.crypto || window.msCrypto; // IE 11 uses window.msCrypto
+ var crypto = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
function randomByte() {
if (!crypto || !crypto.getRandomValues) {
@@ -24570,11 +25158,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 221 */
+/* 229 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var alphabet = __webpack_require__(217);
+ var alphabet = __webpack_require__(225);
/**
* Decode the id to get the version and worker
@@ -24593,11 +25181,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 222 */
+/* 230 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var alphabet = __webpack_require__(217);
+ var alphabet = __webpack_require__(225);
function isShortId(id) {
if (!id || typeof id !== 'string' || id.length < 6 ) {
@@ -24605,20 +25193,20 @@ return /******/ (function(modules) { // webpackBootstrap
}
var characters = alphabet.characters();
- var invalidCharacters = id.split('').map(function(char){
- if (characters.indexOf(char) === -1) {
- return char;
+ var len = id.length;
+ for(var i = 0; i < len;i++) {
+ if (characters.indexOf(id[i]) === -1) {
+ return false;
}
- }).join('').split('').join('');
-
- return invalidCharacters.length === 0;
+ }
+ return true;
}
module.exports = isShortId;
/***/ },
-/* 223 */
+/* 231 */
/***/ function(module, exports) {
'use strict';
@@ -24627,12 +25215,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 224 */
+/* 232 */
/***/ function(module, exports, __webpack_require__) {
- var baseClone = __webpack_require__(225),
- bindCallback = __webpack_require__(209),
- isIterateeCall = __webpack_require__(211);
+ var baseClone = __webpack_require__(233),
+ bindCallback = __webpack_require__(217),
+ isIterateeCall = __webpack_require__(219);
/**
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
@@ -24703,18 +25291,18 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 225 */
+/* 233 */
/***/ function(module, exports, __webpack_require__) {
- var arrayCopy = __webpack_require__(184),
- arrayEach = __webpack_require__(182),
- baseAssign = __webpack_require__(226),
- baseForOwn = __webpack_require__(227),
- initCloneArray = __webpack_require__(228),
- initCloneByTag = __webpack_require__(229),
- initCloneObject = __webpack_require__(231),
- isArray = __webpack_require__(191),
- isObject = __webpack_require__(195);
+ var arrayCopy = __webpack_require__(192),
+ arrayEach = __webpack_require__(190),
+ baseAssign = __webpack_require__(234),
+ baseForOwn = __webpack_require__(235),
+ initCloneArray = __webpack_require__(236),
+ initCloneByTag = __webpack_require__(237),
+ initCloneObject = __webpack_require__(239),
+ isArray = __webpack_require__(199),
+ isObject = __webpack_require__(203);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
@@ -24837,11 +25425,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 226 */
+/* 234 */
/***/ function(module, exports, __webpack_require__) {
- var baseCopy = __webpack_require__(205),
- keys = __webpack_require__(206);
+ var baseCopy = __webpack_require__(213),
+ keys = __webpack_require__(214);
/**
* The base implementation of `_.assign` without support for argument juggling,
@@ -24862,11 +25450,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 227 */
+/* 235 */
/***/ function(module, exports, __webpack_require__) {
- var baseFor = __webpack_require__(198),
- keys = __webpack_require__(206);
+ var baseFor = __webpack_require__(206),
+ keys = __webpack_require__(214);
/**
* The base implementation of `_.forOwn` without support for callback
@@ -24885,7 +25473,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 228 */
+/* 236 */
/***/ function(module, exports) {
/** Used for native method references. */
@@ -24917,10 +25505,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 229 */
+/* 237 */
/***/ function(module, exports, __webpack_require__) {
- var bufferClone = __webpack_require__(230);
+ var bufferClone = __webpack_require__(238);
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
@@ -24986,7 +25574,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 230 */
+/* 238 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/** Native method references. */
@@ -25013,7 +25601,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
-/* 231 */
+/* 239 */
/***/ function(module, exports) {
/**
@@ -25035,19 +25623,19 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 232 */
+/* 240 */
/***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(233);
+ module.exports = __webpack_require__(241);
/***/ },
-/* 233 */
+/* 241 */
/***/ function(module, exports, __webpack_require__) {
- var arrayEach = __webpack_require__(182),
- baseEach = __webpack_require__(234),
- createForEach = __webpack_require__(236);
+ var arrayEach = __webpack_require__(190),
+ baseEach = __webpack_require__(242),
+ createForEach = __webpack_require__(244);
/**
* Iterates over elements of `collection` invoking `iteratee` for each element.
@@ -25085,11 +25673,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 234 */
+/* 242 */
/***/ function(module, exports, __webpack_require__) {
- var baseForOwn = __webpack_require__(227),
- createBaseEach = __webpack_require__(235);
+ var baseForOwn = __webpack_require__(235),
+ createBaseEach = __webpack_require__(243);
/**
* The base implementation of `_.forEach` without support for callback
@@ -25106,12 +25694,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 235 */
+/* 243 */
/***/ function(module, exports, __webpack_require__) {
- var getLength = __webpack_require__(187),
- isLength = __webpack_require__(189),
- toObject = __webpack_require__(200);
+ var getLength = __webpack_require__(195),
+ isLength = __webpack_require__(197),
+ toObject = __webpack_require__(208);
/**
* Creates a `baseEach` or `baseEachRight` function.
@@ -25143,11 +25731,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 236 */
+/* 244 */
/***/ function(module, exports, __webpack_require__) {
- var bindCallback = __webpack_require__(209),
- isArray = __webpack_require__(191);
+ var bindCallback = __webpack_require__(217),
+ isArray = __webpack_require__(199);
/**
* Creates a function for `_.forEach` or `_.forEachRight`.
@@ -25169,16 +25757,16 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 237 */
+/* 245 */
/***/ function(module, exports, __webpack_require__) {
- var isArguments = __webpack_require__(185),
- isArray = __webpack_require__(191),
- isArrayLike = __webpack_require__(186),
- isFunction = __webpack_require__(194),
- isObjectLike = __webpack_require__(190),
- isString = __webpack_require__(238),
- keys = __webpack_require__(206);
+ var isArguments = __webpack_require__(193),
+ isArray = __webpack_require__(199),
+ isArrayLike = __webpack_require__(194),
+ isFunction = __webpack_require__(202),
+ isObjectLike = __webpack_require__(198),
+ isString = __webpack_require__(246),
+ keys = __webpack_require__(214);
/**
* Checks if `value` is empty. A value is considered empty unless it's an
@@ -25222,10 +25810,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 238 */
+/* 246 */
/***/ function(module, exports, __webpack_require__) {
- var isObjectLike = __webpack_require__(190);
+ var isObjectLike = __webpack_require__(198);
/** `Object#toString` result references. */
var stringTag = '[object String]';
@@ -25263,10 +25851,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 239 */
+/* 247 */
/***/ function(module, exports, __webpack_require__) {
- var isObjectLike = __webpack_require__(190);
+ var isObjectLike = __webpack_require__(198);
/** `Object#toString` result references. */
var boolTag = '[object Boolean]';
@@ -25304,30 +25892,30 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 240 */
+/* 248 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _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; }; }();
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _merge = __webpack_require__(188);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _merge2 = _interopRequireDefault(_merge);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _Helpers = __webpack_require__(222);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _Helpers2 = _interopRequireDefault(_Helpers);
- var _Helpers = __webpack_require__(214);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _Helpers2 = _interopRequireDefault(_Helpers);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Edge = (function () {
+ var Edge = function () {
function Edge() {
_classCallCheck(this, Edge);
}
@@ -25336,7 +25924,7 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'defaults',
value: function defaults() {
return {
- id: _Helpers2['default'].generateId(),
+ id: _Helpers2.default.generateId(),
display: {
scale: 1,
arrow: false,
@@ -25347,7 +25935,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'setDefaults',
value: function setDefaults(edge) {
- return (0, _lodashObjectMerge2['default'])(this.defaults(), edge);
+ return (0, _merge2.default)(this.defaults(), edge);
}
}, {
key: 'combine',
@@ -25356,11 +25944,11 @@ return /******/ (function(modules) { // webpackBootstrap
return edge1;
}
- return (0, _lodashObjectMerge2['default'])({}, edge1, {
+ return (0, _merge2.default)({}, edge1, {
display: {
label: edge1.display.label + ", " + edge2.display.label,
scale: Math.max(edge1.display.scale, edge2.display.scale),
- arrow: edge1.display.arrow && edge2.display.arrow && (edge1.node1_id == edge2.node1_id && edge1.node2_id == edge2.node2_id),
+ arrow: edge1.display.arrow && edge2.display.arrow && edge1.node1_id == edge2.node1_id && edge1.node2_id == edge2.node2_id,
status: this.combineStatuses(edge1.display.status, edge2.display.status)
}
});
@@ -25381,32 +25969,31 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Edge;
- })();
+ }();
- exports['default'] = Edge;
- module.exports = exports['default'];
+ exports.default = Edge;
/***/ },
-/* 241 */
+/* 249 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
+ var _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; }; }();
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _merge = __webpack_require__(188);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _merge2 = _interopRequireDefault(_merge);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _Helpers = __webpack_require__(222);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _Helpers2 = _interopRequireDefault(_Helpers);
- var _Helpers = __webpack_require__(214);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _Helpers2 = _interopRequireDefault(_Helpers);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Caption = (function () {
+ var Caption = function () {
function Caption() {
_classCallCheck(this, Caption);
}
@@ -25415,7 +26002,7 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'defaults',
value: function defaults() {
return {
- id: _Helpers2['default'].generateId(),
+ id: _Helpers2.default.generateId(),
display: {
text: "Caption",
x: 0,
@@ -25428,22 +26015,22 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'setDefaults',
value: function setDefaults(caption) {
- return (0, _lodashObjectMerge2['default'])({}, this.defaults(), caption);
+ return (0, _merge2.default)({}, this.defaults(), caption);
}
}]);
return Caption;
- })();
+ }();
module.exports = Caption;
/***/ },
-/* 242 */
+/* 250 */
/***/ function(module, exports, __webpack_require__) {
- var assignWith = __webpack_require__(243),
- baseAssign = __webpack_require__(226),
- createAssigner = __webpack_require__(208);
+ var assignWith = __webpack_require__(251),
+ baseAssign = __webpack_require__(234),
+ createAssigner = __webpack_require__(216);
/**
* Assigns own enumerable properties of source object(s) to the destination
@@ -25487,10 +26074,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 243 */
+/* 251 */
/***/ function(module, exports, __webpack_require__) {
- var keys = __webpack_require__(206);
+ var keys = __webpack_require__(214);
/**
* A specialized version of `_.assign` for customizing assigned values without
@@ -25525,11 +26112,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 244 */
+/* 252 */
/***/ function(module, exports, __webpack_require__) {
- var baseValues = __webpack_require__(245),
- keys = __webpack_require__(206);
+ var baseValues = __webpack_require__(253),
+ keys = __webpack_require__(214);
/**
* Creates an array of the own enumerable property values of `object`.
@@ -25564,7 +26151,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 245 */
+/* 253 */
/***/ function(module, exports) {
/**
@@ -25592,14 +26179,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 246 */
+/* 254 */
/***/ function(module, exports, __webpack_require__) {
- var baseIndexOf = __webpack_require__(247),
- cacheIndexOf = __webpack_require__(249),
- createCache = __webpack_require__(250),
- isArrayLike = __webpack_require__(186),
- restParam = __webpack_require__(212);
+ var baseIndexOf = __webpack_require__(255),
+ cacheIndexOf = __webpack_require__(257),
+ createCache = __webpack_require__(258),
+ isArrayLike = __webpack_require__(194),
+ restParam = __webpack_require__(220);
/**
* Creates an array of unique values that are included in all of the provided
@@ -25656,10 +26243,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 247 */
+/* 255 */
/***/ function(module, exports, __webpack_require__) {
- var indexOfNaN = __webpack_require__(248);
+ var indexOfNaN = __webpack_require__(256);
/**
* The base implementation of `_.indexOf` without support for binary searches.
@@ -25689,7 +26276,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 248 */
+/* 256 */
/***/ function(module, exports) {
/**
@@ -25718,10 +26305,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 249 */
+/* 257 */
/***/ function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(195);
+ var isObject = __webpack_require__(203);
/**
* Checks if `value` is in `cache` mimicking the return signature of
@@ -25743,11 +26330,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 250 */
+/* 258 */
/***/ function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {var SetCache = __webpack_require__(251),
- getNative = __webpack_require__(192);
+ /* WEBPACK VAR INJECTION */(function(global) {var SetCache = __webpack_require__(259),
+ getNative = __webpack_require__(200);
/** Native method references. */
var Set = getNative(global, 'Set');
@@ -25771,11 +26358,11 @@ return /******/ (function(modules) { // webpackBootstrap
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
-/* 251 */
+/* 259 */
/***/ function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {var cachePush = __webpack_require__(252),
- getNative = __webpack_require__(192);
+ /* WEBPACK VAR INJECTION */(function(global) {var cachePush = __webpack_require__(260),
+ getNative = __webpack_require__(200);
/** Native method references. */
var Set = getNative(global, 'Set');
@@ -25807,10 +26394,10 @@ return /******/ (function(modules) { // webpackBootstrap
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
-/* 252 */
+/* 260 */
/***/ function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(195);
+ var isObject = __webpack_require__(203);
/**
* Adds `value` to the cache.
@@ -25833,11 +26420,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 253 */
+/* 261 */
/***/ function(module, exports, __webpack_require__) {
- var baseFlatten = __webpack_require__(254),
- isIterateeCall = __webpack_require__(211);
+ var baseFlatten = __webpack_require__(262),
+ isIterateeCall = __webpack_require__(219);
/**
* Flattens a nested array. If `isDeep` is `true` the array is recursively
@@ -25871,14 +26458,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 254 */
+/* 262 */
/***/ function(module, exports, __webpack_require__) {
- var arrayPush = __webpack_require__(255),
- isArguments = __webpack_require__(185),
- isArray = __webpack_require__(191),
- isArrayLike = __webpack_require__(186),
- isObjectLike = __webpack_require__(190);
+ var arrayPush = __webpack_require__(263),
+ isArguments = __webpack_require__(193),
+ isArray = __webpack_require__(199),
+ isArrayLike = __webpack_require__(194),
+ isObjectLike = __webpack_require__(198);
/**
* The base implementation of `_.flatten` with added support for restricting
@@ -25918,7 +26505,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 255 */
+/* 263 */
/***/ function(module, exports) {
/**
@@ -25944,11 +26531,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 256 */
+/* 264 */
/***/ function(module, exports, __webpack_require__) {
- var baseClone = __webpack_require__(225),
- bindCallback = __webpack_require__(209);
+ var baseClone = __webpack_require__(233),
+ bindCallback = __webpack_require__(217);
/**
* Creates a deep clone of `value`. If `customizer` is provided it's invoked
@@ -26005,17 +26592,17 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 257 */
+/* 265 */
/***/ function(module, exports, __webpack_require__) {
- var arrayMap = __webpack_require__(258),
- baseDifference = __webpack_require__(259),
- baseFlatten = __webpack_require__(254),
- bindCallback = __webpack_require__(209),
- keysIn = __webpack_require__(201),
- pickByArray = __webpack_require__(260),
- pickByCallback = __webpack_require__(261),
- restParam = __webpack_require__(212);
+ var arrayMap = __webpack_require__(266),
+ baseDifference = __webpack_require__(267),
+ baseFlatten = __webpack_require__(262),
+ bindCallback = __webpack_require__(217),
+ keysIn = __webpack_require__(209),
+ pickByArray = __webpack_require__(268),
+ pickByCallback = __webpack_require__(269),
+ restParam = __webpack_require__(220);
/**
* The opposite of `_.pick`; this method creates an object composed of the
@@ -26058,7 +26645,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 258 */
+/* 266 */
/***/ function(module, exports) {
/**
@@ -26085,12 +26672,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 259 */
+/* 267 */
/***/ function(module, exports, __webpack_require__) {
- var baseIndexOf = __webpack_require__(247),
- cacheIndexOf = __webpack_require__(249),
- createCache = __webpack_require__(250);
+ var baseIndexOf = __webpack_require__(255),
+ cacheIndexOf = __webpack_require__(257),
+ createCache = __webpack_require__(258);
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@@ -26146,10 +26733,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 260 */
+/* 268 */
/***/ function(module, exports, __webpack_require__) {
- var toObject = __webpack_require__(200);
+ var toObject = __webpack_require__(208);
/**
* A specialized version of `_.pick` which picks `object` properties specified
@@ -26180,10 +26767,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 261 */
+/* 269 */
/***/ function(module, exports, __webpack_require__) {
- var baseForIn = __webpack_require__(197);
+ var baseForIn = __webpack_require__(205);
/**
* A specialized version of `_.pick` which picks `object` properties `predicate`
@@ -26208,14 +26795,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 262 */
+/* 270 */
/***/ function(module, exports, __webpack_require__) {
- var baseDifference = __webpack_require__(259),
- baseFlatten = __webpack_require__(254),
- isArrayLike = __webpack_require__(186),
- isObjectLike = __webpack_require__(190),
- restParam = __webpack_require__(212);
+ var baseDifference = __webpack_require__(267),
+ baseFlatten = __webpack_require__(262),
+ isArrayLike = __webpack_require__(194),
+ isObjectLike = __webpack_require__(198),
+ restParam = __webpack_require__(220);
/**
* Creates an array of unique `array` values not included in the other
@@ -26243,7 +26830,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 263 */
+/* 271 */
/***/ function(module, exports) {
/**
@@ -26279,12 +26866,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 264 */
+/* 272 */
/***/ function(module, exports, __webpack_require__) {
- var getLength = __webpack_require__(187),
- isLength = __webpack_require__(189),
- keys = __webpack_require__(206);
+ var getLength = __webpack_require__(195),
+ isLength = __webpack_require__(197),
+ keys = __webpack_require__(214);
/**
* Gets the size of `collection` by returning its length for array-like
@@ -26315,16 +26902,16 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 265 */
+/* 273 */
/***/ function(module, exports, __webpack_require__) {
- var baseIndexOf = __webpack_require__(247),
- getLength = __webpack_require__(187),
- isArray = __webpack_require__(191),
- isIterateeCall = __webpack_require__(211),
- isLength = __webpack_require__(189),
- isString = __webpack_require__(238),
- values = __webpack_require__(244);
+ var baseIndexOf = __webpack_require__(255),
+ getLength = __webpack_require__(195),
+ isArray = __webpack_require__(199),
+ isIterateeCall = __webpack_require__(219),
+ isLength = __webpack_require__(197),
+ isString = __webpack_require__(246),
+ values = __webpack_require__(252);
/* Native method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
@@ -26378,26 +26965,751 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 266 */
+/* 274 */
/***/ function(module, exports, __webpack_require__) {
- 'use strict';
+ var __WEBPACK_AMD_DEFINE_RESULT__;/**
+ * Springy v2.7.1
+ *
+ * Copyright (c) 2010-2013 Dennis Hotson
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+ (function (root, factory) {
+ if (true) {
+ // AMD. Register as an anonymous module.
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
+ return (root.returnExportsGlobal = factory());
+ }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ } else if (typeof exports === 'object') {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like enviroments that support module.exports,
+ // like Node.
+ module.exports = factory();
+ } else {
+ // Browser globals
+ root.Springy = factory();
+ }
+ }(this, function() {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
+ var Springy = {};
+
+ var Graph = Springy.Graph = function() {
+ this.nodeSet = {};
+ this.nodes = [];
+ this.edges = [];
+ this.adjacency = {};
- var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
+ this.nextNodeId = 0;
+ this.nextEdgeId = 0;
+ this.eventListeners = [];
+ };
- 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 Node = Springy.Node = function(id, data) {
+ this.id = id;
+ this.data = (data !== undefined) ? data : {};
- var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ // Data fields used by layout algorithm in this file:
+ // this.data.mass
+ // Data used by default renderer in springyui.js
+ // this.data.label
+ };
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var Edge = Springy.Edge = function(id, source, target, data) {
+ this.id = id;
+ this.source = source;
+ this.target = target;
+ this.data = (data !== undefined) ? data : {};
+
+ // Edge data field used by layout alorithm
+ // this.data.length
+ // this.data.type
+ };
+
+ Graph.prototype.addNode = function(node) {
+ if (!(node.id in this.nodeSet)) {
+ this.nodes.push(node);
+ }
+
+ this.nodeSet[node.id] = node;
+
+ this.notify();
+ return node;
+ };
+
+ Graph.prototype.addNodes = function() {
+ // accepts variable number of arguments, where each argument
+ // is a string that becomes both node identifier and label
+ for (var i = 0; i < arguments.length; i++) {
+ var name = arguments[i];
+ var node = new Node(name, {label:name});
+ this.addNode(node);
+ }
+ };
+
+ Graph.prototype.addEdge = function(edge) {
+ var exists = false;
+ this.edges.forEach(function(e) {
+ if (edge.id === e.id) { exists = true; }
+ });
+
+ if (!exists) {
+ this.edges.push(edge);
+ }
+
+ if (!(edge.source.id in this.adjacency)) {
+ this.adjacency[edge.source.id] = {};
+ }
+ if (!(edge.target.id in this.adjacency[edge.source.id])) {
+ this.adjacency[edge.source.id][edge.target.id] = [];
+ }
+
+ exists = false;
+ this.adjacency[edge.source.id][edge.target.id].forEach(function(e) {
+ if (edge.id === e.id) { exists = true; }
+ });
+
+ if (!exists) {
+ this.adjacency[edge.source.id][edge.target.id].push(edge);
+ }
+
+ this.notify();
+ return edge;
+ };
+
+ Graph.prototype.addEdges = function() {
+ // accepts variable number of arguments, where each argument
+ // is a triple [nodeid1, nodeid2, attributes]
+ for (var i = 0; i < arguments.length; i++) {
+ var e = arguments[i];
+ var node1 = this.nodeSet[e[0]];
+ if (node1 == undefined) {
+ throw new TypeError("invalid node name: " + e[0]);
+ }
+ var node2 = this.nodeSet[e[1]];
+ if (node2 == undefined) {
+ throw new TypeError("invalid node name: " + e[1]);
+ }
+ var attr = e[2];
+
+ this.newEdge(node1, node2, attr);
+ }
+ };
+
+ Graph.prototype.newNode = function(data) {
+ var node = new Node(this.nextNodeId++, data);
+ this.addNode(node);
+ return node;
+ };
+
+ Graph.prototype.newEdge = function(source, target, data) {
+ var edge = new Edge(this.nextEdgeId++, source, target, data);
+ this.addEdge(edge);
+ return edge;
+ };
+
+
+ // add nodes and edges from JSON object
+ Graph.prototype.loadJSON = function(json) {
+ /**
+ Springy's simple JSON format for graphs.
+
+ historically, Springy uses separate lists
+ of nodes and edges:
+
+ {
+ "nodes": [
+ "center",
+ "left",
+ "right",
+ "up",
+ "satellite"
+ ],
+ "edges": [
+ ["center", "left"],
+ ["center", "right"],
+ ["center", "up"]
+ ]
+ }
+
+ **/
+ // parse if a string is passed (EC5+ browsers)
+ if (typeof json == 'string' || json instanceof String) {
+ json = JSON.parse( json );
+ }
+
+ if ('nodes' in json || 'edges' in json) {
+ this.addNodes.apply(this, json['nodes']);
+ this.addEdges.apply(this, json['edges']);
+ }
+ }
+
+
+ // find the edges from node1 to node2
+ Graph.prototype.getEdges = function(node1, node2) {
+ if (node1.id in this.adjacency
+ && node2.id in this.adjacency[node1.id]) {
+ return this.adjacency[node1.id][node2.id];
+ }
+
+ return [];
+ };
+
+ // remove a node and it's associated edges from the graph
+ Graph.prototype.removeNode = function(node) {
+ if (node.id in this.nodeSet) {
+ delete this.nodeSet[node.id];
+ }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ for (var i = this.nodes.length - 1; i >= 0; i--) {
+ if (this.nodes[i].id === node.id) {
+ this.nodes.splice(i, 1);
+ }
+ }
- 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; }
+ this.detachNode(node);
+ };
+
+ // removes edges associated with a given node
+ Graph.prototype.detachNode = function(node) {
+ var tmpEdges = this.edges.slice();
+ tmpEdges.forEach(function(e) {
+ if (e.source.id === node.id || e.target.id === node.id) {
+ this.removeEdge(e);
+ }
+ }, this);
+
+ this.notify();
+ };
+
+ // remove a node and it's associated edges from the graph
+ Graph.prototype.removeEdge = function(edge) {
+ for (var i = this.edges.length - 1; i >= 0; i--) {
+ if (this.edges[i].id === edge.id) {
+ this.edges.splice(i, 1);
+ }
+ }
+
+ for (var x in this.adjacency) {
+ for (var y in this.adjacency[x]) {
+ var edges = this.adjacency[x][y];
+
+ for (var j=edges.length - 1; j>=0; j--) {
+ if (this.adjacency[x][y][j].id === edge.id) {
+ this.adjacency[x][y].splice(j, 1);
+ }
+ }
+
+ // Clean up empty edge arrays
+ if (this.adjacency[x][y].length == 0) {
+ delete this.adjacency[x][y];
+ }
+ }
+
+ // Clean up empty objects
+ if (isEmpty(this.adjacency[x])) {
+ delete this.adjacency[x];
+ }
+ }
+
+ this.notify();
+ };
+
+ /* Merge a list of nodes and edges into the current graph. eg.
+ var o = {
+ nodes: [
+ {id: 123, data: {type: 'user', userid: 123, displayname: 'aaa'}},
+ {id: 234, data: {type: 'user', userid: 234, displayname: 'bbb'}}
+ ],
+ edges: [
+ {from: 0, to: 1, type: 'submitted_design', directed: true, data: {weight: }}
+ ]
+ }
+ */
+ Graph.prototype.merge = function(data) {
+ var nodes = [];
+ data.nodes.forEach(function(n) {
+ nodes.push(this.addNode(new Node(n.id, n.data)));
+ }, this);
+
+ data.edges.forEach(function(e) {
+ var from = nodes[e.from];
+ var to = nodes[e.to];
+
+ var id = (e.directed)
+ ? (id = e.type + "-" + from.id + "-" + to.id)
+ : (from.id < to.id) // normalise id for non-directed edges
+ ? e.type + "-" + from.id + "-" + to.id
+ : e.type + "-" + to.id + "-" + from.id;
+
+ var edge = this.addEdge(new Edge(id, from, to, e.data));
+ edge.data.type = e.type;
+ }, this);
+ };
+
+ Graph.prototype.filterNodes = function(fn) {
+ var tmpNodes = this.nodes.slice();
+ tmpNodes.forEach(function(n) {
+ if (!fn(n)) {
+ this.removeNode(n);
+ }
+ }, this);
+ };
+
+ Graph.prototype.filterEdges = function(fn) {
+ var tmpEdges = this.edges.slice();
+ tmpEdges.forEach(function(e) {
+ if (!fn(e)) {
+ this.removeEdge(e);
+ }
+ }, this);
+ };
+
+
+ Graph.prototype.addGraphListener = function(obj) {
+ this.eventListeners.push(obj);
+ };
+
+ Graph.prototype.notify = function() {
+ this.eventListeners.forEach(function(obj){
+ obj.graphChanged();
+ });
+ };
+
+ // -----------
+ var Layout = Springy.Layout = {};
+ Layout.ForceDirected = function(graph, stiffness, repulsion, damping, minEnergyThreshold) {
+ this.graph = graph;
+ this.stiffness = stiffness; // spring stiffness constant
+ this.repulsion = repulsion; // repulsion constant
+ this.damping = damping; // velocity damping factor
+ this.minEnergyThreshold = minEnergyThreshold || 0.01; //threshold used to determine render stop
+
+ this.nodePoints = {}; // keep track of points associated with nodes
+ this.edgeSprings = {}; // keep track of springs associated with edges
+ };
+
+ Layout.ForceDirected.prototype.point = function(node) {
+ if (!(node.id in this.nodePoints)) {
+ var mass = (node.data.mass !== undefined) ? node.data.mass : 1.0;
+ this.nodePoints[node.id] = new Layout.ForceDirected.Point(Vector.random(), mass);
+ }
+
+ return this.nodePoints[node.id];
+ };
+
+ Layout.ForceDirected.prototype.spring = function(edge) {
+ if (!(edge.id in this.edgeSprings)) {
+ var length = (edge.data.length !== undefined) ? edge.data.length : 1.0;
+
+ var existingSpring = false;
+
+ var from = this.graph.getEdges(edge.source, edge.target);
+ from.forEach(function(e) {
+ if (existingSpring === false && e.id in this.edgeSprings) {
+ existingSpring = this.edgeSprings[e.id];
+ }
+ }, this);
+
+ if (existingSpring !== false) {
+ return new Layout.ForceDirected.Spring(existingSpring.point1, existingSpring.point2, 0.0, 0.0);
+ }
+
+ var to = this.graph.getEdges(edge.target, edge.source);
+ from.forEach(function(e){
+ if (existingSpring === false && e.id in this.edgeSprings) {
+ existingSpring = this.edgeSprings[e.id];
+ }
+ }, this);
+
+ if (existingSpring !== false) {
+ return new Layout.ForceDirected.Spring(existingSpring.point2, existingSpring.point1, 0.0, 0.0);
+ }
+
+ this.edgeSprings[edge.id] = new Layout.ForceDirected.Spring(
+ this.point(edge.source), this.point(edge.target), length, this.stiffness
+ );
+ }
+
+ return this.edgeSprings[edge.id];
+ };
+
+ // callback should accept two arguments: Node, Point
+ Layout.ForceDirected.prototype.eachNode = function(callback) {
+ var t = this;
+ this.graph.nodes.forEach(function(n){
+ callback.call(t, n, t.point(n));
+ });
+ };
+
+ // callback should accept two arguments: Edge, Spring
+ Layout.ForceDirected.prototype.eachEdge = function(callback) {
+ var t = this;
+ this.graph.edges.forEach(function(e){
+ callback.call(t, e, t.spring(e));
+ });
+ };
+
+ // callback should accept one argument: Spring
+ Layout.ForceDirected.prototype.eachSpring = function(callback) {
+ var t = this;
+ this.graph.edges.forEach(function(e){
+ callback.call(t, t.spring(e));
+ });
+ };
+
+
+ // Physics stuff
+ Layout.ForceDirected.prototype.applyCoulombsLaw = function() {
+ this.eachNode(function(n1, point1) {
+ this.eachNode(function(n2, point2) {
+ if (point1 !== point2)
+ {
+ var d = point1.p.subtract(point2.p);
+ var distance = d.magnitude() + 0.1; // avoid massive forces at small distances (and divide by zero)
+ var direction = d.normalise();
+
+ // apply force to each end point
+ point1.applyForce(direction.multiply(this.repulsion).divide(distance * distance * 0.5));
+ point2.applyForce(direction.multiply(this.repulsion).divide(distance * distance * -0.5));
+ }
+ });
+ });
+ };
+
+ Layout.ForceDirected.prototype.applyHookesLaw = function() {
+ this.eachSpring(function(spring){
+ var d = spring.point2.p.subtract(spring.point1.p); // the direction of the spring
+ var displacement = spring.length - d.magnitude();
+ var direction = d.normalise();
+
+ // apply force to each end point
+ spring.point1.applyForce(direction.multiply(spring.k * displacement * -0.5));
+ spring.point2.applyForce(direction.multiply(spring.k * displacement * 0.5));
+ });
+ };
+
+ Layout.ForceDirected.prototype.attractToCentre = function() {
+ this.eachNode(function(node, point) {
+ var direction = point.p.multiply(-1.0);
+ point.applyForce(direction.multiply(this.repulsion / 50.0));
+ });
+ };
+
+
+ Layout.ForceDirected.prototype.updateVelocity = function(timestep) {
+ this.eachNode(function(node, point) {
+ // Is this, along with updatePosition below, the only places that your
+ // integration code exist?
+ point.v = point.v.add(point.a.multiply(timestep)).multiply(this.damping);
+ point.a = new Vector(0,0);
+ });
+ };
+
+ Layout.ForceDirected.prototype.updatePosition = function(timestep) {
+ this.eachNode(function(node, point) {
+ // Same question as above; along with updateVelocity, is this all of
+ // your integration code?
+ point.p = point.p.add(point.v.multiply(timestep));
+ });
+ };
+
+ // Calculate the total kinetic energy of the system
+ Layout.ForceDirected.prototype.totalEnergy = function(timestep) {
+ var energy = 0.0;
+ this.eachNode(function(node, point) {
+ var speed = point.v.magnitude();
+ energy += 0.5 * point.m * speed * speed;
+ });
+
+ return energy;
+ };
+
+ var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; // stolen from coffeescript, thanks jashkenas! ;-)
+
+ Springy.requestAnimationFrame = __bind(this.requestAnimationFrame ||
+ this.webkitRequestAnimationFrame ||
+ this.mozRequestAnimationFrame ||
+ this.oRequestAnimationFrame ||
+ this.msRequestAnimationFrame ||
+ (function(callback, element) {
+ this.setTimeout(callback, 10);
+ }), this);
+
+
+ /**
+ * Start simulation if it's not running already.
+ * In case it's running then the call is ignored, and none of the callbacks passed is ever executed.
+ */
+ Layout.ForceDirected.prototype.start = function(render, onRenderStop, onRenderStart) {
+ var t = this;
+
+ if (this._started) return;
+ this._started = true;
+ this._stop = false;
+
+ if (onRenderStart !== undefined) { onRenderStart(); }
+
+ Springy.requestAnimationFrame(function step() {
+ t.tick(0.03);
+
+ if (render !== undefined) {
+ render();
+ }
+
+ // stop simulation when energy of the system goes below a threshold
+ if (t._stop || t.totalEnergy() < t.minEnergyThreshold) {
+ t._started = false;
+ if (onRenderStop !== undefined) { onRenderStop(); }
+ } else {
+ Springy.requestAnimationFrame(step);
+ }
+ });
+ };
+
+ Layout.ForceDirected.prototype.stop = function() {
+ this._stop = true;
+ }
+
+ Layout.ForceDirected.prototype.tick = function(timestep) {
+ this.applyCoulombsLaw();
+ this.applyHookesLaw();
+ this.attractToCentre();
+ this.updateVelocity(timestep);
+ this.updatePosition(timestep);
+ };
+
+ // Find the nearest point to a particular position
+ Layout.ForceDirected.prototype.nearest = function(pos) {
+ var min = {node: null, point: null, distance: null};
+ var t = this;
+ this.graph.nodes.forEach(function(n){
+ var point = t.point(n);
+ var distance = point.p.subtract(pos).magnitude();
+
+ if (min.distance === null || distance < min.distance) {
+ min = {node: n, point: point, distance: distance};
+ }
+ });
+
+ return min;
+ };
+
+ // returns [bottomleft, topright]
+ Layout.ForceDirected.prototype.getBoundingBox = function() {
+ var bottomleft = new Vector(-2,-2);
+ var topright = new Vector(2,2);
+
+ this.eachNode(function(n, point) {
+ if (point.p.x < bottomleft.x) {
+ bottomleft.x = point.p.x;
+ }
+ if (point.p.y < bottomleft.y) {
+ bottomleft.y = point.p.y;
+ }
+ if (point.p.x > topright.x) {
+ topright.x = point.p.x;
+ }
+ if (point.p.y > topright.y) {
+ topright.y = point.p.y;
+ }
+ });
+
+ var padding = topright.subtract(bottomleft).multiply(0.07); // ~5% padding
+
+ return {bottomleft: bottomleft.subtract(padding), topright: topright.add(padding)};
+ };
+
+
+ // Vector
+ var Vector = Springy.Vector = function(x, y) {
+ this.x = x;
+ this.y = y;
+ };
+
+ Vector.random = function() {
+ return new Vector(10.0 * (Math.random() - 0.5), 10.0 * (Math.random() - 0.5));
+ };
+
+ Vector.prototype.add = function(v2) {
+ return new Vector(this.x + v2.x, this.y + v2.y);
+ };
+
+ Vector.prototype.subtract = function(v2) {
+ return new Vector(this.x - v2.x, this.y - v2.y);
+ };
+
+ Vector.prototype.multiply = function(n) {
+ return new Vector(this.x * n, this.y * n);
+ };
+
+ Vector.prototype.divide = function(n) {
+ return new Vector((this.x / n) || 0, (this.y / n) || 0); // Avoid divide by zero errors..
+ };
+
+ Vector.prototype.magnitude = function() {
+ return Math.sqrt(this.x*this.x + this.y*this.y);
+ };
+
+ Vector.prototype.normal = function() {
+ return new Vector(-this.y, this.x);
+ };
+
+ Vector.prototype.normalise = function() {
+ return this.divide(this.magnitude());
+ };
+
+ // Point
+ Layout.ForceDirected.Point = function(position, mass) {
+ this.p = position; // position
+ this.m = mass; // mass
+ this.v = new Vector(0, 0); // velocity
+ this.a = new Vector(0, 0); // acceleration
+ };
+
+ Layout.ForceDirected.Point.prototype.applyForce = function(force) {
+ this.a = this.a.add(force.divide(this.m));
+ };
+
+ // Spring
+ Layout.ForceDirected.Spring = function(point1, point2, length, k) {
+ this.point1 = point1;
+ this.point2 = point2;
+ this.length = length; // spring length at rest
+ this.k = k; // spring constant (See Hooke's law) .. how stiff the spring is
+ };
+
+ // Layout.ForceDirected.Spring.prototype.distanceToPoint = function(point)
+ // {
+ // // hardcore vector arithmetic.. ohh yeah!
+ // // .. see http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment/865080#865080
+ // var n = this.point2.p.subtract(this.point1.p).normalise().normal();
+ // var ac = point.p.subtract(this.point1.p);
+ // return Math.abs(ac.x * n.x + ac.y * n.y);
+ // };
+
+ /**
+ * Renderer handles the layout rendering loop
+ * @param onRenderStop optional callback function that gets executed whenever rendering stops.
+ * @param onRenderStart optional callback function that gets executed whenever rendering starts.
+ */
+ var Renderer = Springy.Renderer = function(layout, clear, drawEdge, drawNode, onRenderStop, onRenderStart) {
+ this.layout = layout;
+ this.clear = clear;
+ this.drawEdge = drawEdge;
+ this.drawNode = drawNode;
+ this.onRenderStop = onRenderStop;
+ this.onRenderStart = onRenderStart;
+
+ this.layout.graph.addGraphListener(this);
+ }
+
+ Renderer.prototype.graphChanged = function(e) {
+ this.start();
+ };
+
+ /**
+ * Starts the simulation of the layout in use.
+ *
+ * Note that in case the algorithm is still or already running then the layout that's in use
+ * might silently ignore the call, and your optional done
callback is never executed.
+ * At least the built-in ForceDirected layout behaves in this way.
+ *
+ * @param done An optional callback function that gets executed when the springy algorithm stops,
+ * either because it ended or because stop() was called.
+ */
+ Renderer.prototype.start = function(done) {
+ var t = this;
+ this.layout.start(function render() {
+ t.clear();
+
+ t.layout.eachEdge(function(edge, spring) {
+ t.drawEdge(edge, spring.point1.p, spring.point2.p);
+ });
+
+ t.layout.eachNode(function(node, point) {
+ t.drawNode(node, point.p);
+ });
+ }, this.onRenderStop, this.onRenderStart);
+ };
+
+ Renderer.prototype.stop = function() {
+ this.layout.stop();
+ };
+
+ // Array.forEach implementation for IE support..
+ //https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach
+ if ( !Array.prototype.forEach ) {
+ Array.prototype.forEach = function( callback, thisArg ) {
+ var T, k;
+ if ( this == null ) {
+ throw new TypeError( " this is null or not defined" );
+ }
+ var O = Object(this);
+ var len = O.length >>> 0; // Hack to convert O.length to a UInt32
+ if ( {}.toString.call(callback) != "[object Function]" ) {
+ throw new TypeError( callback + " is not a function" );
+ }
+ if ( thisArg ) {
+ T = thisArg;
+ }
+ k = 0;
+ while( k < len ) {
+ var kValue;
+ if ( k in O ) {
+ kValue = O[ k ];
+ callback.call( T, kValue, k, O );
+ }
+ k++;
+ }
+ };
+ }
+
+ var isEmpty = function(obj) {
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ return Springy;
+ }));
+
+
+/***/ },
+/* 275 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
+
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -26407,57 +27719,67 @@ return /******/ (function(modules) { // webpackBootstrap
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _BaseComponent2 = __webpack_require__(267);
+ var _BaseComponent2 = __webpack_require__(276);
var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _Node = __webpack_require__(268);
+ var _Node = __webpack_require__(277);
var _Node2 = _interopRequireDefault(_Node);
- var _Edge = __webpack_require__(274);
+ var _Edge = __webpack_require__(283);
var _Edge2 = _interopRequireDefault(_Edge);
- var _Caption = __webpack_require__(276);
+ var _Caption = __webpack_require__(285);
var _Caption2 = _interopRequireDefault(_Caption);
- var _modelsGraph = __webpack_require__(178);
+ var _Graph = __webpack_require__(186);
- var _modelsGraph2 = _interopRequireDefault(_modelsGraph);
+ var _Graph2 = _interopRequireDefault(_Graph);
+
+ var _reactDraggable = __webpack_require__(281);
- var _reactDraggable = __webpack_require__(272);
+ var _values = __webpack_require__(252);
- var _lodashObjectValues = __webpack_require__(244);
+ var _values2 = _interopRequireDefault(_values);
- var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues);
+ var _min = __webpack_require__(287);
- var _lodashCollectionMin = __webpack_require__(278);
+ var _min2 = _interopRequireDefault(_min);
- var _lodashCollectionMin2 = _interopRequireDefault(_lodashCollectionMin);
+ var _max = __webpack_require__(315);
- var _lodashCollectionMax = __webpack_require__(306);
+ var _max2 = _interopRequireDefault(_max);
- var _lodashCollectionMax2 = _interopRequireDefault(_lodashCollectionMax);
+ var _includes = __webpack_require__(273);
- var _lodashCollectionIncludes = __webpack_require__(265);
+ var _includes2 = _interopRequireDefault(_includes);
- var _lodashCollectionIncludes2 = _interopRequireDefault(_lodashCollectionIncludes);
+ 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 Graph = (function (_BaseComponent) {
+ var Graph = function (_BaseComponent) {
_inherits(Graph, _BaseComponent);
function Graph(props) {
_classCallCheck(this, Graph);
- _get(Object.getPrototypeOf(Graph.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop');
- this.nodes = {};
- this.edges = {};
- this.mounted = false;
- var viewBox = this._computeViewbox(props.graph, props.zoom);
- this.state = { x: 0, y: 0, viewBox: viewBox, height: props.height };
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Graph).call(this, props));
+
+ _this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop');
+ _this.nodes = {};
+ _this.edges = {};
+ _this.mounted = false;
+ var viewBox = _this._computeViewbox(props.graph, props.zoom, props.viewOnlyHighlighted);
+ _this.state = { x: 0, y: 0, viewBox: viewBox, height: props.height };
+ return _this;
}
_createClass(Graph, [{
@@ -26470,10 +27792,11 @@ return /******/ (function(modules) { // webpackBootstrap
var viewBox = _state.viewBox;
var height = _state.height;
- return _react2['default'].createElement(
+
+ return _react2.default.createElement(
'svg',
{ id: 'svg', version: '1.1', xmlns: 'http://www.w3.org/2000/svg', className: 'Graph', width: '100%', height: height, viewBox: viewBox, preserveAspectRatio: 'xMidYMid' },
- _react2['default'].createElement(
+ _react2.default.createElement(
_reactDraggable.DraggableCore,
{
handle: '#zoom-handle',
@@ -26481,16 +27804,16 @@ return /******/ (function(modules) { // webpackBootstrap
onStart: this._handleDragStart,
onDrag: this._handleDrag,
onStop: this._handleDragStop },
- _react2['default'].createElement(
+ _react2.default.createElement(
'g',
{ id: 'zoom', transform: 'translate(' + x + ', ' + y + ')' },
- _react2['default'].createElement('rect', { id: 'zoom-handle', x: '-5000', y: '-5000', width: '10000', height: '10000', fill: '#fff' }),
+ _react2.default.createElement('rect', { id: 'zoom-handle', x: '-5000', y: '-5000', width: '10000', height: '10000', fill: '#fff' }),
this._renderEdges(),
this._renderNodes(),
this._renderCaptions()
)
),
- _react2['default'].createElement('defs', { dangerouslySetInnerHTML: { __html: this._renderMarkers() } })
+ _react2.default.createElement('defs', { dangerouslySetInnerHTML: { __html: this._renderMarkers() } })
);
}
@@ -26505,7 +27828,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
- this._updateViewbox(nextProps.graph, nextProps.zoom);
+ this._updateViewbox(nextProps.graph, nextProps.zoom, nextProps.viewOnlyHighlighted);
}
// RENDERING
@@ -26513,66 +27836,66 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_renderEdges',
value: function _renderEdges() {
- var _this = this;
+ var _this2 = this;
- return (0, _lodashObjectValues2['default'])(this.props.graph.edges).map(function (e, i) {
- return _react2['default'].createElement(_Edge2['default'], {
- ref: function (c) {
- _this.edges[e.id] = c;if (c) {
- c.graph = _this;
+ return (0, _values2.default)(this.props.graph.edges).map(function (e, i) {
+ return _react2.default.createElement(_Edge2.default, {
+ ref: function ref(c) {
+ _this2.edges[e.id] = c;if (c) {
+ c.graph = _this2;
}
},
key: e.id,
edge: e,
- graphId: _this.props.graph.id,
- zoom: _this.props.zoom,
- selected: _this.props.selection && (0, _lodashCollectionIncludes2['default'])(_this.props.selection.edgeIds, e.id),
- clickEdge: _this.props.clickEdge,
- moveEdge: _this.props.moveEdge,
- isLocked: _this.props.isLocked });
+ graphId: _this2.props.graph.id,
+ zoom: _this2.props.zoom,
+ selected: _this2.props.selection && (0, _includes2.default)(_this2.props.selection.edgeIds, e.id),
+ clickEdge: _this2.props.clickEdge,
+ moveEdge: _this2.props.moveEdge,
+ isLocked: _this2.props.isLocked });
});
}
}, {
key: '_renderNodes',
value: function _renderNodes() {
- var _this2 = this;
+ var _this3 = this;
- return (0, _lodashObjectValues2['default'])(this.props.graph.nodes).map(function (n, i) {
- return _react2['default'].createElement(_Node2['default'], {
- ref: function (c) {
- _this2.nodes[n.id] = c;if (c) {
- c.graph = _this2;
+ return (0, _values2.default)(this.props.graph.nodes).map(function (n, i) {
+ return _react2.default.createElement(_Node2.default, {
+ ref: function ref(c) {
+ _this3.nodes[n.id] = c;if (c) {
+ c.graph = _this3;
}
},
key: n.id,
node: n,
- graph: _this2.props.graph,
- zoom: _this2.props.zoom,
- selected: _this2.props.selection && (0, _lodashCollectionIncludes2['default'])(_this2.props.selection.nodeIds, n.id),
- clickNode: _this2.props.clickNode,
- moveNode: _this2.props.moveNode,
- isLocked: _this2.props.isLocked });
+ graph: _this3.props.graph,
+ zoom: _this3.props.zoom,
+ selected: _this3.props.selection && (0, _includes2.default)(_this3.props.selection.nodeIds, n.id),
+ clickNode: _this3.props.clickNode,
+ moveNode: _this3.props.moveNode,
+ isLocked: _this3.props.isLocked });
});
}
}, {
key: '_renderCaptions',
value: function _renderCaptions() {
- var _this3 = this;
+ var _this4 = this;
- return (0, _lodashObjectValues2['default'])(this.props.graph.captions).map(function (c, i) {
- return _react2['default'].createElement(_Caption2['default'], {
- ref: function (c) {
+ return (0, _values2.default)(this.props.graph.captions).map(function (c, i) {
+ return _react2.default.createElement(_Caption2.default, {
+ ref: function ref(c) {
if (c) {
- c.graph = _this3;
+ c.graph = _this4;
}
},
key: c.id,
caption: c,
- graphId: _this3.props.graph.id,
- selected: _this3.props.selection && (0, _lodashCollectionIncludes2['default'])(_this3.props.selection.captionIds, c.id),
- moveCaption: _this3.props.moveCaption,
- clickCaption: _this3.props.clickCaption,
- isLocked: _this3.props.isLocked });
+ graphId: _this4.props.graph.id,
+ selected: _this4.props.selection && (0, _includes2.default)(_this4.props.selection.captionIds, c.id),
+ moveCaption: _this4.props.moveCaption,
+ clickCaption: _this4.props.clickCaption,
+ isLocked: _this4.props.isLocked });
});
}
}, {
@@ -26585,14 +27908,14 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_updateViewbox',
- value: function _updateViewbox(graph, zoom) {
- var viewBox = this._computeViewbox(graph, zoom);
+ value: function _updateViewbox(graph, zoom, viewOnlyHighlighted) {
+ var viewBox = this._computeViewbox(graph, zoom, viewOnlyHighlighted);
var changed = viewBox !== this.state.viewBox;
var oldViewBox = changed ? this.state.viewBox : null;
this.setState({ viewBox: viewBox, oldViewBox: oldViewBox });
this._updateActualZoom(viewBox);
- if (changed && _modelsGraph2['default'].hasContent(graph)) {
+ if (changed && _Graph2.default.hasContent(graph)) {
this._animateTransition(oldViewBox, viewBox);
}
}
@@ -26611,7 +27934,7 @@ return /******/ (function(modules) { // webpackBootstrap
var w = _viewBox$split$map2[2];
var h = _viewBox$split$map2[3];
- var domNode = _reactDom2['default'].findDOMNode(this);
+ var domNode = _reactDom2.default.findDOMNode(this);
var svgWidth = domNode.getBoundingClientRect().width;
var svgHeight = domNode.getBoundingClientRect().height;
var xFactor = svgWidth / w;
@@ -26624,9 +27947,9 @@ return /******/ (function(modules) { // webpackBootstrap
key: '_computeViewbox',
value: function _computeViewbox(graph) {
var zoom = arguments.length <= 1 || arguments[1] === undefined ? 1.2 : arguments[1];
+ var viewOnlyHighlighted = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
- var onlyHighlighted = this.props.viewOnlyHighlighted;
- var rect = this._computeRect(graph, onlyHighlighted);
+ var rect = this._computeRect(graph, viewOnlyHighlighted);
var w = rect.w / zoom;
var h = rect.h / zoom;
var x = rect.x + rect.w / 2 - w / 2;
@@ -26639,12 +27962,12 @@ return /******/ (function(modules) { // webpackBootstrap
value: function _computeRect(graph) {
var onlyHighlighted = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
- var nodes = (0, _lodashObjectValues2['default'])(graph.nodes).filter(function (n) {
+ var nodes = (0, _values2.default)(graph.nodes).filter(function (n) {
return !onlyHighlighted || n.display.status === "highlighted";
}).map(function (n) {
return n.display;
});
- var captions = (0, _lodashObjectValues2['default'])(graph.captions).filter(function (c) {
+ var captions = (0, _values2.default)(graph.captions).filter(function (c) {
return !onlyHighlighted || c.display.status === "highlighted";
}).map(function (c) {
return c.display;
@@ -26653,10 +27976,10 @@ return /******/ (function(modules) { // webpackBootstrap
// show all nodes and captions if none are highlighted
if (items.length == 0) {
- nodes = (0, _lodashObjectValues2['default'])(graph.nodes).map(function (n) {
+ nodes = (0, _values2.default)(graph.nodes).map(function (n) {
return n.display;
});
- captions = (0, _lodashObjectValues2['default'])(graph.captions).map(function (c) {
+ captions = (0, _values2.default)(graph.captions).map(function (c) {
return c.display;
});
items = nodes.concat(captions);
@@ -26671,10 +27994,10 @@ return /******/ (function(modules) { // webpackBootstrap
return i.y;
});
var textPadding = 100; // node text might extend below node
- var x = (0, _lodashCollectionMin2['default'])(xs) - padding;
- var y = (0, _lodashCollectionMin2['default'])(ys) - padding;
- var w = (0, _lodashCollectionMax2['default'])(xs) - (0, _lodashCollectionMin2['default'])(xs) + padding * 2;
- var h = (0, _lodashCollectionMax2['default'])(ys) - (0, _lodashCollectionMin2['default'])(ys) + textPadding + padding;
+ var x = (0, _min2.default)(xs) - padding;
+ var y = (0, _min2.default)(ys) - padding;
+ var w = (0, _max2.default)(xs) - (0, _min2.default)(xs) + padding * 2;
+ var h = (0, _max2.default)(ys) - (0, _min2.default)(ys) + textPadding + padding;
var factor = Math.min(400 / w, 400 / h);
if (factor > 1) {
@@ -26710,9 +28033,9 @@ return /******/ (function(modules) { // webpackBootstrap
var x = _calculateDeltas2.x;
var y = _calculateDeltas2.y;
-
// in order to avoid rerendering state isn't updated until drag is finished
- _reactDom2['default'].findDOMNode(this).querySelector("#zoom").setAttribute("transform", 'translate(' + x + ', ' + y + ')');
+
+ _reactDom2.default.findDOMNode(this).querySelector("#zoom").setAttribute("transform", 'translate(' + x + ', ' + y + ')');
}
}, {
key: '_handleDragStop',
@@ -26743,15 +28066,15 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_animateTransition',
value: function _animateTransition(oldViewBox, viewBox, duration) {
- var _this4 = this;
+ var _this5 = this;
if (!this._isSmallDevice() && viewBox && oldViewBox && viewBox !== oldViewBox) {
(function () {
- var start = _this4._now();
- var that = _this4;
- var domNode = _reactDom2['default'].findDOMNode(that);
- var req = undefined;
+ var start = _this5._now();
+ var that = _this5;
+ var domNode = _reactDom2.default.findDOMNode(that);
+ var req = void 0;
var oldVb = oldViewBox.split(" ").map(function (n) {
return parseInt(n);
@@ -26792,7 +28115,7 @@ return /******/ (function(modules) { // webpackBootstrap
requestAnimationFrame(draw);
})();
} else {
- _reactDom2['default'].findDOMNode(this).setAttribute("viewBox", viewBox);
+ _reactDom2.default.findDOMNode(this).setAttribute("viewBox", viewBox);
}
}
}, {
@@ -26823,123 +28146,124 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Graph;
- })(_BaseComponent3['default']);
+ }(_BaseComponent3.default);
- exports['default'] = Graph;
- module.exports = exports['default'];
+ exports.default = Graph;
/***/ },
-/* 267 */
+/* 276 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
+ var _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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ var _react = __webpack_require__(2);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- 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; }
+ 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; }
- var _react = __webpack_require__(2);
+ 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 BaseComponent = (function (_Component) {
+ var BaseComponent = function (_Component) {
_inherits(BaseComponent, _Component);
function BaseComponent() {
_classCallCheck(this, BaseComponent);
- _get(Object.getPrototypeOf(BaseComponent.prototype), 'constructor', this).apply(this, arguments);
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(BaseComponent).apply(this, arguments));
}
_createClass(BaseComponent, [{
key: 'bindAll',
value: function bindAll() {
- var _this = this;
+ var _this2 = this;
for (var _len = arguments.length, methods = Array(_len), _key = 0; _key < _len; _key++) {
methods[_key] = arguments[_key];
}
methods.forEach(function (method) {
- _this[method] = _this[method].bind(_this);
+ _this2[method] = _this2[method].bind(_this2);
});
}
}]);
return BaseComponent;
- })(_react.Component);
+ }(_react.Component);
module.exports = BaseComponent;
/***/ },
-/* 268 */
+/* 277 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- 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 _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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
- var _BaseComponent2 = __webpack_require__(267);
+ var _BaseComponent2 = __webpack_require__(276);
var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _NodeLabel = __webpack_require__(269);
+ var _NodeLabel = __webpack_require__(278);
var _NodeLabel2 = _interopRequireDefault(_NodeLabel);
- var _NodeCircle = __webpack_require__(271);
+ var _NodeCircle = __webpack_require__(280);
var _NodeCircle2 = _interopRequireDefault(_NodeCircle);
- var _NodeDisplaySettings = __webpack_require__(270);
+ var _NodeDisplaySettings = __webpack_require__(279);
var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
- var _reactDraggable = __webpack_require__(272);
+ var _reactDraggable = __webpack_require__(281);
- var _modelsGraph = __webpack_require__(178);
+ var _Graph = __webpack_require__(186);
- var _modelsGraph2 = _interopRequireDefault(_modelsGraph);
+ var _Graph2 = _interopRequireDefault(_Graph);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _merge = __webpack_require__(188);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _merge2 = _interopRequireDefault(_merge);
- var _classnames = __webpack_require__(273);
+ var _classnames = __webpack_require__(282);
var _classnames2 = _interopRequireDefault(_classnames);
- var _modelsHelpers = __webpack_require__(214);
+ var _Helpers = __webpack_require__(222);
+
+ var _Helpers2 = _interopRequireDefault(_Helpers);
+
+ 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; }
- var _modelsHelpers2 = _interopRequireDefault(_modelsHelpers);
+ 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 Node = (function (_BaseComponent) {
+ var Node = function (_BaseComponent) {
_inherits(Node, _BaseComponent);
function Node(props) {
_classCallCheck(this, Node);
- _get(Object.getPrototypeOf(Node.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop', '_handleClick');
- this.state = props.node.display;
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Node).call(this, props));
+
+ _this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop', '_handleClick');
+ _this.state = props.node.display;
+ return _this;
}
_createClass(Node, [{
@@ -26954,7 +28278,7 @@ return /******/ (function(modules) { // webpackBootstrap
var groupId = 'node-' + n.id;
var transform = 'translate(' + x + ', ' + y + ')';
- return _react2['default'].createElement(
+ return _react2.default.createElement(
_reactDraggable.DraggableCore,
{
handle: '.handle',
@@ -26962,22 +28286,22 @@ return /******/ (function(modules) { // webpackBootstrap
onStart: this._handleDragStart,
onDrag: this._handleDrag,
onStop: this._handleDragStop },
- _react2['default'].createElement(
+ _react2.default.createElement(
'g',
{
id: groupId,
className: 'node',
transform: transform,
onClick: this._handleClick },
- _react2['default'].createElement(_NodeCircle2['default'], { node: n, selected: this.props.selected }),
- this.state.name ? _react2['default'].createElement(_NodeLabel2['default'], { node: n }) : null
+ _react2.default.createElement(_NodeCircle2.default, { node: n, selected: this.props.selected }),
+ this.state.name ? _react2.default.createElement(_NodeLabel2.default, { node: n }) : null
)
);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
- var newState = (0, _lodashObjectMerge2['default'])({ name: null, image: null, url: null }, props.node.display);
+ var newState = (0, _merge2.default)({ name: null, image: null, url: null }, props.node.display);
this.setState(newState);
}
}, {
@@ -26987,6 +28311,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
// keep initial position for comparison with drag position
+
}, {
key: '_handleDragStart',
value: function _handleDragStart(e, ui) {
@@ -26998,10 +28323,11 @@ return /******/ (function(modules) { // webpackBootstrap
}
// while dragging node and its edges are updated only in state, not store
+
}, {
key: '_handleDrag',
value: function _handleDrag(e, ui) {
- var _this = this;
+ var _this2 = this;
if (this.props.isLocked) return;
@@ -27016,16 +28342,17 @@ return /******/ (function(modules) { // webpackBootstrap
this.setState({ x: x, y: y });
// update state of connecting edges
- var edges = _modelsGraph2['default'].edgesConnectedToNode(this.props.graph, n.id);
+ var edges = _Graph2.default.edgesConnectedToNode(this.props.graph, n.id);
edges.forEach(function (edge) {
var thisNodeNum = edge.node1_id == n.id ? 1 : 2;
- var newEdge = _modelsGraph2['default'].moveEdgeNode(edge, thisNodeNum, x, y);
- _this.graph.edges[edge.id].setState(newEdge.display);
+ var newEdge = _Graph2.default.moveEdgeNode(edge, thisNodeNum, x, y);
+ _this2.graph.edges[edge.id].setState(newEdge.display);
});
}
// store updated once dragging is done
+
}, {
key: '_handleDragStop',
value: function _handleDragStop(e, ui) {
@@ -27046,30 +28373,21 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Node;
- })(_BaseComponent3['default']);
+ }(_BaseComponent3.default);
- exports['default'] = Node;
- module.exports = exports['default'];
+ exports.default = Node;
/***/ },
-/* 269 */
+/* 278 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- 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 _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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -27079,17 +28397,25 @@ return /******/ (function(modules) { // webpackBootstrap
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _NodeDisplaySettings = __webpack_require__(270);
+ var _NodeDisplaySettings = __webpack_require__(279);
var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
- var NodeLabel = (function (_Component) {
+ 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 NodeLabel = function (_Component) {
_inherits(NodeLabel, _Component);
function NodeLabel() {
_classCallCheck(this, NodeLabel);
- _get(Object.getPrototypeOf(NodeLabel.prototype), 'constructor', this).apply(this, arguments);
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(NodeLabel).apply(this, arguments));
}
_createClass(NodeLabel, [{
@@ -27102,59 +28428,54 @@ return /******/ (function(modules) { // webpackBootstrap
var scale = _n$display.scale;
var status = _n$display.status;
- var r = _NodeDisplaySettings2['default'].circleRadius * scale;
- var textOffsetY = _NodeDisplaySettings2['default'].textMarginTop + r;
+ var r = _NodeDisplaySettings2.default.circleRadius * scale;
+ var textOffsetY = _NodeDisplaySettings2.default.textMarginTop + r;
var textLines = this._textLines(name);
- var linkAttributes = 'xlink:href="' + url + '" target="_blank"';
-
- var tspans = url ? _react2['default'].createElement('g', { dangerouslySetInnerHTML: { __html: '' + textLines.map(function (line, i) {
- var dy = i == 0 ? textOffsetY : _NodeDisplaySettings2['default'].lineHeight;
- return '' + line + '';
- }).join("") + ''
- } }) : _react2['default'].createElement(
- 'a',
- { className: 'nodeLabel' },
- _react2['default'].createElement(
- 'text',
- { textAnchor: 'middle' },
- textLines.map(function (line, i) {
- var dy = i == 0 ? textOffsetY : _NodeDisplaySettings2['default'].lineHeight;
- return _react2['default'].createElement(
- 'tspan',
- {
- key: i,
- className: 'nodeLabelText',
- x: '0', dy: dy,
- fill: _NodeDisplaySettings2['default'].textColor[status],
- opacity: _NodeDisplaySettings2['default'].textOpacity[status] },
- line
- );
- })
- )
- );
+
+ var tspans = textLines.map(function (line, i) {
+ return _react2.default.createElement(
+ 'tspan',
+ {
+ key: i,
+ className: 'nodeLabelText',
+ x: '0',
+ dy: i == 0 ? textOffsetY : _NodeDisplaySettings2.default.lineHeight,
+ fill: _NodeDisplaySettings2.default.textColor[status],
+ opacity: _NodeDisplaySettings2.default.textOpacity[status] },
+ line
+ );
+ });
var rects = textLines.map(function (line, i) {
var width = line.length * 8;
- var height = _NodeDisplaySettings2['default'].lineHeight;
- var y = r + 4 + i * _NodeDisplaySettings2['default'].lineHeight;
- return _react2['default'].createElement('rect', {
- className: 'nodeLabelRect',
+ var height = _NodeDisplaySettings2.default.lineHeight;
+ var y = r + 4 + i * _NodeDisplaySettings2.default.lineHeight;
+ return _react2.default.createElement('rect', {
key: i,
+ className: 'nodeLabelRect',
fill: '#fff',
opacity: '0.8',
- rx: _NodeDisplaySettings2['default'].cornerRadius,
- ry: _NodeDisplaySettings2['default'].cornerRadius,
+ rx: _NodeDisplaySettings2.default.cornerRadius,
+ ry: _NodeDisplaySettings2.default.cornerRadius,
x: -width / 2,
width: width,
height: height,
y: y });
});
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'g',
{ className: 'nodeLabel' },
rects,
- tspans
+ _react2.default.createElement(
+ 'a',
+ { className: 'nodeLabel', xlinkHref: url, target: '_blank' },
+ _react2.default.createElement(
+ 'text',
+ { textAnchor: 'middle' },
+ tspans
+ )
+ )
);
}
}, {
@@ -27172,7 +28493,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_setRectWidths',
value: function _setRectWidths() {
- var element = _reactDom2['default'].findDOMNode(this);
+ var element = _reactDom2.default.findDOMNode(this);
var texts = element.querySelectorAll(".nodeLabelText");
var rects = element.querySelectorAll(".nodeLabelRect");
@@ -27187,8 +28508,8 @@ return /******/ (function(modules) { // webpackBootstrap
key: '_textLines',
value: function _textLines(text) {
var maxWidth = text.length > 40 ? 25 : 18;
- var words = text.trim().split(" "),
- word = undefined,
+ var words = text.trim().split(/\s+/g),
+ word = void 0,
lines = [],
lineNumber = 1,
line = "",
@@ -27220,13 +28541,12 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return NodeLabel;
- })(_react.Component);
+ }(_react.Component);
- exports['default'] = NodeLabel;
- module.exports = exports['default'];
+ exports.default = NodeLabel;
/***/ },
-/* 270 */
+/* 279 */
/***/ function(module, exports) {
"use strict";
@@ -27279,24 +28599,16 @@ return /******/ (function(modules) { // webpackBootstrap
};
/***/ },
-/* 271 */
+/* 280 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- 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 _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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -27306,27 +28618,35 @@ return /******/ (function(modules) { // webpackBootstrap
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _BaseComponent2 = __webpack_require__(267);
+ var _BaseComponent2 = __webpack_require__(276);
var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _NodeDisplaySettings = __webpack_require__(270);
+ var _NodeDisplaySettings = __webpack_require__(279);
var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
- var NodeCircle = (function (_BaseComponent) {
+ 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 NodeCircle = function (_BaseComponent) {
_inherits(NodeCircle, _BaseComponent);
function NodeCircle() {
_classCallCheck(this, NodeCircle);
- _get(Object.getPrototypeOf(NodeCircle.prototype), 'constructor', this).apply(this, arguments);
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(NodeCircle).apply(this, arguments));
}
_createClass(NodeCircle, [{
key: 'render',
value: function render() {
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'g',
{ className: 'nodeCircle' },
this.props.selected ? this._selectionCirlce() : null,
@@ -27337,7 +28657,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'componentDidMount',
value: function componentDidMount() {
- var element = _reactDom2['default'].findDOMNode(this);
+ var element = _reactDom2.default.findDOMNode(this);
var images = element.querySelectorAll("image");
for (var i = 0; i < images.length; ++i) {
@@ -27351,11 +28671,11 @@ return /******/ (function(modules) { // webpackBootstrap
value: function _selectionCirlce() {
var scale = this.props.node.display.scale;
- var r = _NodeDisplaySettings2['default'].circleRadius * scale;
- var bgColor = _NodeDisplaySettings2['default'].selectColor;
+ var r = _NodeDisplaySettings2.default.circleRadius * scale;
+ var bgColor = _NodeDisplaySettings2.default.selectColor;
var bgOpacity = 0.5;
- var bgRadius = r + _NodeDisplaySettings2['default'].selectionRadiusDiff * scale;
- return _react2['default'].createElement('circle', { className: 'node-selection', r: bgRadius, fill: bgColor, opacity: bgOpacity });
+ var bgRadius = r + _NodeDisplaySettings2.default.selectionRadiusDiff * scale;
+ return _react2.default.createElement('circle', { className: 'node-selection', r: bgRadius, fill: bgColor, opacity: bgOpacity });
}
}, {
key: '_bgCircle',
@@ -27364,11 +28684,11 @@ return /******/ (function(modules) { // webpackBootstrap
var scale = _props$node$display.scale;
var status = _props$node$display.status;
- var r = _NodeDisplaySettings2['default'].circleRadius * scale;
- var bgColor = _NodeDisplaySettings2['default'].bgColor[status];
- var bgOpacity = _NodeDisplaySettings2['default'].bgOpacity[status];
- var bgRadius = r + _NodeDisplaySettings2['default'].bgRadiusDiff * scale;
- return _react2['default'].createElement('circle', { className: 'node-background', r: bgRadius, fill: bgColor, opacity: bgOpacity });
+ var r = _NodeDisplaySettings2.default.circleRadius * scale;
+ var bgColor = _NodeDisplaySettings2.default.bgColor[status];
+ var bgOpacity = _NodeDisplaySettings2.default.bgOpacity[status];
+ var bgRadius = r + _NodeDisplaySettings2.default.bgRadiusDiff * scale;
+ return _react2.default.createElement('circle', { className: 'node-background', r: bgRadius, fill: bgColor, opacity: bgOpacity });
}
}, {
key: '_circle',
@@ -27380,30 +28700,29 @@ return /******/ (function(modules) { // webpackBootstrap
var color = _n$display.color;
var image = _n$display.image;
- var r = _NodeDisplaySettings2['default'].circleRadius * scale;
+ var r = _NodeDisplaySettings2.default.circleRadius * scale;
var clipId = 'image-clip-' + n.id;
var clipPath = 'url(#' + clipId + ')';
- var imageWidth = r * _NodeDisplaySettings2['default'].imageScale;
- var imageOpacity = _NodeDisplaySettings2['default'].imageOpacity[status];
+ var imageWidth = r * _NodeDisplaySettings2.default.imageScale;
+ var imageOpacity = _NodeDisplaySettings2.default.imageOpacity[status];
var innerHTML = { __html: '\n \n \n \n '
};
- return image ? _react2['default'].createElement('g', { dangerouslySetInnerHTML: innerHTML }) : _react2['default'].createElement('circle', {
+ return image ? _react2.default.createElement('g', { dangerouslySetInnerHTML: innerHTML }) : _react2.default.createElement('circle', {
className: 'handle',
r: r,
- fill: color ? color : _NodeDisplaySettings2['default'].circleColor[status],
- opacity: _NodeDisplaySettings2['default'].circleOpacity[status] });
+ fill: color ? color : _NodeDisplaySettings2.default.circleColor[status],
+ opacity: _NodeDisplaySettings2.default.circleOpacity[status] });
}
}]);
return NodeCircle;
- })(_BaseComponent3['default']);
+ }(_BaseComponent3.default);
- exports['default'] = NodeCircle;
- module.exports = exports['default'];
+ exports.default = NodeCircle;
/***/ },
-/* 272 */
+/* 281 */
/***/ function(module, exports, __webpack_require__) {
(function webpackUniversalModuleDefinition(root, factory) {
@@ -27464,8 +28783,8 @@ return /******/ (function(modules) { // webpackBootstrap
'use strict';
- module.exports = __webpack_require__(1);
- module.exports.DraggableCore = __webpack_require__(10);
+ module.exports = __webpack_require__(1).default;
+ module.exports.DraggableCore = __webpack_require__(9).default;
/***/ },
/* 1 */
@@ -27473,23 +28792,15 @@ return /******/ (function(modules) { // webpackBootstrap
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
-
- 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
-
- 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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -27503,147 +28814,175 @@ return /******/ (function(modules) { // webpackBootstrap
var _classnames2 = _interopRequireDefault(_classnames);
- var _objectAssign = __webpack_require__(5);
+ var _domFns = __webpack_require__(5);
+
+ var _positionFns = __webpack_require__(8);
+
+ var _shims = __webpack_require__(6);
+
+ var _DraggableCore = __webpack_require__(9);
- var _objectAssign2 = _interopRequireDefault(_objectAssign);
+ var _DraggableCore2 = _interopRequireDefault(_DraggableCore);
- var _utilsDomFns = __webpack_require__(6);
+ var _log = __webpack_require__(10);
- var _utilsPositionFns = __webpack_require__(9);
+ var _log2 = _interopRequireDefault(_log);
- var _utilsShims = __webpack_require__(7);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _DraggableCore2 = __webpack_require__(10);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var _DraggableCore3 = _interopRequireDefault(_DraggableCore2);
+ 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; }
- var _utilsLog = __webpack_require__(11);
+ 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; }
+ // $FlowIgnore
- var _utilsLog2 = _interopRequireDefault(_utilsLog);
//
// Define
//
- var Draggable = (function (_DraggableCore) {
- _inherits(Draggable, _DraggableCore);
+ var Draggable = function (_React$Component) {
+ _inherits(Draggable, _React$Component);
function Draggable() {
- var _this = this;
+ var _Object$getPrototypeO;
+
+ var _temp, _this, _ret;
_classCallCheck(this, Draggable);
- _get(Object.getPrototypeOf(Draggable.prototype), 'constructor', this).apply(this, arguments);
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
- this.state = {
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Draggable)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.state = {
// Whether or not we are currently dragging.
dragging: false,
+ // Whether or not we have been dragged before.
+ dragged: false,
+
// Current transform x and y.
- clientX: this.props.start.x, clientY: this.props.start.y,
+ clientX: _this.props.start.x, clientY: _this.props.start.y,
+
+ // Used for compensating for out-of-bounds drags
+ slackX: 0, slackY: 0,
// Can only determine if SVG after mounting
isElementSVG: false
- };
-
- this.onDragStart = function (e, coreEvent) {
- (0, _utilsLog2['default'])('Draggable: onDragStart: %j', coreEvent.position);
+ }, _this.onDragStart = function (e, coreEvent) {
+ (0, _log2.default)('Draggable: onDragStart: %j', coreEvent.position);
// Short-circuit if user's callback killed it.
- var shouldStart = _this.props.onStart(e, (0, _utilsDomFns.createUIEvent)(_this, coreEvent));
+ var shouldStart = _this.props.onStart(e, (0, _domFns.createUIEvent)(_this, coreEvent));
// Kills start event on core as well, so move handlers are never bound.
if (shouldStart === false) return false;
- _this.setState({
- dragging: true
- });
- };
-
- this.onDrag = function (e, coreEvent) {
+ _this.setState({ dragging: true, dragged: true });
+ }, _this.onDrag = function (e, coreEvent) {
if (!_this.state.dragging) return false;
- (0, _utilsLog2['default'])('Draggable: onDrag: %j', coreEvent.position);
+ (0, _log2.default)('Draggable: onDrag: %j', coreEvent.position);
- // Short-circuit if user's callback killed it.
- var shouldUpdate = _this.props.onDrag(e, (0, _utilsDomFns.createUIEvent)(_this, coreEvent));
- if (shouldUpdate === false) return false;
+ var uiEvent = (0, _domFns.createUIEvent)(_this, coreEvent);
var newState = {
- clientX: _this.state.clientX + coreEvent.position.deltaX,
- clientY: _this.state.clientY + coreEvent.position.deltaY
+ clientX: uiEvent.position.left,
+ clientY: uiEvent.position.top
};
- // Snap to grid if prop has been provided
- if (Array.isArray(_this.props.grid)) {
- newState.lastX = (_this.state.lastX || newState.clientX) + coreEvent.position.deltaX;
- newState.lastY = (_this.state.lastY || newState.clientY) + coreEvent.position.deltaY;
- // Eslint bug, it thinks newState.clientY is undefined
- /*eslint no-undef:0*/
+ // Keep within bounds.
+ if (_this.props.bounds) {
+ // Save original x and y.
+ var _clientX = newState.clientX;
+ var _clientY = newState.clientY;
- var _snapToGrid = (0, _utilsPositionFns.snapToGrid)(_this.props.grid, newState.lastX, newState.lastY);
+ // Add slack to the values used to calculate bound position. This will ensure that if
+ // we start removing slack, the element won't react to it right away until it's been
+ // completely removed.
- var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
+ newState.clientX += _this.state.slackX;
+ newState.clientY += _this.state.slackY;
- newState.clientX = _snapToGrid2[0];
- newState.clientY = _snapToGrid2[1];
- }
+ // Get bound position. This will ceil/floor the x and y within the boundaries.
- // Keep within bounds.
- if (_this.props.bounds) {
- var _getBoundPosition = (0, _utilsPositionFns.getBoundPosition)(_this, newState.clientX, newState.clientY);
+
+ // Recalculate slack by noting how much was shaved by the boundPosition handler.
+
+ var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.clientX, newState.clientY);
var _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2);
newState.clientX = _getBoundPosition2[0];
newState.clientY = _getBoundPosition2[1];
+ newState.slackX = _this.state.slackX + (_clientX - newState.clientX);
+ newState.slackY = _this.state.slackY + (_clientY - newState.clientY);
+
+ // Update the event we fire to reflect what really happened after bounds took effect.
+ uiEvent.position.left = _clientX;
+ uiEvent.position.top = _clientY;
+ uiEvent.deltaX = newState.clientX - _this.state.clientX;
+ uiEvent.deltaY = newState.clientY - _this.state.clientY;
}
- _this.setState(newState);
- };
+ // Short-circuit if user's callback killed it.
+ var shouldUpdate = _this.props.onDrag(e, uiEvent);
+ if (shouldUpdate === false) return false;
- this.onDragStop = function (e, coreEvent) {
+ _this.setState(newState);
+ }, _this.onDragStop = function (e, coreEvent) {
if (!_this.state.dragging) return false;
// Short-circuit if user's callback killed it.
- var shouldStop = _this.props.onStop(e, (0, _utilsDomFns.createUIEvent)(_this, coreEvent));
+ var shouldStop = _this.props.onStop(e, (0, _domFns.createUIEvent)(_this, coreEvent));
if (shouldStop === false) return false;
- (0, _utilsLog2['default'])('Draggable: onDragStop: %j', coreEvent.position);
+ (0, _log2.default)('Draggable: onDragStop: %j', coreEvent.position);
_this.setState({
- dragging: false
+ dragging: false,
+ slackX: 0,
+ slackY: 0
});
- };
+ }, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Draggable, [{
key: 'componentDidMount',
value: function componentDidMount() {
// Check to see if the element passed is an instanceof SVGElement
- if (_reactDom2['default'].findDOMNode(this) instanceof SVGElement) {
+ if (_reactDom2.default.findDOMNode(this) instanceof SVGElement) {
this.setState({ isElementSVG: true });
}
}
+ }, {
+ key: 'componentWillUnmount',
+ value: function componentWillUnmount() {
+ this.setState({ dragging: false }); // prevents invariant if unmounted while dragging
+ }
}, {
key: 'render',
value: function render() {
- var style = undefined,
+ var style = {},
svgTransform = null;
+
// Add a CSS transform to move the element around. This allows us to move the element around
// without worrying about whether or not it is relatively or absolutely positioned.
// If the item you are dragging already has a transform set, wrap it in a so
// has a clean slate.
- style = (0, _utilsDomFns.createTransform)({
+ var transformOpts = {
// Set left if horizontal drag is enabled
- x: (0, _utilsPositionFns.canDragX)(this) ? this.state.clientX : this.props.start.x,
+ x: (0, _positionFns.canDragX)(this) ? this.state.clientX : this.props.start.x,
// Set top if vertical drag is enabled
- y: (0, _utilsPositionFns.canDragY)(this) ? this.state.clientY : this.props.start.y
- }, this.state.isElementSVG);
+ y: (0, _positionFns.canDragY)(this) ? this.state.clientY : this.props.start.y
+ };
// If this element was SVG, we use the `transform` attribute.
if (this.state.isElementSVG) {
- svgTransform = style;
- style = {};
+ svgTransform = (0, _domFns.createSVGTransform)(transformOpts);
+ } else {
+ style = (0, _domFns.createCSSTransform)(transformOpts);
}
// zIndex option
@@ -27652,159 +28991,134 @@ return /******/ (function(modules) { // webpackBootstrap
}
// Mark with class while dragging
- var className = (0, _classnames2['default'])(this.props.children.props.className || '', 'react-draggable', {
+ var className = (0, _classnames2.default)(this.props.children.props.className || '', 'react-draggable', {
'react-draggable-dragging': this.state.dragging,
'react-draggable-dragged': this.state.dragged
});
// Reuse the child provided
// This makes it flexible to use whatever element is wanted (div, ul, etc)
- return _react2['default'].createElement(
- _DraggableCore3['default'],
+ return _react2.default.createElement(
+ _DraggableCore2.default,
_extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
- _react2['default'].cloneElement(_react2['default'].Children.only(this.props.children), {
+ _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
className: className,
- style: (0, _objectAssign2['default'])({}, this.props.children.props.style, style),
+ style: _extends({}, this.props.children.props.style, style),
transform: svgTransform
})
);
}
- }], [{
- key: 'displayName',
- value: 'Draggable',
- enumerable: true
- }, {
- key: 'propTypes',
- value: (0, _objectAssign2['default'])({}, _DraggableCore3['default'].propTypes, {
- /**
- * `axis` determines which axis the draggable can move.
- *
- * 'both' allows movement horizontally and vertically.
- * 'x' limits movement to horizontal axis.
- * 'y' limits movement to vertical axis.
- *
- * Defaults to 'both'.
- */
- axis: _react.PropTypes.oneOf(['both', 'x', 'y']),
+ }]);
- /**
- * `bounds` determines the range of movement available to the element.
- * Available values are:
- *
- * 'parent' restricts movement within the Draggable's parent node.
- *
- * Alternatively, pass an object with the following properties, all of which are optional:
- *
- * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
- *
- * All values are in px.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- *
- * Content
- *
- * );
- * }
- * });
- * ```
- */
- bounds: _react.PropTypes.oneOfType([_react.PropTypes.shape({
- left: _react.PropTypes.Number,
- right: _react.PropTypes.Number,
- top: _react.PropTypes.Number,
- bottom: _react.PropTypes.Number
- }), _react.PropTypes.oneOf(['parent', false])]),
+ return Draggable;
+ }(_react2.default.Component);
- /**
- * `grid` specifies the x and y that dragging should snap to.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- *
- * I snap to a 25 x 25 grid
- *
- * );
- * }
- * });
- * ```
- */
- grid: _react.PropTypes.arrayOf(_react.PropTypes.number),
+ Draggable.displayName = 'Draggable';
+ Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, {
- /**
- * `start` specifies the x and y that the dragged item should start at
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- *
- * I start with transformX: 25px and transformY: 25px;
- *
- * );
- * }
- * });
- * ```
- */
- start: _react.PropTypes.shape({
- x: _react.PropTypes.number,
- y: _react.PropTypes.number
- }),
+ /**
+ * `axis` determines which axis the draggable can move.
+ *
+ * Note that all callbacks will still return data as normal. This only
+ * controls flushing to the DOM.
+ *
+ * 'both' allows movement horizontally and vertically.
+ * 'x' limits movement to horizontal axis.
+ * 'y' limits movement to vertical axis.
+ * 'none' limits all movement.
+ *
+ * Defaults to 'both'.
+ */
+ axis: _react.PropTypes.oneOf(['both', 'x', 'y', 'none']),
- /**
- * `zIndex` specifies the zIndex to use while dragging.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- *
- * I have a zIndex
- *
- * );
- * }
- * });
- * ```
- */
- zIndex: _react.PropTypes.number,
+ /**
+ * `bounds` determines the range of movement available to the element.
+ * Available values are:
+ *
+ * 'parent' restricts movement within the Draggable's parent node.
+ *
+ * Alternatively, pass an object with the following properties, all of which are optional:
+ *
+ * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
+ *
+ * All values are in px.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ *
+ * Content
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ bounds: _react.PropTypes.oneOfType([_react.PropTypes.shape({
+ left: _react.PropTypes.Number,
+ right: _react.PropTypes.Number,
+ top: _react.PropTypes.Number,
+ bottom: _react.PropTypes.Number
+ }), _react.PropTypes.string, _react.PropTypes.oneOf([false])]),
- /**
- * These properties should be defined on the child, not here.
- */
- className: _utilsShims.dontSetMe,
- style: _utilsShims.dontSetMe,
- transform: _utilsShims.dontSetMe
- }),
- enumerable: true
- }, {
- key: 'defaultProps',
- value: (0, _objectAssign2['default'])({}, _DraggableCore3['default'].defaultProps, {
- axis: 'both',
- bounds: false,
- grid: null,
- start: { x: 0, y: 0 },
- zIndex: NaN
- }),
- enumerable: true
- }]);
+ /**
+ * `start` specifies the x and y that the dragged item should start at
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ *
+ * I start with transformX: 25px and transformY: 25px;
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ start: _react.PropTypes.shape({
+ x: _react.PropTypes.number,
+ y: _react.PropTypes.number
+ }),
- return Draggable;
- })(_DraggableCore3['default']);
+ /**
+ * `zIndex` specifies the zIndex to use while dragging.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ *
+ * I have a zIndex
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ zIndex: _react.PropTypes.number,
- exports['default'] = Draggable;
- module.exports = exports['default'];
+ /**
+ * These properties should be defined on the child, not here.
+ */
+ className: _shims.dontSetMe,
+ style: _shims.dontSetMe,
+ transform: _shims.dontSetMe
+ });
+ Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, {
+ axis: 'both',
+ bounds: false,
+ start: { x: 0, y: 0 },
+ zIndex: NaN
+ });
+ exports.default = Draggable;
/***/ },
/* 2 */
@@ -27822,8 +29136,8 @@ return /******/ (function(modules) { // webpackBootstrap
/* 4 */
/***/ function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2015 Jed Watson.
+ 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
*/
@@ -27835,7 +29149,7 @@ return /******/ (function(modules) { // webpackBootstrap
var hasOwn = {}.hasOwnProperty;
function classNames () {
- var classes = '';
+ var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
@@ -27844,28 +29158,28 @@ return /******/ (function(modules) { // webpackBootstrap
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
- classes += ' ' + arg;
+ classes.push(arg);
} else if (Array.isArray(arg)) {
- classes += ' ' + classNames.apply(null, arg);
+ classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
- classes += ' ' + key;
+ classes.push(key);
}
}
}
}
- return classes.substr(1);
+ 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_RESULT__ = function () {
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
- }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
@@ -27874,58 +29188,16 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
/* 5 */
- /***/ function(module, exports) {
-
- /* eslint-disable no-unused-vars */
- 'use strict';
- 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);
- }
-
- module.exports = 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;
- };
-
-
- /***/ },
- /* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
+
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
exports.matchesSelector = matchesSelector;
exports.addEvent = addEvent;
exports.removeEvent = removeEvent;
@@ -27933,7 +29205,6 @@ return /******/ (function(modules) { // webpackBootstrap
exports.outerWidth = outerWidth;
exports.innerHeight = innerHeight;
exports.innerWidth = innerWidth;
- exports.createTransform = createTransform;
exports.createCSSTransform = createCSSTransform;
exports.createSVGTransform = createSVGTransform;
exports.addUserSelectStyles = addUserSelectStyles;
@@ -27942,31 +29213,30 @@ return /******/ (function(modules) { // webpackBootstrap
exports.createCoreEvent = createCoreEvent;
exports.createUIEvent = createUIEvent;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _shims = __webpack_require__(6);
- var _shims = __webpack_require__(7);
-
- var _getPrefix = __webpack_require__(8);
+ var _getPrefix = __webpack_require__(7);
var _getPrefix2 = _interopRequireDefault(_getPrefix);
- var _objectAssign = __webpack_require__(5);
-
- var _objectAssign2 = _interopRequireDefault(_objectAssign);
-
var _reactDom = __webpack_require__(3);
var _reactDom2 = _interopRequireDefault(_reactDom);
- var matchesSelectorFunc = '';
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+ var matchesSelectorFunc = '';
function matchesSelector(el, selector) {
if (!matchesSelectorFunc) {
matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
+ // $FlowIgnore: Doesn't think elements are indexable
return (0, _shims.isFunction)(el[method]);
});
}
+ // $FlowIgnore: Doesn't think elements are indexable
return el[matchesSelectorFunc].call(el, selector);
}
@@ -27979,6 +29249,7 @@ return /******/ (function(modules) { // webpackBootstrap
} else if (el.addEventListener) {
el.addEventListener(event, handler, true);
} else {
+ // $FlowIgnore: Doesn't think elements are indexable
el['on' + event] = handler;
}
}
@@ -27992,6 +29263,7 @@ return /******/ (function(modules) { // webpackBootstrap
} else if (el.removeEventListener) {
el.removeEventListener(event, handler, true);
} else {
+ // $FlowIgnore: Doesn't think elements are indexable
el['on' + event] = null;
}
}
@@ -28015,7 +29287,6 @@ return /******/ (function(modules) { // webpackBootstrap
width += (0, _shims.int)(computedStyle.borderRightWidth);
return width;
}
-
function innerHeight(node) {
var height = node.clientHeight;
var computedStyle = window.getComputedStyle(node);
@@ -28032,40 +29303,27 @@ return /******/ (function(modules) { // webpackBootstrap
return width;
}
- function createTransform(position, isSVG) {
- if (isSVG) return createSVGTransform(position);
- return createCSSTransform(position);
- }
-
function createCSSTransform(_ref) {
var x = _ref.x;
var y = _ref.y;
- return (function () {
- // Replace unitless items with px
- var out = { transform: 'translate(' + x + 'px,' + y + 'px)' };
- // Add single prefixed property as well
- if (_getPrefix2['default']) {
- out[_getPrefix2['default'] + 'Transform'] = out.transform;
- }
- return out;
- })();
+
+ // Replace unitless items with px
+ return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)');
}
- function createSVGTransform(_ref2) {
- var x = _ref2.x;
- var y = _ref2.y;
- return (function () {
- return 'translate(' + x + ',' + y + ')';
- })();
+ function createSVGTransform(_ref3) {
+ var x = _ref3.x;
+ var y = _ref3.y;
+
+ return 'translate(' + x + ',' + y + ')';
}
// User-select Hacks:
//
// Useful for preventing blue highlights all over everything when dragging.
- var userSelectStyle = ';user-select: none;';
- if (_getPrefix2['default']) {
- userSelectStyle += '-' + _getPrefix2['default'].toLowerCase() + '-user-select: none;';
- }
+ var userSelectPrefix = (0, _getPrefix.getPrefix)('user-select');
+ var userSelect = (0, _getPrefix.browserPrefixToStyle)('user-select', userSelectPrefix);
+ var userSelectStyle = ';' + userSelect + ': none;';
function addUserSelectStyles() {
var style = document.body.getAttribute('style') || '';
@@ -28082,22 +29340,19 @@ return /******/ (function(modules) { // webpackBootstrap
// Workaround IE pointer events; see #51
// https://github.com/mzabriskie/react-draggable/issues/51#issuecomment-103488278
- var touchHacks = {
+ return _extends({
touchAction: 'none'
- };
-
- return (0, _objectAssign2['default'])(touchHacks, childStyle);
+ }, childStyle);
}
// Create an event exposed by
-
function createCoreEvent(draggable, clientX, clientY) {
// State changes are often (but not always!) async. We want the latest value.
var state = draggable._pendingState || draggable.state;
var isStart = !(0, _shims.isNum)(state.lastX);
return {
- node: _reactDom2['default'].findDOMNode(draggable),
+ node: _reactDom2.default.findDOMNode(draggable),
position: isStart ?
// If this is our first move, use the clientX and clientY as last coords.
{
@@ -28115,13 +29370,12 @@ return /******/ (function(modules) { // webpackBootstrap
}
// Create an event exposed by
-
function createUIEvent(draggable, coreEvent) {
return {
- node: _reactDom2['default'].findDOMNode(draggable),
+ node: _reactDom2.default.findDOMNode(draggable),
position: {
- top: coreEvent.position.clientY,
- left: coreEvent.position.clientX
+ left: draggable.state.clientX + coreEvent.position.deltaX,
+ top: draggable.state.clientY + coreEvent.position.deltaY
},
deltaX: coreEvent.position.deltaX,
deltaY: coreEvent.position.deltaY
@@ -28129,13 +29383,12 @@ return /******/ (function(modules) { // webpackBootstrap
}
/***/ },
- /* 7 */
+ /* 6 */
/***/ function(module, exports) {
- // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findInArray = findInArray;
@@ -28144,8 +29397,9 @@ return /******/ (function(modules) { // webpackBootstrap
exports.int = int;
exports.dontSetMe = dontSetMe;
+ // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
function findInArray(array, callback) {
- for (var i = 0, _length = array.length; i < _length; i++) {
+ for (var i = 0, length = array.length; i < length; i++) {
if (callback.apply(callback, [array[i], i, array])) return array[i];
}
}
@@ -28169,36 +29423,74 @@ return /******/ (function(modules) { // webpackBootstrap
}
/***/ },
- /* 8 */
+ /* 7 */
/***/ function(module, exports) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
+ exports.getPrefix = getPrefix;
+ exports.browserPrefixToKey = browserPrefixToKey;
+ exports.browserPrefixToStyle = browserPrefixToStyle;
- exports['default'] = (function () {
- if (typeof window === 'undefined') return '';
- // Thanks David Walsh
- var styles = window.getComputedStyle(document.documentElement, ''),
- pre = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || styles.OLink === '' && ['', 'o'])[1];
- // 'ms' is not titlecased
- if (pre === undefined || pre === null) return '';
- if (pre === 'ms') return pre;
- if (pre === undefined || pre === null) return '';
- return pre.slice(0, 1).toUpperCase() + pre.slice(1);
- })();
+ var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
+ function getPrefix() {
+ var prop = arguments.length <= 0 || arguments[0] === undefined ? 'transform' : arguments[0];
- module.exports = exports['default'];
+ // Checking specifically for 'window.document' is for pseudo-browser server-side
+ // environments that define 'window' as the global context.
+ // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)
+ if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
+
+ var style = window.document.documentElement.style;
+
+ if (prop in style) return '';
+
+ for (var i = 0; i < prefixes.length; i++) {
+ if (browserPrefixToStyle(prop, prefixes[i]) in style) return prefixes[i];
+ }
+
+ return '';
+ }
+
+ function browserPrefixToKey(prop, prefix) {
+ return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
+ }
+
+ function browserPrefixToStyle(prop, prefix) {
+ return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop;
+ }
+
+ function kebabToTitleCase(str) {
+ var out = '';
+ var shouldCapitalize = true;
+ for (var i = 0; i < str.length; i++) {
+ if (shouldCapitalize) {
+ out += str[i].toUpperCase();
+ shouldCapitalize = false;
+ } else if (str[i] === '-') {
+ shouldCapitalize = true;
+ } else {
+ out += str[i];
+ }
+ }
+ return out;
+ }
+
+ // Default export is the prefix itself, like 'Moz', 'Webkit', etc
+ // Note that you may have to re-test for certain things; for instance, Chrome 50
+ // can handle unprefixed `transform`, but not unprefixed `user-select`
+ exports.default = getPrefix();
/***/ },
- /* 9 */
+ /* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBoundPosition = getBoundPosition;
@@ -28207,33 +29499,46 @@ return /******/ (function(modules) { // webpackBootstrap
exports.canDragY = canDragY;
exports.getControlPosition = getControlPosition;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _react = __webpack_require__(2);
+
+ var _react2 = _interopRequireDefault(_react);
- var _shims = __webpack_require__(7);
+ var _shims = __webpack_require__(6);
var _reactDom = __webpack_require__(3);
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _domFns = __webpack_require__(6);
+ var _domFns = __webpack_require__(5);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getBoundPosition(draggable, clientX, clientY) {
// If no bounds, short-circuit and move on
if (!draggable.props.bounds) return [clientX, clientY];
- var bounds = JSON.parse(JSON.stringify(draggable.props.bounds));
- var node = _reactDom2['default'].findDOMNode(draggable);
- var parent = node.parentNode;
+ // Clone new bounds
+ var bounds = draggable.props.bounds;
- if (bounds === 'parent') {
+ bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
+ var node = _reactDom2.default.findDOMNode(draggable);
+
+ if (typeof bounds === 'string') {
+ var boundNode = void 0;
+ if (bounds === 'parent') {
+ boundNode = node.parentNode;
+ } else {
+ boundNode = document.querySelector(bounds);
+ if (!boundNode) throw new Error('Bounds selector "' + bounds + '" could not find an element.');
+ }
var nodeStyle = window.getComputedStyle(node);
- var parentStyle = window.getComputedStyle(parent);
+ var boundNodeStyle = window.getComputedStyle(boundNode);
// Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
bounds = {
- left: -node.offsetLeft + (0, _shims.int)(parentStyle.paddingLeft) + (0, _shims.int)(nodeStyle.borderLeftWidth) + (0, _shims.int)(nodeStyle.marginLeft),
- top: -node.offsetTop + (0, _shims.int)(parentStyle.paddingTop) + (0, _shims.int)(nodeStyle.borderTopWidth) + (0, _shims.int)(nodeStyle.marginTop),
- right: (0, _domFns.innerWidth)(parent) - (0, _domFns.outerWidth)(node) - node.offsetLeft,
- bottom: (0, _domFns.innerHeight)(parent) - (0, _domFns.outerHeight)(node) - node.offsetTop
+ left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.borderLeftWidth) + (0, _shims.int)(nodeStyle.marginLeft),
+ top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.borderTopWidth) + (0, _shims.int)(nodeStyle.marginTop),
+ right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft,
+ bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop
};
}
@@ -28263,7 +29568,6 @@ return /******/ (function(modules) { // webpackBootstrap
}
// Get {clientX, clientY} positions from event.
-
function getControlPosition(e) {
var position = e.targetTouches && e.targetTouches[0] || e;
return {
@@ -28271,40 +29575,52 @@ return /******/ (function(modules) { // webpackBootstrap
clientY: position.clientY
};
}
+
+ // A lot faster than stringify/parse
+ function cloneBounds(bounds) {
+ return {
+ left: bounds.left,
+ top: bounds.top,
+ right: bounds.right,
+ bottom: bounds.bottom
+ };
+ }
/***/ },
- /* 10 */
+ /* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ 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; }; }();
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _react = __webpack_require__(2);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _react2 = _interopRequireDefault(_react);
- 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 _domFns = __webpack_require__(5);
- var _react = __webpack_require__(2);
+ var _positionFns = __webpack_require__(8);
- var _react2 = _interopRequireDefault(_react);
+ var _shims = __webpack_require__(6);
- var _utilsDomFns = __webpack_require__(6);
+ var _log = __webpack_require__(10);
- var _utilsPositionFns = __webpack_require__(9);
+ var _log2 = _interopRequireDefault(_log);
- var _utilsShims = __webpack_require__(7);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _utilsLog = __webpack_require__(11);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var _utilsLog2 = _interopRequireDefault(_utilsLog);
+ 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; }
// Simple abstraction for dragging events names.
var eventsFor = {
@@ -28330,23 +29646,25 @@ return /******/ (function(modules) { // webpackBootstrap
// work well with libraries that require more control over the element.
//
- var DraggableCore = (function (_React$Component) {
+ var DraggableCore = function (_React$Component) {
_inherits(DraggableCore, _React$Component);
function DraggableCore() {
- var _this = this;
+ var _Object$getPrototypeO;
+
+ var _temp, _this, _ret;
_classCallCheck(this, DraggableCore);
- _get(Object.getPrototypeOf(DraggableCore.prototype), 'constructor', this).apply(this, arguments);
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
- this.state = {
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(DraggableCore)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.state = {
dragging: false,
// Used while dragging to determine deltas.
lastX: null, lastY: null
- };
-
- this.handleDragStart = function (e) {
+ }, _this.handleDragStart = function (e) {
// Make it possible to attach event handlers on top of this one.
_this.props.onMouseDown(e);
@@ -28354,7 +29672,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
// Short circuit if handle or cancel prop was provided and selector doesn't match.
- if (_this.props.disabled || _this.props.handle && !(0, _utilsDomFns.matchesSelector)(e.target, _this.props.handle) || _this.props.cancel && (0, _utilsDomFns.matchesSelector)(e.target, _this.props.cancel)) {
+ if (_this.props.disabled || _this.props.handle && !(0, _domFns.matchesSelector)(e.target, _this.props.handle) || _this.props.cancel && (0, _domFns.matchesSelector)(e.target, _this.props.cancel)) {
return;
}
@@ -28367,22 +29685,23 @@ return /******/ (function(modules) { // webpackBootstrap
// Add a style to the body to disable user-select. This prevents text from
// being selected all over the page.
- (0, _utilsDomFns.addUserSelectStyles)();
+ if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)();
// Get the current drag point from the event. This is used as the offset.
- var _getControlPosition = (0, _utilsPositionFns.getControlPosition)(e);
+ var _getControlPosition = (0, _positionFns.getControlPosition)(e);
var clientX = _getControlPosition.clientX;
var clientY = _getControlPosition.clientY;
// Create an event object with all the data parents need to make a decision here.
- var coreEvent = (0, _utilsDomFns.createCoreEvent)(_this, clientX, clientY);
- (0, _utilsLog2['default'])('DraggableCore: handleDragStart: %j', coreEvent.position);
+ var coreEvent = (0, _domFns.createCoreEvent)(_this, clientX, clientY);
+
+ (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent.position);
// Call event handler. If it returns explicit false, cancel.
- (0, _utilsLog2['default'])('calling', _this.props.onStart);
+ (0, _log2.default)('calling', _this.props.onStart);
var shouldUpdate = _this.props.onStart(e, coreEvent);
if (shouldUpdate === false) return;
@@ -28400,26 +29719,41 @@ return /******/ (function(modules) { // webpackBootstrap
});
// Translate el on page scroll.
- (0, _utilsDomFns.addEvent)(document, 'scroll', _this.handleScroll);
+ (0, _domFns.addEvent)(document, 'scroll', _this.handleScroll);
// Add events to the document directly so we catch when the user's mouse/touch moves outside of
// this element. We use different events depending on whether or not we have detected that this
// is a touch-capable device.
- (0, _utilsDomFns.addEvent)(document, dragEventFor.move, _this.handleDrag);
- (0, _utilsDomFns.addEvent)(document, dragEventFor.stop, _this.handleDragStop);
- };
-
- this.handleDrag = function (e) {
+ (0, _domFns.addEvent)(document, dragEventFor.move, _this.handleDrag);
+ (0, _domFns.addEvent)(document, dragEventFor.stop, _this.handleDragStop);
+ }, _this.handleDrag = function (e) {
// Return if this is a touch event, but not the correct one for this element
if (e.targetTouches && e.targetTouches[0].identifier !== _this.state.touchIdentifier) return;
- var _getControlPosition2 = (0, _utilsPositionFns.getControlPosition)(e);
+ var _getControlPosition2 = (0, _positionFns.getControlPosition)(e);
var clientX = _getControlPosition2.clientX;
var clientY = _getControlPosition2.clientY;
- var coreEvent = (0, _utilsDomFns.createCoreEvent)(_this, clientX, clientY);
+ // Snap to grid if prop has been provided
+
+ if (Array.isArray(_this.props.grid)) {
+ var deltaX = clientX - _this.state.lastX,
+ deltaY = clientY - _this.state.lastY;
+
+ var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
- (0, _utilsLog2['default'])('DraggableCore: handleDrag: %j', coreEvent.position);
+ var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
+
+ deltaX = _snapToGrid2[0];
+ deltaY = _snapToGrid2[1];
+
+ if (!deltaX && !deltaY) return; // skip useless drag
+ clientX = _this.state.lastX + deltaX, clientY = _this.state.lastY + deltaY;
+ }
+
+ var coreEvent = (0, _domFns.createCoreEvent)(_this, clientX, clientY);
+
+ (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent.position);
// Call event handler. If it returns explicit false, trigger end.
var shouldUpdate = _this.props.onDrag(e, coreEvent);
@@ -28432,9 +29766,7 @@ return /******/ (function(modules) { // webpackBootstrap
lastX: clientX,
lastY: clientY
});
- };
-
- this.handleDragStop = function (e) {
+ }, _this.handleDragStop = function (e) {
if (!_this.state.dragging) return;
// Short circuit if this is not the correct touch event. `changedTouches` contains all
@@ -28442,16 +29774,16 @@ return /******/ (function(modules) { // webpackBootstrap
if (e.changedTouches && e.changedTouches[0].identifier !== _this.state.touchIdentifier) return;
// Remove user-select hack
- if (_this.props.enableUserSelectHack) (0, _utilsDomFns.removeUserSelectStyles)();
+ if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)();
- var _getControlPosition3 = (0, _utilsPositionFns.getControlPosition)(e);
+ var _getControlPosition3 = (0, _positionFns.getControlPosition)(e);
var clientX = _getControlPosition3.clientX;
var clientY = _getControlPosition3.clientY;
- var coreEvent = (0, _utilsDomFns.createCoreEvent)(_this, clientX, clientY);
+ var coreEvent = (0, _domFns.createCoreEvent)(_this, clientX, clientY);
- (0, _utilsLog2['default'])('DraggableCore: handleDragStop: %j', coreEvent.position);
+ (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent.position);
// Reset the el.
_this.setState({
@@ -28464,47 +29796,47 @@ return /******/ (function(modules) { // webpackBootstrap
_this.props.onStop(e, coreEvent);
// Remove event handlers
- (0, _utilsLog2['default'])('DraggableCore: Removing handlers');
- (0, _utilsDomFns.removeEvent)(document, 'scroll', _this.handleScroll);
- (0, _utilsDomFns.removeEvent)(document, dragEventFor.move, _this.handleDrag);
- (0, _utilsDomFns.removeEvent)(document, dragEventFor.stop, _this.handleDragStop);
- };
-
- this.handleScroll = function () {
+ (0, _log2.default)('DraggableCore: Removing handlers');
+ (0, _domFns.removeEvent)(document, 'scroll', _this.handleScroll);
+ (0, _domFns.removeEvent)(document, dragEventFor.move, _this.handleDrag);
+ (0, _domFns.removeEvent)(document, dragEventFor.stop, _this.handleDragStop);
+ }, _this.handleScroll = function (e) {
var s = _this.state,
x = document.body.scrollLeft,
y = document.body.scrollTop;
// Create the usual event, but make the scroll offset our deltas.
- var coreEvent = (0, _utilsDomFns.createCoreEvent)(_this);
- coreEvent.deltaX = x - s.scrollX;
- coreEvent.deltaY = y - s.scrollY;
+ var coreEvent = (0, _domFns.createCoreEvent)(_this);
+ coreEvent.position.deltaX = x - s.scrollX;
+ coreEvent.position.deltaY = y - s.scrollY;
_this.setState({
- lastX: s.lastX + coreEvent.deltaX,
- lastY: s.lastY + coreEvent.deltaY
+ lastX: s.lastX + coreEvent.position.deltaX,
+ lastY: s.lastY + coreEvent.position.deltaY,
+ scrollX: x,
+ scrollY: y
});
- _this.props.onDrag(coreEvent);
- };
-
- this.onMouseDown = function (e) {
- // HACK: Prevent 'ghost click' which happens 300ms after touchstart if the event isn't cancelled.
- // We don't cancel the event on touchstart because of #37; we might want to make a scrollable item draggable.
- // More on ghost clicks: http://ariatemplates.com/blog/2014/05/ghost-clicks-in-mobile-browsers/
- if (dragEventFor === eventsFor.touch) {
- return e.preventDefault();
- }
+ _this.props.onDrag(e, coreEvent);
+ }, _this.onMouseDown = function (e) {
+ dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
return _this.handleDragStart(e);
- };
+ }, _this.onMouseUp = function (e) {
+ dragEventFor = eventsFor.mouse;
- this.onTouchStart = function (e) {
+ return _this.handleDragStop(e);
+ }, _this.onTouchStart = function (e) {
// We're on a touch device now, so change the event handlers
dragEventFor = eventsFor.touch;
return _this.handleDragStart(e);
- };
+ }, _this.onTouchEnd = function (e) {
+ // We're on a touch device now, so change the event handlers
+ dragEventFor = eventsFor.touch;
+
+ return _this.handleDragStop(e);
+ }, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(DraggableCore, [{
@@ -28512,222 +29844,233 @@ return /******/ (function(modules) { // webpackBootstrap
value: function componentWillUnmount() {
// Remove any leftover event handlers. Remove both touch and mouse handlers in case
// some browser quirk caused a touch event to fire during a mouse move, or vice versa.
- (0, _utilsDomFns.removeEvent)(document, eventsFor.mouse.move, this.handleDrag);
- (0, _utilsDomFns.removeEvent)(document, eventsFor.touch.move, this.handleDrag);
- (0, _utilsDomFns.removeEvent)(document, eventsFor.mouse.stop, this.handleDragStop);
- (0, _utilsDomFns.removeEvent)(document, eventsFor.touch.stop, this.handleDragStop);
- if (this.props.enableUserSelectHack) (0, _utilsDomFns.removeUserSelectStyles)();
+ (0, _domFns.removeEvent)(document, eventsFor.mouse.move, this.handleDrag);
+ (0, _domFns.removeEvent)(document, eventsFor.touch.move, this.handleDrag);
+ (0, _domFns.removeEvent)(document, eventsFor.mouse.stop, this.handleDragStop);
+ (0, _domFns.removeEvent)(document, eventsFor.touch.stop, this.handleDragStop);
+ (0, _domFns.removeEvent)(document, 'scroll', this.handleScroll);
+ if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)();
}
+
+ // When the user scrolls, adjust internal state so the draggable moves along the page properly.
+ // This only fires when a drag is active.
+
+
+ // Same as onMouseDown (start drag), but now consider this a touch device.
+
}, {
key: 'render',
value: function render() {
// Reuse the child provided
// This makes it flexible to use whatever element is wanted (div, ul, etc)
- return _react2['default'].cloneElement(_react2['default'].Children.only(this.props.children), {
- style: (0, _utilsDomFns.styleHacks)(this.props.children.props.style),
+ return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
+ style: (0, _domFns.styleHacks)(this.props.children.props.style),
// Note: mouseMove handler is attached to document so it will still function
// when the user drags quickly and leaves the bounds of the element.
onMouseDown: this.onMouseDown,
onTouchStart: this.onTouchStart,
- onMouseUp: this.handleDragStop,
- onTouchEnd: this.handleDragStop
+ onMouseUp: this.onMouseUp,
+ onTouchEnd: this.onTouchEnd
});
}
- }], [{
- key: 'displayName',
- value: 'DraggableCore',
- enumerable: true
- }, {
- key: 'propTypes',
- value: {
- /**
- * `allowAnyClick` allows dragging using any mouse button.
- * By default, we only accept the left button.
- *
- * Defaults to `false`.
- */
- allowAnyClick: _react.PropTypes.bool,
+ }]);
- /**
- * `disabled`, if true, stops the from dragging. All handlers,
- * with the exception of `onMouseDown`, will not fire.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- *
- * I can't be dragged
- *
- * );
- * }
- * });
- * ```
- */
- disabled: _react.PropTypes.bool,
+ return DraggableCore;
+ }(_react2.default.Component);
- /**
- * By default, we add 'user-select:none' attributes to the document body
- * to prevent ugly text selection during drag. If this is causing problems
- * for your app, set this to `false`.
- */
- enableUserSelectHack: _react.PropTypes.bool,
+ DraggableCore.displayName = 'DraggableCore';
+ DraggableCore.propTypes = {
+ /**
+ * `allowAnyClick` allows dragging using any mouse button.
+ * By default, we only accept the left button.
+ *
+ * Defaults to `false`.
+ */
+ allowAnyClick: _react.PropTypes.bool,
- /**
- * `handle` specifies a selector to be used as the handle that initiates drag.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- *
- *
- *
Click me to drag
- *
This is some other content
- *
- *
- * );
- * }
- * });
- * ```
- */
- handle: _react.PropTypes.string,
+ /**
+ * `disabled`, if true, stops the from dragging. All handlers,
+ * with the exception of `onMouseDown`, will not fire.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ *
+ * I can't be dragged
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ disabled: _react.PropTypes.bool,
- /**
- * `cancel` specifies a selector to be used to prevent drag initialization.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return(
- *
- *
- *
You can't drag from here
- *
Dragging here works fine
- *
- *
- * );
- * }
- * });
- * ```
- */
- cancel: _react.PropTypes.string,
+ /**
+ * By default, we add 'user-select:none' attributes to the document body
+ * to prevent ugly text selection during drag. If this is causing problems
+ * for your app, set this to `false`.
+ */
+ enableUserSelectHack: _react.PropTypes.bool,
- /**
- * Called when dragging starts.
- * If this function returns the boolean false, dragging will be canceled.
- *
- * Example:
- *
- * ```js
- * function (event, ui) {}
- * ```
- *
- * `event` is the Event that was triggered.
- * `ui` is an object:
- *
- * ```js
- * {
- * position: {top: 0, left: 0}
- * }
- * ```
- */
- onStart: _react.PropTypes.func,
+ /**
+ * `grid` specifies the x and y that dragging should snap to.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ *
+ * I snap to a 25 x 25 grid
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ grid: _react.PropTypes.arrayOf(_react.PropTypes.number),
- /**
- * Called while dragging.
- * If this function returns the boolean false, dragging will be canceled.
- *
- * Example:
- *
- * ```js
- * function (event, ui) {}
- * ```
- *
- * `event` is the Event that was triggered.
- * `ui` is an object:
- *
- * ```js
- * {
- * position: {top: 0, left: 0}
- * }
- * ```
- */
- onDrag: _react.PropTypes.func,
+ /**
+ * `handle` specifies a selector to be used as the handle that initiates drag.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ *
+ *
+ *
Click me to drag
+ *
This is some other content
+ *
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ handle: _react.PropTypes.string,
- /**
- * Called when dragging stops.
- *
- * Example:
- *
- * ```js
- * function (event, ui) {}
- * ```
- *
- * `event` is the Event that was triggered.
- * `ui` is an object:
- *
- * ```js
- * {
- * position: {top: 0, left: 0}
- * }
- * ```
- */
- onStop: _react.PropTypes.func,
+ /**
+ * `cancel` specifies a selector to be used to prevent drag initialization.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return(
+ *
+ *
+ *
You can't drag from here
+ *
Dragging here works fine
+ *
+ *
+ * );
+ * }
+ * });
+ * ```
+ */
+ cancel: _react.PropTypes.string,
- /**
- * A workaround option which can be passed if onMouseDown needs to be accessed,
- * since it'll always be blocked (due to that there's internal use of onMouseDown)
- */
- onMouseDown: _react.PropTypes.func,
+ /**
+ * Called when dragging starts.
+ * If this function returns the boolean false, dragging will be canceled.
+ *
+ * Example:
+ *
+ * ```js
+ * function (event, ui) {}
+ * ```
+ *
+ * `event` is the Event that was triggered.
+ * `ui` is an object:
+ *
+ * ```js
+ * {
+ * position: {top: 0, left: 0}
+ * }
+ * ```
+ */
+ onStart: _react.PropTypes.func,
- /**
- * These properties should be defined on the child, not here.
- */
- className: _utilsShims.dontSetMe,
- style: _utilsShims.dontSetMe,
- transform: _utilsShims.dontSetMe
- },
- enumerable: true
- }, {
- key: 'defaultProps',
- value: {
- allowAnyClick: false, // by default only accept left click
- cancel: null,
- disabled: false,
- enableUserSelectHack: true,
- handle: null,
- transform: null,
- onStart: function onStart() {},
- onDrag: function onDrag() {},
- onStop: function onStop() {},
- onMouseDown: function onMouseDown() {}
- },
- enumerable: true
- }]);
+ /**
+ * Called while dragging.
+ * If this function returns the boolean false, dragging will be canceled.
+ *
+ * Example:
+ *
+ * ```js
+ * function (event, ui) {}
+ * ```
+ *
+ * `event` is the Event that was triggered.
+ * `ui` is an object:
+ *
+ * ```js
+ * {
+ * position: {top: 0, left: 0}
+ * }
+ * ```
+ */
+ onDrag: _react.PropTypes.func,
- return DraggableCore;
- })(_react2['default'].Component);
+ /**
+ * Called when dragging stops.
+ *
+ * Example:
+ *
+ * ```js
+ * function (event, ui) {}
+ * ```
+ *
+ * `event` is the Event that was triggered.
+ * `ui` is an object:
+ *
+ * ```js
+ * {
+ * position: {top: 0, left: 0}
+ * }
+ * ```
+ */
+ onStop: _react.PropTypes.func,
- exports['default'] = DraggableCore;
- module.exports = exports['default'];
-
- // When the user scrolls, adjust internal state so the draggable moves along the page properly.
- // This only fires when a drag is active.
-
- // On mousedown, consider the drag started.
-
- // Same as onMouseDown (start drag), but now consider this a touch device.
+ /**
+ * A workaround option which can be passed if onMouseDown needs to be accessed,
+ * since it'll always be blocked (due to that there's internal use of onMouseDown)
+ */
+ onMouseDown: _react.PropTypes.func,
+
+ /**
+ * These properties should be defined on the child, not here.
+ */
+ className: _shims.dontSetMe,
+ style: _shims.dontSetMe,
+ transform: _shims.dontSetMe
+ };
+ DraggableCore.defaultProps = {
+ allowAnyClick: false, // by default only accept left click
+ cancel: null,
+ disabled: false,
+ enableUserSelectHack: true,
+ handle: null,
+ grid: null,
+ transform: null,
+ onStart: function onStart() {},
+ onDrag: function onDrag() {},
+ onStop: function onStop() {},
+ onMouseDown: function onMouseDown() {}
+ };
+ exports.default = DraggableCore;
/***/ },
- /* 11 */
+ /* 10 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
@@ -28735,13 +30078,12 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
- exports["default"] = log;
-
+ exports.default = log;
function log() {
- if ((undefined)) console.log.apply(console, arguments);
- }
+ var _console;
- module.exports = exports["default"];
+ if ((undefined)) (_console = console).log.apply(_console, arguments);
+ }
/***/ }
/******/ ])
@@ -28750,11 +30092,11 @@ return /******/ (function(modules) { // webpackBootstrap
//# sourceMappingURL=react-draggable.js.map
/***/ },
-/* 273 */
+/* 282 */
/***/ function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2015 Jed Watson.
+ 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
*/
@@ -28766,7 +30108,7 @@ return /******/ (function(modules) { // webpackBootstrap
var hasOwn = {}.hasOwnProperty;
function classNames () {
- var classes = '';
+ var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
@@ -28775,28 +30117,28 @@ return /******/ (function(modules) { // webpackBootstrap
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
- classes += ' ' + arg;
+ classes.push(arg);
} else if (Array.isArray(arg)) {
- classes += ' ' + classNames.apply(null, arg);
+ classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
- classes += ' ' + key;
+ classes.push(key);
}
}
}
}
- return classes.substr(1);
+ 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_RESULT__ = function () {
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
- }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
@@ -28804,73 +30146,75 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 274 */
+/* 283 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- 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 _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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
- var _BaseComponent2 = __webpack_require__(267);
+ var _BaseComponent2 = __webpack_require__(276);
var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _reactDraggable = __webpack_require__(272);
+ var _reactDraggable = __webpack_require__(281);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _merge = __webpack_require__(188);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _merge2 = _interopRequireDefault(_merge);
- var _EdgeDisplaySettings = __webpack_require__(275);
+ var _EdgeDisplaySettings = __webpack_require__(284);
var _EdgeDisplaySettings2 = _interopRequireDefault(_EdgeDisplaySettings);
- var _NodeDisplaySettings = __webpack_require__(270);
+ var _NodeDisplaySettings = __webpack_require__(279);
var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
- var _classnames = __webpack_require__(273);
+ var _classnames = __webpack_require__(282);
var _classnames2 = _interopRequireDefault(_classnames);
- var Edge = (function (_BaseComponent) {
+ 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 Edge = function (_BaseComponent) {
_inherits(Edge, _BaseComponent);
function Edge(props) {
_classCallCheck(this, Edge);
- _get(Object.getPrototypeOf(Edge.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop', '_handleClick', '_handleTextClick');
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Edge).call(this, props));
+
+ _this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop', '_handleClick', '_handleTextClick');
// need control point immediately for dragging
- var _calculateGeometry2 = this._calculateGeometry(props.edge.display);
+ var _this$_calculateGeome = _this._calculateGeometry(props.edge.display);
- var cx = _calculateGeometry2.cx;
- var cy = _calculateGeometry2.cy;
+ var cx = _this$_calculateGeome.cx;
+ var cy = _this$_calculateGeome.cy;
- this.state = (0, _lodashObjectMerge2['default'])({}, props.edge.display, { cx: cx, cy: cy });
+ _this.state = (0, _merge2.default)({}, props.edge.display, { cx: cx, cy: cy });
+ return _this;
}
_createClass(Edge, [{
key: 'render',
value: function render() {
- var _this = this;
+ var _this2 = this;
var e = this.props.edge;
var sp = this._getSvgParams(e);
@@ -28878,35 +30222,35 @@ return /******/ (function(modules) { // webpackBootstrap
var selected = this.props.selected;
var highlighted = e.display.status == "highlighted";
- return _react2['default'].createElement(
+ return _react2.default.createElement(
_reactDraggable.DraggableCore,
{
- ref: function (c) {
- return _this.draggable = c;
+ ref: function ref(c) {
+ return _this2.draggable = c;
},
handle: '.handle',
moveOnStartChange: false,
onStart: this._handleDragStart,
onDrag: this._handleDrag,
onStop: this._handleDragStop },
- _react2['default'].createElement(
+ _react2.default.createElement(
'g',
- { id: sp.groupId, className: (0, _classnames2['default'])({ edge: true, selected: selected, highlighted: highlighted }) },
- selected ? _react2['default'].createElement('path', {
+ { id: sp.groupId, className: (0, _classnames2.default)({ edge: true, selected: selected, highlighted: highlighted }) },
+ selected ? _react2.default.createElement('path', {
className: 'edge-selection',
d: sp.curve,
- stroke: _EdgeDisplaySettings2['default'].selectColor,
- strokeOpacity: _EdgeDisplaySettings2['default'].selectOpacity,
- strokeWidth: width + _EdgeDisplaySettings2['default'].selectWidthDiff,
+ stroke: _EdgeDisplaySettings2.default.selectColor,
+ strokeOpacity: _EdgeDisplaySettings2.default.selectOpacity,
+ strokeWidth: width + _EdgeDisplaySettings2.default.selectWidthDiff,
fill: 'none' }) : null,
- highlighted ? _react2['default'].createElement('path', {
+ highlighted ? _react2.default.createElement('path', {
className: 'edge-background',
d: sp.curve,
stroke: sp.bgColor,
strokeOpacity: sp.Opacity,
- strokeWidth: width + _EdgeDisplaySettings2['default'].bgWidthDiff,
+ strokeWidth: width + _EdgeDisplaySettings2.default.bgWidthDiff,
fill: 'none' }) : null,
- _react2['default'].createElement('path', {
+ _react2.default.createElement('path', {
id: sp.pathId,
className: 'edge-line',
d: sp.curve,
@@ -28916,7 +30260,7 @@ return /******/ (function(modules) { // webpackBootstrap
fill: 'none',
markerStart: sp.markerStart,
markerEnd: sp.markerEnd }),
- _react2['default'].createElement('path', {
+ _react2.default.createElement('path', {
className: 'handle edge-handle edgeSelect',
d: sp.curve,
stroke: '#fff',
@@ -28924,8 +30268,8 @@ return /******/ (function(modules) { // webpackBootstrap
strokeWidth: width + 20,
fill: 'none',
onClick: this._handleClick }),
- this.state.label ? _react2['default'].createElement('text', {
- className: (0, _classnames2['default'])({ link: e.display.url, handle: true }),
+ this.state.label ? _react2.default.createElement('text', {
+ className: (0, _classnames2.default)({ link: e.display.url, handle: true }),
dy: -5 - width / 2,
fill: sp.textColor,
textAnchor: 'middle',
@@ -28937,7 +30281,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
- var newState = (0, _lodashObjectMerge2['default'])({ label: null, url: null }, props.edge.display);
+ var newState = (0, _merge2.default)({ label: null, url: null }, props.edge.display);
this.setState(newState);
}
}, {
@@ -29005,17 +30349,18 @@ return /******/ (function(modules) { // webpackBootstrap
var dash = _state.dash;
var status = _state.status;
- var _calculateGeometry3 = this._calculateGeometry(this.state);
+ var _calculateGeometry2 = this._calculateGeometry(this.state);
+
+ var x = _calculateGeometry2.x;
+ var y = _calculateGeometry2.y;
+ var cx = _calculateGeometry2.cx;
+ var cy = _calculateGeometry2.cy;
+ var xa = _calculateGeometry2.xa;
+ var ya = _calculateGeometry2.ya;
+ var xb = _calculateGeometry2.xb;
+ var yb = _calculateGeometry2.yb;
+ var is_reverse = _calculateGeometry2.is_reverse;
- var x = _calculateGeometry3.x;
- var y = _calculateGeometry3.y;
- var cx = _calculateGeometry3.cx;
- var cy = _calculateGeometry3.cy;
- var xa = _calculateGeometry3.xa;
- var ya = _calculateGeometry3.ya;
- var xb = _calculateGeometry3.xb;
- var yb = _calculateGeometry3.yb;
- var is_reverse = _calculateGeometry3.is_reverse;
var pathId = 'path-' + e.id;
var fontSize = 10 * Math.sqrt(scale);
@@ -29030,10 +30375,10 @@ return /******/ (function(modules) { // webpackBootstrap
textPath: { __html: '' + label + '' },
markerStart: arrow && is_reverse ? "url(#marker2)" : "",
markerEnd: arrow && !is_reverse ? "url(#marker1)" : "",
- lineColor: _EdgeDisplaySettings2['default'].lineColor[status],
- textColor: _EdgeDisplaySettings2['default'].textColor[status],
- bgColor: _EdgeDisplaySettings2['default'].bgColor[status],
- bgOpacity: _EdgeDisplaySettings2['default'].bgOpacity[status]
+ lineColor: _EdgeDisplaySettings2.default.lineColor[status],
+ textColor: _EdgeDisplaySettings2.default.textColor[status],
+ bgColor: _EdgeDisplaySettings2.default.bgColor[status],
+ bgOpacity: _EdgeDisplaySettings2.default.bgOpacity[status]
};
}
}, {
@@ -29049,19 +30394,19 @@ return /******/ (function(modules) { // webpackBootstrap
var s1 = state.s1;
var s2 = state.s2;
- var r1 = s1 * _NodeDisplaySettings2['default'].circleRadius;
- var r2 = s2 * _NodeDisplaySettings2['default'].circleRadius;
+ var r1 = s1 * _NodeDisplaySettings2.default.circleRadius;
+ var r2 = s2 * _NodeDisplaySettings2.default.circleRadius;
// set edge position at midpoint between nodes
var x = (x1 + x2) / 2;
var y = (y1 + y2) / 2;
// keep track of which node is on left and right ("a" is left, "b" is right)
- var xa = undefined,
- ya = undefined,
- xb = undefined,
- yb = undefined,
- is_reverse = undefined;
+ var xa = void 0,
+ ya = void 0,
+ xb = void 0,
+ yb = void 0,
+ is_reverse = void 0;
if (x1 < x2) {
xa = x1;
@@ -29079,8 +30424,8 @@ return /******/ (function(modules) { // webpackBootstrap
// generate curve offset if it doesn't exist
if (!cx || !cy) {
- cx = -(ya - y) * _EdgeDisplaySettings2['default'].curveStrength;
- cy = (xa - x) * _EdgeDisplaySettings2['default'].curveStrength;
+ cx = -(ya - y) * _EdgeDisplaySettings2.default.curveStrength;
+ cy = (xa - x) * _EdgeDisplaySettings2.default.curveStrength;
}
// calculate absolute position of curve midpoint
@@ -29092,8 +30437,8 @@ return /******/ (function(modules) { // webpackBootstrap
// calculate spacing between curve endpoint and node center
var sa = is_reverse ? s2 : s1;
var sb = is_reverse ? s1 : s2;
- var ra = (is_reverse ? r2 : r1) + sa * _NodeDisplaySettings2['default'].circleSpacing;
- var rb = (is_reverse ? r1 : r2) + sb * _NodeDisplaySettings2['default'].circleSpacing;
+ var ra = (is_reverse ? r2 : r1) + sa * _NodeDisplaySettings2.default.circleSpacing;
+ var rb = (is_reverse ? r1 : r2) + sb * _NodeDisplaySettings2.default.circleSpacing;
// calculate angle from curve midpoint to node center
var angleA = Math.atan2(ya - my, xa - mx);
@@ -29116,13 +30461,12 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Edge;
- })(_BaseComponent3['default']);
+ }(_BaseComponent3.default);
- exports['default'] = Edge;
- module.exports = exports['default'];
+ exports.default = Edge;
/***/ },
-/* 275 */
+/* 284 */
/***/ function(module, exports) {
"use strict";
@@ -29156,24 +30500,16 @@ return /******/ (function(modules) { // webpackBootstrap
};
/***/ },
-/* 276 */
+/* 285 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- 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 _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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -29183,29 +30519,39 @@ return /******/ (function(modules) { // webpackBootstrap
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _BaseComponent2 = __webpack_require__(267);
+ var _BaseComponent2 = __webpack_require__(276);
var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _reactDraggable = __webpack_require__(272);
+ var _reactDraggable = __webpack_require__(281);
- var _CaptionDisplaySettings = __webpack_require__(277);
+ var _CaptionDisplaySettings = __webpack_require__(286);
var _CaptionDisplaySettings2 = _interopRequireDefault(_CaptionDisplaySettings);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _merge = __webpack_require__(188);
+
+ var _merge2 = _interopRequireDefault(_merge);
+
+ 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; }
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ 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 Caption = (function (_BaseComponent) {
+ var Caption = function (_BaseComponent) {
_inherits(Caption, _BaseComponent);
function Caption(props) {
_classCallCheck(this, Caption);
- _get(Object.getPrototypeOf(Caption.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop', '_handleClick');
- this.state = props.caption.display;
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Caption).call(this, props));
+
+ _this.bindAll('_handleDragStart', '_handleDrag', '_handleDragStop', '_handleClick');
+ _this.state = props.caption.display;
+ return _this;
}
_createClass(Caption, [{
@@ -29221,7 +30567,7 @@ return /******/ (function(modules) { // webpackBootstrap
var transform = 'translate(' + x + ', ' + y + ')';
var highlighted = status == "highlighted";
- return _react2['default'].createElement(
+ return _react2.default.createElement(
_reactDraggable.DraggableCore,
{
handle: '.handle',
@@ -29229,14 +30575,14 @@ return /******/ (function(modules) { // webpackBootstrap
onStart: this._handleDragStart,
onDrag: this._handleDrag,
onStop: this._handleDragStop },
- _react2['default'].createElement(
+ _react2.default.createElement(
'g',
{ className: 'caption', transform: transform, onClick: this._handleClick },
highlighted ? this._highlightRect() : null,
this.props.selected ? this._selectionRect() : null,
- _react2['default'].createElement(
+ _react2.default.createElement(
'text',
- { className: 'handle', fontSize: scale * 15, opacity: _CaptionDisplaySettings2['default'].textOpacity[status] },
+ { className: 'handle', fontSize: scale * 15, opacity: _CaptionDisplaySettings2.default.textOpacity[status] },
text
)
)
@@ -29257,7 +30603,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
- var newState = (0, _lodashObjectMerge2['default'])({ text: null }, props.caption.display);
+ var newState = (0, _merge2.default)({ text: null }, props.caption.display);
this.setState(newState);
}
}, {
@@ -29268,7 +30614,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_setRectWidths',
value: function _setRectWidths() {
- var element = _reactDom2['default'].findDOMNode(this);
+ var element = _reactDom2.default.findDOMNode(this);
var text = element.querySelector(".handle");
var highlightRect = this.refs.highlightRect;
var selectRect = this.refs.selectRect;
@@ -29335,14 +30681,14 @@ return /******/ (function(modules) { // webpackBootstrap
key: '_selectionRect',
value: function _selectionRect() {
var width = this.state.text.length * 8;
- var height = _CaptionDisplaySettings2['default'].lineHeight;
+ var height = _CaptionDisplaySettings2.default.lineHeight;
- return _react2['default'].createElement('rect', {
+ return _react2.default.createElement('rect', {
ref: 'selectRect',
- fill: _CaptionDisplaySettings2['default'].selectFillColor,
- opacity: _CaptionDisplaySettings2['default'].selectOpacity,
- rx: _CaptionDisplaySettings2['default'].cornerRadius,
- ry: _CaptionDisplaySettings2['default'].cornerRadius,
+ fill: _CaptionDisplaySettings2.default.selectFillColor,
+ opacity: _CaptionDisplaySettings2.default.selectOpacity,
+ rx: _CaptionDisplaySettings2.default.cornerRadius,
+ ry: _CaptionDisplaySettings2.default.cornerRadius,
y: -height + 4,
width: width,
height: height });
@@ -29351,14 +30697,14 @@ return /******/ (function(modules) { // webpackBootstrap
key: '_highlightRect',
value: function _highlightRect() {
var width = this.state.text.length * 8;
- var height = _CaptionDisplaySettings2['default'].lineHeight;
+ var height = _CaptionDisplaySettings2.default.lineHeight;
- return _react2['default'].createElement('rect', {
+ return _react2.default.createElement('rect', {
ref: 'highlightRect',
- fill: _CaptionDisplaySettings2['default'].highlightFillColor,
- opacity: _CaptionDisplaySettings2['default'].highlightOpacity,
- rx: _CaptionDisplaySettings2['default'].cornerRadius,
- ry: _CaptionDisplaySettings2['default'].cornerRadius,
+ fill: _CaptionDisplaySettings2.default.highlightFillColor,
+ opacity: _CaptionDisplaySettings2.default.highlightOpacity,
+ rx: _CaptionDisplaySettings2.default.cornerRadius,
+ ry: _CaptionDisplaySettings2.default.cornerRadius,
y: -height + 4,
width: width,
height: height });
@@ -29366,13 +30712,12 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Caption;
- })(_BaseComponent3['default']);
+ }(_BaseComponent3.default);
- exports['default'] = Caption;
- module.exports = exports['default'];
+ exports.default = Caption;
/***/ },
-/* 277 */
+/* 286 */
/***/ function(module, exports) {
"use strict";
@@ -29392,18 +30737,18 @@ return /******/ (function(modules) { // webpackBootstrap
};
/***/ },
-/* 278 */
+/* 287 */
/***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(279);
+ module.exports = __webpack_require__(288);
/***/ },
-/* 279 */
+/* 288 */
/***/ function(module, exports, __webpack_require__) {
- var createExtremum = __webpack_require__(280),
- lt = __webpack_require__(305);
+ var createExtremum = __webpack_require__(289),
+ lt = __webpack_require__(314);
/** Used as references for `-Infinity` and `Infinity`. */
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
@@ -29461,15 +30806,15 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 280 */
+/* 289 */
/***/ function(module, exports, __webpack_require__) {
- var arrayExtremum = __webpack_require__(281),
- baseCallback = __webpack_require__(282),
- baseExtremum = __webpack_require__(303),
- isArray = __webpack_require__(191),
- isIterateeCall = __webpack_require__(211),
- toIterable = __webpack_require__(304);
+ var arrayExtremum = __webpack_require__(290),
+ baseCallback = __webpack_require__(291),
+ baseExtremum = __webpack_require__(312),
+ isArray = __webpack_require__(199),
+ isIterateeCall = __webpack_require__(219),
+ toIterable = __webpack_require__(313);
/**
* Creates a `_.max` or `_.min` function.
@@ -29500,7 +30845,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 281 */
+/* 290 */
/***/ function(module, exports) {
/**
@@ -29536,14 +30881,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 282 */
+/* 291 */
/***/ function(module, exports, __webpack_require__) {
- var baseMatches = __webpack_require__(283),
- baseMatchesProperty = __webpack_require__(294),
- bindCallback = __webpack_require__(209),
- identity = __webpack_require__(210),
- property = __webpack_require__(301);
+ var baseMatches = __webpack_require__(292),
+ baseMatchesProperty = __webpack_require__(303),
+ bindCallback = __webpack_require__(217),
+ identity = __webpack_require__(218),
+ property = __webpack_require__(310);
/**
* The base implementation of `_.callback` which supports specifying the
@@ -29577,12 +30922,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 283 */
+/* 292 */
/***/ function(module, exports, __webpack_require__) {
- var baseIsMatch = __webpack_require__(284),
- getMatchData = __webpack_require__(291),
- toObject = __webpack_require__(200);
+ var baseIsMatch = __webpack_require__(293),
+ getMatchData = __webpack_require__(300),
+ toObject = __webpack_require__(208);
/**
* The base implementation of `_.matches` which does not clone `source`.
@@ -29613,11 +30958,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 284 */
+/* 293 */
/***/ function(module, exports, __webpack_require__) {
- var baseIsEqual = __webpack_require__(285),
- toObject = __webpack_require__(200);
+ var baseIsEqual = __webpack_require__(294),
+ toObject = __webpack_require__(208);
/**
* The base implementation of `_.isMatch` without support for callback
@@ -29671,12 +31016,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 285 */
+/* 294 */
/***/ function(module, exports, __webpack_require__) {
- var baseIsEqualDeep = __webpack_require__(286),
- isObject = __webpack_require__(195),
- isObjectLike = __webpack_require__(190);
+ var baseIsEqualDeep = __webpack_require__(295),
+ isObject = __webpack_require__(203),
+ isObjectLike = __webpack_require__(198);
/**
* The base implementation of `_.isEqual` without support for `this` binding
@@ -29705,14 +31050,14 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 286 */
+/* 295 */
/***/ function(module, exports, __webpack_require__) {
- var equalArrays = __webpack_require__(287),
- equalByTag = __webpack_require__(289),
- equalObjects = __webpack_require__(290),
- isArray = __webpack_require__(191),
- isTypedArray = __webpack_require__(203);
+ var equalArrays = __webpack_require__(296),
+ equalByTag = __webpack_require__(298),
+ equalObjects = __webpack_require__(299),
+ isArray = __webpack_require__(199),
+ isTypedArray = __webpack_require__(211);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
@@ -29813,10 +31158,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 287 */
+/* 296 */
/***/ function(module, exports, __webpack_require__) {
- var arraySome = __webpack_require__(288);
+ var arraySome = __webpack_require__(297);
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
@@ -29870,7 +31215,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 288 */
+/* 297 */
/***/ function(module, exports) {
/**
@@ -29899,7 +31244,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 289 */
+/* 298 */
/***/ function(module, exports) {
/** `Object#toString` result references. */
@@ -29953,10 +31298,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 290 */
+/* 299 */
/***/ function(module, exports, __webpack_require__) {
- var keys = __webpack_require__(206);
+ var keys = __webpack_require__(214);
/** Used for native method references. */
var objectProto = Object.prototype;
@@ -30026,11 +31371,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 291 */
+/* 300 */
/***/ function(module, exports, __webpack_require__) {
- var isStrictComparable = __webpack_require__(292),
- pairs = __webpack_require__(293);
+ var isStrictComparable = __webpack_require__(301),
+ pairs = __webpack_require__(302);
/**
* Gets the propery names, values, and compare flags of `object`.
@@ -30053,10 +31398,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 292 */
+/* 301 */
/***/ function(module, exports, __webpack_require__) {
- var isObject = __webpack_require__(195);
+ var isObject = __webpack_require__(203);
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
@@ -30074,11 +31419,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 293 */
+/* 302 */
/***/ function(module, exports, __webpack_require__) {
- var keys = __webpack_require__(206),
- toObject = __webpack_require__(200);
+ var keys = __webpack_require__(214),
+ toObject = __webpack_require__(208);
/**
* Creates a two dimensional array of the key-value pairs for `object`,
@@ -30113,18 +31458,18 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 294 */
+/* 303 */
/***/ function(module, exports, __webpack_require__) {
- var baseGet = __webpack_require__(295),
- baseIsEqual = __webpack_require__(285),
- baseSlice = __webpack_require__(296),
- isArray = __webpack_require__(191),
- isKey = __webpack_require__(297),
- isStrictComparable = __webpack_require__(292),
- last = __webpack_require__(298),
- toObject = __webpack_require__(200),
- toPath = __webpack_require__(299);
+ var baseGet = __webpack_require__(304),
+ baseIsEqual = __webpack_require__(294),
+ baseSlice = __webpack_require__(305),
+ isArray = __webpack_require__(199),
+ isKey = __webpack_require__(306),
+ isStrictComparable = __webpack_require__(301),
+ last = __webpack_require__(307),
+ toObject = __webpack_require__(208),
+ toPath = __webpack_require__(308);
/**
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
@@ -30164,10 +31509,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 295 */
+/* 304 */
/***/ function(module, exports, __webpack_require__) {
- var toObject = __webpack_require__(200);
+ var toObject = __webpack_require__(208);
/**
* The base implementation of `get` without support for string paths
@@ -30199,7 +31544,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 296 */
+/* 305 */
/***/ function(module, exports) {
/**
@@ -30237,11 +31582,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 297 */
+/* 306 */
/***/ function(module, exports, __webpack_require__) {
- var isArray = __webpack_require__(191),
- toObject = __webpack_require__(200);
+ var isArray = __webpack_require__(199),
+ toObject = __webpack_require__(208);
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
@@ -30271,7 +31616,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 298 */
+/* 307 */
/***/ function(module, exports) {
/**
@@ -30296,11 +31641,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 299 */
+/* 308 */
/***/ function(module, exports, __webpack_require__) {
- var baseToString = __webpack_require__(300),
- isArray = __webpack_require__(191);
+ var baseToString = __webpack_require__(309),
+ isArray = __webpack_require__(199);
/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
@@ -30330,7 +31675,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 300 */
+/* 309 */
/***/ function(module, exports) {
/**
@@ -30349,12 +31694,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 301 */
+/* 310 */
/***/ function(module, exports, __webpack_require__) {
- var baseProperty = __webpack_require__(188),
- basePropertyDeep = __webpack_require__(302),
- isKey = __webpack_require__(297);
+ var baseProperty = __webpack_require__(196),
+ basePropertyDeep = __webpack_require__(311),
+ isKey = __webpack_require__(306);
/**
* Creates a function that returns the property value at `path` on a
@@ -30386,11 +31731,11 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 302 */
+/* 311 */
/***/ function(module, exports, __webpack_require__) {
- var baseGet = __webpack_require__(295),
- toPath = __webpack_require__(299);
+ var baseGet = __webpack_require__(304),
+ toPath = __webpack_require__(308);
/**
* A specialized version of `baseProperty` which supports deep paths.
@@ -30411,10 +31756,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 303 */
+/* 312 */
/***/ function(module, exports, __webpack_require__) {
- var baseEach = __webpack_require__(234);
+ var baseEach = __webpack_require__(242);
/**
* Gets the extremum value of `collection` invoking `iteratee` for each value
@@ -30446,12 +31791,12 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 304 */
+/* 313 */
/***/ function(module, exports, __webpack_require__) {
- var isArrayLike = __webpack_require__(186),
- isObject = __webpack_require__(195),
- values = __webpack_require__(244);
+ var isArrayLike = __webpack_require__(194),
+ isObject = __webpack_require__(203),
+ values = __webpack_require__(252);
/**
* Converts `value` to an array-like object if it's not one.
@@ -30474,7 +31819,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 305 */
+/* 314 */
/***/ function(module, exports) {
/**
@@ -30505,18 +31850,18 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 306 */
+/* 315 */
/***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(307);
+ module.exports = __webpack_require__(316);
/***/ },
-/* 307 */
+/* 316 */
/***/ function(module, exports, __webpack_require__) {
- var createExtremum = __webpack_require__(280),
- gt = __webpack_require__(308);
+ var createExtremum = __webpack_require__(289),
+ gt = __webpack_require__(317);
/** Used as references for `-Infinity` and `Infinity`. */
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
@@ -30574,7 +31919,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 308 */
+/* 317 */
/***/ function(module, exports) {
/**
@@ -30605,26 +31950,18 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
-/* 309 */
+/* 318 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
-
- 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 _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 _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
@@ -30634,66 +31971,77 @@ return /******/ (function(modules) { // webpackBootstrap
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _reactHotkeys = __webpack_require__(310);
+ var _reactHotkeys = __webpack_require__(319);
- var _BaseComponent2 = __webpack_require__(267);
+ var _BaseComponent2 = __webpack_require__(276);
var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _ZoomButtons = __webpack_require__(357);
+ var _ZoomButtons = __webpack_require__(325);
var _ZoomButtons2 = _interopRequireDefault(_ZoomButtons);
- var _EditTools = __webpack_require__(358);
+ var _EditTools = __webpack_require__(326);
var _EditTools2 = _interopRequireDefault(_EditTools);
- var _lodashObjectMerge = __webpack_require__(180);
+ var _merge = __webpack_require__(188);
+
+ var _merge2 = _interopRequireDefault(_merge);
+
+ var _values = __webpack_require__(252);
+
+ var _values2 = _interopRequireDefault(_values);
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ var _cloneDeep = __webpack_require__(264);
- var _lodashObjectValues = __webpack_require__(244);
+ var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
- var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues);
+ var _pick = __webpack_require__(411);
- var _lodashLangCloneDeep = __webpack_require__(256);
+ var _pick2 = _interopRequireDefault(_pick);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _lodashLangCloneDeep2 = _interopRequireDefault(_lodashLangCloneDeep);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var _lodashObjectPick = __webpack_require__(435);
+ 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; }
- var _lodashObjectPick2 = _interopRequireDefault(_lodashObjectPick);
+ 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; }
- __webpack_require__(436);
- __webpack_require__(441);
+ __webpack_require__(412);
+ __webpack_require__(417);
- var Editor = (function (_BaseComponent) {
+ var Editor = function (_BaseComponent) {
_inherits(Editor, _BaseComponent);
- function Editor() {
+ function Editor(props) {
_classCallCheck(this, Editor);
- _get(Object.getPrototypeOf(Editor.prototype), 'constructor', this).apply(this, arguments);
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Editor).call(this, props));
+
+ _this.state = { helpScreen: false };
+ return _this;
}
_createClass(Editor, [{
key: 'render',
value: function render() {
- var _this = this;
+ var _this2 = this;
- var zoomIn = undefined,
- zoomOut = undefined,
- resetZoom = undefined;
+ var zoomIn = void 0,
+ zoomOut = void 0,
+ resetZoom = void 0;
if (this.props.graphApi) {
- zoomIn = function () {
- return _this.props.graphApi.zoomIn();
+ zoomIn = function zoomIn() {
+ return _this2.props.graphApi.zoomIn();
};
- zoomOut = function () {
- return _this.props.graphApi.zoomOut();
+ zoomOut = function zoomOut() {
+ return _this2.props.graphApi.zoomOut();
};
- resetZoom = function () {
- return _this.props.graphApi.resetZoom();
+ resetZoom = function resetZoom() {
+ return _this2.props.graphApi.resetZoom();
};
}
@@ -30702,41 +32050,38 @@ return /******/ (function(modules) { // webpackBootstrap
'altO': ['alt+o', 'ctrl+o'],
'altN': ['alt+n', 'ctrl+n'],
'altE': ['alt+e', 'ctrl+e'],
- 'altC': ['alt+c', 'ctrl+c'],
'altH': ['alt+h', 'ctrl+h'],
'altR': ['alt+r', 'ctrl+r'],
- 'esc': 'esc'
+ 'esc': 'esc',
+ 'enter': 'enter'
};
var keyHandlers = {
'altP': function altP() {
- return _this.props.graphApi.prune();
+ return _this2.props.graphApi.prune();
},
'altO': function altO() {
- return _this.props.graphApi.circleLayout();
+ return _this2.props.graphApi.circleLayout();
},
'altN': function altN() {
- return _this._focusAddNodeInput();
+ return _this2._focusAddNodeInput();
},
'altE': function altE() {
- return _this._toggleAddEdgeForm();
- },
- 'altC': function altC() {
- return _this._toggleAddCaptionForm();
+ return _this2._toggleAddEdgeForm();
},
'altH': function altH() {
- return _this._toggleHelpScreen();
+ return _this2._toggleHelpScreen();
},
'altR': function altR() {
- return _this._toggleAddConnectedNodesForm();
+ return _this2._toggleAddConnectedNodesForm();
},
'esc': function esc() {
- return _this._clearForms();
+ return _this2._clearForms();
}
};
var _closeAddForm = function _closeAddForm() {
- return _this.props.toggleAddForm(null);
+ return _this2.props.toggleAddForm(null);
};
var _computeEditForms2 = this._computeEditForms(this.props.selection);
@@ -30745,6 +32090,7 @@ return /******/ (function(modules) { // webpackBootstrap
var formData = _computeEditForms2.formData;
var addForm = _computeEditForms2.addForm;
+
var fetchInterlocks = function fetchInterlocks() {};
var showInterlocksButton = this.props.isEditor && this.props.dataSource && this.props.dataSource.getInterlocks && formData && formData.length == 2;
@@ -30752,49 +32098,50 @@ return /******/ (function(modules) { // webpackBootstrap
(function () {
var node1Id = formData[0].id;
var node2Id = formData[1].id;
- var nodeIds = Object.keys(_this.props.graph.nodes);
- fetchInterlocks = function () {
- _this.props.fetchInterlocks(node1Id, node2Id, nodeIds, _this.props.dataSource.getInterlocks);
+ var nodeIds = Object.keys(_this2.props.graph.nodes);
+ fetchInterlocks = function fetchInterlocks() {
+ _this2.props.fetchInterlocks(node1Id, node2Id, nodeIds, _this2.props.dataSource.getInterlocks);
};
})();
}
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'div',
{ id: 'oligrapherEditorContainer', style: { height: '100%' } },
- _react2['default'].createElement(
+ _react2.default.createElement(
_reactHotkeys.HotKeys,
{ focused: true, attach: window, keyMap: keyMap, handlers: keyHandlers },
- _react2['default'].createElement(_ZoomButtons2['default'], { zoomIn: zoomIn, zoomOut: zoomOut }),
- this.props.showEditButton && this.props.isEditor && _react2['default'].createElement(
+ _react2.default.createElement(_ZoomButtons2.default, { zoomIn: zoomIn, zoomOut: zoomOut }),
+ this.props.showEditButton && this.props.isEditor && _react2.default.createElement(
'button',
{
id: 'toggleEditTools',
className: 'btn btn-sm btn-default',
- onClick: function () {
- return _this.props.toggleEditTools();
+ onClick: function onClick() {
+ return _this2.props.toggleEditTools();
} },
- _react2['default'].createElement('span', { className: 'glyphicon glyphicon-pencil' })
+ _react2.default.createElement('span', { className: 'glyphicon glyphicon-pencil' })
),
- this.props.showEditTools && _react2['default'].createElement(_EditTools2['default'], _extends({
+ this.props.showEditTools && _react2.default.createElement(_EditTools2.default, _extends({
ref: 'editTools'
}, this.props, {
closeAddForm: _closeAddForm,
source: this.props.dataSource,
- toggleAddEdgeForm: function () {
- return _this._toggleAddEdgeForm();
+ toggleAddEdgeForm: function toggleAddEdgeForm() {
+ return _this2._toggleAddEdgeForm();
},
- toggleHelpScreen: function () {
- return _this._toggleHelpScreen();
+ toggleHelpScreen: function toggleHelpScreen() {
+ return _this2._toggleHelpScreen();
},
- clearGraph: function () {
- return _this._clearGraph();
+ clearGraph: function clearGraph() {
+ return _this2._clearGraph();
},
data: formData,
addForm: addForm,
currentForm: currentForm,
showInterlocksButton: showInterlocksButton,
- fetchInterlocks: fetchInterlocks }))
+ fetchInterlocks: fetchInterlocks,
+ 'delete': this.props.delete }))
)
);
}
@@ -30815,9 +32162,9 @@ return /******/ (function(modules) { // webpackBootstrap
var captionIds = _props$selection.captionIds;
var graph = this.props.graph;
- var nodes = (0, _lodashObjectPick2['default'])(graph.nodes, nodeIds);
- var edges = (0, _lodashObjectPick2['default'])(graph.edges, edgeIds);
- var captions = (0, _lodashObjectPick2['default'])(graph.captions, captionIds);
+ var nodes = (0, _pick2.default)(graph.nodes, nodeIds);
+ var edges = (0, _pick2.default)(graph.edges, edgeIds);
+ var captions = (0, _pick2.default)(graph.captions, captionIds);
var nodeCount = Object.keys(nodes).length;
var edgeCount = Object.keys(edges).length;
var captionCount = Object.keys(captions).length;
@@ -30826,19 +32173,19 @@ return /******/ (function(modules) { // webpackBootstrap
if (addForm != 'AddEdgeForm') {
currentForm = 'UpdateNodeForm';
}
- formData = (0, _lodashObjectValues2['default'])(nodes)[0];
+ formData = (0, _values2.default)(nodes)[0];
} else if (nodeCount == 0 && edgeCount == 1 && captionCount == 0) {
currentForm = 'UpdateEdgeForm';
addForm = null;
- formData = (0, _lodashObjectValues2['default'])(edges)[0];
+ formData = (0, _values2.default)(edges)[0];
} else if (nodeCount == 0 && edgeCount == 0 && captionCount == 1) {
currentForm = 'UpdateCaptionForm';
addForm = null;
- formData = (0, _lodashObjectValues2['default'])(captions)[0];
+ formData = (0, _values2.default)(captions)[0];
} else if (nodeCount == 2 && edgeCount == 0 && captionCount == 0) {
currentForm = null;
addForm = 'AddEdgeForm';
- formData = (0, _lodashObjectValues2['default'])(nodes);
+ formData = (0, _values2.default)(nodes);
} else {
currentForm = null;
formData = null;
@@ -30864,7 +32211,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_toggleHelpScreen',
value: function _toggleHelpScreen() {
- this.setState({ addForm: null, helpScreen: !this.state.helpScreen });
+ this.props.toggleHelpScreen();
}
}, {
key: '_clearGraph',
@@ -30879,6 +32226,7 @@ return /******/ (function(modules) { // webpackBootstrap
value: function _clearForms() {
this.props.toggleAddForm(null);
this.props.graphApi.deselectAll();
+ console.log(this.refs);
this.refs.editTools.refs.editButtons.refs.addNodeInput.clear();
}
}, {
@@ -30889,13 +32237,12 @@ return /******/ (function(modules) { // webpackBootstrap
}]);
return Editor;
- })(_BaseComponent3['default']);
+ }(_BaseComponent3.default);
- exports['default'] = Editor;
- module.exports = exports['default'];
+ exports.default = Editor;
/***/ },
-/* 310 */
+/* 319 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -30906,20 +32253,20 @@ return /******/ (function(modules) { // webpackBootstrap
function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
- var _HotKeys = __webpack_require__(311);
+ var _HotKeys = __webpack_require__(320);
exports.HotKeys = _interopRequire(_HotKeys);
- var _FocusTrap = __webpack_require__(312);
+ var _FocusTrap = __webpack_require__(321);
exports.FocusTrap = _interopRequire(_FocusTrap);
- var _HotKeyMapMixin = __webpack_require__(313);
+ var _HotKeyMapMixin = __webpack_require__(322);
exports.HotKeyMapMixin = _interopRequire(_HotKeyMapMixin);
/***/ },
-/* 311 */
+/* 320 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -30940,31 +32287,31 @@ return /******/ (function(modules) { // webpackBootstrap
var _reactDom2 = _interopRequireDefault(_reactDom);
- var _FocusTrap = __webpack_require__(312);
+ var _FocusTrap = __webpack_require__(321);
var _FocusTrap2 = _interopRequireDefault(_FocusTrap);
- var _HotKeyMapMixin = __webpack_require__(313);
+ var _HotKeyMapMixin = __webpack_require__(322);
var _HotKeyMapMixin2 = _interopRequireDefault(_HotKeyMapMixin);
- var _lodashLangIsBoolean = __webpack_require__(346);
+ var _lodashLangIsBoolean = __webpack_require__(247);
var _lodashLangIsBoolean2 = _interopRequireDefault(_lodashLangIsBoolean);
- var _lodashLangIsArray = __webpack_require__(328);
+ var _lodashLangIsArray = __webpack_require__(199);
var _lodashLangIsArray2 = _interopRequireDefault(_lodashLangIsArray);
- var _lodashLangIsObject = __webpack_require__(320);
+ var _lodashLangIsObject = __webpack_require__(203);
var _lodashLangIsObject2 = _interopRequireDefault(_lodashLangIsObject);
- var _lodashCollectionForEach = __webpack_require__(347);
+ var _lodashCollectionForEach = __webpack_require__(241);
var _lodashCollectionForEach2 = _interopRequireDefault(_lodashCollectionForEach);
- var _lodashLangIsEqual = __webpack_require__(338);
+ var _lodashLangIsEqual = __webpack_require__(323);
var _lodashLangIsEqual2 = _interopRequireDefault(_lodashLangIsEqual);
@@ -31015,7 +32362,7 @@ return /******/ (function(modules) { // webpackBootstrap
componentDidMount: function componentDidMount() {
// import is here to support React's server rendering as Mousetrap immediately
// calls itself with window and it fails in Node environment
- var Mousetrap = __webpack_require__(356);
+ var Mousetrap = __webpack_require__(324);
// Not optimal - imagine hundreds of this component. We need a top level
// delegation point for mousetrap
this.__mousetrap__ = new Mousetrap(this.props.attach || _reactDom2['default'].findDOMNode(this));
@@ -31138,7 +32485,7 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = exports['default'];
/***/ },
-/* 312 */
+/* 321 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -31187,7 +32534,7 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = exports['default'];
/***/ },
-/* 313 */
+/* 322 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -31203,11 +32550,11 @@ return /******/ (function(modules) { // webpackBootstrap
var _react2 = _interopRequireDefault(_react);
- var _lodashObjectAssign = __webpack_require__(314);
+ var _lodashObjectAssign = __webpack_require__(250);
var _lodashObjectAssign2 = _interopRequireDefault(_lodashObjectAssign);
- var _lodashLangIsEqual = __webpack_require__(338);
+ var _lodashLangIsEqual = __webpack_require__(323);
var _lodashLangIsEqual2 = _interopRequireDefault(_lodashLangIsEqual);
@@ -31263,4706 +32610,15550 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = exports['default'];
/***/ },
-/* 314 */
+/* 323 */
/***/ function(module, exports, __webpack_require__) {
- var assignWith = __webpack_require__(315),
- baseAssign = __webpack_require__(331),
- createAssigner = __webpack_require__(333);
+ var baseIsEqual = __webpack_require__(294),
+ bindCallback = __webpack_require__(217);
/**
- * Assigns own enumerable properties of source object(s) to the destination
- * object. Subsequent sources overwrite property assignments of previous sources.
- * If `customizer` is provided it's invoked to produce the assigned values.
- * The `customizer` is bound to `thisArg` and invoked with five arguments:
- * (objectValue, sourceValue, key, object, source).
+ * Performs a deep comparison between two values to determine if they are
+ * equivalent. If `customizer` is provided it's invoked to compare values.
+ * If `customizer` returns `undefined` comparisons are handled by the method
+ * instead. The `customizer` is bound to `thisArg` and invoked with up to
+ * three arguments: (value, other [, index|key]).
*
- * **Note:** This method mutates `object` and is based on
- * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
+ * their own, not inherited, enumerable properties. Functions and DOM nodes
+ * are **not** supported. Provide a customizer function to extend support
+ * for comparing other values.
*
* @static
* @memberOf _
- * @alias extend
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @param {Function} [customizer] The function to customize assigned values.
+ * @alias eq
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @param {Function} [customizer] The function to customize value comparisons.
* @param {*} [thisArg] The `this` binding of `customizer`.
- * @returns {Object} Returns `object`.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
- * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
- * // => { 'user': 'fred', 'age': 40 }
+ * var object = { 'user': 'fred' };
+ * var other = { 'user': 'fred' };
*
- * // using a customizer callback
- * var defaults = _.partialRight(_.assign, function(value, other) {
- * return _.isUndefined(value) ? other : value;
- * });
+ * object == other;
+ * // => false
*
- * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
- * // => { 'user': 'barney', 'age': 36 }
- */
- var assign = createAssigner(function(object, source, customizer) {
- return customizer
- ? assignWith(object, source, customizer)
- : baseAssign(object, source);
- });
-
- module.exports = assign;
-
-
-/***/ },
-/* 315 */
-/***/ function(module, exports, __webpack_require__) {
-
- var keys = __webpack_require__(316);
-
- /**
- * A specialized version of `_.assign` for customizing assigned values without
- * support for argument juggling, multiple sources, and `this` binding `customizer`
- * functions.
+ * _.isEqual(object, other);
+ * // => true
*
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {Function} customizer The function to customize assigned values.
- * @returns {Object} Returns `object`.
+ * // using a customizer callback
+ * var array = ['hello', 'goodbye'];
+ * var other = ['hi', 'goodbye'];
+ *
+ * _.isEqual(array, other, function(value, other) {
+ * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
+ * return true;
+ * }
+ * });
+ * // => true
*/
- function assignWith(object, source, customizer) {
- var index = -1,
- props = keys(source),
- length = props.length;
-
- while (++index < length) {
- var key = props[index],
- value = object[key],
- result = customizer(value, source[key], key, object, source);
-
- if ((result === result ? (result !== value) : (value === value)) ||
- (value === undefined && !(key in object))) {
- object[key] = result;
- }
- }
- return object;
+ function isEqual(value, other, customizer, thisArg) {
+ customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
+ var result = customizer ? customizer(value, other) : undefined;
+ return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
}
- module.exports = assignWith;
+ module.exports = isEqual;
/***/ },
-/* 316 */
+/* 324 */
/***/ function(module, exports, __webpack_require__) {
- var getNative = __webpack_require__(317),
- isArrayLike = __webpack_require__(322),
- isObject = __webpack_require__(320),
- shimKeys = __webpack_require__(326);
-
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeKeys = getNative(Object, 'keys');
-
+ var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */
/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
- * for more details.
+ * Copyright 2016 Craig Campbell
*
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Foo.prototype.c = 3;
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
+ * Mousetrap is a simple keyboard shortcut library for Javascript with
+ * no external dependencies
*
- * _.keys('hi');
- * // => ['0', '1']
+ * @version 1.6.0
+ * @url craig.is/killing/mice
*/
- var keys = !nativeKeys ? shimKeys : function(object) {
- var Ctor = object == null ? undefined : object.constructor;
- if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
- (typeof object != 'function' && isArrayLike(object))) {
- return shimKeys(object);
- }
- return isObject(object) ? nativeKeys(object) : [];
- };
-
- module.exports = keys;
+ (function(window, document, undefined) {
+ // Check if mousetrap is used inside browser, if not, return
+ if (!window) {
+ return;
+ }
-/***/ },
-/* 317 */
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * mapping of special keycodes to their corresponding keys
+ *
+ * everything in this dictionary cannot use keypress events
+ * so it has to be here to map to the correct keycodes for
+ * keyup/keydown events
+ *
+ * @type {Object}
+ */
+ var _MAP = {
+ 8: 'backspace',
+ 9: 'tab',
+ 13: 'enter',
+ 16: 'shift',
+ 17: 'ctrl',
+ 18: 'alt',
+ 20: 'capslock',
+ 27: 'esc',
+ 32: 'space',
+ 33: 'pageup',
+ 34: 'pagedown',
+ 35: 'end',
+ 36: 'home',
+ 37: 'left',
+ 38: 'up',
+ 39: 'right',
+ 40: 'down',
+ 45: 'ins',
+ 46: 'del',
+ 91: 'meta',
+ 93: 'meta',
+ 224: 'meta'
+ };
- var isNative = __webpack_require__(318);
+ /**
+ * mapping for special characters so they can support
+ *
+ * this dictionary is only used incase you want to bind a
+ * keyup or keydown event to one of these keys
+ *
+ * @type {Object}
+ */
+ var _KEYCODE_MAP = {
+ 106: '*',
+ 107: '+',
+ 109: '-',
+ 110: '.',
+ 111 : '/',
+ 186: ';',
+ 187: '=',
+ 188: ',',
+ 189: '-',
+ 190: '.',
+ 191: '/',
+ 192: '`',
+ 219: '[',
+ 220: '\\',
+ 221: ']',
+ 222: '\''
+ };
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = object == null ? undefined : object[key];
- return isNative(value) ? value : undefined;
- }
+ /**
+ * this is a mapping of keys that require shift on a US keypad
+ * back to the non shift equivelents
+ *
+ * this is so you can use keyup events with these keys
+ *
+ * note that this will only work reliably on US keyboards
+ *
+ * @type {Object}
+ */
+ var _SHIFT_MAP = {
+ '~': '`',
+ '!': '1',
+ '@': '2',
+ '#': '3',
+ '$': '4',
+ '%': '5',
+ '^': '6',
+ '&': '7',
+ '*': '8',
+ '(': '9',
+ ')': '0',
+ '_': '-',
+ '+': '=',
+ ':': ';',
+ '\"': '\'',
+ '<': ',',
+ '>': '.',
+ '?': '/',
+ '|': '\\'
+ };
- module.exports = getNative;
+ /**
+ * this is a list of special strings you can use to map
+ * to modifier keys when you specify your keyboard shortcuts
+ *
+ * @type {Object}
+ */
+ var _SPECIAL_ALIASES = {
+ 'option': 'alt',
+ 'command': 'meta',
+ 'return': 'enter',
+ 'escape': 'esc',
+ 'plus': '+',
+ 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
+ };
+ /**
+ * variable to store the flipped version of _MAP from above
+ * needed to check if we should use keypress or not when no action
+ * is specified
+ *
+ * @type {Object|undefined}
+ */
+ var _REVERSE_MAP;
-/***/ },
-/* 318 */
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * loop through the f keys, f1 to f19 and add them to the map
+ * programatically
+ */
+ for (var i = 1; i < 20; ++i) {
+ _MAP[111 + i] = 'f' + i;
+ }
- var isFunction = __webpack_require__(319),
- isObjectLike = __webpack_require__(321);
-
- /** Used to detect host constructors (Safari > 5). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /** Used to resolve the decompiled source of functions. */
- var fnToString = Function.prototype.toString;
+ /**
+ * loop through to map numbers on the numeric keypad
+ */
+ for (i = 0; i <= 9; ++i) {
+ _MAP[i + 96] = i;
+ }
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
+ /**
+ * cross browser add event method
+ *
+ * @param {Element|HTMLDocument} object
+ * @param {string} type
+ * @param {Function} callback
+ * @returns void
+ */
+ function _addEvent(object, type, callback) {
+ if (object.addEventListener) {
+ object.addEventListener(type, callback, false);
+ return;
+ }
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
+ object.attachEvent('on' + type, callback);
+ }
- /**
- * Checks if `value` is a native function.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */
- function isNative(value) {
- if (value == null) {
- return false;
- }
- if (isFunction(value)) {
- return reIsNative.test(fnToString.call(value));
- }
- return isObjectLike(value) && reIsHostCtor.test(value);
- }
+ /**
+ * takes the event and returns the key character
+ *
+ * @param {Event} e
+ * @return {string}
+ */
+ function _characterFromEvent(e) {
- module.exports = isNative;
+ // for keypress events we should return the character as is
+ if (e.type == 'keypress') {
+ var character = String.fromCharCode(e.which);
+ // if the shift key is not pressed then it is safe to assume
+ // that we want the character to be lowercase. this means if
+ // you accidentally have caps lock on then your key bindings
+ // will continue to work
+ //
+ // the only side effect that might not be desired is if you
+ // bind something like 'A' cause you want to trigger an
+ // event when capital A is pressed caps lock will no longer
+ // trigger the event. shift+a will though.
+ if (!e.shiftKey) {
+ character = character.toLowerCase();
+ }
-/***/ },
-/* 319 */
-/***/ function(module, exports, __webpack_require__) {
+ return character;
+ }
- var isObject = __webpack_require__(320);
+ // for non keypress events the special maps are needed
+ if (_MAP[e.which]) {
+ return _MAP[e.which];
+ }
- /** `Object#toString` result references. */
- var funcTag = '[object Function]';
+ if (_KEYCODE_MAP[e.which]) {
+ return _KEYCODE_MAP[e.which];
+ }
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ // if it is not in the special map
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
+ // with keydown and keyup events the character seems to always
+ // come in as an uppercase character whether you are pressing shift
+ // or not. we should make sure it is always lowercase for comparisons
+ return String.fromCharCode(e.which).toLowerCase();
+ }
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in older versions of Chrome and Safari which return 'function' for regexes
- // and Safari 8 which returns 'object' for typed array constructors.
- return isObject(value) && objToString.call(value) == funcTag;
- }
+ /**
+ * checks if two arrays are equal
+ *
+ * @param {Array} modifiers1
+ * @param {Array} modifiers2
+ * @returns {boolean}
+ */
+ function _modifiersMatch(modifiers1, modifiers2) {
+ return modifiers1.sort().join(',') === modifiers2.sort().join(',');
+ }
- module.exports = isFunction;
+ /**
+ * takes a key event and figures out what the modifiers are
+ *
+ * @param {Event} e
+ * @returns {Array}
+ */
+ function _eventModifiers(e) {
+ var modifiers = [];
+ if (e.shiftKey) {
+ modifiers.push('shift');
+ }
-/***/ },
-/* 320 */
-/***/ function(module, exports) {
+ if (e.altKey) {
+ modifiers.push('alt');
+ }
- /**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
- function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
+ if (e.ctrlKey) {
+ modifiers.push('ctrl');
+ }
- module.exports = isObject;
+ if (e.metaKey) {
+ modifiers.push('meta');
+ }
+ return modifiers;
+ }
-/***/ },
-/* 321 */
-/***/ function(module, exports) {
+ /**
+ * prevents default for this event
+ *
+ * @param {Event} e
+ * @returns void
+ */
+ function _preventDefault(e) {
+ if (e.preventDefault) {
+ e.preventDefault();
+ return;
+ }
- /**
- * Checks if `value` is object-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
+ e.returnValue = false;
+ }
- module.exports = isObjectLike;
+ /**
+ * stops propogation for this event
+ *
+ * @param {Event} e
+ * @returns void
+ */
+ function _stopPropagation(e) {
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ return;
+ }
+ e.cancelBubble = true;
+ }
-/***/ },
-/* 322 */
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * determines if the keycode specified is a modifier key or not
+ *
+ * @param {string} key
+ * @returns {boolean}
+ */
+ function _isModifier(key) {
+ return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
+ }
- var getLength = __webpack_require__(323),
- isLength = __webpack_require__(325);
+ /**
+ * reverses the map lookup so that we can look for specific keys
+ * to see what can and can't use keypress
+ *
+ * @return {Object}
+ */
+ function _getReverseMap() {
+ if (!_REVERSE_MAP) {
+ _REVERSE_MAP = {};
+ for (var key in _MAP) {
- /**
- * Checks if `value` is array-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- */
- function isArrayLike(value) {
- return value != null && isLength(getLength(value));
- }
+ // pull out the numeric keypad from here cause keypress should
+ // be able to detect the keys from the character
+ if (key > 95 && key < 112) {
+ continue;
+ }
- module.exports = isArrayLike;
+ if (_MAP.hasOwnProperty(key)) {
+ _REVERSE_MAP[_MAP[key]] = key;
+ }
+ }
+ }
+ return _REVERSE_MAP;
+ }
+ /**
+ * picks the best action based on the key combination
+ *
+ * @param {string} key - character for key
+ * @param {Array} modifiers
+ * @param {string=} action passed in
+ */
+ function _pickBestAction(key, modifiers, action) {
-/***/ },
-/* 323 */
-/***/ function(module, exports, __webpack_require__) {
+ // if no action was picked in we should try to pick the one
+ // that we think would work best for this key
+ if (!action) {
+ action = _getReverseMap()[key] ? 'keydown' : 'keypress';
+ }
- var baseProperty = __webpack_require__(324);
+ // modifier keys don't work as expected with keypress,
+ // switch to keydown
+ if (action == 'keypress' && modifiers.length) {
+ action = 'keydown';
+ }
- /**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
- var getLength = baseProperty('length');
+ return action;
+ }
- module.exports = getLength;
+ /**
+ * Converts from a string key combination to an array
+ *
+ * @param {string} combination like "command+shift+l"
+ * @return {Array}
+ */
+ function _keysFromString(combination) {
+ if (combination === '+') {
+ return ['+'];
+ }
+ combination = combination.replace(/\+{2}/g, '+plus');
+ return combination.split('+');
+ }
-/***/ },
-/* 324 */
-/***/ function(module, exports) {
+ /**
+ * Gets info for a specific key combination
+ *
+ * @param {string} combination key combination ("command+s" or "a" or "*")
+ * @param {string=} action
+ * @returns {Object}
+ */
+ function _getKeyInfo(combination, action) {
+ var keys;
+ var key;
+ var i;
+ var modifiers = [];
- /**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
- }
+ // take the keys from this pattern and figure out what the actual
+ // pattern is all about
+ keys = _keysFromString(combination);
- module.exports = baseProperty;
+ for (i = 0; i < keys.length; ++i) {
+ key = keys[i];
+ // normalize key names
+ if (_SPECIAL_ALIASES[key]) {
+ key = _SPECIAL_ALIASES[key];
+ }
-/***/ },
-/* 325 */
-/***/ function(module, exports) {
+ // if this is not a keypress event then we should
+ // be smart about using shift keys
+ // this will only work for US keyboards however
+ if (action && action != 'keypress' && _SHIFT_MAP[key]) {
+ key = _SHIFT_MAP[key];
+ modifiers.push('shift');
+ }
- /**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
- var MAX_SAFE_INTEGER = 9007199254740991;
+ // if this key is a modifier then add it to the list of modifiers
+ if (_isModifier(key)) {
+ modifiers.push(key);
+ }
+ }
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- */
- function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
+ // depending on what the key combination is
+ // we will try to pick the best event for it
+ action = _pickBestAction(key, modifiers, action);
- module.exports = isLength;
+ return {
+ key: key,
+ modifiers: modifiers,
+ action: action
+ };
+ }
+ function _belongsTo(element, ancestor) {
+ if (element === null || element === document) {
+ return false;
+ }
-/***/ },
-/* 326 */
-/***/ function(module, exports, __webpack_require__) {
+ if (element === ancestor) {
+ return true;
+ }
- var isArguments = __webpack_require__(327),
- isArray = __webpack_require__(328),
- isIndex = __webpack_require__(329),
- isLength = __webpack_require__(325),
- keysIn = __webpack_require__(330);
+ return _belongsTo(element.parentNode, ancestor);
+ }
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ function Mousetrap(targetElement) {
+ var self = this;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
+ targetElement = targetElement || document;
- /**
- * A fallback implementation of `Object.keys` which creates an array of the
- * own enumerable property names of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function shimKeys(object) {
- var props = keysIn(object),
- propsLength = props.length,
- length = propsLength && object.length;
+ if (!(self instanceof Mousetrap)) {
+ return new Mousetrap(targetElement);
+ }
- var allowIndexes = !!length && isLength(length) &&
- (isArray(object) || isArguments(object));
+ /**
+ * element to attach key events to
+ *
+ * @type {Element}
+ */
+ self.target = targetElement;
- var index = -1,
- result = [];
+ /**
+ * a list of all the callbacks setup via Mousetrap.bind()
+ *
+ * @type {Object}
+ */
+ self._callbacks = {};
- while (++index < propsLength) {
- var key = props[index];
- if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
- result.push(key);
- }
- }
- return result;
- }
+ /**
+ * direct map of string combinations to callbacks used for trigger()
+ *
+ * @type {Object}
+ */
+ self._directMap = {};
- module.exports = shimKeys;
+ /**
+ * keeps track of what level each sequence is at since multiple
+ * sequences can start out with the same sequence
+ *
+ * @type {Object}
+ */
+ var _sequenceLevels = {};
+ /**
+ * variable to store the setTimeout call
+ *
+ * @type {null|number}
+ */
+ var _resetTimer;
-/***/ },
-/* 327 */
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * temporary state where we will ignore the next keyup
+ *
+ * @type {boolean|string}
+ */
+ var _ignoreNextKeyup = false;
- var isArrayLike = __webpack_require__(322),
- isObjectLike = __webpack_require__(321);
+ /**
+ * temporary state where we will ignore the next keypress
+ *
+ * @type {boolean}
+ */
+ var _ignoreNextKeypress = false;
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ /**
+ * are we currently inside of a sequence?
+ * type of action ("keyup" or "keydown" or "keypress") or false
+ *
+ * @type {boolean|string}
+ */
+ var _nextExpectedAction = false;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
+ /**
+ * resets all sequence counters except for the ones passed in
+ *
+ * @param {Object} doNotReset
+ * @returns void
+ */
+ function _resetSequences(doNotReset) {
+ doNotReset = doNotReset || {};
- /** Native method references. */
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
+ var activeSequences = false,
+ key;
- /**
- * Checks if `value` is classified as an `arguments` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments(value) {
- return isObjectLike(value) && isArrayLike(value) &&
- hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
- }
+ for (key in _sequenceLevels) {
+ if (doNotReset[key]) {
+ activeSequences = true;
+ continue;
+ }
+ _sequenceLevels[key] = 0;
+ }
- module.exports = isArguments;
+ if (!activeSequences) {
+ _nextExpectedAction = false;
+ }
+ }
+ /**
+ * finds all callbacks that match based on the keycode, modifiers,
+ * and action
+ *
+ * @param {string} character
+ * @param {Array} modifiers
+ * @param {Event|Object} e
+ * @param {string=} sequenceName - name of the sequence we are looking for
+ * @param {string=} combination
+ * @param {number=} level
+ * @returns {Array}
+ */
+ function _getMatches(character, modifiers, e, sequenceName, combination, level) {
+ var i;
+ var callback;
+ var matches = [];
+ var action = e.type;
-/***/ },
-/* 328 */
-/***/ function(module, exports, __webpack_require__) {
+ // if there are no events related to this keycode
+ if (!self._callbacks[character]) {
+ return [];
+ }
- var getNative = __webpack_require__(317),
- isLength = __webpack_require__(325),
- isObjectLike = __webpack_require__(321);
+ // if a modifier key is coming up on its own we should allow it
+ if (action == 'keyup' && _isModifier(character)) {
+ modifiers = [character];
+ }
- /** `Object#toString` result references. */
- var arrayTag = '[object Array]';
+ // loop through all callbacks for the key that was pressed
+ // and see if any of them match
+ for (i = 0; i < self._callbacks[character].length; ++i) {
+ callback = self._callbacks[character][i];
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ // if a sequence name is not specified, but this is a sequence at
+ // the wrong level then move onto the next match
+ if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
+ continue;
+ }
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
+ // if the action we are looking for doesn't match the action we got
+ // then we should keep going
+ if (action != callback.action) {
+ continue;
+ }
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeIsArray = getNative(Array, 'isArray');
+ // if this is a keypress event and the meta key and control key
+ // are not pressed that means that we need to only look at the
+ // character, otherwise check the modifiers as well
+ //
+ // chrome will not fire a keypress if meta or control is down
+ // safari will fire a keypress if meta or meta+shift is down
+ // firefox will fire a keypress if meta or control is down
+ if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(function() { return arguments; }());
- * // => false
- */
- var isArray = nativeIsArray || function(value) {
- return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
- };
+ // when you bind a combination or sequence a second time it
+ // should overwrite the first one. if a sequenceName or
+ // combination is specified in this call it does just that
+ //
+ // @todo make deleting its own method?
+ var deleteCombo = !sequenceName && callback.combo == combination;
+ var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
+ if (deleteCombo || deleteSequence) {
+ self._callbacks[character].splice(i, 1);
+ }
- module.exports = isArray;
+ matches.push(callback);
+ }
+ }
+ return matches;
+ }
-/***/ },
-/* 329 */
-/***/ function(module, exports) {
+ /**
+ * actually calls the callback function
+ *
+ * if your callback function returns false this will use the jquery
+ * convention - prevent default and stop propogation on the event
+ *
+ * @param {Function} callback
+ * @param {Event} e
+ * @returns void
+ */
+ function _fireCallback(callback, e, combo, sequence) {
- /** Used to detect unsigned integer values. */
- var reIsUint = /^\d+$/;
+ // if this event should not happen stop here
+ if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
+ return;
+ }
- /**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
- var MAX_SAFE_INTEGER = 9007199254740991;
+ if (callback(e, combo) === false) {
+ _preventDefault(e);
+ _stopPropagation(e);
+ }
+ }
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
- }
+ /**
+ * handles a character key event
+ *
+ * @param {string} character
+ * @param {Array} modifiers
+ * @param {Event} e
+ * @returns void
+ */
+ self._handleKey = function(character, modifiers, e) {
+ var callbacks = _getMatches(character, modifiers, e);
+ var i;
+ var doNotReset = {};
+ var maxLevel = 0;
+ var processedSequenceCallback = false;
- module.exports = isIndex;
+ // Calculate the maxLevel for sequences so we can only execute the longest callback sequence
+ for (i = 0; i < callbacks.length; ++i) {
+ if (callbacks[i].seq) {
+ maxLevel = Math.max(maxLevel, callbacks[i].level);
+ }
+ }
+ // loop through matching callbacks for this key event
+ for (i = 0; i < callbacks.length; ++i) {
-/***/ },
-/* 330 */
-/***/ function(module, exports, __webpack_require__) {
+ // fire for all sequence callbacks
+ // this is because if for example you have multiple sequences
+ // bound such as "g i" and "g t" they both need to fire the
+ // callback for matching g cause otherwise you can only ever
+ // match the first one
+ if (callbacks[i].seq) {
- var isArguments = __webpack_require__(327),
- isArray = __webpack_require__(328),
- isIndex = __webpack_require__(329),
- isLength = __webpack_require__(325),
- isObject = __webpack_require__(320);
+ // only fire callbacks for the maxLevel to prevent
+ // subsequences from also firing
+ //
+ // for example 'a option b' should not cause 'option b' to fire
+ // even though 'option b' is part of the other sequence
+ //
+ // any sequences that do not match here will be discarded
+ // below by the _resetSequences call
+ if (callbacks[i].level != maxLevel) {
+ continue;
+ }
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ processedSequenceCallback = true;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
+ // keep a list of which sequences were matches for later
+ doNotReset[callbacks[i].seq] = 1;
+ _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
+ continue;
+ }
- /**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
- function keysIn(object) {
- if (object == null) {
- return [];
- }
- if (!isObject(object)) {
- object = Object(object);
- }
- var length = object.length;
- length = (length && isLength(length) &&
- (isArray(object) || isArguments(object)) && length) || 0;
+ // if there were no sequence matches but we are still here
+ // that means this is a regular match so we should fire that
+ if (!processedSequenceCallback) {
+ _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
+ }
+ }
- var Ctor = object.constructor,
- index = -1,
- isProto = typeof Ctor == 'function' && Ctor.prototype === object,
- result = Array(length),
- skipIndexes = length > 0;
+ // if the key you pressed matches the type of sequence without
+ // being a modifier (ie "keyup" or "keypress") then we should
+ // reset all sequences that were not matched by this event
+ //
+ // this is so, for example, if you have the sequence "h a t" and you
+ // type "h e a r t" it does not match. in this case the "e" will
+ // cause the sequence to reset
+ //
+ // modifier keys are ignored because you can have a sequence
+ // that contains modifiers such as "enter ctrl+space" and in most
+ // cases the modifier key will be pressed before the next key
+ //
+ // also if you have a sequence such as "ctrl+b a" then pressing the
+ // "b" key will trigger a "keypress" and a "keydown"
+ //
+ // the "keydown" is expected when there is a modifier, but the
+ // "keypress" ends up matching the _nextExpectedAction since it occurs
+ // after and that causes the sequence to reset
+ //
+ // we ignore keypresses in a sequence that directly follow a keydown
+ // for the same character
+ var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
+ if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
+ _resetSequences(doNotReset);
+ }
- while (++index < length) {
- result[index] = (index + '');
- }
- for (var key in object) {
- if (!(skipIndexes && isIndex(key, length)) &&
- !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
- }
+ _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
+ };
- module.exports = keysIn;
+ /**
+ * handles a keydown event
+ *
+ * @param {Event} e
+ * @returns void
+ */
+ function _handleKeyEvent(e) {
+ // normalize e.which for key events
+ // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
+ if (typeof e.which !== 'number') {
+ e.which = e.keyCode;
+ }
-/***/ },
-/* 331 */
-/***/ function(module, exports, __webpack_require__) {
+ var character = _characterFromEvent(e);
- var baseCopy = __webpack_require__(332),
- keys = __webpack_require__(316);
+ // no character found then stop
+ if (!character) {
+ return;
+ }
- /**
- * The base implementation of `_.assign` without support for argument juggling,
- * multiple sources, and `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
- function baseAssign(object, source) {
- return source == null
- ? object
- : baseCopy(source, keys(source), object);
- }
+ // need to use === for the character check because the character can be 0
+ if (e.type == 'keyup' && _ignoreNextKeyup === character) {
+ _ignoreNextKeyup = false;
+ return;
+ }
- module.exports = baseAssign;
+ self.handleKey(character, _eventModifiers(e), e);
+ }
+ /**
+ * called to set a 1 second timeout on the specified sequence
+ *
+ * this is so after each key press in the sequence you have 1 second
+ * to press the next key before you have to start over
+ *
+ * @returns void
+ */
+ function _resetSequenceTimer() {
+ clearTimeout(_resetTimer);
+ _resetTimer = setTimeout(_resetSequences, 1000);
+ }
-/***/ },
-/* 332 */
-/***/ function(module, exports) {
+ /**
+ * binds a key sequence to an event
+ *
+ * @param {string} combo - combo specified in bind call
+ * @param {Array} keys
+ * @param {Function} callback
+ * @param {string=} action
+ * @returns void
+ */
+ function _bindSequence(combo, keys, callback, action) {
- /**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @returns {Object} Returns `object`.
- */
- function baseCopy(source, props, object) {
- object || (object = {});
+ // start off by adding a sequence level record for this combination
+ // and setting the level to 0
+ _sequenceLevels[combo] = 0;
- var index = -1,
- length = props.length;
+ /**
+ * callback to increase the sequence level for this sequence and reset
+ * all other sequences that were active
+ *
+ * @param {string} nextAction
+ * @returns {Function}
+ */
+ function _increaseSequence(nextAction) {
+ return function() {
+ _nextExpectedAction = nextAction;
+ ++_sequenceLevels[combo];
+ _resetSequenceTimer();
+ };
+ }
- while (++index < length) {
- var key = props[index];
- object[key] = source[key];
- }
- return object;
- }
+ /**
+ * wraps the specified callback inside of another function in order
+ * to reset all sequence counters as soon as this sequence is done
+ *
+ * @param {Event} e
+ * @returns void
+ */
+ function _callbackAndReset(e) {
+ _fireCallback(callback, e, combo);
- module.exports = baseCopy;
+ // we should ignore the next key up if the action is key down
+ // or keypress. this is so if you finish a sequence and
+ // release the key the final key will not trigger a keyup
+ if (action !== 'keyup') {
+ _ignoreNextKeyup = _characterFromEvent(e);
+ }
+ // weird race condition if a sequence ends with the key
+ // another sequence begins with
+ setTimeout(_resetSequences, 10);
+ }
-/***/ },
-/* 333 */
-/***/ function(module, exports, __webpack_require__) {
+ // loop through keys one at a time and bind the appropriate callback
+ // function. for any key leading up to the final one it should
+ // increase the sequence. after the final, it should reset all sequences
+ //
+ // if an action is specified in the original bind call then that will
+ // be used throughout. otherwise we will pass the action that the
+ // next key in the sequence should match. this allows a sequence
+ // to mix and match keypress and keydown events depending on which
+ // ones are better suited to the key provided
+ for (var i = 0; i < keys.length; ++i) {
+ var isFinal = i + 1 === keys.length;
+ var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
+ _bindSingle(keys[i], wrappedCallback, action, combo, i);
+ }
+ }
- var bindCallback = __webpack_require__(334),
- isIterateeCall = __webpack_require__(336),
- restParam = __webpack_require__(337);
+ /**
+ * binds a single keyboard combination
+ *
+ * @param {string} combination
+ * @param {Function} callback
+ * @param {string=} action
+ * @param {string=} sequenceName - name of sequence if part of sequence
+ * @param {number=} level - what part of the sequence the command is
+ * @returns void
+ */
+ function _bindSingle(combination, callback, action, sequenceName, level) {
- /**
- * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
- *
- * @private
- * @param {Function} assigner The function to assign values.
- * @returns {Function} Returns the new assigner function.
- */
- function createAssigner(assigner) {
- return restParam(function(object, sources) {
- var index = -1,
- length = object == null ? 0 : sources.length,
- customizer = length > 2 ? sources[length - 2] : undefined,
- guard = length > 2 ? sources[2] : undefined,
- thisArg = length > 1 ? sources[length - 1] : undefined;
+ // store a direct mapped reference for use with Mousetrap.trigger
+ self._directMap[combination + ':' + action] = callback;
- if (typeof customizer == 'function') {
- customizer = bindCallback(customizer, thisArg, 5);
- length -= 2;
- } else {
- customizer = typeof thisArg == 'function' ? thisArg : undefined;
- length -= (customizer ? 1 : 0);
- }
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- customizer = length < 3 ? undefined : customizer;
- length = 1;
- }
- while (++index < length) {
- var source = sources[index];
- if (source) {
- assigner(object, source, customizer);
- }
- }
- return object;
- });
- }
+ // make sure multiple spaces in a row become a single space
+ combination = combination.replace(/\s+/g, ' ');
- module.exports = createAssigner;
+ var sequence = combination.split(' ');
+ var info;
+ // if this pattern is a sequence of keys then run through this method
+ // to reprocess each pattern one key at a time
+ if (sequence.length > 1) {
+ _bindSequence(combination, sequence, callback, action);
+ return;
+ }
-/***/ },
-/* 334 */
-/***/ function(module, exports, __webpack_require__) {
+ info = _getKeyInfo(combination, action);
- var identity = __webpack_require__(335);
+ // make sure to initialize array if this is the first time
+ // a callback is added for this key
+ self._callbacks[info.key] = self._callbacks[info.key] || [];
- /**
- * A specialized version of `baseCallback` which only supports `this` binding
- * and specifying the number of arguments to provide to `func`.
- *
- * @private
- * @param {Function} func The function to bind.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {number} [argCount] The number of arguments to provide to `func`.
- * @returns {Function} Returns the callback.
- */
- function bindCallback(func, thisArg, argCount) {
- if (typeof func != 'function') {
- return identity;
- }
- if (thisArg === undefined) {
- return func;
- }
- switch (argCount) {
- case 1: return function(value) {
- return func.call(thisArg, value);
+ // remove an existing match if there is one
+ _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
+
+ // add this call back to the array
+ // if it is a sequence put it at the beginning
+ // if not put it at the end
+ //
+ // this is important because the way these are processed expects
+ // the sequence ones to come first
+ self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
+ callback: callback,
+ modifiers: info.modifiers,
+ action: info.action,
+ seq: sequenceName,
+ level: level,
+ combo: combination
+ });
+ }
+
+ /**
+ * binds multiple combinations to the same callback
+ *
+ * @param {Array} combinations
+ * @param {Function} callback
+ * @param {string|undefined} action
+ * @returns void
+ */
+ self._bindMultiple = function(combinations, callback, action) {
+ for (var i = 0; i < combinations.length; ++i) {
+ _bindSingle(combinations[i], callback, action);
+ }
+ };
+
+ // start!
+ _addEvent(targetElement, 'keypress', _handleKeyEvent);
+ _addEvent(targetElement, 'keydown', _handleKeyEvent);
+ _addEvent(targetElement, 'keyup', _handleKeyEvent);
+ }
+
+ /**
+ * binds an event to mousetrap
+ *
+ * can be a single key, a combination of keys separated with +,
+ * an array of keys, or a sequence of keys separated by spaces
+ *
+ * be sure to list the modifier keys first to make sure that the
+ * correct key ends up getting bound (the last key in the pattern)
+ *
+ * @param {string|Array} keys
+ * @param {Function} callback
+ * @param {string=} action - 'keypress', 'keydown', or 'keyup'
+ * @returns void
+ */
+ Mousetrap.prototype.bind = function(keys, callback, action) {
+ var self = this;
+ keys = keys instanceof Array ? keys : [keys];
+ self._bindMultiple.call(self, keys, callback, action);
+ return self;
};
- case 3: return function(value, index, collection) {
- return func.call(thisArg, value, index, collection);
+
+ /**
+ * unbinds an event to mousetrap
+ *
+ * the unbinding sets the callback function of the specified key combo
+ * to an empty function and deletes the corresponding key in the
+ * _directMap dict.
+ *
+ * TODO: actually remove this from the _callbacks dictionary instead
+ * of binding an empty function
+ *
+ * the keycombo+action has to be exactly the same as
+ * it was defined in the bind method
+ *
+ * @param {string|Array} keys
+ * @param {string} action
+ * @returns void
+ */
+ Mousetrap.prototype.unbind = function(keys, action) {
+ var self = this;
+ return self.bind.call(self, keys, function() {}, action);
};
- case 4: return function(accumulator, value, index, collection) {
- return func.call(thisArg, accumulator, value, index, collection);
+
+ /**
+ * triggers an event that has already been bound
+ *
+ * @param {string} keys
+ * @param {string=} action
+ * @returns void
+ */
+ Mousetrap.prototype.trigger = function(keys, action) {
+ var self = this;
+ if (self._directMap[keys + ':' + action]) {
+ self._directMap[keys + ':' + action]({}, keys);
+ }
+ return self;
};
- case 5: return function(value, other, key, object, source) {
- return func.call(thisArg, value, other, key, object, source);
+
+ /**
+ * resets the library back to its initial state. this is useful
+ * if you want to clear out the current keyboard shortcuts and bind
+ * new ones - for example if you switch to another page
+ *
+ * @returns void
+ */
+ Mousetrap.prototype.reset = function() {
+ var self = this;
+ self._callbacks = {};
+ self._directMap = {};
+ return self;
};
- }
- return function() {
- return func.apply(thisArg, arguments);
- };
- }
- module.exports = bindCallback;
+ /**
+ * should we stop this event before firing off callbacks
+ *
+ * @param {Event} e
+ * @param {Element} element
+ * @return {boolean}
+ */
+ Mousetrap.prototype.stopCallback = function(e, element) {
+ var self = this;
+ // if the element has the class "mousetrap" then no need to stop
+ if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
+ return false;
+ }
-/***/ },
-/* 335 */
-/***/ function(module, exports) {
+ if (_belongsTo(element, self.target)) {
+ return false;
+ }
- /**
- * This method returns the first argument provided to it.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.identity(object) === object;
- * // => true
- */
- function identity(value) {
- return value;
- }
+ // stop for input, select, and textarea
+ return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
+ };
- module.exports = identity;
+ /**
+ * exposes _handleKey publicly so it can be overwritten by extensions
+ */
+ Mousetrap.prototype.handleKey = function() {
+ var self = this;
+ return self._handleKey.apply(self, arguments);
+ };
+
+ /**
+ * allow custom key mappings
+ */
+ Mousetrap.addKeycodes = function(object) {
+ for (var key in object) {
+ if (object.hasOwnProperty(key)) {
+ _MAP[key] = object[key];
+ }
+ }
+ _REVERSE_MAP = null;
+ };
+
+ /**
+ * Init the global mousetrap functions
+ *
+ * This method is needed to allow the global mousetrap functions to work
+ * now that mousetrap is a constructor function.
+ */
+ Mousetrap.init = function() {
+ var documentMousetrap = Mousetrap(document);
+ for (var method in documentMousetrap) {
+ if (method.charAt(0) !== '_') {
+ Mousetrap[method] = (function(method) {
+ return function() {
+ return documentMousetrap[method].apply(documentMousetrap, arguments);
+ };
+ } (method));
+ }
+ }
+ };
+
+ Mousetrap.init();
+
+ // expose mousetrap to the global object
+ window.Mousetrap = Mousetrap;
+
+ // expose as a common js module
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = Mousetrap;
+ }
+
+ // expose mousetrap as an AMD module
+ if (true) {
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
+ return Mousetrap;
+ }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ }
+ }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);
/***/ },
-/* 336 */
+/* 325 */
/***/ function(module, exports, __webpack_require__) {
- var isArrayLike = __webpack_require__(322),
- isIndex = __webpack_require__(329),
- isObject = __webpack_require__(320);
+ "use strict";
- /**
- * Checks if the provided arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
- */
- function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)) {
- var other = object[index];
- return value === value ? (value === other) : (other !== other);
- }
- return false;
- }
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- module.exports = isIterateeCall;
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ var _react = __webpack_require__(2);
-/***/ },
-/* 337 */
-/***/ function(module, exports) {
+ var _react2 = _interopRequireDefault(_react);
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max;
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
- *
- * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.restParam(function(what, names) {
- * return what + ' ' + _.initial(names).join(', ') +
- * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */
- function restParam(func, start) {
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
+ 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 ZoomButtons = function (_Component) {
+ _inherits(ZoomButtons, _Component);
+
+ function ZoomButtons() {
+ _classCallCheck(this, ZoomButtons);
+
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(ZoomButtons).apply(this, arguments));
}
- start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- rest = Array(length);
- while (++index < length) {
- rest[index] = args[start + index];
- }
- switch (start) {
- case 0: return func.call(this, rest);
- case 1: return func.call(this, args[0], rest);
- case 2: return func.call(this, args[0], args[1], rest);
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
+ _createClass(ZoomButtons, [{
+ key: "render",
+ value: function render() {
+ return _react2.default.createElement(
+ "div",
+ { id: "zoomButtons" },
+ _react2.default.createElement(
+ "button",
+ { id: "zoomIn", title: "zoom in", onClick: this.props.zoomIn },
+ "+"
+ ),
+ _react2.default.createElement(
+ "button",
+ { id: "zoomOut", title: "zoom out", onClick: this.props.zoomOut },
+ "–"
+ )
+ );
}
- otherArgs[start] = rest;
- return func.apply(this, otherArgs);
- };
- }
+ }]);
- module.exports = restParam;
+ return ZoomButtons;
+ }(_react.Component);
+ exports.default = ZoomButtons;
/***/ },
-/* 338 */
+/* 326 */
/***/ function(module, exports, __webpack_require__) {
- var baseIsEqual = __webpack_require__(339),
- bindCallback = __webpack_require__(334);
+ 'use strict';
- /**
- * Performs a deep comparison between two values to determine if they are
- * equivalent. If `customizer` is provided it's invoked to compare values.
- * If `customizer` returns `undefined` comparisons are handled by the method
- * instead. The `customizer` is bound to `thisArg` and invoked with up to
- * three arguments: (value, other [, index|key]).
- *
- * **Note:** This method supports comparing arrays, booleans, `Date` objects,
- * numbers, `Object` objects, regexes, and strings. Objects are compared by
- * their own, not inherited, enumerable properties. Functions and DOM nodes
- * are **not** supported. Provide a customizer function to extend support
- * for comparing other values.
- *
- * @static
- * @memberOf _
- * @alias eq
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize value comparisons.
- * @param {*} [thisArg] The `this` binding of `customizer`.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
- *
- * object == other;
- * // => false
- *
- * _.isEqual(object, other);
- * // => true
- *
- * // using a customizer callback
- * var array = ['hello', 'goodbye'];
- * var other = ['hi', 'goodbye'];
- *
- * _.isEqual(array, other, function(value, other) {
- * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
- * return true;
- * }
- * });
- * // => true
- */
- function isEqual(value, other, customizer, thisArg) {
- customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
- var result = customizer ? customizer(value, other) : undefined;
- return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
- }
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- module.exports = isEqual;
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ var _react = __webpack_require__(2);
-/***/ },
-/* 339 */
-/***/ function(module, exports, __webpack_require__) {
+ var _react2 = _interopRequireDefault(_react);
- var baseIsEqualDeep = __webpack_require__(340),
- isObject = __webpack_require__(320),
- isObjectLike = __webpack_require__(321);
+ var _BaseComponent2 = __webpack_require__(276);
- /**
- * The base implementation of `_.isEqual` without support for `this` binding
- * `customizer` functions.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {Function} [customizer] The function to customize comparing values.
- * @param {boolean} [isLoose] Specify performing partial comparisons.
- * @param {Array} [stackA] Tracks traversed `value` objects.
- * @param {Array} [stackB] Tracks traversed `other` objects.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- */
- function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
- if (value === other) {
- return true;
- }
- if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
- return value !== value && other !== other;
- }
- return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
- }
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- module.exports = baseIsEqual;
+ var _UndoButtons = __webpack_require__(327);
+ var _UndoButtons2 = _interopRequireDefault(_UndoButtons);
-/***/ },
-/* 340 */
-/***/ function(module, exports, __webpack_require__) {
+ var _LayoutButtons = __webpack_require__(328);
- var equalArrays = __webpack_require__(341),
- equalByTag = __webpack_require__(343),
- equalObjects = __webpack_require__(344),
- isArray = __webpack_require__(328),
- isTypedArray = __webpack_require__(345);
+ var _LayoutButtons2 = _interopRequireDefault(_LayoutButtons);
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- objectTag = '[object Object]';
+ var _EditButtons = __webpack_require__(329);
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ var _EditButtons2 = _interopRequireDefault(_EditButtons);
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
+ var _AddEdgeForm = __webpack_require__(332);
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
+ var _AddEdgeForm2 = _interopRequireDefault(_AddEdgeForm);
- /**
- * A specialized version of `baseIsEqual` for arrays and objects which performs
- * deep comparisons and tracks traversed objects enabling objects with circular
- * references to be compared.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparing objects.
- * @param {boolean} [isLoose] Specify performing partial comparisons.
- * @param {Array} [stackA=[]] Tracks traversed `value` objects.
- * @param {Array} [stackB=[]] Tracks traversed `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */
- function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
- var objIsArr = isArray(object),
- othIsArr = isArray(other),
- objTag = arrayTag,
- othTag = arrayTag;
+ var _AddCaptionForm = __webpack_require__(338);
- if (!objIsArr) {
- objTag = objToString.call(object);
- if (objTag == argsTag) {
- objTag = objectTag;
- } else if (objTag != objectTag) {
- objIsArr = isTypedArray(object);
- }
- }
- if (!othIsArr) {
- othTag = objToString.call(other);
- if (othTag == argsTag) {
- othTag = objectTag;
- } else if (othTag != objectTag) {
- othIsArr = isTypedArray(other);
- }
- }
- var objIsObj = objTag == objectTag,
- othIsObj = othTag == objectTag,
- isSameTag = objTag == othTag;
+ var _AddCaptionForm2 = _interopRequireDefault(_AddCaptionForm);
- if (isSameTag && !(objIsArr || objIsObj)) {
- return equalByTag(object, other, objTag);
- }
- if (!isLoose) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
+ var _AddConnectedNodesForm = __webpack_require__(339);
- if (objIsWrapped || othIsWrapped) {
- return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
- }
- }
- if (!isSameTag) {
- return false;
- }
- // Assume cyclic values are equal.
- // For more information on detecting circular references see https://es5.github.io/#JO.
- stackA || (stackA = []);
- stackB || (stackB = []);
+ var _AddConnectedNodesForm2 = _interopRequireDefault(_AddConnectedNodesForm);
- var length = stackA.length;
- while (length--) {
- if (stackA[length] == object) {
- return stackB[length] == other;
- }
- }
- // Add `object` and `other` to the stack of traversed objects.
- stackA.push(object);
- stackB.push(other);
+ var _DeleteSelectedButton = __webpack_require__(342);
- var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
+ var _DeleteSelectedButton2 = _interopRequireDefault(_DeleteSelectedButton);
- stackA.pop();
- stackB.pop();
+ var _UpdateNodeForm = __webpack_require__(343);
- return result;
- }
+ var _UpdateNodeForm2 = _interopRequireDefault(_UpdateNodeForm);
- module.exports = baseIsEqualDeep;
+ var _UpdateEdgeForm = __webpack_require__(408);
+ var _UpdateEdgeForm2 = _interopRequireDefault(_UpdateEdgeForm);
-/***/ },
-/* 341 */
-/***/ function(module, exports, __webpack_require__) {
+ var _UpdateCaptionForm = __webpack_require__(409);
- var arraySome = __webpack_require__(342);
+ var _UpdateCaptionForm2 = _interopRequireDefault(_UpdateCaptionForm);
- /**
- * A specialized version of `baseIsEqualDeep` for arrays with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Array} array The array to compare.
- * @param {Array} other The other array to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparing arrays.
- * @param {boolean} [isLoose] Specify performing partial comparisons.
- * @param {Array} [stackA] Tracks traversed `value` objects.
- * @param {Array} [stackB] Tracks traversed `other` objects.
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
- */
- function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
- var index = -1,
- arrLength = array.length,
- othLength = other.length;
+ var _HelpScreen = __webpack_require__(410);
- if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
- return false;
- }
- // Ignore non-index properties.
- while (++index < arrLength) {
- var arrValue = array[index],
- othValue = other[index],
- result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
+ var _HelpScreen2 = _interopRequireDefault(_HelpScreen);
- if (result !== undefined) {
- if (result) {
- continue;
- }
- return false;
- }
- // Recursively compare arrays (susceptible to call stack limits).
- if (isLoose) {
- if (!arraySome(other, function(othValue) {
- return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
- })) {
- return false;
- }
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
- return false;
- }
- }
- return true;
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- module.exports = equalArrays;
+ 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; }
-/***/ },
-/* 342 */
-/***/ function(module, exports) {
+ 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; }
- /**
- * A specialized version of `_.some` for arrays without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */
- function arraySome(array, predicate) {
- var index = -1,
- length = array.length;
+ var EditTools = function (_BaseComponent) {
+ _inherits(EditTools, _BaseComponent);
- while (++index < length) {
- if (predicate(array[index], index, array)) {
- return true;
- }
+ function EditTools(props) {
+ _classCallCheck(this, EditTools);
+
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(EditTools).call(this, props));
+
+ _this.bindAll('_handleDelete');
+
+ return _this;
}
- return false;
- }
- module.exports = arraySome;
+ _createClass(EditTools, [{
+ key: 'render',
+ value: function render() {
+ var _props = this.props;
+ var graphApi = _props.graphApi;
+ var source = _props.source;
+ var data = _props.data;
+ var graph = _props.graph;
+ var addForm = _props.addForm;
+ var currentForm = _props.currentForm;
+ var helpScreen = _props.helpScreen;
+ var clearGraph = _props.clearGraph;
+ var closeAddForm = _props.closeAddForm;
+ var toggleHelpScreen = _props.toggleHelpScreen;
+ var toggleAddEdgeForm = _props.toggleAddEdgeForm;
+ var zoomIn = graphApi.zoomIn;
+ var zoomOut = graphApi.zoomOut;
+ var resetZoom = graphApi.resetZoom;
+ var prune = graphApi.prune;
+ var circleLayout = graphApi.circleLayout;
+ var addNode = graphApi.addNode;
+ var addEdge = graphApi.addEdge;
+ var addCaption = graphApi.addCaption;
+ var addSurroundingNodes = graphApi.addSurroundingNodes;
+ var updateNode = graphApi.updateNode;
+ var updateEdge = graphApi.updateEdge;
+ var updateCaption = graphApi.updateCaption;
+ var deselectAll = graphApi.deselectAll;
+ var deleteAll = graphApi.deleteAll;
+ var getGraph = graphApi.getGraph;
-/***/ },
-/* 343 */
-/***/ function(module, exports) {
+ return _react2.default.createElement(
+ 'div',
+ { id: 'editTools' },
+ _react2.default.createElement(
+ 'div',
+ { id: 'buttons' },
+ _react2.default.createElement(_EditButtons2.default, {
+ ref: 'editButtons',
+ addNode: addNode,
+ addEdge: addEdge,
+ closeAddForm: closeAddForm,
+ source: source,
+ nodes: graph.nodes,
+ nodeResults: this.props.nodeResults,
+ setNodeResults: this.props.setNodeResults,
+ toggleAddEdgeForm: toggleAddEdgeForm,
+ showInterlocksButton: this.props.showInterlocksButton,
+ fetchInterlocks: this.props.fetchInterlocks }),
+ currentForm == 'UpdateCaptionForm' && _react2.default.createElement(_UpdateCaptionForm2.default, {
+ updateCaption: updateCaption,
+ data: data,
+ deselect: deselectAll }),
+ currentForm != 'UpdateCaptionForm' && _react2.default.createElement(_AddCaptionForm2.default, {
+ addCaption: addCaption }),
+ _react2.default.createElement(_LayoutButtons2.default, {
+ prune: prune,
+ circleLayout: circleLayout,
+ clearGraph: clearGraph }),
+ _react2.default.createElement(_UndoButtons2.default, {
+ undo: this.props.undo,
+ redo: this.props.redo,
+ canUndo: this.props.canUndo,
+ canRedo: this.props.canRedo }),
+ this.props.hideHelp ? null : _react2.default.createElement(
+ 'button',
+ { id: 'helpButton', className: 'btn btn-sm btn-default buttonGroup', onClick: toggleHelpScreen },
+ 'help'
+ )
+ ),
+ addForm == 'AddEdgeForm' && _react2.default.createElement(_AddEdgeForm2.default, {
+ addEdge: addEdge,
+ nodes: graph.nodes,
+ closeAddForm: closeAddForm,
+ data: data }),
+ currentForm == 'UpdateNodeForm' && _react2.default.createElement(_UpdateNodeForm2.default, {
+ updateNode: updateNode,
+ data: data,
+ deselect: deselectAll }),
+ currentForm == 'UpdateEdgeForm' && _react2.default.createElement(_UpdateEdgeForm2.default, {
+ updateEdge: updateEdge,
+ getGraph: getGraph,
+ data: data,
+ deselect: deselectAll }),
+ currentForm == 'UpdateNodeForm' && source && source.getConnectedNodes && _react2.default.createElement(_AddConnectedNodesForm2.default, {
+ data: data,
+ source: source,
+ closeAddForm: closeAddForm,
+ graph: graph,
+ addSurroundingNodes: addSurroundingNodes,
+ addEdge: addEdge }),
+ (currentForm == 'UpdateNodeForm' || currentForm == 'UpdateEdgeForm') && _react2.default.createElement(_DeleteSelectedButton2.default, {
+ currentForm: currentForm,
+ doDelete: this._handleDelete }),
+ helpScreen && !this.props.hideHelp ? _react2.default.createElement(_HelpScreen2.default, { source: source }) : null
+ );
+ }
+ }, {
+ key: '_handleDelete',
+ value: function _handleDelete() {
+ this.props.delete();
+ }
+ }]);
- /** `Object#toString` result references. */
- var boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- numberTag = '[object Number]',
- regexpTag = '[object RegExp]',
- stringTag = '[object String]';
+ return EditTools;
+ }(_BaseComponent3.default);
- /**
- * A specialized version of `baseIsEqualDeep` for comparing objects of
- * the same `toStringTag`.
- *
- * **Note:** This function only supports comparing values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {string} tag The `toStringTag` of the objects to compare.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */
- function equalByTag(object, other, tag) {
- switch (tag) {
- case boolTag:
- case dateTag:
- // Coerce dates and booleans to numbers, dates to milliseconds and booleans
- // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
- return +object == +other;
+ exports.default = EditTools;
- case errorTag:
- return object.name == other.name && object.message == other.message;
+/***/ },
+/* 327 */
+/***/ function(module, exports, __webpack_require__) {
- case numberTag:
- // Treat `NaN` vs. `NaN` as equal.
- return (object != +object)
- ? other != +other
- : object == +other;
+ "use strict";
- case regexpTag:
- case stringTag:
- // Coerce regexes to strings and treat strings primitives and string
- // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
- return object == (other + '');
- }
- return false;
- }
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- module.exports = equalByTag;
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ var _react = __webpack_require__(2);
-/***/ },
-/* 344 */
-/***/ function(module, exports, __webpack_require__) {
+ var _react2 = _interopRequireDefault(_react);
- var keys = __webpack_require__(316);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
+ 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; }
- /**
- * A specialized version of `baseIsEqualDeep` for objects with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Function} [customizer] The function to customize comparing values.
- * @param {boolean} [isLoose] Specify performing partial comparisons.
- * @param {Array} [stackA] Tracks traversed `value` objects.
- * @param {Array} [stackB] Tracks traversed `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */
- function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
- var objProps = keys(object),
- objLength = objProps.length,
- othProps = keys(other),
- othLength = othProps.length;
+ 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; }
- if (objLength != othLength && !isLoose) {
- return false;
- }
- var index = objLength;
- while (index--) {
- var key = objProps[index];
- if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
- return false;
- }
- }
- var skipCtor = isLoose;
- while (++index < objLength) {
- key = objProps[index];
- var objValue = object[key],
- othValue = other[key],
- result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
+ var UndoButtons = function (_Component) {
+ _inherits(UndoButtons, _Component);
- // Recursively compare objects (susceptible to call stack limits).
- if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
- return false;
- }
- skipCtor || (skipCtor = key == 'constructor');
+ function UndoButtons() {
+ _classCallCheck(this, UndoButtons);
+
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(UndoButtons).apply(this, arguments));
}
- if (!skipCtor) {
- var objCtor = object.constructor,
- othCtor = other.constructor;
- // Non `Object` object instances with different constructors are not equal.
- if (objCtor != othCtor &&
- ('constructor' in object && 'constructor' in other) &&
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
- return false;
+ _createClass(UndoButtons, [{
+ key: "render",
+ value: function render() {
+ return _react2.default.createElement(
+ "div",
+ { id: "undobuttons", className: "btn-group buttonGroup" },
+ _react2.default.createElement(
+ "button",
+ { className: "btn btn-sm btn-default", onClick: this.props.undo, disabled: !this.props.canUndo },
+ "undo"
+ ),
+ _react2.default.createElement(
+ "button",
+ { className: "btn btn-sm btn-default", onClick: this.props.redo, disabled: !this.props.canRedo },
+ "redo"
+ )
+ );
}
- }
- return true;
- }
+ }]);
- module.exports = equalObjects;
+ return UndoButtons;
+ }(_react.Component);
+ exports.default = UndoButtons;
/***/ },
-/* 345 */
+/* 328 */
/***/ function(module, exports, __webpack_require__) {
- var isLength = __webpack_require__(325),
- isObjectLike = __webpack_require__(321);
-
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag = '[object Function]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- objectTag = '[object Object]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- weakMapTag = '[object WeakMap]';
-
- var arrayBufferTag = '[object ArrayBuffer]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
+ "use strict";
- /** Used to identify `toStringTag` values of typed arrays. */
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
- typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
- typedArrayTags[dateTag] = typedArrayTags[errorTag] =
- typedArrayTags[funcTag] = typedArrayTags[mapTag] =
- typedArrayTags[numberTag] = typedArrayTags[objectTag] =
- typedArrayTags[regexpTag] = typedArrayTags[setTag] =
- typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ 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; }; }();
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
+ var _react = __webpack_require__(2);
- /**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
- function isTypedArray(value) {
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
- }
+ var _react2 = _interopRequireDefault(_react);
- module.exports = isTypedArray;
+ 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"); } }
-/***/ },
-/* 346 */
-/***/ function(module, exports, __webpack_require__) {
+ 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; }
- var isObjectLike = __webpack_require__(321);
+ 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; }
- /** `Object#toString` result references. */
- var boolTag = '[object Boolean]';
+ var LayoutButtons = function (_Component) {
+ _inherits(LayoutButtons, _Component);
- /** Used for native method references. */
- var objectProto = Object.prototype;
+ function LayoutButtons() {
+ _classCallCheck(this, LayoutButtons);
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(LayoutButtons).apply(this, arguments));
+ }
- /**
- * Checks if `value` is classified as a boolean primitive or object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isBoolean(false);
- * // => true
- *
- * _.isBoolean(null);
- * // => false
- */
- function isBoolean(value) {
- return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
- }
+ _createClass(LayoutButtons, [{
+ key: "render",
+ value: function render() {
+ return _react2.default.createElement(
+ "div",
+ { id: "layoutButtons", className: "btn-group buttonGroup" },
+ _react2.default.createElement(
+ "button",
+ { className: "btn btn-sm btn-default", title: "remove unconnected nodes", onClick: this.props.prune },
+ "prune"
+ ),
+ _react2.default.createElement(
+ "button",
+ { className: "btn btn-sm btn-default", title: "arrange nodes in a circle", onClick: this.props.circleLayout },
+ "circle"
+ ),
+ _react2.default.createElement(
+ "button",
+ { className: "btn btn-sm btn-default", title: "delete everything", onClick: this.props.clearGraph },
+ "clear"
+ )
+ );
+ }
+ }]);
- module.exports = isBoolean;
+ return LayoutButtons;
+ }(_react.Component);
+ exports.default = LayoutButtons;
/***/ },
-/* 347 */
+/* 329 */
/***/ function(module, exports, __webpack_require__) {
- var arrayEach = __webpack_require__(348),
- baseEach = __webpack_require__(349),
- createForEach = __webpack_require__(355);
+ 'use strict';
- /**
- * Iterates over elements of `collection` invoking `iteratee` for each element.
- * The `iteratee` is bound to `thisArg` and invoked with three arguments:
- * (value, index|key, collection). Iteratee functions may exit iteration early
- * by explicitly returning `false`.
- *
- * **Note:** As with other "Collections" methods, objects with a "length" property
- * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
- * may be used for object iteration.
- *
- * @static
- * @memberOf _
- * @alias each
- * @category Collection
- * @param {Array|Object|string} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @param {*} [thisArg] The `this` binding of `iteratee`.
- * @returns {Array|Object|string} Returns `collection`.
- * @example
- *
- * _([1, 2]).forEach(function(n) {
- * console.log(n);
- * }).value();
- * // => logs each value from left to right and returns the array
- *
- * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
- * console.log(n, key);
- * });
- * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
- */
- var forEach = createForEach(arrayEach, baseEach);
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- module.exports = forEach;
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ var _react = __webpack_require__(2);
-/***/ },
-/* 348 */
-/***/ function(module, exports) {
+ var _react2 = _interopRequireDefault(_react);
- /**
- * A specialized version of `_.forEach` for arrays without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array.length;
+ var _AddNodeInput = __webpack_require__(330);
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
+ var _AddNodeInput2 = _interopRequireDefault(_AddNodeInput);
- module.exports = arrayEach;
+ 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"); } }
-/***/ },
-/* 349 */
-/***/ function(module, exports, __webpack_require__) {
+ 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; }
- var baseForOwn = __webpack_require__(350),
- createBaseEach = __webpack_require__(354);
+ 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; }
- /**
- * The base implementation of `_.forEach` without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Array|Object|string} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array|Object|string} Returns `collection`.
- */
- var baseEach = createBaseEach(baseForOwn);
+ var EditButtons = function (_Component) {
+ _inherits(EditButtons, _Component);
- module.exports = baseEach;
+ function EditButtons() {
+ _classCallCheck(this, EditButtons);
+
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(EditButtons).apply(this, arguments));
+ }
+
+ _createClass(EditButtons, [{
+ key: 'render',
+ value: function render() {
+ return _react2.default.createElement(
+ 'div',
+ { id: 'editButtons', className: 'form-inline buttonGroup' },
+ _react2.default.createElement(_AddNodeInput2.default, {
+ ref: 'addNodeInput',
+ addNode: this.props.addNode,
+ addEdge: this.props.addEdge,
+ closeAddForm: this.props.closeAddForm,
+ source: this.props.source,
+ nodes: this.props.nodes,
+ results: this.props.nodeResults,
+ setNodeResults: this.props.setNodeResults }),
+ _react2.default.createElement(
+ 'button',
+ { className: 'btn btn-sm btn-default', title: 'add adge between nodes', onClick: this.props.toggleAddEdgeForm },
+ 'add edge'
+ ),
+ this.props.showInterlocksButton && _react2.default.createElement(
+ 'button',
+ { id: 'addInterlocksButton', className: 'btn btn-sm btn-default', title: 'search for entities related to both of selected', onClick: this.props.fetchInterlocks },
+ 'add interlocks'
+ )
+ );
+ }
+ }]);
+ return EditButtons;
+ }(_react.Component);
+
+ exports.default = EditButtons;
/***/ },
-/* 350 */
+/* 330 */
/***/ function(module, exports, __webpack_require__) {
- var baseFor = __webpack_require__(351),
- keys = __webpack_require__(316);
+ 'use strict';
- /**
- * The base implementation of `_.forOwn` without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
- function baseForOwn(object, iteratee) {
- return baseFor(object, iteratee, keys);
- }
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- module.exports = baseForOwn;
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ var _react = __webpack_require__(2);
-/***/ },
-/* 351 */
-/***/ function(module, exports, __webpack_require__) {
+ var _react2 = _interopRequireDefault(_react);
- var createBaseFor = __webpack_require__(352);
+ var _reactDom = __webpack_require__(154);
- /**
- * The base implementation of `baseForIn` and `baseForOwn` which iterates
- * over `object` properties returned by `keysFunc` invoking `iteratee` for
- * each property. Iteratee functions may exit iteration early by explicitly
- * returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
- var baseFor = createBaseFor();
+ var _reactDom2 = _interopRequireDefault(_reactDom);
- module.exports = baseFor;
+ var _BaseComponent2 = __webpack_require__(276);
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
-/***/ },
-/* 352 */
-/***/ function(module, exports, __webpack_require__) {
+ var _AddNodeResult = __webpack_require__(331);
- var toObject = __webpack_require__(353);
+ var _AddNodeResult2 = _interopRequireDefault(_AddNodeResult);
- /**
- * Creates a base function for `_.forIn` or `_.forInRight`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var iterable = toObject(object),
- props = keysFunc(object),
- length = props.length,
- index = fromRight ? length : -1;
+ var _reactHotkeys = __webpack_require__(319);
- while ((fromRight ? index-- : ++index < length)) {
- var key = props[index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- module.exports = createBaseFor;
+ 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; }
-/***/ },
-/* 353 */
-/***/ function(module, exports, __webpack_require__) {
+ 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 isObject = __webpack_require__(320);
+ var AddNodeInput = function (_BaseComponent) {
+ _inherits(AddNodeInput, _BaseComponent);
- /**
- * Converts `value` to an object if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Object} Returns the object.
- */
- function toObject(value) {
- return isObject(value) ? value : Object(value);
- }
+ function AddNodeInput(props) {
+ _classCallCheck(this, AddNodeInput);
- module.exports = toObject;
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddNodeInput).call(this, props));
+ _this.bindAll('_handleSubmit', '_handleSearch');
+ return _this;
+ }
-/***/ },
-/* 354 */
-/***/ function(module, exports, __webpack_require__) {
+ _createClass(AddNodeInput, [{
+ key: 'render',
+ value: function render() {
+ var _this2 = this;
- var getLength = __webpack_require__(323),
- isLength = __webpack_require__(325),
- toObject = __webpack_require__(353);
+ // filter existing nodes out of results
+ var results = this.props.results.filter(function (node) {
+ return !_this2.props.nodes[node.id];
+ });
- /**
- * Creates a `baseEach` or `baseEachRight` function.
- *
- * @private
- * @param {Function} eachFunc The function to iterate over a collection.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseEach(eachFunc, fromRight) {
- return function(collection, iteratee) {
- var length = collection ? getLength(collection) : 0;
- if (!isLength(length)) {
- return eachFunc(collection, iteratee);
+ var keyMap = {
+ 'esc': 'esc'
+ };
+
+ var keyHandlers = {
+ 'esc': function esc() {
+ return _this2.clear();
+ }
+ };
+
+ return _react2.default.createElement(
+ 'div',
+ { id: 'addNodeInput' },
+ _react2.default.createElement(
+ _reactHotkeys.HotKeys,
+ { keyMap: keyMap, handlers: keyHandlers },
+ _react2.default.createElement(
+ 'form',
+ { onSubmit: this._handleSubmit },
+ _react2.default.createElement('input', { type: 'text', className: 'form-control input-sm', title: 'add new node', placeholder: 'add node', ref: 'name', onChange: this._handleSearch }),
+ _react2.default.createElement('br', null),
+ this.props.source ? _react2.default.createElement(
+ 'ul',
+ { className: 'addNodeResults dropdown-menu', style: { display: results.length > 0 ? "block" : "none" }, ref: 'results' },
+ results.map(function (node, i) {
+ return _react2.default.createElement(_AddNodeResult2.default, {
+ key: node.id,
+ node: node,
+ source: _this2.props.source,
+ nodes: _this2.props.nodes,
+ addNode: _this2.props.addNode,
+ addEdge: _this2.props.addEdge,
+ clearResults: function clearResults() {
+ return _this2.clear();
+ } });
+ })
+ ) : null
+ )
+ )
+ );
}
- var index = fromRight ? length : -1,
- iterable = toObject(collection);
+ }, {
+ key: 'componentWillUnmount',
+ value: function componentWillUnmount() {
+ window.clearTimeout(this.timeout);
+ }
+ }, {
+ key: 'clear',
+ value: function clear() {
+ this.refs.name.value = '';
+ this.refs.name.blur();
+ this.props.setNodeResults([]);
+ }
+ }, {
+ key: '_handleSubmit',
+ value: function _handleSubmit(e) {
+ var name = this.refs.name.value.trim();
+ this.props.addNode({ display: { name: name } });
+ this.clear();
+ this.props.closeAddForm();
+ e.preventDefault();
+ }
+ }, {
+ key: '_handleSearch',
+ value: function _handleSearch() {
+ var _this3 = this;
- while ((fromRight ? index-- : ++index < length)) {
- if (iteratee(iterable[index], index, iterable) === false) {
- break;
+ // text and source required for search
+ if (this.props.source) {
+ (function () {
+ var that = _this3;
+
+ // cancel previously queued search
+ window.clearTimeout(_this3.timeout);
+
+ // queue new search
+ _this3.timeout = setTimeout(function () {
+ var query = that.refs.name.value.trim();
+
+ if (query) {
+ that.props.source.findNodes(query, function (nodes) {
+ return that._addResults(nodes);
+ });
+ } else {
+ _this3.setState({ results: [] });
+ }
+ }, 200);
+ })();
}
}
- return collection;
- };
- }
+ }, {
+ key: '_addResults',
+ value: function _addResults(nodes) {
+ this.props.setNodeResults(nodes);
+ }
+ }]);
- module.exports = createBaseEach;
+ return AddNodeInput;
+ }(_BaseComponent3.default);
+ exports.default = AddNodeInput;
/***/ },
-/* 355 */
+/* 331 */
/***/ function(module, exports, __webpack_require__) {
- var bindCallback = __webpack_require__(334),
- isArray = __webpack_require__(328);
+ 'use strict';
- /**
- * Creates a function for `_.forEach` or `_.forEachRight`.
- *
- * @private
- * @param {Function} arrayFunc The function to iterate over an array.
- * @param {Function} eachFunc The function to iterate over a collection.
- * @returns {Function} Returns the new each function.
- */
- function createForEach(arrayFunc, eachFunc) {
- return function(collection, iteratee, thisArg) {
- return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
- ? arrayFunc(collection, iteratee)
- : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
- };
- }
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- module.exports = createForEach;
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ var _react = __webpack_require__(2);
-/***/ },
-/* 356 */
-/***/ function(module, exports, __webpack_require__) {
+ var _react2 = _interopRequireDefault(_react);
- var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */
- /**
- * Copyright 2015 Craig Campbell
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Mousetrap is a simple keyboard shortcut library for Javascript with
- * no external dependencies
- *
- * @version 1.5.3
- * @url craig.is/killing/mice
- */
- (function(window, document, undefined) {
+ var _BaseComponent2 = __webpack_require__(276);
- /**
- * mapping of special keycodes to their corresponding keys
- *
- * everything in this dictionary cannot use keypress events
- * so it has to be here to map to the correct keycodes for
- * keyup/keydown events
- *
- * @type {Object}
- */
- var _MAP = {
- 8: 'backspace',
- 9: 'tab',
- 13: 'enter',
- 16: 'shift',
- 17: 'ctrl',
- 18: 'alt',
- 20: 'capslock',
- 27: 'esc',
- 32: 'space',
- 33: 'pageup',
- 34: 'pagedown',
- 35: 'end',
- 36: 'home',
- 37: 'left',
- 38: 'up',
- 39: 'right',
- 40: 'down',
- 45: 'ins',
- 46: 'del',
- 91: 'meta',
- 93: 'meta',
- 224: 'meta'
- };
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- /**
- * mapping for special characters so they can support
- *
- * this dictionary is only used incase you want to bind a
- * keyup or keydown event to one of these keys
- *
- * @type {Object}
- */
- var _KEYCODE_MAP = {
- 106: '*',
- 107: '+',
- 109: '-',
- 110: '.',
- 111 : '/',
- 186: ';',
- 187: '=',
- 188: ',',
- 189: '-',
- 190: '.',
- 191: '/',
- 192: '`',
- 219: '[',
- 220: '\\',
- 221: ']',
- 222: '\''
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /**
- * this is a mapping of keys that require shift on a US keypad
- * back to the non shift equivelents
- *
- * this is so you can use keyup events with these keys
- *
- * note that this will only work reliably on US keyboards
- *
- * @type {Object}
- */
- var _SHIFT_MAP = {
- '~': '`',
- '!': '1',
- '@': '2',
- '#': '3',
- '$': '4',
- '%': '5',
- '^': '6',
- '&': '7',
- '*': '8',
- '(': '9',
- ')': '0',
- '_': '-',
- '+': '=',
- ':': ';',
- '\"': '\'',
- '<': ',',
- '>': '.',
- '?': '/',
- '|': '\\'
- };
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * this is a list of special strings you can use to map
- * to modifier keys when you specify your keyboard shortcuts
- *
- * @type {Object}
- */
- var _SPECIAL_ALIASES = {
- 'option': 'alt',
- 'command': 'meta',
- 'return': 'enter',
- 'escape': 'esc',
- 'plus': '+',
- 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
- };
+ 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; }
- /**
- * variable to store the flipped version of _MAP from above
- * needed to check if we should use keypress or not when no action
- * is specified
- *
- * @type {Object|undefined}
- */
- var _REVERSE_MAP;
+ 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; }
- /**
- * loop through the f keys, f1 to f19 and add them to the map
- * programatically
- */
- for (var i = 1; i < 20; ++i) {
- _MAP[111 + i] = 'f' + i;
- }
+ var AddNodeResult = function (_BaseComponent) {
+ _inherits(AddNodeResult, _BaseComponent);
- /**
- * loop through to map numbers on the numeric keypad
- */
- for (i = 0; i <= 9; ++i) {
- _MAP[i + 96] = i;
- }
+ function AddNodeResult(props) {
+ _classCallCheck(this, AddNodeResult);
- /**
- * cross browser add event method
- *
- * @param {Element|HTMLDocument} object
- * @param {string} type
- * @param {Function} callback
- * @returns void
- */
- function _addEvent(object, type, callback) {
- if (object.addEventListener) {
- object.addEventListener(type, callback, false);
- return;
- }
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddNodeResult).call(this, props));
- object.attachEvent('on' + type, callback);
+ _this.bindAll('_handleClick');
+ return _this;
+ }
+
+ _createClass(AddNodeResult, [{
+ key: 'render',
+ value: function render() {
+ return _react2.default.createElement(
+ 'li',
+ { className: 'addNodeResult' },
+ _react2.default.createElement(
+ 'a',
+ { onClick: this._handleClick },
+ this.props.node.display.name
+ )
+ );
}
+ }, {
+ key: '_handleClick',
+ value: function _handleClick(e) {
+ var _this2 = this;
- /**
- * takes the event and returns the key character
- *
- * @param {Event} e
- * @return {string}
- */
- function _characterFromEvent(e) {
+ var _props = this.props;
+ var source = _props.source;
+ var node = _props.node;
+ var nodes = _props.nodes;
- // for keypress events we should return the character as is
- if (e.type == 'keypress') {
- var character = String.fromCharCode(e.which);
- // if the shift key is not pressed then it is safe to assume
- // that we want the character to be lowercase. this means if
- // you accidentally have caps lock on then your key bindings
- // will continue to work
- //
- // the only side effect that might not be desired is if you
- // bind something like 'A' cause you want to trigger an
- // event when capital A is pressed caps lock will no longer
- // trigger the event. shift+a will though.
- if (!e.shiftKey) {
- character = character.toLowerCase();
- }
-
- return character;
- }
-
- // for non keypress events the special maps are needed
- if (_MAP[e.which]) {
- return _MAP[e.which];
- }
-
- if (_KEYCODE_MAP[e.which]) {
- return _KEYCODE_MAP[e.which];
- }
+ if (source) {
+ var nodeIds = Object.keys(nodes);
- // if it is not in the special map
+ var callback = function callback(data) {
+ _this2.props.addNode(data.node);
+ data.edges.forEach(function (edge) {
+ return _this2.props.addEdge(edge);
+ });
+ _this2.props.clearResults();
+ };
- // with keydown and keyup events the character seems to always
- // come in as an uppercase character whether you are pressing shift
- // or not. we should make sure it is always lowercase for comparisons
- return String.fromCharCode(e.which).toLowerCase();
+ source.getNodeWithEdges(node.id, nodeIds, callback);
+ }
}
+ }]);
- /**
- * checks if two arrays are equal
- *
- * @param {Array} modifiers1
- * @param {Array} modifiers2
- * @returns {boolean}
- */
- function _modifiersMatch(modifiers1, modifiers2) {
- return modifiers1.sort().join(',') === modifiers2.sort().join(',');
- }
+ return AddNodeResult;
+ }(_BaseComponent3.default);
- /**
- * takes a key event and figures out what the modifiers are
- *
- * @param {Event} e
- * @returns {Array}
- */
- function _eventModifiers(e) {
- var modifiers = [];
+ exports.default = AddNodeResult;
- if (e.shiftKey) {
- modifiers.push('shift');
- }
+/***/ },
+/* 332 */
+/***/ function(module, exports, __webpack_require__) {
- if (e.altKey) {
- modifiers.push('alt');
- }
+ 'use strict';
- if (e.ctrlKey) {
- modifiers.push('ctrl');
- }
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- if (e.metaKey) {
- modifiers.push('meta');
- }
+ 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; }; }();
- return modifiers;
- }
+ var _react = __webpack_require__(2);
- /**
- * prevents default for this event
- *
- * @param {Event} e
- * @returns void
- */
- function _preventDefault(e) {
- if (e.preventDefault) {
- e.preventDefault();
- return;
- }
+ var _react2 = _interopRequireDefault(_react);
- e.returnValue = false;
- }
+ var _BaseComponent2 = __webpack_require__(276);
- /**
- * stops propogation for this event
- *
- * @param {Event} e
- * @returns void
- */
- function _stopPropagation(e) {
- if (e.stopPropagation) {
- e.stopPropagation();
- return;
- }
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- e.cancelBubble = true;
- }
+ var _values = __webpack_require__(252);
- /**
- * determines if the keycode specified is a modifier key or not
- *
- * @param {string} key
- * @returns {boolean}
- */
- function _isModifier(key) {
- return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
- }
+ var _values2 = _interopRequireDefault(_values);
- /**
- * reverses the map lookup so that we can look for specific keys
- * to see what can and can't use keypress
- *
- * @return {Object}
- */
- function _getReverseMap() {
- if (!_REVERSE_MAP) {
- _REVERSE_MAP = {};
- for (var key in _MAP) {
+ var _sortBy = __webpack_require__(333);
- // pull out the numeric keypad from here cause keypress should
- // be able to detect the keys from the character
- if (key > 95 && key < 112) {
- continue;
- }
+ var _sortBy2 = _interopRequireDefault(_sortBy);
- if (_MAP.hasOwnProperty(key)) {
- _REVERSE_MAP[_MAP[key]] = key;
- }
- }
- }
- return _REVERSE_MAP;
- }
+ var _reactHotkeys = __webpack_require__(319);
- /**
- * picks the best action based on the key combination
- *
- * @param {string} key - character for key
- * @param {Array} modifiers
- * @param {string=} action passed in
- */
- function _pickBestAction(key, modifiers, action) {
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // if no action was picked in we should try to pick the one
- // that we think would work best for this key
- if (!action) {
- action = _getReverseMap()[key] ? 'keydown' : 'keypress';
- }
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- // modifier keys don't work as expected with keypress,
- // switch to keydown
- if (action == 'keypress' && modifiers.length) {
- action = 'keydown';
- }
+ 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; }
- return action;
- }
+ 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; }
- /**
- * Converts from a string key combination to an array
- *
- * @param {string} combination like "command+shift+l"
- * @return {Array}
- */
- function _keysFromString(combination) {
- if (combination === '+') {
- return ['+'];
- }
+ var AddEdgeForm = function (_BaseComponent) {
+ _inherits(AddEdgeForm, _BaseComponent);
- combination = combination.replace(/\+{2}/g, '+plus');
- return combination.split('+');
- }
+ function AddEdgeForm(props) {
+ _classCallCheck(this, AddEdgeForm);
- /**
- * Gets info for a specific key combination
- *
- * @param {string} combination key combination ("command+s" or "a" or "*")
- * @param {string=} action
- * @returns {Object}
- */
- function _getKeyInfo(combination, action) {
- var keys;
- var key;
- var i;
- var modifiers = [];
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddEdgeForm).call(this, props));
- // take the keys from this pattern and figure out what the actual
- // pattern is all about
- keys = _keysFromString(combination);
+ _this.bindAll('_handleSubmit');
+ return _this;
+ }
- for (i = 0; i < keys.length; ++i) {
- key = keys[i];
+ _createClass(AddEdgeForm, [{
+ key: 'render',
+ value: function render() {
+ var _this2 = this;
- // normalize key names
- if (_SPECIAL_ALIASES[key]) {
- key = _SPECIAL_ALIASES[key];
- }
+ var node1Id = void 0,
+ node2Id = void 0;
- // if this is not a keypress event then we should
- // be smart about using shift keys
- // this will only work for US keyboards however
- if (action && action != 'keypress' && _SHIFT_MAP[key]) {
- key = _SHIFT_MAP[key];
- modifiers.push('shift');
- }
+ if (Array.isArray(this.props.data) && this.props.data.length == 2) {
+ node1Id = this.props.data[0].id;
+ node2Id = this.props.data[1].id;
+ } else {
+ node1Id = this.props.data ? this.props.data.id : null;
+ node2Id = null;
+ }
- // if this key is a modifier then add it to the list of modifiers
- if (_isModifier(key)) {
- modifiers.push(key);
- }
+ var keyMap = {
+ 'altN': ['alt+n', 'ctrl+n'],
+ 'esc': 'esc'
+ };
+
+ var keyHandlers = {
+ 'altN': function altN() {
+ return _this2.props.closeAddForm();
+ },
+ 'esc': function esc() {
+ return _this2._clear();
}
+ };
- // depending on what the key combination is
- // we will try to pick the best event for it
- action = _pickBestAction(key, modifiers, action);
+ var nodes = (0, _sortBy2.default)((0, _values2.default)(this.props.nodes), function (node) {
+ return node.display.name;
+ });
- return {
- key: key,
- modifiers: modifiers,
- action: action
- };
+ return _react2.default.createElement(
+ 'div',
+ { id: 'addEdgeForm', className: 'editForm' },
+ _react2.default.createElement(
+ _reactHotkeys.HotKeys,
+ { keyMap: keyMap, handlers: keyHandlers },
+ _react2.default.createElement(
+ 'form',
+ { onSubmit: this._handleSubmit },
+ _react2.default.createElement(
+ 'select',
+ { defaultValue: node1Id, className: 'form-control input-sm', ref: 'node1Id' },
+ _react2.default.createElement(
+ 'option',
+ { value: '' },
+ 'Node 1'
+ ),
+ nodes.map(function (node, i) {
+ return _react2.default.createElement(
+ 'option',
+ { key: node.id, value: node.id },
+ node.display.name
+ );
+ })
+ ),
+ _react2.default.createElement(
+ 'select',
+ { defaultValue: node2Id, className: 'form-control input-sm', ref: 'node2Id' },
+ _react2.default.createElement(
+ 'option',
+ { value: '' },
+ 'Node 2'
+ ),
+ nodes.map(function (node, i) {
+ return _react2.default.createElement(
+ 'option',
+ { key: node.id, value: node.id },
+ node.display.name
+ );
+ })
+ ),
+ _react2.default.createElement('input', { type: 'text', placeholder: 'label', className: 'form-control input-sm', ref: 'label' })
+ )
+ )
+ );
}
+ }, {
+ key: '_handleSubmit',
+ value: function _handleSubmit(e) {
+ var node1Id = this.refs.node1Id.value;
+ var node2Id = this.refs.node2Id.value;
+ var label = this.refs.label.value.trim();
- function _belongsTo(element, ancestor) {
- if (element === null || element === document) {
- return false;
- }
-
- if (element === ancestor) {
- return true;
- }
+ if (node1Id && node2Id && label) {
+ this.props.addEdge({ node1_id: node1Id, node2_id: node2Id, display: { label: label } });
+ this._clear();
+ this.props.closeAddForm();
+ }
- return _belongsTo(element.parentNode, ancestor);
+ e.preventDefault();
}
+ }, {
+ key: '_clear',
+ value: function _clear() {
+ this.refs.node1Id.value = '';
+ this.refs.node2Id.value = '';
+ this.refs.label.value = '';
+ }
+ }]);
- function Mousetrap(targetElement) {
- var self = this;
-
- targetElement = targetElement || document;
+ return AddEdgeForm;
+ }(_BaseComponent3.default);
- if (!(self instanceof Mousetrap)) {
- return new Mousetrap(targetElement);
- }
+ exports.default = AddEdgeForm;
- /**
- * element to attach key events to
- *
- * @type {Element}
- */
- self.target = targetElement;
+/***/ },
+/* 333 */
+/***/ function(module, exports, __webpack_require__) {
- /**
- * a list of all the callbacks setup via Mousetrap.bind()
- *
- * @type {Object}
- */
- self._callbacks = {};
+ var baseCallback = __webpack_require__(291),
+ baseMap = __webpack_require__(334),
+ baseSortBy = __webpack_require__(335),
+ compareAscending = __webpack_require__(336),
+ isIterateeCall = __webpack_require__(219);
- /**
- * direct map of string combinations to callbacks used for trigger()
- *
- * @type {Object}
- */
- self._directMap = {};
+ /**
+ * Creates an array of elements, sorted in ascending order by the results of
+ * running each element in a collection through `iteratee`. This method performs
+ * a stable sort, that is, it preserves the original sort order of equal elements.
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array} Returns the new sorted array.
+ * @example
+ *
+ * _.sortBy([1, 2, 3], function(n) {
+ * return Math.sin(n);
+ * });
+ * // => [3, 1, 2]
+ *
+ * _.sortBy([1, 2, 3], function(n) {
+ * return this.sin(n);
+ * }, Math);
+ * // => [3, 1, 2]
+ *
+ * var users = [
+ * { 'user': 'fred' },
+ * { 'user': 'pebbles' },
+ * { 'user': 'barney' }
+ * ];
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.sortBy(users, 'user'), 'user');
+ * // => ['barney', 'fred', 'pebbles']
+ */
+ function sortBy(collection, iteratee, thisArg) {
+ if (collection == null) {
+ return [];
+ }
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+ iteratee = undefined;
+ }
+ var index = -1;
+ iteratee = baseCallback(iteratee, thisArg, 3);
- /**
- * keeps track of what level each sequence is at since multiple
- * sequences can start out with the same sequence
- *
- * @type {Object}
- */
- var _sequenceLevels = {};
+ var result = baseMap(collection, function(value, key, collection) {
+ return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
+ });
+ return baseSortBy(result, compareAscending);
+ }
- /**
- * variable to store the setTimeout call
- *
- * @type {null|number}
- */
- var _resetTimer;
+ module.exports = sortBy;
- /**
- * temporary state where we will ignore the next keyup
- *
- * @type {boolean|string}
- */
- var _ignoreNextKeyup = false;
- /**
- * temporary state where we will ignore the next keypress
- *
- * @type {boolean}
- */
- var _ignoreNextKeypress = false;
+/***/ },
+/* 334 */
+/***/ function(module, exports, __webpack_require__) {
- /**
- * are we currently inside of a sequence?
- * type of action ("keyup" or "keydown" or "keypress") or false
- *
- * @type {boolean|string}
- */
- var _nextExpectedAction = false;
+ var baseEach = __webpack_require__(242),
+ isArrayLike = __webpack_require__(194);
- /**
- * resets all sequence counters except for the ones passed in
- *
- * @param {Object} doNotReset
- * @returns void
- */
- function _resetSequences(doNotReset) {
- doNotReset = doNotReset || {};
+ /**
+ * The base implementation of `_.map` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function baseMap(collection, iteratee) {
+ var index = -1,
+ result = isArrayLike(collection) ? Array(collection.length) : [];
- var activeSequences = false,
- key;
+ baseEach(collection, function(value, key, collection) {
+ result[++index] = iteratee(value, key, collection);
+ });
+ return result;
+ }
- for (key in _sequenceLevels) {
- if (doNotReset[key]) {
- activeSequences = true;
- continue;
- }
- _sequenceLevels[key] = 0;
- }
+ module.exports = baseMap;
- if (!activeSequences) {
- _nextExpectedAction = false;
- }
- }
- /**
- * finds all callbacks that match based on the keycode, modifiers,
- * and action
- *
- * @param {string} character
- * @param {Array} modifiers
- * @param {Event|Object} e
- * @param {string=} sequenceName - name of the sequence we are looking for
- * @param {string=} combination
- * @param {number=} level
- * @returns {Array}
- */
- function _getMatches(character, modifiers, e, sequenceName, combination, level) {
- var i;
- var callback;
- var matches = [];
- var action = e.type;
+/***/ },
+/* 335 */
+/***/ function(module, exports) {
- // if there are no events related to this keycode
- if (!self._callbacks[character]) {
- return [];
- }
+ /**
+ * The base implementation of `_.sortBy` which uses `comparer` to define
+ * the sort order of `array` and replaces criteria objects with their
+ * corresponding values.
+ *
+ * @private
+ * @param {Array} array The array to sort.
+ * @param {Function} comparer The function to define sort order.
+ * @returns {Array} Returns `array`.
+ */
+ function baseSortBy(array, comparer) {
+ var length = array.length;
- // if a modifier key is coming up on its own we should allow it
- if (action == 'keyup' && _isModifier(character)) {
- modifiers = [character];
- }
+ array.sort(comparer);
+ while (length--) {
+ array[length] = array[length].value;
+ }
+ return array;
+ }
- // loop through all callbacks for the key that was pressed
- // and see if any of them match
- for (i = 0; i < self._callbacks[character].length; ++i) {
- callback = self._callbacks[character][i];
+ module.exports = baseSortBy;
- // if a sequence name is not specified, but this is a sequence at
- // the wrong level then move onto the next match
- if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
- continue;
- }
- // if the action we are looking for doesn't match the action we got
- // then we should keep going
- if (action != callback.action) {
- continue;
- }
+/***/ },
+/* 336 */
+/***/ function(module, exports, __webpack_require__) {
- // if this is a keypress event and the meta key and control key
- // are not pressed that means that we need to only look at the
- // character, otherwise check the modifiers as well
- //
- // chrome will not fire a keypress if meta or control is down
- // safari will fire a keypress if meta or meta+shift is down
- // firefox will fire a keypress if meta or control is down
- if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
+ var baseCompareAscending = __webpack_require__(337);
- // when you bind a combination or sequence a second time it
- // should overwrite the first one. if a sequenceName or
- // combination is specified in this call it does just that
- //
- // @todo make deleting its own method?
- var deleteCombo = !sequenceName && callback.combo == combination;
- var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
- if (deleteCombo || deleteSequence) {
- self._callbacks[character].splice(i, 1);
- }
+ /**
+ * Used by `_.sortBy` to compare transformed elements of a collection and stable
+ * sort them in ascending order.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @returns {number} Returns the sort order indicator for `object`.
+ */
+ function compareAscending(object, other) {
+ return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
+ }
- matches.push(callback);
- }
- }
+ module.exports = compareAscending;
- return matches;
- }
- /**
- * actually calls the callback function
- *
- * if your callback function returns false this will use the jquery
- * convention - prevent default and stop propogation on the event
- *
- * @param {Function} callback
- * @param {Event} e
- * @returns void
- */
- function _fireCallback(callback, e, combo, sequence) {
+/***/ },
+/* 337 */
+/***/ function(module, exports) {
- // if this event should not happen stop here
- if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
- return;
- }
+ /**
+ * The base implementation of `compareAscending` which compares values and
+ * sorts them in ascending order without guaranteeing a stable sort.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {number} Returns the sort order indicator for `value`.
+ */
+ function baseCompareAscending(value, other) {
+ if (value !== other) {
+ var valIsNull = value === null,
+ valIsUndef = value === undefined,
+ valIsReflexive = value === value;
- if (callback(e, combo) === false) {
- _preventDefault(e);
- _stopPropagation(e);
- }
- }
+ var othIsNull = other === null,
+ othIsUndef = other === undefined,
+ othIsReflexive = other === other;
- /**
- * handles a character key event
- *
- * @param {string} character
- * @param {Array} modifiers
- * @param {Event} e
- * @returns void
- */
- self._handleKey = function(character, modifiers, e) {
- var callbacks = _getMatches(character, modifiers, e);
- var i;
- var doNotReset = {};
- var maxLevel = 0;
- var processedSequenceCallback = false;
+ if ((value > other && !othIsNull) || !valIsReflexive ||
+ (valIsNull && !othIsUndef && othIsReflexive) ||
+ (valIsUndef && othIsReflexive)) {
+ return 1;
+ }
+ if ((value < other && !valIsNull) || !othIsReflexive ||
+ (othIsNull && !valIsUndef && valIsReflexive) ||
+ (othIsUndef && valIsReflexive)) {
+ return -1;
+ }
+ }
+ return 0;
+ }
- // Calculate the maxLevel for sequences so we can only execute the longest callback sequence
- for (i = 0; i < callbacks.length; ++i) {
- if (callbacks[i].seq) {
- maxLevel = Math.max(maxLevel, callbacks[i].level);
- }
- }
+ module.exports = baseCompareAscending;
- // loop through matching callbacks for this key event
- for (i = 0; i < callbacks.length; ++i) {
- // fire for all sequence callbacks
- // this is because if for example you have multiple sequences
- // bound such as "g i" and "g t" they both need to fire the
- // callback for matching g cause otherwise you can only ever
- // match the first one
- if (callbacks[i].seq) {
+/***/ },
+/* 338 */
+/***/ function(module, exports, __webpack_require__) {
- // only fire callbacks for the maxLevel to prevent
- // subsequences from also firing
- //
- // for example 'a option b' should not cause 'option b' to fire
- // even though 'option b' is part of the other sequence
- //
- // any sequences that do not match here will be discarded
- // below by the _resetSequences call
- if (callbacks[i].level != maxLevel) {
- continue;
- }
+ 'use strict';
- processedSequenceCallback = true;
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- // keep a list of which sequences were matches for later
- doNotReset[callbacks[i].seq] = 1;
- _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
- continue;
- }
+ 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; }; }();
- // if there were no sequence matches but we are still here
- // that means this is a regular match so we should fire that
- if (!processedSequenceCallback) {
- _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
- }
- }
+ var _react = __webpack_require__(2);
- // if the key you pressed matches the type of sequence without
- // being a modifier (ie "keyup" or "keypress") then we should
- // reset all sequences that were not matched by this event
- //
- // this is so, for example, if you have the sequence "h a t" and you
- // type "h e a r t" it does not match. in this case the "e" will
- // cause the sequence to reset
- //
- // modifier keys are ignored because you can have a sequence
- // that contains modifiers such as "enter ctrl+space" and in most
- // cases the modifier key will be pressed before the next key
- //
- // also if you have a sequence such as "ctrl+b a" then pressing the
- // "b" key will trigger a "keypress" and a "keydown"
- //
- // the "keydown" is expected when there is a modifier, but the
- // "keypress" ends up matching the _nextExpectedAction since it occurs
- // after and that causes the sequence to reset
- //
- // we ignore keypresses in a sequence that directly follow a keydown
- // for the same character
- var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
- if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
- _resetSequences(doNotReset);
- }
+ var _react2 = _interopRequireDefault(_react);
- _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
- };
+ var _BaseComponent2 = __webpack_require__(276);
- /**
- * handles a keydown event
- *
- * @param {Event} e
- * @returns void
- */
- function _handleKeyEvent(e) {
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- // normalize e.which for key events
- // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
- if (typeof e.which !== 'number') {
- e.which = e.keyCode;
- }
+ var _reactHotkeys = __webpack_require__(319);
- var character = _characterFromEvent(e);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // no character found then stop
- if (!character) {
- return;
- }
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- // need to use === for the character check because the character can be 0
- if (e.type == 'keyup' && _ignoreNextKeyup === character) {
- _ignoreNextKeyup = false;
- return;
- }
+ 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; }
- self.handleKey(character, _eventModifiers(e), e);
- }
+ 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; }
- /**
- * called to set a 1 second timeout on the specified sequence
- *
- * this is so after each key press in the sequence you have 1 second
- * to press the next key before you have to start over
- *
- * @returns void
- */
- function _resetSequenceTimer() {
- clearTimeout(_resetTimer);
- _resetTimer = setTimeout(_resetSequences, 1000);
- }
+ var AddCaptionForm = function (_BaseComponent) {
+ _inherits(AddCaptionForm, _BaseComponent);
- /**
- * binds a key sequence to an event
- *
- * @param {string} combo - combo specified in bind call
- * @param {Array} keys
- * @param {Function} callback
- * @param {string=} action
- * @returns void
- */
- function _bindSequence(combo, keys, callback, action) {
+ function AddCaptionForm(props) {
+ _classCallCheck(this, AddCaptionForm);
- // start off by adding a sequence level record for this combination
- // and setting the level to 0
- _sequenceLevels[combo] = 0;
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddCaptionForm).call(this, props));
- /**
- * callback to increase the sequence level for this sequence and reset
- * all other sequences that were active
- *
- * @param {string} nextAction
- * @returns {Function}
- */
- function _increaseSequence(nextAction) {
- return function() {
- _nextExpectedAction = nextAction;
- ++_sequenceLevels[combo];
- _resetSequenceTimer();
- };
- }
+ _this.bindAll('_handleSubmit', '_handleScaleChange');
- /**
- * wraps the specified callback inside of another function in order
- * to reset all sequence counters as soon as this sequence is done
- *
- * @param {Event} e
- * @returns void
- */
- function _callbackAndReset(e) {
- _fireCallback(callback, e, combo);
+ _this.state = {
+ scaleValue: 1
+ };
+ return _this;
+ }
- // we should ignore the next key up if the action is key down
- // or keypress. this is so if you finish a sequence and
- // release the key the final key will not trigger a keyup
- if (action !== 'keyup') {
- _ignoreNextKeyup = _characterFromEvent(e);
- }
+ _createClass(AddCaptionForm, [{
+ key: 'render',
+ value: function render() {
- // weird race condition if a sequence ends with the key
- // another sequence begins with
- setTimeout(_resetSequences, 10);
- }
+ var scales = [[null, "Scale"], [1, "1x"], [1.25, "1.25x"], [1.5, "1.5x"], [2, "2x"], [2.5, "2.5x"], [3, "3x"], [4, "4x"], [5, "5x"]];
- // loop through keys one at a time and bind the appropriate callback
- // function. for any key leading up to the final one it should
- // increase the sequence. after the final, it should reset all sequences
- //
- // if an action is specified in the original bind call then that will
- // be used throughout. otherwise we will pass the action that the
- // next key in the sequence should match. this allows a sequence
- // to mix and match keypress and keydown events depending on which
- // ones are better suited to the key provided
- for (var i = 0; i < keys.length; ++i) {
- var isFinal = i + 1 === keys.length;
- var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
- _bindSingle(keys[i], wrappedCallback, action, combo, i);
- }
- }
+ return _react2.default.createElement(
+ 'div',
+ { id: 'addCaption', className: 'form-inline buttonGroup' },
+ _react2.default.createElement(
+ 'form',
+ { onSubmit: this._handleSubmit },
+ _react2.default.createElement('input', { type: 'text', className: 'form-control input-sm', title: 'add caption', placeholder: 'add caption', ref: 'text' }),
+ ' ',
+ _react2.default.createElement(
+ 'select',
+ {
+ title: 'text size for new caption',
+ value: this.state.scale,
+ className: 'form-control input-sm',
+ ref: 'scale',
+ onChange: this._handleScaleChange },
+ scales.map(function (scale, i) {
+ return _react2.default.createElement(
+ 'option',
+ { key: scale[1], value: scale[0] },
+ scale[1]
+ );
+ })
+ )
+ )
+ );
+ }
+ }, {
+ key: 'componentDidMount',
+ value: function componentDidMount() {
+ var _this2 = this;
- /**
- * binds a single keyboard combination
- *
- * @param {string} combination
- * @param {Function} callback
- * @param {string=} action
- * @param {string=} sequenceName - name of sequence if part of sequence
- * @param {number=} level - what part of the sequence the command is
- * @returns void
- */
- function _bindSingle(combination, callback, action, sequenceName, level) {
+ // need to wait a moment before focusing so that alt+c doesn't end up in the input
+ setTimeout(function () {
+ return _this2.refs.text.focus();
+ }, 50);
+ }
+ }, {
+ key: '_handleScaleChange',
+ value: function _handleScaleChange() {
+ this.setState({ scaleValue: this.refs.scale.value });
+ }
+ }, {
+ key: '_handleSubmit',
+ value: function _handleSubmit(e) {
+ var text = this.refs.text.value.trim();
+ var scale = this.state.scaleValue;
- // store a direct mapped reference for use with Mousetrap.trigger
- self._directMap[combination + ':' + action] = callback;
+ this.props.addCaption({ display: { text: text, scale: scale } });
+ this._clear();
+ e.preventDefault();
+ }
+ }, {
+ key: '_clear',
+ value: function _clear() {
+ this.refs.text.value = '';
+ this.refs.scale.value = 1;
+ }
+ }]);
- // make sure multiple spaces in a row become a single space
- combination = combination.replace(/\s+/g, ' ');
+ return AddCaptionForm;
+ }(_BaseComponent3.default);
- var sequence = combination.split(' ');
- var info;
+ exports.default = AddCaptionForm;
- // if this pattern is a sequence of keys then run through this method
- // to reprocess each pattern one key at a time
- if (sequence.length > 1) {
- _bindSequence(combination, sequence, callback, action);
- return;
- }
+/***/ },
+/* 339 */
+/***/ function(module, exports, __webpack_require__) {
- info = _getKeyInfo(combination, action);
+ 'use strict';
- // make sure to initialize array if this is the first time
- // a callback is added for this key
- self._callbacks[info.key] = self._callbacks[info.key] || [];
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- // remove an existing match if there is one
- _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
+ 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; }; }();
- // add this call back to the array
- // if it is a sequence put it at the beginning
- // if not put it at the end
- //
- // this is important because the way these are processed expects
- // the sequence ones to come first
- self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
- callback: callback,
- modifiers: info.modifiers,
- action: info.action,
- seq: sequenceName,
- level: level,
- combo: combination
- });
- }
+ var _react = __webpack_require__(2);
- /**
- * binds multiple combinations to the same callback
- *
- * @param {Array} combinations
- * @param {Function} callback
- * @param {string|undefined} action
- * @returns void
- */
- self._bindMultiple = function(combinations, callback, action) {
- for (var i = 0; i < combinations.length; ++i) {
- _bindSingle(combinations[i], callback, action);
- }
- };
+ var _react2 = _interopRequireDefault(_react);
- // start!
- _addEvent(targetElement, 'keypress', _handleKeyEvent);
- _addEvent(targetElement, 'keydown', _handleKeyEvent);
- _addEvent(targetElement, 'keyup', _handleKeyEvent);
- }
+ var _BaseComponent2 = __webpack_require__(276);
- /**
- * binds an event to mousetrap
- *
- * can be a single key, a combination of keys separated with +,
- * an array of keys, or a sequence of keys separated by spaces
- *
- * be sure to list the modifier keys first to make sure that the
- * correct key ends up getting bound (the last key in the pattern)
- *
- * @param {string|Array} keys
- * @param {Function} callback
- * @param {string=} action - 'keypress', 'keydown', or 'keyup'
- * @returns void
- */
- Mousetrap.prototype.bind = function(keys, callback, action) {
- var self = this;
- keys = keys instanceof Array ? keys : [keys];
- self._bindMultiple.call(self, keys, callback, action);
- return self;
- };
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- /**
- * unbinds an event to mousetrap
- *
- * the unbinding sets the callback function of the specified key combo
- * to an empty function and deletes the corresponding key in the
- * _directMap dict.
- *
- * TODO: actually remove this from the _callbacks dictionary instead
- * of binding an empty function
- *
- * the keycombo+action has to be exactly the same as
- * it was defined in the bind method
- *
- * @param {string|Array} keys
- * @param {string} action
- * @returns void
- */
- Mousetrap.prototype.unbind = function(keys, action) {
- var self = this;
- return self.bind.call(self, keys, function() {}, action);
- };
+ var _reactHotkeys = __webpack_require__(319);
- /**
- * triggers an event that has already been bound
- *
- * @param {string} keys
- * @param {string=} action
- * @returns void
- */
- Mousetrap.prototype.trigger = function(keys, action) {
- var self = this;
- if (self._directMap[keys + ':' + action]) {
- self._directMap[keys + ':' + action]({}, keys);
- }
- return self;
- };
+ var _mapKeys = __webpack_require__(340);
- /**
- * resets the library back to its initial state. this is useful
- * if you want to clear out the current keyboard shortcuts and bind
- * new ones - for example if you switch to another page
- *
- * @returns void
- */
- Mousetrap.prototype.reset = function() {
- var self = this;
- self._callbacks = {};
- self._directMap = {};
- return self;
- };
+ var _mapKeys2 = _interopRequireDefault(_mapKeys);
- /**
- * should we stop this event before firing off callbacks
- *
- * @param {Event} e
- * @param {Element} element
- * @return {boolean}
- */
- Mousetrap.prototype.stopCallback = function(e, element) {
- var self = this;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // if the element has the class "mousetrap" then no need to stop
- if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
- return false;
- }
-
- if (_belongsTo(element, self.target)) {
- return false;
- }
-
- // stop for input, select, and textarea
- return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
- };
-
- /**
- * exposes _handleKey publicly so it can be overwritten by extensions
- */
- Mousetrap.prototype.handleKey = function() {
- var self = this;
- return self._handleKey.apply(self, arguments);
- };
-
- /**
- * Init the global mousetrap functions
- *
- * This method is needed to allow the global mousetrap functions to work
- * now that mousetrap is a constructor function.
- */
- Mousetrap.init = function() {
- var documentMousetrap = Mousetrap(document);
- for (var method in documentMousetrap) {
- if (method.charAt(0) !== '_') {
- Mousetrap[method] = (function(method) {
- return function() {
- return documentMousetrap[method].apply(documentMousetrap, arguments);
- };
- } (method));
- }
- }
- };
-
- Mousetrap.init();
-
- // expose mousetrap to the global object
- window.Mousetrap = Mousetrap;
-
- // expose as a common js module
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = Mousetrap;
- }
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- // expose mousetrap as an AMD module
- if (true) {
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
- return Mousetrap;
- }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- }
- }) (window, document);
+ 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; }
-/***/ },
-/* 357 */
-/***/ function(module, exports, __webpack_require__) {
+ var AddConnectedNodesForm = function (_BaseComponent) {
+ _inherits(AddConnectedNodesForm, _BaseComponent);
- "use strict";
+ function AddConnectedNodesForm(props) {
+ _classCallCheck(this, AddConnectedNodesForm);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(AddConnectedNodesForm).call(this, props));
- 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; }; })();
+ _this.bindAll('_handleSubmit');
+ return _this;
+ }
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ _createClass(AddConnectedNodesForm, [{
+ key: 'render',
+ value: function render() {
+ var _this2 = this;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ var keyMap = {
+ 'esc': 'esc'
+ };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+ var keyHandlers = {
+ 'esc': function esc() {
+ return _this2.props.closeAddForm();
+ }
+ };
- 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; }
+ return _react2.default.createElement(
+ 'div',
+ { id: 'addConnectedNodes', className: 'editForm form-inline' },
+ _react2.default.createElement(
+ _reactHotkeys.HotKeys,
+ { keyMap: keyMap, handlers: keyHandlers },
+ _react2.default.createElement('input', {
+ id: 'addConnectedNodesNum',
+ type: 'text',
+ title: 'maximum number of nodes to add',
+ className: 'form-control input-sm',
+ defaultValue: '5',
+ ref: 'num' }),
+ this._renderOptions(),
+ ' ',
+ _react2.default.createElement(
+ 'button',
+ { onClick: this._handleSubmit, title: 'search for given number of nodes', className: 'btn btn-sm btn-default' },
+ 'Add Connections'
+ )
+ )
+ );
+ }
+ }, {
+ key: '_renderOptions',
+ value: function _renderOptions() {
+ var options = this.props.source.getConnectedNodesOptions;
+ return options ? Object.keys(options).map(function (key) {
+ return _react2.default.createElement(
+ 'select',
+ { key: key, title: 'type of connections to search for', className: 'form-control input-sm', ref: key },
+ Object.keys(options[key]).map(function (val) {
+ return _react2.default.createElement(
+ 'option',
+ { key: val, value: val },
+ options[key][val]
+ );
+ })
+ );
+ }) : null;
+ }
+ }, {
+ key: '_handleSubmit',
+ value: function _handleSubmit(e) {
+ var _this3 = this;
- var _react = __webpack_require__(2);
+ var num = parseInt(this.refs.num.value);
+ var nodeId = this.props.data.id;
+ var nodeIds = Object.keys(this.props.graph.nodes);
+ var options = this._options();
- var _react2 = _interopRequireDefault(_react);
+ this.props.source.getConnectedNodes(nodeId, nodeIds, options, function (data) {
+ _this3.props.addSurroundingNodes(nodeId, data.nodes);
- var ZoomButtons = (function (_Component) {
- _inherits(ZoomButtons, _Component);
+ data.edges.forEach(function (edge) {
+ if (!_this3.props.graph.edges[edge.id]) {
+ _this3.props.addEdge(edge);
+ }
+ });
+ });
- function ZoomButtons() {
- _classCallCheck(this, ZoomButtons);
+ e.preventDefault();
+ }
+ }, {
+ key: '_options',
+ value: function _options() {
+ var _this4 = this;
- _get(Object.getPrototypeOf(ZoomButtons.prototype), "constructor", this).apply(this, arguments);
- }
+ return Object.keys(this.refs).reduce(function (result, ref) {
+ result[ref] = _this4.refs[ref].value;
+ return result;
+ }, {});
+ }
+ }, {
+ key: '_clear',
+ value: function _clear() {
+ var _this5 = this;
- _createClass(ZoomButtons, [{
- key: "render",
- value: function render() {
- return _react2["default"].createElement(
- "div",
- { id: "zoomButtons" },
- _react2["default"].createElement(
- "button",
- { id: "zoomIn", onClick: this.props.zoomIn },
- "+"
- ),
- _react2["default"].createElement(
- "button",
- { id: "zoomOut", onClick: this.props.zoomOut },
- "–"
- )
- );
+ this.refs.num.value = "5";
+ Object.keys(this.props.source.getConnectedNodesOptions).forEach(function (key) {
+ _this5.refs[key].value = null;
+ });
}
}]);
- return ZoomButtons;
- })(_react.Component);
+ return AddConnectedNodesForm;
+ }(_BaseComponent3.default);
- exports["default"] = ZoomButtons;
- module.exports = exports["default"];
+ exports.default = AddConnectedNodesForm;
/***/ },
-/* 358 */
+/* 340 */
/***/ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ var createObjectMapper = __webpack_require__(341);
- 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'); } }
+ /**
+ * The opposite of `_.mapValues`; this method creates an object with the
+ * same values as `object` and keys generated by running each own enumerable
+ * property of `object` through `iteratee`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns the new mapped object.
+ * @example
+ *
+ * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
+ * return key + value;
+ * });
+ * // => { 'a1': 1, 'b2': 2 }
+ */
+ var mapKeys = createObjectMapper(true);
- 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; }
+ module.exports = mapKeys;
- var _react = __webpack_require__(2);
- var _react2 = _interopRequireDefault(_react);
+/***/ },
+/* 341 */
+/***/ function(module, exports, __webpack_require__) {
- var _UndoButtons = __webpack_require__(359);
+ var baseCallback = __webpack_require__(291),
+ baseForOwn = __webpack_require__(235);
- var _UndoButtons2 = _interopRequireDefault(_UndoButtons);
+ /**
+ * Creates a function for `_.mapKeys` or `_.mapValues`.
+ *
+ * @private
+ * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
+ * @returns {Function} Returns the new map function.
+ */
+ function createObjectMapper(isMapKeys) {
+ return function(object, iteratee, thisArg) {
+ var result = {};
+ iteratee = baseCallback(iteratee, thisArg, 3);
- var _LayoutButtons = __webpack_require__(360);
+ baseForOwn(object, function(value, key, object) {
+ var mapped = iteratee(value, key, object);
+ key = isMapKeys ? mapped : key;
+ value = isMapKeys ? value : mapped;
+ result[key] = value;
+ });
+ return result;
+ };
+ }
- var _LayoutButtons2 = _interopRequireDefault(_LayoutButtons);
+ module.exports = createObjectMapper;
- var _EditButtons = __webpack_require__(361);
- var _EditButtons2 = _interopRequireDefault(_EditButtons);
+/***/ },
+/* 342 */
+/***/ function(module, exports, __webpack_require__) {
- var _AddEdgeForm = __webpack_require__(364);
+ 'use strict';
- var _AddEdgeForm2 = _interopRequireDefault(_AddEdgeForm);
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
- var _AddCaptionForm = __webpack_require__(370);
+ 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 _AddCaptionForm2 = _interopRequireDefault(_AddCaptionForm);
+ var _react = __webpack_require__(2);
- var _AddConnectedNodesForm = __webpack_require__(371);
+ var _react2 = _interopRequireDefault(_react);
- var _AddConnectedNodesForm2 = _interopRequireDefault(_AddConnectedNodesForm);
+ var _BaseComponent2 = __webpack_require__(276);
- var _UpdateNodeForm = __webpack_require__(374);
+ var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _UpdateNodeForm2 = _interopRequireDefault(_UpdateNodeForm);
+ var _reactHotkeys = __webpack_require__(319);
- var _UpdateEdgeForm = __webpack_require__(432);
+ var _mapKeys = __webpack_require__(340);
- var _UpdateEdgeForm2 = _interopRequireDefault(_UpdateEdgeForm);
+ var _mapKeys2 = _interopRequireDefault(_mapKeys);
- var _UpdateCaptionForm = __webpack_require__(433);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _UpdateCaptionForm2 = _interopRequireDefault(_UpdateCaptionForm);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var _HelpScreen = __webpack_require__(434);
+ 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; }
- var _HelpScreen2 = _interopRequireDefault(_HelpScreen);
+ 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 EditTools = (function (_Component) {
- _inherits(EditTools, _Component);
+ var DeleteSelectedButton = function (_BaseComponent) {
+ _inherits(DeleteSelectedButton, _BaseComponent);
- function EditTools() {
- _classCallCheck(this, EditTools);
+ function DeleteSelectedButton(props) {
+ _classCallCheck(this, DeleteSelectedButton);
- _get(Object.getPrototypeOf(EditTools.prototype), 'constructor', this).apply(this, arguments);
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(DeleteSelectedButton).call(this, props));
}
- _createClass(EditTools, [{
+ _createClass(DeleteSelectedButton, [{
key: 'render',
value: function render() {
- var _props = this.props;
- var graphApi = _props.graphApi;
- var source = _props.source;
- var data = _props.data;
- var graph = _props.graph;
- var addForm = _props.addForm;
- var currentForm = _props.currentForm;
- var helpScreen = _props.helpScreen;
- var clearGraph = _props.clearGraph;
- var closeAddForm = _props.closeAddForm;
- var toggleHelpScreen = _props.toggleHelpScreen;
- var toggleAddEdgeForm = _props.toggleAddEdgeForm;
- var zoomIn = graphApi.zoomIn;
- var zoomOut = graphApi.zoomOut;
- var resetZoom = graphApi.resetZoom;
- var prune = graphApi.prune;
- var circleLayout = graphApi.circleLayout;
- var addNode = graphApi.addNode;
- var addEdge = graphApi.addEdge;
- var addCaption = graphApi.addCaption;
- var addSurroundingNodes = graphApi.addSurroundingNodes;
- var updateNode = graphApi.updateNode;
- var updateEdge = graphApi.updateEdge;
- var updateCaption = graphApi.updateCaption;
- var deselectAll = graphApi.deselectAll;
- var deleteAll = graphApi.deleteAll;
- var getGraph = graphApi.getGraph;
+ var whichClass = this.props.currentForm === "UpdateNodeForm" ? "nodeDelete" : "edgeDelete";
- return _react2['default'].createElement(
+ return _react2.default.createElement(
'div',
- { id: 'editTools' },
- _react2['default'].createElement(
- 'div',
- { id: 'buttons' },
- _react2['default'].createElement(_EditButtons2['default'], {
- ref: 'editButtons',
- addNode: addNode,
- addEdge: addEdge,
- closeAddForm: closeAddForm,
- source: source,
- nodes: graph.nodes,
- nodeResults: this.props.nodeResults,
- setNodeResults: this.props.setNodeResults,
- toggleAddEdgeForm: toggleAddEdgeForm,
- showInterlocksButton: this.props.showInterlocksButton,
- fetchInterlocks: this.props.fetchInterlocks }),
- _react2['default'].createElement(_LayoutButtons2['default'], {
- prune: prune,
- circleLayout: circleLayout,
- clearGraph: clearGraph }),
- _react2['default'].createElement(_UndoButtons2['default'], {
- undo: this.props.undo,
- redo: this.props.redo,
- canUndo: this.props.canUndo,
- canRedo: this.props.canRedo }),
- this.props.hideHelp ? null : _react2['default'].createElement(
- 'button',
- { id: 'helpButton', className: 'btn btn-sm btn-default buttonGroup', onClick: toggleHelpScreen },
- 'help'
- )
- ),
- addForm == 'AddEdgeForm' && _react2['default'].createElement(_AddEdgeForm2['default'], {
- addEdge: addEdge,
- nodes: graph.nodes,
- closeAddForm: closeAddForm,
- data: data }),
- addForm == 'AddCaptionForm' && _react2['default'].createElement(_AddCaptionForm2['default'], {
- addCaption: addCaption,
- closeAddForm: closeAddForm }),
- currentForm == 'UpdateNodeForm' && _react2['default'].createElement(_UpdateNodeForm2['default'], {
- updateNode: updateNode,
- data: data,
- deselect: deselectAll }),
- currentForm == 'UpdateEdgeForm' && _react2['default'].createElement(_UpdateEdgeForm2['default'], {
- updateEdge: updateEdge,
- getGraph: getGraph,
- data: data,
- deselect: deselectAll }),
- currentForm == 'UpdateCaptionForm' && _react2['default'].createElement(_UpdateCaptionForm2['default'], {
- updateCaption: updateCaption,
- data: data,
- deselect: deselectAll }),
- currentForm == 'UpdateNodeForm' && source && source.getConnectedNodes && _react2['default'].createElement(_AddConnectedNodesForm2['default'], {
- data: data,
- source: source,
- closeAddForm: closeAddForm,
- graph: graph,
- addSurroundingNodes: addSurroundingNodes,
- addEdge: addEdge }),
- helpScreen && !this.props.hideHelp ? _react2['default'].createElement(_HelpScreen2['default'], { source: source }) : null
+ {
+ className: "editForm form-inline " + whichClass,
+ id: 'deleteSelected' },
+ _react2.default.createElement(
+ 'button',
+ {
+ className: 'btn btn-sm btn-default',
+ title: 'delete selected',
+ onClick: this.props.doDelete },
+ 'Delete Selected'
+ )
);
}
}]);
- return EditTools;
- })(_react.Component);
+ return DeleteSelectedButton;
+ }(_BaseComponent3.default);
- exports['default'] = EditTools;
- module.exports = exports['default'];
+ exports.default = DeleteSelectedButton;
/***/ },
-/* 359 */
+/* 343 */
/***/ function(module, exports, __webpack_require__) {
- "use strict";
+ '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 _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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ var _react = __webpack_require__(2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ var _react2 = _interopRequireDefault(_react);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+ var _BaseComponent2 = __webpack_require__(276);
- 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 _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _react = __webpack_require__(2);
+ var _ChangeColorInput = __webpack_require__(344);
- var _react2 = _interopRequireDefault(_react);
+ var _ChangeColorInput2 = _interopRequireDefault(_ChangeColorInput);
- var UndoButtons = (function (_Component) {
- _inherits(UndoButtons, _Component);
+ var _reactHotkeys = __webpack_require__(319);
- function UndoButtons() {
- _classCallCheck(this, UndoButtons);
+ var _merge = __webpack_require__(188);
- _get(Object.getPrototypeOf(UndoButtons.prototype), "constructor", this).apply(this, arguments);
- }
+ var _merge2 = _interopRequireDefault(_merge);
- _createClass(UndoButtons, [{
- key: "render",
- value: function render() {
- return _react2["default"].createElement(
- "div",
- { id: "undobuttons", className: "btn-group buttonGroup" },
- _react2["default"].createElement(
- "button",
- { className: "btn btn-sm btn-default", onClick: this.props.undo, disabled: !this.props.canUndo },
- "undo"
- ),
- _react2["default"].createElement(
- "button",
- { className: "btn btn-sm btn-default", onClick: this.props.redo, disabled: !this.props.canRedo },
- "redo"
- )
- );
- }
- }]);
+ var _NodeDisplaySettings = __webpack_require__(279);
- return UndoButtons;
- })(_react.Component);
+ var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
- exports["default"] = UndoButtons;
- module.exports = exports["default"];
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-/***/ },
-/* 360 */
-/***/ function(module, exports, __webpack_require__) {
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- "use strict";
+ 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; }
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
+ 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 _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 UpdateNodeForm = function (_BaseComponent) {
+ _inherits(UpdateNodeForm, _BaseComponent);
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ function UpdateNodeForm() {
+ _classCallCheck(this, UpdateNodeForm);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ return _possibleConstructorReturn(this, Object.getPrototypeOf(UpdateNodeForm).apply(this, arguments));
+ }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+ _createClass(UpdateNodeForm, [{
+ key: 'render',
+ value: function render() {
+ var _this2 = this;
- 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 display = this.props.data.display;
- var _react = __webpack_require__(2);
- var _react2 = _interopRequireDefault(_react);
+ if (!display.color) {
+ display.color = _NodeDisplaySettings2.default.circleColor[display.status];
+ }
- var LayoutButtons = (function (_Component) {
- _inherits(LayoutButtons, _Component);
+ var keyMap = {
+ 'esc': 'esc'
+ };
- function LayoutButtons() {
- _classCallCheck(this, LayoutButtons);
+ var keyHandlers = {
+ 'esc': function esc() {
+ return _this2.props.deselect();
+ }
+ };
- _get(Object.getPrototypeOf(LayoutButtons.prototype), "constructor", this).apply(this, arguments);
- }
+ var scales = [[1, "1x"], [1.5, "1.5x"], [2, "2x"], [3, "3x"]];
- _createClass(LayoutButtons, [{
- key: "render",
- value: function render() {
- return _react2["default"].createElement(
- "div",
- { id: "layoutButtons", className: "btn-group buttonGroup" },
- _react2["default"].createElement(
- "button",
- { className: "btn btn-sm btn-default", onClick: this.props.prune },
- "prune"
- ),
- _react2["default"].createElement(
- "button",
- { className: "btn btn-sm btn-default", onClick: this.props.circleLayout },
- "circle"
- ),
- _react2["default"].createElement(
- "button",
- { className: "btn btn-sm btn-default", onClick: this.props.clearGraph },
- "clear"
+ return _react2.default.createElement(
+ 'div',
+ { className: 'editForm updateForm form-inline' },
+ _react2.default.createElement(
+ _reactHotkeys.HotKeys,
+ { keyMap: keyMap, handlers: keyHandlers },
+ _react2.default.createElement(
+ 'div',
+ null,
+ _react2.default.createElement('input', {
+ type: 'text',
+ title: 'change node title',
+ className: 'form-control input-sm',
+ placeholder: 'name',
+ ref: 'name',
+ value: display.name,
+ onChange: function onChange() {
+ return _this2.apply();
+ } }),
+ ' ',
+ _react2.default.createElement('input', {
+ type: 'text',
+ title: 'input image URL',
+ className: 'form-control input-sm',
+ placeholder: 'image URL',
+ ref: 'image',
+ value: display.image,
+ onChange: function onChange() {
+ return _this2.apply();
+ } }),
+ ' ',
+ _react2.default.createElement(_ChangeColorInput2.default, {
+ ref: 'color',
+ value: display.color,
+ status: display.status,
+ onChange: function onChange(color) {
+ return _this2.apply(color);
+ } }),
+ ' ',
+ _react2.default.createElement(
+ 'select',
+ {
+ title: 'change node size',
+ value: display.scale,
+ className: 'form-control input-sm',
+ ref: 'scale',
+ onChange: function onChange() {
+ return _this2.apply();
+ } },
+ scales.map(function (scale, i) {
+ return _react2.default.createElement(
+ 'option',
+ { key: scale[1], value: scale[0] },
+ scale[1]
+ );
+ })
+ )
+ ),
+ _react2.default.createElement(
+ 'div',
+ null,
+ _react2.default.createElement('input', {
+ id: 'nodeUrlInput',
+ type: 'text',
+ title: 'edit node link',
+ className: 'form-control input-sm',
+ placeholder: 'link URL',
+ ref: 'url',
+ value: display.url,
+ onChange: function onChange() {
+ return _this2.apply();
+ } })
+ )
)
);
}
+ }, {
+ key: 'apply',
+ value: function apply(newColor) {
+ if (this.props.data) {
+ var name = this.refs.name.value;
+ var image = this.refs.image.value.trim();
+ var color = newColor || this.refs.color.state.color;
+ var scale = parseFloat(this.refs.scale.value);
+ var url = this.refs.url.value.trim();
+ this.props.updateNode(this.props.data.id, { display: { name: name, image: image, color: color, scale: scale, url: url } });
+ }
+ }
}]);
- return LayoutButtons;
- })(_react.Component);
+ return UpdateNodeForm;
+ }(_BaseComponent3.default);
- exports["default"] = LayoutButtons;
- module.exports = exports["default"];
+ exports.default = UpdateNodeForm;
/***/ },
-/* 361 */
+/* 344 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ 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 _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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ var _react = __webpack_require__(2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _react2 = _interopRequireDefault(_react);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _BaseComponent2 = __webpack_require__(276);
- 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 _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
- var _react = __webpack_require__(2);
+ var _reactColor = __webpack_require__(345);
- var _react2 = _interopRequireDefault(_react);
+ var _NodeDisplaySettings = __webpack_require__(279);
- var _AddNodeInput = __webpack_require__(362);
+ var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
- var _AddNodeInput2 = _interopRequireDefault(_AddNodeInput);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var EditButtons = (function (_Component) {
- _inherits(EditButtons, _Component);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function EditButtons() {
- _classCallCheck(this, EditButtons);
+ 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; }
- _get(Object.getPrototypeOf(EditButtons.prototype), 'constructor', this).apply(this, arguments);
- }
+ 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; }
- _createClass(EditButtons, [{
- key: 'render',
- value: function render() {
- return _react2['default'].createElement(
+ var ChangeColorInput = function (_BaseComponent) {
+ _inherits(ChangeColorInput, _BaseComponent);
+
+ function ChangeColorInput(props) {
+ _classCallCheck(this, ChangeColorInput);
+
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ChangeColorInput).call(this, props));
+
+ _this.bindAll("handleClick", "handleClose", "handleValueChange", "handleClearClick", "onChange");
+ _this.state = {
+ displayColorPicker: false,
+ color: props.value
+ };
+ return _this;
+ }
+
+ _createClass(ChangeColorInput, [{
+ key: 'handleClick',
+ value: function handleClick() {
+ this.setState({ displayColorPicker: !this.state.displayColorPicker });
+ }
+ }, {
+ key: 'handleClose',
+ value: function handleClose() {
+ this.setState({ displayColorPicker: false });
+ }
+ }, {
+ key: 'handleClearClick',
+ value: function handleClearClick() {
+ this.handleClose();
+ this.onChange(_NodeDisplaySettings2.default.circleColor[this.props.status]);
+ }
+ }, {
+ key: 'handleValueChange',
+ value: function handleValueChange(color) {
+ this.onChange(color.hex);
+ }
+ }, {
+ key: 'onChange',
+ value: function onChange(newColor) {
+ this.setState({ color: newColor });
+ this.props.onChange(newColor);
+ }
+ }, {
+ key: 'render',
+ value: function render() {
+ return _react2.default.createElement(
'div',
- { id: 'editButtons', className: 'form-inline buttonGroup' },
- _react2['default'].createElement(_AddNodeInput2['default'], {
- ref: 'addNodeInput',
- addNode: this.props.addNode,
- addEdge: this.props.addEdge,
- closeAddForm: this.props.closeAddForm,
- source: this.props.source,
- nodes: this.props.nodes,
- results: this.props.nodeResults,
- setNodeResults: this.props.setNodeResults }),
- _react2['default'].createElement(
- 'button',
- { className: 'btn btn-sm btn-default', onClick: this.props.toggleAddEdgeForm },
- 'add edge'
+ { className: 'nodeColorInputWrapper' },
+ _react2.default.createElement(
+ 'div',
+ { className: 'input-sm form-control nodeColorInput' },
+ _react2.default.createElement('div', { className: 'nodeColorInputSwatch', style: { background: this.state.color }, onClick: this.handleClick }),
+ _react2.default.createElement(
+ 'button',
+ { className: 'nodeColorInputClearer', onClick: this.handleClearClick },
+ _react2.default.createElement('span', { className: 'glyphicon glyphicon-remove-sign' })
+ )
),
- this.props.showInterlocksButton && _react2['default'].createElement(
- 'button',
- { id: 'addInterlocksButton', className: 'btn btn-sm btn-default', onClick: this.props.fetchInterlocks },
- 'add interlocks'
+ _react2.default.createElement(
+ 'div',
+ { className: 'nodeColorPickerWrapper' },
+ this.state.displayColorPicker && _react2.default.createElement(
+ 'div',
+ { is: 'popover' },
+ _react2.default.createElement('div', { className: 'nodeColorPickerCover', onClick: this.handleClose }),
+ _react2.default.createElement(_reactColor.CompactPicker, { color: this.state.color, onChange: this.handleValueChange })
+ )
)
);
}
+ }, {
+ key: 'componentWillReceiveProps',
+ value: function componentWillReceiveProps(props) {
+ this.setState({ color: props.value || _NodeDisplaySettings2.default.circleColor[props.status] });
+ }
}]);
- return EditButtons;
- })(_react.Component);
+ return ChangeColorInput;
+ }(_BaseComponent3.default);
- exports['default'] = EditButtons;
- module.exports = exports['default'];
+ exports.default = ChangeColorInput;
+ ;
/***/ },
-/* 362 */
+/* 345 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- Object.defineProperty(exports, '__esModule', {
+ Object.defineProperty(exports, "__esModule", {
value: true
});
+ exports.default = exports.CustomPicker = exports.SwatchesPicker = exports.SliderPicker = exports.SketchPicker = exports.PhotoshopPicker = exports.MaterialPicker = exports.CompactPicker = exports.ChromePicker = undefined;
- 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ var _Chrome = __webpack_require__(346);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ Object.defineProperty(exports, 'ChromePicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Chrome).default;
+ }
+ });
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _Compact = __webpack_require__(382);
- 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; }
+ Object.defineProperty(exports, 'CompactPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Compact).default;
+ }
+ });
- var _react = __webpack_require__(2);
+ var _Material = __webpack_require__(392);
- var _react2 = _interopRequireDefault(_react);
+ Object.defineProperty(exports, 'MaterialPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Material).default;
+ }
+ });
- var _reactDom = __webpack_require__(154);
+ var _Photoshop = __webpack_require__(393);
- var _reactDom2 = _interopRequireDefault(_reactDom);
+ Object.defineProperty(exports, 'PhotoshopPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Photoshop).default;
+ }
+ });
- var _BaseComponent2 = __webpack_require__(267);
+ var _Sketch = __webpack_require__(397);
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ Object.defineProperty(exports, 'SketchPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Sketch).default;
+ }
+ });
- var _AddNodeResult = __webpack_require__(363);
+ var _Slider = __webpack_require__(400);
- var _AddNodeResult2 = _interopRequireDefault(_AddNodeResult);
+ Object.defineProperty(exports, 'SliderPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Slider).default;
+ }
+ });
- var _reactHotkeys = __webpack_require__(310);
+ var _Swatches = __webpack_require__(404);
- var AddNodeInput = (function (_BaseComponent) {
- _inherits(AddNodeInput, _BaseComponent);
+ Object.defineProperty(exports, 'SwatchesPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_Swatches).default;
+ }
+ });
- function AddNodeInput(props) {
- _classCallCheck(this, AddNodeInput);
+ var _ColorWrap = __webpack_require__(375);
- _get(Object.getPrototypeOf(AddNodeInput.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleSubmit', '_handleSearch');
+ Object.defineProperty(exports, 'CustomPicker', {
+ enumerable: true,
+ get: function get() {
+ return _interopRequireDefault(_ColorWrap).default;
}
+ });
- _createClass(AddNodeInput, [{
- key: 'render',
- value: function render() {
- var _this = this;
+ var _Chrome2 = _interopRequireDefault(_Chrome);
- // filter existing nodes out of results
- var results = this.props.results.filter(function (node) {
- return !_this.props.nodes[node.id];
- });
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var keyMap = {
- 'esc': 'esc'
- };
+ exports.default = _Chrome2.default;
- var keyHandlers = {
- 'esc': function esc() {
- return _this.clear();
- }
- };
+/***/ },
+/* 346 */
+/***/ function(module, exports, __webpack_require__) {
- return _react2['default'].createElement(
- 'div',
- { id: 'addNodeInput' },
- _react2['default'].createElement(
- _reactHotkeys.HotKeys,
- { keyMap: keyMap, handlers: keyHandlers },
- _react2['default'].createElement(
- 'form',
- { onSubmit: this._handleSubmit },
- _react2['default'].createElement('input', { type: 'text', className: 'form-control input-sm', placeholder: 'add node', ref: 'name', onChange: this._handleSearch }),
- _react2['default'].createElement('br', null),
- this.props.source ? _react2['default'].createElement(
- 'ul',
- { className: 'addNodeResults dropdown-menu', style: { display: results.length > 0 ? "block" : "none" }, ref: 'results' },
- results.map(function (node, i) {
- return _react2['default'].createElement(_AddNodeResult2['default'], {
- key: node.id,
- node: node,
- source: _this.props.source,
- nodes: _this.props.nodes,
- addNode: _this.props.addNode,
- addEdge: _this.props.addEdge,
- clearResults: function () {
- return _this.clear();
- } });
- })
- ) : null
- )
- )
- );
- }
- }, {
- key: 'componentWillUnmount',
- value: function componentWillUnmount() {
- window.clearTimeout(this.timeout);
- }
- }, {
- key: 'clear',
- value: function clear() {
- this.refs.name.value = '';
- this.refs.name.blur();
- this.props.setNodeResults([]);
- }
- }, {
- key: '_handleSubmit',
- value: function _handleSubmit(e) {
- var name = this.refs.name.value.trim();
- this.props.addNode({ display: { name: name } });
- this.clear();
- this.props.closeAddForm();
- e.preventDefault();
- }
- }, {
- key: '_handleSearch',
- value: function _handleSearch() {
- var _this2 = this;
+ 'use strict';
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports.Chrome = undefined;
- // text and source required for search
- if (this.props.source) {
- (function () {
- var that = _this2;
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- // cancel previously queued search
- window.clearTimeout(_this2.timeout);
+ 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; }; }();
- // queue new search
- _this2.timeout = setTimeout(function () {
- var query = that.refs.name.value.trim();
+ var _react = __webpack_require__(2);
- if (query) {
- that.props.source.findNodes(query, function (nodes) {
- return that._addResults(nodes);
- });
- } else {
- _this2.setState({ results: [] });
- }
- }, 200);
- })();
- }
- }
- }, {
- key: '_addResults',
- value: function _addResults(nodes) {
- this.props.setNodeResults(nodes);
- }
- }]);
+ var _react2 = _interopRequireDefault(_react);
- return AddNodeInput;
- })(_BaseComponent3['default']);
+ var _reactcss = __webpack_require__(347);
- exports['default'] = AddNodeInput;
- module.exports = exports['default'];
+ var _reactcss2 = _interopRequireDefault(_reactcss);
-/***/ },
-/* 363 */
-/***/ function(module, exports, __webpack_require__) {
+ var _common = __webpack_require__(365);
- 'use strict';
+ var _ChromeFields = __webpack_require__(379);
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
+ var _ChromeFields2 = _interopRequireDefault(_ChromeFields);
- 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 _ChromePointer = __webpack_require__(380);
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ var _ChromePointer2 = _interopRequireDefault(_ChromePointer);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ var _ChromePointerCircle = __webpack_require__(381);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ var _ChromePointerCircle2 = _interopRequireDefault(_ChromePointerCircle);
- 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 _reactAddonsShallowCompare = __webpack_require__(367);
- var _react = __webpack_require__(2);
+ var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
- var _react2 = _interopRequireDefault(_react);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _BaseComponent2 = __webpack_require__(267);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ 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; }
- var AddNodeResult = (function (_BaseComponent) {
- _inherits(AddNodeResult, _BaseComponent);
+ 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; }
- function AddNodeResult(props) {
- _classCallCheck(this, AddNodeResult);
+ var Chrome = exports.Chrome = function (_ReactCSS$Component) {
+ _inherits(Chrome, _ReactCSS$Component);
+
+ function Chrome() {
+ var _Object$getPrototypeO;
+
+ var _temp, _this, _ret;
+
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ _classCallCheck(this, Chrome);
- _get(Object.getPrototypeOf(AddNodeResult.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleClick');
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Chrome)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.shouldComponentUpdate = _reactAddonsShallowCompare2.default.bind(_this, _this, arguments[0], arguments[1]), _this.handleChange = function (data) {
+ _this.props.onChange(data);
+ }, _temp), _possibleConstructorReturn(_this, _ret);
}
- _createClass(AddNodeResult, [{
+ _createClass(Chrome, [{
+ key: 'classes',
+ value: function classes() {
+ return {
+ 'default': {
+ picker: {
+ background: '#fff',
+ borderRadius: '2px',
+ boxShadow: '0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)',
+ boxSizing: 'initial',
+ width: '225px',
+ fontFamily: 'Menlo'
+ },
+ saturation: {
+ width: '100%',
+ paddingBottom: '55%',
+ position: 'relative',
+ borderRadius: '2px 2px 0 0',
+ overflow: 'hidden'
+ },
+ Saturation: {
+ radius: '2px 2px 0 0'
+ },
+ body: {
+ padding: '16px 16px 12px'
+ },
+ controls: {
+ display: 'flex'
+ },
+ color: {
+ width: '32px'
+ },
+ swatch: {
+ marginTop: '6px',
+ width: '16px',
+ height: '16px',
+ borderRadius: '8px',
+ position: 'relative',
+ overflow: 'hidden'
+ },
+ active: {
+ Absolute: '0px 0px 0px 0px',
+ borderRadius: '8px',
+ boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.1)',
+ background: 'rgba(' + this.props.rgb.r + ', ' + this.props.rgb.g + ', ' + this.props.rgb.b + ', ' + this.props.rgb.a + ')',
+ zIndex: '2'
+ },
+ toggles: {
+ flex: '1'
+ },
+ hue: {
+ height: '10px',
+ position: 'relative',
+ marginBottom: '8px'
+ },
+ Hue: {
+ radius: '2px'
+ },
+ alpha: {
+ height: '10px',
+ position: 'relative'
+ },
+ Alpha: {
+ radius: '2px'
+ }
+ },
+ 'disableAlpha': {
+ color: {
+ width: '22px'
+ },
+ alpha: {
+ display: 'none'
+ },
+ hue: {
+ marginBottom: '0px'
+ },
+ swatch: {
+ width: '10px',
+ height: '10px',
+ marginTop: '0px'
+ }
+ }
+ };
+ }
+ }, {
key: 'render',
value: function render() {
- return _react2['default'].createElement(
- 'li',
- { className: 'addNodeResult' },
- _react2['default'].createElement(
- 'a',
- { onClick: this._handleClick },
- this.props.node.display.name
+ console.log(this.props.rgb);
+ return _react2.default.createElement(
+ 'div',
+ { style: this.styles().picker },
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().saturation },
+ _react2.default.createElement(_common.Saturation, _extends({}, this.styles().Saturation, this.props, { pointer: _ChromePointerCircle2.default, onChange: this.handleChange }))
+ ),
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().body },
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().controls, className: 'flexbox-fix' },
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().color },
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().swatch },
+ _react2.default.createElement('div', { style: this.styles().active }),
+ _react2.default.createElement(_common.Checkboard, null)
+ )
+ ),
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().toggles },
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().hue },
+ _react2.default.createElement(_common.Hue, _extends({}, this.styles().Hue, this.props, { pointer: _ChromePointer2.default, onChange: this.handleChange }))
+ ),
+ _react2.default.createElement(
+ 'div',
+ { style: this.styles().alpha },
+ _react2.default.createElement(_common.Alpha, _extends({}, this.styles().Alpha, this.props, { pointer: _ChromePointer2.default, onChange: this.handleChange }))
+ )
+ )
+ ),
+ _react2.default.createElement(_ChromeFields2.default, _extends({}, this.props, { onChange: this.handleChange, disableAlpha: this.props.disableAlpha }))
)
);
}
- }, {
- key: '_handleClick',
- value: function _handleClick(e) {
- var _this = this;
+ }]);
- var _props = this.props;
- var source = _props.source;
- var node = _props.node;
- var nodes = _props.nodes;
+ return Chrome;
+ }(_reactcss2.default.Component);
- if (source) {
- var nodeIds = Object.keys(nodes);
+ exports.default = (0, _common.ColorWrap)(Chrome);
- var callback = function callback(data) {
- _this.props.addNode(data.node);
- data.edges.forEach(function (edge) {
- return _this.props.addEdge(edge);
- });
- _this.props.clearResults();
- };
+/***/ },
+/* 347 */
+/***/ function(module, exports, __webpack_require__) {
- source.getNodeWithEdges(node.id, nodeIds, callback);
- }
- }
- }]);
+ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(exports,"__esModule",{value:!0});var _transform=__webpack_require__(348),_transform2=_interopRequireDefault(_transform),_Component=__webpack_require__(357),_Component2=_interopRequireDefault(_Component),_inline=__webpack_require__(351),_inline2=_interopRequireDefault(_inline),_Hover=__webpack_require__(363),_Hover2=_interopRequireDefault(_Hover),_loopable=__webpack_require__(364),_loopable2=_interopRequireDefault(_loopable),ReactCSS=_transform2["default"];ReactCSS.Component=_Component2["default"],ReactCSS.inline=_inline2["default"],ReactCSS.mixin={css:_inline2["default"]},ReactCSS.Hover=_Hover2["default"],ReactCSS.loopable=_loopable2["default"],exports["default"]=ReactCSS;
- return AddNodeResult;
- })(_BaseComponent3['default']);
+/***/ },
+/* 348 */
+/***/ function(module, exports, __webpack_require__) {
- exports['default'] = AddNodeResult;
- module.exports = exports['default'];
+ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function ReactCSS(e){return function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"styles",value:function(){return _inline2["default"].call(this,_get(Object.getPrototypeOf(t.prototype),"activations",this)&&_get(Object.getPrototypeOf(t.prototype),"activations",this).call(this))}},{key:"render",value:function(){return transformElement(this,_get(Object.getPrototypeOf(t.prototype),"render",this).call(this),_get(Object.getPrototypeOf(t.prototype),"classes",this)&&_get(Object.getPrototypeOf(t.prototype),"classes",this).call(this))}}]),t}(e)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r
+ * Build: `lodash modern -d -o ./index.js`
+ * Copyright 2012-2015 The Dojo Foundation
+ * Based on Underscore.js 1.8.3
+ * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license
+ */
+ ;(function() {
- 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; }; })();
+ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+ var undefined;
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ /** Used as the semantic version number. */
+ var VERSION = '3.10.1';
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ /** Used to compose bitmasks for wrapper metadata. */
+ var BIND_FLAG = 1,
+ BIND_KEY_FLAG = 2,
+ CURRY_BOUND_FLAG = 4,
+ CURRY_FLAG = 8,
+ CURRY_RIGHT_FLAG = 16,
+ PARTIAL_FLAG = 32,
+ PARTIAL_RIGHT_FLAG = 64,
+ ARY_FLAG = 128,
+ REARG_FLAG = 256;
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ /** Used as default options for `_.trunc`. */
+ var DEFAULT_TRUNC_LENGTH = 30,
+ DEFAULT_TRUNC_OMISSION = '...';
- 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; }
+ /** Used to detect when a function becomes hot. */
+ var HOT_COUNT = 150,
+ HOT_SPAN = 16;
- var _react = __webpack_require__(2);
+ /** Used as the size to enable large array optimizations. */
+ var LARGE_ARRAY_SIZE = 200;
- var _react2 = _interopRequireDefault(_react);
+ /** Used to indicate the type of lazy iteratees. */
+ var LAZY_FILTER_FLAG = 1,
+ LAZY_MAP_FLAG = 2;
- var _BaseComponent2 = __webpack_require__(267);
+ /** Used as the `TypeError` message for "Functions" methods. */
+ var FUNC_ERROR_TEXT = 'Expected a function';
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ /** Used as the internal argument placeholder. */
+ var PLACEHOLDER = '__lodash_placeholder__';
- var _lodashObjectValues = __webpack_require__(244);
+ /** `Object#toString` result references. */
+ var argsTag = '[object Arguments]',
+ arrayTag = '[object Array]',
+ boolTag = '[object Boolean]',
+ dateTag = '[object Date]',
+ errorTag = '[object Error]',
+ funcTag = '[object Function]',
+ mapTag = '[object Map]',
+ numberTag = '[object Number]',
+ objectTag = '[object Object]',
+ regexpTag = '[object RegExp]',
+ setTag = '[object Set]',
+ stringTag = '[object String]',
+ weakMapTag = '[object WeakMap]';
- var _lodashObjectValues2 = _interopRequireDefault(_lodashObjectValues);
+ var arrayBufferTag = '[object ArrayBuffer]',
+ float32Tag = '[object Float32Array]',
+ float64Tag = '[object Float64Array]',
+ int8Tag = '[object Int8Array]',
+ int16Tag = '[object Int16Array]',
+ int32Tag = '[object Int32Array]',
+ uint8Tag = '[object Uint8Array]',
+ uint8ClampedTag = '[object Uint8ClampedArray]',
+ uint16Tag = '[object Uint16Array]',
+ uint32Tag = '[object Uint32Array]';
- var _lodashCollectionSortBy = __webpack_require__(365);
+ /** Used to match empty string literals in compiled template source. */
+ var reEmptyStringLeading = /\b__p \+= '';/g,
+ reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+ reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
- var _lodashCollectionSortBy2 = _interopRequireDefault(_lodashCollectionSortBy);
+ /** Used to match HTML entities and HTML characters. */
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
+ reUnescapedHtml = /[&<>"'`]/g,
+ reHasEscapedHtml = RegExp(reEscapedHtml.source),
+ reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
- var _reactHotkeys = __webpack_require__(310);
+ /** Used to match template delimiters. */
+ var reEscape = /<%-([\s\S]+?)%>/g,
+ reEvaluate = /<%([\s\S]+?)%>/g,
+ reInterpolate = /<%=([\s\S]+?)%>/g;
- var AddEdgeForm = (function (_BaseComponent) {
- _inherits(AddEdgeForm, _BaseComponent);
+ /** Used to match property names within property paths. */
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
+ reIsPlainProp = /^\w*$/,
+ rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
- function AddEdgeForm(props) {
- _classCallCheck(this, AddEdgeForm);
+ /**
+ * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
+ * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
+ */
+ var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
+ reHasRegExpChars = RegExp(reRegExpChars.source);
- _get(Object.getPrototypeOf(AddEdgeForm.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleSubmit');
- }
+ /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
+ var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
- _createClass(AddEdgeForm, [{
- key: 'render',
- value: function render() {
- var _this = this;
-
- var node1Id = undefined,
- node2Id = undefined;
-
- if (Array.isArray(this.props.data) && this.props.data.length == 2) {
- node1Id = this.props.data[0].id;
- node2Id = this.props.data[1].id;
- } else {
- node1Id = this.props.data ? this.props.data.id : null;
- node2Id = null;
- }
-
- var keyMap = {
- 'altN': ['alt+n', 'ctrl+n'],
- 'esc': 'esc'
- };
-
- var keyHandlers = {
- 'altN': function altN() {
- return _this.props.closeAddForm();
- },
- 'esc': function esc() {
- return _this._clear();
- }
- };
-
- var nodes = (0, _lodashCollectionSortBy2['default'])((0, _lodashObjectValues2['default'])(this.props.nodes), function (node) {
- return node.display.name;
- });
+ /** Used to match backslashes in property paths. */
+ var reEscapeChar = /\\(\\)?/g;
- return _react2['default'].createElement(
- 'div',
- { id: 'addEdgeForm', className: 'editForm' },
- _react2['default'].createElement(
- _reactHotkeys.HotKeys,
- { keyMap: keyMap, handlers: keyHandlers },
- _react2['default'].createElement(
- 'form',
- { onSubmit: this._handleSubmit },
- _react2['default'].createElement(
- 'select',
- { defaultValue: node1Id, className: 'form-control input-sm', ref: 'node1Id' },
- _react2['default'].createElement(
- 'option',
- { value: '' },
- 'Node 1'
- ),
- nodes.map(function (node, i) {
- return _react2['default'].createElement(
- 'option',
- { key: node.id, value: node.id },
- node.display.name
- );
- })
- ),
- _react2['default'].createElement(
- 'select',
- { defaultValue: node2Id, className: 'form-control input-sm', ref: 'node2Id' },
- _react2['default'].createElement(
- 'option',
- { value: '' },
- 'Node 2'
- ),
- nodes.map(function (node, i) {
- return _react2['default'].createElement(
- 'option',
- { key: node.id, value: node.id },
- node.display.name
- );
- })
- ),
- _react2['default'].createElement('input', { type: 'text', placeholder: 'label', className: 'form-control input-sm', ref: 'label' })
- )
- )
- );
- }
- }, {
- key: '_handleSubmit',
- value: function _handleSubmit(e) {
- var node1Id = this.refs.node1Id.value;
- var node2Id = this.refs.node2Id.value;
- var label = this.refs.label.value.trim();
+ /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
- if (node1Id && node2Id && label) {
- this.props.addEdge({ node1_id: node1Id, node2_id: node2Id, display: { label: label } });
- this._clear();
- this.props.closeAddForm();
- }
+ /** Used to match `RegExp` flags from their coerced string values. */
+ var reFlags = /\w*$/;
- e.preventDefault();
- }
- }, {
- key: '_clear',
- value: function _clear() {
- this.refs.node1Id.value = '';
- this.refs.node2Id.value = '';
- this.refs.label.value = '';
- }
- }]);
+ /** Used to detect hexadecimal string values. */
+ var reHasHexPrefix = /^0[xX]/;
- return AddEdgeForm;
- })(_BaseComponent3['default']);
+ /** Used to detect host constructors (Safari > 5). */
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
- exports['default'] = AddEdgeForm;
- module.exports = exports['default'];
+ /** Used to detect unsigned integer values. */
+ var reIsUint = /^\d+$/;
-/***/ },
-/* 365 */
-/***/ function(module, exports, __webpack_require__) {
+ /** Used to match latin-1 supplementary letters (excluding mathematical operators). */
+ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
- var baseCallback = __webpack_require__(282),
- baseMap = __webpack_require__(366),
- baseSortBy = __webpack_require__(367),
- compareAscending = __webpack_require__(368),
- isIterateeCall = __webpack_require__(211);
+ /** Used to ensure capturing order of template delimiters. */
+ var reNoMatch = /($^)/;
- /**
- * Creates an array of elements, sorted in ascending order by the results of
- * running each element in a collection through `iteratee`. This method performs
- * a stable sort, that is, it preserves the original sort order of equal elements.
- * The `iteratee` is bound to `thisArg` and invoked with three arguments:
- * (value, index|key, collection).
- *
- * If a property name is provided for `iteratee` the created `_.property`
- * style callback returns the property value of the given element.
- *
- * If a value is also provided for `thisArg` the created `_.matchesProperty`
- * style callback returns `true` for elements that have a matching property
- * value, else `false`.
- *
- * If an object is provided for `iteratee` the created `_.matches` style
- * callback returns `true` for elements that have the properties of the given
- * object, else `false`.
- *
- * @static
- * @memberOf _
- * @category Collection
- * @param {Array|Object|string} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked
- * per iteration.
- * @param {*} [thisArg] The `this` binding of `iteratee`.
- * @returns {Array} Returns the new sorted array.
- * @example
- *
- * _.sortBy([1, 2, 3], function(n) {
- * return Math.sin(n);
- * });
- * // => [3, 1, 2]
- *
- * _.sortBy([1, 2, 3], function(n) {
- * return this.sin(n);
- * }, Math);
- * // => [3, 1, 2]
- *
- * var users = [
- * { 'user': 'fred' },
- * { 'user': 'pebbles' },
- * { 'user': 'barney' }
- * ];
- *
- * // using the `_.property` callback shorthand
- * _.pluck(_.sortBy(users, 'user'), 'user');
- * // => ['barney', 'fred', 'pebbles']
- */
- function sortBy(collection, iteratee, thisArg) {
- if (collection == null) {
- return [];
- }
- if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
- iteratee = undefined;
- }
- var index = -1;
- iteratee = baseCallback(iteratee, thisArg, 3);
+ /** Used to match unescaped characters in compiled string literals. */
+ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
- var result = baseMap(collection, function(value, key, collection) {
- return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
- });
- return baseSortBy(result, compareAscending);
- }
+ /** Used to match words to create compound words. */
+ var reWords = (function() {
+ var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
+ lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
- module.exports = sortBy;
+ return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
+ }());
+ /** Used to assign default `context` object properties. */
+ var contextProps = [
+ 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
+ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
+ 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
+ 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
+ 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
+ ];
-/***/ },
-/* 366 */
-/***/ function(module, exports, __webpack_require__) {
+ /** Used to make template sourceURLs easier to identify. */
+ var templateCounter = -1;
- var baseEach = __webpack_require__(234),
- isArrayLike = __webpack_require__(186);
+ /** Used to identify `toStringTag` values of typed arrays. */
+ var typedArrayTags = {};
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+ typedArrayTags[uint32Tag] = true;
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+ typedArrayTags[dateTag] = typedArrayTags[errorTag] =
+ typedArrayTags[funcTag] = typedArrayTags[mapTag] =
+ typedArrayTags[numberTag] = typedArrayTags[objectTag] =
+ typedArrayTags[regexpTag] = typedArrayTags[setTag] =
+ typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
- /**
- * The base implementation of `_.map` without support for callback shorthands
- * and `this` binding.
- *
- * @private
- * @param {Array|Object|string} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
- function baseMap(collection, iteratee) {
- var index = -1,
- result = isArrayLike(collection) ? Array(collection.length) : [];
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
+ var cloneableTags = {};
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
+ cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
+ cloneableTags[dateTag] = cloneableTags[float32Tag] =
+ cloneableTags[float64Tag] = cloneableTags[int8Tag] =
+ cloneableTags[int16Tag] = cloneableTags[int32Tag] =
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
+ cloneableTags[regexpTag] = cloneableTags[stringTag] =
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
+ cloneableTags[mapTag] = cloneableTags[setTag] =
+ cloneableTags[weakMapTag] = false;
- baseEach(collection, function(value, key, collection) {
- result[++index] = iteratee(value, key, collection);
- });
- return result;
- }
+ /** Used to map latin-1 supplementary letters to basic latin letters. */
+ var deburredLetters = {
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss'
+ };
- module.exports = baseMap;
+ /** Used to map characters to HTML entities. */
+ var htmlEscapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ '`': '`'
+ };
+ /** Used to map HTML entities to characters. */
+ var htmlUnescapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ ''': "'",
+ '`': '`'
+ };
-/***/ },
-/* 367 */
-/***/ function(module, exports) {
+ /** Used to determine if values are of the language type `Object`. */
+ var objectTypes = {
+ 'function': true,
+ 'object': true
+ };
- /**
- * The base implementation of `_.sortBy` which uses `comparer` to define
- * the sort order of `array` and replaces criteria objects with their
- * corresponding values.
- *
- * @private
- * @param {Array} array The array to sort.
- * @param {Function} comparer The function to define sort order.
- * @returns {Array} Returns `array`.
- */
- function baseSortBy(array, comparer) {
- var length = array.length;
+ /** Used to escape characters for inclusion in compiled regexes. */
+ var regexpEscapes = {
+ '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',
+ '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',
+ 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',
+ 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',
+ 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'
+ };
- array.sort(comparer);
- while (length--) {
- array[length] = array[length].value;
- }
- return array;
- }
+ /** Used to escape characters for inclusion in compiled string literals. */
+ var stringEscapes = {
+ '\\': '\\',
+ "'": "'",
+ '\n': 'n',
+ '\r': 'r',
+ '\u2028': 'u2028',
+ '\u2029': 'u2029'
+ };
- module.exports = baseSortBy;
+ /** Detect free variable `exports`. */
+ var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+ /** Detect free variable `module`. */
+ var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
-/***/ },
-/* 368 */
-/***/ function(module, exports, __webpack_require__) {
+ /** Detect free variable `global` from Node.js. */
+ var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
- var baseCompareAscending = __webpack_require__(369);
+ /** Detect free variable `self`. */
+ var freeSelf = objectTypes[typeof self] && self && self.Object && self;
- /**
- * Used by `_.sortBy` to compare transformed elements of a collection and stable
- * sort them in ascending order.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @returns {number} Returns the sort order indicator for `object`.
- */
- function compareAscending(object, other) {
- return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
- }
+ /** Detect free variable `window`. */
+ var freeWindow = objectTypes[typeof window] && window && window.Object && window;
- module.exports = compareAscending;
+ /** Detect the popular CommonJS extension `module.exports`. */
+ var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+ /**
+ * Used as a reference to the global object.
+ *
+ * The `this` value is used if it's the global object to avoid Greasemonkey's
+ * restricted `window` object, otherwise the `window` object is used.
+ */
+ var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
-/***/ },
-/* 369 */
-/***/ function(module, exports) {
+ /*--------------------------------------------------------------------------*/
- /**
- * The base implementation of `compareAscending` which compares values and
- * sorts them in ascending order without guaranteeing a stable sort.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {number} Returns the sort order indicator for `value`.
- */
- function baseCompareAscending(value, other) {
- if (value !== other) {
- var valIsNull = value === null,
- valIsUndef = value === undefined,
- valIsReflexive = value === value;
+ /**
+ * The base implementation of `compareAscending` which compares values and
+ * sorts them in ascending order without guaranteeing a stable sort.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {number} Returns the sort order indicator for `value`.
+ */
+ function baseCompareAscending(value, other) {
+ if (value !== other) {
+ var valIsNull = value === null,
+ valIsUndef = value === undefined,
+ valIsReflexive = value === value;
- var othIsNull = other === null,
- othIsUndef = other === undefined,
- othIsReflexive = other === other;
+ var othIsNull = other === null,
+ othIsUndef = other === undefined,
+ othIsReflexive = other === other;
- if ((value > other && !othIsNull) || !valIsReflexive ||
- (valIsNull && !othIsUndef && othIsReflexive) ||
- (valIsUndef && othIsReflexive)) {
- return 1;
- }
- if ((value < other && !valIsNull) || !othIsReflexive ||
- (othIsNull && !valIsUndef && valIsReflexive) ||
- (othIsUndef && valIsReflexive)) {
- return -1;
+ if ((value > other && !othIsNull) || !valIsReflexive ||
+ (valIsNull && !othIsUndef && othIsReflexive) ||
+ (valIsUndef && othIsReflexive)) {
+ return 1;
+ }
+ if ((value < other && !valIsNull) || !othIsReflexive ||
+ (othIsNull && !valIsUndef && valIsReflexive) ||
+ (othIsUndef && valIsReflexive)) {
+ return -1;
+ }
}
+ return 0;
}
- return 0;
- }
-
- module.exports = baseCompareAscending;
-
-
-/***/ },
-/* 370 */
-/***/ function(module, exports, __webpack_require__) {
- 'use strict';
+ /**
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
+ * support for callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseFindIndex(array, predicate, fromRight) {
+ var length = array.length,
+ index = fromRight ? length : -1;
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
+ while ((fromRight ? index-- : ++index < length)) {
+ if (predicate(array[index], index, array)) {
+ return index;
+ }
+ }
+ return -1;
+ }
- 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; }; })();
+ /**
+ * The base implementation of `_.indexOf` without support for binary searches.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOf(array, value, fromIndex) {
+ if (value !== value) {
+ return indexOfNaN(array, fromIndex);
+ }
+ var index = fromIndex - 1,
+ length = array.length;
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+ }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ /**
+ * The base implementation of `_.isFunction` without support for environments
+ * with incorrect `typeof` results.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ */
+ function baseIsFunction(value) {
+ // Avoid a Chakra JIT bug in compatibility modes of IE 11.
+ // See https://github.com/jashkenas/underscore/issues/1621 for more details.
+ return typeof value == 'function' || false;
+ }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ /**
+ * Converts `value` to a string if it's not one. An empty string is returned
+ * for `null` or `undefined` values.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ */
+ function baseToString(value) {
+ return value == null ? '' : (value + '');
+ }
- 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; }
+ /**
+ * Used by `_.trim` and `_.trimLeft` to get the index of the first character
+ * of `string` that is not found in `chars`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @param {string} chars The characters to find.
+ * @returns {number} Returns the index of the first character not found in `chars`.
+ */
+ function charsLeftIndex(string, chars) {
+ var index = -1,
+ length = string.length;
- var _react = __webpack_require__(2);
+ while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
+ return index;
+ }
- var _react2 = _interopRequireDefault(_react);
+ /**
+ * Used by `_.trim` and `_.trimRight` to get the index of the last character
+ * of `string` that is not found in `chars`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @param {string} chars The characters to find.
+ * @returns {number} Returns the index of the last character not found in `chars`.
+ */
+ function charsRightIndex(string, chars) {
+ var index = string.length;
- var _BaseComponent2 = __webpack_require__(267);
+ while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
+ return index;
+ }
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ /**
+ * Used by `_.sortBy` to compare transformed elements of a collection and stable
+ * sort them in ascending order.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @returns {number} Returns the sort order indicator for `object`.
+ */
+ function compareAscending(object, other) {
+ return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
+ }
- var _reactHotkeys = __webpack_require__(310);
+ /**
+ * Used by `_.sortByOrder` to compare multiple properties of a value to another
+ * and stable sort them.
+ *
+ * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,
+ * a value is sorted in ascending order if its corresponding order is "asc", and
+ * descending if "desc".
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {boolean[]} orders The order to sort by for each property.
+ * @returns {number} Returns the sort order indicator for `object`.
+ */
+ function compareMultiple(object, other, orders) {
+ var index = -1,
+ objCriteria = object.criteria,
+ othCriteria = other.criteria,
+ length = objCriteria.length,
+ ordersLength = orders.length;
- var AddCaptionForm = (function (_BaseComponent) {
- _inherits(AddCaptionForm, _BaseComponent);
+ while (++index < length) {
+ var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
+ if (result) {
+ if (index >= ordersLength) {
+ return result;
+ }
+ var order = orders[index];
+ return result * ((order === 'asc' || order === true) ? 1 : -1);
+ }
+ }
+ // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+ // that causes it, under certain circumstances, to provide the same value for
+ // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
+ // for more details.
+ //
+ // This also ensures a stable sort in V8 and other engines.
+ // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
+ return object.index - other.index;
+ }
- function AddCaptionForm(props) {
- _classCallCheck(this, AddCaptionForm);
+ /**
+ * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
+ *
+ * @private
+ * @param {string} letter The matched letter to deburr.
+ * @returns {string} Returns the deburred letter.
+ */
+ function deburrLetter(letter) {
+ return deburredLetters[letter];
+ }
- _get(Object.getPrototypeOf(AddCaptionForm.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleSubmit');
+ /**
+ * Used by `_.escape` to convert characters to HTML entities.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @returns {string} Returns the escaped character.
+ */
+ function escapeHtmlChar(chr) {
+ return htmlEscapes[chr];
}
- _createClass(AddCaptionForm, [{
- key: 'render',
- value: function render() {
- var _this = this;
+ /**
+ * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @param {string} leadingChar The capture group for a leading character.
+ * @param {string} whitespaceChar The capture group for a whitespace character.
+ * @returns {string} Returns the escaped character.
+ */
+ function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
+ if (leadingChar) {
+ chr = regexpEscapes[chr];
+ } else if (whitespaceChar) {
+ chr = stringEscapes[chr];
+ }
+ return '\\' + chr;
+ }
- var keyMap = {
- 'esc': 'esc'
- };
+ /**
+ * Used by `_.template` to escape characters for inclusion in compiled string literals.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @returns {string} Returns the escaped character.
+ */
+ function escapeStringChar(chr) {
+ return '\\' + stringEscapes[chr];
+ }
- var keyHandlers = {
- 'esc': function esc() {
- return _this.props.closeAddForm();
- }
- };
+ /**
+ * Gets the index at which the first occurrence of `NaN` is found in `array`.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {number} fromIndex The index to search from.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched `NaN`, else `-1`.
+ */
+ function indexOfNaN(array, fromIndex, fromRight) {
+ var length = array.length,
+ index = fromIndex + (fromRight ? 0 : -1);
- return _react2['default'].createElement(
- 'div',
- { id: 'addCaption', className: 'editForm' },
- _react2['default'].createElement(
- _reactHotkeys.HotKeys,
- { keyMap: keyMap, handlers: keyHandlers },
- _react2['default'].createElement(
- 'form',
- { onSubmit: this._handleSubmit },
- _react2['default'].createElement('input', { type: 'text', className: 'form-control input-sm', placeholder: 'add caption', ref: 'text' }),
- _react2['default'].createElement('br', null)
- )
- )
- );
+ while ((fromRight ? index-- : ++index < length)) {
+ var other = array[index];
+ if (other !== other) {
+ return index;
+ }
}
- }, {
- key: 'componentDidMount',
- value: function componentDidMount() {
- var _this2 = this;
+ return -1;
+ }
- // need to wait a moment before focusing so that alt+c doesn't end up in the input
- setTimeout(function () {
- return _this2.refs.text.focus();
- }, 50);
- }
- }, {
- key: '_handleSubmit',
- value: function _handleSubmit(e) {
- var text = this.refs.text.value.trim();
- this.props.addCaption({ display: { text: text } });
- this._clear();
- e.preventDefault();
- }
- }, {
- key: '_clear',
- value: function _clear() {
- this.refs.text.value = '';
- }
- }]);
+ /**
+ * Checks if `value` is object-like.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ */
+ function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+ }
- return AddCaptionForm;
- })(_BaseComponent3['default']);
+ /**
+ * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
+ * character code is whitespace.
+ *
+ * @private
+ * @param {number} charCode The character code to inspect.
+ * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
+ */
+ function isSpace(charCode) {
+ return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
+ (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
+ }
- exports['default'] = AddCaptionForm;
- module.exports = exports['default'];
+ /**
+ * Replaces all `placeholder` elements in `array` with an internal placeholder
+ * and returns an array of their indexes.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {*} placeholder The placeholder to replace.
+ * @returns {Array} Returns the new array of placeholder indexes.
+ */
+ function replaceHolders(array, placeholder) {
+ var index = -1,
+ length = array.length,
+ resIndex = -1,
+ result = [];
-/***/ },
-/* 371 */
-/***/ function(module, exports, __webpack_require__) {
+ while (++index < length) {
+ if (array[index] === placeholder) {
+ array[index] = PLACEHOLDER;
+ result[++resIndex] = index;
+ }
+ }
+ return result;
+ }
- 'use strict';
+ /**
+ * An implementation of `_.uniq` optimized for sorted arrays without support
+ * for callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee] The function invoked per iteration.
+ * @returns {Array} Returns the new duplicate-value-free array.
+ */
+ function sortedUniq(array, iteratee) {
+ var seen,
+ index = -1,
+ length = array.length,
+ resIndex = -1,
+ result = [];
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
+ while (++index < length) {
+ var value = array[index],
+ computed = iteratee ? iteratee(value, index, array) : value;
- 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; }; })();
+ if (!index || seen !== computed) {
+ seen = computed;
+ result[++resIndex] = value;
+ }
+ }
+ return result;
+ }
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ /**
+ * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the first non-whitespace character.
+ */
+ function trimmedLeftIndex(string) {
+ var index = -1,
+ length = string.length;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ while (++index < length && isSpace(string.charCodeAt(index))) {}
+ return index;
+ }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ /**
+ * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the last non-whitespace character.
+ */
+ function trimmedRightIndex(string) {
+ var index = string.length;
- 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; }
+ while (index-- && isSpace(string.charCodeAt(index))) {}
+ return index;
+ }
- var _react = __webpack_require__(2);
+ /**
+ * Used by `_.unescape` to convert HTML entities to characters.
+ *
+ * @private
+ * @param {string} chr The matched character to unescape.
+ * @returns {string} Returns the unescaped character.
+ */
+ function unescapeHtmlChar(chr) {
+ return htmlUnescapes[chr];
+ }
- var _react2 = _interopRequireDefault(_react);
+ /*--------------------------------------------------------------------------*/
- var _BaseComponent2 = __webpack_require__(267);
+ /**
+ * Create a new pristine `lodash` function using the given `context` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {Object} [context=root] The context object.
+ * @returns {Function} Returns a new `lodash` function.
+ * @example
+ *
+ * _.mixin({ 'foo': _.constant('foo') });
+ *
+ * var lodash = _.runInContext();
+ * lodash.mixin({ 'bar': lodash.constant('bar') });
+ *
+ * _.isFunction(_.foo);
+ * // => true
+ * _.isFunction(_.bar);
+ * // => false
+ *
+ * lodash.isFunction(lodash.foo);
+ * // => false
+ * lodash.isFunction(lodash.bar);
+ * // => true
+ *
+ * // using `context` to mock `Date#getTime` use in `_.now`
+ * var mock = _.runInContext({
+ * 'Date': function() {
+ * return { 'getTime': getTimeMock };
+ * }
+ * });
+ *
+ * // or creating a suped-up `defer` in Node.js
+ * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
+ */
+ function runInContext(context) {
+ // Avoid issues with some ES3 environments that attempt to use values, named
+ // after built-in constructors like `Object`, for the creation of literals.
+ // ES5 clears this up by stating that literals must use built-in constructors.
+ // See https://es5.github.io/#x11.1.5 for more details.
+ context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
+
+ /** Native constructor references. */
+ var Array = context.Array,
+ Date = context.Date,
+ Error = context.Error,
+ Function = context.Function,
+ Math = context.Math,
+ Number = context.Number,
+ Object = context.Object,
+ RegExp = context.RegExp,
+ String = context.String,
+ TypeError = context.TypeError;
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ /** Used for native method references. */
+ var arrayProto = Array.prototype,
+ objectProto = Object.prototype,
+ stringProto = String.prototype;
- var _reactHotkeys = __webpack_require__(310);
+ /** Used to resolve the decompiled source of functions. */
+ var fnToString = Function.prototype.toString;
- var _lodashObjectMapKeys = __webpack_require__(372);
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
- var _lodashObjectMapKeys2 = _interopRequireDefault(_lodashObjectMapKeys);
+ /** Used to generate unique IDs. */
+ var idCounter = 0;
- var AddConnectedNodesForm = (function (_BaseComponent) {
- _inherits(AddConnectedNodesForm, _BaseComponent);
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objToString = objectProto.toString;
- function AddConnectedNodesForm(props) {
- _classCallCheck(this, AddConnectedNodesForm);
+ /** Used to restore the original `_` reference in `_.noConflict`. */
+ var oldDash = root._;
- _get(Object.getPrototypeOf(AddConnectedNodesForm.prototype), 'constructor', this).call(this, props);
- this.bindAll('_handleSubmit');
- }
+ /** Used to detect if a method is native. */
+ var reIsNative = RegExp('^' +
+ fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+ );
- _createClass(AddConnectedNodesForm, [{
- key: 'render',
- value: function render() {
- var _this = this;
+ /** Native method references. */
+ var ArrayBuffer = context.ArrayBuffer,
+ clearTimeout = context.clearTimeout,
+ parseFloat = context.parseFloat,
+ pow = Math.pow,
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
+ Set = getNative(context, 'Set'),
+ setTimeout = context.setTimeout,
+ splice = arrayProto.splice,
+ Uint8Array = context.Uint8Array,
+ WeakMap = getNative(context, 'WeakMap');
- var keyMap = {
- 'esc': 'esc'
- };
+ /* Native method references for those with the same name as other `lodash` methods. */
+ var nativeCeil = Math.ceil,
+ nativeCreate = getNative(Object, 'create'),
+ nativeFloor = Math.floor,
+ nativeIsArray = getNative(Array, 'isArray'),
+ nativeIsFinite = context.isFinite,
+ nativeKeys = getNative(Object, 'keys'),
+ nativeMax = Math.max,
+ nativeMin = Math.min,
+ nativeNow = getNative(Date, 'now'),
+ nativeParseInt = context.parseInt,
+ nativeRandom = Math.random;
- var keyHandlers = {
- 'esc': function esc() {
- return _this.props.closeAddForm();
- }
- };
+ /** Used as references for `-Infinity` and `Infinity`. */
+ var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
+ POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
- return _react2['default'].createElement(
- 'div',
- { id: 'addConnectedNodes', className: 'editForm form-inline' },
- _react2['default'].createElement(
- _reactHotkeys.HotKeys,
- { keyMap: keyMap, handlers: keyHandlers },
- _react2['default'].createElement('input', {
- id: 'addConnectedNodesNum',
- type: 'text',
- className: 'form-control input-sm',
- defaultValue: '5',
- ref: 'num' }),
- this._renderOptions(),
- ' ',
- _react2['default'].createElement(
- 'button',
- { onClick: this._handleSubmit, className: 'btn btn-sm btn-default' },
- 'Add Connections'
- )
- )
- );
- }
- }, {
- key: '_renderOptions',
- value: function _renderOptions() {
- var options = this.props.source.getConnectedNodesOptions;
- return options ? Object.keys(options).map(function (key) {
- return _react2['default'].createElement(
- 'select',
- { key: key, className: 'form-control input-sm', ref: key },
- Object.keys(options[key]).map(function (val) {
- return _react2['default'].createElement(
- 'option',
- { key: val, value: val },
- options[key][val]
- );
- })
- );
- }) : null;
- }
- }, {
- key: '_handleSubmit',
- value: function _handleSubmit(e) {
- var _this2 = this;
+ /** Used as references for the maximum length and index of an array. */
+ var MAX_ARRAY_LENGTH = 4294967295,
+ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
+ HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
- var num = parseInt(this.refs.num.value);
- var nodeId = this.props.data.id;
- var nodeIds = Object.keys(this.props.graph.nodes);
- var options = this._options();
+ /**
+ * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
+ * of an array-like value.
+ */
+ var MAX_SAFE_INTEGER = 9007199254740991;
- this.props.source.getConnectedNodes(nodeId, nodeIds, options, function (data) {
- _this2.props.addSurroundingNodes(nodeId, data.nodes);
+ /** Used to store function metadata. */
+ var metaMap = WeakMap && new WeakMap;
- data.edges.forEach(function (edge) {
- if (!_this2.props.graph.edges[edge.id]) {
- _this2.props.addEdge(edge);
- }
- });
- });
+ /** Used to lookup unminified function names. */
+ var realNames = {};
- e.preventDefault();
- }
- }, {
- key: '_options',
- value: function _options() {
- var _this3 = this;
+ /*------------------------------------------------------------------------*/
- return Object.keys(this.refs).reduce(function (result, ref) {
- result[ref] = _this3.refs[ref].value;
- return result;
- }, {});
+ /**
+ * Creates a `lodash` object which wraps `value` to enable implicit chaining.
+ * Methods that operate on and return arrays, collections, and functions can
+ * be chained together. Methods that retrieve a single value or may return a
+ * primitive value will automatically end the chain returning the unwrapped
+ * value. Explicit chaining may be enabled using `_.chain`. The execution of
+ * chained methods is lazy, that is, execution is deferred until `_#value`
+ * is implicitly or explicitly called.
+ *
+ * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
+ * fusion is an optimization strategy which merge iteratee calls; this can help
+ * to avoid the creation of intermediate data structures and greatly reduce the
+ * number of iteratee executions.
+ *
+ * Chaining is supported in custom builds as long as the `_#value` method is
+ * directly or indirectly included in the build.
+ *
+ * In addition to lodash methods, wrappers have `Array` and `String` methods.
+ *
+ * The wrapper `Array` methods are:
+ * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
+ * `splice`, and `unshift`
+ *
+ * The wrapper `String` methods are:
+ * `replace` and `split`
+ *
+ * The wrapper methods that support shortcut fusion are:
+ * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
+ * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
+ * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
+ * and `where`
+ *
+ * The chainable wrapper methods are:
+ * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
+ * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
+ * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
+ * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
+ * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
+ * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+ * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+ * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
+ * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
+ * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
+ * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
+ * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
+ * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
+ * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
+ * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
+ * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
+ * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
+ *
+ * The wrapper methods that are **not** chainable by default are:
+ * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
+ * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
+ * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
+ * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
+ * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+ * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
+ * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
+ * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
+ * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
+ * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
+ * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
+ * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
+ * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
+ * `unescape`, `uniqueId`, `value`, and `words`
+ *
+ * The wrapper method `sample` will return a wrapped value when `n` is provided,
+ * otherwise an unwrapped value is returned.
+ *
+ * @name _
+ * @constructor
+ * @category Chain
+ * @param {*} value The value to wrap in a `lodash` instance.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var wrapped = _([1, 2, 3]);
+ *
+ * // returns an unwrapped value
+ * wrapped.reduce(function(total, n) {
+ * return total + n;
+ * });
+ * // => 6
+ *
+ * // returns a wrapped value
+ * var squares = wrapped.map(function(n) {
+ * return n * n;
+ * });
+ *
+ * _.isArray(squares);
+ * // => false
+ *
+ * _.isArray(squares.value());
+ * // => true
+ */
+ function lodash(value) {
+ if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
+ if (value instanceof LodashWrapper) {
+ return value;
+ }
+ if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
+ return wrapperClone(value);
+ }
+ }
+ return new LodashWrapper(value);
}
- }, {
- key: '_clear',
- value: function _clear() {
- var _this4 = this;
- this.refs.num.value = "5";
- Object.keys(this.props.source.getConnectedNodesOptions).forEach(function (key) {
- _this4.refs[key].value = null;
- });
+ /**
+ * The function whose prototype all chaining wrappers inherit from.
+ *
+ * @private
+ */
+ function baseLodash() {
+ // No operation performed.
}
- }]);
-
- return AddConnectedNodesForm;
- })(_BaseComponent3['default']);
-
- exports['default'] = AddConnectedNodesForm;
- module.exports = exports['default'];
-
-/***/ },
-/* 372 */
-/***/ function(module, exports, __webpack_require__) {
- var createObjectMapper = __webpack_require__(373);
+ /**
+ * The base constructor for creating `lodash` wrapper objects.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
+ * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
+ */
+ function LodashWrapper(value, chainAll, actions) {
+ this.__wrapped__ = value;
+ this.__actions__ = actions || [];
+ this.__chain__ = !!chainAll;
+ }
- /**
- * The opposite of `_.mapValues`; this method creates an object with the
- * same values as `object` and keys generated by running each own enumerable
- * property of `object` through `iteratee`.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked
- * per iteration.
- * @param {*} [thisArg] The `this` binding of `iteratee`.
- * @returns {Object} Returns the new mapped object.
- * @example
- *
- * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
- * return key + value;
- * });
- * // => { 'a1': 1, 'b2': 2 }
- */
- var mapKeys = createObjectMapper(true);
+ /**
+ * An object environment feature flags.
+ *
+ * @static
+ * @memberOf _
+ * @type Object
+ */
+ var support = lodash.support = {};
- module.exports = mapKeys;
+ /**
+ * By default, the template delimiters used by lodash are like those in
+ * embedded Ruby (ERB). Change the following template settings to use
+ * alternative delimiters.
+ *
+ * @static
+ * @memberOf _
+ * @type Object
+ */
+ lodash.templateSettings = {
+ /**
+ * Used to detect `data` property values to be HTML-escaped.
+ *
+ * @memberOf _.templateSettings
+ * @type RegExp
+ */
+ 'escape': reEscape,
-/***/ },
-/* 373 */
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * Used to detect code to be evaluated.
+ *
+ * @memberOf _.templateSettings
+ * @type RegExp
+ */
+ 'evaluate': reEvaluate,
- var baseCallback = __webpack_require__(282),
- baseForOwn = __webpack_require__(227);
+ /**
+ * Used to detect `data` property values to inject.
+ *
+ * @memberOf _.templateSettings
+ * @type RegExp
+ */
+ 'interpolate': reInterpolate,
- /**
- * Creates a function for `_.mapKeys` or `_.mapValues`.
- *
- * @private
- * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
- * @returns {Function} Returns the new map function.
- */
- function createObjectMapper(isMapKeys) {
- return function(object, iteratee, thisArg) {
- var result = {};
- iteratee = baseCallback(iteratee, thisArg, 3);
+ /**
+ * Used to reference the data object in the template text.
+ *
+ * @memberOf _.templateSettings
+ * @type string
+ */
+ 'variable': '',
- baseForOwn(object, function(value, key, object) {
- var mapped = iteratee(value, key, object);
- key = isMapKeys ? mapped : key;
- value = isMapKeys ? value : mapped;
- result[key] = value;
- });
- return result;
- };
- }
+ /**
+ * Used to import variables into the compiled template.
+ *
+ * @memberOf _.templateSettings
+ * @type Object
+ */
+ 'imports': {
- module.exports = createObjectMapper;
+ /**
+ * A reference to the `lodash` function.
+ *
+ * @memberOf _.templateSettings.imports
+ * @type Function
+ */
+ '_': lodash
+ }
+ };
+ /*------------------------------------------------------------------------*/
-/***/ },
-/* 374 */
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ */
+ function LazyWrapper(value) {
+ this.__wrapped__ = value;
+ this.__actions__ = [];
+ this.__dir__ = 1;
+ this.__filtered__ = false;
+ this.__iteratees__ = [];
+ this.__takeCount__ = POSITIVE_INFINITY;
+ this.__views__ = [];
+ }
- 'use strict';
+ /**
+ * Creates a clone of the lazy wrapper object.
+ *
+ * @private
+ * @name clone
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the cloned `LazyWrapper` object.
+ */
+ function lazyClone() {
+ var result = new LazyWrapper(this.__wrapped__);
+ result.__actions__ = arrayCopy(this.__actions__);
+ result.__dir__ = this.__dir__;
+ result.__filtered__ = this.__filtered__;
+ result.__iteratees__ = arrayCopy(this.__iteratees__);
+ result.__takeCount__ = this.__takeCount__;
+ result.__views__ = arrayCopy(this.__views__);
+ return result;
+ }
- 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; }; })();
+ /**
+ * Reverses the direction of lazy iteration.
+ *
+ * @private
+ * @name reverse
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the new reversed `LazyWrapper` object.
+ */
+ function lazyReverse() {
+ if (this.__filtered__) {
+ var result = new LazyWrapper(this);
+ result.__dir__ = -1;
+ result.__filtered__ = true;
+ } else {
+ result = this.clone();
+ result.__dir__ *= -1;
+ }
+ return result;
+ }
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ /**
+ * Extracts the unwrapped value from its lazy wrapper.
+ *
+ * @private
+ * @name value
+ * @memberOf LazyWrapper
+ * @returns {*} Returns the unwrapped value.
+ */
+ function lazyValue() {
+ var array = this.__wrapped__.value(),
+ dir = this.__dir__,
+ isArr = isArray(array),
+ isRight = dir < 0,
+ arrLength = isArr ? array.length : 0,
+ view = getView(0, arrLength, this.__views__),
+ start = view.start,
+ end = view.end,
+ length = end - start,
+ index = isRight ? end : (start - 1),
+ iteratees = this.__iteratees__,
+ iterLength = iteratees.length,
+ resIndex = 0,
+ takeCount = nativeMin(length, this.__takeCount__);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
+ return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
+ }
+ var result = [];
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ outer:
+ while (length-- && resIndex < takeCount) {
+ index += dir;
- 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 iterIndex = -1,
+ value = array[index];
- var _react = __webpack_require__(2);
+ while (++iterIndex < iterLength) {
+ var data = iteratees[iterIndex],
+ iteratee = data.iteratee,
+ type = data.type,
+ computed = iteratee(value);
- var _react2 = _interopRequireDefault(_react);
+ if (type == LAZY_MAP_FLAG) {
+ value = computed;
+ } else if (!computed) {
+ if (type == LAZY_FILTER_FLAG) {
+ continue outer;
+ } else {
+ break outer;
+ }
+ }
+ }
+ result[resIndex++] = value;
+ }
+ return result;
+ }
- var _BaseComponent2 = __webpack_require__(267);
+ /*------------------------------------------------------------------------*/
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ /**
+ * Creates a cache object to store key/value pairs.
+ *
+ * @private
+ * @static
+ * @name Cache
+ * @memberOf _.memoize
+ */
+ function MapCache() {
+ this.__data__ = {};
+ }
- var _ChangeColorInput = __webpack_require__(375);
+ /**
+ * Removes `key` and its value from the cache.
+ *
+ * @private
+ * @name delete
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.
+ */
+ function mapDelete(key) {
+ return this.has(key) && delete this.__data__[key];
+ }
- var _ChangeColorInput2 = _interopRequireDefault(_ChangeColorInput);
+ /**
+ * Gets the cached value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the cached value.
+ */
+ function mapGet(key) {
+ return key == '__proto__' ? undefined : this.__data__[key];
+ }
- var _reactHotkeys = __webpack_require__(310);
+ /**
+ * Checks if a cached value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function mapHas(key) {
+ return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
+ }
- var _lodashObjectMerge = __webpack_require__(180);
+ /**
+ * Sets `value` to `key` of the cache.
+ *
+ * @private
+ * @name set
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to cache.
+ * @param {*} value The value to cache.
+ * @returns {Object} Returns the cache object.
+ */
+ function mapSet(key, value) {
+ if (key != '__proto__') {
+ this.__data__[key] = value;
+ }
+ return this;
+ }
- var _lodashObjectMerge2 = _interopRequireDefault(_lodashObjectMerge);
+ /*------------------------------------------------------------------------*/
- var _NodeDisplaySettings = __webpack_require__(270);
+ /**
+ *
+ * Creates a cache object to store unique values.
+ *
+ * @private
+ * @param {Array} [values] The values to cache.
+ */
+ function SetCache(values) {
+ var length = values ? values.length : 0;
- var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
+ this.data = { 'hash': nativeCreate(null), 'set': new Set };
+ while (length--) {
+ this.push(values[length]);
+ }
+ }
- var UpdateNodeForm = (function (_BaseComponent) {
- _inherits(UpdateNodeForm, _BaseComponent);
+ /**
+ * Checks if `value` is in `cache` mimicking the return signature of
+ * `_.indexOf` by returning `0` if the value is found, else `-1`.
+ *
+ * @private
+ * @param {Object} cache The cache to search.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `0` if `value` is found, else `-1`.
+ */
+ function cacheIndexOf(cache, value) {
+ var data = cache.data,
+ result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
- function UpdateNodeForm() {
- _classCallCheck(this, UpdateNodeForm);
+ return result ? 0 : -1;
+ }
- _get(Object.getPrototypeOf(UpdateNodeForm.prototype), 'constructor', this).apply(this, arguments);
- }
+ /**
+ * Adds `value` to the cache.
+ *
+ * @private
+ * @name push
+ * @memberOf SetCache
+ * @param {*} value The value to cache.
+ */
+ function cachePush(value) {
+ var data = this.data;
+ if (typeof value == 'string' || isObject(value)) {
+ data.set.add(value);
+ } else {
+ data.hash[value] = true;
+ }
+ }
- _createClass(UpdateNodeForm, [{
- key: 'render',
- value: function render() {
- var _this = this;
+ /*------------------------------------------------------------------------*/
- var display = this.props.data.display;
+ /**
+ * Creates a new array joining `array` with `other`.
+ *
+ * @private
+ * @param {Array} array The array to join.
+ * @param {Array} other The other array to join.
+ * @returns {Array} Returns the new concatenated array.
+ */
+ function arrayConcat(array, other) {
+ var index = -1,
+ length = array.length,
+ othIndex = -1,
+ othLength = other.length,
+ result = Array(length + othLength);
- if (!display.color) {
- display.color = _NodeDisplaySettings2['default'].circleColor[display.status];
+ while (++index < length) {
+ result[index] = array[index];
}
+ while (++othIndex < othLength) {
+ result[index++] = other[othIndex];
+ }
+ return result;
+ }
- var keyMap = {
- 'esc': 'esc'
- };
-
- var keyHandlers = {
- 'esc': function esc() {
- return _this.props.deselect();
- }
- };
+ /**
+ * Copies the values of `source` to `array`.
+ *
+ * @private
+ * @param {Array} source The array to copy values from.
+ * @param {Array} [array=[]] The array to copy values to.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayCopy(source, array) {
+ var index = -1,
+ length = source.length;
- var scales = [[1, "1x"], [1.5, "1.5x"], [2, "2x"], [3, "3x"]];
+ array || (array = Array(length));
+ while (++index < length) {
+ array[index] = source[index];
+ }
+ return array;
+ }
- console.log(display.color);
+ /**
+ * A specialized version of `_.forEach` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array.length;
- return _react2['default'].createElement(
- 'div',
- { className: 'editForm updateForm form-inline' },
- _react2['default'].createElement(
- _reactHotkeys.HotKeys,
- { keyMap: keyMap, handlers: keyHandlers },
- _react2['default'].createElement(
- 'div',
- null,
- _react2['default'].createElement('input', {
- type: 'text',
- className: 'form-control input-sm',
- placeholder: 'name',
- ref: 'name',
- value: display.name,
- onChange: function () {
- return _this.apply();
- } }),
- ' ',
- _react2['default'].createElement('input', {
- type: 'text',
- className: 'form-control input-sm',
- placeholder: 'image URL',
- ref: 'image',
- value: display.image,
- onChange: function () {
- return _this.apply();
- } }),
- ' ',
- _react2['default'].createElement(_ChangeColorInput2['default'], {
- ref: 'color',
- value: display.color,
- status: display.status,
- onChange: function (color) {
- return _this.apply(color);
- } }),
- ' ',
- _react2['default'].createElement(
- 'select',
- {
- value: display.scale,
- className: 'form-control input-sm',
- ref: 'scale',
- onChange: function () {
- return _this.apply();
- } },
- scales.map(function (scale, i) {
- return _react2['default'].createElement(
- 'option',
- { key: scale[1], value: scale[0] },
- scale[1]
- );
- })
- )
- ),
- _react2['default'].createElement(
- 'div',
- null,
- _react2['default'].createElement('input', {
- id: 'nodeUrlInput',
- type: 'text',
- className: 'form-control input-sm',
- placeholder: 'link URL',
- ref: 'url',
- value: display.url,
- onChange: function () {
- return _this.apply();
- } })
- )
- )
- );
- }
- }, {
- key: 'apply',
- value: function apply(newColor) {
- if (this.props.data) {
- var _name = this.refs.name.value;
- var image = this.refs.image.value.trim();
- var color = newColor || null;
- var scale = parseFloat(this.refs.scale.value);
- var url = this.refs.url.value.trim();
- this.props.updateNode(this.props.data.id, { display: { name: _name, image: image, color: color, scale: scale, url: url } });
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
+ }
}
+ return array;
}
- }]);
-
- return UpdateNodeForm;
- })(_BaseComponent3['default']);
- exports['default'] = UpdateNodeForm;
- module.exports = exports['default'];
+ /**
+ * A specialized version of `_.forEachRight` for arrays without support for
+ * callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEachRight(array, iteratee) {
+ var length = array.length;
-/***/ },
-/* 375 */
-/***/ function(module, exports, __webpack_require__) {
+ while (length--) {
+ if (iteratee(array[length], length, array) === false) {
+ break;
+ }
+ }
+ return array;
+ }
- 'use strict';
+ /**
+ * A specialized version of `_.every` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
+ */
+ function arrayEvery(array, predicate) {
+ var index = -1,
+ length = array.length;
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
+ while (++index < length) {
+ if (!predicate(array[index], index, array)) {
+ return false;
+ }
+ }
+ return 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; }; })();
+ /**
+ * A specialized version of `baseExtremum` for arrays which invokes `iteratee`
+ * with one argument: (value).
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} comparator The function used to compare values.
+ * @param {*} exValue The initial extremum value.
+ * @returns {*} Returns the extremum value.
+ */
+ function arrayExtremum(array, iteratee, comparator, exValue) {
+ var index = -1,
+ length = array.length,
+ computed = exValue,
+ result = computed;
- var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
+ while (++index < length) {
+ var value = array[index],
+ current = +iteratee(value);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+ if (comparator(current, computed)) {
+ computed = current;
+ result = value;
+ }
+ }
+ return result;
+ }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
+ /**
+ * A specialized version of `_.filter` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ */
+ function arrayFilter(array, predicate) {
+ var index = -1,
+ length = array.length,
+ resIndex = -1,
+ result = [];
- 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; }
+ while (++index < length) {
+ var value = array[index];
+ if (predicate(value, index, array)) {
+ result[++resIndex] = value;
+ }
+ }
+ return result;
+ }
- var _react = __webpack_require__(2);
+ /**
+ * A specialized version of `_.map` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function arrayMap(array, iteratee) {
+ var index = -1,
+ length = array.length,
+ result = Array(length);
- var _react2 = _interopRequireDefault(_react);
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
+ }
+ return result;
+ }
- var _BaseComponent2 = __webpack_require__(267);
+ /**
+ * Appends the elements of `values` to `array`.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to append.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayPush(array, values) {
+ var index = -1,
+ length = values.length,
+ offset = array.length;
- var _BaseComponent3 = _interopRequireDefault(_BaseComponent2);
+ while (++index < length) {
+ array[offset + index] = values[index];
+ }
+ return array;
+ }
- var _reactColor = __webpack_require__(376);
+ /**
+ * A specialized version of `_.reduce` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initFromArray] Specify using the first element of `array`
+ * as the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+ function arrayReduce(array, iteratee, accumulator, initFromArray) {
+ var index = -1,
+ length = array.length;
- var _NodeDisplaySettings = __webpack_require__(270);
+ if (initFromArray && length) {
+ accumulator = array[++index];
+ }
+ while (++index < length) {
+ accumulator = iteratee(accumulator, array[index], index, array);
+ }
+ return accumulator;
+ }
- var _NodeDisplaySettings2 = _interopRequireDefault(_NodeDisplaySettings);
+ /**
+ * A specialized version of `_.reduceRight` for arrays without support for
+ * callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initFromArray] Specify using the last element of `array`
+ * as the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+ function arrayReduceRight(array, iteratee, accumulator, initFromArray) {
+ var length = array.length;
+ if (initFromArray && length) {
+ accumulator = array[--length];
+ }
+ while (length--) {
+ accumulator = iteratee(accumulator, array[length], length, array);
+ }
+ return accumulator;
+ }
- var ChangeColorInput = (function (_BaseComponent) {
- _inherits(ChangeColorInput, _BaseComponent);
+ /**
+ * A specialized version of `_.some` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ */
+ function arraySome(array, predicate) {
+ var index = -1,
+ length = array.length;
- function ChangeColorInput(props) {
- _classCallCheck(this, ChangeColorInput);
+ while (++index < length) {
+ if (predicate(array[index], index, array)) {
+ return true;
+ }
+ }
+ return false;
+ }
- _get(Object.getPrototypeOf(ChangeColorInput.prototype), 'constructor', this).call(this, props);
- this.bindAll("handleClick", "handleClose", "handleValueChange", "handleClearClick", "onChange");
- this.state = {
- displayColorPicker: false,
- color: props.value
- };
- }
+ /**
+ * A specialized version of `_.sum` for arrays without support for callback
+ * shorthands and `this` binding..
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the sum.
+ */
+ function arraySum(array, iteratee) {
+ var length = array.length,
+ result = 0;
- _createClass(ChangeColorInput, [{
- key: 'handleClick',
- value: function handleClick() {
- this.setState({ displayColorPicker: !this.state.displayColorPicker });
- }
- }, {
- key: 'handleClose',
- value: function handleClose() {
- this.setState({ displayColorPicker: false });
- }
- }, {
- key: 'handleClearClick',
- value: function handleClearClick() {
- this.handleClose();
- this.onChange(_NodeDisplaySettings2['default'].circleColor[this.props.status]);
- }
- }, {
- key: 'handleValueChange',
- value: function handleValueChange(color) {
- this.onChange("#" + color.hex);
- }
- }, {
- key: 'onChange',
- value: function onChange(newColor) {
- this.setState({ color: newColor });
- this.props.onChange(newColor);
- }
- }, {
- key: 'render',
- value: function render() {
- return _react2['default'].createElement(
- 'div',
- { id: 'nodeColorInputWrapper' },
- _react2['default'].createElement(
- 'div',
- { id: 'swatch', className: 'input-sm form-control' },
- _react2['default'].createElement('div', { id: 'color', style: { background: this.state.color }, onClick: this.handleClick }),
- _react2['default'].createElement(
- 'button',
- { id: 'nodeColorInputClearer', onClick: this.handleClearClick },
- _react2['default'].createElement('span', { className: 'glyphicon glyphicon-remove-sign' })
- )
- ),
- _react2['default'].createElement(
- 'div',
- { id: 'nodeColorPickerWrapper' },
- this.state.displayColorPicker && _react2['default'].createElement(
- 'div',
- { is: 'popover' },
- _react2['default'].createElement('div', { is: 'cover', onClick: this.handleClose }),
- _react2['default'].createElement(_reactColor.CompactPicker, { color: this.state.color, onChange: this.handleValueChange })
- )
- )
- );
+ while (length--) {
+ result += +iteratee(array[length]) || 0;
+ }
+ return result;
}
- }, {
- key: 'componentWillReceiveProps',
- value: function componentWillReceiveProps(props) {
- this.setState({ color: props.value || _NodeDisplaySettings2['default'].circleColor[props.status] });
+
+ /**
+ * Used by `_.defaults` to customize its `_.assign` use.
+ *
+ * @private
+ * @param {*} objectValue The destination object property value.
+ * @param {*} sourceValue The source object property value.
+ * @returns {*} Returns the value to assign to the destination object.
+ */
+ function assignDefaults(objectValue, sourceValue) {
+ return objectValue === undefined ? sourceValue : objectValue;
}
- }]);
- return ChangeColorInput;
- })(_BaseComponent3['default']);
+ /**
+ * Used by `_.template` to customize its `_.assign` use.
+ *
+ * **Note:** This function is like `assignDefaults` except that it ignores
+ * inherited property values when checking if a property is `undefined`.
+ *
+ * @private
+ * @param {*} objectValue The destination object property value.
+ * @param {*} sourceValue The source object property value.
+ * @param {string} key The key associated with the object and source values.
+ * @param {Object} object The destination object.
+ * @returns {*} Returns the value to assign to the destination object.
+ */
+ function assignOwnDefaults(objectValue, sourceValue, key, object) {
+ return (objectValue === undefined || !hasOwnProperty.call(object, key))
+ ? sourceValue
+ : objectValue;
+ }
- exports['default'] = ChangeColorInput;
- ;
- module.exports = exports['default'];
+ /**
+ * A specialized version of `_.assign` for customizing assigned values without
+ * support for argument juggling, multiple sources, and `this` binding `customizer`
+ * functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {Function} customizer The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ */
+ function assignWith(object, source, customizer) {
+ var index = -1,
+ props = keys(source),
+ length = props.length;
-/***/ },
-/* 376 */
-/***/ function(module, exports, __webpack_require__) {
+ while (++index < length) {
+ var key = props[index],
+ value = object[key],
+ result = customizer(value, source[key], key, object, source);
- 'use strict';
+ if ((result === result ? (result !== value) : (value === value)) ||
+ (value === undefined && !(key in object))) {
+ object[key] = result;
+ }
+ }
+ return object;
+ }
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.CustomPicker = exports.SwatchesPicker = exports.SliderPicker = exports.SketchPicker = exports.PhotoshopPicker = exports.MaterialPicker = exports.CompactPicker = exports.ChromePicker = undefined;
+ /**
+ * The base implementation of `_.assign` without support for argument juggling,
+ * multiple sources, and `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @returns {Object} Returns `object`.
+ */
+ function baseAssign(object, source) {
+ return source == null
+ ? object
+ : baseCopy(source, keys(source), object);
+ }
+
+ /**
+ * The base implementation of `_.at` without support for string collections
+ * and individual key arguments.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {number[]|string[]} props The property names or indexes of elements to pick.
+ * @returns {Array} Returns the new array of picked elements.
+ */
+ function baseAt(collection, props) {
+ var index = -1,
+ isNil = collection == null,
+ isArr = !isNil && isArrayLike(collection),
+ length = isArr ? collection.length : 0,
+ propsLength = props.length,
+ result = Array(propsLength);
+
+ while(++index < propsLength) {
+ var key = props[index];
+ if (isArr) {
+ result[index] = isIndex(key, length) ? collection[key] : undefined;
+ } else {
+ result[index] = isNil ? undefined : collection[key];
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Copies properties of `source` to `object`.
+ *
+ * @private
+ * @param {Object} source The object to copy properties from.
+ * @param {Array} props The property names to copy.
+ * @param {Object} [object={}] The object to copy properties to.
+ * @returns {Object} Returns `object`.
+ */
+ function baseCopy(source, props, object) {
+ object || (object = {});
+
+ var index = -1,
+ length = props.length;
+
+ while (++index < length) {
+ var key = props[index];
+ object[key] = source[key];
+ }
+ return object;
+ }
+
+ /**
+ * The base implementation of `_.callback` which supports specifying the
+ * number of arguments to provide to `func`.
+ *
+ * @private
+ * @param {*} [func=_.identity] The value to convert to a callback.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {number} [argCount] The number of arguments to provide to `func`.
+ * @returns {Function} Returns the callback.
+ */
+ function baseCallback(func, thisArg, argCount) {
+ var type = typeof func;
+ if (type == 'function') {
+ return thisArg === undefined
+ ? func
+ : bindCallback(func, thisArg, argCount);
+ }
+ if (func == null) {
+ return identity;
+ }
+ if (type == 'object') {
+ return baseMatches(func);
+ }
+ return thisArg === undefined
+ ? property(func)
+ : baseMatchesProperty(func, thisArg);
+ }
+
+ /**
+ * The base implementation of `_.clone` without support for argument juggling
+ * and `this` binding `customizer` functions.
+ *
+ * @private
+ * @param {*} value The value to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @param {Function} [customizer] The function to customize cloning values.
+ * @param {string} [key] The key of `value`.
+ * @param {Object} [object] The object `value` belongs to.
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
+ * @param {Array} [stackB=[]] Associates clones with source counterparts.
+ * @returns {*} Returns the cloned value.
+ */
+ function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
+ var result;
+ if (customizer) {
+ result = object ? customizer(value, key, object) : customizer(value);
+ }
+ if (result !== undefined) {
+ return result;
+ }
+ if (!isObject(value)) {
+ return value;
+ }
+ var isArr = isArray(value);
+ if (isArr) {
+ result = initCloneArray(value);
+ if (!isDeep) {
+ return arrayCopy(value, result);
+ }
+ } else {
+ var tag = objToString.call(value),
+ isFunc = tag == funcTag;
+
+ if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
+ result = initCloneObject(isFunc ? {} : value);
+ if (!isDeep) {
+ return baseAssign(result, value);
+ }
+ } else {
+ return cloneableTags[tag]
+ ? initCloneByTag(value, tag, isDeep)
+ : (object ? value : {});
+ }
+ }
+ // Check for circular references and return its corresponding clone.
+ stackA || (stackA = []);
+ stackB || (stackB = []);
+
+ var length = stackA.length;
+ while (length--) {
+ if (stackA[length] == value) {
+ return stackB[length];
+ }
+ }
+ // Add the source value to the stack of traversed objects and associate it with its clone.
+ stackA.push(value);
+ stackB.push(result);
+
+ // Recursively populate clone (susceptible to call stack limits).
+ (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
+ result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.create` without support for assigning
+ * properties to the created object.
+ *
+ * @private
+ * @param {Object} prototype The object to inherit from.
+ * @returns {Object} Returns the new object.
+ */
+ var baseCreate = (function() {
+ function object() {}
+ return function(prototype) {
+ if (isObject(prototype)) {
+ object.prototype = prototype;
+ var result = new object;
+ object.prototype = undefined;
+ }
+ return result || {};
+ };
+ }());
+
+ /**
+ * The base implementation of `_.delay` and `_.defer` which accepts an index
+ * of where to slice the arguments to provide to `func`.
+ *
+ * @private
+ * @param {Function} func The function to delay.
+ * @param {number} wait The number of milliseconds to delay invocation.
+ * @param {Object} args The arguments provide to `func`.
+ * @returns {number} Returns the timer id.
+ */
+ function baseDelay(func, wait, args) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ return setTimeout(function() { func.apply(undefined, args); }, wait);
+ }
+
+ /**
+ * The base implementation of `_.difference` which accepts a single array
+ * of values to exclude.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Array} values The values to exclude.
+ * @returns {Array} Returns the new array of filtered values.
+ */
+ function baseDifference(array, values) {
+ var length = array ? array.length : 0,
+ result = [];
+
+ if (!length) {
+ return result;
+ }
+ var index = -1,
+ indexOf = getIndexOf(),
+ isCommon = indexOf == baseIndexOf,
+ cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
+ valuesLength = values.length;
+
+ if (cache) {
+ indexOf = cacheIndexOf;
+ isCommon = false;
+ values = cache;
+ }
+ outer:
+ while (++index < length) {
+ var value = array[index];
+
+ if (isCommon && value === value) {
+ var valuesIndex = valuesLength;
+ while (valuesIndex--) {
+ if (values[valuesIndex] === value) {
+ continue outer;
+ }
+ }
+ result.push(value);
+ }
+ else if (indexOf(values, value, 0) < 0) {
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.forEach` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array|Object|string} Returns `collection`.
+ */
+ var baseEach = createBaseEach(baseForOwn);
+
+ /**
+ * The base implementation of `_.forEachRight` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array|Object|string} Returns `collection`.
+ */
+ var baseEachRight = createBaseEach(baseForOwnRight, true);
+
+ /**
+ * The base implementation of `_.every` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`
+ */
+ function baseEvery(collection, predicate) {
+ var result = true;
+ baseEach(collection, function(value, index, collection) {
+ result = !!predicate(value, index, collection);
+ return result;
+ });
+ return result;
+ }
+
+ /**
+ * Gets the extremum value of `collection` invoking `iteratee` for each value
+ * in `collection` to generate the criterion by which the value is ranked.
+ * The `iteratee` is invoked with three arguments: (value, index|key, collection).
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} comparator The function used to compare values.
+ * @param {*} exValue The initial extremum value.
+ * @returns {*} Returns the extremum value.
+ */
+ function baseExtremum(collection, iteratee, comparator, exValue) {
+ var computed = exValue,
+ result = computed;
+
+ baseEach(collection, function(value, index, collection) {
+ var current = +iteratee(value, index, collection);
+ if (comparator(current, computed) || (current === exValue && current === result)) {
+ computed = current;
+ result = value;
+ }
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.fill` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to fill.
+ * @param {*} value The value to fill `array` with.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns `array`.
+ */
+ function baseFill(array, value, start, end) {
+ var length = array.length;
+
+ start = start == null ? 0 : (+start || 0);
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = (end === undefined || end > length) ? length : (+end || 0);
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : (end >>> 0);
+ start >>>= 0;
+
+ while (start < length) {
+ array[start++] = value;
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.filter` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ */
+ function baseFilter(collection, predicate) {
+ var result = [];
+ baseEach(collection, function(value, index, collection) {
+ if (predicate(value, index, collection)) {
+ result.push(value);
+ }
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
+ * without support for callback shorthands and `this` binding, which iterates
+ * over `collection` using the provided `eachFunc`.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to search.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {Function} eachFunc The function to iterate over `collection`.
+ * @param {boolean} [retKey] Specify returning the key of the found element
+ * instead of the element itself.
+ * @returns {*} Returns the found element or its key, else `undefined`.
+ */
+ function baseFind(collection, predicate, eachFunc, retKey) {
+ var result;
+ eachFunc(collection, function(value, key, collection) {
+ if (predicate(value, key, collection)) {
+ result = retKey ? key : value;
+ return false;
+ }
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.flatten` with added support for restricting
+ * flattening and specifying the start index.
+ *
+ * @private
+ * @param {Array} array The array to flatten.
+ * @param {boolean} [isDeep] Specify a deep flatten.
+ * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
+ * @param {Array} [result=[]] The initial result value.
+ * @returns {Array} Returns the new flattened array.
+ */
+ function baseFlatten(array, isDeep, isStrict, result) {
+ result || (result = []);
+
+ var index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ var value = array[index];
+ if (isObjectLike(value) && isArrayLike(value) &&
+ (isStrict || isArray(value) || isArguments(value))) {
+ if (isDeep) {
+ // Recursively flatten arrays (susceptible to call stack limits).
+ baseFlatten(value, isDeep, isStrict, result);
+ } else {
+ arrayPush(result, value);
+ }
+ } else if (!isStrict) {
+ result[result.length] = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `baseForIn` and `baseForOwn` which iterates
+ * over `object` properties returned by `keysFunc` invoking `iteratee` for
+ * each property. Iteratee functions may exit iteration early by explicitly
+ * returning `false`.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+ var baseFor = createBaseFor();
+
+ /**
+ * This function is like `baseFor` except that it iterates over properties
+ * in the opposite order.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+ var baseForRight = createBaseFor(true);
+
+ /**
+ * The base implementation of `_.forIn` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForIn(object, iteratee) {
+ return baseFor(object, iteratee, keysIn);
+ }
+
+ /**
+ * The base implementation of `_.forOwn` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForOwn(object, iteratee) {
+ return baseFor(object, iteratee, keys);
+ }
+
+ /**
+ * The base implementation of `_.forOwnRight` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForOwnRight(object, iteratee) {
+ return baseForRight(object, iteratee, keys);
+ }
+
+ /**
+ * The base implementation of `_.functions` which creates an array of
+ * `object` function property names filtered from those provided.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Array} props The property names to filter.
+ * @returns {Array} Returns the new array of filtered property names.
+ */
+ function baseFunctions(object, props) {
+ var index = -1,
+ length = props.length,
+ resIndex = -1,
+ result = [];
+
+ while (++index < length) {
+ var key = props[index];
+ if (isFunction(object[key])) {
+ result[++resIndex] = key;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `get` without support for string paths
+ * and default values.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} path The path of the property to get.
+ * @param {string} [pathKey] The key representation of path.
+ * @returns {*} Returns the resolved value.
+ */
+ function baseGet(object, path, pathKey) {
+ if (object == null) {
+ return;
+ }
+ if (pathKey !== undefined && pathKey in toObject(object)) {
+ path = [pathKey];
+ }
+ var index = 0,
+ length = path.length;
+
+ while (object != null && index < length) {
+ object = object[path[index++]];
+ }
+ return (index && index == length) ? object : undefined;
+ }
+
+ /**
+ * The base implementation of `_.isEqual` without support for `this` binding
+ * `customizer` functions.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @param {Function} [customizer] The function to customize comparing values.
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
+ * @param {Array} [stackA] Tracks traversed `value` objects.
+ * @param {Array} [stackB] Tracks traversed `other` objects.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ */
+ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
+ if (value === other) {
+ return true;
+ }
+ if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
+ return value !== value && other !== other;
+ }
+ return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
+ }
+
+ /**
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
+ * deep comparisons and tracks traversed objects enabling objects with circular
+ * references to be compared.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Function} [customizer] The function to customize comparing objects.
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
+ * @param {Array} [stackA=[]] Tracks traversed `value` objects.
+ * @param {Array} [stackB=[]] Tracks traversed `other` objects.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
+ var objIsArr = isArray(object),
+ othIsArr = isArray(other),
+ objTag = arrayTag,
+ othTag = arrayTag;
+
+ if (!objIsArr) {
+ objTag = objToString.call(object);
+ if (objTag == argsTag) {
+ objTag = objectTag;
+ } else if (objTag != objectTag) {
+ objIsArr = isTypedArray(object);
+ }
+ }
+ if (!othIsArr) {
+ othTag = objToString.call(other);
+ if (othTag == argsTag) {
+ othTag = objectTag;
+ } else if (othTag != objectTag) {
+ othIsArr = isTypedArray(other);
+ }
+ }
+ var objIsObj = objTag == objectTag,
+ othIsObj = othTag == objectTag,
+ isSameTag = objTag == othTag;
+
+ if (isSameTag && !(objIsArr || objIsObj)) {
+ return equalByTag(object, other, objTag);
+ }
+ if (!isLoose) {
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
+
+ if (objIsWrapped || othIsWrapped) {
+ return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
+ }
+ }
+ if (!isSameTag) {
+ return false;
+ }
+ // Assume cyclic values are equal.
+ // For more information on detecting circular references see https://es5.github.io/#JO.
+ stackA || (stackA = []);
+ stackB || (stackB = []);
+
+ var length = stackA.length;
+ while (length--) {
+ if (stackA[length] == object) {
+ return stackB[length] == other;
+ }
+ }
+ // Add `object` and `other` to the stack of traversed objects.
+ stackA.push(object);
+ stackB.push(other);
+
+ var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
+
+ stackA.pop();
+ stackB.pop();
+
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.isMatch` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Array} matchData The propery names, values, and compare flags to match.
+ * @param {Function} [customizer] The function to customize comparing objects.
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+ */
+ function baseIsMatch(object, matchData, customizer) {
+ var index = matchData.length,
+ length = index,
+ noCustomizer = !customizer;
+
+ if (object == null) {
+ return !length;
+ }
+ object = toObject(object);
+ while (index--) {
+ var data = matchData[index];
+ if ((noCustomizer && data[2])
+ ? data[1] !== object[data[0]]
+ : !(data[0] in object)
+ ) {
+ return false;
+ }
+ }
+ while (++index < length) {
+ data = matchData[index];
+ var key = data[0],
+ objValue = object[key],
+ srcValue = data[1];
+
+ if (noCustomizer && data[2]) {
+ if (objValue === undefined && !(key in object)) {
+ return false;
+ }
+ } else {
+ var result = customizer ? customizer(objValue, srcValue, key) : undefined;
+ if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * The base implementation of `_.map` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function baseMap(collection, iteratee) {
+ var index = -1,
+ result = isArrayLike(collection) ? Array(collection.length) : [];
+
+ baseEach(collection, function(value, key, collection) {
+ result[++index] = iteratee(value, key, collection);
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.matches` which does not clone `source`.
+ *
+ * @private
+ * @param {Object} source The object of property values to match.
+ * @returns {Function} Returns the new function.
+ */
+ function baseMatches(source) {
+ var matchData = getMatchData(source);
+ if (matchData.length == 1 && matchData[0][2]) {
+ var key = matchData[0][0],
+ value = matchData[0][1];
+
+ return function(object) {
+ if (object == null) {
+ return false;
+ }
+ return object[key] === value && (value !== undefined || (key in toObject(object)));
+ };
+ }
+ return function(object) {
+ return baseIsMatch(object, matchData);
+ };
+ }
+
+ /**
+ * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
+ *
+ * @private
+ * @param {string} path The path of the property to get.
+ * @param {*} srcValue The value to compare.
+ * @returns {Function} Returns the new function.
+ */
+ function baseMatchesProperty(path, srcValue) {
+ var isArr = isArray(path),
+ isCommon = isKey(path) && isStrictComparable(srcValue),
+ pathKey = (path + '');
+
+ path = toPath(path);
+ return function(object) {
+ if (object == null) {
+ return false;
+ }
+ var key = pathKey;
+ object = toObject(object);
+ if ((isArr || !isCommon) && !(key in object)) {
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+ if (object == null) {
+ return false;
+ }
+ key = last(path);
+ object = toObject(object);
+ }
+ return object[key] === srcValue
+ ? (srcValue !== undefined || (key in object))
+ : baseIsEqual(srcValue, object[key], undefined, true);
+ };
+ }
+
+ /**
+ * The base implementation of `_.merge` without support for argument juggling,
+ * multiple sources, and `this` binding `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {Function} [customizer] The function to customize merged values.
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
+ * @param {Array} [stackB=[]] Associates values with source counterparts.
+ * @returns {Object} Returns `object`.
+ */
+ function baseMerge(object, source, customizer, stackA, stackB) {
+ if (!isObject(object)) {
+ return object;
+ }
+ var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
+ props = isSrcArr ? undefined : keys(source);
+
+ arrayEach(props || source, function(srcValue, key) {
+ if (props) {
+ key = srcValue;
+ srcValue = source[key];
+ }
+ if (isObjectLike(srcValue)) {
+ stackA || (stackA = []);
+ stackB || (stackB = []);
+ baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
+ }
+ else {
+ var value = object[key],
+ result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
+ isCommon = result === undefined;
+
+ if (isCommon) {
+ result = srcValue;
+ }
+ if ((result !== undefined || (isSrcArr && !(key in object))) &&
+ (isCommon || (result === result ? (result !== value) : (value === value)))) {
+ object[key] = result;
+ }
+ }
+ });
+ return object;
+ }
+
+ /**
+ * A specialized version of `baseMerge` for arrays and objects which performs
+ * deep merges and tracks traversed objects enabling objects with circular
+ * references to be merged.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {string} key The key of the value to merge.
+ * @param {Function} mergeFunc The function to merge values.
+ * @param {Function} [customizer] The function to customize merged values.
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
+ * @param {Array} [stackB=[]] Associates values with source counterparts.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
+ var length = stackA.length,
+ srcValue = source[key];
+
+ while (length--) {
+ if (stackA[length] == srcValue) {
+ object[key] = stackB[length];
+ return;
+ }
+ }
+ var value = object[key],
+ result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
+ isCommon = result === undefined;
+
+ if (isCommon) {
+ result = srcValue;
+ if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
+ result = isArray(value)
+ ? value
+ : (isArrayLike(value) ? arrayCopy(value) : []);
+ }
+ else if (isPlainObject(srcValue) || isArguments(srcValue)) {
+ result = isArguments(value)
+ ? toPlainObject(value)
+ : (isPlainObject(value) ? value : {});
+ }
+ else {
+ isCommon = false;
+ }
+ }
+ // Add the source value to the stack of traversed objects and associate
+ // it with its merged value.
+ stackA.push(srcValue);
+ stackB.push(result);
+
+ if (isCommon) {
+ // Recursively merge objects and arrays (susceptible to call stack limits).
+ object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
+ } else if (result === result ? (result !== value) : (value === value)) {
+ object[key] = result;
+ }
+ }
+
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ /**
+ * A specialized version of `baseProperty` which supports deep paths.
+ *
+ * @private
+ * @param {Array|string} path The path of the property to get.
+ * @returns {Function} Returns the new function.
+ */
+ function basePropertyDeep(path) {
+ var pathKey = (path + '');
+ path = toPath(path);
+ return function(object) {
+ return baseGet(object, path, pathKey);
+ };
+ }
+
+ /**
+ * The base implementation of `_.pullAt` without support for individual
+ * index arguments and capturing the removed elements.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {number[]} indexes The indexes of elements to remove.
+ * @returns {Array} Returns `array`.
+ */
+ function basePullAt(array, indexes) {
+ var length = array ? indexes.length : 0;
+ while (length--) {
+ var index = indexes[length];
+ if (index != previous && isIndex(index)) {
+ var previous = index;
+ splice.call(array, index, 1);
+ }
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.random` without support for argument juggling
+ * and returning floating-point numbers.
+ *
+ * @private
+ * @param {number} min The minimum possible value.
+ * @param {number} max The maximum possible value.
+ * @returns {number} Returns the random number.
+ */
+ function baseRandom(min, max) {
+ return min + nativeFloor(nativeRandom() * (max - min + 1));
+ }
+
+ /**
+ * The base implementation of `_.reduce` and `_.reduceRight` without support
+ * for callback shorthands and `this` binding, which iterates over `collection`
+ * using the provided `eachFunc`.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} accumulator The initial value.
+ * @param {boolean} initFromCollection Specify using the first or last element
+ * of `collection` as the initial value.
+ * @param {Function} eachFunc The function to iterate over `collection`.
+ * @returns {*} Returns the accumulated value.
+ */
+ function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
+ eachFunc(collection, function(value, index, collection) {
+ accumulator = initFromCollection
+ ? (initFromCollection = false, value)
+ : iteratee(accumulator, value, index, collection);
+ });
+ return accumulator;
+ }
+
+ /**
+ * The base implementation of `setData` without support for hot loop detection.
+ *
+ * @private
+ * @param {Function} func The function to associate metadata with.
+ * @param {*} data The metadata.
+ * @returns {Function} Returns `func`.
+ */
+ var baseSetData = !metaMap ? identity : function(func, data) {
+ metaMap.set(func, data);
+ return func;
+ };
+
+ /**
+ * The base implementation of `_.slice` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+ function baseSlice(array, start, end) {
+ var index = -1,
+ length = array.length;
+
+ start = start == null ? 0 : (+start || 0);
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = (end === undefined || end > length) ? length : (+end || 0);
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : ((end - start) >>> 0);
+ start >>>= 0;
+
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = array[index + start];
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.some` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ */
+ function baseSome(collection, predicate) {
+ var result;
+
+ baseEach(collection, function(value, index, collection) {
+ result = predicate(value, index, collection);
+ return !result;
+ });
+ return !!result;
+ }
+
+ /**
+ * The base implementation of `_.sortBy` which uses `comparer` to define
+ * the sort order of `array` and replaces criteria objects with their
+ * corresponding values.
+ *
+ * @private
+ * @param {Array} array The array to sort.
+ * @param {Function} comparer The function to define sort order.
+ * @returns {Array} Returns `array`.
+ */
+ function baseSortBy(array, comparer) {
+ var length = array.length;
+
+ array.sort(comparer);
+ while (length--) {
+ array[length] = array[length].value;
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.sortByOrder` without param guards.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+ * @param {boolean[]} orders The sort orders of `iteratees`.
+ * @returns {Array} Returns the new sorted array.
+ */
+ function baseSortByOrder(collection, iteratees, orders) {
+ var callback = getCallback(),
+ index = -1;
+
+ iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
+
+ var result = baseMap(collection, function(value) {
+ var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
+ return { 'criteria': criteria, 'index': ++index, 'value': value };
+ });
+
+ return baseSortBy(result, function(object, other) {
+ return compareMultiple(object, other, orders);
+ });
+ }
+
+ /**
+ * The base implementation of `_.sum` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the sum.
+ */
+ function baseSum(collection, iteratee) {
+ var result = 0;
+ baseEach(collection, function(value, index, collection) {
+ result += +iteratee(value, index, collection) || 0;
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.uniq` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee] The function invoked per iteration.
+ * @returns {Array} Returns the new duplicate-value-free array.
+ */
+ function baseUniq(array, iteratee) {
+ var index = -1,
+ indexOf = getIndexOf(),
+ length = array.length,
+ isCommon = indexOf == baseIndexOf,
+ isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
+ seen = isLarge ? createCache() : null,
+ result = [];
+
+ if (seen) {
+ indexOf = cacheIndexOf;
+ isCommon = false;
+ } else {
+ isLarge = false;
+ seen = iteratee ? [] : result;
+ }
+ outer:
+ while (++index < length) {
+ var value = array[index],
+ computed = iteratee ? iteratee(value, index, array) : value;
+
+ if (isCommon && value === value) {
+ var seenIndex = seen.length;
+ while (seenIndex--) {
+ if (seen[seenIndex] === computed) {
+ continue outer;
+ }
+ }
+ if (iteratee) {
+ seen.push(computed);
+ }
+ result.push(value);
+ }
+ else if (indexOf(seen, computed, 0) < 0) {
+ if (iteratee || isLarge) {
+ seen.push(computed);
+ }
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
+ * array of `object` property values corresponding to the property names
+ * of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the array of property values.
+ */
+ function baseValues(object, props) {
+ var index = -1,
+ length = props.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = object[props[index]];
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,
+ * and `_.takeWhile` without support for callback shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to query.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Array} Returns the slice of `array`.
+ */
+ function baseWhile(array, predicate, isDrop, fromRight) {
+ var length = array.length,
+ index = fromRight ? length : -1;
+
+ while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
+ return isDrop
+ ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
+ : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
+ }
+
+ /**
+ * The base implementation of `wrapperValue` which returns the result of
+ * performing a sequence of actions on the unwrapped `value`, where each
+ * successive action is supplied the return value of the previous.
+ *
+ * @private
+ * @param {*} value The unwrapped value.
+ * @param {Array} actions Actions to peform to resolve the unwrapped value.
+ * @returns {*} Returns the resolved value.
+ */
+ function baseWrapperValue(value, actions) {
+ var result = value;
+ if (result instanceof LazyWrapper) {
+ result = result.value();
+ }
+ var index = -1,
+ length = actions.length;
+
+ while (++index < length) {
+ var action = actions[index];
+ result = action.func.apply(action.thisArg, arrayPush([result], action.args));
+ }
+ return result;
+ }
+
+ /**
+ * Performs a binary search of `array` to determine the index at which `value`
+ * should be inserted into `array` in order to maintain its sort order.
+ *
+ * @private
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ */
+ function binaryIndex(array, value, retHighest) {
+ var low = 0,
+ high = array ? array.length : low;
+
+ if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
+ while (low < high) {
+ var mid = (low + high) >>> 1,
+ computed = array[mid];
+
+ if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
+ low = mid + 1;
+ } else {
+ high = mid;
+ }
+ }
+ return high;
+ }
+ return binaryIndexBy(array, value, identity, retHighest);
+ }
+
+ /**
+ * This function is like `binaryIndex` except that it invokes `iteratee` for
+ * `value` and each element of `array` to compute their sort ranking. The
+ * iteratee is invoked with one argument; (value).
+ *
+ * @private
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ */
+ function binaryIndexBy(array, value, iteratee, retHighest) {
+ value = iteratee(value);
+
+ var low = 0,
+ high = array ? array.length : 0,
+ valIsNaN = value !== value,
+ valIsNull = value === null,
+ valIsUndef = value === undefined;
+
+ while (low < high) {
+ var mid = nativeFloor((low + high) / 2),
+ computed = iteratee(array[mid]),
+ isDef = computed !== undefined,
+ isReflexive = computed === computed;
+
+ if (valIsNaN) {
+ var setLow = isReflexive || retHighest;
+ } else if (valIsNull) {
+ setLow = isReflexive && isDef && (retHighest || computed != null);
+ } else if (valIsUndef) {
+ setLow = isReflexive && (retHighest || isDef);
+ } else if (computed == null) {
+ setLow = false;
+ } else {
+ setLow = retHighest ? (computed <= value) : (computed < value);
+ }
+ if (setLow) {
+ low = mid + 1;
+ } else {
+ high = mid;
+ }
+ }
+ return nativeMin(high, MAX_ARRAY_INDEX);
+ }
+
+ /**
+ * A specialized version of `baseCallback` which only supports `this` binding
+ * and specifying the number of arguments to provide to `func`.
+ *
+ * @private
+ * @param {Function} func The function to bind.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {number} [argCount] The number of arguments to provide to `func`.
+ * @returns {Function} Returns the callback.
+ */
+ function bindCallback(func, thisArg, argCount) {
+ if (typeof func != 'function') {
+ return identity;
+ }
+ if (thisArg === undefined) {
+ return func;
+ }
+ switch (argCount) {
+ case 1: return function(value) {
+ return func.call(thisArg, value);
+ };
+ case 3: return function(value, index, collection) {
+ return func.call(thisArg, value, index, collection);
+ };
+ case 4: return function(accumulator, value, index, collection) {
+ return func.call(thisArg, accumulator, value, index, collection);
+ };
+ case 5: return function(value, other, key, object, source) {
+ return func.call(thisArg, value, other, key, object, source);
+ };
+ }
+ return function() {
+ return func.apply(thisArg, arguments);
+ };
+ }
+
+ /**
+ * Creates a clone of the given array buffer.
+ *
+ * @private
+ * @param {ArrayBuffer} buffer The array buffer to clone.
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
+ */
+ function bufferClone(buffer) {
+ var result = new ArrayBuffer(buffer.byteLength),
+ view = new Uint8Array(result);
+
+ view.set(new Uint8Array(buffer));
+ return result;
+ }
+
+ /**
+ * Creates an array that is the composition of partially applied arguments,
+ * placeholders, and provided arguments into a single array of arguments.
+ *
+ * @private
+ * @param {Array|Object} args The provided arguments.
+ * @param {Array} partials The arguments to prepend to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
+ * @returns {Array} Returns the new array of composed arguments.
+ */
+ function composeArgs(args, partials, holders) {
+ var holdersLength = holders.length,
+ argsIndex = -1,
+ argsLength = nativeMax(args.length - holdersLength, 0),
+ leftIndex = -1,
+ leftLength = partials.length,
+ result = Array(leftLength + argsLength);
+
+ while (++leftIndex < leftLength) {
+ result[leftIndex] = partials[leftIndex];
+ }
+ while (++argsIndex < holdersLength) {
+ result[holders[argsIndex]] = args[argsIndex];
+ }
+ while (argsLength--) {
+ result[leftIndex++] = args[argsIndex++];
+ }
+ return result;
+ }
+
+ /**
+ * This function is like `composeArgs` except that the arguments composition
+ * is tailored for `_.partialRight`.
+ *
+ * @private
+ * @param {Array|Object} args The provided arguments.
+ * @param {Array} partials The arguments to append to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
+ * @returns {Array} Returns the new array of composed arguments.
+ */
+ function composeArgsRight(args, partials, holders) {
+ var holdersIndex = -1,
+ holdersLength = holders.length,
+ argsIndex = -1,
+ argsLength = nativeMax(args.length - holdersLength, 0),
+ rightIndex = -1,
+ rightLength = partials.length,
+ result = Array(argsLength + rightLength);
+
+ while (++argsIndex < argsLength) {
+ result[argsIndex] = args[argsIndex];
+ }
+ var offset = argsIndex;
+ while (++rightIndex < rightLength) {
+ result[offset + rightIndex] = partials[rightIndex];
+ }
+ while (++holdersIndex < holdersLength) {
+ result[offset + holders[holdersIndex]] = args[argsIndex++];
+ }
+ return result;
+ }
+
+ /**
+ * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.
+ *
+ * @private
+ * @param {Function} setter The function to set keys and values of the accumulator object.
+ * @param {Function} [initializer] The function to initialize the accumulator object.
+ * @returns {Function} Returns the new aggregator function.
+ */
+ function createAggregator(setter, initializer) {
+ return function(collection, iteratee, thisArg) {
+ var result = initializer ? initializer() : {};
+ iteratee = getCallback(iteratee, thisArg, 3);
+
+ if (isArray(collection)) {
+ var index = -1,
+ length = collection.length;
+
+ while (++index < length) {
+ var value = collection[index];
+ setter(result, value, iteratee(value, index, collection), collection);
+ }
+ } else {
+ baseEach(collection, function(value, key, collection) {
+ setter(result, value, iteratee(value, key, collection), collection);
+ });
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
+ *
+ * @private
+ * @param {Function} assigner The function to assign values.
+ * @returns {Function} Returns the new assigner function.
+ */
+ function createAssigner(assigner) {
+ return restParam(function(object, sources) {
+ var index = -1,
+ length = object == null ? 0 : sources.length,
+ customizer = length > 2 ? sources[length - 2] : undefined,
+ guard = length > 2 ? sources[2] : undefined,
+ thisArg = length > 1 ? sources[length - 1] : undefined;
+
+ if (typeof customizer == 'function') {
+ customizer = bindCallback(customizer, thisArg, 5);
+ length -= 2;
+ } else {
+ customizer = typeof thisArg == 'function' ? thisArg : undefined;
+ length -= (customizer ? 1 : 0);
+ }
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+ customizer = length < 3 ? undefined : customizer;
+ length = 1;
+ }
+ while (++index < length) {
+ var source = sources[index];
+ if (source) {
+ assigner(object, source, customizer);
+ }
+ }
+ return object;
+ });
+ }
+
+ /**
+ * Creates a `baseEach` or `baseEachRight` function.
+ *
+ * @private
+ * @param {Function} eachFunc The function to iterate over a collection.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+ function createBaseEach(eachFunc, fromRight) {
+ return function(collection, iteratee) {
+ var length = collection ? getLength(collection) : 0;
+ if (!isLength(length)) {
+ return eachFunc(collection, iteratee);
+ }
+ var index = fromRight ? length : -1,
+ iterable = toObject(collection);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ if (iteratee(iterable[index], index, iterable) === false) {
+ break;
+ }
+ }
+ return collection;
+ };
+ }
+
+ /**
+ * Creates a base function for `_.forIn` or `_.forInRight`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+ function createBaseFor(fromRight) {
+ return function(object, iteratee, keysFunc) {
+ var iterable = toObject(object),
+ props = keysFunc(object),
+ length = props.length,
+ index = fromRight ? length : -1;
+
+ while ((fromRight ? index-- : ++index < length)) {
+ var key = props[index];
+ if (iteratee(iterable[key], key, iterable) === false) {
+ break;
+ }
+ }
+ return object;
+ };
+ }
+
+ /**
+ * Creates a function that wraps `func` and invokes it with the `this`
+ * binding of `thisArg`.
+ *
+ * @private
+ * @param {Function} func The function to bind.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @returns {Function} Returns the new bound function.
+ */
+ function createBindWrapper(func, thisArg) {
+ var Ctor = createCtorWrapper(func);
+
+ function wrapper() {
+ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+ return fn.apply(thisArg, arguments);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates a `Set` cache object to optimize linear searches of large arrays.
+ *
+ * @private
+ * @param {Array} [values] The values to cache.
+ * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
+ */
+ function createCache(values) {
+ return (nativeCreate && Set) ? new SetCache(values) : null;
+ }
+
+ /**
+ * Creates a function that produces compound words out of the words in a
+ * given string.
+ *
+ * @private
+ * @param {Function} callback The function to combine each word.
+ * @returns {Function} Returns the new compounder function.
+ */
+ function createCompounder(callback) {
+ return function(string) {
+ var index = -1,
+ array = words(deburr(string)),
+ length = array.length,
+ result = '';
+
+ while (++index < length) {
+ result = callback(result, array[index], index);
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Creates a function that produces an instance of `Ctor` regardless of
+ * whether it was invoked as part of a `new` expression or by `call` or `apply`.
+ *
+ * @private
+ * @param {Function} Ctor The constructor to wrap.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createCtorWrapper(Ctor) {
+ return function() {
+ // Use a `switch` statement to work with class constructors.
+ // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
+ // for more details.
+ var args = arguments;
+ switch (args.length) {
+ case 0: return new Ctor;
+ case 1: return new Ctor(args[0]);
+ case 2: return new Ctor(args[0], args[1]);
+ case 3: return new Ctor(args[0], args[1], args[2]);
+ case 4: return new Ctor(args[0], args[1], args[2], args[3]);
+ case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
+ case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
+ case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+ }
+ var thisBinding = baseCreate(Ctor.prototype),
+ result = Ctor.apply(thisBinding, args);
+
+ // Mimic the constructor's `return` behavior.
+ // See https://es5.github.io/#x13.2.2 for more details.
+ return isObject(result) ? result : thisBinding;
+ };
+ }
+
+ /**
+ * Creates a `_.curry` or `_.curryRight` function.
+ *
+ * @private
+ * @param {boolean} flag The curry bit flag.
+ * @returns {Function} Returns the new curry function.
+ */
+ function createCurry(flag) {
+ function curryFunc(func, arity, guard) {
+ if (guard && isIterateeCall(func, arity, guard)) {
+ arity = undefined;
+ }
+ var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);
+ result.placeholder = curryFunc.placeholder;
+ return result;
+ }
+ return curryFunc;
+ }
+
+ /**
+ * Creates a `_.defaults` or `_.defaultsDeep` function.
+ *
+ * @private
+ * @param {Function} assigner The function to assign values.
+ * @param {Function} customizer The function to customize assigned values.
+ * @returns {Function} Returns the new defaults function.
+ */
+ function createDefaults(assigner, customizer) {
+ return restParam(function(args) {
+ var object = args[0];
+ if (object == null) {
+ return object;
+ }
+ args.push(customizer);
+ return assigner.apply(undefined, args);
+ });
+ }
+
+ /**
+ * Creates a `_.max` or `_.min` function.
+ *
+ * @private
+ * @param {Function} comparator The function used to compare values.
+ * @param {*} exValue The initial extremum value.
+ * @returns {Function} Returns the new extremum function.
+ */
+ function createExtremum(comparator, exValue) {
+ return function(collection, iteratee, thisArg) {
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+ iteratee = undefined;
+ }
+ iteratee = getCallback(iteratee, thisArg, 3);
+ if (iteratee.length == 1) {
+ collection = isArray(collection) ? collection : toIterable(collection);
+ var result = arrayExtremum(collection, iteratee, comparator, exValue);
+ if (!(collection.length && result === exValue)) {
+ return result;
+ }
+ }
+ return baseExtremum(collection, iteratee, comparator, exValue);
+ };
+ }
+
+ /**
+ * Creates a `_.find` or `_.findLast` function.
+ *
+ * @private
+ * @param {Function} eachFunc The function to iterate over a collection.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new find function.
+ */
+ function createFind(eachFunc, fromRight) {
+ return function(collection, predicate, thisArg) {
+ predicate = getCallback(predicate, thisArg, 3);
+ if (isArray(collection)) {
+ var index = baseFindIndex(collection, predicate, fromRight);
+ return index > -1 ? collection[index] : undefined;
+ }
+ return baseFind(collection, predicate, eachFunc);
+ };
+ }
+
+ /**
+ * Creates a `_.findIndex` or `_.findLastIndex` function.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new find function.
+ */
+ function createFindIndex(fromRight) {
+ return function(array, predicate, thisArg) {
+ if (!(array && array.length)) {
+ return -1;
+ }
+ predicate = getCallback(predicate, thisArg, 3);
+ return baseFindIndex(array, predicate, fromRight);
+ };
+ }
+
+ /**
+ * Creates a `_.findKey` or `_.findLastKey` function.
+ *
+ * @private
+ * @param {Function} objectFunc The function to iterate over an object.
+ * @returns {Function} Returns the new find function.
+ */
+ function createFindKey(objectFunc) {
+ return function(object, predicate, thisArg) {
+ predicate = getCallback(predicate, thisArg, 3);
+ return baseFind(object, predicate, objectFunc, true);
+ };
+ }
+
+ /**
+ * Creates a `_.flow` or `_.flowRight` function.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new flow function.
+ */
+ function createFlow(fromRight) {
+ return function() {
+ var wrapper,
+ length = arguments.length,
+ index = fromRight ? length : -1,
+ leftIndex = 0,
+ funcs = Array(length);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ var func = funcs[leftIndex++] = arguments[index];
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
+ wrapper = new LodashWrapper([], true);
+ }
+ }
+ index = wrapper ? -1 : length;
+ while (++index < length) {
+ func = funcs[index];
+
+ var funcName = getFuncName(func),
+ data = funcName == 'wrapper' ? getData(func) : undefined;
+
+ if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
+ wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
+ } else {
+ wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
+ }
+ }
+ return function() {
+ var args = arguments,
+ value = args[0];
+
+ if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
+ return wrapper.plant(value).value();
+ }
+ var index = 0,
+ result = length ? funcs[index].apply(this, args) : value;
+
+ while (++index < length) {
+ result = funcs[index].call(this, result);
+ }
+ return result;
+ };
+ };
+ }
+
+ /**
+ * Creates a function for `_.forEach` or `_.forEachRight`.
+ *
+ * @private
+ * @param {Function} arrayFunc The function to iterate over an array.
+ * @param {Function} eachFunc The function to iterate over a collection.
+ * @returns {Function} Returns the new each function.
+ */
+ function createForEach(arrayFunc, eachFunc) {
+ return function(collection, iteratee, thisArg) {
+ return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
+ ? arrayFunc(collection, iteratee)
+ : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
+ };
+ }
+
+ /**
+ * Creates a function for `_.forIn` or `_.forInRight`.
+ *
+ * @private
+ * @param {Function} objectFunc The function to iterate over an object.
+ * @returns {Function} Returns the new each function.
+ */
+ function createForIn(objectFunc) {
+ return function(object, iteratee, thisArg) {
+ if (typeof iteratee != 'function' || thisArg !== undefined) {
+ iteratee = bindCallback(iteratee, thisArg, 3);
+ }
+ return objectFunc(object, iteratee, keysIn);
+ };
+ }
+
+ /**
+ * Creates a function for `_.forOwn` or `_.forOwnRight`.
+ *
+ * @private
+ * @param {Function} objectFunc The function to iterate over an object.
+ * @returns {Function} Returns the new each function.
+ */
+ function createForOwn(objectFunc) {
+ return function(object, iteratee, thisArg) {
+ if (typeof iteratee != 'function' || thisArg !== undefined) {
+ iteratee = bindCallback(iteratee, thisArg, 3);
+ }
+ return objectFunc(object, iteratee);
+ };
+ }
+
+ /**
+ * Creates a function for `_.mapKeys` or `_.mapValues`.
+ *
+ * @private
+ * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
+ * @returns {Function} Returns the new map function.
+ */
+ function createObjectMapper(isMapKeys) {
+ return function(object, iteratee, thisArg) {
+ var result = {};
+ iteratee = getCallback(iteratee, thisArg, 3);
+
+ baseForOwn(object, function(value, key, object) {
+ var mapped = iteratee(value, key, object);
+ key = isMapKeys ? mapped : key;
+ value = isMapKeys ? value : mapped;
+ result[key] = value;
+ });
+ return result;
+ };
+ }
+
+ /**
+ * Creates a function for `_.padLeft` or `_.padRight`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify padding from the right.
+ * @returns {Function} Returns the new pad function.
+ */
+ function createPadDir(fromRight) {
+ return function(string, length, chars) {
+ string = baseToString(string);
+ return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
+ };
+ }
+
+ /**
+ * Creates a `_.partial` or `_.partialRight` function.
+ *
+ * @private
+ * @param {boolean} flag The partial bit flag.
+ * @returns {Function} Returns the new partial function.
+ */
+ function createPartial(flag) {
+ var partialFunc = restParam(function(func, partials) {
+ var holders = replaceHolders(partials, partialFunc.placeholder);
+ return createWrapper(func, flag, undefined, partials, holders);
+ });
+ return partialFunc;
+ }
+
+ /**
+ * Creates a function for `_.reduce` or `_.reduceRight`.
+ *
+ * @private
+ * @param {Function} arrayFunc The function to iterate over an array.
+ * @param {Function} eachFunc The function to iterate over a collection.
+ * @returns {Function} Returns the new each function.
+ */
+ function createReduce(arrayFunc, eachFunc) {
+ return function(collection, iteratee, accumulator, thisArg) {
+ var initFromArray = arguments.length < 3;
+ return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
+ ? arrayFunc(collection, iteratee, accumulator, initFromArray)
+ : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
+ };
+ }
+
+ /**
+ * Creates a function that wraps `func` and invokes it with optional `this`
+ * binding of, partial application, and currying.
+ *
+ * @private
+ * @param {Function|string} func The function or method name to reference.
+ * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
+ * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [ary] The arity cap of `func`.
+ * @param {number} [arity] The arity of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
+ var isAry = bitmask & ARY_FLAG,
+ isBind = bitmask & BIND_FLAG,
+ isBindKey = bitmask & BIND_KEY_FLAG,
+ isCurry = bitmask & CURRY_FLAG,
+ isCurryBound = bitmask & CURRY_BOUND_FLAG,
+ isCurryRight = bitmask & CURRY_RIGHT_FLAG,
+ Ctor = isBindKey ? undefined : createCtorWrapper(func);
+
+ function wrapper() {
+ // Avoid `arguments` object use disqualifying optimizations by
+ // converting it to an array before providing it to other functions.
+ var length = arguments.length,
+ index = length,
+ args = Array(length);
+
+ while (index--) {
+ args[index] = arguments[index];
+ }
+ if (partials) {
+ args = composeArgs(args, partials, holders);
+ }
+ if (partialsRight) {
+ args = composeArgsRight(args, partialsRight, holdersRight);
+ }
+ if (isCurry || isCurryRight) {
+ var placeholder = wrapper.placeholder,
+ argsHolders = replaceHolders(args, placeholder);
+
+ length -= argsHolders.length;
+ if (length < arity) {
+ var newArgPos = argPos ? arrayCopy(argPos) : undefined,
+ newArity = nativeMax(arity - length, 0),
+ newsHolders = isCurry ? argsHolders : undefined,
+ newHoldersRight = isCurry ? undefined : argsHolders,
+ newPartials = isCurry ? args : undefined,
+ newPartialsRight = isCurry ? undefined : args;
+
+ bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
+ bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
+
+ if (!isCurryBound) {
+ bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
+ }
+ var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
+ result = createHybridWrapper.apply(undefined, newData);
+
+ if (isLaziable(func)) {
+ setData(result, newData);
+ }
+ result.placeholder = placeholder;
+ return result;
+ }
+ }
+ var thisBinding = isBind ? thisArg : this,
+ fn = isBindKey ? thisBinding[func] : func;
+
+ if (argPos) {
+ args = reorder(args, argPos);
+ }
+ if (isAry && ary < args.length) {
+ args.length = ary;
+ }
+ if (this && this !== root && this instanceof wrapper) {
+ fn = Ctor || createCtorWrapper(func);
+ }
+ return fn.apply(thisBinding, args);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates the padding required for `string` based on the given `length`.
+ * The `chars` string is truncated if the number of characters exceeds `length`.
+ *
+ * @private
+ * @param {string} string The string to create padding for.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the pad for `string`.
+ */
+ function createPadding(string, length, chars) {
+ var strLength = string.length;
+ length = +length;
+
+ if (strLength >= length || !nativeIsFinite(length)) {
+ return '';
+ }
+ var padLength = length - strLength;
+ chars = chars == null ? ' ' : (chars + '');
+ return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
+ }
+
+ /**
+ * Creates a function that wraps `func` and invokes it with the optional `this`
+ * binding of `thisArg` and the `partials` prepended to those provided to
+ * the wrapper.
+ *
+ * @private
+ * @param {Function} func The function to partially apply arguments to.
+ * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {Array} partials The arguments to prepend to those provided to the new function.
+ * @returns {Function} Returns the new bound function.
+ */
+ function createPartialWrapper(func, bitmask, thisArg, partials) {
+ var isBind = bitmask & BIND_FLAG,
+ Ctor = createCtorWrapper(func);
+
+ function wrapper() {
+ // Avoid `arguments` object use disqualifying optimizations by
+ // converting it to an array before providing it `func`.
+ var argsIndex = -1,
+ argsLength = arguments.length,
+ leftIndex = -1,
+ leftLength = partials.length,
+ args = Array(leftLength + argsLength);
+
+ while (++leftIndex < leftLength) {
+ args[leftIndex] = partials[leftIndex];
+ }
+ while (argsLength--) {
+ args[leftIndex++] = arguments[++argsIndex];
+ }
+ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+ return fn.apply(isBind ? thisArg : this, args);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates a `_.ceil`, `_.floor`, or `_.round` function.
+ *
+ * @private
+ * @param {string} methodName The name of the `Math` method to use when rounding.
+ * @returns {Function} Returns the new round function.
+ */
+ function createRound(methodName) {
+ var func = Math[methodName];
+ return function(number, precision) {
+ precision = precision === undefined ? 0 : (+precision || 0);
+ if (precision) {
+ precision = pow(10, precision);
+ return func(number * precision) / precision;
+ }
+ return func(number);
+ };
+ }
+
+ /**
+ * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
+ *
+ * @private
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
+ * @returns {Function} Returns the new index function.
+ */
+ function createSortedIndex(retHighest) {
+ return function(array, value, iteratee, thisArg) {
+ var callback = getCallback(iteratee);
+ return (iteratee == null && callback === baseCallback)
+ ? binaryIndex(array, value, retHighest)
+ : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
+ };
+ }
+
+ /**
+ * Creates a function that either curries or invokes `func` with optional
+ * `this` binding and partially applied arguments.
+ *
+ * @private
+ * @param {Function|string} func The function or method name to reference.
+ * @param {number} bitmask The bitmask of flags.
+ * The bitmask may be composed of the following flags:
+ * 1 - `_.bind`
+ * 2 - `_.bindKey`
+ * 4 - `_.curry` or `_.curryRight` of a bound function
+ * 8 - `_.curry`
+ * 16 - `_.curryRight`
+ * 32 - `_.partial`
+ * 64 - `_.partialRight`
+ * 128 - `_.rearg`
+ * 256 - `_.ary`
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {Array} [partials] The arguments to be partially applied.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [ary] The arity cap of `func`.
+ * @param {number} [arity] The arity of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
+ var isBindKey = bitmask & BIND_KEY_FLAG;
+ if (!isBindKey && typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ var length = partials ? partials.length : 0;
+ if (!length) {
+ bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
+ partials = holders = undefined;
+ }
+ length -= (holders ? holders.length : 0);
+ if (bitmask & PARTIAL_RIGHT_FLAG) {
+ var partialsRight = partials,
+ holdersRight = holders;
+
+ partials = holders = undefined;
+ }
+ var data = isBindKey ? undefined : getData(func),
+ newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
+
+ if (data) {
+ mergeData(newData, data);
+ bitmask = newData[1];
+ arity = newData[9];
+ }
+ newData[9] = arity == null
+ ? (isBindKey ? 0 : func.length)
+ : (nativeMax(arity - length, 0) || 0);
+
+ if (bitmask == BIND_FLAG) {
+ var result = createBindWrapper(newData[0], newData[2]);
+ } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
+ result = createPartialWrapper.apply(undefined, newData);
+ } else {
+ result = createHybridWrapper.apply(undefined, newData);
+ }
+ var setter = data ? baseSetData : setData;
+ return setter(result, newData);
+ }
+
+ /**
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
+ * partial deep comparisons.
+ *
+ * @private
+ * @param {Array} array The array to compare.
+ * @param {Array} other The other array to compare.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Function} [customizer] The function to customize comparing arrays.
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
+ * @param {Array} [stackA] Tracks traversed `value` objects.
+ * @param {Array} [stackB] Tracks traversed `other` objects.
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
+ */
+ function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
+ var index = -1,
+ arrLength = array.length,
+ othLength = other.length;
+
+ if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
+ return false;
+ }
+ // Ignore non-index properties.
+ while (++index < arrLength) {
+ var arrValue = array[index],
+ othValue = other[index],
+ result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
+
+ if (result !== undefined) {
+ if (result) {
+ continue;
+ }
+ return false;
+ }
+ // Recursively compare arrays (susceptible to call stack limits).
+ if (isLoose) {
+ if (!arraySome(other, function(othValue) {
+ return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
+ })) {
+ return false;
+ }
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
+ * the same `toStringTag`.
+ *
+ * **Note:** This function only supports comparing values with tags of
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {string} tag The `toStringTag` of the objects to compare.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function equalByTag(object, other, tag) {
+ switch (tag) {
+ case boolTag:
+ case dateTag:
+ // Coerce dates and booleans to numbers, dates to milliseconds and booleans
+ // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
+ return +object == +other;
+
+ case errorTag:
+ return object.name == other.name && object.message == other.message;
+
+ case numberTag:
+ // Treat `NaN` vs. `NaN` as equal.
+ return (object != +object)
+ ? other != +other
+ : object == +other;
+
+ case regexpTag:
+ case stringTag:
+ // Coerce regexes to strings and treat strings primitives and string
+ // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
+ return object == (other + '');
+ }
+ return false;
+ }
+
+ /**
+ * A specialized version of `baseIsEqualDeep` for objects with support for
+ * partial deep comparisons.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Function} [customizer] The function to customize comparing values.
+ * @param {boolean} [isLoose] Specify performing partial comparisons.
+ * @param {Array} [stackA] Tracks traversed `value` objects.
+ * @param {Array} [stackB] Tracks traversed `other` objects.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
+ var objProps = keys(object),
+ objLength = objProps.length,
+ othProps = keys(other),
+ othLength = othProps.length;
+
+ if (objLength != othLength && !isLoose) {
+ return false;
+ }
+ var index = objLength;
+ while (index--) {
+ var key = objProps[index];
+ if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
+ return false;
+ }
+ }
+ var skipCtor = isLoose;
+ while (++index < objLength) {
+ key = objProps[index];
+ var objValue = object[key],
+ othValue = other[key],
+ result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
+
+ // Recursively compare objects (susceptible to call stack limits).
+ if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
+ return false;
+ }
+ skipCtor || (skipCtor = key == 'constructor');
+ }
+ if (!skipCtor) {
+ var objCtor = object.constructor,
+ othCtor = other.constructor;
+
+ // Non `Object` object instances with different constructors are not equal.
+ if (objCtor != othCtor &&
+ ('constructor' in object && 'constructor' in other) &&
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Gets the appropriate "callback" function. If the `_.callback` method is
+ * customized this function returns the custom method, otherwise it returns
+ * the `baseCallback` function. If arguments are provided the chosen function
+ * is invoked with them and its result is returned.
+ *
+ * @private
+ * @returns {Function} Returns the chosen function or its result.
+ */
+ function getCallback(func, thisArg, argCount) {
+ var result = lodash.callback || callback;
+ result = result === callback ? baseCallback : result;
+ return argCount ? result(func, thisArg, argCount) : result;
+ }
+
+ /**
+ * Gets metadata for `func`.
+ *
+ * @private
+ * @param {Function} func The function to query.
+ * @returns {*} Returns the metadata for `func`.
+ */
+ var getData = !metaMap ? noop : function(func) {
+ return metaMap.get(func);
+ };
+
+ /**
+ * Gets the name of `func`.
+ *
+ * @private
+ * @param {Function} func The function to query.
+ * @returns {string} Returns the function name.
+ */
+ function getFuncName(func) {
+ var result = func.name,
+ array = realNames[result],
+ length = array ? array.length : 0;
+
+ while (length--) {
+ var data = array[length],
+ otherFunc = data.func;
+ if (otherFunc == null || otherFunc == func) {
+ return data.name;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+ * customized this function returns the custom method, otherwise it returns
+ * the `baseIndexOf` function. If arguments are provided the chosen function
+ * is invoked with them and its result is returned.
+ *
+ * @private
+ * @returns {Function|number} Returns the chosen function or its result.
+ */
+ function getIndexOf(collection, target, fromIndex) {
+ var result = lodash.indexOf || indexOf;
+ result = result === indexOf ? baseIndexOf : result;
+ return collection ? result(collection, target, fromIndex) : result;
+ }
+
+ /**
+ * Gets the "length" property value of `object`.
+ *
+ * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
+ * that affects Safari on at least iOS 8.1-8.3 ARM64.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {*} Returns the "length" value.
+ */
+ var getLength = baseProperty('length');
+
+ /**
+ * Gets the propery names, values, and compare flags of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the match data of `object`.
+ */
+ function getMatchData(object) {
+ var result = pairs(object),
+ length = result.length;
+
+ while (length--) {
+ result[length][2] = isStrictComparable(result[length][1]);
+ }
+ return result;
+ }
+
+ /**
+ * Gets the native function at `key` of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {string} key The key of the method to get.
+ * @returns {*} Returns the function if it's native, else `undefined`.
+ */
+ function getNative(object, key) {
+ var value = object == null ? undefined : object[key];
+ return isNative(value) ? value : undefined;
+ }
+
+ /**
+ * Gets the view, applying any `transforms` to the `start` and `end` positions.
+ *
+ * @private
+ * @param {number} start The start of the view.
+ * @param {number} end The end of the view.
+ * @param {Array} transforms The transformations to apply to the view.
+ * @returns {Object} Returns an object containing the `start` and `end`
+ * positions of the view.
+ */
+ function getView(start, end, transforms) {
+ var index = -1,
+ length = transforms.length;
+
+ while (++index < length) {
+ var data = transforms[index],
+ size = data.size;
+
+ switch (data.type) {
+ case 'drop': start += size; break;
+ case 'dropRight': end -= size; break;
+ case 'take': end = nativeMin(end, start + size); break;
+ case 'takeRight': start = nativeMax(start, end - size); break;
+ }
+ }
+ return { 'start': start, 'end': end };
+ }
+
+ /**
+ * Initializes an array clone.
+ *
+ * @private
+ * @param {Array} array The array to clone.
+ * @returns {Array} Returns the initialized clone.
+ */
+ function initCloneArray(array) {
+ var length = array.length,
+ result = new array.constructor(length);
+
+ // Add array properties assigned by `RegExp#exec`.
+ if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
+ result.index = array.index;
+ result.input = array.input;
+ }
+ return result;
+ }
+
+ /**
+ * Initializes an object clone.
+ *
+ * @private
+ * @param {Object} object The object to clone.
+ * @returns {Object} Returns the initialized clone.
+ */
+ function initCloneObject(object) {
+ var Ctor = object.constructor;
+ if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
+ Ctor = Object;
+ }
+ return new Ctor;
+ }
+
+ /**
+ * Initializes an object clone based on its `toStringTag`.
+ *
+ * **Note:** This function only supports cloning values with tags of
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+ *
+ * @private
+ * @param {Object} object The object to clone.
+ * @param {string} tag The `toStringTag` of the object to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the initialized clone.
+ */
+ function initCloneByTag(object, tag, isDeep) {
+ var Ctor = object.constructor;
+ switch (tag) {
+ case arrayBufferTag:
+ return bufferClone(object);
+
+ case boolTag:
+ case dateTag:
+ return new Ctor(+object);
+
+ case float32Tag: case float64Tag:
+ case int8Tag: case int16Tag: case int32Tag:
+ case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
+ var buffer = object.buffer;
+ return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
+
+ case numberTag:
+ case stringTag:
+ return new Ctor(object);
+
+ case regexpTag:
+ var result = new Ctor(object.source, reFlags.exec(object));
+ result.lastIndex = object.lastIndex;
+ }
+ return result;
+ }
+
+ /**
+ * Invokes the method at `path` on `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the method to invoke.
+ * @param {Array} args The arguments to invoke the method with.
+ * @returns {*} Returns the result of the invoked method.
+ */
+ function invokePath(object, path, args) {
+ if (object != null && !isKey(path, object)) {
+ path = toPath(path);
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+ path = last(path);
+ }
+ var func = object == null ? object : object[path];
+ return func == null ? undefined : func.apply(object, args);
+ }
+
+ /**
+ * Checks if `value` is array-like.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ */
+ function isArrayLike(value) {
+ return value != null && isLength(getLength(value));
+ }
+
+ /**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return value > -1 && value % 1 == 0 && value < length;
+ }
+
+ /**
+ * Checks if the provided arguments are from an iteratee call.
+ *
+ * @private
+ * @param {*} value The potential iteratee value argument.
+ * @param {*} index The potential iteratee index or key argument.
+ * @param {*} object The potential iteratee object argument.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
+ */
+ function isIterateeCall(value, index, object) {
+ if (!isObject(object)) {
+ return false;
+ }
+ var type = typeof index;
+ if (type == 'number'
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)) {
+ var other = object[index];
+ return value === value ? (value === other) : (other !== other);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if `value` is a property name and not a property path.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {Object} [object] The object to query keys on.
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
+ */
+ function isKey(value, object) {
+ var type = typeof value;
+ if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
+ return true;
+ }
+ if (isArray(value)) {
+ return false;
+ }
+ var result = !reIsDeepProp.test(value);
+ return result || (object != null && value in toObject(object));
+ }
+
+ /**
+ * Checks if `func` has a lazy counterpart.
+ *
+ * @private
+ * @param {Function} func The function to check.
+ * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
+ */
+ function isLaziable(func) {
+ var funcName = getFuncName(func);
+ if (!(funcName in LazyWrapper.prototype)) {
+ return false;
+ }
+ var other = lodash[funcName];
+ if (func === other) {
+ return true;
+ }
+ var data = getData(other);
+ return !!data && func === data[0];
+ }
+
+ /**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ */
+ function isLength(value) {
+ return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+ }
+
+ /**
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
+ * equality comparisons, else `false`.
+ */
+ function isStrictComparable(value) {
+ return value === value && !isObject(value);
+ }
+
+ /**
+ * Merges the function metadata of `source` into `data`.
+ *
+ * Merging metadata reduces the number of wrappers required to invoke a function.
+ * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
+ * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
+ * augment function arguments, making the order in which they are executed important,
+ * preventing the merging of metadata. However, we make an exception for a safe
+ * common case where curried functions have `_.ary` and or `_.rearg` applied.
+ *
+ * @private
+ * @param {Array} data The destination metadata.
+ * @param {Array} source The source metadata.
+ * @returns {Array} Returns `data`.
+ */
+ function mergeData(data, source) {
+ var bitmask = data[1],
+ srcBitmask = source[1],
+ newBitmask = bitmask | srcBitmask,
+ isCommon = newBitmask < ARY_FLAG;
+
+ var isCombo =
+ (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
+ (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
+ (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
+
+ // Exit early if metadata can't be merged.
+ if (!(isCommon || isCombo)) {
+ return data;
+ }
+ // Use source `thisArg` if available.
+ if (srcBitmask & BIND_FLAG) {
+ data[2] = source[2];
+ // Set when currying a bound function.
+ newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
+ }
+ // Compose partial arguments.
+ var value = source[3];
+ if (value) {
+ var partials = data[3];
+ data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
+ data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
+ }
+ // Compose partial right arguments.
+ value = source[5];
+ if (value) {
+ partials = data[5];
+ data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
+ data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
+ }
+ // Use source `argPos` if available.
+ value = source[7];
+ if (value) {
+ data[7] = arrayCopy(value);
+ }
+ // Use source `ary` if it's smaller.
+ if (srcBitmask & ARY_FLAG) {
+ data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
+ }
+ // Use source `arity` if one is not provided.
+ if (data[9] == null) {
+ data[9] = source[9];
+ }
+ // Use source `func` and merge bitmasks.
+ data[0] = source[0];
+ data[1] = newBitmask;
+
+ return data;
+ }
+
+ /**
+ * Used by `_.defaultsDeep` to customize its `_.merge` use.
+ *
+ * @private
+ * @param {*} objectValue The destination object property value.
+ * @param {*} sourceValue The source object property value.
+ * @returns {*} Returns the value to assign to the destination object.
+ */
+ function mergeDefaults(objectValue, sourceValue) {
+ return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);
+ }
+
+ /**
+ * A specialized version of `_.pick` which picks `object` properties specified
+ * by `props`.
+ *
+ * @private
+ * @param {Object} object The source object.
+ * @param {string[]} props The property names to pick.
+ * @returns {Object} Returns the new object.
+ */
+ function pickByArray(object, props) {
+ object = toObject(object);
+
+ var index = -1,
+ length = props.length,
+ result = {};
+
+ while (++index < length) {
+ var key = props[index];
+ if (key in object) {
+ result[key] = object[key];
+ }
+ }
+ return result;
+ }
+
+ /**
+ * A specialized version of `_.pick` which picks `object` properties `predicate`
+ * returns truthy for.
+ *
+ * @private
+ * @param {Object} object The source object.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {Object} Returns the new object.
+ */
+ function pickByCallback(object, predicate) {
+ var result = {};
+ baseForIn(object, function(value, key, object) {
+ if (predicate(value, key, object)) {
+ result[key] = value;
+ }
+ });
+ return result;
+ }
+
+ /**
+ * Reorder `array` according to the specified indexes where the element at
+ * the first index is assigned as the first element, the element at
+ * the second index is assigned as the second element, and so on.
+ *
+ * @private
+ * @param {Array} array The array to reorder.
+ * @param {Array} indexes The arranged array indexes.
+ * @returns {Array} Returns `array`.
+ */
+ function reorder(array, indexes) {
+ var arrLength = array.length,
+ length = nativeMin(indexes.length, arrLength),
+ oldArray = arrayCopy(array);
+
+ while (length--) {
+ var index = indexes[length];
+ array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
+ }
+ return array;
+ }
+
+ /**
+ * Sets metadata for `func`.
+ *
+ * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
+ * period of time, it will trip its breaker and transition to an identity function
+ * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
+ * for more details.
+ *
+ * @private
+ * @param {Function} func The function to associate metadata with.
+ * @param {*} data The metadata.
+ * @returns {Function} Returns `func`.
+ */
+ var setData = (function() {
+ var count = 0,
+ lastCalled = 0;
+
+ return function(key, value) {
+ var stamp = now(),
+ remaining = HOT_SPAN - (stamp - lastCalled);
+
+ lastCalled = stamp;
+ if (remaining > 0) {
+ if (++count >= HOT_COUNT) {
+ return key;
+ }
+ } else {
+ count = 0;
+ }
+ return baseSetData(key, value);
+ };
+ }());
+
+ /**
+ * A fallback implementation of `Object.keys` which creates an array of the
+ * own enumerable property names of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+ function shimKeys(object) {
+ var props = keysIn(object),
+ propsLength = props.length,
+ length = propsLength && object.length;
+
+ var allowIndexes = !!length && isLength(length) &&
+ (isArray(object) || isArguments(object));
+
+ var index = -1,
+ result = [];
+
+ while (++index < propsLength) {
+ var key = props[index];
+ if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Converts `value` to an array-like object if it's not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Array|Object} Returns the array-like object.
+ */
+ function toIterable(value) {
+ if (value == null) {
+ return [];
+ }
+ if (!isArrayLike(value)) {
+ return values(value);
+ }
+ return isObject(value) ? value : Object(value);
+ }
+
+ /**
+ * Converts `value` to an object if it's not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Object} Returns the object.
+ */
+ function toObject(value) {
+ return isObject(value) ? value : Object(value);
+ }
+
+ /**
+ * Converts `value` to property path array if it's not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Array} Returns the property path array.
+ */
+ function toPath(value) {
+ if (isArray(value)) {
+ return value;
+ }
+ var result = [];
+ baseToString(value).replace(rePropName, function(match, number, quote, string) {
+ result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
+ });
+ return result;
+ }
+
+ /**
+ * Creates a clone of `wrapper`.
+ *
+ * @private
+ * @param {Object} wrapper The wrapper to clone.
+ * @returns {Object} Returns the cloned wrapper.
+ */
+ function wrapperClone(wrapper) {
+ return wrapper instanceof LazyWrapper
+ ? wrapper.clone()
+ : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an array of elements split into groups the length of `size`.
+ * If `collection` can't be split evenly, the final chunk will be the remaining
+ * elements.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to process.
+ * @param {number} [size=1] The length of each chunk.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Array} Returns the new array containing chunks.
+ * @example
+ *
+ * _.chunk(['a', 'b', 'c', 'd'], 2);
+ * // => [['a', 'b'], ['c', 'd']]
+ *
+ * _.chunk(['a', 'b', 'c', 'd'], 3);
+ * // => [['a', 'b', 'c'], ['d']]
+ */
+ function chunk(array, size, guard) {
+ if (guard ? isIterateeCall(array, size, guard) : size == null) {
+ size = 1;
+ } else {
+ size = nativeMax(nativeFloor(size) || 1, 1);
+ }
+ var index = 0,
+ length = array ? array.length : 0,
+ resIndex = -1,
+ result = Array(nativeCeil(length / size));
+
+ while (index < length) {
+ result[++resIndex] = baseSlice(array, index, (index += size));
+ }
+ return result;
+ }
+
+ /**
+ * Creates an array with all falsey values removed. The values `false`, `null`,
+ * `0`, `""`, `undefined`, and `NaN` are falsey.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to compact.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.compact([0, 1, false, 2, '', 3]);
+ * // => [1, 2, 3]
+ */
+ function compact(array) {
+ var index = -1,
+ length = array ? array.length : 0,
+ resIndex = -1,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+ if (value) {
+ result[++resIndex] = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates an array of unique `array` values not included in the other
+ * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {...Array} [values] The arrays of values to exclude.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.difference([1, 2, 3], [4, 2]);
+ * // => [1, 3]
+ */
+ var difference = restParam(function(array, values) {
+ return (isObjectLike(array) && isArrayLike(array))
+ ? baseDifference(array, baseFlatten(values, false, true))
+ : [];
+ });
+
+ /**
+ * Creates a slice of `array` with `n` elements dropped from the beginning.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to drop.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.drop([1, 2, 3]);
+ * // => [2, 3]
+ *
+ * _.drop([1, 2, 3], 2);
+ * // => [3]
+ *
+ * _.drop([1, 2, 3], 5);
+ * // => []
+ *
+ * _.drop([1, 2, 3], 0);
+ * // => [1, 2, 3]
+ */
+ function drop(array, n, guard) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
+ n = 1;
+ }
+ return baseSlice(array, n < 0 ? 0 : n);
+ }
+
+ /**
+ * Creates a slice of `array` with `n` elements dropped from the end.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to drop.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.dropRight([1, 2, 3]);
+ * // => [1, 2]
+ *
+ * _.dropRight([1, 2, 3], 2);
+ * // => [1]
+ *
+ * _.dropRight([1, 2, 3], 5);
+ * // => []
+ *
+ * _.dropRight([1, 2, 3], 0);
+ * // => [1, 2, 3]
+ */
+ function dropRight(array, n, guard) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
+ n = 1;
+ }
+ n = length - (+n || 0);
+ return baseSlice(array, 0, n < 0 ? 0 : n);
+ }
+
+ /**
+ * Creates a slice of `array` excluding elements dropped from the end.
+ * Elements are dropped until `predicate` returns falsey. The predicate is
+ * bound to `thisArg` and invoked with three arguments: (value, index, array).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that match the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.dropRightWhile([1, 2, 3], function(n) {
+ * return n > 1;
+ * });
+ * // => [1]
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': false }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
+ * // => ['barney', 'fred']
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.pluck(_.dropRightWhile(users, 'active', false), 'user');
+ * // => ['barney']
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.dropRightWhile(users, 'active'), 'user');
+ * // => ['barney', 'fred', 'pebbles']
+ */
+ function dropRightWhile(array, predicate, thisArg) {
+ return (array && array.length)
+ ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true)
+ : [];
+ }
+
+ /**
+ * Creates a slice of `array` excluding elements dropped from the beginning.
+ * Elements are dropped until `predicate` returns falsey. The predicate is
+ * bound to `thisArg` and invoked with three arguments: (value, index, array).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.dropWhile([1, 2, 3], function(n) {
+ * return n < 3;
+ * });
+ * // => [3]
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': true }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
+ * // => ['fred', 'pebbles']
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.pluck(_.dropWhile(users, 'active', false), 'user');
+ * // => ['pebbles']
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.dropWhile(users, 'active'), 'user');
+ * // => ['barney', 'fred', 'pebbles']
+ */
+ function dropWhile(array, predicate, thisArg) {
+ return (array && array.length)
+ ? baseWhile(array, getCallback(predicate, thisArg, 3), true)
+ : [];
+ }
+
+ /**
+ * Fills elements of `array` with `value` from `start` up to, but not
+ * including, `end`.
+ *
+ * **Note:** This method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to fill.
+ * @param {*} value The value to fill `array` with.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [1, 2, 3];
+ *
+ * _.fill(array, 'a');
+ * console.log(array);
+ * // => ['a', 'a', 'a']
+ *
+ * _.fill(Array(3), 2);
+ * // => [2, 2, 2]
+ *
+ * _.fill([4, 6, 8], '*', 1, 2);
+ * // => [4, '*', 8]
+ */
+ function fill(array, value, start, end) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
+ start = 0;
+ end = length;
+ }
+ return baseFill(array, value, start, end);
+ }
+
+ /**
+ * This method is like `_.find` except that it returns the index of the first
+ * element `predicate` returns truthy for instead of the element itself.
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to search.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {number} Returns the index of the found element, else `-1`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': true }
+ * ];
+ *
+ * _.findIndex(users, function(chr) {
+ * return chr.user == 'barney';
+ * });
+ * // => 0
+ *
+ * // using the `_.matches` callback shorthand
+ * _.findIndex(users, { 'user': 'fred', 'active': false });
+ * // => 1
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.findIndex(users, 'active', false);
+ * // => 0
+ *
+ * // using the `_.property` callback shorthand
+ * _.findIndex(users, 'active');
+ * // => 2
+ */
+ var findIndex = createFindIndex();
+
+ /**
+ * This method is like `_.findIndex` except that it iterates over elements
+ * of `collection` from right to left.
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to search.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {number} Returns the index of the found element, else `-1`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': false }
+ * ];
+ *
+ * _.findLastIndex(users, function(chr) {
+ * return chr.user == 'pebbles';
+ * });
+ * // => 2
+ *
+ * // using the `_.matches` callback shorthand
+ * _.findLastIndex(users, { 'user': 'barney', 'active': true });
+ * // => 0
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.findLastIndex(users, 'active', false);
+ * // => 2
+ *
+ * // using the `_.property` callback shorthand
+ * _.findLastIndex(users, 'active');
+ * // => 0
+ */
+ var findLastIndex = createFindIndex(true);
+
+ /**
+ * Gets the first element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @alias head
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {*} Returns the first element of `array`.
+ * @example
+ *
+ * _.first([1, 2, 3]);
+ * // => 1
+ *
+ * _.first([]);
+ * // => undefined
+ */
+ function first(array) {
+ return array ? array[0] : undefined;
+ }
+
+ /**
+ * Flattens a nested array. If `isDeep` is `true` the array is recursively
+ * flattened, otherwise it is only flattened a single level.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to flatten.
+ * @param {boolean} [isDeep] Specify a deep flatten.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * _.flatten([1, [2, 3, [4]]]);
+ * // => [1, 2, 3, [4]]
+ *
+ * // using `isDeep`
+ * _.flatten([1, [2, 3, [4]]], true);
+ * // => [1, 2, 3, 4]
+ */
+ function flatten(array, isDeep, guard) {
+ var length = array ? array.length : 0;
+ if (guard && isIterateeCall(array, isDeep, guard)) {
+ isDeep = false;
+ }
+ return length ? baseFlatten(array, isDeep) : [];
+ }
+
+ /**
+ * Recursively flattens a nested array.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to recursively flatten.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * _.flattenDeep([1, [2, 3, [4]]]);
+ * // => [1, 2, 3, 4]
+ */
+ function flattenDeep(array) {
+ var length = array ? array.length : 0;
+ return length ? baseFlatten(array, true) : [];
+ }
+
+ /**
+ * Gets the index at which the first occurrence of `value` is found in `array`
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons. If `fromIndex` is negative, it is used as the offset
+ * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
+ * performs a faster binary search.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+ * to perform a binary search on a sorted array.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.indexOf([1, 2, 1, 2], 2);
+ * // => 1
+ *
+ * // using `fromIndex`
+ * _.indexOf([1, 2, 1, 2], 2, 2);
+ * // => 3
+ *
+ * // performing a binary search
+ * _.indexOf([1, 1, 2, 2], 2, true);
+ * // => 2
+ */
+ function indexOf(array, value, fromIndex) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return -1;
+ }
+ if (typeof fromIndex == 'number') {
+ fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
+ } else if (fromIndex) {
+ var index = binaryIndex(array, value);
+ if (index < length &&
+ (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
+ return index;
+ }
+ return -1;
+ }
+ return baseIndexOf(array, value, fromIndex || 0);
+ }
+
+ /**
+ * Gets all but the last element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.initial([1, 2, 3]);
+ * // => [1, 2]
+ */
+ function initial(array) {
+ return dropRight(array, 1);
+ }
+
+ /**
+ * Creates an array of unique values that are included in all of the provided
+ * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @returns {Array} Returns the new array of shared values.
+ * @example
+ * _.intersection([1, 2], [4, 2], [2, 1]);
+ * // => [2]
+ */
+ var intersection = restParam(function(arrays) {
+ var othLength = arrays.length,
+ othIndex = othLength,
+ caches = Array(length),
+ indexOf = getIndexOf(),
+ isCommon = indexOf == baseIndexOf,
+ result = [];
+
+ while (othIndex--) {
+ var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
+ caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
+ }
+ var array = arrays[0],
+ index = -1,
+ length = array ? array.length : 0,
+ seen = caches[0];
+
+ outer:
+ while (++index < length) {
+ value = array[index];
+ if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
+ var othIndex = othLength;
+ while (--othIndex) {
+ var cache = caches[othIndex];
+ if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
+ continue outer;
+ }
+ }
+ if (seen) {
+ seen.push(value);
+ }
+ result.push(value);
+ }
+ }
+ return result;
+ });
+
+ /**
+ * Gets the last element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {*} Returns the last element of `array`.
+ * @example
+ *
+ * _.last([1, 2, 3]);
+ * // => 3
+ */
+ function last(array) {
+ var length = array ? array.length : 0;
+ return length ? array[length - 1] : undefined;
+ }
+
+ /**
+ * This method is like `_.indexOf` except that it iterates over elements of
+ * `array` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {boolean|number} [fromIndex=array.length-1] The index to search from
+ * or `true` to perform a binary search on a sorted array.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.lastIndexOf([1, 2, 1, 2], 2);
+ * // => 3
+ *
+ * // using `fromIndex`
+ * _.lastIndexOf([1, 2, 1, 2], 2, 2);
+ * // => 1
+ *
+ * // performing a binary search
+ * _.lastIndexOf([1, 1, 2, 2], 2, true);
+ * // => 3
+ */
+ function lastIndexOf(array, value, fromIndex) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return -1;
+ }
+ var index = length;
+ if (typeof fromIndex == 'number') {
+ index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
+ } else if (fromIndex) {
+ index = binaryIndex(array, value, true) - 1;
+ var other = array[index];
+ if (value === value ? (value === other) : (other !== other)) {
+ return index;
+ }
+ return -1;
+ }
+ if (value !== value) {
+ return indexOfNaN(array, index, true);
+ }
+ while (index--) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Removes all provided values from `array` using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * **Note:** Unlike `_.without`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {...*} [values] The values to remove.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [1, 2, 3, 1, 2, 3];
+ *
+ * _.pull(array, 2, 3);
+ * console.log(array);
+ * // => [1, 1]
+ */
+ function pull() {
+ var args = arguments,
+ array = args[0];
+
+ if (!(array && array.length)) {
+ return array;
+ }
+ var index = 0,
+ indexOf = getIndexOf(),
+ length = args.length;
+
+ while (++index < length) {
+ var fromIndex = 0,
+ value = args[index];
+
+ while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
+ splice.call(array, fromIndex, 1);
+ }
+ }
+ return array;
+ }
+
+ /**
+ * Removes elements from `array` corresponding to the given indexes and returns
+ * an array of the removed elements. Indexes may be specified as an array of
+ * indexes or as individual arguments.
+ *
+ * **Note:** Unlike `_.at`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {...(number|number[])} [indexes] The indexes of elements to remove,
+ * specified as individual indexes or arrays of indexes.
+ * @returns {Array} Returns the new array of removed elements.
+ * @example
+ *
+ * var array = [5, 10, 15, 20];
+ * var evens = _.pullAt(array, 1, 3);
+ *
+ * console.log(array);
+ * // => [5, 15]
+ *
+ * console.log(evens);
+ * // => [10, 20]
+ */
+ var pullAt = restParam(function(array, indexes) {
+ indexes = baseFlatten(indexes);
+
+ var result = baseAt(array, indexes);
+ basePullAt(array, indexes.sort(baseCompareAscending));
+ return result;
+ });
+
+ /**
+ * Removes all elements from `array` that `predicate` returns truthy for
+ * and returns an array of the removed elements. The predicate is bound to
+ * `thisArg` and invoked with three arguments: (value, index, array).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * **Note:** Unlike `_.filter`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the new array of removed elements.
+ * @example
+ *
+ * var array = [1, 2, 3, 4];
+ * var evens = _.remove(array, function(n) {
+ * return n % 2 == 0;
+ * });
+ *
+ * console.log(array);
+ * // => [1, 3]
+ *
+ * console.log(evens);
+ * // => [2, 4]
+ */
+ function remove(array, predicate, thisArg) {
+ var result = [];
+ if (!(array && array.length)) {
+ return result;
+ }
+ var index = -1,
+ indexes = [],
+ length = array.length;
+
+ predicate = getCallback(predicate, thisArg, 3);
+ while (++index < length) {
+ var value = array[index];
+ if (predicate(value, index, array)) {
+ result.push(value);
+ indexes.push(index);
+ }
+ }
+ basePullAt(array, indexes);
+ return result;
+ }
+
+ /**
+ * Gets all but the first element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @alias tail
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.rest([1, 2, 3]);
+ * // => [2, 3]
+ */
+ function rest(array) {
+ return drop(array, 1);
+ }
+
+ /**
+ * Creates a slice of `array` from `start` up to, but not including, `end`.
+ *
+ * **Note:** This method is used instead of `Array#slice` to support node
+ * lists in IE < 9 and to ensure dense arrays are returned.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+ function slice(array, start, end) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
+ start = 0;
+ end = length;
+ }
+ return baseSlice(array, start, end);
+ }
+
+ /**
+ * Uses a binary search to determine the lowest index at which `value` should
+ * be inserted into `array` in order to maintain its sort order. If an iteratee
+ * function is provided it is invoked for `value` and each element of `array`
+ * to compute their sort ranking. The iteratee is bound to `thisArg` and
+ * invoked with one argument; (value).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * _.sortedIndex([30, 50], 40);
+ * // => 1
+ *
+ * _.sortedIndex([4, 4, 5, 5], 5);
+ * // => 2
+ *
+ * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
+ *
+ * // using an iteratee function
+ * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
+ * return this.data[word];
+ * }, dict);
+ * // => 1
+ *
+ * // using the `_.property` callback shorthand
+ * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+ * // => 1
+ */
+ var sortedIndex = createSortedIndex();
+
+ /**
+ * This method is like `_.sortedIndex` except that it returns the highest
+ * index at which `value` should be inserted into `array` in order to
+ * maintain its sort order.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * _.sortedLastIndex([4, 4, 5, 5], 5);
+ * // => 4
+ */
+ var sortedLastIndex = createSortedIndex(true);
+
+ /**
+ * Creates a slice of `array` with `n` elements taken from the beginning.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to take.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.take([1, 2, 3]);
+ * // => [1]
+ *
+ * _.take([1, 2, 3], 2);
+ * // => [1, 2]
+ *
+ * _.take([1, 2, 3], 5);
+ * // => [1, 2, 3]
+ *
+ * _.take([1, 2, 3], 0);
+ * // => []
+ */
+ function take(array, n, guard) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
+ n = 1;
+ }
+ return baseSlice(array, 0, n < 0 ? 0 : n);
+ }
+
+ /**
+ * Creates a slice of `array` with `n` elements taken from the end.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to take.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.takeRight([1, 2, 3]);
+ * // => [3]
+ *
+ * _.takeRight([1, 2, 3], 2);
+ * // => [2, 3]
+ *
+ * _.takeRight([1, 2, 3], 5);
+ * // => [1, 2, 3]
+ *
+ * _.takeRight([1, 2, 3], 0);
+ * // => []
+ */
+ function takeRight(array, n, guard) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (guard ? isIterateeCall(array, n, guard) : n == null) {
+ n = 1;
+ }
+ n = length - (+n || 0);
+ return baseSlice(array, n < 0 ? 0 : n);
+ }
+
+ /**
+ * Creates a slice of `array` with elements taken from the end. Elements are
+ * taken until `predicate` returns falsey. The predicate is bound to `thisArg`
+ * and invoked with three arguments: (value, index, array).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.takeRightWhile([1, 2, 3], function(n) {
+ * return n > 1;
+ * });
+ * // => [2, 3]
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': false }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
+ * // => ['pebbles']
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.pluck(_.takeRightWhile(users, 'active', false), 'user');
+ * // => ['fred', 'pebbles']
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.takeRightWhile(users, 'active'), 'user');
+ * // => []
+ */
+ function takeRightWhile(array, predicate, thisArg) {
+ return (array && array.length)
+ ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true)
+ : [];
+ }
+
+ /**
+ * Creates a slice of `array` with elements taken from the beginning. Elements
+ * are taken until `predicate` returns falsey. The predicate is bound to
+ * `thisArg` and invoked with three arguments: (value, index, array).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.takeWhile([1, 2, 3], function(n) {
+ * return n < 3;
+ * });
+ * // => [1, 2]
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false},
+ * { 'user': 'pebbles', 'active': true }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
+ * // => ['barney']
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.pluck(_.takeWhile(users, 'active', false), 'user');
+ * // => ['barney', 'fred']
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.takeWhile(users, 'active'), 'user');
+ * // => []
+ */
+ function takeWhile(array, predicate, thisArg) {
+ return (array && array.length)
+ ? baseWhile(array, getCallback(predicate, thisArg, 3))
+ : [];
+ }
+
+ /**
+ * Creates an array of unique values, in order, from all of the provided arrays
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @returns {Array} Returns the new array of combined values.
+ * @example
+ *
+ * _.union([1, 2], [4, 2], [2, 1]);
+ * // => [1, 2, 4]
+ */
+ var union = restParam(function(arrays) {
+ return baseUniq(baseFlatten(arrays, false, true));
+ });
+
+ /**
+ * Creates a duplicate-free version of an array, using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons, in which only the first occurence of each element
+ * is kept. Providing `true` for `isSorted` performs a faster search algorithm
+ * for sorted arrays. If an iteratee function is provided it is invoked for
+ * each element in the array to generate the criterion by which uniqueness
+ * is computed. The `iteratee` is bound to `thisArg` and invoked with three
+ * arguments: (value, index, array).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias unique
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {boolean} [isSorted] Specify the array is sorted.
+ * @param {Function|Object|string} [iteratee] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array} Returns the new duplicate-value-free array.
+ * @example
+ *
+ * _.uniq([2, 1, 2]);
+ * // => [2, 1]
+ *
+ * // using `isSorted`
+ * _.uniq([1, 1, 2], true);
+ * // => [1, 2]
+ *
+ * // using an iteratee function
+ * _.uniq([1, 2.5, 1.5, 2], function(n) {
+ * return this.floor(n);
+ * }, Math);
+ * // => [1, 2.5]
+ *
+ * // using the `_.property` callback shorthand
+ * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+ * // => [{ 'x': 1 }, { 'x': 2 }]
+ */
+ function uniq(array, isSorted, iteratee, thisArg) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ if (isSorted != null && typeof isSorted != 'boolean') {
+ thisArg = iteratee;
+ iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
+ isSorted = false;
+ }
+ var callback = getCallback();
+ if (!(iteratee == null && callback === baseCallback)) {
+ iteratee = callback(iteratee, thisArg, 3);
+ }
+ return (isSorted && getIndexOf() == baseIndexOf)
+ ? sortedUniq(array, iteratee)
+ : baseUniq(array, iteratee);
+ }
+
+ /**
+ * This method is like `_.zip` except that it accepts an array of grouped
+ * elements and creates an array regrouping the elements to their pre-zip
+ * configuration.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array of grouped elements to process.
+ * @returns {Array} Returns the new array of regrouped elements.
+ * @example
+ *
+ * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
+ * // => [['fred', 30, true], ['barney', 40, false]]
+ *
+ * _.unzip(zipped);
+ * // => [['fred', 'barney'], [30, 40], [true, false]]
+ */
+ function unzip(array) {
+ if (!(array && array.length)) {
+ return [];
+ }
+ var index = -1,
+ length = 0;
+
+ array = arrayFilter(array, function(group) {
+ if (isArrayLike(group)) {
+ length = nativeMax(group.length, length);
+ return true;
+ }
+ });
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = arrayMap(array, baseProperty(index));
+ }
+ return result;
+ }
+
+ /**
+ * This method is like `_.unzip` except that it accepts an iteratee to specify
+ * how regrouped values should be combined. The `iteratee` is bound to `thisArg`
+ * and invoked with four arguments: (accumulator, value, index, group).
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array of grouped elements to process.
+ * @param {Function} [iteratee] The function to combine regrouped values.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array} Returns the new array of regrouped elements.
+ * @example
+ *
+ * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
+ * // => [[1, 10, 100], [2, 20, 200]]
+ *
+ * _.unzipWith(zipped, _.add);
+ * // => [3, 30, 300]
+ */
+ function unzipWith(array, iteratee, thisArg) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return [];
+ }
+ var result = unzip(array);
+ if (iteratee == null) {
+ return result;
+ }
+ iteratee = bindCallback(iteratee, thisArg, 4);
+ return arrayMap(result, function(group) {
+ return arrayReduce(group, iteratee, undefined, true);
+ });
+ }
+
+ /**
+ * Creates an array excluding all provided values using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to filter.
+ * @param {...*} [values] The values to exclude.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.without([1, 2, 1, 3], 1, 2);
+ * // => [3]
+ */
+ var without = restParam(function(array, values) {
+ return isArrayLike(array)
+ ? baseDifference(array, values)
+ : [];
+ });
+
+ /**
+ * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
+ * of the provided arrays.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @returns {Array} Returns the new array of values.
+ * @example
+ *
+ * _.xor([1, 2], [4, 2]);
+ * // => [1, 4]
+ */
+ function xor() {
+ var index = -1,
+ length = arguments.length;
+
+ while (++index < length) {
+ var array = arguments[index];
+ if (isArrayLike(array)) {
+ var result = result
+ ? arrayPush(baseDifference(result, array), baseDifference(array, result))
+ : array;
+ }
+ }
+ return result ? baseUniq(result) : [];
+ }
+
+ /**
+ * Creates an array of grouped elements, the first of which contains the first
+ * elements of the given arrays, the second of which contains the second elements
+ * of the given arrays, and so on.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {...Array} [arrays] The arrays to process.
+ * @returns {Array} Returns the new array of grouped elements.
+ * @example
+ *
+ * _.zip(['fred', 'barney'], [30, 40], [true, false]);
+ * // => [['fred', 30, true], ['barney', 40, false]]
+ */
+ var zip = restParam(unzip);
+
+ /**
+ * The inverse of `_.pairs`; this method returns an object composed from arrays
+ * of property names and values. Provide either a single two dimensional array,
+ * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
+ * and one of corresponding values.
+ *
+ * @static
+ * @memberOf _
+ * @alias object
+ * @category Array
+ * @param {Array} props The property names.
+ * @param {Array} [values=[]] The property values.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * _.zipObject([['fred', 30], ['barney', 40]]);
+ * // => { 'fred': 30, 'barney': 40 }
+ *
+ * _.zipObject(['fred', 'barney'], [30, 40]);
+ * // => { 'fred': 30, 'barney': 40 }
+ */
+ function zipObject(props, values) {
+ var index = -1,
+ length = props ? props.length : 0,
+ result = {};
+
+ if (length && !values && !isArray(props[0])) {
+ values = [];
+ }
+ while (++index < length) {
+ var key = props[index];
+ if (values) {
+ result[key] = values[index];
+ } else if (key) {
+ result[key[0]] = key[1];
+ }
+ }
+ return result;
+ }
+
+ /**
+ * This method is like `_.zip` except that it accepts an iteratee to specify
+ * how grouped values should be combined. The `iteratee` is bound to `thisArg`
+ * and invoked with four arguments: (accumulator, value, index, group).
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {...Array} [arrays] The arrays to process.
+ * @param {Function} [iteratee] The function to combine grouped values.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array} Returns the new array of grouped elements.
+ * @example
+ *
+ * _.zipWith([1, 2], [10, 20], [100, 200], _.add);
+ * // => [111, 222]
+ */
+ var zipWith = restParam(function(arrays) {
+ var length = arrays.length,
+ iteratee = length > 2 ? arrays[length - 2] : undefined,
+ thisArg = length > 1 ? arrays[length - 1] : undefined;
+
+ if (length > 2 && typeof iteratee == 'function') {
+ length -= 2;
+ } else {
+ iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
+ thisArg = undefined;
+ }
+ arrays.length = length;
+ return unzipWith(arrays, iteratee, thisArg);
+ });
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a `lodash` object that wraps `value` with explicit method
+ * chaining enabled.
+ *
+ * @static
+ * @memberOf _
+ * @category Chain
+ * @param {*} value The value to wrap.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 40 },
+ * { 'user': 'pebbles', 'age': 1 }
+ * ];
+ *
+ * var youngest = _.chain(users)
+ * .sortBy('age')
+ * .map(function(chr) {
+ * return chr.user + ' is ' + chr.age;
+ * })
+ * .first()
+ * .value();
+ * // => 'pebbles is 1'
+ */
+ function chain(value) {
+ var result = lodash(value);
+ result.__chain__ = true;
+ return result;
+ }
+
+ /**
+ * This method invokes `interceptor` and returns `value`. The interceptor is
+ * bound to `thisArg` and invoked with one argument; (value). The purpose of
+ * this method is to "tap into" a method chain in order to perform operations
+ * on intermediate results within the chain.
+ *
+ * @static
+ * @memberOf _
+ * @category Chain
+ * @param {*} value The value to provide to `interceptor`.
+ * @param {Function} interceptor The function to invoke.
+ * @param {*} [thisArg] The `this` binding of `interceptor`.
+ * @returns {*} Returns `value`.
+ * @example
+ *
+ * _([1, 2, 3])
+ * .tap(function(array) {
+ * array.pop();
+ * })
+ * .reverse()
+ * .value();
+ * // => [2, 1]
+ */
+ function tap(value, interceptor, thisArg) {
+ interceptor.call(thisArg, value);
+ return value;
+ }
+
+ /**
+ * This method is like `_.tap` except that it returns the result of `interceptor`.
+ *
+ * @static
+ * @memberOf _
+ * @category Chain
+ * @param {*} value The value to provide to `interceptor`.
+ * @param {Function} interceptor The function to invoke.
+ * @param {*} [thisArg] The `this` binding of `interceptor`.
+ * @returns {*} Returns the result of `interceptor`.
+ * @example
+ *
+ * _(' abc ')
+ * .chain()
+ * .trim()
+ * .thru(function(value) {
+ * return [value];
+ * })
+ * .value();
+ * // => ['abc']
+ */
+ function thru(value, interceptor, thisArg) {
+ return interceptor.call(thisArg, value);
+ }
+
+ /**
+ * Enables explicit method chaining on the wrapper object.
+ *
+ * @name chain
+ * @memberOf _
+ * @category Chain
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 40 }
+ * ];
+ *
+ * // without explicit chaining
+ * _(users).first();
+ * // => { 'user': 'barney', 'age': 36 }
+ *
+ * // with explicit chaining
+ * _(users).chain()
+ * .first()
+ * .pick('user')
+ * .value();
+ * // => { 'user': 'barney' }
+ */
+ function wrapperChain() {
+ return chain(this);
+ }
+
+ /**
+ * Executes the chained sequence and returns the wrapped result.
+ *
+ * @name commit
+ * @memberOf _
+ * @category Chain
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var array = [1, 2];
+ * var wrapped = _(array).push(3);
+ *
+ * console.log(array);
+ * // => [1, 2]
+ *
+ * wrapped = wrapped.commit();
+ * console.log(array);
+ * // => [1, 2, 3]
+ *
+ * wrapped.last();
+ * // => 3
+ *
+ * console.log(array);
+ * // => [1, 2, 3]
+ */
+ function wrapperCommit() {
+ return new LodashWrapper(this.value(), this.__chain__);
+ }
+
+ /**
+ * Creates a new array joining a wrapped array with any additional arrays
+ * and/or values.
+ *
+ * @name concat
+ * @memberOf _
+ * @category Chain
+ * @param {...*} [values] The values to concatenate.
+ * @returns {Array} Returns the new concatenated array.
+ * @example
+ *
+ * var array = [1];
+ * var wrapped = _(array).concat(2, [3], [[4]]);
+ *
+ * console.log(wrapped.value());
+ * // => [1, 2, 3, [4]]
+ *
+ * console.log(array);
+ * // => [1]
+ */
+ var wrapperConcat = restParam(function(values) {
+ values = baseFlatten(values);
+ return this.thru(function(array) {
+ return arrayConcat(isArray(array) ? array : [toObject(array)], values);
+ });
+ });
+
+ /**
+ * Creates a clone of the chained sequence planting `value` as the wrapped value.
+ *
+ * @name plant
+ * @memberOf _
+ * @category Chain
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var array = [1, 2];
+ * var wrapped = _(array).map(function(value) {
+ * return Math.pow(value, 2);
+ * });
+ *
+ * var other = [3, 4];
+ * var otherWrapped = wrapped.plant(other);
+ *
+ * otherWrapped.value();
+ * // => [9, 16]
+ *
+ * wrapped.value();
+ * // => [1, 4]
+ */
+ function wrapperPlant(value) {
+ var result,
+ parent = this;
+
+ while (parent instanceof baseLodash) {
+ var clone = wrapperClone(parent);
+ if (result) {
+ previous.__wrapped__ = clone;
+ } else {
+ result = clone;
+ }
+ var previous = clone;
+ parent = parent.__wrapped__;
+ }
+ previous.__wrapped__ = value;
+ return result;
+ }
+
+ /**
+ * Reverses the wrapped array so the first element becomes the last, the
+ * second element becomes the second to last, and so on.
+ *
+ * **Note:** This method mutates the wrapped array.
+ *
+ * @name reverse
+ * @memberOf _
+ * @category Chain
+ * @returns {Object} Returns the new reversed `lodash` wrapper instance.
+ * @example
+ *
+ * var array = [1, 2, 3];
+ *
+ * _(array).reverse().value()
+ * // => [3, 2, 1]
+ *
+ * console.log(array);
+ * // => [3, 2, 1]
+ */
+ function wrapperReverse() {
+ var value = this.__wrapped__;
+
+ var interceptor = function(value) {
+ return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
+ };
+ if (value instanceof LazyWrapper) {
+ var wrapped = value;
+ if (this.__actions__.length) {
+ wrapped = new LazyWrapper(this);
+ }
+ wrapped = wrapped.reverse();
+ wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
+ return new LodashWrapper(wrapped, this.__chain__);
+ }
+ return this.thru(interceptor);
+ }
+
+ /**
+ * Produces the result of coercing the unwrapped value to a string.
+ *
+ * @name toString
+ * @memberOf _
+ * @category Chain
+ * @returns {string} Returns the coerced string value.
+ * @example
+ *
+ * _([1, 2, 3]).toString();
+ * // => '1,2,3'
+ */
+ function wrapperToString() {
+ return (this.value() + '');
+ }
+
+ /**
+ * Executes the chained sequence to extract the unwrapped value.
+ *
+ * @name value
+ * @memberOf _
+ * @alias run, toJSON, valueOf
+ * @category Chain
+ * @returns {*} Returns the resolved unwrapped value.
+ * @example
+ *
+ * _([1, 2, 3]).value();
+ * // => [1, 2, 3]
+ */
+ function wrapperValue() {
+ return baseWrapperValue(this.__wrapped__, this.__actions__);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an array of elements corresponding to the given keys, or indexes,
+ * of `collection`. Keys may be specified as individual arguments or as arrays
+ * of keys.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {...(number|number[]|string|string[])} [props] The property names
+ * or indexes of elements to pick, specified individually or in arrays.
+ * @returns {Array} Returns the new array of picked elements.
+ * @example
+ *
+ * _.at(['a', 'b', 'c'], [0, 2]);
+ * // => ['a', 'c']
+ *
+ * _.at(['barney', 'fred', 'pebbles'], 0, 2);
+ * // => ['barney', 'pebbles']
+ */
+ var at = restParam(function(collection, props) {
+ return baseAt(collection, baseFlatten(props));
+ });
+
+ /**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` through `iteratee`. The corresponding value
+ * of each key is the number of times the key was returned by `iteratee`.
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns the composed aggregate object.
+ * @example
+ *
+ * _.countBy([4.3, 6.1, 6.4], function(n) {
+ * return Math.floor(n);
+ * });
+ * // => { '4': 1, '6': 2 }
+ *
+ * _.countBy([4.3, 6.1, 6.4], function(n) {
+ * return this.floor(n);
+ * }, Math);
+ * // => { '4': 1, '6': 2 }
+ *
+ * _.countBy(['one', 'two', 'three'], 'length');
+ * // => { '3': 2, '5': 1 }
+ */
+ var countBy = createAggregator(function(result, value, key) {
+ hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
+ });
+
+ /**
+ * Checks if `predicate` returns truthy for **all** elements of `collection`.
+ * The predicate is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias all
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
+ * @example
+ *
+ * _.every([true, 1, null, 'yes'], Boolean);
+ * // => false
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.every(users, { 'user': 'barney', 'active': false });
+ * // => false
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.every(users, 'active', false);
+ * // => true
+ *
+ * // using the `_.property` callback shorthand
+ * _.every(users, 'active');
+ * // => false
+ */
+ function every(collection, predicate, thisArg) {
+ var func = isArray(collection) ? arrayEvery : baseEvery;
+ if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
+ predicate = undefined;
+ }
+ if (typeof predicate != 'function' || thisArg !== undefined) {
+ predicate = getCallback(predicate, thisArg, 3);
+ }
+ return func(collection, predicate);
+ }
+
+ /**
+ * Iterates over elements of `collection`, returning an array of all elements
+ * `predicate` returns truthy for. The predicate is bound to `thisArg` and
+ * invoked with three arguments: (value, index|key, collection).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias select
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the new filtered array.
+ * @example
+ *
+ * _.filter([4, 5, 6], function(n) {
+ * return n % 2 == 0;
+ * });
+ * // => [4, 6]
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
+ * // => ['barney']
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.pluck(_.filter(users, 'active', false), 'user');
+ * // => ['fred']
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.filter(users, 'active'), 'user');
+ * // => ['barney']
+ */
+ function filter(collection, predicate, thisArg) {
+ var func = isArray(collection) ? arrayFilter : baseFilter;
+ predicate = getCallback(predicate, thisArg, 3);
+ return func(collection, predicate);
+ }
+
+ /**
+ * Iterates over elements of `collection`, returning the first element
+ * `predicate` returns truthy for. The predicate is bound to `thisArg` and
+ * invoked with three arguments: (value, index|key, collection).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias detect
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to search.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {*} Returns the matched element, else `undefined`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false },
+ * { 'user': 'pebbles', 'age': 1, 'active': true }
+ * ];
+ *
+ * _.result(_.find(users, function(chr) {
+ * return chr.age < 40;
+ * }), 'user');
+ * // => 'barney'
+ *
+ * // using the `_.matches` callback shorthand
+ * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
+ * // => 'pebbles'
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.result(_.find(users, 'active', false), 'user');
+ * // => 'fred'
+ *
+ * // using the `_.property` callback shorthand
+ * _.result(_.find(users, 'active'), 'user');
+ * // => 'barney'
+ */
+ var find = createFind(baseEach);
+
+ /**
+ * This method is like `_.find` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to search.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {*} Returns the matched element, else `undefined`.
+ * @example
+ *
+ * _.findLast([1, 2, 3, 4], function(n) {
+ * return n % 2 == 1;
+ * });
+ * // => 3
+ */
+ var findLast = createFind(baseEachRight, true);
+
+ /**
+ * Performs a deep comparison between each element in `collection` and the
+ * source object, returning the first element that has equivalent property
+ * values.
+ *
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
+ * their own, not inherited, enumerable properties. For comparing a single
+ * own or inherited property value see `_.matchesProperty`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to search.
+ * @param {Object} source The object of property values to match.
+ * @returns {*} Returns the matched element, else `undefined`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false }
+ * ];
+ *
+ * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');
+ * // => 'barney'
+ *
+ * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');
+ * // => 'fred'
+ */
+ function findWhere(collection, source) {
+ return find(collection, baseMatches(source));
+ }
+
+ /**
+ * Iterates over elements of `collection` invoking `iteratee` for each element.
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection). Iteratee functions may exit iteration early
+ * by explicitly returning `false`.
+ *
+ * **Note:** As with other "Collections" methods, objects with a "length" property
+ * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+ * may be used for object iteration.
+ *
+ * @static
+ * @memberOf _
+ * @alias each
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array|Object|string} Returns `collection`.
+ * @example
+ *
+ * _([1, 2]).forEach(function(n) {
+ * console.log(n);
+ * }).value();
+ * // => logs each value from left to right and returns the array
+ *
+ * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
+ * console.log(n, key);
+ * });
+ * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
+ */
+ var forEach = createForEach(arrayEach, baseEach);
+
+ /**
+ * This method is like `_.forEach` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @alias eachRight
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array|Object|string} Returns `collection`.
+ * @example
+ *
+ * _([1, 2]).forEachRight(function(n) {
+ * console.log(n);
+ * }).value();
+ * // => logs each value from right to left and returns the array
+ */
+ var forEachRight = createForEach(arrayEachRight, baseEachRight);
+
+ /**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` through `iteratee`. The corresponding value
+ * of each key is an array of the elements responsible for generating the key.
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns the composed aggregate object.
+ * @example
+ *
+ * _.groupBy([4.2, 6.1, 6.4], function(n) {
+ * return Math.floor(n);
+ * });
+ * // => { '4': [4.2], '6': [6.1, 6.4] }
+ *
+ * _.groupBy([4.2, 6.1, 6.4], function(n) {
+ * return this.floor(n);
+ * }, Math);
+ * // => { '4': [4.2], '6': [6.1, 6.4] }
+ *
+ * // using the `_.property` callback shorthand
+ * _.groupBy(['one', 'two', 'three'], 'length');
+ * // => { '3': ['one', 'two'], '5': ['three'] }
+ */
+ var groupBy = createAggregator(function(result, value, key) {
+ if (hasOwnProperty.call(result, key)) {
+ result[key].push(value);
+ } else {
+ result[key] = [value];
+ }
+ });
+
+ /**
+ * Checks if `value` is in `collection` using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons. If `fromIndex` is negative, it is used as the offset
+ * from the end of `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @alias contains, include
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to search.
+ * @param {*} target The value to search for.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
+ * @returns {boolean} Returns `true` if a matching element is found, else `false`.
+ * @example
+ *
+ * _.includes([1, 2, 3], 1);
+ * // => true
+ *
+ * _.includes([1, 2, 3], 1, 2);
+ * // => false
+ *
+ * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
+ * // => true
+ *
+ * _.includes('pebbles', 'eb');
+ * // => true
+ */
+ function includes(collection, target, fromIndex, guard) {
+ var length = collection ? getLength(collection) : 0;
+ if (!isLength(length)) {
+ collection = values(collection);
+ length = collection.length;
+ }
+ if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
+ fromIndex = 0;
+ } else {
+ fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
+ }
+ return (typeof collection == 'string' || !isArray(collection) && isString(collection))
+ ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
+ : (!!length && getIndexOf(collection, target, fromIndex) > -1);
+ }
+
+ /**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` through `iteratee`. The corresponding value
+ * of each key is the last element responsible for generating the key. The
+ * iteratee function is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns the composed aggregate object.
+ * @example
+ *
+ * var keyData = [
+ * { 'dir': 'left', 'code': 97 },
+ * { 'dir': 'right', 'code': 100 }
+ * ];
+ *
+ * _.indexBy(keyData, 'dir');
+ * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+ *
+ * _.indexBy(keyData, function(object) {
+ * return String.fromCharCode(object.code);
+ * });
+ * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+ *
+ * _.indexBy(keyData, function(object) {
+ * return this.fromCharCode(object.code);
+ * }, String);
+ * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+ */
+ var indexBy = createAggregator(function(result, value, key) {
+ result[key] = value;
+ });
+
+ /**
+ * Invokes the method at `path` of each element in `collection`, returning
+ * an array of the results of each invoked method. Any additional arguments
+ * are provided to each invoked method. If `methodName` is a function it is
+ * invoked for, and `this` bound to, each element in `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Array|Function|string} path The path of the method to invoke or
+ * the function invoked per iteration.
+ * @param {...*} [args] The arguments to invoke the method with.
+ * @returns {Array} Returns the array of results.
+ * @example
+ *
+ * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+ * // => [[1, 5, 7], [1, 2, 3]]
+ *
+ * _.invoke([123, 456], String.prototype.split, '');
+ * // => [['1', '2', '3'], ['4', '5', '6']]
+ */
+ var invoke = restParam(function(collection, path, args) {
+ var index = -1,
+ isFunc = typeof path == 'function',
+ isProp = isKey(path),
+ result = isArrayLike(collection) ? Array(collection.length) : [];
+
+ baseEach(collection, function(value) {
+ var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
+ result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
+ });
+ return result;
+ });
+
+ /**
+ * Creates an array of values by running each element in `collection` through
+ * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
+ * arguments: (value, index|key, collection).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * Many lodash methods are guarded to work as iteratees for methods like
+ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
+ *
+ * The guarded methods are:
+ * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
+ * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
+ * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
+ * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
+ * `sum`, `uniq`, and `words`
+ *
+ * @static
+ * @memberOf _
+ * @alias collect
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array} Returns the new mapped array.
+ * @example
+ *
+ * function timesThree(n) {
+ * return n * 3;
+ * }
+ *
+ * _.map([1, 2], timesThree);
+ * // => [3, 6]
+ *
+ * _.map({ 'a': 1, 'b': 2 }, timesThree);
+ * // => [3, 6] (iteration order is not guaranteed)
+ *
+ * var users = [
+ * { 'user': 'barney' },
+ * { 'user': 'fred' }
+ * ];
+ *
+ * // using the `_.property` callback shorthand
+ * _.map(users, 'user');
+ * // => ['barney', 'fred']
+ */
+ function map(collection, iteratee, thisArg) {
+ var func = isArray(collection) ? arrayMap : baseMap;
+ iteratee = getCallback(iteratee, thisArg, 3);
+ return func(collection, iteratee);
+ }
+
+ /**
+ * Creates an array of elements split into two groups, the first of which
+ * contains elements `predicate` returns truthy for, while the second of which
+ * contains elements `predicate` returns falsey for. The predicate is bound
+ * to `thisArg` and invoked with three arguments: (value, index|key, collection).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the array of grouped elements.
+ * @example
+ *
+ * _.partition([1, 2, 3], function(n) {
+ * return n % 2;
+ * });
+ * // => [[1, 3], [2]]
+ *
+ * _.partition([1.2, 2.3, 3.4], function(n) {
+ * return this.floor(n) % 2;
+ * }, Math);
+ * // => [[1.2, 3.4], [2.3]]
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
+ * ];
+ *
+ * var mapper = function(array) {
+ * return _.pluck(array, 'user');
+ * };
+ *
+ * // using the `_.matches` callback shorthand
+ * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
+ * // => [['pebbles'], ['barney', 'fred']]
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.map(_.partition(users, 'active', false), mapper);
+ * // => [['barney', 'pebbles'], ['fred']]
+ *
+ * // using the `_.property` callback shorthand
+ * _.map(_.partition(users, 'active'), mapper);
+ * // => [['fred'], ['barney', 'pebbles']]
+ */
+ var partition = createAggregator(function(result, value, key) {
+ result[key ? 0 : 1].push(value);
+ }, function() { return [[], []]; });
+
+ /**
+ * Gets the property value of `path` from all elements in `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Array|string} path The path of the property to pluck.
+ * @returns {Array} Returns the property values.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 40 }
+ * ];
+ *
+ * _.pluck(users, 'user');
+ * // => ['barney', 'fred']
+ *
+ * var userIndex = _.indexBy(users, 'user');
+ * _.pluck(userIndex, 'age');
+ * // => [36, 40] (iteration order is not guaranteed)
+ */
+ function pluck(collection, path) {
+ return map(collection, property(path));
+ }
+
+ /**
+ * Reduces `collection` to a value which is the accumulated result of running
+ * each element in `collection` through `iteratee`, where each successive
+ * invocation is supplied the return value of the previous. If `accumulator`
+ * is not provided the first element of `collection` is used as the initial
+ * value. The `iteratee` is bound to `thisArg` and invoked with four arguments:
+ * (accumulator, value, index|key, collection).
+ *
+ * Many lodash methods are guarded to work as iteratees for methods like
+ * `_.reduce`, `_.reduceRight`, and `_.transform`.
+ *
+ * The guarded methods are:
+ * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,
+ * and `sortByOrder`
+ *
+ * @static
+ * @memberOf _
+ * @alias foldl, inject
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {*} Returns the accumulated value.
+ * @example
+ *
+ * _.reduce([1, 2], function(total, n) {
+ * return total + n;
+ * });
+ * // => 3
+ *
+ * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
+ * result[key] = n * 3;
+ * return result;
+ * }, {});
+ * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)
+ */
+ var reduce = createReduce(arrayReduce, baseEach);
+
+ /**
+ * This method is like `_.reduce` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @alias foldr
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {*} Returns the accumulated value.
+ * @example
+ *
+ * var array = [[0, 1], [2, 3], [4, 5]];
+ *
+ * _.reduceRight(array, function(flattened, other) {
+ * return flattened.concat(other);
+ * }, []);
+ * // => [4, 5, 2, 3, 0, 1]
+ */
+ var reduceRight = createReduce(arrayReduceRight, baseEachRight);
+
+ /**
+ * The opposite of `_.filter`; this method returns the elements of `collection`
+ * that `predicate` does **not** return truthy for.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Array} Returns the new filtered array.
+ * @example
+ *
+ * _.reject([1, 2, 3, 4], function(n) {
+ * return n % 2 == 0;
+ * });
+ * // => [1, 3]
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
+ * // => ['barney']
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.pluck(_.reject(users, 'active', false), 'user');
+ * // => ['fred']
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.reject(users, 'active'), 'user');
+ * // => ['barney']
+ */
+ function reject(collection, predicate, thisArg) {
+ var func = isArray(collection) ? arrayFilter : baseFilter;
+ predicate = getCallback(predicate, thisArg, 3);
+ return func(collection, function(value, index, collection) {
+ return !predicate(value, index, collection);
+ });
+ }
+
+ /**
+ * Gets a random element or `n` random elements from a collection.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to sample.
+ * @param {number} [n] The number of elements to sample.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {*} Returns the random sample(s).
+ * @example
+ *
+ * _.sample([1, 2, 3, 4]);
+ * // => 2
+ *
+ * _.sample([1, 2, 3, 4], 2);
+ * // => [3, 1]
+ */
+ function sample(collection, n, guard) {
+ if (guard ? isIterateeCall(collection, n, guard) : n == null) {
+ collection = toIterable(collection);
+ var length = collection.length;
+ return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
+ }
+ var index = -1,
+ result = toArray(collection),
+ length = result.length,
+ lastIndex = length - 1;
+
+ n = nativeMin(n < 0 ? 0 : (+n || 0), length);
+ while (++index < n) {
+ var rand = baseRandom(index, lastIndex),
+ value = result[rand];
+
+ result[rand] = result[index];
+ result[index] = value;
+ }
+ result.length = n;
+ return result;
+ }
+
+ /**
+ * Creates an array of shuffled values, using a version of the
+ * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to shuffle.
+ * @returns {Array} Returns the new shuffled array.
+ * @example
+ *
+ * _.shuffle([1, 2, 3, 4]);
+ * // => [4, 1, 3, 2]
+ */
+ function shuffle(collection) {
+ return sample(collection, POSITIVE_INFINITY);
+ }
+
+ /**
+ * Gets the size of `collection` by returning its length for array-like
+ * values or the number of own enumerable properties for objects.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to inspect.
+ * @returns {number} Returns the size of `collection`.
+ * @example
+ *
+ * _.size([1, 2, 3]);
+ * // => 3
+ *
+ * _.size({ 'a': 1, 'b': 2 });
+ * // => 2
+ *
+ * _.size('pebbles');
+ * // => 7
+ */
+ function size(collection) {
+ var length = collection ? getLength(collection) : 0;
+ return isLength(length) ? length : keys(collection).length;
+ }
+
+ /**
+ * Checks if `predicate` returns truthy for **any** element of `collection`.
+ * The function returns as soon as it finds a passing value and does not iterate
+ * over the entire collection. The predicate is bound to `thisArg` and invoked
+ * with three arguments: (value, index|key, collection).
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias any
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ * @example
+ *
+ * _.some([null, 0, 'yes', false], Boolean);
+ * // => true
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false }
+ * ];
+ *
+ * // using the `_.matches` callback shorthand
+ * _.some(users, { 'user': 'barney', 'active': false });
+ * // => false
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.some(users, 'active', false);
+ * // => true
+ *
+ * // using the `_.property` callback shorthand
+ * _.some(users, 'active');
+ * // => true
+ */
+ function some(collection, predicate, thisArg) {
+ var func = isArray(collection) ? arraySome : baseSome;
+ if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
+ predicate = undefined;
+ }
+ if (typeof predicate != 'function' || thisArg !== undefined) {
+ predicate = getCallback(predicate, thisArg, 3);
+ }
+ return func(collection, predicate);
+ }
+
+ /**
+ * Creates an array of elements, sorted in ascending order by the results of
+ * running each element in a collection through `iteratee`. This method performs
+ * a stable sort, that is, it preserves the original sort order of equal elements.
+ * The `iteratee` is bound to `thisArg` and invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Array} Returns the new sorted array.
+ * @example
+ *
+ * _.sortBy([1, 2, 3], function(n) {
+ * return Math.sin(n);
+ * });
+ * // => [3, 1, 2]
+ *
+ * _.sortBy([1, 2, 3], function(n) {
+ * return this.sin(n);
+ * }, Math);
+ * // => [3, 1, 2]
+ *
+ * var users = [
+ * { 'user': 'fred' },
+ * { 'user': 'pebbles' },
+ * { 'user': 'barney' }
+ * ];
+ *
+ * // using the `_.property` callback shorthand
+ * _.pluck(_.sortBy(users, 'user'), 'user');
+ * // => ['barney', 'fred', 'pebbles']
+ */
+ function sortBy(collection, iteratee, thisArg) {
+ if (collection == null) {
+ return [];
+ }
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+ iteratee = undefined;
+ }
+ var index = -1;
+ iteratee = getCallback(iteratee, thisArg, 3);
+
+ var result = baseMap(collection, function(value, key, collection) {
+ return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
+ });
+ return baseSortBy(result, compareAscending);
+ }
+
+ /**
+ * This method is like `_.sortBy` except that it can sort by multiple iteratees
+ * or property names.
+ *
+ * If a property name is provided for an iteratee the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If an object is provided for an iteratee the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees
+ * The iteratees to sort by, specified as individual values or arrays of values.
+ * @returns {Array} Returns the new sorted array.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'fred', 'age': 48 },
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 42 },
+ * { 'user': 'barney', 'age': 34 }
+ * ];
+ *
+ * _.map(_.sortByAll(users, ['user', 'age']), _.values);
+ * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
+ *
+ * _.map(_.sortByAll(users, 'user', function(chr) {
+ * return Math.floor(chr.age / 10);
+ * }), _.values);
+ * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ */
+ var sortByAll = restParam(function(collection, iteratees) {
+ if (collection == null) {
+ return [];
+ }
+ var guard = iteratees[2];
+ if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
+ iteratees.length = 1;
+ }
+ return baseSortByOrder(collection, baseFlatten(iteratees), []);
+ });
+
+ /**
+ * This method is like `_.sortByAll` except that it allows specifying the
+ * sort orders of the iteratees to sort by. If `orders` is unspecified, all
+ * values are sorted in ascending order. Otherwise, a value is sorted in
+ * ascending order if its corresponding order is "asc", and descending if "desc".
+ *
+ * If a property name is provided for an iteratee the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If an object is provided for an iteratee the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+ * @param {boolean[]} [orders] The sort orders of `iteratees`.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
+ * @returns {Array} Returns the new sorted array.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'fred', 'age': 48 },
+ * { 'user': 'barney', 'age': 34 },
+ * { 'user': 'fred', 'age': 42 },
+ * { 'user': 'barney', 'age': 36 }
+ * ];
+ *
+ * // sort by `user` in ascending order and by `age` in descending order
+ * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);
+ * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ */
+ function sortByOrder(collection, iteratees, orders, guard) {
+ if (collection == null) {
+ return [];
+ }
+ if (guard && isIterateeCall(iteratees, orders, guard)) {
+ orders = undefined;
+ }
+ if (!isArray(iteratees)) {
+ iteratees = iteratees == null ? [] : [iteratees];
+ }
+ if (!isArray(orders)) {
+ orders = orders == null ? [] : [orders];
+ }
+ return baseSortByOrder(collection, iteratees, orders);
+ }
+
+ /**
+ * Performs a deep comparison between each element in `collection` and the
+ * source object, returning an array of all elements that have equivalent
+ * property values.
+ *
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
+ * their own, not inherited, enumerable properties. For comparing a single
+ * own or inherited property value see `_.matchesProperty`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to search.
+ * @param {Object} source The object of property values to match.
+ * @returns {Array} Returns the new filtered array.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },
+ * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }
+ * ];
+ *
+ * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');
+ * // => ['barney']
+ *
+ * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
+ * // => ['fred']
+ */
+ function where(collection, source) {
+ return filter(collection, baseMatches(source));
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Gets the number of milliseconds that have elapsed since the Unix epoch
+ * (1 January 1970 00:00:00 UTC).
+ *
+ * @static
+ * @memberOf _
+ * @category Date
+ * @example
+ *
+ * _.defer(function(stamp) {
+ * console.log(_.now() - stamp);
+ * }, _.now());
+ * // => logs the number of milliseconds it took for the deferred function to be invoked
+ */
+ var now = nativeNow || function() {
+ return new Date().getTime();
+ };
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * The opposite of `_.before`; this method creates a function that invokes
+ * `func` once it is called `n` or more times.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {number} n The number of calls before `func` is invoked.
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var saves = ['profile', 'settings'];
+ *
+ * var done = _.after(saves.length, function() {
+ * console.log('done saving!');
+ * });
+ *
+ * _.forEach(saves, function(type) {
+ * asyncSave({ 'type': type, 'complete': done });
+ * });
+ * // => logs 'done saving!' after the two async saves have completed
+ */
+ function after(n, func) {
+ if (typeof func != 'function') {
+ if (typeof n == 'function') {
+ var temp = n;
+ n = func;
+ func = temp;
+ } else {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ }
+ n = nativeIsFinite(n = +n) ? n : 0;
+ return function() {
+ if (--n < 1) {
+ return func.apply(this, arguments);
+ }
+ };
+ }
+
+ /**
+ * Creates a function that accepts up to `n` arguments ignoring any
+ * additional arguments.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to cap arguments for.
+ * @param {number} [n=func.length] The arity cap.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * _.map(['6', '8', '10'], _.ary(parseInt, 1));
+ * // => [6, 8, 10]
+ */
+ function ary(func, n, guard) {
+ if (guard && isIterateeCall(func, n, guard)) {
+ n = undefined;
+ }
+ n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
+ return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
+ }
+
+ /**
+ * Creates a function that invokes `func`, with the `this` binding and arguments
+ * of the created function, while it is called less than `n` times. Subsequent
+ * calls to the created function return the result of the last `func` invocation.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {number} n The number of calls at which `func` is no longer invoked.
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * jQuery('#add').on('click', _.before(5, addContactToList));
+ * // => allows adding up to 4 contacts to the list
+ */
+ function before(n, func) {
+ var result;
+ if (typeof func != 'function') {
+ if (typeof n == 'function') {
+ var temp = n;
+ n = func;
+ func = temp;
+ } else {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ }
+ return function() {
+ if (--n > 0) {
+ result = func.apply(this, arguments);
+ }
+ if (n <= 1) {
+ func = undefined;
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of `thisArg`
+ * and prepends any additional `_.bind` arguments to those provided to the
+ * bound function.
+ *
+ * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
+ * may be used as a placeholder for partially applied arguments.
+ *
+ * **Note:** Unlike native `Function#bind` this method does not set the "length"
+ * property of bound functions.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to bind.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new bound function.
+ * @example
+ *
+ * var greet = function(greeting, punctuation) {
+ * return greeting + ' ' + this.user + punctuation;
+ * };
+ *
+ * var object = { 'user': 'fred' };
+ *
+ * var bound = _.bind(greet, object, 'hi');
+ * bound('!');
+ * // => 'hi fred!'
+ *
+ * // using placeholders
+ * var bound = _.bind(greet, object, _, '!');
+ * bound('hi');
+ * // => 'hi fred!'
+ */
+ var bind = restParam(function(func, thisArg, partials) {
+ var bitmask = BIND_FLAG;
+ if (partials.length) {
+ var holders = replaceHolders(partials, bind.placeholder);
+ bitmask |= PARTIAL_FLAG;
+ }
+ return createWrapper(func, bitmask, thisArg, partials, holders);
+ });
+
+ /**
+ * Binds methods of an object to the object itself, overwriting the existing
+ * method. Method names may be specified as individual arguments or as arrays
+ * of method names. If no method names are provided all enumerable function
+ * properties, own and inherited, of `object` are bound.
+ *
+ * **Note:** This method does not set the "length" property of bound functions.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Object} object The object to bind and assign the bound methods to.
+ * @param {...(string|string[])} [methodNames] The object method names to bind,
+ * specified as individual method names or arrays of method names.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var view = {
+ * 'label': 'docs',
+ * 'onClick': function() {
+ * console.log('clicked ' + this.label);
+ * }
+ * };
+ *
+ * _.bindAll(view);
+ * jQuery('#docs').on('click', view.onClick);
+ * // => logs 'clicked docs' when the element is clicked
+ */
+ var bindAll = restParam(function(object, methodNames) {
+ methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);
+
+ var index = -1,
+ length = methodNames.length;
+
+ while (++index < length) {
+ var key = methodNames[index];
+ object[key] = createWrapper(object[key], BIND_FLAG, object);
+ }
+ return object;
+ });
+
+ /**
+ * Creates a function that invokes the method at `object[key]` and prepends
+ * any additional `_.bindKey` arguments to those provided to the bound function.
+ *
+ * This method differs from `_.bind` by allowing bound functions to reference
+ * methods that may be redefined or don't yet exist.
+ * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
+ * for more details.
+ *
+ * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for partially applied arguments.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Object} object The object the method belongs to.
+ * @param {string} key The key of the method.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new bound function.
+ * @example
+ *
+ * var object = {
+ * 'user': 'fred',
+ * 'greet': function(greeting, punctuation) {
+ * return greeting + ' ' + this.user + punctuation;
+ * }
+ * };
+ *
+ * var bound = _.bindKey(object, 'greet', 'hi');
+ * bound('!');
+ * // => 'hi fred!'
+ *
+ * object.greet = function(greeting, punctuation) {
+ * return greeting + 'ya ' + this.user + punctuation;
+ * };
+ *
+ * bound('!');
+ * // => 'hiya fred!'
+ *
+ * // using placeholders
+ * var bound = _.bindKey(object, 'greet', _, '!');
+ * bound('hi');
+ * // => 'hiya fred!'
+ */
+ var bindKey = restParam(function(object, key, partials) {
+ var bitmask = BIND_FLAG | BIND_KEY_FLAG;
+ if (partials.length) {
+ var holders = replaceHolders(partials, bindKey.placeholder);
+ bitmask |= PARTIAL_FLAG;
+ }
+ return createWrapper(key, bitmask, object, partials, holders);
+ });
+
+ /**
+ * Creates a function that accepts one or more arguments of `func` that when
+ * called either invokes `func` returning its result, if all `func` arguments
+ * have been provided, or returns a function that accepts one or more of the
+ * remaining `func` arguments, and so on. The arity of `func` may be specified
+ * if `func.length` is not sufficient.
+ *
+ * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
+ * may be used as a placeholder for provided arguments.
+ *
+ * **Note:** This method does not set the "length" property of curried functions.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to curry.
+ * @param {number} [arity=func.length] The arity of `func`.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Function} Returns the new curried function.
+ * @example
+ *
+ * var abc = function(a, b, c) {
+ * return [a, b, c];
+ * };
+ *
+ * var curried = _.curry(abc);
+ *
+ * curried(1)(2)(3);
+ * // => [1, 2, 3]
+ *
+ * curried(1, 2)(3);
+ * // => [1, 2, 3]
+ *
+ * curried(1, 2, 3);
+ * // => [1, 2, 3]
+ *
+ * // using placeholders
+ * curried(1)(_, 3)(2);
+ * // => [1, 2, 3]
+ */
+ var curry = createCurry(CURRY_FLAG);
+
+ /**
+ * This method is like `_.curry` except that arguments are applied to `func`
+ * in the manner of `_.partialRight` instead of `_.partial`.
+ *
+ * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for provided arguments.
+ *
+ * **Note:** This method does not set the "length" property of curried functions.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to curry.
+ * @param {number} [arity=func.length] The arity of `func`.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Function} Returns the new curried function.
+ * @example
+ *
+ * var abc = function(a, b, c) {
+ * return [a, b, c];
+ * };
+ *
+ * var curried = _.curryRight(abc);
+ *
+ * curried(3)(2)(1);
+ * // => [1, 2, 3]
+ *
+ * curried(2, 3)(1);
+ * // => [1, 2, 3]
+ *
+ * curried(1, 2, 3);
+ * // => [1, 2, 3]
+ *
+ * // using placeholders
+ * curried(3)(1, _)(2);
+ * // => [1, 2, 3]
+ */
+ var curryRight = createCurry(CURRY_RIGHT_FLAG);
+
+ /**
+ * Creates a debounced function that delays invoking `func` until after `wait`
+ * milliseconds have elapsed since the last time the debounced function was
+ * invoked. The debounced function comes with a `cancel` method to cancel
+ * delayed invocations. Provide an options object to indicate that `func`
+ * should be invoked on the leading and/or trailing edge of the `wait` timeout.
+ * Subsequent calls to the debounced function return the result of the last
+ * `func` invocation.
+ *
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
+ * on the trailing edge of the timeout only if the the debounced function is
+ * invoked more than once during the `wait` timeout.
+ *
+ * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
+ * for details over the differences between `_.debounce` and `_.throttle`.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to debounce.
+ * @param {number} [wait=0] The number of milliseconds to delay.
+ * @param {Object} [options] The options object.
+ * @param {boolean} [options.leading=false] Specify invoking on the leading
+ * edge of the timeout.
+ * @param {number} [options.maxWait] The maximum time `func` is allowed to be
+ * delayed before it is invoked.
+ * @param {boolean} [options.trailing=true] Specify invoking on the trailing
+ * edge of the timeout.
+ * @returns {Function} Returns the new debounced function.
+ * @example
+ *
+ * // avoid costly calculations while the window size is in flux
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
+ *
+ * // invoke `sendMail` when the click event is fired, debouncing subsequent calls
+ * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+ * 'leading': true,
+ * 'trailing': false
+ * }));
+ *
+ * // ensure `batchLog` is invoked once after 1 second of debounced calls
+ * var source = new EventSource('/stream');
+ * jQuery(source).on('message', _.debounce(batchLog, 250, {
+ * 'maxWait': 1000
+ * }));
+ *
+ * // cancel a debounced call
+ * var todoChanges = _.debounce(batchLog, 1000);
+ * Object.observe(models.todo, todoChanges);
+ *
+ * Object.observe(models, function(changes) {
+ * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {
+ * todoChanges.cancel();
+ * }
+ * }, ['delete']);
+ *
+ * // ...at some point `models.todo` is changed
+ * models.todo.completed = true;
+ *
+ * // ...before 1 second has passed `models.todo` is deleted
+ * // which cancels the debounced `todoChanges` call
+ * delete models.todo;
+ */
+ function debounce(func, wait, options) {
+ var args,
+ maxTimeoutId,
+ result,
+ stamp,
+ thisArg,
+ timeoutId,
+ trailingCall,
+ lastCalled = 0,
+ maxWait = false,
+ trailing = true;
+
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ wait = wait < 0 ? 0 : (+wait || 0);
+ if (options === true) {
+ var leading = true;
+ trailing = false;
+ } else if (isObject(options)) {
+ leading = !!options.leading;
+ maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
+ }
+
+ function cancel() {
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ }
+ if (maxTimeoutId) {
+ clearTimeout(maxTimeoutId);
+ }
+ lastCalled = 0;
+ maxTimeoutId = timeoutId = trailingCall = undefined;
+ }
+
+ function complete(isCalled, id) {
+ if (id) {
+ clearTimeout(id);
+ }
+ maxTimeoutId = timeoutId = trailingCall = undefined;
+ if (isCalled) {
+ lastCalled = now();
+ result = func.apply(thisArg, args);
+ if (!timeoutId && !maxTimeoutId) {
+ args = thisArg = undefined;
+ }
+ }
+ }
+
+ function delayed() {
+ var remaining = wait - (now() - stamp);
+ if (remaining <= 0 || remaining > wait) {
+ complete(trailingCall, maxTimeoutId);
+ } else {
+ timeoutId = setTimeout(delayed, remaining);
+ }
+ }
+
+ function maxDelayed() {
+ complete(trailing, timeoutId);
+ }
+
+ function debounced() {
+ args = arguments;
+ stamp = now();
+ thisArg = this;
+ trailingCall = trailing && (timeoutId || !leading);
+
+ if (maxWait === false) {
+ var leadingCall = leading && !timeoutId;
+ } else {
+ if (!maxTimeoutId && !leading) {
+ lastCalled = stamp;
+ }
+ var remaining = maxWait - (stamp - lastCalled),
+ isCalled = remaining <= 0 || remaining > maxWait;
+
+ if (isCalled) {
+ if (maxTimeoutId) {
+ maxTimeoutId = clearTimeout(maxTimeoutId);
+ }
+ lastCalled = stamp;
+ result = func.apply(thisArg, args);
+ }
+ else if (!maxTimeoutId) {
+ maxTimeoutId = setTimeout(maxDelayed, remaining);
+ }
+ }
+ if (isCalled && timeoutId) {
+ timeoutId = clearTimeout(timeoutId);
+ }
+ else if (!timeoutId && wait !== maxWait) {
+ timeoutId = setTimeout(delayed, wait);
+ }
+ if (leadingCall) {
+ isCalled = true;
+ result = func.apply(thisArg, args);
+ }
+ if (isCalled && !timeoutId && !maxTimeoutId) {
+ args = thisArg = undefined;
+ }
+ return result;
+ }
+ debounced.cancel = cancel;
+ return debounced;
+ }
+
+ /**
+ * Defers invoking the `func` until the current call stack has cleared. Any
+ * additional arguments are provided to `func` when it is invoked.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to defer.
+ * @param {...*} [args] The arguments to invoke the function with.
+ * @returns {number} Returns the timer id.
+ * @example
+ *
+ * _.defer(function(text) {
+ * console.log(text);
+ * }, 'deferred');
+ * // logs 'deferred' after one or more milliseconds
+ */
+ var defer = restParam(function(func, args) {
+ return baseDelay(func, 1, args);
+ });
+
+ /**
+ * Invokes `func` after `wait` milliseconds. Any additional arguments are
+ * provided to `func` when it is invoked.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to delay.
+ * @param {number} wait The number of milliseconds to delay invocation.
+ * @param {...*} [args] The arguments to invoke the function with.
+ * @returns {number} Returns the timer id.
+ * @example
+ *
+ * _.delay(function(text) {
+ * console.log(text);
+ * }, 1000, 'later');
+ * // => logs 'later' after one second
+ */
+ var delay = restParam(function(func, wait, args) {
+ return baseDelay(func, wait, args);
+ });
+
+ /**
+ * Creates a function that returns the result of invoking the provided
+ * functions with the `this` binding of the created function, where each
+ * successive invocation is supplied the return value of the previous.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {...Function} [funcs] Functions to invoke.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var addSquare = _.flow(_.add, square);
+ * addSquare(1, 2);
+ * // => 9
+ */
+ var flow = createFlow();
+
+ /**
+ * This method is like `_.flow` except that it creates a function that
+ * invokes the provided functions from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @alias backflow, compose
+ * @category Function
+ * @param {...Function} [funcs] Functions to invoke.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var addSquare = _.flowRight(square, _.add);
+ * addSquare(1, 2);
+ * // => 9
+ */
+ var flowRight = createFlow(true);
+
+ /**
+ * Creates a function that memoizes the result of `func`. If `resolver` is
+ * provided it determines the cache key for storing the result based on the
+ * arguments provided to the memoized function. By default, the first argument
+ * provided to the memoized function is coerced to a string and used as the
+ * cache key. The `func` is invoked with the `this` binding of the memoized
+ * function.
+ *
+ * **Note:** The cache is exposed as the `cache` property on the memoized
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
+ * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
+ * method interface of `get`, `has`, and `set`.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to have its output memoized.
+ * @param {Function} [resolver] The function to resolve the cache key.
+ * @returns {Function} Returns the new memoizing function.
+ * @example
+ *
+ * var upperCase = _.memoize(function(string) {
+ * return string.toUpperCase();
+ * });
+ *
+ * upperCase('fred');
+ * // => 'FRED'
+ *
+ * // modifying the result cache
+ * upperCase.cache.set('fred', 'BARNEY');
+ * upperCase('fred');
+ * // => 'BARNEY'
+ *
+ * // replacing `_.memoize.Cache`
+ * var object = { 'user': 'fred' };
+ * var other = { 'user': 'barney' };
+ * var identity = _.memoize(_.identity);
+ *
+ * identity(object);
+ * // => { 'user': 'fred' }
+ * identity(other);
+ * // => { 'user': 'fred' }
+ *
+ * _.memoize.Cache = WeakMap;
+ * var identity = _.memoize(_.identity);
+ *
+ * identity(object);
+ * // => { 'user': 'fred' }
+ * identity(other);
+ * // => { 'user': 'barney' }
+ */
+ function memoize(func, resolver) {
+ if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ var memoized = function() {
+ var args = arguments,
+ key = resolver ? resolver.apply(this, args) : args[0],
+ cache = memoized.cache;
+
+ if (cache.has(key)) {
+ return cache.get(key);
+ }
+ var result = func.apply(this, args);
+ memoized.cache = cache.set(key, result);
+ return result;
+ };
+ memoized.cache = new memoize.Cache;
+ return memoized;
+ }
+
+ /**
+ * Creates a function that runs each argument through a corresponding
+ * transform function.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to wrap.
+ * @param {...(Function|Function[])} [transforms] The functions to transform
+ * arguments, specified as individual functions or arrays of functions.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * function doubled(n) {
+ * return n * 2;
+ * }
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var modded = _.modArgs(function(x, y) {
+ * return [x, y];
+ * }, square, doubled);
+ *
+ * modded(1, 2);
+ * // => [1, 4]
+ *
+ * modded(5, 10);
+ * // => [25, 20]
+ */
+ var modArgs = restParam(function(func, transforms) {
+ transforms = baseFlatten(transforms);
+ if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ var length = transforms.length;
+ return restParam(function(args) {
+ var index = nativeMin(args.length, length);
+ while (index--) {
+ args[index] = transforms[index](args[index]);
+ }
+ return func.apply(this, args);
+ });
+ });
+
+ /**
+ * Creates a function that negates the result of the predicate `func`. The
+ * `func` predicate is invoked with the `this` binding and arguments of the
+ * created function.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} predicate The predicate to negate.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * function isEven(n) {
+ * return n % 2 == 0;
+ * }
+ *
+ * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
+ * // => [1, 3, 5]
+ */
+ function negate(predicate) {
+ if (typeof predicate != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ return function() {
+ return !predicate.apply(this, arguments);
+ };
+ }
+
+ /**
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
+ * to the function return the value of the first call. The `func` is invoked
+ * with the `this` binding and arguments of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var initialize = _.once(createApplication);
+ * initialize();
+ * initialize();
+ * // `initialize` invokes `createApplication` once
+ */
+ function once(func) {
+ return before(2, func);
+ }
+
+ /**
+ * Creates a function that invokes `func` with `partial` arguments prepended
+ * to those provided to the new function. This method is like `_.bind` except
+ * it does **not** alter the `this` binding.
+ *
+ * The `_.partial.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for partially applied arguments.
+ *
+ * **Note:** This method does not set the "length" property of partially
+ * applied functions.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to partially apply arguments to.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new partially applied function.
+ * @example
+ *
+ * var greet = function(greeting, name) {
+ * return greeting + ' ' + name;
+ * };
+ *
+ * var sayHelloTo = _.partial(greet, 'hello');
+ * sayHelloTo('fred');
+ * // => 'hello fred'
+ *
+ * // using placeholders
+ * var greetFred = _.partial(greet, _, 'fred');
+ * greetFred('hi');
+ * // => 'hi fred'
+ */
+ var partial = createPartial(PARTIAL_FLAG);
+
+ /**
+ * This method is like `_.partial` except that partially applied arguments
+ * are appended to those provided to the new function.
+ *
+ * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for partially applied arguments.
+ *
+ * **Note:** This method does not set the "length" property of partially
+ * applied functions.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to partially apply arguments to.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new partially applied function.
+ * @example
+ *
+ * var greet = function(greeting, name) {
+ * return greeting + ' ' + name;
+ * };
+ *
+ * var greetFred = _.partialRight(greet, 'fred');
+ * greetFred('hi');
+ * // => 'hi fred'
+ *
+ * // using placeholders
+ * var sayHelloTo = _.partialRight(greet, 'hello', _);
+ * sayHelloTo('fred');
+ * // => 'hello fred'
+ */
+ var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
+
+ /**
+ * Creates a function that invokes `func` with arguments arranged according
+ * to the specified indexes where the argument value at the first index is
+ * provided as the first argument, the argument value at the second index is
+ * provided as the second argument, and so on.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to rearrange arguments for.
+ * @param {...(number|number[])} indexes The arranged argument indexes,
+ * specified as individual indexes or arrays of indexes.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var rearged = _.rearg(function(a, b, c) {
+ * return [a, b, c];
+ * }, 2, 0, 1);
+ *
+ * rearged('b', 'c', 'a')
+ * // => ['a', 'b', 'c']
+ *
+ * var map = _.rearg(_.map, [1, 0]);
+ * map(function(n) {
+ * return n * 3;
+ * }, [1, 2, 3]);
+ * // => [3, 6, 9]
+ */
+ var rearg = restParam(function(func, indexes) {
+ return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
+ });
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * created function and arguments from `start` and beyond provided as an array.
+ *
+ * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var say = _.restParam(function(what, names) {
+ * return what + ' ' + _.initial(names).join(', ') +
+ * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
+ * });
+ *
+ * say('hello', 'fred', 'barney', 'pebbles');
+ * // => 'hello fred, barney, & pebbles'
+ */
+ function restParam(func, start) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ rest = Array(length);
+
+ while (++index < length) {
+ rest[index] = args[start + index];
+ }
+ switch (start) {
+ case 0: return func.call(this, rest);
+ case 1: return func.call(this, args[0], rest);
+ case 2: return func.call(this, args[0], args[1], rest);
+ }
+ var otherArgs = Array(start + 1);
+ index = -1;
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = rest;
+ return func.apply(this, otherArgs);
+ };
+ }
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of the created
+ * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
+ *
+ * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to spread arguments over.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var say = _.spread(function(who, what) {
+ * return who + ' says ' + what;
+ * });
+ *
+ * say(['fred', 'hello']);
+ * // => 'fred says hello'
+ *
+ * // with a Promise
+ * var numbers = Promise.all([
+ * Promise.resolve(40),
+ * Promise.resolve(36)
+ * ]);
+ *
+ * numbers.then(_.spread(function(x, y) {
+ * return x + y;
+ * }));
+ * // => a Promise of 76
+ */
+ function spread(func) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ return function(array) {
+ return func.apply(this, array);
+ };
+ }
+
+ /**
+ * Creates a throttled function that only invokes `func` at most once per
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
+ * method to cancel delayed invocations. Provide an options object to indicate
+ * that `func` should be invoked on the leading and/or trailing edge of the
+ * `wait` timeout. Subsequent calls to the throttled function return the
+ * result of the last `func` call.
+ *
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
+ * on the trailing edge of the timeout only if the the throttled function is
+ * invoked more than once during the `wait` timeout.
+ *
+ * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
+ * for details over the differences between `_.throttle` and `_.debounce`.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to throttle.
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
+ * @param {Object} [options] The options object.
+ * @param {boolean} [options.leading=true] Specify invoking on the leading
+ * edge of the timeout.
+ * @param {boolean} [options.trailing=true] Specify invoking on the trailing
+ * edge of the timeout.
+ * @returns {Function} Returns the new throttled function.
+ * @example
+ *
+ * // avoid excessively updating the position while scrolling
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
+ *
+ * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
+ * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+ * 'trailing': false
+ * }));
+ *
+ * // cancel a trailing throttled call
+ * jQuery(window).on('popstate', throttled.cancel);
+ */
+ function throttle(func, wait, options) {
+ var leading = true,
+ trailing = true;
+
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ if (options === false) {
+ leading = false;
+ } else if (isObject(options)) {
+ leading = 'leading' in options ? !!options.leading : leading;
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
+ }
+ return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });
+ }
+
+ /**
+ * Creates a function that provides `value` to the wrapper function as its
+ * first argument. Any additional arguments provided to the function are
+ * appended to those provided to the wrapper function. The wrapper is invoked
+ * with the `this` binding of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {*} value The value to wrap.
+ * @param {Function} wrapper The wrapper function.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var p = _.wrap(_.escape, function(func, text) {
+ * return '' + func(text) + '
';
+ * });
+ *
+ * p('fred, barney, & pebbles');
+ * // => 'fred, barney, & pebbles
'
+ */
+ function wrap(value, wrapper) {
+ wrapper = wrapper == null ? identity : wrapper;
+ return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
+ * otherwise they are assigned by reference. If `customizer` is provided it is
+ * invoked to produce the cloned values. If `customizer` returns `undefined`
+ * cloning is handled by the method instead. The `customizer` is bound to
+ * `thisArg` and invoked with two argument; (value [, index|key, object]).
+ *
+ * **Note:** This method is loosely based on the
+ * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
+ * The enumerable properties of `arguments` objects and objects created by
+ * constructors other than `Object` are cloned to plain `Object` objects. An
+ * empty object is returned for uncloneable values such as functions, DOM nodes,
+ * Maps, Sets, and WeakMaps.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @param {Function} [customizer] The function to customize cloning values.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {*} Returns the cloned value.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney' },
+ * { 'user': 'fred' }
+ * ];
+ *
+ * var shallow = _.clone(users);
+ * shallow[0] === users[0];
+ * // => true
+ *
+ * var deep = _.clone(users, true);
+ * deep[0] === users[0];
+ * // => false
+ *
+ * // using a customizer callback
+ * var el = _.clone(document.body, function(value) {
+ * if (_.isElement(value)) {
+ * return value.cloneNode(false);
+ * }
+ * });
+ *
+ * el === document.body
+ * // => false
+ * el.nodeName
+ * // => BODY
+ * el.childNodes.length;
+ * // => 0
+ */
+ function clone(value, isDeep, customizer, thisArg) {
+ if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
+ isDeep = false;
+ }
+ else if (typeof isDeep == 'function') {
+ thisArg = customizer;
+ customizer = isDeep;
+ isDeep = false;
+ }
+ return typeof customizer == 'function'
+ ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
+ : baseClone(value, isDeep);
+ }
+
+ /**
+ * Creates a deep clone of `value`. If `customizer` is provided it is invoked
+ * to produce the cloned values. If `customizer` returns `undefined` cloning
+ * is handled by the method instead. The `customizer` is bound to `thisArg`
+ * and invoked with two argument; (value [, index|key, object]).
+ *
+ * **Note:** This method is loosely based on the
+ * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
+ * The enumerable properties of `arguments` objects and objects created by
+ * constructors other than `Object` are cloned to plain `Object` objects. An
+ * empty object is returned for uncloneable values such as functions, DOM nodes,
+ * Maps, Sets, and WeakMaps.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to deep clone.
+ * @param {Function} [customizer] The function to customize cloning values.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {*} Returns the deep cloned value.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney' },
+ * { 'user': 'fred' }
+ * ];
+ *
+ * var deep = _.cloneDeep(users);
+ * deep[0] === users[0];
+ * // => false
+ *
+ * // using a customizer callback
+ * var el = _.cloneDeep(document.body, function(value) {
+ * if (_.isElement(value)) {
+ * return value.cloneNode(true);
+ * }
+ * });
+ *
+ * el === document.body
+ * // => false
+ * el.nodeName
+ * // => BODY
+ * el.childNodes.length;
+ * // => 20
+ */
+ function cloneDeep(value, customizer, thisArg) {
+ return typeof customizer == 'function'
+ ? baseClone(value, true, bindCallback(customizer, thisArg, 1))
+ : baseClone(value, true);
+ }
+
+ /**
+ * Checks if `value` is greater than `other`.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
+ * @example
+ *
+ * _.gt(3, 1);
+ * // => true
+ *
+ * _.gt(3, 3);
+ * // => false
+ *
+ * _.gt(1, 3);
+ * // => false
+ */
+ function gt(value, other) {
+ return value > other;
+ }
+
+ /**
+ * Checks if `value` is greater than or equal to `other`.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
+ * @example
+ *
+ * _.gte(3, 1);
+ * // => true
+ *
+ * _.gte(3, 3);
+ * // => true
+ *
+ * _.gte(1, 3);
+ * // => false
+ */
+ function gte(value, other) {
+ return value >= other;
+ }
+
+ /**
+ * Checks if `value` is classified as an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArguments(function() { return arguments; }());
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+ function isArguments(value) {
+ return isObjectLike(value) && isArrayLike(value) &&
+ hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
+ }
+
+ /**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(function() { return arguments; }());
+ * // => false
+ */
+ var isArray = nativeIsArray || function(value) {
+ return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
+ };
+
+ /**
+ * Checks if `value` is classified as a boolean primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isBoolean(false);
+ * // => true
+ *
+ * _.isBoolean(null);
+ * // => false
+ */
+ function isBoolean(value) {
+ return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
+ }
+
+ /**
+ * Checks if `value` is classified as a `Date` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isDate(new Date);
+ * // => true
+ *
+ * _.isDate('Mon April 23 2012');
+ * // => false
+ */
+ function isDate(value) {
+ return isObjectLike(value) && objToString.call(value) == dateTag;
+ }
+
+ /**
+ * Checks if `value` is a DOM element.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
+ * @example
+ *
+ * _.isElement(document.body);
+ * // => true
+ *
+ * _.isElement('');
+ * // => false
+ */
+ function isElement(value) {
+ return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
+ }
+
+ /**
+ * Checks if `value` is empty. A value is considered empty unless it is an
+ * `arguments` object, array, string, or jQuery-like collection with a length
+ * greater than `0` or an object with own enumerable properties.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {Array|Object|string} value The value to inspect.
+ * @returns {boolean} Returns `true` if `value` is empty, else `false`.
+ * @example
+ *
+ * _.isEmpty(null);
+ * // => true
+ *
+ * _.isEmpty(true);
+ * // => true
+ *
+ * _.isEmpty(1);
+ * // => true
+ *
+ * _.isEmpty([1, 2, 3]);
+ * // => false
+ *
+ * _.isEmpty({ 'a': 1 });
+ * // => false
+ */
+ function isEmpty(value) {
+ if (value == null) {
+ return true;
+ }
+ if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
+ (isObjectLike(value) && isFunction(value.splice)))) {
+ return !value.length;
+ }
+ return !keys(value).length;
+ }
+
+ /**
+ * Performs a deep comparison between two values to determine if they are
+ * equivalent. If `customizer` is provided it is invoked to compare values.
+ * If `customizer` returns `undefined` comparisons are handled by the method
+ * instead. The `customizer` is bound to `thisArg` and invoked with three
+ * arguments: (value, other [, index|key]).
+ *
+ * **Note:** This method supports comparing arrays, booleans, `Date` objects,
+ * numbers, `Object` objects, regexes, and strings. Objects are compared by
+ * their own, not inherited, enumerable properties. Functions and DOM nodes
+ * are **not** supported. Provide a customizer function to extend support
+ * for comparing other values.
+ *
+ * @static
+ * @memberOf _
+ * @alias eq
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @param {Function} [customizer] The function to customize value comparisons.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @example
+ *
+ * var object = { 'user': 'fred' };
+ * var other = { 'user': 'fred' };
+ *
+ * object == other;
+ * // => false
+ *
+ * _.isEqual(object, other);
+ * // => true
+ *
+ * // using a customizer callback
+ * var array = ['hello', 'goodbye'];
+ * var other = ['hi', 'goodbye'];
+ *
+ * _.isEqual(array, other, function(value, other) {
+ * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
+ * return true;
+ * }
+ * });
+ * // => true
+ */
+ function isEqual(value, other, customizer, thisArg) {
+ customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
+ var result = customizer ? customizer(value, other) : undefined;
+ return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
+ }
+
+ /**
+ * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
+ * `SyntaxError`, `TypeError`, or `URIError` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
+ * @example
+ *
+ * _.isError(new Error);
+ * // => true
+ *
+ * _.isError(Error);
+ * // => false
+ */
+ function isError(value) {
+ return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
+ }
+
+ /**
+ * Checks if `value` is a finite primitive number.
+ *
+ * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+ * @example
+ *
+ * _.isFinite(10);
+ * // => true
+ *
+ * _.isFinite('10');
+ * // => false
+ *
+ * _.isFinite(true);
+ * // => false
+ *
+ * _.isFinite(Object(10));
+ * // => false
+ *
+ * _.isFinite(Infinity);
+ * // => false
+ */
+ function isFinite(value) {
+ return typeof value == 'number' && nativeIsFinite(value);
+ }
+
+ /**
+ * Checks if `value` is classified as a `Function` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ *
+ * _.isFunction(/abc/);
+ * // => false
+ */
+ function isFunction(value) {
+ // The use of `Object#toString` avoids issues with the `typeof` operator
+ // in older versions of Chrome and Safari which return 'function' for regexes
+ // and Safari 8 equivalents which return 'object' for typed array constructors.
+ return isObject(value) && objToString.call(value) == funcTag;
+ }
+
+ /**
+ * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
+ * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(1);
+ * // => false
+ */
+ function isObject(value) {
+ // Avoid a V8 JIT bug in Chrome 19-20.
+ // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
+ var type = typeof value;
+ return !!value && (type == 'object' || type == 'function');
+ }
+
+ /**
+ * Performs a deep comparison between `object` and `source` to determine if
+ * `object` contains equivalent property values. If `customizer` is provided
+ * it is invoked to compare values. If `customizer` returns `undefined`
+ * comparisons are handled by the method instead. The `customizer` is bound
+ * to `thisArg` and invoked with three arguments: (value, other, index|key).
+ *
+ * **Note:** This method supports comparing properties of arrays, booleans,
+ * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
+ * and DOM nodes are **not** supported. Provide a customizer function to extend
+ * support for comparing other values.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property values to match.
+ * @param {Function} [customizer] The function to customize value comparisons.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+ * @example
+ *
+ * var object = { 'user': 'fred', 'age': 40 };
+ *
+ * _.isMatch(object, { 'age': 40 });
+ * // => true
+ *
+ * _.isMatch(object, { 'age': 36 });
+ * // => false
+ *
+ * // using a customizer callback
+ * var object = { 'greeting': 'hello' };
+ * var source = { 'greeting': 'hi' };
+ *
+ * _.isMatch(object, source, function(value, other) {
+ * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
+ * });
+ * // => true
+ */
+ function isMatch(object, source, customizer, thisArg) {
+ customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
+ return baseIsMatch(object, getMatchData(source), customizer);
+ }
+
+ /**
+ * Checks if `value` is `NaN`.
+ *
+ * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
+ * which returns `true` for `undefined` and other non-numeric values.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ * @example
+ *
+ * _.isNaN(NaN);
+ * // => true
+ *
+ * _.isNaN(new Number(NaN));
+ * // => true
+ *
+ * isNaN(undefined);
+ * // => true
+ *
+ * _.isNaN(undefined);
+ * // => false
+ */
+ function isNaN(value) {
+ // An `NaN` primitive is the only value that is not equal to itself.
+ // Perform the `toStringTag` check first to avoid errors with some host objects in IE.
+ return isNumber(value) && value != +value;
+ }
+
+ /**
+ * Checks if `value` is a native function.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
+ * @example
+ *
+ * _.isNative(Array.prototype.push);
+ * // => true
+ *
+ * _.isNative(_);
+ * // => false
+ */
+ function isNative(value) {
+ if (value == null) {
+ return false;
+ }
+ if (isFunction(value)) {
+ return reIsNative.test(fnToString.call(value));
+ }
+ return isObjectLike(value) && reIsHostCtor.test(value);
+ }
+
+ /**
+ * Checks if `value` is `null`.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
+ * @example
+ *
+ * _.isNull(null);
+ * // => true
+ *
+ * _.isNull(void 0);
+ * // => false
+ */
+ function isNull(value) {
+ return value === null;
+ }
+
+ /**
+ * Checks if `value` is classified as a `Number` primitive or object.
+ *
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
+ * as numbers, use the `_.isFinite` method.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isNumber(8.4);
+ * // => true
+ *
+ * _.isNumber(NaN);
+ * // => true
+ *
+ * _.isNumber('8.4');
+ * // => false
+ */
+ function isNumber(value) {
+ return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
+ }
+
+ /**
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
+ *
+ * **Note:** This method assumes objects created by the `Object` constructor
+ * have no inherited enumerable properties.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * _.isPlainObject(new Foo);
+ * // => false
+ *
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
+ *
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
+ */
+ function isPlainObject(value) {
+ var Ctor;
+
+ // Exit early for non `Object` objects.
+ if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
+ (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
+ return false;
+ }
+ // IE < 9 iterates inherited properties before own properties. If the first
+ // iterated property is an object's own property then there are no inherited
+ // enumerable properties.
+ var result;
+ // In most environments an object's own properties are iterated before
+ // its inherited properties. If the last iterated property is an object's
+ // own property then there are no inherited enumerable properties.
+ baseForIn(value, function(subValue, key) {
+ result = key;
+ });
+ return result === undefined || hasOwnProperty.call(value, result);
+ }
+
+ /**
+ * Checks if `value` is classified as a `RegExp` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isRegExp(/abc/);
+ * // => true
+ *
+ * _.isRegExp('/abc/');
+ * // => false
+ */
+ function isRegExp(value) {
+ return isObject(value) && objToString.call(value) == regexpTag;
+ }
+
+ /**
+ * Checks if `value` is classified as a `String` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isString('abc');
+ * // => true
+ *
+ * _.isString(1);
+ * // => false
+ */
+ function isString(value) {
+ return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
+ }
+
+ /**
+ * Checks if `value` is classified as a typed array.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isTypedArray(new Uint8Array);
+ * // => true
+ *
+ * _.isTypedArray([]);
+ * // => false
+ */
+ function isTypedArray(value) {
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
+ }
+
+ /**
+ * Checks if `value` is `undefined`.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
+ * @example
+ *
+ * _.isUndefined(void 0);
+ * // => true
+ *
+ * _.isUndefined(null);
+ * // => false
+ */
+ function isUndefined(value) {
+ return value === undefined;
+ }
+
+ /**
+ * Checks if `value` is less than `other`.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
+ * @example
+ *
+ * _.lt(1, 3);
+ * // => true
+ *
+ * _.lt(3, 3);
+ * // => false
+ *
+ * _.lt(3, 1);
+ * // => false
+ */
+ function lt(value, other) {
+ return value < other;
+ }
+
+ /**
+ * Checks if `value` is less than or equal to `other`.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
+ * @example
+ *
+ * _.lte(1, 3);
+ * // => true
+ *
+ * _.lte(3, 3);
+ * // => true
+ *
+ * _.lte(3, 1);
+ * // => false
+ */
+ function lte(value, other) {
+ return value <= other;
+ }
+
+ /**
+ * Converts `value` to an array.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {Array} Returns the converted array.
+ * @example
+ *
+ * (function() {
+ * return _.toArray(arguments).slice(1);
+ * }(1, 2, 3));
+ * // => [2, 3]
+ */
+ function toArray(value) {
+ var length = value ? getLength(value) : 0;
+ if (!isLength(length)) {
+ return values(value);
+ }
+ if (!length) {
+ return [];
+ }
+ return arrayCopy(value);
+ }
+
+ /**
+ * Converts `value` to a plain object flattening inherited enumerable
+ * properties of `value` to own properties of the plain object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {Object} Returns the converted plain object.
+ * @example
+ *
+ * function Foo() {
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.assign({ 'a': 1 }, new Foo);
+ * // => { 'a': 1, 'b': 2 }
+ *
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
+ */
+ function toPlainObject(value) {
+ return baseCopy(value, keysIn(value));
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Recursively merges own enumerable properties of the source object(s), that
+ * don't resolve to `undefined` into the destination object. Subsequent sources
+ * overwrite property assignments of previous sources. If `customizer` is
+ * provided it is invoked to produce the merged values of the destination and
+ * source properties. If `customizer` returns `undefined` merging is handled
+ * by the method instead. The `customizer` is bound to `thisArg` and invoked
+ * with five arguments: (objectValue, sourceValue, key, object, source).
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var users = {
+ * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
+ * };
+ *
+ * var ages = {
+ * 'data': [{ 'age': 36 }, { 'age': 40 }]
+ * };
+ *
+ * _.merge(users, ages);
+ * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+ *
+ * // using a customizer callback
+ * var object = {
+ * 'fruits': ['apple'],
+ * 'vegetables': ['beet']
+ * };
+ *
+ * var other = {
+ * 'fruits': ['banana'],
+ * 'vegetables': ['carrot']
+ * };
+ *
+ * _.merge(object, other, function(a, b) {
+ * if (_.isArray(a)) {
+ * return a.concat(b);
+ * }
+ * });
+ * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
+ */
+ var merge = createAssigner(baseMerge);
+
+ /**
+ * Assigns own enumerable properties of source object(s) to the destination
+ * object. Subsequent sources overwrite property assignments of previous sources.
+ * If `customizer` is provided it is invoked to produce the assigned values.
+ * The `customizer` is bound to `thisArg` and invoked with five arguments:
+ * (objectValue, sourceValue, key, object, source).
+ *
+ * **Note:** This method mutates `object` and is based on
+ * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
+ *
+ * @static
+ * @memberOf _
+ * @alias extend
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
+ * // => { 'user': 'fred', 'age': 40 }
+ *
+ * // using a customizer callback
+ * var defaults = _.partialRight(_.assign, function(value, other) {
+ * return _.isUndefined(value) ? other : value;
+ * });
+ *
+ * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
+ * // => { 'user': 'barney', 'age': 36 }
+ */
+ var assign = createAssigner(function(object, source, customizer) {
+ return customizer
+ ? assignWith(object, source, customizer)
+ : baseAssign(object, source);
+ });
+
+ /**
+ * Creates an object that inherits from the given `prototype` object. If a
+ * `properties` object is provided its own enumerable properties are assigned
+ * to the created object.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} prototype The object to inherit from.
+ * @param {Object} [properties] The properties to assign to the object.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * function Shape() {
+ * this.x = 0;
+ * this.y = 0;
+ * }
+ *
+ * function Circle() {
+ * Shape.call(this);
+ * }
+ *
+ * Circle.prototype = _.create(Shape.prototype, {
+ * 'constructor': Circle
+ * });
+ *
+ * var circle = new Circle;
+ * circle instanceof Circle;
+ * // => true
+ *
+ * circle instanceof Shape;
+ * // => true
+ */
+ function create(prototype, properties, guard) {
+ var result = baseCreate(prototype);
+ if (guard && isIterateeCall(prototype, properties, guard)) {
+ properties = undefined;
+ }
+ return properties ? baseAssign(result, properties) : result;
+ }
+
+ /**
+ * Assigns own enumerable properties of source object(s) to the destination
+ * object for all destination properties that resolve to `undefined`. Once a
+ * property is set, additional values of the same property are ignored.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
+ * // => { 'user': 'barney', 'age': 36 }
+ */
+ var defaults = createDefaults(assign, assignDefaults);
+
+ /**
+ * This method is like `_.defaults` except that it recursively assigns
+ * default properties.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
+ * // => { 'user': { 'name': 'barney', 'age': 36 } }
+ *
+ */
+ var defaultsDeep = createDefaults(merge, mergeDefaults);
+
+ /**
+ * This method is like `_.find` except that it returns the key of the first
+ * element `predicate` returns truthy for instead of the element itself.
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to search.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+ * @example
+ *
+ * var users = {
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
+ * };
+ *
+ * _.findKey(users, function(chr) {
+ * return chr.age < 40;
+ * });
+ * // => 'barney' (iteration order is not guaranteed)
+ *
+ * // using the `_.matches` callback shorthand
+ * _.findKey(users, { 'age': 1, 'active': true });
+ * // => 'pebbles'
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.findKey(users, 'active', false);
+ * // => 'fred'
+ *
+ * // using the `_.property` callback shorthand
+ * _.findKey(users, 'active');
+ * // => 'barney'
+ */
+ var findKey = createFindKey(baseForOwn);
+
+ /**
+ * This method is like `_.findKey` except that it iterates over elements of
+ * a collection in the opposite order.
+ *
+ * If a property name is provided for `predicate` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `predicate` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to search.
+ * @param {Function|Object|string} [predicate=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+ * @example
+ *
+ * var users = {
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
+ * };
+ *
+ * _.findLastKey(users, function(chr) {
+ * return chr.age < 40;
+ * });
+ * // => returns `pebbles` assuming `_.findKey` returns `barney`
+ *
+ * // using the `_.matches` callback shorthand
+ * _.findLastKey(users, { 'age': 36, 'active': true });
+ * // => 'barney'
+ *
+ * // using the `_.matchesProperty` callback shorthand
+ * _.findLastKey(users, 'active', false);
+ * // => 'fred'
+ *
+ * // using the `_.property` callback shorthand
+ * _.findLastKey(users, 'active');
+ * // => 'pebbles'
+ */
+ var findLastKey = createFindKey(baseForOwnRight);
+
+ /**
+ * Iterates over own and inherited enumerable properties of an object invoking
+ * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
+ * with three arguments: (value, key, object). Iteratee functions may exit
+ * iteration early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forIn(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
+ */
+ var forIn = createForIn(baseFor);
+
+ /**
+ * This method is like `_.forIn` except that it iterates over properties of
+ * `object` in the opposite order.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forInRight(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
+ */
+ var forInRight = createForIn(baseForRight);
+
+ /**
+ * Iterates over own enumerable properties of an object invoking `iteratee`
+ * for each property. The `iteratee` is bound to `thisArg` and invoked with
+ * three arguments: (value, key, object). Iteratee functions may exit iteration
+ * early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forOwn(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => logs 'a' and 'b' (iteration order is not guaranteed)
+ */
+ var forOwn = createForOwn(baseForOwn);
+
+ /**
+ * This method is like `_.forOwn` except that it iterates over properties of
+ * `object` in the opposite order.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forOwnRight(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
+ */
+ var forOwnRight = createForOwn(baseForOwnRight);
+
+ /**
+ * Creates an array of function property names from all enumerable properties,
+ * own and inherited, of `object`.
+ *
+ * @static
+ * @memberOf _
+ * @alias methods
+ * @category Object
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns the new array of property names.
+ * @example
+ *
+ * _.functions(_);
+ * // => ['after', 'ary', 'assign', ...]
+ */
+ function functions(object) {
+ return baseFunctions(object, keysIn(object));
+ }
+
+ /**
+ * Gets the property value at `path` of `object`. If the resolved value is
+ * `undefined` the `defaultValue` is used in its place.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to get.
+ * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+ * @returns {*} Returns the resolved value.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+ *
+ * _.get(object, 'a[0].b.c');
+ * // => 3
+ *
+ * _.get(object, ['a', '0', 'b', 'c']);
+ * // => 3
+ *
+ * _.get(object, 'a.b.c', 'default');
+ * // => 'default'
+ */
+ function get(object, path, defaultValue) {
+ var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
+ return result === undefined ? defaultValue : result;
+ }
+
+ /**
+ * Checks if `path` is a direct property.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path to check.
+ * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
+ * @example
+ *
+ * var object = { 'a': { 'b': { 'c': 3 } } };
+ *
+ * _.has(object, 'a');
+ * // => true
+ *
+ * _.has(object, 'a.b.c');
+ * // => true
+ *
+ * _.has(object, ['a', 'b', 'c']);
+ * // => true
+ */
+ function has(object, path) {
+ if (object == null) {
+ return false;
+ }
+ var result = hasOwnProperty.call(object, path);
+ if (!result && !isKey(path)) {
+ path = toPath(path);
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+ if (object == null) {
+ return false;
+ }
+ path = last(path);
+ result = hasOwnProperty.call(object, path);
+ }
+ return result || (isLength(object.length) && isIndex(path, object.length) &&
+ (isArray(object) || isArguments(object)));
+ }
+
+ /**
+ * Creates an object composed of the inverted keys and values of `object`.
+ * If `object` contains duplicate values, subsequent values overwrite property
+ * assignments of previous values unless `multiValue` is `true`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to invert.
+ * @param {boolean} [multiValue] Allow multiple values per key.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {Object} Returns the new inverted object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2, 'c': 1 };
+ *
+ * _.invert(object);
+ * // => { '1': 'c', '2': 'b' }
+ *
+ * // with `multiValue`
+ * _.invert(object, true);
+ * // => { '1': ['a', 'c'], '2': ['b'] }
+ */
+ function invert(object, multiValue, guard) {
+ if (guard && isIterateeCall(object, multiValue, guard)) {
+ multiValue = undefined;
+ }
+ var index = -1,
+ props = keys(object),
+ length = props.length,
+ result = {};
+
+ while (++index < length) {
+ var key = props[index],
+ value = object[key];
+
+ if (multiValue) {
+ if (hasOwnProperty.call(result, value)) {
+ result[value].push(key);
+ } else {
+ result[value] = [key];
+ }
+ }
+ else {
+ result[value] = key;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+ var keys = !nativeKeys ? shimKeys : function(object) {
+ var Ctor = object == null ? undefined : object.constructor;
+ if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
+ (typeof object != 'function' && isArrayLike(object))) {
+ return shimKeys(object);
+ }
+ return isObject(object) ? nativeKeys(object) : [];
+ };
+
+ /**
+ * Creates an array of the own and inherited enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keysIn(new Foo);
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
+ */
+ function keysIn(object) {
+ if (object == null) {
+ return [];
+ }
+ if (!isObject(object)) {
+ object = Object(object);
+ }
+ var length = object.length;
+ length = (length && isLength(length) &&
+ (isArray(object) || isArguments(object)) && length) || 0;
+
+ var Ctor = object.constructor,
+ index = -1,
+ isProto = typeof Ctor == 'function' && Ctor.prototype === object,
+ result = Array(length),
+ skipIndexes = length > 0;
+
+ while (++index < length) {
+ result[index] = (index + '');
+ }
+ for (var key in object) {
+ if (!(skipIndexes && isIndex(key, length)) &&
+ !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The opposite of `_.mapValues`; this method creates an object with the
+ * same values as `object` and keys generated by running each own enumerable
+ * property of `object` through `iteratee`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns the new mapped object.
+ * @example
+ *
+ * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
+ * return key + value;
+ * });
+ * // => { 'a1': 1, 'b2': 2 }
+ */
+ var mapKeys = createObjectMapper(true);
+
+ /**
+ * Creates an object with the same keys as `object` and values generated by
+ * running each own enumerable property of `object` through `iteratee`. The
+ * iteratee function is bound to `thisArg` and invoked with three arguments:
+ * (value, key, object).
+ *
+ * If a property name is provided for `iteratee` the created `_.property`
+ * style callback returns the property value of the given element.
+ *
+ * If a value is also provided for `thisArg` the created `_.matchesProperty`
+ * style callback returns `true` for elements that have a matching property
+ * value, else `false`.
+ *
+ * If an object is provided for `iteratee` the created `_.matches` style
+ * callback returns `true` for elements that have the properties of the given
+ * object, else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function|Object|string} [iteratee=_.identity] The function invoked
+ * per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {Object} Returns the new mapped object.
+ * @example
+ *
+ * _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
+ * return n * 3;
+ * });
+ * // => { 'a': 3, 'b': 6 }
+ *
+ * var users = {
+ * 'fred': { 'user': 'fred', 'age': 40 },
+ * 'pebbles': { 'user': 'pebbles', 'age': 1 }
+ * };
+ *
+ * // using the `_.property` callback shorthand
+ * _.mapValues(users, 'age');
+ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+ */
+ var mapValues = createObjectMapper();
+
+ /**
+ * The opposite of `_.pick`; this method creates an object composed of the
+ * own and inherited enumerable properties of `object` that are not omitted.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The source object.
+ * @param {Function|...(string|string[])} [predicate] The function invoked per
+ * iteration or property names to omit, specified as individual property
+ * names or arrays of property names.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * var object = { 'user': 'fred', 'age': 40 };
+ *
+ * _.omit(object, 'age');
+ * // => { 'user': 'fred' }
+ *
+ * _.omit(object, _.isNumber);
+ * // => { 'user': 'fred' }
+ */
+ var omit = restParam(function(object, props) {
+ if (object == null) {
+ return {};
+ }
+ if (typeof props[0] != 'function') {
+ var props = arrayMap(baseFlatten(props), String);
+ return pickByArray(object, baseDifference(keysIn(object), props));
+ }
+ var predicate = bindCallback(props[0], props[1], 3);
+ return pickByCallback(object, function(value, key, object) {
+ return !predicate(value, key, object);
+ });
+ });
+
+ /**
+ * Creates a two dimensional array of the key-value pairs for `object`,
+ * e.g. `[[key1, value1], [key2, value2]]`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the new array of key-value pairs.
+ * @example
+ *
+ * _.pairs({ 'barney': 36, 'fred': 40 });
+ * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
+ */
+ function pairs(object) {
+ object = toObject(object);
+
+ var index = -1,
+ props = keys(object),
+ length = props.length,
+ result = Array(length);
+
+ while (++index < length) {
+ var key = props[index];
+ result[index] = [key, object[key]];
+ }
+ return result;
+ }
+
+ /**
+ * Creates an object composed of the picked `object` properties. Property
+ * names may be specified as individual arguments or as arrays of property
+ * names. If `predicate` is provided it is invoked for each property of `object`
+ * picking the properties `predicate` returns truthy for. The predicate is
+ * bound to `thisArg` and invoked with three arguments: (value, key, object).
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The source object.
+ * @param {Function|...(string|string[])} [predicate] The function invoked per
+ * iteration or property names to pick, specified as individual property
+ * names or arrays of property names.
+ * @param {*} [thisArg] The `this` binding of `predicate`.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * var object = { 'user': 'fred', 'age': 40 };
+ *
+ * _.pick(object, 'user');
+ * // => { 'user': 'fred' }
+ *
+ * _.pick(object, _.isString);
+ * // => { 'user': 'fred' }
+ */
+ var pick = restParam(function(object, props) {
+ if (object == null) {
+ return {};
+ }
+ return typeof props[0] == 'function'
+ ? pickByCallback(object, bindCallback(props[0], props[1], 3))
+ : pickByArray(object, baseFlatten(props));
+ });
+
+ /**
+ * This method is like `_.get` except that if the resolved value is a function
+ * it is invoked with the `this` binding of its parent object and its result
+ * is returned.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to resolve.
+ * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+ * @returns {*} Returns the resolved value.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
+ *
+ * _.result(object, 'a[0].b.c1');
+ * // => 3
+ *
+ * _.result(object, 'a[0].b.c2');
+ * // => 4
+ *
+ * _.result(object, 'a.b.c', 'default');
+ * // => 'default'
+ *
+ * _.result(object, 'a.b.c', _.constant('default'));
+ * // => 'default'
+ */
+ function result(object, path, defaultValue) {
+ var result = object == null ? undefined : object[path];
+ if (result === undefined) {
+ if (object != null && !isKey(path, object)) {
+ path = toPath(path);
+ object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
+ result = object == null ? undefined : object[last(path)];
+ }
+ result = result === undefined ? defaultValue : result;
+ }
+ return isFunction(result) ? result.call(object) : result;
+ }
+
+ /**
+ * Sets the property value of `path` on `object`. If a portion of `path`
+ * does not exist it is created.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to augment.
+ * @param {Array|string} path The path of the property to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+ *
+ * _.set(object, 'a[0].b.c', 4);
+ * console.log(object.a[0].b.c);
+ * // => 4
+ *
+ * _.set(object, 'x[0].y.z', 5);
+ * console.log(object.x[0].y.z);
+ * // => 5
+ */
+ function set(object, path, value) {
+ if (object == null) {
+ return object;
+ }
+ var pathKey = (path + '');
+ path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
+
+ var index = -1,
+ length = path.length,
+ lastIndex = length - 1,
+ nested = object;
+
+ while (nested != null && ++index < length) {
+ var key = path[index];
+ if (isObject(nested)) {
+ if (index == lastIndex) {
+ nested[key] = value;
+ } else if (nested[key] == null) {
+ nested[key] = isIndex(path[index + 1]) ? [] : {};
+ }
+ }
+ nested = nested[key];
+ }
+ return object;
+ }
+
+ /**
+ * An alternative to `_.reduce`; this method transforms `object` to a new
+ * `accumulator` object which is the result of running each of its own enumerable
+ * properties through `iteratee`, with each invocation potentially mutating
+ * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
+ * with four arguments: (accumulator, value, key, object). Iteratee functions
+ * may exit iteration early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Array|Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The custom accumulator value.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
+ * @returns {*} Returns the accumulated value.
+ * @example
+ *
+ * _.transform([2, 3, 4], function(result, n) {
+ * result.push(n *= n);
+ * return n % 2 == 0;
+ * });
+ * // => [4, 9]
+ *
+ * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
+ * result[key] = n * 3;
+ * });
+ * // => { 'a': 3, 'b': 6 }
+ */
+ function transform(object, iteratee, accumulator, thisArg) {
+ var isArr = isArray(object) || isTypedArray(object);
+ iteratee = getCallback(iteratee, thisArg, 4);
+
+ if (accumulator == null) {
+ if (isArr || isObject(object)) {
+ var Ctor = object.constructor;
+ if (isArr) {
+ accumulator = isArray(object) ? new Ctor : [];
+ } else {
+ accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
+ }
+ } else {
+ accumulator = {};
+ }
+ }
+ (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
+ return iteratee(accumulator, value, index, object);
+ });
+ return accumulator;
+ }
+
+ /**
+ * Creates an array of the own enumerable property values of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property values.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.values(new Foo);
+ * // => [1, 2] (iteration order is not guaranteed)
+ *
+ * _.values('hi');
+ * // => ['h', 'i']
+ */
+ function values(object) {
+ return baseValues(object, keys(object));
+ }
+
+ /**
+ * Creates an array of the own and inherited enumerable property values
+ * of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property values.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.valuesIn(new Foo);
+ * // => [1, 2, 3] (iteration order is not guaranteed)
+ */
+ function valuesIn(object) {
+ return baseValues(object, keysIn(object));
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Checks if `n` is between `start` and up to but not including, `end`. If
+ * `end` is not specified it is set to `start` with `start` then set to `0`.
+ *
+ * @static
+ * @memberOf _
+ * @category Number
+ * @param {number} n The number to check.
+ * @param {number} [start=0] The start of the range.
+ * @param {number} end The end of the range.
+ * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
+ * @example
+ *
+ * _.inRange(3, 2, 4);
+ * // => true
+ *
+ * _.inRange(4, 8);
+ * // => true
+ *
+ * _.inRange(4, 2);
+ * // => false
+ *
+ * _.inRange(2, 2);
+ * // => false
+ *
+ * _.inRange(1.2, 2);
+ * // => true
+ *
+ * _.inRange(5.2, 4);
+ * // => false
+ */
+ function inRange(value, start, end) {
+ start = +start || 0;
+ if (end === undefined) {
+ end = start;
+ start = 0;
+ } else {
+ end = +end || 0;
+ }
+ return value >= nativeMin(start, end) && value < nativeMax(start, end);
+ }
+
+ /**
+ * Produces a random number between `min` and `max` (inclusive). If only one
+ * argument is provided a number between `0` and the given number is returned.
+ * If `floating` is `true`, or either `min` or `max` are floats, a floating-point
+ * number is returned instead of an integer.
+ *
+ * @static
+ * @memberOf _
+ * @category Number
+ * @param {number} [min=0] The minimum possible value.
+ * @param {number} [max=1] The maximum possible value.
+ * @param {boolean} [floating] Specify returning a floating-point number.
+ * @returns {number} Returns the random number.
+ * @example
+ *
+ * _.random(0, 5);
+ * // => an integer between 0 and 5
+ *
+ * _.random(5);
+ * // => also an integer between 0 and 5
+ *
+ * _.random(5, true);
+ * // => a floating-point number between 0 and 5
+ *
+ * _.random(1.2, 5.2);
+ * // => a floating-point number between 1.2 and 5.2
+ */
+ function random(min, max, floating) {
+ if (floating && isIterateeCall(min, max, floating)) {
+ max = floating = undefined;
+ }
+ var noMin = min == null,
+ noMax = max == null;
+
+ if (floating == null) {
+ if (noMax && typeof min == 'boolean') {
+ floating = min;
+ min = 1;
+ }
+ else if (typeof max == 'boolean') {
+ floating = max;
+ noMax = true;
+ }
+ }
+ if (noMin && noMax) {
+ max = 1;
+ noMax = false;
+ }
+ min = +min || 0;
+ if (noMax) {
+ max = min;
+ min = 0;
+ } else {
+ max = +max || 0;
+ }
+ if (floating || min % 1 || max % 1) {
+ var rand = nativeRandom();
+ return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);
+ }
+ return baseRandom(min, max);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the camel cased string.
+ * @example
+ *
+ * _.camelCase('Foo Bar');
+ * // => 'fooBar'
+ *
+ * _.camelCase('--foo-bar');
+ * // => 'fooBar'
+ *
+ * _.camelCase('__foo_bar__');
+ * // => 'fooBar'
+ */
+ var camelCase = createCompounder(function(result, word, index) {
+ word = word.toLowerCase();
+ return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
+ });
+
+ /**
+ * Capitalizes the first character of `string`.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to capitalize.
+ * @returns {string} Returns the capitalized string.
+ * @example
+ *
+ * _.capitalize('fred');
+ * // => 'Fred'
+ */
+ function capitalize(string) {
+ string = baseToString(string);
+ return string && (string.charAt(0).toUpperCase() + string.slice(1));
+ }
+
+ /**
+ * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+ * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to deburr.
+ * @returns {string} Returns the deburred string.
+ * @example
+ *
+ * _.deburr('déjà vu');
+ * // => 'deja vu'
+ */
+ function deburr(string) {
+ string = baseToString(string);
+ return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
+ }
+
+ /**
+ * Checks if `string` ends with the given target string.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to search.
+ * @param {string} [target] The string to search for.
+ * @param {number} [position=string.length] The position to search from.
+ * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.
+ * @example
+ *
+ * _.endsWith('abc', 'c');
+ * // => true
+ *
+ * _.endsWith('abc', 'b');
+ * // => false
+ *
+ * _.endsWith('abc', 'b', 2);
+ * // => true
+ */
+ function endsWith(string, target, position) {
+ string = baseToString(string);
+ target = (target + '');
+
+ var length = string.length;
+ position = position === undefined
+ ? length
+ : nativeMin(position < 0 ? 0 : (+position || 0), length);
+
+ position -= target.length;
+ return position >= 0 && string.indexOf(target, position) == position;
+ }
+
+ /**
+ * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to
+ * their corresponding HTML entities.
+ *
+ * **Note:** No other characters are escaped. To escape additional characters
+ * use a third-party library like [_he_](https://mths.be/he).
+ *
+ * Though the ">" character is escaped for symmetry, characters like
+ * ">" and "/" don't need escaping in HTML and have no special meaning
+ * unless they're part of a tag or unquoted attribute value.
+ * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+ * (under "semi-related fun fact") for more details.
+ *
+ * Backticks are escaped because in Internet Explorer < 9, they can break out
+ * of attribute values or HTML comments. See [#59](https://html5sec.org/#59),
+ * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
+ * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
+ * for more details.
+ *
+ * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
+ * to reduce XSS vectors.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to escape.
+ * @returns {string} Returns the escaped string.
+ * @example
+ *
+ * _.escape('fred, barney, & pebbles');
+ * // => 'fred, barney, & pebbles'
+ */
+ function escape(string) {
+ // Reset `lastIndex` because in IE < 9 `String#replace` does not.
+ string = baseToString(string);
+ return (string && reHasUnescapedHtml.test(string))
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
+ : string;
+ }
+
+ /**
+ * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
+ * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to escape.
+ * @returns {string} Returns the escaped string.
+ * @example
+ *
+ * _.escapeRegExp('[lodash](https://lodash.com/)');
+ * // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
+ */
+ function escapeRegExp(string) {
+ string = baseToString(string);
+ return (string && reHasRegExpChars.test(string))
+ ? string.replace(reRegExpChars, escapeRegExpChar)
+ : (string || '(?:)');
+ }
+
+ /**
+ * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the kebab cased string.
+ * @example
+ *
+ * _.kebabCase('Foo Bar');
+ * // => 'foo-bar'
+ *
+ * _.kebabCase('fooBar');
+ * // => 'foo-bar'
+ *
+ * _.kebabCase('__foo_bar__');
+ * // => 'foo-bar'
+ */
+ var kebabCase = createCompounder(function(result, word, index) {
+ return result + (index ? '-' : '') + word.toLowerCase();
+ });
+
+ /**
+ * Pads `string` on the left and right sides if it's shorter than `length`.
+ * Padding characters are truncated if they can't be evenly divided by `length`.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to pad.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padded string.
+ * @example
+ *
+ * _.pad('abc', 8);
+ * // => ' abc '
+ *
+ * _.pad('abc', 8, '_-');
+ * // => '_-abc_-_'
+ *
+ * _.pad('abc', 3);
+ * // => 'abc'
+ */
+ function pad(string, length, chars) {
+ string = baseToString(string);
+ length = +length;
+
+ var strLength = string.length;
+ if (strLength >= length || !nativeIsFinite(length)) {
+ return string;
+ }
+ var mid = (length - strLength) / 2,
+ leftLength = nativeFloor(mid),
+ rightLength = nativeCeil(mid);
+
+ chars = createPadding('', rightLength, chars);
+ return chars.slice(0, leftLength) + string + chars;
+ }
+
+ /**
+ * Pads `string` on the left side if it's shorter than `length`. Padding
+ * characters are truncated if they exceed `length`.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to pad.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padded string.
+ * @example
+ *
+ * _.padLeft('abc', 6);
+ * // => ' abc'
+ *
+ * _.padLeft('abc', 6, '_-');
+ * // => '_-_abc'
+ *
+ * _.padLeft('abc', 3);
+ * // => 'abc'
+ */
+ var padLeft = createPadDir();
+
+ /**
+ * Pads `string` on the right side if it's shorter than `length`. Padding
+ * characters are truncated if they exceed `length`.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to pad.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padded string.
+ * @example
+ *
+ * _.padRight('abc', 6);
+ * // => 'abc '
+ *
+ * _.padRight('abc', 6, '_-');
+ * // => 'abc_-_'
+ *
+ * _.padRight('abc', 3);
+ * // => 'abc'
+ */
+ var padRight = createPadDir(true);
+
+ /**
+ * Converts `string` to an integer of the specified radix. If `radix` is
+ * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
+ * in which case a `radix` of `16` is used.
+ *
+ * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)
+ * of `parseInt`.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} string The string to convert.
+ * @param {number} [radix] The radix to interpret `value` by.
+ * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.parseInt('08');
+ * // => 8
+ *
+ * _.map(['6', '08', '10'], _.parseInt);
+ * // => [6, 8, 10]
+ */
+ function parseInt(string, radix, guard) {
+ // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
+ // Chrome fails to trim leading whitespace characters.
+ // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
+ if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
+ radix = 0;
+ } else if (radix) {
+ radix = +radix;
+ }
+ string = trim(string);
+ return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
+ }
+
+ /**
+ * Repeats the given string `n` times.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to repeat.
+ * @param {number} [n=0] The number of times to repeat the string.
+ * @returns {string} Returns the repeated string.
+ * @example
+ *
+ * _.repeat('*', 3);
+ * // => '***'
+ *
+ * _.repeat('abc', 2);
+ * // => 'abcabc'
+ *
+ * _.repeat('abc', 0);
+ * // => ''
+ */
+ function repeat(string, n) {
+ var result = '';
+ string = baseToString(string);
+ n = +n;
+ if (n < 1 || !string || !nativeIsFinite(n)) {
+ return result;
+ }
+ // Leverage the exponentiation by squaring algorithm for a faster repeat.
+ // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
+ do {
+ if (n % 2) {
+ result += string;
+ }
+ n = nativeFloor(n / 2);
+ string += string;
+ } while (n);
+
+ return result;
+ }
+
+ /**
+ * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the snake cased string.
+ * @example
+ *
+ * _.snakeCase('Foo Bar');
+ * // => 'foo_bar'
+ *
+ * _.snakeCase('fooBar');
+ * // => 'foo_bar'
+ *
+ * _.snakeCase('--foo-bar');
+ * // => 'foo_bar'
+ */
+ var snakeCase = createCompounder(function(result, word, index) {
+ return result + (index ? '_' : '') + word.toLowerCase();
+ });
+
+ /**
+ * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the start cased string.
+ * @example
+ *
+ * _.startCase('--foo-bar');
+ * // => 'Foo Bar'
+ *
+ * _.startCase('fooBar');
+ * // => 'Foo Bar'
+ *
+ * _.startCase('__foo_bar__');
+ * // => 'Foo Bar'
+ */
+ var startCase = createCompounder(function(result, word, index) {
+ return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
+ });
+
+ /**
+ * Checks if `string` starts with the given target string.
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to search.
+ * @param {string} [target] The string to search for.
+ * @param {number} [position=0] The position to search from.
+ * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.
+ * @example
+ *
+ * _.startsWith('abc', 'a');
+ * // => true
+ *
+ * _.startsWith('abc', 'b');
+ * // => false
+ *
+ * _.startsWith('abc', 'b', 1);
+ * // => true
+ */
+ function startsWith(string, target, position) {
+ string = baseToString(string);
+ position = position == null
+ ? 0
+ : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
+
+ return string.lastIndexOf(target, position) == position;
+ }
+
+ /**
+ * Creates a compiled template function that can interpolate data properties
+ * in "interpolate" delimiters, HTML-escape interpolated data properties in
+ * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
+ * properties may be accessed as free variables in the template. If a setting
+ * object is provided it takes precedence over `_.templateSettings` values.
+ *
+ * **Note:** In the development build `_.template` utilizes
+ * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
+ * for easier debugging.
+ *
+ * For more information on precompiling templates see
+ * [lodash's custom builds documentation](https://lodash.com/custom-builds).
+ *
+ * For more information on Chrome extension sandboxes see
+ * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
+ *
+ * @static
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The template string.
+ * @param {Object} [options] The options object.
+ * @param {RegExp} [options.escape] The HTML "escape" delimiter.
+ * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
+ * @param {Object} [options.imports] An object to import into the template as free variables.
+ * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
+ * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
+ * @param {string} [options.variable] The data object variable name.
+ * @param- {Object} [otherOptions] Enables the legacy `options` param signature.
+ * @returns {Function} Returns the compiled template function.
+ * @example
+ *
+ * // using the "interpolate" delimiter to create a compiled template
+ * var compiled = _.template('hello <%= user %>!');
+ * compiled({ 'user': 'fred' });
+ * // => 'hello fred!'
+ *
+ * // using the HTML "escape" delimiter to escape data property values
+ * var compiled = _.template('<%- value %>');
+ * compiled({ 'value': '