diff options
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/statusbar.py | 3 | ||||
-rw-r--r-- | libmproxy/models/connections.py | 8 | ||||
-rw-r--r-- | libmproxy/web/app.py | 2 | ||||
-rw-r--r-- | libmproxy/web/static/app.css | 6 | ||||
-rw-r--r-- | libmproxy/web/static/app.js | 3276 | ||||
-rw-r--r-- | libmproxy/web/static/vendor.css | 674 | ||||
-rw-r--r-- | libmproxy/web/static/vendor.js | 6033 |
7 files changed, 5701 insertions, 4301 deletions
diff --git a/libmproxy/console/statusbar.py b/libmproxy/console/statusbar.py index ea2dbfa8..fd084f8c 100644 --- a/libmproxy/console/statusbar.py +++ b/libmproxy/console/statusbar.py @@ -4,7 +4,6 @@ import urwid import netlib.utils from . import pathedit, signals, common -from .. import utils class ActionBar(urwid.WidgetWrap): @@ -25,6 +24,7 @@ class ActionBar(urwid.WidgetWrap): def sig_message(self, sender, message, expire=None): w = urwid.Text(message) self._w = w + self.prompting = False if expire: def cb(*args): if w == self._w: @@ -88,6 +88,7 @@ class ActionBar(urwid.WidgetWrap): def clear(self): self._w = urwid.Text("") + self.prompting = False def prompt_done(self): self.prompting = False diff --git a/libmproxy/models/connections.py b/libmproxy/models/connections.py index f1e10de9..ec089471 100644 --- a/libmproxy/models/connections.py +++ b/libmproxy/models/connections.py @@ -51,9 +51,9 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject): def get_state(self, short=False): d = super(ClientConnection, self).get_state(short) d.update( - address={ + address=({ "address": self.address(), - "use_ipv6": self.address.use_ipv6}, + "use_ipv6": self.address.use_ipv6} if self.address else {}), clientcert=self.cert.to_pem() if self.clientcert else None) return d @@ -135,8 +135,8 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject): def get_state(self, short=False): d = super(ServerConnection, self).get_state(short) d.update( - address={"address": self.address(), - "use_ipv6": self.address.use_ipv6}, + address=({"address": self.address(), + "use_ipv6": self.address.use_ipv6} if self.address else {}), source_address=({"address": self.source_address(), "use_ipv6": self.source_address.use_ipv6} if self.source_address else None), cert=self.cert.to_pem() if self.cert else None diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py index 58dc77e7..5c80584d 100644 --- a/libmproxy/web/app.py +++ b/libmproxy/web/app.py @@ -29,7 +29,7 @@ class RequestHandler(tornado.web.RequestHandler): def json(self): if not self.request.headers.get("Content-Type").startswith("application/json"): return None - return json.loads(self.request.content) + return json.loads(self.request.body) @property def state(self): diff --git a/libmproxy/web/static/app.css b/libmproxy/web/static/app.css index 8a2a4356..94a6abf0 100644 --- a/libmproxy/web/static/app.css +++ b/libmproxy/web/static/app.css @@ -137,8 +137,8 @@ header .menu { border-bottom: solid #a6a6a6 1px; } .menu-row { - margin-left: -2.5px; - margin-right: -2.5px; + margin-left: -2px; + margin-right: -3px; } .filter-input { position: relative; @@ -418,4 +418,4 @@ footer { padding: 0px 10px 3px; } -/*# sourceMappingURL=app.css.map */
\ No newline at end of file +/*# sourceMappingURL=app.css.map */ diff --git a/libmproxy/web/static/app.js b/libmproxy/web/static/app.js index edcc95ba..27f356f7 100644 --- a/libmproxy/web/static/app.js +++ b/libmproxy/web/static/app.js @@ -302,6 +302,8 @@ function isUndefined(arg) { } },{}],2:[function(require,module,exports){ +"use strict"; + var $ = require("jquery"); var _ = require("lodash"); var AppDispatcher = require("./dispatcher.js").AppDispatcher; @@ -315,7 +317,7 @@ var ActionTypes = { // Stores SETTINGS_STORE: "settings", EVENT_STORE: "events", - FLOW_STORE: "flows", + FLOW_STORE: "flows" }; var StoreCmds = { @@ -326,17 +328,17 @@ var StoreCmds = { }; var ConnectionActions = { - open: function () { + open: function open() { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_OPEN }); }, - close: function () { + close: function close() { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_CLOSE }); }, - error: function () { + error: function error() { AppDispatcher.dispatchViewAction({ type: ActionTypes.CONNECTION_ERROR }); @@ -344,7 +346,7 @@ var ConnectionActions = { }; var SettingsActions = { - update: function (settings) { + update: function update(settings) { $.ajax({ type: "PUT", @@ -366,7 +368,7 @@ var SettingsActions = { var EventLogActions_event_id = 0; var EventLogActions = { - add_event: function (message) { + add_event: function add_event(message) { AppDispatcher.dispatchViewAction({ type: ActionTypes.EVENT_STORE, cmd: StoreCmds.ADD, @@ -380,28 +382,28 @@ var EventLogActions = { }; var FlowActions = { - accept: function (flow) { + accept: function accept(flow) { $.post("/flows/" + flow.id + "/accept"); }, - accept_all: function(){ + accept_all: function accept_all() { $.post("/flows/accept"); }, - "delete": function(flow){ + "delete": function _delete(flow) { $.ajax({ - type:"DELETE", + type: "DELETE", url: "/flows/" + flow.id }); }, - duplicate: function(flow){ + duplicate: function duplicate(flow) { $.post("/flows/" + flow.id + "/duplicate"); }, - replay: function(flow){ + replay: function replay(flow) { $.post("/flows/" + flow.id + "/replay"); }, - revert: function(flow){ + revert: function revert(flow) { $.post("/flows/" + flow.id + "/revert"); }, - update: function (flow, nextProps) { + update: function update(flow, nextProps) { /* //Facebook Flux: We do an optimistic update on the client already. var nextFlow = _.cloneDeep(flow); @@ -419,7 +421,7 @@ var FlowActions = { data: JSON.stringify(nextProps) }); }, - clear: function(){ + clear: function clear() { $.post("/clear"); } }; @@ -440,7 +442,10 @@ module.exports = { Query: Query }; + },{"./dispatcher.js":21,"jquery":"jquery","lodash":"lodash"}],3:[function(require,module,exports){ +"use strict"; + var React = require("react"); var ReactRouter = require("react-router"); var $ = require("jquery"); @@ -461,32 +466,29 @@ $(function () { }); - },{"./actions.js":2,"./components/proxyapp.js":18,"./connection":20,"jquery":"jquery","react":"react","react-router":"react-router"}],4:[function(require,module,exports){ +"use strict"; + var React = require("react"); var ReactRouter = require("react-router"); var _ = require("lodash"); // http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html (also contains inverse example) var AutoScrollMixin = { - componentWillUpdate: function () { + componentWillUpdate: function componentWillUpdate() { var node = this.getDOMNode(); - this._shouldScrollBottom = ( - node.scrollTop !== 0 && - node.scrollTop + node.clientHeight === node.scrollHeight - ); + this._shouldScrollBottom = node.scrollTop !== 0 && node.scrollTop + node.clientHeight === node.scrollHeight; }, - componentDidUpdate: function () { + componentDidUpdate: function componentDidUpdate() { if (this._shouldScrollBottom) { var node = this.getDOMNode(); node.scrollTop = node.scrollHeight; } - }, + } }; - var StickyHeadMixin = { - adjustHead: function () { + adjustHead: function adjustHead() { // Abusing CSS transforms to set the element // referenced as head into some kind of position:sticky. var head = this.refs.head.getDOMNode(); @@ -498,39 +500,37 @@ var SettingsState = { contextTypes: { settingsStore: React.PropTypes.object.isRequired }, - getInitialState: function () { + getInitialState: function getInitialState() { return { settings: this.context.settingsStore.dict }; }, - componentDidMount: function () { + componentDidMount: function componentDidMount() { this.context.settingsStore.addListener("recalculate", this.onSettingsChange); }, - componentWillUnmount: function () { + componentWillUnmount: function componentWillUnmount() { this.context.settingsStore.removeListener("recalculate", this.onSettingsChange); }, - onSettingsChange: function () { + onSettingsChange: function onSettingsChange() { this.setState({ settings: this.context.settingsStore.dict }); - }, + } }; - var ChildFocus = { contextTypes: { returnFocus: React.PropTypes.func }, - returnFocus: function(){ + returnFocus: function returnFocus() { React.findDOMNode(this).blur(); window.getSelection().removeAllRanges(); this.context.returnFocus(); } }; - var Navigation = _.extend({}, ReactRouter.Navigation, { - setQuery: function (dict) { + setQuery: function setQuery(dict) { var q = this.context.router.getCurrentQuery(); for (var i in dict) { if (dict.hasOwnProperty(i)) { @@ -539,7 +539,7 @@ var Navigation = _.extend({}, ReactRouter.Navigation, { } this.replaceWith(this.context.router.getCurrentPath(), this.context.router.getCurrentParams(), q); }, - replaceWith: function (routeNameOrPath, params, query) { + replaceWith: function replaceWith(routeNameOrPath, params, query) { if (routeNameOrPath === undefined) { routeNameOrPath = this.context.router.getCurrentPath(); } @@ -558,30 +558,32 @@ var Navigation = _.extend({}, ReactRouter.Navigation, { // We keep the old method for now - if it should turn out that their changes are permanent, // we may remove this mixin and access react-router directly again. var RouterState = _.extend({}, ReactRouter.State, { - getQuery: function () { + getQuery: function getQuery() { // For whatever reason, react-router always returns the same object, which makes comparing // the current props with nextProps impossible. As a workaround, we just clone the query object. return _.clone(this.context.router.getCurrentQuery()); }, - getParams: function () { + getParams: function getParams() { return _.clone(this.context.router.getCurrentParams()); } }); -var Splitter = React.createClass({displayName: "Splitter", - getDefaultProps: function () { +var Splitter = React.createClass({ + displayName: "Splitter", + + getDefaultProps: function getDefaultProps() { return { axis: "x" }; }, - getInitialState: function () { + getInitialState: function getInitialState() { return { applied: false, startX: false, startY: false }; }, - onMouseDown: function (e) { + onMouseDown: function onMouseDown(e) { this.setState({ startX: e.pageX, startY: e.pageY @@ -591,13 +593,13 @@ var Splitter = React.createClass({displayName: "Splitter", // Occasionally, only a dragEnd event is triggered, but no mouseUp. window.addEventListener("dragend", this.onDragEnd); }, - onDragEnd: function () { + onDragEnd: function onDragEnd() { this.getDOMNode().style.transform = ""; window.removeEventListener("dragend", this.onDragEnd); window.removeEventListener("mouseup", this.onMouseUp); window.removeEventListener("mousemove", this.onMouseMove); }, - onMouseUp: function (e) { + onMouseUp: function onMouseUp(e) { this.onDragEnd(); var node = this.getDOMNode(); @@ -621,8 +623,9 @@ var Splitter = React.createClass({displayName: "Splitter", }); this.onResize(); }, - onMouseMove: function (e) { - var dX = 0, dY = 0; + onMouseMove: function onMouseMove(e) { + var dX = 0, + dY = 0; if (this.props.axis === "x") { dX = e.pageX - this.state.startX; } else { @@ -630,14 +633,14 @@ var Splitter = React.createClass({displayName: "Splitter", } this.getDOMNode().style.transform = "translate(" + dX + "px," + dY + "px)"; }, - onResize: function () { + onResize: function onResize() { // Trigger a global resize event. This notifies components that employ virtual scrolling // that their viewport may have changed. window.setTimeout(function () { window.dispatchEvent(new CustomEvent("resize")); }, 1); }, - reset: function (willUnmount) { + reset: function reset(willUnmount) { if (!this.state.applied) { return; } @@ -655,20 +658,20 @@ var Splitter = React.createClass({displayName: "Splitter", } this.onResize(); }, - componentWillUnmount: function () { + componentWillUnmount: function componentWillUnmount() { this.reset(true); }, - render: function () { + render: function render() { var className = "splitter"; if (this.props.axis === "x") { className += " splitter-x"; } else { className += " splitter-y"; } - return ( - React.createElement("div", {className: className}, - React.createElement("div", {onMouseDown: this.onMouseDown, draggable: "true"}) - ) + return React.createElement( + "div", + { className: className }, + React.createElement("div", { onMouseDown: this.onMouseDown, draggable: "true" }) ); } }); @@ -683,32 +686,40 @@ module.exports = { SettingsState: SettingsState }; + },{"lodash":"lodash","react":"react","react-router":"react-router"}],5:[function(require,module,exports){ +"use strict"; + +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 React = require("react"); var common = require("./common.js"); var utils = require("../utils.js"); -var contentToHtml = function (content) { +var contentToHtml = function contentToHtml(content) { return _.escape(content); }; -var nodeToContent = function (node) { +var nodeToContent = function nodeToContent(node) { return node.textContent; }; /* -Basic Editor Functionality + Basic Editor Functionality */ -var EditorBase = React.createClass({displayName: "EditorBase", +var EditorBase = React.createClass({ + displayName: "EditorBase", + propTypes: { content: React.PropTypes.string.isRequired, onDone: React.PropTypes.func.isRequired, contentToHtml: React.PropTypes.func, nodeToContent: React.PropTypes.func, // content === nodeToContent( Node<innerHTML=contentToHtml(content)> ) + onStop: React.PropTypes.func, submitOnEnter: React.PropTypes.bool, className: React.PropTypes.string, tag: React.PropTypes.string }, - getDefaultProps: function () { + getDefaultProps: function getDefaultProps() { return { contentToHtml: contentToHtml, nodeToContent: nodeToContent, @@ -717,68 +728,113 @@ var EditorBase = React.createClass({displayName: "EditorBase", tag: "div" }; }, - getInitialState: function () { + getInitialState: function getInitialState() { return { editable: false }; }, - render: function () { + render: function render() { var className = "inline-input " + this.props.className; - var html = {__html: this.props.contentToHtml(this.props.content)}; + var html = { __html: this.props.contentToHtml(this.props.content) }; var Tag = this.props.tag; - return React.createElement(Tag, React.__spread({}, - this.props, - {tabIndex: "0", - className: className, + return React.createElement(Tag, _extends({}, this.props, { + tabIndex: "0", + className: className, contentEditable: this.state.editable || undefined, // workaround: use undef instead of false to remove attr - onFocus: this.onFocus, - onBlur: this._stop, - onKeyDown: this.onKeyDown, - onInput: this.onInput, - onPaste: this.onPaste, - dangerouslySetInnerHTML: html}) - ); - }, - onPaste: function(e){ + onFocus: this.onFocus, + onMouseDown: this.onMouseDown, + onClick: this.onClick, + onBlur: this._stop, + onKeyDown: this.onKeyDown, + onInput: this.onInput, + onPaste: this.onPaste, + dangerouslySetInnerHTML: html + })); + }, + onPaste: function onPaste(e) { e.preventDefault(); var content = e.clipboardData.getData("text/plain"); document.execCommand("insertHTML", false, content); }, - onFocus: function (e) { - this.setState({editable: true}, function () { - React.findDOMNode(this).focus(); - var range = document.createRange(); - range.selectNodeContents(this.getDOMNode()); - var sel = window.getSelection(); - sel.removeAllRanges(); - sel.addRange(range); + onMouseDown: function onMouseDown(e) { + this._mouseDown = true; + window.addEventListener("mouseup", this.onMouseUp); + this.props.onMouseDown && this.props.onMouseDown(e); + }, + onMouseUp: function onMouseUp() { + if (this._mouseDown) { + this._mouseDown = false; + window.removeEventListener("mouseup", this.onMouseUp); + } + }, + onClick: function onClick(e) { + this.onMouseUp(); + this.onFocus(e); + }, + onFocus: function onFocus(e) { + console.log("onFocus", this._mouseDown, this._ignore_events, this.state.editable); + if (this._mouseDown || this._ignore_events || this.state.editable) { + return; + } + + //contenteditable in FireFox is more or less broken. + // - we need to blur() and then focus(), otherwise the caret is not shown. + // - blur() + focus() == we need to save the caret position before + // Firefox sometimes just doesn't set a caret position => use caretPositionFromPoint + var sel = window.getSelection(); + var range; + if (sel.rangeCount > 0) { + range = sel.getRangeAt(0); + } else if (document.caretPositionFromPoint && e.clientX && e.clientY) { + var pos = document.caretPositionFromPoint(e.clientX, e.clientY); + range = document.createRange(); + range.setStart(pos.offsetNode, pos.offset); + } else if (document.caretRangeFromPoint && e.clientX && e.clientY) { + range = document.caretRangeFromPoint(e.clientX, e.clientY); + } else { + range = document.createRange(); + range.selectNodeContents(React.findDOMNode(this)); + } + + this._ignore_events = true; + this.setState({ editable: true }, function () { + var node = React.findDOMNode(this); + node.blur(); + node.focus(); + this._ignore_events = false; + //sel.removeAllRanges(); + //sel.addRange(range); }); - this.props.onFocus && this.props.onFocus(e); }, - stop: function () { + stop: function stop() { // a stop would cause a blur as a side-effect. // but a blur event must trigger a stop as well. // to fix this, make stop = blur and do the actual stop in the onBlur handler. React.findDOMNode(this).blur(); + this.props.onStop && this.props.onStop(); }, - _stop: function (e) { + _stop: function _stop(e) { + if (this._ignore_events) { + return; + } + console.log("_stop", _.extend({}, e)); window.getSelection().removeAllRanges(); //make sure that selection is cleared on blur var node = React.findDOMNode(this); var content = this.props.nodeToContent(node); - this.setState({editable: false}); + this.setState({ editable: false }); this.props.onDone(content); this.props.onBlur && this.props.onBlur(e); }, - cancel: function () { + reset: function reset() { React.findDOMNode(this).innerHTML = this.props.contentToHtml(this.props.content); - this.stop(); }, - onKeyDown: function (e) { + onKeyDown: function onKeyDown(e) { e.stopPropagation(); switch (e.keyCode) { case utils.Key.ESC: e.preventDefault(); - this.cancel(); + this.reset(); + this.stop(); break; case utils.Key.ENTER: if (this.props.submitOnEnter && !e.shiftKey) { @@ -790,7 +846,7 @@ var EditorBase = React.createClass({displayName: "EditorBase", break; } }, - onInput: function () { + onInput: function onInput() { var node = React.findDOMNode(this); var content = this.props.nodeToContent(node); this.props.onInput && this.props.onInput(content); @@ -798,48 +854,49 @@ var EditorBase = React.createClass({displayName: "EditorBase", }); /* -Add Validation to EditorBase + Add Validation to EditorBase */ -var ValidateEditor = React.createClass({displayName: "ValidateEditor", +var ValidateEditor = React.createClass({ + displayName: "ValidateEditor", + propTypes: { content: React.PropTypes.string.isRequired, onDone: React.PropTypes.func.isRequired, onInput: React.PropTypes.func, isValid: React.PropTypes.func, - className: React.PropTypes.string, + className: React.PropTypes.string }, - getInitialState: function(){ + getInitialState: function getInitialState() { return { currentContent: this.props.content }; }, - componentWillReceiveProps: function(){ - this.setState({currentContent: this.props.content}); + componentWillReceiveProps: function componentWillReceiveProps() { + this.setState({ currentContent: this.props.content }); }, - onInput: function(content){ - this.setState({currentContent: content}); + onInput: function onInput(content) { + this.setState({ currentContent: content }); this.props.onInput && this.props.onInput(content); }, - render: function () { + render: function render() { var className = this.props.className || ""; if (this.props.isValid) { if (this.props.isValid(this.state.currentContent)) { className += " has-success"; } else { - className += " has-warning" + className += " has-warning"; } } - return React.createElement(EditorBase, React.__spread({}, - this.props, - {ref: "editor", - className: className, - onDone: this.onDone, - onInput: this.onInput}) - ); + return React.createElement(EditorBase, _extends({}, this.props, { + ref: "editor", + className: className, + onDone: this.onDone, + onInput: this.onInput + })); }, - onDone: function (content) { - if(this.props.isValid && !this.props.isValid(content)){ - this.refs.editor.cancel(); + onDone: function onDone(content) { + if (this.props.isValid && !this.props.isValid(content)) { + this.refs.editor.reset(); content = this.props.content; } this.props.onDone(content); @@ -847,31 +904,29 @@ var ValidateEditor = React.createClass({displayName: "ValidateEditor", }); /* -Text Editor with mitmweb-specific convenience features + Text Editor with mitmweb-specific convenience features */ -var ValueEditor = React.createClass({displayName: "ValueEditor", +var ValueEditor = React.createClass({ + displayName: "ValueEditor", + mixins: [common.ChildFocus], propTypes: { content: React.PropTypes.string.isRequired, onDone: React.PropTypes.func.isRequired, - inline: React.PropTypes.bool, + inline: React.PropTypes.bool }, - render: function () { + render: function render() { var tag = this.props.inline ? "span" : "div"; - return React.createElement(ValidateEditor, React.__spread({}, - this.props, - {onBlur: this.onBlur, - tag: tag}) - ); + return React.createElement(ValidateEditor, _extends({}, this.props, { + onStop: this.onStop, + tag: tag + })); }, - focus: function () { + focus: function focus() { React.findDOMNode(this).focus(); }, - onBlur: function(e){ - if(!e.relatedTarget){ - this.returnFocus(); - } - this.props.onBlur && this.props.onBlur(e); + onStop: function onStop() { + this.returnFocus(); } }); @@ -879,7 +934,10 @@ module.exports = { ValueEditor: ValueEditor }; + },{"../utils.js":26,"./common.js":4,"react":"react"}],6:[function(require,module,exports){ +"use strict"; + var React = require("react"); var common = require("./common.js"); var Query = require("../actions.js").Query; @@ -887,38 +945,44 @@ var VirtualScrollMixin = require("./virtualscroll.js"); var views = require("../store/view.js"); var _ = require("lodash"); -var LogMessage = React.createClass({displayName: "LogMessage", - render: function () { +var LogMessage = React.createClass({ + displayName: "LogMessage", + + render: function render() { var entry = this.props.entry; var indicator; switch (entry.level) { case "web": - indicator = React.createElement("i", {className: "fa fa-fw fa-html5"}); + indicator = React.createElement("i", { className: "fa fa-fw fa-html5" }); break; case "debug": - indicator = React.createElement("i", {className: "fa fa-fw fa-bug"}); + indicator = React.createElement("i", { className: "fa fa-fw fa-bug" }); break; default: - indicator = React.createElement("i", {className: "fa fa-fw fa-info"}); - } - return ( - React.createElement("div", null, - indicator, " ", entry.message - ) + indicator = React.createElement("i", { className: "fa fa-fw fa-info" }); + } + return React.createElement( + "div", + null, + indicator, + " ", + entry.message ); }, - shouldComponentUpdate: function () { + shouldComponentUpdate: function shouldComponentUpdate() { return false; // log entries are immutable. } }); -var EventLogContents = React.createClass({displayName: "EventLogContents", +var EventLogContents = React.createClass({ + displayName: "EventLogContents", + contextTypes: { eventStore: React.PropTypes.object.isRequired }, mixins: [common.AutoScrollMixin, VirtualScrollMixin], - getInitialState: function () { - var filterFn = function (entry) { + getInitialState: function getInitialState() { + var filterFn = function filterFn(entry) { return this.props.filter[entry.level]; }; var view = new views.StoreView(this.context.eventStore, filterFn.bind(this)); @@ -929,68 +993,75 @@ var EventLogContents = React.createClass({displayName: "EventLogContents", view: view }; }, - componentWillUnmount: function () { + componentWillUnmount: function componentWillUnmount() { this.state.view.close(); }, - filter: function (entry) { + filter: function filter(entry) { return this.props.filter[entry.level]; }, - onEventLogChange: function () { + onEventLogChange: function onEventLogChange() { this.forceUpdate(); }, - componentWillReceiveProps: function (nextProps) { + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (nextProps.filter !== this.props.filter) { this.props.filter = nextProps.filter; // Dirty: Make sure that view filter sees the update. this.state.view.recalculate(); } }, - getDefaultProps: function () { + getDefaultProps: function getDefaultProps() { return { rowHeight: 45, rowHeightMin: 15, placeholderTagName: "div" }; }, - renderRow: function (elem) { - return React.createElement(LogMessage, {key: elem.id, entry: elem}); + renderRow: function renderRow(elem) { + return React.createElement(LogMessage, { key: elem.id, entry: elem }); }, - render: function () { + render: function render() { var entries = this.state.view.list; var rows = this.renderRows(entries); - return React.createElement("pre", {onScroll: this.onScroll}, - this.getPlaceholderTop(entries.length), - rows, - this.getPlaceholderBottom(entries.length) + return React.createElement( + "pre", + { onScroll: this.onScroll }, + this.getPlaceholderTop(entries.length), + rows, + this.getPlaceholderBottom(entries.length) ); } }); -var ToggleFilter = React.createClass({displayName: "ToggleFilter", - toggle: function (e) { +var ToggleFilter = React.createClass({ + displayName: "ToggleFilter", + + toggle: function toggle(e) { e.preventDefault(); return this.props.toggleLevel(this.props.name); }, - render: function () { + render: function render() { var className = "label "; if (this.props.active) { className += "label-primary"; } else { className += "label-default"; } - return ( - React.createElement("a", { - href: "#", - className: className, - onClick: this.toggle}, - this.props.name - ) + return React.createElement( + "a", + { + href: "#", + className: className, + onClick: this.toggle }, + this.props.name ); } }); -var EventLog = React.createClass({displayName: "EventLog", - getInitialState: function () { +var EventLog = React.createClass({ + displayName: "EventLog", + + mixins: [common.Navigation], + getInitialState: function getInitialState() { return { filter: { "debug": false, @@ -999,77 +1070,92 @@ var EventLog = React.createClass({displayName: "EventLog", } }; }, - close: function () { + close: function close() { var d = {}; d[Query.SHOW_EVENTLOG] = undefined; this.setQuery(d); }, - toggleLevel: function (level) { + toggleLevel: function toggleLevel(level) { var filter = _.extend({}, this.state.filter); filter[level] = !filter[level]; - this.setState({filter: filter}); - }, - render: function () { - return ( - React.createElement("div", {className: "eventlog"}, - React.createElement("div", null, - "Eventlog", - React.createElement("div", {className: "pull-right"}, - React.createElement(ToggleFilter, {name: "debug", active: this.state.filter.debug, toggleLevel: this.toggleLevel}), - React.createElement(ToggleFilter, {name: "info", active: this.state.filter.info, toggleLevel: this.toggleLevel}), - React.createElement(ToggleFilter, {name: "web", active: this.state.filter.web, toggleLevel: this.toggleLevel}), - React.createElement("i", {onClick: this.close, className: "fa fa-close"}) - ) - - ), - React.createElement(EventLogContents, {filter: this.state.filter}) - ) + this.setState({ filter: filter }); + }, + render: function render() { + return React.createElement( + "div", + { className: "eventlog" }, + React.createElement( + "div", + null, + "Eventlog", + React.createElement( + "div", + { className: "pull-right" }, + React.createElement(ToggleFilter, { name: "debug", active: this.state.filter.debug, toggleLevel: this.toggleLevel }), + React.createElement(ToggleFilter, { name: "info", active: this.state.filter.info, toggleLevel: this.toggleLevel }), + React.createElement(ToggleFilter, { name: "web", active: this.state.filter.web, toggleLevel: this.toggleLevel }), + React.createElement("i", { onClick: this.close, className: "fa fa-close" }) + ) + ), + React.createElement(EventLogContents, { filter: this.state.filter }) ); } }); module.exports = EventLog; + },{"../actions.js":2,"../store/view.js":25,"./common.js":4,"./virtualscroll.js":19,"lodash":"lodash","react":"react"}],7:[function(require,module,exports){ +"use strict"; + +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 React = require("react"); var RequestUtils = require("../flow/utils.js").RequestUtils; var ResponseUtils = require("../flow/utils.js").ResponseUtils; var utils = require("../utils.js"); -var TLSColumn = React.createClass({displayName: "TLSColumn", +var TLSColumn = React.createClass({ + displayName: "TLSColumn", + statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-tls " + (this.props.className || "") })); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement("th", _extends({}, this.props, { className: "col-tls " + (this.props.className || "") })); } }), - sortKeyFun: function(flow){ + sortKeyFun: function sortKeyFun(flow) { return flow.request.scheme; } }, - render: function () { + render: function render() { var flow = this.props.flow; - var ssl = (flow.request.scheme === "https"); + var ssl = flow.request.scheme === "https"; var classes; if (ssl) { classes = "col-tls col-tls-https"; } else { classes = "col-tls col-tls-http"; } - return React.createElement("td", {className: classes}); + return React.createElement("td", { className: classes }); } }); +var IconColumn = React.createClass({ + displayName: "IconColumn", -var IconColumn = React.createClass({displayName: "IconColumn", statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-icon " + (this.props.className || "") })); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement("th", _extends({}, this.props, { className: "col-icon " + (this.props.className || "") })); } }) }, - render: function () { + render: function render() { var flow = this.props.flow; var icon; @@ -1077,9 +1163,9 @@ var IconColumn = React.createClass({displayName: "IconColumn", var contentType = ResponseUtils.getContentType(flow.response); //TODO: We should assign a type to the flow somewhere else. - if (flow.response.code === 304) { + if (flow.response.status_code === 304) { icon = "resource-icon-not-modified"; - } else if (300 <= flow.response.code && flow.response.code < 400) { + } else if (300 <= flow.response.status_code && flow.response.status_code < 400) { icon = "resource-icon-redirect"; } else if (contentType && contentType.indexOf("image") >= 0) { icon = "resource-icon-image"; @@ -1095,86 +1181,126 @@ var IconColumn = React.createClass({displayName: "IconColumn", icon = "resource-icon-plain"; } - icon += " resource-icon"; - return React.createElement("td", {className: "col-icon"}, - React.createElement("div", {className: icon}) + return React.createElement( + "td", + { className: "col-icon" }, + React.createElement("div", { className: icon }) ); } }); -var PathColumn = React.createClass({displayName: "PathColumn", +var PathColumn = React.createClass({ + displayName: "PathColumn", + statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-path " + (this.props.className || "") }), "Path"); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement( + "th", + _extends({}, this.props, { className: "col-path " + (this.props.className || "") }), + "Path" + ); } }), - sortKeyFun: function(flow){ + sortKeyFun: function sortKeyFun(flow) { return RequestUtils.pretty_url(flow.request); } }, - render: function () { + render: function render() { var flow = this.props.flow; - return React.createElement("td", {className: "col-path"}, - flow.request.is_replay ? React.createElement("i", {className: "fa fa-fw fa-repeat pull-right"}) : null, - flow.intercepted ? React.createElement("i", {className: "fa fa-fw fa-pause pull-right"}) : null, - RequestUtils.pretty_url(flow.request) + return React.createElement( + "td", + { className: "col-path" }, + flow.request.is_replay ? React.createElement("i", { className: "fa fa-fw fa-repeat pull-right" }) : null, + flow.intercepted ? React.createElement("i", { className: "fa fa-fw fa-pause pull-right" }) : null, + RequestUtils.pretty_url(flow.request) ); } }); +var MethodColumn = React.createClass({ + displayName: "MethodColumn", -var MethodColumn = React.createClass({displayName: "MethodColumn", statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-method " + (this.props.className || "") }), "Method"); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement( + "th", + _extends({}, this.props, { className: "col-method " + (this.props.className || "") }), + "Method" + ); } }), - sortKeyFun: function(flow){ + sortKeyFun: function sortKeyFun(flow) { return flow.request.method; } }, - render: function () { + render: function render() { var flow = this.props.flow; - return React.createElement("td", {className: "col-method"}, flow.request.method); + return React.createElement( + "td", + { className: "col-method" }, + flow.request.method + ); } }); +var StatusColumn = React.createClass({ + displayName: "StatusColumn", -var StatusColumn = React.createClass({displayName: "StatusColumn", statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-status " + (this.props.className || "") }), "Status"); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement( + "th", + _extends({}, this.props, { className: "col-status " + (this.props.className || "") }), + "Status" + ); } }), - sortKeyFun: function(flow){ - return flow.response ? flow.response.code : undefined; + sortKeyFun: function sortKeyFun(flow) { + return flow.response ? flow.response.status_code : undefined; } }, - render: function () { + render: function render() { var flow = this.props.flow; var status; if (flow.response) { - status = flow.response.code; + status = flow.response.status_code; } else { status = null; } - return React.createElement("td", {className: "col-status"}, status); + return React.createElement( + "td", + { className: "col-status" }, + status + ); } }); +var SizeColumn = React.createClass({ + displayName: "SizeColumn", -var SizeColumn = React.createClass({displayName: "SizeColumn", statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-size " + (this.props.className || "") }), "Size"); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement( + "th", + _extends({}, this.props, { className: "col-size " + (this.props.className || "") }), + "Size" + ); } }), - sortKeyFun: function(flow){ + sortKeyFun: function sortKeyFun(flow) { var total = flow.request.contentLength; if (flow.response) { total += flow.response.contentLength || 0; @@ -1182,7 +1308,7 @@ var SizeColumn = React.createClass({displayName: "SizeColumn", return total; } }, - render: function () { + render: function render() { var flow = this.props.flow; var total = flow.request.contentLength; @@ -1190,25 +1316,36 @@ var SizeColumn = React.createClass({displayName: "SizeColumn", total += flow.response.contentLength || 0; } var size = utils.formatSize(total); - return React.createElement("td", {className: "col-size"}, size); + return React.createElement( + "td", + { className: "col-size" }, + size + ); } }); +var TimeColumn = React.createClass({ + displayName: "TimeColumn", -var TimeColumn = React.createClass({displayName: "TimeColumn", statics: { - Title: React.createClass({displayName: "Title", - render: function(){ - return React.createElement("th", React.__spread({}, this.props, {className: "col-time " + (this.props.className || "") }), "Time"); + Title: React.createClass({ + displayName: "Title", + + render: function render() { + return React.createElement( + "th", + _extends({}, this.props, { className: "col-time " + (this.props.className || "") }), + "Time" + ); } }), - sortKeyFun: function(flow){ - if(flow.response) { + sortKeyFun: function sortKeyFun(flow) { + if (flow.response) { return flow.response.timestamp_end - flow.request.timestamp_start; } } }, - render: function () { + render: function render() { var flow = this.props.flow; var time; if (flow.response) { @@ -1216,24 +1353,22 @@ var TimeColumn = React.createClass({displayName: "TimeColumn", } else { time = "..."; } - return React.createElement("td", {className: "col-time"}, time); + return React.createElement( + "td", + { className: "col-time" }, + time + ); } }); - -var all_columns = [ - TLSColumn, - IconColumn, - PathColumn, - MethodColumn, - StatusColumn, - SizeColumn, - TimeColumn -]; +var all_columns = [TLSColumn, IconColumn, PathColumn, MethodColumn, StatusColumn, SizeColumn, TimeColumn]; module.exports = all_columns; + },{"../flow/utils.js":23,"../utils.js":26,"react":"react"}],8:[function(require,module,exports){ +"use strict"; + var React = require("react"); var common = require("./common.js"); var utils = require("../utils.js"); @@ -1242,12 +1377,14 @@ var _ = require("lodash"); var VirtualScrollMixin = require("./virtualscroll.js"); var flowtable_columns = require("./flowtable-columns.js"); -var FlowRow = React.createClass({displayName: "FlowRow", - render: function () { +var FlowRow = React.createClass({ + displayName: "FlowRow", + + render: function render() { var flow = this.props.flow; - var columns = this.props.columns.map(function (Column) { - return React.createElement(Column, {key: Column.displayName, flow: flow}); - }.bind(this)); + var columns = this.props.columns.map((function (Column) { + return React.createElement(Column, { key: Column.displayName, flow: flow }); + }).bind(this)); var className = ""; if (this.props.selected) { className += " selected"; @@ -1265,12 +1402,13 @@ var FlowRow = React.createClass({displayName: "FlowRow", className += " has-response"; } - return ( - React.createElement("tr", {className: className, onClick: this.props.selectFlow.bind(null, flow)}, - columns - )); + return React.createElement( + "tr", + { className: className, onClick: this.props.selectFlow.bind(null, flow) }, + columns + ); }, - shouldComponentUpdate: function (nextProps) { + shouldComponentUpdate: function shouldComponentUpdate(nextProps) { return true; // Further optimization could be done here // by calling forceUpdate on flow updates, selection changes and column changes. @@ -1281,17 +1419,19 @@ var FlowRow = React.createClass({displayName: "FlowRow", } }); -var FlowTableHead = React.createClass({displayName: "FlowTableHead", - getInitialState: function(){ +var FlowTableHead = React.createClass({ + displayName: "FlowTableHead", + + getInitialState: function getInitialState() { return { sortColumn: undefined, sortDesc: false }; }, - onClick: function(Column){ + onClick: function onClick(Column) { var sortDesc = this.state.sortDesc; var hasSort = Column.sortKeyFun; - if(Column === this.state.sortColumn){ + if (Column === this.state.sortColumn) { sortDesc = !sortDesc; this.setState({ sortDesc: sortDesc @@ -1300,120 +1440,124 @@ var FlowTableHead = React.createClass({displayName: "FlowTableHead", this.setState({ sortColumn: hasSort && Column, sortDesc: false - }) + }); } var sortKeyFun; - if(!sortDesc){ + if (!sortDesc) { sortKeyFun = Column.sortKeyFun; } else { - sortKeyFun = hasSort && function(){ + sortKeyFun = hasSort && function () { var k = Column.sortKeyFun.apply(this, arguments); - if(_.isString(k)){ - return utils.reverseString(""+k); + if (_.isString(k)) { + return utils.reverseString("" + k); } else { return -k; } - } + }; } this.props.setSortKeyFun(sortKeyFun); }, - render: function () { - var columns = this.props.columns.map(function (Column) { + render: function render() { + var columns = this.props.columns.map((function (Column) { var onClick = this.onClick.bind(this, Column); var className; - if(this.state.sortColumn === Column) { - if(this.state.sortDesc){ + if (this.state.sortColumn === Column) { + if (this.state.sortDesc) { className = "sort-desc"; } else { className = "sort-asc"; } } return React.createElement(Column.Title, { - key: Column.displayName, - onClick: onClick, - className: className}); - }.bind(this)); - return React.createElement("thead", null, - React.createElement("tr", null, columns) + key: Column.displayName, + onClick: onClick, + className: className }); + }).bind(this)); + return React.createElement( + "thead", + null, + React.createElement( + "tr", + null, + columns + ) ); } }); - var ROW_HEIGHT = 32; -var FlowTable = React.createClass({displayName: "FlowTable", +var FlowTable = React.createClass({ + displayName: "FlowTable", + mixins: [common.StickyHeadMixin, common.AutoScrollMixin, VirtualScrollMixin], contextTypes: { view: React.PropTypes.object.isRequired }, - getInitialState: function () { + getInitialState: function getInitialState() { return { columns: flowtable_columns }; }, - componentWillMount: function () { + componentWillMount: function componentWillMount() { this.context.view.addListener("add", this.onChange); this.context.view.addListener("update", this.onChange); this.context.view.addListener("remove", this.onChange); this.context.view.addListener("recalculate", this.onChange); }, - componentWillUnmount: function(){ + componentWillUnmount: function componentWillUnmount() { this.context.view.removeListener("add", this.onChange); this.context.view.removeListener("update", this.onChange); this.context.view.removeListener("remove", this.onChange); this.context.view.removeListener("recalculate", this.onChange); }, - getDefaultProps: function () { + getDefaultProps: function getDefaultProps() { return { rowHeight: ROW_HEIGHT }; }, - onScrollFlowTable: function () { + onScrollFlowTable: function onScrollFlowTable() { this.adjustHead(); this.onScroll(); }, - onChange: function () { + onChange: function onChange() { this.forceUpdate(); }, - scrollIntoView: function (flow) { - this.scrollRowIntoView( - this.context.view.index(flow), - this.refs.body.getDOMNode().offsetTop - ); + scrollIntoView: function scrollIntoView(flow) { + this.scrollRowIntoView(this.context.view.index(flow), this.refs.body.getDOMNode().offsetTop); }, - renderRow: function (flow) { - var selected = (flow === this.props.selected); - var highlighted = - ( - this.context.view._highlight && - this.context.view._highlight[flow.id] - ); + renderRow: function renderRow(flow) { + var selected = flow === this.props.selected; + var highlighted = this.context.view._highlight && this.context.view._highlight[flow.id]; - return React.createElement(FlowRow, {key: flow.id, - ref: flow.id, - flow: flow, - columns: this.state.columns, - selected: selected, - highlighted: highlighted, - selectFlow: this.props.selectFlow} - ); + return React.createElement(FlowRow, { key: flow.id, + ref: flow.id, + flow: flow, + columns: this.state.columns, + selected: selected, + highlighted: highlighted, + selectFlow: this.props.selectFlow + }); }, - render: function () { + render: function render() { var flows = this.context.view.list; var rows = this.renderRows(flows); - return ( - React.createElement("div", {className: "flow-table", onScroll: this.onScrollFlowTable}, - React.createElement("table", null, - React.createElement(FlowTableHead, {ref: "head", - columns: this.state.columns, - setSortKeyFun: this.props.setSortKeyFun}), - React.createElement("tbody", {ref: "body"}, - this.getPlaceholderTop(flows.length), - rows, - this.getPlaceholderBottom(flows.length) - ) + return React.createElement( + "div", + { className: "flow-table", onScroll: this.onScrollFlowTable }, + React.createElement( + "table", + null, + React.createElement(FlowTableHead, { ref: "head", + columns: this.state.columns, + setSortKeyFun: this.props.setSortKeyFun }), + React.createElement( + "tbody", + { ref: "body" }, + this.getPlaceholderTop(flows.length), + rows, + this.getPlaceholderBottom(flows.length) ) ) ); @@ -1424,6 +1568,10 @@ module.exports = FlowTable; },{"../utils.js":26,"./common.js":4,"./flowtable-columns.js":7,"./virtualscroll.js":19,"lodash":"lodash","react":"react"}],9:[function(require,module,exports){ +"use strict"; + +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 React = require("react"); var _ = require("lodash"); @@ -1431,28 +1579,32 @@ var MessageUtils = require("../../flow/utils.js").MessageUtils; var utils = require("../../utils.js"); var image_regex = /^image\/(png|jpe?g|gif|vnc.microsoft.icon|x-icon)$/i; -var ViewImage = React.createClass({displayName: "ViewImage", +var ViewImage = React.createClass({ + displayName: "ViewImage", + statics: { - matches: function (message) { + matches: function matches(message) { return image_regex.test(MessageUtils.getContentType(message)); } }, - render: function () { + render: function render() { var url = MessageUtils.getContentURL(this.props.flow, this.props.message); - return React.createElement("div", {className: "flowview-image"}, - React.createElement("img", {src: url, alt: "preview", className: "img-thumbnail"}) + return React.createElement( + "div", + { className: "flowview-image" }, + React.createElement("img", { src: url, alt: "preview", className: "img-thumbnail" }) ); } }); var RawMixin = { - getInitialState: function () { + getInitialState: function getInitialState() { return { content: undefined, request: undefined - } + }; }, - requestContent: function (nextProps) { + requestContent: function requestContent(nextProps) { if (this.state.request) { this.state.request.abort(); } @@ -1461,77 +1613,91 @@ var RawMixin = { content: undefined, request: request }); - request.done(function (data) { - this.setState({content: data}); - }.bind(this)).fail(function (jqXHR, textStatus, errorThrown) { + request.done((function (data) { + this.setState({ content: data }); + }).bind(this)).fail((function (jqXHR, textStatus, errorThrown) { if (textStatus === "abort") { return; } - this.setState({content: "AJAX Error: " + textStatus + "\r\n" + errorThrown}); - }.bind(this)).always(function () { - this.setState({request: undefined}); - }.bind(this)); - + this.setState({ content: "AJAX Error: " + textStatus + "\r\n" + errorThrown }); + }).bind(this)).always((function () { + this.setState({ request: undefined }); + }).bind(this)); }, - componentWillMount: function () { + componentWillMount: function componentWillMount() { this.requestContent(this.props); }, - componentWillReceiveProps: function (nextProps) { + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (nextProps.message !== this.props.message) { this.requestContent(nextProps); } }, - componentWillUnmount: function () { + componentWillUnmount: function componentWillUnmount() { if (this.state.request) { this.state.request.abort(); } }, - render: function () { + render: function render() { if (!this.state.content) { - return React.createElement("div", {className: "text-center"}, - React.createElement("i", {className: "fa fa-spinner fa-spin"}) + return React.createElement( + "div", + { className: "text-center" }, + React.createElement("i", { className: "fa fa-spinner fa-spin" }) ); } return this.renderContent(); } }; -var ViewRaw = React.createClass({displayName: "ViewRaw", +var ViewRaw = React.createClass({ + displayName: "ViewRaw", + mixins: [RawMixin], statics: { - matches: function (message) { + matches: function matches(message) { return true; } }, - renderContent: function () { - return React.createElement("pre", null, this.state.content); + renderContent: function renderContent() { + return React.createElement( + "pre", + null, + this.state.content + ); } }); var json_regex = /^application\/json$/i; -var ViewJSON = React.createClass({displayName: "ViewJSON", +var ViewJSON = React.createClass({ + displayName: "ViewJSON", + mixins: [RawMixin], statics: { - matches: function (message) { + matches: function matches(message) { return json_regex.test(MessageUtils.getContentType(message)); } }, - renderContent: function () { + renderContent: function renderContent() { var json = this.state.content; try { json = JSON.stringify(JSON.parse(json), null, 2); - } catch (e) { - } - return React.createElement("pre", null, json); + } catch (e) {} + return React.createElement( + "pre", + null, + json + ); } }); -var ViewAuto = React.createClass({displayName: "ViewAuto", +var ViewAuto = React.createClass({ + displayName: "ViewAuto", + statics: { - matches: function () { + matches: function matches() { return false; // don't match itself }, - findView: function (message) { + findView: function findView(message) { for (var i = 0; i < all.length; i++) { if (all[i].matches(message)) { return all[i]; @@ -1540,47 +1706,72 @@ var ViewAuto = React.createClass({displayName: "ViewAuto", return all[all.length - 1]; } }, - render: function () { + render: function render() { var View = ViewAuto.findView(this.props.message); - return React.createElement(View, React.__spread({}, this.props)); + return React.createElement(View, this.props); } }); var all = [ViewAuto, ViewImage, ViewJSON, ViewRaw]; +var ContentEmpty = React.createClass({ + displayName: "ContentEmpty", -var ContentEmpty = React.createClass({displayName: "ContentEmpty", - render: function () { + render: function render() { var message_name = this.props.flow.request === this.props.message ? "request" : "response"; - return React.createElement("div", {className: "alert alert-info"}, "No ", message_name, " content."); + return React.createElement( + "div", + { className: "alert alert-info" }, + "No ", + message_name, + " content." + ); } }); -var ContentMissing = React.createClass({displayName: "ContentMissing", - render: function () { +var ContentMissing = React.createClass({ + displayName: "ContentMissing", + + render: function render() { var message_name = this.props.flow.request === this.props.message ? "Request" : "Response"; - return React.createElement("div", {className: "alert alert-info"}, message_name, " content missing."); + return React.createElement( + "div", + { className: "alert alert-info" }, + message_name, + " content missing." + ); } }); -var TooLarge = React.createClass({displayName: "TooLarge", +var TooLarge = React.createClass({ + displayName: "TooLarge", + statics: { - isTooLarge: function (message) { + isTooLarge: function isTooLarge(message) { var max_mb = ViewImage.matches(message) ? 10 : 0.2; return message.contentLength > 1024 * 1024 * max_mb; } }, - render: function () { + render: function render() { var size = utils.formatSize(this.props.message.contentLength); - return React.createElement("div", {className: "alert alert-warning"}, - React.createElement("button", {onClick: this.props.onClick, className: "btn btn-xs btn-warning pull-right"}, "Display anyway"), - size, " content size." + return React.createElement( + "div", + { className: "alert alert-warning" }, + React.createElement( + "button", + { onClick: this.props.onClick, className: "btn btn-xs btn-warning pull-right" }, + "Display anyway" + ), + size, + " content size." ); } }); -var ViewSelector = React.createClass({displayName: "ViewSelector", - render: function () { +var ViewSelector = React.createClass({ + displayName: "ViewSelector", + + render: function render() { var views = []; for (var i = 0; i < all.length; i++) { var view = all[i]; @@ -1594,22 +1785,28 @@ var ViewSelector = React.createClass({displayName: "ViewSelector", } else { text = view.displayName.toLowerCase().replace("view", ""); } - views.push( - React.createElement("button", { - key: view.displayName, - onClick: this.props.selectView.bind(null, view), - className: className}, - text - ) - ); + views.push(React.createElement( + "button", + { + key: view.displayName, + onClick: this.props.selectView.bind(null, view), + className: className }, + text + )); } - return React.createElement("div", {className: "view-selector btn-group btn-group-xs"}, views); + return React.createElement( + "div", + { className: "view-selector btn-group btn-group-xs" }, + views + ); } }); -var ContentView = React.createClass({displayName: "ContentView", - getInitialState: function () { +var ContentView = React.createClass({ + displayName: "ContentView", + + getInitialState: function getInitialState() { return { displayLarge: false, View: ViewAuto @@ -1620,40 +1817,46 @@ var ContentView = React.createClass({displayName: "ContentView", // Every view takes the flow and the message as props, e.g. // <Auto flow={flow} message={flow.request}/> flow: React.PropTypes.object.isRequired, - message: React.PropTypes.object.isRequired, + message: React.PropTypes.object.isRequired }, - selectView: function (view) { + selectView: function selectView(view) { this.setState({ View: view }); }, - displayLarge: function () { - this.setState({displayLarge: true}); + displayLarge: function displayLarge() { + this.setState({ displayLarge: true }); }, - componentWillReceiveProps: function (nextProps) { + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { if (nextProps.message !== this.props.message) { this.setState(this.getInitialState()); } }, - render: function () { + render: function render() { var message = this.props.message; if (message.contentLength === 0) { - return React.createElement(ContentEmpty, React.__spread({}, this.props)); + return React.createElement(ContentEmpty, this.props); } else if (message.contentLength === null) { - return React.createElement(ContentMissing, React.__spread({}, this.props)); + return React.createElement(ContentMissing, this.props); } else if (!this.state.displayLarge && TooLarge.isTooLarge(message)) { - return React.createElement(TooLarge, React.__spread({}, this.props, {onClick: this.displayLarge})); + return React.createElement(TooLarge, _extends({}, this.props, { onClick: this.displayLarge })); } var downloadUrl = MessageUtils.getContentURL(this.props.flow, message); - return React.createElement("div", null, - React.createElement(this.state.View, React.__spread({}, this.props)), - React.createElement("div", {className: "view-options text-center"}, - React.createElement(ViewSelector, {selectView: this.selectView, active: this.state.View, message: message}), - "Â ", - React.createElement("a", {className: "btn btn-default btn-xs", href: downloadUrl}, - React.createElement("i", {className: "fa fa-download"}) + return React.createElement( + "div", + null, + React.createElement(this.state.View, this.props), + React.createElement( + "div", + { className: "view-options text-center" }, + React.createElement(ViewSelector, { selectView: this.selectView, active: this.state.View, message: message }), + "Â ", + React.createElement( + "a", + { className: "btn btn-default btn-xs", href: downloadUrl }, + React.createElement("i", { className: "fa fa-download" }) ) ) ); @@ -1662,14 +1865,19 @@ var ContentView = React.createClass({displayName: "ContentView", module.exports = ContentView; + },{"../../flow/utils.js":23,"../../utils.js":26,"lodash":"lodash","react":"react"}],10:[function(require,module,exports){ +"use strict"; + var React = require("react"); var _ = require("lodash"); var utils = require("../../utils.js"); -var TimeStamp = React.createClass({displayName: "TimeStamp", - render: function () { +var TimeStamp = React.createClass({ + displayName: "TimeStamp", + + render: function render() { if (!this.props.t) { //should be return null, but that triggers a React bug. @@ -1681,119 +1889,175 @@ var TimeStamp = React.createClass({displayName: "TimeStamp", var delta; if (this.props.deltaTo) { delta = utils.formatTimeDelta(1000 * (this.props.t - this.props.deltaTo)); - delta = React.createElement("span", {className: "text-muted"}, "(" + delta + ")"); + delta = React.createElement( + "span", + { className: "text-muted" }, + "(" + delta + ")" + ); } else { delta = null; } - return React.createElement("tr", null, - React.createElement("td", null, this.props.title + ":"), - React.createElement("td", null, ts, " ", delta) + return React.createElement( + "tr", + null, + React.createElement( + "td", + null, + this.props.title + ":" + ), + React.createElement( + "td", + null, + ts, + " ", + delta + ) ); } }); -var ConnectionInfo = React.createClass({displayName: "ConnectionInfo", +var ConnectionInfo = React.createClass({ + displayName: "ConnectionInfo", - render: function () { + render: function render() { var conn = this.props.conn; var address = conn.address.address.join(":"); - var sni = React.createElement("tr", {key: "sni"}); //should be null, but that triggers a React bug. + var sni = React.createElement("tr", { key: "sni" }); //should be null, but that triggers a React bug. if (conn.sni) { - sni = React.createElement("tr", {key: "sni"}, - React.createElement("td", null, - React.createElement("abbr", {title: "TLS Server Name Indication"}, "TLS SNI:") - ), - React.createElement("td", null, conn.sni) + sni = React.createElement( + "tr", + { key: "sni" }, + React.createElement( + "td", + null, + React.createElement( + "abbr", + { title: "TLS Server Name Indication" }, + "TLS SNI:" + ) + ), + React.createElement( + "td", + null, + conn.sni + ) ); } - return ( - React.createElement("table", {className: "connection-table"}, - React.createElement("tbody", null, - React.createElement("tr", {key: "address"}, - React.createElement("td", null, "Address:"), - React.createElement("td", null, address) - ), - sni - ) + return React.createElement( + "table", + { className: "connection-table" }, + React.createElement( + "tbody", + null, + React.createElement( + "tr", + { key: "address" }, + React.createElement( + "td", + null, + "Address:" + ), + React.createElement( + "td", + null, + address + ) + ), + sni ) ); } }); -var CertificateInfo = React.createClass({displayName: "CertificateInfo", - render: function () { +var CertificateInfo = React.createClass({ + displayName: "CertificateInfo", + + render: function render() { //TODO: We should fetch human-readable certificate representation // from the server var flow = this.props.flow; var client_conn = flow.client_conn; var server_conn = flow.server_conn; - var preStyle = {maxHeight: 100}; - return ( - React.createElement("div", null, - client_conn.cert ? React.createElement("h4", null, "Client Certificate") : null, - client_conn.cert ? React.createElement("pre", {style: preStyle}, client_conn.cert) : null, - - server_conn.cert ? React.createElement("h4", null, "Server Certificate") : null, - server_conn.cert ? React.createElement("pre", {style: preStyle}, server_conn.cert) : null - ) + var preStyle = { maxHeight: 100 }; + return React.createElement( + "div", + null, + client_conn.cert ? React.createElement( + "h4", + null, + "Client Certificate" + ) : null, + client_conn.cert ? React.createElement( + "pre", + { style: preStyle }, + client_conn.cert + ) : null, + server_conn.cert ? React.createElement( + "h4", + null, + "Server Certificate" + ) : null, + server_conn.cert ? React.createElement( + "pre", + { style: preStyle }, + server_conn.cert + ) : null ); } }); -var Timing = React.createClass({displayName: "Timing", - render: function () { +var Timing = React.createClass({ + displayName: "Timing", + + render: function render() { var flow = this.props.flow; var sc = flow.server_conn; var cc = flow.client_conn; var req = flow.request; var resp = flow.response; - var timestamps = [ - { - title: "Server conn. initiated", - t: sc.timestamp_start, - deltaTo: req.timestamp_start - }, { - title: "Server conn. TCP handshake", - t: sc.timestamp_tcp_setup, - deltaTo: req.timestamp_start - }, { - title: "Server conn. SSL handshake", - t: sc.timestamp_ssl_setup, - deltaTo: req.timestamp_start - }, { - title: "Client conn. established", - t: cc.timestamp_start, - deltaTo: req.timestamp_start - }, { - title: "Client conn. SSL handshake", - t: cc.timestamp_ssl_setup, + var timestamps = [{ + title: "Server conn. initiated", + t: sc.timestamp_start, + deltaTo: req.timestamp_start + }, { + title: "Server conn. TCP handshake", + t: sc.timestamp_tcp_setup, + deltaTo: req.timestamp_start + }, { + title: "Server conn. SSL handshake", + t: sc.timestamp_ssl_setup, + deltaTo: req.timestamp_start + }, { + title: "Client conn. established", + t: cc.timestamp_start, + deltaTo: req.timestamp_start + }, { + title: "Client conn. SSL handshake", + t: cc.timestamp_ssl_setup, + deltaTo: req.timestamp_start + }, { + title: "First request byte", + t: req.timestamp_start + }, { + title: "Request complete", + t: req.timestamp_end, + deltaTo: req.timestamp_start + }]; + + if (flow.response) { + timestamps.push({ + title: "First response byte", + t: resp.timestamp_start, deltaTo: req.timestamp_start }, { - title: "First request byte", - t: req.timestamp_start, - }, { - title: "Request complete", - t: req.timestamp_end, + title: "Response complete", + t: resp.timestamp_end, deltaTo: req.timestamp_start - } - ]; - - if (flow.response) { - timestamps.push( - { - title: "First response byte", - t: resp.timestamp_start, - deltaTo: req.timestamp_start - }, { - title: "Response complete", - t: resp.timestamp_end, - deltaTo: req.timestamp_start - } - ); + }); } //Add unique key for each row. @@ -1804,48 +2068,64 @@ var Timing = React.createClass({displayName: "Timing", timestamps = _.sortBy(timestamps, 't'); var rows = timestamps.map(function (e) { - return React.createElement(TimeStamp, React.__spread({}, e)); + return React.createElement(TimeStamp, e); }); - return ( - React.createElement("div", null, - React.createElement("h4", null, "Timing"), - React.createElement("table", {className: "timing-table"}, - React.createElement("tbody", null, + return React.createElement( + "div", + null, + React.createElement( + "h4", + null, + "Timing" + ), + React.createElement( + "table", + { className: "timing-table" }, + React.createElement( + "tbody", + null, rows - ) ) ) ); } }); -var Details = React.createClass({displayName: "Details", - render: function () { +var Details = React.createClass({ + displayName: "Details", + + render: function render() { var flow = this.props.flow; var client_conn = flow.client_conn; var server_conn = flow.server_conn; - return ( - React.createElement("section", null, - - React.createElement("h4", null, "Client Connection"), - React.createElement(ConnectionInfo, {conn: client_conn}), - - React.createElement("h4", null, "Server Connection"), - React.createElement(ConnectionInfo, {conn: server_conn}), - - React.createElement(CertificateInfo, {flow: flow}), - - React.createElement(Timing, {flow: flow}) - - ) + return React.createElement( + "section", + null, + React.createElement( + "h4", + null, + "Client Connection" + ), + React.createElement(ConnectionInfo, { conn: client_conn }), + React.createElement( + "h4", + null, + "Server Connection" + ), + React.createElement(ConnectionInfo, { conn: server_conn }), + React.createElement(CertificateInfo, { flow: flow }), + React.createElement(Timing, { flow: flow }) ); } }); module.exports = Details; + },{"../../utils.js":26,"lodash":"lodash","react":"react"}],11:[function(require,module,exports){ +"use strict"; + var React = require("react"); var _ = require("lodash"); @@ -1855,7 +2135,6 @@ var Messages = require("./messages.js"); var Details = require("./details.js"); var Prompt = require("../prompt.js"); - var allTabs = { request: Messages.Request, response: Messages.Response, @@ -1863,14 +2142,16 @@ var allTabs = { details: Details }; -var FlowView = React.createClass({displayName: "FlowView", +var FlowView = React.createClass({ + displayName: "FlowView", + mixins: [common.StickyHeadMixin, common.Navigation, common.RouterState], - getInitialState: function () { + getInitialState: function getInitialState() { return { prompt: false }; }, - getTabs: function (flow) { + getTabs: function getTabs(flow) { var tabs = []; ["request", "response", "error"].forEach(function (e) { if (flow[e]) { @@ -1880,43 +2161,32 @@ var FlowView = React.createClass({displayName: "FlowView", tabs.push("details"); return tabs; }, - nextTab: function (i) { + nextTab: function nextTab(i) { var tabs = this.getTabs(this.props.flow); var currentIndex = tabs.indexOf(this.getActive()); // JS modulo operator doesn't correct negative numbers, make sure that we are positive. var nextIndex = (currentIndex + i + tabs.length) % tabs.length; this.selectTab(tabs[nextIndex]); }, - selectTab: function (panel) { - this.replaceWith( - "flow", - { - flowId: this.getParams().flowId, - detailTab: panel - } - ); + selectTab: function selectTab(panel) { + this.replaceWith("flow", { + flowId: this.getParams().flowId, + detailTab: panel + }); }, - getActive: function(){ + getActive: function getActive() { return this.getParams().detailTab; }, - promptEdit: function () { + promptEdit: function promptEdit() { var options; - switch(this.getActive()){ + switch (this.getActive()) { case "request": - options = [ - "method", - "url", - {text:"http version", key:"v"}, - "header" - /*, "content"*/]; + options = ["method", "url", { text: "http version", key: "v" }, "header" + /*, "content"*/]; break; case "response": - options = [ - {text:"http version", key:"v"}, - "code", - "message", - "header" - /*, "content"*/]; + options = [{ text: "http version", key: "v" }, "code", "message", "header" + /*, "content"*/]; break; case "details": return; @@ -1926,17 +2196,17 @@ var FlowView = React.createClass({displayName: "FlowView", this.setState({ prompt: { - done: function (k) { - this.setState({prompt: false}); - if(k){ + done: (function (k) { + this.setState({ prompt: false }); + if (k) { this.refs.tab.edit(k); } - }.bind(this), + }).bind(this), options: options } }); }, - render: function () { + render: function render() { var flow = this.props.flow; var tabs = this.getTabs(flow); var active = this.getActive(); @@ -1954,27 +2224,32 @@ var FlowView = React.createClass({displayName: "FlowView", var prompt = null; if (this.state.prompt) { - prompt = React.createElement(Prompt, React.__spread({}, this.state.prompt)); + prompt = React.createElement(Prompt, this.state.prompt); } var Tab = allTabs[active]; - return ( - React.createElement("div", {className: "flow-detail", onScroll: this.adjustHead}, - React.createElement(Nav, {ref: "head", - flow: flow, - tabs: tabs, - active: active, - selectTab: this.selectTab}), - React.createElement(Tab, {ref: "tab", flow: flow}), - prompt - ) + return React.createElement( + "div", + { className: "flow-detail", onScroll: this.adjustHead }, + React.createElement(Nav, { ref: "head", + flow: flow, + tabs: tabs, + active: active, + selectTab: this.selectTab }), + React.createElement(Tab, { ref: "tab", flow: flow }), + prompt ); } }); module.exports = FlowView; + },{"../common.js":4,"../prompt.js":17,"./details.js":10,"./messages.js":12,"./nav.js":13,"lodash":"lodash","react":"react"}],12:[function(require,module,exports){ +"use strict"; + +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 React = require("react"); var _ = require("lodash"); @@ -1985,12 +2260,14 @@ var utils = require("../../utils.js"); var ContentView = require("./contentview.js"); var ValueEditor = require("../editor.js").ValueEditor; -var Headers = React.createClass({displayName: "Headers", +var Headers = React.createClass({ + displayName: "Headers", + propTypes: { onChange: React.PropTypes.func.isRequired, message: React.PropTypes.object.isRequired }, - onChange: function (row, col, val) { + onChange: function onChange(row, col, val) { var nextHeaders = _.cloneDeep(this.props.message.headers); nextHeaders[row][col] = val; if (!nextHeaders[row][0] && !nextHeaders[row][1]) { @@ -2002,16 +2279,16 @@ var Headers = React.createClass({displayName: "Headers", nextHeaders.splice(row, 1); // manually move selection target if this has been the last row. if (row === nextHeaders.length) { - this._nextSel = (row - 1) + "-value"; + this._nextSel = row - 1 + "-value"; } } } this.props.onChange(nextHeaders); }, - edit: function () { + edit: function edit() { this.refs["0-key"].focus(); }, - onTab: function (row, col, e) { + onTab: function onTab(row, col, e) { var headers = this.props.message.headers; if (row === headers.length - 1 && col === 1) { e.preventDefault(); @@ -2019,65 +2296,78 @@ var Headers = React.createClass({displayName: "Headers", var nextHeaders = _.cloneDeep(this.props.message.headers); nextHeaders.push(["Name", "Value"]); this.props.onChange(nextHeaders); - this._nextSel = (row + 1) + "-key"; + this._nextSel = row + 1 + "-key"; } }, - componentDidUpdate: function () { + componentDidUpdate: function componentDidUpdate() { if (this._nextSel && this.refs[this._nextSel]) { this.refs[this._nextSel].focus(); this._nextSel = undefined; } }, - onRemove: function (row, col, e) { + onRemove: function onRemove(row, col, e) { if (col === 1) { e.preventDefault(); this.refs[row + "-key"].focus(); } else if (row > 0) { e.preventDefault(); - this.refs[(row - 1) + "-value"].focus(); + this.refs[row - 1 + "-value"].focus(); } }, - render: function () { + render: function render() { - var rows = this.props.message.headers.map(function (header, i) { + var rows = this.props.message.headers.map((function (header, i) { var kEdit = React.createElement(HeaderEditor, { - ref: i + "-key", - content: header[0], - onDone: this.onChange.bind(null, i, 0), - onRemove: this.onRemove.bind(null, i, 0), - onTab: this.onTab.bind(null, i, 0)}); + ref: i + "-key", + content: header[0], + onDone: this.onChange.bind(null, i, 0), + onRemove: this.onRemove.bind(null, i, 0), + onTab: this.onTab.bind(null, i, 0) }); var vEdit = React.createElement(HeaderEditor, { - ref: i + "-value", - content: header[1], - onDone: this.onChange.bind(null, i, 1), - onRemove: this.onRemove.bind(null, i, 1), - onTab: this.onTab.bind(null, i, 1)}); - return ( - React.createElement("tr", {key: i}, - React.createElement("td", {className: "header-name"}, kEdit, ":"), - React.createElement("td", {className: "header-value"}, vEdit) + ref: i + "-value", + content: header[1], + onDone: this.onChange.bind(null, i, 1), + onRemove: this.onRemove.bind(null, i, 1), + onTab: this.onTab.bind(null, i, 1) }); + return React.createElement( + "tr", + { key: i }, + React.createElement( + "td", + { className: "header-name" }, + kEdit, + ":" + ), + React.createElement( + "td", + { className: "header-value" }, + vEdit ) ); - }.bind(this)); - return ( - React.createElement("table", {className: "header-table"}, - React.createElement("tbody", null, - rows - ) + }).bind(this)); + return React.createElement( + "table", + { className: "header-table" }, + React.createElement( + "tbody", + null, + rows ) ); } }); -var HeaderEditor = React.createClass({displayName: "HeaderEditor", - render: function () { - return React.createElement(ValueEditor, React.__spread({ref: "input"}, this.props, {onKeyDown: this.onKeyDown, inline: true})); +var HeaderEditor = React.createClass({ + displayName: "HeaderEditor", + + render: function render() { + return React.createElement(ValueEditor, _extends({ ref: "input" }, this.props, { onKeyDown: this.onKeyDown, inline: true })); }, - focus: function () { + focus: function focus() { this.getDOMNode().focus(); }, - onKeyDown: function (e) { + onKeyDown: function onKeyDown(e) { switch (e.keyCode) { case utils.Key.BACKSPACE: var s = window.getSelection().getRangeAt(0); @@ -2094,126 +2384,118 @@ var HeaderEditor = React.createClass({displayName: "HeaderEditor", } }); -var RequestLine = React.createClass({displayName: "RequestLine", - render: function () { +var RequestLine = React.createClass({ + displayName: "RequestLine", + + render: function render() { var flow = this.props.flow; var url = flowutils.RequestUtils.pretty_url(flow.request); - var httpver = "HTTP/" + flow.request.http_version.join("."); + var httpver = flow.request.http_version; - return React.createElement("div", {className: "first-line request-line"}, + return React.createElement( + "div", + { className: "first-line request-line" }, React.createElement(ValueEditor, { - ref: "method", - content: flow.request.method, - onDone: this.onMethodChange, - inline: true}), - "Â ", + ref: "method", + content: flow.request.method, + onDone: this.onMethodChange, + inline: true }), + "Â ", React.createElement(ValueEditor, { - ref: "url", - content: url, - onDone: this.onUrlChange, - isValid: this.isValidUrl, - inline: true}), - "Â ", + ref: "url", + content: url, + onDone: this.onUrlChange, + isValid: this.isValidUrl, + inline: true }), + "Â ", React.createElement(ValueEditor, { - ref: "httpVersion", - content: httpver, - onDone: this.onHttpVersionChange, - isValid: flowutils.isValidHttpVersion, - inline: true}) - ) - }, - isValidUrl: function (url) { + ref: "httpVersion", + content: httpver, + onDone: this.onHttpVersionChange, + isValid: flowutils.isValidHttpVersion, + inline: true }) + ); + }, + isValidUrl: function isValidUrl(url) { var u = flowutils.parseUrl(url); return !!u.host; }, - onMethodChange: function (nextMethod) { - actions.FlowActions.update( - this.props.flow, - {request: {method: nextMethod}} - ); + onMethodChange: function onMethodChange(nextMethod) { + actions.FlowActions.update(this.props.flow, { request: { method: nextMethod } }); }, - onUrlChange: function (nextUrl) { + onUrlChange: function onUrlChange(nextUrl) { var props = flowutils.parseUrl(nextUrl); props.path = props.path || ""; - actions.FlowActions.update( - this.props.flow, - {request: props} - ); + actions.FlowActions.update(this.props.flow, { request: props }); }, - onHttpVersionChange: function (nextVer) { + onHttpVersionChange: function onHttpVersionChange(nextVer) { var ver = flowutils.parseHttpVersion(nextVer); - actions.FlowActions.update( - this.props.flow, - {request: {http_version: ver}} - ); + actions.FlowActions.update(this.props.flow, { request: { http_version: ver } }); } }); -var ResponseLine = React.createClass({displayName: "ResponseLine", - render: function () { +var ResponseLine = React.createClass({ + displayName: "ResponseLine", + + render: function render() { var flow = this.props.flow; - var httpver = "HTTP/" + flow.response.http_version.join("."); - return React.createElement("div", {className: "first-line response-line"}, + var httpver = flow.response.http_version; + return React.createElement( + "div", + { className: "first-line response-line" }, React.createElement(ValueEditor, { - ref: "httpVersion", - content: httpver, - onDone: this.onHttpVersionChange, - isValid: flowutils.isValidHttpVersion, - inline: true}), - "Â ", + ref: "httpVersion", + content: httpver, + onDone: this.onHttpVersionChange, + isValid: flowutils.isValidHttpVersion, + inline: true }), + "Â ", React.createElement(ValueEditor, { - ref: "code", - content: flow.response.code + "", - onDone: this.onCodeChange, - isValid: this.isValidCode, - inline: true}), - "Â ", + ref: "code", + content: flow.response.status_code + "", + onDone: this.onCodeChange, + isValid: this.isValidCode, + inline: true }), + "Â ", React.createElement(ValueEditor, { - ref: "msg", - content: flow.response.msg, - onDone: this.onMsgChange, - inline: true}) + ref: "msg", + content: flow.response.msg, + onDone: this.onMsgChange, + inline: true }) ); }, - isValidCode: function (code) { - return /^\d+$/.test(code); + isValidCode: function isValidCode(code) { + return (/^\d+$/.test(code) + ); }, - onHttpVersionChange: function (nextVer) { + onHttpVersionChange: function onHttpVersionChange(nextVer) { var ver = flowutils.parseHttpVersion(nextVer); - actions.FlowActions.update( - this.props.flow, - {response: {httpversion: ver}} - ); + actions.FlowActions.update(this.props.flow, { response: { http_version: ver } }); }, - onMsgChange: function (nextMsg) { - actions.FlowActions.update( - this.props.flow, - {response: {msg: nextMsg}} - ); + onMsgChange: function onMsgChange(nextMsg) { + actions.FlowActions.update(this.props.flow, { response: { msg: nextMsg } }); }, - onCodeChange: function (nextCode) { + onCodeChange: function onCodeChange(nextCode) { nextCode = parseInt(nextCode); - actions.FlowActions.update( - this.props.flow, - {response: {code: nextCode}} - ); + actions.FlowActions.update(this.props.flow, { response: { code: nextCode } }); } }); -var Request = React.createClass({displayName: "Request", - render: function () { +var Request = React.createClass({ + displayName: "Request", + + render: function render() { var flow = this.props.flow; - return ( - React.createElement("section", {className: "request"}, - React.createElement(RequestLine, {ref: "requestLine", flow: flow}), - /*<ResponseLine flow={flow}/>*/ - React.createElement(Headers, {ref: "headers", message: flow.request, onChange: this.onHeaderChange}), - React.createElement("hr", null), - React.createElement(ContentView, {flow: flow, message: flow.request}) - ) + return React.createElement( + "section", + { className: "request" }, + React.createElement(RequestLine, { ref: "requestLine", flow: flow }), + React.createElement(Headers, { ref: "headers", message: flow.request, onChange: this.onHeaderChange }), + React.createElement("hr", null), + React.createElement(ContentView, { flow: flow, message: flow.request }) ); }, - edit: function (k) { + edit: function edit(k) { switch (k) { case "m": this.refs.requestLine.refs.method.focus(); @@ -2231,7 +2513,7 @@ var Request = React.createClass({displayName: "Request", throw "Unimplemented: " + k; } }, - onHeaderChange: function (nextHeaders) { + onHeaderChange: function onHeaderChange(nextHeaders) { actions.FlowActions.update(this.props.flow, { request: { headers: nextHeaders @@ -2240,23 +2522,24 @@ var Request = React.createClass({displayName: "Request", } }); -var Response = React.createClass({displayName: "Response", - render: function () { +var Response = React.createClass({ + displayName: "Response", + + render: function render() { var flow = this.props.flow; - return ( - React.createElement("section", {className: "response"}, - /*<RequestLine flow={flow}/>*/ - React.createElement(ResponseLine, {ref: "responseLine", flow: flow}), - React.createElement(Headers, {ref: "headers", message: flow.response, onChange: this.onHeaderChange}), - React.createElement("hr", null), - React.createElement(ContentView, {flow: flow, message: flow.response}) - ) + return React.createElement( + "section", + { className: "response" }, + React.createElement(ResponseLine, { ref: "responseLine", flow: flow }), + React.createElement(Headers, { ref: "headers", message: flow.response, onChange: this.onHeaderChange }), + React.createElement("hr", null), + React.createElement(ContentView, { flow: flow, message: flow.response }) ); }, - edit: function (k) { + edit: function edit(k) { switch (k) { case "c": - this.refs.responseLine.refs.code.focus(); + this.refs.responseLine.refs.status_code.focus(); break; case "m": this.refs.responseLine.refs.msg.focus(); @@ -2271,7 +2554,7 @@ var Response = React.createClass({displayName: "Response", throw "Unimplemented: " + k; } }, - onHeaderChange: function (nextHeaders) { + onHeaderChange: function onHeaderChange(nextHeaders) { actions.FlowActions.update(this.props.flow, { response: { headers: nextHeaders @@ -2280,15 +2563,25 @@ var Response = React.createClass({displayName: "Response", } }); -var Error = React.createClass({displayName: "Error", - render: function () { +var Error = React.createClass({ + displayName: "Error", + + render: function render() { var flow = this.props.flow; - return ( - React.createElement("section", null, - React.createElement("div", {className: "alert alert-warning"}, - flow.error.msg, - React.createElement("div", null, - React.createElement("small", null, utils.formatTimeStamp(flow.error.timestamp) ) + return React.createElement( + "section", + null, + React.createElement( + "div", + { className: "alert alert-warning" }, + flow.error.msg, + React.createElement( + "div", + null, + React.createElement( + "small", + null, + utils.formatTimeStamp(flow.error.timestamp) ) ) ) @@ -2301,92 +2594,122 @@ module.exports = { Response: Response, Error: Error }; +/*<ResponseLine flow={flow}/>*/ /*<RequestLine flow={flow}/>*/ + },{"../../actions.js":2,"../../flow/utils.js":23,"../../utils.js":26,"../common.js":4,"../editor.js":5,"./contentview.js":9,"lodash":"lodash","react":"react"}],13:[function(require,module,exports){ +"use strict"; + var React = require("react"); var actions = require("../../actions.js"); -var NavAction = React.createClass({displayName: "NavAction", - onClick: function (e) { +var NavAction = React.createClass({ + displayName: "NavAction", + + onClick: function onClick(e) { e.preventDefault(); this.props.onClick(); }, - render: function () { - return ( - React.createElement("a", {title: this.props.title, - href: "#", - className: "nav-action", - onClick: this.onClick}, - React.createElement("i", {className: "fa fa-fw " + this.props.icon}) - ) + render: function render() { + return React.createElement( + "a", + { title: this.props.title, + href: "#", + className: "nav-action", + onClick: this.onClick }, + React.createElement("i", { className: "fa fa-fw " + this.props.icon }) ); } }); -var Nav = React.createClass({displayName: "Nav", - render: function () { +var Nav = React.createClass({ + displayName: "Nav", + + render: function render() { var flow = this.props.flow; - var tabs = this.props.tabs.map(function (e) { + var tabs = this.props.tabs.map((function (e) { var str = e.charAt(0).toUpperCase() + e.slice(1); var className = this.props.active === e ? "active" : ""; - var onClick = function (event) { + var onClick = (function (event) { this.props.selectTab(e); event.preventDefault(); - }.bind(this); - return React.createElement("a", {key: e, - href: "#", - className: className, - onClick: onClick}, str); - }.bind(this)); + }).bind(this); + return React.createElement( + "a", + { key: e, + href: "#", + className: className, + onClick: onClick }, + str + ); + }).bind(this)); var acceptButton = null; - if(flow.intercepted){ - acceptButton = React.createElement(NavAction, {title: "[a]ccept intercepted flow", icon: "fa-play", onClick: actions.FlowActions.accept.bind(null, flow)}); + if (flow.intercepted) { + acceptButton = React.createElement(NavAction, { title: "[a]ccept intercepted flow", icon: "fa-play", onClick: actions.FlowActions.accept.bind(null, flow) }); } var revertButton = null; - if(flow.modified){ - revertButton = React.createElement(NavAction, {title: "revert changes to flow [V]", icon: "fa-history", onClick: actions.FlowActions.revert.bind(null, flow)}); - } - - return ( - React.createElement("nav", {ref: "head", className: "nav-tabs nav-tabs-sm"}, - tabs, - React.createElement(NavAction, {title: "[d]elete flow", icon: "fa-trash", onClick: actions.FlowActions.delete.bind(null, flow)}), - React.createElement(NavAction, {title: "[D]uplicate flow", icon: "fa-copy", onClick: actions.FlowActions.duplicate.bind(null, flow)}), - React.createElement(NavAction, {disabled: true, title: "[r]eplay flow", icon: "fa-repeat", onClick: actions.FlowActions.replay.bind(null, flow)}), - acceptButton, - revertButton - ) + if (flow.modified) { + revertButton = React.createElement(NavAction, { title: "revert changes to flow [V]", icon: "fa-history", onClick: actions.FlowActions.revert.bind(null, flow) }); + } + + return React.createElement( + "nav", + { ref: "head", className: "nav-tabs nav-tabs-sm" }, + tabs, + React.createElement(NavAction, { title: "[d]elete flow", icon: "fa-trash", onClick: actions.FlowActions["delete"].bind(null, flow) }), + React.createElement(NavAction, { title: "[D]uplicate flow", icon: "fa-copy", onClick: actions.FlowActions.duplicate.bind(null, flow) }), + React.createElement(NavAction, { disabled: true, title: "[r]eplay flow", icon: "fa-repeat", onClick: actions.FlowActions.replay.bind(null, flow) }), + acceptButton, + revertButton ); } }); module.exports = Nav; + },{"../../actions.js":2,"react":"react"}],14:[function(require,module,exports){ +"use strict"; + var React = require("react"); var common = require("./common.js"); -var Footer = React.createClass({displayName: "Footer", +var Footer = React.createClass({ + displayName: "Footer", + mixins: [common.SettingsState], - render: function () { + render: function render() { var mode = this.state.settings.mode; var intercept = this.state.settings.intercept; - return ( - React.createElement("footer", null, - mode && mode != "regular" ? React.createElement("span", {className: "label label-success"}, mode, " mode") : null, - "Â ", - intercept ? React.createElement("span", {className: "label label-success"}, "Intercept: ", intercept) : null - ) + return React.createElement( + "footer", + null, + mode && mode != "regular" ? React.createElement( + "span", + { className: "label label-success" }, + mode, + " mode" + ) : null, + "Â ", + intercept ? React.createElement( + "span", + { className: "label label-success" }, + "Intercept: ", + intercept + ) : null ); } }); module.exports = Footer; + },{"./common.js":4,"react":"react"}],15:[function(require,module,exports){ +"use strict"; + var React = require("react"); var $ = require("jquery"); @@ -2396,12 +2719,14 @@ var common = require("./common.js"); var actions = require("../actions.js"); var Query = require("../actions.js").Query; -var FilterDocs = React.createClass({displayName: "FilterDocs", +var FilterDocs = React.createClass({ + displayName: "FilterDocs", + statics: { xhr: false, doc: false }, - componentWillMount: function () { + componentWillMount: function componentWillMount() { if (!FilterDocs.doc) { FilterDocs.xhr = $.getJSON("/filter-help").done(function (doc) { FilterDocs.doc = doc; @@ -2409,38 +2734,63 @@ var FilterDocs = React.createClass({displayName: "FilterDocs", }); } if (FilterDocs.xhr) { - FilterDocs.xhr.done(function () { + FilterDocs.xhr.done((function () { this.forceUpdate(); - }.bind(this)); + }).bind(this)); } }, - render: function () { + render: function render() { if (!FilterDocs.doc) { - return React.createElement("i", {className: "fa fa-spinner fa-spin"}); + return React.createElement("i", { className: "fa fa-spinner fa-spin" }); } else { var commands = FilterDocs.doc.commands.map(function (c) { - return React.createElement("tr", {key: c[1]}, - React.createElement("td", null, c[0].replace(" ", '\u00a0')), - React.createElement("td", null, c[1]) + return React.createElement( + "tr", + { key: c[1] }, + React.createElement( + "td", + null, + c[0].replace(" ", "Â ") + ), + React.createElement( + "td", + null, + c[1] + ) ); }); - commands.push(React.createElement("tr", {key: "docs-link"}, - React.createElement("td", {colSpan: "2"}, - React.createElement("a", {href: "https://mitmproxy.org/doc/features/filters.html", - target: "_blank"}, - React.createElement("i", {className: "fa fa-external-link"}), - "Â mitmproxy docs") + commands.push(React.createElement( + "tr", + { key: "docs-link" }, + React.createElement( + "td", + { colSpan: "2" }, + React.createElement( + "a", + { href: "https://mitmproxy.org/doc/features/filters.html", + target: "_blank" }, + React.createElement("i", { className: "fa fa-external-link" }), + "Â mitmproxy docs" + ) ) )); - return React.createElement("table", {className: "table table-condensed"}, - React.createElement("tbody", null, commands) + return React.createElement( + "table", + { className: "table table-condensed" }, + React.createElement( + "tbody", + null, + commands + ) ); } } }); -var FilterInput = React.createClass({displayName: "FilterInput", +var FilterInput = React.createClass({ + displayName: "FilterInput", + mixins: [common.ChildFocus], - getInitialState: function () { + getInitialState: function getInitialState() { // Consider both focus and mouseover for showing/hiding the tooltip, // because onBlur of the input is triggered before the click on the tooltip // finalized, hiding the tooltip just as the user clicks on it. @@ -2450,10 +2800,10 @@ var FilterInput = React.createClass({displayName: "FilterInput", mousefocus: false }; }, - componentWillReceiveProps: function (nextProps) { - this.setState({value: nextProps.value}); + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { + this.setState({ value: nextProps.value }); }, - onChange: function (e) { + onChange: function onChange(e) { var nextValue = e.target.value; this.setState({ value: nextValue @@ -2463,7 +2813,7 @@ var FilterInput = React.createClass({displayName: "FilterInput", this.props.onChange(nextValue); } }, - isValid: function (filt) { + isValid: function isValid(filt) { try { Filt.parse(filt || this.state.value); return true; @@ -2471,7 +2821,7 @@ var FilterInput = React.createClass({displayName: "FilterInput", return false; } }, - getDesc: function () { + getDesc: function getDesc() { var desc; try { desc = Filt.parse(this.state.value).desc; @@ -2481,136 +2831,143 @@ var FilterInput = React.createClass({displayName: "FilterInput", if (desc !== "true") { return desc; } else { - return ( - React.createElement(FilterDocs, null) - ); + return React.createElement(FilterDocs, null); } }, - onFocus: function () { - this.setState({focus: true}); + onFocus: function onFocus() { + this.setState({ focus: true }); }, - onBlur: function () { - this.setState({focus: false}); + onBlur: function onBlur() { + this.setState({ focus: false }); }, - onMouseEnter: function () { - this.setState({mousefocus: true}); + onMouseEnter: function onMouseEnter() { + this.setState({ mousefocus: true }); }, - onMouseLeave: function () { - this.setState({mousefocus: false}); + onMouseLeave: function onMouseLeave() { + this.setState({ mousefocus: false }); }, - onKeyDown: function (e) { + onKeyDown: function onKeyDown(e) { if (e.keyCode === utils.Key.ESC || e.keyCode === utils.Key.ENTER) { this.blur(); // If closed using ESC/ENTER, hide the tooltip. - this.setState({mousefocus: false}); + this.setState({ mousefocus: false }); } e.stopPropagation(); }, - blur: function () { + blur: function blur() { this.refs.input.getDOMNode().blur(); this.returnFocus(); }, - select: function () { + select: function select() { this.refs.input.getDOMNode().select(); }, - render: function () { + render: function render() { var isValid = this.isValid(); var icon = "fa fa-fw fa-" + this.props.type; var groupClassName = "filter-input input-group" + (isValid ? "" : " has-error"); var popover; if (this.state.focus || this.state.mousefocus) { - popover = ( - React.createElement("div", {className: "popover bottom", onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave}, - React.createElement("div", {className: "arrow"}), - React.createElement("div", {className: "popover-content"}, + popover = React.createElement( + "div", + { className: "popover bottom", onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave }, + React.createElement("div", { className: "arrow" }), + React.createElement( + "div", + { className: "popover-content" }, this.getDesc() - ) ) ); } - return ( - React.createElement("div", {className: groupClassName}, - React.createElement("span", {className: "input-group-addon"}, - React.createElement("i", {className: icon, style: {color: this.props.color}}) - ), - React.createElement("input", {type: "text", placeholder: this.props.placeholder, className: "form-control", - ref: "input", - onChange: this.onChange, - onFocus: this.onFocus, - onBlur: this.onBlur, - onKeyDown: this.onKeyDown, - value: this.state.value}), - popover - ) + return React.createElement( + "div", + { className: groupClassName }, + React.createElement( + "span", + { className: "input-group-addon" }, + React.createElement("i", { className: icon, style: { color: this.props.color } }) + ), + React.createElement("input", { type: "text", placeholder: this.props.placeholder, className: "form-control", + ref: "input", + onChange: this.onChange, + onFocus: this.onFocus, + onBlur: this.onBlur, + onKeyDown: this.onKeyDown, + value: this.state.value }), + popover ); } }); -var MainMenu = React.createClass({displayName: "MainMenu", +var MainMenu = React.createClass({ + displayName: "MainMenu", + mixins: [common.Navigation, common.RouterState, common.SettingsState], statics: { title: "Start", route: "flows" }, - onSearchChange: function (val) { + onSearchChange: function onSearchChange(val) { var d = {}; d[Query.SEARCH] = val; this.setQuery(d); }, - onHighlightChange: function (val) { + onHighlightChange: function onHighlightChange(val) { var d = {}; d[Query.HIGHLIGHT] = val; this.setQuery(d); }, - onInterceptChange: function (val) { - actions.SettingsActions.update({intercept: val}); + onInterceptChange: function onInterceptChange(val) { + actions.SettingsActions.update({ intercept: val }); }, - render: function () { + render: function render() { var search = this.getQuery()[Query.SEARCH] || ""; var highlight = this.getQuery()[Query.HIGHLIGHT] || ""; var intercept = this.state.settings.intercept || ""; - return ( - React.createElement("div", null, - React.createElement("div", {className: "menu-row"}, - React.createElement(FilterInput, { - ref: "search", - placeholder: "Search", - type: "search", - color: "black", - value: search, - onChange: this.onSearchChange}), - React.createElement(FilterInput, { - ref: "highlight", - placeholder: "Highlight", - type: "tag", - color: "hsl(48, 100%, 50%)", - value: highlight, - onChange: this.onHighlightChange}), - React.createElement(FilterInput, { - ref: "intercept", - placeholder: "Intercept", - type: "pause", - color: "hsl(208, 56%, 53%)", - value: intercept, - onChange: this.onInterceptChange}) - ), - React.createElement("div", {className: "clearfix"}) - ) + return React.createElement( + "div", + null, + React.createElement( + "div", + { className: "menu-row" }, + React.createElement(FilterInput, { + ref: "search", + placeholder: "Search", + type: "search", + color: "black", + value: search, + onChange: this.onSearchChange }), + React.createElement(FilterInput, { + ref: "highlight", + placeholder: "Highlight", + type: "tag", + color: "hsl(48, 100%, 50%)", + value: highlight, + onChange: this.onHighlightChange }), + React.createElement(FilterInput, { + ref: "intercept", + placeholder: "Intercept", + type: "pause", + color: "hsl(208, 56%, 53%)", + value: intercept, + onChange: this.onInterceptChange }) + ), + React.createElement("div", { className: "clearfix" }) ); } }); +var ViewMenu = React.createClass({ + displayName: "ViewMenu", -var ViewMenu = React.createClass({displayName: "ViewMenu", statics: { title: "View", route: "flows" }, mixins: [common.Navigation, common.RouterState], - toggleEventLog: function () { + toggleEventLog: function toggleEventLog() { var d = {}; if (this.getQuery()[Query.SHOW_EVENTLOG]) { @@ -2621,46 +2978,59 @@ var ViewMenu = React.createClass({displayName: "ViewMenu", this.setQuery(d); }, - render: function () { + render: function render() { var showEventLog = this.getQuery()[Query.SHOW_EVENTLOG]; - return ( - React.createElement("div", null, - React.createElement("button", { - className: "btn " + (showEventLog ? "btn-primary" : "btn-default"), - onClick: this.toggleEventLog}, - React.createElement("i", {className: "fa fa-database"}), + return React.createElement( + "div", + null, + React.createElement( + "button", + { + className: "btn " + (showEventLog ? "btn-primary" : "btn-default"), + onClick: this.toggleEventLog }, + React.createElement("i", { className: "fa fa-database" }), "Â Show Eventlog" - ), - React.createElement("span", null, " ") + ), + React.createElement( + "span", + null, + " " ) ); } }); +var ReportsMenu = React.createClass({ + displayName: "ReportsMenu", -var ReportsMenu = React.createClass({displayName: "ReportsMenu", statics: { title: "Visualization", route: "reports" }, - render: function () { - return React.createElement("div", null, "Reports Menu"); + render: function render() { + return React.createElement( + "div", + null, + "Reports Menu" + ); } }); -var FileMenu = React.createClass({displayName: "FileMenu", - getInitialState: function () { +var FileMenu = React.createClass({ + displayName: "FileMenu", + + getInitialState: function getInitialState() { return { showFileMenu: false }; }, - handleFileClick: function (e) { + handleFileClick: function handleFileClick(e) { e.preventDefault(); if (!this.state.showFileMenu) { - var close = function () { - this.setState({showFileMenu: false}); + var close = (function () { + this.setState({ showFileMenu: false }); document.removeEventListener("click", close); - }.bind(this); + }).bind(this); document.addEventListener("click", close); this.setState({ @@ -2668,126 +3038,146 @@ var FileMenu = React.createClass({displayName: "FileMenu", }); } }, - handleNewClick: function (e) { + handleNewClick: function handleNewClick(e) { e.preventDefault(); if (confirm("Delete all flows?")) { actions.FlowActions.clear(); } }, - handleOpenClick: function (e) { + handleOpenClick: function handleOpenClick(e) { e.preventDefault(); console.error("unimplemented: handleOpenClick"); }, - handleSaveClick: function (e) { + handleSaveClick: function handleSaveClick(e) { e.preventDefault(); console.error("unimplemented: handleSaveClick"); }, - handleShutdownClick: function (e) { + handleShutdownClick: function handleShutdownClick(e) { e.preventDefault(); console.error("unimplemented: handleShutdownClick"); }, - render: function () { + render: function render() { var fileMenuClass = "dropdown pull-left" + (this.state.showFileMenu ? " open" : ""); - return ( - React.createElement("div", {className: fileMenuClass}, - React.createElement("a", {href: "#", className: "special", onClick: this.handleFileClick}, " mitmproxy "), - React.createElement("ul", {className: "dropdown-menu", role: "menu"}, - React.createElement("li", null, - React.createElement("a", {href: "#", onClick: this.handleNewClick}, - React.createElement("i", {className: "fa fa-fw fa-file"}), - "New" - ) - ), - React.createElement("li", {role: "presentation", className: "divider"}), - React.createElement("li", null, - React.createElement("a", {href: "http://mitm.it/", target: "_blank"}, - React.createElement("i", {className: "fa fa-fw fa-external-link"}), - "Install Certificates..." - ) + return React.createElement( + "div", + { className: fileMenuClass }, + React.createElement( + "a", + { href: "#", className: "special", onClick: this.handleFileClick }, + " mitmproxy " + ), + React.createElement( + "ul", + { className: "dropdown-menu", role: "menu" }, + React.createElement( + "li", + null, + React.createElement( + "a", + { href: "#", onClick: this.handleNewClick }, + React.createElement("i", { className: "fa fa-fw fa-file" }), + "New" + ) + ), + React.createElement("li", { role: "presentation", className: "divider" }), + React.createElement( + "li", + null, + React.createElement( + "a", + { href: "http://mitm.it/", target: "_blank" }, + React.createElement("i", { className: "fa fa-fw fa-external-link" }), + "Install Certificates..." ) - /* - <li> - <a href="#" onClick={this.handleOpenClick}> - <i className="fa fa-fw fa-folder-open"></i> - Open - </a> - </li> - <li> - <a href="#" onClick={this.handleSaveClick}> - <i className="fa fa-fw fa-save"></i> - Save - </a> - </li> - <li role="presentation" className="divider"></li> - <li> - <a href="#" onClick={this.handleShutdownClick}> - <i className="fa fa-fw fa-plug"></i> - Shutdown - </a> - </li> - */ ) ) ); } }); - var header_entries = [MainMenu, ViewMenu /*, ReportsMenu */]; +var Header = React.createClass({ + displayName: "Header", -var Header = React.createClass({displayName: "Header", mixins: [common.Navigation], - getInitialState: function () { + getInitialState: function getInitialState() { return { active: header_entries[0] }; }, - handleClick: function (active, e) { + handleClick: function handleClick(active, e) { e.preventDefault(); this.replaceWith(active.route); - this.setState({active: active}); + this.setState({ active: active }); }, - render: function () { - var header = header_entries.map(function (entry, i) { + render: function render() { + var header = header_entries.map((function (entry, i) { var className; if (entry === this.state.active) { className = "active"; } else { className = ""; } - return ( - React.createElement("a", {key: i, - href: "#", - className: className, - onClick: this.handleClick.bind(this, entry)}, - entry.title - ) + return React.createElement( + "a", + { key: i, + href: "#", + className: className, + onClick: this.handleClick.bind(this, entry) }, + entry.title ); - }.bind(this)); - - return ( - React.createElement("header", null, - React.createElement("nav", {className: "nav-tabs nav-tabs-lg"}, - React.createElement(FileMenu, null), - header - ), - React.createElement("div", {className: "menu"}, - React.createElement(this.state.active, {ref: "active"}) - ) + }).bind(this)); + + return React.createElement( + "header", + null, + React.createElement( + "nav", + { className: "nav-tabs nav-tabs-lg" }, + React.createElement(FileMenu, null), + header + ), + React.createElement( + "div", + { className: "menu" }, + React.createElement(this.state.active, { ref: "active" }) ) ); } }); - module.exports = { Header: Header, MainMenu: MainMenu }; +/* +<li> +<a href="#" onClick={this.handleOpenClick}> +<i className="fa fa-fw fa-folder-open"></i> +Open +</a> +</li> +<li> +<a href="#" onClick={this.handleSaveClick}> +<i className="fa fa-fw fa-save"></i> +Save +</a> +</li> +<li role="presentation" className="divider"></li> +<li> +<a href="#" onClick={this.handleShutdownClick}> +<i className="fa fa-fw fa-plug"></i> +Shutdown +</a> +</li> +*/ + },{"../actions.js":2,"../filt/filt.js":22,"../utils.js":26,"./common.js":4,"jquery":"jquery","react":"react"}],16:[function(require,module,exports){ +"use strict"; + var React = require("react"); var actions = require("../actions.js"); @@ -2800,20 +3190,22 @@ var common = require("./common.js"); var FlowTable = require("./flowtable.js"); var FlowView = require("./flowview/index.js"); -var MainView = React.createClass({displayName: "MainView", +var MainView = React.createClass({ + displayName: "MainView", + mixins: [common.Navigation, common.RouterState], contextTypes: { - flowStore: React.PropTypes.object.isRequired, + flowStore: React.PropTypes.object.isRequired }, childContextTypes: { - view: React.PropTypes.object.isRequired, + view: React.PropTypes.object.isRequired }, - getChildContext: function () { + getChildContext: function getChildContext() { return { view: this.state.view }; }, - getInitialState: function () { + getInitialState: function getInitialState() { var sortKeyFun = false; var view = new views.StoreView(this.context.flowStore, this.getViewFilt(), sortKeyFun); view.addListener("recalculate", this.onRecalculate); @@ -2827,10 +3219,10 @@ var MainView = React.createClass({displayName: "MainView", sortKeyFun: sortKeyFun }; }, - componentWillUnmount: function () { + componentWillUnmount: function componentWillUnmount() { this.state.view.close(); }, - getViewFilt: function () { + getViewFilt: function getViewFilt() { try { var filt = Filt.parse(this.getQuery()[Query.SEARCH] || ""); var highlightStr = this.getQuery()[Query.HIGHLIGHT]; @@ -2847,52 +3239,49 @@ var MainView = React.createClass({displayName: "MainView", return filt(flow); }; }, - componentWillReceiveProps: function (nextProps) { - var filterChanged = (this.props.query[Query.SEARCH] !== nextProps.query[Query.SEARCH]); - var highlightChanged = (this.props.query[Query.HIGHLIGHT] !== nextProps.query[Query.HIGHLIGHT]); + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { + var filterChanged = this.props.query[Query.SEARCH] !== nextProps.query[Query.SEARCH]; + var highlightChanged = this.props.query[Query.HIGHLIGHT] !== nextProps.query[Query.HIGHLIGHT]; if (filterChanged || highlightChanged) { this.state.view.recalculate(this.getViewFilt(), this.state.sortKeyFun); } }, - onRecalculate: function () { + onRecalculate: function onRecalculate() { this.forceUpdate(); var selected = this.getSelected(); if (selected) { this.refs.flowTable.scrollIntoView(selected); } }, - onUpdate: function (flow) { + onUpdate: function onUpdate(flow) { if (flow.id === this.getParams().flowId) { this.forceUpdate(); } }, - onRemove: function (flow_id, index) { + onRemove: function onRemove(flow_id, index) { if (flow_id === this.getParams().flowId) { var flow_to_select = this.state.view.list[Math.min(index, this.state.view.list.length - 1)]; this.selectFlow(flow_to_select); } }, - setSortKeyFun: function (sortKeyFun) { + setSortKeyFun: function setSortKeyFun(sortKeyFun) { this.setState({ sortKeyFun: sortKeyFun }); this.state.view.recalculate(this.getViewFilt(), sortKeyFun); }, - selectFlow: function (flow) { + selectFlow: function selectFlow(flow) { if (flow) { - this.replaceWith( - "flow", - { - flowId: flow.id, - detailTab: this.getParams().detailTab || "request" - } - ); + this.replaceWith("flow", { + flowId: flow.id, + detailTab: this.getParams().detailTab || "request" + }); this.refs.flowTable.scrollIntoView(flow); } else { this.replaceWith("flows", {}); } }, - selectFlowRelative: function (shift) { + selectFlowRelative: function selectFlowRelative(shift) { var flows = this.state.view.list; var index; if (!this.getParams().flowId) { @@ -2910,13 +3299,11 @@ var MainView = React.createClass({displayName: "MainView", break; } } - index = Math.min( - Math.max(0, index + shift), - flows.length - 1); + index = Math.min(Math.max(0, index + shift), flows.length - 1); } this.selectFlow(flows[index]); }, - onMainKeyDown: function (e) { + onMainKeyDown: function onMainKeyDown(e) { var flow = this.getSelected(); if (e.ctrlKey) { return; @@ -2969,7 +3356,7 @@ var MainView = React.createClass({displayName: "MainView", if (e.shiftKey) { actions.FlowActions.duplicate(flow); } else { - actions.FlowActions.delete(flow); + actions.FlowActions["delete"](flow); } } break; @@ -3003,30 +3390,27 @@ var MainView = React.createClass({displayName: "MainView", } e.preventDefault(); }, - getSelected: function () { + getSelected: function getSelected() { return this.context.flowStore.get(this.getParams().flowId); }, - render: function () { + render: function render() { var selected = this.getSelected(); var details; if (selected) { - details = [ - React.createElement(common.Splitter, {key: "splitter"}), - React.createElement(FlowView, {key: "flowDetails", ref: "flowDetails", flow: selected}) - ]; + details = [React.createElement(common.Splitter, { key: "splitter" }), React.createElement(FlowView, { key: "flowDetails", ref: "flowDetails", flow: selected })]; } else { details = null; } - return ( - React.createElement("div", {className: "main-view"}, - React.createElement(FlowTable, {ref: "flowTable", - selectFlow: this.selectFlow, - setSortKeyFun: this.setSortKeyFun, - selected: selected}), - details - ) + return React.createElement( + "div", + { className: "main-view" }, + React.createElement(FlowTable, { ref: "flowTable", + selectFlow: this.selectFlow, + setSortKeyFun: this.setSortKeyFun, + selected: selected }), + details ); } }); @@ -3035,23 +3419,27 @@ module.exports = MainView; },{"../actions.js":2,"../filt/filt.js":22,"../store/view.js":25,"../utils.js":26,"./common.js":4,"./flowtable.js":8,"./flowview/index.js":11,"react":"react"}],17:[function(require,module,exports){ +"use strict"; + var React = require("react"); var _ = require("lodash"); var utils = require("../utils.js"); var common = require("./common.js"); -var Prompt = React.createClass({displayName: "Prompt", +var Prompt = React.createClass({ + displayName: "Prompt", + mixins: [common.ChildFocus], propTypes: { options: React.PropTypes.array.isRequired, done: React.PropTypes.func.isRequired, prompt: React.PropTypes.string }, - componentDidMount: function () { + componentDidMount: function componentDidMount() { React.findDOMNode(this).focus(); }, - onKeyDown: function (e) { + onKeyDown: function onKeyDown(e) { e.stopPropagation(); e.preventDefault(); var opts = this.getOptions(); @@ -3066,17 +3454,17 @@ var Prompt = React.createClass({displayName: "Prompt", this.done(false); } }, - onClick: function (e) { + onClick: function onClick(e) { this.done(false); }, - done: function (ret) { + done: function done(ret) { this.props.done(ret); this.returnFocus(); }, - getOptions: function () { + getOptions: function getOptions() { var opts = []; - var keyTaken = function (k) { + var keyTaken = function keyTaken(k) { return _.includes(_.pluck(opts, "key"), k); }; @@ -3100,35 +3488,49 @@ var Prompt = React.createClass({displayName: "Prompt", } return opts; }, - render: function () { + render: function render() { var opts = this.getOptions(); - opts = _.map(opts, function (o) { + opts = _.map(opts, (function (o) { var prefix, suffix; var idx = o.text.indexOf(o.key); if (idx !== -1) { prefix = o.text.substring(0, idx); suffix = o.text.substring(idx + 1); - } else { prefix = o.text + " ("; suffix = ")"; } - var onClick = function (e) { + var onClick = (function (e) { this.done(o.key); e.stopPropagation(); - }.bind(this); - return React.createElement("span", { - key: o.key, - className: "option", - onClick: onClick}, - prefix, - React.createElement("strong", {className: "text-primary"}, o.key), suffix + }).bind(this); + return React.createElement( + "span", + { + key: o.key, + className: "option", + onClick: onClick }, + prefix, + React.createElement( + "strong", + { className: "text-primary" }, + o.key + ), + suffix ); - }.bind(this)); - return React.createElement("div", {tabIndex: "0", onKeyDown: this.onKeyDown, onClick: this.onClick, className: "prompt-dialog"}, - React.createElement("div", {className: "prompt-content"}, - this.props.prompt || React.createElement("strong", null, "Select: "), - opts + }).bind(this)); + return React.createElement( + "div", + { tabIndex: "0", onKeyDown: this.onKeyDown, onClick: this.onClick, className: "prompt-dialog" }, + React.createElement( + "div", + { className: "prompt-content" }, + this.props.prompt || React.createElement( + "strong", + null, + "Select: " + ), + opts ) ); } @@ -3136,7 +3538,10 @@ var Prompt = React.createClass({displayName: "Prompt", module.exports = Prompt; + },{"../utils.js":26,"./common.js":4,"lodash":"lodash","react":"react"}],18:[function(require,module,exports){ +"use strict"; + var React = require("react"); var ReactRouter = require("react-router"); var _ = require("lodash"); @@ -3150,35 +3555,41 @@ var store = require("../store/store.js"); var Query = require("../actions.js").Query; var Key = require("../utils.js").Key; - //TODO: Move out of here, just a stub. -var Reports = React.createClass({displayName: "Reports", - render: function () { - return React.createElement("div", null, "ReportEditor"); +var Reports = React.createClass({ + displayName: "Reports", + + render: function render() { + return React.createElement( + "div", + null, + "ReportEditor" + ); } }); +var ProxyAppMain = React.createClass({ + displayName: "ProxyAppMain", -var ProxyAppMain = React.createClass({displayName: "ProxyAppMain", mixins: [common.RouterState], childContextTypes: { settingsStore: React.PropTypes.object.isRequired, flowStore: React.PropTypes.object.isRequired, eventStore: React.PropTypes.object.isRequired, - returnFocus: React.PropTypes.func.isRequired, + returnFocus: React.PropTypes.func.isRequired }, - componentDidMount: function () { + componentDidMount: function componentDidMount() { this.focus(); }, - getChildContext: function () { + getChildContext: function getChildContext() { return { settingsStore: this.state.settingsStore, flowStore: this.state.flowStore, eventStore: this.state.eventStore, - returnFocus: this.focus, + returnFocus: this.focus }; }, - getInitialState: function () { + getInitialState: function getInitialState() { var eventStore = new store.EventLogStore(); var flowStore = new store.FlowStore(); var settingsStore = new store.SettingsStore(); @@ -3191,20 +3602,20 @@ var ProxyAppMain = React.createClass({displayName: "ProxyAppMain", eventStore: eventStore }; }, - focus: function () { + focus: function focus() { React.findDOMNode(this).focus(); }, - getMainComponent: function () { + getMainComponent: function getMainComponent() { return this.refs.view.refs.__routeHandler__; }, - onKeydown: function (e) { + onKeydown: function onKeydown(e) { - var selectFilterInput = function (name) { + var selectFilterInput = (function (name) { var headerComponent = this.refs.header; - headerComponent.setState({active: header.MainMenu}, function () { + headerComponent.setState({ active: header.MainMenu }, function () { headerComponent.refs.active.refs[name].select(); }); - }.bind(this); + }).bind(this); switch (e.keyCode) { case Key.I: @@ -3225,94 +3636,92 @@ var ProxyAppMain = React.createClass({displayName: "ProxyAppMain", } e.preventDefault(); }, - render: function () { + render: function render() { var eventlog; if (this.getQuery()[Query.SHOW_EVENTLOG]) { - eventlog = [ - React.createElement(common.Splitter, {key: "splitter", axis: "y"}), - React.createElement(EventLog, {key: "eventlog"}) - ]; + eventlog = [React.createElement(common.Splitter, { key: "splitter", axis: "y" }), React.createElement(EventLog, { key: "eventlog" })]; } else { eventlog = null; } - return ( - React.createElement("div", {id: "container", tabIndex: "0", onKeyDown: this.onKeydown}, - React.createElement(header.Header, {ref: "header"}), - React.createElement(RouteHandler, {ref: "view", query: this.getQuery()}), - eventlog, - React.createElement(Footer, null) - ) + return React.createElement( + "div", + { id: "container", tabIndex: "0", onKeyDown: this.onKeydown }, + React.createElement(header.Header, { ref: "header" }), + React.createElement(RouteHandler, { ref: "view", query: this.getQuery() }), + eventlog, + React.createElement(Footer, null) ); } }); - var Route = ReactRouter.Route; var RouteHandler = ReactRouter.RouteHandler; var Redirect = ReactRouter.Redirect; var DefaultRoute = ReactRouter.DefaultRoute; var NotFoundRoute = ReactRouter.NotFoundRoute; - -var routes = ( - React.createElement(Route, {path: "/", handler: ProxyAppMain}, - React.createElement(Route, {name: "flows", path: "flows", handler: MainView}), - React.createElement(Route, {name: "flow", path: "flows/:flowId/:detailTab", handler: MainView}), - React.createElement(Route, {name: "reports", handler: Reports}), - React.createElement(Redirect, {path: "/", to: "flows"}) - ) +var routes = React.createElement( + Route, + { path: "/", handler: ProxyAppMain }, + React.createElement(Route, { name: "flows", path: "flows", handler: MainView }), + React.createElement(Route, { name: "flow", path: "flows/:flowId/:detailTab", handler: MainView }), + React.createElement(Route, { name: "reports", handler: Reports }), + React.createElement(Redirect, { path: "/", to: "flows" }) ); module.exports = { routes: routes }; + },{"../actions.js":2,"../store/store.js":24,"../utils.js":26,"./common.js":4,"./eventlog.js":6,"./footer.js":14,"./header.js":15,"./mainview.js":16,"lodash":"lodash","react":"react","react-router":"react-router"}],19:[function(require,module,exports){ +"use strict"; + var React = require("react"); var VirtualScrollMixin = { - getInitialState: function () { + getInitialState: function getInitialState() { return { start: 0, stop: 0 }; }, - componentWillMount: function () { + componentWillMount: function componentWillMount() { if (!this.props.rowHeight) { console.warn("VirtualScrollMixin: No rowHeight specified", this); } }, - getPlaceholderTop: function (total) { + getPlaceholderTop: function getPlaceholderTop(total) { var Tag = this.props.placeholderTagName || "tr"; // When a large trunk of elements is removed from the button, start may be far off the viewport. // To make this issue less severe, limit the top placeholder to the total number of rows. var style = { height: Math.min(this.state.start, total) * this.props.rowHeight }; - var spacer = React.createElement(Tag, {key: "placeholder-top", style: style}); + var spacer = React.createElement(Tag, { key: "placeholder-top", style: style }); if (this.state.start % 2 === 1) { // fix even/odd rows - return [spacer, React.createElement(Tag, {key: "placeholder-top-2"})]; + return [spacer, React.createElement(Tag, { key: "placeholder-top-2" })]; } else { return spacer; } }, - getPlaceholderBottom: function (total) { + getPlaceholderBottom: function getPlaceholderBottom(total) { var Tag = this.props.placeholderTagName || "tr"; var style = { height: Math.max(0, total - this.state.stop) * this.props.rowHeight }; - return React.createElement(Tag, {key: "placeholder-bottom", style: style}); + return React.createElement(Tag, { key: "placeholder-bottom", style: style }); }, - componentDidMount: function () { + componentDidMount: function componentDidMount() { this.onScroll(); window.addEventListener('resize', this.onScroll); }, - componentWillUnmount: function(){ + componentWillUnmount: function componentWillUnmount() { window.removeEventListener('resize', this.onScroll); }, - onScroll: function () { + onScroll: function onScroll() { var viewport = this.getDOMNode(); var top = viewport.scrollTop; var height = viewport.offsetHeight; @@ -3324,7 +3733,7 @@ var VirtualScrollMixin = { stop: stop }); }, - renderRows: function (elems) { + renderRows: function renderRows(elems) { var rows = []; var max = Math.min(elems.length, this.state.stop); @@ -3334,9 +3743,9 @@ var VirtualScrollMixin = { } return rows; }, - scrollRowIntoView: function (index, head_height) { + scrollRowIntoView: function scrollRowIntoView(index, head_height) { - var row_top = (index * this.props.rowHeight) + head_height; + var row_top = index * this.props.rowHeight + head_height; var row_bottom = row_top + this.props.rowHeight; var viewport = this.getDOMNode(); @@ -3349,12 +3758,14 @@ var VirtualScrollMixin = { } else if (row_bottom > viewport_bottom) { viewport.scrollTop = row_bottom - viewport.offsetHeight; } - }, + } }; -module.exports = VirtualScrollMixin; +module.exports = VirtualScrollMixin; + },{"react":"react"}],20:[function(require,module,exports){ +"use strict"; var actions = require("./actions.js"); var AppDispatcher = require("./dispatcher.js").AppDispatcher; @@ -3385,16 +3796,17 @@ function Connection(url) { module.exports = Connection; + },{"./actions.js":2,"./dispatcher.js":21}],21:[function(require,module,exports){ +"use strict"; var flux = require("flux"); -const PayloadSources = { +var PayloadSources = { VIEW: "view", SERVER: "server" }; - var AppDispatcher = new flux.Dispatcher(); AppDispatcher.dispatchViewAction = function (action) { action.source = PayloadSources.VIEW; @@ -3409,8 +3821,11 @@ module.exports = { AppDispatcher: AppDispatcher }; + },{"flux":"flux"}],22:[function(require,module,exports){ -module.exports = (function() { +"use strict"; + +module.exports = (function () { /* * Generated by PEG.js 0.8.0. * @@ -3418,37 +3833,40 @@ module.exports = (function() { */ function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } + function ctor() { + this.constructor = child; + } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function SyntaxError(message, expected, found, offset, line, column) { - this.message = message; + this.message = message; this.expected = expected; - this.found = found; - this.offset = offset; - this.line = line; - this.column = column; + this.found = found; + this.offset = offset; + this.line = line; + this.column = column; - this.name = "SyntaxError"; + this.name = "SyntaxError"; } peg$subclass(SyntaxError, Error); function parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, - peg$FAILED = {}, - peg$startRuleFunctions = { start: peg$parsestart }, - peg$startRuleFunction = peg$parsestart, - + peg$startRuleFunction = peg$parsestart, peg$c0 = { type: "other", description: "filter expression" }, peg$c1 = peg$FAILED, - peg$c2 = function(orExpr) { return orExpr; }, + peg$c2 = function peg$c2(orExpr) { + return orExpr; + }, peg$c3 = [], - peg$c4 = function() {return trueFilter; }, + peg$c4 = function peg$c4() { + return trueFilter; + }, peg$c5 = { type: "other", description: "whitespace" }, peg$c6 = /^[ \t\n\r]/, peg$c7 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, @@ -3458,84 +3876,130 @@ module.exports = (function() { peg$c11 = { type: "other", description: "optional whitespace" }, peg$c12 = "|", peg$c13 = { type: "literal", value: "|", description: "\"|\"" }, - peg$c14 = function(first, second) { return or(first, second); }, + peg$c14 = function peg$c14(first, second) { + return or(first, second); + }, peg$c15 = "&", peg$c16 = { type: "literal", value: "&", description: "\"&\"" }, - peg$c17 = function(first, second) { return and(first, second); }, + peg$c17 = function peg$c17(first, second) { + return and(first, second); + }, peg$c18 = "!", peg$c19 = { type: "literal", value: "!", description: "\"!\"" }, - peg$c20 = function(expr) { return not(expr); }, + peg$c20 = function peg$c20(expr) { + return not(expr); + }, peg$c21 = "(", peg$c22 = { type: "literal", value: "(", description: "\"(\"" }, peg$c23 = ")", peg$c24 = { type: "literal", value: ")", description: "\")\"" }, - peg$c25 = function(expr) { return binding(expr); }, + peg$c25 = function peg$c25(expr) { + return binding(expr); + }, peg$c26 = "~a", peg$c27 = { type: "literal", value: "~a", description: "\"~a\"" }, - peg$c28 = function() { return assetFilter; }, + peg$c28 = function peg$c28() { + return assetFilter; + }, peg$c29 = "~e", peg$c30 = { type: "literal", value: "~e", description: "\"~e\"" }, - peg$c31 = function() { return errorFilter; }, + peg$c31 = function peg$c31() { + return errorFilter; + }, peg$c32 = "~q", peg$c33 = { type: "literal", value: "~q", description: "\"~q\"" }, - peg$c34 = function() { return noResponseFilter; }, + peg$c34 = function peg$c34() { + return noResponseFilter; + }, peg$c35 = "~s", peg$c36 = { type: "literal", value: "~s", description: "\"~s\"" }, - peg$c37 = function() { return responseFilter; }, + peg$c37 = function peg$c37() { + return responseFilter; + }, peg$c38 = "true", peg$c39 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c40 = function() { return trueFilter; }, + peg$c40 = function peg$c40() { + return trueFilter; + }, peg$c41 = "false", peg$c42 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c43 = function() { return falseFilter; }, + peg$c43 = function peg$c43() { + return falseFilter; + }, peg$c44 = "~c", peg$c45 = { type: "literal", value: "~c", description: "\"~c\"" }, - peg$c46 = function(s) { return responseCode(s); }, + peg$c46 = function peg$c46(s) { + return responseCode(s); + }, peg$c47 = "~d", peg$c48 = { type: "literal", value: "~d", description: "\"~d\"" }, - peg$c49 = function(s) { return domain(s); }, + peg$c49 = function peg$c49(s) { + return domain(s); + }, peg$c50 = "~h", peg$c51 = { type: "literal", value: "~h", description: "\"~h\"" }, - peg$c52 = function(s) { return header(s); }, + peg$c52 = function peg$c52(s) { + return header(s); + }, peg$c53 = "~hq", peg$c54 = { type: "literal", value: "~hq", description: "\"~hq\"" }, - peg$c55 = function(s) { return requestHeader(s); }, + peg$c55 = function peg$c55(s) { + return requestHeader(s); + }, peg$c56 = "~hs", peg$c57 = { type: "literal", value: "~hs", description: "\"~hs\"" }, - peg$c58 = function(s) { return responseHeader(s); }, + peg$c58 = function peg$c58(s) { + return responseHeader(s); + }, peg$c59 = "~m", peg$c60 = { type: "literal", value: "~m", description: "\"~m\"" }, - peg$c61 = function(s) { return method(s); }, + peg$c61 = function peg$c61(s) { + return method(s); + }, peg$c62 = "~t", peg$c63 = { type: "literal", value: "~t", description: "\"~t\"" }, - peg$c64 = function(s) { return contentType(s); }, + peg$c64 = function peg$c64(s) { + return contentType(s); + }, peg$c65 = "~tq", peg$c66 = { type: "literal", value: "~tq", description: "\"~tq\"" }, - peg$c67 = function(s) { return requestContentType(s); }, + peg$c67 = function peg$c67(s) { + return requestContentType(s); + }, peg$c68 = "~ts", peg$c69 = { type: "literal", value: "~ts", description: "\"~ts\"" }, - peg$c70 = function(s) { return responseContentType(s); }, + peg$c70 = function peg$c70(s) { + return responseContentType(s); + }, peg$c71 = "~u", peg$c72 = { type: "literal", value: "~u", description: "\"~u\"" }, - peg$c73 = function(s) { return url(s); }, + peg$c73 = function peg$c73(s) { + return url(s); + }, peg$c74 = { type: "other", description: "integer" }, peg$c75 = null, peg$c76 = /^['"]/, peg$c77 = { type: "class", value: "['\"]", description: "['\"]" }, peg$c78 = /^[0-9]/, peg$c79 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c80 = function(digits) { return parseInt(digits.join(""), 10); }, + peg$c80 = function peg$c80(digits) { + return parseInt(digits.join(""), 10); + }, peg$c81 = { type: "other", description: "string" }, peg$c82 = "\"", peg$c83 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c84 = function(chars) { return chars.join(""); }, + peg$c84 = function peg$c84(chars) { + return chars.join(""); + }, peg$c85 = "'", peg$c86 = { type: "literal", value: "'", description: "\"'\"" }, peg$c87 = void 0, peg$c88 = /^["\\]/, peg$c89 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, peg$c90 = { type: "any", description: "any character" }, - peg$c91 = function(char) { return char; }, + peg$c91 = function peg$c91(char) { + return char; + }, peg$c92 = "\\", peg$c93 = { type: "literal", value: "\\", description: "\"\\\\\"" }, peg$c94 = /^['\\]/, @@ -3544,22 +4008,26 @@ module.exports = (function() { peg$c97 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, peg$c98 = "n", peg$c99 = { type: "literal", value: "n", description: "\"n\"" }, - peg$c100 = function() { return "\n"; }, + peg$c100 = function peg$c100() { + return "\n"; + }, peg$c101 = "r", peg$c102 = { type: "literal", value: "r", description: "\"r\"" }, - peg$c103 = function() { return "\r"; }, + peg$c103 = function peg$c103() { + return "\r"; + }, peg$c104 = "t", peg$c105 = { type: "literal", value: "t", description: "\"t\"" }, - peg$c106 = function() { return "\t"; }, - - peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, + peg$c106 = function peg$c106() { + return "\t"; + }, + peg$currPos = 0, + peg$reportedPos = 0, + peg$cachedPos = 0, peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, peg$result; if ("startRule" in options) { @@ -3587,11 +4055,7 @@ module.exports = (function() { } function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - peg$reportedPos - ); + throw peg$buildException(null, [{ type: "other", description: description }], peg$reportedPos); } function error(message) { @@ -3605,7 +4069,9 @@ module.exports = (function() { for (p = startPos; p < endPos; p++) { ch = input.charAt(p); if (ch === "\n") { - if (!details.seenCR) { details.line++; } + if (!details.seenCR) { + details.line++; + } details.column = 1; details.seenCR = false; } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { @@ -3632,7 +4098,9 @@ module.exports = (function() { } function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } + if (peg$currPos < peg$maxFailPos) { + return; + } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; @@ -3646,7 +4114,7 @@ module.exports = (function() { function cleanupExpected(expected) { var i = 1; - expected.sort(function(a, b) { + expected.sort(function (a, b) { if (a.description < b.description) { return -1; } else if (a.description > b.description) { @@ -3667,34 +4135,31 @@ module.exports = (function() { function buildMessage(expected, found) { function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\x08/g, '\\b').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\f/g, '\\f').replace(/\r/g, '\\r').replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { + return '\\x0' + hex(ch); + }).replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { + return '\\x' + hex(ch); + }).replace(/[\u0180-\u0FFF]/g, function (ch) { + return "\\u0" + hex(ch); + }).replace(/[\u1080-\uFFFF]/g, function (ch) { + return "\\u" + hex(ch); + }); } var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; + expectedDesc, + foundDesc, + i; for (i = 0; i < expected.length; i++) { expectedDescs[i] = expected[i].description; } - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; + expectedDesc = expected.length > 1 ? expectedDescs.slice(0, -1).join(", ") + " or " + expectedDescs[expected.length - 1] : expectedDescs[0]; foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; @@ -3702,20 +4167,13 @@ module.exports = (function() { } var posDetails = peg$computePosDetails(pos), - found = pos < input.length ? input.charAt(pos) : null; + found = pos < input.length ? input.charAt(pos) : null; if (expected !== null) { cleanupExpected(expected); } - return new SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - pos, - posDetails.line, - posDetails.column - ); + return new SyntaxError(message !== null ? message : buildMessage(expected, found), expected, found, pos, posDetails.line, posDetails.column); } function peg$parsestart() { @@ -3756,7 +4214,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c0); } + if (peg$silentFails === 0) { + peg$fail(peg$c0); + } } return s0; @@ -3771,12 +4231,16 @@ module.exports = (function() { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { + peg$fail(peg$c7); + } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c5); } + if (peg$silentFails === 0) { + peg$fail(peg$c5); + } } return s0; @@ -3791,12 +4255,16 @@ module.exports = (function() { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } + if (peg$silentFails === 0) { + peg$fail(peg$c10); + } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { + peg$fail(peg$c8); + } } return s0; @@ -3815,7 +4283,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c11); } + if (peg$silentFails === 0) { + peg$fail(peg$c11); + } } return s0; @@ -3834,7 +4304,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { + peg$fail(peg$c13); + } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); @@ -3884,7 +4356,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { + peg$fail(peg$c16); + } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); @@ -3963,7 +4437,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { + peg$fail(peg$c19); + } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -4001,7 +4477,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c22); } + if (peg$silentFails === 0) { + peg$fail(peg$c22); + } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -4015,7 +4493,9 @@ module.exports = (function() { peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } + if (peg$silentFails === 0) { + peg$fail(peg$c24); + } } if (s5 !== peg$FAILED) { peg$reportedPos = s0; @@ -4070,7 +4550,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { + peg$fail(peg$c27); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4084,7 +4566,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (peg$silentFails === 0) { + peg$fail(peg$c30); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4098,7 +4582,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { + peg$fail(peg$c33); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4112,7 +4598,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { + peg$fail(peg$c36); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4136,7 +4624,9 @@ module.exports = (function() { peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } + if (peg$silentFails === 0) { + peg$fail(peg$c39); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4150,7 +4640,9 @@ module.exports = (function() { peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { + peg$fail(peg$c42); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4171,7 +4663,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { + peg$fail(peg$c45); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4209,7 +4703,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { + peg$fail(peg$c48); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4247,7 +4743,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { + peg$fail(peg$c51); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4285,7 +4783,9 @@ module.exports = (function() { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } + if (peg$silentFails === 0) { + peg$fail(peg$c54); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4323,7 +4823,9 @@ module.exports = (function() { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { + peg$fail(peg$c57); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4361,7 +4863,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { + peg$fail(peg$c60); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4399,7 +4903,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { + peg$fail(peg$c63); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4437,7 +4943,9 @@ module.exports = (function() { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + if (peg$silentFails === 0) { + peg$fail(peg$c66); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4475,7 +4983,9 @@ module.exports = (function() { peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } + if (peg$silentFails === 0) { + peg$fail(peg$c69); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4513,7 +5023,9 @@ module.exports = (function() { peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c72); } + if (peg$silentFails === 0) { + peg$fail(peg$c72); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4576,7 +5088,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c77); } + if (peg$silentFails === 0) { + peg$fail(peg$c77); + } } if (s1 === peg$FAILED) { s1 = peg$c75; @@ -4588,7 +5102,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { + peg$fail(peg$c79); + } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { @@ -4598,7 +5114,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { + peg$fail(peg$c79); + } } } } else { @@ -4610,7 +5128,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c77); } + if (peg$silentFails === 0) { + peg$fail(peg$c77); + } } if (s3 === peg$FAILED) { s3 = peg$c75; @@ -4634,7 +5154,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c74); } + if (peg$silentFails === 0) { + peg$fail(peg$c74); + } } return s0; @@ -4650,7 +5172,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { + peg$fail(peg$c83); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4665,7 +5189,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { + peg$fail(peg$c83); + } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; @@ -4690,7 +5216,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } + if (peg$silentFails === 0) { + peg$fail(peg$c86); + } } if (s1 !== peg$FAILED) { s2 = []; @@ -4705,7 +5233,9 @@ module.exports = (function() { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } + if (peg$silentFails === 0) { + peg$fail(peg$c86); + } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; @@ -4763,7 +5293,9 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { + peg$fail(peg$c81); + } } return s0; @@ -4780,7 +5312,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c89); } + if (peg$silentFails === 0) { + peg$fail(peg$c89); + } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -4795,7 +5329,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { + peg$fail(peg$c90); + } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; @@ -4816,7 +5352,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { + peg$fail(peg$c93); + } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); @@ -4848,7 +5386,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } + if (peg$silentFails === 0) { + peg$fail(peg$c95); + } } peg$silentFails--; if (s2 === peg$FAILED) { @@ -4863,7 +5403,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { + peg$fail(peg$c90); + } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; @@ -4884,7 +5426,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { + peg$fail(peg$c93); + } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); @@ -4925,7 +5469,9 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { + peg$fail(peg$c90); + } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; @@ -4951,7 +5497,9 @@ module.exports = (function() { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { + peg$fail(peg$c97); + } } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -4960,7 +5508,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } + if (peg$silentFails === 0) { + peg$fail(peg$c99); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4974,7 +5524,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c102); } + if (peg$silentFails === 0) { + peg$fail(peg$c102); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -4988,7 +5540,9 @@ module.exports = (function() { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } + if (peg$silentFails === 0) { + peg$fail(peg$c105); + } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; @@ -5002,170 +5556,153 @@ module.exports = (function() { return s0; } - var flowutils = require("../flow/utils.js"); function or(first, second) { - // Add explicit function names to ease debugging. - function orFilter() { - return first.apply(this, arguments) || second.apply(this, arguments); - } - orFilter.desc = first.desc + " or " + second.desc; - return orFilter; + // Add explicit function names to ease debugging. + function orFilter() { + return first.apply(this, arguments) || second.apply(this, arguments); + } + orFilter.desc = first.desc + " or " + second.desc; + return orFilter; } function and(first, second) { - function andFilter() { - return first.apply(this, arguments) && second.apply(this, arguments); - } - andFilter.desc = first.desc + " and " + second.desc; - return andFilter; + function andFilter() { + return first.apply(this, arguments) && second.apply(this, arguments); + } + andFilter.desc = first.desc + " and " + second.desc; + return andFilter; } function not(expr) { - function notFilter() { - return !expr.apply(this, arguments); - } - notFilter.desc = "not " + expr.desc; - return notFilter; + function notFilter() { + return !expr.apply(this, arguments); + } + notFilter.desc = "not " + expr.desc; + return notFilter; } function binding(expr) { - function bindingFilter() { - return expr.apply(this, arguments); - } - bindingFilter.desc = "(" + expr.desc + ")"; - return bindingFilter; + function bindingFilter() { + return expr.apply(this, arguments); + } + bindingFilter.desc = "(" + expr.desc + ")"; + return bindingFilter; } function trueFilter(flow) { - return true; + return true; } trueFilter.desc = "true"; function falseFilter(flow) { - return false; + return false; } falseFilter.desc = "false"; - var ASSET_TYPES = [ - new RegExp("text/javascript"), - new RegExp("application/x-javascript"), - new RegExp("application/javascript"), - new RegExp("text/css"), - new RegExp("image/.*"), - new RegExp("application/x-shockwave-flash") - ]; + var ASSET_TYPES = [new RegExp("text/javascript"), new RegExp("application/x-javascript"), new RegExp("application/javascript"), new RegExp("text/css"), new RegExp("image/.*"), new RegExp("application/x-shockwave-flash")]; function assetFilter(flow) { - if (flow.response) { - var ct = flowutils.ResponseUtils.getContentType(flow.response); - var i = ASSET_TYPES.length; - while (i--) { - if (ASSET_TYPES[i].test(ct)) { - return true; - } - } + if (flow.response) { + var ct = flowutils.ResponseUtils.getContentType(flow.response); + var i = ASSET_TYPES.length; + while (i--) { + if (ASSET_TYPES[i].test(ct)) { + return true; + } } - return false; + } + return false; } assetFilter.desc = "is asset"; - function responseCode(code){ - function responseCodeFilter(flow){ - return flow.response && flow.response.code === code; - } - responseCodeFilter.desc = "resp. code is " + code; - return responseCodeFilter; + function responseCode(code) { + function responseCodeFilter(flow) { + return flow.response && flow.response.status_code === code; + } + responseCodeFilter.desc = "resp. code is " + code; + return responseCodeFilter; } - function domain(regex){ - regex = new RegExp(regex, "i"); - function domainFilter(flow){ - return flow.request && regex.test(flow.request.host); - } - domainFilter.desc = "domain matches " + regex; - return domainFilter; + function domain(regex) { + regex = new RegExp(regex, "i"); + function domainFilter(flow) { + return flow.request && regex.test(flow.request.host); + } + domainFilter.desc = "domain matches " + regex; + return domainFilter; } - function errorFilter(flow){ - return !!flow.error; + function errorFilter(flow) { + return !!flow.error; } errorFilter.desc = "has error"; - function header(regex){ - regex = new RegExp(regex, "i"); - function headerFilter(flow){ - return ( - (flow.request && flowutils.RequestUtils.match_header(flow.request, regex)) - || - (flow.response && flowutils.ResponseUtils.match_header(flow.response, regex)) - ); - } - headerFilter.desc = "header matches " + regex; - return headerFilter; + function header(regex) { + regex = new RegExp(regex, "i"); + function headerFilter(flow) { + return flow.request && flowutils.RequestUtils.match_header(flow.request, regex) || flow.response && flowutils.ResponseUtils.match_header(flow.response, regex); + } + headerFilter.desc = "header matches " + regex; + return headerFilter; } - function requestHeader(regex){ - regex = new RegExp(regex, "i"); - function requestHeaderFilter(flow){ - return (flow.request && flowutils.RequestUtils.match_header(flow.request, regex)); - } - requestHeaderFilter.desc = "req. header matches " + regex; - return requestHeaderFilter; + function requestHeader(regex) { + regex = new RegExp(regex, "i"); + function requestHeaderFilter(flow) { + return flow.request && flowutils.RequestUtils.match_header(flow.request, regex); + } + requestHeaderFilter.desc = "req. header matches " + regex; + return requestHeaderFilter; } - function responseHeader(regex){ - regex = new RegExp(regex, "i"); - function responseHeaderFilter(flow){ - return (flow.response && flowutils.ResponseUtils.match_header(flow.response, regex)); - } - responseHeaderFilter.desc = "resp. header matches " + regex; - return responseHeaderFilter; + function responseHeader(regex) { + regex = new RegExp(regex, "i"); + function responseHeaderFilter(flow) { + return flow.response && flowutils.ResponseUtils.match_header(flow.response, regex); + } + responseHeaderFilter.desc = "resp. header matches " + regex; + return responseHeaderFilter; } - function method(regex){ - regex = new RegExp(regex, "i"); - function methodFilter(flow){ - return flow.request && regex.test(flow.request.method); - } - methodFilter.desc = "method matches " + regex; - return methodFilter; + function method(regex) { + regex = new RegExp(regex, "i"); + function methodFilter(flow) { + return flow.request && regex.test(flow.request.method); + } + methodFilter.desc = "method matches " + regex; + return methodFilter; } - function noResponseFilter(flow){ - return flow.request && !flow.response; + function noResponseFilter(flow) { + return flow.request && !flow.response; } noResponseFilter.desc = "has no response"; - function responseFilter(flow){ - return !!flow.response; + function responseFilter(flow) { + return !!flow.response; } responseFilter.desc = "has response"; - function contentType(regex){ - regex = new RegExp(regex, "i"); - function contentTypeFilter(flow){ - return ( - (flow.request && regex.test(flowutils.RequestUtils.getContentType(flow.request))) - || - (flow.response && regex.test(flowutils.ResponseUtils.getContentType(flow.response))) - ); - } - contentTypeFilter.desc = "content type matches " + regex; - return contentTypeFilter; + function contentType(regex) { + regex = new RegExp(regex, "i"); + function contentTypeFilter(flow) { + return flow.request && regex.test(flowutils.RequestUtils.getContentType(flow.request)) || flow.response && regex.test(flowutils.ResponseUtils.getContentType(flow.response)); + } + contentTypeFilter.desc = "content type matches " + regex; + return contentTypeFilter; } - function requestContentType(regex){ - regex = new RegExp(regex, "i"); - function requestContentTypeFilter(flow){ - return flow.request && regex.test(flowutils.RequestUtils.getContentType(flow.request)); - } - requestContentTypeFilter.desc = "req. content type matches " + regex; - return requestContentTypeFilter; + function requestContentType(regex) { + regex = new RegExp(regex, "i"); + function requestContentTypeFilter(flow) { + return flow.request && regex.test(flowutils.RequestUtils.getContentType(flow.request)); + } + requestContentTypeFilter.desc = "req. content type matches " + regex; + return requestContentTypeFilter; } - function responseContentType(regex){ - regex = new RegExp(regex, "i"); - function responseContentTypeFilter(flow){ - return flow.response && regex.test(flowutils.ResponseUtils.getContentType(flow.response)); - } - responseContentTypeFilter.desc = "resp. content type matches " + regex; - return responseContentTypeFilter; + function responseContentType(regex) { + regex = new RegExp(regex, "i"); + function responseContentTypeFilter(flow) { + return flow.response && regex.test(flowutils.ResponseUtils.getContentType(flow.response)); + } + responseContentTypeFilter.desc = "resp. content type matches " + regex; + return responseContentTypeFilter; } - function url(regex){ - regex = new RegExp(regex, "i"); - function urlFilter(flow){ - return flow.request && regex.test(flowutils.RequestUtils.pretty_url(flow.request)); - } - urlFilter.desc = "url matches " + regex; - return urlFilter; + function url(regex) { + regex = new RegExp(regex, "i"); + function urlFilter(flow) { + return flow.request && regex.test(flowutils.RequestUtils.pretty_url(flow.request)); + } + urlFilter.desc = "url matches " + regex; + return urlFilter; } - peg$result = peg$startRuleFunction(); if (peg$result !== peg$FAILED && peg$currPos === input.length) { @@ -5181,11 +5718,14 @@ module.exports = (function() { return { SyntaxError: SyntaxError, - parse: parse + parse: parse }; })(); + },{"../flow/utils.js":23}],23:[function(require,module,exports){ +"use strict"; + var _ = require("lodash"); var $ = require("jquery"); @@ -5195,21 +5735,20 @@ var defaultPorts = { }; var MessageUtils = { - getContentType: function (message) { + getContentType: function getContentType(message) { var ct = this.get_first_header(message, /^Content-Type$/i); - if(ct){ + if (ct) { return ct.split(";")[0].trim(); } }, - get_first_header: function (message, regex) { + get_first_header: function get_first_header(message, regex) { //FIXME: Cache Invalidation. - if (!message._headerLookups) - Object.defineProperty(message, "_headerLookups", { - value: {}, - configurable: false, - enumerable: false, - writable: false - }); + if (!message._headerLookups) Object.defineProperty(message, "_headerLookups", { + value: {}, + configurable: false, + enumerable: false, + writable: false + }); if (!(regex in message._headerLookups)) { var header; for (var i = 0; i < message.headers.length; i++) { @@ -5222,7 +5761,7 @@ var MessageUtils = { } return message._headerLookups[regex]; }, - match_header: function (message, regex) { + match_header: function match_header(message, regex) { var headers = message.headers; var i = headers.length; while (i--) { @@ -5232,7 +5771,7 @@ var MessageUtils = { } return false; }, - getContentURL: function (flow, message) { + getContentURL: function getContentURL(flow, message) { if (message === flow.request) { message = "request"; } else if (message === flow.response) { @@ -5240,18 +5779,18 @@ var MessageUtils = { } return "/flows/" + flow.id + "/" + message + "/content"; }, - getContent: function (flow, message) { + getContent: function getContent(flow, message) { var url = MessageUtils.getContentURL(flow, message); return $.get(url); } }; var RequestUtils = _.extend(MessageUtils, { - pretty_host: function (request) { + pretty_host: function pretty_host(request) { //FIXME: Add hostheader return request.host; }, - pretty_url: function (request) { + pretty_url: function pretty_url(request) { var port = ""; if (defaultPorts[request.scheme] !== request.port) { port = ":" + request.port; @@ -5262,13 +5801,12 @@ var RequestUtils = _.extend(MessageUtils, { var ResponseUtils = _.extend(MessageUtils, {}); - var parseUrl_regex = /^(?:(https?):\/\/)?([^\/:]+)?(?::(\d+))?(\/.*)?$/i; -var parseUrl = function (url) { +var parseUrl = function parseUrl(url) { //there are many correct ways to parse a URL, //however, a mitmproxy user may also wish to generate a not-so-correct URL. ;-) var parts = parseUrl_regex.exec(url); - if(!parts){ + if (!parts) { return false; } @@ -5295,13 +5833,12 @@ var parseUrl = function (url) { return ret; }; - var isValidHttpVersion_regex = /^HTTP\/\d+(\.\d+)*$/i; -var isValidHttpVersion = function (httpVersion) { +var isValidHttpVersion = function isValidHttpVersion(httpVersion) { return isValidHttpVersion_regex.test(httpVersion); }; -var parseHttpVersion = function (httpVersion) { +var parseHttpVersion = function parseHttpVersion(httpVersion) { httpVersion = httpVersion.replace("HTTP/", "").split("."); return _.map(httpVersion, function (x) { return parseInt(x); @@ -5317,7 +5854,9 @@ module.exports = { isValidHttpVersion: isValidHttpVersion }; + },{"jquery":"jquery","lodash":"lodash"}],24:[function(require,module,exports){ +"use strict"; var _ = require("lodash"); var $ = require("jquery"); @@ -5327,13 +5866,12 @@ var utils = require("../utils.js"); var actions = require("../actions.js"); var dispatcher = require("../dispatcher.js"); - function ListStore() { EventEmitter.call(this); this.reset(); } _.extend(ListStore.prototype, EventEmitter.prototype, { - add: function (elem) { + add: function add(elem) { if (elem.id in this._pos_map) { return; } @@ -5341,14 +5879,14 @@ _.extend(ListStore.prototype, EventEmitter.prototype, { this.list.push(elem); this.emit("add", elem); }, - update: function (elem) { + update: function update(elem) { if (!(elem.id in this._pos_map)) { return; } this.list[this._pos_map[elem.id]] = elem; this.emit("update", elem); }, - remove: function (elem_id) { + remove: function remove(elem_id) { if (!(elem_id in this._pos_map)) { return; } @@ -5356,37 +5894,36 @@ _.extend(ListStore.prototype, EventEmitter.prototype, { this._build_map(); this.emit("remove", elem_id); }, - reset: function (elems) { + reset: function reset(elems) { this.list = elems || []; this._build_map(); this.emit("recalculate"); }, - _build_map: function () { + _build_map: function _build_map() { this._pos_map = {}; for (var i = 0; i < this.list.length; i++) { var elem = this.list[i]; this._pos_map[elem.id] = i; } }, - get: function (elem_id) { + get: function get(elem_id) { return this.list[this._pos_map[elem_id]]; }, - index: function (elem_id) { + index: function index(elem_id) { return this._pos_map[elem_id]; } }); - function DictStore() { EventEmitter.call(this); this.reset(); } _.extend(DictStore.prototype, EventEmitter.prototype, { - update: function (dict) { + update: function update(dict) { _.merge(this.dict, dict); this.emit("recalculate"); }, - reset: function (dict) { + reset: function reset(dict) { this.dict = dict || {}; this.emit("recalculate"); } @@ -5407,7 +5944,7 @@ function LiveStoreMixin(type) { } } _.extend(LiveStoreMixin.prototype, { - handle: function (event) { + handle: function handle(event) { if (event.type === actions.ActionTypes.CONNECTION_OPEN) { return this.fetch(); } @@ -5422,10 +5959,10 @@ _.extend(LiveStoreMixin.prototype, { } } }, - close: function () { + close: function close() { dispatcher.AppDispatcher.unregister(this.handle); }, - fetch: function (data) { + fetch: function fetch(data) { console.log("fetch " + this.type); if (this._fetchxhr) { this._fetchxhr.abort(); @@ -5434,16 +5971,14 @@ _.extend(LiveStoreMixin.prototype, { if (data) { this.handle_fetch(data); } else { - this._fetchxhr = $.getJSON("/" + this.type) - .done(function (message) { - this.handle_fetch(message.data); - }.bind(this)) - .fail(function () { - EventLogActions.add_event("Could not fetch " + this.type); - }.bind(this)); + this._fetchxhr = $.getJSON("/" + this.type).done((function (message) { + this.handle_fetch(message.data); + }).bind(this)).fail((function () { + EventLogActions.add_event("Could not fetch " + this.type); + }).bind(this)); } }, - handle_fetch: function (data) { + handle_fetch: function handle_fetch(data) { this._fetchxhr = false; console.log(this.type + " fetched.", this._updates_before_fetch); this.reset(data); @@ -5452,7 +5987,7 @@ _.extend(LiveStoreMixin.prototype, { for (var i = 0; i < updates.length; i++) { this.handle(updates[i]); } - }, + } }); function LiveListStore(type) { @@ -5467,7 +6002,6 @@ function LiveDictStore(type) { } _.extend(LiveDictStore.prototype, DictStore.prototype, LiveStoreMixin.prototype); - function FlowStore() { return new LiveListStore(actions.ActionTypes.FLOW_STORE); } @@ -5480,27 +6014,29 @@ function EventLogStore() { LiveListStore.call(this, actions.ActionTypes.EVENT_STORE); } _.extend(EventLogStore.prototype, LiveListStore.prototype, { - fetch: function(){ + fetch: function fetch() { LiveListStore.prototype.fetch.apply(this, arguments); // Make sure to display updates even if fetching all events failed. // This way, we can send "fetch failed" log messages to the log. - if(this._fetchxhr){ - this._fetchxhr.fail(function(){ + if (this._fetchxhr) { + this._fetchxhr.fail((function () { this.handle_fetch(null); - }.bind(this)); + }).bind(this)); } } }); - module.exports = { EventLogStore: EventLogStore, SettingsStore: SettingsStore, FlowStore: FlowStore }; + },{"../actions.js":2,"../dispatcher.js":21,"../utils.js":26,"events":1,"jquery":"jquery","lodash":"lodash"}],25:[function(require,module,exports){ +"use strict"; + var EventEmitter = require('events').EventEmitter; var _ = require("lodash"); @@ -5511,7 +6047,7 @@ function SortByStoreOrder(elem) { } var default_sort = SortByStoreOrder; -var default_filt = function (elem) { +var default_filt = function default_filt(elem) { return true; }; @@ -5533,14 +6069,14 @@ function StoreView(store, filt, sortfun) { } _.extend(StoreView.prototype, EventEmitter.prototype, { - close: function () { + close: function close() { this.store.removeListener("add", this.add); this.store.removeListener("update", this.update); this.store.removeListener("remove", this.remove); this.store.removeListener("recalculate", this.recalculate); this.removeAllListeners(); }, - recalculate: function (filt, sortfun) { + recalculate: function recalculate(filt, sortfun) { filt = filt || this.filt || default_filt; sortfun = sortfun || this.sortfun || default_sort; filt = filt.bind(this); @@ -5552,9 +6088,9 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { this.list.sort(function (a, b) { var akey = sortfun(a); var bkey = sortfun(b); - if(akey < bkey){ + if (akey < bkey) { return -1; - } else if(akey > bkey){ + } else if (akey > bkey) { return 1; } else { return 0; @@ -5562,13 +6098,14 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { }); this.emit("recalculate"); }, - index: function (elem) { + index: function index(elem) { return _.sortedIndex(this.list, elem, this.sortfun); }, - add: function (elem) { + add: function add(elem) { if (this.filt(elem)) { var idx = this.index(elem); - if (idx === this.list.length) { //happens often, .push is way faster. + if (idx === this.list.length) { + //happens often, .push is way faster. this.list.push(elem); } else { this.list.splice(idx, 0, elem); @@ -5576,7 +6113,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { this.emit("add", elem, idx); } }, - update: function (elem) { + update: function update(elem) { var idx; var i = this.list.length; // Search from the back, we usually update the latest entries. @@ -5587,12 +6124,14 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { } } - if (idx === -1) { //not contained in list + if (idx === -1) { + //not contained in list this.add(elem); } else if (!this.filt(elem)) { this.remove(elem.id); } else { - if (this.sortfun(this.list[idx]) !== this.sortfun(elem)) { //sortpos has changed + if (this.sortfun(this.list[idx]) !== this.sortfun(elem)) { + //sortpos has changed this.remove(this.list[idx]); this.add(elem); } else { @@ -5601,7 +6140,7 @@ _.extend(StoreView.prototype, EventEmitter.prototype, { } } }, - remove: function (elem_id) { + remove: function remove(elem_id) { var idx = this.list.length; while (idx--) { if (this.list[idx].id === elem_id) { @@ -5617,7 +6156,10 @@ module.exports = { StoreView: StoreView }; + },{"../utils.js":26,"events":1,"lodash":"lodash"}],26:[function(require,module,exports){ +"use strict"; + var $ = require("jquery"); var _ = require("lodash"); var actions = require("./actions.js"); @@ -5647,10 +6189,8 @@ for (var i = 65; i <= 90; i++) { Key[String.fromCharCode(i)] = i; } - -var formatSize = function (bytes) { - if (bytes === 0) - return "0"; +var formatSize = function formatSize(bytes) { + if (bytes === 0) return "0"; var prefix = ["b", "kb", "mb", "gb", "tb"]; for (var i = 0; i < prefix.length; i++) { if (Math.pow(1024, i + 1) > bytes) { @@ -5658,15 +6198,11 @@ var formatSize = function (bytes) { } } var precision; - if (bytes % Math.pow(1024, i) === 0) - precision = 0; - else - precision = 1; + if (bytes % Math.pow(1024, i) === 0) precision = 0;else precision = 1; return (bytes / Math.pow(1024, i)).toFixed(precision) + prefix[i]; }; - -var formatTimeDelta = function (milliseconds) { +var formatTimeDelta = function formatTimeDelta(milliseconds) { var time = milliseconds; var prefix = ["ms", "s", "min", "h"]; var div = [1000, 60, 60]; @@ -5678,9 +6214,8 @@ var formatTimeDelta = function (milliseconds) { return Math.round(time) + prefix[i]; }; - -var formatTimeStamp = function (seconds) { - var ts = (new Date(seconds * 1000)).toISOString(); +var formatTimeStamp = function formatTimeStamp(seconds) { + var ts = new Date(seconds * 1000).toISOString(); return ts.replace("T", " ").replace("Z", ""); }; @@ -5689,23 +6224,21 @@ var formatTimeStamp = function (seconds) { // This beauty "reverses" a JS string. var end = String.fromCharCode(0xffff); function reverseString(s) { - return String.fromCharCode.apply(String, - _.map(s.split(""), function (c) { - return 0xffff - c.charCodeAt(0); - }) - ) + end; + return String.fromCharCode.apply(String, _.map(s.split(""), function (c) { + return 0xffff - c.charCodeAt(0); + })) + end; } function getCookie(name) { var r = document.cookie.match(new RegExp("\\b" + name + "=([^;]*)\\b")); return r ? r[1] : undefined; } -var xsrf = $.param({_xsrf: getCookie("_xsrf")}); +var xsrf = $.param({ _xsrf: getCookie("_xsrf") }); //Tornado XSRF Protection. $.ajaxPrefilter(function (options) { if (["post", "put", "delete"].indexOf(options.type.toLowerCase()) >= 0 && options.url[0] === "/") { - if(options.url.indexOf("?") === -1){ + if (options.url.indexOf("?") === -1) { options.url += "?" + xsrf; } else { options.url += "&" + xsrf; @@ -5728,9 +6261,10 @@ module.exports = { formatTimeDelta: formatTimeDelta, formatTimeStamp: formatTimeStamp, reverseString: reverseString, - Key: Key, + Key: Key }; + },{"./actions.js":2,"jquery":"jquery","lodash":"lodash","react":"react"}]},{},[3]) diff --git a/libmproxy/web/static/vendor.css b/libmproxy/web/static/vendor.css index a170c49a..4ed1f0b8 100644 --- a/libmproxy/web/static/vendor.css +++ b/libmproxy/web/static/vendor.css @@ -1,4 +1,4 @@ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; -ms-text-size-adjust: 100%; @@ -88,7 +88,6 @@ figure { margin: 1em 40px; } hr { - -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } @@ -148,8 +147,6 @@ input[type="number"]::-webkit-outer-spin-button { } input[type="search"] { -webkit-appearance: textfield; - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; box-sizing: content-box; } input[type="search"]::-webkit-search-cancel-button, @@ -228,9 +225,6 @@ th { h3 { page-break-after: avoid; } - select { - background: #fff !important; - } .navbar { display: none; } @@ -1076,7 +1070,7 @@ body { font-size: 14px; line-height: 1.42857143; color: #333333; - background-color: #ffffff; + background-color: #fff; } input, button, @@ -1121,8 +1115,8 @@ img { .img-thumbnail { padding: 4px; line-height: 1.42857143; - background-color: #ffffff; - border: 1px solid #dddddd; + background-color: #fff; + border: 1px solid #ddd; border-radius: 4px; -webkit-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; @@ -1330,62 +1324,72 @@ mark, .text-primary { color: #337ab7; } -a.text-primary:hover { +a.text-primary:hover, +a.text-primary:focus { color: #286090; } .text-success { color: #3c763d; } -a.text-success:hover { +a.text-success:hover, +a.text-success:focus { color: #2b542c; } .text-info { color: #31708f; } -a.text-info:hover { +a.text-info:hover, +a.text-info:focus { color: #245269; } .text-warning { color: #8a6d3b; } -a.text-warning:hover { +a.text-warning:hover, +a.text-warning:focus { color: #66512c; } .text-danger { color: #a94442; } -a.text-danger:hover { +a.text-danger:hover, +a.text-danger:focus { color: #843534; } .bg-primary { color: #fff; background-color: #337ab7; } -a.bg-primary:hover { +a.bg-primary:hover, +a.bg-primary:focus { background-color: #286090; } .bg-success { background-color: #dff0d8; } -a.bg-success:hover { +a.bg-success:hover, +a.bg-success:focus { background-color: #c1e2b3; } .bg-info { background-color: #d9edf7; } -a.bg-info:hover { +a.bg-info:hover, +a.bg-info:focus { background-color: #afd9ee; } .bg-warning { background-color: #fcf8e3; } -a.bg-warning:hover { +a.bg-warning:hover, +a.bg-warning:focus { background-color: #f7ecb5; } .bg-danger { background-color: #f2dede; } -a.bg-danger:hover { +a.bg-danger:hover, +a.bg-danger:focus { background-color: #e4b9b9; } .page-header { @@ -1524,8 +1528,8 @@ code { kbd { padding: 2px 4px; font-size: 90%; - color: #ffffff; - background-color: #333333; + color: #fff; + background-color: #333; border-radius: 3px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); } @@ -1545,7 +1549,7 @@ pre { word-wrap: break-word; color: #333333; background-color: #f5f5f5; - border: 1px solid #cccccc; + border: 1px solid #ccc; border-radius: 4px; } pre code { @@ -2253,11 +2257,11 @@ th { padding: 8px; line-height: 1.42857143; vertical-align: top; - border-top: 1px solid #dddddd; + border-top: 1px solid #ddd; } .table > thead > tr > th { vertical-align: bottom; - border-bottom: 2px solid #dddddd; + border-bottom: 2px solid #ddd; } .table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, @@ -2268,10 +2272,10 @@ th { border-top: 0; } .table > tbody + tbody { - border-top: 2px solid #dddddd; + border-top: 2px solid #ddd; } .table .table { - background-color: #ffffff; + background-color: #fff; } .table-condensed > thead > tr > th, .table-condensed > tbody > tr > th, @@ -2282,7 +2286,7 @@ th { padding: 5px; } .table-bordered { - border: 1px solid #dddddd; + border: 1px solid #ddd; } .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, @@ -2290,7 +2294,7 @@ th { .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td { - border: 1px solid #dddddd; + border: 1px solid #ddd; } .table-bordered > thead > tr > th, .table-bordered > thead > tr > td { @@ -2428,7 +2432,7 @@ table th[class*="col-"] { margin-bottom: 15px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; - border: 1px solid #dddddd; + border: 1px solid #ddd; } .table-responsive > .table { margin-bottom: 0; @@ -2534,9 +2538,9 @@ output { font-size: 14px; line-height: 1.42857143; color: #555555; - background-color: #ffffff; + background-color: #fff; background-image: none; - border: 1px solid #cccccc; + border: 1px solid #ccc; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); @@ -2551,14 +2555,14 @@ output { box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); } .form-control::-moz-placeholder { - color: #999999; + color: #999; opacity: 1; } .form-control:-ms-input-placeholder { - color: #999999; + color: #999; } .form-control::-webkit-input-placeholder { - color: #999999; + color: #999; } .form-control[disabled], .form-control[readonly], @@ -2577,10 +2581,10 @@ input[type="search"] { -webkit-appearance: none; } @media screen and (-webkit-min-device-pixel-ratio: 0) { - input[type="date"], - input[type="time"], - input[type="datetime-local"], - input[type="month"] { + input[type="date"].form-control, + input[type="time"].form-control, + input[type="datetime-local"].form-control, + input[type="month"].form-control { line-height: 34px; } input[type="date"].input-sm, @@ -2702,20 +2706,20 @@ select[multiple].input-sm { line-height: 1.5; border-radius: 3px; } -select.form-group-sm .form-control { +.form-group-sm select.form-control { height: 30px; line-height: 30px; } -textarea.form-group-sm .form-control, -select[multiple].form-group-sm .form-control { +.form-group-sm textarea.form-control, +.form-group-sm select[multiple].form-control { height: auto; } .form-group-sm .form-control-static { height: 30px; - padding: 5px 10px; + min-height: 32px; + padding: 6px 10px; font-size: 12px; line-height: 1.5; - min-height: 32px; } .input-lg { height: 46px; @@ -2739,20 +2743,20 @@ select[multiple].input-lg { line-height: 1.3333333; border-radius: 6px; } -select.form-group-lg .form-control { +.form-group-lg select.form-control { height: 46px; line-height: 46px; } -textarea.form-group-lg .form-control, -select[multiple].form-group-lg .form-control { +.form-group-lg textarea.form-control, +.form-group-lg select[multiple].form-control { height: auto; } .form-group-lg .form-control-static { height: 46px; - padding: 10px 16px; + min-height: 38px; + padding: 11px 16px; font-size: 18px; line-height: 1.3333333; - min-height: 38px; } .has-feedback { position: relative; @@ -2772,12 +2776,16 @@ select[multiple].form-group-lg .form-control { text-align: center; pointer-events: none; } -.input-lg + .form-control-feedback { +.input-lg + .form-control-feedback, +.input-group-lg + .form-control-feedback, +.form-group-lg .form-control + .form-control-feedback { width: 46px; height: 46px; line-height: 46px; } -.input-sm + .form-control-feedback { +.input-sm + .form-control-feedback, +.input-group-sm + .form-control-feedback, +.form-group-sm .form-control + .form-control-feedback { width: 30px; height: 30px; line-height: 30px; @@ -2963,11 +2971,13 @@ select[multiple].form-group-lg .form-control { @media (min-width: 768px) { .form-horizontal .form-group-lg .control-label { padding-top: 14.333333px; + font-size: 18px; } } @media (min-width: 768px) { .form-horizontal .form-group-sm .control-label { padding-top: 6px; + font-size: 12px; } } .btn { @@ -3003,7 +3013,7 @@ select[multiple].form-group-lg .form-control { .btn:hover, .btn:focus, .btn.focus { - color: #333333; + color: #333; text-decoration: none; } .btn:active, @@ -3017,27 +3027,51 @@ select[multiple].form-group-lg .form-control { .btn[disabled], fieldset[disabled] .btn { cursor: not-allowed; - pointer-events: none; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; box-shadow: none; } +a.btn.disabled, +fieldset[disabled] a.btn { + pointer-events: none; +} .btn-default { - color: #333333; - background-color: #ffffff; - border-color: #cccccc; + color: #333; + background-color: #fff; + border-color: #ccc; } -.btn-default:hover, .btn-default:focus, -.btn-default.focus, +.btn-default.focus { + color: #333; + background-color: #e6e6e6; + border-color: #8c8c8c; +} +.btn-default:hover { + color: #333; + background-color: #e6e6e6; + border-color: #adadad; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { - color: #333333; + color: #333; background-color: #e6e6e6; border-color: #adadad; } +.btn-default:active:hover, +.btn-default.active:hover, +.open > .dropdown-toggle.btn-default:hover, +.btn-default:active:focus, +.btn-default.active:focus, +.open > .dropdown-toggle.btn-default:focus, +.btn-default:active.focus, +.btn-default.active.focus, +.open > .dropdown-toggle.btn-default.focus { + color: #333; + background-color: #d4d4d4; + border-color: #8c8c8c; +} .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -3061,28 +3095,49 @@ fieldset[disabled] .btn-default:active, .btn-default.disabled.active, .btn-default[disabled].active, fieldset[disabled] .btn-default.active { - background-color: #ffffff; - border-color: #cccccc; + background-color: #fff; + border-color: #ccc; } .btn-default .badge { - color: #ffffff; - background-color: #333333; + color: #fff; + background-color: #333; } .btn-primary { - color: #ffffff; + color: #fff; background-color: #337ab7; border-color: #2e6da4; } -.btn-primary:hover, .btn-primary:focus, -.btn-primary.focus, +.btn-primary.focus { + color: #fff; + background-color: #286090; + border-color: #122b40; +} +.btn-primary:hover { + color: #fff; + background-color: #286090; + border-color: #204d74; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { - color: #ffffff; + color: #fff; background-color: #286090; border-color: #204d74; } +.btn-primary:active:hover, +.btn-primary.active:hover, +.open > .dropdown-toggle.btn-primary:hover, +.btn-primary:active:focus, +.btn-primary.active:focus, +.open > .dropdown-toggle.btn-primary:focus, +.btn-primary:active.focus, +.btn-primary.active.focus, +.open > .dropdown-toggle.btn-primary.focus { + color: #fff; + background-color: #204d74; + border-color: #122b40; +} .btn-primary:active, .btn-primary.active, .open > .dropdown-toggle.btn-primary { @@ -3111,23 +3166,44 @@ fieldset[disabled] .btn-primary.active { } .btn-primary .badge { color: #337ab7; - background-color: #ffffff; + background-color: #fff; } .btn-success { - color: #ffffff; + color: #fff; background-color: #5cb85c; border-color: #4cae4c; } -.btn-success:hover, .btn-success:focus, -.btn-success.focus, +.btn-success.focus { + color: #fff; + background-color: #449d44; + border-color: #255625; +} +.btn-success:hover { + color: #fff; + background-color: #449d44; + border-color: #398439; +} .btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success { - color: #ffffff; + color: #fff; background-color: #449d44; border-color: #398439; } +.btn-success:active:hover, +.btn-success.active:hover, +.open > .dropdown-toggle.btn-success:hover, +.btn-success:active:focus, +.btn-success.active:focus, +.open > .dropdown-toggle.btn-success:focus, +.btn-success:active.focus, +.btn-success.active.focus, +.open > .dropdown-toggle.btn-success.focus { + color: #fff; + background-color: #398439; + border-color: #255625; +} .btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success { @@ -3156,23 +3232,44 @@ fieldset[disabled] .btn-success.active { } .btn-success .badge { color: #5cb85c; - background-color: #ffffff; + background-color: #fff; } .btn-info { - color: #ffffff; + color: #fff; background-color: #5bc0de; border-color: #46b8da; } -.btn-info:hover, .btn-info:focus, -.btn-info.focus, +.btn-info.focus { + color: #fff; + background-color: #31b0d5; + border-color: #1b6d85; +} +.btn-info:hover { + color: #fff; + background-color: #31b0d5; + border-color: #269abc; +} .btn-info:active, .btn-info.active, .open > .dropdown-toggle.btn-info { - color: #ffffff; + color: #fff; background-color: #31b0d5; border-color: #269abc; } +.btn-info:active:hover, +.btn-info.active:hover, +.open > .dropdown-toggle.btn-info:hover, +.btn-info:active:focus, +.btn-info.active:focus, +.open > .dropdown-toggle.btn-info:focus, +.btn-info:active.focus, +.btn-info.active.focus, +.open > .dropdown-toggle.btn-info.focus { + color: #fff; + background-color: #269abc; + border-color: #1b6d85; +} .btn-info:active, .btn-info.active, .open > .dropdown-toggle.btn-info { @@ -3201,23 +3298,44 @@ fieldset[disabled] .btn-info.active { } .btn-info .badge { color: #5bc0de; - background-color: #ffffff; + background-color: #fff; } .btn-warning { - color: #ffffff; + color: #fff; background-color: #f0ad4e; border-color: #eea236; } -.btn-warning:hover, .btn-warning:focus, -.btn-warning.focus, +.btn-warning.focus { + color: #fff; + background-color: #ec971f; + border-color: #985f0d; +} +.btn-warning:hover { + color: #fff; + background-color: #ec971f; + border-color: #d58512; +} .btn-warning:active, .btn-warning.active, .open > .dropdown-toggle.btn-warning { - color: #ffffff; + color: #fff; background-color: #ec971f; border-color: #d58512; } +.btn-warning:active:hover, +.btn-warning.active:hover, +.open > .dropdown-toggle.btn-warning:hover, +.btn-warning:active:focus, +.btn-warning.active:focus, +.open > .dropdown-toggle.btn-warning:focus, +.btn-warning:active.focus, +.btn-warning.active.focus, +.open > .dropdown-toggle.btn-warning.focus { + color: #fff; + background-color: #d58512; + border-color: #985f0d; +} .btn-warning:active, .btn-warning.active, .open > .dropdown-toggle.btn-warning { @@ -3246,23 +3364,44 @@ fieldset[disabled] .btn-warning.active { } .btn-warning .badge { color: #f0ad4e; - background-color: #ffffff; + background-color: #fff; } .btn-danger { - color: #ffffff; + color: #fff; background-color: #d9534f; border-color: #d43f3a; } -.btn-danger:hover, .btn-danger:focus, -.btn-danger.focus, +.btn-danger.focus { + color: #fff; + background-color: #c9302c; + border-color: #761c19; +} +.btn-danger:hover { + color: #fff; + background-color: #c9302c; + border-color: #ac2925; +} .btn-danger:active, .btn-danger.active, .open > .dropdown-toggle.btn-danger { - color: #ffffff; + color: #fff; background-color: #c9302c; border-color: #ac2925; } +.btn-danger:active:hover, +.btn-danger.active:hover, +.open > .dropdown-toggle.btn-danger:hover, +.btn-danger:active:focus, +.btn-danger.active:focus, +.open > .dropdown-toggle.btn-danger:focus, +.btn-danger:active.focus, +.btn-danger.active.focus, +.open > .dropdown-toggle.btn-danger.focus { + color: #fff; + background-color: #ac2925; + border-color: #761c19; +} .btn-danger:active, .btn-danger.active, .open > .dropdown-toggle.btn-danger { @@ -3291,7 +3430,7 @@ fieldset[disabled] .btn-danger.active { } .btn-danger .badge { color: #d9534f; - background-color: #ffffff; + background-color: #fff; } .btn-link { color: #337ab7; @@ -3398,6 +3537,7 @@ tbody.collapse.in { margin-left: 2px; vertical-align: middle; border-top: 4px dashed; + border-top: 4px solid \9; border-right: 4px solid transparent; border-left: 4px solid transparent; } @@ -3421,8 +3561,8 @@ tbody.collapse.in { list-style: none; font-size: 14px; text-align: left; - background-color: #ffffff; - border: 1px solid #cccccc; + background-color: #fff; + border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); @@ -3457,7 +3597,7 @@ tbody.collapse.in { .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { - color: #ffffff; + color: #fff; text-decoration: none; outline: 0; background-color: #337ab7; @@ -3512,7 +3652,8 @@ tbody.collapse.in { .dropup .caret, .navbar-fixed-bottom .dropdown .caret { border-top: 0; - border-bottom: 4px solid; + border-bottom: 4px dashed; + border-bottom: 4px solid \9; content: ""; } .dropup .dropdown-menu, @@ -3561,6 +3702,7 @@ tbody.collapse.in { .btn-toolbar { margin-left: -5px; } +.btn-toolbar .btn, .btn-toolbar .btn-group, .btn-toolbar .input-group { float: left; @@ -3786,7 +3928,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { color: #555555; text-align: center; background-color: #eeeeee; - border: 1px solid #cccccc; + border: 1px solid #ccc; border-radius: 4px; } .input-group-addon.input-sm { @@ -3851,6 +3993,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group { + z-index: 2; margin-left: -1px; } .nav { @@ -3898,7 +4041,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { max-width: none; } .nav-tabs { - border-bottom: 1px solid #dddddd; + border-bottom: 1px solid #ddd; } .nav-tabs > li { float: left; @@ -3911,14 +4054,14 @@ select[multiple].input-group-sm > .input-group-btn > .btn { border-radius: 4px 4px 0 0; } .nav-tabs > li > a:hover { - border-color: #eeeeee #eeeeee #dddddd; + border-color: #eeeeee #eeeeee #ddd; } .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { color: #555555; - background-color: #ffffff; - border: 1px solid #dddddd; + background-color: #fff; + border: 1px solid #ddd; border-bottom-color: transparent; cursor: default; } @@ -3953,17 +4096,17 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { - border: 1px solid #dddddd; + border: 1px solid #ddd; } @media (min-width: 768px) { .nav-tabs.nav-justified > li > a { - border-bottom: 1px solid #dddddd; + border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { - border-bottom-color: #ffffff; + border-bottom-color: #fff; } } .nav-pills > li { @@ -3978,7 +4121,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { - color: #ffffff; + color: #fff; background-color: #337ab7; } .nav-stacked > li { @@ -4021,17 +4164,17 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { - border: 1px solid #dddddd; + border: 1px solid #ddd; } @media (min-width: 768px) { .nav-tabs-justified > li > a { - border-bottom: 1px solid #dddddd; + border-bottom: 1px solid #ddd; border-radius: 4px 4px 0 0; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { - border-bottom-color: #ffffff; + border-bottom-color: #fff; } } .tab-content > .tab-pane { @@ -4393,30 +4536,30 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { - color: #333333; + color: #333; background-color: transparent; } .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus { - color: #555555; + color: #555; background-color: #eeeeee; } .navbar-default .navbar-nav > .disabled > a, .navbar-default .navbar-nav > .disabled > a:hover, .navbar-default .navbar-nav > .disabled > a:focus { - color: #cccccc; + color: #ccc; background-color: transparent; } .navbar-default .navbar-toggle { - border-color: #dddddd; + border-color: #ddd; } .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { - background-color: #dddddd; + background-color: #ddd; } .navbar-default .navbar-toggle .icon-bar { - background-color: #888888; + background-color: #888; } .navbar-default .navbar-collapse, .navbar-default .navbar-form { @@ -4426,7 +4569,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus { background-color: #eeeeee; - color: #555555; + color: #555; } @media (max-width: 767px) { .navbar-default .navbar-nav .open .dropdown-menu > li > a { @@ -4434,19 +4577,19 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { - color: #333333; + color: #333; background-color: transparent; } .navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #555555; + color: #555; background-color: #eeeeee; } .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { - color: #cccccc; + color: #ccc; background-color: transparent; } } @@ -4454,23 +4597,23 @@ select[multiple].input-group-sm > .input-group-btn > .btn { color: #303030; } .navbar-default .navbar-link:hover { - color: #333333; + color: #333; } .navbar-default .btn-link { color: #303030; } .navbar-default .btn-link:hover, .navbar-default .btn-link:focus { - color: #333333; + color: #333; } .navbar-default .btn-link[disabled]:hover, fieldset[disabled] .navbar-default .btn-link:hover, .navbar-default .btn-link[disabled]:focus, fieldset[disabled] .navbar-default .btn-link:focus { - color: #cccccc; + color: #ccc; } .navbar-inverse { - background-color: #222222; + background-color: #222; border-color: #080808; } .navbar-inverse .navbar-brand { @@ -4478,7 +4621,7 @@ fieldset[disabled] .navbar-default .btn-link:focus { } .navbar-inverse .navbar-brand:hover, .navbar-inverse .navbar-brand:focus { - color: #ffffff; + color: #fff; background-color: transparent; } .navbar-inverse .navbar-text { @@ -4489,30 +4632,30 @@ fieldset[disabled] .navbar-default .btn-link:focus { } .navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus { - color: #ffffff; + color: #fff; background-color: transparent; } .navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus { - color: #ffffff; + color: #fff; background-color: #080808; } .navbar-inverse .navbar-nav > .disabled > a, .navbar-inverse .navbar-nav > .disabled > a:hover, .navbar-inverse .navbar-nav > .disabled > a:focus { - color: #444444; + color: #444; background-color: transparent; } .navbar-inverse .navbar-toggle { - border-color: #333333; + border-color: #333; } .navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus { - background-color: #333333; + background-color: #333; } .navbar-inverse .navbar-toggle .icon-bar { - background-color: #ffffff; + background-color: #fff; } .navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form { @@ -4522,7 +4665,7 @@ fieldset[disabled] .navbar-default .btn-link:focus { .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus { background-color: #080808; - color: #ffffff; + color: #fff; } @media (max-width: 767px) { .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { @@ -4536,19 +4679,19 @@ fieldset[disabled] .navbar-default .btn-link:focus { } .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { - color: #ffffff; + color: #fff; background-color: transparent; } .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #ffffff; + color: #fff; background-color: #080808; } .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { - color: #444444; + color: #444; background-color: transparent; } } @@ -4556,20 +4699,20 @@ fieldset[disabled] .navbar-default .btn-link:focus { color: #9d9d9d; } .navbar-inverse .navbar-link:hover { - color: #ffffff; + color: #fff; } .navbar-inverse .btn-link { color: #9d9d9d; } .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link:focus { - color: #ffffff; + color: #fff; } .navbar-inverse .btn-link[disabled]:hover, fieldset[disabled] .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link[disabled]:focus, fieldset[disabled] .navbar-inverse .btn-link:focus { - color: #444444; + color: #444; } .breadcrumb { padding: 8px 15px; @@ -4584,7 +4727,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .breadcrumb > li + li:before { content: "/\00a0"; padding: 0 5px; - color: #cccccc; + color: #ccc; } .breadcrumb > .active { color: #777777; @@ -4606,8 +4749,8 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { line-height: 1.42857143; text-decoration: none; color: #337ab7; - background-color: #ffffff; - border: 1px solid #dddddd; + background-color: #fff; + border: 1px solid #ddd; margin-left: -1px; } .pagination > li:first-child > a, @@ -4625,9 +4768,10 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pagination > li > span:hover, .pagination > li > a:focus, .pagination > li > span:focus { + z-index: 3; color: #23527c; background-color: #eeeeee; - border-color: #dddddd; + border-color: #ddd; } .pagination > .active > a, .pagination > .active > span, @@ -4636,7 +4780,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pagination > .active > a:focus, .pagination > .active > span:focus { z-index: 2; - color: #ffffff; + color: #fff; background-color: #337ab7; border-color: #337ab7; cursor: default; @@ -4648,14 +4792,15 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pagination > .disabled > a:hover, .pagination > .disabled > a:focus { color: #777777; - background-color: #ffffff; - border-color: #dddddd; + background-color: #fff; + border-color: #ddd; cursor: not-allowed; } .pagination-lg > li > a, .pagination-lg > li > span { padding: 10px 16px; font-size: 18px; + line-height: 1.3333333; } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { @@ -4671,6 +4816,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pagination-sm > li > span { padding: 5px 10px; font-size: 12px; + line-height: 1.5; } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { @@ -4695,8 +4841,8 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pager li > span { display: inline-block; padding: 5px 14px; - background-color: #ffffff; - border: 1px solid #dddddd; + background-color: #fff; + border: 1px solid #ddd; border-radius: 15px; } .pager li > a:hover, @@ -4717,7 +4863,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pager .disabled > a:focus, .pager .disabled > span { color: #777777; - background-color: #ffffff; + background-color: #fff; cursor: not-allowed; } .label { @@ -4726,7 +4872,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { font-size: 75%; font-weight: bold; line-height: 1; - color: #ffffff; + color: #fff; text-align: center; white-space: nowrap; vertical-align: baseline; @@ -4734,7 +4880,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { } a.label:hover, a.label:focus { - color: #ffffff; + color: #fff; text-decoration: none; cursor: pointer; } @@ -4793,9 +4939,9 @@ a.label:focus { padding: 3px 7px; font-size: 12px; font-weight: bold; - color: #ffffff; + color: #fff; line-height: 1; - vertical-align: baseline; + vertical-align: middle; white-space: nowrap; text-align: center; background-color: #777777; @@ -4815,14 +4961,14 @@ a.label:focus { } a.badge:hover, a.badge:focus { - color: #ffffff; + color: #fff; text-decoration: none; cursor: pointer; } .list-group-item.active > .badge, .nav-pills > .active > a > .badge { color: #337ab7; - background-color: #ffffff; + background-color: #fff; } .list-group-item > .badge { float: right; @@ -4834,7 +4980,8 @@ a.badge:focus { margin-left: 3px; } .jumbotron { - padding: 30px 15px; + padding-top: 30px; + padding-bottom: 30px; margin-bottom: 30px; color: inherit; background-color: #eeeeee; @@ -4860,7 +5007,8 @@ a.badge:focus { } @media screen and (min-width: 768px) { .jumbotron { - padding: 48px 0; + padding-top: 48px; + padding-bottom: 48px; } .container .jumbotron, .container-fluid .jumbotron { @@ -4877,8 +5025,8 @@ a.badge:focus { padding: 4px; margin-bottom: 20px; line-height: 1.42857143; - background-color: #ffffff; - border: 1px solid #dddddd; + background-color: #fff; + border: 1px solid #ddd; border-radius: 4px; -webkit-transition: border 0.2s ease-in-out; -o-transition: border 0.2s ease-in-out; @@ -5004,7 +5152,7 @@ a.thumbnail.active { height: 100%; font-size: 12px; line-height: 20px; - color: #ffffff; + color: #fff; text-align: center; background-color: #337ab7; -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); @@ -5075,6 +5223,9 @@ a.thumbnail.active { .media-object { display: block; } +.media-object.img-thumbnail { + max-width: none; +} .media-right, .media > .pull-right { padding-left: 10px; @@ -5112,8 +5263,8 @@ a.thumbnail.active { display: block; padding: 10px 15px; margin-bottom: -1px; - background-color: #ffffff; - border: 1px solid #dddddd; + background-color: #fff; + border: 1px solid #ddd; } .list-group-item:first-child { border-top-right-radius: 4px; @@ -5124,18 +5275,26 @@ a.thumbnail.active { border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } -a.list-group-item { - color: #555555; +a.list-group-item, +button.list-group-item { + color: #555; } -a.list-group-item .list-group-item-heading { - color: #333333; +a.list-group-item .list-group-item-heading, +button.list-group-item .list-group-item-heading { + color: #333; } a.list-group-item:hover, -a.list-group-item:focus { +button.list-group-item:hover, +a.list-group-item:focus, +button.list-group-item:focus { text-decoration: none; - color: #555555; + color: #555; background-color: #f5f5f5; } +button.list-group-item { + width: 100%; + text-align: left; +} .list-group-item.disabled, .list-group-item.disabled:hover, .list-group-item.disabled:focus { @@ -5157,7 +5316,7 @@ a.list-group-item:focus { .list-group-item.active:hover, .list-group-item.active:focus { z-index: 2; - color: #ffffff; + color: #fff; background-color: #337ab7; border-color: #337ab7; } @@ -5181,20 +5340,27 @@ a.list-group-item:focus { color: #3c763d; background-color: #dff0d8; } -a.list-group-item-success { +a.list-group-item-success, +button.list-group-item-success { color: #3c763d; } -a.list-group-item-success .list-group-item-heading { +a.list-group-item-success .list-group-item-heading, +button.list-group-item-success .list-group-item-heading { color: inherit; } a.list-group-item-success:hover, -a.list-group-item-success:focus { +button.list-group-item-success:hover, +a.list-group-item-success:focus, +button.list-group-item-success:focus { color: #3c763d; background-color: #d0e9c6; } a.list-group-item-success.active, +button.list-group-item-success.active, a.list-group-item-success.active:hover, -a.list-group-item-success.active:focus { +button.list-group-item-success.active:hover, +a.list-group-item-success.active:focus, +button.list-group-item-success.active:focus { color: #fff; background-color: #3c763d; border-color: #3c763d; @@ -5203,20 +5369,27 @@ a.list-group-item-success.active:focus { color: #31708f; background-color: #d9edf7; } -a.list-group-item-info { +a.list-group-item-info, +button.list-group-item-info { color: #31708f; } -a.list-group-item-info .list-group-item-heading { +a.list-group-item-info .list-group-item-heading, +button.list-group-item-info .list-group-item-heading { color: inherit; } a.list-group-item-info:hover, -a.list-group-item-info:focus { +button.list-group-item-info:hover, +a.list-group-item-info:focus, +button.list-group-item-info:focus { color: #31708f; background-color: #c4e3f3; } a.list-group-item-info.active, +button.list-group-item-info.active, a.list-group-item-info.active:hover, -a.list-group-item-info.active:focus { +button.list-group-item-info.active:hover, +a.list-group-item-info.active:focus, +button.list-group-item-info.active:focus { color: #fff; background-color: #31708f; border-color: #31708f; @@ -5225,20 +5398,27 @@ a.list-group-item-info.active:focus { color: #8a6d3b; background-color: #fcf8e3; } -a.list-group-item-warning { +a.list-group-item-warning, +button.list-group-item-warning { color: #8a6d3b; } -a.list-group-item-warning .list-group-item-heading { +a.list-group-item-warning .list-group-item-heading, +button.list-group-item-warning .list-group-item-heading { color: inherit; } a.list-group-item-warning:hover, -a.list-group-item-warning:focus { +button.list-group-item-warning:hover, +a.list-group-item-warning:focus, +button.list-group-item-warning:focus { color: #8a6d3b; background-color: #faf2cc; } a.list-group-item-warning.active, +button.list-group-item-warning.active, a.list-group-item-warning.active:hover, -a.list-group-item-warning.active:focus { +button.list-group-item-warning.active:hover, +a.list-group-item-warning.active:focus, +button.list-group-item-warning.active:focus { color: #fff; background-color: #8a6d3b; border-color: #8a6d3b; @@ -5247,20 +5427,27 @@ a.list-group-item-warning.active:focus { color: #a94442; background-color: #f2dede; } -a.list-group-item-danger { +a.list-group-item-danger, +button.list-group-item-danger { color: #a94442; } -a.list-group-item-danger .list-group-item-heading { +a.list-group-item-danger .list-group-item-heading, +button.list-group-item-danger .list-group-item-heading { color: inherit; } a.list-group-item-danger:hover, -a.list-group-item-danger:focus { +button.list-group-item-danger:hover, +a.list-group-item-danger:focus, +button.list-group-item-danger:focus { color: #a94442; background-color: #ebcccc; } a.list-group-item-danger.active, +button.list-group-item-danger.active, a.list-group-item-danger.active:hover, -a.list-group-item-danger.active:focus { +button.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus, +button.list-group-item-danger.active:focus { color: #fff; background-color: #a94442; border-color: #a94442; @@ -5275,7 +5462,7 @@ a.list-group-item-danger.active:focus { } .panel { margin-bottom: 20px; - background-color: #ffffff; + background-color: #fff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); @@ -5309,7 +5496,7 @@ a.list-group-item-danger.active:focus { .panel-footer { padding: 10px 15px; background-color: #f5f5f5; - border-top: 1px solid #dddddd; + border-top: 1px solid #ddd; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } @@ -5334,6 +5521,10 @@ a.list-group-item-danger.active:focus { border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; } +.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { + border-top-right-radius: 0; + border-top-left-radius: 0; +} .panel-heading + .list-group .list-group-item:first-child { border-top-width: 0; } @@ -5419,7 +5610,7 @@ a.list-group-item-danger.active:focus { .panel > .panel-body + .table-responsive, .panel > .table + .panel-body, .panel > .table-responsive + .panel-body { - border-top: 1px solid #dddddd; + border-top: 1px solid #ddd; } .panel > .table > tbody:first-child > tr:first-child th, .panel > .table > tbody:first-child > tr:first-child td { @@ -5496,37 +5687,37 @@ a.list-group-item-danger.active:focus { } .panel-group .panel-heading + .panel-collapse > .panel-body, .panel-group .panel-heading + .panel-collapse > .list-group { - border-top: 1px solid #dddddd; + border-top: 1px solid #ddd; } .panel-group .panel-footer { border-top: 0; } .panel-group .panel-footer + .panel-collapse .panel-body { - border-bottom: 1px solid #dddddd; + border-bottom: 1px solid #ddd; } .panel-default { - border-color: #dddddd; + border-color: #ddd; } .panel-default > .panel-heading { color: #333333; background-color: #f5f5f5; - border-color: #dddddd; + border-color: #ddd; } .panel-default > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #dddddd; + border-top-color: #ddd; } .panel-default > .panel-heading .badge { color: #f5f5f5; background-color: #333333; } .panel-default > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #dddddd; + border-bottom-color: #ddd; } .panel-primary { border-color: #337ab7; } .panel-primary > .panel-heading { - color: #ffffff; + color: #fff; background-color: #337ab7; border-color: #337ab7; } @@ -5535,7 +5726,7 @@ a.list-group-item-danger.active:focus { } .panel-primary > .panel-heading .badge { color: #337ab7; - background-color: #ffffff; + background-color: #fff; } .panel-primary > .panel-footer + .panel-collapse > .panel-body { border-bottom-color: #337ab7; @@ -5665,14 +5856,14 @@ a.list-group-item-danger.active:focus { font-size: 21px; font-weight: bold; line-height: 1; - color: #000000; - text-shadow: 0 1px 0 #ffffff; + color: #000; + text-shadow: 0 1px 0 #fff; opacity: 0.2; filter: alpha(opacity=20); } .close:hover, .close:focus { - color: #000000; + color: #000; text-decoration: none; cursor: pointer; opacity: 0.5; @@ -5727,8 +5918,8 @@ button.close { } .modal-content { position: relative; - background-color: #ffffff; - border: 1px solid #999999; + background-color: #fff; + border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 6px; -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); @@ -5743,7 +5934,7 @@ button.close { bottom: 0; left: 0; z-index: 1040; - background-color: #000000; + background-color: #000; } .modal-backdrop.fade { opacity: 0; @@ -5814,9 +6005,21 @@ button.close { z-index: 1070; display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 12px; + font-style: normal; font-weight: normal; - line-height: 1.4; + letter-spacing: normal; + line-break: auto; + line-height: 1.42857143; + text-align: left; + text-align: start; + text-decoration: none; + text-shadow: none; + text-transform: none; + white-space: normal; + word-break: normal; + word-spacing: normal; + word-wrap: normal; + font-size: 12px; opacity: 0; filter: alpha(opacity=0); } @@ -5843,10 +6046,9 @@ button.close { .tooltip-inner { max-width: 200px; padding: 3px 8px; - color: #ffffff; + color: #fff; text-align: center; - text-decoration: none; - background-color: #000000; + background-color: #000; border-radius: 4px; } .tooltip-arrow { @@ -5861,56 +6063,56 @@ button.close { left: 50%; margin-left: -5px; border-width: 5px 5px 0; - border-top-color: #000000; + border-top-color: #000; } .tooltip.top-left .tooltip-arrow { bottom: 0; right: 5px; margin-bottom: -5px; border-width: 5px 5px 0; - border-top-color: #000000; + border-top-color: #000; } .tooltip.top-right .tooltip-arrow { bottom: 0; left: 5px; margin-bottom: -5px; border-width: 5px 5px 0; - border-top-color: #000000; + border-top-color: #000; } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; - border-right-color: #000000; + border-right-color: #000; } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; - border-left-color: #000000; + border-left-color: #000; } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; - border-bottom-color: #000000; + border-bottom-color: #000; } .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; - border-bottom-color: #000000; + border-bottom-color: #000; } .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; margin-top: -5px; border-width: 0 5px 5px; - border-bottom-color: #000000; + border-bottom-color: #000; } .popover { position: absolute; @@ -5921,18 +6123,28 @@ button.close { max-width: 276px; padding: 1px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; + font-style: normal; font-weight: normal; + letter-spacing: normal; + line-break: auto; line-height: 1.42857143; text-align: left; - background-color: #ffffff; + text-align: start; + text-decoration: none; + text-shadow: none; + text-transform: none; + white-space: normal; + word-break: normal; + word-spacing: normal; + word-wrap: normal; + font-size: 14px; + background-color: #fff; background-clip: padding-box; - border: 1px solid #cccccc; + border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - white-space: normal; } .popover.top { margin-top: -10px; @@ -5986,7 +6198,7 @@ button.close { bottom: 1px; margin-left: -10px; border-bottom-width: 0; - border-top-color: #ffffff; + border-top-color: #fff; } .popover.right > .arrow { top: 50%; @@ -6001,7 +6213,7 @@ button.close { left: 1px; bottom: -10px; border-left-width: 0; - border-right-color: #ffffff; + border-right-color: #fff; } .popover.bottom > .arrow { left: 50%; @@ -6016,7 +6228,7 @@ button.close { top: 1px; margin-left: -10px; border-top-width: 0; - border-bottom-color: #ffffff; + border-bottom-color: #fff; } .popover.left > .arrow { top: 50%; @@ -6030,7 +6242,7 @@ button.close { content: " "; right: 1px; border-right-width: 0; - border-left-color: #ffffff; + border-left-color: #fff; bottom: -10px; } .carousel { @@ -6061,9 +6273,9 @@ button.close { -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; backface-visibility: hidden; - -webkit-perspective: 1000; - -moz-perspective: 1000; - perspective: 1000; + -webkit-perspective: 1000px; + -moz-perspective: 1000px; + perspective: 1000px; } .carousel-inner > .item.next, .carousel-inner > .item.active.right { @@ -6124,7 +6336,7 @@ button.close { opacity: 0.5; filter: alpha(opacity=50); font-size: 20px; - color: #ffffff; + color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); } @@ -6147,7 +6359,7 @@ button.close { .carousel-control:hover, .carousel-control:focus { outline: 0; - color: #ffffff; + color: #fff; text-decoration: none; opacity: 0.9; filter: alpha(opacity=90); @@ -6158,6 +6370,7 @@ button.close { .carousel-control .glyphicon-chevron-right { position: absolute; top: 50%; + margin-top: -10px; z-index: 5; display: inline-block; } @@ -6175,7 +6388,6 @@ button.close { .carousel-control .icon-next { width: 20px; height: 20px; - margin-top: -10px; line-height: 1; font-family: serif; } @@ -6202,7 +6414,7 @@ button.close { height: 10px; margin: 1px; text-indent: -999px; - border: 1px solid #ffffff; + border: 1px solid #fff; border-radius: 10px; cursor: pointer; background-color: #000 \9; @@ -6212,7 +6424,7 @@ button.close { margin: 0; width: 12px; height: 12px; - background-color: #ffffff; + background-color: #fff; } .carousel-caption { position: absolute; @@ -6222,7 +6434,7 @@ button.close { z-index: 10; padding-top: 20px; padding-bottom: 20px; - color: #ffffff; + color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); } @@ -6367,7 +6579,7 @@ button.close { display: block !important; } table.visible-xs { - display: table; + display: table !important; } tr.visible-xs { display: table-row !important; @@ -6397,7 +6609,7 @@ button.close { display: block !important; } table.visible-sm { - display: table; + display: table !important; } tr.visible-sm { display: table-row !important; @@ -6427,7 +6639,7 @@ button.close { display: block !important; } table.visible-md { - display: table; + display: table !important; } tr.visible-md { display: table-row !important; @@ -6457,7 +6669,7 @@ button.close { display: block !important; } table.visible-lg { - display: table; + display: table !important; } tr.visible-lg { display: table-row !important; @@ -6510,7 +6722,7 @@ button.close { display: block !important; } table.visible-print { - display: table; + display: table !important; } tr.visible-print { display: table-row !important; @@ -8222,4 +8434,4 @@ button.close { content: "\f20c"; } -/*# sourceMappingURL=vendor.css.map */
\ No newline at end of file +/*# sourceMappingURL=vendor.css.map */ diff --git a/libmproxy/web/static/vendor.js b/libmproxy/web/static/vendor.js index 1e83ac50..59d10445 100644 --- a/libmproxy/web/static/vendor.js +++ b/libmproxy/web/static/vendor.js @@ -2,69 +2,74 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ // shim for using process in browser var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canMutationObserver = typeof window !== 'undefined' - && window.MutationObserver; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; } + if (queue.length) { + drainQueue(); + } +} - var queue = []; - - if (canMutationObserver) { - var hiddenDiv = document.createElement("div"); - var observer = new MutationObserver(function () { - var queueList = queue.slice(); - queue.length = 0; - queueList.forEach(function (fn) { - fn(); - }); - }); - - observer.observe(hiddenDiv, { attributes: true }); - - return function nextTick(fn) { - if (!queue.length) { - hiddenDiv.setAttribute('yes', 'no'); - } - queue.push(fn); - }; +function drainQueue() { + if (draining) { + return; } + var timeout = setTimeout(cleanUpNextTick); + draining = true; - if (canPost) { - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; + } + queueIndex = -1; + len = queue.length; } + currentQueue = null; + draining = false; + clearTimeout(timeout); +} - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + setTimeout(drainQueue, 0); + } +}; +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; function noop() {} @@ -80,15 +85,16 @@ process.binding = function (name) { throw new Error('process.binding is not supported'); }; -// TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; +process.umask = function() { return 0; }; },{}],2:[function(require,module,exports){ -/* - * Copyright (c) 2014, Facebook, Inc. +(function (process){ +/** + * Copyright (c) 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -96,14 +102,18 @@ process.chdir = function (dir) { * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Dispatcher - * @typechecks + * + * @preventMunge */ -"use strict"; +'use strict'; + +exports.__esModule = true; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } -var invariant = require('./invariant'); +var invariant = require('fbjs/lib/invariant'); -var _lastID = 1; var _prefix = 'ID_'; /** @@ -153,7 +163,7 @@ var _prefix = 'ID_'; * * This payload is digested by both stores: * - * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { + * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { * if (payload.actionType === 'country-update') { * CountryStore.country = payload.selectedCountry; * } @@ -181,15 +191,11 @@ var _prefix = 'ID_'; * flightDispatcher.register(function(payload) { * switch (payload.actionType) { * case 'country-update': + * case 'city-update': * flightDispatcher.waitFor([CityStore.dispatchToken]); * FlightPriceStore.price = * getFlightPriceStore(CountryStore.country, CityStore.city); * break; - * - * case 'city-update': - * FlightPriceStore.price = - * FlightPriceStore(CountryStore.country, CityStore.city); - * break; * } * }); * @@ -198,131 +204,109 @@ var _prefix = 'ID_'; * `FlightPriceStore`. */ +var Dispatcher = (function () { function Dispatcher() { - this.$Dispatcher_callbacks = {}; - this.$Dispatcher_isPending = {}; - this.$Dispatcher_isHandled = {}; - this.$Dispatcher_isDispatching = false; - this.$Dispatcher_pendingPayload = null; + _classCallCheck(this, Dispatcher); + + this._callbacks = {}; + this._isDispatching = false; + this._isHandled = {}; + this._isPending = {}; + this._lastID = 1; } /** * Registers a callback to be invoked with every dispatched payload. Returns * a token that can be used with `waitFor()`. - * - * @param {function} callback - * @return {string} */ - Dispatcher.prototype.register=function(callback) { - var id = _prefix + _lastID++; - this.$Dispatcher_callbacks[id] = callback; + + Dispatcher.prototype.register = function register(callback) { + var id = _prefix + this._lastID++; + this._callbacks[id] = callback; return id; }; /** * Removes a callback based on its token. - * - * @param {string} id */ - Dispatcher.prototype.unregister=function(id) { - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', - id - ); - delete this.$Dispatcher_callbacks[id]; + + Dispatcher.prototype.unregister = function unregister(id) { + !this._callbacks[id] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', id) : invariant(false) : undefined; + delete this._callbacks[id]; }; /** * Waits for the callbacks specified to be invoked before continuing execution * of the current callback. This method should only be used by a callback in * response to a dispatched payload. - * - * @param {array<string>} ids */ - Dispatcher.prototype.waitFor=function(ids) { - invariant( - this.$Dispatcher_isDispatching, - 'Dispatcher.waitFor(...): Must be invoked while dispatching.' - ); + + Dispatcher.prototype.waitFor = function waitFor(ids) { + !this._isDispatching ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.waitFor(...): Must be invoked while dispatching.') : invariant(false) : undefined; for (var ii = 0; ii < ids.length; ii++) { var id = ids[ii]; - if (this.$Dispatcher_isPending[id]) { - invariant( - this.$Dispatcher_isHandled[id], - 'Dispatcher.waitFor(...): Circular dependency detected while ' + - 'waiting for `%s`.', - id - ); + if (this._isPending[id]) { + !this._isHandled[id] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.waitFor(...): Circular dependency detected while ' + 'waiting for `%s`.', id) : invariant(false) : undefined; continue; } - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', - id - ); - this.$Dispatcher_invokeCallback(id); + !this._callbacks[id] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', id) : invariant(false) : undefined; + this._invokeCallback(id); } }; /** * Dispatches a payload to all registered callbacks. - * - * @param {object} payload */ - Dispatcher.prototype.dispatch=function(payload) { - invariant( - !this.$Dispatcher_isDispatching, - 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.' - ); - this.$Dispatcher_startDispatching(payload); + + Dispatcher.prototype.dispatch = function dispatch(payload) { + !!this._isDispatching ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.') : invariant(false) : undefined; + this._startDispatching(payload); try { - for (var id in this.$Dispatcher_callbacks) { - if (this.$Dispatcher_isPending[id]) { + for (var id in this._callbacks) { + if (this._isPending[id]) { continue; } - this.$Dispatcher_invokeCallback(id); + this._invokeCallback(id); } } finally { - this.$Dispatcher_stopDispatching(); + this._stopDispatching(); } }; /** * Is this Dispatcher currently dispatching. - * - * @return {boolean} */ - Dispatcher.prototype.isDispatching=function() { - return this.$Dispatcher_isDispatching; + + Dispatcher.prototype.isDispatching = function isDispatching() { + return this._isDispatching; }; /** * Call the callback stored with the given id. Also do some internal * bookkeeping. * - * @param {string} id * @internal */ - Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) { - this.$Dispatcher_isPending[id] = true; - this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload); - this.$Dispatcher_isHandled[id] = true; + + Dispatcher.prototype._invokeCallback = function _invokeCallback(id) { + this._isPending[id] = true; + this._callbacks[id](this._pendingPayload); + this._isHandled[id] = true; }; /** * Set up bookkeeping needed when dispatching. * - * @param {object} payload * @internal */ - Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) { - for (var id in this.$Dispatcher_callbacks) { - this.$Dispatcher_isPending[id] = false; - this.$Dispatcher_isHandled[id] = false; + + Dispatcher.prototype._startDispatching = function _startDispatching(payload) { + for (var id in this._callbacks) { + this._isPending[id] = false; + this._isHandled[id] = false; } - this.$Dispatcher_pendingPayload = payload; - this.$Dispatcher_isDispatching = true; + this._pendingPayload = payload; + this._isDispatching = true; }; /** @@ -330,17 +314,22 @@ var _prefix = 'ID_'; * * @internal */ - Dispatcher.prototype.$Dispatcher_stopDispatching=function() { - this.$Dispatcher_pendingPayload = null; - this.$Dispatcher_isDispatching = false; + + Dispatcher.prototype._stopDispatching = function _stopDispatching() { + delete this._pendingPayload; + this._isDispatching = false; }; + return Dispatcher; +})(); module.exports = Dispatcher; +}).call(this,require('_process')) -},{"./invariant":3}],3:[function(require,module,exports){ +},{"_process":1,"fbjs/lib/invariant":3}],3:[function(require,module,exports){ +(function (process){ /** - * Copyright (c) 2014, Facebook, Inc. + * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -363,8 +352,8 @@ module.exports = Dispatcher; * will remain to ensure logic does not differ in production. */ -var invariant = function(condition, format, a, b, c, d, e, f) { - if (false) { +var invariant = function (condition, format, a, b, c, d, e, f) { + if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } @@ -373,17 +362,13 @@ var invariant = function(condition, format, a, b, c, d, e, f) { if (!condition) { var error; if (format === undefined) { - error = new Error( - 'Minified exception occurred; use the non-minified dev environment ' + - 'for the full error message and additional helpful warnings.' - ); + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error( - 'Invariant Violation: ' + - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); + error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + })); } error.framesToPop = 1; // we don't care about invariant's own frame @@ -392,438 +377,23 @@ var invariant = function(condition, format, a, b, c, d, e, f) { }; module.exports = invariant; +}).call(this,require('_process')) -},{}],4:[function(require,module,exports){ -module.exports = require('./lib/'); - -},{"./lib/":5}],5:[function(require,module,exports){ -// Load modules - -var Stringify = require('./stringify'); -var Parse = require('./parse'); - - -// Declare internals - -var internals = {}; - - -module.exports = { - stringify: Stringify, - parse: Parse -}; - -},{"./parse":6,"./stringify":7}],6:[function(require,module,exports){ -// Load modules - -var Utils = require('./utils'); - - -// Declare internals - -var internals = { - delimiter: '&', - depth: 5, - arrayLimit: 20, - parameterLimit: 1000 -}; - - -internals.parseValues = function (str, options) { - - var obj = {}; - var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); - - for (var i = 0, il = parts.length; i < il; ++i) { - var part = parts[i]; - var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; - - if (pos === -1) { - obj[Utils.decode(part)] = ''; - } - else { - var key = Utils.decode(part.slice(0, pos)); - var val = Utils.decode(part.slice(pos + 1)); - - if (Object.prototype.hasOwnProperty(key)) { - continue; - } - - if (!obj.hasOwnProperty(key)) { - obj[key] = val; - } - else { - obj[key] = [].concat(obj[key]).concat(val); - } - } - } - - return obj; -}; - - -internals.parseObject = function (chain, val, options) { - - if (!chain.length) { - return val; - } - - var root = chain.shift(); - - var obj = {}; - if (root === '[]') { - obj = []; - obj = obj.concat(internals.parseObject(chain, val, options)); - } - else { - var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; - var index = parseInt(cleanRoot, 10); - var indexString = '' + index; - if (!isNaN(index) && - root !== cleanRoot && - indexString === cleanRoot && - index >= 0 && - index <= options.arrayLimit) { - - obj = []; - obj[index] = internals.parseObject(chain, val, options); - } - else { - obj[cleanRoot] = internals.parseObject(chain, val, options); - } - } - - return obj; -}; - - -internals.parseKeys = function (key, val, options) { - - if (!key) { - return; - } - - // The regex chunks - - var parent = /^([^\[\]]*)/; - var child = /(\[[^\[\]]*\])/g; - - // Get the parent - - var segment = parent.exec(key); - - // Don't allow them to overwrite object prototype properties - - if (Object.prototype.hasOwnProperty(segment[1])) { - return; - } - - // Stash the parent if it exists - - var keys = []; - if (segment[1]) { - keys.push(segment[1]); - } - - // Loop through children appending to the array until we hit depth - - var i = 0; - while ((segment = child.exec(key)) !== null && i < options.depth) { - - ++i; - if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) { - keys.push(segment[1]); - } - } - - // If there's a remainder, just add whatever is left - - if (segment) { - keys.push('[' + key.slice(segment.index) + ']'); - } - - return internals.parseObject(keys, val, options); -}; - - -module.exports = function (str, options) { - - if (str === '' || - str === null || - typeof str === 'undefined') { - - return {}; - } - - options = options || {}; - options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; - options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; - options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; - options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; - - var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; - var obj = {}; - - // Iterate over the keys and setup the new object - - var keys = Object.keys(tempObj); - for (var i = 0, il = keys.length; i < il; ++i) { - var key = keys[i]; - var newObj = internals.parseKeys(key, tempObj[key], options); - obj = Utils.merge(obj, newObj); - } - - return Utils.compact(obj); -}; - -},{"./utils":8}],7:[function(require,module,exports){ -// Load modules - -var Utils = require('./utils'); - - -// Declare internals - -var internals = { - delimiter: '&', - arrayPrefixGenerators: { - brackets: function (prefix, key) { - return prefix + '[]'; - }, - indices: function (prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function (prefix, key) { - return prefix; - } - } -}; - - -internals.stringify = function (obj, prefix, generateArrayPrefix) { - - if (Utils.isBuffer(obj)) { - obj = obj.toString(); - } - else if (obj instanceof Date) { - obj = obj.toISOString(); - } - else if (obj === null) { - obj = ''; - } - - if (typeof obj === 'string' || - typeof obj === 'number' || - typeof obj === 'boolean') { - - return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)]; - } - - var values = []; - - if (typeof obj === 'undefined') { - return values; - } - - var objKeys = Object.keys(obj); - for (var i = 0, il = objKeys.length; i < il; ++i) { - var key = objKeys[i]; - if (Array.isArray(obj)) { - values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix)); - } - else { - values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix)); - } - } - - return values; -}; - - -module.exports = function (obj, options) { - - options = options || {}; - var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter; - - var keys = []; - - if (typeof obj !== 'object' || - obj === null) { - - return ''; - } - - var arrayFormat; - if (options.arrayFormat in internals.arrayPrefixGenerators) { - arrayFormat = options.arrayFormat; - } - else if ('indices' in options) { - arrayFormat = options.indices ? 'indices' : 'repeat'; - } - else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat]; - - var objKeys = Object.keys(obj); - for (var i = 0, il = objKeys.length; i < il; ++i) { - var key = objKeys[i]; - keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix)); - } - - return keys.join(delimiter); -}; - -},{"./utils":8}],8:[function(require,module,exports){ -// Load modules - - -// Declare internals - -var internals = {}; - - -exports.arrayToObject = function (source) { - - var obj = {}; - for (var i = 0, il = source.length; i < il; ++i) { - if (typeof source[i] !== 'undefined') { - - obj[i] = source[i]; - } - } - - return obj; -}; - - -exports.merge = function (target, source) { - - if (!source) { - return target; - } - - if (typeof source !== 'object') { - if (Array.isArray(target)) { - target.push(source); - } - else { - target[source] = true; - } - - return target; - } - - if (typeof target !== 'object') { - target = [target].concat(source); - return target; - } - - if (Array.isArray(target) && - !Array.isArray(source)) { - - target = exports.arrayToObject(target); - } - - var keys = Object.keys(source); - for (var k = 0, kl = keys.length; k < kl; ++k) { - var key = keys[k]; - var value = source[key]; - - if (!target[key]) { - target[key] = value; - } - else { - target[key] = exports.merge(target[key], value); - } - } - - return target; -}; - - -exports.decode = function (str) { - - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (e) { - return str; - } -}; - - -exports.compact = function (obj, refs) { - - if (typeof obj !== 'object' || - obj === null) { - - return obj; - } - - refs = refs || []; - var lookup = refs.indexOf(obj); - if (lookup !== -1) { - return refs[lookup]; - } - - refs.push(obj); - - if (Array.isArray(obj)) { - var compacted = []; - - for (var i = 0, il = obj.length; i < il; ++i) { - if (typeof obj[i] !== 'undefined') { - compacted.push(obj[i]); - } - } - - return compacted; - } - - var keys = Object.keys(obj); - for (i = 0, il = keys.length; i < il; ++i) { - var key = keys[i]; - obj[key] = exports.compact(obj[key], refs); - } - - return obj; -}; - - -exports.isRegExp = function (obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; - - -exports.isBuffer = function (obj) { - - if (obj === null || - typeof obj === 'undefined') { - - return false; - } - - return !!(obj.constructor && - obj.constructor.isBuffer && - obj.constructor.isBuffer(obj)); -}; - -},{}],9:[function(require,module,exports){ -"use strict"; - +},{"_process":1}],4:[function(require,module,exports){ /** * Represents a cancellation caused by navigating away * before the previous transition has fully resolved. */ +"use strict"; + function Cancellation() {} module.exports = Cancellation; -},{}],10:[function(require,module,exports){ -"use strict"; +},{}],5:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; var History = { @@ -838,7 +408,7 @@ var History = { * Sends the browser back one entry in the history. */ back: function back() { - invariant(canUseDOM, "Cannot use History.back without a DOM"); + invariant(canUseDOM, 'Cannot use History.back without a DOM'); // Do this first so that History.length will // be accurate in location change listeners. @@ -850,15 +420,15 @@ var History = { }; module.exports = History; -},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],11:[function(require,module,exports){ -"use strict"; +},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],6:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (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; }; })(); /* jshint -W084 */ -var PathUtils = require("./PathUtils"); +var PathUtils = require('./PathUtils'); function deepSearch(route, pathname, query) { // Check the subtree first to find the most deeply-nested match. @@ -903,44 +473,33 @@ var Match = (function () { this.routes = routes; } - _createClass(Match, null, { - findMatch: { + _createClass(Match, null, [{ + key: 'findMatch', - /** - * Attempts to match depth-first a route in the given route's - * subtree against the given path and returns the match if it - * succeeds, null if no match can be made. - */ - - value: function findMatch(routes, path) { - var pathname = PathUtils.withoutQuery(path); - var query = PathUtils.extractQuery(path); - var match = null; + /** + * Attempts to match depth-first a route in the given route's + * subtree against the given path and returns the match if it + * succeeds, null if no match can be made. + */ + value: function findMatch(routes, path) { + var pathname = PathUtils.withoutQuery(path); + var query = PathUtils.extractQuery(path); + var match = null; - for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); + for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); - return match; - } + return match; } - }); + }]); return Match; })(); module.exports = Match; -},{"./PathUtils":13}],12:[function(require,module,exports){ -"use strict"; - -var warning = require("react/lib/warning"); -var PropTypes = require("./PropTypes"); +},{"./PathUtils":8}],7:[function(require,module,exports){ +'use strict'; -function deprecatedMethod(routerMethodName, fn) { - return function () { - warning(false, "Router.Navigation is deprecated. Please use this.context.router." + routerMethodName + "() instead"); - - return fn.apply(this, arguments); - }; -} +var PropTypes = require('./PropTypes'); /** * A mixin for components that modify the URL. @@ -970,50 +529,50 @@ var Navigation = { * Returns an absolute URL path created from the given route * name, URL parameters, and query values. */ - makePath: deprecatedMethod("makePath", function (to, params, query) { + makePath: function makePath(to, params, query) { return this.context.router.makePath(to, params, query); - }), + }, /** * Returns a string that may safely be used as the href of a * link to the route with the given name. */ - makeHref: deprecatedMethod("makeHref", function (to, params, query) { + makeHref: function makeHref(to, params, query) { return this.context.router.makeHref(to, params, query); - }), + }, /** * Transitions to the URL specified in the arguments by pushing * a new URL onto the history stack. */ - transitionTo: deprecatedMethod("transitionTo", function (to, params, query) { + transitionTo: function transitionTo(to, params, query) { this.context.router.transitionTo(to, params, query); - }), + }, /** * Transitions to the URL specified in the arguments by replacing * the current URL in the history stack. */ - replaceWith: deprecatedMethod("replaceWith", function (to, params, query) { + replaceWith: function replaceWith(to, params, query) { this.context.router.replaceWith(to, params, query); - }), + }, /** * Transitions to the previous URL. */ - goBack: deprecatedMethod("goBack", function () { + goBack: function goBack() { return this.context.router.goBack(); - }) + } }; module.exports = Navigation; -},{"./PropTypes":14,"react/lib/warning":212}],13:[function(require,module,exports){ -"use strict"; +},{"./PropTypes":9}],8:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var objectAssign = require("object-assign"); -var qs = require("qs"); +var invariant = require('react/lib/invariant'); +var assign = require('object-assign'); +var qs = require('qs'); var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g; @@ -1028,17 +587,17 @@ function compilePattern(pattern) { var source = pattern.replace(paramCompileMatcher, function (match, paramName) { if (paramName) { paramNames.push(paramName); - return "([^/?#]+)"; - } else if (match === "*") { - paramNames.push("splat"); - return "(.*?)"; + return '([^/?#]+)'; + } else if (match === '*') { + paramNames.push('splat'); + return '(.*?)'; } else { - return "\\" + match; + return '\\' + match; } }); _compiledPatterns[pattern] = { - matcher: new RegExp("^" + source + "$", "i"), + matcher: new RegExp('^' + source + '$', 'i'), paramNames: paramNames }; } @@ -1052,14 +611,14 @@ var PathUtils = { * Returns true if the given path is absolute. */ isAbsolute: function isAbsolute(path) { - return path.charAt(0) === "/"; + return path.charAt(0) === '/'; }, /** * Joins two URL paths together. */ join: function join(a, b) { - return a.replace(/\/*$/, "/") + b; + return a.replace(/\/*$/, '/') + b; }, /** @@ -1103,28 +662,28 @@ var PathUtils = { var splatIndex = 0; return pattern.replace(paramInjectMatcher, function (match, paramName) { - paramName = paramName || "splat"; + paramName = paramName || 'splat'; // If param is optional don't check for existence - if (paramName.slice(-1) === "?") { + if (paramName.slice(-1) === '?') { paramName = paramName.slice(0, -1); - if (params[paramName] == null) return ""; + if (params[paramName] == null) return ''; } else { - invariant(params[paramName] != null, "Missing \"%s\" parameter for path \"%s\"", paramName, pattern); + invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern); } var segment; - if (paramName === "splat" && Array.isArray(params[paramName])) { + if (paramName === 'splat' && Array.isArray(params[paramName])) { segment = params[paramName][splatIndex++]; - invariant(segment != null, "Missing splat # %s for path \"%s\"", splatIndex, pattern); + invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern); } else { segment = params[paramName]; } return segment; - }).replace(paramInjectTrailingSlashMatcher, "/"); + }).replace(paramInjectTrailingSlashMatcher, '/'); }, /** @@ -1140,7 +699,7 @@ var PathUtils = { * Returns a version of the given path without the query string. */ withoutQuery: function withoutQuery(path) { - return path.replace(queryMatcher, ""); + return path.replace(queryMatcher, ''); }, /** @@ -1150,24 +709,24 @@ var PathUtils = { withQuery: function withQuery(path, query) { var existingQuery = PathUtils.extractQuery(path); - if (existingQuery) query = query ? objectAssign(existingQuery, query) : existingQuery; + if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery; - var queryString = qs.stringify(query, { arrayFormat: "brackets" }); + var queryString = qs.stringify(query, { arrayFormat: 'brackets' }); if (queryString) { - return PathUtils.withoutQuery(path) + "?" + queryString; + return PathUtils.withoutQuery(path) + '?' + queryString; }return PathUtils.withoutQuery(path); } }; module.exports = PathUtils; -},{"object-assign":41,"qs":4,"react/lib/invariant":191}],14:[function(require,module,exports){ -"use strict"; +},{"object-assign":36,"qs":37,"react/lib/invariant":191}],9:[function(require,module,exports){ +'use strict'; -var assign = require("react/lib/Object.assign"); -var ReactPropTypes = require("react").PropTypes; -var Route = require("./Route"); +var assign = require('react/lib/Object.assign'); +var ReactPropTypes = require('react').PropTypes; +var Route = require('./Route'); var PropTypes = assign({}, ReactPropTypes, { @@ -1176,7 +735,7 @@ var PropTypes = assign({}, ReactPropTypes, { */ falsy: function falsy(props, propName, componentName) { if (props[propName]) { - return new Error("<" + componentName + "> may not have a \"" + propName + "\" prop"); + return new Error('<' + componentName + '> should not have a "' + propName + '" prop'); } }, @@ -1194,12 +753,12 @@ var PropTypes = assign({}, ReactPropTypes, { }); module.exports = PropTypes; -},{"./Route":16,"react":"react","react/lib/Object.assign":69}],15:[function(require,module,exports){ -"use strict"; - +},{"./Route":11,"react":"react","react/lib/Object.assign":69}],10:[function(require,module,exports){ /** * Encapsulates a redirect to the given route. */ +"use strict"; + function Redirect(to, params, query) { this.to = to; this.params = params; @@ -1207,17 +766,17 @@ function Redirect(to, params, query) { } module.exports = Redirect; -},{}],16:[function(require,module,exports){ -"use strict"; +},{}],11:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (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 assign = require("react/lib/Object.assign"); -var invariant = require("react/lib/invariant"); -var warning = require("react/lib/warning"); -var PathUtils = require("./PathUtils"); +var assign = require('react/lib/Object.assign'); +var invariant = require('react/lib/invariant'); +var warning = require('react/lib/warning'); +var PathUtils = require('./PathUtils'); var _currentRoute; @@ -1236,191 +795,184 @@ var Route = (function () { this.handler = handler; } - _createClass(Route, { - appendChild: { - - /** - * Appends the given route to this route's child routes. - */ - - value: function appendChild(route) { - invariant(route instanceof Route, "route.appendChild must use a valid Route"); + _createClass(Route, [{ + key: 'appendChild', - if (!this.childRoutes) this.childRoutes = []; - - this.childRoutes.push(route); - } - }, - toString: { - value: function toString() { - var string = "<Route"; - - if (this.name) string += " name=\"" + this.name + "\""; + /** + * Appends the given route to this route's child routes. + */ + value: function appendChild(route) { + invariant(route instanceof Route, 'route.appendChild must use a valid Route'); - string += " path=\"" + this.path + "\">"; + if (!this.childRoutes) this.childRoutes = []; - return string; - } + this.childRoutes.push(route); } }, { - createRoute: { - - /** - * Creates and returns a new route. Options may be a URL pathname string - * with placeholders for named params or an object with any of the following - * properties: - * - * - name The name of the route. This is used to lookup a - * route relative to its parent route and should be - * unique among all child routes of the same parent - * - path A URL pathname string with optional placeholders - * that specify the names of params to extract from - * the URL when the path matches. Defaults to `/${name}` - * when there is a name given, or the path of the parent - * route, or / - * - ignoreScrollBehavior True to make this route (and all descendants) ignore - * the scroll behavior of the router - * - isDefault True to make this route the default route among all - * its siblings - * - isNotFound True to make this route the "not found" route among - * all its siblings - * - onEnter A transition hook that will be called when the - * router is going to enter this route - * - onLeave A transition hook that will be called when the - * router is going to leave this route - * - handler A React component that will be rendered when - * this route is active - * - parentRoute The parent route to use for this route. This option - * is automatically supplied when creating routes inside - * the callback to another invocation of createRoute. You - * only ever need to use this when declaring routes - * independently of one another to manually piece together - * the route hierarchy - * - * The callback may be used to structure your route hierarchy. Any call to - * createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect - * inside the callback automatically uses this route as its parent. - */ - - value: function createRoute(options, callback) { - options = options || {}; - - if (typeof options === "string") options = { path: options }; - - var parentRoute = _currentRoute; - - if (parentRoute) { - warning(options.parentRoute == null || options.parentRoute === parentRoute, "You should not use parentRoute with createRoute inside another route's child callback; it is ignored"); - } else { - parentRoute = options.parentRoute; - } + key: 'toString', + value: function toString() { + var string = '<Route'; + + if (this.name) string += ' name="' + this.name + '"'; + + string += ' path="' + this.path + '">'; + + return string; + } + }], [{ + key: 'createRoute', + + /** + * Creates and returns a new route. Options may be a URL pathname string + * with placeholders for named params or an object with any of the following + * properties: + * + * - name The name of the route. This is used to lookup a + * route relative to its parent route and should be + * unique among all child routes of the same parent + * - path A URL pathname string with optional placeholders + * that specify the names of params to extract from + * the URL when the path matches. Defaults to `/${name}` + * when there is a name given, or the path of the parent + * route, or / + * - ignoreScrollBehavior True to make this route (and all descendants) ignore + * the scroll behavior of the router + * - isDefault True to make this route the default route among all + * its siblings + * - isNotFound True to make this route the "not found" route among + * all its siblings + * - onEnter A transition hook that will be called when the + * router is going to enter this route + * - onLeave A transition hook that will be called when the + * router is going to leave this route + * - handler A React component that will be rendered when + * this route is active + * - parentRoute The parent route to use for this route. This option + * is automatically supplied when creating routes inside + * the callback to another invocation of createRoute. You + * only ever need to use this when declaring routes + * independently of one another to manually piece together + * the route hierarchy + * + * The callback may be used to structure your route hierarchy. Any call to + * createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect + * inside the callback automatically uses this route as its parent. + */ + value: function createRoute(options, callback) { + options = options || {}; + + if (typeof options === 'string') options = { path: options }; + + var parentRoute = _currentRoute; + + if (parentRoute) { + warning(options.parentRoute == null || options.parentRoute === parentRoute, 'You should not use parentRoute with createRoute inside another route\'s child callback; it is ignored'); + } else { + parentRoute = options.parentRoute; + } - var name = options.name; - var path = options.path || name; + var name = options.name; + var path = options.path || name; - if (path && !(options.isDefault || options.isNotFound)) { - if (PathUtils.isAbsolute(path)) { - if (parentRoute) { - invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, "You cannot nest path \"%s\" inside \"%s\"; the parent requires URL parameters", path, parentRoute.path); - } - } else if (parentRoute) { - // Relative paths extend their parent. - path = PathUtils.join(parentRoute.path, path); - } else { - path = "/" + path; + if (path && !(options.isDefault || options.isNotFound)) { + if (PathUtils.isAbsolute(path)) { + if (parentRoute) { + invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, 'You cannot nest path "%s" inside "%s"; the parent requires URL parameters', path, parentRoute.path); } + } else if (parentRoute) { + // Relative paths extend their parent. + path = PathUtils.join(parentRoute.path, path); } else { - path = parentRoute ? parentRoute.path : "/"; + path = '/' + path; } + } else { + path = parentRoute ? parentRoute.path : '/'; + } - if (options.isNotFound && !/\*$/.test(path)) path += "*"; // Auto-append * to the path of not found routes. - - var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler); - - if (parentRoute) { - if (route.isDefault) { - invariant(parentRoute.defaultRoute == null, "%s may not have more than one default route", parentRoute); + if (options.isNotFound && !/\*$/.test(path)) path += '*'; // Auto-append * to the path of not found routes. - parentRoute.defaultRoute = route; - } else if (route.isNotFound) { - invariant(parentRoute.notFoundRoute == null, "%s may not have more than one not found route", parentRoute); + var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler); - parentRoute.notFoundRoute = route; - } + if (parentRoute) { + if (route.isDefault) { + invariant(parentRoute.defaultRoute == null, '%s may not have more than one default route', parentRoute); - parentRoute.appendChild(route); - } + parentRoute.defaultRoute = route; + } else if (route.isNotFound) { + invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute); - // Any routes created in the callback - // use this route as their parent. - if (typeof callback === "function") { - var currentRoute = _currentRoute; - _currentRoute = route; - callback.call(route, route); - _currentRoute = currentRoute; + parentRoute.notFoundRoute = route; } - return route; + parentRoute.appendChild(route); } - }, - createDefaultRoute: { - - /** - * Creates and returns a route that is rendered when its parent matches - * the current URL. - */ - value: function createDefaultRoute(options) { - return Route.createRoute(assign({}, options, { isDefault: true })); + // Any routes created in the callback + // use this route as their parent. + if (typeof callback === 'function') { + var currentRoute = _currentRoute; + _currentRoute = route; + callback.call(route, route); + _currentRoute = currentRoute; } - }, - createNotFoundRoute: { - /** - * Creates and returns a route that is rendered when its parent matches - * the current URL but none of its siblings do. - */ + return route; + } + }, { + key: 'createDefaultRoute', - value: function createNotFoundRoute(options) { - return Route.createRoute(assign({}, options, { isNotFound: true })); - } - }, - createRedirect: { + /** + * Creates and returns a route that is rendered when its parent matches + * the current URL. + */ + value: function createDefaultRoute(options) { + return Route.createRoute(assign({}, options, { isDefault: true })); + } + }, { + key: 'createNotFoundRoute', - /** - * Creates and returns a route that automatically redirects the transition - * to another route. In addition to the normal options to createRoute, this - * function accepts the following options: - * - * - from An alias for the `path` option. Defaults to * - * - to The path/route/route name to redirect to - * - params The params to use in the redirect URL. Defaults - * to using the current params - * - query The query to use in the redirect URL. Defaults - * to using the current query - */ + /** + * Creates and returns a route that is rendered when its parent matches + * the current URL but none of its siblings do. + */ + value: function createNotFoundRoute(options) { + return Route.createRoute(assign({}, options, { isNotFound: true })); + } + }, { + key: 'createRedirect', - value: function createRedirect(options) { - return Route.createRoute(assign({}, options, { - path: options.path || options.from || "*", - onEnter: function onEnter(transition, params, query) { - transition.redirect(options.to, options.params || params, options.query || query); - } - })); - } + /** + * Creates and returns a route that automatically redirects the transition + * to another route. In addition to the normal options to createRoute, this + * function accepts the following options: + * + * - from An alias for the `path` option. Defaults to * + * - to The path/route/route name to redirect to + * - params The params to use in the redirect URL. Defaults + * to using the current params + * - query The query to use in the redirect URL. Defaults + * to using the current query + */ + value: function createRedirect(options) { + return Route.createRoute(assign({}, options, { + path: options.path || options.from || '*', + onEnter: function onEnter(transition, params, query) { + transition.redirect(options.to, options.params || params, options.query || query); + } + })); } - }); + }]); return Route; })(); module.exports = Route; -},{"./PathUtils":13,"react/lib/Object.assign":69,"react/lib/invariant":191,"react/lib/warning":212}],17:[function(require,module,exports){ -"use strict"; +},{"./PathUtils":8,"react/lib/Object.assign":69,"react/lib/invariant":191,"react/lib/warning":212}],12:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; -var getWindowScrollPosition = require("./getWindowScrollPosition"); +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; +var getWindowScrollPosition = require('./getWindowScrollPosition'); function shouldUpdateScroll(state, prevState) { if (!prevState) { @@ -1469,7 +1021,7 @@ var ScrollHistory = { }, componentWillMount: function componentWillMount() { - invariant(this.constructor.getScrollBehavior() == null || canUseDOM, "Cannot use scroll behavior without a DOM"); + invariant(this.constructor.getScrollBehavior() == null || canUseDOM, 'Cannot use scroll behavior without a DOM'); }, componentDidMount: function componentDidMount() { @@ -1491,19 +1043,10 @@ var ScrollHistory = { }; module.exports = ScrollHistory; -},{"./getWindowScrollPosition":32,"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],18:[function(require,module,exports){ -"use strict"; - -var warning = require("react/lib/warning"); -var PropTypes = require("./PropTypes"); - -function deprecatedMethod(routerMethodName, fn) { - return function () { - warning(false, "Router.State is deprecated. Please use this.context.router." + routerMethodName + "() instead"); +},{"./getWindowScrollPosition":27,"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],13:[function(require,module,exports){ +'use strict'; - return fn.apply(this, arguments); - }; -} +var PropTypes = require('./PropTypes'); /** * A mixin for components that need to know the path, routes, URL @@ -1515,10 +1058,10 @@ function deprecatedMethod(routerMethodName, fn) { * mixins: [ Router.State ], * render() { * var className = this.props.className; - * + * * if (this.isActive('about')) * className += ' is-active'; - * + * * return React.DOM.a({ className: className }, this.props.children); * } * }); @@ -1532,56 +1075,56 @@ var State = { /** * Returns the current URL path. */ - getPath: deprecatedMethod("getCurrentPath", function () { + getPath: function getPath() { return this.context.router.getCurrentPath(); - }), + }, /** * Returns the current URL path without the query string. */ - getPathname: deprecatedMethod("getCurrentPathname", function () { + getPathname: function getPathname() { return this.context.router.getCurrentPathname(); - }), + }, /** * Returns an object of the URL params that are currently active. */ - getParams: deprecatedMethod("getCurrentParams", function () { + getParams: function getParams() { return this.context.router.getCurrentParams(); - }), + }, /** * Returns an object of the query params that are currently active. */ - getQuery: deprecatedMethod("getCurrentQuery", function () { + getQuery: function getQuery() { return this.context.router.getCurrentQuery(); - }), + }, /** * Returns an array of the routes that are currently active. */ - getRoutes: deprecatedMethod("getCurrentRoutes", function () { + getRoutes: function getRoutes() { return this.context.router.getCurrentRoutes(); - }), + }, /** * A helper method to determine if a given route, params, and query * are active. */ - isActive: deprecatedMethod("isActive", function (to, params, query) { + isActive: function isActive(to, params, query) { return this.context.router.isActive(to, params, query); - }) + } }; module.exports = State; -},{"./PropTypes":14,"react/lib/warning":212}],19:[function(require,module,exports){ -"use strict"; - +},{"./PropTypes":9}],14:[function(require,module,exports){ /* jshint -W058 */ -var Cancellation = require("./Cancellation"); -var Redirect = require("./Redirect"); +'use strict'; + +var Cancellation = require('./Cancellation'); +var Redirect = require('./Redirect'); /** * Encapsulates a transition to a given path. @@ -1597,7 +1140,7 @@ function Transition(path, retry) { } Transition.prototype.abort = function (reason) { - if (this.abortReason == null) this.abortReason = reason || "ABORT"; + if (this.abortReason == null) this.abortReason = reason || 'ABORT'; }; Transition.prototype.redirect = function (to, params, query) { @@ -1651,36 +1194,36 @@ Transition.to = function (transition, routes, params, query, callback) { }; module.exports = Transition; -},{"./Cancellation":9,"./Redirect":15}],20:[function(require,module,exports){ -"use strict"; - +},{"./Cancellation":4,"./Redirect":10}],15:[function(require,module,exports){ /** * Actions that modify the URL. */ +'use strict'; + var LocationActions = { /** * Indicates a new location is being pushed to the history stack. */ - PUSH: "push", + PUSH: 'push', /** * Indicates the current location should be replaced. */ - REPLACE: "replace", + REPLACE: 'replace', /** * Indicates the most recent entry should be removed from the history stack. */ - POP: "pop" + POP: 'pop' }; module.exports = LocationActions; -},{}],21:[function(require,module,exports){ -"use strict"; +},{}],16:[function(require,module,exports){ +'use strict'; -var LocationActions = require("../actions/LocationActions"); +var LocationActions = require('../actions/LocationActions'); /** * A scroll behavior that attempts to imitate the default behavior @@ -1707,13 +1250,13 @@ var ImitateBrowserBehavior = { }; module.exports = ImitateBrowserBehavior; -},{"../actions/LocationActions":20}],22:[function(require,module,exports){ -"use strict"; - +},{"../actions/LocationActions":15}],17:[function(require,module,exports){ /** * A scroll behavior that always scrolls to the top of the page * after a transition. */ +"use strict"; + var ScrollToTopBehavior = { updateScrollPosition: function updateScrollPosition() { @@ -1723,14 +1266,14 @@ var ScrollToTopBehavior = { }; module.exports = ScrollToTopBehavior; -},{}],23:[function(require,module,exports){ -"use strict"; +},{}],18:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (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) 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 _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; /** * This component is necessary to get around a context warning @@ -1738,7 +1281,7 @@ var _classCallCheck = function (instance, Constructor) { if (!(instance instance * between the "owner" and "parent" contexts. */ -var React = require("react"); +var React = require('react'); var ContextWrapper = (function (_React$Component) { function ContextWrapper() { @@ -1751,28 +1294,27 @@ var ContextWrapper = (function (_React$Component) { _inherits(ContextWrapper, _React$Component); - _createClass(ContextWrapper, { - render: { - value: function render() { - return this.props.children; - } + _createClass(ContextWrapper, [{ + key: 'render', + value: function render() { + return this.props.children; } - }); + }]); return ContextWrapper; })(React.Component); module.exports = ContextWrapper; -},{"react":"react"}],24:[function(require,module,exports){ -"use strict"; +},{"react":"react"}],19:[function(require,module,exports){ +'use strict'; -var _inherits = function (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) subClass.__proto__ = superClass; }; +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; -var PropTypes = require("../PropTypes"); -var RouteHandler = require("./RouteHandler"); -var Route = require("./Route"); +var PropTypes = require('../PropTypes'); +var RouteHandler = require('./RouteHandler'); +var Route = require('./Route'); /** * A <DefaultRoute> component is a special kind of <Route> that @@ -1811,18 +1353,18 @@ DefaultRoute.defaultProps = { }; module.exports = DefaultRoute; -},{"../PropTypes":14,"./Route":28,"./RouteHandler":29}],25:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./Route":23,"./RouteHandler":24}],20:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (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) 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 _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; -var React = require("react"); -var assign = require("react/lib/Object.assign"); -var PropTypes = require("../PropTypes"); +var React = require('react'); +var assign = require('react/lib/Object.assign'); +var PropTypes = require('../PropTypes'); function isLeftClickEvent(event) { return event.button === 0; @@ -1862,67 +1404,64 @@ var Link = (function (_React$Component) { _inherits(Link, _React$Component); - _createClass(Link, { - handleClick: { - value: function handleClick(event) { - var allowTransition = true; - var clickResult; - - if (this.props.onClick) clickResult = this.props.onClick(event); + _createClass(Link, [{ + key: 'handleClick', + value: function handleClick(event) { + var allowTransition = true; + var clickResult; - if (isModifiedEvent(event) || !isLeftClickEvent(event)) { - return; - }if (clickResult === false || event.defaultPrevented === true) allowTransition = false; - - event.preventDefault(); + if (this.props.onClick) clickResult = this.props.onClick(event); - if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query); - } - }, - getHref: { + if (isModifiedEvent(event) || !isLeftClickEvent(event)) { + return; + }if (clickResult === false || event.defaultPrevented === true) allowTransition = false; - /** - * Returns the value of the "href" attribute to use on the DOM element. - */ + event.preventDefault(); - value: function getHref() { - return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); - } - }, - getClassName: { + if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query); + } + }, { + key: 'getHref', - /** - * Returns the value of the "class" attribute to use on the DOM element, which contains - * the value of the activeClassName property when this <Link> is active. - */ + /** + * Returns the value of the "href" attribute to use on the DOM element. + */ + value: function getHref() { + return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); + } + }, { + key: 'getClassName', - value: function getClassName() { - var className = this.props.className; + /** + * Returns the value of the "class" attribute to use on the DOM element, which contains + * the value of the activeClassName property when this <Link> is active. + */ + value: function getClassName() { + var className = this.props.className; - if (this.getActiveState()) className += " " + this.props.activeClassName; + if (this.getActiveState()) className += ' ' + this.props.activeClassName; - return className; - } - }, - getActiveState: { - value: function getActiveState() { - return this.context.router.isActive(this.props.to, this.props.params, this.props.query); - } - }, - render: { - value: function render() { - var props = assign({}, this.props, { - href: this.getHref(), - className: this.getClassName(), - onClick: this.handleClick.bind(this) - }); + return className; + } + }, { + key: 'getActiveState', + value: function getActiveState() { + return this.context.router.isActive(this.props.to, this.props.params, this.props.query); + } + }, { + key: 'render', + value: function render() { + var props = assign({}, this.props, { + href: this.getHref(), + className: this.getClassName(), + onClick: this.handleClick.bind(this) + }); - if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle; + if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle; - return React.DOM.a(props, this.props.children); - } + return React.DOM.a(props, this.props.children); } - }); + }]); return Link; })(React.Component); @@ -1945,21 +1484,21 @@ Link.propTypes = { }; Link.defaultProps = { - activeClassName: "active", - className: "" + activeClassName: 'active', + className: '' }; module.exports = Link; -},{"../PropTypes":14,"react":"react","react/lib/Object.assign":69}],26:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"react":"react","react/lib/Object.assign":69}],21:[function(require,module,exports){ +'use strict'; -var _inherits = function (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) subClass.__proto__ = superClass; }; +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; -var PropTypes = require("../PropTypes"); -var RouteHandler = require("./RouteHandler"); -var Route = require("./Route"); +var PropTypes = require('../PropTypes'); +var RouteHandler = require('./RouteHandler'); +var Route = require('./Route'); /** * A <NotFoundRoute> is a special kind of <Route> that @@ -1999,15 +1538,15 @@ NotFoundRoute.defaultProps = { }; module.exports = NotFoundRoute; -},{"../PropTypes":14,"./Route":28,"./RouteHandler":29}],27:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./Route":23,"./RouteHandler":24}],22:[function(require,module,exports){ +'use strict'; -var _inherits = function (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) subClass.__proto__ = superClass; }; +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; -var PropTypes = require("../PropTypes"); -var Route = require("./Route"); +var PropTypes = require('../PropTypes'); +var Route = require('./Route'); /** * A <Redirect> component is a special kind of <Route> that always @@ -2043,19 +1582,19 @@ Redirect.propTypes = { Redirect.defaultProps = {}; module.exports = Redirect; -},{"../PropTypes":14,"./Route":28}],28:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./Route":23}],23:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (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) 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 _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; -var React = require("react"); -var invariant = require("react/lib/invariant"); -var PropTypes = require("../PropTypes"); -var RouteHandler = require("./RouteHandler"); +var React = require('react'); +var invariant = require('react/lib/invariant'); +var PropTypes = require('../PropTypes'); +var RouteHandler = require('./RouteHandler'); /** * <Route> components specify components that are rendered to the page when the @@ -2109,13 +1648,12 @@ var Route = (function (_React$Component) { _inherits(Route, _React$Component); - _createClass(Route, { - render: { - value: function render() { - invariant(false, "%s elements are for router configuration only and should not be rendered", this.constructor.name); - } + _createClass(Route, [{ + key: 'render', + value: function render() { + invariant(false, '%s elements are for router configuration only and should not be rendered', this.constructor.name); } - }); + }]); return Route; })(React.Component); @@ -2136,21 +1674,21 @@ Route.defaultProps = { }; module.exports = Route; -},{"../PropTypes":14,"./RouteHandler":29,"react":"react","react/lib/invariant":191}],29:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./RouteHandler":24,"react":"react","react/lib/invariant":191}],24:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (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) 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 _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (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) subClass.__proto__ = superClass; }; -var React = require("react"); -var ContextWrapper = require("./ContextWrapper"); -var assign = require("react/lib/Object.assign"); -var PropTypes = require("../PropTypes"); +var React = require('react'); +var ContextWrapper = require('./ContextWrapper'); +var assign = require('react/lib/Object.assign'); +var PropTypes = require('../PropTypes'); -var REF_NAME = "__routeHandler__"; +var REF_NAME = '__routeHandler__'; /** * A <RouteHandler> component renders the active child route handler @@ -2168,57 +1706,65 @@ var RouteHandler = (function (_React$Component) { _inherits(RouteHandler, _React$Component); - _createClass(RouteHandler, { - getChildContext: { - value: function getChildContext() { - return { - routeDepth: this.context.routeDepth + 1 - }; - } - }, - componentDidMount: { - value: function componentDidMount() { - this._updateRouteComponent(this.refs[REF_NAME]); - } - }, - componentDidUpdate: { - value: function componentDidUpdate() { - this._updateRouteComponent(this.refs[REF_NAME]); - } - }, - componentWillUnmount: { - value: function componentWillUnmount() { - this._updateRouteComponent(null); - } - }, - _updateRouteComponent: { - value: function _updateRouteComponent(component) { - this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component); - } - }, - getRouteDepth: { - value: function getRouteDepth() { - return this.context.routeDepth; - } - }, - createChildRouteHandler: { - value: function createChildRouteHandler(props) { - var route = this.context.router.getRouteAtDepth(this.getRouteDepth()); - return route ? React.createElement(route.handler, assign({}, props || this.props, { ref: REF_NAME })) : null; - } - }, - render: { - value: function render() { - var handler = this.createChildRouteHandler(); - // <script/> for things like <CSSTransitionGroup/> that don't like null - return handler ? React.createElement( - ContextWrapper, - null, - handler - ) : React.createElement("script", null); - } + _createClass(RouteHandler, [{ + key: 'getChildContext', + value: function getChildContext() { + return { + routeDepth: this.context.routeDepth + 1 + }; } - }); + }, { + key: 'componentDidMount', + value: function componentDidMount() { + this._updateRouteComponent(this.refs[REF_NAME]); + } + }, { + key: 'componentDidUpdate', + value: function componentDidUpdate() { + this._updateRouteComponent(this.refs[REF_NAME]); + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this._updateRouteComponent(null); + } + }, { + key: '_updateRouteComponent', + value: function _updateRouteComponent(component) { + this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component); + } + }, { + key: 'getRouteDepth', + value: function getRouteDepth() { + return this.context.routeDepth; + } + }, { + key: 'createChildRouteHandler', + value: function createChildRouteHandler(props) { + var route = this.context.router.getRouteAtDepth(this.getRouteDepth()); + + if (route == null) { + return null; + }var childProps = assign({}, props || this.props, { + ref: REF_NAME, + params: this.context.router.getCurrentParams(), + query: this.context.router.getCurrentQuery() + }); + + return React.createElement(route.handler, childProps); + } + }, { + key: 'render', + value: function render() { + var handler = this.createChildRouteHandler(); + // <script/> for things like <CSSTransitionGroup/> that don't like null + return handler ? React.createElement( + ContextWrapper, + null, + handler + ) : React.createElement('script', null); + } + }]); return RouteHandler; })(React.Component); @@ -2237,38 +1783,38 @@ RouteHandler.childContextTypes = { }; module.exports = RouteHandler; -},{"../PropTypes":14,"./ContextWrapper":23,"react":"react","react/lib/Object.assign":69}],30:[function(require,module,exports){ +},{"../PropTypes":9,"./ContextWrapper":18,"react":"react","react/lib/Object.assign":69}],25:[function(require,module,exports){ (function (process){ -"use strict"; - /* jshint -W058 */ -var React = require("react"); -var warning = require("react/lib/warning"); -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; -var LocationActions = require("./actions/LocationActions"); -var ImitateBrowserBehavior = require("./behaviors/ImitateBrowserBehavior"); -var HashLocation = require("./locations/HashLocation"); -var HistoryLocation = require("./locations/HistoryLocation"); -var RefreshLocation = require("./locations/RefreshLocation"); -var StaticLocation = require("./locations/StaticLocation"); -var ScrollHistory = require("./ScrollHistory"); -var createRoutesFromReactChildren = require("./createRoutesFromReactChildren"); -var isReactChildren = require("./isReactChildren"); -var Transition = require("./Transition"); -var PropTypes = require("./PropTypes"); -var Redirect = require("./Redirect"); -var History = require("./History"); -var Cancellation = require("./Cancellation"); -var Match = require("./Match"); -var Route = require("./Route"); -var supportsHistory = require("./supportsHistory"); -var PathUtils = require("./PathUtils"); +'use strict'; + +var React = require('react'); +var warning = require('react/lib/warning'); +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; +var LocationActions = require('./actions/LocationActions'); +var ImitateBrowserBehavior = require('./behaviors/ImitateBrowserBehavior'); +var HashLocation = require('./locations/HashLocation'); +var HistoryLocation = require('./locations/HistoryLocation'); +var RefreshLocation = require('./locations/RefreshLocation'); +var StaticLocation = require('./locations/StaticLocation'); +var ScrollHistory = require('./ScrollHistory'); +var createRoutesFromReactChildren = require('./createRoutesFromReactChildren'); +var isReactChildren = require('./isReactChildren'); +var Transition = require('./Transition'); +var PropTypes = require('./PropTypes'); +var Redirect = require('./Redirect'); +var History = require('./History'); +var Cancellation = require('./Cancellation'); +var Match = require('./Match'); +var Route = require('./Route'); +var supportsHistory = require('./supportsHistory'); +var PathUtils = require('./PathUtils'); /** * The default location for new routers. */ -var DEFAULT_LOCATION = canUseDOM ? HashLocation : "/"; +var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/'; /** * The default scroll behavior for new routers. @@ -2306,7 +1852,7 @@ function addRoutesToNamedRoutes(routes, namedRoutes) { route = routes[i]; if (route.name) { - invariant(namedRoutes[route.name] == null, "You may not have more than one route named \"%s\"", route.name); + invariant(namedRoutes[route.name] == null, 'You may not have more than one route named "%s"', route.name); namedRoutes[route.name] = route; } @@ -2364,12 +1910,12 @@ function createRouter(options) { var pendingTransition = null; var dispatchHandler = null; - if (typeof location === "string") location = new StaticLocation(location); + if (typeof location === 'string') location = new StaticLocation(location); if (location instanceof StaticLocation) { - warning(!canUseDOM || process.env.NODE_ENV === "test", "You should not use a static location in a DOM environment because " + "the router will not be kept in sync with the current URL"); + warning(!canUseDOM || process.env.NODE_ENV === 'test', 'You should not use a static location in a DOM environment because ' + 'the router will not be kept in sync with the current URL'); } else { - invariant(canUseDOM || location.needsDOM === false, "You cannot use %s without a DOM", location); + invariant(canUseDOM || location.needsDOM === false, 'You cannot use %s without a DOM', location); } // Automatically fall back to full page refreshes in @@ -2378,7 +1924,7 @@ function createRouter(options) { var Router = React.createClass({ - displayName: "Router", + displayName: 'Router', statics: { @@ -2437,7 +1983,7 @@ function createRouter(options) { } else { var route = to instanceof Route ? to : Router.namedRoutes[to]; - invariant(route instanceof Route, "Cannot find a route named \"%s\"", to); + invariant(route instanceof Route, 'Cannot find a route named "%s"', to); path = route.path; } @@ -2451,7 +1997,7 @@ function createRouter(options) { */ makeHref: function makeHref(to, params, query) { var path = Router.makePath(to, params, query); - return location === HashLocation ? "#" + path : path; + return location === HashLocation ? '#' + path : path; }, /** @@ -2494,13 +2040,13 @@ function createRouter(options) { return true; } - warning(false, "goBack() was ignored because there is no router history"); + warning(false, 'goBack() was ignored because there is no router history'); return false; }, handleAbort: options.onAbort || function (abortReason) { - if (location instanceof StaticLocation) throw new Error("Unhandled aborted transition! Reason: " + abortReason); + if (location instanceof StaticLocation) throw new Error('Unhandled aborted transition! Reason: ' + abortReason); if (abortReason instanceof Cancellation) { return; @@ -2552,7 +2098,7 @@ function createRouter(options) { var match = Router.match(path); - warning(match != null, "No route matches path \"%s\". Make sure you have <Route path=\"%s\"> somewhere in your routes", path, path); + warning(match != null, 'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes', path, path); if (match == null) match = {}; @@ -2607,7 +2153,7 @@ function createRouter(options) { * Router.*Location objects (e.g. Router.HashLocation or Router.HistoryLocation). */ run: function run(callback) { - invariant(!Router.isRunning, "Router is already running"); + invariant(!Router.isRunning, 'Router is already running'); dispatchHandler = function (error, transition, newState) { if (error) Router.handleError(error); @@ -2754,20 +2300,21 @@ function createRouter(options) { module.exports = createRouter; }).call(this,require('_process')) -},{"./Cancellation":9,"./History":10,"./Match":11,"./PathUtils":13,"./PropTypes":14,"./Redirect":15,"./Route":16,"./ScrollHistory":17,"./Transition":19,"./actions/LocationActions":20,"./behaviors/ImitateBrowserBehavior":21,"./createRoutesFromReactChildren":31,"./isReactChildren":33,"./locations/HashLocation":34,"./locations/HistoryLocation":35,"./locations/RefreshLocation":36,"./locations/StaticLocation":37,"./supportsHistory":40,"_process":1,"react":"react","react/lib/ExecutionEnvironment":62,"react/lib/invariant":191,"react/lib/warning":212}],31:[function(require,module,exports){ -"use strict"; +},{"./Cancellation":4,"./History":5,"./Match":6,"./PathUtils":8,"./PropTypes":9,"./Redirect":10,"./Route":11,"./ScrollHistory":12,"./Transition":14,"./actions/LocationActions":15,"./behaviors/ImitateBrowserBehavior":16,"./createRoutesFromReactChildren":26,"./isReactChildren":28,"./locations/HashLocation":29,"./locations/HistoryLocation":30,"./locations/RefreshLocation":31,"./locations/StaticLocation":32,"./supportsHistory":35,"_process":1,"react":"react","react/lib/ExecutionEnvironment":62,"react/lib/invariant":191,"react/lib/warning":212}],26:[function(require,module,exports){ /* jshint -W084 */ -var React = require("react"); -var assign = require("react/lib/Object.assign"); -var warning = require("react/lib/warning"); -var DefaultRoute = require("./components/DefaultRoute"); -var NotFoundRoute = require("./components/NotFoundRoute"); -var Redirect = require("./components/Redirect"); -var Route = require("./Route"); +'use strict'; + +var React = require('react'); +var assign = require('react/lib/Object.assign'); +var warning = require('react/lib/warning'); +var DefaultRoute = require('./components/DefaultRoute'); +var NotFoundRoute = require('./components/NotFoundRoute'); +var Redirect = require('./components/Redirect'); +var Route = require('./Route'); function checkPropTypes(componentName, propTypes, props) { - componentName = componentName || "UnknownComponent"; + componentName = componentName || 'UnknownComponent'; for (var propName in propTypes) { if (propTypes.hasOwnProperty(propName)) { @@ -2836,17 +2383,17 @@ function createRoutesFromReactChildren(children) { } module.exports = createRoutesFromReactChildren; -},{"./Route":16,"./components/DefaultRoute":24,"./components/NotFoundRoute":26,"./components/Redirect":27,"react":"react","react/lib/Object.assign":69,"react/lib/warning":212}],32:[function(require,module,exports){ -"use strict"; +},{"./Route":11,"./components/DefaultRoute":19,"./components/NotFoundRoute":21,"./components/Redirect":22,"react":"react","react/lib/Object.assign":69,"react/lib/warning":212}],27:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; /** * Returns the current scroll position of the window as { x, y }. */ function getWindowScrollPosition() { - invariant(canUseDOM, "Cannot get current scroll position without a DOM"); + invariant(canUseDOM, 'Cannot get current scroll position without a DOM'); return { x: window.pageXOffset || document.documentElement.scrollLeft, @@ -2855,10 +2402,10 @@ function getWindowScrollPosition() { } module.exports = getWindowScrollPosition; -},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],33:[function(require,module,exports){ -"use strict"; +},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],28:[function(require,module,exports){ +'use strict'; -var React = require("react"); +var React = require('react'); function isValidChild(object) { return object == null || React.isValidElement(object); @@ -2869,11 +2416,11 @@ function isReactChildren(object) { } module.exports = isReactChildren; -},{"react":"react"}],34:[function(require,module,exports){ -"use strict"; +},{"react":"react"}],29:[function(require,module,exports){ +'use strict'; -var LocationActions = require("../actions/LocationActions"); -var History = require("../History"); +var LocationActions = require('../actions/LocationActions'); +var History = require('../History'); var _listeners = []; var _isListening = false; @@ -2895,9 +2442,9 @@ function notifyChange(type) { function ensureSlash() { var path = HashLocation.getCurrentPath(); - if (path.charAt(0) === "/") { + if (path.charAt(0) === '/') { return true; - }HashLocation.replace("/" + path); + }HashLocation.replace('/' + path); return false; } @@ -2927,9 +2474,9 @@ var HashLocation = { if (!_isListening) { if (window.addEventListener) { - window.addEventListener("hashchange", onHashChange, false); + window.addEventListener('hashchange', onHashChange, false); } else { - window.attachEvent("onhashchange", onHashChange); + window.attachEvent('onhashchange', onHashChange); } _isListening = true; @@ -2943,9 +2490,9 @@ var HashLocation = { if (_listeners.length === 0) { if (window.removeEventListener) { - window.removeEventListener("hashchange", onHashChange, false); + window.removeEventListener('hashchange', onHashChange, false); } else { - window.removeEvent("onhashchange", onHashChange); + window.removeEvent('onhashchange', onHashChange); } _isListening = false; @@ -2959,7 +2506,7 @@ var HashLocation = { replace: function replace(path) { _actionType = LocationActions.REPLACE; - window.location.replace(window.location.pathname + window.location.search + "#" + path); + window.location.replace(window.location.pathname + window.location.search + '#' + path); }, pop: function pop() { @@ -2971,21 +2518,21 @@ var HashLocation = { return decodeURI( // We can't use window.location.hash here because it's not // consistent across browsers - Firefox will pre-decode it! - window.location.href.split("#")[1] || ""); + window.location.href.split('#')[1] || ''); }, toString: function toString() { - return "<HashLocation>"; + return '<HashLocation>'; } }; module.exports = HashLocation; -},{"../History":10,"../actions/LocationActions":20}],35:[function(require,module,exports){ -"use strict"; +},{"../History":5,"../actions/LocationActions":15}],30:[function(require,module,exports){ +'use strict'; -var LocationActions = require("../actions/LocationActions"); -var History = require("../History"); +var LocationActions = require('../actions/LocationActions'); +var History = require('../History'); var _listeners = []; var _isListening = false; @@ -3019,9 +2566,9 @@ var HistoryLocation = { if (!_isListening) { if (window.addEventListener) { - window.addEventListener("popstate", onPopState, false); + window.addEventListener('popstate', onPopState, false); } else { - window.attachEvent("onpopstate", onPopState); + window.attachEvent('onpopstate', onPopState); } _isListening = true; @@ -3035,9 +2582,9 @@ var HistoryLocation = { if (_listeners.length === 0) { if (window.addEventListener) { - window.removeEventListener("popstate", onPopState, false); + window.removeEventListener('popstate', onPopState, false); } else { - window.removeEvent("onpopstate", onPopState); + window.removeEvent('onpopstate', onPopState); } _isListening = false; @@ -3045,13 +2592,13 @@ var HistoryLocation = { }, push: function push(path) { - window.history.pushState({ path: path }, "", path); + window.history.pushState({ path: path }, '', path); History.length += 1; notifyChange(LocationActions.PUSH); }, replace: function replace(path) { - window.history.replaceState({ path: path }, "", path); + window.history.replaceState({ path: path }, '', path); notifyChange(LocationActions.REPLACE); }, @@ -3062,17 +2609,17 @@ var HistoryLocation = { }, toString: function toString() { - return "<HistoryLocation>"; + return '<HistoryLocation>'; } }; module.exports = HistoryLocation; -},{"../History":10,"../actions/LocationActions":20}],36:[function(require,module,exports){ -"use strict"; +},{"../History":5,"../actions/LocationActions":15}],31:[function(require,module,exports){ +'use strict'; -var HistoryLocation = require("./HistoryLocation"); -var History = require("../History"); +var HistoryLocation = require('./HistoryLocation'); +var History = require('../History'); /** * A Location that uses full page refreshes. This is used as @@ -3094,23 +2641,23 @@ var RefreshLocation = { getCurrentPath: HistoryLocation.getCurrentPath, toString: function toString() { - return "<RefreshLocation>"; + return '<RefreshLocation>'; } }; module.exports = RefreshLocation; -},{"../History":10,"./HistoryLocation":35}],37:[function(require,module,exports){ -"use strict"; +},{"../History":5,"./HistoryLocation":30}],32:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (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 invariant = require("react/lib/invariant"); +var invariant = require('react/lib/invariant'); function throwCannotModify() { - invariant(false, "You cannot modify a static location"); + invariant(false, 'You cannot modify a static location'); } /** @@ -3126,18 +2673,17 @@ var StaticLocation = (function () { this.path = path; } - _createClass(StaticLocation, { - getCurrentPath: { - value: function getCurrentPath() { - return this.path; - } - }, - toString: { - value: function toString() { - return "<StaticLocation path=\"" + this.path + "\">"; - } + _createClass(StaticLocation, [{ + key: 'getCurrentPath', + value: function getCurrentPath() { + return this.path; } - }); + }, { + key: 'toString', + value: function toString() { + return '<StaticLocation path="' + this.path + '">'; + } + }]); return StaticLocation; })(); @@ -3151,16 +2697,16 @@ StaticLocation.prototype.replace = throwCannotModify; StaticLocation.prototype.pop = throwCannotModify; module.exports = StaticLocation; -},{"react/lib/invariant":191}],38:[function(require,module,exports){ -"use strict"; +},{"react/lib/invariant":191}],33:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (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 invariant = require("react/lib/invariant"); -var LocationActions = require("../actions/LocationActions"); -var History = require("../History"); +var invariant = require('react/lib/invariant'); +var LocationActions = require('../actions/LocationActions'); +var History = require('../History'); /** * A location that is convenient for testing and does not require a DOM. @@ -3175,82 +2721,81 @@ var TestLocation = (function () { this._updateHistoryLength(); } - _createClass(TestLocation, { - needsDOM: { - get: function () { - return false; - } - }, - _updateHistoryLength: { - value: function _updateHistoryLength() { - History.length = this.history.length; - } - }, - _notifyChange: { - value: function _notifyChange(type) { - var change = { - path: this.getCurrentPath(), - type: type - }; + _createClass(TestLocation, [{ + key: 'needsDOM', + get: function () { + return false; + } + }, { + key: '_updateHistoryLength', + value: function _updateHistoryLength() { + History.length = this.history.length; + } + }, { + key: '_notifyChange', + value: function _notifyChange(type) { + var change = { + path: this.getCurrentPath(), + type: type + }; - for (var i = 0, len = this.listeners.length; i < len; ++i) this.listeners[i].call(this, change); - } - }, - addChangeListener: { - value: function addChangeListener(listener) { - this.listeners.push(listener); - } - }, - removeChangeListener: { - value: function removeChangeListener(listener) { - this.listeners = this.listeners.filter(function (l) { - return l !== listener; - }); - } - }, - push: { - value: function push(path) { - this.history.push(path); - this._updateHistoryLength(); - this._notifyChange(LocationActions.PUSH); - } - }, - replace: { - value: function replace(path) { - invariant(this.history.length, "You cannot replace the current path with no history"); + for (var i = 0, len = this.listeners.length; i < len; ++i) this.listeners[i].call(this, change); + } + }, { + key: 'addChangeListener', + value: function addChangeListener(listener) { + this.listeners.push(listener); + } + }, { + key: 'removeChangeListener', + value: function removeChangeListener(listener) { + this.listeners = this.listeners.filter(function (l) { + return l !== listener; + }); + } + }, { + key: 'push', + value: function push(path) { + this.history.push(path); + this._updateHistoryLength(); + this._notifyChange(LocationActions.PUSH); + } + }, { + key: 'replace', + value: function replace(path) { + invariant(this.history.length, 'You cannot replace the current path with no history'); - this.history[this.history.length - 1] = path; + this.history[this.history.length - 1] = path; - this._notifyChange(LocationActions.REPLACE); - } - }, - pop: { - value: function pop() { - this.history.pop(); - this._updateHistoryLength(); - this._notifyChange(LocationActions.POP); - } - }, - getCurrentPath: { - value: function getCurrentPath() { - return this.history[this.history.length - 1]; - } - }, - toString: { - value: function toString() { - return "<TestLocation>"; - } + this._notifyChange(LocationActions.REPLACE); } - }); + }, { + key: 'pop', + value: function pop() { + this.history.pop(); + this._updateHistoryLength(); + this._notifyChange(LocationActions.POP); + } + }, { + key: 'getCurrentPath', + value: function getCurrentPath() { + return this.history[this.history.length - 1]; + } + }, { + key: 'toString', + value: function toString() { + return '<TestLocation>'; + } + }]); return TestLocation; })(); module.exports = TestLocation; -},{"../History":10,"../actions/LocationActions":20,"react/lib/invariant":191}],39:[function(require,module,exports){ -"use strict"; +},{"../History":5,"../actions/LocationActions":15,"react/lib/invariant":191}],34:[function(require,module,exports){ +'use strict'; -var createRouter = require("./createRouter"); +var createRouter = require('./createRouter'); /** * A high-level convenience method that creates, configures, and @@ -3282,7 +2827,7 @@ var createRouter = require("./createRouter"); * }); */ function runRouter(routes, location, callback) { - if (typeof location === "function") { + if (typeof location === 'function') { callback = location; location = null; } @@ -3298,8 +2843,8 @@ function runRouter(routes, location, callback) { } module.exports = runRouter; -},{"./createRouter":30}],40:[function(require,module,exports){ -"use strict"; +},{"./createRouter":25}],35:[function(require,module,exports){ +'use strict'; function supportsHistory() { /*! taken from modernizr @@ -3308,14 +2853,14 @@ function supportsHistory() { * changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586 */ var ua = navigator.userAgent; - if ((ua.indexOf("Android 2.") !== -1 || ua.indexOf("Android 4.0") !== -1) && ua.indexOf("Mobile Safari") !== -1 && ua.indexOf("Chrome") === -1 && ua.indexOf("Windows Phone") === -1) { + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) { return false; } - return window.history && "pushState" in window.history; + return window.history && 'pushState' in window.history; } module.exports = supportsHistory; -},{}],41:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ 'use strict'; function ToObject(val) { @@ -3343,6 +2888,422 @@ module.exports = Object.assign || function (target, source) { return to; }; +},{}],37:[function(require,module,exports){ +module.exports = require('./lib/'); + +},{"./lib/":38}],38:[function(require,module,exports){ +// Load modules + +var Stringify = require('./stringify'); +var Parse = require('./parse'); + + +// Declare internals + +var internals = {}; + + +module.exports = { + stringify: Stringify, + parse: Parse +}; + +},{"./parse":39,"./stringify":40}],39:[function(require,module,exports){ +// Load modules + +var Utils = require('./utils'); + + +// Declare internals + +var internals = { + delimiter: '&', + depth: 5, + arrayLimit: 20, + parameterLimit: 1000 +}; + + +internals.parseValues = function (str, options) { + + var obj = {}; + var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); + + for (var i = 0, il = parts.length; i < il; ++i) { + var part = parts[i]; + var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; + + if (pos === -1) { + obj[Utils.decode(part)] = ''; + } + else { + var key = Utils.decode(part.slice(0, pos)); + var val = Utils.decode(part.slice(pos + 1)); + + if (Object.prototype.hasOwnProperty(key)) { + continue; + } + + if (!obj.hasOwnProperty(key)) { + obj[key] = val; + } + else { + obj[key] = [].concat(obj[key]).concat(val); + } + } + } + + return obj; +}; + + +internals.parseObject = function (chain, val, options) { + + if (!chain.length) { + return val; + } + + var root = chain.shift(); + + var obj = {}; + if (root === '[]') { + obj = []; + obj = obj.concat(internals.parseObject(chain, val, options)); + } + else { + var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; + var index = parseInt(cleanRoot, 10); + var indexString = '' + index; + if (!isNaN(index) && + root !== cleanRoot && + indexString === cleanRoot && + index >= 0 && + index <= options.arrayLimit) { + + obj = []; + obj[index] = internals.parseObject(chain, val, options); + } + else { + obj[cleanRoot] = internals.parseObject(chain, val, options); + } + } + + return obj; +}; + + +internals.parseKeys = function (key, val, options) { + + if (!key) { + return; + } + + // The regex chunks + + var parent = /^([^\[\]]*)/; + var child = /(\[[^\[\]]*\])/g; + + // Get the parent + + var segment = parent.exec(key); + + // Don't allow them to overwrite object prototype properties + + if (Object.prototype.hasOwnProperty(segment[1])) { + return; + } + + // Stash the parent if it exists + + var keys = []; + if (segment[1]) { + keys.push(segment[1]); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + + ++i; + if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) { + keys.push(segment[1]); + } + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return internals.parseObject(keys, val, options); +}; + + +module.exports = function (str, options) { + + if (str === '' || + str === null || + typeof str === 'undefined') { + + return {}; + } + + options = options || {}; + options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; + + var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; + var obj = {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0, il = keys.length; i < il; ++i) { + var key = keys[i]; + var newObj = internals.parseKeys(key, tempObj[key], options); + obj = Utils.merge(obj, newObj); + } + + return Utils.compact(obj); +}; + +},{"./utils":41}],40:[function(require,module,exports){ +// Load modules + +var Utils = require('./utils'); + + +// Declare internals + +var internals = { + delimiter: '&', + arrayPrefixGenerators: { + brackets: function (prefix, key) { + return prefix + '[]'; + }, + indices: function (prefix, key) { + return prefix + '[' + key + ']'; + }, + repeat: function (prefix, key) { + return prefix; + } + } +}; + + +internals.stringify = function (obj, prefix, generateArrayPrefix) { + + if (Utils.isBuffer(obj)) { + obj = obj.toString(); + } + else if (obj instanceof Date) { + obj = obj.toISOString(); + } + else if (obj === null) { + obj = ''; + } + + if (typeof obj === 'string' || + typeof obj === 'number' || + typeof obj === 'boolean') { + + return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys = Object.keys(obj); + for (var i = 0, il = objKeys.length; i < il; ++i) { + var key = objKeys[i]; + if (Array.isArray(obj)) { + values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix)); + } + else { + values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix)); + } + } + + return values; +}; + + +module.exports = function (obj, options) { + + options = options || {}; + var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter; + + var keys = []; + + if (typeof obj !== 'object' || + obj === null) { + + return ''; + } + + var arrayFormat; + if (options.arrayFormat in internals.arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } + else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } + else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat]; + + var objKeys = Object.keys(obj); + for (var i = 0, il = objKeys.length; i < il; ++i) { + var key = objKeys[i]; + keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix)); + } + + return keys.join(delimiter); +}; + +},{"./utils":41}],41:[function(require,module,exports){ +// Load modules + + +// Declare internals + +var internals = {}; + + +exports.arrayToObject = function (source) { + + var obj = {}; + for (var i = 0, il = source.length; i < il; ++i) { + if (typeof source[i] !== 'undefined') { + + obj[i] = source[i]; + } + } + + return obj; +}; + + +exports.merge = function (target, source) { + + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } + else { + target[source] = true; + } + + return target; + } + + if (typeof target !== 'object') { + target = [target].concat(source); + return target; + } + + if (Array.isArray(target) && + !Array.isArray(source)) { + + target = exports.arrayToObject(target); + } + + var keys = Object.keys(source); + for (var k = 0, kl = keys.length; k < kl; ++k) { + var key = keys[k]; + var value = source[key]; + + if (!target[key]) { + target[key] = value; + } + else { + target[key] = exports.merge(target[key], value); + } + } + + return target; +}; + + +exports.decode = function (str) { + + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } +}; + + +exports.compact = function (obj, refs) { + + if (typeof obj !== 'object' || + obj === null) { + + return obj; + } + + refs = refs || []; + var lookup = refs.indexOf(obj); + if (lookup !== -1) { + return refs[lookup]; + } + + refs.push(obj); + + if (Array.isArray(obj)) { + var compacted = []; + + for (var i = 0, il = obj.length; i < il; ++i) { + if (typeof obj[i] !== 'undefined') { + compacted.push(obj[i]); + } + } + + return compacted; + } + + var keys = Object.keys(obj); + for (i = 0, il = keys.length; i < il; ++i) { + var key = keys[i]; + obj[key] = exports.compact(obj[key], refs); + } + + return obj; +}; + + +exports.isRegExp = function (obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + + +exports.isBuffer = function (obj) { + + if (obj === null || + typeof obj === 'undefined') { + + return false; + } + + return !!(obj.constructor && + obj.constructor.isBuffer && + obj.constructor.isBuffer(obj)); +}; + },{}],42:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -3977,6 +3938,7 @@ var CSSCore = { module.exports = CSSCore; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],45:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -4000,7 +3962,9 @@ var isUnitlessNumber = { columnCount: true, flex: true, flexGrow: true, + flexPositive: true, flexShrink: true, + flexNegative: true, fontWeight: true, lineClamp: true, lineHeight: true, @@ -4013,7 +3977,9 @@ var isUnitlessNumber = { // SVG-related properties fillOpacity: true, - strokeOpacity: true + strokeDashoffset: true, + strokeOpacity: true, + strokeWidth: true }; /** @@ -4280,6 +4246,7 @@ var CSSPropertyOperations = { module.exports = CSSPropertyOperations; }).call(this,require('_process')) + },{"./CSSProperty":45,"./ExecutionEnvironment":62,"./camelizeStyleName":162,"./dangerousStyleValue":169,"./hyphenateStyleName":189,"./memoizeStringOnly":200,"./warning":212,"_process":1}],47:[function(require,module,exports){ (function (process){ /** @@ -4380,6 +4347,7 @@ PooledClass.addPoolingTo(CallbackQueue); module.exports = CallbackQueue; }).call(this,require('_process')) + },{"./Object.assign":69,"./PooledClass":70,"./invariant":191,"_process":1}],48:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -4925,6 +4893,7 @@ var DOMChildrenOperations = { module.exports = DOMChildrenOperations; }).call(this,require('_process')) + },{"./Danger":53,"./ReactMultiChildUpdateTypes":119,"./invariant":191,"./setTextContent":206,"_process":1}],51:[function(require,module,exports){ (function (process){ /** @@ -5224,6 +5193,7 @@ var DOMProperty = { module.exports = DOMProperty; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],52:[function(require,module,exports){ (function (process){ /** @@ -5416,6 +5386,7 @@ var DOMPropertyOperations = { module.exports = DOMPropertyOperations; }).call(this,require('_process')) + },{"./DOMProperty":51,"./quoteAttributeValueForBrowser":204,"./warning":212,"_process":1}],53:[function(require,module,exports){ (function (process){ /** @@ -5603,6 +5574,7 @@ var Danger = { module.exports = Danger; }).call(this,require('_process')) + },{"./ExecutionEnvironment":62,"./createNodesFromMarkup":167,"./emptyFunction":170,"./getMarkupWrap":183,"./invariant":191,"_process":1}],54:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -5944,6 +5916,7 @@ var EventListener = { module.exports = EventListener; }).call(this,require('_process')) + },{"./emptyFunction":170,"_process":1}],58:[function(require,module,exports){ (function (process){ /** @@ -6222,6 +6195,7 @@ var EventPluginHub = { module.exports = EventPluginHub; }).call(this,require('_process')) + },{"./EventPluginRegistry":59,"./EventPluginUtils":60,"./accumulateInto":159,"./forEachAccumulated":176,"./invariant":191,"_process":1}],59:[function(require,module,exports){ (function (process){ /** @@ -6502,6 +6476,7 @@ var EventPluginRegistry = { module.exports = EventPluginRegistry; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],60:[function(require,module,exports){ (function (process){ /** @@ -6723,6 +6698,7 @@ var EventPluginUtils = { module.exports = EventPluginUtils; }).call(this,require('_process')) + },{"./EventConstants":56,"./invariant":191,"_process":1}],61:[function(require,module,exports){ (function (process){ /** @@ -6865,6 +6841,7 @@ var EventPropagators = { module.exports = EventPropagators; }).call(this,require('_process')) + },{"./EventConstants":56,"./EventPluginHub":58,"./accumulateInto":159,"./forEachAccumulated":176,"_process":1}],62:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -7100,6 +7077,7 @@ var HTMLDOMPropertyConfig = { headers: null, height: MUST_USE_ATTRIBUTE, hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, + high: null, href: null, hrefLang: null, htmlFor: null, @@ -7110,6 +7088,7 @@ var HTMLDOMPropertyConfig = { lang: null, list: MUST_USE_ATTRIBUTE, loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + low: null, manifest: MUST_USE_ATTRIBUTE, marginHeight: null, marginWidth: null, @@ -7124,6 +7103,7 @@ var HTMLDOMPropertyConfig = { name: null, noValidate: HAS_BOOLEAN_VALUE, open: HAS_BOOLEAN_VALUE, + optimum: null, pattern: null, placeholder: null, poster: null, @@ -7137,6 +7117,7 @@ var HTMLDOMPropertyConfig = { rowSpan: null, sandbox: null, scope: null, + scoped: HAS_BOOLEAN_VALUE, scrolling: null, seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, @@ -7178,7 +7159,9 @@ var HTMLDOMPropertyConfig = { itemID: MUST_USE_ATTRIBUTE, itemRef: MUST_USE_ATTRIBUTE, // property is supported for OpenGraph in meta tags. - property: null + property: null, + // IE-only attribute that controls focus behavior + unselectable: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { acceptCharset: 'accept-charset', @@ -7402,6 +7385,7 @@ var LinkedValueUtils = { module.exports = LinkedValueUtils; }).call(this,require('_process')) + },{"./ReactPropTypes":126,"./invariant":191,"_process":1}],67:[function(require,module,exports){ (function (process){ /** @@ -7459,6 +7443,7 @@ var LocalEventTrapMixin = { module.exports = LocalEventTrapMixin; }).call(this,require('_process')) + },{"./ReactBrowserEventEmitter":73,"./accumulateInto":159,"./forEachAccumulated":176,"./invariant":191,"_process":1}],68:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -7682,6 +7667,7 @@ var PooledClass = { module.exports = PooledClass; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],71:[function(require,module,exports){ (function (process){ /** @@ -7794,7 +7780,7 @@ if ("production" !== process.env.NODE_ENV) { if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { console.debug( 'Download the React DevTools for a better development experience: ' + - 'http://fb.me/react-devtools' + 'https://fb.me/react-devtools' ); } } @@ -7821,7 +7807,7 @@ if ("production" !== process.env.NODE_ENV) { if (!expectedFeatures[i]) { console.error( 'One or more ES5 shim/shams expected by React are not available: ' + - 'http://fb.me/react-warning-polyfills' + 'https://fb.me/react-warning-polyfills' ); break; } @@ -7829,11 +7815,12 @@ if ("production" !== process.env.NODE_ENV) { } } -React.version = '0.13.1'; +React.version = '0.13.3'; module.exports = React; }).call(this,require('_process')) + },{"./EventPluginUtils":60,"./ExecutionEnvironment":62,"./Object.assign":69,"./ReactChildren":77,"./ReactClass":78,"./ReactComponent":79,"./ReactContext":84,"./ReactCurrentOwner":85,"./ReactDOM":86,"./ReactDOMTextComponent":97,"./ReactDefaultInjection":100,"./ReactElement":103,"./ReactElementValidator":104,"./ReactInstanceHandles":112,"./ReactMount":117,"./ReactPerf":122,"./ReactPropTypes":126,"./ReactReconciler":129,"./ReactServerRendering":132,"./findDOMNode":173,"./onlyChild":201,"_process":1}],72:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -8436,6 +8423,7 @@ var ReactCSSTransitionGroupChild = React.createClass({ module.exports = ReactCSSTransitionGroupChild; }).call(this,require('_process')) + },{"./CSSCore":44,"./React":71,"./ReactTransitionEvents":137,"./onlyChild":201,"./warning":212,"_process":1}],76:[function(require,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. @@ -8716,6 +8704,7 @@ var ReactChildren = { module.exports = ReactChildren; }).call(this,require('_process')) + },{"./PooledClass":70,"./ReactFragment":109,"./traverseAllChildren":210,"./warning":212,"_process":1}],78:[function(require,module,exports){ (function (process){ /** @@ -9554,7 +9543,7 @@ var ReactClass = { ("production" !== process.env.NODE_ENV ? warning( this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + - 'JSX instead. See: http://fb.me/react-legacyfactory' + 'JSX instead. See: https://fb.me/react-legacyfactory' ) : null); } @@ -9662,6 +9651,7 @@ var ReactClass = { module.exports = ReactClass; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactComponent":79,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactErrorUtils":106,"./ReactInstanceMap":113,"./ReactLifeCycle":114,"./ReactPropTypeLocationNames":124,"./ReactPropTypeLocations":125,"./ReactUpdateQueue":139,"./invariant":191,"./keyMirror":197,"./keyOf":198,"./warning":212,"_process":1}],79:[function(require,module,exports){ (function (process){ /** @@ -9766,20 +9756,38 @@ ReactComponent.prototype.forceUpdate = function(callback) { */ if ("production" !== process.env.NODE_ENV) { var deprecatedAPIs = { - getDOMNode: 'getDOMNode', - isMounted: 'isMounted', - replaceProps: 'replaceProps', - replaceState: 'replaceState', - setProps: 'setProps' + getDOMNode: [ + 'getDOMNode', + 'Use React.findDOMNode(component) instead.' + ], + isMounted: [ + 'isMounted', + 'Instead, make sure to clean up subscriptions and pending requests in ' + + 'componentWillUnmount to prevent memory leaks.' + ], + replaceProps: [ + 'replaceProps', + 'Instead, call React.render again at the top level.' + ], + replaceState: [ + 'replaceState', + 'Refactor your code to use setState instead (see ' + + 'https://github.com/facebook/react/issues/3236).' + ], + setProps: [ + 'setProps', + 'Instead, call React.render again at the top level.' + ] }; - var defineDeprecationWarning = function(methodName, displayName) { + var defineDeprecationWarning = function(methodName, info) { try { Object.defineProperty(ReactComponent.prototype, methodName, { get: function() { ("production" !== process.env.NODE_ENV ? warning( false, - '%s(...) is deprecated in plain JavaScript React classes.', - displayName + '%s(...) is deprecated in plain JavaScript React classes. %s', + info[0], + info[1] ) : null); return undefined; } @@ -9798,6 +9806,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = ReactComponent; }).call(this,require('_process')) + },{"./ReactUpdateQueue":139,"./invariant":191,"./warning":212,"_process":1}],80:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -9906,6 +9915,7 @@ var ReactComponentEnvironment = { module.exports = ReactComponentEnvironment; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],82:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -10134,6 +10144,14 @@ var ReactCompositeComponentMixin = { this.getName() || 'a component' ) : null); ("production" !== process.env.NODE_ENV ? warning( + !inst.getDefaultProps || + inst.getDefaultProps.isReactClassApproved, + 'getDefaultProps was defined on %s, a plain JavaScript class. ' + + 'This is only supported for classes created using React.createClass. ' + + 'Use a static property to define defaultProps instead.', + this.getName() || 'a component' + ) : null); + ("production" !== process.env.NODE_ENV ? warning( !inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', @@ -10169,6 +10187,7 @@ var ReactCompositeComponentMixin = { this._pendingReplaceState = false; this._pendingForceUpdate = false; + var childContext; var renderedElement; var previouslyMounting = ReactLifeCycle.currentlyMountingInstance; @@ -10183,7 +10202,8 @@ var ReactCompositeComponentMixin = { } } - renderedElement = this._renderValidatedComponent(); + childContext = this._getValidatedChildContext(context); + renderedElement = this._renderValidatedComponent(childContext); } finally { ReactLifeCycle.currentlyMountingInstance = previouslyMounting; } @@ -10197,7 +10217,7 @@ var ReactCompositeComponentMixin = { this._renderedComponent, rootID, transaction, - this._processChildContext(context) + this._mergeChildContext(context, childContext) ); if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); @@ -10327,7 +10347,7 @@ var ReactCompositeComponentMixin = { * @return {object} * @private */ - _processChildContext: function(currentContext) { + _getValidatedChildContext: function(currentContext) { var inst = this._instance; var childContext = inst.getChildContext && inst.getChildContext(); if (childContext) { @@ -10352,6 +10372,13 @@ var ReactCompositeComponentMixin = { name ) : invariant(name in inst.constructor.childContextTypes)); } + return childContext; + } + return null; + }, + + _mergeChildContext: function(currentContext, childContext) { + if (childContext) { return assign({}, currentContext, childContext); } return currentContext; @@ -10611,6 +10638,10 @@ var ReactCompositeComponentMixin = { return inst.state; } + if (replace && queue.length === 1) { + return queue[0]; + } + var nextState = assign({}, replace ? queue[0] : inst.state); for (var i = replace ? 1 : 0; i < queue.length; i++) { var partial = queue[i]; @@ -10680,13 +10711,14 @@ var ReactCompositeComponentMixin = { _updateRenderedComponent: function(transaction, context) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; - var nextRenderedElement = this._renderValidatedComponent(); + var childContext = this._getValidatedChildContext(); + var nextRenderedElement = this._renderValidatedComponent(childContext); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { ReactReconciler.receiveComponent( prevComponentInstance, nextRenderedElement, transaction, - this._processChildContext(context) + this._mergeChildContext(context, childContext) ); } else { // These two IDs are actually the same! But nothing should rely on that. @@ -10702,7 +10734,7 @@ var ReactCompositeComponentMixin = { this._renderedComponent, thisID, transaction, - context + this._mergeChildContext(context, childContext) ); this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup); } @@ -10740,11 +10772,12 @@ var ReactCompositeComponentMixin = { /** * @private */ - _renderValidatedComponent: function() { + _renderValidatedComponent: function(childContext) { var renderedComponent; var previousContext = ReactContext.current; - ReactContext.current = this._processChildContext( - this._currentElement._context + ReactContext.current = this._mergeChildContext( + this._currentElement._context, + childContext ); ReactCurrentOwner.current = this; try { @@ -10845,6 +10878,7 @@ var ReactCompositeComponent = { module.exports = ReactCompositeComponent; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactComponentEnvironment":81,"./ReactContext":84,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactElementValidator":104,"./ReactInstanceMap":113,"./ReactLifeCycle":114,"./ReactNativeComponent":120,"./ReactPerf":122,"./ReactPropTypeLocationNames":124,"./ReactPropTypeLocations":125,"./ReactReconciler":129,"./ReactUpdates":140,"./emptyObject":171,"./invariant":191,"./shouldUpdateReactComponent":208,"./warning":212,"_process":1}],84:[function(require,module,exports){ (function (process){ /** @@ -10923,6 +10957,7 @@ var ReactContext = { module.exports = ReactContext; }).call(this,require('_process')) + },{"./Object.assign":69,"./emptyObject":171,"./warning":212,"_process":1}],85:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -11113,6 +11148,7 @@ var ReactDOM = mapObject({ // SVG circle: 'circle', + clipPath: 'clipPath', defs: 'defs', ellipse: 'ellipse', g: 'g', @@ -11135,6 +11171,7 @@ var ReactDOM = mapObject({ module.exports = ReactDOM; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactElementValidator":104,"./mapObject":199,"_process":1}],87:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -11264,11 +11301,13 @@ function assertValidProps(props) { 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' ) : invariant(props.children == null)); ("production" !== process.env.NODE_ENV ? invariant( - props.dangerouslySetInnerHTML.__html != null, + typeof props.dangerouslySetInnerHTML === 'object' && + '__html' in props.dangerouslySetInnerHTML, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + - 'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' + + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.' - ) : invariant(props.dangerouslySetInnerHTML.__html != null)); + ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' && + '__html' in props.dangerouslySetInnerHTML)); } if ("production" !== process.env.NODE_ENV) { ("production" !== process.env.NODE_ENV ? warning( @@ -11576,6 +11615,8 @@ ReactDOMComponent.Mixin = { if (propKey === STYLE) { if (nextProp) { nextProp = this._previousStyleCopy = assign({}, nextProp); + } else { + this._previousStyleCopy = null; } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. @@ -11705,6 +11746,7 @@ ReactDOMComponent.injection = { module.exports = ReactDOMComponent; }).call(this,require('_process')) + },{"./CSSPropertyOperations":46,"./DOMProperty":51,"./DOMPropertyOperations":52,"./Object.assign":69,"./ReactBrowserEventEmitter":73,"./ReactComponentBrowserEnvironment":80,"./ReactMount":117,"./ReactMultiChild":118,"./ReactPerf":122,"./escapeTextContentForBrowser":172,"./invariant":191,"./isEventSupported":192,"./keyOf":198,"./warning":212,"_process":1}],89:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -11922,6 +11964,7 @@ ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { module.exports = ReactDOMIDOperations; }).call(this,require('_process')) + },{"./CSSPropertyOperations":46,"./DOMChildrenOperations":50,"./DOMPropertyOperations":52,"./ReactMount":117,"./ReactPerf":122,"./invariant":191,"./setInnerHTML":205,"_process":1}],91:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -12190,6 +12233,7 @@ var ReactDOMInput = ReactClass.createClass({ module.exports = ReactDOMInput; }).call(this,require('_process')) + },{"./AutoFocusMixin":42,"./DOMPropertyOperations":52,"./LinkedValueUtils":66,"./Object.assign":69,"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactElement":103,"./ReactMount":117,"./ReactUpdates":140,"./invariant":191,"_process":1}],94:[function(require,module,exports){ (function (process){ /** @@ -12242,6 +12286,7 @@ var ReactDOMOption = ReactClass.createClass({ module.exports = ReactDOMOption; }).call(this,require('_process')) + },{"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactElement":103,"./warning":212,"_process":1}],95:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -12890,6 +12935,7 @@ var ReactDOMTextarea = ReactClass.createClass({ module.exports = ReactDOMTextarea; }).call(this,require('_process')) + },{"./AutoFocusMixin":42,"./DOMPropertyOperations":52,"./LinkedValueUtils":66,"./Object.assign":69,"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactElement":103,"./ReactUpdates":140,"./invariant":191,"./warning":212,"_process":1}],99:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -13122,6 +13168,7 @@ module.exports = { }; }).call(this,require('_process')) + },{"./BeforeInputEventPlugin":43,"./ChangeEventPlugin":48,"./ClientReactRootIndex":49,"./DefaultEventPluginOrder":54,"./EnterLeaveEventPlugin":55,"./ExecutionEnvironment":62,"./HTMLDOMPropertyConfig":64,"./MobileSafariClickEventPlugin":68,"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactComponentBrowserEnvironment":80,"./ReactDOMButton":87,"./ReactDOMComponent":88,"./ReactDOMForm":89,"./ReactDOMIDOperations":90,"./ReactDOMIframe":91,"./ReactDOMImg":92,"./ReactDOMInput":93,"./ReactDOMOption":94,"./ReactDOMSelect":95,"./ReactDOMTextComponent":97,"./ReactDOMTextarea":98,"./ReactDefaultBatchingStrategy":99,"./ReactDefaultPerf":101,"./ReactElement":103,"./ReactEventListener":108,"./ReactInjection":110,"./ReactInstanceHandles":112,"./ReactMount":117,"./ReactReconcileTransaction":128,"./SVGDOMPropertyConfig":142,"./SelectEventPlugin":143,"./ServerReactRootIndex":144,"./SimpleEventPlugin":145,"./createFullPageComponent":166,"_process":1}],101:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -13902,6 +13949,7 @@ ReactElement.isValidElement = function(object) { module.exports = ReactElement; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactContext":84,"./ReactCurrentOwner":85,"./warning":212,"_process":1}],104:[function(require,module,exports){ (function (process){ /** @@ -14072,7 +14120,7 @@ function warnAndMonitorForKeyUse(message, element, parentType) { ("production" !== process.env.NODE_ENV ? warning( false, - message + '%s%s See http://fb.me/react-warning-keys for more information.', + message + '%s%s See https://fb.me/react-warning-keys for more information.', parentOrOwnerAddendum, childOwnerAddendum ) : null); @@ -14196,9 +14244,9 @@ function warnForPropsMutation(propName, element) { ("production" !== process.env.NODE_ENV ? warning( false, - 'Don\'t set .props.%s of the React component%s. ' + - 'Instead, specify the correct value when ' + - 'initially creating the element.%s', + 'Don\'t set .props.%s of the React component%s. Instead, specify the ' + + 'correct value when initially creating the element or use ' + + 'React.cloneElement to make a new element with updated props.%s', propName, elementInfo, ownerInfo @@ -14367,6 +14415,7 @@ var ReactElementValidator = { module.exports = ReactElementValidator; }).call(this,require('_process')) + },{"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactFragment":109,"./ReactNativeComponent":120,"./ReactPropTypeLocationNames":124,"./ReactPropTypeLocations":125,"./getIteratorFn":182,"./invariant":191,"./warning":212,"_process":1}],105:[function(require,module,exports){ (function (process){ /** @@ -14462,6 +14511,7 @@ var ReactEmptyComponent = { module.exports = ReactEmptyComponent; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactInstanceMap":113,"./invariant":191,"_process":1}],106:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -14912,6 +14962,7 @@ var ReactFragment = { module.exports = ReactFragment; }).call(this,require('_process')) + },{"./ReactElement":103,"./warning":212,"_process":1}],110:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -15425,6 +15476,7 @@ var ReactInstanceHandles = { module.exports = ReactInstanceHandles; }).call(this,require('_process')) + },{"./ReactRootIndex":131,"./invariant":191,"_process":1}],113:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -16523,6 +16575,7 @@ ReactPerf.measureMethods(ReactMount, 'ReactMount', { module.exports = ReactMount; }).call(this,require('_process')) + },{"./DOMProperty":51,"./ReactBrowserEventEmitter":73,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactElementValidator":104,"./ReactEmptyComponent":105,"./ReactInstanceHandles":112,"./ReactInstanceMap":113,"./ReactMarkupChecksum":116,"./ReactPerf":122,"./ReactReconciler":129,"./ReactUpdateQueue":139,"./ReactUpdates":140,"./containsNode":164,"./emptyObject":171,"./getReactRootElementInContainer":185,"./instantiateReactComponent":190,"./invariant":191,"./setInnerHTML":205,"./shouldUpdateReactComponent":208,"./warning":212,"_process":1}],118:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -17093,6 +17146,7 @@ var ReactNativeComponent = { module.exports = ReactNativeComponent; }).call(this,require('_process')) + },{"./Object.assign":69,"./invariant":191,"_process":1}],121:[function(require,module,exports){ (function (process){ /** @@ -17205,6 +17259,7 @@ var ReactOwner = { module.exports = ReactOwner; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],122:[function(require,module,exports){ (function (process){ /** @@ -17309,6 +17364,7 @@ function _noMeasure(objName, fnName, func) { module.exports = ReactPerf; }).call(this,require('_process')) + },{"_process":1}],123:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -17447,6 +17503,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = ReactPropTypeLocationNames; }).call(this,require('_process')) + },{"_process":1}],125:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -18176,6 +18233,7 @@ var ReactReconciler = { module.exports = ReactReconciler; }).call(this,require('_process')) + },{"./ReactElementValidator":104,"./ReactRef":130,"_process":1}],130:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -18360,6 +18418,7 @@ module.exports = { }; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactInstanceHandles":112,"./ReactMarkupChecksum":116,"./ReactServerRenderingTransaction":133,"./emptyObject":171,"./instantiateReactComponent":190,"./invariant":191,"_process":1}],133:[function(require,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. @@ -18608,6 +18667,7 @@ var ReactUpdates = require("./ReactUpdates"); var SyntheticEvent = require("./SyntheticEvent"); var assign = require("./Object.assign"); +var emptyObject = require("./emptyObject"); var topLevelTypes = EventConstants.topLevelTypes; @@ -18949,6 +19009,9 @@ assign( ); ReactShallowRenderer.prototype.render = function(element, context) { + if (!context) { + context = emptyObject; + } var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); this._render(element, transaction, context); ReactUpdates.ReactReconcileTransaction.release(transaction); @@ -19089,7 +19152,7 @@ for (eventType in topLevelTypes) { module.exports = ReactTestUtils; -},{"./EventConstants":56,"./EventPluginHub":58,"./EventPropagators":61,"./Object.assign":69,"./React":71,"./ReactBrowserEventEmitter":73,"./ReactCompositeComponent":83,"./ReactElement":103,"./ReactEmptyComponent":105,"./ReactInstanceHandles":112,"./ReactInstanceMap":113,"./ReactMount":117,"./ReactUpdates":140,"./SyntheticEvent":149}],136:[function(require,module,exports){ +},{"./EventConstants":56,"./EventPluginHub":58,"./EventPropagators":61,"./Object.assign":69,"./React":71,"./ReactBrowserEventEmitter":73,"./ReactCompositeComponent":83,"./ReactElement":103,"./ReactEmptyComponent":105,"./ReactInstanceHandles":112,"./ReactInstanceMap":113,"./ReactMount":117,"./ReactUpdates":140,"./SyntheticEvent":149,"./emptyObject":171}],136:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. @@ -19834,6 +19897,7 @@ var ReactUpdateQueue = { module.exports = ReactUpdateQueue; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactInstanceMap":113,"./ReactLifeCycle":114,"./ReactUpdates":140,"./invariant":191,"./warning":212,"_process":1}],140:[function(require,module,exports){ (function (process){ /** @@ -20116,6 +20180,7 @@ var ReactUpdates = { module.exports = ReactUpdates; }).call(this,require('_process')) + },{"./CallbackQueue":47,"./Object.assign":69,"./PooledClass":70,"./ReactCurrentOwner":85,"./ReactPerf":122,"./ReactReconciler":129,"./Transaction":157,"./invariant":191,"./warning":212,"_process":1}],141:[function(require,module,exports){ (function (process){ /** @@ -20172,6 +20237,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = React; }).call(this,require('_process')) + },{"./LinkedStateMixin":65,"./React":71,"./ReactCSSTransitionGroup":74,"./ReactComponentWithPureRenderMixin":82,"./ReactDefaultPerf":101,"./ReactFragment":109,"./ReactTestUtils":135,"./ReactTransitionGroup":138,"./ReactUpdates":140,"./cloneWithProps":163,"./cx":168,"./update":211,"_process":1}],142:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -20194,6 +20260,7 @@ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; var SVGDOMPropertyConfig = { Properties: { + clipPath: MUST_USE_ATTRIBUTE, cx: MUST_USE_ATTRIBUTE, cy: MUST_USE_ATTRIBUTE, d: MUST_USE_ATTRIBUTE, @@ -20239,6 +20306,7 @@ var SVGDOMPropertyConfig = { y: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { + clipPath: 'clip-path', fillOpacity: 'fill-opacity', fontFamily: 'font-family', fontSize: 'font-size', @@ -20918,6 +20986,7 @@ var SimpleEventPlugin = { module.exports = SimpleEventPlugin; }).call(this,require('_process')) + },{"./EventConstants":56,"./EventPluginUtils":60,"./EventPropagators":61,"./SyntheticClipboardEvent":146,"./SyntheticDragEvent":148,"./SyntheticEvent":149,"./SyntheticFocusEvent":150,"./SyntheticKeyboardEvent":152,"./SyntheticMouseEvent":153,"./SyntheticTouchEvent":154,"./SyntheticUIEvent":155,"./SyntheticWheelEvent":156,"./getEventCharCode":178,"./invariant":191,"./keyOf":198,"./warning":212,"_process":1}],146:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -21878,6 +21947,7 @@ var Transaction = { module.exports = Transaction; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],158:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -21973,6 +22043,7 @@ function accumulateInto(current, next) { module.exports = accumulateInto; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],160:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22140,6 +22211,7 @@ function cloneWithProps(child, props) { module.exports = cloneWithProps; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactPropTransferer":123,"./keyOf":198,"./warning":212,"_process":1}],164:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22332,6 +22404,7 @@ function createFullPageComponent(tag) { module.exports = createFullPageComponent; }).call(this,require('_process')) + },{"./ReactClass":78,"./ReactElement":103,"./invariant":191,"_process":1}],167:[function(require,module,exports){ (function (process){ /** @@ -22422,6 +22495,7 @@ function createNodesFromMarkup(markup, handleScript) { module.exports = createNodesFromMarkup; }).call(this,require('_process')) + },{"./ExecutionEnvironment":62,"./createArrayFromMixed":165,"./getMarkupWrap":183,"./invariant":191,"_process":1}],168:[function(require,module,exports){ (function (process){ /** @@ -22478,6 +22552,7 @@ function cx(classNames) { module.exports = cx; }).call(this,require('_process')) + },{"./warning":212,"_process":1}],169:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22594,6 +22669,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = emptyObject; }).call(this,require('_process')) + },{"_process":1}],172:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22707,6 +22783,7 @@ function findDOMNode(componentOrElement) { module.exports = findDOMNode; }).call(this,require('_process')) + },{"./ReactCurrentOwner":85,"./ReactInstanceMap":113,"./ReactMount":117,"./invariant":191,"./isNode":193,"./warning":212,"_process":1}],174:[function(require,module,exports){ (function (process){ /** @@ -22765,6 +22842,7 @@ function flattenChildren(children) { module.exports = flattenChildren; }).call(this,require('_process')) + },{"./traverseAllChildren":210,"./warning":212,"_process":1}],175:[function(require,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. @@ -23166,6 +23244,7 @@ var shouldWrap = { // Force wrapping for SVG elements because if they get created inside a <div>, // they will be initialized in the wrong namespace (and will not display). 'circle': true, + 'clipPath': true, 'defs': true, 'ellipse': true, 'g': true, @@ -23208,6 +23287,7 @@ var markupWrap = { 'th': trWrap, 'circle': svgWrap, + 'clipPath': svgWrap, 'defs': svgWrap, 'ellipse': svgWrap, 'g': svgWrap, @@ -23250,6 +23330,7 @@ function getMarkupWrap(nodeName) { module.exports = getMarkupWrap; }).call(this,require('_process')) + },{"./ExecutionEnvironment":62,"./invariant":191,"_process":1}],184:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -23555,6 +23636,7 @@ assign( function isInternalComponentType(type) { return ( typeof type === 'function' && + typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function' ); @@ -23648,6 +23730,7 @@ function instantiateReactComponent(node, parentCompositeType) { module.exports = instantiateReactComponent; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactCompositeComponent":83,"./ReactEmptyComponent":105,"./ReactNativeComponent":120,"./invariant":191,"./warning":212,"_process":1}],191:[function(require,module,exports){ (function (process){ /** @@ -23705,6 +23788,7 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; }).call(this,require('_process')) + },{"_process":1}],192:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -23961,6 +24045,7 @@ var keyMirror = function(obj) { module.exports = keyMirror; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],198:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -24123,6 +24208,7 @@ function onlyChild(children) { module.exports = onlyChild; }).call(this,require('_process')) + },{"./ReactElement":103,"./invariant":191,"_process":1}],202:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -24486,6 +24572,7 @@ function shouldUpdateReactComponent(prevElement, nextElement) { module.exports = shouldUpdateReactComponent; }).call(this,require('_process')) + },{"./warning":212,"_process":1}],209:[function(require,module,exports){ (function (process){ /** @@ -24558,6 +24645,7 @@ function toArray(obj) { module.exports = toArray; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],210:[function(require,module,exports){ (function (process){ /** @@ -24811,6 +24899,7 @@ function traverseAllChildren(children, callback, traverseContext) { module.exports = traverseAllChildren; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactFragment":109,"./ReactInstanceHandles":112,"./getIteratorFn":182,"./invariant":191,"./warning":212,"_process":1}],211:[function(require,module,exports){ (function (process){ /** @@ -24824,11 +24913,14 @@ module.exports = traverseAllChildren; * @providesModule update */ + /* global hasOwnProperty:true */ + 'use strict'; var assign = require("./Object.assign"); var keyOf = require("./keyOf"); var invariant = require("./invariant"); +var hasOwnProperty = {}.hasOwnProperty; function shallowCopy(x) { if (Array.isArray(x)) { @@ -24888,7 +24980,7 @@ function update(value, spec) { COMMAND_SET ) : invariant(typeof spec === 'object')); - if (spec.hasOwnProperty(COMMAND_SET)) { + if (hasOwnProperty.call(spec, COMMAND_SET)) { ("production" !== process.env.NODE_ENV ? invariant( Object.keys(spec).length === 1, 'Cannot have more than one key in an object with %s', @@ -24900,7 +24992,7 @@ function update(value, spec) { var nextValue = shallowCopy(value); - if (spec.hasOwnProperty(COMMAND_MERGE)) { + if (hasOwnProperty.call(spec, COMMAND_MERGE)) { var mergeObj = spec[COMMAND_MERGE]; ("production" !== process.env.NODE_ENV ? invariant( mergeObj && typeof mergeObj === 'object', @@ -24917,21 +25009,21 @@ function update(value, spec) { assign(nextValue, spec[COMMAND_MERGE]); } - if (spec.hasOwnProperty(COMMAND_PUSH)) { + if (hasOwnProperty.call(spec, COMMAND_PUSH)) { invariantArrayCase(value, spec, COMMAND_PUSH); spec[COMMAND_PUSH].forEach(function(item) { nextValue.push(item); }); } - if (spec.hasOwnProperty(COMMAND_UNSHIFT)) { + if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) { invariantArrayCase(value, spec, COMMAND_UNSHIFT); spec[COMMAND_UNSHIFT].forEach(function(item) { nextValue.unshift(item); }); } - if (spec.hasOwnProperty(COMMAND_SPLICE)) { + if (hasOwnProperty.call(spec, COMMAND_SPLICE)) { ("production" !== process.env.NODE_ENV ? invariant( Array.isArray(value), 'Expected %s target to be an array; got %s', @@ -24957,7 +25049,7 @@ function update(value, spec) { }); } - if (spec.hasOwnProperty(COMMAND_APPLY)) { + if (hasOwnProperty.call(spec, COMMAND_APPLY)) { ("production" !== process.env.NODE_ENV ? invariant( typeof spec[COMMAND_APPLY] === 'function', 'update(): expected spec of %s to be a function; got %s.', @@ -24979,6 +25071,7 @@ function update(value, spec) { module.exports = update; }).call(this,require('_process')) + },{"./Object.assign":69,"./invariant":191,"./keyOf":198,"_process":1}],212:[function(require,module,exports){ (function (process){ /** @@ -25042,9 +25135,10 @@ if ("production" !== process.env.NODE_ENV) { module.exports = warning; }).call(this,require('_process')) + },{"./emptyFunction":170,"_process":1}],"flux":[function(require,module,exports){ /** - * Copyright (c) 2014, Facebook, Inc. + * Copyright (c) 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -25052,11 +25146,11 @@ module.exports = warning; * of patent rights can be found in the PATENTS file in the same directory. */ -module.exports.Dispatcher = require('./lib/Dispatcher') +module.exports.Dispatcher = require('./lib/Dispatcher'); },{"./lib/Dispatcher":2}],"jquery":[function(require,module,exports){ /*! - * jQuery JavaScript Library v2.1.3 + * jQuery JavaScript Library v2.1.4 * http://jquery.com/ * * Includes Sizzle.js @@ -25066,7 +25160,7 @@ module.exports.Dispatcher = require('./lib/Dispatcher') * Released under the MIT license * http://jquery.org/license * - * Date: 2014-12-18T15:11Z + * Date: 2015-04-28T16:01Z */ (function( global, factory ) { @@ -25124,7 +25218,7 @@ var // Use the correct document accordingly with window argument (sandbox) document = window.document, - version = "2.1.3", + version = "2.1.4", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -25588,7 +25682,12 @@ jQuery.each("Boolean Number String Function Array Date RegExp Object Error".spli }); function isArraylike( obj ) { - var length = obj.length, + + // Support: iOS 8.2 (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { @@ -34265,10 +34364,10 @@ return jQuery; (function (global){ /** * @license - * lodash 3.6.0 (Custom Build) <https://lodash.com/> + * lodash 3.10.1 (Custom Build) <https://lodash.com/> * Build: `lodash modern -d -o ./index.js` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> - * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> + * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ @@ -34278,7 +34377,7 @@ return jQuery; var undefined; /** Used as the semantic version number. */ - var VERSION = '3.6.0'; + var VERSION = '3.10.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -34299,9 +34398,11 @@ return jQuery; var HOT_COUNT = 150, HOT_SPAN = 16; + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + /** Used to indicate the type of lazy iteratees. */ - var LAZY_DROP_WHILE_FLAG = 0, - LAZY_FILTER_FLAG = 1, + var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2; /** Used as the `TypeError` message for "Functions" methods. */ @@ -34352,24 +34453,38 @@ return jQuery; reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - */ - var reComboMarks = /[\u0300-\u036f\ufe20-\ufe23]/g; + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; /** - * Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). + * 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); + + /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ + var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect hexadecimal string values. */ - var reHexPrefix = /^0[xX]/; + var reHasHexPrefix = /^0[xX]/; /** Used to detect host constructors (Safari > 5). */ - var reHostCtor = /^\[object .+?Constructor\]$/; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; @@ -34377,14 +34492,6 @@ return jQuery; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; - /** - * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). - * In addition to special characters the forward slash is escaped to allow for - * easier `eval` use and `Function` compilation. - */ - var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, - reHasRegExpChars = RegExp(reRegExpChars.source); - /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; @@ -34396,26 +34503,13 @@ return jQuery; return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g'); }()); - /** Used to detect and test for whitespace. */ - var whitespace = ( - // Basic whitespace characters. - ' \t\x0b\f\xa0\ufeff' + - - // Line terminators. - '\n\r\u2028\u2029' + - - // Unicode category "Zs" space separators. - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' - ); - /** 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', 'document', - 'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - 'window' + 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite', + 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap' ]; /** Used to make template sourceURLs easier to identify. */ @@ -34451,13 +34545,6 @@ return jQuery; cloneableTags[mapTag] = cloneableTags[setTag] = cloneableTags[weakMapTag] = false; - /** Used as an internal `_.debounce` options object by `_.throttle`. */ - var debounceOptions = { - 'leading': false, - 'maxWait': 0, - 'trailing': false - }; - /** 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', @@ -34505,6 +34592,15 @@ return jQuery; 'object': true }; + /** 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' + }; + /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', @@ -34522,7 +34618,7 @@ return jQuery; var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; /** Detect free variable `global` from Node.js. */ - var freeGlobal = freeExports && freeModule && typeof global == 'object' && global; + var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; /** Detect free variable `self`. */ var freeSelf = objectTypes[typeof self] && self && self.Object && self; @@ -34536,7 +34632,7 @@ return jQuery; /** * Used as a reference to the global object. * - * The `this` value is used if it is the global object to avoid Greasemonkey's + * 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; @@ -34548,19 +34644,28 @@ return jQuery; * sorts them in ascending order without guaranteeing a stable sort. * * @private - * @param {*} value The value to compare to `other`. - * @param {*} other The value to compare to `value`. + * @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 valIsReflexive = value === value, + var valIsNull = value === null, + valIsUndef = value === undefined, + valIsReflexive = value === value; + + var othIsNull = other === null, + othIsUndef = other === undefined, othIsReflexive = other === other; - if (value > other || !valIsReflexive || (typeof value == 'undefined' && othIsReflexive)) { + if ((value > other && !othIsNull) || !valIsReflexive || + (valIsNull && !othIsUndef && othIsReflexive) || + (valIsUndef && othIsReflexive)) { return 1; } - if (value < other || !othIsReflexive || (typeof other == 'undefined' && valIsReflexive)) { + if ((value < other && !valIsNull) || !othIsReflexive || + (othIsNull && !valIsUndef && valIsReflexive) || + (othIsUndef && valIsReflexive)) { return -1; } } @@ -34628,7 +34733,7 @@ return jQuery; } /** - * Converts `value` to a string if it is not one. An empty string is returned + * Converts `value` to a string if it's not one. An empty string is returned * for `null` or `undefined` values. * * @private @@ -34636,24 +34741,10 @@ return jQuery; * @returns {string} Returns the string. */ function baseToString(value) { - if (typeof value == 'string') { - return value; - } return value == null ? '' : (value + ''); } /** - * Used by `_.max` and `_.min` as the default callback for string values. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the code unit of the first character of the string. - */ - function charAtCallback(string) { - return string.charCodeAt(0); - } - - /** * Used by `_.trim` and `_.trimLeft` to get the index of the first character * of `string` that is not found in `chars`. * @@ -34691,8 +34782,8 @@ return jQuery; * sort them in ascending order. * * @private - * @param {Object} object The object to compare to `other`. - * @param {Object} other The object to compare to `object`. + * @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) { @@ -34700,16 +34791,16 @@ return jQuery; } /** - * Used by `_.sortByOrder` to compare multiple properties of each element - * in a collection and stable sort them in the following order: + * Used by `_.sortByOrder` to compare multiple properties of a value to another + * and stable sort them. * - * If orders is unspecified, sort in ascending order for all properties. - * Otherwise, for each property, sort in ascending order if its corresponding value in - * orders is true, and descending order if false. + * 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 to `other`. - * @param {Object} other The object to compare to `object`. + * @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`. */ @@ -34726,7 +34817,8 @@ return jQuery; if (index >= ordersLength) { return result; } - return result * (orders[index] ? 1 : -1); + 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 @@ -34762,8 +34854,25 @@ return jQuery; } /** - * Used by `_.template` to escape characters for inclusion in compiled - * string literals. + * 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; + } + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. * * @private * @param {string} chr The matched character to escape. @@ -34974,15 +35083,9 @@ return jQuery; objectProto = Object.prototype, stringProto = String.prototype; - /** Used to detect DOM support. */ - var document = (document = context.window) && document.document; - /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; - /** Used to the length of n-tuples for `_.unzip`. */ - var getLength = baseProperty('length'); - /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; @@ -34990,56 +35093,42 @@ return jQuery; var idCounter = 0; /** - * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = context._; + var oldDash = root._; /** Used to detect if a method is native. */ - var reNative = RegExp('^' + - escapeRegExp(objToString) - .replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Native method references. */ - var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer, - bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, - ceil = Math.ceil, + var ArrayBuffer = context.ArrayBuffer, clearTimeout = context.clearTimeout, - floor = Math.floor, - getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - push = arrayProto.push, + parseFloat = context.parseFloat, + pow = Math.pow, propertyIsEnumerable = objectProto.propertyIsEnumerable, - Set = isNative(Set = context.Set) && Set, + Set = getNative(context, 'Set'), setTimeout = context.setTimeout, splice = arrayProto.splice, - Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, - WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap; - - /** Used to clone array buffers. */ - var Float64Array = (function() { - // Safari 5 errors when using an array buffer to initialize a typed array - // where the array buffer's `byteLength` is not a multiple of the typed - // array's `BYTES_PER_ELEMENT`. - try { - var func = isNative(func = context.Float64Array) && func, - result = new func(new ArrayBuffer(10), 0, 1) && func; - } catch(e) {} - return result; - }()); + Uint8Array = context.Uint8Array, + WeakMap = getNative(context, 'WeakMap'); /* Native method references for those with the same name as other `lodash` methods. */ - var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, - nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, + var nativeCeil = Math.ceil, + nativeCreate = getNative(Object, 'create'), + nativeFloor = Math.floor, + nativeIsArray = getNative(Array, 'isArray'), nativeIsFinite = context.isFinite, - nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, + nativeKeys = getNative(Object, 'keys'), nativeMax = Math.max, nativeMin = Math.min, - nativeNow = isNative(nativeNow = Date.now) && nativeNow, - nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite, + nativeNow = getNative(Date, 'now'), nativeParseInt = context.parseInt, nativeRandom = Math.random; @@ -35048,18 +35137,15 @@ return jQuery; POSITIVE_INFINITY = Number.POSITIVE_INFINITY; /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - /** Used as the size, in bytes, of each `Float64Array` element. */ - var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; - /** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * 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 = Math.pow(2, 53) - 1; + var MAX_SAFE_INTEGER = 9007199254740991; /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; @@ -35072,15 +35158,16 @@ return jQuery; /** * 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 return a boolean or single 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. + * 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 that merges iteratees to avoid creating intermediate - * arrays and reduce the number of iteratee executions. + * 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. @@ -35103,35 +35190,37 @@ return jQuery; * 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`, `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`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, - * `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `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`, `reverse`, - * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, - * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, - * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, - * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * `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`, `clone`, `cloneDeep`, `deburr`, - * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, - * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `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`, `max`, `min`, - * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, - * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, - * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, - * `startCase`, `startsWith`, `sum`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words` + * `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. @@ -35146,8 +35235,8 @@ return jQuery; * var wrapped = _([1, 2, 3]); * * // returns an unwrapped value - * wrapped.reduce(function(sum, n) { - * return sum + n; + * wrapped.reduce(function(total, n) { + * return total + n; * }); * // => 6 * @@ -35206,57 +35295,6 @@ return jQuery; */ var support = lodash.support = {}; - (function(x) { - - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but Firefox OS certified apps, older Opera mobile browsers, and - * the PlayStation 3; forced `false` for Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = /\bthis\b/.test(function() { return this; }); - - /** - * Detect if `Function#name` is supported (all but IE). - * - * @memberOf _.support - * @type boolean - */ - support.funcNames = typeof Function.name == 'string'; - - /** - * Detect if the DOM is supported. - * - * @memberOf _.support - * @type boolean - */ - try { - support.dom = document.createDocumentFragment().nodeType === 11; - } catch(e) { - support.dom = false; - } - - /** - * Detect if `arguments` object indexes are non-enumerable. - * - * In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object - * indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat - * `arguments` object indexes as non-enumerable and fail `hasOwnProperty` - * checks for indexes that exceed their function's formal parameters with - * associated values of `0`. - * - * @memberOf _.support - * @type boolean - */ - try { - support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1); - } catch(e) { - support.nonEnumArgs = true; - } - }(0, 0)); - /** * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB). Change the following template settings to use @@ -35328,13 +35366,12 @@ return jQuery; */ function LazyWrapper(value) { this.__wrapped__ = value; - this.__actions__ = null; + this.__actions__ = []; this.__dir__ = 1; - this.__dropCount__ = 0; this.__filtered__ = false; - this.__iteratees__ = null; + this.__iteratees__ = []; this.__takeCount__ = POSITIVE_INFINITY; - this.__views__ = null; + this.__views__ = []; } /** @@ -35346,17 +35383,13 @@ return jQuery; * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { - var actions = this.__actions__, - iteratees = this.__iteratees__, - views = this.__views__, - result = new LazyWrapper(this.__wrapped__); - - result.__actions__ = actions ? arrayCopy(actions) : null; + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = arrayCopy(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; - result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null; + result.__iteratees__ = arrayCopy(this.__iteratees__); result.__takeCount__ = this.__takeCount__; - result.__views__ = views ? arrayCopy(views) : null; + result.__views__ = arrayCopy(this.__views__); return result; } @@ -35389,22 +35422,25 @@ return jQuery; * @returns {*} Returns the unwrapped value. */ function lazyValue() { - var array = this.__wrapped__.value(); - if (!isArray(array)) { - return baseWrapperValue(array, this.__actions__); - } - var dir = this.__dir__, + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), isRight = dir < 0, - view = getView(0, array.length, this.__views__), + 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), - takeCount = nativeMin(length, this.__takeCount__), iteratees = this.__iteratees__, - iterLength = iteratees ? iteratees.length : 0, + iterLength = iteratees.length, resIndex = 0, - result = []; + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { + return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__); + } + var result = []; outer: while (length-- && resIndex < takeCount) { @@ -35416,30 +35452,16 @@ return jQuery; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, - type = data.type; + type = data.type, + computed = iteratee(value); - if (type == LAZY_DROP_WHILE_FLAG) { - if (data.done && (isRight ? (index > data.index) : (index < data.index))) { - data.count = 0; - data.done = false; - } - data.index = index; - if (!data.done) { - var limit = data.limit; - if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) { - continue outer; - } - } - } else { - var computed = iteratee(value); - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } } } @@ -35502,7 +35524,7 @@ return jQuery; } /** - * Adds `value` to `key` of the cache. + * Sets `value` to `key` of the cache. * * @private * @name set @@ -35572,6 +35594,30 @@ return jQuery; /*------------------------------------------------------------------------*/ /** + * 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); + + while (++index < length) { + result[index] = array[index]; + } + while (++othIndex < othLength) { + result[index++] = other[othIndex]; + } + return result; + } + + /** * Copies the values of `source` to `array`. * * @private @@ -35654,6 +35700,35 @@ return jQuery; } /** + * 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; + + while (++index < length) { + var value = array[index], + current = +iteratee(value); + + if (comparator(current, computed)) { + computed = current; + result = value; + } + } + return result; + } + + /** * A specialized version of `_.filter` for arrays without support for callback * shorthands and `this` binding. * @@ -35698,45 +35773,22 @@ return jQuery; } /** - * A specialized version of `_.max` for arrays without support for iteratees. + * Appends the elements of `values` to `array`. * * @private - * @param {Array} array The array to iterate over. - * @returns {*} Returns the maximum value. + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. */ - function arrayMax(array) { + function arrayPush(array, values) { var index = -1, - length = array.length, - result = NEGATIVE_INFINITY; + length = values.length, + offset = array.length; while (++index < length) { - var value = array[index]; - if (value > result) { - result = value; - } + array[offset + index] = values[index]; } - return result; - } - - /** - * A specialized version of `_.min` for arrays without support for iteratees. - * - * @private - * @param {Array} array The array to iterate over. - * @returns {*} Returns the minimum value. - */ - function arrayMin(array) { - var index = -1, - length = array.length, - result = POSITIVE_INFINITY; - - while (++index < length) { - var value = array[index]; - if (value < result) { - result = value; - } - } - return result; + return array; } /** @@ -35810,18 +35862,20 @@ return jQuery; } /** - * A specialized version of `_.sum` for arrays without support for iteratees. + * 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) { + function arraySum(array, iteratee) { var length = array.length, result = 0; while (length--) { - result += +array[length] || 0; + result += +iteratee(array[length]) || 0; } return result; } @@ -35835,13 +35889,13 @@ return jQuery; * @returns {*} Returns the value to assign to the destination object. */ function assignDefaults(objectValue, sourceValue) { - return typeof objectValue == 'undefined' ? sourceValue : objectValue; + return objectValue === undefined ? sourceValue : objectValue; } /** * Used by `_.template` to customize its `_.assign` use. * - * **Note:** This method is like `assignDefaults` except that it ignores + * **Note:** This function is like `assignDefaults` except that it ignores * inherited property values when checking if a property is `undefined`. * * @private @@ -35852,27 +35906,25 @@ return jQuery; * @returns {*} Returns the value to assign to the destination object. */ function assignOwnDefaults(objectValue, sourceValue, key, object) { - return (typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key)) + return (objectValue === undefined || !hasOwnProperty.call(object, key)) ? sourceValue : objectValue; } /** - * The base implementation of `_.assign` without support for argument juggling, - * multiple sources, and `this` binding `customizer` functions. + * 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 assigning values. - * @returns {Object} Returns the destination object. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. */ - function baseAssign(object, source, customizer) { - var props = keys(source); - if (!customizer) { - return baseCopy(source, object, props); - } + function assignWith(object, source, customizer) { var index = -1, + props = keys(source), length = props.length; while (++index < length) { @@ -35881,7 +35933,7 @@ return jQuery; result = customizer(value, source[key], key, object, source); if ((result === result ? (result !== value) : (value === value)) || - (typeof value == 'undefined' && !(key in object))) { + (value === undefined && !(key in object))) { object[key] = result; } } @@ -35889,47 +35941,60 @@ return jQuery; } /** - * The base implementation of `_.at` without support for strings and individual - * key arguments. + * 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. + * @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, - length = collection.length, - isArr = isLength(length), + 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) { - key = parseFloat(key); result[index] = isIndex(key, length) ? collection[key] : undefined; } else { - result[index] = collection[key]; + result[index] = isNil ? undefined : collection[key]; } } return result; } /** - * Copies the properties of `source` to `object`. + * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. - * @param {Object} [object={}] The object to copy properties to. * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ - function baseCopy(source, object, props) { - if (!props) { - props = object; - object = {}; - } + function baseCopy(source, props, object) { + object || (object = {}); + var index = -1, length = props.length; @@ -35953,7 +36018,7 @@ return jQuery; function baseCallback(func, thisArg, argCount) { var type = typeof func; if (type == 'function') { - return typeof thisArg == 'undefined' + return thisArg === undefined ? func : bindCallback(func, thisArg, argCount); } @@ -35963,9 +36028,9 @@ return jQuery; if (type == 'object') { return baseMatches(func); } - return typeof thisArg == 'undefined' - ? baseProperty(func + '') - : baseMatchesProperty(func + '', thisArg); + return thisArg === undefined + ? property(func) + : baseMatchesProperty(func, thisArg); } /** @@ -35987,7 +36052,7 @@ return jQuery; if (customizer) { result = object ? customizer(value, key, object) : customizer(value); } - if (typeof result != 'undefined') { + if (result !== undefined) { return result; } if (!isObject(value)) { @@ -36006,7 +36071,7 @@ return jQuery; if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = initCloneObject(isFunc ? {} : value); if (!isDeep) { - return baseCopy(value, result, keys(value)); + return baseAssign(result, value); } } else { return cloneableTags[tag] @@ -36014,7 +36079,7 @@ return jQuery; : (object ? value : {}); } } - // Check for circular references and return corresponding clone. + // Check for circular references and return its corresponding clone. stackA || (stackA = []); stackB || (stackB = []); @@ -36044,14 +36109,14 @@ return jQuery; * @returns {Object} Returns the new object. */ var baseCreate = (function() { - function Object() {} + function object() {} return function(prototype) { if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; + object.prototype = prototype; + var result = new object; + object.prototype = undefined; } - return result || context.Object(); + return result || {}; }; }()); @@ -36091,7 +36156,7 @@ return jQuery; var index = -1, indexOf = getIndexOf(), isCommon = indexOf == baseIndexOf, - cache = (isCommon && values.length >= 200) ? createCache(values) : null, + cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, valuesLength = values.length; if (cache) { @@ -36161,6 +36226,32 @@ return jQuery; } /** + * 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 @@ -36177,7 +36268,7 @@ return jQuery; if (start < 0) { start = -start > length ? 0 : (length + start); } - end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); + end = (end === undefined || end > length) ? length : (+end || 0); if (end < 0) { end += length; } @@ -36239,33 +36330,29 @@ return jQuery; * * @private * @param {Array} array The array to flatten. - * @param {boolean} isDeep Specify a deep flatten. - * @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. + * @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) { + function baseFlatten(array, isDeep, isStrict, result) { + result || (result = []); + var index = -1, - length = array.length, - resIndex = -1, - result = []; + length = array.length; while (++index < length) { var value = array[index]; - - if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). - value = baseFlatten(value, isDeep, isStrict); - } - var valIndex = -1, - valLength = value.length; - - result.length += valLength; - while (++valIndex < valLength) { - result[++resIndex] = value[valIndex]; + baseFlatten(value, isDeep, isStrict, result); + } else { + arrayPush(result, value); } } else if (!isStrict) { - result[++resIndex] = value; + result[result.length] = value; } } return result; @@ -36274,7 +36361,7 @@ return jQuery; /** * The base implementation of `baseForIn` and `baseForOwn` which iterates * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iterator functions may exit iteration early by explicitly + * each property. Iteratee functions may exit iteration early by explicitly * returning `false`. * * @private @@ -36361,6 +36448,32 @@ return jQuery; } /** + * 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. * @@ -36374,18 +36487,10 @@ return jQuery; * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { - // Exit early for identical values. if (value === other) { - // Treat `+0` vs. `-0` as not equal. - return value !== 0 || (1 / value == 1 / other); + return true; } - var valType = typeof value, - othType = typeof other; - - // Exit early for unlike primitive values. - if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') || - value == null || other == null) { - // Return `false` unless both values are `NaN`. + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); @@ -36428,28 +36533,24 @@ return jQuery; othIsArr = isTypedArray(other); } } - var objIsObj = (objTag == objectTag || (isLoose && objTag == funcTag)), - othIsObj = (othTag == objectTag || (isLoose && othTag == funcTag)), + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && !(objIsArr || objIsObj)) { return equalByTag(object, other, objTag); } - if (isLoose) { - if (!isSameTag && !(objIsObj && othIsObj)) { - return false; - } - } else { - var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + if (!isLoose) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - if (valWrapped || othWrapped) { - return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); - } - if (!isSameTag) { - return false; + 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 = []); @@ -36479,42 +36580,44 @@ return jQuery; * * @private * @param {Object} object The object to inspect. - * @param {Array} props The source property names to match. - * @param {Array} values The source values to match. - * @param {Array} strictCompareFlags Strict comparison flags for source values. + * @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, props, values, strictCompareFlags, customizer) { - var index = -1, - length = props.length, + function baseIsMatch(object, matchData, customizer) { + var index = matchData.length, + length = index, noCustomizer = !customizer; - while (++index < length) { - if ((noCustomizer && strictCompareFlags[index]) - ? values[index] !== object[props[index]] - : !(props[index] in object) + 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; } } - index = -1; while (++index < length) { - var key = props[index], + data = matchData[index]; + var key = data[0], objValue = object[key], - srcValue = values[index]; + srcValue = data[1]; - if (noCustomizer && strictCompareFlags[index]) { - var result = typeof objValue != 'undefined' || (key in object); + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } } else { - result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (typeof result == 'undefined') { - result = baseIsEqual(srcValue, objValue, customizer, true); + var result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + return false; } } - if (!result) { - return false; - } } return true; } @@ -36529,9 +36632,11 @@ return jQuery; * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { - var result = []; + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + baseEach(collection, function(value, key, collection) { - result.push(iteratee(value, key, collection)); + result[++index] = iteratee(value, key, collection); }); return result; } @@ -36544,54 +36649,54 @@ return jQuery; * @returns {Function} Returns the new function. */ function baseMatches(source) { - var props = keys(source), - length = props.length; + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + var key = matchData[0][0], + value = matchData[0][1]; - if (!length) { - return constant(true); - } - if (length == 1) { - var key = props[0], - value = source[key]; - - if (isStrictComparable(value)) { - return function(object) { - return object != null && object[key] === value && - (typeof value != 'undefined' || (key in toObject(object))); - }; - } - } - var values = Array(length), - strictCompareFlags = Array(length); - - while (length--) { - value = source[props[length]]; - values[length] = value; - strictCompareFlags[length] = isStrictComparable(value); + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; } return function(object) { - return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); + return baseIsMatch(object, matchData); }; } /** - * The base implementation of `_.matchesProperty` which does not coerce `key` - * to a string. + * The base implementation of `_.matchesProperty` which does not clone `srcValue`. * * @private - * @param {string} key The key of the property to get. - * @param {*} value The value to compare. + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to compare. * @returns {Function} Returns the new function. */ - function baseMatchesProperty(key, value) { - if (isStrictComparable(value)) { - return function(object) { - return object != null && object[key] === value && - (typeof value != 'undefined' || (key in toObject(object))); - }; - } + function baseMatchesProperty(path, srcValue) { + var isArr = isArray(path), + isCommon = isKey(path) && isStrictComparable(srcValue), + pathKey = (path + ''); + + path = toPath(path); return function(object) { - return object != null && baseIsEqual(value, object[key], null, true); + 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); }; } @@ -36602,32 +36707,40 @@ return jQuery; * @private * @param {Object} object The destination object. * @param {Object} source The source object. - * @param {Function} [customizer] The function to customize merging properties. + * @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 the destination object. + * @returns {Object} Returns `object`. */ function baseMerge(object, source, customizer, stackA, stackB) { if (!isObject(object)) { return object; } - var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); - (isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { + 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 = []); - return baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); + baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); } - var value = object[key], - result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; + else { + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; - if (isCommon) { - result = srcValue; - } - if ((isSrcArr || typeof result != 'undefined') && - (isCommon || (result === result ? (result !== value) : (value === value)))) { - object[key] = result; + if (isCommon) { + result = srcValue; + } + if ((result !== undefined || (isSrcArr && !(key in object))) && + (isCommon || (result === result ? (result !== value) : (value === value)))) { + object[key] = result; + } } }); return object; @@ -36643,7 +36756,7 @@ return jQuery; * @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 merging properties. + * @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`. @@ -36660,14 +36773,14 @@ return jQuery; } var value = object[key], result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; + isCommon = result === undefined; if (isCommon) { result = srcValue; - if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { + if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { result = isArray(value) ? value - : ((value && value.length) ? arrayCopy(value) : []); + : (isArrayLike(value) ? arrayCopy(value) : []); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { result = isArguments(value) @@ -36692,7 +36805,7 @@ return jQuery; } /** - * The base implementation of `_.property` which does not coerce `key` to a string. + * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. @@ -36705,6 +36818,42 @@ return jQuery; } /** + * 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. * @@ -36714,7 +36863,7 @@ return jQuery; * @returns {number} Returns the random number. */ function baseRandom(min, max) { - return min + floor(nativeRandom() * (max - min + 1)); + return min + nativeFloor(nativeRandom() * (max - min + 1)); } /** @@ -36770,7 +36919,7 @@ return jQuery; if (start < 0) { start = -start > length ? 0 : (length + start); } - end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); + end = (end === undefined || end > length) ? length : (+end || 0); if (end < 0) { end += length; } @@ -36829,23 +36978,19 @@ return jQuery; * * @private * @param {Array|Object|string} collection The collection to iterate over. - * @param {string[]} props The property names to sort by. - * @param {boolean[]} orders The sort orders of `props`. + * @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, props, orders) { - var index = -1, - length = collection.length, - result = isLength(length) ? Array(length) : []; + function baseSortByOrder(collection, iteratees, orders) { + var callback = getCallback(), + index = -1; - baseEach(collection, function(value) { - var length = props.length, - criteria = Array(length); + iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); }); - while (length--) { - criteria[length] = value == null ? undefined : value[props[length]]; - } - result[++index] = { 'criteria': criteria, 'index': index, 'value': value }; + 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) { @@ -36884,7 +37029,7 @@ return jQuery; indexOf = getIndexOf(), length = array.length, isCommon = indexOf == baseIndexOf, - isLarge = isCommon && length >= 200, + isLarge = isCommon && length >= LARGE_ARRAY_SIZE, seen = isLarge ? createCache() : null, result = []; @@ -36925,7 +37070,7 @@ return jQuery; /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names - * returned by `keysFunc`. + * of `props`. * * @private * @param {Object} object The object to query. @@ -36983,11 +37128,8 @@ return jQuery; length = actions.length; while (++index < length) { - var args = [result], - action = actions[index]; - - push.apply(args, action.args); - result = action.func.apply(action.thisArg, args); + var action = actions[index]; + result = action.func.apply(action.thisArg, arrayPush([result], action.args)); } return result; } @@ -37012,7 +37154,7 @@ return jQuery; var mid = (low + high) >>> 1, computed = array[mid]; - if (retHighest ? (computed <= value) : (computed < value)) { + if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { low = mid + 1; } else { high = mid; @@ -37042,17 +37184,23 @@ return jQuery; var low = 0, high = array ? array.length : 0, valIsNaN = value !== value, - valIsUndef = typeof value == 'undefined'; + valIsNull = value === null, + valIsUndef = value === undefined; while (low < high) { - var mid = floor((low + high) / 2), + 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 || typeof computed != 'undefined'); + setLow = isReflexive && (retHighest || isDef); + } else if (computed == null) { + setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } @@ -37079,7 +37227,7 @@ return jQuery; if (typeof func != 'function') { return identity; } - if (typeof thisArg == 'undefined') { + if (thisArg === undefined) { return func; } switch (argCount) { @@ -37109,26 +37257,11 @@ return jQuery; * @returns {ArrayBuffer} Returns the cloned array buffer. */ function bufferClone(buffer) { - return bufferSlice.call(buffer, 0); - } - if (!bufferSlice) { - // PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`. - bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) { - var byteLength = buffer.byteLength, - floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0, - offset = floatLength * FLOAT64_BYTES_PER_ELEMENT, - result = new ArrayBuffer(byteLength); - - if (floatLength) { - var view = new Float64Array(result, 0, floatLength); - view.set(new Float64Array(buffer, 0, floatLength)); - } - if (byteLength != offset) { - view = new Uint8Array(result, offset); - view.set(new Uint8Array(buffer, offset)); - } - return result; - }; + var result = new ArrayBuffer(buffer.byteLength), + view = new Uint8Array(result); + + view.set(new Uint8Array(buffer)); + return result; } /** @@ -37147,7 +37280,7 @@ return jQuery; argsLength = nativeMax(args.length - holdersLength, 0), leftIndex = -1, leftLength = partials.length, - result = Array(argsLength + leftLength); + result = Array(leftLength + argsLength); while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; @@ -37183,23 +37316,18 @@ return jQuery; while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } - var pad = argsIndex; + var offset = argsIndex; while (++rightIndex < rightLength) { - result[pad + rightIndex] = partials[rightIndex]; + result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { - result[pad + holders[holdersIndex]] = args[argsIndex++]; + result[offset + holders[holdersIndex]] = args[argsIndex++]; } return result; } /** - * Creates a function that aggregates a collection, creating an accumulator - * object composed from the results of running each element in the collection - * through an iteratee. - * - * **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`, - * and `_.partition`. + * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function. * * @private * @param {Function} setter The function to set keys and values of the accumulator object. @@ -37229,48 +37357,39 @@ return jQuery; } /** - * Creates a function that assigns properties of source object(s) to a given - * destination object. - * - * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. + * 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 function() { - var args = arguments, - length = args.length, - object = args[0]; - - if (length < 2 || object == null) { - return object; - } - var customizer = args[length - 2], - thisArg = args[length - 1], - guard = args[3]; + 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 (length > 3 && typeof customizer == 'function') { + if (typeof customizer == 'function') { customizer = bindCallback(customizer, thisArg, 5); length -= 2; } else { - customizer = (length > 2 && typeof thisArg == 'function') ? thisArg : null; + customizer = typeof thisArg == 'function' ? thisArg : undefined; length -= (customizer ? 1 : 0); } - if (guard && isIterateeCall(args[1], args[2], guard)) { - customizer = length == 3 ? null : customizer; - length = 2; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; } - var index = 0; while (++index < length) { - var source = args[index]; + var source = sources[index]; if (source) { assigner(object, source, customizer); } } return object; - }; + }); } /** @@ -37283,7 +37402,7 @@ return jQuery; */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { - var length = collection ? collection.length : 0; + var length = collection ? getLength(collection) : 0; if (!isLength(length)) { return eachFunc(collection, iteratee); } @@ -37349,9 +37468,9 @@ return jQuery; * @param {Array} [values] The values to cache. * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. */ - var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { - return new SetCache(values); - }; + function createCache(values) { + return (nativeCreate && Set) ? new SetCache(values) : null; + } /** * Creates a function that produces compound words out of the words in a @@ -37385,8 +37504,22 @@ return jQuery; */ 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, arguments); + result = Ctor.apply(thisBinding, args); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. @@ -37404,9 +37537,9 @@ return jQuery; function createCurry(flag) { function curryFunc(func, arity, guard) { if (guard && isIterateeCall(func, arity, guard)) { - arity = null; + arity = undefined; } - var result = createWrapper(func, flag, null, null, null, null, null, arity); + var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curryFunc.placeholder; return result; } @@ -37414,35 +37547,46 @@ return jQuery; } /** + * 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} arrayFunc The function to get the extremum value from an array. - * @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, - * extremum value. + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. * @returns {Function} Returns the new extremum function. */ - function createExtremum(arrayFunc, isMin) { + function createExtremum(comparator, exValue) { return function(collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } - var func = getCallback(), - noIteratee = iteratee == null; - - if (!(func === baseCallback && noIteratee)) { - noIteratee = false; - iteratee = func(iteratee, thisArg, 3); - } - if (noIteratee) { - var isArr = isArray(collection); - if (!isArr && isString(collection)) { - iteratee = charAtCallback; - } else { - return arrayFunc(isArr ? collection : toIterable(collection)); + 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 extremumBy(collection, iteratee, isMin); + return baseExtremum(collection, iteratee, comparator, exValue); }; } @@ -37462,7 +37606,7 @@ return jQuery; return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, eachFunc); - } + }; } /** @@ -37505,11 +37649,8 @@ return jQuery; */ function createFlow(fromRight) { return function() { - var length = arguments.length; - if (!length) { - return function() { return arguments[0]; }; - } var wrapper, + length = arguments.length, index = fromRight ? length : -1, leftIndex = 0, funcs = Array(length); @@ -37519,28 +37660,32 @@ return jQuery; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - var funcName = wrapper ? '' : getFuncName(func); - wrapper = funcName == 'wrapper' ? new LodashWrapper([]) : wrapper; + if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') { + wrapper = new LodashWrapper([], true); + } } index = wrapper ? -1 : length; while (++index < length) { func = funcs[index]; - funcName = getFuncName(func); - var data = funcName == 'wrapper' ? getData(func) : null; - if (data && isLaziable(data[0])) { + 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; - if (wrapper && args.length == 1 && isArray(args[0])) { - return wrapper.plant(args[0]).value(); + 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 = funcs[index].apply(this, args); + result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); @@ -37560,7 +37705,7 @@ return jQuery; */ function createForEach(arrayFunc, eachFunc) { return function(collection, iteratee, thisArg) { - return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); }; @@ -37575,7 +37720,7 @@ return jQuery; */ function createForIn(objectFunc) { return function(object, iteratee, thisArg) { - if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { + if (typeof iteratee != 'function' || thisArg !== undefined) { iteratee = bindCallback(iteratee, thisArg, 3); } return objectFunc(object, iteratee, keysIn); @@ -37591,7 +37736,7 @@ return jQuery; */ function createForOwn(objectFunc) { return function(object, iteratee, thisArg) { - if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { + if (typeof iteratee != 'function' || thisArg !== undefined) { iteratee = bindCallback(iteratee, thisArg, 3); } return objectFunc(object, iteratee); @@ -37599,6 +37744,28 @@ return jQuery; } /** + * 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 @@ -37608,7 +37775,7 @@ return jQuery; function createPadDir(fromRight) { return function(string, length, chars) { string = baseToString(string); - return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string)); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); }; } @@ -37622,7 +37789,7 @@ return jQuery; function createPartial(flag) { var partialFunc = restParam(function(func, partials) { var holders = replaceHolders(partials, partialFunc.placeholder); - return createWrapper(func, flag, null, partials, holders); + return createWrapper(func, flag, undefined, partials, holders); }); return partialFunc; } @@ -37638,7 +37805,7 @@ return jQuery; function createReduce(arrayFunc, eachFunc) { return function(collection, iteratee, accumulator, thisArg) { var initFromArray = arguments.length < 3; - return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee, accumulator, initFromArray) : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc); }; @@ -37667,10 +37834,8 @@ return jQuery; isBindKey = bitmask & BIND_KEY_FLAG, isCurry = bitmask & CURRY_FLAG, isCurryBound = bitmask & CURRY_BOUND_FLAG, - isCurryRight = bitmask & CURRY_RIGHT_FLAG; - - var Ctor = !isBindKey && createCtorWrapper(func), - key = func; + isCurryRight = bitmask & CURRY_RIGHT_FLAG, + Ctor = isBindKey ? undefined : createCtorWrapper(func); function wrapper() { // Avoid `arguments` object use disqualifying optimizations by @@ -37694,12 +37859,12 @@ return jQuery; length -= argsHolders.length; if (length < arity) { - var newArgPos = argPos ? arrayCopy(argPos) : null, + var newArgPos = argPos ? arrayCopy(argPos) : undefined, newArity = nativeMax(arity - length, 0), - newsHolders = isCurry ? argsHolders : null, - newHoldersRight = isCurry ? null : argsHolders, - newPartials = isCurry ? args : null, - newPartialsRight = isCurry ? null : args; + 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); @@ -37717,17 +37882,18 @@ return jQuery; return result; } } - var thisBinding = isBind ? thisArg : this; - if (isBindKey) { - func = thisBinding[key]; - } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + if (argPos) { args = reorder(args, argPos); } if (isAry && ary < args.length) { args.length = ary; } - var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func; + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtorWrapper(func); + } return fn.apply(thisBinding, args); } return wrapper; @@ -37752,7 +37918,7 @@ return jQuery; } var padLength = length - strLength; chars = chars == null ? ' ' : (chars + ''); - return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); + return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength); } /** @@ -37778,7 +37944,7 @@ return jQuery; argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, - args = Array(argsLength + leftLength); + args = Array(leftLength + argsLength); while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; @@ -37793,6 +37959,25 @@ return jQuery; } /** + * 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 @@ -37801,10 +37986,10 @@ return jQuery; */ function createSortedIndex(retHighest) { return function(array, value, iteratee, thisArg) { - var func = getCallback(iteratee); - return (func === baseCallback && iteratee == null) + var callback = getCallback(iteratee); + return (iteratee == null && callback === baseCallback) ? binaryIndex(array, value, retHighest) - : binaryIndexBy(array, value, func(iteratee, thisArg, 1), retHighest); + : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest); }; } @@ -37841,16 +38026,16 @@ return jQuery; var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); - partials = holders = null; + partials = holders = undefined; } length -= (holders ? holders.length : 0); if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; - partials = holders = null; + partials = holders = undefined; } - var data = isBindKey ? null : getData(func), + var data = isBindKey ? undefined : getData(func), newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; if (data) { @@ -37890,40 +38075,35 @@ return jQuery; function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { var index = -1, arrLength = array.length, - othLength = other.length, - result = true; + othLength = other.length; if (arrLength != othLength && !(isLoose && othLength > arrLength)) { return false; } - // Deep compare the contents, ignoring non-numeric properties. - while (result && ++index < arrLength) { + // Ignore non-index properties. + while (++index < arrLength) { var arrValue = array[index], - othValue = other[index]; + othValue = other[index], + result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; - result = undefined; - if (customizer) { - result = isLoose - ? customizer(othValue, arrValue, index) - : customizer(arrValue, othValue, index); + if (result !== undefined) { + if (result) { + continue; + } + return false; } - if (typeof result == 'undefined') { - // Recursively compare arrays (susceptible to call stack limits). - if (isLoose) { - var othIndex = othLength; - while (othIndex--) { - othValue = other[othIndex]; - result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); - if (result) { - break; - } - } - } else { - result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + // 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 !!result; + return true; } /** @@ -37934,7 +38114,7 @@ return jQuery; * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private - * @param {Object} value The object to compare. + * @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`. @@ -37954,8 +38134,7 @@ return jQuery; // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other - // But, treat `-0` vs. `+0` as not equal. - : (object == 0 ? ((1 / object) == (1 / other)) : object == +other); + : object == +other; case regexpTag: case stringTag: @@ -37989,29 +38168,22 @@ return jQuery; if (objLength != othLength && !isLoose) { return false; } - var skipCtor = isLoose, - index = -1; - + 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) { - var key = objProps[index], - result = isLoose ? key in other : hasOwnProperty.call(other, key); + key = objProps[index]; + var objValue = object[key], + othValue = other[key], + result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; - if (result) { - var objValue = object[key], - othValue = other[key]; - - result = undefined; - if (customizer) { - result = isLoose - ? customizer(othValue, objValue, key) - : customizer(objValue, othValue, key); - } - if (typeof result == 'undefined') { - // Recursively compare objects (susceptible to call stack limits). - result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB); - } - } - if (!result) { + // 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'); @@ -38032,34 +38204,6 @@ return jQuery; } /** - * 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, collection). - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {boolean} [isMin] Specify returning the minimum, instead of the - * maximum, extremum value. - * @returns {*} Returns the extremum value. - */ - function extremumBy(collection, iteratee, isMin) { - var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY, - computed = exValue, - result = computed; - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if ((isMin ? (current < computed) : (current > computed)) || - (current === exValue && current === result)) { - computed = current; - result = value; - } - }); - return result; - } - - /** * 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 @@ -38092,29 +38236,20 @@ return jQuery; * @param {Function} func The function to query. * @returns {string} Returns the function name. */ - var getFuncName = (function() { - if (!support.funcNames) { - return constant(''); - } - if (constant.name == 'constant') { - return baseProperty('name'); - } - return function(func) { - var result = func.name, - array = realNames[result], - length = array ? array.length : 0; + 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; - } + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; } - return result; - }; - }()); + } + return result; + } /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is @@ -38132,18 +38267,60 @@ return jQuery; } /** + * 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. + * @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 ? transforms.length : 0; + length = transforms.length; while (++index < length) { var data = transforms[index], @@ -38199,7 +38376,6 @@ return jQuery; * **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. @@ -38234,6 +38410,36 @@ return jQuery; } /** + * 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 @@ -38242,7 +38448,7 @@ return jQuery; * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { - value = +value; + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } @@ -38261,13 +38467,9 @@ return jQuery; return false; } var type = typeof index; - if (type == 'number') { - var length = object.length, - prereq = isLength(length) && isIndex(index, length); - } else { - prereq = type == 'string' && index in object; - } - if (prereq) { + 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); } @@ -38275,6 +38477,26 @@ return jQuery; } /** + * 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 @@ -38283,13 +38505,21 @@ return jQuery; */ function isLaziable(func) { var funcName = getFuncName(func); - return !!funcName && func === lodash[funcName] && funcName in LazyWrapper.prototype; + 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`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. @@ -38308,7 +38538,7 @@ return jQuery; * equality comparisons, else `false`. */ function isStrictComparable(value) { - return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value)); + return value === value && !isObject(value); } /** @@ -38382,8 +38612,20 @@ return jQuery; } /** - * A specialized version of `_.pick` that picks `object` properties specified - * by the `props` array. + * 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. @@ -38407,7 +38649,7 @@ return jQuery; } /** - * A specialized version of `_.pick` that picks `object` properties `predicate` + * A specialized version of `_.pick` which picks `object` properties `predicate` * returns truthy for. * * @private @@ -38481,53 +38723,20 @@ return jQuery; }()); /** - * A fallback implementation of `_.isPlainObject` which checks if `value` - * is an object created by the `Object` constructor or has a `[[Prototype]]` - * of `null`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - var Ctor, - support = lodash.support; - - // Exit early for non `Object` objects. - if (!(isObjectLike(value) && objToString.call(value) == objectTag) || - (!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 typeof result == 'undefined' || hasOwnProperty.call(value, result); - } - - /** * 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 inspect. + * @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, - support = lodash.support; + length = propsLength && object.length; - var allowIndexes = length && isLength(length) && - (isArray(object) || (support.nonEnumArgs && isArguments(object))); + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); var index = -1, result = []; @@ -38542,7 +38751,7 @@ return jQuery; } /** - * Converts `value` to an array-like object if it is not one. + * Converts `value` to an array-like object if it's not one. * * @private * @param {*} value The value to process. @@ -38552,14 +38761,14 @@ return jQuery; if (value == null) { return []; } - if (!isLength(value.length)) { + if (!isArrayLike(value)) { return values(value); } return isObject(value) ? value : Object(value); } /** - * Converts `value` to an object if it is not one. + * Converts `value` to an object if it's not one. * * @private * @param {*} value The value to process. @@ -38570,6 +38779,24 @@ return jQuery; } /** + * 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 @@ -38608,12 +38835,12 @@ return jQuery; if (guard ? isIterateeCall(array, size, guard) : size == null) { size = 1; } else { - size = nativeMax(+size || 1, 1); + size = nativeMax(nativeFloor(size) || 1, 1); } var index = 0, length = array ? array.length : 0, resIndex = -1, - result = Array(ceil(length / size)); + result = Array(nativeCeil(length / size)); while (index < length) { result[++resIndex] = baseSlice(array, index, (index += size)); @@ -38651,12 +38878,9 @@ return jQuery; } /** - * Creates an array excluding all values of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * 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 _ @@ -38670,7 +38894,7 @@ return jQuery; * // => [1, 3] */ var difference = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return (isObjectLike(array) && isArrayLike(array)) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); @@ -39065,13 +39289,10 @@ return jQuery; /** * Gets the index at which the first occurrence of `value` is found in `array` - * using `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. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * 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 _ @@ -39102,10 +39323,9 @@ return jQuery; if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; } else if (fromIndex) { - var index = binaryIndex(array, value), - other = array[index]; - - if (value === value ? (value === other) : (other !== other)) { + var index = binaryIndex(array, value); + if (index < length && + (value === value ? (value === array[index]) : (array[index] !== array[index]))) { return index; } return -1; @@ -39131,13 +39351,10 @@ return jQuery; } /** - * Creates an array of unique values in all provided arrays using `SameValueZero` + * 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. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @category Array @@ -39147,36 +39364,31 @@ return jQuery; * _.intersection([1, 2], [4, 2], [2, 1]); * // => [2] */ - function intersection() { - var args = [], - argsIndex = -1, - argsLength = arguments.length, - caches = [], + var intersection = restParam(function(arrays) { + var othLength = arrays.length, + othIndex = othLength, + caches = Array(length), indexOf = getIndexOf(), - isCommon = indexOf == baseIndexOf; + isCommon = indexOf == baseIndexOf, + result = []; - while (++argsIndex < argsLength) { - var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { - args.push(value); - caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); - } + while (othIndex--) { + var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : []; + caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null; } - argsLength = args.length; - var array = args[0], + var array = arrays[0], index = -1, length = array ? array.length : 0, - result = [], seen = caches[0]; outer: while (++index < length) { value = array[index]; if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { - argsIndex = argsLength; - while (--argsIndex) { - var cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], 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; } } @@ -39187,7 +39399,7 @@ return jQuery; } } return result; - } + }); /** * Gets the last element of `array`. @@ -39260,14 +39472,11 @@ return jQuery; } /** - * Removes all provided values from `array` using `SameValueZero` for equality - * comparisons. + * Removes all provided values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. * - * **Notes:** - * - Unlike `_.without`, this method mutates `array` - * - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except - * that `NaN` matches `NaN` + * **Note:** Unlike `_.without`, this method mutates `array`. * * @static * @memberOf _ @@ -39331,20 +39540,10 @@ return jQuery; * // => [10, 20] */ var pullAt = restParam(function(array, indexes) { - array || (array = []); indexes = baseFlatten(indexes); - var length = indexes.length, - result = baseAt(array, indexes); - - indexes.sort(baseCompareAscending); - while (length--) { - var index = parseFloat(indexes[length]); - if (index != previous && isIndex(index)) { - var previous = index; - splice.call(array, index, 1); - } - } + var result = baseAt(array, indexes); + basePullAt(array, indexes.sort(baseCompareAscending)); return result; }); @@ -39388,19 +39587,23 @@ return jQuery; * // => [2, 4] */ function remove(array, predicate, thisArg) { + var result = []; + if (!(array && array.length)) { + return result; + } var index = -1, - length = array ? array.length : 0, - result = []; + indexes = [], + length = array.length; predicate = getCallback(predicate, thisArg, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); - splice.call(array, index--, 1); - length--; + indexes.push(index); } } + basePullAt(array, indexes); return result; } @@ -39425,7 +39628,7 @@ return jQuery; /** * Creates a slice of `array` from `start` up to, but not including, `end`. * - * **Note:** This function is used instead of `Array#slice` to support node + * **Note:** This method is used instead of `Array#slice` to support node * lists in IE < 9 and to ensure dense arrays are returned. * * @static @@ -39702,12 +39905,9 @@ return jQuery; } /** - * Creates an array of unique values, in order, of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * 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 _ @@ -39724,12 +39924,14 @@ return jQuery; }); /** - * Creates a duplicate-value-free version of an array using `SameValueZero` - * for equality comparisons. Providing `true` for `isSorted` performs a faster - * search algorithm for sorted arrays. If an iteratee function is provided it - * is invoked for each value 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). + * 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. @@ -39742,10 +39944,6 @@ return jQuery; * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @alias unique @@ -39757,8 +39955,8 @@ return jQuery; * @returns {Array} Returns the new duplicate-value-free array. * @example * - * _.uniq([1, 2, 1]); - * // => [1, 2] + * _.uniq([2, 1, 2]); + * // => [2, 1] * * // using `isSorted` * _.uniq([1, 1, 2], true); @@ -39781,12 +39979,12 @@ return jQuery; } if (isSorted != null && typeof isSorted != 'boolean') { thisArg = iteratee; - iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; + iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted; isSorted = false; } - var func = getCallback(); - if (!(func === baseCallback && iteratee == null)) { - iteratee = func(iteratee, thisArg, 3); + var callback = getCallback(); + if (!(iteratee == null && callback === baseCallback)) { + iteratee = callback(iteratee, thisArg, 3); } return (isSorted && getIndexOf() == baseIndexOf) ? sortedUniq(array, iteratee) @@ -39795,7 +39993,7 @@ return jQuery; /** * 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` + * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static @@ -39812,10 +40010,19 @@ return jQuery; * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { + if (!(array && array.length)) { + return []; + } var index = -1, - length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, - result = Array(length); + 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)); } @@ -39823,12 +40030,44 @@ return jQuery; } /** - * Creates an array excluding all provided values using `SameValueZero` for - * equality comparisons. + * 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 * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * 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 _ @@ -39842,13 +40081,13 @@ return jQuery; * // => [3] */ var without = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, values) : []; }); /** - * Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the provided arrays. * * @static @@ -39867,9 +40106,9 @@ return jQuery; while (++index < length) { var array = arguments[index]; - if (isArray(array) || isArguments(array)) { + if (isArrayLike(array)) { var result = result - ? baseDifference(result, array).concat(baseDifference(array, result)) + ? arrayPush(baseDifference(result, array), baseDifference(array, result)) : array; } } @@ -39933,6 +40172,38 @@ return jQuery; 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); + }); + /*------------------------------------------------------------------------*/ /** @@ -40059,16 +40330,16 @@ return jQuery; * @example * * var array = [1, 2]; - * var wrapper = _(array).push(3); + * var wrapped = _(array).push(3); * * console.log(array); * // => [1, 2] * - * wrapper = wrapper.commit(); + * wrapped = wrapped.commit(); * console.log(array); * // => [1, 2, 3] * - * wrapper.last(); + * wrapped.last(); * // => 3 * * console.log(array); @@ -40079,6 +40350,33 @@ return jQuery; } /** + * 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 @@ -40088,17 +40386,17 @@ return jQuery; * @example * * var array = [1, 2]; - * var wrapper = _(array).map(function(value) { + * var wrapped = _(array).map(function(value) { * return Math.pow(value, 2); * }); * * var other = [3, 4]; - * var otherWrapper = wrapper.plant(other); + * var otherWrapped = wrapped.plant(other); * - * otherWrapper.value(); + * otherWrapped.value(); * // => [9, 16] * - * wrapper.value(); + * wrapped.value(); * // => [1, 4] */ function wrapperPlant(value) { @@ -40141,15 +40439,20 @@ return jQuery; */ 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) { - value = new LazyWrapper(this); + wrapped = new LazyWrapper(this); } - return new LodashWrapper(value.reverse(), this.__chain__); + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); + return new LodashWrapper(wrapped, this.__chain__); } - return this.thru(function(value) { - return value.reverse(); - }); + return this.thru(interceptor); } /** @@ -40208,10 +40511,6 @@ return jQuery; * // => ['barney', 'pebbles'] */ var at = restParam(function(collection, props) { - var length = collection ? collection.length : 0; - if (isLength(length)) { - collection = toIterable(collection); - } return baseAt(collection, baseFlatten(props)); }); @@ -40311,9 +40610,9 @@ return jQuery; function every(collection, predicate, thisArg) { var func = isArray(collection) ? arrayEvery : baseEvery; if (thisArg && isIterateeCall(collection, predicate, thisArg)) { - predicate = null; + predicate = undefined; } - if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + if (typeof predicate != 'function' || thisArg !== undefined) { predicate = getCallback(predicate, thisArg, 3); } return func(collection, predicate); @@ -40483,10 +40782,10 @@ return jQuery; /** * 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). Iterator functions may exit iteration early + * (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 + * **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. * @@ -40584,13 +40883,10 @@ return jQuery; }); /** - * Checks if `value` is in `collection` using `SameValueZero` for equality - * comparisons. If `fromIndex` is negative, it is used as the offset from - * the end of `collection`. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * 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 _ @@ -40616,22 +40912,19 @@ return jQuery; * // => true */ function includes(collection, target, fromIndex, guard) { - var length = collection ? collection.length : 0; + var length = collection ? getLength(collection) : 0; if (!isLength(length)) { collection = values(collection); length = collection.length; } - if (!length) { - return false; - } 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) - : (getIndexOf(collection, target, fromIndex) > -1); + ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) + : (!!length && getIndexOf(collection, target, fromIndex) > -1); } /** @@ -40685,16 +40978,16 @@ return jQuery; }); /** - * Invokes the method named by `methodName` on 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`. + * 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 {Function|string} methodName The name of the method to invoke or + * @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. @@ -40706,15 +40999,15 @@ return jQuery; * _.invoke([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ - var invoke = restParam(function(collection, methodName, args) { + var invoke = restParam(function(collection, path, args) { var index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = isLength(length) ? Array(length) : []; + isFunc = typeof path == 'function', + isProp = isKey(path), + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { - var func = isFunc ? methodName : (value != null && value[methodName]); - result[++index] = func ? func.apply(value, args) : undefined; + var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); }); return result; }); @@ -40735,14 +41028,15 @@ return jQuery; * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * Many lodash methods are guarded to work as interatees for methods like + * 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`, `uniq`, and `words` + * `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 _ @@ -40751,7 +41045,6 @@ return jQuery; * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. - * create a `_.property` or `_.matches` style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new mapped array. * @example @@ -40845,13 +41138,13 @@ return jQuery; }, function() { return [[], []]; }); /** - * Gets the value of `key` from all elements in `collection`. + * 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 {string} key The key of the property to pluck. + * @param {Array|string} path The path of the property to pluck. * @returns {Array} Returns the property values. * @example * @@ -40867,8 +41160,8 @@ return jQuery; * _.pluck(userIndex, 'age'); * // => [36, 40] (iteration order is not guaranteed) */ - function pluck(collection, key) { - return map(collection, baseProperty(key)); + function pluck(collection, path) { + return map(collection, property(path)); } /** @@ -40879,11 +41172,12 @@ return jQuery; * 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 interatees for methods like + * Many lodash methods are guarded to work as iteratees for methods like * `_.reduce`, `_.reduceRight`, and `_.transform`. * * The guarded methods are: - * `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`, + * and `sortByOrder` * * @static * @memberOf _ @@ -40896,8 +41190,8 @@ return jQuery; * @returns {*} Returns the accumulated value. * @example * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; + * _.reduce([1, 2], function(total, n) { + * return total + n; * }); * // => 3 * @@ -40931,23 +41225,12 @@ return jQuery; * }, []); * // => [4, 5, 2, 3, 0, 1] */ - var reduceRight = createReduce(arrayReduceRight, baseEachRight); + var reduceRight = createReduce(arrayReduceRight, baseEachRight); /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * - * 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 @@ -41012,8 +41295,20 @@ return jQuery; var length = collection.length; return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } - var result = shuffle(collection); - result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); + 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; } @@ -41032,20 +41327,7 @@ return jQuery; * // => [4, 1, 3, 2] */ function shuffle(collection) { - collection = toIterable(collection); - - var index = -1, - length = collection.length, - result = Array(length); - - while (++index < length) { - var rand = baseRandom(0, index); - if (index != rand) { - result[index] = result[rand]; - } - result[rand] = collection[index]; - } - return result; + return sample(collection, POSITIVE_INFINITY); } /** @@ -41069,7 +41351,7 @@ return jQuery; * // => 7 */ function size(collection) { - var length = collection ? collection.length : 0; + var length = collection ? getLength(collection) : 0; return isLength(length) ? length : keys(collection).length; } @@ -41125,9 +41407,9 @@ return jQuery; function some(collection, predicate, thisArg) { var func = isArray(collection) ? arraySome : baseSome; if (thisArg && isIterateeCall(collection, predicate, thisArg)) { - predicate = null; + predicate = undefined; } - if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + if (typeof predicate != 'function' || thisArg !== undefined) { predicate = getCallback(predicate, thisArg, 3); } return func(collection, predicate); @@ -41155,9 +41437,8 @@ return jQuery; * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [iteratee=_.identity] The function - * invoked per iteration. If a property name or an object is provided it is - * used to create a `_.property` or `_.matches` style callback respectively. + * @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 @@ -41186,104 +41467,112 @@ return jQuery; if (collection == null) { return []; } - var index = -1, - length = collection.length, - result = isLength(length) ? Array(length) : []; - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } + var index = -1; iteratee = getCallback(iteratee, thisArg, 3); - baseEach(collection, function(value, key, collection) { - result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; + + 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 sorts by property names - * instead of an iteratee function. + * 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 {...(string|string[])} props The property names to sort by, - * specified as individual property names or arrays of property names. + * @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': 40 }, - * { 'user': 'barney', 'age': 26 }, - * { 'user': 'fred', 'age': 30 } + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } * ]; * * _.map(_.sortByAll(users, ['user', 'age']), _.values); - * // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] + * // => [['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]] */ - function sortByAll() { - var args = arguments, - collection = args[0], - guard = args[3], - index = 0, - length = args.length - 1; - + var sortByAll = restParam(function(collection, iteratees) { if (collection == null) { return []; } - var props = Array(length); - while (index < length) { - props[index] = args[++index]; - } - if (guard && isIterateeCall(args[1], args[2], guard)) { - props = args[1]; + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; } - return baseSortByOrder(collection, baseFlatten(props), []); - } + return baseSortByOrder(collection, baseFlatten(iteratees), []); + }); /** * This method is like `_.sortByAll` except that it allows specifying the - * sort orders of the property names to sort by. A truthy value in `orders` - * will sort the corresponding property name in ascending order while a - * falsey value will sort it in descending order. + * 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 {string[]} props The property names to sort by. - * @param {boolean[]} orders The sort orders of `props`. + * @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': 'barney', 'age': 26 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 30 } + * { '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'], [true, false]), _.values); - * // => [['barney', 36], ['barney', 26], ['fred', 40], ['fred', 30]] + * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ - function sortByOrder(collection, props, orders, guard) { + function sortByOrder(collection, iteratees, orders, guard) { if (collection == null) { return []; } - if (guard && isIterateeCall(props, orders, guard)) { - orders = null; + if (guard && isIterateeCall(iteratees, orders, guard)) { + orders = undefined; } - if (!isArray(props)) { - props = props == null ? [] : [props]; + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; } if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } - return baseSortByOrder(collection, props, orders); + return baseSortByOrder(collection, iteratees, orders); } /** @@ -41400,10 +41689,10 @@ return jQuery; */ function ary(func, n, guard) { if (guard && isIterateeCall(func, n, guard)) { - n = null; + n = undefined; } n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); - return createWrapper(func, ARY_FLAG, null, null, null, null, n); + return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); } /** @@ -41436,8 +41725,9 @@ return jQuery; return function() { if (--n > 0) { result = func.apply(this, arguments); - } else { - func = null; + } + if (n <= 1) { + func = undefined; } return result; }; @@ -41451,7 +41741,7 @@ return jQuery; * 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` + * **Note:** Unlike native `Function#bind` this method does not set the "length" * property of bound functions. * * @static @@ -41493,7 +41783,7 @@ return jQuery; * 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. + * **Note:** This method does not set the "length" property of bound functions. * * @static * @memberOf _ @@ -41534,7 +41824,7 @@ return jQuery; * * 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://michaux.ca/articles/lazy-function-definition-pattern) + * 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 @@ -41591,7 +41881,7 @@ return jQuery; * 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. + * **Note:** This method does not set the "length" property of curried functions. * * @static * @memberOf _ @@ -41630,7 +41920,7 @@ return jQuery; * 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. + * **Note:** This method does not set the "length" property of curried functions. * * @static * @memberOf _ @@ -41663,12 +41953,13 @@ return jQuery; var curryRight = createCurry(CURRY_RIGHT_FLAG); /** - * Creates a function that delays invoking `func` until after `wait` milliseconds - * have elapsed since the last time it was invoked. The created 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. + * 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 @@ -41744,9 +42035,9 @@ return jQuery; var leading = true; trailing = false; } else if (isObject(options)) { - leading = options.leading; + leading = !!options.leading; maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); - trailing = 'trailing' in options ? options.trailing : trailing; + trailing = 'trailing' in options ? !!options.trailing : trailing; } function cancel() { @@ -41756,41 +42047,35 @@ return jQuery; 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) { - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - var isCalled = trailingCall; - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } + complete(trailingCall, maxTimeoutId); } else { timeoutId = setTimeout(delayed, remaining); } } function maxDelayed() { - if (timeoutId) { - clearTimeout(timeoutId); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (trailing || (maxWait !== wait)) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } + complete(trailing, timeoutId); } function debounced() { @@ -41830,7 +42115,7 @@ return jQuery; result = func.apply(thisArg, args); } if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = null; + args = thisArg = undefined; } return result; } @@ -41935,7 +42220,7 @@ return jQuery; * * **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`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * 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 @@ -41982,14 +42267,14 @@ return jQuery; } var memoized = function() { var args = arguments, - cache = memoized.cache, - key = resolver ? resolver.apply(this, args) : args[0]; + 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); - cache.set(key, result); + memoized.cache = cache.set(key, result); return result; }; memoized.cache = new memoize.Cache; @@ -41997,6 +42282,52 @@ return jQuery; } /** + * 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. @@ -42042,7 +42373,7 @@ return jQuery; * // `initialize` invokes `createApplication` once */ function once(func) { - return before(func, 2); + return before(2, func); } /** @@ -42053,7 +42384,7 @@ return jQuery; * 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 + * **Note:** This method does not set the "length" property of partially * applied functions. * * @static @@ -42086,7 +42417,7 @@ return jQuery; * 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 + * **Note:** This method does not set the "length" property of partially * applied functions. * * @static @@ -42141,7 +42472,7 @@ return jQuery; * // => [3, 6, 9] */ var rearg = restParam(function(func, indexes) { - return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes)); + return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); }); /** @@ -42170,7 +42501,7 @@ return jQuery; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - start = nativeMax(typeof start == 'undefined' ? (func.length - 1) : (+start || 0), 0); + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); return function() { var args = arguments, index = -1, @@ -42236,12 +42567,12 @@ return jQuery; } /** - * Creates a function that only invokes `func` at most once per every `wait` - * milliseconds. The created 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. + * 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 @@ -42287,10 +42618,7 @@ return jQuery; leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } - debounceOptions.leading = leading; - debounceOptions.maxWait = +wait; - debounceOptions.trailing = trailing; - return debounce(func, wait, debounceOptions); + return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing }); } /** @@ -42316,7 +42644,7 @@ return jQuery; */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; - return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); + return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []); } /*------------------------------------------------------------------------*/ @@ -42381,8 +42709,9 @@ return jQuery; customizer = isDeep; isDeep = false; } - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); - return baseClone(value, isDeep, customizer); + return typeof customizer == 'function' + ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) + : baseClone(value, isDeep); } /** @@ -42431,8 +42760,57 @@ return jQuery; * // => 20 */ function cloneDeep(value, customizer, thisArg) { - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); - return baseClone(value, true, customizer); + 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; } /** @@ -42452,8 +42830,8 @@ return jQuery; * // => false */ function isArguments(value) { - var length = isObjectLike(value) ? value.length : undefined; - return isLength(length) && objToString.call(value) == argsTag; + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); } /** @@ -42533,14 +42911,7 @@ return jQuery; * // => false */ function isElement(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && - (objToString.call(value).indexOf('Element') > -1); - } - // Fallback for environments without DOM support. - if (!support.dom) { - isElement = function(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); - }; + return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); } /** @@ -42574,10 +42945,9 @@ return jQuery; if (value == null) { return true; } - var length = value.length; - if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) || + if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || (isObjectLike(value) && isFunction(value.splice)))) { - return !length; + return !value.length; } return !keys(value).length; } @@ -42597,10 +42967,11 @@ return jQuery; * * @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 comparing values. + * @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 @@ -42626,12 +42997,9 @@ return jQuery; * // => true */ function isEqual(value, other, customizer, thisArg) { - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); - if (!customizer && isStrictComparable(value) && isStrictComparable(other)) { - return value === other; - } + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; var result = customizer ? customizer(value, other) : undefined; - return typeof result == 'undefined' ? baseIsEqual(value, other, customizer) : !!result; + return result === undefined ? baseIsEqual(value, other, customizer) : !!result; } /** @@ -42658,7 +43026,7 @@ return jQuery; /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). + * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite). * * @static * @memberOf _ @@ -42682,9 +43050,9 @@ return jQuery; * _.isFinite(Infinity); * // => false */ - var isFinite = nativeNumIsFinite || function(value) { + function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); - }; + } /** * Checks if `value` is classified as a `Function` object. @@ -42702,12 +43070,12 @@ return jQuery; * _.isFunction(/abc/); * // => false */ - var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) { + 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 objToString.call(value) == funcTag; - }; + return isObject(value) && objToString.call(value) == funcTag; + } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. @@ -42733,7 +43101,7 @@ return jQuery; // 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 type == 'function' || (!!value && type == 'object'); + return !!value && (type == 'object' || type == 'function'); } /** @@ -42753,7 +43121,7 @@ return jQuery; * @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 comparing values. + * @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 @@ -42776,32 +43144,8 @@ return jQuery; * // => true */ function isMatch(object, source, customizer, thisArg) { - var props = keys(source), - length = props.length; - - if (!length) { - return true; - } - if (object == null) { - return false; - } - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); - if (!customizer && length == 1) { - var key = props[0], - value = source[key]; - - if (isStrictComparable(value)) { - return value === object[key] && (typeof value != 'undefined' || (key in toObject(object))); - } - } - var values = Array(length), - strictCompareFlags = Array(length); - - while (length--) { - value = values[length] = source[props[length]]; - strictCompareFlags[length] = isStrictComparable(value); - } - return baseIsMatch(toObject(object), props, values, strictCompareFlags, customizer); + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; + return baseIsMatch(object, getMatchData(source), customizer); } /** @@ -42855,10 +43199,10 @@ return jQuery; if (value == null) { return false; } - if (objToString.call(value) == funcTag) { - return reNative.test(fnToString.call(value)); + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); } - return isObjectLike(value) && reHostCtor.test(value); + return isObjectLike(value) && reIsHostCtor.test(value); } /** @@ -42937,17 +43281,26 @@ return jQuery; * _.isPlainObject(Object.create(null)); * // => true */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && objToString.call(value) == objectTag)) { + 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; } - var valueOf = value.valueOf, - objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); - }; + // 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. @@ -42966,7 +43319,7 @@ return jQuery; * // => false */ function isRegExp(value) { - return (isObjectLike(value) && objToString.call(value) == regexpTag) || false; + return isObject(value) && objToString.call(value) == regexpTag; } /** @@ -43026,7 +43379,55 @@ return jQuery; * // => false */ function isUndefined(value) { - return typeof value == 'undefined'; + 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; } /** @@ -43045,7 +43446,7 @@ return jQuery; * // => [2, 3] */ function toArray(value) { - var length = value ? value.length : 0; + var length = value ? getLength(value) : 0; if (!isLength(length)) { return values(value); } @@ -43085,19 +43486,72 @@ return jQuery; /*------------------------------------------------------------------------*/ /** + * 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 assigning values. + * @param {Function} [customizer] The function to customize assigned values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {Object} Returns `object`. * @example @@ -43107,13 +43561,17 @@ return jQuery; * * // using a customizer callback * var defaults = _.partialRight(_.assign, function(value, other) { - * return typeof value == 'undefined' ? other : value; + * return _.isUndefined(value) ? other : value; * }); * * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ - var assign = createAssigner(baseAssign); + 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 @@ -43152,9 +43610,9 @@ return jQuery; function create(prototype, properties, guard) { var result = baseCreate(prototype); if (guard && isIterateeCall(prototype, properties, guard)) { - properties = null; + properties = undefined; } - return properties ? baseCopy(properties, result, keys(properties)) : result; + return properties ? baseAssign(result, properties) : result; } /** @@ -43162,6 +43620,8 @@ return jQuery; * 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 @@ -43173,14 +43633,27 @@ return jQuery; * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ - var defaults = restParam(function(args) { - var object = args[0]; - if (object == null) { - return object; - } - args.push(assignDefaults); - return assign.apply(undefined, args); - }); + 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 @@ -43285,7 +43758,7 @@ return jQuery; /** * 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). Iterator functions may exit + * with three arguments: (value, key, object). Iteratee functions may exit * iteration early by explicitly returning `false`. * * @static @@ -43341,7 +43814,7 @@ return jQuery; /** * 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). Iterator functions may exit iteration + * three arguments: (value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static @@ -43414,24 +43887,72 @@ return jQuery; } /** - * Checks if `key` exists as a direct property of `object` instead of an - * inherited property. + * 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 inspect. - * @param {string} key The key to check. - * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. + * @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': 1, 'b': 2, 'c': 3 }; + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * - * _.has(object, 'b'); + * _.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, key) { - return object ? hasOwnProperty.call(object, key) : false; + 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))); } /** @@ -43459,7 +43980,7 @@ return jQuery; */ function invert(object, multiValue, guard) { if (guard && isIterateeCall(object, multiValue, guard)) { - multiValue = null; + multiValue = undefined; } var index = -1, props = keys(object), @@ -43488,13 +44009,13 @@ return jQuery; * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * [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 inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * @@ -43512,12 +44033,9 @@ return jQuery; * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { - if (object) { - var Ctor = object.constructor, - length = object.length; - } + var Ctor = object == null ? undefined : object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && (length && isLength(length)))) { + (typeof object != 'function' && isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; @@ -43531,7 +44049,7 @@ return jQuery; * @static * @memberOf _ * @category Object - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * @@ -43554,7 +44072,7 @@ return jQuery; } var length = object.length; length = (length && isLength(length) && - (isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0; + (isArray(object) || isArguments(object)) && length) || 0; var Ctor = object.constructor, index = -1, @@ -43575,6 +44093,28 @@ return jQuery; } /** + * 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: @@ -43615,74 +44155,11 @@ return jQuery; * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ - function mapValues(object, iteratee, thisArg) { - var result = {}; - iteratee = getCallback(iteratee, thisArg, 3); - - baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); - }); - return result; - } - - /** - * 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 merging properties. - * @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); + 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. - * 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` omitting the properties `predicate` returns truthy for. The - * predicate is bound to `thisArg` and invoked with three arguments: - * (value, key, object). * * @static * @memberOf _ @@ -43724,7 +44201,7 @@ return jQuery; * @static * @memberOf _ * @category Object - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. * @example * @@ -43732,6 +44209,8 @@ return jQuery; * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) */ function pairs(object) { + object = toObject(object); + var index = -1, props = keys(object), length = props.length, @@ -43780,41 +44259,93 @@ return jQuery; }); /** - * Resolves the value of property `key` on `object`. If the value of `key` is - * a function it is invoked with the `this` binding of `object` and its result - * is returned, else the property value is returned. If the property value is - * `undefined` the `defaultValue` is used in its place. + * 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 {string} key The key of the property to resolve. - * @param {*} [defaultValue] The value returned if the property value - * resolves to `undefined`. + * @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 = { 'user': 'fred', 'age': _.constant(40) }; + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; * - * _.result(object, 'user'); - * // => 'fred' + * _.result(object, 'a[0].b.c1'); + * // => 3 * - * _.result(object, 'age'); - * // => 40 + * _.result(object, 'a[0].b.c2'); + * // => 4 * - * _.result(object, 'status', 'busy'); - * // => 'busy' + * _.result(object, 'a.b.c', 'default'); + * // => 'default' * - * _.result(object, 'status', _.constant('busy')); - * // => 'busy' + * _.result(object, 'a.b.c', _.constant('default')); + * // => 'default' */ - function result(object, key, defaultValue) { - var value = object == null ? undefined : object[key]; - if (typeof value == 'undefined') { - value = defaultValue; + 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 isFunction(value) ? value.call(object) : value; + return object; } /** @@ -43822,7 +44353,7 @@ return jQuery; * `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). Iterator functions + * with four arguments: (accumulator, value, key, object). Iteratee functions * may exit iteration early by explicitly returning `false`. * * @static @@ -43856,7 +44387,7 @@ return jQuery; if (isArr) { accumulator = isArray(object) ? new Ctor : []; } else { - accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype); + accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); } } else { accumulator = {}; @@ -43959,13 +44490,13 @@ return jQuery; */ function inRange(value, start, end) { start = +start || 0; - if (typeof end === 'undefined') { + if (end === undefined) { end = start; start = 0; } else { end = +end || 0; } - return value >= start && value < end; + return value >= nativeMin(start, end) && value < nativeMax(start, end); } /** @@ -43997,7 +44528,7 @@ return jQuery; */ function random(min, max, floating) { if (floating && isIterateeCall(min, max, floating)) { - max = floating = null; + max = floating = undefined; } var noMin = min == null, noMax = max == null; @@ -44090,7 +44621,7 @@ return jQuery; */ function deburr(string) { string = baseToString(string); - return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, ''); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); } /** @@ -44119,7 +44650,7 @@ return jQuery; target = (target + ''); var length = string.length; - position = typeof position == 'undefined' + position = position === undefined ? length : nativeMin(position < 0 ? 0 : (+position || 0), length); @@ -44135,15 +44666,16 @@ return jQuery; * use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't require escaping in HTML and have no special meaning + * ">" 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 [#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. + * 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. @@ -44183,8 +44715,8 @@ return jQuery; function escapeRegExp(string) { string = baseToString(string); return (string && reHasRegExpChars.test(string)) - ? string.replace(reRegExpChars, '\\$&') - : string; + ? string.replace(reRegExpChars, escapeRegExpChar) + : (string || '(?:)'); } /** @@ -44211,7 +44743,7 @@ return jQuery; }); /** - * Pads `string` on the left and right sides if it is shorter than `length`. + * 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 @@ -44241,15 +44773,15 @@ return jQuery; return string; } var mid = (length - strLength) / 2, - leftLength = floor(mid), - rightLength = ceil(mid); + 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 is shorter than `length`. Padding + * Pads `string` on the left side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static @@ -44273,7 +44805,7 @@ return jQuery; var padLeft = createPadDir(); /** - * Pads `string` on the right side if it is shorter than `length`. Padding + * Pads `string` on the right side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static @@ -44320,25 +44852,16 @@ return jQuery; * // => [6, 8, 10] */ function parseInt(string, radix, guard) { - if (guard && isIterateeCall(string, radix, guard)) { + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. + // Chrome fails to trim leading <BOM> 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; } - return nativeParseInt(string, radix); - } - // Fallback for environments with pre-ES5 implementations. - if (nativeParseInt(whitespace + '08') != 8) { - parseInt = function(string, radix, guard) { - // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. - // Chrome fails to trim leading <BOM> 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 || (reHexPrefix.test(string) ? 16 : 10)); - }; + string = trim(string); + return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); } /** @@ -44374,7 +44897,7 @@ return jQuery; if (n % 2) { result += string; } - n = floor(n / 2); + n = nativeFloor(n / 2); string += string; } while (n); @@ -44559,12 +45082,12 @@ return jQuery; var settings = lodash.templateSettings; if (otherOptions && isIterateeCall(string, options, otherOptions)) { - options = otherOptions = null; + options = otherOptions = undefined; } string = baseToString(string); - options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); + options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); - var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), + var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); @@ -44754,7 +45277,7 @@ return jQuery; } /** - * Truncates `string` if it is longer than the given maximum string length. + * Truncates `string` if it's longer than the given maximum string length. * The last characters of the truncated string are replaced with the omission * string which defaults to "...". * @@ -44795,7 +45318,7 @@ return jQuery; */ function trunc(string, options, guard) { if (guard && isIterateeCall(string, options, guard)) { - options = null; + options = undefined; } var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; @@ -44890,7 +45413,7 @@ return jQuery; */ function words(string, pattern, guard) { if (guard && isIterateeCall(string, pattern, guard)) { - pattern = null; + pattern = undefined; } string = baseToString(string); return string.match(pattern || reWords) || []; @@ -44966,7 +45489,7 @@ return jQuery; */ function callback(func, thisArg, guard) { if (guard && isIterateeCall(func, thisArg, guard)) { - thisArg = null; + thisArg = undefined; } return isObjectLike(func) ? matches(func) @@ -45015,7 +45538,7 @@ return jQuery; } /** - * Creates a function which performs a deep comparison between a given object + * Creates a function that performs a deep comparison between a given object * and `source`, returning `true` if the given object has equivalent property * values, else `false`. * @@ -45044,7 +45567,7 @@ return jQuery; } /** - * Creates a function which compares the property value of `key` on a given + * Creates a function that compares the property value of `path` on a given * object to `value`. * * **Note:** This method supports comparing arrays, booleans, `Date` objects, @@ -45054,8 +45577,8 @@ return jQuery; * @static * @memberOf _ * @category Utility - * @param {string} key The key of the property to get. - * @param {*} value The value to compare. + * @param {Array|string} path The path of the property to get. + * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. * @example * @@ -45067,22 +45590,79 @@ return jQuery; * _.find(users, _.matchesProperty('user', 'fred')); * // => { 'user': 'fred' } */ - function matchesProperty(key, value) { - return baseMatchesProperty(key + '', baseClone(value, true)); + function matchesProperty(path, srcValue) { + return baseMatchesProperty(path, baseClone(srcValue, true)); } /** + * Creates a function that invokes the method at `path` on a given object. + * Any additional arguments are provided to the invoked method. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': _.constant(2) } } }, + * { 'a': { 'b': { 'c': _.constant(1) } } } + * ]; + * + * _.map(objects, _.method('a.b.c')); + * // => [2, 1] + * + * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ + var method = restParam(function(path, args) { + return function(object) { + return invokePath(object, path, args); + }; + }); + + /** + * The opposite of `_.method`; this method creates a function that invokes + * the method at a given path on `object`. Any additional arguments are + * provided to the invoked method. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} object The object to query. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Function} Returns the new function. + * @example + * + * var array = _.times(3, _.constant), + * object = { 'a': array, 'b': array, 'c': array }; + * + * _.map(['a[2]', 'c[0]'], _.methodOf(object)); + * // => [2, 0] + * + * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); + * // => [2, 0] + */ + var methodOf = restParam(function(object, args) { + return function(path) { + return invokePath(object, path, args); + }; + }); + + /** * Adds all own enumerable function properties of a source object to the * destination object. If `object` is a function then methods are added to * its prototype as well. * - * **Note:** Use `_.runInContext` to create a pristine `lodash` function - * for mixins to avoid conflicts caused by modifying the original. + * **Note:** Use `_.runInContext` to create a pristine `lodash` function to + * avoid conflicts caused by modifying the original. * * @static * @memberOf _ * @category Utility - * @param {Function|Object} [object=this] object The destination object. + * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. * @param {Object} [options] The options object. * @param {boolean} [options.chain=true] Specify whether the functions added @@ -45096,9 +45676,6 @@ return jQuery; * }); * } * - * // use `_.runInContext` to avoid conflicts (esp. in Node.js) - * var _ = require('lodash').runInContext(); - * * _.mixin({ 'vowels': vowels }); * _.vowels('fred'); * // => ['e'] @@ -45113,8 +45690,8 @@ return jQuery; function mixin(object, source, options) { if (options == null) { var isObj = isObject(source), - props = isObj && keys(source), - methodNames = props && props.length && baseFunctions(source, props); + props = isObj ? keys(source) : undefined, + methodNames = (props && props.length) ? baseFunctions(source, props) : undefined; if (!(methodNames ? methodNames.length : isObj)) { methodNames = false; @@ -45153,9 +45730,7 @@ return jQuery; result.__chain__ = chainAll; return result; } - var args = [this.value()]; - push.apply(args, arguments); - return func.apply(object, args); + return func.apply(object, arrayPush([this.value()], arguments)); }; }(func)); } @@ -45176,12 +45751,12 @@ return jQuery; * var lodash = _.noConflict(); */ function noConflict() { - context._ = oldDash; + root._ = oldDash; return this; } /** - * A no-operation function which returns `undefined` regardless of the + * A no-operation function that returns `undefined` regardless of the * arguments it receives. * * @static @@ -45199,61 +45774,61 @@ return jQuery; } /** - * Creates a function which returns the property value of `key` on a given object. + * Creates a function that returns the property value at `path` on a + * given object. * * @static * @memberOf _ * @category Utility - * @param {string} key The key of the property to get. + * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * - * var users = [ - * { 'user': 'fred' }, - * { 'user': 'barney' } + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } * ]; * - * var getName = _.property('user'); - * - * _.map(users, getName); - * // => ['fred', 'barney'] + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] * - * _.pluck(_.sortBy(users, getName), 'user'); - * // => ['barney', 'fred'] + * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] */ - function property(key) { - return baseProperty(key + ''); + function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); } /** - * The opposite of `_.property`; this method creates a function which returns - * the property value of a given key on `object`. + * The opposite of `_.property`; this method creates a function that returns + * the property value at a given path on `object`. * * @static * @memberOf _ * @category Utility - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Function} Returns the new function. * @example * - * var object = { 'a': 3, 'b': 1, 'c': 2 }; + * var array = [0, 1, 2], + * object = { 'a': array, 'b': array, 'c': array }; * - * _.map(['a', 'c'], _.propertyOf(object)); - * // => [3, 2] + * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); + * // => [2, 0] * - * _.sortBy(['a', 'b', 'c'], _.propertyOf(object)); - * // => ['b', 'c', 'a'] + * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); + * // => [2, 0] */ function propertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; + return function(path) { + return baseGet(object, toPath(path), path + ''); }; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. If `end` is not specified it is - * set to `start` with `start` then set to `0`. If `start` is less than `end` + * set to `start` with `start` then set to `0`. If `end` is less than `start` * a zero-length range is created unless a negative `step` is specified. * * @static @@ -45285,7 +45860,7 @@ return jQuery; */ function range(start, end, step) { if (step && isIterateeCall(start, end, step)) { - end = step = null; + end = step = undefined; } start = +start || 0; step = step == null ? 1 : (+step || 0); @@ -45299,7 +45874,7 @@ return jQuery; // Use `Array(length)` so engines like Chakra and V8 avoid slower modes. // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details. var index = -1, - length = nativeMax(ceil((end - start) / (step || 1)), 0), + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (++index < length) { @@ -45329,7 +45904,7 @@ return jQuery; * _.times(3, function(n) { * mage.castSpell(n); * }); - * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively + * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` * * _.times(3, function(n) { * this.cast(n); @@ -45337,7 +45912,7 @@ return jQuery; * // => also invokes `mage.castSpell(n)` three times */ function times(n, iteratee, thisArg) { - n = +n; + n = nativeFloor(n); // Exit early to avoid a JSC JIT bug in Safari 8 // where `Array(0)` is treated as `Array(1)`. @@ -45396,10 +45971,54 @@ return jQuery; * // => 10 */ function add(augend, addend) { - return augend + addend; + return (+augend || 0) + (+addend || 0); } /** + * Calculates `n` rounded up to `precision`. + * + * @static + * @memberOf _ + * @category Math + * @param {number} n The number to round up. + * @param {number} [precision=0] The precision to round up to. + * @returns {number} Returns the rounded up number. + * @example + * + * _.ceil(4.006); + * // => 5 + * + * _.ceil(6.004, 2); + * // => 6.01 + * + * _.ceil(6040, -2); + * // => 6100 + */ + var ceil = createRound('ceil'); + + /** + * Calculates `n` rounded down to `precision`. + * + * @static + * @memberOf _ + * @category Math + * @param {number} n The number to round down. + * @param {number} [precision=0] The precision to round down to. + * @returns {number} Returns the rounded down number. + * @example + * + * _.floor(4.006); + * // => 4 + * + * _.floor(0.046, 2); + * // => 0.04 + * + * _.floor(4060, -2); + * // => 4000 + */ + var floor = createRound('floor'); + + /** * Gets the maximum value of `collection`. If `collection` is empty or falsey * `-Infinity` is returned. If an iteratee function is provided it is invoked * for each value in `collection` to generate the criterion by which the value @@ -45446,7 +46065,7 @@ return jQuery; * _.max(users, 'age'); * // => { 'user': 'fred', 'age': 40 } */ - var max = createExtremum(arrayMax); + var max = createExtremum(gt, NEGATIVE_INFINITY); /** * Gets the minimum value of `collection`. If `collection` is empty or falsey @@ -45495,7 +46114,29 @@ return jQuery; * _.min(users, 'age'); * // => { 'user': 'barney', 'age': 36 } */ - var min = createExtremum(arrayMin, true); + var min = createExtremum(lt, POSITIVE_INFINITY); + + /** + * Calculates `n` rounded to `precision`. + * + * @static + * @memberOf _ + * @category Math + * @param {number} n The number to round. + * @param {number} [precision=0] The precision to round to. + * @returns {number} Returns the rounded number. + * @example + * + * _.round(4.006); + * // => 4 + * + * _.round(4.006, 2); + * // => 4.01 + * + * _.round(4060, -2); + * // => 4100 + */ + var round = createRound('round'); /** * Gets the sum of the values in `collection`. @@ -45531,17 +46172,11 @@ return jQuery; */ function sum(collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } - var func = getCallback(), - noIteratee = iteratee == null; - - if (!(func === baseCallback && noIteratee)) { - noIteratee = false; - iteratee = func(iteratee, thisArg, 3); - } - return noIteratee - ? arraySum(isArray(collection) ? collection : toIterable(collection)) + iteratee = getCallback(iteratee, thisArg, 3); + return iteratee.length == 1 + ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee) : baseSum(collection, iteratee); } @@ -45588,6 +46223,7 @@ return jQuery; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; + lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; @@ -45617,12 +46253,16 @@ return jQuery; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; + lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; + lodash.method = method; + lodash.methodOf = methodOf; lodash.mixin = mixin; + lodash.modArgs = modArgs; lodash.negate = negate; lodash.omit = omit; lodash.once = once; @@ -45642,6 +46282,7 @@ return jQuery; lodash.remove = remove; lodash.rest = rest; lodash.restParam = restParam; + lodash.set = set; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; @@ -45662,6 +46303,7 @@ return jQuery; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; + lodash.unzipWith = unzipWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.where = where; @@ -45670,6 +46312,7 @@ return jQuery; lodash.xor = xor; lodash.zip = zip; lodash.zipObject = zipObject; + lodash.zipWith = zipWith; // Add aliases. lodash.backflow = flowRight; @@ -45695,6 +46338,7 @@ return jQuery; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; + lodash.ceil = ceil; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.deburr = deburr; @@ -45710,6 +46354,10 @@ return jQuery; lodash.findLastKey = findLastKey; lodash.findWhere = findWhere; lodash.first = first; + lodash.floor = floor; + lodash.get = get; + lodash.gt = gt; + lodash.gte = gte; lodash.has = has; lodash.identity = identity; lodash.includes = includes; @@ -45739,6 +46387,8 @@ return jQuery; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; + lodash.lt = lt; + lodash.lte = lte; lodash.max = max; lodash.min = min; lodash.noConflict = noConflict; @@ -45753,6 +46403,7 @@ return jQuery; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.result = result; + lodash.round = round; lodash.runInContext = runInContext; lodash.size = size; lodash.snakeCase = snakeCase; @@ -45775,6 +46426,7 @@ return jQuery; lodash.all = every; lodash.any = some; lodash.contains = includes; + lodash.eq = isEqual; lodash.detect = find; lodash.foldl = reduce; lodash.foldr = reduceRight; @@ -45822,48 +46474,20 @@ return jQuery; lodash[methodName].placeholder = lodash; }); - // Add `LazyWrapper` methods that accept an `iteratee` value. - arrayEach(['dropWhile', 'filter', 'map', 'takeWhile'], function(methodName, type) { - var isFilter = type != LAZY_MAP_FLAG, - isDropWhile = type == LAZY_DROP_WHILE_FLAG; - - LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { - var filtered = this.__filtered__, - result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(), - iteratees = result.__iteratees__ || (result.__iteratees__ = []); - - iteratees.push({ - 'done': false, - 'count': 0, - 'index': 0, - 'iteratee': getCallback(iteratee, thisArg, 1), - 'limit': -1, - 'type': type - }); - - result.__filtered__ = filtered || isFilter; - return result; - }; - }); - // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { - var whileName = methodName + 'While'; - LazyWrapper.prototype[methodName] = function(n) { - var filtered = this.__filtered__, - result = (filtered && !index) ? this.dropWhile() : this.clone(); + var filtered = this.__filtered__; + if (filtered && !index) { + return new LazyWrapper(this); + } + n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0); - n = n == null ? 1 : nativeMax(floor(n) || 0, 0); + var result = this.clone(); if (filtered) { - if (index) { - result.__takeCount__ = nativeMin(result.__takeCount__, n); - } else { - last(result.__iteratees__).limit = n; - } + result.__takeCount__ = nativeMin(result.__takeCount__, n); } else { - var views = result.__views__ || (result.__views__ = []); - views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); + result.__views__.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; @@ -45871,9 +46495,18 @@ return jQuery; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; + }); + + // Add `LazyWrapper` methods that accept an `iteratee` value. + arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { + var type = index + 1, + isFilter = type != LAZY_MAP_FLAG; - LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) { - return this.reverse()[whileName](predicate, thisArg).reverse(); + LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { + var result = this.clone(); + result.__iteratees__.push({ 'iteratee': getCallback(iteratee, thisArg, 1), 'type': type }); + result.__filtered__ = result.__filtered__ || isFilter; + return result; }; }); @@ -45891,14 +46524,14 @@ return jQuery; var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { - return this[dropName](1); + return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); // Add `LazyWrapper` methods for `_.pluck` and `_.where`. arrayEach(['pluck', 'where'], function(methodName, index) { var operationName = index ? 'filter' : 'map', - createCallback = index ? baseMatches : baseProperty; + createCallback = index ? baseMatches : property; LazyWrapper.prototype[methodName] = function(value) { return this[operationName](createCallback(value)); @@ -45918,31 +46551,42 @@ return jQuery; LazyWrapper.prototype.slice = function(start, end) { start = start == null ? 0 : (+start || 0); - var result = start < 0 ? this.takeRight(-start) : this.drop(start); - if (typeof end != 'undefined') { + var result = this; + if (result.__filtered__ && (start > 0 || end < 0)) { + return new LazyWrapper(result); + } + if (start < 0) { + result = result.takeRight(-start); + } else if (start) { + result = result.drop(start); + } + if (end !== undefined) { end = (+end || 0); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; + LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) { + return this.reverse().takeWhile(predicate, thisArg).reverse(); + }; + LazyWrapper.prototype.toArray = function() { - return this.drop(0); + return this.take(POSITIVE_INFINITY); }; // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { - var lodashFunc = lodash[methodName]; + var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName), + retUnwrapped = /^(?:first|last)$/.test(methodName), + lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName]; + if (!lodashFunc) { return; } - var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName), - retUnwrapped = /^(?:first|last)$/.test(methodName); - lodash.prototype[methodName] = function() { - var args = arguments, - length = args.length, + var args = retUnwrapped ? [1] : arguments, chainAll = this.__chain__, value = this.__wrapped__, isHybrid = !!this.__actions__.length, @@ -45951,28 +46595,30 @@ return jQuery; useLazy = isLazy || isArray(value); if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { - // avoid lazy use if the iteratee has a `length` other than `1` + // Avoid lazy use if the iteratee has a "length" value other than `1`. isLazy = useLazy = false; } - var onlyLazy = isLazy && !isHybrid; - if (retUnwrapped && !chainAll) { - return onlyLazy - ? func.call(value) - : lodashFunc.call(lodash, this.value()); - } var interceptor = function(value) { - var otherArgs = [value]; - push.apply(otherArgs, args); - return lodashFunc.apply(lodash, otherArgs); + return (retUnwrapped && chainAll) + ? lodashFunc(value, 1)[0] + : lodashFunc.apply(undefined, arrayPush([value], args)); }; - if (useLazy) { - var wrapper = onlyLazy ? value : new LazyWrapper(this), - result = func.apply(wrapper, args); - if (!retUnwrapped && (isHybrid || result.__actions__)) { - var actions = result.__actions__ || (result.__actions__ = []); - actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash }); + var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined }, + onlyLazy = isLazy && !isHybrid; + + if (retUnwrapped && !chainAll) { + if (onlyLazy) { + value = value.clone(); + value.__actions__.push(action); + return func.call(value); } + return lodashFunc.call(undefined, this.value())[0]; + } + if (!retUnwrapped && useLazy) { + value = onlyLazy ? value : new LazyWrapper(this); + var result = func.apply(value, args); + result.__actions__.push(action); return new LodashWrapper(result, chainAll); } return this.thru(interceptor); @@ -45980,7 +46626,7 @@ return jQuery; }); // Add `Array` and `String` methods to `lodash.prototype`. - arrayEach(['concat', 'join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) { + arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) { var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName); @@ -46007,7 +46653,7 @@ return jQuery; } }); - realNames[createHybridWrapper(null, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': null }]; + realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; // Add functions to the lazy wrapper. LazyWrapper.prototype.clone = lazyClone; @@ -46017,6 +46663,7 @@ return jQuery; // Add chaining functions to the `lodash` wrapper. lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; + lodash.prototype.concat = wrapperConcat; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toString = wrapperToString; @@ -46056,7 +46703,7 @@ return jQuery; if (moduleExports) { (freeModule.exports = _)._ = _; } - // Export for Narwhal or Rhino -require. + // Export for Rhino with CommonJS support. else { freeExports._ = _; } @@ -46068,40 +46715,46 @@ return jQuery; }.call(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + },{}],"react-router":[function(require,module,exports){ -"use strict"; +'use strict'; -exports.DefaultRoute = require("./components/DefaultRoute"); -exports.Link = require("./components/Link"); -exports.NotFoundRoute = require("./components/NotFoundRoute"); -exports.Redirect = require("./components/Redirect"); -exports.Route = require("./components/Route"); -exports.RouteHandler = require("./components/RouteHandler"); - -exports.HashLocation = require("./locations/HashLocation"); -exports.HistoryLocation = require("./locations/HistoryLocation"); -exports.RefreshLocation = require("./locations/RefreshLocation"); -exports.StaticLocation = require("./locations/StaticLocation"); -exports.TestLocation = require("./locations/TestLocation"); - -exports.ImitateBrowserBehavior = require("./behaviors/ImitateBrowserBehavior"); -exports.ScrollToTopBehavior = require("./behaviors/ScrollToTopBehavior"); - -exports.History = require("./History"); -exports.Navigation = require("./Navigation"); -exports.State = require("./State"); - -exports.createRoute = require("./Route").createRoute; -exports.createDefaultRoute = require("./Route").createDefaultRoute; -exports.createNotFoundRoute = require("./Route").createNotFoundRoute; -exports.createRedirect = require("./Route").createRedirect; -exports.createRoutesFromReactChildren = require("./createRoutesFromReactChildren"); -exports.create = require("./createRouter"); -exports.run = require("./runRouter"); -},{"./History":10,"./Navigation":12,"./Route":16,"./State":18,"./behaviors/ImitateBrowserBehavior":21,"./behaviors/ScrollToTopBehavior":22,"./components/DefaultRoute":24,"./components/Link":25,"./components/NotFoundRoute":26,"./components/Redirect":27,"./components/Route":28,"./components/RouteHandler":29,"./createRouter":30,"./createRoutesFromReactChildren":31,"./locations/HashLocation":34,"./locations/HistoryLocation":35,"./locations/RefreshLocation":36,"./locations/StaticLocation":37,"./locations/TestLocation":38,"./runRouter":39}],"react/addons":[function(require,module,exports){ +exports.DefaultRoute = require('./components/DefaultRoute'); +exports.Link = require('./components/Link'); +exports.NotFoundRoute = require('./components/NotFoundRoute'); +exports.Redirect = require('./components/Redirect'); +exports.Route = require('./components/Route'); +exports.ActiveHandler = require('./components/RouteHandler'); +exports.RouteHandler = exports.ActiveHandler; + +exports.HashLocation = require('./locations/HashLocation'); +exports.HistoryLocation = require('./locations/HistoryLocation'); +exports.RefreshLocation = require('./locations/RefreshLocation'); +exports.StaticLocation = require('./locations/StaticLocation'); +exports.TestLocation = require('./locations/TestLocation'); + +exports.ImitateBrowserBehavior = require('./behaviors/ImitateBrowserBehavior'); +exports.ScrollToTopBehavior = require('./behaviors/ScrollToTopBehavior'); + +exports.History = require('./History'); +exports.Navigation = require('./Navigation'); +exports.State = require('./State'); + +exports.createRoute = require('./Route').createRoute; +exports.createDefaultRoute = require('./Route').createDefaultRoute; +exports.createNotFoundRoute = require('./Route').createNotFoundRoute; +exports.createRedirect = require('./Route').createRedirect; +exports.createRoutesFromReactChildren = require('./createRoutesFromReactChildren'); + +exports.create = require('./createRouter'); +exports.run = require('./runRouter'); +},{"./History":5,"./Navigation":7,"./Route":11,"./State":13,"./behaviors/ImitateBrowserBehavior":16,"./behaviors/ScrollToTopBehavior":17,"./components/DefaultRoute":19,"./components/Link":20,"./components/NotFoundRoute":21,"./components/Redirect":22,"./components/Route":23,"./components/RouteHandler":24,"./createRouter":25,"./createRoutesFromReactChildren":26,"./locations/HashLocation":29,"./locations/HistoryLocation":30,"./locations/RefreshLocation":31,"./locations/StaticLocation":32,"./locations/TestLocation":33,"./runRouter":34}],"react/addons":[function(require,module,exports){ module.exports = require('./lib/ReactWithAddons'); },{"./lib/ReactWithAddons":141}],"react":[function(require,module,exports){ module.exports = require('./lib/React'); -},{"./lib/React":71}]},{},["flux","jquery","lodash","react","react-router","react/addons"]); +},{"./lib/React":71}]},{},[]) + + +//# sourceMappingURL=vendor.js.map |