diff --git a/mitmproxy/web/static/app.css b/mitmproxy/web/static/app.css index 94a6abf0a..1f64abe7a 100644 --- a/mitmproxy/web/static/app.css +++ b/mitmproxy/web/static/app.css @@ -42,7 +42,8 @@ html { } html, body, -#container { +#container, +#mitmproxy { height: 100%; margin: 0; overflow: hidden; diff --git a/mitmproxy/web/static/app.js b/mitmproxy/web/static/app.js index 27f356f7b..400c3c51b 100644 --- a/mitmproxy/web/static/app.js +++ b/mitmproxy/web/static/app.js @@ -82,18 +82,11 @@ EventEmitter.prototype.emit = function(type) { break; // slower default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; + args = Array.prototype.slice.call(arguments, 1); handler.apply(this, args); } } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - + args = Array.prototype.slice.call(arguments, 1); listeners = handler.slice(); len = listeners.length; for (i = 0; i < len; i++) @@ -131,7 +124,6 @@ EventEmitter.prototype.addListener = function(type, listener) { // Check for listener leak if (isObject(this._events[type]) && !this._events[type].warned) { - var m; if (!isUndefined(this._maxListeners)) { m = this._maxListeners; } else { @@ -253,7 +245,7 @@ EventEmitter.prototype.removeAllListeners = function(type) { if (isFunction(listeners)) { this.removeListener(type, listeners); - } else { + } else if (listeners) { // LIFO order while (listeners.length) this.removeListener(type, listeners[listeners.length - 1]); @@ -274,15 +266,20 @@ EventEmitter.prototype.listeners = function(type) { return ret; }; +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; + + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; + EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; + return emitter.listenerCount(type); }; function isFunction(arg) { @@ -442,61 +439,74 @@ 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"); -var Connection = require("./connection"); -var proxyapp = require("./components/proxyapp.js"); -var EventLogActions = require("./actions.js").EventLogActions; +var _react = require("react"); -$(function () { - window.ws = new Connection("/updates"); +var _react2 = _interopRequireDefault(_react); + +var _reactDom = require("react-dom"); + +var _jquery = require("jquery"); + +var _jquery2 = _interopRequireDefault(_jquery); + +var _connection = require("./connection"); + +var _connection2 = _interopRequireDefault(_connection); + +var _proxyapp = require("./components/proxyapp.js"); + +var _actions = require("./actions.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _jquery2.default)(function () { + window.ws = new _connection2.default("/updates"); window.onerror = function (msg) { - EventLogActions.add_event(msg); + _actions.EventLogActions.add_event(msg); }; - ReactRouter.run(proxyapp.routes, function (Handler, state) { - React.render(React.createElement(Handler, null), document.body); - }); + (0, _reactDom.render)(_proxyapp.app, document.getElementById("mitmproxy")); }); - -},{"./actions.js":2,"./components/proxyapp.js":18,"./connection":20,"jquery":"jquery","react":"react","react-router":"react-router"}],4:[function(require,module,exports){ +},{"./actions.js":2,"./components/proxyapp.js":18,"./connection":20,"jquery":"jquery","react":"react","react-dom":"react-dom"}],4:[function(require,module,exports){ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); var React = require("react"); +var ReactDOM = require("react-dom"); 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 = { +var AutoScrollMixin = exports.AutoScrollMixin = { componentWillUpdate: function componentWillUpdate() { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); this._shouldScrollBottom = node.scrollTop !== 0 && node.scrollTop + node.clientHeight === node.scrollHeight; }, componentDidUpdate: function componentDidUpdate() { if (this._shouldScrollBottom) { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); node.scrollTop = node.scrollHeight; } } }; -var StickyHeadMixin = { +var StickyHeadMixin = exports.StickyHeadMixin = { 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(); - head.style.transform = "translate(0," + this.getDOMNode().scrollTop + "px)"; + var head = this.refs.head; + head.style.transform = "translate(0," + ReactDOM.findDOMNode(this).scrollTop + "px)"; } }; -var SettingsState = { +var SettingsState = exports.SettingsState = { contextTypes: { settingsStore: React.PropTypes.object.isRequired }, @@ -518,57 +528,61 @@ var SettingsState = { } }; -var ChildFocus = { +var ChildFocus = exports.ChildFocus = { contextTypes: { returnFocus: React.PropTypes.func }, returnFocus: function returnFocus() { - React.findDOMNode(this).blur(); + ReactDOM.findDOMNode(this).blur(); window.getSelection().removeAllRanges(); this.context.returnFocus(); } }; -var Navigation = _.extend({}, ReactRouter.Navigation, { +var Navigation = exports.Navigation = { + contextTypes: { + routerFoo: React.PropTypes.object, + router: React.PropTypes.object.isRequired + }, setQuery: function setQuery(dict) { - var q = this.context.router.getCurrentQuery(); + var q = this.context.routerFoo.location.query; for (var i in dict) { if (dict.hasOwnProperty(i)) { q[i] = dict[i] || undefined; //falsey values shall be removed. } } - this.replaceWith(this.context.router.getCurrentPath(), this.context.router.getCurrentParams(), q); + this.replaceWith(undefined, q); }, - replaceWith: function replaceWith(routeNameOrPath, params, query) { - if (routeNameOrPath === undefined) { - routeNameOrPath = this.context.router.getCurrentPath(); - } - if (params === undefined) { - params = this.context.router.getCurrentParams(); + replaceWith: function replaceWith(pathname, query) { + if (pathname === undefined) { + pathname = this.context.routerFoo.location.pathname; } if (query === undefined) { - query = this.context.router.getCurrentQuery(); + query = this.context.routerFoo.query; } - - this.context.router.replaceWith(routeNameOrPath, params, query); + console.log({ pathname: pathname, query: query }); + this.context.router.replace({ pathname: pathname, query: query }); } -}); +}; // react-router is fairly good at changing its API regularly. // 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, { +var RouterState = exports.RouterState = { + contextTypes: { + routerFoo: React.PropTypes.object + }, 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()); + return _.clone(this.context.routerFoo.location.query); }, getParams: function getParams() { - return _.clone(this.context.router.getCurrentParams()); + return _.clone(this.context.routerFoo.params); } -}); +}; -var Splitter = React.createClass({ +var Splitter = exports.Splitter = React.createClass({ displayName: "Splitter", getDefaultProps: function getDefaultProps() { @@ -594,7 +608,7 @@ var Splitter = React.createClass({ window.addEventListener("dragend", this.onDragEnd); }, onDragEnd: function onDragEnd() { - this.getDOMNode().style.transform = ""; + ReactDOM.findDOMNode(this).style.transform = ""; window.removeEventListener("dragend", this.onDragEnd); window.removeEventListener("mouseup", this.onMouseUp); window.removeEventListener("mousemove", this.onMouseMove); @@ -602,7 +616,7 @@ var Splitter = React.createClass({ onMouseUp: function onMouseUp(e) { this.onDragEnd(); - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); var prev = node.previousElementSibling; var next = node.nextElementSibling; @@ -631,7 +645,7 @@ var Splitter = React.createClass({ } else { dY = e.pageY - this.state.startY; } - this.getDOMNode().style.transform = "translate(" + dX + "px," + dY + "px)"; + ReactDOM.findDOMNode(this).style.transform = "translate(" + dX + "px," + dY + "px)"; }, onResize: function onResize() { // Trigger a global resize event. This notifies components that employ virtual scrolling @@ -644,7 +658,7 @@ var Splitter = React.createClass({ if (!this.state.applied) { return; } - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); var prev = node.previousElementSibling; var next = node.nextElementSibling; @@ -676,23 +690,13 @@ var Splitter = React.createClass({ } }); -module.exports = { - ChildFocus: ChildFocus, - RouterState: RouterState, - Navigation: Navigation, - StickyHeadMixin: StickyHeadMixin, - AutoScrollMixin: AutoScrollMixin, - Splitter: Splitter, - SettingsState: SettingsState -}; - - -},{"lodash":"lodash","react":"react","react-router":"react-router"}],5:[function(require,module,exports){ +},{"lodash":"lodash","react":"react","react-dom":"react-dom","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 ReactDOM = require('react-dom'); var common = require("./common.js"); var utils = require("../utils.js"); @@ -740,8 +744,8 @@ var EditorBase = React.createClass({ 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, + contentEditable: this.state.editable || undefined // workaround: use undef instead of false to remove attr + , onFocus: this.onFocus, onMouseDown: this.onMouseDown, onClick: this.onClick, onBlur: this._stop, @@ -793,12 +797,12 @@ var EditorBase = React.createClass({ range = document.caretRangeFromPoint(e.clientX, e.clientY); } else { range = document.createRange(); - range.selectNodeContents(React.findDOMNode(this)); + range.selectNodeContents(ReactDOM.findDOMNode(this)); } this._ignore_events = true; this.setState({ editable: true }, function () { - var node = React.findDOMNode(this); + var node = ReactDOM.findDOMNode(this); node.blur(); node.focus(); this._ignore_events = false; @@ -810,7 +814,7 @@ var EditorBase = React.createClass({ // 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(); + ReactDOM.findDOMNode(this).blur(); this.props.onStop && this.props.onStop(); }, _stop: function _stop(e) { @@ -819,14 +823,14 @@ var EditorBase = React.createClass({ } console.log("_stop", _.extend({}, e)); window.getSelection().removeAllRanges(); //make sure that selection is cleared on blur - var node = React.findDOMNode(this); + var node = ReactDOM.findDOMNode(this); var content = this.props.nodeToContent(node); this.setState({ editable: false }); this.props.onDone(content); this.props.onBlur && this.props.onBlur(e); }, reset: function reset() { - React.findDOMNode(this).innerHTML = this.props.contentToHtml(this.props.content); + ReactDOM.findDOMNode(this).innerHTML = this.props.contentToHtml(this.props.content); }, onKeyDown: function onKeyDown(e) { e.stopPropagation(); @@ -847,7 +851,7 @@ var EditorBase = React.createClass({ } }, onInput: function onInput() { - var node = React.findDOMNode(this); + var node = ReactDOM.findDOMNode(this); var content = this.props.nodeToContent(node); this.props.onInput && this.props.onInput(content); } @@ -923,7 +927,7 @@ var ValueEditor = React.createClass({ })); }, focus: function focus() { - React.findDOMNode(this).focus(); + ReactDOM.findDOMNode(this).focus(); }, onStop: function onStop() { this.returnFocus(); @@ -934,14 +938,15 @@ module.exports = { ValueEditor: ValueEditor }; - -},{"../utils.js":26,"./common.js":4,"react":"react"}],6:[function(require,module,exports){ +},{"../utils.js":26,"./common.js":4,"react":"react","react-dom":"react-dom"}],6:[function(require,module,exports){ "use strict"; +var _virtualscroll = require("./virtualscroll.js"); + var React = require("react"); var common = require("./common.js"); var Query = require("../actions.js").Query; -var VirtualScrollMixin = require("./virtualscroll.js"); + var views = require("../store/view.js"); var _ = require("lodash"); @@ -980,7 +985,7 @@ var EventLogContents = React.createClass({ contextTypes: { eventStore: React.PropTypes.object.isRequired }, - mixins: [common.AutoScrollMixin, VirtualScrollMixin], + mixins: [common.AutoScrollMixin, _virtualscroll.VirtualScrollMixin], getInitialState: function getInitialState() { var filterFn = function filterFn(entry) { return this.props.filter[entry.level]; @@ -1104,7 +1109,6 @@ var EventLog = React.createClass({ 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"; @@ -1365,16 +1369,17 @@ var all_columns = [TLSColumn, IconColumn, PathColumn, MethodColumn, StatusColumn module.exports = all_columns; - },{"../flow/utils.js":23,"../utils.js":26,"react":"react"}],8:[function(require,module,exports){ "use strict"; +var _virtualscroll = require("./virtualscroll.js"); + var React = require("react"); +var ReactDOM = require('react-dom'); var common = require("./common.js"); var utils = require("../utils.js"); var _ = require("lodash"); -var VirtualScrollMixin = require("./virtualscroll.js"); var flowtable_columns = require("./flowtable-columns.js"); var FlowRow = React.createClass({ @@ -1382,9 +1387,9 @@ var FlowRow = React.createClass({ render: function render() { var flow = this.props.flow; - var columns = this.props.columns.map((function (Column) { + var columns = this.props.columns.map(function (Column) { return React.createElement(Column, { key: Column.displayName, flow: flow }); - }).bind(this)); + }.bind(this)); var className = ""; if (this.props.selected) { className += " selected"; @@ -1458,7 +1463,7 @@ var FlowTableHead = React.createClass({ this.props.setSortKeyFun(sortKeyFun); }, render: function render() { - var columns = this.props.columns.map((function (Column) { + var columns = this.props.columns.map(function (Column) { var onClick = this.onClick.bind(this, Column); var className; if (this.state.sortColumn === Column) { @@ -1472,7 +1477,7 @@ var FlowTableHead = React.createClass({ key: Column.displayName, onClick: onClick, className: className }); - }).bind(this)); + }.bind(this)); return React.createElement( "thead", null, @@ -1490,7 +1495,7 @@ var ROW_HEIGHT = 32; var FlowTable = React.createClass({ displayName: "FlowTable", - mixins: [common.StickyHeadMixin, common.AutoScrollMixin, VirtualScrollMixin], + mixins: [common.StickyHeadMixin, common.AutoScrollMixin, _virtualscroll.VirtualScrollMixin], contextTypes: { view: React.PropTypes.object.isRequired }, @@ -1524,7 +1529,7 @@ var FlowTable = React.createClass({ this.forceUpdate(); }, scrollIntoView: function scrollIntoView(flow) { - this.scrollRowIntoView(this.context.view.index(flow), this.refs.body.getDOMNode().offsetTop); + this.scrollRowIntoView(this.context.view.index(flow), ReactDOM.findDOMNode(this.refs.body).offsetTop); }, renderRow: function renderRow(flow) { var selected = flow === this.props.selected; @@ -1566,8 +1571,7 @@ var FlowTable = React.createClass({ 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){ +},{"../utils.js":26,"./common.js":4,"./flowtable-columns.js":7,"./virtualscroll.js":19,"lodash":"lodash","react":"react","react-dom":"react-dom"}],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; }; @@ -1613,16 +1617,16 @@ var RawMixin = { content: undefined, request: request }); - request.done((function (data) { + request.done(function (data) { this.setState({ content: data }); - }).bind(this)).fail((function (jqXHR, textStatus, errorThrown) { + }.bind(this)).fail(function (jqXHR, textStatus, errorThrown) { if (textStatus === "abort") { return; } this.setState({ content: "AJAX Error: " + textStatus + "\r\n" + errorThrown }); - }).bind(this)).always((function () { + }.bind(this)).always(function () { this.setState({ request: undefined }); - }).bind(this)); + }.bind(this)); }, componentWillMount: function componentWillMount() { this.requestContent(this.props); @@ -1865,7 +1869,6 @@ var ContentView = React.createClass({ module.exports = ContentView; - },{"../../flow/utils.js":23,"../../utils.js":26,"lodash":"lodash","react":"react"}],10:[function(require,module,exports){ "use strict"; @@ -1920,6 +1923,7 @@ var TimeStamp = React.createClass({ var ConnectionInfo = React.createClass({ displayName: "ConnectionInfo", + render: function render() { var conn = this.props.conn; var address = conn.address.address.join(":"); @@ -2122,7 +2126,6 @@ var Details = React.createClass({ module.exports = Details; - },{"../../utils.js":26,"lodash":"lodash","react":"react"}],11:[function(require,module,exports){ "use strict"; @@ -2169,10 +2172,7 @@ var FlowView = React.createClass({ this.selectTab(tabs[nextIndex]); }, selectTab: function selectTab(panel) { - this.replaceWith("flow", { - flowId: this.getParams().flowId, - detailTab: panel - }); + this.replaceWith("/flows/" + this.getParams().flowId + "/" + panel); }, getActive: function getActive() { return this.getParams().detailTab; @@ -2196,12 +2196,12 @@ var FlowView = React.createClass({ this.setState({ prompt: { - done: (function (k) { + done: function (k) { this.setState({ prompt: false }); if (k) { this.refs.tab.edit(k); } - }).bind(this), + }.bind(this), options: options } }); @@ -2211,7 +2211,7 @@ var FlowView = React.createClass({ var tabs = this.getTabs(flow); var active = this.getActive(); - if (!_.contains(tabs, active)) { + if (tabs.indexOf(active) < 0) { if (active === "response" && flow.error) { active = "error"; } else if (active === "error" && flow.response) { @@ -2244,13 +2244,13 @@ var FlowView = React.createClass({ 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 ReactDOM = require('react-dom'); var _ = require("lodash"); var common = require("../common.js"); @@ -2316,7 +2316,7 @@ var Headers = React.createClass({ }, 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", @@ -2345,7 +2345,7 @@ var Headers = React.createClass({ vEdit ) ); - }).bind(this)); + }.bind(this)); return React.createElement( "table", { className: "header-table" }, @@ -2365,7 +2365,7 @@ var HeaderEditor = React.createClass({ return React.createElement(ValueEditor, _extends({ ref: "input" }, this.props, { onKeyDown: this.onKeyDown, inline: true })); }, focus: function focus() { - this.getDOMNode().focus(); + ReactDOM.findDOMNode(this).focus(); }, onKeyDown: function onKeyDown(e) { switch (e.keyCode) { @@ -2594,10 +2594,8 @@ module.exports = { Response: Response, Error: Error }; -/**/ /**/ - -},{"../../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){ +},{"../../actions.js":2,"../../flow/utils.js":23,"../../utils.js":26,"../common.js":4,"../editor.js":5,"./contentview.js":9,"lodash":"lodash","react":"react","react-dom":"react-dom"}],13:[function(require,module,exports){ "use strict"; var React = require("react"); @@ -2629,13 +2627,13 @@ var Nav = React.createClass({ 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); + }.bind(this); return React.createElement( "a", { key: e, @@ -2644,7 +2642,7 @@ var Nav = React.createClass({ onClick: onClick }, str ); - }).bind(this)); + }.bind(this)); var acceptButton = null; if (flow.intercepted) { @@ -2659,7 +2657,7 @@ var Nav = React.createClass({ "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]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, @@ -2670,7 +2668,6 @@ var Nav = React.createClass({ module.exports = Nav; - },{"../../actions.js":2,"react":"react"}],14:[function(require,module,exports){ "use strict"; @@ -2706,11 +2703,11 @@ var Footer = React.createClass({ module.exports = Footer; - },{"./common.js":4,"react":"react"}],15:[function(require,module,exports){ "use strict"; var React = require("react"); +var ReactDOM = require('react-dom'); var $ = require("jquery"); var Filt = require("../filt/filt.js"); @@ -2734,9 +2731,9 @@ var FilterDocs = React.createClass({ }); } if (FilterDocs.xhr) { - FilterDocs.xhr.done((function () { + FilterDocs.xhr.done(function () { this.forceUpdate(); - }).bind(this)); + }.bind(this)); } }, render: function render() { @@ -2815,24 +2812,24 @@ var FilterInput = React.createClass({ }, isValid: function isValid(filt) { try { - Filt.parse(filt || this.state.value); + var str = filt || this.state.value; + if (str) { + Filt.parse(filt || this.state.value); + } return true; } catch (e) { return false; } }, getDesc: function getDesc() { - var desc; - try { - desc = Filt.parse(this.state.value).desc; - } catch (e) { - desc = "" + e; - } - if (desc !== "true") { - return desc; - } else { - return React.createElement(FilterDocs, null); + if (this.state.value) { + try { + return Filt.parse(this.state.value).desc; + } catch (e) { + return "" + e; + } } + return React.createElement(FilterDocs, null); }, onFocus: function onFocus() { this.setState({ focus: true }); @@ -2855,11 +2852,11 @@ var FilterInput = React.createClass({ e.stopPropagation(); }, blur: function blur() { - this.refs.input.getDOMNode().blur(); + ReactDOM.findDOMNode(this.refs.input).blur(); this.returnFocus(); }, select: function select() { - this.refs.input.getDOMNode().select(); + ReactDOM.findDOMNode(this.refs.input).select(); }, render: function render() { var isValid = this.isValid(); @@ -3027,10 +3024,10 @@ var FileMenu = React.createClass({ handleFileClick: function handleFileClick(e) { e.preventDefault(); if (!this.state.showFileMenu) { - var close = (function () { + var close = function () { this.setState({ showFileMenu: false }); document.removeEventListener("click", close); - }).bind(this); + }.bind(this); document.addEventListener("click", close); this.setState({ @@ -3113,7 +3110,7 @@ var Header = React.createClass({ this.setState({ active: active }); }, render: function render() { - var header = header_entries.map((function (entry, i) { + var header = header_entries.map(function (entry, i) { var className; if (entry === this.state.active) { className = "active"; @@ -3128,7 +3125,7 @@ var Header = React.createClass({ onClick: this.handleClick.bind(this, entry) }, entry.title ); - }).bind(this)); + }.bind(this)); return React.createElement( "header", @@ -3152,30 +3149,8 @@ module.exports = { Header: Header, MainMenu: MainMenu }; -/* -
  • - - -Open - -
  • -
  • - - -Save - -
  • -
  • -
  • - - -Shutdown - -
  • -*/ - -},{"../actions.js":2,"../filt/filt.js":22,"../utils.js":26,"./common.js":4,"jquery":"jquery","react":"react"}],16:[function(require,module,exports){ +},{"../actions.js":2,"../filt/filt.js":22,"../utils.js":26,"./common.js":4,"jquery":"jquery","react":"react","react-dom":"react-dom"}],16:[function(require,module,exports){ "use strict"; var React = require("react"); @@ -3224,7 +3199,10 @@ var MainView = React.createClass({ }, getViewFilt: function getViewFilt() { try { - var filt = Filt.parse(this.getQuery()[Query.SEARCH] || ""); + var filtStr = this.getQuery()[Query.SEARCH]; + var filt = filtStr ? Filt.parse(filtStr) : function () { + return true; + }; var highlightStr = this.getQuery()[Query.HIGHLIGHT]; var highlight = highlightStr ? Filt.parse(highlightStr) : false; } catch (e) { @@ -3272,13 +3250,11 @@ var MainView = React.createClass({ }, selectFlow: function selectFlow(flow) { if (flow) { - this.replaceWith("flow", { - flowId: flow.id, - detailTab: this.getParams().detailTab || "request" - }); + var tab = this.getParams().detailTab || "request"; + this.replaceWith("/flows/" + flow.id + "/" + tab); this.refs.flowTable.scrollIntoView(flow); } else { - this.replaceWith("flows", {}); + this.replaceWith("/flows"); } }, selectFlowRelative: function selectFlowRelative(shift) { @@ -3356,7 +3332,7 @@ var MainView = React.createClass({ if (e.shiftKey) { actions.FlowActions.duplicate(flow); } else { - actions.FlowActions["delete"](flow); + actions.FlowActions.delete(flow); } } break; @@ -3417,11 +3393,11 @@ var MainView = React.createClass({ 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 ReactDOM = require('react-dom'); var _ = require("lodash"); var utils = require("../utils.js"); @@ -3437,7 +3413,7 @@ var Prompt = React.createClass({ prompt: React.PropTypes.string }, componentDidMount: function componentDidMount() { - React.findDOMNode(this).focus(); + ReactDOM.findDOMNode(this).focus(); }, onKeyDown: function onKeyDown(e) { e.stopPropagation(); @@ -3490,7 +3466,7 @@ var Prompt = React.createClass({ }, 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) { @@ -3500,10 +3476,10 @@ var Prompt = React.createClass({ prefix = o.text + " ("; suffix = ")"; } - var onClick = (function (e) { + var onClick = function (e) { this.done(o.key); e.stopPropagation(); - }).bind(this); + }.bind(this); return React.createElement( "span", { @@ -3518,7 +3494,7 @@ var Prompt = React.createClass({ ), suffix ); - }).bind(this)); + }.bind(this)); return React.createElement( "div", { tabIndex: "0", onKeyDown: this.onKeyDown, onClick: this.onClick, className: "prompt-dialog" }, @@ -3538,11 +3514,18 @@ var Prompt = React.createClass({ module.exports = Prompt; - -},{"../utils.js":26,"./common.js":4,"lodash":"lodash","react":"react"}],18:[function(require,module,exports){ +},{"../utils.js":26,"./common.js":4,"lodash":"lodash","react":"react","react-dom":"react-dom"}],18:[function(require,module,exports){ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.app = undefined; + +var _reactRouter = require("react-router"); + var React = require("react"); +var ReactDOM = require("react-dom"); var ReactRouter = require("react-router"); var _ = require("lodash"); @@ -3576,7 +3559,8 @@ var ProxyAppMain = React.createClass({ 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, + routerFoo: React.PropTypes.object }, componentDidMount: function componentDidMount() { this.focus(); @@ -3586,7 +3570,11 @@ var ProxyAppMain = React.createClass({ settingsStore: this.state.settingsStore, flowStore: this.state.flowStore, eventStore: this.state.eventStore, - returnFocus: this.focus + returnFocus: this.focus, + routerFoo: { + location: this.props.location, + params: this.props.params + } }; }, getInitialState: function getInitialState() { @@ -3603,19 +3591,19 @@ var ProxyAppMain = React.createClass({ }; }, focus: function focus() { - React.findDOMNode(this).focus(); + ReactDOM.findDOMNode(this).focus(); }, getMainComponent: function getMainComponent() { - return this.refs.view.refs.__routeHandler__; + return this.refs.view; }, onKeydown: function onKeydown(e) { - var selectFilterInput = (function (name) { + var selectFilterInput = function (name) { var headerComponent = this.refs.header; headerComponent.setState({ active: header.MainMenu }, function () { headerComponent.refs.active.refs[name].select(); }); - }).bind(this); + }.bind(this); switch (e.keyCode) { case Key.I: @@ -3638,48 +3626,55 @@ var ProxyAppMain = React.createClass({ }, render: function render() { var eventlog; - if (this.getQuery()[Query.SHOW_EVENTLOG]) { + if (this.props.location.query[Query.SHOW_EVENTLOG]) { eventlog = [React.createElement(common.Splitter, { key: "splitter", axis: "y" }), React.createElement(EventLog, { key: "eventlog" })]; } else { eventlog = null; } + var children = React.cloneElement(this.props.children, { ref: "view", query: this.props.location.query }); 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() }), + children, 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 app = exports.app = React.createElement( + _reactRouter.Router, + { history: _reactRouter.hashHistory }, + React.createElement(_reactRouter.Redirect, { from: "/", to: "/flows" }), + React.createElement( + _reactRouter.Route, + { path: "/", component: ProxyAppMain }, + React.createElement(_reactRouter.Route, { path: "flows", component: MainView }), + React.createElement(_reactRouter.Route, { path: "flows/:flowId/:detailTab", component: MainView }), + React.createElement(_reactRouter.Route, { path: "reports", component: Reports }) + ) ); -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){ +},{"../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-dom":"react-dom","react-router":"react-router"}],19:[function(require,module,exports){ "use strict"; -var React = require("react"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.VirtualScrollMixin = undefined; -var VirtualScrollMixin = { +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _reactDom = require("react-dom"); + +var _reactDom2 = _interopRequireDefault(_reactDom); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var VirtualScrollMixin = exports.VirtualScrollMixin = { getInitialState: function getInitialState() { return { start: 0, @@ -3698,11 +3693,11 @@ var VirtualScrollMixin = { var style = { height: Math.min(this.state.start, total) * this.props.rowHeight }; - var spacer = React.createElement(Tag, { key: "placeholder-top", style: style }); + var spacer = _react2.default.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, _react2.default.createElement(Tag, { key: "placeholder-top-2" })]; } else { return spacer; } @@ -3712,7 +3707,7 @@ var VirtualScrollMixin = { var style = { height: Math.max(0, total - this.state.stop) * this.props.rowHeight }; - return React.createElement(Tag, { key: "placeholder-bottom", style: style }); + return _react2.default.createElement(Tag, { key: "placeholder-bottom", style: style }); }, componentDidMount: function componentDidMount() { this.onScroll(); @@ -3722,7 +3717,7 @@ var VirtualScrollMixin = { window.removeEventListener('resize', this.onScroll); }, onScroll: function onScroll() { - var viewport = this.getDOMNode(); + var viewport = _reactDom2.default.findDOMNode(this); var top = viewport.scrollTop; var height = viewport.offsetHeight; var start = Math.floor(top / this.props.rowHeight); @@ -3748,7 +3743,7 @@ var VirtualScrollMixin = { var row_top = index * this.props.rowHeight + head_height; var row_bottom = row_top + this.props.rowHeight; - var viewport = this.getDOMNode(); + var viewport = _reactDom2.default.findDOMNode(this); var viewport_top = viewport.scrollTop; var viewport_bottom = viewport_top + viewport.offsetHeight; @@ -3761,10 +3756,7 @@ var VirtualScrollMixin = { } }; -module.exports = VirtualScrollMixin; - - -},{"react":"react"}],20:[function(require,module,exports){ +},{"react":"react","react-dom":"react-dom"}],20:[function(require,module,exports){ "use strict"; var actions = require("./actions.js"); @@ -3796,7 +3788,6 @@ function Connection(url) { module.exports = Connection; - },{"./actions.js":2,"./dispatcher.js":21}],21:[function(require,module,exports){ "use strict"; @@ -3821,15 +3812,16 @@ module.exports = { AppDispatcher: AppDispatcher }; - },{"flux":"flux"}],22:[function(require,module,exports){ "use strict"; -module.exports = (function () { +module.exports = function () { + "use strict"; + /* - * Generated by PEG.js 0.8.0. + * Generated by PEG.js 0.9.0. * - * http://pegjs.majda.cz/ + * http://pegjs.org/ */ function peg$subclass(child, parent) { @@ -3840,191 +3832,185 @@ module.exports = (function () { child.prototype = new ctor(); } - function SyntaxError(message, expected, found, offset, line, column) { + function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; - this.offset = offset; - this.line = line; - this.column = column; - + this.location = location; this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } } - peg$subclass(SyntaxError, Error); + peg$subclass(peg$SyntaxError, Error); - function parse(input) { + function peg$parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, + parser = this, peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c0 = { type: "other", description: "filter expression" }, - peg$c1 = peg$FAILED, - peg$c2 = function peg$c2(orExpr) { + peg$c1 = function peg$c1(orExpr) { return orExpr; }, - peg$c3 = [], - 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]" }, - peg$c8 = { type: "other", description: "control character" }, - peg$c9 = /^[|&!()~"]/, - peg$c10 = { type: "class", value: "[|&!()~\"]", description: "[|&!()~\"]" }, - peg$c11 = { type: "other", description: "optional whitespace" }, - peg$c12 = "|", - peg$c13 = { type: "literal", value: "|", description: "\"|\"" }, - peg$c14 = function peg$c14(first, second) { + peg$c2 = { type: "other", description: "whitespace" }, + peg$c3 = /^[ \t\n\r]/, + peg$c4 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, + peg$c5 = { type: "other", description: "control character" }, + peg$c6 = /^[|&!()~"]/, + peg$c7 = { type: "class", value: "[|&!()~\"]", description: "[|&!()~\"]" }, + peg$c8 = { type: "other", description: "optional whitespace" }, + peg$c9 = "|", + peg$c10 = { type: "literal", value: "|", description: "\"|\"" }, + peg$c11 = function peg$c11(first, second) { return or(first, second); }, - peg$c15 = "&", - peg$c16 = { type: "literal", value: "&", description: "\"&\"" }, - peg$c17 = function peg$c17(first, second) { + peg$c12 = "&", + peg$c13 = { type: "literal", value: "&", description: "\"&\"" }, + peg$c14 = function peg$c14(first, second) { return and(first, second); }, - peg$c18 = "!", - peg$c19 = { type: "literal", value: "!", description: "\"!\"" }, - peg$c20 = function peg$c20(expr) { + peg$c15 = "!", + peg$c16 = { type: "literal", value: "!", description: "\"!\"" }, + peg$c17 = function peg$c17(expr) { return not(expr); }, - peg$c21 = "(", - peg$c22 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c23 = ")", - peg$c24 = { type: "literal", value: ")", description: "\")\"" }, - peg$c25 = function peg$c25(expr) { + peg$c18 = "(", + peg$c19 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c20 = ")", + peg$c21 = { type: "literal", value: ")", description: "\")\"" }, + peg$c22 = function peg$c22(expr) { return binding(expr); }, - peg$c26 = "~a", - peg$c27 = { type: "literal", value: "~a", description: "\"~a\"" }, - peg$c28 = function peg$c28() { + peg$c23 = "~a", + peg$c24 = { type: "literal", value: "~a", description: "\"~a\"" }, + peg$c25 = function peg$c25() { return assetFilter; }, - peg$c29 = "~e", - peg$c30 = { type: "literal", value: "~e", description: "\"~e\"" }, - peg$c31 = function peg$c31() { + peg$c26 = "~e", + peg$c27 = { type: "literal", value: "~e", description: "\"~e\"" }, + peg$c28 = function peg$c28() { return errorFilter; }, - peg$c32 = "~q", - peg$c33 = { type: "literal", value: "~q", description: "\"~q\"" }, - peg$c34 = function peg$c34() { + peg$c29 = "~q", + peg$c30 = { type: "literal", value: "~q", description: "\"~q\"" }, + peg$c31 = function peg$c31() { return noResponseFilter; }, - peg$c35 = "~s", - peg$c36 = { type: "literal", value: "~s", description: "\"~s\"" }, - peg$c37 = function peg$c37() { + peg$c32 = "~s", + peg$c33 = { type: "literal", value: "~s", description: "\"~s\"" }, + peg$c34 = function peg$c34() { return responseFilter; }, - peg$c38 = "true", - peg$c39 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c40 = function peg$c40() { + peg$c35 = "true", + peg$c36 = { type: "literal", value: "true", description: "\"true\"" }, + peg$c37 = function peg$c37() { return trueFilter; }, - peg$c41 = "false", - peg$c42 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c43 = function peg$c43() { + peg$c38 = "false", + peg$c39 = { type: "literal", value: "false", description: "\"false\"" }, + peg$c40 = function peg$c40() { return falseFilter; }, - peg$c44 = "~c", - peg$c45 = { type: "literal", value: "~c", description: "\"~c\"" }, - peg$c46 = function peg$c46(s) { + peg$c41 = "~c", + peg$c42 = { type: "literal", value: "~c", description: "\"~c\"" }, + peg$c43 = function peg$c43(s) { return responseCode(s); }, - peg$c47 = "~d", - peg$c48 = { type: "literal", value: "~d", description: "\"~d\"" }, - peg$c49 = function peg$c49(s) { + peg$c44 = "~d", + peg$c45 = { type: "literal", value: "~d", description: "\"~d\"" }, + peg$c46 = function peg$c46(s) { return domain(s); }, - peg$c50 = "~h", - peg$c51 = { type: "literal", value: "~h", description: "\"~h\"" }, - peg$c52 = function peg$c52(s) { + peg$c47 = "~h", + peg$c48 = { type: "literal", value: "~h", description: "\"~h\"" }, + peg$c49 = function peg$c49(s) { return header(s); }, - peg$c53 = "~hq", - peg$c54 = { type: "literal", value: "~hq", description: "\"~hq\"" }, - peg$c55 = function peg$c55(s) { + peg$c50 = "~hq", + peg$c51 = { type: "literal", value: "~hq", description: "\"~hq\"" }, + peg$c52 = function peg$c52(s) { return requestHeader(s); }, - peg$c56 = "~hs", - peg$c57 = { type: "literal", value: "~hs", description: "\"~hs\"" }, - peg$c58 = function peg$c58(s) { + peg$c53 = "~hs", + peg$c54 = { type: "literal", value: "~hs", description: "\"~hs\"" }, + peg$c55 = function peg$c55(s) { return responseHeader(s); }, - peg$c59 = "~m", - peg$c60 = { type: "literal", value: "~m", description: "\"~m\"" }, - peg$c61 = function peg$c61(s) { + peg$c56 = "~m", + peg$c57 = { type: "literal", value: "~m", description: "\"~m\"" }, + peg$c58 = function peg$c58(s) { return method(s); }, - peg$c62 = "~t", - peg$c63 = { type: "literal", value: "~t", description: "\"~t\"" }, - peg$c64 = function peg$c64(s) { + peg$c59 = "~t", + peg$c60 = { type: "literal", value: "~t", description: "\"~t\"" }, + peg$c61 = function peg$c61(s) { return contentType(s); }, - peg$c65 = "~tq", - peg$c66 = { type: "literal", value: "~tq", description: "\"~tq\"" }, - peg$c67 = function peg$c67(s) { + peg$c62 = "~tq", + peg$c63 = { type: "literal", value: "~tq", description: "\"~tq\"" }, + peg$c64 = function peg$c64(s) { return requestContentType(s); }, - peg$c68 = "~ts", - peg$c69 = { type: "literal", value: "~ts", description: "\"~ts\"" }, - peg$c70 = function peg$c70(s) { + peg$c65 = "~ts", + peg$c66 = { type: "literal", value: "~ts", description: "\"~ts\"" }, + peg$c67 = function peg$c67(s) { return responseContentType(s); }, - peg$c71 = "~u", - peg$c72 = { type: "literal", value: "~u", description: "\"~u\"" }, - peg$c73 = function peg$c73(s) { + peg$c68 = "~u", + peg$c69 = { type: "literal", value: "~u", description: "\"~u\"" }, + peg$c70 = function peg$c70(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 peg$c80(digits) { + peg$c71 = { type: "other", description: "integer" }, + peg$c72 = /^['"]/, + peg$c73 = { type: "class", value: "['\"]", description: "['\"]" }, + peg$c74 = /^[0-9]/, + peg$c75 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c76 = function peg$c76(digits) { return parseInt(digits.join(""), 10); }, - peg$c81 = { type: "other", description: "string" }, - peg$c82 = "\"", - peg$c83 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c84 = function peg$c84(chars) { + peg$c77 = { type: "other", description: "string" }, + peg$c78 = "\"", + peg$c79 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c80 = function peg$c80(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 peg$c91(char) { + peg$c81 = "'", + peg$c82 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c83 = /^["\\]/, + peg$c84 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, + peg$c85 = { type: "any", description: "any character" }, + peg$c86 = function peg$c86(char) { return char; }, - peg$c92 = "\\", - peg$c93 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c94 = /^['\\]/, - peg$c95 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, - peg$c96 = /^['"\\]/, - peg$c97 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, - peg$c98 = "n", - peg$c99 = { type: "literal", value: "n", description: "\"n\"" }, - peg$c100 = function peg$c100() { + peg$c87 = "\\", + peg$c88 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c89 = /^['\\]/, + peg$c90 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, + peg$c91 = /^['"\\]/, + peg$c92 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, + peg$c93 = "n", + peg$c94 = { type: "literal", value: "n", description: "\"n\"" }, + peg$c95 = function peg$c95() { return "\n"; }, - peg$c101 = "r", - peg$c102 = { type: "literal", value: "r", description: "\"r\"" }, - peg$c103 = function peg$c103() { + peg$c96 = "r", + peg$c97 = { type: "literal", value: "r", description: "\"r\"" }, + peg$c98 = function peg$c98() { return "\r"; }, - peg$c104 = "t", - peg$c105 = { type: "literal", value: "t", description: "\"t\"" }, - peg$c106 = function peg$c106() { + peg$c99 = "t", + peg$c100 = { type: "literal", value: "t", description: "\"t\"" }, + peg$c101 = function peg$c101() { return "\t"; }, peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, @@ -4039,34 +4025,42 @@ module.exports = (function () { } function text() { - return input.substring(peg$reportedPos, peg$currPos); + return input.substring(peg$savedPos, peg$currPos); } - function offset() { - return peg$reportedPos; - } - - function line() { - return peg$computePosDetails(peg$reportedPos).line; - } - - function column() { - return peg$computePosDetails(peg$reportedPos).column; + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description) { - throw peg$buildException(null, [{ type: "other", description: description }], peg$reportedPos); + throw peg$buildException(null, [{ type: "other", description: description }], input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos)); } function error(message) { - throw peg$buildException(message, null, peg$reportedPos); + throw peg$buildException(message, null, input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos)); } function peg$computePosDetails(pos) { - function advance(details, startPos, endPos) { - var p, ch; + var details = peg$posDetailsCache[pos], + p, + ch; - for (p = startPos; p < endPos; p++) { + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column, + seenCR: details.seenCR + }; + + while (p < pos) { ch = input.charAt(p); if (ch === "\n") { if (!details.seenCR) { @@ -4082,19 +4076,31 @@ module.exports = (function () { details.column++; details.seenCR = false; } - } - } - if (peg$cachedPos !== pos) { - if (peg$cachedPos > pos) { - peg$cachedPos = 0; - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; + p++; } - advance(peg$cachedPosDetails, peg$cachedPos, pos); - peg$cachedPos = pos; - } - return peg$cachedPosDetails; + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; } function peg$fail(expected) { @@ -4110,7 +4116,7 @@ module.exports = (function () { peg$maxFailExpected.push(expected); } - function peg$buildException(message, expected, pos) { + function peg$buildException(message, expected, found, location) { function cleanupExpected(expected) { var i = 1; @@ -4143,9 +4149,9 @@ module.exports = (function () { return '\\x0' + hex(ch); }).replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { return '\\x' + hex(ch); - }).replace(/[\u0180-\u0FFF]/g, function (ch) { + }).replace(/[\u0100-\u0FFF]/g, function (ch) { return "\\u0" + hex(ch); - }).replace(/[\u1080-\uFFFF]/g, function (ch) { + }).replace(/[\u1000-\uFFFF]/g, function (ch) { return "\\u" + hex(ch); }); } @@ -4166,14 +4172,11 @@ module.exports = (function () { return "Expected " + expectedDesc + " but " + foundDesc + " found."; } - var posDetails = peg$computePosDetails(pos), - 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 peg$SyntaxError(message !== null ? message : buildMessage(expected, found), expected, found, location); } function peg$parsestart() { @@ -4187,29 +4190,20 @@ module.exports = (function () { if (s2 !== peg$FAILED) { s3 = peg$parse__(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c2(s2); + peg$savedPos = s0; + s1 = peg$c1(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c4(); - } - s0 = s1; + s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { @@ -4225,6 +4219,30 @@ module.exports = (function () { function peg$parsews() { var s0, s1; + peg$silentFails++; + if (peg$c3.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c4); + } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c2); + } + } + + return s0; + } + + function peg$parsecc() { + var s0, s1; + peg$silentFails++; if (peg$c6.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); @@ -4246,30 +4264,6 @@ module.exports = (function () { return s0; } - function peg$parsecc() { - var s0, s1; - - peg$silentFails++; - if (peg$c9.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - 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); - } - } - - return s0; - } - function peg$parse__() { var s0, s1; @@ -4284,7 +4278,7 @@ module.exports = (function () { if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c11); + peg$fail(peg$c8); } } @@ -4300,12 +4294,12 @@ module.exports = (function () { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 124) { - s3 = peg$c12; + s3 = peg$c9; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c13); + peg$fail(peg$c10); } } if (s3 !== peg$FAILED) { @@ -4313,28 +4307,28 @@ module.exports = (function () { if (s4 !== peg$FAILED) { s5 = peg$parseOrExpr(); if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c14(s1, s5); + peg$savedPos = s0; + s1 = peg$c11(s1, s5); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseAndExpr(); @@ -4352,12 +4346,12 @@ module.exports = (function () { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 38) { - s3 = peg$c15; + s3 = peg$c12; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c16); + peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { @@ -4365,28 +4359,28 @@ module.exports = (function () { if (s4 !== peg$FAILED) { s5 = peg$parseAndExpr(); if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c17(s1, s5); + peg$savedPos = s0; + s1 = peg$c14(s1, s5); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -4400,25 +4394,25 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseAndExpr(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c17(s1, s3); + peg$savedPos = s0; + s1 = peg$c14(s1, s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseNotExpr(); @@ -4433,12 +4427,12 @@ module.exports = (function () { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 33) { - s1 = peg$c18; + s1 = peg$c15; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c19); + peg$fail(peg$c16); } } if (s1 !== peg$FAILED) { @@ -4446,20 +4440,20 @@ module.exports = (function () { if (s2 !== peg$FAILED) { s3 = peg$parseNotExpr(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c20(s3); + peg$savedPos = s0; + s1 = peg$c17(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseBindingExpr(); @@ -4473,12 +4467,12 @@ module.exports = (function () { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c21; + s1 = peg$c18; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c22); + peg$fail(peg$c19); } } if (s1 !== peg$FAILED) { @@ -4489,37 +4483,37 @@ module.exports = (function () { s4 = peg$parse__(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c23; + s5 = peg$c20; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c24); + peg$fail(peg$c21); } } if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c25(s3); + peg$savedPos = s0; + s1 = peg$c22(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseExpr(); @@ -4545,66 +4539,66 @@ module.exports = (function () { s0 = peg$parseBooleanLiteral(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c26) { - s1 = peg$c26; + if (input.substr(peg$currPos, 2) === peg$c23) { + s1 = peg$c23; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c27); + peg$fail(peg$c24); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c28(); + peg$savedPos = s0; + s1 = peg$c25(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c29) { - s1 = peg$c29; + if (input.substr(peg$currPos, 2) === peg$c26) { + s1 = peg$c26; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c30); + peg$fail(peg$c27); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c31(); + peg$savedPos = s0; + s1 = peg$c28(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c32) { - s1 = peg$c32; + if (input.substr(peg$currPos, 2) === peg$c29) { + s1 = peg$c29; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c33); + peg$fail(peg$c30); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(); + peg$savedPos = s0; + s1 = peg$c31(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c35) { - s1 = peg$c35; + if (input.substr(peg$currPos, 2) === peg$c32) { + s1 = peg$c32; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c36); + peg$fail(peg$c33); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c37(); + peg$savedPos = s0; + s1 = peg$c34(); } s0 = s1; } @@ -4619,34 +4613,34 @@ module.exports = (function () { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c38) { - s1 = peg$c38; + if (input.substr(peg$currPos, 4) === peg$c35) { + s1 = peg$c35; peg$currPos += 4; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c39); + peg$fail(peg$c36); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c40(); + peg$savedPos = s0; + s1 = peg$c37(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c41) { - s1 = peg$c41; + if (input.substr(peg$currPos, 5) === peg$c38) { + s1 = peg$c38; peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c42); + peg$fail(peg$c39); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c43(); + peg$savedPos = s0; + s1 = peg$c40(); } s0 = s1; } @@ -4658,13 +4652,13 @@ module.exports = (function () { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c44) { - s1 = peg$c44; + if (input.substr(peg$currPos, 2) === peg$c41) { + s1 = peg$c41; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c45); + peg$fail(peg$c42); } } if (s1 !== peg$FAILED) { @@ -4676,35 +4670,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseIntegerLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c46(s3); + peg$savedPos = s0; + s1 = peg$c43(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c47) { - s1 = peg$c47; + if (input.substr(peg$currPos, 2) === peg$c44) { + s1 = peg$c44; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c48); + peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { @@ -4716,35 +4710,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c49(s3); + peg$savedPos = s0; + s1 = peg$c46(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c50) { - s1 = peg$c50; + if (input.substr(peg$currPos, 2) === peg$c47) { + s1 = peg$c47; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c51); + peg$fail(peg$c48); } } if (s1 !== peg$FAILED) { @@ -4756,35 +4750,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c52(s3); + peg$savedPos = s0; + s1 = peg$c49(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c53) { - s1 = peg$c53; + if (input.substr(peg$currPos, 3) === peg$c50) { + s1 = peg$c50; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c54); + peg$fail(peg$c51); } } if (s1 !== peg$FAILED) { @@ -4796,35 +4790,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c55(s3); + peg$savedPos = s0; + s1 = peg$c52(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c56) { - s1 = peg$c56; + if (input.substr(peg$currPos, 3) === peg$c53) { + s1 = peg$c53; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c57); + peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { @@ -4836,35 +4830,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c58(s3); + peg$savedPos = s0; + s1 = peg$c55(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c59) { - s1 = peg$c59; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c60); + peg$fail(peg$c57); } } if (s1 !== peg$FAILED) { @@ -4876,35 +4870,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c61(s3); + peg$savedPos = s0; + s1 = peg$c58(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c62) { - s1 = peg$c62; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c63); + peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { @@ -4916,35 +4910,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c64(s3); + peg$savedPos = s0; + s1 = peg$c61(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c65) { - s1 = peg$c65; + if (input.substr(peg$currPos, 3) === peg$c62) { + s1 = peg$c62; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c66); + peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { @@ -4956,35 +4950,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c67(s3); + peg$savedPos = s0; + s1 = peg$c64(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c68) { - s1 = peg$c68; + if (input.substr(peg$currPos, 3) === peg$c65) { + s1 = peg$c65; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c69); + peg$fail(peg$c66); } } if (s1 !== peg$FAILED) { @@ -4996,35 +4990,35 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c70(s3); + peg$savedPos = s0; + s1 = peg$c67(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c71) { - s1 = peg$c71; + if (input.substr(peg$currPos, 2) === peg$c68) { + s1 = peg$c68; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c72); + peg$fail(peg$c69); } } if (s1 !== peg$FAILED) { @@ -5036,32 +5030,32 @@ module.exports = (function () { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c73(s3); + peg$savedPos = s0; + s1 = peg$c70(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseStringLiteral(); if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c73(s1); + peg$savedPos = s0; + s1 = peg$c70(s1); } s0 = s1; } @@ -5083,79 +5077,79 @@ module.exports = (function () { peg$silentFails++; s0 = peg$currPos; - if (peg$c76.test(input.charAt(peg$currPos))) { + if (peg$c72.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c77); + peg$fail(peg$c73); } } if (s1 === peg$FAILED) { - s1 = peg$c75; + s1 = null; } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c78.test(input.charAt(peg$currPos))) { + if (peg$c74.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c79); + peg$fail(peg$c75); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c78.test(input.charAt(peg$currPos))) { + if (peg$c74.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c79); + peg$fail(peg$c75); } } } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { - if (peg$c76.test(input.charAt(peg$currPos))) { + if (peg$c72.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c77); + peg$fail(peg$c73); } } if (s3 === peg$FAILED) { - s3 = peg$c75; + s3 = null; } if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c80(s2); + peg$savedPos = s0; + s1 = peg$c76(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c74); + peg$fail(peg$c71); } } @@ -5168,12 +5162,12 @@ module.exports = (function () { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c82; + s1 = peg$c78; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c83); + peg$fail(peg$c79); } } if (s1 !== peg$FAILED) { @@ -5185,39 +5179,39 @@ module.exports = (function () { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c82; + s3 = peg$c78; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c83); + peg$fail(peg$c79); } } if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c84(s2); + peg$savedPos = s0; + s1 = peg$c80(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c85; + s1 = peg$c81; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c86); + peg$fail(peg$c82); } } if (s1 !== peg$FAILED) { @@ -5229,29 +5223,29 @@ module.exports = (function () { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c85; + s3 = peg$c81; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c86); + peg$fail(peg$c82); } } if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c84(s2); + peg$savedPos = s0; + s1 = peg$c80(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -5260,10 +5254,10 @@ module.exports = (function () { s2 = peg$parsecc(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { s2 = []; @@ -5274,19 +5268,19 @@ module.exports = (function () { s3 = peg$parseUnquotedStringChar(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c84(s2); + peg$savedPos = s0; + s1 = peg$c80(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } } @@ -5294,7 +5288,7 @@ module.exports = (function () { if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c81); + peg$fail(peg$c77); } } @@ -5307,21 +5301,21 @@ module.exports = (function () { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (peg$c88.test(input.charAt(peg$currPos))) { + if (peg$c83.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c89); + peg$fail(peg$c84); } } peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -5330,45 +5324,45 @@ module.exports = (function () { } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c90); + peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c92; + s1 = peg$c87; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c93); + peg$fail(peg$c88); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } @@ -5381,21 +5375,21 @@ module.exports = (function () { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (peg$c94.test(input.charAt(peg$currPos))) { + if (peg$c89.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c95); + peg$fail(peg$c90); } } peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -5404,45 +5398,45 @@ module.exports = (function () { } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c90); + peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c92; + s1 = peg$c87; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c93); + peg$fail(peg$c88); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } @@ -5458,10 +5452,10 @@ module.exports = (function () { s2 = peg$parsews(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -5470,20 +5464,20 @@ module.exports = (function () { } else { s2 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c90); + peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } return s0; @@ -5492,61 +5486,61 @@ module.exports = (function () { function peg$parseEscapeSequence() { var s0, s1; - if (peg$c96.test(input.charAt(peg$currPos))) { + if (peg$c91.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c97); + peg$fail(peg$c92); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 110) { - s1 = peg$c98; + s1 = peg$c93; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c99); + peg$fail(peg$c94); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c100(); + peg$savedPos = s0; + s1 = peg$c95(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 114) { - s1 = peg$c101; + s1 = peg$c96; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c102); + peg$fail(peg$c97); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c103(); + peg$savedPos = s0; + s1 = peg$c98(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 116) { - s1 = peg$c104; + s1 = peg$c99; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { - peg$fail(peg$c105); + peg$fail(peg$c100); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c106(); + peg$savedPos = s0; + s1 = peg$c101(); } s0 = s1; } @@ -5712,16 +5706,15 @@ module.exports = (function () { peg$fail({ type: "end", description: "end of input" }); } - throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); } } return { - SyntaxError: SyntaxError, - parse: parse + SyntaxError: peg$SyntaxError, + parse: peg$parse }; -})(); - +}(); },{"../flow/utils.js":23}],23:[function(require,module,exports){ "use strict"; @@ -5854,7 +5847,6 @@ module.exports = { isValidHttpVersion: isValidHttpVersion }; - },{"jquery":"jquery","lodash":"lodash"}],24:[function(require,module,exports){ "use strict"; @@ -5971,11 +5963,11 @@ _.extend(LiveStoreMixin.prototype, { if (data) { this.handle_fetch(data); } else { - this._fetchxhr = $.getJSON("/" + this.type).done((function (message) { + this._fetchxhr = $.getJSON("/" + this.type).done(function (message) { this.handle_fetch(message.data); - }).bind(this)).fail((function () { + }.bind(this)).fail(function () { EventLogActions.add_event("Could not fetch " + this.type); - }).bind(this)); + }.bind(this)); } }, handle_fetch: function handle_fetch(data) { @@ -6020,9 +6012,9 @@ _.extend(EventLogStore.prototype, LiveListStore.prototype, { // 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 () { + this._fetchxhr.fail(function () { this.handle_fetch(null); - }).bind(this)); + }.bind(this)); } } }); @@ -6033,7 +6025,6 @@ module.exports = { FlowStore: FlowStore }; - },{"../actions.js":2,"../dispatcher.js":21,"../utils.js":26,"events":1,"jquery":"jquery","lodash":"lodash"}],25:[function(require,module,exports){ "use strict"; @@ -6156,7 +6147,6 @@ module.exports = { StoreView: StoreView }; - },{"../utils.js":26,"events":1,"lodash":"lodash"}],26:[function(require,module,exports){ "use strict"; @@ -6264,7 +6254,6 @@ module.exports = { Key: Key }; - },{"./actions.js":2,"jquery":"jquery","lodash":"lodash","react":"react"}]},{},[3]) diff --git a/mitmproxy/web/static/vendor.css b/mitmproxy/web/static/vendor.css index 4ed1f0b83..f8df478ef 100644 --- a/mitmproxy/web/static/vendor.css +++ b/mitmproxy/web/static/vendor.css @@ -264,10 +264,10 @@ th { -moz-osx-font-smoothing: grayscale; } .glyphicon-asterisk:before { - content: "\2a"; + content: "\002a"; } .glyphicon-plus:before { - content: "\2b"; + content: "\002b"; } .glyphicon-euro:before, .glyphicon-eur:before { @@ -2564,6 +2564,10 @@ output { .form-control::-webkit-input-placeholder { color: #999; } +.form-control::-ms-expand { + border: 0; + background-color: transparent; +} .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { @@ -2970,7 +2974,7 @@ select[multiple].input-lg { } @media (min-width: 768px) { .form-horizontal .form-group-lg .control-label { - padding-top: 14.333333px; + padding-top: 11px; font-size: 18px; } } @@ -3077,9 +3081,6 @@ fieldset[disabled] a.btn { .open > .dropdown-toggle.btn-default { background-image: none; } -.btn-default.disabled, -.btn-default[disabled], -fieldset[disabled] .btn-default, .btn-default.disabled:hover, .btn-default[disabled]:hover, fieldset[disabled] .btn-default:hover, @@ -3088,13 +3089,7 @@ fieldset[disabled] .btn-default:hover, fieldset[disabled] .btn-default:focus, .btn-default.disabled.focus, .btn-default[disabled].focus, -fieldset[disabled] .btn-default.focus, -.btn-default.disabled:active, -.btn-default[disabled]:active, -fieldset[disabled] .btn-default:active, -.btn-default.disabled.active, -.btn-default[disabled].active, -fieldset[disabled] .btn-default.active { +fieldset[disabled] .btn-default.focus { background-color: #fff; border-color: #ccc; } @@ -3143,9 +3138,6 @@ fieldset[disabled] .btn-default.active { .open > .dropdown-toggle.btn-primary { background-image: none; } -.btn-primary.disabled, -.btn-primary[disabled], -fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, @@ -3154,13 +3146,7 @@ fieldset[disabled] .btn-primary:hover, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled.focus, .btn-primary[disabled].focus, -fieldset[disabled] .btn-primary.focus, -.btn-primary.disabled:active, -.btn-primary[disabled]:active, -fieldset[disabled] .btn-primary:active, -.btn-primary.disabled.active, -.btn-primary[disabled].active, -fieldset[disabled] .btn-primary.active { +fieldset[disabled] .btn-primary.focus { background-color: #337ab7; border-color: #2e6da4; } @@ -3209,9 +3195,6 @@ fieldset[disabled] .btn-primary.active { .open > .dropdown-toggle.btn-success { background-image: none; } -.btn-success.disabled, -.btn-success[disabled], -fieldset[disabled] .btn-success, .btn-success.disabled:hover, .btn-success[disabled]:hover, fieldset[disabled] .btn-success:hover, @@ -3220,13 +3203,7 @@ fieldset[disabled] .btn-success:hover, fieldset[disabled] .btn-success:focus, .btn-success.disabled.focus, .btn-success[disabled].focus, -fieldset[disabled] .btn-success.focus, -.btn-success.disabled:active, -.btn-success[disabled]:active, -fieldset[disabled] .btn-success:active, -.btn-success.disabled.active, -.btn-success[disabled].active, -fieldset[disabled] .btn-success.active { +fieldset[disabled] .btn-success.focus { background-color: #5cb85c; border-color: #4cae4c; } @@ -3275,9 +3252,6 @@ fieldset[disabled] .btn-success.active { .open > .dropdown-toggle.btn-info { background-image: none; } -.btn-info.disabled, -.btn-info[disabled], -fieldset[disabled] .btn-info, .btn-info.disabled:hover, .btn-info[disabled]:hover, fieldset[disabled] .btn-info:hover, @@ -3286,13 +3260,7 @@ fieldset[disabled] .btn-info:hover, fieldset[disabled] .btn-info:focus, .btn-info.disabled.focus, .btn-info[disabled].focus, -fieldset[disabled] .btn-info.focus, -.btn-info.disabled:active, -.btn-info[disabled]:active, -fieldset[disabled] .btn-info:active, -.btn-info.disabled.active, -.btn-info[disabled].active, -fieldset[disabled] .btn-info.active { +fieldset[disabled] .btn-info.focus { background-color: #5bc0de; border-color: #46b8da; } @@ -3341,9 +3309,6 @@ fieldset[disabled] .btn-info.active { .open > .dropdown-toggle.btn-warning { background-image: none; } -.btn-warning.disabled, -.btn-warning[disabled], -fieldset[disabled] .btn-warning, .btn-warning.disabled:hover, .btn-warning[disabled]:hover, fieldset[disabled] .btn-warning:hover, @@ -3352,13 +3317,7 @@ fieldset[disabled] .btn-warning:hover, fieldset[disabled] .btn-warning:focus, .btn-warning.disabled.focus, .btn-warning[disabled].focus, -fieldset[disabled] .btn-warning.focus, -.btn-warning.disabled:active, -.btn-warning[disabled]:active, -fieldset[disabled] .btn-warning:active, -.btn-warning.disabled.active, -.btn-warning[disabled].active, -fieldset[disabled] .btn-warning.active { +fieldset[disabled] .btn-warning.focus { background-color: #f0ad4e; border-color: #eea236; } @@ -3407,9 +3366,6 @@ fieldset[disabled] .btn-warning.active { .open > .dropdown-toggle.btn-danger { background-image: none; } -.btn-danger.disabled, -.btn-danger[disabled], -fieldset[disabled] .btn-danger, .btn-danger.disabled:hover, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger:hover, @@ -3418,13 +3374,7 @@ fieldset[disabled] .btn-danger:hover, fieldset[disabled] .btn-danger:focus, .btn-danger.disabled.focus, .btn-danger[disabled].focus, -fieldset[disabled] .btn-danger.focus, -.btn-danger.disabled:active, -.btn-danger[disabled]:active, -fieldset[disabled] .btn-danger:active, -.btn-danger.disabled.active, -.btn-danger[disabled].active, -fieldset[disabled] .btn-danger.active { +fieldset[disabled] .btn-danger.focus { background-color: #d9534f; border-color: #d43f3a; } @@ -3795,13 +3745,15 @@ tbody.collapse.in { } .btn-group-vertical > .btn:first-child:not(:last-child) { border-top-right-radius: 4px; + border-top-left-radius: 4px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .btn-group-vertical > .btn:last-child:not(:first-child) { - border-bottom-left-radius: 4px; border-top-right-radius: 0; border-top-left-radius: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; } .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { border-radius: 0; @@ -3858,6 +3810,9 @@ tbody.collapse.in { width: 100%; margin-bottom: 0; } +.input-group .form-control:focus { + z-index: 3; +} .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn { @@ -4768,7 +4723,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pagination > li > span:hover, .pagination > li > a:focus, .pagination > li > span:focus { - z-index: 3; + z-index: 2; color: #23527c; background-color: #eeeeee; border-color: #ddd; @@ -4779,7 +4734,7 @@ fieldset[disabled] .navbar-inverse .btn-link:focus { .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus { - z-index: 2; + z-index: 3; color: #fff; background-color: #337ab7; border-color: #337ab7; @@ -5001,6 +4956,8 @@ a.badge:focus { .container .jumbotron, .container-fluid .jumbotron { border-radius: 6px; + padding-left: 15px; + padding-right: 15px; } .jumbotron .container { max-width: 100%; @@ -5947,7 +5904,6 @@ button.close { .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5; - min-height: 16.42857143px; } .modal-header .close { margin-top: -2px; @@ -6339,6 +6295,7 @@ button.close { color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); + background-color: rgba(0, 0, 0, 0); } .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); @@ -6448,16 +6405,16 @@ button.close { .carousel-control .icon-next { width: 30px; height: 30px; - margin-top: -15px; + margin-top: -10px; font-size: 30px; } .carousel-control .glyphicon-chevron-left, .carousel-control .icon-prev { - margin-left: -15px; + margin-left: -10px; } .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { - margin-right: -15px; + margin-right: -10px; } .carousel-caption { left: 20%; @@ -6496,6 +6453,8 @@ button.close { .pager:after, .panel-body:before, .panel-body:after, +.modal-header:before, +.modal-header:after, .modal-footer:before, .modal-footer:after { content: " "; @@ -6515,6 +6474,7 @@ button.close { .navbar-collapse:after, .pager:after, .panel-body:after, +.modal-header:after, .modal-footer:after { clear: both; } diff --git a/mitmproxy/web/static/vendor.js b/mitmproxy/web/static/vendor.js index 59d104450..cc631d270 100644 --- a/mitmproxy/web/static/vendor.js +++ b/mitmproxy/web/static/vendor.js @@ -380,991 +380,393 @@ module.exports = invariant; }).call(this,require('_process')) },{"_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() {} +exports.__esModule = true; +var _slice = Array.prototype.slice; +exports.loopAsync = loopAsync; +exports.mapAsync = mapAsync; -module.exports = Cancellation; +function loopAsync(turns, work, callback) { + var currentTurn = 0, + isDone = false; + var sync = false, + hasNext = false, + doneArgs = undefined; + + function done() { + isDone = true; + if (sync) { + // Iterate instead of recursing if possible. + doneArgs = [].concat(_slice.call(arguments)); + return; + } + + callback.apply(this, arguments); + } + + function next() { + if (isDone) { + return; + } + + hasNext = true; + if (sync) { + // Iterate instead of recursing if possible. + return; + } + + sync = true; + + while (!isDone && currentTurn < turns && hasNext) { + hasNext = false; + work.call(this, currentTurn++, next, done); + } + + sync = false; + + if (isDone) { + // This means the loop finished synchronously. + callback.apply(this, doneArgs); + return; + } + + if (currentTurn >= turns && hasNext) { + isDone = true; + callback(); + } + } + + next(); +} + +function mapAsync(array, work, callback) { + var length = array.length; + var values = []; + + if (length === 0) return callback(null, values); + + var isDone = false, + doneCount = 0; + + function done(index, error, value) { + if (isDone) return; + + if (error) { + isDone = true; + callback(error); + } else { + values[index] = value; + + isDone = ++doneCount === length; + + if (isDone) callback(null, values); + } + } + + array.forEach(function (item, index) { + work(item, index, function (error, value) { + done(index, error, value); + }); + }); +} },{}],5:[function(require,module,exports){ +(function (process){ 'use strict'; -var invariant = require('react/lib/invariant'); -var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; +exports.__esModule = true; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _routerWarning = require('./routerWarning'); + +var _routerWarning2 = _interopRequireDefault(_routerWarning); + +var _PropTypes = require('./PropTypes'); + +/** + * A mixin that adds the "history" instance variable to components. + */ var History = { - /** - * The current number of entries in the history. - * - * Note: This property is read-only. - */ - length: 1, - - /** - * Sends the browser back one entry in the history. - */ - back: function back() { - invariant(canUseDOM, 'Cannot use History.back without a DOM'); - - // Do this first so that History.length will - // be accurate in location change listeners. - History.length -= 1; - - window.history.back(); - } - -}; - -module.exports = History; -},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],6:[function(require,module,exports){ -'use strict'; - -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'); - -function deepSearch(route, pathname, query) { - // Check the subtree first to find the most deeply-nested match. - var childRoutes = route.childRoutes; - if (childRoutes) { - var match, childRoute; - for (var i = 0, len = childRoutes.length; i < len; ++i) { - childRoute = childRoutes[i]; - - if (childRoute.isDefault || childRoute.isNotFound) continue; // Check these in order later. - - if (match = deepSearch(childRoute, pathname, query)) { - // A route in the subtree matched! Add this route and we're done. - match.routes.unshift(route); - return match; - } - } - } - - // No child routes matched; try the default route. - var defaultRoute = route.defaultRoute; - if (defaultRoute && (params = PathUtils.extractParams(defaultRoute.path, pathname))) { - return new Match(pathname, params, query, [route, defaultRoute]); - } // Does the "not found" route match? - var notFoundRoute = route.notFoundRoute; - if (notFoundRoute && (params = PathUtils.extractParams(notFoundRoute.path, pathname))) { - return new Match(pathname, params, query, [route, notFoundRoute]); - } // Last attempt: check this route. - var params = PathUtils.extractParams(route.path, pathname); - if (params) { - return new Match(pathname, params, query, [route]); - }return null; -} - -var Match = (function () { - function Match(pathname, params, query, routes) { - _classCallCheck(this, Match); - - this.pathname = pathname; - this.params = params; - this.query = query; - this.routes = routes; - } - - _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; - - for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); - - return match; - } - }]); - - return Match; -})(); - -module.exports = Match; -},{"./PathUtils":8}],7:[function(require,module,exports){ -'use strict'; - -var PropTypes = require('./PropTypes'); - -/** - * A mixin for components that modify the URL. - * - * Example: - * - * var MyLink = React.createClass({ - * mixins: [ Router.Navigation ], - * handleClick(event) { - * event.preventDefault(); - * this.transitionTo('aRoute', { the: 'params' }, { the: 'query' }); - * }, - * render() { - * return ( - * Click me! - * ); - * } - * }); - */ -var Navigation = { - contextTypes: { - router: PropTypes.router.isRequired - }, - - /** - * Returns an absolute URL path created from the given route - * name, URL parameters, and query values. - */ - 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: 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: 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: function replaceWith(to, params, query) { - this.context.router.replaceWith(to, params, query); - }, - - /** - * Transitions to the previous URL. - */ - goBack: function goBack() { - return this.context.router.goBack(); - } - -}; - -module.exports = Navigation; -},{"./PropTypes":9}],8:[function(require,module,exports){ -'use strict'; - -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; -var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?/g; -var queryMatcher = /\?(.*)$/; - -var _compiledPatterns = {}; - -function compilePattern(pattern) { - if (!(pattern in _compiledPatterns)) { - var paramNames = []; - var source = pattern.replace(paramCompileMatcher, function (match, paramName) { - if (paramName) { - paramNames.push(paramName); - return '([^/?#]+)'; - } else if (match === '*') { - paramNames.push('splat'); - return '(.*?)'; - } else { - return '\\' + match; - } - }); - - _compiledPatterns[pattern] = { - matcher: new RegExp('^' + source + '$', 'i'), - paramNames: paramNames - }; - } - - return _compiledPatterns[pattern]; -} - -var PathUtils = { - - /** - * Returns true if the given path is absolute. - */ - isAbsolute: function isAbsolute(path) { - return path.charAt(0) === '/'; - }, - - /** - * Joins two URL paths together. - */ - join: function join(a, b) { - return a.replace(/\/*$/, '/') + b; - }, - - /** - * Returns an array of the names of all parameters in the given pattern. - */ - extractParamNames: function extractParamNames(pattern) { - return compilePattern(pattern).paramNames; - }, - - /** - * Extracts the portions of the given URL path that match the given pattern - * and returns an object of param name => value pairs. Returns null if the - * pattern does not match the given path. - */ - extractParams: function extractParams(pattern, path) { - var _compilePattern = compilePattern(pattern); - - var matcher = _compilePattern.matcher; - var paramNames = _compilePattern.paramNames; - - var match = path.match(matcher); - - if (!match) { - return null; - }var params = {}; - - paramNames.forEach(function (paramName, index) { - params[paramName] = match[index + 1]; - }); - - return params; - }, - - /** - * Returns a version of the given route path with params interpolated. Throws - * if there is a dynamic segment of the route path for which there is no param. - */ - injectParams: function injectParams(pattern, params) { - params = params || {}; - - var splatIndex = 0; - - return pattern.replace(paramInjectMatcher, function (match, paramName) { - paramName = paramName || 'splat'; - - // If param is optional don't check for existence - if (paramName.slice(-1) === '?') { - paramName = paramName.slice(0, -1); - - if (params[paramName] == null) return ''; - } else { - invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern); - } - - var segment; - if (paramName === 'splat' && Array.isArray(params[paramName])) { - segment = params[paramName][splatIndex++]; - - invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern); - } else { - segment = params[paramName]; - } - - return segment; - }).replace(paramInjectTrailingSlashMatcher, '/'); - }, - - /** - * Returns an object that is the result of parsing any query string contained - * in the given path, null if the path contains no query string. - */ - extractQuery: function extractQuery(path) { - var match = path.match(queryMatcher); - return match && qs.parse(match[1]); - }, - - /** - * Returns a version of the given path without the query string. - */ - withoutQuery: function withoutQuery(path) { - return path.replace(queryMatcher, ''); - }, - - /** - * Returns a version of the given path with the parameters in the given - * query merged into the query string. - */ - withQuery: function withQuery(path, query) { - var existingQuery = PathUtils.extractQuery(path); - - if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery; - - var queryString = qs.stringify(query, { arrayFormat: 'brackets' }); - - if (queryString) { - return PathUtils.withoutQuery(path) + '?' + queryString; - }return PathUtils.withoutQuery(path); - } - -}; - -module.exports = PathUtils; -},{"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 PropTypes = assign({}, ReactPropTypes, { - - /** - * Indicates that a prop should be falsy. - */ - falsy: function falsy(props, propName, componentName) { - if (props[propName]) { - return new Error('<' + componentName + '> should not have a "' + propName + '" prop'); - } - }, - - /** - * Indicates that a prop should be a Route object. - */ - route: ReactPropTypes.instanceOf(Route), - - /** - * Indicates that a prop should be a Router object. - */ - //router: ReactPropTypes.instanceOf(Router) // TODO - router: ReactPropTypes.func - -}); - -module.exports = PropTypes; -},{"./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; - this.query = query; -} - -module.exports = Redirect; -},{}],11:[function(require,module,exports){ -'use strict'; - -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 _currentRoute; - -var Route = (function () { - function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) { - _classCallCheck(this, Route); - - this.name = name; - this.path = path; - this.paramNames = PathUtils.extractParamNames(this.path); - this.ignoreScrollBehavior = !!ignoreScrollBehavior; - this.isDefault = !!isDefault; - this.isNotFound = !!isNotFound; - this.onEnter = onEnter; - this.onLeave = onLeave; - this.handler = handler; - } - - _createClass(Route, [{ - key: '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'); - - if (!this.childRoutes) this.childRoutes = []; - - this.childRoutes.push(route); - } - }, { - key: 'toString', - value: function toString() { - var string = ''; - - 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; - - 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; - } - } 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); - - parentRoute.defaultRoute = route; - } else if (route.isNotFound) { - invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute); - - parentRoute.notFoundRoute = route; - } - - parentRoute.appendChild(route); - } - - // 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; - } - - return route; - } - }, { - key: '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 })); - } - }, { - key: 'createNotFoundRoute', - - /** - * 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', - - /** - * 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":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'); - -function shouldUpdateScroll(state, prevState) { - if (!prevState) { - return true; - } // Don't update scroll position when only the query has changed. - if (state.pathname === prevState.pathname) { - return false; - }var routes = state.routes; - var prevRoutes = prevState.routes; - - var sharedAncestorRoutes = routes.filter(function (route) { - return prevRoutes.indexOf(route) !== -1; - }); - - return !sharedAncestorRoutes.some(function (route) { - return route.ignoreScrollBehavior; - }); -} - -/** - * Provides the router with the ability to manage window scroll position - * according to its scroll behavior. - */ -var ScrollHistory = { - - statics: { - - /** - * Records curent scroll position as the last known position for the given URL path. - */ - recordScrollPosition: function recordScrollPosition(path) { - if (!this.scrollHistory) this.scrollHistory = {}; - - this.scrollHistory[path] = getWindowScrollPosition(); - }, - - /** - * Returns the last known scroll position for the given URL path. - */ - getScrollPosition: function getScrollPosition(path) { - if (!this.scrollHistory) this.scrollHistory = {}; - - return this.scrollHistory[path] || null; - } - + history: _PropTypes.history }, componentWillMount: function componentWillMount() { - invariant(this.constructor.getScrollBehavior() == null || canUseDOM, 'Cannot use scroll behavior without a DOM'); + process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : undefined; + this.history = this.context.history; + } + +}; + +exports['default'] = History; +module.exports = exports['default']; +}).call(this,require('_process')) + +},{"./PropTypes":12,"./routerWarning":34,"_process":1}],6:[function(require,module,exports){ +'use strict'; + +exports.__esModule = true; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _Link = require('./Link'); + +var _Link2 = _interopRequireDefault(_Link); + +/** + * An is used to link to an . + */ +var IndexLink = _react2['default'].createClass({ + displayName: 'IndexLink', + + render: function render() { + return _react2['default'].createElement(_Link2['default'], _extends({}, this.props, { onlyActiveOnIndex: true })); + } + +}); + +exports['default'] = IndexLink; +module.exports = exports['default']; +},{"./Link":10,"react":"react"}],7:[function(require,module,exports){ +(function (process){ +'use strict'; + +exports.__esModule = true; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _routerWarning = require('./routerWarning'); + +var _routerWarning2 = _interopRequireDefault(_routerWarning); + +var _invariant = require('invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _Redirect = require('./Redirect'); + +var _Redirect2 = _interopRequireDefault(_Redirect); + +var _PropTypes = require('./PropTypes'); + +var _React$PropTypes = _react2['default'].PropTypes; +var string = _React$PropTypes.string; +var object = _React$PropTypes.object; + +/** + * An is used to redirect from an indexRoute. + */ +var IndexRedirect = _react2['default'].createClass({ + displayName: 'IndexRedirect', + + statics: { + + createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) { + /* istanbul ignore else: sanity check */ + if (parentRoute) { + parentRoute.indexRoute = _Redirect2['default'].createRouteFromReactElement(element); + } else { + process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'An does not make sense at the root of your route config') : undefined; + } + } + + }, + + propTypes: { + to: string.isRequired, + query: object, + state: object, + onEnter: _PropTypes.falsy, + children: _PropTypes.falsy + }, + + /* istanbul ignore next: sanity check */ + render: function render() { + !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, ' elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined; + } + +}); + +exports['default'] = IndexRedirect; +module.exports = exports['default']; +}).call(this,require('_process')) + +},{"./PropTypes":12,"./Redirect":13,"./routerWarning":34,"_process":1,"invariant":58,"react":"react"}],8:[function(require,module,exports){ +(function (process){ +'use strict'; + +exports.__esModule = true; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _routerWarning = require('./routerWarning'); + +var _routerWarning2 = _interopRequireDefault(_routerWarning); + +var _invariant = require('invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _RouteUtils = require('./RouteUtils'); + +var _PropTypes = require('./PropTypes'); + +var func = _react2['default'].PropTypes.func; + +/** + * An is used to specify its parent's in + * a JSX route config. + */ +var IndexRoute = _react2['default'].createClass({ + displayName: 'IndexRoute', + + statics: { + + createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) { + /* istanbul ignore else: sanity check */ + if (parentRoute) { + parentRoute.indexRoute = _RouteUtils.createRouteFromReactElement(element); + } else { + process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'An does not make sense at the root of your route config') : undefined; + } + } + + }, + + propTypes: { + path: _PropTypes.falsy, + component: _PropTypes.component, + components: _PropTypes.components, + getComponent: func, + getComponents: func + }, + + /* istanbul ignore next: sanity check */ + render: function render() { + !false ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, ' elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined; + } + +}); + +exports['default'] = IndexRoute; +module.exports = exports['default']; +}).call(this,require('_process')) + +},{"./PropTypes":12,"./RouteUtils":16,"./routerWarning":34,"_process":1,"invariant":58,"react":"react"}],9:[function(require,module,exports){ +(function (process){ +'use strict'; + +exports.__esModule = true; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _routerWarning = require('./routerWarning'); + +var _routerWarning2 = _interopRequireDefault(_routerWarning); + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _invariant = require('invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +var object = _react2['default'].PropTypes.object; + +/** + * The Lifecycle mixin adds the routerWillLeave lifecycle method to a + * component that may be used to cancel a transition or prompt the user + * for confirmation. + * + * On standard transitions, routerWillLeave receives a single argument: the + * location we're transitioning to. To cancel the transition, return false. + * To prompt the user for confirmation, return a prompt message (string). + * + * During the beforeunload event (assuming you're using the useBeforeUnload + * history enhancer), routerWillLeave does not receive a location object + * because it isn't possible for us to know the location we're transitioning + * to. In this case routerWillLeave must return a prompt message to prevent + * the user from closing the window/tab. + */ +var Lifecycle = { + + contextTypes: { + history: object.isRequired, + // Nested children receive the route as context, either + // set by the route component using the RouteContext mixin + // or by some other ancestor. + route: object + }, + + propTypes: { + // Route components receive the route object as a prop. + route: object }, componentDidMount: function componentDidMount() { - this._updateScroll(); + process.env.NODE_ENV !== 'production' ? _routerWarning2['default'](false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : undefined; + !this.routerWillLeave ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : _invariant2['default'](false) : undefined; + + var route = this.props.route || this.context.route; + + !route ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'The Lifecycle mixin must be used on either a) a or ' + 'b) a descendant of a that uses the RouteContext mixin') : _invariant2['default'](false) : undefined; + + this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave); }, - componentDidUpdate: function componentDidUpdate(prevProps, prevState) { - this._updateScroll(prevState); - }, - - _updateScroll: function _updateScroll(prevState) { - if (!shouldUpdateScroll(this.state, prevState)) { - return; - }var scrollBehavior = this.constructor.getScrollBehavior(); - - if (scrollBehavior) scrollBehavior.updateScrollPosition(this.constructor.getScrollPosition(this.state.path), this.state.action); + componentWillUnmount: function componentWillUnmount() { + if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute(); } }; -module.exports = ScrollHistory; -},{"./getWindowScrollPosition":27,"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],13:[function(require,module,exports){ +exports['default'] = Lifecycle; +module.exports = exports['default']; +}).call(this,require('_process')) + +},{"./routerWarning":34,"_process":1,"invariant":58,"react":"react"}],10:[function(require,module,exports){ +(function (process){ 'use strict'; -var PropTypes = require('./PropTypes'); +exports.__esModule = true; -/** - * A mixin for components that need to know the path, routes, URL - * params and query that are currently active. - * - * Example: - * - * var AboutLink = React.createClass({ - * 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); - * } - * }); - */ -var State = { +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; }; - contextTypes: { - router: PropTypes.router.isRequired - }, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Returns the current URL path. - */ - getPath: function getPath() { - return this.context.router.getCurrentPath(); - }, +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - /** - * Returns the current URL path without the query string. - */ - getPathname: function getPathname() { - return this.context.router.getCurrentPathname(); - }, +var _react = require('react'); - /** - * Returns an object of the URL params that are currently active. - */ - getParams: function getParams() { - return this.context.router.getCurrentParams(); - }, +var _react2 = _interopRequireDefault(_react); - /** - * Returns an object of the query params that are currently active. - */ - getQuery: function getQuery() { - return this.context.router.getCurrentQuery(); - }, +var _routerWarning = require('./routerWarning'); - /** - * Returns an array of the routes that are currently active. - */ - getRoutes: function getRoutes() { - return this.context.router.getCurrentRoutes(); - }, +var _routerWarning2 = _interopRequireDefault(_routerWarning); - /** - * A helper method to determine if a given route, params, and query - * are active. - */ - isActive: function isActive(to, params, query) { - return this.context.router.isActive(to, params, query); - } - -}; - -module.exports = State; -},{"./PropTypes":9}],14:[function(require,module,exports){ -/* jshint -W058 */ - -'use strict'; - -var Cancellation = require('./Cancellation'); -var Redirect = require('./Redirect'); - -/** - * Encapsulates a transition to a given path. - * - * The willTransitionTo and willTransitionFrom handlers receive - * an instance of this class as their first argument. - */ -function Transition(path, retry) { - this.path = path; - this.abortReason = null; - // TODO: Change this to router.retryTransition(transition) - this.retry = retry.bind(this); -} - -Transition.prototype.abort = function (reason) { - if (this.abortReason == null) this.abortReason = reason || 'ABORT'; -}; - -Transition.prototype.redirect = function (to, params, query) { - this.abort(new Redirect(to, params, query)); -}; - -Transition.prototype.cancel = function () { - this.abort(new Cancellation()); -}; - -Transition.from = function (transition, routes, components, callback) { - routes.reduce(function (callback, route, index) { - return function (error) { - if (error || transition.abortReason) { - callback(error); - } else if (route.onLeave) { - try { - route.onLeave(transition, components[index], callback); - - // If there is no callback in the argument list, call it automatically. - if (route.onLeave.length < 3) callback(); - } catch (e) { - callback(e); - } - } else { - callback(); - } - }; - }, callback)(); -}; - -Transition.to = function (transition, routes, params, query, callback) { - routes.reduceRight(function (callback, route) { - return function (error) { - if (error || transition.abortReason) { - callback(error); - } else if (route.onEnter) { - try { - route.onEnter(transition, params, query, callback); - - // If there is no callback in the argument list, call it automatically. - if (route.onEnter.length < 4) callback(); - } catch (e) { - callback(e); - } - } else { - callback(); - } - }; - }, callback)(); -}; - -module.exports = Transition; -},{"./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', - - /** - * Indicates the current location should be replaced. - */ - REPLACE: 'replace', - - /** - * Indicates the most recent entry should be removed from the history stack. - */ - POP: 'pop' - -}; - -module.exports = LocationActions; -},{}],16:[function(require,module,exports){ -'use strict'; - -var LocationActions = require('../actions/LocationActions'); - -/** - * A scroll behavior that attempts to imitate the default behavior - * of modern browsers. - */ -var ImitateBrowserBehavior = { - - updateScrollPosition: function updateScrollPosition(position, actionType) { - switch (actionType) { - case LocationActions.PUSH: - case LocationActions.REPLACE: - window.scrollTo(0, 0); - break; - case LocationActions.POP: - if (position) { - window.scrollTo(position.x, position.y); - } else { - window.scrollTo(0, 0); - } - break; - } - } - -}; - -module.exports = ImitateBrowserBehavior; -},{"../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() { - window.scrollTo(0, 0); - } - -}; - -module.exports = ScrollToTopBehavior; -},{}],18:[function(require,module,exports){ -'use strict'; - -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 _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 - * present in React 0.13.0. It sovles this by providing a separation - * between the "owner" and "parent" contexts. - */ - -var React = require('react'); - -var ContextWrapper = (function (_React$Component) { - function ContextWrapper() { - _classCallCheck(this, ContextWrapper); - - if (_React$Component != null) { - _React$Component.apply(this, arguments); - } - } - - _inherits(ContextWrapper, _React$Component); - - _createClass(ContextWrapper, [{ - key: 'render', - value: function render() { - return this.props.children; - } - }]); - - return ContextWrapper; -})(React.Component); - -module.exports = ContextWrapper; -},{"react":"react"}],19:[function(require,module,exports){ -'use strict'; - -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'); - -/** - * A component is a special kind of that - * renders when its parent matches but none of its siblings do. - * Only one such route may be used at any given level in the - * route hierarchy. - */ - -var DefaultRoute = (function (_Route) { - function DefaultRoute() { - _classCallCheck(this, DefaultRoute); - - if (_Route != null) { - _Route.apply(this, arguments); - } - } - - _inherits(DefaultRoute, _Route); - - return DefaultRoute; -})(Route); - -// TODO: Include these in the above class definition -// once we can use ES7 property initializers. -// https://github.com/babel/babel/issues/619 - -DefaultRoute.propTypes = { - name: PropTypes.string, - path: PropTypes.falsy, - children: PropTypes.falsy, - handler: PropTypes.func.isRequired -}; - -DefaultRoute.defaultProps = { - handler: RouteHandler -}; - -module.exports = DefaultRoute; -},{"../PropTypes":9,"./Route":23,"./RouteHandler":24}],20:[function(require,module,exports){ -'use strict'; - -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 _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$PropTypes = _react2['default'].PropTypes; +var bool = _React$PropTypes.bool; +var object = _React$PropTypes.object; +var string = _React$PropTypes.string; +var func = _React$PropTypes.func; +var oneOfType = _React$PropTypes.oneOfType; function isLeftClickEvent(event) { return event.button === 0; @@ -1374,944 +776,671 @@ function isModifiedEvent(event) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); } +function isEmptyObject(object) { + for (var p in object) { + if (object.hasOwnProperty(p)) return false; + }return true; +} + +function createLocationDescriptor(to, _ref) { + var query = _ref.query; + var hash = _ref.hash; + var state = _ref.state; + + if (query || hash || state) { + return { pathname: to, query: query, hash: hash, state: state }; + } + + return to; +} + /** - * components are used to create an element that links to a route. - * When that route is active, the link gets an "active" class name (or the - * value of its `activeClassName` prop). + * A is used to create an element that links to a route. + * When that route is active, the link gets the value of its + * activeClassName prop. * * For example, assuming you have the following route: * - * + * * * You could use the following component to link to that route: * - * + * * - * In addition to params, links may pass along query string parameters - * using the `query` prop. + * Links may pass along location state and/or query string parameters + * in the state/query props, respectively. * - * + * */ - -var Link = (function (_React$Component) { - function Link() { - _classCallCheck(this, Link); - - if (_React$Component != null) { - _React$Component.apply(this, arguments); - } - } - - _inherits(Link, _React$Component); - - _createClass(Link, [{ - key: 'handleClick', - value: function handleClick(event) { - var allowTransition = true; - var clickResult; - - if (this.props.onClick) clickResult = this.props.onClick(event); - - if (isModifiedEvent(event) || !isLeftClickEvent(event)) { - return; - }if (clickResult === false || event.defaultPrevented === true) allowTransition = false; - - event.preventDefault(); - - if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query); - } - }, { - key: 'getHref', - - /** - * 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', - - /** - * Returns the value of the "class" attribute to use on the DOM element, which contains - * the value of the activeClassName property when this is active. - */ - value: function getClassName() { - var className = this.props.className; - - if (this.getActiveState()) className += ' ' + this.props.activeClassName; - - 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; - - return React.DOM.a(props, this.props.children); - } - }]); - - return Link; -})(React.Component); - -// TODO: Include these in the above class definition -// once we can use ES7 property initializers. -// https://github.com/babel/babel/issues/619 - -Link.contextTypes = { - router: PropTypes.router.isRequired -}; - -Link.propTypes = { - activeClassName: PropTypes.string.isRequired, - to: PropTypes.oneOfType([PropTypes.string, PropTypes.route]).isRequired, - params: PropTypes.object, - query: PropTypes.object, - activeStyle: PropTypes.object, - onClick: PropTypes.func -}; - -Link.defaultProps = { - activeClassName: 'active', - className: '' -}; - -module.exports = Link; -},{"../PropTypes":9,"react":"react","react/lib/Object.assign":69}],21:[function(require,module,exports){ -'use strict'; - -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'); - -/** - * A is a special kind of that - * renders when the beginning of its parent's path matches - * but none of its siblings do, including any . - * Only one such route may be used at any given level in the - * route hierarchy. - */ - -var NotFoundRoute = (function (_Route) { - function NotFoundRoute() { - _classCallCheck(this, NotFoundRoute); - - if (_Route != null) { - _Route.apply(this, arguments); - } - } - - _inherits(NotFoundRoute, _Route); - - return NotFoundRoute; -})(Route); - -// TODO: Include these in the above class definition -// once we can use ES7 property initializers. -// https://github.com/babel/babel/issues/619 - -NotFoundRoute.propTypes = { - name: PropTypes.string, - path: PropTypes.falsy, - children: PropTypes.falsy, - handler: PropTypes.func.isRequired -}; - -NotFoundRoute.defaultProps = { - handler: RouteHandler -}; - -module.exports = NotFoundRoute; -},{"../PropTypes":9,"./Route":23,"./RouteHandler":24}],22:[function(require,module,exports){ -'use strict'; - -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'); - -/** - * A component is a special kind of that always - * redirects to another route when it matches. - */ - -var Redirect = (function (_Route) { - function Redirect() { - _classCallCheck(this, Redirect); - - if (_Route != null) { - _Route.apply(this, arguments); - } - } - - _inherits(Redirect, _Route); - - return Redirect; -})(Route); - -// TODO: Include these in the above class definition -// once we can use ES7 property initializers. -// https://github.com/babel/babel/issues/619 - -Redirect.propTypes = { - path: PropTypes.string, - from: PropTypes.string, // Alias for path. - to: PropTypes.string, - handler: PropTypes.falsy -}; - -// Redirects should not have a default handler -Redirect.defaultProps = {}; - -module.exports = Redirect; -},{"../PropTypes":9,"./Route":23}],23:[function(require,module,exports){ -'use strict'; - -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 _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'); - -/** - * components specify components that are rendered to the page when the - * URL matches a given pattern. - * - * Routes are arranged in a nested tree structure. When a new URL is requested, - * the tree is searched depth-first to find a route whose path matches the URL. - * When one is found, all routes in the tree that lead to it are considered - * "active" and their components are rendered into the DOM, nested in the same - * order as they are in the tree. - * - * The preferred way to configure a router is using JSX. The XML-like syntax is - * a great way to visualize how routes are laid out in an application. - * - * var routes = [ - * - * - * - * - * - * ]; - * - * Router.run(routes, function (Handler) { - * React.render(, document.body); - * }); - * - * Handlers for Route components that contain children can render their active - * child route using a element. - * - * var App = React.createClass({ - * render: function () { - * return ( - *
    - * - *
    - * ); - * } - * }); - * - * If no handler is provided for the route, it will render a matched child route. - */ - -var Route = (function (_React$Component) { - function Route() { - _classCallCheck(this, Route); - - if (_React$Component != null) { - _React$Component.apply(this, arguments); - } - } - - _inherits(Route, _React$Component); - - _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); - -// TODO: Include these in the above class definition -// once we can use ES7 property initializers. -// https://github.com/babel/babel/issues/619 - -Route.propTypes = { - name: PropTypes.string, - path: PropTypes.string, - handler: PropTypes.func, - ignoreScrollBehavior: PropTypes.bool -}; - -Route.defaultProps = { - handler: RouteHandler -}; - -module.exports = Route; -},{"../PropTypes":9,"./RouteHandler":24,"react":"react","react/lib/invariant":191}],24:[function(require,module,exports){ -'use strict'; - -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 _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 REF_NAME = '__routeHandler__'; - -/** - * A component renders the active child route handler - * when routes are nested. - */ - -var RouteHandler = (function (_React$Component) { - function RouteHandler() { - _classCallCheck(this, RouteHandler); - - if (_React$Component != null) { - _React$Component.apply(this, arguments); - } - } - - _inherits(RouteHandler, _React$Component); - - _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(); - // +
    \ No newline at end of file diff --git a/web/.babelrc b/web/.babelrc new file mode 100644 index 000000000..facd18092 --- /dev/null +++ b/web/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "react"] +} \ No newline at end of file diff --git a/web/.bowerrc b/web/.bowerrc deleted file mode 100644 index 5e6701af4..000000000 --- a/web/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory" : "bower_components" -} \ No newline at end of file diff --git a/web/.eslintrc b/web/.eslintrc deleted file mode 100644 index df1877399..000000000 --- a/web/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "ecmaFeatures": { - "jsx": true - }, - "env": { - "es6": true - } -} \ No newline at end of file diff --git a/web/.eslintrc.yml b/web/.eslintrc.yml new file mode 100644 index 000000000..319fa67c9 --- /dev/null +++ b/web/.eslintrc.yml @@ -0,0 +1,9 @@ +{ + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true + } + } +} \ No newline at end of file diff --git a/web/gulpfile.js b/web/gulpfile.js index 83893c91c..58f740986 100644 --- a/web/gulpfile.js +++ b/web/gulpfile.js @@ -7,8 +7,6 @@ var conf = require('./conf.js'); var babelify = require('babelify'); var browserify = require('browserify'); var gulp = require("gulp"); -var concat = require('gulp-concat'); -var connect = require('gulp-connect'); var eslint = require('gulp-eslint'); var less = require("gulp-less"); var livereload = require("gulp-livereload"); @@ -16,18 +14,13 @@ var minifyCSS = require('gulp-minify-css'); var notify = require("gulp-notify"); var peg = require("gulp-peg"); var plumber = require("gulp-plumber"); -var react = require("gulp-react"); var rename = require("gulp-rename"); -var replace = require('gulp-replace'); var sourcemaps = require('gulp-sourcemaps'); var gutil = require("gulp-util"); var _ = require('lodash'); -var map = require("map-stream"); -var reactify = require('reactify'); var uglifyify = require('uglifyify'); var buffer = require('vinyl-buffer'); var source = require('vinyl-source-stream'); -var transform = require('vinyl-transform'); var watchify = require('watchify'); var vendor_packages = _.difference( @@ -116,6 +109,7 @@ function buildScript(bundler, filename, dev) { // listen for an update and run rebundle bundler.on('update', rebundle); bundler.on('log', gutil.log); + bundler.on('error', gutil.log); // run it once the first time buildScript is called return rebundle(); @@ -150,7 +144,7 @@ function app_stream(dev) { for (var vp of vendor_packages) { bundler.external(vp); } - bundler = bundler.transform(babelify).transform(reactify); + bundler = bundler.transform(babelify); return buildScript(bundler, "app.js", dev); } gulp.task('scripts-app-dev', function () { diff --git a/web/package.json b/web/package.json index 5bcbdd87b..a1b42d016 100644 --- a/web/package.json +++ b/web/package.json @@ -15,41 +15,36 @@ "testDirectoryName": "tests" }, "dependencies": { - "bootstrap": "^3.3.4", + "bootstrap": "^3.3.6", "flux": "^2.1.1", - "jquery": "^2.1.4", - "lodash": "^3.10.1", - "react": "^0.13.3", - "react-router": "^0.13.2" + "jquery": "^2.2.1", + "lodash": "^4.5.1", + "react": "^0.14.7", + "react-dom": "^0.14.7", + "react-router": "^2.0.0" }, "devDependencies": { - "babelify": "^6.3.0", - "browserify": "^11.2.0", - "eslint": "^1.5.1", - "gulp": "^3.9.0", - "gulp-concat": "^2.6.0", - "gulp-connect": "^2.2.0", - "gulp-eslint": "^1.0.0", - "gulp-jshint": "^1.11.2", - "gulp-less": "^3.0.3", + "babel-core": "^6.5.2", + "babel-preset-es2015": "^6.5.0", + "babel-preset-react": "^6.5.0", + "babelify": "^7.2.0", + "browserify": "^13.0.0", + "eslint": "^2.2.0", + "gulp": "^3.9.1", + "gulp-eslint": "^2.0.0", + "gulp-less": "^3.0.5", "gulp-livereload": "^3.8.1", - "gulp-minify-css": "^1.2.1", + "gulp-minify-css": "^1.2.4", "gulp-notify": "^2.2.0", - "gulp-peg": "^0.1.2", - "gulp-plumber": "^1.0.1", - "gulp-react": "^3.0.1", + "gulp-peg": "^0.2.0", + "gulp-plumber": "^1.1.0", "gulp-rename": "^1.2.2", - "gulp-replace": "^0.5.4", "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.4.1", - "gulp-util": "^3.0.6", - "lodash": "^3.10.1", - "map-stream": "0.0.6", - "reactify": "^1.1.1", + "gulp-util": "^3.0.7", + "lodash": "^4.5.1", "uglifyify": "^3.0.1", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", - "vinyl-transform": "^1.0.0", - "watchify": "^3.4.0" + "watchify": "^3.7.0" } } diff --git a/web/src/css/layout.less b/web/src/css/layout.less index 1075d6c96..ed4adb698 100644 --- a/web/src/css/layout.less +++ b/web/src/css/layout.less @@ -1,4 +1,4 @@ -html, body, #container { +html, body, #container, #mitmproxy { height: 100%; margin: 0; overflow: hidden; diff --git a/web/src/js/app.js b/web/src/js/app.js index 9fb868b80..e21fa499a 100644 --- a/web/src/js/app.js +++ b/web/src/js/app.js @@ -1,9 +1,9 @@ -var React = require("react"); -var ReactRouter = require("react-router"); -var $ = require("jquery"); -var Connection = require("./connection"); -var proxyapp = require("./components/proxyapp.js"); -var EventLogActions = require("./actions.js").EventLogActions; +import React from "react" +import { render } from 'react-dom' +import $ from "jquery" +import Connection from "./connection" +import {app} from "./components/proxyapp.js" +import { EventLogActions } from "./actions.js" $(function () { window.ws = new Connection("/updates"); @@ -12,8 +12,6 @@ $(function () { EventLogActions.add_event(msg); }; - ReactRouter.run(proxyapp.routes, function (Handler, state) { - React.render(, document.body); - }); + render(app, document.getElementById("mitmproxy")); }); diff --git a/web/src/js/components/common.js b/web/src/js/components/common.js index 965ae9a76..03b2ef8c7 100644 --- a/web/src/js/components/common.js +++ b/web/src/js/components/common.js @@ -1,11 +1,12 @@ var React = require("react"); +var ReactDOM = require("react-dom"); 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 = { +export var AutoScrollMixin = { componentWillUpdate: function () { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); this._shouldScrollBottom = ( node.scrollTop !== 0 && node.scrollTop + node.clientHeight === node.scrollHeight @@ -13,23 +14,23 @@ var AutoScrollMixin = { }, componentDidUpdate: function () { if (this._shouldScrollBottom) { - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); node.scrollTop = node.scrollHeight; } }, }; -var StickyHeadMixin = { +export var StickyHeadMixin = { adjustHead: function () { // Abusing CSS transforms to set the element // referenced as head into some kind of position:sticky. - var head = this.refs.head.getDOMNode(); - head.style.transform = "translate(0," + this.getDOMNode().scrollTop + "px)"; + var head = this.refs.head; + head.style.transform = "translate(0," + ReactDOM.findDOMNode(this).scrollTop + "px)"; } }; -var SettingsState = { +export var SettingsState = { contextTypes: { settingsStore: React.PropTypes.object.isRequired }, @@ -52,58 +53,62 @@ var SettingsState = { }; -var ChildFocus = { +export var ChildFocus = { contextTypes: { returnFocus: React.PropTypes.func }, returnFocus: function(){ - React.findDOMNode(this).blur(); + ReactDOM.findDOMNode(this).blur(); window.getSelection().removeAllRanges(); this.context.returnFocus(); } }; -var Navigation = _.extend({}, ReactRouter.Navigation, { +export var Navigation = { + contextTypes: { + routerFoo: React.PropTypes.object, + router: React.PropTypes.object.isRequired + }, setQuery: function (dict) { - var q = this.context.router.getCurrentQuery(); + var q = this.context.routerFoo.location.query; for (var i in dict) { if (dict.hasOwnProperty(i)) { q[i] = dict[i] || undefined; //falsey values shall be removed. } } - this.replaceWith(this.context.router.getCurrentPath(), this.context.router.getCurrentParams(), q); + this.replaceWith(undefined, q); }, - replaceWith: function (routeNameOrPath, params, query) { - if (routeNameOrPath === undefined) { - routeNameOrPath = this.context.router.getCurrentPath(); - } - if (params === undefined) { - params = this.context.router.getCurrentParams(); + replaceWith: function (pathname, query) { + if (pathname === undefined) { + pathname = this.context.routerFoo.location.pathname; } if (query === undefined) { - query = this.context.router.getCurrentQuery(); + query = this.context.routerFoo.query; } - - this.context.router.replaceWith(routeNameOrPath, params, query); + console.log({ pathname, query }); + this.context.router.replace({ pathname, query }); } -}); +}; // react-router is fairly good at changing its API regularly. // 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, { +export var RouterState = { + contextTypes: { + routerFoo: React.PropTypes.object, + }, getQuery: function () { // 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()); + return _.clone(this.context.routerFoo.location.query); }, getParams: function () { - return _.clone(this.context.router.getCurrentParams()); + return _.clone(this.context.routerFoo.params); } -}); +}; -var Splitter = React.createClass({ +export var Splitter = React.createClass({ getDefaultProps: function () { return { axis: "x" @@ -127,7 +132,7 @@ var Splitter = React.createClass({ window.addEventListener("dragend", this.onDragEnd); }, onDragEnd: function () { - this.getDOMNode().style.transform = ""; + ReactDOM.findDOMNode(this).style.transform = ""; window.removeEventListener("dragend", this.onDragEnd); window.removeEventListener("mouseup", this.onMouseUp); window.removeEventListener("mousemove", this.onMouseMove); @@ -135,7 +140,7 @@ var Splitter = React.createClass({ onMouseUp: function (e) { this.onDragEnd(); - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); var prev = node.previousElementSibling; var next = node.nextElementSibling; @@ -163,7 +168,7 @@ var Splitter = React.createClass({ } else { dY = e.pageY - this.state.startY; } - this.getDOMNode().style.transform = "translate(" + dX + "px," + dY + "px)"; + ReactDOM.findDOMNode(this).style.transform = "translate(" + dX + "px," + dY + "px)"; }, onResize: function () { // Trigger a global resize event. This notifies components that employ virtual scrolling @@ -176,7 +181,7 @@ var Splitter = React.createClass({ if (!this.state.applied) { return; } - var node = this.getDOMNode(); + var node = ReactDOM.findDOMNode(this); var prev = node.previousElementSibling; var next = node.nextElementSibling; @@ -206,14 +211,4 @@ var Splitter = React.createClass({ ); } -}); - -module.exports = { - ChildFocus: ChildFocus, - RouterState: RouterState, - Navigation: Navigation, - StickyHeadMixin: StickyHeadMixin, - AutoScrollMixin: AutoScrollMixin, - Splitter: Splitter, - SettingsState: SettingsState -}; \ No newline at end of file +}); \ No newline at end of file diff --git a/web/src/js/components/editor.js b/web/src/js/components/editor.js index f2d445667..62c5310cb 100644 --- a/web/src/js/components/editor.js +++ b/web/src/js/components/editor.js @@ -1,4 +1,5 @@ var React = require("react"); +var ReactDOM = require('react-dom'); var common = require("./common.js"); var utils = require("../utils.js"); @@ -98,12 +99,12 @@ var EditorBase = React.createClass({ range = document.caretRangeFromPoint(e.clientX, e.clientY); } else { range = document.createRange(); - range.selectNodeContents(React.findDOMNode(this)); + range.selectNodeContents(ReactDOM.findDOMNode(this)); } this._ignore_events = true; this.setState({editable: true}, function () { - var node = React.findDOMNode(this); + var node = ReactDOM.findDOMNode(this); node.blur(); node.focus(); this._ignore_events = false; @@ -117,7 +118,7 @@ var EditorBase = React.createClass({ // 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(); + ReactDOM.findDOMNode(this).blur(); this.props.onStop && this.props.onStop(); }, _stop: function (e) { @@ -126,14 +127,14 @@ var EditorBase = React.createClass({ } console.log("_stop", _.extend({}, e)); window.getSelection().removeAllRanges(); //make sure that selection is cleared on blur - var node = React.findDOMNode(this); + var node = ReactDOM.findDOMNode(this); var content = this.props.nodeToContent(node); this.setState({editable: false}); this.props.onDone(content); this.props.onBlur && this.props.onBlur(e); }, reset: function () { - React.findDOMNode(this).innerHTML = this.props.contentToHtml(this.props.content); + ReactDOM.findDOMNode(this).innerHTML = this.props.contentToHtml(this.props.content); }, onKeyDown: function (e) { e.stopPropagation(); @@ -154,7 +155,7 @@ var EditorBase = React.createClass({ } }, onInput: function () { - var node = React.findDOMNode(this); + var node = ReactDOM.findDOMNode(this); var content = this.props.nodeToContent(node); this.props.onInput && this.props.onInput(content); } @@ -228,7 +229,7 @@ var ValueEditor = React.createClass({ />; }, focus: function () { - React.findDOMNode(this).focus(); + ReactDOM.findDOMNode(this).focus(); }, onStop: function () { this.returnFocus(); diff --git a/web/src/js/components/eventlog.js b/web/src/js/components/eventlog.js index fea7b2471..9dcd2c386 100644 --- a/web/src/js/components/eventlog.js +++ b/web/src/js/components/eventlog.js @@ -1,7 +1,7 @@ var React = require("react"); var common = require("./common.js"); var Query = require("../actions.js").Query; -var VirtualScrollMixin = require("./virtualscroll.js"); +import { VirtualScrollMixin } from "./virtualscroll.js" var views = require("../store/view.js"); var _ = require("lodash"); diff --git a/web/src/js/components/flowtable.js b/web/src/js/components/flowtable.js index 609034f68..b27ed30d3 100644 --- a/web/src/js/components/flowtable.js +++ b/web/src/js/components/flowtable.js @@ -1,9 +1,10 @@ var React = require("react"); +var ReactDOM = require('react-dom'); var common = require("./common.js"); var utils = require("../utils.js"); var _ = require("lodash"); -var VirtualScrollMixin = require("./virtualscroll.js"); +import { VirtualScrollMixin } from "./virtualscroll.js" var flowtable_columns = require("./flowtable-columns.js"); var FlowRow = React.createClass({ @@ -143,7 +144,7 @@ var FlowTable = React.createClass({ scrollIntoView: function (flow) { this.scrollRowIntoView( this.context.view.index(flow), - this.refs.body.getDOMNode().offsetTop + ReactDOM.findDOMNode(this.refs.body).offsetTop ); }, renderRow: function (flow) { diff --git a/web/src/js/components/flowview/index.js b/web/src/js/components/flowview/index.js index 739a46dc6..91b17dd23 100644 --- a/web/src/js/components/flowview/index.js +++ b/web/src/js/components/flowview/index.js @@ -40,13 +40,7 @@ var FlowView = React.createClass({ this.selectTab(tabs[nextIndex]); }, selectTab: function (panel) { - this.replaceWith( - "flow", - { - flowId: this.getParams().flowId, - detailTab: panel - } - ); + this.replaceWith(`/flows/${this.getParams().flowId}/${panel}`); }, getActive: function(){ return this.getParams().detailTab; @@ -93,7 +87,7 @@ var FlowView = React.createClass({ var tabs = this.getTabs(flow); var active = this.getActive(); - if (!_.contains(tabs, active)) { + if (tabs.indexOf(active) < 0) { if (active === "response" && flow.error) { active = "error"; } else if (active === "error" && flow.response) { diff --git a/web/src/js/components/flowview/messages.js b/web/src/js/components/flowview/messages.js index 7ac95d850..c11ee46fe 100644 --- a/web/src/js/components/flowview/messages.js +++ b/web/src/js/components/flowview/messages.js @@ -1,4 +1,5 @@ var React = require("react"); +var ReactDOM = require('react-dom'); var _ = require("lodash"); var common = require("../common.js"); @@ -98,7 +99,7 @@ var HeaderEditor = React.createClass({ return ; }, focus: function () { - this.getDOMNode().focus(); + ReactDOM.findDOMNode(this).focus(); }, onKeyDown: function (e) { switch (e.keyCode) { diff --git a/web/src/js/components/header.js b/web/src/js/components/header.js index 998a41df1..f2cc3fc53 100644 --- a/web/src/js/components/header.js +++ b/web/src/js/components/header.js @@ -1,4 +1,5 @@ var React = require("react"); +var ReactDOM = require('react-dom'); var $ = require("jquery"); var Filt = require("../filt/filt.js"); @@ -76,26 +77,24 @@ var FilterInput = React.createClass({ }, isValid: function (filt) { try { - Filt.parse(filt || this.state.value); + var str = filt || this.state.value; + if(str){ + Filt.parse(filt || this.state.value); + } return true; } catch (e) { return false; } }, getDesc: function () { - var desc; - try { - desc = Filt.parse(this.state.value).desc; - } catch (e) { - desc = "" + e; - } - if (desc !== "true") { - return desc; - } else { - return ( - - ); + if(this.state.value) { + try { + return Filt.parse(this.state.value).desc; + } catch (e) { + return "" + e; + } } + return ; }, onFocus: function () { this.setState({focus: true}); @@ -118,11 +117,11 @@ var FilterInput = React.createClass({ e.stopPropagation(); }, blur: function () { - this.refs.input.getDOMNode().blur(); + ReactDOM.findDOMNode(this.refs.input).blur(); this.returnFocus(); }, select: function () { - this.refs.input.getDOMNode().select(); + ReactDOM.findDOMNode(this.refs.input).select(); }, render: function () { var isValid = this.isValid(); diff --git a/web/src/js/components/mainview.js b/web/src/js/components/mainview.js index 9ff51dfa4..86666e398 100644 --- a/web/src/js/components/mainview.js +++ b/web/src/js/components/mainview.js @@ -42,7 +42,8 @@ var MainView = React.createClass({ }, getViewFilt: function () { try { - var filt = Filt.parse(this.getQuery()[Query.SEARCH] || ""); + var filtStr = this.getQuery()[Query.SEARCH]; + var filt = filtStr ? Filt.parse(filtStr) : function(){return true}; var highlightStr = this.getQuery()[Query.HIGHLIGHT]; var highlight = highlightStr ? Filt.parse(highlightStr) : false; } catch (e) { @@ -90,16 +91,11 @@ var MainView = React.createClass({ }, selectFlow: function (flow) { if (flow) { - this.replaceWith( - "flow", - { - flowId: flow.id, - detailTab: this.getParams().detailTab || "request" - } - ); + var tab = this.getParams().detailTab || "request"; + this.replaceWith(`/flows/${flow.id}/${tab}`); this.refs.flowTable.scrollIntoView(flow); } else { - this.replaceWith("flows", {}); + this.replaceWith("/flows"); } }, selectFlowRelative: function (shift) { diff --git a/web/src/js/components/prompt.js b/web/src/js/components/prompt.js index 121a1170a..9695bd948 100644 --- a/web/src/js/components/prompt.js +++ b/web/src/js/components/prompt.js @@ -1,4 +1,5 @@ var React = require("react"); +var ReactDOM = require('react-dom'); var _ = require("lodash"); var utils = require("../utils.js"); @@ -12,7 +13,7 @@ var Prompt = React.createClass({ prompt: React.PropTypes.string }, componentDidMount: function () { - React.findDOMNode(this).focus(); + ReactDOM.findDOMNode(this).focus(); }, onKeyDown: function (e) { e.stopPropagation(); diff --git a/web/src/js/components/proxyapp.js b/web/src/js/components/proxyapp.js index e766d6e60..9c2d87146 100644 --- a/web/src/js/components/proxyapp.js +++ b/web/src/js/components/proxyapp.js @@ -1,4 +1,5 @@ var React = require("react"); +var ReactDOM = require("react-dom"); var ReactRouter = require("react-router"); var _ = require("lodash"); @@ -27,6 +28,7 @@ var ProxyAppMain = React.createClass({ flowStore: React.PropTypes.object.isRequired, eventStore: React.PropTypes.object.isRequired, returnFocus: React.PropTypes.func.isRequired, + routerFoo: React.PropTypes.object, }, componentDidMount: function () { this.focus(); @@ -37,6 +39,10 @@ var ProxyAppMain = React.createClass({ flowStore: this.state.flowStore, eventStore: this.state.eventStore, returnFocus: this.focus, + routerFoo: { + location: this.props.location, + params: this.props.params + } }; }, getInitialState: function () { @@ -53,10 +59,10 @@ var ProxyAppMain = React.createClass({ }; }, focus: function () { - React.findDOMNode(this).focus(); + ReactDOM.findDOMNode(this).focus(); }, getMainComponent: function () { - return this.refs.view.refs.__routeHandler__; + return this.refs.view; }, onKeydown: function (e) { @@ -88,7 +94,7 @@ var ProxyAppMain = React.createClass({ }, render: function () { var eventlog; - if (this.getQuery()[Query.SHOW_EVENTLOG]) { + if (this.props.location.query[Query.SHOW_EVENTLOG]) { eventlog = [ , @@ -96,10 +102,14 @@ var ProxyAppMain = React.createClass({ } else { eventlog = null; } + var children = React.cloneElement( + this.props.children, + { ref: "view", query: this.props.location.query } + ); return (
    - + {children} {eventlog}
    @@ -108,22 +118,15 @@ var ProxyAppMain = React.createClass({ }); -var Route = ReactRouter.Route; -var RouteHandler = ReactRouter.RouteHandler; -var Redirect = ReactRouter.Redirect; -var DefaultRoute = ReactRouter.DefaultRoute; -var NotFoundRoute = ReactRouter.NotFoundRoute; +import { Route, Router, hashHistory, Redirect} from "react-router"; - -var routes = ( - - - - - +export var app = ( + + + + + + -); - -module.exports = { - routes: routes -}; \ No newline at end of file + +); \ No newline at end of file diff --git a/web/src/js/components/virtualscroll.js b/web/src/js/components/virtualscroll.js index 956e1a0bc..f462fdccf 100644 --- a/web/src/js/components/virtualscroll.js +++ b/web/src/js/components/virtualscroll.js @@ -1,6 +1,7 @@ -var React = require("react"); +import React from "react"; +import ReactDOM from "react-dom"; -var VirtualScrollMixin = { +export var VirtualScrollMixin = { getInitialState: function () { return { start: 0, @@ -43,7 +44,7 @@ var VirtualScrollMixin = { window.removeEventListener('resize', this.onScroll); }, onScroll: function () { - var viewport = this.getDOMNode(); + var viewport = ReactDOM.findDOMNode(this); var top = viewport.scrollTop; var height = viewport.offsetHeight; var start = Math.floor(top / this.props.rowHeight); @@ -69,7 +70,7 @@ var VirtualScrollMixin = { var row_top = (index * this.props.rowHeight) + head_height; var row_bottom = row_top + this.props.rowHeight; - var viewport = this.getDOMNode(); + var viewport = ReactDOM.findDOMNode(this); var viewport_top = viewport.scrollTop; var viewport_bottom = viewport_top + viewport.offsetHeight; @@ -81,5 +82,3 @@ var VirtualScrollMixin = { } }, }; - -module.exports = VirtualScrollMixin; \ No newline at end of file diff --git a/web/src/js/filt/filt.js b/web/src/js/filt/filt.js index 45b42f3ab..6a0bbab70 100644 --- a/web/src/js/filt/filt.js +++ b/web/src/js/filt/filt.js @@ -1,8 +1,10 @@ module.exports = (function() { + "use strict"; + /* - * Generated by PEG.js 0.8.0. + * Generated by PEG.js 0.9.0. * - * http://pegjs.majda.cz/ + * http://pegjs.org/ */ function peg$subclass(child, parent) { @@ -11,21 +13,23 @@ module.exports = (function() { child.prototype = new ctor(); } - function SyntaxError(message, expected, found, offset, line, column) { + function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; - this.offset = offset; - this.line = line; - this.column = column; - + this.location = location; this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } } - peg$subclass(SyntaxError, Error); + peg$subclass(peg$SyntaxError, Error); - function parse(input) { + function peg$parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, + parser = this, peg$FAILED = {}, @@ -33,117 +37,111 @@ module.exports = (function() { peg$startRuleFunction = peg$parsestart, peg$c0 = { type: "other", description: "filter expression" }, - peg$c1 = peg$FAILED, - peg$c2 = function(orExpr) { return orExpr; }, - peg$c3 = [], - peg$c4 = function() {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]" }, - peg$c8 = { type: "other", description: "control character" }, - peg$c9 = /^[|&!()~"]/, - peg$c10 = { type: "class", value: "[|&!()~\"]", description: "[|&!()~\"]" }, - 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$c15 = "&", - peg$c16 = { type: "literal", value: "&", description: "\"&\"" }, - peg$c17 = function(first, second) { return and(first, second); }, - peg$c18 = "!", - peg$c19 = { type: "literal", value: "!", description: "\"!\"" }, - peg$c20 = function(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$c26 = "~a", - peg$c27 = { type: "literal", value: "~a", description: "\"~a\"" }, - peg$c28 = function() { return assetFilter; }, - peg$c29 = "~e", - peg$c30 = { type: "literal", value: "~e", description: "\"~e\"" }, - peg$c31 = function() { return errorFilter; }, - peg$c32 = "~q", - peg$c33 = { type: "literal", value: "~q", description: "\"~q\"" }, - peg$c34 = function() { return noResponseFilter; }, - peg$c35 = "~s", - peg$c36 = { type: "literal", value: "~s", description: "\"~s\"" }, - peg$c37 = function() { return responseFilter; }, - peg$c38 = "true", - peg$c39 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c40 = function() { return trueFilter; }, - peg$c41 = "false", - peg$c42 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c43 = function() { return falseFilter; }, - peg$c44 = "~c", - peg$c45 = { type: "literal", value: "~c", description: "\"~c\"" }, - peg$c46 = function(s) { return responseCode(s); }, - peg$c47 = "~d", - peg$c48 = { type: "literal", value: "~d", description: "\"~d\"" }, - peg$c49 = function(s) { return domain(s); }, - peg$c50 = "~h", - peg$c51 = { type: "literal", value: "~h", description: "\"~h\"" }, - peg$c52 = function(s) { return header(s); }, - peg$c53 = "~hq", - peg$c54 = { type: "literal", value: "~hq", description: "\"~hq\"" }, - peg$c55 = function(s) { return requestHeader(s); }, - peg$c56 = "~hs", - peg$c57 = { type: "literal", value: "~hs", description: "\"~hs\"" }, - peg$c58 = function(s) { return responseHeader(s); }, - peg$c59 = "~m", - peg$c60 = { type: "literal", value: "~m", description: "\"~m\"" }, - peg$c61 = function(s) { return method(s); }, - peg$c62 = "~t", - peg$c63 = { type: "literal", value: "~t", description: "\"~t\"" }, - peg$c64 = function(s) { return contentType(s); }, - peg$c65 = "~tq", - peg$c66 = { type: "literal", value: "~tq", description: "\"~tq\"" }, - peg$c67 = function(s) { return requestContentType(s); }, - peg$c68 = "~ts", - peg$c69 = { type: "literal", value: "~ts", description: "\"~ts\"" }, - peg$c70 = function(s) { return responseContentType(s); }, - peg$c71 = "~u", - peg$c72 = { type: "literal", value: "~u", description: "\"~u\"" }, - peg$c73 = function(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$c81 = { type: "other", description: "string" }, - peg$c82 = "\"", - peg$c83 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c84 = function(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$c92 = "\\", - peg$c93 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c94 = /^['\\]/, - peg$c95 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, - peg$c96 = /^['"\\]/, - peg$c97 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, - peg$c98 = "n", - peg$c99 = { type: "literal", value: "n", description: "\"n\"" }, - peg$c100 = function() { return "\n"; }, - peg$c101 = "r", - peg$c102 = { type: "literal", value: "r", description: "\"r\"" }, - peg$c103 = function() { return "\r"; }, - peg$c104 = "t", - peg$c105 = { type: "literal", value: "t", description: "\"t\"" }, - peg$c106 = function() { return "\t"; }, + peg$c1 = function(orExpr) { return orExpr; }, + peg$c2 = { type: "other", description: "whitespace" }, + peg$c3 = /^[ \t\n\r]/, + peg$c4 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, + peg$c5 = { type: "other", description: "control character" }, + peg$c6 = /^[|&!()~"]/, + peg$c7 = { type: "class", value: "[|&!()~\"]", description: "[|&!()~\"]" }, + peg$c8 = { type: "other", description: "optional whitespace" }, + peg$c9 = "|", + peg$c10 = { type: "literal", value: "|", description: "\"|\"" }, + peg$c11 = function(first, second) { return or(first, second); }, + peg$c12 = "&", + peg$c13 = { type: "literal", value: "&", description: "\"&\"" }, + peg$c14 = function(first, second) { return and(first, second); }, + peg$c15 = "!", + peg$c16 = { type: "literal", value: "!", description: "\"!\"" }, + peg$c17 = function(expr) { return not(expr); }, + peg$c18 = "(", + peg$c19 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c20 = ")", + peg$c21 = { type: "literal", value: ")", description: "\")\"" }, + peg$c22 = function(expr) { return binding(expr); }, + peg$c23 = "~a", + peg$c24 = { type: "literal", value: "~a", description: "\"~a\"" }, + peg$c25 = function() { return assetFilter; }, + peg$c26 = "~e", + peg$c27 = { type: "literal", value: "~e", description: "\"~e\"" }, + peg$c28 = function() { return errorFilter; }, + peg$c29 = "~q", + peg$c30 = { type: "literal", value: "~q", description: "\"~q\"" }, + peg$c31 = function() { return noResponseFilter; }, + peg$c32 = "~s", + peg$c33 = { type: "literal", value: "~s", description: "\"~s\"" }, + peg$c34 = function() { return responseFilter; }, + peg$c35 = "true", + peg$c36 = { type: "literal", value: "true", description: "\"true\"" }, + peg$c37 = function() { return trueFilter; }, + peg$c38 = "false", + peg$c39 = { type: "literal", value: "false", description: "\"false\"" }, + peg$c40 = function() { return falseFilter; }, + peg$c41 = "~c", + peg$c42 = { type: "literal", value: "~c", description: "\"~c\"" }, + peg$c43 = function(s) { return responseCode(s); }, + peg$c44 = "~d", + peg$c45 = { type: "literal", value: "~d", description: "\"~d\"" }, + peg$c46 = function(s) { return domain(s); }, + peg$c47 = "~h", + peg$c48 = { type: "literal", value: "~h", description: "\"~h\"" }, + peg$c49 = function(s) { return header(s); }, + peg$c50 = "~hq", + peg$c51 = { type: "literal", value: "~hq", description: "\"~hq\"" }, + peg$c52 = function(s) { return requestHeader(s); }, + peg$c53 = "~hs", + peg$c54 = { type: "literal", value: "~hs", description: "\"~hs\"" }, + peg$c55 = function(s) { return responseHeader(s); }, + peg$c56 = "~m", + peg$c57 = { type: "literal", value: "~m", description: "\"~m\"" }, + peg$c58 = function(s) { return method(s); }, + peg$c59 = "~t", + peg$c60 = { type: "literal", value: "~t", description: "\"~t\"" }, + peg$c61 = function(s) { return contentType(s); }, + peg$c62 = "~tq", + peg$c63 = { type: "literal", value: "~tq", description: "\"~tq\"" }, + peg$c64 = function(s) { return requestContentType(s); }, + peg$c65 = "~ts", + peg$c66 = { type: "literal", value: "~ts", description: "\"~ts\"" }, + peg$c67 = function(s) { return responseContentType(s); }, + peg$c68 = "~u", + peg$c69 = { type: "literal", value: "~u", description: "\"~u\"" }, + peg$c70 = function(s) { return url(s); }, + peg$c71 = { type: "other", description: "integer" }, + peg$c72 = /^['"]/, + peg$c73 = { type: "class", value: "['\"]", description: "['\"]" }, + peg$c74 = /^[0-9]/, + peg$c75 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c76 = function(digits) { return parseInt(digits.join(""), 10); }, + peg$c77 = { type: "other", description: "string" }, + peg$c78 = "\"", + peg$c79 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c80 = function(chars) { return chars.join(""); }, + peg$c81 = "'", + peg$c82 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c83 = /^["\\]/, + peg$c84 = { type: "class", value: "[\"\\\\]", description: "[\"\\\\]" }, + peg$c85 = { type: "any", description: "any character" }, + peg$c86 = function(char) { return char; }, + peg$c87 = "\\", + peg$c88 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c89 = /^['\\]/, + peg$c90 = { type: "class", value: "['\\\\]", description: "['\\\\]" }, + peg$c91 = /^['"\\]/, + peg$c92 = { type: "class", value: "['\"\\\\]", description: "['\"\\\\]" }, + peg$c93 = "n", + peg$c94 = { type: "literal", value: "n", description: "\"n\"" }, + peg$c95 = function() { return "\n"; }, + peg$c96 = "r", + peg$c97 = { type: "literal", value: "r", description: "\"r\"" }, + peg$c98 = function() { return "\r"; }, + peg$c99 = "t", + peg$c100 = { type: "literal", value: "t", description: "\"t\"" }, + peg$c101 = function() { return "\t"; }, peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, @@ -159,38 +157,51 @@ module.exports = (function() { } function text() { - return input.substring(peg$reportedPos, peg$currPos); + return input.substring(peg$savedPos, peg$currPos); } - function offset() { - return peg$reportedPos; - } - - function line() { - return peg$computePosDetails(peg$reportedPos).line; - } - - function column() { - return peg$computePosDetails(peg$reportedPos).column; + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description) { throw peg$buildException( null, [{ type: "other", description: description }], - peg$reportedPos + input.substring(peg$savedPos, peg$currPos), + peg$computeLocation(peg$savedPos, peg$currPos) ); } function error(message) { - throw peg$buildException(message, null, peg$reportedPos); + throw peg$buildException( + message, + null, + input.substring(peg$savedPos, peg$currPos), + peg$computeLocation(peg$savedPos, peg$currPos) + ); } function peg$computePosDetails(pos) { - function advance(details, startPos, endPos) { - var p, ch; + var details = peg$posDetailsCache[pos], + p, ch; - for (p = startPos; p < endPos; p++) { + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column, + seenCR: details.seenCR + }; + + while (p < pos) { ch = input.charAt(p); if (ch === "\n") { if (!details.seenCR) { details.line++; } @@ -204,19 +215,31 @@ module.exports = (function() { details.column++; details.seenCR = false; } - } - } - if (peg$cachedPos !== pos) { - if (peg$cachedPos > pos) { - peg$cachedPos = 0; - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; + p++; } - advance(peg$cachedPosDetails, peg$cachedPos, pos); - peg$cachedPos = pos; - } - return peg$cachedPosDetails; + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; } function peg$fail(expected) { @@ -230,7 +253,7 @@ module.exports = (function() { peg$maxFailExpected.push(expected); } - function peg$buildException(message, expected, pos) { + function peg$buildException(message, expected, found, location) { function cleanupExpected(expected) { var i = 1; @@ -267,8 +290,8 @@ module.exports = (function() { .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); }); + .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) + .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); } var expectedDescs = new Array(expected.length), @@ -289,20 +312,15 @@ module.exports = (function() { return "Expected " + expectedDesc + " but " + foundDesc + " found."; } - var posDetails = peg$computePosDetails(pos), - found = pos < input.length ? input.charAt(pos) : null; - if (expected !== null) { cleanupExpected(expected); } - return new SyntaxError( + return new peg$SyntaxError( message !== null ? message : buildMessage(expected, found), expected, found, - pos, - posDetails.line, - posDetails.column + location ); } @@ -317,29 +335,20 @@ module.exports = (function() { if (s2 !== peg$FAILED) { s3 = peg$parse__(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c2(s2); + peg$savedPos = s0; + s1 = peg$c1(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c4(); - } - s0 = s1; + s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { @@ -353,6 +362,26 @@ module.exports = (function() { function peg$parsews() { var s0, s1; + peg$silentFails++; + if (peg$c3.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c4); } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } + + return s0; + } + + function peg$parsecc() { + var s0, s1; + peg$silentFails++; if (peg$c6.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); @@ -370,26 +399,6 @@ module.exports = (function() { return s0; } - function peg$parsecc() { - var s0, s1; - - peg$silentFails++; - if (peg$c9.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - 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); } - } - - return s0; - } - function peg$parse__() { var s0, s1; @@ -403,7 +412,7 @@ 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$c8); } } return s0; @@ -418,39 +427,39 @@ module.exports = (function() { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 124) { - s3 = peg$c12; + s3 = peg$c9; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parseOrExpr(); if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c14(s1, s5); + peg$savedPos = s0; + s1 = peg$c11(s1, s5); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseAndExpr(); @@ -468,39 +477,39 @@ module.exports = (function() { s2 = peg$parse__(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 38) { - s3 = peg$c15; + s3 = peg$c12; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { s4 = peg$parse__(); if (s4 !== peg$FAILED) { s5 = peg$parseAndExpr(); if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c17(s1, s5); + peg$savedPos = s0; + s1 = peg$c14(s1, s5); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -514,25 +523,25 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseAndExpr(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c17(s1, s3); + peg$savedPos = s0; + s1 = peg$c14(s1, s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseNotExpr(); @@ -547,31 +556,31 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 33) { - s1 = peg$c18; + s1 = peg$c15; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); if (s2 !== peg$FAILED) { s3 = peg$parseNotExpr(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c20(s3); + peg$savedPos = s0; + s1 = peg$c17(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseBindingExpr(); @@ -585,11 +594,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c21; + s1 = peg$c18; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c22); } + if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s1 !== peg$FAILED) { s2 = peg$parse__(); @@ -599,35 +608,35 @@ module.exports = (function() { s4 = peg$parse__(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c23; + s5 = peg$c20; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c25(s3); + peg$savedPos = s0; + s1 = peg$c22(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parseExpr(); @@ -653,58 +662,58 @@ module.exports = (function() { s0 = peg$parseBooleanLiteral(); if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c26) { - s1 = peg$c26; + if (input.substr(peg$currPos, 2) === peg$c23) { + s1 = peg$c23; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c24); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c28(); + peg$savedPos = s0; + s1 = peg$c25(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c29) { - s1 = peg$c29; + if (input.substr(peg$currPos, 2) === peg$c26) { + s1 = peg$c26; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c31(); + peg$savedPos = s0; + s1 = peg$c28(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c32) { - s1 = peg$c32; + if (input.substr(peg$currPos, 2) === peg$c29) { + s1 = peg$c29; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { peg$fail(peg$c30); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(); + peg$savedPos = s0; + s1 = peg$c31(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c35) { - s1 = peg$c35; + if (input.substr(peg$currPos, 2) === peg$c32) { + s1 = peg$c32; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c37(); + peg$savedPos = s0; + s1 = peg$c34(); } s0 = s1; } @@ -719,30 +728,30 @@ module.exports = (function() { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c38) { - s1 = peg$c38; + if (input.substr(peg$currPos, 4) === peg$c35) { + s1 = peg$c35; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } + if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c40(); + peg$savedPos = s0; + s1 = peg$c37(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c41) { - s1 = peg$c41; + if (input.substr(peg$currPos, 5) === peg$c38) { + s1 = peg$c38; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c39); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c43(); + peg$savedPos = s0; + s1 = peg$c40(); } s0 = s1; } @@ -754,12 +763,12 @@ module.exports = (function() { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c44) { - s1 = peg$c44; + if (input.substr(peg$currPos, 2) === peg$c41) { + s1 = peg$c41; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s1 !== peg$FAILED) { s2 = []; @@ -770,34 +779,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseIntegerLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c46(s3); + peg$savedPos = s0; + s1 = peg$c43(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c47) { - s1 = peg$c47; + if (input.substr(peg$currPos, 2) === peg$c44) { + s1 = peg$c44; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { s2 = []; @@ -808,34 +817,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c49(s3); + peg$savedPos = s0; + s1 = peg$c46(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c50) { - s1 = peg$c50; + if (input.substr(peg$currPos, 2) === peg$c47) { + s1 = peg$c47; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { peg$fail(peg$c48); } } if (s1 !== peg$FAILED) { s2 = []; @@ -846,34 +855,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c52(s3); + peg$savedPos = s0; + s1 = peg$c49(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c53) { - s1 = peg$c53; + if (input.substr(peg$currPos, 3) === peg$c50) { + s1 = peg$c50; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c54); } + if (peg$silentFails === 0) { peg$fail(peg$c51); } } if (s1 !== peg$FAILED) { s2 = []; @@ -884,34 +893,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c55(s3); + peg$savedPos = s0; + s1 = peg$c52(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c56) { - s1 = peg$c56; + if (input.substr(peg$currPos, 3) === peg$c53) { + s1 = peg$c53; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { s2 = []; @@ -922,34 +931,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c58(s3); + peg$savedPos = s0; + s1 = peg$c55(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c59) { - s1 = peg$c59; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } + if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s1 !== peg$FAILED) { s2 = []; @@ -960,34 +969,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c61(s3); + peg$savedPos = s0; + s1 = peg$c58(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c62) { - s1 = peg$c62; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { s2 = []; @@ -998,34 +1007,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c64(s3); + peg$savedPos = s0; + s1 = peg$c61(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c65) { - s1 = peg$c65; + if (input.substr(peg$currPos, 3) === peg$c62) { + s1 = peg$c62; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1036,34 +1045,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c67(s3); + peg$savedPos = s0; + s1 = peg$c64(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c68) { - s1 = peg$c68; + if (input.substr(peg$currPos, 3) === peg$c65) { + s1 = peg$c65; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c69); } + if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1074,34 +1083,34 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c70(s3); + peg$savedPos = s0; + s1 = peg$c67(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c71) { - s1 = peg$c71; + if (input.substr(peg$currPos, 2) === peg$c68) { + s1 = peg$c68; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c72); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1112,32 +1121,32 @@ module.exports = (function() { s3 = peg$parsews(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parseStringLiteral(); if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c73(s3); + peg$savedPos = s0; + s1 = peg$c70(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseStringLiteral(); if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c73(s1); + peg$savedPos = s0; + s1 = peg$c70(s1); } s0 = s1; } @@ -1159,70 +1168,70 @@ module.exports = (function() { peg$silentFails++; s0 = peg$currPos; - if (peg$c76.test(input.charAt(peg$currPos))) { + if (peg$c72.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c77); } + if (peg$silentFails === 0) { peg$fail(peg$c73); } } if (s1 === peg$FAILED) { - s1 = peg$c75; + s1 = null; } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c78.test(input.charAt(peg$currPos))) { + if (peg$c74.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c78.test(input.charAt(peg$currPos))) { + if (peg$c74.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { - if (peg$c76.test(input.charAt(peg$currPos))) { + if (peg$c72.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c77); } + if (peg$silentFails === 0) { peg$fail(peg$c73); } } if (s3 === peg$FAILED) { - s3 = peg$c75; + s3 = null; } if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c80(s2); + peg$savedPos = s0; + s1 = peg$c76(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c74); } + if (peg$silentFails === 0) { peg$fail(peg$c71); } } return s0; @@ -1234,11 +1243,11 @@ module.exports = (function() { peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c82; + s1 = peg$c78; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1249,36 +1258,36 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c82; + s3 = peg$c78; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { peg$fail(peg$c79); } } if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c84(s2); + peg$savedPos = s0; + s1 = peg$c80(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c85; + s1 = peg$c81; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1289,27 +1298,27 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c85; + s3 = peg$c81; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c84(s2); + peg$savedPos = s0; + s1 = peg$c80(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; @@ -1318,10 +1327,10 @@ module.exports = (function() { s2 = peg$parsecc(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { s2 = []; @@ -1332,26 +1341,26 @@ module.exports = (function() { s3 = peg$parseUnquotedStringChar(); } } else { - s2 = peg$c1; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c84(s2); + peg$savedPos = s0; + s1 = peg$c80(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c77); } } return s0; @@ -1363,19 +1372,19 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (peg$c88.test(input.charAt(peg$currPos))) { + if (peg$c83.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c89); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -1383,42 +1392,42 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c92; + s1 = peg$c87; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { peg$fail(peg$c88); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } @@ -1431,19 +1440,19 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - if (peg$c94.test(input.charAt(peg$currPos))) { + if (peg$c89.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } + if (peg$silentFails === 0) { peg$fail(peg$c90); } } peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -1451,42 +1460,42 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c92; + s1 = peg$c87; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { peg$fail(peg$c88); } } if (s1 !== peg$FAILED) { s2 = peg$parseEscapeSequence(); if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } @@ -1502,10 +1511,10 @@ module.exports = (function() { s2 = peg$parsews(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c87; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c1; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.length > peg$currPos) { @@ -1513,19 +1522,19 @@ module.exports = (function() { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c91(s2); + peg$savedPos = s0; + s1 = peg$c86(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c1; + s0 = peg$FAILED; } return s0; @@ -1534,53 +1543,53 @@ module.exports = (function() { function peg$parseEscapeSequence() { var s0, s1; - if (peg$c96.test(input.charAt(peg$currPos))) { + if (peg$c91.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c97); } + if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 110) { - s1 = peg$c98; + s1 = peg$c93; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } + if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c100(); + peg$savedPos = s0; + s1 = peg$c95(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 114) { - s1 = peg$c101; + s1 = peg$c96; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c102); } + if (peg$silentFails === 0) { peg$fail(peg$c97); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c103(); + peg$savedPos = s0; + s1 = peg$c98(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 116) { - s1 = peg$c104; + s1 = peg$c99; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } + if (peg$silentFails === 0) { peg$fail(peg$c100); } } if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c106(); + peg$savedPos = s0; + s1 = peg$c101(); } s0 = s1; } @@ -1763,12 +1772,19 @@ module.exports = (function() { peg$fail({ type: "end", description: "end of input" }); } - throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + throw peg$buildException( + null, + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); } } return { - SyntaxError: SyntaxError, - parse: parse + SyntaxError: peg$SyntaxError, + parse: peg$parse }; })(); \ No newline at end of file diff --git a/web/src/js/filt/filt.peg b/web/src/js/filt/filt.peg index 6f9bdac63..ccaaa0729 100644 --- a/web/src/js/filt/filt.peg +++ b/web/src/js/filt/filt.peg @@ -166,7 +166,6 @@ function url(regex){ start "filter expression" = __ orExpr:OrExpr __ { return orExpr; } - / {return trueFilter; } ws "whitespace" = [ \t\n\r] cc "control character" = [|&!()~"] diff --git a/web/src/templates/index.html b/web/src/templates/index.html index 5f2c6d5e0..165d7d3d2 100644 --- a/web/src/templates/index.html +++ b/web/src/templates/index.html @@ -10,5 +10,6 @@ +
    \ No newline at end of file