mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 10:26:23 +00:00
4181 lines
328 KiB
JavaScript
4181 lines
328 KiB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||
var ActionTypes = {
|
||
// Connection
|
||
CONNECTION_OPEN: "connection_open",
|
||
CONNECTION_CLOSE: "connection_close",
|
||
CONNECTION_ERROR: "connection_error",
|
||
|
||
// Stores
|
||
SETTINGS_STORE: "settings",
|
||
EVENT_STORE: "events",
|
||
FLOW_STORE: "flows",
|
||
};
|
||
|
||
var StoreCmds = {
|
||
ADD: "add",
|
||
UPDATE: "update",
|
||
REMOVE: "remove",
|
||
RESET: "reset"
|
||
};
|
||
|
||
var ConnectionActions = {
|
||
open: function () {
|
||
AppDispatcher.dispatchViewAction({
|
||
type: ActionTypes.CONNECTION_OPEN
|
||
});
|
||
},
|
||
close: function () {
|
||
AppDispatcher.dispatchViewAction({
|
||
type: ActionTypes.CONNECTION_CLOSE
|
||
});
|
||
},
|
||
error: function () {
|
||
AppDispatcher.dispatchViewAction({
|
||
type: ActionTypes.CONNECTION_ERROR
|
||
});
|
||
}
|
||
};
|
||
|
||
var SettingsActions = {
|
||
update: function (settings) {
|
||
|
||
jQuery.ajax({
|
||
type: "PUT",
|
||
url: "/settings",
|
||
data: settings
|
||
});
|
||
|
||
/*
|
||
//Facebook Flux: We do an optimistic update on the client already.
|
||
AppDispatcher.dispatchViewAction({
|
||
type: ActionTypes.SETTINGS_STORE,
|
||
cmd: StoreCmds.UPDATE,
|
||
data: settings
|
||
});
|
||
*/
|
||
}
|
||
};
|
||
|
||
var EventLogActions_event_id = 0;
|
||
var EventLogActions = {
|
||
add_event: function (message) {
|
||
AppDispatcher.dispatchViewAction({
|
||
type: ActionTypes.EVENT_STORE,
|
||
cmd: StoreCmds.ADD,
|
||
data: {
|
||
message: message,
|
||
level: "web",
|
||
id: "viewAction-" + EventLogActions_event_id++
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
var FlowActions = {
|
||
accept: function (flow) {
|
||
jQuery.post("/flows/" + flow.id + "/accept");
|
||
},
|
||
accept_all: function(){
|
||
jQuery.post("/flows/accept");
|
||
},
|
||
"delete": function(flow){
|
||
jQuery.ajax({
|
||
type:"DELETE",
|
||
url: "/flows/" + flow.id
|
||
});
|
||
},
|
||
duplicate: function(flow){
|
||
jQuery.post("/flows/" + flow.id + "/duplicate");
|
||
},
|
||
replay: function(flow){
|
||
jQuery.post("/flows/" + flow.id + "/replay");
|
||
},
|
||
revert: function(flow){
|
||
jQuery.post("/flows/" + flow.id + "/revert");
|
||
},
|
||
update: function (flow) {
|
||
AppDispatcher.dispatchViewAction({
|
||
type: ActionTypes.FLOW_STORE,
|
||
cmd: StoreCmds.UPDATE,
|
||
data: flow
|
||
});
|
||
},
|
||
clear: function(){
|
||
jQuery.post("/clear");
|
||
}
|
||
};
|
||
|
||
Query = {
|
||
FILTER: "f",
|
||
HIGHLIGHT: "h",
|
||
SHOW_EVENTLOG: "e"
|
||
};
|
||
|
||
module.exports = {
|
||
ActionTypes: ActionTypes,
|
||
ConnectionActions: ConnectionActions,
|
||
FlowActions: FlowActions,
|
||
StoreCmds: StoreCmds
|
||
|
||
|
||
};
|
||
},{}],2:[function(require,module,exports){
|
||
|
||
var React = require("react");
|
||
var ReactRouter = require("react-router");
|
||
var $ = require("jquery");
|
||
|
||
var Connection = require("./connection");
|
||
var proxyapp = require("./components/proxyapp.jsx.js");
|
||
|
||
$(function () {
|
||
window.ws = new Connection("/updates");
|
||
|
||
ReactRouter.run(proxyapp.routes, function (Handler) {
|
||
React.render(React.createElement(Handler, null), document.body);
|
||
});
|
||
});
|
||
},{"./components/proxyapp.jsx.js":9,"./connection":12,"jquery":"jquery","react":"react","react-router":"react-router"}],3:[function(require,module,exports){
|
||
var React = require("react");
|
||
var _ = require("lodash");
|
||
|
||
var utils = require("./utils.jsx.js");
|
||
var actions = require("../actions.js");
|
||
var flowutils = require("../flow/utils.js");
|
||
var toputils = require("../utils.js");
|
||
|
||
var NavAction = React.createClass({displayName: "NavAction",
|
||
onClick: function (e) {
|
||
e.preventDefault();
|
||
this.props.onClick();
|
||
},
|
||
render: function () {
|
||
return (
|
||
React.createElement("a", {title: this.props.title,
|
||
href: "#",
|
||
className: "nav-action",
|
||
onClick: this.onClick},
|
||
React.createElement("i", {className: "fa fa-fw " + this.props.icon})
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var FlowDetailNav = React.createClass({displayName: "FlowDetailNav",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
|
||
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) {
|
||
this.props.selectTab(e);
|
||
event.preventDefault();
|
||
}.bind(this);
|
||
return React.createElement("a", {key: e,
|
||
href: "#",
|
||
className: className,
|
||
onClick: onClick}, str);
|
||
}.bind(this));
|
||
|
||
var acceptButton = null;
|
||
if(flow.intercepted){
|
||
acceptButton = React.createElement(NavAction, {title: "[a]ccept intercepted flow", icon: "fa-play", onClick: actions.FlowActions.accept.bind(null, flow)});
|
||
}
|
||
var revertButton = null;
|
||
if(flow.modified){
|
||
revertButton = React.createElement(NavAction, {title: "revert changes to flow [V]", icon: "fa-history", onClick: actions.FlowActions.revert.bind(null, flow)});
|
||
}
|
||
|
||
return (
|
||
React.createElement("nav", {ref: "head", className: "nav-tabs nav-tabs-sm"},
|
||
tabs,
|
||
React.createElement(NavAction, {title: "[d]elete flow", icon: "fa-trash", onClick: actions.FlowActions.delete.bind(null, flow)}),
|
||
React.createElement(NavAction, {title: "[D]uplicate flow", icon: "fa-copy", onClick: actions.FlowActions.duplicate.bind(null, flow)}),
|
||
React.createElement(NavAction, {disabled: true, title: "[r]eplay flow", icon: "fa-repeat", onClick: actions.FlowActions.replay.bind(null, flow)}),
|
||
acceptButton,
|
||
revertButton
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var Headers = React.createClass({displayName: "Headers",
|
||
render: function () {
|
||
var rows = this.props.message.headers.map(function (header, i) {
|
||
return (
|
||
React.createElement("tr", {key: i},
|
||
React.createElement("td", {className: "header-name"}, header[0] + ":"),
|
||
React.createElement("td", {className: "header-value"}, header[1])
|
||
)
|
||
);
|
||
});
|
||
return (
|
||
React.createElement("table", {className: "header-table"},
|
||
React.createElement("tbody", null,
|
||
rows
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var FlowDetailRequest = React.createClass({displayName: "FlowDetailRequest",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var first_line = [
|
||
flow.request.method,
|
||
flowutils.RequestUtils.pretty_url(flow.request),
|
||
"HTTP/" + flow.request.httpversion.join(".")
|
||
].join(" ");
|
||
var content = null;
|
||
if (flow.request.contentLength > 0) {
|
||
content = "Request Content Size: " + toputils.formatSize(flow.request.contentLength);
|
||
} else {
|
||
content = React.createElement("div", {className: "alert alert-info"}, "No Content");
|
||
}
|
||
|
||
//TODO: Styling
|
||
|
||
return (
|
||
React.createElement("section", null,
|
||
React.createElement("div", {className: "first-line"}, first_line ),
|
||
React.createElement(Headers, {message: flow.request}),
|
||
React.createElement("hr", null),
|
||
content
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var FlowDetailResponse = React.createClass({displayName: "FlowDetailResponse",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var first_line = [
|
||
"HTTP/" + flow.response.httpversion.join("."),
|
||
flow.response.code,
|
||
flow.response.msg
|
||
].join(" ");
|
||
var content = null;
|
||
if (flow.response.contentLength > 0) {
|
||
content = "Response Content Size: " + toputils.formatSize(flow.response.contentLength);
|
||
} else {
|
||
content = React.createElement("div", {className: "alert alert-info"}, "No Content");
|
||
}
|
||
|
||
//TODO: Styling
|
||
|
||
return (
|
||
React.createElement("section", null,
|
||
React.createElement("div", {className: "first-line"}, first_line ),
|
||
React.createElement(Headers, {message: flow.response}),
|
||
React.createElement("hr", null),
|
||
content
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var FlowDetailError = React.createClass({displayName: "FlowDetailError",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
return (
|
||
React.createElement("section", null,
|
||
React.createElement("div", {className: "alert alert-warning"},
|
||
flow.error.msg,
|
||
React.createElement("div", null,
|
||
React.createElement("small", null, toputils.formatTimeStamp(flow.error.timestamp) )
|
||
)
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var TimeStamp = React.createClass({displayName: "TimeStamp",
|
||
render: function () {
|
||
|
||
if (!this.props.t) {
|
||
//should be return null, but that triggers a React bug.
|
||
return React.createElement("tr", null);
|
||
}
|
||
|
||
var ts = toputils.formatTimeStamp(this.props.t);
|
||
|
||
var delta;
|
||
if (this.props.deltaTo) {
|
||
delta = toputils.formatTimeDelta(1000 * (this.props.t - this.props.deltaTo));
|
||
delta = React.createElement("span", {className: "text-muted"}, "(" + delta + ")");
|
||
} else {
|
||
delta = null;
|
||
}
|
||
|
||
return React.createElement("tr", null,
|
||
React.createElement("td", null, this.props.title + ":"),
|
||
React.createElement("td", null, ts, " ", delta)
|
||
);
|
||
}
|
||
});
|
||
|
||
var ConnectionInfo = React.createClass({displayName: "ConnectionInfo",
|
||
|
||
render: function () {
|
||
var conn = this.props.conn;
|
||
var address = conn.address.address.join(":");
|
||
|
||
var sni = React.createElement("tr", {key: "sni"}); //should be null, but that triggers a React bug.
|
||
if (conn.sni) {
|
||
sni = React.createElement("tr", {key: "sni"},
|
||
React.createElement("td", null,
|
||
React.createElement("abbr", {title: "TLS Server Name Indication"}, "TLS SNI:")
|
||
),
|
||
React.createElement("td", null, conn.sni)
|
||
);
|
||
}
|
||
return (
|
||
React.createElement("table", {className: "connection-table"},
|
||
React.createElement("tbody", null,
|
||
React.createElement("tr", {key: "address"},
|
||
React.createElement("td", null, "Address:"),
|
||
React.createElement("td", null, address)
|
||
),
|
||
sni
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var CertificateInfo = React.createClass({displayName: "CertificateInfo",
|
||
render: function () {
|
||
//TODO: We should fetch human-readable certificate representation
|
||
// from the server
|
||
var flow = this.props.flow;
|
||
var client_conn = flow.client_conn;
|
||
var server_conn = flow.server_conn;
|
||
|
||
var preStyle = {maxHeight: 100};
|
||
return (
|
||
React.createElement("div", null,
|
||
client_conn.cert ? React.createElement("h4", null, "Client Certificate") : null,
|
||
client_conn.cert ? React.createElement("pre", {style: preStyle}, client_conn.cert) : null,
|
||
|
||
server_conn.cert ? React.createElement("h4", null, "Server Certificate") : null,
|
||
server_conn.cert ? React.createElement("pre", {style: preStyle}, server_conn.cert) : null
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var Timing = React.createClass({displayName: "Timing",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var sc = flow.server_conn;
|
||
var cc = flow.client_conn;
|
||
var req = flow.request;
|
||
var resp = flow.response;
|
||
|
||
var timestamps = [
|
||
{
|
||
title: "Server conn. initiated",
|
||
t: sc.timestamp_start,
|
||
deltaTo: req.timestamp_start
|
||
}, {
|
||
title: "Server conn. TCP handshake",
|
||
t: sc.timestamp_tcp_setup,
|
||
deltaTo: req.timestamp_start
|
||
}, {
|
||
title: "Server conn. SSL handshake",
|
||
t: sc.timestamp_ssl_setup,
|
||
deltaTo: req.timestamp_start
|
||
}, {
|
||
title: "Client conn. established",
|
||
t: cc.timestamp_start,
|
||
deltaTo: req.timestamp_start
|
||
}, {
|
||
title: "Client conn. SSL handshake",
|
||
t: cc.timestamp_ssl_setup,
|
||
deltaTo: req.timestamp_start
|
||
}, {
|
||
title: "First request byte",
|
||
t: req.timestamp_start,
|
||
}, {
|
||
title: "Request complete",
|
||
t: req.timestamp_end,
|
||
deltaTo: req.timestamp_start
|
||
}
|
||
];
|
||
|
||
if (flow.response) {
|
||
timestamps.push(
|
||
{
|
||
title: "First response byte",
|
||
t: resp.timestamp_start,
|
||
deltaTo: req.timestamp_start
|
||
}, {
|
||
title: "Response complete",
|
||
t: resp.timestamp_end,
|
||
deltaTo: req.timestamp_start
|
||
}
|
||
);
|
||
}
|
||
|
||
//Add unique key for each row.
|
||
timestamps.forEach(function (e) {
|
||
e.key = e.title;
|
||
});
|
||
|
||
timestamps = _.sortBy(timestamps, 't');
|
||
|
||
var rows = timestamps.map(function (e) {
|
||
return React.createElement(TimeStamp, React.__spread({}, e));
|
||
});
|
||
|
||
return (
|
||
React.createElement("div", null,
|
||
React.createElement("h4", null, "Timing"),
|
||
React.createElement("table", {className: "timing-table"},
|
||
React.createElement("tbody", null,
|
||
rows
|
||
)
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var FlowDetailConnectionInfo = React.createClass({displayName: "FlowDetailConnectionInfo",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var client_conn = flow.client_conn;
|
||
var server_conn = flow.server_conn;
|
||
return (
|
||
React.createElement("section", null,
|
||
|
||
React.createElement("h4", null, "Client Connection"),
|
||
React.createElement(ConnectionInfo, {conn: client_conn}),
|
||
|
||
React.createElement("h4", null, "Server Connection"),
|
||
React.createElement(ConnectionInfo, {conn: server_conn}),
|
||
|
||
React.createElement(CertificateInfo, {flow: flow}),
|
||
|
||
React.createElement(Timing, {flow: flow})
|
||
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var allTabs = {
|
||
request: FlowDetailRequest,
|
||
response: FlowDetailResponse,
|
||
error: FlowDetailError,
|
||
details: FlowDetailConnectionInfo
|
||
};
|
||
|
||
var FlowDetail = React.createClass({displayName: "FlowDetail",
|
||
mixins: [utils.StickyHeadMixin, utils.Navigation, utils.State],
|
||
getTabs: function (flow) {
|
||
var tabs = [];
|
||
["request", "response", "error"].forEach(function (e) {
|
||
if (flow[e]) {
|
||
tabs.push(e);
|
||
}
|
||
});
|
||
tabs.push("details");
|
||
return tabs;
|
||
},
|
||
nextTab: function (i) {
|
||
var tabs = this.getTabs(this.props.flow);
|
||
var currentIndex = tabs.indexOf(this.getParams().detailTab);
|
||
// JS modulo operator doesn't correct negative numbers, make sure that we are positive.
|
||
var nextIndex = (currentIndex + i + tabs.length) % tabs.length;
|
||
this.selectTab(tabs[nextIndex]);
|
||
},
|
||
selectTab: function (panel) {
|
||
this.replaceWith(
|
||
"flow",
|
||
{
|
||
flowId: this.getParams().flowId,
|
||
detailTab: panel
|
||
}
|
||
);
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var tabs = this.getTabs(flow);
|
||
var active = this.getParams().detailTab;
|
||
|
||
if (!_.contains(tabs, active)) {
|
||
if (active === "response" && flow.error) {
|
||
active = "error";
|
||
} else if (active === "error" && flow.response) {
|
||
active = "response";
|
||
} else {
|
||
active = tabs[0];
|
||
}
|
||
this.selectTab(active);
|
||
}
|
||
|
||
var Tab = allTabs[active];
|
||
return (
|
||
React.createElement("div", {className: "flow-detail", onScroll: this.adjustHead},
|
||
React.createElement(FlowDetailNav, {ref: "head",
|
||
flow: flow,
|
||
tabs: tabs,
|
||
active: active,
|
||
selectTab: this.selectTab}),
|
||
React.createElement(Tab, {flow: flow})
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
module.exports = {
|
||
FlowDetail: FlowDetail
|
||
};
|
||
},{"../actions.js":1,"../flow/utils.js":15,"../utils.js":18,"./utils.jsx.js":10,"lodash":"lodash","react":"react"}],4:[function(require,module,exports){
|
||
var React = require("react");
|
||
var flowutils = require("../flow/utils.js");
|
||
var utils = require("../utils.js");
|
||
|
||
var TLSColumn = React.createClass({displayName: "TLSColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "tls", className: "col-tls"});
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var ssl = (flow.request.scheme == "https");
|
||
var classes;
|
||
if (ssl) {
|
||
classes = "col-tls col-tls-https";
|
||
} else {
|
||
classes = "col-tls col-tls-http";
|
||
}
|
||
return React.createElement("td", {className: classes});
|
||
}
|
||
});
|
||
|
||
|
||
var IconColumn = React.createClass({displayName: "IconColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "icon", className: "col-icon"});
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
|
||
var icon;
|
||
if (flow.response) {
|
||
var contentType = flowutils.ResponseUtils.getContentType(flow.response);
|
||
|
||
//TODO: We should assign a type to the flow somewhere else.
|
||
if (flow.response.code == 304) {
|
||
icon = "resource-icon-not-modified";
|
||
} else if (300 <= flow.response.code && flow.response.code < 400) {
|
||
icon = "resource-icon-redirect";
|
||
} else if (contentType && contentType.indexOf("image") >= 0) {
|
||
icon = "resource-icon-image";
|
||
} else if (contentType && contentType.indexOf("javascript") >= 0) {
|
||
icon = "resource-icon-js";
|
||
} else if (contentType && contentType.indexOf("css") >= 0) {
|
||
icon = "resource-icon-css";
|
||
} else if (contentType && contentType.indexOf("html") >= 0) {
|
||
icon = "resource-icon-document";
|
||
}
|
||
}
|
||
if (!icon) {
|
||
icon = "resource-icon-plain";
|
||
}
|
||
|
||
|
||
icon += " resource-icon";
|
||
return React.createElement("td", {className: "col-icon"},
|
||
React.createElement("div", {className: icon})
|
||
);
|
||
}
|
||
});
|
||
|
||
var PathColumn = React.createClass({displayName: "PathColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "path", className: "col-path"}, "Path");
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
return React.createElement("td", {className: "col-path"},
|
||
flow.request.is_replay ? React.createElement("i", {className: "fa fa-fw fa-repeat pull-right"}) : null,
|
||
flow.intercepted ? React.createElement("i", {className: "fa fa-fw fa-pause pull-right"}) : null,
|
||
flow.request.scheme + "://" + flow.request.host + flow.request.path
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
var MethodColumn = React.createClass({displayName: "MethodColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "method", className: "col-method"}, "Method");
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
return React.createElement("td", {className: "col-method"}, flow.request.method);
|
||
}
|
||
});
|
||
|
||
|
||
var StatusColumn = React.createClass({displayName: "StatusColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "status", className: "col-status"}, "Status");
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var status;
|
||
if (flow.response) {
|
||
status = flow.response.code;
|
||
} else {
|
||
status = null;
|
||
}
|
||
return React.createElement("td", {className: "col-status"}, status);
|
||
}
|
||
});
|
||
|
||
|
||
var SizeColumn = React.createClass({displayName: "SizeColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "size", className: "col-size"}, "Size");
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
|
||
var total = flow.request.contentLength;
|
||
if (flow.response) {
|
||
total += flow.response.contentLength || 0;
|
||
}
|
||
var size = utils.formatSize(total);
|
||
return React.createElement("td", {className: "col-size"}, size);
|
||
}
|
||
});
|
||
|
||
|
||
var TimeColumn = React.createClass({displayName: "TimeColumn",
|
||
statics: {
|
||
renderTitle: function () {
|
||
return React.createElement("th", {key: "time", className: "col-time"}, "Time");
|
||
}
|
||
},
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var time;
|
||
if (flow.response) {
|
||
time = utils.formatTimeDelta(1000 * (flow.response.timestamp_end - flow.request.timestamp_start));
|
||
} else {
|
||
time = "...";
|
||
}
|
||
return React.createElement("td", {className: "col-time"}, time);
|
||
}
|
||
});
|
||
|
||
|
||
var all_columns = [
|
||
TLSColumn,
|
||
IconColumn,
|
||
PathColumn,
|
||
MethodColumn,
|
||
StatusColumn,
|
||
SizeColumn,
|
||
TimeColumn];
|
||
|
||
|
||
module.exports = all_columns;
|
||
|
||
|
||
|
||
},{"../flow/utils.js":15,"../utils.js":18,"react":"react"}],5:[function(require,module,exports){
|
||
var React = require("react");
|
||
var utils = require("./utils.jsx.js");
|
||
var VirtualScrollMixin = require("./virtualscroll.jsx.js");
|
||
var flowtable_columns = require("./flowtable-columns.jsx.js");
|
||
|
||
var FlowRow = React.createClass({displayName: "FlowRow",
|
||
render: function () {
|
||
var flow = this.props.flow;
|
||
var columns = this.props.columns.map(function (Column) {
|
||
return React.createElement(Column, {key: Column.displayName, flow: flow});
|
||
}.bind(this));
|
||
var className = "";
|
||
if (this.props.selected) {
|
||
className += " selected";
|
||
}
|
||
if (this.props.highlighted) {
|
||
className += " highlighted";
|
||
}
|
||
if (flow.intercepted) {
|
||
className += " intercepted";
|
||
}
|
||
if (flow.request) {
|
||
className += " has-request";
|
||
}
|
||
if (flow.response) {
|
||
className += " has-response";
|
||
}
|
||
|
||
return (
|
||
React.createElement("tr", {className: className, onClick: this.props.selectFlow.bind(null, flow)},
|
||
columns
|
||
));
|
||
},
|
||
shouldComponentUpdate: function (nextProps) {
|
||
return true;
|
||
// Further optimization could be done here
|
||
// by calling forceUpdate on flow updates, selection changes and column changes.
|
||
//return (
|
||
//(this.props.columns.length !== nextProps.columns.length) ||
|
||
//(this.props.selected !== nextProps.selected)
|
||
//);
|
||
}
|
||
});
|
||
|
||
var FlowTableHead = React.createClass({displayName: "FlowTableHead",
|
||
render: function () {
|
||
var columns = this.props.columns.map(function (column) {
|
||
return column.renderTitle();
|
||
}.bind(this));
|
||
return React.createElement("thead", null,
|
||
React.createElement("tr", null, columns)
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
var ROW_HEIGHT = 32;
|
||
|
||
var FlowTable = React.createClass({displayName: "FlowTable",
|
||
mixins: [utils.StickyHeadMixin, utils.AutoScrollMixin, VirtualScrollMixin],
|
||
getInitialState: function () {
|
||
return {
|
||
columns: flowtable_columns
|
||
};
|
||
},
|
||
componentWillMount: function () {
|
||
if (this.props.view) {
|
||
this.props.view.addListener("add update remove recalculate", this.onChange);
|
||
}
|
||
},
|
||
componentWillReceiveProps: function (nextProps) {
|
||
if (nextProps.view !== this.props.view) {
|
||
if (this.props.view) {
|
||
this.props.view.removeListener("add update remove recalculate");
|
||
}
|
||
nextProps.view.addListener("add update remove recalculate", this.onChange);
|
||
}
|
||
},
|
||
getDefaultProps: function () {
|
||
return {
|
||
rowHeight: ROW_HEIGHT
|
||
};
|
||
},
|
||
onScrollFlowTable: function () {
|
||
this.adjustHead();
|
||
this.onScroll();
|
||
},
|
||
onChange: function () {
|
||
this.forceUpdate();
|
||
},
|
||
scrollIntoView: function (flow) {
|
||
this.scrollRowIntoView(
|
||
this.props.view.index(flow),
|
||
this.refs.body.getDOMNode().offsetTop
|
||
);
|
||
},
|
||
renderRow: function (flow) {
|
||
var selected = (flow === this.props.selected);
|
||
var highlighted =
|
||
(
|
||
this.props.view._highlight &&
|
||
this.props.view._highlight[flow.id]
|
||
);
|
||
|
||
return React.createElement(FlowRow, {key: flow.id,
|
||
ref: flow.id,
|
||
flow: flow,
|
||
columns: this.state.columns,
|
||
selected: selected,
|
||
highlighted: highlighted,
|
||
selectFlow: this.props.selectFlow}
|
||
);
|
||
},
|
||
render: function () {
|
||
//console.log("render flowtable", this.state.start, this.state.stop, this.props.selected);
|
||
var flows = this.props.view ? this.props.view.list : [];
|
||
|
||
var rows = this.renderRows(flows);
|
||
|
||
return (
|
||
React.createElement("div", {className: "flow-table", onScroll: this.onScrollFlowTable},
|
||
React.createElement("table", null,
|
||
React.createElement(FlowTableHead, {ref: "head",
|
||
columns: this.state.columns}),
|
||
React.createElement("tbody", {ref: "body"},
|
||
this.getPlaceholderTop(flows.length),
|
||
rows,
|
||
this.getPlaceholderBottom(flows.length)
|
||
)
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
module.exports = FlowTable;
|
||
|
||
},{"./flowtable-columns.jsx.js":4,"./utils.jsx.js":10,"./virtualscroll.jsx.js":11,"react":"react"}],6:[function(require,module,exports){
|
||
var React = require("react");
|
||
|
||
var Footer = React.createClass({displayName: "Footer",
|
||
render: function () {
|
||
var mode = this.props.settings.mode;
|
||
var intercept = this.props.settings.intercept;
|
||
return (
|
||
React.createElement("footer", null,
|
||
mode != "regular" ? React.createElement("span", {className: "label label-success"}, mode, " mode") : null,
|
||
" ",
|
||
intercept ? React.createElement("span", {className: "label label-success"}, "Intercept: ", intercept) : null
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
module.exports = Footer;
|
||
},{"react":"react"}],7:[function(require,module,exports){
|
||
var React = require("react");
|
||
var $ = require("jquery");
|
||
|
||
var utils = require("./utils.jsx.js");
|
||
|
||
var FilterDocs = React.createClass({displayName: "FilterDocs",
|
||
statics: {
|
||
xhr: false,
|
||
doc: false
|
||
},
|
||
componentWillMount: function () {
|
||
if (!FilterDocs.doc) {
|
||
FilterDocs.xhr = $.getJSON("/filter-help").done(function (doc) {
|
||
FilterDocs.doc = doc;
|
||
FilterDocs.xhr = false;
|
||
});
|
||
}
|
||
if (FilterDocs.xhr) {
|
||
FilterDocs.xhr.done(function () {
|
||
this.forceUpdate();
|
||
}.bind(this));
|
||
}
|
||
},
|
||
render: function () {
|
||
if (!FilterDocs.doc) {
|
||
return React.createElement("i", {className: "fa fa-spinner fa-spin"});
|
||
} else {
|
||
var commands = FilterDocs.doc.commands.map(function (c) {
|
||
return React.createElement("tr", null,
|
||
React.createElement("td", null, c[0].replace(" ", '\u00a0')),
|
||
React.createElement("td", null, c[1])
|
||
);
|
||
});
|
||
commands.push(React.createElement("tr", null,
|
||
React.createElement("td", {colSpan: "2"},
|
||
React.createElement("a", {href: "https://mitmproxy.org/doc/features/filters.html",
|
||
target: "_blank"},
|
||
React.createElement("i", {className: "fa fa-external-link"}),
|
||
" mitmproxy docs")
|
||
)
|
||
));
|
||
return React.createElement("table", {className: "table table-condensed"},
|
||
React.createElement("tbody", null, commands)
|
||
);
|
||
}
|
||
}
|
||
});
|
||
var FilterInput = React.createClass({displayName: "FilterInput",
|
||
getInitialState: function () {
|
||
// Consider both focus and mouseover for showing/hiding the tooltip,
|
||
// because onBlur of the input is triggered before the click on the tooltip
|
||
// finalized, hiding the tooltip just as the user clicks on it.
|
||
return {
|
||
value: this.props.value,
|
||
focus: false,
|
||
mousefocus: false
|
||
};
|
||
},
|
||
componentWillReceiveProps: function (nextProps) {
|
||
this.setState({value: nextProps.value});
|
||
},
|
||
onChange: function (e) {
|
||
var nextValue = e.target.value;
|
||
this.setState({
|
||
value: nextValue
|
||
});
|
||
// Only propagate valid filters upwards.
|
||
if (this.isValid(nextValue)) {
|
||
this.props.onChange(nextValue);
|
||
}
|
||
},
|
||
isValid: function (filt) {
|
||
try {
|
||
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 (
|
||
React.createElement(FilterDocs, null)
|
||
);
|
||
}
|
||
},
|
||
onFocus: function () {
|
||
this.setState({focus: true});
|
||
},
|
||
onBlur: function () {
|
||
this.setState({focus: false});
|
||
},
|
||
onMouseEnter: function () {
|
||
this.setState({mousefocus: true});
|
||
},
|
||
onMouseLeave: function () {
|
||
this.setState({mousefocus: false});
|
||
},
|
||
onKeyDown: function (e) {
|
||
if (e.keyCode === Key.ESC || e.keyCode === Key.ENTER) {
|
||
this.blur();
|
||
// If closed using ESC/ENTER, hide the tooltip.
|
||
this.setState({mousefocus: false});
|
||
}
|
||
},
|
||
blur: function () {
|
||
this.refs.input.getDOMNode().blur();
|
||
},
|
||
focus: function () {
|
||
this.refs.input.getDOMNode().select();
|
||
},
|
||
render: function () {
|
||
var isValid = this.isValid();
|
||
var icon = "fa fa-fw fa-" + this.props.type;
|
||
var groupClassName = "filter-input input-group" + (isValid ? "" : " has-error");
|
||
|
||
var popover;
|
||
if (this.state.focus || this.state.mousefocus) {
|
||
popover = (
|
||
React.createElement("div", {className: "popover bottom", onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave},
|
||
React.createElement("div", {className: "arrow"}),
|
||
React.createElement("div", {className: "popover-content"},
|
||
this.getDesc()
|
||
)
|
||
)
|
||
);
|
||
}
|
||
|
||
return (
|
||
React.createElement("div", {className: groupClassName},
|
||
React.createElement("span", {className: "input-group-addon"},
|
||
React.createElement("i", {className: icon, style: {color: this.props.color}})
|
||
),
|
||
React.createElement("input", {type: "text", placeholder: this.props.placeholder, className: "form-control",
|
||
ref: "input",
|
||
onChange: this.onChange,
|
||
onFocus: this.onFocus,
|
||
onBlur: this.onBlur,
|
||
onKeyDown: this.onKeyDown,
|
||
value: this.state.value}),
|
||
popover
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
var MainMenu = React.createClass({displayName: "MainMenu",
|
||
mixins: [utils.Navigation, utils.State],
|
||
statics: {
|
||
title: "Start",
|
||
route: "flows"
|
||
},
|
||
onFilterChange: function (val) {
|
||
var d = {};
|
||
d[Query.FILTER] = val;
|
||
this.setQuery(d);
|
||
},
|
||
onHighlightChange: function (val) {
|
||
var d = {};
|
||
d[Query.HIGHLIGHT] = val;
|
||
this.setQuery(d);
|
||
},
|
||
onInterceptChange: function (val) {
|
||
SettingsActions.update({intercept: val});
|
||
},
|
||
render: function () {
|
||
var filter = this.getQuery()[Query.FILTER] || "";
|
||
var highlight = this.getQuery()[Query.HIGHLIGHT] || "";
|
||
var intercept = this.props.settings.intercept || "";
|
||
|
||
return (
|
||
React.createElement("div", null,
|
||
React.createElement("div", {className: "menu-row"},
|
||
React.createElement(FilterInput, {
|
||
placeholder: "Filter",
|
||
type: "filter",
|
||
color: "black",
|
||
value: filter,
|
||
onChange: this.onFilterChange}),
|
||
React.createElement(FilterInput, {
|
||
placeholder: "Highlight",
|
||
type: "tag",
|
||
color: "hsl(48, 100%, 50%)",
|
||
value: highlight,
|
||
onChange: this.onHighlightChange}),
|
||
React.createElement(FilterInput, {
|
||
placeholder: "Intercept",
|
||
type: "pause",
|
||
color: "hsl(208, 56%, 53%)",
|
||
value: intercept,
|
||
onChange: this.onInterceptChange})
|
||
),
|
||
React.createElement("div", {className: "clearfix"})
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
var ViewMenu = React.createClass({displayName: "ViewMenu",
|
||
statics: {
|
||
title: "View",
|
||
route: "flows"
|
||
},
|
||
mixins: [utils.Navigation, utils.State],
|
||
toggleEventLog: function () {
|
||
var d = {};
|
||
|
||
if (this.getQuery()[Query.SHOW_EVENTLOG]) {
|
||
d[Query.SHOW_EVENTLOG] = undefined;
|
||
} else {
|
||
d[Query.SHOW_EVENTLOG] = "t"; // any non-false value will do it, keep it short
|
||
}
|
||
|
||
this.setQuery(d);
|
||
},
|
||
render: function () {
|
||
var showEventLog = this.getQuery()[Query.SHOW_EVENTLOG];
|
||
return (
|
||
React.createElement("div", null,
|
||
React.createElement("button", {
|
||
className: "btn " + (showEventLog ? "btn-primary" : "btn-default"),
|
||
onClick: this.toggleEventLog},
|
||
React.createElement("i", {className: "fa fa-database"}),
|
||
" Show Eventlog"
|
||
),
|
||
React.createElement("span", null, " ")
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
var ReportsMenu = React.createClass({displayName: "ReportsMenu",
|
||
statics: {
|
||
title: "Visualization",
|
||
route: "reports"
|
||
},
|
||
render: function () {
|
||
return React.createElement("div", null, "Reports Menu");
|
||
}
|
||
});
|
||
|
||
var FileMenu = React.createClass({displayName: "FileMenu",
|
||
getInitialState: function () {
|
||
return {
|
||
showFileMenu: false
|
||
};
|
||
},
|
||
handleFileClick: function (e) {
|
||
e.preventDefault();
|
||
if (!this.state.showFileMenu) {
|
||
var close = function () {
|
||
this.setState({showFileMenu: false});
|
||
document.removeEventListener("click", close);
|
||
}.bind(this);
|
||
document.addEventListener("click", close);
|
||
|
||
this.setState({
|
||
showFileMenu: true
|
||
});
|
||
}
|
||
},
|
||
handleNewClick: function (e) {
|
||
e.preventDefault();
|
||
if (confirm("Delete all flows?")) {
|
||
FlowActions.clear();
|
||
}
|
||
},
|
||
handleOpenClick: function (e) {
|
||
e.preventDefault();
|
||
console.error("unimplemented: handleOpenClick");
|
||
},
|
||
handleSaveClick: function (e) {
|
||
e.preventDefault();
|
||
console.error("unimplemented: handleSaveClick");
|
||
},
|
||
handleShutdownClick: function (e) {
|
||
e.preventDefault();
|
||
console.error("unimplemented: handleShutdownClick");
|
||
},
|
||
render: function () {
|
||
var fileMenuClass = "dropdown pull-left" + (this.state.showFileMenu ? " open" : "");
|
||
|
||
return (
|
||
React.createElement("div", {className: fileMenuClass},
|
||
React.createElement("a", {href: "#", className: "special", onClick: this.handleFileClick}, " File "),
|
||
React.createElement("ul", {className: "dropdown-menu", role: "menu"},
|
||
React.createElement("li", null,
|
||
React.createElement("a", {href: "#", onClick: this.handleNewClick},
|
||
React.createElement("i", {className: "fa fa-fw fa-file"}),
|
||
"New"
|
||
)
|
||
),
|
||
React.createElement("li", {role: "presentation", className: "divider"}),
|
||
React.createElement("li", null,
|
||
React.createElement("a", {href: "http://mitm.it/", target: "_blank"},
|
||
React.createElement("i", {className: "fa fa-fw fa-external-link"}),
|
||
"Install Certificates..."
|
||
)
|
||
)
|
||
/*
|
||
<li>
|
||
<a href="#" onClick={this.handleOpenClick}>
|
||
<i className="fa fa-fw fa-folder-open"></i>
|
||
Open
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="#" onClick={this.handleSaveClick}>
|
||
<i className="fa fa-fw fa-save"></i>
|
||
Save
|
||
</a>
|
||
</li>
|
||
<li role="presentation" className="divider"></li>
|
||
<li>
|
||
<a href="#" onClick={this.handleShutdownClick}>
|
||
<i className="fa fa-fw fa-plug"></i>
|
||
Shutdown
|
||
</a>
|
||
</li>
|
||
*/
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
var header_entries = [MainMenu, ViewMenu /*, ReportsMenu */];
|
||
|
||
|
||
var Header = React.createClass({displayName: "Header",
|
||
mixins: [utils.Navigation],
|
||
getInitialState: function () {
|
||
return {
|
||
active: header_entries[0]
|
||
};
|
||
},
|
||
handleClick: function (active, e) {
|
||
e.preventDefault();
|
||
this.replaceWith(active.route);
|
||
this.setState({active: active});
|
||
},
|
||
render: function () {
|
||
var header = header_entries.map(function (entry, i) {
|
||
var classes = React.addons.classSet({
|
||
active: entry == this.state.active
|
||
});
|
||
return (
|
||
React.createElement("a", {key: i,
|
||
href: "#",
|
||
className: classes,
|
||
onClick: this.handleClick.bind(this, entry)
|
||
},
|
||
entry.title
|
||
)
|
||
);
|
||
}.bind(this));
|
||
|
||
return (
|
||
React.createElement("header", null,
|
||
React.createElement("div", {className: "title-bar"},
|
||
"mitmproxy ", this.props.settings.version
|
||
),
|
||
React.createElement("nav", {className: "nav-tabs nav-tabs-lg"},
|
||
React.createElement(FileMenu, null),
|
||
header
|
||
),
|
||
React.createElement("div", {className: "menu"},
|
||
React.createElement(this.state.active, {settings: this.props.settings})
|
||
)
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
module.exports = {
|
||
Header: Header
|
||
}
|
||
},{"./utils.jsx.js":10,"jquery":"jquery","react":"react"}],8:[function(require,module,exports){
|
||
var React = require("react");
|
||
|
||
var utils = require("./utils.jsx.js");
|
||
var views = require("../store/view.js");
|
||
var Filt = require("../filt/filt.js");
|
||
FlowTable = require("./flowtable.jsx.js");
|
||
var flowdetail = require("./flowdetail.jsx.js");
|
||
|
||
|
||
var MainView = React.createClass({displayName: "MainView",
|
||
mixins: [utils.Navigation, utils.State],
|
||
getInitialState: function () {
|
||
this.onQueryChange(Query.FILTER, function () {
|
||
this.state.view.recalculate(this.getViewFilt(), this.getViewSort());
|
||
}.bind(this));
|
||
this.onQueryChange(Query.HIGHLIGHT, function () {
|
||
this.state.view.recalculate(this.getViewFilt(), this.getViewSort());
|
||
}.bind(this));
|
||
return {
|
||
flows: []
|
||
};
|
||
},
|
||
getViewFilt: function () {
|
||
try {
|
||
var filt = Filt.parse(this.getQuery()[Query.FILTER] || "");
|
||
var highlightStr = this.getQuery()[Query.HIGHLIGHT];
|
||
var highlight = highlightStr ? Filt.parse(highlightStr) : false;
|
||
} catch (e) {
|
||
console.error("Error when processing filter: " + e);
|
||
}
|
||
|
||
return function filter_and_highlight(flow) {
|
||
if (!this._highlight) {
|
||
this._highlight = {};
|
||
}
|
||
this._highlight[flow.id] = highlight && highlight(flow);
|
||
return filt(flow);
|
||
};
|
||
},
|
||
getViewSort: function () {
|
||
},
|
||
componentWillReceiveProps: function (nextProps) {
|
||
if (nextProps.flowStore !== this.props.flowStore) {
|
||
this.closeView();
|
||
this.openView(nextProps.flowStore);
|
||
}
|
||
},
|
||
openView: function (store) {
|
||
var view = new views.StoreView(store, this.getViewFilt(), this.getViewSort());
|
||
this.setState({
|
||
view: view
|
||
});
|
||
|
||
view.addListener("recalculate", this.onRecalculate);
|
||
view.addListener("add update remove", this.onUpdate);
|
||
view.addListener("remove", this.onRemove);
|
||
},
|
||
onRecalculate: function () {
|
||
this.forceUpdate();
|
||
var selected = this.getSelected();
|
||
if (selected) {
|
||
this.refs.flowTable.scrollIntoView(selected);
|
||
}
|
||
},
|
||
onUpdate: function (flow) {
|
||
if (flow.id === this.getParams().flowId) {
|
||
this.forceUpdate();
|
||
}
|
||
},
|
||
onRemove: function (flow_id, index) {
|
||
if (flow_id === this.getParams().flowId) {
|
||
var flow_to_select = this.state.view.list[Math.min(index, this.state.view.list.length -1)];
|
||
this.selectFlow(flow_to_select);
|
||
}
|
||
},
|
||
closeView: function () {
|
||
this.state.view.close();
|
||
},
|
||
componentWillMount: function () {
|
||
this.openView(this.props.flowStore);
|
||
},
|
||
componentWillUnmount: function () {
|
||
this.closeView();
|
||
},
|
||
selectFlow: function (flow) {
|
||
if (flow) {
|
||
this.replaceWith(
|
||
"flow",
|
||
{
|
||
flowId: flow.id,
|
||
detailTab: this.getParams().detailTab || "request"
|
||
}
|
||
);
|
||
this.refs.flowTable.scrollIntoView(flow);
|
||
} else {
|
||
this.replaceWith("flows", {});
|
||
}
|
||
},
|
||
selectFlowRelative: function (shift) {
|
||
var flows = this.state.view.list;
|
||
var index;
|
||
if (!this.getParams().flowId) {
|
||
if (shift > 0) {
|
||
index = flows.length - 1;
|
||
} else {
|
||
index = 0;
|
||
}
|
||
} else {
|
||
var currFlowId = this.getParams().flowId;
|
||
var i = flows.length;
|
||
while (i--) {
|
||
if (flows[i].id === currFlowId) {
|
||
index = i;
|
||
break;
|
||
}
|
||
}
|
||
index = Math.min(
|
||
Math.max(0, index + shift),
|
||
flows.length - 1);
|
||
}
|
||
this.selectFlow(flows[index]);
|
||
},
|
||
onKeyDown: function (e) {
|
||
var flow = this.getSelected();
|
||
if (e.ctrlKey) {
|
||
return;
|
||
}
|
||
switch (e.keyCode) {
|
||
case Key.K:
|
||
case Key.UP:
|
||
this.selectFlowRelative(-1);
|
||
break;
|
||
case Key.J:
|
||
case Key.DOWN:
|
||
this.selectFlowRelative(+1);
|
||
break;
|
||
case Key.SPACE:
|
||
case Key.PAGE_DOWN:
|
||
this.selectFlowRelative(+10);
|
||
break;
|
||
case Key.PAGE_UP:
|
||
this.selectFlowRelative(-10);
|
||
break;
|
||
case Key.END:
|
||
this.selectFlowRelative(+1e10);
|
||
break;
|
||
case Key.HOME:
|
||
this.selectFlowRelative(-1e10);
|
||
break;
|
||
case Key.ESC:
|
||
this.selectFlow(null);
|
||
break;
|
||
case Key.H:
|
||
case Key.LEFT:
|
||
if (this.refs.flowDetails) {
|
||
this.refs.flowDetails.nextTab(-1);
|
||
}
|
||
break;
|
||
case Key.L:
|
||
case Key.TAB:
|
||
case Key.RIGHT:
|
||
if (this.refs.flowDetails) {
|
||
this.refs.flowDetails.nextTab(+1);
|
||
}
|
||
break;
|
||
case Key.C:
|
||
if (e.shiftKey) {
|
||
FlowActions.clear();
|
||
}
|
||
break;
|
||
case Key.D:
|
||
if (flow) {
|
||
if (e.shiftKey) {
|
||
FlowActions.duplicate(flow);
|
||
} else {
|
||
FlowActions.delete(flow);
|
||
}
|
||
}
|
||
break;
|
||
case Key.A:
|
||
if (e.shiftKey) {
|
||
FlowActions.accept_all();
|
||
} else if (flow && flow.intercepted) {
|
||
FlowActions.accept(flow);
|
||
}
|
||
break;
|
||
case Key.R:
|
||
if (!e.shiftKey && flow) {
|
||
FlowActions.replay(flow);
|
||
}
|
||
break;
|
||
case Key.V:
|
||
if(e.shiftKey && flow && flow.modified) {
|
||
FlowActions.revert(flow);
|
||
}
|
||
break;
|
||
default:
|
||
console.debug("keydown", e.keyCode);
|
||
return;
|
||
}
|
||
e.preventDefault();
|
||
},
|
||
getSelected: function () {
|
||
return this.props.flowStore.get(this.getParams().flowId);
|
||
},
|
||
render: function () {
|
||
var selected = this.getSelected();
|
||
|
||
var details;
|
||
if (selected) {
|
||
details = [
|
||
React.createElement(utils.Splitter, {key: "splitter"}),
|
||
React.createElement(flowdetail.FlowDetail, {key: "flowDetails", ref: "flowDetails", flow: selected})
|
||
];
|
||
} else {
|
||
details = null;
|
||
}
|
||
|
||
return (
|
||
React.createElement("div", {className: "main-view", onKeyDown: this.onKeyDown, tabIndex: "0"},
|
||
React.createElement(FlowTable, {ref: "flowTable",
|
||
view: this.state.view,
|
||
selectFlow: this.selectFlow,
|
||
selected: selected}),
|
||
details
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
module.exports = MainView;
|
||
|
||
},{"../filt/filt.js":14,"../store/view.js":17,"./flowdetail.jsx.js":3,"./flowtable.jsx.js":5,"./utils.jsx.js":10,"react":"react"}],9:[function(require,module,exports){
|
||
var React = require("react");
|
||
var ReactRouter = require("react-router");
|
||
var _ = require("lodash");
|
||
|
||
var utils = require("./utils.jsx.js");
|
||
var MainView = require("./mainview.jsx.js");
|
||
var Footer = require("./footer.jsx.js");
|
||
var header = require("./header.jsx.js");
|
||
var store = require("../store/store.js");
|
||
|
||
|
||
//TODO: Move out of here, just a stub.
|
||
var Reports = React.createClass({displayName: "Reports",
|
||
render: function () {
|
||
return React.createElement("div", null, "ReportEditor");
|
||
}
|
||
});
|
||
|
||
|
||
var ProxyAppMain = React.createClass({displayName: "ProxyAppMain",
|
||
mixins: [utils.State],
|
||
getInitialState: function () {
|
||
var eventStore = new store.EventLogStore();
|
||
var flowStore = new store.FlowStore();
|
||
var settings = new store.SettingsStore();
|
||
|
||
// Default Settings before fetch
|
||
_.extend(settings.dict,{
|
||
});
|
||
return {
|
||
settings: settings,
|
||
flowStore: flowStore,
|
||
eventStore: eventStore
|
||
};
|
||
},
|
||
componentDidMount: function () {
|
||
this.state.settings.addListener("recalculate", this.onSettingsChange);
|
||
window.app = this;
|
||
},
|
||
componentWillUnmount: function () {
|
||
this.state.settings.removeListener("recalculate", this.onSettingsChange);
|
||
},
|
||
onSettingsChange: function(){
|
||
this.setState({
|
||
settings: this.state.settings
|
||
});
|
||
},
|
||
render: function () {
|
||
|
||
var eventlog;
|
||
if (this.getQuery()[Query.SHOW_EVENTLOG]) {
|
||
eventlog = [
|
||
React.createElement(Splitter, {key: "splitter", axis: "y"}),
|
||
React.createElement(EventLog, {key: "eventlog", eventStore: this.state.eventStore})
|
||
];
|
||
} else {
|
||
eventlog = null;
|
||
}
|
||
|
||
return (
|
||
React.createElement("div", {id: "container"},
|
||
React.createElement(header.Header, {settings: this.state.settings.dict}),
|
||
React.createElement(RouteHandler, {settings: this.state.settings.dict, flowStore: this.state.flowStore}),
|
||
eventlog,
|
||
React.createElement(Footer, {settings: this.state.settings.dict})
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
|
||
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"})
|
||
)
|
||
);
|
||
|
||
module.exports = {
|
||
routes: routes
|
||
};
|
||
|
||
|
||
},{"../store/store.js":16,"./footer.jsx.js":6,"./header.jsx.js":7,"./mainview.jsx.js":8,"./utils.jsx.js":10,"lodash":"lodash","react":"react","react-router":"react-router"}],10:[function(require,module,exports){
|
||
var React = require("react");
|
||
var ReactRouter = require("react-router");
|
||
var _ = require("lodash");
|
||
|
||
//React utils. For other utilities, see ../utils.js
|
||
|
||
// http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html (also contains inverse example)
|
||
var AutoScrollMixin = {
|
||
componentWillUpdate: function () {
|
||
var node = this.getDOMNode();
|
||
this._shouldScrollBottom = (
|
||
node.scrollTop !== 0 &&
|
||
node.scrollTop + node.clientHeight === node.scrollHeight
|
||
);
|
||
},
|
||
componentDidUpdate: function () {
|
||
if (this._shouldScrollBottom) {
|
||
var node = this.getDOMNode();
|
||
node.scrollTop = node.scrollHeight;
|
||
}
|
||
},
|
||
};
|
||
|
||
|
||
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 Navigation = _.extend({}, ReactRouter.Navigation, {
|
||
setQuery: function (dict) {
|
||
var q = this.context.getCurrentQuery();
|
||
for(var i in dict){
|
||
if(dict.hasOwnProperty(i)){
|
||
q[i] = dict[i] || undefined; //falsey values shall be removed.
|
||
}
|
||
}
|
||
q._ = "_"; // workaround for https://github.com/rackt/react-router/pull/599
|
||
this.replaceWith(this.context.getCurrentPath(), this.context.getCurrentParams(), q);
|
||
},
|
||
replaceWith: function(routeNameOrPath, params, query) {
|
||
if(routeNameOrPath === undefined){
|
||
routeNameOrPath = this.context.getCurrentPath();
|
||
}
|
||
if(params === undefined){
|
||
params = this.context.getCurrentParams();
|
||
}
|
||
if(query === undefined){
|
||
query = this.context.getCurrentQuery();
|
||
}
|
||
ReactRouter.Navigation.replaceWith.call(this, routeNameOrPath, params, query);
|
||
}
|
||
});
|
||
_.extend(Navigation.contextTypes, ReactRouter.State.contextTypes);
|
||
|
||
var State = _.extend({}, ReactRouter.State, {
|
||
getInitialState: function () {
|
||
this._query = this.context.getCurrentQuery();
|
||
this._queryWatches = [];
|
||
return null;
|
||
},
|
||
onQueryChange: function (key, callback) {
|
||
this._queryWatches.push({
|
||
key: key,
|
||
callback: callback
|
||
});
|
||
},
|
||
componentWillReceiveProps: function (nextProps, nextState) {
|
||
var q = this.context.getCurrentQuery();
|
||
for (var i = 0; i < this._queryWatches.length; i++) {
|
||
var watch = this._queryWatches[i];
|
||
if (this._query[watch.key] !== q[watch.key]) {
|
||
watch.callback(this._query[watch.key], q[watch.key], watch.key);
|
||
}
|
||
}
|
||
this._query = q;
|
||
}
|
||
});
|
||
|
||
var Splitter = React.createClass({displayName: "Splitter",
|
||
getDefaultProps: function () {
|
||
return {
|
||
axis: "x"
|
||
};
|
||
},
|
||
getInitialState: function () {
|
||
return {
|
||
applied: false,
|
||
startX: false,
|
||
startY: false
|
||
};
|
||
},
|
||
onMouseDown: function (e) {
|
||
this.setState({
|
||
startX: e.pageX,
|
||
startY: e.pageY
|
||
});
|
||
window.addEventListener("mousemove", this.onMouseMove);
|
||
window.addEventListener("mouseup", this.onMouseUp);
|
||
// Occasionally, only a dragEnd event is triggered, but no mouseUp.
|
||
window.addEventListener("dragend", this.onDragEnd);
|
||
},
|
||
onDragEnd: function () {
|
||
this.getDOMNode().style.transform = "";
|
||
window.removeEventListener("dragend", this.onDragEnd);
|
||
window.removeEventListener("mouseup", this.onMouseUp);
|
||
window.removeEventListener("mousemove", this.onMouseMove);
|
||
},
|
||
onMouseUp: function (e) {
|
||
this.onDragEnd();
|
||
|
||
var node = this.getDOMNode();
|
||
var prev = node.previousElementSibling;
|
||
var next = node.nextElementSibling;
|
||
|
||
var dX = e.pageX - this.state.startX;
|
||
var dY = e.pageY - this.state.startY;
|
||
var flexBasis;
|
||
if (this.props.axis === "x") {
|
||
flexBasis = prev.offsetWidth + dX;
|
||
} else {
|
||
flexBasis = prev.offsetHeight + dY;
|
||
}
|
||
|
||
prev.style.flex = "0 0 " + Math.max(0, flexBasis) + "px";
|
||
next.style.flex = "1 1 auto";
|
||
|
||
this.setState({
|
||
applied: true
|
||
});
|
||
this.onResize();
|
||
},
|
||
onMouseMove: function (e) {
|
||
var dX = 0, dY = 0;
|
||
if (this.props.axis === "x") {
|
||
dX = e.pageX - this.state.startX;
|
||
} else {
|
||
dY = e.pageY - this.state.startY;
|
||
}
|
||
this.getDOMNode().style.transform = "translate(" + dX + "px," + dY + "px)";
|
||
},
|
||
onResize: function () {
|
||
// Trigger a global resize event. This notifies components that employ virtual scrolling
|
||
// that their viewport may have changed.
|
||
window.setTimeout(function () {
|
||
window.dispatchEvent(new CustomEvent("resize"));
|
||
}, 1);
|
||
},
|
||
reset: function (willUnmount) {
|
||
if (!this.state.applied) {
|
||
return;
|
||
}
|
||
var node = this.getDOMNode();
|
||
var prev = node.previousElementSibling;
|
||
var next = node.nextElementSibling;
|
||
|
||
prev.style.flex = "";
|
||
next.style.flex = "";
|
||
|
||
if (!willUnmount) {
|
||
this.setState({
|
||
applied: false
|
||
});
|
||
}
|
||
this.onResize();
|
||
},
|
||
componentWillUnmount: function () {
|
||
this.reset(true);
|
||
},
|
||
render: function () {
|
||
var className = "splitter";
|
||
if (this.props.axis === "x") {
|
||
className += " splitter-x";
|
||
} else {
|
||
className += " splitter-y";
|
||
}
|
||
return (
|
||
React.createElement("div", {className: className},
|
||
React.createElement("div", {onMouseDown: this.onMouseDown, draggable: "true"})
|
||
)
|
||
);
|
||
}
|
||
});
|
||
|
||
module.exports = {
|
||
State: State,
|
||
Navigation: Navigation,
|
||
StickyHeadMixin: StickyHeadMixin,
|
||
AutoScrollMixin: AutoScrollMixin,
|
||
Splitter: Splitter
|
||
}
|
||
},{"lodash":"lodash","react":"react","react-router":"react-router"}],11:[function(require,module,exports){
|
||
var React = require("react");
|
||
|
||
var VirtualScrollMixin = {
|
||
getInitialState: function () {
|
||
return {
|
||
start: 0,
|
||
stop: 0
|
||
};
|
||
},
|
||
componentWillMount: function () {
|
||
if (!this.props.rowHeight) {
|
||
console.warn("VirtualScrollMixin: No rowHeight specified", this);
|
||
}
|
||
},
|
||
getPlaceholderTop: function (total) {
|
||
var Tag = this.props.placeholderTagName || "tr";
|
||
// When a large trunk of elements is removed from the button, start may be far off the viewport.
|
||
// To make this issue less severe, limit the top placeholder to the total number of rows.
|
||
var style = {
|
||
height: Math.min(this.state.start, total) * this.props.rowHeight
|
||
};
|
||
var spacer = React.createElement(Tag, {key: "placeholder-top", style: style});
|
||
|
||
if (this.state.start % 2 === 1) {
|
||
// fix even/odd rows
|
||
return [spacer, React.createElement(Tag, {key: "placeholder-top-2"})];
|
||
} else {
|
||
return spacer;
|
||
}
|
||
},
|
||
getPlaceholderBottom: function (total) {
|
||
var Tag = this.props.placeholderTagName || "tr";
|
||
var style = {
|
||
height: Math.max(0, total - this.state.stop) * this.props.rowHeight
|
||
};
|
||
return React.createElement(Tag, {key: "placeholder-bottom", style: style});
|
||
},
|
||
componentDidMount: function () {
|
||
this.onScroll();
|
||
window.addEventListener('resize', this.onScroll);
|
||
},
|
||
componentWillUnmount: function(){
|
||
window.removeEventListener('resize', this.onScroll);
|
||
},
|
||
onScroll: function () {
|
||
var viewport = this.getDOMNode();
|
||
var top = viewport.scrollTop;
|
||
var height = viewport.offsetHeight;
|
||
var start = Math.floor(top / this.props.rowHeight);
|
||
var stop = start + Math.ceil(height / (this.props.rowHeightMin || this.props.rowHeight));
|
||
|
||
this.setState({
|
||
start: start,
|
||
stop: stop
|
||
});
|
||
},
|
||
renderRows: function (elems) {
|
||
var rows = [];
|
||
var max = Math.min(elems.length, this.state.stop);
|
||
|
||
for (var i = this.state.start; i < max; i++) {
|
||
var elem = elems[i];
|
||
rows.push(this.renderRow(elem));
|
||
}
|
||
return rows;
|
||
},
|
||
scrollRowIntoView: function (index, head_height) {
|
||
|
||
var row_top = (index * this.props.rowHeight) + head_height;
|
||
var row_bottom = row_top + this.props.rowHeight;
|
||
|
||
var viewport = this.getDOMNode();
|
||
var viewport_top = viewport.scrollTop;
|
||
var viewport_bottom = viewport_top + viewport.offsetHeight;
|
||
|
||
// Account for pinned thead
|
||
if (row_top - head_height < viewport_top) {
|
||
viewport.scrollTop = row_top - head_height;
|
||
} else if (row_bottom > viewport_bottom) {
|
||
viewport.scrollTop = row_bottom - viewport.offsetHeight;
|
||
}
|
||
},
|
||
};
|
||
|
||
module.exports = VirtualScrollMixin;
|
||
},{"react":"react"}],12:[function(require,module,exports){
|
||
|
||
var actions = require("./actions.js");
|
||
|
||
function Connection(url) {
|
||
if (url[0] === "/") {
|
||
url = location.origin.replace("http", "ws") + url;
|
||
}
|
||
|
||
var ws = new WebSocket(url);
|
||
ws.onopen = function () {
|
||
actions.ConnectionActions.open();
|
||
};
|
||
ws.onmessage = function (message) {
|
||
var m = JSON.parse(message.data);
|
||
AppDispatcher.dispatchServerAction(m);
|
||
};
|
||
ws.onerror = function () {
|
||
actions.ConnectionActions.error();
|
||
EventLogActions.add_event("WebSocket connection error.");
|
||
};
|
||
ws.onclose = function () {
|
||
actions.ConnectionActions.close();
|
||
EventLogActions.add_event("WebSocket connection closed.");
|
||
};
|
||
return ws;
|
||
}
|
||
|
||
module.exports = Connection;
|
||
},{"./actions.js":1}],13:[function(require,module,exports){
|
||
const PayloadSources = {
|
||
VIEW: "view",
|
||
SERVER: "server"
|
||
};
|
||
|
||
|
||
function Dispatcher() {
|
||
this.callbacks = [];
|
||
}
|
||
Dispatcher.prototype.register = function (callback) {
|
||
this.callbacks.push(callback);
|
||
};
|
||
Dispatcher.prototype.unregister = function (callback) {
|
||
var index = this.callbacks.indexOf(callback);
|
||
if (index >= 0) {
|
||
this.callbacks.splice(index, 1);
|
||
}
|
||
};
|
||
Dispatcher.prototype.dispatch = function (payload) {
|
||
console.debug("dispatch", payload);
|
||
for (var i = 0; i < this.callbacks.length; i++) {
|
||
this.callbacks[i](payload);
|
||
}
|
||
};
|
||
|
||
|
||
AppDispatcher = new Dispatcher();
|
||
AppDispatcher.dispatchViewAction = function (action) {
|
||
action.source = PayloadSources.VIEW;
|
||
this.dispatch(action);
|
||
};
|
||
AppDispatcher.dispatchServerAction = function (action) {
|
||
action.source = PayloadSources.SERVER;
|
||
this.dispatch(action);
|
||
};
|
||
|
||
module.exports = {
|
||
AppDispatcher: AppDispatcher
|
||
};
|
||
},{}],14:[function(require,module,exports){
|
||
/* jshint ignore:start */
|
||
Filt = (function() {
|
||
/*
|
||
* Generated by PEG.js 0.8.0.
|
||
*
|
||
* http://pegjs.majda.cz/
|
||
*/
|
||
|
||
function peg$subclass(child, parent) {
|
||
function ctor() { this.constructor = child; }
|
||
ctor.prototype = parent.prototype;
|
||
child.prototype = new ctor();
|
||
}
|
||
|
||
function SyntaxError(message, expected, found, offset, line, column) {
|
||
this.message = message;
|
||
this.expected = expected;
|
||
this.found = found;
|
||
this.offset = offset;
|
||
this.line = line;
|
||
this.column = column;
|
||
|
||
this.name = "SyntaxError";
|
||
}
|
||
|
||
peg$subclass(SyntaxError, Error);
|
||
|
||
function parse(input) {
|
||
var options = arguments.length > 1 ? arguments[1] : {},
|
||
|
||
peg$FAILED = {},
|
||
|
||
peg$startRuleFunctions = { start: peg$parsestart },
|
||
peg$startRuleFunction = peg$parsestart,
|
||
|
||
peg$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$currPos = 0,
|
||
peg$reportedPos = 0,
|
||
peg$cachedPos = 0,
|
||
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
|
||
peg$maxFailPos = 0,
|
||
peg$maxFailExpected = [],
|
||
peg$silentFails = 0,
|
||
|
||
peg$result;
|
||
|
||
if ("startRule" in options) {
|
||
if (!(options.startRule in peg$startRuleFunctions)) {
|
||
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
||
}
|
||
|
||
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
||
}
|
||
|
||
function text() {
|
||
return input.substring(peg$reportedPos, peg$currPos);
|
||
}
|
||
|
||
function offset() {
|
||
return peg$reportedPos;
|
||
}
|
||
|
||
function line() {
|
||
return peg$computePosDetails(peg$reportedPos).line;
|
||
}
|
||
|
||
function column() {
|
||
return peg$computePosDetails(peg$reportedPos).column;
|
||
}
|
||
|
||
function expected(description) {
|
||
throw peg$buildException(
|
||
null,
|
||
[{ type: "other", description: description }],
|
||
peg$reportedPos
|
||
);
|
||
}
|
||
|
||
function error(message) {
|
||
throw peg$buildException(message, null, peg$reportedPos);
|
||
}
|
||
|
||
function peg$computePosDetails(pos) {
|
||
function advance(details, startPos, endPos) {
|
||
var p, ch;
|
||
|
||
for (p = startPos; p < endPos; p++) {
|
||
ch = input.charAt(p);
|
||
if (ch === "\n") {
|
||
if (!details.seenCR) { details.line++; }
|
||
details.column = 1;
|
||
details.seenCR = false;
|
||
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
|
||
details.line++;
|
||
details.column = 1;
|
||
details.seenCR = true;
|
||
} else {
|
||
details.column++;
|
||
details.seenCR = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (peg$cachedPos !== pos) {
|
||
if (peg$cachedPos > pos) {
|
||
peg$cachedPos = 0;
|
||
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
|
||
}
|
||
advance(peg$cachedPosDetails, peg$cachedPos, pos);
|
||
peg$cachedPos = pos;
|
||
}
|
||
|
||
return peg$cachedPosDetails;
|
||
}
|
||
|
||
function peg$fail(expected) {
|
||
if (peg$currPos < peg$maxFailPos) { return; }
|
||
|
||
if (peg$currPos > peg$maxFailPos) {
|
||
peg$maxFailPos = peg$currPos;
|
||
peg$maxFailExpected = [];
|
||
}
|
||
|
||
peg$maxFailExpected.push(expected);
|
||
}
|
||
|
||
function peg$buildException(message, expected, pos) {
|
||
function cleanupExpected(expected) {
|
||
var i = 1;
|
||
|
||
expected.sort(function(a, b) {
|
||
if (a.description < b.description) {
|
||
return -1;
|
||
} else if (a.description > b.description) {
|
||
return 1;
|
||
} else {
|
||
return 0;
|
||
}
|
||
});
|
||
|
||
while (i < expected.length) {
|
||
if (expected[i - 1] === expected[i]) {
|
||
expected.splice(i, 1);
|
||
} else {
|
||
i++;
|
||
}
|
||
}
|
||
}
|
||
|
||
function buildMessage(expected, found) {
|
||
function stringEscape(s) {
|
||
function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
|
||
|
||
return s
|
||
.replace(/\\/g, '\\\\')
|
||
.replace(/"/g, '\\"')
|
||
.replace(/\x08/g, '\\b')
|
||
.replace(/\t/g, '\\t')
|
||
.replace(/\n/g, '\\n')
|
||
.replace(/\f/g, '\\f')
|
||
.replace(/\r/g, '\\r')
|
||
.replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
||
.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
|
||
.replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
|
||
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
|
||
}
|
||
|
||
var expectedDescs = new Array(expected.length),
|
||
expectedDesc, foundDesc, i;
|
||
|
||
for (i = 0; i < expected.length; i++) {
|
||
expectedDescs[i] = expected[i].description;
|
||
}
|
||
|
||
expectedDesc = expected.length > 1
|
||
? expectedDescs.slice(0, -1).join(", ")
|
||
+ " or "
|
||
+ expectedDescs[expected.length - 1]
|
||
: expectedDescs[0];
|
||
|
||
foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
|
||
|
||
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
|
||
);
|
||
}
|
||
|
||
function peg$parsestart() {
|
||
var s0, s1, s2, s3;
|
||
|
||
peg$silentFails++;
|
||
s0 = peg$currPos;
|
||
s1 = peg$parse__();
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = peg$parseOrExpr();
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parse__();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c2(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} 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;
|
||
}
|
||
peg$silentFails--;
|
||
if (s0 === peg$FAILED) {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c0); }
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parsews() {
|
||
var s0, s1;
|
||
|
||
peg$silentFails++;
|
||
if (peg$c6.test(input.charAt(peg$currPos))) {
|
||
s0 = input.charAt(peg$currPos);
|
||
peg$currPos++;
|
||
} else {
|
||
s0 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c7); }
|
||
}
|
||
peg$silentFails--;
|
||
if (s0 === peg$FAILED) {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c5); }
|
||
}
|
||
|
||
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;
|
||
|
||
peg$silentFails++;
|
||
s0 = [];
|
||
s1 = peg$parsews();
|
||
while (s1 !== peg$FAILED) {
|
||
s0.push(s1);
|
||
s1 = peg$parsews();
|
||
}
|
||
peg$silentFails--;
|
||
if (s0 === peg$FAILED) {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c11); }
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseOrExpr() {
|
||
var s0, s1, s2, s3, s4, s5;
|
||
|
||
s0 = peg$currPos;
|
||
s1 = peg$parseAndExpr();
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = peg$parse__();
|
||
if (s2 !== peg$FAILED) {
|
||
if (input.charCodeAt(peg$currPos) === 124) {
|
||
s3 = peg$c12;
|
||
peg$currPos++;
|
||
} else {
|
||
s3 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c13); }
|
||
}
|
||
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);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$parseAndExpr();
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseAndExpr() {
|
||
var s0, s1, s2, s3, s4, s5;
|
||
|
||
s0 = peg$currPos;
|
||
s1 = peg$parseNotExpr();
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = peg$parse__();
|
||
if (s2 !== peg$FAILED) {
|
||
if (input.charCodeAt(peg$currPos) === 38) {
|
||
s3 = peg$c15;
|
||
peg$currPos++;
|
||
} else {
|
||
s3 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c16); }
|
||
}
|
||
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);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
s1 = peg$parseNotExpr();
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseAndExpr();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c17(s1, s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$parseNotExpr();
|
||
}
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseNotExpr() {
|
||
var s0, s1, s2, s3;
|
||
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 33) {
|
||
s1 = peg$c18;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
||
}
|
||
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);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$parseBindingExpr();
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseBindingExpr() {
|
||
var s0, s1, s2, s3, s4, s5;
|
||
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 40) {
|
||
s1 = peg$c21;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c22); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = peg$parse__();
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseOrExpr();
|
||
if (s3 !== peg$FAILED) {
|
||
s4 = peg$parse__();
|
||
if (s4 !== peg$FAILED) {
|
||
if (input.charCodeAt(peg$currPos) === 41) {
|
||
s5 = peg$c23;
|
||
peg$currPos++;
|
||
} else {
|
||
s5 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c24); }
|
||
}
|
||
if (s5 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c25(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$parseExpr();
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseExpr() {
|
||
var s0;
|
||
|
||
s0 = peg$parseNullaryExpr();
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$parseUnaryExpr();
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseNullaryExpr() {
|
||
var s0, s1;
|
||
|
||
s0 = peg$parseBooleanLiteral();
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c27); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c28();
|
||
}
|
||
s0 = s1;
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c30); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c31();
|
||
}
|
||
s0 = s1;
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c33); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c34();
|
||
}
|
||
s0 = s1;
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 2) === peg$c35) {
|
||
s1 = peg$c35;
|
||
peg$currPos += 2;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c36); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c37();
|
||
}
|
||
s0 = s1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseBooleanLiteral() {
|
||
var s0, s1;
|
||
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 4) === peg$c38) {
|
||
s1 = peg$c38;
|
||
peg$currPos += 4;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c39); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c40();
|
||
}
|
||
s0 = s1;
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 5) === peg$c41) {
|
||
s1 = peg$c41;
|
||
peg$currPos += 5;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c42); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c43();
|
||
}
|
||
s0 = s1;
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseUnaryExpr() {
|
||
var s0, s1, s2, s3;
|
||
|
||
s0 = peg$currPos;
|
||
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$c45); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseIntegerLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c46(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c48); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c49(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 2) === peg$c50) {
|
||
s1 = peg$c50;
|
||
peg$currPos += 2;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c51); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c52(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c54); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c55(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 3) === peg$c56) {
|
||
s1 = peg$c56;
|
||
peg$currPos += 3;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c57); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c58(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c60); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c61(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 2) === peg$c62) {
|
||
s1 = peg$c62;
|
||
peg$currPos += 2;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c64(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
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$c66); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c67(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 3) === peg$c68) {
|
||
s1 = peg$c68;
|
||
peg$currPos += 3;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c69); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c70(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.substr(peg$currPos, 2) === peg$c71) {
|
||
s1 = peg$c71;
|
||
peg$currPos += 2;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c72); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parsews();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parsews();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
s3 = peg$parseStringLiteral();
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c73(s3);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
s1 = peg$parseStringLiteral();
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c73(s1);
|
||
}
|
||
s0 = s1;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseIntegerLiteral() {
|
||
var s0, s1, s2, s3;
|
||
|
||
peg$silentFails++;
|
||
s0 = peg$currPos;
|
||
if (peg$c76.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 (s1 === peg$FAILED) {
|
||
s1 = peg$c75;
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
if (peg$c78.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 (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
if (peg$c78.test(input.charAt(peg$currPos))) {
|
||
s3 = input.charAt(peg$currPos);
|
||
peg$currPos++;
|
||
} else {
|
||
s3 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c79); }
|
||
}
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
if (peg$c76.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 (s3 === peg$FAILED) {
|
||
s3 = peg$c75;
|
||
}
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c80(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
peg$silentFails--;
|
||
if (s0 === peg$FAILED) {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c74); }
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseStringLiteral() {
|
||
var s0, s1, s2, s3;
|
||
|
||
peg$silentFails++;
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 34) {
|
||
s1 = peg$c82;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c83); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parseDoubleStringChar();
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parseDoubleStringChar();
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
if (input.charCodeAt(peg$currPos) === 34) {
|
||
s3 = peg$c82;
|
||
peg$currPos++;
|
||
} else {
|
||
s3 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c83); }
|
||
}
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c84(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 39) {
|
||
s1 = peg$c85;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c86); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parseSingleStringChar();
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parseSingleStringChar();
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
if (input.charCodeAt(peg$currPos) === 39) {
|
||
s3 = peg$c85;
|
||
peg$currPos++;
|
||
} else {
|
||
s3 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c86); }
|
||
}
|
||
if (s3 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c84(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
s1 = peg$currPos;
|
||
peg$silentFails++;
|
||
s2 = peg$parsecc();
|
||
peg$silentFails--;
|
||
if (s2 === peg$FAILED) {
|
||
s1 = peg$c87;
|
||
} else {
|
||
peg$currPos = s1;
|
||
s1 = peg$c1;
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = [];
|
||
s3 = peg$parseUnquotedStringChar();
|
||
if (s3 !== peg$FAILED) {
|
||
while (s3 !== peg$FAILED) {
|
||
s2.push(s3);
|
||
s3 = peg$parseUnquotedStringChar();
|
||
}
|
||
} else {
|
||
s2 = peg$c1;
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c84(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
}
|
||
}
|
||
peg$silentFails--;
|
||
if (s0 === peg$FAILED) {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c81); }
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseDoubleStringChar() {
|
||
var s0, s1, s2;
|
||
|
||
s0 = peg$currPos;
|
||
s1 = peg$currPos;
|
||
peg$silentFails++;
|
||
if (peg$c88.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$silentFails--;
|
||
if (s2 === peg$FAILED) {
|
||
s1 = peg$c87;
|
||
} else {
|
||
peg$currPos = s1;
|
||
s1 = peg$c1;
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
if (input.length > peg$currPos) {
|
||
s2 = input.charAt(peg$currPos);
|
||
peg$currPos++;
|
||
} else {
|
||
s2 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c91(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 92) {
|
||
s1 = peg$c92;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c93); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = peg$parseEscapeSequence();
|
||
if (s2 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c91(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseSingleStringChar() {
|
||
var s0, s1, s2;
|
||
|
||
s0 = peg$currPos;
|
||
s1 = peg$currPos;
|
||
peg$silentFails++;
|
||
if (peg$c94.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$silentFails--;
|
||
if (s2 === peg$FAILED) {
|
||
s1 = peg$c87;
|
||
} else {
|
||
peg$currPos = s1;
|
||
s1 = peg$c1;
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
if (input.length > peg$currPos) {
|
||
s2 = input.charAt(peg$currPos);
|
||
peg$currPos++;
|
||
} else {
|
||
s2 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c91(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 92) {
|
||
s1 = peg$c92;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c93); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
s2 = peg$parseEscapeSequence();
|
||
if (s2 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c91(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseUnquotedStringChar() {
|
||
var s0, s1, s2;
|
||
|
||
s0 = peg$currPos;
|
||
s1 = peg$currPos;
|
||
peg$silentFails++;
|
||
s2 = peg$parsews();
|
||
peg$silentFails--;
|
||
if (s2 === peg$FAILED) {
|
||
s1 = peg$c87;
|
||
} else {
|
||
peg$currPos = s1;
|
||
s1 = peg$c1;
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
if (input.length > peg$currPos) {
|
||
s2 = input.charAt(peg$currPos);
|
||
peg$currPos++;
|
||
} else {
|
||
s2 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
||
}
|
||
if (s2 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c91(s2);
|
||
s0 = s1;
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
} else {
|
||
peg$currPos = s0;
|
||
s0 = peg$c1;
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
function peg$parseEscapeSequence() {
|
||
var s0, s1;
|
||
|
||
if (peg$c96.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 (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 110) {
|
||
s1 = peg$c98;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c99); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c100();
|
||
}
|
||
s0 = s1;
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 114) {
|
||
s1 = peg$c101;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c102); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c103();
|
||
}
|
||
s0 = s1;
|
||
if (s0 === peg$FAILED) {
|
||
s0 = peg$currPos;
|
||
if (input.charCodeAt(peg$currPos) === 116) {
|
||
s1 = peg$c104;
|
||
peg$currPos++;
|
||
} else {
|
||
s1 = peg$FAILED;
|
||
if (peg$silentFails === 0) { peg$fail(peg$c105); }
|
||
}
|
||
if (s1 !== peg$FAILED) {
|
||
peg$reportedPos = s0;
|
||
s1 = peg$c106();
|
||
}
|
||
s0 = s1;
|
||
}
|
||
}
|
||
}
|
||
|
||
return s0;
|
||
}
|
||
|
||
|
||
function or(first, second) {
|
||
// Add explicit function names to ease debugging.
|
||
function orFilter() {
|
||
return first.apply(this, arguments) || second.apply(this, arguments);
|
||
}
|
||
orFilter.desc = first.desc + " or " + second.desc;
|
||
return orFilter;
|
||
}
|
||
function and(first, second) {
|
||
function andFilter() {
|
||
return first.apply(this, arguments) && second.apply(this, arguments);
|
||
}
|
||
andFilter.desc = first.desc + " and " + second.desc;
|
||
return andFilter;
|
||
}
|
||
function not(expr) {
|
||
function notFilter() {
|
||
return !expr.apply(this, arguments);
|
||
}
|
||
notFilter.desc = "not " + expr.desc;
|
||
return notFilter;
|
||
}
|
||
function binding(expr) {
|
||
function bindingFilter() {
|
||
return expr.apply(this, arguments);
|
||
}
|
||
bindingFilter.desc = "(" + expr.desc + ")";
|
||
return bindingFilter;
|
||
}
|
||
function trueFilter(flow) {
|
||
return true;
|
||
}
|
||
trueFilter.desc = "true";
|
||
function falseFilter(flow) {
|
||
return false;
|
||
}
|
||
falseFilter.desc = "false";
|
||
|
||
var ASSET_TYPES = [
|
||
new RegExp("text/javascript"),
|
||
new RegExp("application/x-javascript"),
|
||
new RegExp("application/javascript"),
|
||
new RegExp("text/css"),
|
||
new RegExp("image/.*"),
|
||
new RegExp("application/x-shockwave-flash")
|
||
];
|
||
function assetFilter(flow) {
|
||
if (flow.response) {
|
||
var ct = ResponseUtils.getContentType(flow.response);
|
||
var i = ASSET_TYPES.length;
|
||
while (i--) {
|
||
if (ASSET_TYPES[i].test(ct)) {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
assetFilter.desc = "is asset";
|
||
function responseCode(code){
|
||
function responseCodeFilter(flow){
|
||
return flow.response && flow.response.code === code;
|
||
}
|
||
responseCodeFilter.desc = "resp. code is " + code;
|
||
return responseCodeFilter;
|
||
}
|
||
function domain(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function domainFilter(flow){
|
||
return flow.request && regex.test(flow.request.host);
|
||
}
|
||
domainFilter.desc = "domain matches " + regex;
|
||
return domainFilter;
|
||
}
|
||
function errorFilter(flow){
|
||
return !!flow.error;
|
||
}
|
||
errorFilter.desc = "has error";
|
||
function header(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function headerFilter(flow){
|
||
return (
|
||
(flow.request && RequestUtils.match_header(flow.request, regex))
|
||
||
|
||
(flow.response && ResponseUtils.match_header(flow.response, regex))
|
||
);
|
||
}
|
||
headerFilter.desc = "header matches " + regex;
|
||
return headerFilter;
|
||
}
|
||
function requestHeader(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function requestHeaderFilter(flow){
|
||
return (flow.request && RequestUtils.match_header(flow.request, regex));
|
||
}
|
||
requestHeaderFilter.desc = "req. header matches " + regex;
|
||
return requestHeaderFilter;
|
||
}
|
||
function responseHeader(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function responseHeaderFilter(flow){
|
||
return (flow.response && ResponseUtils.match_header(flow.response, regex));
|
||
}
|
||
responseHeaderFilter.desc = "resp. header matches " + regex;
|
||
return responseHeaderFilter;
|
||
}
|
||
function method(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function methodFilter(flow){
|
||
return flow.request && regex.test(flow.request.method);
|
||
}
|
||
methodFilter.desc = "method matches " + regex;
|
||
return methodFilter;
|
||
}
|
||
function noResponseFilter(flow){
|
||
return flow.request && !flow.response;
|
||
}
|
||
noResponseFilter.desc = "has no response";
|
||
function responseFilter(flow){
|
||
return !!flow.response;
|
||
}
|
||
responseFilter.desc = "has response";
|
||
|
||
function contentType(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function contentTypeFilter(flow){
|
||
return (
|
||
(flow.request && regex.test(RequestUtils.getContentType(flow.request)))
|
||
||
|
||
(flow.response && regex.test(ResponseUtils.getContentType(flow.response)))
|
||
);
|
||
}
|
||
contentTypeFilter.desc = "content type matches " + regex;
|
||
return contentTypeFilter;
|
||
}
|
||
function requestContentType(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function requestContentTypeFilter(flow){
|
||
return flow.request && regex.test(RequestUtils.getContentType(flow.request));
|
||
}
|
||
requestContentTypeFilter.desc = "req. content type matches " + regex;
|
||
return requestContentTypeFilter;
|
||
}
|
||
function responseContentType(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function responseContentTypeFilter(flow){
|
||
return flow.response && regex.test(ResponseUtils.getContentType(flow.response));
|
||
}
|
||
responseContentTypeFilter.desc = "resp. content type matches " + regex;
|
||
return responseContentTypeFilter;
|
||
}
|
||
function url(regex){
|
||
regex = new RegExp(regex, "i");
|
||
function urlFilter(flow){
|
||
return flow.request && regex.test(RequestUtils.pretty_url(flow.request));
|
||
}
|
||
urlFilter.desc = "url matches " + regex;
|
||
return urlFilter;
|
||
}
|
||
|
||
|
||
peg$result = peg$startRuleFunction();
|
||
|
||
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
||
return peg$result;
|
||
} else {
|
||
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
||
peg$fail({ type: "end", description: "end of input" });
|
||
}
|
||
|
||
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
|
||
}
|
||
}
|
||
|
||
return {
|
||
SyntaxError: SyntaxError,
|
||
parse: parse
|
||
};
|
||
})();
|
||
/* jshint ignore:end */
|
||
|
||
module.exports = Filt;
|
||
|
||
},{}],15:[function(require,module,exports){
|
||
var _ = require("lodash");
|
||
|
||
var _MessageUtils = {
|
||
getContentType: function (message) {
|
||
return this.get_first_header(message, /^Content-Type$/i);
|
||
},
|
||
get_first_header: function (message, regex) {
|
||
//FIXME: Cache Invalidation.
|
||
if (!message._headerLookups)
|
||
Object.defineProperty(message, "_headerLookups", {
|
||
value: {},
|
||
configurable: false,
|
||
enumerable: false,
|
||
writable: false
|
||
});
|
||
if (!(regex in message._headerLookups)) {
|
||
var header;
|
||
for (var i = 0; i < message.headers.length; i++) {
|
||
if (!!message.headers[i][0].match(regex)) {
|
||
header = message.headers[i];
|
||
break;
|
||
}
|
||
}
|
||
message._headerLookups[regex] = header ? header[1] : undefined;
|
||
}
|
||
return message._headerLookups[regex];
|
||
},
|
||
match_header: function (message, regex) {
|
||
var headers = message.headers;
|
||
var i = headers.length;
|
||
while (i--) {
|
||
if (regex.test(headers[i].join(" "))) {
|
||
return headers[i];
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
};
|
||
|
||
var defaultPorts = {
|
||
"http": 80,
|
||
"https": 443
|
||
};
|
||
|
||
var RequestUtils = _.extend(_MessageUtils, {
|
||
pretty_host: function (request) {
|
||
//FIXME: Add hostheader
|
||
return request.host;
|
||
},
|
||
pretty_url: function (request) {
|
||
var port = "";
|
||
if (defaultPorts[request.scheme] !== request.port) {
|
||
port = ":" + request.port;
|
||
}
|
||
return request.scheme + "://" + this.pretty_host(request) + port + request.path;
|
||
}
|
||
});
|
||
|
||
var ResponseUtils = _.extend(_MessageUtils, {});
|
||
|
||
|
||
module.exports = {
|
||
ResponseUtils: ResponseUtils,
|
||
RequestUtils: RequestUtils
|
||
|
||
}
|
||
},{"lodash":"lodash"}],16:[function(require,module,exports){
|
||
|
||
var _ = require("lodash");
|
||
var $ = require("jquery");
|
||
|
||
var utils = require("../utils.js");
|
||
var actions = require("../actions.js");
|
||
var dispatcher = require("../dispatcher.js");
|
||
|
||
|
||
function ListStore() {
|
||
utils.EventEmitter.call(this);
|
||
this.reset();
|
||
}
|
||
_.extend(ListStore.prototype, utils.EventEmitter.prototype, {
|
||
add: function (elem) {
|
||
if (elem.id in this._pos_map) {
|
||
return;
|
||
}
|
||
this._pos_map[elem.id] = this.list.length;
|
||
this.list.push(elem);
|
||
this.emit("add", elem);
|
||
},
|
||
update: function (elem) {
|
||
if (!(elem.id in this._pos_map)) {
|
||
return;
|
||
}
|
||
this.list[this._pos_map[elem.id]] = elem;
|
||
this.emit("update", elem);
|
||
},
|
||
remove: function (elem_id) {
|
||
if (!(elem_id in this._pos_map)) {
|
||
return;
|
||
}
|
||
this.list.splice(this._pos_map[elem_id], 1);
|
||
this._build_map();
|
||
this.emit("remove", elem_id);
|
||
},
|
||
reset: function (elems) {
|
||
this.list = elems || [];
|
||
this._build_map();
|
||
this.emit("recalculate");
|
||
},
|
||
_build_map: function () {
|
||
this._pos_map = {};
|
||
for (var i = 0; i < this.list.length; i++) {
|
||
var elem = this.list[i];
|
||
this._pos_map[elem.id] = i;
|
||
}
|
||
},
|
||
get: function (elem_id) {
|
||
return this.list[this._pos_map[elem_id]];
|
||
},
|
||
index: function (elem_id) {
|
||
return this._pos_map[elem_id];
|
||
}
|
||
});
|
||
|
||
|
||
function DictStore() {
|
||
utils.EventEmitter.call(this);
|
||
this.reset();
|
||
}
|
||
_.extend(DictStore.prototype, utils.EventEmitter.prototype, {
|
||
update: function (dict) {
|
||
_.merge(this.dict, dict);
|
||
this.emit("recalculate");
|
||
},
|
||
reset: function (dict) {
|
||
this.dict = dict || {};
|
||
this.emit("recalculate");
|
||
}
|
||
});
|
||
|
||
function LiveStoreMixin(type) {
|
||
this.type = type;
|
||
|
||
this._updates_before_fetch = undefined;
|
||
this._fetchxhr = false;
|
||
|
||
this.handle = this.handle.bind(this);
|
||
dispatcher.AppDispatcher.register(this.handle);
|
||
|
||
// Avoid double-fetch on startup.
|
||
if (!(window.ws && window.ws.readyState === WebSocket.CONNECTING)) {
|
||
this.fetch();
|
||
}
|
||
}
|
||
_.extend(LiveStoreMixin.prototype, {
|
||
handle: function (event) {
|
||
if (event.type === actions.ActionTypes.CONNECTION_OPEN) {
|
||
return this.fetch();
|
||
}
|
||
if (event.type === this.type) {
|
||
if (event.cmd === actions.StoreCmds.RESET) {
|
||
this.fetch(event.data);
|
||
} else if (this._updates_before_fetch) {
|
||
console.log("defer update", event);
|
||
this._updates_before_fetch.push(event);
|
||
} else {
|
||
this[event.cmd](event.data);
|
||
}
|
||
}
|
||
},
|
||
close: function () {
|
||
dispatcher.AppDispatcher.unregister(this.handle);
|
||
},
|
||
fetch: function (data) {
|
||
console.log("fetch " + this.type);
|
||
if (this._fetchxhr) {
|
||
this._fetchxhr.abort();
|
||
}
|
||
this._updates_before_fetch = []; // (JS: empty array is true)
|
||
if (data) {
|
||
this.handle_fetch(data);
|
||
} else {
|
||
this._fetchxhr = $.getJSON("/" + this.type)
|
||
.done(function (message) {
|
||
this.handle_fetch(message.data);
|
||
}.bind(this))
|
||
.fail(function () {
|
||
EventLogActions.add_event("Could not fetch " + this.type);
|
||
}.bind(this));
|
||
}
|
||
},
|
||
handle_fetch: function (data) {
|
||
this._fetchxhr = false;
|
||
console.log(this.type + " fetched.", this._updates_before_fetch);
|
||
this.reset(data);
|
||
var updates = this._updates_before_fetch;
|
||
this._updates_before_fetch = false;
|
||
for (var i = 0; i < updates.length; i++) {
|
||
this.handle(updates[i]);
|
||
}
|
||
},
|
||
});
|
||
|
||
function LiveListStore(type) {
|
||
ListStore.call(this);
|
||
LiveStoreMixin.call(this, type);
|
||
}
|
||
_.extend(LiveListStore.prototype, ListStore.prototype, LiveStoreMixin.prototype);
|
||
|
||
function LiveDictStore(type) {
|
||
DictStore.call(this);
|
||
LiveStoreMixin.call(this, type);
|
||
}
|
||
_.extend(LiveDictStore.prototype, DictStore.prototype, LiveStoreMixin.prototype);
|
||
|
||
|
||
function FlowStore() {
|
||
return new LiveListStore(actions.ActionTypes.FLOW_STORE);
|
||
}
|
||
|
||
function SettingsStore() {
|
||
return new LiveDictStore(actions.ActionTypes.SETTINGS_STORE);
|
||
}
|
||
|
||
function EventLogStore() {
|
||
LiveListStore.call(this, actions.ActionTypes.EVENT_STORE);
|
||
}
|
||
_.extend(EventLogStore.prototype, LiveListStore.prototype, {
|
||
fetch: function(){
|
||
LiveListStore.prototype.fetch.apply(this, arguments);
|
||
|
||
// Make sure to display updates even if fetching all events failed.
|
||
// This way, we can send "fetch failed" log messages to the log.
|
||
if(this._fetchxhr){
|
||
this._fetchxhr.fail(function(){
|
||
this.handle_fetch(null);
|
||
}.bind(this));
|
||
}
|
||
}
|
||
});
|
||
|
||
|
||
module.exports = {
|
||
EventLogStore: EventLogStore,
|
||
SettingsStore: SettingsStore,
|
||
FlowStore: FlowStore
|
||
};
|
||
},{"../actions.js":1,"../dispatcher.js":13,"../utils.js":18,"jquery":"jquery","lodash":"lodash"}],17:[function(require,module,exports){
|
||
var _ = require("lodash");
|
||
|
||
var utils = require("../utils.js");
|
||
|
||
function SortByStoreOrder(elem) {
|
||
return this.store.index(elem.id);
|
||
}
|
||
|
||
var default_sort = SortByStoreOrder;
|
||
var default_filt = function(elem){
|
||
return true;
|
||
};
|
||
|
||
function StoreView(store, filt, sortfun) {
|
||
utils.EventEmitter.call(this);
|
||
filt = filt || default_filt;
|
||
sortfun = sortfun || default_sort;
|
||
|
||
this.store = store;
|
||
|
||
this.add = this.add.bind(this);
|
||
this.update = this.update.bind(this);
|
||
this.remove = this.remove.bind(this);
|
||
this.recalculate = this.recalculate.bind(this);
|
||
this.store.addListener("add", this.add);
|
||
this.store.addListener("update", this.update);
|
||
this.store.addListener("remove", this.remove);
|
||
this.store.addListener("recalculate", this.recalculate);
|
||
|
||
this.recalculate(filt, sortfun);
|
||
}
|
||
|
||
_.extend(StoreView.prototype, utils.EventEmitter.prototype, {
|
||
close: function () {
|
||
this.store.removeListener("add", this.add);
|
||
this.store.removeListener("update", this.update);
|
||
this.store.removeListener("remove", this.remove);
|
||
this.store.removeListener("recalculate", this.recalculate);
|
||
},
|
||
recalculate: function (filt, sortfun) {
|
||
if (filt) {
|
||
this.filt = filt.bind(this);
|
||
}
|
||
if (sortfun) {
|
||
this.sortfun = sortfun.bind(this);
|
||
}
|
||
|
||
this.list = this.store.list.filter(this.filt);
|
||
this.list.sort(function (a, b) {
|
||
return this.sortfun(a) - this.sortfun(b);
|
||
}.bind(this));
|
||
this.emit("recalculate");
|
||
},
|
||
index: function (elem) {
|
||
return _.sortedIndex(this.list, elem, this.sortfun);
|
||
},
|
||
add: function (elem) {
|
||
if (this.filt(elem)) {
|
||
var idx = this.index(elem);
|
||
if (idx === this.list.length) { //happens often, .push is way faster.
|
||
this.list.push(elem);
|
||
} else {
|
||
this.list.splice(idx, 0, elem);
|
||
}
|
||
this.emit("add", elem, idx);
|
||
}
|
||
},
|
||
update: function (elem) {
|
||
var idx;
|
||
var i = this.list.length;
|
||
// Search from the back, we usually update the latest entries.
|
||
while (i--) {
|
||
if (this.list[i].id === elem.id) {
|
||
idx = i;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (idx === -1) { //not contained in list
|
||
this.add(elem);
|
||
} else if (!this.filt(elem)) {
|
||
this.remove(elem.id);
|
||
} else {
|
||
if (this.sortfun(this.list[idx]) !== this.sortfun(elem)) { //sortpos has changed
|
||
this.remove(this.list[idx]);
|
||
this.add(elem);
|
||
} else {
|
||
this.list[idx] = elem;
|
||
this.emit("update", elem, idx);
|
||
}
|
||
}
|
||
},
|
||
remove: function (elem_id) {
|
||
var idx = this.list.length;
|
||
while (idx--) {
|
||
if (this.list[idx].id === elem_id) {
|
||
this.list.splice(idx, 1);
|
||
this.emit("remove", elem_id, idx);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
module.exports = {
|
||
StoreView: StoreView
|
||
};
|
||
},{"../utils.js":18,"lodash":"lodash"}],18:[function(require,module,exports){
|
||
var $ = require("jquery");
|
||
|
||
|
||
var Key = {
|
||
UP: 38,
|
||
DOWN: 40,
|
||
PAGE_UP: 33,
|
||
PAGE_DOWN: 34,
|
||
HOME: 36,
|
||
END: 35,
|
||
LEFT: 37,
|
||
RIGHT: 39,
|
||
ENTER: 13,
|
||
ESC: 27,
|
||
TAB: 9,
|
||
SPACE: 32,
|
||
BACKSPACE: 8,
|
||
};
|
||
// Add A-Z
|
||
for (var i = 65; i <= 90; i++) {
|
||
Key[String.fromCharCode(i)] = i;
|
||
}
|
||
|
||
|
||
var formatSize = function (bytes) {
|
||
var size = bytes;
|
||
var prefix = ["B", "KB", "MB", "GB", "TB"];
|
||
var i = 0;
|
||
while (Math.abs(size) >= 1024 && i < prefix.length - 1) {
|
||
i++;
|
||
size = size / 1024;
|
||
}
|
||
return (Math.floor(size * 100) / 100.0).toFixed(2) + prefix[i];
|
||
};
|
||
|
||
|
||
var formatTimeDelta = function (milliseconds) {
|
||
var time = milliseconds;
|
||
var prefix = ["ms", "s", "min", "h"];
|
||
var div = [1000, 60, 60];
|
||
var i = 0;
|
||
while (Math.abs(time) >= div[i] && i < div.length) {
|
||
time = time / div[i];
|
||
i++;
|
||
}
|
||
return Math.round(time) + prefix[i];
|
||
};
|
||
|
||
|
||
var formatTimeStamp = function (seconds) {
|
||
var ts = (new Date(seconds * 1000)).toISOString();
|
||
return ts.replace("T", " ").replace("Z", "");
|
||
};
|
||
|
||
|
||
function EventEmitter() {
|
||
this.listeners = {};
|
||
}
|
||
EventEmitter.prototype.emit = function (event) {
|
||
if (!(event in this.listeners)) {
|
||
return;
|
||
}
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
this.listeners[event].forEach(function (listener) {
|
||
listener.apply(this, args);
|
||
}.bind(this));
|
||
};
|
||
EventEmitter.prototype.addListener = function (events, f) {
|
||
events.split(" ").forEach(function (event) {
|
||
this.listeners[event] = this.listeners[event] || [];
|
||
this.listeners[event].push(f);
|
||
}.bind(this));
|
||
};
|
||
EventEmitter.prototype.removeListener = function (events, f) {
|
||
if (!(events in this.listeners)) {
|
||
return false;
|
||
}
|
||
events.split(" ").forEach(function (event) {
|
||
var index = this.listeners[event].indexOf(f);
|
||
if (index >= 0) {
|
||
this.listeners[event].splice(index, 1);
|
||
}
|
||
}.bind(this));
|
||
};
|
||
|
||
|
||
function getCookie(name) {
|
||
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
||
return r ? r[1] : undefined;
|
||
}
|
||
var xsrf = $.param({_xsrf: getCookie("_xsrf")});
|
||
|
||
//Tornado XSRF Protection.
|
||
$.ajaxPrefilter(function (options) {
|
||
if (["post", "put", "delete"].indexOf(options.type.toLowerCase()) >= 0 && options.url[0] === "/") {
|
||
if (options.data) {
|
||
options.data += ("&" + xsrf);
|
||
} else {
|
||
options.data = xsrf;
|
||
}
|
||
}
|
||
});
|
||
// Log AJAX Errors
|
||
$(document).ajaxError(function (event, jqXHR, ajaxSettings, thrownError) {
|
||
var message = jqXHR.responseText;
|
||
console.error(message, arguments);
|
||
EventLogActions.add_event(thrownError + ": " + message);
|
||
window.alert(message);
|
||
});
|
||
|
||
module.exports = {
|
||
EventEmitter: EventEmitter,
|
||
formatSize: formatSize,
|
||
formatTimeDelta: formatTimeDelta,
|
||
formatTimeStamp: formatTimeStamp
|
||
};
|
||
},{"jquery":"jquery"}]},{},[2])
|
||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvanMvYWN0aW9ucy5qcyIsInNyYy9qcy9hcHAuanMiLCJzcmMvanMvY29tcG9uZW50cy9mbG93ZGV0YWlsLmpzeC5qcyIsInNyYy9qcy9jb21wb25lbnRzL2Zsb3d0YWJsZS1jb2x1bW5zLmpzeC5qcyIsInNyYy9qcy9jb21wb25lbnRzL2Zsb3d0YWJsZS5qc3guanMiLCJzcmMvanMvY29tcG9uZW50cy9mb290ZXIuanN4LmpzIiwic3JjL2pzL2NvbXBvbmVudHMvaGVhZGVyLmpzeC5qcyIsInNyYy9qcy9jb21wb25lbnRzL21haW52aWV3LmpzeC5qcyIsInNyYy9qcy9jb21wb25lbnRzL3Byb3h5YXBwLmpzeC5qcyIsInNyYy9qcy9jb21wb25lbnRzL3V0aWxzLmpzeC5qcyIsInNyYy9qcy9jb21wb25lbnRzL3ZpcnR1YWxzY3JvbGwuanN4LmpzIiwic3JjL2pzL2Nvbm5lY3Rpb24uanMiLCJzcmMvanMvZGlzcGF0Y2hlci5qcyIsInNyYy9qcy9maWx0L2ZpbHQuanMiLCJzcmMvanMvZmxvdy91dGlscy5qcyIsInNyYy9qcy9zdG9yZS9zdG9yZS5qcyIsInNyYy9qcy9zdG9yZS92aWV3LmpzIiwic3JjL2pzL3V0aWxzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOi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zZSB7XG4gICAgICAgICAgICBjb250ZW50ID0gUmVhY3QuY3JlYXRlRWxlbWVudChcImRpdlwiLCB7Y2xhc3NOYW1lOiBcImFsZXJ0IGFsZXJ0LWluZm9cIn0sIFwiTm8gQ29udGVudFwiKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vVE9ETzogU3R5bGluZ1xuXG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwic2VjdGlvblwiLCBudWxsLCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IFwiZmlyc3QtbGluZVwifSwgZmlyc3RfbGluZSApLCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KEhlYWRlcnMsIHttZXNzYWdlOiBmbG93LnJlc3BvbnNlfSksIFxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJoclwiLCBudWxsKSwgXG4gICAgICAgICAgICAgICAgY29udGVudFxuICAgICAgICAgICAgKVxuICAgICAgICApO1xuICAgIH1cbn0pO1xuXG52YXIgRmxvd0RldGFpbEVycm9yID0gUmVhY3QuY3JlYXRlQ2xhc3Moe2Rpc3BsYXlOYW1lOiBcIkZsb3dEZXRhaWxFcnJvclwiLFxuICAgIHJlbmRlcjogZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgZmxvdyA9IHRoaXMucHJvcHMuZmxvdztcbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJzZWN0aW9uXCIsIG51bGwsIFxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge2NsYXNzTmFtZTogXCJhbGVydCBhbGVydC13YXJuaW5nXCJ9LCBcbiAgICAgICAgICAgICAgICBmbG93LmVycm9yLm1zZywgXG4gICAgICAgICAgICAgICA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UmVhY3QuY3JlYXRlRWxlbWVudChcInRkXCIsIG51bGwsIGNvbm4uc25pKVxuICAgICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcInRhYmxlXCIsIHtjbGFzc05hbWU6IFwiY29ubmVjdGlvbi10YWJsZVwifSwgXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcInRib2R5XCIsIG51bGwsIFxuICAgICAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwidHJcIiwge2tleTogXCJhZGRyZXNzXCJ9LCBcbiAgICAgICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJ0ZFwiLCBudWxsLCBcIkFkZHJlc3M6XCIpLCBcbiAgICAgICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJ0ZFwiLCBudWxsLCBhZGRyZXNzKVxuICAgICAgICAgICAgICAgICAgICApLCBcbiAgICAgICAgICAgICAgICAgICAgc25pXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuICAgICAgICApO1xuICAgIH1cbn0pO1xuXG52YXIgQ2VydGlmaWNhdGVJbmZvID0gUmVhY3QuY3JlYXRlQ2xhc3Moe2Rpc3BsYXlOYW1lOiBcIkNlcnRpZmljYXRlSW5mb1wiLFxuICAgIHJlbmRlcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAvL1RPRE86IFdlIHNob3VsZCBmZXRjaCBodW1hbi1yZWFkYWJsZSBjZXJ0aWZpY2F0ZSByZXByZXNlbnRhdGlvblxuICAgICAgICAvLyBmcm9tIHRoZSBzZXJ2ZXJcbiAgICAgICAgdmFyIGZsb3cgPSB0aGlzLnByb3BzLmZsb3c7XG4gICAgICAgIHZhciBjbGllbnRfY29ubiA9IGZsb3cuY2xpZW50X2Nvbm47XG4gICAgICAgIHZhciBzZX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AgdmFyIHJlc3AgPSBmbG93LnJlc3BvbnNlO1xuXG4gICAgICAgIHZhciB0aW1lc3RhbXBzID0gW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIHRpdGxlOiBcIlNlcnZlciBjb25uLiBpbml0aWF0ZWRcIixcbiAgICAgICAgICAgICAgICB0OiBzYy50aW1lc3RhbXBfc3RhcnQsXG4gICAgICAgICAgICAgICAgZGVsdGFUbzogcmVxLnRpbWVzdGFtcF9zdGFydFxuICAgICAgICAgICAgfSwge1xuICAgICAgICAgICAgICAgIHRpdGxlOiBcIlNlcnZlciBjb25uLiBUQ1AgaGFuZHNoYWtlXCIsXG4gICAgICAgICAgICAgICAgdDogc2MudGltZXN0YW1wX3RjcF9zZXR1cCxcbiAgICAgICAgICAgICAgICBkZWx0YVRvOiByZXEudGltZXN0YW1wX3N0YXJ0XG4gICAgICAgICAgICB9LCB7XG4gICAgICAgICAgICAgICAgdGl0bGU6IFwiU2VydmVyIGNvbm4uIFNTTCBoYW5kc2hha2VcIixcbiAgICAgICAgICAgICAgICB0OiBzYy50aW1lc3RhbXBfc3NsX3NldHVwLFxuICAgICAgICAgICAgICAgIGRlbHRhVG86IHJlcS50aW1lc3RhbXBfc3RhcnRcbiAgICAgICAgICAgIH0sIHtcbiAgICAgICAgICAgICAgICB0aXRsZTogXCJDbGllbnQgY29ubi4gZXN0YWJsaXNoZWRcIixcbiAgICAgICAgICAgICAgICB0OiBjYy50aW1lc3RhbXBfc3RhcnQsXG4gICAgICAgICAgICAgICAgZGVsdGFUbzogcmVxLnRpbWVzdGFtcF9zdGFydFxuICAgICAgICAgICAgfSwge1xuICAgICAgICAgICAgICAgIHRpdGxlOiBcIkNsaWVudCBjb25uLiBTU0wgaGFuZHNoYWtlXCIsXG4gICAgICAgICAgICAgICAgdDogY2MudGltZXN0YW1wX3NzbF9zZXR1cCxcbiAgICAgICAgICAgICAgICBkZWx0YVRvOiByZXEudGltZXN0YW1wX3N0YXJ0XG4gICAgICAgICAgICB9LCB7XG4gICAgICAgICAgICAgICAgdGl0bGU6IFwiRmlyc3QgcmVxdWVzdCBieXRlXCIsXG4gICAgICAgICAgICAgICAgdDogcmVxLnRpbWVzdGFtcF9zdGFydCxcbiAgICAgICAgICAgIH0sIHtcbiAgICAgICAgICAgICAgICB0aXRsZTogXCJSZXF1ZXN0IGNvbXBsZXRlXCIsXG4gICAgICAgICAgICAgICAgdDogcmVxLnRpbWVzdGFtcF9lbmQsXG4gICAgICAgICAgICAgICAgZGVsdGFUbzogcmVxLnRpbWVzdGFtcF9zdGFydFxuICAgICAgICAgICAgfVxuICAgICAgICBdO1xuXG4gICAgICAgIGlmIChmbG93LnJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aW1lc3RhbXBzLnB1c2goXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXCJGaXJzdCByZXNwb25zZSBieXRlXCIsXG4gICAgICAgICAgICAgICAgICAgIHQ6IHJlc3AudGltZXN0YW1wX3N0YXJ0LFxuICAgICAgICAgICAgICAgICAgICBkZWx0YVRvOiByZXEudGltZXN0YW1wX3N0YXJ0XG4gICAgICAgICAgICAgICAgfSwge1xuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXCJSZXNwb25zZSBjb21wbGV0ZVwiLFxuICAgICAgICAgICAgICAgICAgICB0OiByZXNwLnRpbWVzdGFtcF9lbmQsXG4gICAgICAgICAgICAgICAgICAgIGRlbHRhVG86IHJlcS50aW1lc3RhbXBfc3RhcnRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApO1xuICAgICAgICB9XG5cbiAgICAgICAgLy9BZGQgdW5pcXVlIGtleSBmb3IgZWFjaCByb3cuXG4gICAgICAgIHRpbWVzdGFtcHMuZm9yRWFjaChmdW5jdGlvbiAoZSkge1xuICAgICAgICAgICAgZS5rZXkgPSBlLnRpdGxlO1xuICAgICAgICB9KTtcblxuICAgICAgICB0aW1lc3RhbXBzID0gXy5zb3J0QnkodGltZ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Rpb24gKCkge1xuICAgICAgICB2YXIgZmxvdyA9IHRoaXMucHJvcHMuZmxvdztcbiAgICAgICAgdmFyIHRhYnMgPSB0aGlzLmdldFRhYnMoZmxvdyk7XG4gICAgICAgIHZhciBhY3RpdmUgPSB0aGlzLmdldFBhcmFtcygpLmRldGFpbFRhYjtcblxuICAgICAgICBpZiAoIV8uY29udGFpbnModGFicywgYWN0aXZlKSkge1xuICAgICAgICAgICAgaWYgKGFjdGl2ZSA9PT0gXCJyZXNwb25zZVwiICYmIGZsb3cuZXJyb3IpIHtcbiAgICAgICAgICAgICAgICBhY3RpdmUgPSBcImVycm9yXCI7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGFjdGl2ZSA9PT0gXCJlcnJvclwiICYmIGZsb3cucmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICBhY3RpdmUgPSBcInJlc3BvbnNlXCI7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGFjdGl2ZSA9IHRhYnNbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLnNlbGVjdFRhYihhY3RpdmUpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIFRhYiA9IGFsbFRhYnNbYWN0aXZlXTtcbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge2NsYXNzTmFtZTogXCJmbG93LWRldGFpbFwiLCBvblNjcm9sbDogdGhpcy5hZGp1c3RIZWFkfSwgXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChGbG93RGV0YWlsTmF2LCB7cmVmOiBcImhlYWRcIiwgXG4gICAgICAgICAgICAgICAgICAgIGZsb3c6IGZsb3csIFxuICAgICAgICAgICAgICAgICAgICB0YWJzOiB0YWJzLCBcbiAgICAgICAgICAgICAgICAgICAgYWN0aXZlOiBhY3RpdmUsIFxuICAgICAgICAgICAgICAgICAgICBzZWxlY3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nRlbnRUeXBlLmluZGV4T2YoXCJpbWFnZVwiKSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgaWNvbiA9IFwicmVzb3VyY2UtaWNvbi1pbWFnZVwiO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjb250ZW50VHlwZSAmJiBjb250ZW50VHlwZS5pbmRleE9mKFwiamF2YXNjcmlwdFwiKSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgaWNvbiA9IFwicmVzb3VyY2UtaWNvbi1qc1wiO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjb250ZW50VHlwZSAmJiBjb250ZW50VHlwZS5pbmRleE9mKFwiY3NzXCIpID49IDApIHtcbiAgICAgICAgICAgICAgICBpY29uID0gXCJyZXNvdXJjZS1pY29uLWNzc1wiO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjb250ZW50VHlwZSAmJiBjb250ZW50VHlwZS5pbmRleE9mKFwiaHRtbFwiKSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgaWNvbiA9IFwicmVzb3VyY2UtaWNvbi1kb2N1bWVudFwiO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICghaWNvbikge1xuICAgICAgICAgICAgaWNvbiA9IFwicmVzb3VyY2UtaWNvbi1wbGFpblwiO1xuICAgICAgICB9XG5cblxuICAgICAgICBpY29uICs9IFwiIHJlc291cmNlLWljb25cIjtcbiAgICAgICAgcmV0dXJuIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJ0ZFwiLCB7Y2xhc3NOYW1lOiBcImNvbC1pY29uXCJ9LCBcbiAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge2NsYXNzTmFtZTogaWNvbn0pXG4gICAgICAgICk7XG4gICAgfVxufSk7XG5cbnZhciBQYXRoQ29sdW1uID0gUmVhY3QuY3JlYXRlQ2xhc3Moe2Rpc3BsYXlOYW1lOiBcIlBhdGhDb2x1bW5cIixcbiAgICBzdGF0a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m93SGVpZ2h0OiBST1dfSEVJR0hUXG4gICAgICAgIH07XG4gICAgfSxcbiAgICBvblNjcm9sbEZsb3dUYWJsZTogZnVuY3Rpb24gKCkge1xuICAgICAgICB0aGlzLmFkanVzdEhlYWQoKTtcbiAgICAgICAgdGhpcy5vblNjcm9sbCgpO1xuICAgIH0sXG4gICAgb25DaGFuZ2U6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdGhpcy5mb3JjZVVwZGF0ZSgpO1xuICAgIH0sXG4gICAgc2Nyb2xsSW50b1ZpZXc6IGZ1bmN0aW9uIChmbG93KSB7XG4gICAgICAgIHRoaXMuc2Nyb2xsUm93SW50b1ZpZXcoXG4gICAgICAgICAgICB0aGlzLnByb3BzLnZpZXcuaW5kZXgoZmxvdyksXG4gICAgICAgICAgICB0aGlzLnJlZnMuYm9keS5nZXRET01Ob2RlKCkub2Zmc2V0VG9wXG4gICAgICAgICk7XG4gICAgfSxcbiAgICByZW5kZXJSb3c6IGZ1bmN0aW9uIChmbG93KSB7XG4gICAgICAgIHZhciBzZWxlY3RlZCA9IChmbG93ID09PSB0aGlzLnByb3BzLnNlbGVjdGVkKTtcbiAgICAgICAgdmFyIGhpZ2hsaWdodGVkID1cbiAgICAgICAgICAgIChcbiAgICAgICAgICAgIHRoaXMucHJvcHMudmlldy5faGlnaGxpZ2h0ICYmXG4gICAgICAgICAgICB0aGlzLnByb3BzLnZpZXcuX2hpZ2hsaWdodFtmbG93LmlkXVxuICAgICAgICAgICAgKTtcblxuICAgICAgICByZXR1cm4gUmVhY3QuY3JlYXRlRWxlbWVudChGbG93Um93LCB7a2V5OiBmbG93LmlkLCBcbiAgICAgICAgICAgIHJlZjogZmxvdy5pZCwgXG4gICAgICAgICAgICBmbG93OiBmbG93LCBcbiAgICAgICAgICAgIGNvbHVtbnM6IHRoaXMuc3RhdGUuY29sdW1ucywgXG4gICAgICAgICAgICBzZWxlY3RlZDogc2VsZWN0ZWQsIFxuICAgICAgICAgICAgaGlnaGxpZ2h0ZWQ6IGhpZ2hsaWdodGVkLCBcbiAgICAgICAgICAgIHNlbGVjdEZsb3c6IHRoaXMucHJvcHMuc2VsZWN0Rmxvd31cbiAgICAgICAgKTtcbiAgICB9LFxuICAgIHJlbmRlcjogZnVuY3Rpb24gKCkge1xuICAgICAgICAvL2NvbnNvbGUubG9nKFwicmVuZGVyIGZsb3d0YWJsZVwiLCB0aGlzLnN0YXRlLnN0YXJ0LCB0aGlzLnN0YXRlLnN0b3AsIHRoaXMucHJvcHMuc2VsZWN0ZWQpO1xuICAgICAgICB2YXIgZmxvd3MgPSB0aGlzLnByb3BzLnZpZXcgPyB0aGlzLnByb3BzLnZpZXcubGlzdCA6IFtdO1xuXG4gICAgICAgIHZhciByb3dzID0gdGhpcy5yZW5kZXJSb3dzKGZsb3dzKTtcblxuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImRpdlwiLCB7Y2xhc3NOYW1lOiBcImZsb3ctdGFibGVcIiwgb25TY3JvbGw6IHRoaXMub25TY3JvbGxGbG93VGFibGV9LCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwidGFibGVcIiwgbnVsbCwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoRmxvd1RhYmxlSGVhZCwge3JlZjogXCJoZWFkXCIsIFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uczogdGhpcy5zdGF0ZS5jb2x1bW5zfSksIFxuICAgICAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwidGJvZHlcIiwge3JlZjogXCJib2R5XCJ9LCBcbiAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdldFBsYWNlaG9sZGVyVG9wKGZsb3dzLmxlbmd0aCksIFxuICAgICAgICAgICAgICAgICAgICAgICAgcm93cywgXG4gICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRQbGFjZWh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nVuY3Rpb24gKGMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gUmVhY3QuY3JlYXRlRWxlbWVudChcInRyXCIsIG51bGwsIFxuICAgICAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwidGRcIiwgbnVsbCwgY1swXS5yZXBsYWNlKFwiIFwiLCAnXFx1MDBhMCcpKSwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJ0ZFwiLCBudWxsLCBjWzFdKVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGNvbW1hbmRzLnB1c2goUmVhY3QuY3JlYXRlRWxlbWVudChcInRyXCIsIG51bGwsIFxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJ0ZFwiLCB7Y29sU3BhbjogXCIyXCJ9LCBcbiAgICAgICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImFcIiwge2hyZWY6IFwiaHR0cHM6Ly9taXRtcHJveHkub3JnL2RvYy9mZWF0dXJlcy9maWx0ZXJzLmh0bWxcIiwgXG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IFwiX2JsYW5rXCJ9LCBcbiAgICAgICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJpXCIsIHtjbGFzc05hbWU6IFwiZmEgZmEtZXh0ZXJuYWwtbGlua1wifSksIFxuICAgICAgICAgICAgICAgICAgICBcIsKgIG1pdG1wcm94eSBkb2NzXCIpXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICByZXR1cm4gUmVhY3QuY3JlYXRlRWxlbWVudChcInRhYmxlXCIsIHtjbGFzc05hbWU6IFwidGFibGUgdGFibGUtY29uZGVuc2VkXCJ9LCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwidGJv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ZS5mb2N1cyB8fCB0aGlzLnN0YXRlLm1vdXNlZm9jdXMpIHtcbiAgICAgICAgICAgIHBvcG92ZXIgPSAoXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImRpdlwiLCB7Y2xhc3NOYW1lOiBcInBvcG92ZXIgYm90dG9tXCIsIG9uTW91c2VFbnRlcjogdGhpcy5vbk1vdXNlRW50ZXIsIG9uTW91c2VMZWF2ZTogdGhpcy5vbk1vdXNlTGVhdmV9LCBcbiAgICAgICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImRpdlwiLCB7Y2xhc3NOYW1lOiBcImFycm93XCJ9KSwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge2NsYXNzTmFtZTogXCJwb3BvdmVyLWNvbnRlbnRcIn0sIFxuICAgICAgICAgICAgICAgICAgICB0aGlzLmdldERlc2MoKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IGdyb3VwQ2xhc3NOYW1lfSwgXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcInNwYW5cIiwge2NsYXNzTmFtZTogXCJpbnB1dC1ncm91cC1hZGRvblwifSwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJpXCIsIHtjbGFzc05hbWU6IGljb24sIHN0eWxlOiB7Y29sb3I6IHRoaXMucHJvcHMuY29sb3J9fSlcbiAgICAgICAgICAgICAgICApLCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiaW5wdXRcIiwge3R5cGU6IFwidGV4dFwiLCBwbGFjZWhvbGRlcjogdGhpcy5wcm9wcy5wbGFjZWhvbGRlciwgY2xhc3NOYW1lOiBcImZvcm0tY29udHJvbFwiLCBcbiAgICAgICAgICAgICAgICAgICAgcmVmOiBcImlucHV0XCIsIFxuICAgICAgICAgICAgICAgICAgICBvbkNoYW5nZTogdGhpcy5vbkNoYW5nZSwgXG4gICAgICAgICAgICAgICAgICAgIG9uRm9jdXM6IHRoaXMub25Gb2N1cywgXG4gICAgICAgICAgICAgICAgICAgIG9uQmx1cjogdGhpcy5vbkJsdXIsIFxuICAgICAgICAgICAgICAgICAgICBvbktleURvd246IHRoaXMub25LZXlEb3duLCBcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHRoaXMuc3RhdGUudmFsdWV9KSwgXG4gICAgICAgICAgICAgICAgcG9wb3ZlclxuICAgICAgICAgICAgKVxuICAgICAgICApO1xuICAgIH1cbn0pO1xuXG52YXIgTWFpbk1lbnUgPSBSZWFjdC5jcmVhdGVDbGFzcyh7ZGlzcGxheU5hbWU6IFwiTWFpbk1lbnVcIixcbiAgICBtaXhpbnM6IFt1dGlscy5OYXZpZ2F0aW9uLCB1dGlscy5TdGF0ZV0sXG4gICAgc3RhdGljczoge1xuICAgICAgICB0aXRsZTogXCJTdGFydFwiLFxuICAgICAgICByb3V0ZTogXCJmbG93c1wiXG4gICAgfSxcbiAgICBvbkZpbHRlckNoYW5nZTogZnVuY3Rpb24gKHZhbCkge1xuICAgICAgICB2YXIgZCA9IHt9O1xuICAgICAgICBkW1F1ZXJ5LkZJTFRFUl0gPSB2YWw7XG4gICAgICAgIHRoaXMuc2V0UXVlcnkoZCk7XG4gICAgfSxcbiAgICBvbkhpZ2hsaWdodENoYW5nZTogZnVuY3Rpb24gKHZhbCkge1xuICAgICAgICB2YXIgZCA9IHt9O1xuICAgICAgICBkW1F1ZXJ5LkhJR0hMSUdIVF0gPSB2YWw7XG4gICAgICAgIHRoaXMuc2V0UXVlcnkoZCk7XG4gICAgfSxcbiAgICBvbkludGVyY2VwdENoYW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pZ2hsaWdodFwiLCBcbiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFwidGFnXCIsIFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sb3I6IFwiaHNsKDQ4LCAxMDAlLCA1MCUpXCIsIFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGhpZ2hsaWdodCwgXG4gICAgICAgICAgICAgICAgICAgICAgICBvbkNoYW5nZTogdGhpcy5vbkhpZ2hsaWdodENoYW5nZX0pLCBcbiAgICAgICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChGaWx0ZXJJbnB1dCwge1xuICAgICAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXI6IFwiSW50ZXJjZXB0XCIsIFxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogXCJwYXVzZVwiLCBcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yOiBcImhzbCgyMDgsIDU2JSwgNTMlKVwiLCBcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpbnRlcmNlcHQsIFxuICAgICAgICAgICAgICAgICAgICAgICAgb25DaGFuZ2U6IHRoaXMub25JbnRlcmNlcHRDaGFuZ2V9KVxuICAgICAgICAgICAgICAgICksIFxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge2NsYXNzTmFtZTogXCJjbGVhcmZpeFwifSlcbiAgICAgICAgICAgIClcbiAgICAgICAgKTtcbiAgICB9XG59KTtcblxuXG52YXIgVmlld01lbnUgPSBSZWFjdC5jcmVhdGVDbGFzcyh7ZGlzcGxheU5hbWU6IFwiVmlld01lbnVcIixcbiAgICBzdGF0aWNzOiB7XG4gICAgICAgIHRpdGxlOiBcIlZpZXdcIixcbiAgICAgICAgcm91dGU6IFwiZmxvd3NcIlxuICAgIH0sXG4gICAgbWl4aW5zOiBbdXRpbHMuTmF2aWdhdGlvbiwgdXRpbHMuU3RhdGVdLFxuICAgIHRvZ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xuICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImRpdlwiLCB7Y2xhc3NOYW1lOiBmaWxlTWVudUNsYXNzfSwgXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImFcIiwge2hyZWY6IFwiI1wiLCBjbGFzc05hbWU6IFwic3BlY2lhbFwiLCBvbkNsaWNrOiB0aGlzLmhhbmRsZUZpbGVDbGlja30sIFwiIEZpbGUgXCIpLCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwidWxcIiwge2NsYXNzTmFtZTogXCJkcm9wZG93bi1tZW51XCIsIHJvbGU6IFwibWVudVwifSwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJsaVwiLCBudWxsLCBcbiAgICAgICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJhXCIsIHtocmVmOiBcIiNcIiwgb25DbGljazogdGhpcy5oYW5kbGVOZXdDbGlja30sIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJpXCIsIHtjbGFzc05hbWU6IFwiZmEgZmEtZncgZmEtZmlsZVwifSksIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiTmV3XCJcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKSwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJsaVwiLCB7cm9sZTogXCJwcmVzZW50YXRpb25cIiwgY2xhc3NOYW1lOiBcImRpdmlkZXJcIn0pLCBcbiAgICAgICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImxpXCIsIG51bGwsIFxuICAgICAgICAgICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImFcIiwge2hyZWY6IFwiaHR0cDovL21pdG0uaXQvXCIsIHRhcmdldDogXCJfYmxhbmtcIn0sIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJpXCIsIHtjbGFzc05hbWU6IFwiZmEgZmEtZncgZmEtZXh0ZXJuYWwtbGlua1wifSksIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiSW5zdGFsbCBDZXJ0aWZpY2F0ZXMuLi5cIlxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgLypcbiAgICAgICAgICAgICAgICAgPGxpPlxuICAgICAgICAgICAgICAgICA8YSBocmVmPVwiI1wiIG9uQ2xpY2s9e3RoaXMuaGFuZGxlT3BlbkNsaWNrfT5cbiAgICAgICAgICAgICAgICAgPGkgY2xhc3NOYW1lPVwiZmEgZmEtZncgZmEtZm9sZGVyLW9wZW5cIj48L2k+XG4gICAgICAgICAgICAgICAgIE9wZW5cbiAgICAgICAgICAgICAgICAgPC9hPlxuICAgICAgICAgICAgICAgICA8L2xpPlxuICAgICAgICAgICAgICAgICA8bGk+XG4gICAgICAgICAgICAgICAgIDxhIGhyZWY9XCIjXCIgb25DbGljaz17dGhpcy5oYW5kbGVTYXZlQ2xpY2t9PlxuICAgICAgICAgICAgICAgICA8aSBjbGFzc05hbWU9XCJmYSBmYS1mdyBmYS1zYXZlXCI+PC9pPlxuICAgICAgICAgICAgICAgICBTYXZlXG4gICAgICAgICAgICAgICAgIDwvYT5cbiAgICAgICAgICAgICAgICAgPC9saT5cbiAgICAgICAgICAgICAgICAgPGxpIHJvbGU9XCJwcmVzZW50YXRpb25cIiBjbGFzc05hbWU9XCJkaXZpZGVyXCI+PC9saT5cbiAgICAgICAgICAgICAgICAgPGxpPlxuICAgICAgICAgICAgICAgICA8YSBocmVmPVwiI1wiIG9uQ2xpY2s9e3RoaXMuaGFuZGxlU2h1dGRvd25DbGlja30+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ICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiYVwiLCB7a2V5OiBpLCBcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogXCIjXCIsIFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IGNsYXNzZXMsIFxuICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiB0aGlzLmhhbmRsZUNsaWNrLmJpbmQodGhpcywgZW50cnkpXG4gICAgICAgICAgICAgICAgfSwgXG4gICAgICAgICAgICAgICAgICAgICBlbnRyeS50aXRsZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICk7XG4gICAgICAgIH0uYmluZCh0aGlzKSk7XG5cbiAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJoZWFkZXJcIiwgbnVsbCwgXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcImRpdlwiLCB7Y2xhc3NOYW1lOiBcInRpdGxlLWJhclwifSwgXG4gICAgICAgICAgICAgICAgICAgIFwibWl0bXByb3h5IFwiLCAgdGhpcy5wcm9wcy5zZXR0aW5ncy52ZXJzaW9uXG4gICAgICAgICAgICAgICAgKSwgXG4gICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChcIm5hdlwiLCB7Y2xhc3NOYW1lOiBcIm5hdi10YWJzIG5hdi10YWJzLWxnXCJ9LCBcbiAgICAgICAgICAgICAgICAgICAgUmVhY3QuY3JlYXRlRWxlbWVudChGaWxlTWVudSwgbnVsbCksIFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJcbiAgICAgICAgICAgICAgICApLCBcbiAgICAgICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IFwibWVudVwifSwgXG4gICAgICAgICAgICAgICAgICAgIFJlYWN0LmN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IChmbG93KSB7XG4gICAgICAgIGlmIChmbG93LmlkID09PSB0aGlzLmdldFBhcmFtcygpLmZsb3dJZCkge1xuICAgICAgICAgICAgdGhpcy5mb3JjZVVwZGF0ZSgpO1xuICAgICAgICB9XG4gICAgfSxcbiAgICBvblJlbW92ZTogZnVuY3Rpb24gKGZsb3dfaWQsIGluZGV4KSB7XG4gICAgICAgIGlmIChmbG93X2lkID09PSB0aGlzLmdldFBhcmFtcygpLmZsb3dJZCkge1xuICAgICAgICAgICAgdmFyIGZsb3dfdG9fc2VsZWN0ID0gdGhpcy5zdGF0ZS52aWV3Lmxpc3RbTWF0aC5taW4oaW5kZXgsIHRoaXMuc3RhdGUudmlldy5saXN0Lmxlbmd0aCAtMSldO1xuICAgICAgICAgICAgdGhpcy5zZWxlY3RGbG93KGZsb3dfdG9fc2VsZWN0KTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgY2xvc2VWaWV3OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHRoaXMuc3RhdGUudmlldy5jbG9zZSgpO1xuICAgIH0sXG4gICAgY29tcG9uZW50V2lsbE1vdW50OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHRoaXMub3BlblZpZXcodGhpcy5wcm9wcy5mbG93U3RvcmUpO1xuICAgIH0sXG4gICAgY29tcG9uZW50V2lsbFVubW91bnQ6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdGhpcy5jbG9zZVZpZXcoKTtcbiAgICB9LFxuICAgIHNlbGVjdEZsb3c6IGZ1bmN0aW9uIChmbG93KSB7XG4gICAgICAgIGlmIChmbG93KSB7XG4gICAgICAgICAgICB0aGlzLnJlcGxhY2VXaXRoKFxuICAgICAgICAgICAgICAgIFwiZmxvd1wiLFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgZmxvd0lkOiBmbG93LmlkLFxuICAgICAgICAgICAgICAgICAgICBkZXRhaWxUYWI6IHRoaXMuZ2V0UGFyYW1zKCkuZGV0YWlsVGFiIHx8IFwicmVxdWVzdFwiXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIHRoaXMucmVmcy5mbG93VGFibGUuc2Nyb2xsSW50b1ZpZXcoZmxvdyk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnJlcGxhY2VXaXRoKFwiZmxvd3NcIiwge30pO1xuICAgICAgICB9XG4gICAgfSxcbiAgICBzZWxlY3RGbG93UmVsYXRpdmU6IGZ1bmN0aW9uIChzaGlmdCkge1xuICAgICAgICB2YXIgZmxvd3MgPSB0aGlzLnN0YXRlLnZpZXcubGlzdDtcbiAgICAgICAgdmFyIGluZGV4O1xuICAgICAgICBpZiAoIXRoaXMuZ2V0UGFyYW1zKCkuZmxvd0lkKSB7XG4gICAgICAgICAgICBpZiAoc2hpZnQgPiAwKSB7XG4gICAgICAgICAgICAgICAgaW5kZXggPSBmbG93cy5sZW5ndGggLSAxO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpbmRleCA9IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB2YXIgY3VyckZsb3dJZCA9IHRoaXMuZ2V0UGFyYW1zKCkuZmxvd0lkO1xuICAgICAgICAgICAgdmFyIGkgPSBmbG93cy5sZW5ndGg7XG4gICAgICAgICAgICB3aGlsZSAoaS0tKSB7XG4gICAgICAgICAgICAgICAgaWYgKGZsb3dzW2ldLmlkID09PSBjdXJyRmxvd0lkKSB7XG4gICAgICAgICAgICAgICAgICAgIGluZGV4ID0gaTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW5kZXggPSBNYXRoLm1pbihcbiAgICAgICAgICAgICAgICBNYXRoLm1heCgwLCBpbmRleCArIHNoaWZ0KSxcbiAgICAgICAgICAgICAgICBmbG93cy5sZW5ndGggLSAxKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnNlbGVjdEZsb3coZmxvd3NbaW5kZXhdKTtcbiAgICB9LFxuICAgIG9uS2V5RG93bjogZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgdmFyIGZsb3cgPSB0aGlzLmdldFNlbGVjdGVkKCk7XG4gICAgICAgIGlmIChlLmN0cmxLZXkpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBzd2l0Y2ggKGUua2V5Q29kZSkge1xuICAgICAgICAgICAgY2FzZSBLZXkuSzpcbiAgICAgICAgICAgIGNhc2UgS2V5LlVQOlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0Rmxvd1JlbGF0aXZlKC0xKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgS2V5Lko6XG4gICAgICAgICAgICBjYXNlIEtleS5ET1dOOlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0Rmxvd1JlbGF0aXZlKCsxKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgS2V5LlNQQUNFOlxuICAgICAgICAgICAgY2FzZSBLZXkuUEFHRV9ET1dOOlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0Rmxvd1JlbGF0aXZlKCsxMCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEtleS5QQUdFX1VQOlxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0Rmxvd1JlbGF0aXZlKC0xMCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEtleS5FTkQ6XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RGbG93UmVsYXRpdmUoKzFlMTApO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBLZXkuSE9NRTpcbiAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdEZsb3dSZWxhdGl2ZSgtMWUxMCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEtleS5FU0M6XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RGbG93KG51bGwpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBLZXkuSDpcbiAgICAgICAgICAgIGNhc2UgS2V5LkxFRlQ6XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMucmVmcy5mbG93RGV0YWlscykge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZnMuZmxvd0RldGFpbHMubmV4dFRhYigtMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBLZXkuTDpcbiAgICAgICAgICAgIGNhc2UgS2V5LlRBQjpcbiAgICAgICAgICAgIGNhc2UgS2V5LlJJR0hUOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLnJlZnMuZmxvd0RldGFpbHMpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWZzLmZsb3dEZXRhaWxzLm5leHRUYWIoKzEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgS2V5LkM6XG4gICAgICAgICAgICAgICAgaWYgKGUuc2hpZnRLZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgRmxvd0FjdGlvbnMuY2xlYXIoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEtleS5EOlxuICAgICAgICAgICAgICAgIGlmIChmbG93KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlLnNoaWZ0S2V5KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBGbG93QWN0aW9ucy5kdXBsaWNhdGUoZmxvdyk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBGbG93QWN0aW9ucy5kZWxldGUoZmxvdyk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIEtleS5BOlxuICAgICAgICAgICAgICAgIGlmIChlLnNoaWZ0S2V5KSB7XG4gICAgICAgICAgICAgICAgICAgIEZsb3dBY3Rpb25zLmFjY2VwdF9hbGwoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZsb3cgJiYgZmxvdy5pbnRlcmNlcHRlZCkge1xuICAgICAgICAgICAgICAgICAgICBGbG93QWN0aW9ucy5hY2NlcHQoZmxvdyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBLZXkuUjpcbiAgICAgICAgICAgICAgICBpZiAoIWUuc2hpZnRLZXkgJiYgZmxvdykge1xuICAgICAgICAgICAgICAgICAgICBGbG93QWN0aW9ucy5yZXBsYXkoZmxvdyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBLZXkuVjpcbiAgICAgICAgICAgICAgICBpZihlLnNoaWZ0S2V5ICYmIGZsb3cgJiYgZmxvdy5tb2RpZmllZCkge1xuICAgICAgICAgICAgICAgICAgICBGbG93QWN0aW9ucy5yZXZlcnQoZmxvdyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBjb25zb2xlLmRlYnVnKFwia2V5ZG93blwiLCBlLmtleUNvZGUpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgfSxcbiAgICBnZXRTZWxlY3RlZDogZnVuY3Rpb24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xzZSB7XG4gICAgICAgICAgICBjbGFzc05hbWUgKz0gXCIgc3BsaXR0ZXIteVwiO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICBSZWFjdC5jcmVhdGVFbGVtZW50KFwiZGl2XCIsIHtjbGFzc05hbWU6IGNsYXNzTmFtZX0sIFxuICAgICAgICAgICAgICAgIFJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge29uTW91c2VEb3duOiB0aGlzLm9uTW91c2VEb3duLCBkcmFnZ2FibGU6IFwidHJ1ZVwifSlcbiAgICAgICAgICAgIClcbiAgICAgICAgKTtcbiAgICB9XG59KTtcblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gICAgU3RhdGU6IFN0YXRlLFxuICAgIE5hdmlnYXRpb246IE5hdmlnYXRpb24sXG4gICAgU3RpY2t5SGVhZE1peGluOiBTdGlja3lIZWFkTWl4aW4sXG4gICAgQXV0b1Njcm9sbE1peGluOiBBdXRvU2Nyb2xsTWl4aW4sXG4gICAgU3BsaXR0ZXI6IFNwbGl0dGVyXG59IiwidmFyIFJlYWN0ID0gcmVxdWlyZShcInJlYWN0XCIpO1xuXG52YXIgVmlydHVhbFNjcm9sbE1peGluID0ge1xuICAgIGdldEluaXRpYWxTdGF0ZTogZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgc3RhcnQ6IDAsXG4gICAgICAgICAgICBzdG9wOiAwXG4gICAgICAgIH07XG4gICAgfSxcbiAgICBjb21wb25lbnRXaWxsTW91bnQ6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgaWYgKCF0aGlzLnByb3BzLnJvd0hlaWdodCkge1xuICAgICAgICAgICAgY29uc29sZS53YXJuKFwiVmlydHVhbFNjcm9sbE1peGluOiBObyByb3dIZWlnaHQgc3BlY2lmaWVkXCIsIHRoaXMpO1xuICAgICAgICB9XG4gICAgfSxcbiAgICBnZXRQbGFjZWhvbGRlclRvcDogZnVuY3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TtcbiAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSBcIlxcclwiIHx8IGNoID09PSBcIlxcdTIwMjhcIiB8fCBjaCA9PT0gXCJcXHUyMDI5XCIpIHtcbiAgICAgICAgICAgIGRldGFpbHMubGluZSsrO1xuICAgICAgICAgICAgZGV0YWlscy5jb2x1bW4gPSAxO1xuICAgICAgICAgICAgZGV0YWlscy5zZWVuQ1IgPSB0cnVlO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBkZXRhaWxzLmNvbHVtbisrO1xuICAgICAgICAgICAgZGV0YWlscy5zZWVuQ1IgPSBmYWxzZTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKHBlZyRjYWNoZWRQb3MgIT09IHBvcykge1xuICAgICAgICBpZiAocGVnJGNhY2hlZFBvcyA+IHBvcykge1xuICAgICAgICAgIHBlZyRjYWNoZWRQb3MgPSAwO1xuICAgICAgICAgIHBlZyRjYWNoZWRQb3NEZXRhaWxzID0geyBsaW5lOiAxLCBjb2x1bW46IDEsIHNlZW5DUjogZmFsc2UgfTtcbiAgICAgICAgfVxuICAgICAgICBhZHZhbmNlKHBlZyRjYWNoZWRQb3NEZXRhaWxzLCBwZWckY2FjaGVkUG9zLCBwb3MpO1xuICAgICAgICBwZWckY2FjaGVkUG9zID0gcG9zO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gcGVnJGNhY2hlZFBvc0RldGFpbHM7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGVnJGZhaWwoZXhwZWN0ZWQpIHtcbiAgICAgIGlmIChwZWckY3VyclBvcyA8IHBlZyRtYXhGYWlsUG9zKSB7IHJldHVybjsgfVxuXG4gICAgICBpZiAocGVnJGN1cnJQb3MgPiBwZWckbWF4RmFpbFBvcykge1xuICAgICAgICBwZWckbWF4RmFpbFBvcyA9IHBlZyRjdXJyUG9zO1xuICAgICAgICBwZWckbWF4RmFpbEV4cGVjdGVkID0gW107X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ldGFpbHMubGluZSxcbiAgICAgICAgcG9zRGV0YWlscy5jb2x1bW5cbiAgICAgICk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGVnJHBhcnNlc3RhcnQoKSB7XG4gICAgICB2YXIgczAsIHMxLCBzMiwgczM7XG5cbiAgICAgIHBlZyRzaWxlbnRGYWlscysrO1xuICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgIHMxID0gcGVnJHBhcnNlX18oKTtcbiAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMiA9IHBlZyRwYXJzZU9yRXhwcigpO1xuICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBzMyA9IHBlZyRwYXJzZV9fKCk7XG4gICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgIHMxID0gcGVnJGMyKHMyKTtcbiAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICB9XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgczEgPSBbXTtcbiAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgczEgPSBwZWckYzQoKTtcbiAgICAgICAgfVxuICAgICAgICBzMCA9IHMxO1xuICAgICAgfVxuICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjMCk7IH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHMwO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBlZyRwYXJzZXdzKCkge1xuICAgICAgdmFyIHMwLCBzMTtcblxuICAgICAgcGVnJHNpbGVudEZhaWxzKys7XG4gICAgICBpZiAocGVnJGM2LnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHtcbiAgICAgICAgczAgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpO1xuICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgczAgPSBwZWckRkFJTEVEO1xuICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNyk7IH1cbiAgICAgIH1cbiAgICAgIHBlZyRzaWxlbnRGYWlscy0tO1xuICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzUpOyB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VjYygpIHtcbiAgICAgIHZhciBzMCwgczE7XG5cbiAgICAgIHBlZyRzaWxlbnRGYWlscysrO1xuICAgICAgaWYgKHBlZyRjOS50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgIHMwID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTtcbiAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMwID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzEwKTsgfVxuICAgICAgfVxuICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjOCk7IH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHMwO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBlZyRwYXJzZV9fKCkge1xuICAgICAgdmFyIHMwLCBzMTtcblxuICAgICAgcGVnJHNpbGVudEZhaWxzKys7XG4gICAgICBzMCA9IFtdO1xuICAgICAgczEgPSBwZWckcGFyc2V3cygpO1xuICAgICAgd2hpbGUgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMwLnB1c2goczEpO1xuICAgICAgICBzMSA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICB9XG4gICAgICBwZWckc2lsZW50RmFpbHMtLTtcbiAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGMxMSk7IH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHMwO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBlZyRwYXJzZU9yRXhwcigpIHtcbiAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQsIHM1O1xuXG4gICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgczEgPSBwZWckcGFyc2VBbmRFeHByKCk7XG4gICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczIgPSBwZWckcGFyc2VfXygpO1xuICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDEyNCkge1xuICAgICAgICAgICAgczMgPSBwZWckYzEyO1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzEzKTsgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlX18oKTtcbiAgICAgICAgICAgIGlmIChzNCAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZU9yRXhwcigpO1xuICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICBzMSA9IHBlZyRjMTQoczEsIHM1KTtcbiAgICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgfVxuICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMwID0gcGVnJHBhcnNlQW5kRXhwcigpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gczA7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGVnJHBhcnNlQW5kRXhwcigpIHtcbiAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQsIHM1O1xuXG4gICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgczEgPSBwZWckcGFyc2VOb3RFeHByKCk7XG4gICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczIgPSBwZWckcGFyc2VfXygpO1xuICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM4KSB7XG4gICAgICAgICAgICBzMyA9IHBlZyRjMTU7XG4gICAgICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjMTYpOyB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgczQgPSBwZWckcGFyc2VfXygpO1xuICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgIHM1ID0gcGVnJHBhcnNlQW5kRXhwcigpO1xuICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICBzMSA9IHBlZyRjMTcoczEsIHM1KTtcbiAgICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgfVxuICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICAgIHMxID0gcGVnJHBhcnNlTm90RXhwcigpO1xuICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBzMiA9IFtdO1xuICAgICAgICAgIHMzID0gcGVnJHBhcnNld3MoKTtcbiAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICBzMi5wdXNoKHMzKTtcbiAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzMiA9IHBlZyRjMTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBzMyA9IHBlZyRwYXJzZUFuZEV4cHIoKTtcbiAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgICAgczEgPSBwZWckYzE3KHMxLCBzMyk7XG4gICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHMwID0gcGVnJHBhcnNlTm90RXhwcigpO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VOb3RFeHByKCkge1xuICAgICAgdmFyIHMwLCBzMSwgczIsIHMzO1xuXG4gICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSAzMykge1xuICAgICAgICBzMSA9IHBlZyRjMTg7XG4gICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGMxOSk7IH1cbiAgICAgIH1cbiAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMiA9IHBlZyRwYXJzZV9fKCk7XG4gICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHMzID0gcGVnJHBhcnNlTm90RXhwcigpO1xuICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICBzMSA9IHBlZyRjMjAoczMpO1xuICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgIH1cbiAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMCA9IHBlZyRwYXJzZUJpbmRpbmdFeHByKCk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VCaW5kaW5nRXhwcigpIHtcbiAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQsIHM1O1xuXG4gICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0MCkge1xuICAgICAgICBzMSA9IHBlZyRjMjE7XG4gICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGMyMik7IH1cbiAgICAgIH1cbiAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMiA9IHBlZyRwYXJzZV9fKCk7XG4gICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHMzID0gcGVnJHBhcnNlT3JFeHByKCk7XG4gICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBzNCA9IHBlZyRwYXJzZV9fKCk7XG4gICAgICAgICAgICBpZiAoczQgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0MSkge1xuICAgICAgICAgICAgICAgIHM1ID0gcGVnJGMyMztcbiAgICAgICAgICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHM1ID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjMjQpOyB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICAgICAgczEgPSBwZWckYzI1KHMzKTtcbiAgICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgfVxuICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMwID0gcGVnJHBhcnNlRXhwcigpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gczA7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGVnJHBhcnNlRXhwcigpIHtcbiAgICAgIHZhciBzMDtcblxuICAgICAgczAgPSBwZWckcGFyc2VOdWxsYXJ5RXhwcigpO1xuICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMwID0gcGVnJHBhcnNlVW5hcnlFeHByKCk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VOdWxsYXJ5RXhwcigpIHtcbiAgICAgIHZhciBzMCwgczE7XG5cbiAgICAgIHMwID0gcGVnJHBhcnNlQm9vbGVhbkxpdGVyYWwoKTtcbiAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCAyKSA9PT0gcGVnJGMyNikge1xuICAgICAgICAgIHMxID0gcGVnJGMyNjtcbiAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjMjcpOyB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgczEgPSBwZWckYzI4KCk7XG4gICAgICAgIH1cbiAgICAgICAgczAgPSBzMTtcbiAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCAyKSA9PT0gcGVnJGMyOSkge1xuICAgICAgICAgICAgczEgPSBwZWckYzI5O1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMjtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzMwKTsgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgczEgPSBwZWckYzMxKCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMikgPT09IHBlZyRjMzIpIHtcbiAgICAgICAgICAgICAgczEgPSBwZWckYzMyO1xuICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjMzMpOyB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICAgIHMxID0gcGVnJGMzNCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCAyKSA9PT0gcGVnJGMzNSkge1xuICAgICAgICAgICAgICAgIHMxID0gcGVnJGMzNTtcbiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjMzYpOyB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICAgICAgczEgPSBwZWckYzM3KCk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHMwO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBlZyRwYXJzZUJvb2xlYW5MaXRlcmFsKCkge1xuICAgICAgdmFyIHMwLCBzMTtcblxuICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDQpID09PSBwZWckYzM4KSB7XG4gICAgICAgIHMxID0gcGVnJGMzODtcbiAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzM5KTsgfVxuICAgICAgfVxuICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICBzMSA9IHBlZyRjNDAoKTtcbiAgICAgIH1cbiAgICAgIHMwID0gczE7XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNSkgPT09IHBlZyRjNDEpIHtcbiAgICAgICAgICBzMSA9IHBlZyRjNDE7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzQyKTsgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgIHMxID0gcGVnJGM0MygpO1xuICAgICAgICB9XG4gICAgICAgIHMwID0gczE7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VVbmFyeUV4cHIoKSB7XG4gICAgICB2YXIgczAsIHMxLCBzMiwgczM7XG5cbiAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCAyKSA9PT0gcGVnJGM0NCkge1xuICAgICAgICBzMSA9IHBlZyRjNDQ7XG4gICAgICAgIHBlZyRjdXJyUG9zICs9IDI7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM0NSk7IH1cbiAgICAgIH1cbiAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMiA9IFtdO1xuICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgczIucHVzaChzMyk7XG4gICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHMzID0gcGVnJHBhcnNlSW50ZWdlckxpdGVyYWwoKTtcbiAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgczEgPSBwZWckYzQ2KHMzKTtcbiAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICB9XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMikgPT09IHBlZyRjNDcpIHtcbiAgICAgICAgICBzMSA9IHBlZyRjNDc7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzQ4KTsgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgIHMyID0gW107XG4gICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgd2hpbGUgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlU3RyaW5nTGl0ZXJhbCgpO1xuICAgICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICBzMSA9IHBlZyRjNDkoczMpO1xuICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDIpID09PSBwZWckYzUwKSB7XG4gICAgICAgICAgICBzMSA9IHBlZyRjNTA7XG4gICAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNTEpOyB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgIHMzID0gcGVnJHBhcnNld3MoKTtcbiAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICBzMi5wdXNoKHMzKTtcbiAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlU3RyaW5nTGl0ZXJhbCgpO1xuICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNTIoczMpO1xuICAgICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMykgPT09IHBlZyRjNTMpIHtcbiAgICAgICAgICAgICAgczEgPSBwZWckYzUzO1xuICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAzO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNTQpOyB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzMiA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZVN0cmluZ0xpdGVyYWwoKTtcbiAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzU1KHMzKTtcbiAgICAgICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMykgPT09IHBlZyRjNTYpIHtcbiAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNTY7XG4gICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMztcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzU3KTsgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgIHMyID0gW107XG4gICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgd2hpbGUgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlU3RyaW5nTGl0ZXJhbCgpO1xuICAgICAgICAgICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNTgoczMpO1xuICAgICAgICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDIpID09PSBwZWckYzU5KSB7XG4gICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNTk7XG4gICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNjApOyB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNld3MoKTtcbiAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICBzMi5wdXNoKHMzKTtcbiAgICAgICAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlU3RyaW5nTGl0ZXJhbCgpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNjEoczMpO1xuICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMikgPT09IHBlZyRjNjIpIHtcbiAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzYyO1xuICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNjMpOyB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBzMiA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZVN0cmluZ0xpdGVyYWwoKTtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzY0KHMzKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMykgPT09IHBlZyRjNjUpIHtcbiAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNjU7XG4gICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMztcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzY2KTsgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgIHMyID0gW107XG4gICAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlU3RyaW5nTGl0ZXJhbCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNjcoczMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDMpID09PSBwZWckYzY4KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNjg7XG4gICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAzO1xuICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNjkpOyB9XG4gICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNld3MoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMi5wdXNoKHMzKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZXdzKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHMyID0gcGVnJGMxO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlU3RyaW5nTGl0ZXJhbCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNzAoczMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMikgPT09IHBlZyRjNzEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzcxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNzIpOyB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2V3cygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMiA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZVN0cmluZ0xpdGVyYWwoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzczKHMzKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckcGFyc2VTdHJpbmdMaXRlcmFsKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGM3MyhzMSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHMwO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBlZyRwYXJzZUludGVnZXJMaXRlcmFsKCkge1xuICAgICAgdmFyIHMwLCBzMSwgczIsIHMzO1xuXG4gICAgICBwZWckc2lsZW50RmFpbHMrKztcbiAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICBpZiAocGVnJGM3Ni50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgIHMxID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTtcbiAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzc3KTsgfVxuICAgICAgfVxuICAgICAgaWYgKHMxID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMxID0gcGVnJGM3NTtcbiAgICAgIH1cbiAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMiA9IFtdO1xuICAgICAgICBpZiAocGVnJGM3OC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgICAgczMgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpO1xuICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgczMgPSBwZWckRkFJTEVEO1xuICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM3OSk7IH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHMyLnB1c2goczMpO1xuICAgICAgICAgICAgaWYgKHBlZyRjNzgudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkge1xuICAgICAgICAgICAgICBzMyA9IGlucHV0LmNoYXJBdChwZWckY3VyclBvcyk7XG4gICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM3OSk7IH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgczIgPSBwZWckYzE7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgaWYgKHBlZyRjNzYudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkge1xuICAgICAgICAgICAgczMgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpO1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEO1xuICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzc3KTsgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoczMgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgIHMzID0gcGVnJGM3NTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICAgIHMxID0gcGVnJGM4MChzMik7XG4gICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgfVxuICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjNzQpOyB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VTdHJpbmdMaXRlcmFsKCkge1xuICAgICAgdmFyIHMwLCBzMSwgczIsIHMzO1xuXG4gICAgICBwZWckc2lsZW50RmFpbHMrKztcbiAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM0KSB7XG4gICAgICAgIHMxID0gcGVnJGM4MjtcbiAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzgzKTsgfVxuICAgICAgfVxuICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMyID0gW107XG4gICAgICAgIHMzID0gcGVnJHBhcnNlRG91YmxlU3RyaW5nQ2hhcigpO1xuICAgICAgICB3aGlsZSAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBzMi5wdXNoKHMzKTtcbiAgICAgICAgICBzMyA9IHBlZyRwYXJzZURvdWJsZVN0cmluZ0NoYXIoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM0KSB7XG4gICAgICAgICAgICBzMyA9IHBlZyRjODI7XG4gICAgICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7XG4gICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjODMpOyB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICBzMSA9IHBlZyRjODQoczIpO1xuICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgIH1cbiAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM5KSB7XG4gICAgICAgICAgczEgPSBwZWckYzg1O1xuICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM4Nik7IH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBzMiA9IFtdO1xuICAgICAgICAgIHMzID0gcGVnJHBhcnNlU2luZ2xlU3RyaW5nQ2hhcigpO1xuICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgczIucHVzaChzMyk7XG4gICAgICAgICAgICBzMyA9IHBlZyRwYXJzZVNpbmdsZVN0cmluZ0NoYXIoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM5KSB7XG4gICAgICAgICAgICAgIHMzID0gcGVnJGM4NTtcbiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzg2KTsgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgIHBlZyRyZXBvcnRlZFBvcyA9IHMwO1xuICAgICAgICAgICAgICBzMSA9IHBlZyRjODQoczIpO1xuICAgICAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgIHMxID0gcGVnJGN1cnJQb3M7XG4gICAgICAgICAgcGVnJHNpbGVudEZhaWxzKys7XG4gICAgICAgICAgczIgPSBwZWckcGFyc2VjYygpO1xuICAgICAgICAgIHBlZyRzaWxlbnRGYWlscy0tO1xuICAgICAgICAgIGlmIChzMiA9PT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgczEgPSBwZWckYzg3O1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBwZWckY3VyclBvcyA9IHMxO1xuICAgICAgICAgICAgczEgPSBwZWckYzE7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgczIgPSBbXTtcbiAgICAgICAgICAgIHMzID0gcGVnJHBhcnNlVW5xdW90ZWRTdHJpbmdDaGFyKCk7XG4gICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgd2hpbGUgKHMzICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICAgICAgczIucHVzaChzMyk7XG4gICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2VVbnF1b3RlZFN0cmluZ0NoYXIoKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgczIgPSBwZWckYzE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICAgIHMxID0gcGVnJGM4NChzMik7XG4gICAgICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjODEpOyB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VEb3VibGVTdHJpbmdDaGFyKCkge1xuICAgICAgdmFyIHMwLCBzMSwgczI7XG5cbiAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICBzMSA9IHBlZyRjdXJyUG9zO1xuICAgICAgcGVnJHNpbGVudEZhaWxzKys7XG4gICAgICBpZiAocGVnJGM4OC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTtcbiAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMyID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzg5KTsgfVxuICAgICAgfVxuICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICBpZiAoczIgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczEgPSBwZWckYzg3O1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGVnJGN1cnJQb3MgPSBzMTtcbiAgICAgICAgczEgPSBwZWckYzE7XG4gICAgICB9XG4gICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgaWYgKGlucHV0Lmxlbmd0aCA+IHBlZyRjdXJyUG9zKSB7XG4gICAgICAgICAgczIgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpO1xuICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgczIgPSBwZWckRkFJTEVEO1xuICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM5MCk7IH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICBzMSA9IHBlZyRjOTEoczIpO1xuICAgICAgICAgIHMwID0gczE7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICB9XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA5Mikge1xuICAgICAgICAgIHMxID0gcGVnJGM5MjtcbiAgICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjOTMpOyB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgczIgPSBwZWckcGFyc2VFc2NhcGVTZXF1ZW5jZSgpO1xuICAgICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICBzMSA9IHBlZyRjOTEoczIpO1xuICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VTaW5nbGVTdHJpbmdDaGFyKCkge1xuICAgICAgdmFyIHMwLCBzMSwgczI7XG5cbiAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICBzMSA9IHBlZyRjdXJyUG9zO1xuICAgICAgcGVnJHNpbGVudEZhaWxzKys7XG4gICAgICBpZiAocGVnJGM5NC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTtcbiAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMyID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzk1KTsgfVxuICAgICAgfVxuICAgICAgcGVnJHNpbGVudEZhaWxzLS07XG4gICAgICBpZiAoczIgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczEgPSBwZWckYzg3O1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGVnJGN1cnJQb3MgPSBzMTtcbiAgICAgICAgczEgPSBwZWckYzE7XG4gICAgICB9XG4gICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgaWYgKGlucHV0Lmxlbmd0aCA+IHBlZyRjdXJyUG9zKSB7XG4gICAgICAgICAgczIgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpO1xuICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgczIgPSBwZWckRkFJTEVEO1xuICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM5MCk7IH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICBzMSA9IHBlZyRjOTEoczIpO1xuICAgICAgICAgIHMwID0gczE7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICBzMCA9IHBlZyRjMTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICB9XG4gICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA5Mikge1xuICAgICAgICAgIHMxID0gcGVnJGM5MjtcbiAgICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjOTMpOyB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgczIgPSBwZWckcGFyc2VFc2NhcGVTZXF1ZW5jZSgpO1xuICAgICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICBzMSA9IHBlZyRjOTEoczIpO1xuICAgICAgICAgICAgczAgPSBzMTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDtcbiAgICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBwZWckY3VyclBvcyA9IHMwO1xuICAgICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwZWckcGFyc2VVbnF1b3RlZFN0cmluZ0NoYXIoKSB7XG4gICAgICB2YXIgczAsIHMxLCBzMjtcblxuICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgIHMxID0gcGVnJGN1cnJQb3M7XG4gICAgICBwZWckc2lsZW50RmFpbHMrKztcbiAgICAgIHMyID0gcGVnJHBhcnNld3MoKTtcbiAgICAgIHBlZyRzaWxlbnRGYWlscy0tO1xuICAgICAgaWYgKHMyID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMxID0gcGVnJGM4NztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBlZyRjdXJyUG9zID0gczE7XG4gICAgICAgIHMxID0gcGVnJGMxO1xuICAgICAgfVxuICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIGlmIChpbnB1dC5sZW5ndGggPiBwZWckY3VyclBvcykge1xuICAgICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTtcbiAgICAgICAgICBwZWckY3VyclBvcysrO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7IHBlZyRmYWlsKHBlZyRjOTApOyB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgczEgPSBwZWckYzkxKHMyKTtcbiAgICAgICAgICBzMCA9IHMxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgICAgczAgPSBwZWckYzE7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHBlZyRjdXJyUG9zID0gczA7XG4gICAgICAgIHMwID0gcGVnJGMxO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gczA7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGVnJHBhcnNlRXNjYXBlU2VxdWVuY2UoKSB7XG4gICAgICB2YXIgczAsIHMxO1xuXG4gICAgICBpZiAocGVnJGM5Ni50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7XG4gICAgICAgIHMwID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTtcbiAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHMwID0gcGVnJEZBSUxFRDtcbiAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgeyBwZWckZmFpbChwZWckYzk3KTsgfVxuICAgICAgfVxuICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgIHMwID0gcGVnJGN1cnJQb3M7XG4gICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gMTEwKSB7XG4gICAgICAgICAgczEgPSBwZWckYzk4O1xuICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgczEgPSBwZWckRkFJTEVEO1xuICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGM5OSk7IH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHtcbiAgICAgICAgICBwZWckcmVwb3J0ZWRQb3MgPSBzMDtcbiAgICAgICAgICBzMSA9IHBlZyRjMTAwKCk7XG4gICAgICAgIH1cbiAgICAgICAgczAgPSBzMTtcbiAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgczAgPSBwZWckY3VyclBvcztcbiAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDExNCkge1xuICAgICAgICAgICAgczEgPSBwZWckYzEwMTtcbiAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDtcbiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsgcGVnJGZhaWwocGVnJGMxMDIpOyB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkge1xuICAgICAgICAgICAgcGVnJHJlcG9ydGVkUG9zID0gczA7XG4gICAgICAgICAgICBzMSA9IHBlZyRjMTAzKCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHMwID0gczE7XG4gICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7XG4gICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zO1xuICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSAxMTYpIHtcbiAgICAgICAgICAgICAgczEgPSBwZWckYzEwNDtcbiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKztcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAg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KSB7XG4gICAgICAgIHJldHVybiB0aGlzLmdldF9maXJzdF9oZWFkZXIobWVzc2FnZSwgL15Db250ZW50LVR5cGUkL2kpO1xuICAgIH0sXG4gICAgZ2V0X2ZpcnN0X2hlYWRlcjogZnVuY3Rpb24gKG1lc3NhZ2UsIHJlZ2V4KSB7XG4gICAgICAgIC8vRklYTUU6IENhY2hlIEludmFsaWRhdGlvbi5cbiAgICAgICAgaWYgKCFtZXNzYWdlLl9oZWFkZXJMb29rdXBzKVxuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG1lc3NhZ2UsIFwiX2hlYWRlckxvb2t1cHNcIiwge1xuICAgICAgICAgICAgICAgIHZhbHVlOiB7fSxcbiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLFxuICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLFxuICAgICAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIGlmICghKHJlZ2V4IGluIG1lc3NhZ2UuX2hlYWRlckxvb2t1cHMpKSB7XG4gICAgICAgICAgICB2YXIgaGVhZGVyO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBtZXNzYWdlLmhlYWRlcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAoISFtZXNzYWdlLmhlYWRlcnNbaV1bMF0ubWF0Y2gocmVnZXgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGhlYWRlciA9IG1lc3NhZ2UuaGVhZGVyc1tpXTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbWVzc2FnZS5faGVhZGVyTG9va3Vwc1tyZWdleF0gPSBoZWFkZXIgPyBoZWFkZXJbMV0gOiB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ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ZXIuXG4gICAgICAgICAgICAgICAgdGhpcy5saXN0LnB1c2goZWxlbSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMubGlzdC5zcGxpY2UoaWR4LCAwLCBlbGVtKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZW1pdChcImFkZFwiLCBlbGVtLCBpZHgpO1xuICAgICAgICB9XG4gICAgfSxcbiAgICB1cGRhdGU6IGZ1bmN0aW9uIChlbGVtKSB7XG4gICAgICAgIHZhciBpZHg7XG4gICAgICAgIHZhciBpID0gdGhpcy5saXN0Lmxlbmd0aDtcbiAgICAgICAgLy8gU2VhcmNoIGZyb20gdGhlIGJhY2ssIHdlIHVzdWFsbHkgdXBkYXRlIHRoZSBsYXRlc3QgZW50cmllcy5cbiAgICAgICAgd2hpbGUgKGktLSkge1xuICAgICAgICAgICAgaWYgKHRoaXMubGlzdFtpXS5pZCA9PT0gZWxlbS5pZCkge1xuICAgICAgICAgICAgICAgIGlkeCA9IGk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaWR4ID09PSAtMSkgeyAvL25vdCBjb250YWluZWQgaW4gbGlzdFxuICAgICAgICAgICAgdGhpcy5hZGQoZWxlbSk7XG4gICAgICAgIH0gZWxzZSBpZiAoIXRoaXMuZmlsdChlbGVtKSkge1xuICAgICAgICAgICAgdGhpcy5yZW1vdmUoZWxlbS5pZCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAodGhpcy5zb3J0ZnVuKHRoaXMubGlzdFtpZHhdKSAhPT0gdGhpcy5zb3J0ZnVuKGVsZW0pKSB7IC8vc29ydHBvcyBoYXMgY2hhbmdlZFxuICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlKHRoaXMubGlzdFtpZHhdKTtcbiAgICAgICAgICAgICAgICB0aGlzLmFkZChlbGVtKTtcbiAgICAg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