protobufjs
Advanced tools
Comparing version 6.3.1 to 6.4.0
@@ -0,1 +1,53 @@ | ||
# [6.4.0](https://github.com/dcodeIO/protobuf.js/releases/tag/6.4.0) | ||
## Breaking | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a017bf8a2dbdb7f9e7ce4c026bb6845174feb3b1) Dropped IE8 support<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/39bc1031bb502f8b677b3736dd283736ea4d92c1) Removed now unused util.longNeq which was used by early static code<br /> | ||
## Fixed | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/5915ff972482e7db2a73629244ab8a93685b2e55) Do not swallow errors in loadSync, also accept negative enum values in Enum#add, fixes [#609](https://github.com/dcodeIO/protobuf.js/issues/609)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/fde56c0de69b480343931264a01a1ead1e3156ec) Improved bytes field support, also fixes [#606](https://github.com/dcodeIO/protobuf.js/issues/606)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/0c03f327115d57c4cd5eea3a9a1fad672ed6bd44) Fall back to browser Reader when passing an Uint8Array under node, fixes [#605](https://github.com/dcodeIO/protobuf.js/issues/605)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/7eb3d456370d7d66b0856e32b2d2602abf598516) Respect optional properties when writing interfaces in tsd-jsdoc, fixes [#598](https://github.com/dcodeIO/protobuf.js/issues/598)<br /> | ||
## New | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/bcadffecb3a8b98fbbd34b45bae0e6af58f9c810) Instead of protobuf.parse.keepCase, fall back to protobuf.parse.defaults holding all possible defaults, see [#608](https://github.com/dcodeIO/protobuf.js/issues/608)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a4d6a2af0d57a2e0cccf31e3462c8b2465239f8b) Added global ParseOptions#keepCase fallback as protobuf.parse.keepCase, see [#608](https://github.com/dcodeIO/protobuf.js/issues/608)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a017bf8a2dbdb7f9e7ce4c026bb6845174feb3b1) Converters use code generation and support custom implementations<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/28ce07d9812f5e1743afef95a94532d2c9488a84) Be more verbose when throwing invalid wire type errors, see [#602](https://github.com/dcodeIO/protobuf.js/issues/602)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/40074bb69c3ca4fcefe09d4cfe01f3a86844a7e8) Added an asJSON-option to always populate array fields, even if defaults=false, see [#597](https://github.com/dcodeIO/protobuf.js/issues/597)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a7d23240a278aac0bf01767b6096d692c09ae1ce) Attempt to improve TypeScript support by using explicit exports<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/cec253fb9a177ac810ec96f4f87186506091fa37) Copy-pasted typescript definitions to micro modules, see [#599](https://github.com/dcodeIO/protobuf.js/issues/599)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/1f18453c7bfcce65c258fa98a3e3d4577d2e550f) Emit an error on resolveAll() if any extension fields cannot be resolved, see [#595](https://github.com/dcodeIO/protobuf.js/issues/595) + test case<br /> | ||
## CLI | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/804739dbb75359b0034db0097fe82081e3870a53) Removed 'not recommend' label for --keep-case, see [#608](https://github.com/dcodeIO/protobuf.js/issues/608)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/9681854526f1813a6ef08becf130ef2fbc28b638) Added customizable linter configuration to pbjs<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/9681854526f1813a6ef08becf130ef2fbc28b638) Added stdin support to pbjs and pbts<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/407223b5ceca3304bc65cb48888abfdc917d5800) Static code no longer uses IE8 support utility<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a017bf8a2dbdb7f9e7ce4c026bb6845174feb3b1) Generated static code now supports asJSON/from<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3c775535517b8385a1d3c1bf056f3da3b4266f8c) Added support for TypeScript enums to pbts<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/0cda72a55a1f2567a5d981dc5d924e55b8070513) Added a few helpful comments to static code<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/24b293c297feff8bda5ee7a2f8f3f83d77c156d0) Slightly beautify statically generated code<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/65637ffce20099df97ffbcdce50faccc8e97c366) Do not wrap main definition as a module and export directly instead<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/65637ffce20099df97ffbcdce50faccc8e97c366) Generate prettier definitions with --no-comments<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/20d8a2dd93d3bbb6990594286f992e703fc4e334) Added variable arguments support to tsd-jsdoc<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/8493dbd9a923693e943f710918937d83ae3c4572) Reference dependency imports as a module to prevent name collisions, see [#596](https://github.com/dcodeIO/protobuf.js/issues/596)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/39a2ea361c50d7f4aaa0408a0d55bb13823b906c) Removed now unnecessary comment lines in generated static code<br /> | ||
## Docs | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/a4e41b55471d83a8bf265c6641c3c6e0eee82e31) Added notes on CSP-restricted environments to README, see [#593](https://github.com/dcodeIO/protobuf.js/issues/593)<br /> | ||
## Other | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/1a3effdad171ded0608e8da021ba8f9dd017f2ff) Added test case for asJSON with arrays=true, see [#597](https://github.com/dcodeIO/protobuf.js/issues/597)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/751a90f509b68a5f410d1f1844ccff2fc1fc056a) Added a tape adapter to assert message equality accross browsers<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/fde56c0de69b480343931264a01a1ead1e3156ec) Refactored some internal utility away<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/805291086f6212d1f108b3d8f36325cf1739c0bd) Reverted previous attempt on [#597](https://github.com/dcodeIO/protobuf.js/issues/597)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/c5160217ea95996375460c5403dfe37b913d392e) Minor tsd-jsdoc refactor<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/961dd03061fc2c43ab3bf22b3f9f5165504c1002) Removed unused sandbox files<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/f625eb8b0762f8f5d35bcd5fc445e52b92d8e77d) Updated package.json of micro modules to reference types, see [#599](https://github.com/dcodeIO/protobuf.js/issues/599)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/46ec8209b21cf9ff09ae8674e2a5bbc49fd4991b) Reference dependencies as imports in generated typescript definitions, see [#596](https://github.com/dcodeIO/protobuf.js/issues/596)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/3bab132b871798c7c50c60a4c14c2effdffa372e) Allow null values on optional long fields, see [#590](https://github.com/dcodeIO/protobuf.js/issues/590)<br /> | ||
[:hash:](https://github.com/dcodeIO/protobuf.js/commit/31da56c177f1e11ffe0072ad5f58a55e3f8008fd) Various jsdoc improvements and a workaround for d.ts generation, see [#592](https://github.com/dcodeIO/protobuf.js/issues/592)<br /> | ||
# [6.3.1](https://github.com/dcodeIO/protobuf.js/releases/tag/6.3.1) | ||
@@ -2,0 +54,0 @@ |
124
cli/pbjs.js
@@ -20,2 +20,3 @@ var path = require("path"), | ||
exports.main = function(args, callback) { | ||
var lintDefault = "eslint-disable block-scoped-var, no-redeclare, no-control-regex"; | ||
var argv = minimist(args, { | ||
@@ -27,13 +28,18 @@ alias: { | ||
wrap : "w", | ||
root : "r" | ||
root : "r", | ||
lint : "l" | ||
}, | ||
string: [ "target", "out", "path", "wrap", "root" ], | ||
boolean: [ "keep-case", "create", "encode", "decode", "verify", "delimited" ], | ||
string: [ "target", "out", "path", "wrap", "root", "lint" ], | ||
boolean: [ "keep-case", "create", "encode", "decode", "verify", "convert", "delimited", "beautify", "comments" ], | ||
default: { | ||
target: "json", | ||
create: true, | ||
encode: true, | ||
decode: true, | ||
verify: true, | ||
delimited: true | ||
target : "json", | ||
create : true, | ||
encode : true, | ||
decode : true, | ||
verify : true, | ||
convert : true, | ||
delimited : true, | ||
beautify : true, | ||
comments : true, | ||
lint : lintDefault | ||
} | ||
@@ -54,5 +60,5 @@ }); | ||
console.error([ | ||
"protobuf.js v" + pkg.version + " cli", | ||
"protobuf.js v" + pkg.version + " CLI for JavaScript", | ||
"", | ||
"Consolidates imports and converts between file formats.", | ||
chalk.bold.white("Consolidates imports and converts between file formats."), | ||
"", | ||
@@ -67,3 +73,3 @@ " -t, --target Specifies the target format. Also accepts a path to require a custom target.", | ||
"", | ||
" Module targets only:", | ||
chalk.bold.gray(" Module targets only:"), | ||
"", | ||
@@ -73,13 +79,18 @@ " -w, --wrap Specifies the wrapper to use. Also accepts a path to require a custom wrapper.", | ||
" default Default wrapper supporting both CommonJS and AMD", | ||
" commonjs CommonJS only wrapper", | ||
" amd AMD only wrapper", | ||
" commonjs CommonJS wrapper", | ||
" amd AMD wrapper", | ||
" es6 ES6 wrapper", | ||
"", | ||
" -r, --root Specifies an alternative protobuf.roots name.", | ||
"", | ||
" Proto sources only:", | ||
" -l, --lint Linter configuration. Defaults to protobuf.js-compatible rules:", | ||
"", | ||
" --keep-case Keeps field casing instead of converting to camel case (not recommended).", | ||
" " + lintDefault, | ||
"", | ||
" Static targets only:", | ||
chalk.bold.gray(" Proto sources only:"), | ||
"", | ||
" --keep-case Keeps field casing instead of converting to camel case.", | ||
"", | ||
chalk.bold.gray(" Static targets only:"), | ||
"", | ||
" --no-create Does not generate create functions used for runtime compatibility.", | ||
@@ -89,5 +100,8 @@ " --no-encode Does not generate encode functions.", | ||
" --no-verify Does not generate verify functions.", | ||
" --no-convert Does not generate convert functions like asJSON and from.", | ||
" --no-delimited Does not generate delimited encode/decode functions.", | ||
" --no-beautify Does not beautify generated code.", | ||
" --no-comments Does not output any JSDoc comments.", | ||
"", | ||
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." | ||
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or) ") + "other | " + chalk.bold.green("pbjs") + " [options] -" | ||
].join("\n")); | ||
@@ -130,28 +144,56 @@ return 1; | ||
try { | ||
root.loadSync(files, parseOptions); // sync is deterministic while async is not | ||
} catch (err) { | ||
if (callback) { | ||
callback(err); | ||
return undefined; | ||
// Read from stdin | ||
if (files.length === 1 && files[0] === "-") { | ||
var data = []; | ||
process.stdin.on("data", function(chunk) { | ||
data.push(chunk); | ||
}); | ||
process.stdin.on("end", function() { | ||
var source = Buffer.concat(data).toString("utf8"); | ||
if (source.charAt(0) !== "{") { | ||
protobuf.parse(source, root, parseOptions); | ||
} else { | ||
var json = JSON.parse(source); | ||
root.setOptions(json.options).addJSON(json); | ||
} | ||
callTarget(); | ||
}); | ||
// Load from disk | ||
} else { | ||
try { | ||
root.loadSync(files, parseOptions); // sync is deterministic while async is not | ||
callTarget(); | ||
} catch (err) { | ||
if (callback) { | ||
callback(err); | ||
return undefined; | ||
} | ||
throw err; | ||
} | ||
throw err; | ||
} | ||
target(root, argv, function targetCallback(err, output) { | ||
if (err) { | ||
if (callback) | ||
return callback(err); | ||
throw err; | ||
} | ||
if (output !== "") { | ||
if (argv.out) | ||
fs.writeFileSync(argv.out, output, { encoding: "utf8" }); | ||
else | ||
process.stdout.write(output, "utf8"); | ||
} | ||
return callback | ||
? callback(null) | ||
: undefined; | ||
}); | ||
function callTarget() { | ||
target(root, argv, function targetCallback(err, output) { | ||
if (err) { | ||
if (callback) | ||
return callback(err); | ||
throw err; | ||
} | ||
if (output !== "") { | ||
output = [ | ||
"// $> pbjs " + args.join(" "), | ||
"// Generated " + (new Date()).toUTCString().replace(/GMT/, "UTC"), | ||
"" | ||
].join("\n") + "\n" + output; | ||
if (argv.out) | ||
fs.writeFileSync(argv.out, output, { encoding: "utf8" }); | ||
else | ||
process.stdout.write(output, "utf8"); | ||
} | ||
return callback | ||
? callback(null) | ||
: undefined; | ||
}); | ||
} | ||
}; |
147
cli/pbts.js
@@ -9,3 +9,4 @@ var path = require("path"), | ||
chalk = util.require("chalk", pkg.devDependencies.chalk), | ||
glob = util.require("glob", pkg.devDependencies.glob); | ||
glob = util.require("glob", pkg.devDependencies.glob), | ||
tmp = util.require("tmp", pkg.devDependencies.glob); | ||
@@ -26,8 +27,11 @@ var jsdoc = util.require("jsdoc/package.json", pkg.devDependencies.jsdoc); | ||
name: "n", | ||
out : "o" | ||
out : "o", | ||
main: "m", | ||
global: "g" | ||
}, | ||
string: [ "name", "out" ], | ||
boolean: [ "comments" ], | ||
string: [ "name", "out", "global" ], | ||
boolean: [ "comments", "main" ], | ||
default: { | ||
comments: true | ||
comments: true, | ||
main: false | ||
} | ||
@@ -43,5 +47,5 @@ }); | ||
console.error([ | ||
"protobuf.js v" + pkg.version + " cli for TypeScript", | ||
"protobuf.js v" + pkg.version + " CLI for TypeScript", | ||
"", | ||
"Generates TypeScript definitions from annotated JavaScript files.", | ||
chalk.bold.white("Generates TypeScript definitions from annotated JavaScript files."), | ||
"", | ||
@@ -52,5 +56,9 @@ " -n, --name Wraps everything in a module of the specified name.", | ||
"", | ||
" -m, --main Whether building the main library without any imports.", | ||
"", | ||
" -g, --global Name of the global object in browser environments, if any.", | ||
"", | ||
" --no-comments Does not output any JSDoc comments.", | ||
"", | ||
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." | ||
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." + chalk.bold.gray(" (or) ") + "other | " + chalk.bold.green("pbts") + " [options] -" | ||
].join("\n")); | ||
@@ -72,47 +80,88 @@ if (callback) | ||
// There is no proper API for jsdoc, so this executes the CLI and pipes the output | ||
var basedir = path.join(__dirname, ".."); | ||
var moduleName = argv.name || "null"; | ||
var child = child_process.exec("node \"" + basedir + "/node_modules/jsdoc/jsdoc.js\" -c \"" + basedir + "/jsdoc.types.json\" -q \"module=" + encodeURIComponent(moduleName) + "&comments=" + Boolean(argv.comments) + "\" " + files.map(function(file) { return '"' + file + '"'; }).join(' '), { | ||
cwd: process.cwd(), | ||
argv0: "node", | ||
stdio: "pipe", | ||
maxBuffer: 1 << 24 // 16mb | ||
}); | ||
var out = []; | ||
child.stdout.on("data", function(data) { | ||
out.push(data); | ||
}); | ||
child.stderr.pipe(process.stderr); | ||
child.on("close", function(code) { | ||
if (code) { | ||
out = out.join('').replace(/\s*JSDoc \d+\.\d+\.\d+ [^$]+/, ""); | ||
process.stderr.write(out); | ||
var err = Error("code " + code); | ||
if (callback) | ||
callback(err); | ||
else | ||
throw err; | ||
return; | ||
} | ||
var cleanup = []; | ||
var output = [ | ||
"// $> pbts " + process.argv.slice(2).join(' '), | ||
"// Generated " + (new Date()).toUTCString().replace(/GMT/, "UTC"), | ||
].join('\n') + "\n" + out.join(''); | ||
// Read from stdin (to a temporary file) | ||
if (files.length === 1 && files[0] === "-") { | ||
var data = []; | ||
process.stdin.on("data", function(chunk) { | ||
data.push(chunk); | ||
}); | ||
process.stdin.on("end", function() { | ||
files[0] = tmp.tmpNameSync() + ".js"; | ||
fs.writeFileSync(files[0], Buffer.concat(data)); | ||
cleanup.push(files[0]); | ||
callJsdoc(); | ||
}); | ||
try { | ||
if (argv.out) | ||
fs.writeFileSync(argv.out, output); | ||
else | ||
process.stdout.write(output, "utf8"); | ||
} catch (err) { | ||
if (callback) | ||
callback(err); | ||
else | ||
throw err; | ||
} | ||
}); | ||
// Load from disk | ||
} else { | ||
callJsdoc(); | ||
} | ||
function callJsdoc() { | ||
// There is no proper API for jsdoc, so this executes the CLI and pipes the output | ||
var basedir = path.join(__dirname, ".."); | ||
var moduleName = argv.name || "null"; | ||
var cmd = "node \"" + basedir + "/node_modules/jsdoc/jsdoc.js\" -c \"" + basedir + "/jsdoc.types.json\" -q \"module=" + encodeURIComponent(moduleName) + "&comments=" + Boolean(argv.comments) + "\" " + files.map(function(file) { return '"' + file + '"'; }).join(' '); | ||
var child = child_process.exec(cmd, { | ||
cwd: process.cwd(), | ||
argv0: "node", | ||
stdio: "pipe", | ||
maxBuffer: 1 << 24 // 16mb | ||
}); | ||
var out = []; | ||
child.stdout.on("data", function(data) { | ||
out.push(data); | ||
}); | ||
child.stderr.pipe(process.stderr); | ||
child.on("close", function(code) { | ||
// clean up temporary files, no matter what | ||
try { cleanup.forEach(fs.unlinkSync); } catch(e) {} cleanup = []; | ||
if (code) { | ||
out = out.join('').replace(/\s*JSDoc \d+\.\d+\.\d+ [^$]+/, ""); | ||
process.stderr.write(out); | ||
var err = Error("code " + code); | ||
if (callback) | ||
callback(err); | ||
else | ||
throw err; | ||
return; | ||
} | ||
var output = [ | ||
"// $> pbts " + args.join(" "), | ||
"// Generated " + (new Date()).toUTCString().replace(/GMT/, "UTC"), | ||
"" | ||
]; | ||
if (argv.global) | ||
output.push( | ||
"export as namespace " + argv.global + ";", | ||
"" | ||
); | ||
if (!argv.main) | ||
output.push( | ||
"import * as $protobuf from \"protobufjs\";", | ||
"" | ||
); | ||
output = output.join('\n') + "\n" + out.join(''); | ||
try { | ||
if (argv.out) | ||
fs.writeFileSync(argv.out, output); | ||
else | ||
process.stdout.write(output, "utf8"); | ||
if (callback) | ||
callback(null); | ||
} catch (err) { | ||
if (callback) | ||
callback(err); | ||
else | ||
throw err; | ||
} | ||
}); | ||
} | ||
return undefined; | ||
}; |
"use strict"; | ||
module.exports = json_module; | ||
var path = require("path"), | ||
fs = require("fs"), | ||
util = require("../util"); | ||
var util = require("../util"); | ||
var protobuf = require("../.."); | ||
json_module.description = "JSON representation as a module" | ||
@@ -15,3 +11,3 @@ | ||
var output = "var $root = protobuf.Root.fromJSON(" + JSON.stringify(root, null, 2).replace(/^(?!$)/mg, " ").trim() + ").resolveAll();"; | ||
output = util.wrap(options.wrap || "default", output, options.root); | ||
output = util.wrap(output, options); | ||
process.nextTick(function() { | ||
@@ -21,4 +17,5 @@ callback(null, output); | ||
} catch (e) { | ||
callback(e); | ||
return callback(e); | ||
} | ||
return undefined; | ||
} |
@@ -22,3 +22,3 @@ "use strict"; | ||
try { | ||
output = util.wrap(options.wrap || "default", output, options.root); | ||
output = util.wrap(output, options); | ||
} catch (e) { | ||
@@ -25,0 +25,0 @@ callback(e); |
"use strict"; | ||
module.exports = static_target; | ||
// - Static code does not have any reflection or JSON features. | ||
var protobuf = require("../.."), | ||
cliUtil = require("../util"); | ||
var UglifyJS = cliUtil.require("uglify-js", require(require("path").join(__dirname, "..", "..", "package.json")).devDependencies["uglify-js"]); | ||
var Type = protobuf.Type, | ||
@@ -25,10 +25,13 @@ Service = protobuf.Service, | ||
try { | ||
push("// Lazily resolved type references"); | ||
if (config.comments) | ||
push("// Lazily resolved type references"); | ||
push("var $lazyTypes = [];"); | ||
push(""); | ||
push("// Exported root namespace"); | ||
if (config.comments) | ||
push("// Exported root namespace"); | ||
push("var $root = {};"); | ||
buildNamespace(null, root); | ||
push(""); | ||
push("// Resolve lazy types"); | ||
if (config.comments) | ||
push("// Resolve lazy types"); | ||
push("$lazyTypes.forEach(function(types) {"); | ||
@@ -42,3 +45,3 @@ ++indent; | ||
--indent; | ||
push("path = path.split('.');"); | ||
push("path = path.split(\".\");"); | ||
push("var ptr = $root;"); | ||
@@ -75,4 +78,8 @@ push("while (path.length)"); | ||
function pushComment(lines) { | ||
if (!config.comments) | ||
return; | ||
push("/**"); | ||
lines.forEach(function(line) { | ||
if (line === null) | ||
return; | ||
push(" * " + line); | ||
@@ -89,2 +96,8 @@ }); | ||
function aOrAn(name) { | ||
return ((/^[hH](?:ou|on|ei)/.test(name) || /^[aeiouAEIOU][a-z]/.test(name)) && !/^us/i.test(name) | ||
? "an " | ||
: "a ") + name; | ||
} | ||
// generate dot-notation property accessors where possible. this saves a few chars (i.e. m.hello | ||
@@ -95,3 +108,3 @@ // instead of m["hello"]) but has no measurable performance impact (on V8). not present within the | ||
return function safeProp_dn(name) { | ||
return /^[$\w]+$/.test(name) && cliUtil.reserved(name) | ||
return !/^[$\w]+$/.test(name) || cliUtil.reserved(name) | ||
? safeProp(name) | ||
@@ -139,19 +152,48 @@ : "." + name; | ||
function beautify(code) { | ||
return UglifyJS.minify(code | ||
.replace(/\br\b/g, "reader") | ||
.replace(/\bw\b/g, "writer") | ||
.replace(/\bm\b/g, "message") | ||
.replace(/\bt\b/g, "tag") | ||
.replace(/\bl\b/g, "len") | ||
.replace(/\bc\b/g, "end") | ||
.replace(/\bc2\b/g, "end2") | ||
.replace(/\bk\b/g, "key") | ||
.replace(/\bks\b/g, "keys") | ||
.replace(/\be\b/g, "err") | ||
.replace(/\bf\b/g, "impl") | ||
.replace(/\bo\b/g, "options") | ||
.replace(/\bs\b/g, "src") | ||
.replace(/\bd\b/g, "dst"), | ||
{ | ||
fromString: true, | ||
compress: false, | ||
mangle: false, | ||
output: { | ||
beautify: true, | ||
bracketize: true | ||
} | ||
} | ||
).code.replace(/ {4}/g, "\t"); | ||
} | ||
function buildFunction(type, functionName, gen, scope) { | ||
var lines = gen.str(functionName) | ||
.replace("(this.getCtor())", " $root" + type.fullName) | ||
.split(/\n/g); | ||
push(name(type.name) + "." + functionName + " = (function() {"); | ||
++indent; | ||
push("/* eslint-disable */"); | ||
var code = gen.str(functionName) | ||
.replace("(this.ctor)", " $root" + type.fullName) // types: construct directly instead of using reflected ctor | ||
.replace(/(types\[\d+])(\.values)/,"$1"); // enums: use types[N] instead of reflected types[N].values | ||
if (config.beautify) | ||
code = beautify(code); | ||
// remove unused scope vars | ||
Object.keys(scope).forEach(function(key) { | ||
push("var " + key + " = " + scope[key] + ";"); | ||
if (!new RegExp("\\b(" + key + ")\\b", "g").test(code)) | ||
delete scope[key]; | ||
}); | ||
push("var types; $lazyTypes.push(types = [" + type.fieldsArray.map(function(field) { | ||
return field.resolve().resolvedType | ||
? JSON.stringify(field.resolvedType.fullName.substring(1)) | ||
: "null"; | ||
}).join(",") + "]);"); | ||
push("return " + lines[0]); | ||
lines.slice(1).forEach(function(line) { | ||
// enclose all but the first and last line in an iife returning our properly scoped function | ||
var lines = code.split(/\n/g); | ||
push(name(type.name) + "." + functionName + " = (function(" + Object.keys(scope).join(", ") + ") { return " + lines[0]); | ||
lines.slice(1, lines.length - 1).forEach(function(line) { | ||
var prev = indent; | ||
@@ -164,5 +206,3 @@ var i = 0; | ||
}); | ||
push("/* eslint-enable */"); | ||
--indent; | ||
push("})();"); | ||
push("};})(" + Object.keys(scope).map(function(key) { return scope[key]; }).join(", ") + ");"); | ||
} | ||
@@ -194,5 +234,6 @@ | ||
if (type.fieldsArray.length || type.oneofsArray.length) { | ||
if (type.fieldsArray.length || type.oneofsArray.length || config.convert) { | ||
push(""); | ||
push("/** @alias " + fullName + ".prototype */"); | ||
if (config.comments) | ||
push("/** @alias " + fullName + ".prototype */"); | ||
push("var $prototype = " + name(type.name) + ".prototype;"); | ||
@@ -243,14 +284,17 @@ } | ||
jsType = "Array.<" + jsType + ">"; | ||
push(""); | ||
pushComment([ | ||
type.name + " " + field.name + ".", | ||
"@name " + fullName + "#" + name(field.name), | ||
"@type {" + jsType + "}" | ||
]); | ||
var prop = util.safeProp(field.name); | ||
if (config.comments) { | ||
push(""); | ||
pushComment([ | ||
type.name + " " + field.name + ".", | ||
prop.charAt(0) !== "." ? "@name " + fullName + "#" + field.name : null, | ||
"@type {" + jsType + "}" | ||
]); | ||
} | ||
if (Array.isArray(field.defaultValue)) { | ||
push("$prototype[" + JSON.stringify(field.name) + "] = $protobuf.util.emptyArray;"); | ||
push("$prototype" + prop + " = $protobuf.util.emptyArray;"); | ||
} else if (util.isObject(field.defaultValue)) | ||
push("$prototype[" + JSON.stringify(field.name) + "] = $protobuf.util.emptyObject;"); | ||
push("$prototype" + prop + " = $protobuf.util.emptyObject;"); | ||
else | ||
push("$prototype[" + JSON.stringify(field.name) + "] = " + JSON.stringify(field.defaultValue) + ";"); | ||
push("$prototype" + prop + " = " + JSON.stringify(field.defaultValue) + ";"); | ||
}); | ||
@@ -267,5 +311,5 @@ | ||
]); | ||
push("$protobuf.util.prop($prototype, " + JSON.stringify(oneof.name) +", {"); | ||
push("Object.defineProperty($prototype, " + JSON.stringify(oneof.name) +", {"); | ||
++indent; | ||
push("get: function getVirtual() {"); | ||
push("get: function() {"); | ||
++indent; | ||
@@ -281,3 +325,3 @@ oneof.oneof.forEach(function(name) { | ||
push("},"); | ||
push("set: function setVirtual(value) {"); | ||
push("set: function(value) {"); | ||
++indent; | ||
@@ -296,2 +340,18 @@ oneof.oneof.forEach(function(name) { | ||
var hasTypes = false; | ||
var types = type.fieldsArray.map(function(field) { | ||
if (field.resolve().resolvedType) { // including enums! | ||
hasTypes = true; | ||
return JSON.stringify(field.resolvedType.fullName.substring(1)); | ||
} | ||
return "null"; | ||
}).join(", "); | ||
if (hasTypes && (config.encode || config.decode || config.verify || config.convert)) { | ||
push(""); | ||
if (config.comments) | ||
push("// Referenced types"); | ||
push("var $types = [" + types + "]; $lazyTypes.push($types);"); | ||
} | ||
if (config.create) { | ||
@@ -310,3 +370,2 @@ push(""); | ||
} | ||
@@ -316,11 +375,12 @@ if (config.encode) { | ||
pushComment([ | ||
"Encodes the specified " + type.name + ".", | ||
"Encodes the specified " + type.name + " message.", | ||
"@function", | ||
"@param {" + fullName + "|Object} message " + type.name + " or plain object to encode", | ||
"@param {Writer} [writer] Writer to encode to", | ||
"@returns {Writer} Writer" | ||
"@param {" + fullName + "|Object} message " + type.name + " message or plain object to encode", | ||
"@param {$protobuf.Writer} [writer] Writer to encode to", | ||
"@returns {$protobuf.Writer} Writer" | ||
]); | ||
buildFunction(type, "encode", protobuf.encoder(type), { | ||
Writer : "$protobuf.Writer", | ||
util : "$protobuf.util" | ||
util : "$protobuf.util", | ||
types : hasTypes ? "$types" : undefined | ||
}); | ||
@@ -331,6 +391,6 @@ | ||
pushComment([ | ||
"Encodes the specified " + type.name + ", length delimited.", | ||
"@param {" + fullName + "|Object} message " + type.name + " or plain object to encode", | ||
"@param {Writer} [writer] Writer to encode to", | ||
"@returns {Writer} Writer" | ||
"Encodes the specified " + type.name + " message, length delimited.", | ||
"@param {" + fullName + "|Object} message " + type.name + " message or plain object to encode", | ||
"@param {$protobuf.Writer} [writer] Writer to encode to", | ||
"@returns {$protobuf.Writer} Writer" | ||
]); | ||
@@ -350,5 +410,5 @@ push(name(type.name) + ".encodeDelimited = function encodeDelimited(message, writer) {"); | ||
pushComment([ | ||
"Decodes a " + type.name + " from the specified reader or buffer.", | ||
"Decodes " + aOrAn(type.name) + " message from the specified reader or buffer.", | ||
"@function", | ||
"@param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from", | ||
"@param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from", | ||
"@param {number} [length] Message length if known beforehand", | ||
@@ -359,3 +419,4 @@ "@returns {" + fullName + "} " + type.name | ||
Reader : "$protobuf.Reader", | ||
util : "$protobuf.util" | ||
util : "$protobuf.util", | ||
types : hasTypes ? "$types" : undefined | ||
}); | ||
@@ -366,4 +427,4 @@ | ||
pushComment([ | ||
"Decodes a " + type.name + " from the specified reader or buffer, length delimited.", | ||
"@param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from", | ||
"Decodes " + aOrAn(type.name) + " message from the specified reader or buffer, length delimited.", | ||
"@param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from", | ||
"@returns {" + fullName + "} " + type.name | ||
@@ -384,12 +445,54 @@ ]); | ||
pushComment([ | ||
"Verifies a " + type.name + ".", | ||
"Verifies " + aOrAn(type.name) + " message.", | ||
"@function", | ||
"@param {" + fullName + "|Object} message " + type.name + " or plain object to verify", | ||
"@param {" + fullName + "|Object} message " + type.name + " message or plain object to verify", | ||
"@returns {?string} `null` if valid, otherwise the reason why it is not" | ||
]); | ||
buildFunction(type, "verify", protobuf.verifier(type), { | ||
util : "$protobuf.util" | ||
util : "$protobuf.util", | ||
types : hasTypes ? "$types" : undefined | ||
}); | ||
} | ||
if (config.convert) { | ||
push(""); | ||
pushComment([ | ||
"Converts " + aOrAn(type.name) + " message.", | ||
"@function", | ||
"@param {" + fullName + "|Object} source " + type.name + " message or plain object to convert", | ||
"@param {*} impl Converter implementation to use", | ||
"@param {Object.<string,*>} [options] Conversion options", | ||
"@returns {" + fullName + "|Object} Converted message" | ||
]); | ||
buildFunction(type, "convert", protobuf.converter(type), { | ||
util : "$protobuf.util", | ||
types : hasTypes ? "$types" : undefined | ||
}); | ||
push(""); | ||
pushComment([ | ||
"Creates " + aOrAn(type.name) + " message from JSON.", | ||
"@param {Object.<string,*>} source Source object", | ||
"@param {Object.<string,*>} [options] Conversion options", | ||
"@returns {" + fullName + "} " + type.name | ||
]); | ||
push(name(type.name) + ".from = function from(source, options) {"); | ||
++indent; | ||
push("return this.convert(source, $protobuf.converters.message, options);"); | ||
--indent; | ||
push("};"); | ||
push(""); | ||
pushComment([ | ||
"Converts this " + type.name + " message to JSON.", | ||
"@param {Object.<string,*>} [options] Conversion options", | ||
"@returns {Object.<string,*>} JSON object" | ||
]); | ||
push("$prototype.asJSON = function asJSON(options) {"); | ||
++indent; | ||
push("return this.constructor.convert(this, $protobuf.converters.json, options);"); | ||
--indent; | ||
push("};"); | ||
} | ||
} | ||
@@ -408,3 +511,3 @@ | ||
"@type {function}", | ||
"@param {Method} method Reflected method being called", | ||
"@param {$protobuf.Method} method Reflected method being called", | ||
"@param {Uint8Array} requestData Request data", | ||
@@ -428,3 +531,3 @@ "@param {RPCCallback} callback Callback function", | ||
pushComment([ | ||
"Constructs a new " + service.name + ".", | ||
"Constructs a new " + service.name + " service.", | ||
"@exports " + fullName, | ||
@@ -458,5 +561,5 @@ "@constructor", | ||
--indent; | ||
push("};"); | ||
push("}"); | ||
service.getMethodsArray().forEach(function(method) { | ||
service.methodsArray.forEach(function(method) { | ||
method.resolve(); | ||
@@ -476,3 +579,3 @@ var lcName = method.name.substring(0, 1).toLowerCase() + method.name.substring(1); | ||
"Calls " + method.name + ".", | ||
"@param {" + method.resolvedRequestType.fullName.substring(1) + "|Object} request " + method.resolvedRequestType.name + " or plain object", | ||
"@param {" + method.resolvedRequestType.fullName.substring(1) + "|Object} request " + method.resolvedRequestType.name + " message or plain object", | ||
"@param {" + cbName + "} callback Node-style callback called with the error, if any, and " + method.resolvedResponseType.name, | ||
@@ -490,3 +593,3 @@ "@returns {undefined}" | ||
++indent; | ||
push("(typeof setImmediate === 'function' ? setImmediate : setTimeout)(function() { callback(err); });"); | ||
push("(typeof setImmediate === \"function\" ? setImmediate : setTimeout)(function() { callback(err); });"); | ||
push("return;"); | ||
@@ -524,17 +627,30 @@ --indent; | ||
function buildEnum(ref, enm) { | ||
var parentFullName = enm.parent.fullName.substring(1); | ||
push(""); | ||
pushComment([ | ||
enm.name + " values.", | ||
"@exports " + enm.fullName.substring(1), | ||
"@type {Object.<string,number>}" | ||
]); | ||
push(name(ref) + "." + name(enm.name) + " = {"); | ||
push(""); | ||
var comment = parentFullName.length ? [ | ||
enm.name + " enum.", | ||
"@name " + name(enm.name), | ||
"@memberof " + parentFullName, | ||
"@enum {number}" | ||
] : [ | ||
enm.name + " enum.", | ||
"@exports " + name(enm.name), | ||
"@enum {number}" | ||
]; | ||
Object.keys(enm.values).forEach(function(key) { | ||
var val = enm.values[key]; | ||
comment.push("@property {number} " + key + "=" + val + " " + key + " value"); | ||
}); | ||
pushComment(comment); | ||
push(name(ref) + "." + name(enm.name) + " = (function() {"); | ||
++indent; | ||
var keys = Object.keys(enm.values); | ||
for (var i = 0; i < keys.length; ++i) { | ||
push(name(keys[i]) + ": " + enm.values[keys[i]].toString(10) + (i < keys.length - 1 ? "," : "")); | ||
} | ||
push("var valuesById = {},"); | ||
push(" values = Object.create(valuesById);"); | ||
Object.keys(enm.values).forEach(function(key) { | ||
var val = enm.values[key]; | ||
push("values[valuesById[" + val + "] = " + JSON.stringify(key) + "] = " + val + ";"); | ||
}); | ||
push("return values;"); | ||
--indent; | ||
push("};"); | ||
push("})();"); | ||
} |
@@ -86,3 +86,3 @@ var fs = require("fs"), | ||
console.error("installing " + name + "@" + version + " ..."); | ||
child_process.execSync("npm install " + name + "@" + version, { | ||
child_process.execSync("npm --silent install " + name + "@" + version, { | ||
cwd: cwd | ||
@@ -94,5 +94,4 @@ }); | ||
exports.wrap = function(name, OUTPUT, ROOT) { | ||
if (!ROOT) | ||
ROOT = "default"; | ||
exports.wrap = function(OUTPUT, options) { | ||
var name = options.wrap || "default"; | ||
var wrap; | ||
@@ -106,7 +105,9 @@ try { | ||
} | ||
wrap = wrap.replace(/%ROOT%/g, JSON.stringify(ROOT)); | ||
wrap = wrap.replace(/%ROOT%/g, JSON.stringify(options.root || "default")); | ||
wrap = wrap.replace(/( *)%OUTPUT%/, function($0, $1) { | ||
return $1.length ? OUTPUT.replace(/^/mg, $1) : OUTPUT; | ||
}); | ||
return wrap; | ||
if (options.lint !== "") | ||
wrap = "/*" + options.lint + "*/\n" + wrap; | ||
return wrap.replace(/\r?\n/, "\n"); | ||
}; | ||
@@ -122,2 +123,2 @@ | ||
return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name); | ||
}; | ||
}; |
define(["protobuf"], function($protobuf) { | ||
"use strict"; // eslint-disable-line strict | ||
"use strict"; | ||
@@ -4,0 +4,0 @@ %OUTPUT% |
@@ -1,2 +0,2 @@ | ||
"use strict"; // eslint-disable-line strict | ||
"use strict"; | ||
@@ -3,0 +3,0 @@ var $protobuf = require("protobufjs/runtime"); |
@@ -1,13 +0,11 @@ | ||
(function(global, factory) { | ||
/* eslint-disable no-undef */ | ||
(function(global, factory) { /* global define, require, module */ | ||
/* AMD */ if (typeof define === 'function' && define.amd) | ||
define(["protobuf"], factory); | ||
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) | ||
module.exports = factory(require("protobufjs/runtime")); | ||
/* eslint-enable no-undef */ | ||
})(this, function($protobuf) { | ||
"use strict"; // eslint-disable-line strict | ||
"use strict"; | ||
@@ -14,0 +12,0 @@ %OUTPUT% |
@@ -7,2 +7,2 @@ import * as $protobuf from "protobufjs"; | ||
export default $root; | ||
export { $root as default }; |
/*! | ||
* protobuf.js v6.3.1 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 27 Dec 2016 16:55:50 UTC | ||
* protobuf.js v6.4.0 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 03 Jan 2017 15:34:50 UTC | ||
* Licensed under the BSD-3-Clause License | ||
* see: https://github.com/dcodeIO/protobuf.js for details | ||
*/ | ||
!function t(e,i,n){function r(o,u){if(!i[o]){if(!e[o]){var f="function"==typeof require&&require;if(!u&&f)return f(o,!0);if(s)return s(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var h=i[o]={exports:{}};e[o][0].call(h.exports,function(t){var i=e[o][1][t];return r(i?i:t)},h,h.exports,t,e,i,n)}return i[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e,i){"use strict";function n(t,e){for(var i=[],n=2;n<arguments.length;)i.push(arguments[n++]);var r=!0;return new Promise(function(n,s){i.push(function(t){if(r)if(r=!1,t)s(t);else{for(var e=[],i=1;i<arguments.length;)e.push(arguments[i++]);n.apply(null,e)}});try{t.apply(e||this,i)}catch(t){r&&(r=!1,s(t))}})}e.exports=n},{}],2:[function(t,e,i){"use strict";var n=i;n.length=function(t){var e=t.length;if(!e)return 0;for(var i=0;--e%4>1&&"="===t.charAt(e);)++i;return Math.ceil(3*t.length)/4-i};for(var r=new Array(64),s=new Array(123),o=0;o<64;)s[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(t,e,i){for(var n,s=[],o=0,u=0;e<i;){var f=t[e++];switch(u){case 0:s[o++]=r[f>>2],n=(3&f)<<4,u=1;break;case 1:s[o++]=r[n|f>>4],n=(15&f)<<2,u=2;break;case 2:s[o++]=r[n|f>>6],s[o++]=r[63&f],u=0}}return u&&(s[o++]=r[n],s[o]=61,1===u&&(s[o+1]=61)),String.fromCharCode.apply(String,s)};var u="invalid encoding";n.decode=function(t,e,i){for(var n,r=i,o=0,f=0;f<t.length;){var a=t.charCodeAt(f++);if(61===a&&o>1)break;if(void 0===(a=s[a]))throw Error(u);switch(o){case 0:n=a,o=1;break;case 1:e[i++]=n<<2|(48&a)>>4,n=a,o=2;break;case 2:e[i++]=(15&n)<<4|(60&a)>>2,n=a,o=3;break;case 3:e[i++]=(3&n)<<6|a,o=0}}if(1===o)throw Error(u);return i-r}},{}],3:[function(t,e,i){"use strict";function n(){function t(){for(var e=[],i=0;i<arguments.length;)e.push(arguments[i++]);var n=r.apply(null,e),h=c;if(l.length){var p=l[l.length-1];s.test(p)?h=++c:f.test(p)&&++h,u.test(p)&&!u.test(n)?(h=++c,d=!0):d&&a.test(p)&&(h=--c,d=!1),o.test(n)&&(h=--c)}for(i=0;i<h;++i)n="\t"+n;return l.push(n),t}function e(t){return"function "+(t?t.replace(/[^\w_$]/g,"_"):"")+"("+h.join(", ")+") {\n"+l.join("\n")+"\n}"}function i(e,i){"object"==typeof e&&(i=e,e=void 0);var r=t.str(e);n.verbose&&console.log("--- codegen ---\n"+r.replace(/^/gm,"> ").replace(/\t/g," "));var s=Object.keys(i||(i={}));return Function.apply(null,s.concat("return "+r)).apply(null,s.map(function(t){return i[t]}))}for(var h=[],l=[],c=1,d=!1,p=0;p<arguments.length;)h.push(arguments[p++]);return t.str=e,t.eof=i,t}function r(t){for(var e=[],i=1;i<arguments.length;)e.push(arguments[i++]);return i=0,t.replace(/%([djs])/g,function(t,n){var r=e[i++];switch(n){case"j":return JSON.stringify(r);default:return String(r)}})}e.exports=n;var s=/[{[]$/,o=/^[}\]]/,u=/:$/,f=/^\s*(?:if|else if|while|for)\b|\b(?:else)\s*$/,a=/\b(?:break|continue);?$|^\s*return\b/;n.supported=!1;try{n.supported=1===n("a","b")("return a-b").eof()(2,1)}catch(t){}n.verbose=!1},{}],4:[function(t,e,i){"use strict";function n(){this.a={}}e.exports=n;var r=n.prototype;r.on=function(t,e,i){return(this.a[t]||(this.a[t]=[])).push({fn:e,ctx:i||this}),this},r.off=function(t,e){if(void 0===t)this.a={};else if(void 0===e)this.a[t]=[];else for(var i=this.a[t],n=0;n<i.length;)i[n].fn===e?i.splice(n,1):++n;return this},r.emit=function(t){var e=this.a[t];if(e){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,i)}return this}},{}],5:[function(t,e,i){"use strict";function n(t){for(var e=Object.keys(this),i=0;i<e.length;++i)t[e[i]]=this[e[i]];var n=t.prototype=Object.create(this.prototype);return n.constructor=t,n}e.exports=n},{}],6:[function(t,e,i){"use strict";function n(t,e){return e?u&&u.readFile?u.readFile(t,"utf8",function(i,n){return i&&"undefined"!=typeof XMLHttpRequest?r(t,e):e(i,n)}):r(t,e):s(n,this,t)}function r(t,e){var i=new XMLHttpRequest;i.onreadystatechange=function(){return 4===i.readyState?0===i.status||200===i.status?e(null,i.responseText):e(Error("status "+i.status)):void 0},i.open("GET",t),i.send()}e.exports=n;var s=t(1),o=t(7),u=o("fs")},{1:1,7:7}],7:[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},{}],8:[function(t,e,i){"use strict";var n=i,r=n.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},s=n.normalize=function(t){t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var e=t.split("/"),i=r(t),n="";i&&(n=e.shift()+"/");for(var s=0;s<e.length;)".."===e[s]?s>0?e.splice(--s,2):i?e.splice(s,1):++s:"."===e[s]?e.splice(s,1):++s;return n+e.join("/")};n.resolve=function(t,e,i){return i||(e=s(e)),r(e)?e:(i||(t=s(t)),(t=t.replace(/(?:\/|^)[^\/]+$/,"")).length?s(t+"/"+e):e)}},{}],9:[function(t,e,i){"use strict";function n(t,e,i){var n=i||8192,r=n>>>1,s=null,o=n;return function(i){if(i<1||i>r)return t(i);o+i>n&&(s=t(n),o=0);var u=e.call(s,o,o+=i);return 7&o&&(o=(7|o)+1),u}}e.exports=n},{}],10:[function(t,e,i){"use strict";var n=i;n.length=function(t){for(var e=0,i=0,n=0;n<t.length;++n)i=t.charCodeAt(n),i<128?e+=1:i<2048?e+=2:55296===(64512&i)&&56320===(64512&t.charCodeAt(n+1))?(++n,e+=4):e+=3;return e},n.read=function(t,e,i){var n=i-e;if(n<1)return"";for(var r,s=null,o=[],u=0;e<i;)r=t[e++],r<128?o[u++]=r:r>191&&r<224?o[u++]=(31&r)<<6|63&t[e++]:r>239&&r<365?(r=((7&r)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[u++]=55296+(r>>10),o[u++]=56320+(1023&r)):o[u++]=(15&r)<<12|(63&t[e++])<<6|63&t[e++],u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0);return s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):u?String.fromCharCode.apply(String,o.slice(0,u)):""},n.write=function(t,e,i){for(var n,r,s=i,o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?e[i++]=n:n<2048?(e[i++]=n>>6|192,e[i++]=63&n|128):55296===(64512&n)&&56320===(64512&(r=t.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&r),++o,e[i++]=n>>18|240,e[i++]=n>>12&63|128,e[i++]=n>>6&63|128,e[i++]=63&n|128):(e[i++]=n>>12|224,e[i++]=n>>6&63|128,e[i++]=63&n|128);return i-s}},{}],11:[function(t,e,i){"use strict";function n(t){return r(t)}function r(e,i){if(s||(s=t(29)),!(e instanceof s))throw f("type","a Type");if(i){if("function"!=typeof i)throw f("ctor","a function")}else i=function(t){return function(e){t.call(this,e)}}(o);i.constructor=n;var r=i.prototype=new o;return r.constructor=i,u.merge(i,o,!0),i.$type=e,r.$type=e,e.getFieldsArray().forEach(function(t){r[t.name]=Array.isArray(t.resolve().defaultValue)?u.emptyArray:u.isObject(t.defaultValue)&&!t.long?u.emptyObject:t.defaultValue}),e.getOneofsArray().forEach(function(t){u.prop(r,t.resolve().name,{get:function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(t.oneof.indexOf(e[i])>-1)return e[i]},set:function(e){for(var i=t.oneof,n=0;n<i.length;++n)i[n]!==e&&delete this[i[n]]}})}),e.setCtor(i),r}e.exports=n;var s,o=t(18),u=t(31),f=u.b;n.create=r,n.prototype=o},{18:18,29:29,31:31}],12:[function(t,e,i){"use strict";function n(e,i,n,o,u){r||(r=t(29),s=t(18)),o||(o={});for(var f,a=Object.keys(o.defaults?e.fields:i),h=0;h<a.length;++h){var l=e.fields[f=a[h]],c=i[f];if(l)if(l.repeated){if((c||o.defaults)&&(n[f]=[],c))for(var d=0,p=c.length;d<p;++d)n[f].push(u(l,c[d],o))}else n[f]=u(l,c,o);else o.fieldsOnly||(n[f]=c)}return n}e.exports=n;var r,s,o=t(15),u=t(31);n.toJson=function t(e,i,r){if(r||(r={}),i instanceof s)return n(i.$type,i,{},r,t);if(r.enums&&e.resolvedType instanceof o)return r.enums===String?e.resolvedType.getValuesById()[i]:0|i;if(r.longs&&e.long){var f="u"===e.type.charAt(0);if(r.longs===Number)return"number"==typeof i?i:u.LongBits.from(i).toNumber(f);if(r.longs===String)return"number"==typeof i?u.Long.fromNumber(i,f).toString():(i=u.Long.fromValue(i),i.unsigned=f,i.toString())}if(r.bytes&&e.bytes){if(r.bytes===String)return u.base64.encode(i,0,i.length);if(r.bytes===Array)return Array.prototype.slice.call(i);if(r.bytes===u.Buffer&&!u.Buffer.isBuffer(i))return u.Buffer.from(i)}return i},n.toMessage=function t(e,i,s){switch(typeof i){case"object":if(i){if(e.resolvedType instanceof r)return n(e.resolvedType,i,new(e.resolvedType.getCtor()),s,t);if("bytes"===e.type)return u.Buffer?u.Buffer.isBuffer(i)?i:u.Buffer.from(i):i instanceof u.Array?i:new u.Array(i)}break;case"string":if(e.resolvedType instanceof o)return e.resolvedType.values[i]||0;if(e.long)return u.Long.fromString(i,"u"===e.type.charAt(0));if(e.bytes){var f=u.newBuffer(u.base64.length(i));return u.base64.decode(i,f,0),f}break;case"number":if(e.long)return u.Long.fromNumber(i,"u"===e.type.charAt(0))}return i}},{15:15,18:18,29:29,31:31}],13:[function(t,e,i){"use strict";function n(t){var e=t.getFieldsArray(),i=o.codegen("r","l")("r instanceof Reader||(r=Reader.create(r))")("var c=l===undefined?r.len:r.pos+l,m=new(this.getCtor())")("while(r.pos<c){")("var t=r.uint32()");t.group&&i("if((t&7)===4)")("break"),i("switch(t>>>3){");for(var n=0;n<e.length;++n){var u=e[n].resolve(),f=u.resolvedType instanceof r?"uint32":u.type,a="m"+o.safeProp(u.name);if(i("case %d:",u.id),u.map){var h=u.resolvedKeyType?"uint32":u.keyType;i("r.skip().pos++")("if(%s===util.emptyObject)",a)("%s={}",a)("var k=r.%s()",h)('if(typeof k==="object")')("k=util.longToHash(k)")("r.pos++"),void 0===s.basic[f]?i("%s[k]=types[%d].decode(r,r.uint32())",a,n):i("%s[k]=r.%s()",a,f)}else u.repeated?(i("%s&&%s.length||(%s=[])",a,a,a),u.packed&&void 0!==s.packed[f]&&i("if((t&7)===2){")("var e=r.uint32()+r.pos")("while(r.pos<e)")("%s.push(r.%s())",a,f)("}else"),void 0===s.basic[f]?i(u.resolvedType.group?"%s.push(types[%d].decode(r))":"%s.push(types[%d].decode(r,r.uint32()))",a,n):i("%s.push(r.%s())",a,f)):void 0===s.basic[f]?i(u.resolvedType.group?"%s=types[%d].decode(r)":"%s=types[%d].decode(r,r.uint32())",a,n):i("%s=r.%s()",a,f);i("break")}return i("default:")("r.skipType(t&7)")("break")("}")("}")("return m")}e.exports=n;var r=t(15),s=t(30),o=t(31)},{15:15,30:30,31:31}],14:[function(t,e,i){"use strict";function n(t,e,i,n){return e.resolvedType.group?t("types[%d].encode(%s,w.uint32(%d)).uint32(%d)",i,n,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%d].encode(%s,w.uint32(%d).fork()).ldelim()",i,n,(e.id<<3|2)>>>0)}function r(t){for(var e,i,r=t.getFieldsArray(),f=t.getOneofsArray(),a=u.codegen("m","w")("w||(w=Writer.create())"),e=0;e<r.length;++e){var h=r[e].resolve(),l=h.resolvedType instanceof s?"uint32":h.type,c=o.basic[l];if(i="m"+u.safeProp(h.name),h.map){var d=h.resolvedKeyType?"uint32":h.keyType;a("if(%s&&%s!==util.emptyObject){",i,i)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",i)("w.uint32(%d).fork().uint32(%d).%s(ks[i])",(h.id<<3|2)>>>0,8|o.mapKey[d],d),void 0===c?a("types[%d].encode(%s[ks[i]],w.uint32(18).fork()).ldelim()",e,i):a("w.uint32(%d).%s(%s[ks[i]])",16|c,l,i),a("w.ldelim()")("}")("}")}else h.repeated?h.packed&&void 0!==o.packed[l]?a("if(%s&&%s.length){",i,i)("w.uint32(%d).fork()",(h.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",l,i)("w.ldelim()",h.id)("}"):(a("if(%s)",i)("for(var i=0;i<%s.length;++i)",i),void 0===c?n(a,h,e,i+"[i]"):a("w.uint32(%d).%s(%s[i])",(h.id<<3|c)>>>0,l,i)):h.partOf||(h.required||(h.long?a("if(%s!==undefined&&util.longNe(%s,%d,%d))",i,i,h.defaultValue.low,h.defaultValue.high):a("if(%s!==undefined&&%s!==%j)",i,i,h.defaultValue)),void 0===c?n(a,h,e,i):a("w.uint32(%d).%s(%s)",(h.id<<3|c)>>>0,l,i))}for(var e=0;e<f.length;++e){var p=f[e];a("switch(%s){","m.get"+p.ucName+"()");for(var v=p.getFieldsArray(),y=0;y<v.length;++y){var h=v[y],l=h.resolvedType instanceof s?"uint32":h.type,c=o.basic[l];i="m"+u.safeProp(h.name),a("case%j:",h.name),void 0===c?n(a,h,r.indexOf(h),i):a("w.uint32(%d).%s(%s)",(h.id<<3|c)>>>0,l,i),a("break;")}a("}")}return a("return w")}e.exports=r;var s=t(15),o=t(30),u=t(31)},{15:15,30:30,31:31}],15:[function(t,e,i){"use strict";function n(t,e,i){s.call(this,t,i),this.values=e||{},this.c=null}function r(t){return t.c=null,t}e.exports=n;var s=t(21),o=s.extend(n);n.className="Enum";var u=t(31),f=u.b;u.props(o,{valuesById:{get:function(){return this.c||(this.c={},Object.keys(this.values).forEach(function(t){var e=this.values[t];if(this.c[e])throw Error("duplicate id "+e+" in "+this);this.c[e]=t},this)),this.c}}}),n.testJSON=function(t){return Boolean(t&&t.values)},n.fromJSON=function(t,e){return new n(t,e.values,e.options)},o.toJSON=function(){return{options:this.options,values:this.values}},o.add=function(t,e){if(!u.isString(t))throw f("name");if(!u.isInteger(e)||e<0)throw f("id","a non-negative integer");if(void 0!==this.values[t])throw Error("duplicate name '"+t+"' in "+this);if(void 0!==this.getValuesById()[e])throw Error("duplicate id "+e+" in "+this);return this.values[t]=e,r(this)},o.remove=function(t){if(!u.isString(t))throw f("name");if(void 0===this.values[t])throw Error("'"+t+"' is not a name of "+this);return delete this.values[t],r(this)}},{21:21,31:31}],16:[function(t,e,i){"use strict";function n(t,e,i,n,s,o){if(h.isObject(n)?(o=n,n=s=void 0):h.isObject(s)&&(o=s,s=void 0),r.call(this,t,o),!h.isInteger(e)||e<0)throw l("id","a non-negative integer");if(!h.isString(i))throw l("type");if(void 0!==s&&!h.isString(s))throw l("extend");if(void 0!==n&&!/^required|optional|repeated$/.test(n=n.toString().toLowerCase()))throw l("rule","a valid rule string");this.rule=n&&"optional"!==n?n:void 0,this.type=i,this.id=e,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.defaultValue=null,this.long=!!h.Long&&void 0!==a.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.d=null}e.exports=n;var r=t(21),s=r.extend(n);n.className="Field";var o,u,f=t(15),a=t(30),h=t(31),l=h.b;h.props(s,{packed:{get:s.isPacked=function(){return null===this.d&&(this.d=this.getOption("packed")!==!1),this.d}}}),s.setOption=function(t,e,i){return"packed"===t&&(this.d=null),r.prototype.setOption.call(this,t,e,i)},n.testJSON=function(t){return Boolean(t&&void 0!==t.id)},n.fromJSON=function(e,i){return void 0!==i.keyType?(u||(u=t(17)),u.fromJSON(e,i)):new n(e,i.id,i.type,i.rule,i.extend,i.options)},s.toJSON=function(){return{rule:"optional"!==this.rule&&this.rule||void 0,type:this.type,id:this.id,extend:this.extend,options:this.options}},s.resolve=function(){if(this.resolved)return this;var e=a.defaults[this.type];if(void 0===e)if(o||(o=t(29)),this.resolvedType=this.parent.lookup(this.type,o))e=null;else{if(!(this.resolvedType=this.parent.lookup(this.type,f)))throw Error("unresolvable field type: "+this.type);e=0}return this.map?this.defaultValue={}:this.repeated?this.defaultValue=[]:(this.options&&void 0!==this.options.default?this.defaultValue=this.options.default:this.defaultValue=e,this.long&&(this.defaultValue=h.Long.fromNumber(this.defaultValue,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.defaultValue))),r.prototype.resolve.call(this)}},{15:15,17:17,21:21,29:29,30:30,31:31}],17:[function(t,e,i){"use strict";function n(t,e,i,n,s){if(r.call(this,t,e,n,s),!f.isString(i))throw f.b("keyType");this.keyType=i,this.resolvedKeyType=null,this.map=!0}e.exports=n;var r=t(16),s=r.prototype,o=r.extend(n);n.className="MapField";var u=t(30),f=t(31);n.testJSON=function(t){return r.testJSON(t)&&void 0!==t.keyType},n.fromJSON=function(t,e){return new n(t,e.id,e.keyType,e.type,e.options)},o.toJSON=function(){return{keyType:this.keyType,type:this.type,id:this.id,extend:this.extend,options:this.options}},o.resolve=function(){if(this.resolved)return this;if(void 0===u.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return s.resolve.call(this)}},{16:16,30:30,31:31}],18:[function(t,e,i){"use strict";function n(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)this[e[i]]=t[e[i]]}e.exports=n;var r=t(12),s=n.prototype;s.asJSON=function(t){return r(this.$type,this,{},t,r.toJson)},n.from=function(t,e){return r(this.$type,t,new this.constructor,e,r.toMessage)},n.encode=function(t,e){return this.$type.encode(t,e)},n.encodeDelimited=function(t,e){return this.$type.encodeDelimited(t,e)},n.decode=function(t){return this.$type.decode(t)},n.decodeDelimited=function(t){return this.$type.decodeDelimited(t)},n.verify=function(t){return this.$type.verify(t)}},{12:12}],19:[function(t,e,i){"use strict";function n(t,e,i,n,s,o,a){if(u.isObject(s)?(a=s,s=o=void 0):u.isObject(o)&&(a=o,o=void 0),e&&!u.isString(e))throw f("type");if(!u.isString(i))throw f("requestType");if(!u.isString(n))throw f("responseType");r.call(this,t,a),this.type=e||"rpc",this.requestType=i,this.requestStream=!!s||void 0,this.responseType=n,this.responseStream=!!o||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null}e.exports=n;var r=t(21),s=r.extend(n);n.className="Method";var o=t(29),u=t(31),f=u.b;n.testJSON=function(t){return Boolean(t&&void 0!==t.requestType)},n.fromJSON=function(t,e){return new n(t,e.type,e.requestType,e.responseType,e.requestStream,e.responseStream,e.options)},s.toJSON=function(){return{type:"rpc"!==this.type&&this.type||void 0,requestType:this.requestType,requestStream:this.requestStream||void 0,responseType:this.responseType,responseStream:this.responseStream||void 0,options:this.options}},s.resolve=function(){if(this.resolved)return this;if(!(this.resolvedRequestType=this.parent.lookup(this.requestType,o)))throw Error("unresolvable request type: "+this.requestType);if(!(this.resolvedResponseType=this.parent.lookup(this.responseType,o)))throw Error("unresolvable response type: "+this.requestType);return r.prototype.resolve.call(this)}},{21:21,29:29,31:31}],20:[function(t,e,i){"use strict";function n(){a||(a=t(29)),h||(h=t(28)),l=[d,a,h,p,r],c="one of "+l.map(function(t){return t.name}).join(", ")}function r(t,e){u.call(this,t,e),this.nested=void 0,this.e=null,this.f=[]}function s(t){t.e=null;for(var e=0;e<t.f.length;++e)delete t[t.f[e]];return t.f=[],t}function o(t){if(t&&t.length){for(var e={},i=0;i<t.length;++i)e[t[i].name]=t[i].toJSON();return e}}e.exports=r;var u=t(21),f=u.extend(r);r.className="Namespace";var a,h,l,c,d=t(15),p=t(16),v=t(31),y=v.b;v.props(f,{nestedArray:{get:function(){return this.e||(this.e=v.toArray(this.nested))}}}),r.testJSON=function(t){return Boolean(t&&!t.fields&&!t.values&&void 0===t.id&&!t.oneof&&!t.methods&&void 0===t.requestType)},r.fromJSON=function(t,e){return new r(t,e.options).addJSON(e.nested)},f.toJSON=function(){return{options:this.options,nested:o(this.getNestedArray())}},r.arrayToJSON=o,f.addJSON=function(t){var e=this;return t&&(l||n(),Object.keys(t).forEach(function(i){for(var n=t[i],r=0;r<l.length;++r)if(l[r].testJSON(n))return e.add(l[r].fromJSON(i,n));throw y("nested."+i,"JSON for "+c)})),this},f.get=function(t){return void 0===this.nested?null:this.nested[t]||null},f.getEnum=function(t){if(this.nested&&this.nested[t]instanceof d)return this.nested[t].values;throw Error("no such enum")},f.add=function(t){if(l||n(),!t||l.indexOf(t.constructor)<0)throw y("object",c);if(t instanceof p&&void 0===t.extend)throw y("object","an extension field when not part of a type");if(this.nested){var e=this.get(t.name);if(e){if(!(e instanceof r&&t instanceof r)||e instanceof a||e instanceof h)throw Error("duplicate name '"+t.name+"' in "+this);for(var i=e.getNestedArray(),o=0;o<i.length;++o)t.add(i[o]);this.remove(e),this.nested||(this.nested={}),t.setOptions(e.options,!0)}}else this.nested={};return this.nested[t.name]=t,t.onAdd(this),s(this)},f.remove=function(t){if(!(t instanceof u))throw y("object","a ReflectionObject");if(t.parent!==this||!this.nested)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),s(this)},f.define=function(t,e){v.isString(t)?t=t.split("."):Array.isArray(t)||(e=t,t=void 0);var i=this;if(t)for(;t.length>0;){var n=t.shift();if(i.nested&&i.nested[n]){if(i=i.nested[n],!(i instanceof r))throw Error("path conflicts with non-namespace objects")}else i.add(i=new r(n))}return e&&i.addJSON(e),i},f.resolve=function(){a||(a=t(29)),h||(a=t(28));for(var e=this.getNestedArray(),i=0;i<e.length;++i)if(/^[A-Z]/.test(e[i].name)){if(e[i]instanceof a||e[i]instanceof h)this[e[i].name]=e[i];else{if(!(e[i]instanceof d))continue;this[e[i].name]=e[i].values}this.f.push(e[i].name)}return u.prototype.resolve.call(this)},f.resolveAll=function(){for(var t=this.getNestedArray(),e=0;e<t.length;)t[e]instanceof r?t[e++].resolveAll():t[e++].resolve();return f.resolve.call(this)},f.lookup=function(t,e,i){if("boolean"==typeof e&&(i=e,e=void 0),v.isString(t)&&t.length)t=t.split(".");else if(!t.length)return null;if(""===t[0])return this.getRoot().lookup(t.slice(1),e);var n=this.get(t[0]);return n&&1===t.length&&(!e||n instanceof e)||n instanceof r&&(n=n.lookup(t.slice(1),e,!0))?n:null===this.parent||i?null:this.parent.lookup(t,e)},f.lookupType=function(e){a||(a=t(29));var i=this.lookup(e,a);if(!i)throw Error("no such type");return i},f.lookupService=function(e){h||(h=t(28));var i=this.lookup(e,h);if(!i)throw Error("no such service");return i},f.lookupEnum=function(t){var e=this.lookup(t,d);if(!e)throw Error("no such enum");return e.values}},{15:15,16:16,21:21,28:28,29:29,31:31}],21:[function(t,e,i){"use strict";function n(t,e){if(!r.isString(t))throw o("name");if(e&&!r.isObject(e))throw o("options","an object");this.options=e,this.name=t,this.parent=null,this.resolved=!1}e.exports=n;var r=t(31);n.className="ReflectionObject",n.extend=r.extend;var s,o=r.b,u=n.prototype;r.props(u,{root:{get:function(){for(var t=this;null!==t.parent;)t=t.parent;return t}},fullName:{get:u.getFullName=function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}}),u.toJSON=function(){throw Error()},u.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var i=e.getRoot();s||(s=t(25)),i instanceof s&&i.g(this)},u.onRemove=function(e){var i=e.getRoot();s||(s=t(25)),i instanceof s&&i.h(this),this.parent=null,this.resolved=!1},u.resolve=function(){if(this.resolved)return this;var e=this.getRoot();return s||(s=t(25)),e instanceof s&&(this.resolved=!0),this},u.getOption=function(t){if(this.options)return this.options[t]},u.setOption=function(t,e,i){return i&&this.options&&void 0!==this.options[t]||((this.options||(this.options={}))[t]=e),this},u.setOptions=function(t,e){return t&&Object.keys(t).forEach(function(i){this.setOption(i,t[i],e)},this),this},u.toString=function(){var t=this.constructor.className,e=this.getFullName();return e.length?t+" "+e:t}},{25:25,31:31}],22:[function(t,e,i){"use strict";function n(t,e,i){if(Array.isArray(e)||(i=e,e=void 0),s.call(this,t,i),e&&!Array.isArray(e))throw a("fieldNames","an Array");this.ucName=f.ucFirst(this.name),this.oneof=e||[],this.i=[]}function r(t){t.parent&&t.i.forEach(function(e){e.parent||t.parent.add(e)})}e.exports=n;var s=t(21),o=s.extend(n);n.className="OneOf";var u=t(16),f=t(31),a=f.b;f.prop(o,"fieldsArray",{get:function(){return this.i}}),n.testJSON=function(t){return Boolean(t.oneof)},n.fromJSON=function(t,e){return new n(t,e.oneof,e.options)},o.toJSON=function(){return{oneof:this.oneof,options:this.options}},o.add=function(t){if(!(t instanceof u))throw a("field","a Field");return t.parent&&t.parent.remove(t),this.oneof.push(t.name),this.i.push(t),t.partOf=this,r(this),this},o.remove=function(t){if(!(t instanceof u))throw a("field","a Field");var e=this.i.indexOf(t);if(e<0)throw Error(t+" is not a member of "+this);return this.i.splice(e,1),e=this.oneof.indexOf(t.name),e>-1&&this.oneof.splice(e,1),t.parent&&t.parent.remove(t),t.partOf=null,this},o.onAdd=function(t){s.prototype.onAdd.call(this,t);var e=this;this.oneof.forEach(function(i){var n=t.get(i);n&&!n.partOf&&(n.partOf=e,e.i.push(n))}),r(this)},o.onRemove=function(t){this.i.forEach(function(t){t.parent&&t.parent.remove(t)}),s.prototype.onRemove.call(this,t)}},{16:16,21:21,31:31}],23:[function(t,e,i){"use strict";function n(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function r(t){this.buf=t,this.pos=0,this.len=t.length}function s(){var t=new O(0,0),e=0;if(this.len-this.pos>4){for(e=0;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}else{for(e=0;e<4;++e){if(this.pos>=this.len)throw n(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}if(this.pos>=this.len)throw n(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}if(this.len-this.pos>4){for(e=0;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(e=0;e<5;++e){if(this.pos>=this.len)throw n(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function o(){return s.call(this).toLong()}function u(){return s.call(this).toNumber()}function f(){return s.call(this).toLong(!0)}function a(){return s.call(this).toNumber(!0)}function h(){return s.call(this).zzDecode().toLong()}function l(){return s.call(this).zzDecode().toNumber()}function c(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw n(this,8);return new O(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}function p(){return d.call(this).toLong(!0)}function v(){return d.call(this).toNumber(!0)}function y(){return d.call(this).zzDecode().toLong()}function g(){return d.call(this).zzDecode().toNumber()}function m(){w.Long?(k.int64=o,k.uint64=f,k.sint64=h,k.fixed64=p,k.sfixed64=y):(k.int64=u,k.uint64=a,k.sint64=l,k.fixed64=v,k.sfixed64=g)}e.exports=r;var b,w=t(33),O=w.LongBits,x=w.utf8;r.create=w.Buffer?function(e){return b||(b=t(24)),(r.create=function(t){return new b(t)})(e)}:function(t){return new r(t)};var k=r.prototype;k.j=w.Array.prototype.subarray||w.Array.prototype.slice,k.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,n(this,10);return t}}(),k.int32=function(){return 0|this.uint32()},k.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},k.bool=function(){return 0!==this.uint32()},k.fixed32=function(){if(this.pos+4>this.len)throw n(this,4);return c(this.buf,this.pos+=4)},k.sfixed32=function(){var t=this.fixed32();return t>>>1^-(1&t)};var N="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[3]?function(i,n){return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e[3]=i[n+3],t[0]}:function(i,n){return e[3]=i[n],e[2]=i[n+1],e[1]=i[n+2],e[0]=i[n+3],t[0]}}():function(t,e){var i=c(t,e+4),n=2*(i>>31)+1,r=i>>>23&255,s=8388607&i;return 255===r?s?NaN:n*(1/0):0===r?1.401298464324817e-45*n*s:n*Math.pow(2,r-150)*(s+8388608)};k.float=function(){if(this.pos+4>this.len)throw n(this,4);var t=N(this.buf,this.pos);return this.pos+=4,t};var A="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[7]?function(i,n){return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e[3]=i[n+3],e[4]=i[n+4],e[5]=i[n+5],e[6]=i[n+6],e[7]=i[n+7],t[0]}:function(i,n){return e[7]=i[n],e[6]=i[n+1],e[5]=i[n+2],e[4]=i[n+3],e[3]=i[n+4],e[2]=i[n+5],e[1]=i[n+6],e[0]=i[n+7],t[0]}}():function(t,e){var i=c(t,e+4),n=c(t,e+8),r=2*(n>>31)+1,s=n>>>20&2047,o=4294967296*(1048575&n)+i;return 2047===s?o?NaN:r*(1/0):0===s?5e-324*r*o:r*Math.pow(2,s-1075)*(o+4503599627370496)};k.double=function(){if(this.pos+8>this.len)throw n(this,4);var t=A(this.buf,this.pos);return this.pos+=8,t},k.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw n(this,t);return this.pos+=t,e===i?new this.buf.constructor(0):this.j.call(this.buf,e,i)},k.string=function(){var t=this.bytes();return x.read(t,0,t.length)},k.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw n(this,t);this.pos+=t}else do if(this.pos>=this.len)throw n(this);while(128&this.buf[this.pos++]);return this},k.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4===(t=7&this.uint32()))break;this.skipType(t)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type: "+t)}return this},r.k=m,m()},{24:24,33:33}],24:[function(t,e,i){"use strict";function n(t){r.call(this,t)}e.exports=n;var r=t(23),s=n.prototype=Object.create(r.prototype);s.constructor=n;var o=t(33);o.Buffer&&(s.j=o.Buffer.prototype.slice),s.string=function(){var t=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len))}},{23:23,33:33}],25:[function(t,e,i){"use strict";function n(t){o.call(this,"",t),this.deferred=[],this.files=[]}function r(){}function s(t){var e=t.parent.lookup(t.extend);if(e){var i=new h(t.getFullName(),t.id,t.type,t.rule,(void 0),t.options);return i.declaringField=t,t.extensionField=i,e.add(i),!0}return!1}e.exports=n;var o=t(20),u=o.extend(n);n.className="Root";var f,a,h=t(16),l=t(31);n.fromJSON=function(t,e){return e||(e=new n),e.setOptions(t.options).addJSON(t.nested)},u.resolvePath=l.path.resolve;var c=function(){try{f=t("./parse"),a=t("./common")}catch(t){}c=null};u.load=function t(e,i,n){function s(t,e){if(n){var i=n;n=null,i(t,e)}}function o(t,e){try{if(l.isString(e)&&"{"===e.charAt(0)&&(e=JSON.parse(e)),l.isString(e)){f.filename=t;var n=f(e,h,i);n.imports&&n.imports.forEach(function(e){u(h.resolvePath(t,e))}),n.weakImports&&n.weakImports.forEach(function(e){u(h.resolvePath(t,e),!0)})}else h.setOptions(e.options).addJSON(e.nested)}catch(t){return void s(t)}d||p||s(null,h)}function u(t,e){var i=t.lastIndexOf("google/protobuf/");if(i>-1){var r=t.substring(i);r in a&&(t=r)}if(!(h.files.indexOf(t)>-1)){if(h.files.push(t),t in a)return void(d?o(t,a[t]):(++p,setTimeout(function(){--p,o(t,a[t])})));if(d){var u;try{u=l.fs.readFileSync(t).toString("utf8")}catch(t){return void(e||s(t))}o(t,u)}else++p,l.fetch(t,function(i,r){if(--p,n)return i?void(e||s(i)):void o(t,r)})}}c&&c(),"function"==typeof i&&(n=i,i=void 0);var h=this;if(!n)return l.asPromise(t,h,e);var d=n===r,p=0;return l.isString(e)&&(e=[e]),e.forEach(function(t){u(h.resolvePath("",t))}),d?h:void(p||s(null,h))},u.loadSync=function(t,e){return this.load(t,e,r)},u.g=function(t){var e=this.deferred.slice();this.deferred=[];for(var i=0;i<e.length;)s(e[i])?e.splice(i,1):++i;if(this.deferred=e,t instanceof h&&void 0!==t.extend&&!t.extensionField&&!s(t)&&this.deferred.indexOf(t)<0)this.deferred.push(t);else if(t instanceof o){var n=t.getNestedArray();for(i=0;i<n.length;++i)this.g(n[i])}},u.h=function(t){if(t instanceof h){if(void 0!==t.extend&&!t.extensionField){var e=this.deferred.indexOf(t);e>-1&&this.deferred.splice(e,1)}t.extensionField&&(t.extensionField.parent.remove(t.extensionField),t.extensionField=null)}else if(t instanceof o)for(var i=t.getNestedArray(),n=0;n<i.length;++n)this.h(i[n])}},{16:16,20:20,31:31,undefined:void 0}],26:[function(t,e,i){"use strict";var n=i;n.Service=t(27)},{27:27}],27:[function(t,e,i){"use strict";function n(t){s.call(this),this.$rpc=t}e.exports=n;var r=t(31),s=r.EventEmitter,o=n.prototype=Object.create(s.prototype);o.constructor=n,o.end=function(t){return this.$rpc&&(t||this.$rpc(null,null,null),this.$rpc=null,this.emit("end").off()),this}},{31:31}],28:[function(t,e,i){"use strict";function n(t,e){s.call(this,t,e),this.methods={},this.l=null}function r(t){return t.l=null,t}e.exports=n;var s=t(20),o=s.prototype,u=s.extend(n);n.className="Service";var f=t(19),a=t(31),h=t(26); | ||
a.props(u,{methodsArray:{get:function(){return this.l||(this.l=a.toArray(this.methods))}}}),n.testJSON=function(t){return Boolean(t&&t.methods)},n.fromJSON=function(t,e){var i=new n(t,e.options);return e.methods&&Object.keys(e.methods).forEach(function(t){i.add(f.fromJSON(t,e.methods[t]))}),i},u.toJSON=function(){var t=o.toJSON.call(this);return{options:t&&t.options||void 0,methods:s.arrayToJSON(this.getMethodsArray())||{},nested:t&&t.nested||void 0}},u.get=function(t){return o.get.call(this,t)||this.methods[t]||null},u.resolveAll=function(){for(var t=this.getMethodsArray(),e=0;e<t.length;++e)t[e].resolve();return o.resolve.call(this)},u.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);return t instanceof f?(this.methods[t.name]=t,t.parent=this,r(this)):o.add.call(this,t)},u.remove=function(t){if(t instanceof f){if(this.methods[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.methods[t.name],t.parent=null,r(this)}return o.remove.call(this,t)},u.create=function(t,e,i){var n=new h.Service(t);return this.getMethodsArray().forEach(function(r){n[a.lcFirst(r.name)]=function(s,o){if(n.$rpc){if(!s)throw a.b("request","not null");r.resolve();var u;try{u=(e?r.resolvedRequestType.encodeDelimited(s):r.resolvedRequestType.encode(s)).finish()}catch(t){return void("function"==typeof setImmediate?setImmediate:setTimeout)(function(){o(t)})}t(r,u,function(t,e){if(t)return n.emit("error",t,r),o?o(t):void 0;if(null===e)return void n.end(!0);var s;try{s=i?r.resolvedResponseType.decodeDelimited(e):r.resolvedResponseType.decode(e)}catch(t){return n.emit("error",t,r),o?o("error",t):void 0}return n.emit("data",s,r),o?o(null,s):void 0})}}}),n}},{19:19,20:20,26:26,31:31}],29:[function(t,e,i){"use strict";function n(t,e){s.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this.m=null,this.i=null,this.n=null,this.o=null,this.p=null}function r(t){return t.m=t.i=t.o=t.p=null,delete t.encode,delete t.decode,delete t.verify,t}e.exports=n;var s=t(20),o=s.prototype,u=s.extend(n);n.className="Type";var f,a,h,l=t(15),c=t(22),d=t(16),p=t(28),v=t(11),y=t(18),g=t(23),m=t(35),b=t(12),w=t(31);w.props(u,{fieldsById:{get:function(){if(this.m)return this.m;this.m={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var i=this.fields[t[e]],n=i.id;if(this.m[n])throw Error("duplicate id "+n+" in "+this);this.m[n]=i}return this.m}},fieldsArray:{get:function(){return this.i||(this.i=w.toArray(this.fields))}},repeatedFieldsArray:{get:function(){return this.n||(this.n=this.getFieldsArray().filter(function(t){return t.repeated}))}},oneofsArray:{get:function(){return this.o||(this.o=w.toArray(this.oneofs))}},ctor:{get:function(){return this.p||(this.p=v.create(this).constructor)},set:function(t){if(t&&!(t.prototype instanceof y))throw w.b("ctor","a Message constructor");t.from||(t.from=y.from),this.p=t}}}),n.testJSON=function(t){return Boolean(t&&t.fields)};var O=[l,n,d,p];n.fromJSON=function(t,e){var i=new n(t,e.options);return i.extensions=e.extensions,i.reserved=e.reserved,e.fields&&Object.keys(e.fields).forEach(function(t){i.add(d.fromJSON(t,e.fields[t]))}),e.oneofs&&Object.keys(e.oneofs).forEach(function(t){i.add(c.fromJSON(t,e.oneofs[t]))}),e.nested&&Object.keys(e.nested).forEach(function(t){for(var n=e.nested[t],r=0;r<O.length;++r)if(O[r].testJSON(n))return void i.add(O[r].fromJSON(t,n));throw Error("invalid nested object in "+i+": "+t)}),e.extensions&&e.extensions.length&&(i.extensions=e.extensions),e.reserved&&e.reserved.length&&(i.reserved=e.reserved),e.group&&(i.group=!0),i},u.toJSON=function(){var t=o.toJSON.call(this);return{options:t&&t.options||void 0,oneofs:s.arrayToJSON(this.getOneofsArray()),fields:s.arrayToJSON(this.getFieldsArray().filter(function(t){return!t.declaringField}))||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:t&&t.nested||void 0}},u.resolveAll=function(){for(var t=this.getFieldsArray(),e=0;e<t.length;)t[e++].resolve();var i=this.getOneofsArray();for(e=0;e<i.length;)i[e++].resolve();return o.resolve.call(this)},u.get=function(t){return o.get.call(this,t)||this.fields&&this.fields[t]||this.oneofs&&this.oneofs[t]||null},u.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof d&&void 0===t.extend){if(this.getFieldsById()[t.id])throw Error("duplicate id "+t.id+" in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),r(this)}return t instanceof c?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),r(this)):o.add.call(this,t)},u.remove=function(t){if(t instanceof d&&void 0===t.extend){if(this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.message=null,r(this)}return o.remove.call(this,t)},u.create=function(t){return new(this.getCtor())(t)},u.from=function(t,e){return b(this,t,new(this.getCtor()),e,b.toMessage)},u.setup=function(){return f||(f=t(14),a=t(13),h=t(34)),this.encode=f(this).eof(this.getFullName()+"$encode",{Writer:m,types:this.getFieldsArray().map(function(t){return t.resolvedType}),util:w}),this.decode=a(this).eof(this.getFullName()+"$decode",{Reader:g,types:this.getFieldsArray().map(function(t){return t.resolvedType}),util:w}),this.verify=h(this).eof(this.getFullName()+"$verify",{types:this.getFieldsArray().map(function(t){return t.resolvedType}),util:w}),this},u.encode=function(t,e){return this.setup().encode(t,e)},u.encodeDelimited=function(t,e){return this.encode(t,e&&e.len?e.fork():e).ldelim()},u.decode=function(t,e){return this.setup().decode(t,e)},u.decodeDelimited=function(t){return t=t instanceof g?t:g.create(t),this.decode(t,t.uint32())},u.verify=function(t){return this.setup().verify(t)}},{11:11,12:12,13:13,14:14,15:15,16:16,18:18,20:20,22:22,23:23,28:28,31:31,34:34,35:35}],30:[function(t,e,i){"use strict";function n(t,e){var i=0,n={};for(e|=0;i<t.length;)n[o[i+e]]=t[i++];return n}var r=i,s=t(31),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes","message"];r.basic=n([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),r.defaults=n([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",s.emptyArray,null]),r.long=n([0,0,0,1,1],7),r.mapKey=n([0,0,0,5,5,0,0,0,1,1,0,2],2),r.packed=n([1,5,0,0,0,5,5,0,0,0,1,1,0])},{31:31}],31:[function(t,e,i){"use strict";var n=e.exports=t(33);n.asPromise=t(1),n.codegen=t(3),n.EventEmitter=t(4),n.extend=t(5),n.fetch=t(6),n.path=t(8),n.fs=n.inquire("fs"),n.toArray=function(t){if(!t)return[];for(var e=Object.keys(t),i=e.length,n=new Array(i),r=0;r<i;++r)n[r]=t[e[r]];return n},n.b=function(t,e){return TypeError(t+" must be "+(e||"a string"))},n.merge=function(t,e,i){if(e)for(var n=Object.keys(e),r=0;r<n.length;++r)void 0!==t[n[r]]&&i||(t[n[r]]=e[n[r]]);return t},n.safeProp=function(t){return'["'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"]'},n.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},n.newBuffer=function(t){return t=t||0,n.Buffer?n.Buffer.allocUnsafe(t):new("undefined"!=typeof Uint8Array?Uint8Array:Array)(t)}},{1:1,3:3,33:33,4:4,5:5,6:6,8:8}],32:[function(t,e,i){"use strict";function n(t,e){this.lo=t,this.hi=e}e.exports=n;var r=t(33),s=n.prototype,o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1},n.fromNumber=function(t){if(0===t)return o;var e=t<0;t=Math.abs(t);var i=t>>>0,r=(t-i)/4294967296>>>0;return e&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new n(i,r)},n.from=function(t){if("number"==typeof t)return n.fromNumber(t);if("string"==typeof t){if(!r.Long)return n.fromNumber(parseInt(t,10));t=r.Long.fromString(t)}return t.low||t.high?new n(t.low>>>0,t.high>>>0):o},s.toNumber=function(t){return!t&&this.hi>>>31?(this.lo=~this.lo+1>>>0,this.hi=~this.hi>>>0,this.lo||(this.hi=this.hi+1>>>0),-(this.lo+4294967296*this.hi)):this.lo+4294967296*this.hi},s.toLong=function(t){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var u=String.prototype.charCodeAt;n.fromHash=function(t){return new n((u.call(t,0)|u.call(t,1)<<8|u.call(t,2)<<16|u.call(t,3)<<24)>>>0,(u.call(t,4)|u.call(t,5)<<8|u.call(t,6)<<16|u.call(t,7)<<24)>>>0)},s.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},s.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},s.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},s.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}},{33:33}],33:[function(require,module,exports){(function(global){"use strict";var util=exports;util.LongBits=require(32),util.base64=require(2),util.inquire=require(7),util.utf8=require(10),util.pool=require(9),util.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),util.isIE8=!1;try{util.isIE8=eval("!-[1,]")}catch(t){}util.Buffer=function(){try{var t=util.inquire("buffer").Buffer;return t.prototype.utf8Write?(t.from||(t.from=function(e,i){return new t(e,i)}),t.allocUnsafe||(t.allocUnsafe=function(e){return new t(e)}),t):null}catch(t){return null}}(),util.Array="undefined"==typeof Uint8Array?Array:Uint8Array,util.Long=global.dcodeIO&&global.dcodeIO.Long||util.inquire("long"),util.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},util.isString=function(t){return"string"==typeof t||t instanceof String},util.isObject=function(t){return t&&"object"==typeof t},util.longToHash=function(t){return t?util.LongBits.from(t).toHash():"\0\0\0\0\0\0\0\0"},util.longFromHash=function(t,e){var i=util.LongBits.fromHash(t);return util.Long?util.Long.fromBits(i.lo,i.hi,e):i.toNumber(Boolean(e))},util.longNeq=function(t,e){return"number"==typeof t?"number"==typeof e?t!==e:(t=util.LongBits.fromNumber(t)).lo!==e.low||t.hi!==e.high:"number"==typeof e?(e=util.LongBits.fromNumber(e)).lo!==t.low||e.hi!==t.high:t.low!==e.low||t.high!==e.high},util.longNe=function(t,e,i){if("object"==typeof t)return t.low!==e||t.high!==i;var n=util.LongBits.from(t);return n.lo!==e||n.hi!==i},util.ucFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},util.props=function(t,e){Object.keys(e).forEach(function(i){util.prop(t,i,e[i])})},util.prop=function(t,e,i){var n=util.ucFirst(e);i.get&&(t["get"+n]=i.get),i.set&&(t["set"+n]=util.isIE8?function(t){i.set.call(this,t),this[e]=t}:i.set),util.isIE8?void 0!==i.value&&(t[e]=i.value):Object.defineProperty(t,e,i)},util.emptyArray=Object.freeze?Object.freeze([]):[],util.emptyObject=Object.freeze?Object.freeze({}):{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,2:2,32:32,7:7,9:9}],34:[function(t,e,i){"use strict";function n(t,e){return"invalid value for field "+t.getFullName()+" ("+e+(t.repeated&&"array"!==e?"[]":t.map&&"object"!==e?"{k:"+t.keyType+"}":"")+" expected)"}function r(t,e,i,r){if(e.resolvedType)if(e.resolvedType instanceof u){t("switch(%s){",r)("default:")("return%j",n(e,"enum value"));for(var s=a.toArray(e.resolvedType.values),o=0;o<s.length;++o)t("case %d:",s[o]);t("break")("}")}else e.resolvedType instanceof f&&t("var r;")("if(r=types[%d].verify(%s))",i,r)("return r");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",r)("return%j",n(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",r,r,r,r)("return%j",n(e,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',r)("return%j",n(e,"number"));break;case"bool":t('if(typeof %s!=="boolean")',r)("return%j",n(e,"boolean"));break;case"string":t("if(!util.isString(%s))",r)("return%j",n(e,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',r,r,r)("return%j",n(e,"buffer"))}}function s(t,e,i){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))",i)("return%j",n(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9]\\d*))$/.test(%s))",i)("return%j",n(e,"integer|Long key"));break;case"bool":t("if(!/^true|false|0|1$/.test(%s))",i)("return%j",n(e,"boolean key"))}}function o(t){for(var e=t.getFieldsArray(),i=a.codegen("m"),o=0;o<e.length;++o){var u=e[o].resolve(),h="m"+a.safeProp(u.name);u.map?(i("if(%s!==undefined){",h)("if(!util.isObject(%s))",h)("return%j",n(u,"object"))("var k=Object.keys(%s)",h)("for(var i=0;i<k.length;++i){"),s(i,u,"k[i]"),r(i,u,o,h+"[k[i]]"),i("}")("}")):u.repeated?(i("if(%s!==undefined){",h)("if(!Array.isArray(%s))",h)("return%j",n(u,"array"))("for(var i=0;i<%s.length;++i){",h),r(i,u,o,h+"[i]"),i("}")("}")):(u.required||(u.resolvedType instanceof f?i("if(%s!==undefined&&%s!==null){",h,h):i("if(%s!==undefined){",h)),r(i,u,o,h),u.required||i("}"))}return i("return null")}e.exports=o;var u=t(15),f=t(29),a=t(31)},{15:15,29:29,31:31}],35:[function(t,e,i){"use strict";function n(t,e,i){this.fn=t,this.len=e,this.next=void 0,this.val=i}function r(){}function s(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function o(){this.len=0,this.head=new n(r,0,0),this.tail=this.head,this.states=null}function u(t,e,i){e[i]=255&t}function f(t,e,i){for(;t>127;)e[i++]=127&t|128,t>>>=7;e[i]=t}function a(t,e,i){for(;t.hi;)e[i++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[i++]=127&t.lo|128,t.lo=t.lo>>>7;e[i++]=t.lo}function h(t,e,i){e[i++]=255&t,e[i++]=t>>>8&255,e[i++]=t>>>16&255,e[i]=t>>>24}e.exports=o;var l,c=t(33),d=c.LongBits,p=c.base64,v=c.utf8;o.create=c.Buffer?function(){return l||(l=t(36)),(o.create=function(){return new l})()}:function(){return new o},o.alloc=function(t){return new c.Array(t)},c.Array!==Array&&(o.alloc=c.pool(o.alloc,c.Array.prototype.subarray));var y=o.prototype;y.push=function(t,e,i){return this.tail=this.tail.next=new n(t,e,i),this.len+=e,this},y.uint32=function(t){return t>>>=0,this.push(f,t<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)},y.int32=function(t){return t<0?this.push(a,10,d.fromNumber(t)):this.uint32(t)},y.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},y.uint64=function(t){var e=d.from(t);return this.push(a,e.length(),e)},y.int64=y.uint64,y.sint64=function(t){var e=d.from(t).zzEncode();return this.push(a,e.length(),e)},y.bool=function(t){return this.push(u,1,t?1:0)},y.fixed32=function(t){return this.push(h,4,t>>>0)},y.sfixed32=function(t){return this.push(h,4,t<<1^t>>31)},y.fixed64=function(t){var e=d.from(t);return this.push(h,4,e.lo).push(h,4,e.hi)},y.sfixed64=function(t){var e=d.from(t).zzEncode();return this.push(h,4,e.lo).push(h,4,e.hi)};var g="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[3]?function(i,n,r){t[0]=i,n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r]=e[3]}:function(i,n,r){t[0]=i,n[r++]=e[3],n[r++]=e[2],n[r++]=e[1],n[r]=e[0]}}():function(t,e,i){var n=t<0?1:0;if(n&&(t=-t),0===t)h(1/t>0?0:2147483648,e,i);else if(isNaN(t))h(2147483647,e,i);else if(t>3.4028234663852886e38)h((n<<31|2139095040)>>>0,e,i);else if(t<1.1754943508222875e-38)h((n<<31|Math.round(t/1.401298464324817e-45))>>>0,e,i);else{var r=Math.floor(Math.log(t)/Math.LN2),s=8388607&Math.round(t*Math.pow(2,-r)*8388608);h((n<<31|r+127<<23|s)>>>0,e,i)}};y.float=function(t){return this.push(g,4,t)};var m="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[7]?function(i,n,r){t[0]=i,n[r++]=e[0],n[r++]=e[1],n[r++]=e[2],n[r++]=e[3],n[r++]=e[4],n[r++]=e[5],n[r++]=e[6],n[r]=e[7]}:function(i,n,r){t[0]=i,n[r++]=e[7],n[r++]=e[6],n[r++]=e[5],n[r++]=e[4],n[r++]=e[3],n[r++]=e[2],n[r++]=e[1],n[r]=e[0]}}():function(t,e,i){var n=t<0?1:0;if(n&&(t=-t),0===t)h(0,e,i),h(1/t>0?0:2147483648,e,i+4);else if(isNaN(t))h(4294967295,e,i),h(2147483647,e,i+4);else if(t>1.7976931348623157e308)h(0,e,i),h((n<<31|2146435072)>>>0,e,i+4);else{var r;if(t<2.2250738585072014e-308)r=t/5e-324,h(r>>>0,e,i),h((n<<31|r/4294967296)>>>0,e,i+4);else{var s=Math.floor(Math.log(t)/Math.LN2);1024===s&&(s=1023),r=t*Math.pow(2,-s),h(4503599627370496*r>>>0,e,i),h((n<<31|s+1023<<20|1048576*r&1048575)>>>0,e,i+4)}}};y.double=function(t){return this.push(m,8,t)};var b=c.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var n=0;n<t.length;++n)e[i+n]=t[n]};y.bytes=function(t){var e=t.length>>>0;if("string"==typeof t&&e){var i=o.alloc(e=p.length(t));p.decode(t,i,0),t=i}return e?this.uint32(e).push(b,e,t):this.push(u,1,0)},y.string=function(t){var e=v.length(t);return e?this.uint32(e).push(v.write,e,t):this.push(u,1,0)},y.fork=function(){return this.states=new s(this),this.head=this.tail=new n(r,0,0),this.len=0,this},y.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(r,0,0),this.len=0),this},y.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i).tail.next=t.next,this.tail=e,this.len+=i,this},y.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e}},{33:33,36:36}],36:[function(t,e,i){"use strict";function n(){s.call(this)}function r(t,e,i){t.length<40?f.write(t,e,i):e.utf8Write(t,i)}e.exports=n;var s=t(35),o=n.prototype=Object.create(s.prototype);o.constructor=n;var u=t(33),f=u.utf8,a=u.Buffer;n.alloc=function(t){return(n.alloc=a.allocUnsafe)(t)};var h=a&&a.prototype instanceof Uint8Array&&"set"===a.prototype.set.name?function(t,e,i){e.set(t,i)}:function(t,e,i){t.copy(e,i,0,t.length)};o.bytes=function(t){"string"==typeof t&&(t=a.from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this.push(h,e,t),this},o.string=function(t){var e=a.byteLength(t);return this.uint32(e),e&&this.push(r,e,t),this}},{33:33,35:35}],37:[function(t,e,i){(function(e){"use strict";function n(t,e,i){return"function"==typeof e?(i=e,e=new o.Root):e||(e=new o.Root),e.load(t,i)}function r(t,e){return e||(e=new o.Root),e.loadSync(t)}function s(){o.Reader.k()}var o=e.protobuf=i;o.load=n,o.loadSync=r,o.roots={};try{o.tokenize=t("./tokenize"),o.parse=t("./parse"),o.common=t("./common")}catch(t){}o.Writer=t(35),o.BufferWriter=t(36),o.Reader=t(23),o.BufferReader=t(24),o.encoder=t(14),o.decoder=t(13),o.verifier=t(34),o.ReflectionObject=t(21),o.Namespace=t(20),o.Root=t(25),o.Enum=t(15),o.Type=t(29),o.Field=t(16),o.OneOf=t(22),o.MapField=t(17),o.Service=t(28),o.Method=t(19),o.Class=t(11),o.Message=t(18),o.types=t(30),o.rpc=t(26),o.util=t(31),o.configure=s,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&(o.util.Long=t,s()),o})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{11:11,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,28:28,29:29,30:30,31:31,34:34,35:35,36:36,undefined:void 0}]},{},[37]); | ||
!function e(t,r,n){function i(o,u){if(!r[o]){if(!t[o]){var f="function"==typeof require&&require;if(!u&&f)return f(o,!0);if(s)return s(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var h=r[o]={exports:{}};t[o][0].call(h.exports,function(e){var r=t[o][1][e];return i(r?r:e)},h,h.exports,e,t,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";function n(e,t){for(var r=[],n=2;n<arguments.length;)r.push(arguments[n++]);var i=!0;return new Promise(function(n,s){r.push(function(e){if(i)if(i=!1,e)s(e);else{for(var t=[],r=1;r<arguments.length;)t.push(arguments[r++]);n.apply(null,t)}});try{e.apply(t||this,r)}catch(e){i&&(i=!1,s(e))}})}t.exports=n},{}],2:[function(e,t,r){"use strict";var n=r;n.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),s=new Array(123),o=0;o<64;)s[i[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,r){for(var n,s=[],o=0,u=0;t<r;){var f=e[t++];switch(u){case 0:s[o++]=i[f>>2],n=(3&f)<<4,u=1;break;case 1:s[o++]=i[n|f>>4],n=(15&f)<<2,u=2;break;case 2:s[o++]=i[n|f>>6],s[o++]=i[63&f],u=0}}return u&&(s[o++]=i[n],s[o]=61,1===u&&(s[o+1]=61)),String.fromCharCode.apply(String,s)};var u="invalid encoding";n.decode=function(e,t,r){for(var n,i=r,o=0,f=0;f<e.length;){var a=e.charCodeAt(f++);if(61===a&&o>1)break;if(void 0===(a=s[a]))throw Error(u);switch(o){case 0:n=a,o=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,o=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,o=3;break;case 3:t[r++]=(3&n)<<6|a,o=0}}if(1===o)throw Error(u);return r-i},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)}},{}],3:[function(e,t,r){"use strict";function n(){function e(){for(var t=[],r=0;r<arguments.length;)t.push(arguments[r++]);var n=i.apply(null,t),h=c;if(l.length){var p=l[l.length-1];s.test(p)?h=++c:f.test(p)&&++h,u.test(p)&&!u.test(n)?(h=++c,d=!0):d&&a.test(p)&&(h=--c,d=!1),o.test(n)&&(h=--c)}for(r=0;r<h;++r)n="\t"+n;return l.push(n),e}function t(e){return"function "+(e?e.replace(/[^\w_$]/g,"_"):"")+"("+h.join(", ")+") {\n"+l.join("\n")+"\n}"}function r(t,r){"object"==typeof t&&(r=t,t=void 0);var i=e.str(t);n.verbose&&console.log("--- codegen ---\n"+i.replace(/^/gm,"> ").replace(/\t/g," "));var s=Object.keys(r||(r={}));return Function.apply(null,s.concat("return "+i)).apply(null,s.map(function(e){return r[e]}))}for(var h=[],l=[],c=1,d=!1,p=0;p<arguments.length;)h.push(arguments[p++]);return e.str=t,e.eof=r,e}function i(e){for(var t=[],r=1;r<arguments.length;)t.push(arguments[r++]);return r=0,e.replace(/%([djs])/g,function(e,n){var i=t[r++];switch(n){case"j":return JSON.stringify(i);default:return String(i)}})}t.exports=n;var s=/[{[]$/,o=/^[}\]]/,u=/:$/,f=/^\s*(?:if|}?else if|while|for)\b|\b(?:else)\s*$/,a=/\b(?:break|continue);?$|^\s*return\b/;n.sprintf=i,n.supported=!1;try{n.supported=1===n("a","b")("return a-b").eof()(2,1)}catch(e){}n.verbose=!1},{}],4:[function(e,t,r){"use strict";function n(){this.a={}}t.exports=n;var i=n.prototype;i.on=function(e,t,r){return(this.a[e]||(this.a[e]=[])).push({fn:t,ctx:r||this}),this},i.off=function(e,t){if(void 0===e)this.a={};else if(void 0===t)this.a[e]=[];else for(var r=this.a[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},i.emit=function(e){var t=this.a[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},{}],5:[function(e,t,r){"use strict";function n(e){for(var t=Object.keys(this),r=0;r<t.length;++r)e[t[r]]=this[t[r]];var n=e.prototype=Object.create(this.prototype);return n.constructor=e,n}t.exports=n},{}],6:[function(e,t,r){"use strict";function n(e,t){return t?u&&u.readFile?u.readFile(e,"utf8",function(r,n){return r&&"undefined"!=typeof XMLHttpRequest?i(e,t):t(r,n)}):i(e,t):s(n,this,e)}function i(e,t){var r=new XMLHttpRequest;r.onreadystatechange=function(){return 4===r.readyState?0===r.status||200===r.status?t(null,r.responseText):t(Error("status "+r.status)):void 0},r.open("GET",e),r.send()}t.exports=n;var s=e(1),o=e(7),u=o("fs")},{1:1,7:7}],7:[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],8:[function(e,t,r){"use strict";var n=r,i=n.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},s=n.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var t=e.split("/"),r=i(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return n+t.join("/")};n.resolve=function(e,t,r){return r||(t=s(t)),i(t)?t:(r||(e=s(e)),(e=e.replace(/(?:\/|^)[^\/]+$/,"")).length?s(e+"/"+t):t)}},{}],9:[function(e,t,r){"use strict";function n(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var u=t.call(s,o,o+=r);return 7&o&&(o=(7|o)+1),u}}t.exports=n},{}],10:[function(e,t,r){"use strict";var n=r;n.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},n.read=function(e,t,r){var n=r-t;if(n<1)return"";for(var i,s=null,o=[],u=0;t<r;)i=e[t++],i<128?o[u++]=i:i>191&&i<224?o[u++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[u++]=55296+(i>>10),o[u++]=56320+(1023&i)):o[u++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0);return s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):u?String.fromCharCode.apply(String,o.slice(0,u)):""},n.write=function(e,t,r){for(var n,i,s=r,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}},{}],11:[function(e,t,r){"use strict";function n(e){return i(e)}function i(t,r){if(s||(s=e(30)),!(t instanceof s))throw TypeError("type must be a Type");if(r){if("function"!=typeof r)throw TypeError("ctor must be a function")}else r=function(e){return function(t){e.call(this,t)}}(o);r.constructor=n;var i=r.prototype=new o;return i.constructor=r,u.merge(r,o,!0),r.$type=t,i.$type=t,t.fieldsArray.forEach(function(e){i[e.name]=Array.isArray(e.resolve().defaultValue)?u.emptyArray:u.isObject(e.defaultValue)&&!e.long?u.emptyObject:e.defaultValue}),t.oneofsArray.forEach(function(e){Object.defineProperty(i,e.resolve().name,{get:function(){for(var t=Object.keys(this),r=t.length-1;r>-1;--r)if(e.oneof.indexOf(t[r])>-1)return t[r]},set:function(t){for(var r=e.oneof,n=0;n<r.length;++n)r[n]!==t&&delete this[r[n]]}})}),t.ctor=r,i}t.exports=n;var s,o=e(19),u=e(32);n.create=i,n.prototype=o},{19:19,30:30,32:32}],12:[function(e,t,r){"use strict";function n(e,t,r){if(e.resolvedType)return e.resolvedType instanceof s?f("f.enums(s%s,%d,types[%d].values,o)",r,0,t):f("types[%d].convert(s%s,f,o)",t,r);switch(e.type){case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":return f("f.longs(s%s,%d,%d,%j,o)",r,0,0,"u"===e.type.charAt(0));case"bytes":return f("f.bytes(s%s,%j,o)",r,Array.prototype.slice.call(e.defaultValue))}return null}function i(e){var t=e.fieldsArray,r=u.codegen("s","f","o")("if(!o)")("o={}")("var d=f.create(s,this,o)");if(t.length){r("if(d){");var i;t.forEach(function(e,t){var s=u.safeProp(e.resolve().name);e.repeated?(r("if(s%s&&s%s.length){",s,s)("d%s=[]",s)("for(var i=0;i<s%s.length;++i)",s),(i=n(e,t,s+"[i]"))?r("d%s.push(%s)",s,i):r("d%s.push(s%s[i])",s,s),r("}else if(o.defaults||o.arrays)")("d%s=[]",s)):(i=n(e,t,s))?r("d%s=%s",s,i):r("if(d%s===undefined&&o.defaults)",s)("d%s=%j",s,e.defaultValue)}),r("}")}return r("return d")}t.exports=i;var s=e(16),o=e(13),u=e(32),f=u.codegen.sprintf;u.merge(i,o)},{13:13,16:16,32:32}],13:[function(e,t,r){"use strict";var n=r,i=e(34);n.json={create:function(e,t,r){return e?r.fieldsOnly?{}:i.merge({},e):null},enums:function(e,t,r,n){if(n.defaults)void 0===e&&(e=t);else if(void 0===e||e===t)return;return n.enums===String&&"number"==typeof e?r[e]:e},longs:function(e,t,r,n,s){if(e){if(!i.longNe(e,t,r)&&!s.defaults)return}else{if(!s.defaults)return;e={low:t,high:r}}return s.longs===Number?"number"==typeof e?e:i.LongBits.from(e).toNumber(n):s.longs===String?"number"==typeof e?i.Long.fromNumber(e,n).toString():(e=i.Long.fromValue(e),e.unsigned=n,e.toString()):e},bytes:function(e,t,r){if(e){if(!e.length&&!r.defaults)return}else{if(!r.defaults)return;e=t}return r.bytes===String?i.base64.encode(e,0,e.length):r.bytes===Array?Array.prototype.slice.call(e):r.bytes!==i.Buffer||i.Buffer.isBuffer(e)?e:i.Buffer.from(e)}},n.message={create:function(e,t,r){return e?new(t.ctor?t.ctor:t)(r.fieldsOnly?void 0:e):null},enums:function(e,t,r){return"string"==typeof e?r[e]:0|e},longs:function(e,t,r,n){return"string"==typeof e?i.Long.fromString(e,n):"number"==typeof e?i.Long.fromNumber(e,n):e},bytes:function(e){if(i.Buffer)return i.Buffer.isBuffer(e)?e:i.Buffer.from(e,"base64");if("string"==typeof e){var t=i.newBuffer(i.base64.length(e));return i.base64.decode(e,t,0),t}return e instanceof i.Array?e:new i.Array(e)}}},{34:34}],14:[function(e,t,r){"use strict";function n(e){var t=e.fieldsArray,r=o.codegen("r","l")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new(this.ctor)")("while(r.pos<c){")("var t=r.uint32()");e.group&&r("if((t&7)===4)")("break"),r("switch(t>>>3){");for(var n=0;n<t.length;++n){var u=t[n].resolve(),f=u.resolvedType instanceof i?"uint32":u.type,a="m"+o.safeProp(u.name);if(r("case %d:",u.id),u.map){var h=u.resolvedKeyType?"uint32":u.keyType;r("r.skip().pos++")("if(%s===util.emptyObject)",a)("%s={}",a)("var k=r.%s()",h)('if(typeof k==="object")')("k=util.longToHash(k)")("r.pos++"),void 0===s.basic[f]?r("%s[k]=types[%d].decode(r,r.uint32())",a,n):r("%s[k]=r.%s()",a,f)}else u.repeated?(r("if(!(%s&&%s.length))",a,a)("%s=[]",a),u.packed&&void 0!==s.packed[f]&&r("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",a,f)("}else"),void 0===s.basic[f]?r(u.resolvedType.group?"%s.push(types[%d].decode(r))":"%s.push(types[%d].decode(r,r.uint32()))",a,n):r("%s.push(r.%s())",a,f)):void 0===s.basic[f]?r(u.resolvedType.group?"%s=types[%d].decode(r)":"%s=types[%d].decode(r,r.uint32())",a,n):r("%s=r.%s()",a,f);r("break")}return r("default:")("r.skipType(t&7)")("break")("}")("}")("return m")}t.exports=n;var i=e(16),s=e(31),o=e(32)},{16:16,31:31,32:32}],15:[function(e,t,r){"use strict";function n(e,t,r,n){return t.resolvedType.group?e("types[%d].encode(%s,w.uint32(%d)).uint32(%d)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%d].encode(%s,w.uint32(%d).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}function i(e){for(var t,r,i=e.fieldsArray,f=e.oneofsArray,a=u.codegen("m","w")("if(!w)")("w=Writer.create()"),t=0;t<i.length;++t){var h=i[t].resolve(),l=h.resolvedType instanceof s?"uint32":h.type,c=o.basic[l];if(r="m"+u.safeProp(h.name),h.map){var d=h.resolvedKeyType?"uint32":h.keyType;a("if(%s&&%s!==util.emptyObject){",r,r)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",r)("w.uint32(%d).fork().uint32(%d).%s(ks[i])",(h.id<<3|2)>>>0,8|o.mapKey[d],d),void 0===c?a("types[%d].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",t,r):a(".uint32(%d).%s(%s[ks[i]]).ldelim()",16|c,l,r),a("}")("}")}else h.repeated?h.packed&&void 0!==o.packed[l]?a("if(%s&&%s.length){",r,r)("w.uint32(%d).fork()",(h.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",r)("w.%s(%s[i])",l,r)("w.ldelim()",h.id)("}"):(a("if(%s){",r)("for(var i=0;i<%s.length;++i)",r),void 0===c?n(a,h,t,r+"[i]"):a("w.uint32(%d).%s(%s[i])",(h.id<<3|c)>>>0,l,r),a("}")):h.partOf||(h.required||(h.long?a("if(%s!==undefined&&%s!==null&&util.longNe(%s,%d,%d))",r,r,r,h.defaultValue.low,h.defaultValue.high):h.bytes?a("if(%s&&%s.length"+(h.defaultValue.length?"&&util.arrayNe(%s,%j)":"")+")",r,r,r,Array.prototype.slice.call(h.defaultValue)):a("if(%s!==undefined&&%s!==%j)",r,r,h.defaultValue)),void 0===c?n(a,h,t,r):a("w.uint32(%d).%s(%s)",(h.id<<3|c)>>>0,l,r))}for(var t=0;t<f.length;++t){var p=f[t];a("switch(%s){","m"+u.safeProp(p.name));for(var v=p.fieldsArray,y=0;y<v.length;++y){var h=v[y],l=h.resolvedType instanceof s?"uint32":h.type,c=o.basic[l];r="m"+u.safeProp(h.name),a("case%j:",h.name),void 0===c?n(a,h,i.indexOf(h),r):a("w.uint32(%d).%s(%s)",(h.id<<3|c)>>>0,l,r),a("break;")}a("}")}return a("return w")}t.exports=i;var s=e(16),o=e(31),u=e(32)},{16:16,31:31,32:32}],16:[function(e,t,r){"use strict";function n(e,t,r){i.call(this,e,r),this.valuesById={},this.values=Object.create(this.valuesById);var n=this;Object.keys(t||{}).forEach(function(e){var r;"number"==typeof t[e]?r=t[e]:(r=parseInt(e,10),e=t[e]),n.valuesById[n.values[e]=r]=e})}t.exports=n;var i=e(22),s=i.extend(n);n.className="Enum";var o=e(32);n.testJSON=function(e){return Boolean(e&&e.values)},n.fromJSON=function(e,t){return new n(e,t.values,t.options)},s.toJSON=function(){return{options:this.options,values:this.values}},s.add=function(e,t){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(void 0!==this.valuesById[t])throw Error("duplicate id "+t+" in "+this);return this.valuesById[this.values[e]=t]=e,this},s.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(void 0===t)throw Error("'"+e+"' is not a name of "+this);return delete this.valuesById[t],delete this.values[e],this}},{22:22,32:32}],17:[function(e,t,r){"use strict";function n(e,t,r,n,s,o){if(h.isObject(n)?(o=n,n=s=void 0):h.isObject(s)&&(o=s,s=void 0),i.call(this,e,o),!h.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!h.isString(r))throw TypeError("type must be a string");if(void 0!==s&&!h.isString(s))throw TypeError("extend must be a string");if(void 0!==n&&!/^required|optional|repeated$/.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.defaultValue=null,this.long=!!h.Long&&void 0!==a.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.b=null}t.exports=n;var i=e(22),s=i.extend(n);n.className="Field";var o,u,f=e(16),a=e(31),h=e(32);Object.defineProperties(s,{packed:{get:function(){return null===this.b&&(this.b=this.getOption("packed")!==!1),this.b}}}),s.setOption=function(e,t,r){return"packed"===e&&(this.b=null),i.prototype.setOption.call(this,e,t,r)},n.testJSON=function(e){return Boolean(e&&void 0!==e.id)},n.fromJSON=function(t,r){return void 0!==r.keyType?(u||(u=e(18)),u.fromJSON(t,r)):new n(t,r.id,r.type,r.rule,r.extend,r.options)},s.toJSON=function(){return{rule:"optional"!==this.rule&&this.rule||void 0,type:this.type,id:this.id,extend:this.extend,options:this.options}},s.resolve=function(){if(this.resolved)return this;var t=a.defaults[this.type];if(void 0===t)if(o||(o=e(30)),this.resolvedType=this.parent.lookup(this.type,o))t=null;else{if(!(this.resolvedType=this.parent.lookup(this.type,f)))throw Error("unresolvable field type: "+this.type);t=0}if(this.map)this.defaultValue={};else if(this.repeated)this.defaultValue=[];else if(this.options&&void 0!==this.options.default?(this.defaultValue=this.options.default,this.resolvedType instanceof f&&"string"==typeof this.defaultValue&&(this.defaultValue=this.resolvedType.values[this.defaultValue]||0)):this.defaultValue=t,this.long)this.defaultValue=h.Long.fromNumber(this.defaultValue,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.defaultValue);else if(this.bytes&&"string"==typeof this.defaultValue){var r;h.base64.test(this.defaultValue)?h.base64.decode(this.defaultValue,r=h.newBuffer(h.base64.length(this.defaultValue)),0):h.utf8.write(this.defaultValue,r=h.newBuffer(h.utf8.length(this.defaultValue)),0),this.defaultValue=r}return i.prototype.resolve.call(this)}},{16:16,18:18,22:22,30:30,31:31,32:32}],18:[function(e,t,r){"use strict";function n(e,t,r,n,s){if(i.call(this,e,t,n,s),!f.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}t.exports=n;var i=e(17),s=i.prototype,o=i.extend(n);n.className="MapField";var u=e(31),f=e(32);n.testJSON=function(e){return i.testJSON(e)&&void 0!==e.keyType},n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options)},o.toJSON=function(){return{keyType:this.keyType,type:this.type,id:this.id,extend:this.extend,options:this.options}},o.resolve=function(){if(this.resolved)return this;if(void 0===u.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return s.resolve.call(this)}},{17:17,31:31,32:32}],19:[function(e,t,r){"use strict";function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}t.exports=n;var i=e(13),s=n.prototype;s.asJSON=function(e){return this.$type.convert(this,i.json,e)},n.from=function(e,t){return this.$type.convert(e,i.message,t)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.convert=function(e,t,r){return this.$type.convert(e,t,r)}},{13:13}],20:[function(e,t,r){"use strict";function n(e,t,r,n,s,o,f){if(u.isObject(s)?(f=s,s=o=void 0):u.isObject(o)&&(f=o,o=void 0),t&&!u.isString(t))throw TypeError("type must be a string");if(!u.isString(r))throw TypeError("requestType must be a string");if(!u.isString(n))throw TypeError("responseType must be a string");i.call(this,e,f),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=n,this.responseStream=!!o||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null}t.exports=n;var i=e(22),s=i.extend(n);n.className="Method";var o=e(30),u=e(32);n.testJSON=function(e){return Boolean(e&&void 0!==e.requestType)},n.fromJSON=function(e,t){return new n(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options)},s.toJSON=function(){return{type:"rpc"!==this.type&&this.type||void 0,requestType:this.requestType,requestStream:this.requestStream||void 0,responseType:this.responseType,responseStream:this.responseStream||void 0,options:this.options}},s.resolve=function(){if(this.resolved)return this;if(!(this.resolvedRequestType=this.parent.lookup(this.requestType,o)))throw Error("unresolvable request type: "+this.requestType);if(!(this.resolvedResponseType=this.parent.lookup(this.responseType,o)))throw Error("unresolvable response type: "+this.requestType);return i.prototype.resolve.call(this)}},{22:22,30:30,32:32}],21:[function(e,t,r){"use strict";function n(){a||(a=e(30)),h||(h=e(29)),l=[d,a,h,p,i],c="one of "+l.map(function(e){return e.name}).join(", ")}function i(e,t){u.call(this,e,t),this.nested=void 0,this.c=null,this.d=[]}function s(e){e.c=null;for(var t=0;t<e.d.length;++t)delete e[e.d[t]];return e.d=[],e}function o(e){if(e&&e.length){for(var t={},r=0;r<e.length;++r)t[e[r].name]=e[r].toJSON();return t}}t.exports=i;var u=e(22),f=u.extend(i);i.className="Namespace";var a,h,l,c,d=e(16),p=e(17),v=e(32);Object.defineProperties(f,{nestedArray:{get:function(){return this.c||(this.c=v.toArray(this.nested))}}}),i.testJSON=function(e){return Boolean(e&&!e.fields&&!e.values&&void 0===e.id&&!e.oneof&&!e.methods&&void 0===e.requestType)},i.fromJSON=function(e,t){return new i(e,t.options).addJSON(t.nested)},f.toJSON=function(){return{options:this.options,nested:o(this.nestedArray)}},i.arrayToJSON=o,f.addJSON=function(e){var t=this;return e&&(l||n(),Object.keys(e).forEach(function(r){for(var n=e[r],i=0;i<l.length;++i)if(l[i].testJSON(n))return t.add(l[i].fromJSON(r,n));throw TypeError("nested."+r+" must be JSON for "+c)})),this},f.get=function(e){return void 0===this.nested?null:this.nested[e]||null},f.getEnum=function(e){if(this.nested&&this.nested[e]instanceof d)return this.nested[e].values;throw Error("no such enum")},f.add=function(e){if(l||n(),!e||l.indexOf(e.constructor)<0)throw TypeError("object must be "+c);if(e instanceof p&&void 0===e.extend)throw TypeError("object must be an extension field when not part of a type");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof i&&e instanceof i)||t instanceof a||t instanceof h)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,o=0;o<r.length;++o)e.add(r[o]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),s(this)},f.remove=function(e){if(!(e instanceof u))throw TypeError("object must be a ReflectionObject");if(e.parent!==this||!this.nested)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),s(this)},f.define=function(e,t){v.isString(e)?e=e.split("."):Array.isArray(e)||(t=e,e=void 0);var r=this;if(e)for(;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(r=r.nested[n],!(r instanceof i))throw Error("path conflicts with non-namespace objects")}else r.add(r=new i(n))}return t&&r.addJSON(t),r},f.resolve=function(){a||(a=e(30)),h||(a=e(29));for(var t=this.nestedArray,r=0;r<t.length;++r)if(/^[A-Z]/.test(t[r].name)){if(t[r]instanceof a||t[r]instanceof h)this[t[r].name]=t[r];else{if(!(t[r]instanceof d))continue;this[t[r].name]=t[r].values}this.d.push(t[r].name)}return u.prototype.resolve.call(this)},f.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof i?e[t++].resolveAll():e[t++].resolve();return f.resolve.call(this)},f.lookup=function(e,t,r){if("boolean"==typeof t&&(r=t,t=void 0),v.isString(e)&&e.length)e=e.split(".");else if(!e.length)return null;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);return n&&1===e.length&&(!t||n instanceof t)||n instanceof i&&(n=n.lookup(e.slice(1),t,!0))?n:null===this.parent||r?null:this.parent.lookup(e,t)},f.lookupType=function(t){a||(a=e(30));var r=this.lookup(t,a);if(!r)throw Error("no such type");return r},f.lookupService=function(t){h||(h=e(29));var r=this.lookup(t,h);if(!r)throw Error("no such service");return r},f.lookupEnum=function(e){var t=this.lookup(e,d);if(!t)throw Error("no such enum");return t.values}},{16:16,17:17,22:22,29:29,30:30,32:32}],22:[function(e,t,r){"use strict";function n(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1}t.exports=n;var i=e(32);n.className="ReflectionObject",n.extend=i.extend;var s,o=n.prototype;Object.defineProperties(o,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.toJSON=function(){throw Error()},o.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var r=t.root;s||(s=e(26)),r instanceof s&&r.e(this)},o.onRemove=function(t){var r=t.root;s||(s=e(26)),r instanceof s&&r.f(this),this.parent=null,this.resolved=!1},o.resolve=function(){return this.resolved?this:(s||(s=e(26)),this.root instanceof s&&(this.resolved=!0),this)},o.getOption=function(e){if(this.options)return this.options[e]},o.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.setOptions=function(e,t){return e&&Object.keys(e).forEach(function(r){this.setOption(r,e[r],t)},this),this},o.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e}},{26:26,32:32}],23:[function(e,t,r){"use strict";function n(e,t,r){if(Array.isArray(t)||(r=t,t=void 0),s.call(this,e,r),t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.g=[]}function i(e){e.parent&&e.g.forEach(function(t){t.parent||e.parent.add(t)})}t.exports=n;var s=e(22),o=s.extend(n);n.className="OneOf";var u=e(17);Object.defineProperty(o,"fieldsArray",{get:function(){return this.g}}),n.testJSON=function(e){return Boolean(e.oneof)},n.fromJSON=function(e,t){return new n(e,t.oneof,t.options)},o.toJSON=function(){return{oneof:this.oneof,options:this.options}},o.add=function(e){if(!(e instanceof u))throw TypeError("field must be a Field");return e.parent&&e.parent.remove(e),this.oneof.push(e.name),this.g.push(e),e.partOf=this,i(this),this},o.remove=function(e){if(!(e instanceof u))throw TypeError("field must be a Field");var t=this.g.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.g.splice(t,1),t=this.oneof.indexOf(e.name),t>-1&&this.oneof.splice(t,1),e.parent&&e.parent.remove(e),e.partOf=null,this},o.onAdd=function(e){s.prototype.onAdd.call(this,e);var t=this;this.oneof.forEach(function(r){var n=e.get(r);n&&!n.partOf&&(n.partOf=t,t.g.push(n))}),i(this)},o.onRemove=function(e){this.g.forEach(function(e){e.parent&&e.parent.remove(e)}),s.prototype.onRemove.call(this,e)}},{17:17,22:22}],24:[function(e,t,r){"use strict";function n(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function i(e){this.buf=e,this.pos=0,this.len=e.length}function s(){var e=new O(0,0),t=0;if(this.len-this.pos>4){for(t=0;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e}else{for(t=0;t<4;++t){if(this.pos>=this.len)throw n(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}if(this.pos>=this.len)throw n(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e}if(this.len-this.pos>4){for(t=0;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(t=0;t<5;++t){if(this.pos>=this.len)throw n(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function o(){return s.call(this).toLong()}function u(){return s.call(this).toNumber()}function f(){return s.call(this).toLong(!0)}function a(){return s.call(this).toNumber(!0)}function h(){return s.call(this).zzDecode().toLong()}function l(){return s.call(this).zzDecode().toNumber()}function c(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw n(this,8);return new O(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}function p(){return d.call(this).toLong(!0)}function v(){return d.call(this).toNumber(!0)}function y(){return d.call(this).zzDecode().toLong()}function m(){return d.call(this).zzDecode().toNumber()}function g(){w.Long?(k.int64=o,k.uint64=f,k.sint64=h,k.fixed64=p,k.sfixed64=y):(k.int64=u,k.uint64=a,k.sint64=l,k.fixed64=v,k.sfixed64=m)}t.exports=i;var b,w=e(34),O=w.LongBits,x=w.utf8;i.create=w.Buffer?function(t){return b||(b=e(25)),(i.create=function(e){return w.Buffer.isBuffer(e)?new b(e):new i(e)})(t)}:function(e){return new i(e)};var k=i.prototype;k.h=w.Array.prototype.subarray||w.Array.prototype.slice,k.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,n(this,10);return e}}(),k.int32=function(){return 0|this.uint32()},k.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},k.bool=function(){return 0!==this.uint32()},k.fixed32=function(){if(this.pos+4>this.len)throw n(this,4);return c(this.buf,this.pos+=4)},k.sfixed32=function(){var e=this.fixed32();return e>>>1^-(1&e)};var A="undefined"!=typeof Float32Array?function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[3]?function(r,n){return t[0]=r[n],t[1]=r[n+1],t[2]=r[n+2],t[3]=r[n+3],e[0]}:function(r,n){return t[3]=r[n],t[2]=r[n+1],t[1]=r[n+2],t[0]=r[n+3],e[0]}}():function(e,t){var r=c(e,t+4),n=2*(r>>31)+1,i=r>>>23&255,s=8388607&r;return 255===i?s?NaN:n*(1/0):0===i?1.401298464324817e-45*n*s:n*Math.pow(2,i-150)*(s+8388608)};k.float=function(){if(this.pos+4>this.len)throw n(this,4);var e=A(this.buf,this.pos);return this.pos+=4,e};var N="undefined"!=typeof Float64Array?function(){var e=new Float64Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[7]?function(r,n){return t[0]=r[n],t[1]=r[n+1],t[2]=r[n+2],t[3]=r[n+3],t[4]=r[n+4],t[5]=r[n+5],t[6]=r[n+6],t[7]=r[n+7],e[0]}:function(r,n){return t[7]=r[n],t[6]=r[n+1],t[5]=r[n+2],t[4]=r[n+3],t[3]=r[n+4],t[2]=r[n+5],t[1]=r[n+6],t[0]=r[n+7],e[0]}}():function(e,t){var r=c(e,t+4),n=c(e,t+8),i=2*(n>>31)+1,s=n>>>20&2047,o=4294967296*(1048575&n)+r;return 2047===s?o?NaN:i*(1/0):0===s?5e-324*i*o:i*Math.pow(2,s-1075)*(o+4503599627370496)};k.double=function(){if(this.pos+8>this.len)throw n(this,4);var e=N(this.buf,this.pos);return this.pos+=8,e},k.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw n(this,e);return this.pos+=e,t===r?new this.buf.constructor(0):this.h.call(this.buf,t,r)},k.string=function(){var e=this.bytes();return x.read(e,0,e.length)},k.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw n(this,e);this.pos+=e}else do if(this.pos>=this.len)throw n(this);while(128&this.buf[this.pos++]);return this},k.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4===(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},i.i=g,g()},{25:25,34:34}],25:[function(e,t,r){"use strict";function n(e){i.call(this,e)}t.exports=n;var i=e(24),s=n.prototype=Object.create(i.prototype);s.constructor=n;var o=e(34);o.Buffer&&(s.h=o.Buffer.prototype.slice),s.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},{24:24,34:34}],26:[function(e,t,r){"use strict";function n(e){o.call(this,"",e),this.deferred=[],this.files=[]}function i(){}function s(e){var t=e.parent.lookup(e.extend);if(t){var r=new h(e.fullName,e.id,e.type,e.rule,(void 0),e.options);return r.declaringField=e,e.extensionField=r,t.add(r),!0}return!1}t.exports=n;var o=e(21),u=o.extend(n);n.className="Root";var f,a,h=e(17),l=e(32);n.fromJSON=function(e,t){return t||(t=new n),t.setOptions(e.options).addJSON(e.nested)},u.resolvePath=l.path.resolve;var c=function(){try{f=e("./parse"),a=e("./common")}catch(e){}c=null};u.load=function e(t,r,n){function s(e,t){if(n){var r=n;n=null,r(e,t)}}function o(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){f.filename=e;var n=f(t,h,r);n.imports&&n.imports.forEach(function(t){u(h.resolvePath(e,t))}),n.weakImports&&n.weakImports.forEach(function(t){u(h.resolvePath(e,t),!0)})}else h.setOptions(t.options).addJSON(t.nested)}catch(e){if(d)throw e;return void s(e)}d||p||s(null,h)}function u(e,t){var r=e.lastIndexOf("google/protobuf/");if(r>-1){var i=e.substring(r);i in a&&(e=i)}if(!(h.files.indexOf(e)>-1)){ | ||
if(h.files.push(e),e in a)return void(d?o(e,a[e]):(++p,setTimeout(function(){--p,o(e,a[e])})));if(d){var u;try{u=l.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||s(e))}o(e,u)}else++p,l.fetch(e,function(r,i){if(--p,n)return r?void(t||s(r)):void o(e,i)})}}c&&c(),"function"==typeof r&&(n=r,r=void 0);var h=this;if(!n)return l.asPromise(e,h,t);var d=n===i,p=0;return l.isString(t)&&(t=[t]),t.forEach(function(e){u(h.resolvePath("",e))}),d?h:void(p||s(null,h))},u.loadSync=function(e,t){return this.load(e,t,i)},u.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)},u.e=function(e){var t=this.deferred.slice();this.deferred=[];for(var r=0;r<t.length;)s(t[r])?t.splice(r,1):++r;if(this.deferred=t,e instanceof h&&void 0!==e.extend&&!e.extensionField&&!s(e)&&this.deferred.indexOf(e)<0)this.deferred.push(e);else if(e instanceof o){var n=e.nestedArray;for(r=0;r<n.length;++r)this.e(n[r])}},u.f=function(e){if(e instanceof h){if(void 0!==e.extend&&!e.extensionField){var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}e.extensionField&&(e.extensionField.parent.remove(e.extensionField),e.extensionField=null)}else if(e instanceof o)for(var r=e.nestedArray,n=0;n<r.length;++n)this.f(r[n])}},{17:17,21:21,32:32,undefined:void 0}],27:[function(e,t,r){"use strict";var n=r;n.Service=e(28)},{28:28}],28:[function(e,t,r){"use strict";function n(e){s.call(this),this.$rpc=e}t.exports=n;var i=e(32),s=i.EventEmitter,o=n.prototype=Object.create(s.prototype);o.constructor=n,o.end=function(e){return this.$rpc&&(e||this.$rpc(null,null,null),this.$rpc=null,this.emit("end").off()),this}},{32:32}],29:[function(e,t,r){"use strict";function n(e,t){s.call(this,e,t),this.methods={},this.j=null}function i(e){return e.j=null,e}t.exports=n;var s=e(21),o=s.prototype,u=s.extend(n);n.className="Service";var f=e(20),a=e(32),h=e(27);Object.defineProperties(u,{methodsArray:{get:function(){return this.j||(this.j=a.toArray(this.methods))}}}),n.testJSON=function(e){return Boolean(e&&e.methods)},n.fromJSON=function(e,t){var r=new n(e,t.options);return t.methods&&Object.keys(t.methods).forEach(function(e){r.add(f.fromJSON(e,t.methods[e]))}),r},u.toJSON=function(){var e=o.toJSON.call(this);return{options:e&&e.options||void 0,methods:s.arrayToJSON(this.methodsArray)||{},nested:e&&e.nested||void 0}},u.get=function(e){return o.get.call(this,e)||this.methods[e]||null},u.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return o.resolve.call(this)},u.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof f?(this.methods[e.name]=e,e.parent=this,i(this)):o.add.call(this,e)},u.remove=function(e){if(e instanceof f){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,i(this)}return o.remove.call(this,e)},u.create=function(e,t,r){var n=new h.Service(e);return this.methodsArray.forEach(function(i){n[a.lcFirst(i.name)]=function(s,o){if(n.$rpc){if(!s)throw TypeError("request must not be null");i.resolve();var u;try{u=(t?i.resolvedRequestType.encodeDelimited(s):i.resolvedRequestType.encode(s)).finish()}catch(e){return void("function"==typeof setImmediate?setImmediate:setTimeout)(function(){o(e)})}e(i,u,function(e,t){if(e)return n.emit("error",e,i),o?o(e):void 0;if(null===t)return void n.end(!0);var s;try{s=r?i.resolvedResponseType.decodeDelimited(t):i.resolvedResponseType.decode(t)}catch(e){return n.emit("error",e,i),o?o("error",e):void 0}return n.emit("data",s,i),o?o(null,s):void 0})}}}),n}},{20:20,21:21,27:27,32:32}],30:[function(e,t,r){"use strict";function n(e,t){s.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this.k=null,this.g=null,this.l=null,this.m=null,this.n=null}function i(e){return e.k=e.g=e.m=e.n=null,delete e.encode,delete e.decode,delete e.verify,e}t.exports=n;var s=e(21),o=s.prototype,u=s.extend(n);n.className="Type";var f=e(16),a=e(23),h=e(17),l=e(29),c=e(11),d=e(19),p=e(24),v=e(36),y=e(32),m=e(15),g=e(14),b=e(35),w=e(12);Object.defineProperties(u,{fieldsById:{get:function(){if(this.k)return this.k;this.k={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this.k[n])throw Error("duplicate id "+n+" in "+this);this.k[n]=r}return this.k}},fieldsArray:{get:function(){return this.g||(this.g=y.toArray(this.fields))}},repeatedFieldsArray:{get:function(){return this.l||(this.l=this.fieldsArray.filter(function(e){return e.repeated}))}},oneofsArray:{get:function(){return this.m||(this.m=y.toArray(this.oneofs))}},ctor:{get:function(){return this.n||(this.n=c.create(this).constructor)},set:function(e){if(e&&!(e.prototype instanceof d))throw TypeError("ctor must be a Message constructor");e.from||(e.from=d.from),this.n=e}}}),n.testJSON=function(e){return Boolean(e&&e.fields)};var O=[f,n,h,l];n.fromJSON=function(e,t){var r=new n(e,t.options);return r.extensions=t.extensions,r.reserved=t.reserved,t.fields&&Object.keys(t.fields).forEach(function(e){r.add(h.fromJSON(e,t.fields[e]))}),t.oneofs&&Object.keys(t.oneofs).forEach(function(e){r.add(a.fromJSON(e,t.oneofs[e]))}),t.nested&&Object.keys(t.nested).forEach(function(e){for(var n=t.nested[e],i=0;i<O.length;++i)if(O[i].testJSON(n))return void r.add(O[i].fromJSON(e,n));throw Error("invalid nested object in "+r+": "+e)}),t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),r},u.toJSON=function(){var e=o.toJSON.call(this);return{options:e&&e.options||void 0,oneofs:s.arrayToJSON(this.oneofsArray),fields:s.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}))||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:e&&e.nested||void 0}},u.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return o.resolve.call(this)},u.get=function(e){return o.get.call(this,e)||this.fields&&this.fields[e]||this.oneofs&&this.oneofs[e]||null},u.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof h&&void 0===e.extend){if(this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),i(this)}return e instanceof a?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),i(this)):o.add.call(this,e)},u.remove=function(e){if(e instanceof h&&void 0===e.extend){if(this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.message=null,i(this)}return o.remove.call(this,e)},u.create=function(e){return new this.ctor(e)},u.from=function(e,t){return this.convert(e,w.message,t)},u.setup=function(){var e=this.fullName,t=this.fieldsArray.map(function(e){return e.resolve().resolvedType});return this.encode=m(this).eof(e+"$encode",{Writer:v,types:t,util:y}),this.decode=g(this).eof(e+"$decode",{Reader:p,types:t,util:y}),this.verify=b(this).eof(e+"$verify",{types:t,util:y}),this.convert=w(this).eof(e+"$convert",{types:t,util:y}),this},u.encode=function(e,t){return this.setup().encode(e,t)},u.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},u.decode=function(e,t){return this.setup().decode(e,t)},u.decodeDelimited=function(e){return e=e instanceof p?e:p.create(e),this.decode(e,e.uint32())},u.verify=function(e){return this.setup().verify(e)},u.convert=function(e,t,r){return this.setup().convert(e,t,r)}},{11:11,12:12,14:14,15:15,16:16,17:17,19:19,21:21,23:23,24:24,29:29,32:32,35:35,36:36}],31:[function(e,t,r){"use strict";function n(e,t){var r=0,n={};for(t|=0;r<e.length;)n[o[r+t]]=e[r++];return n}var i=r,s=e(32),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes","message"];i.basic=n([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=n([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",s.emptyArray,null]),i.long=n([0,0,0,1,1],7),i.mapKey=n([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=n([1,5,0,0,0,5,5,0,0,0,1,1,0])},{32:32}],32:[function(e,t,r){"use strict";var n=t.exports=e(34);n.asPromise=e(1),n.codegen=e(3),n.EventEmitter=e(4),n.extend=e(5),n.fetch=e(6),n.path=e(8),n.fs=n.inquire("fs"),n.toArray=function(e){return e?Object.values?Object.values(e):Object.keys(e).map(function(t){return e[t]}):[]},n.merge=function(e,t,r){if(t)for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e},n.safeProp=function(e){return'["'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"]'},n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)},n.newBuffer=function(e){return e=e||0,n.Buffer?n.Buffer.allocUnsafe(e):new("undefined"!=typeof Uint8Array?Uint8Array:Array)(e)}},{1:1,3:3,34:34,4:4,5:5,6:6,8:8}],33:[function(e,t,r){"use strict";function n(e,t){this.lo=e,this.hi=t}t.exports=n;var i=e(34),s=n.prototype,o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var u=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if("string"==typeof e){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):o},s.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},s.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var f=String.prototype.charCodeAt;n.fromHash=function(e){return e===u?o:new n((f.call(e,0)|f.call(e,1)<<8|f.call(e,2)<<16|f.call(e,3)<<24)>>>0,(f.call(e,4)|f.call(e,5)<<8|f.call(e,6)<<16|f.call(e,7)<<24)>>>0)},s.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},s.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},s.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},s.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},{34:34}],34:[function(e,t,r){(function(t){"use strict";var n=r;n.base64=e(2),n.inquire=e(7),n.utf8=e(10),n.pool=e(9),n.LongBits=e(33),n.isNode=Boolean(t.process&&t.process.versions&&t.process.versions.node),n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?(e.from||(e.from=function(t,r){return new e(t,r)}),e.allocUnsafe||(e.allocUnsafe=function(t){return new e(t)}),e):null}catch(e){return null}}(),n.Array="undefined"==typeof Uint8Array?Array:Uint8Array,n.Long=t.dcodeIO&&t.dcodeIO.Long||n.inquire("long"),n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.longNe=function(e,t,r){if("object"==typeof e)return e.low!==t||e.high!==r;var i=n.LongBits.from(e);return i.lo!==t||i.hi!==r},n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.arrayNe=function(e,t){if(e.length===t.length)for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,2:2,33:33,7:7,9:9}],35:[function(e,t,r){"use strict";function n(e,t){return e.fullName.substring(1)+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function i(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof u){e("switch(%s){",i)("default:")("return%j",n(t,"enum value"));for(var s=f.toArray(t.resolvedType.values),o=0;o<s.length;++o)e("case %d:",s[o]);e("break")("}")}else e("var e;")("if(e=types[%d].verify(%s))",r,i)("return e");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",n(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",n(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",n(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",n(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",n(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",n(t,"buffer"))}}function s(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))",r)("return%j",n(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9]\\d*))$/.test(%s))",r)("return%j",n(t,"integer|Long key"));break;case"bool":e("if(!/^true|false|0|1$/.test(%s))",r)("return%j",n(t,"boolean key"))}}function o(e){var t=e.fieldsArray;if(!t.length)return f.codegen()("return null");for(var r=f.codegen("m"),o=0;o<t.length;++o){var a=t[o].resolve(),h="m"+f.safeProp(a.name);a.map?(r("if(%s!==undefined){",h)("if(!util.isObject(%s))",h)("return%j",n(a,"object"))("var k=Object.keys(%s)",h)("for(var i=0;i<k.length;++i){"),s(r,a,"k[i]"),i(r,a,o,h+"[k[i]]"),r("}")("}")):a.repeated?(r("if(%s!==undefined){",h)("if(!Array.isArray(%s))",h)("return%j",n(a,"array"))("for(var i=0;i<%s.length;++i){",h),i(r,a,o,h+"[i]"),r("}")("}")):(a.required||(!a.resolvedType||a.resolvedType instanceof u?r("if(%s!==undefined){",h):r("if(%s!==undefined&&%s!==null){",h,h)),i(r,a,o,h),a.required||r("}"))}return r("return null")}t.exports=o;var u=e(16),f=e(32)},{16:16,32:32}],36:[function(e,t,r){"use strict";function n(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function i(){}function s(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function o(){this.len=0,this.head=new n(i,0,0),this.tail=this.head,this.states=null}function u(e,t,r){t[r]=255&e}function f(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e}function a(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function h(e,t,r){t[r++]=255&e,t[r++]=e>>>8&255,t[r++]=e>>>16&255,t[r]=e>>>24}t.exports=o;var l,c=e(34),d=c.LongBits,p=c.base64,v=c.utf8;o.create=c.Buffer?function(){return l||(l=e(37)),(o.create=function(){return new l})()}:function(){return new o},o.alloc=function(e){return new c.Array(e)},c.Array!==Array&&(o.alloc=c.pool(o.alloc,c.Array.prototype.subarray));var y=o.prototype;y.push=function(e,t,r){return this.tail=this.tail.next=new n(e,t,r),this.len+=t,this},y.uint32=function(e){return e>>>=0,this.push(f,e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)},y.int32=function(e){return e<0?this.push(a,10,d.fromNumber(e)):this.uint32(e)},y.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},y.uint64=function(e){var t=d.from(e);return this.push(a,t.length(),t)},y.int64=y.uint64,y.sint64=function(e){var t=d.from(e).zzEncode();return this.push(a,t.length(),t)},y.bool=function(e){return this.push(u,1,e?1:0)},y.fixed32=function(e){return this.push(h,4,e>>>0)},y.sfixed32=function(e){return this.push(h,4,e<<1^e>>31)},y.fixed64=function(e){var t=d.from(e);return this.push(h,4,t.lo).push(h,4,t.hi)},y.sfixed64=function(e){var t=d.from(e).zzEncode();return this.push(h,4,t.lo).push(h,4,t.hi)};var m="undefined"!=typeof Float32Array?function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[3]?function(r,n,i){e[0]=r,n[i++]=t[0],n[i++]=t[1],n[i++]=t[2],n[i]=t[3]}:function(r,n,i){e[0]=r,n[i++]=t[3],n[i++]=t[2],n[i++]=t[1],n[i]=t[0]}}():function(e,t,r){var n=e<0?1:0;if(n&&(e=-e),0===e)h(1/e>0?0:2147483648,t,r);else if(isNaN(e))h(2147483647,t,r);else if(e>3.4028234663852886e38)h((n<<31|2139095040)>>>0,t,r);else if(e<1.1754943508222875e-38)h((n<<31|Math.round(e/1.401298464324817e-45))>>>0,t,r);else{var i=Math.floor(Math.log(e)/Math.LN2),s=8388607&Math.round(e*Math.pow(2,-i)*8388608);h((n<<31|i+127<<23|s)>>>0,t,r)}};y.float=function(e){return this.push(m,4,e)};var g="undefined"!=typeof Float64Array?function(){var e=new Float64Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[7]?function(r,n,i){e[0]=r,n[i++]=t[0],n[i++]=t[1],n[i++]=t[2],n[i++]=t[3],n[i++]=t[4],n[i++]=t[5],n[i++]=t[6],n[i]=t[7]}:function(r,n,i){e[0]=r,n[i++]=t[7],n[i++]=t[6],n[i++]=t[5],n[i++]=t[4],n[i++]=t[3],n[i++]=t[2],n[i++]=t[1],n[i]=t[0]}}():function(e,t,r){var n=e<0?1:0;if(n&&(e=-e),0===e)h(0,t,r),h(1/e>0?0:2147483648,t,r+4);else if(isNaN(e))h(4294967295,t,r),h(2147483647,t,r+4);else if(e>1.7976931348623157e308)h(0,t,r),h((n<<31|2146435072)>>>0,t,r+4);else{var i;if(e<2.2250738585072014e-308)i=e/5e-324,h(i>>>0,t,r),h((n<<31|i/4294967296)>>>0,t,r+4);else{var s=Math.floor(Math.log(e)/Math.LN2);1024===s&&(s=1023),i=e*Math.pow(2,-s),h(4503599627370496*i>>>0,t,r),h((n<<31|s+1023<<20|1048576*i&1048575)>>>0,t,r+4)}}};y.double=function(e){return this.push(g,8,e)};var b=c.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};y.bytes=function(e){var t=e.length>>>0;if("string"==typeof e&&t){var r=o.alloc(t=p.length(e));p.decode(e,r,0),e=r}return t?this.uint32(t).push(b,t,e):this.push(u,1,0)},y.string=function(e){var t=v.length(e);return t?this.uint32(t).push(v.write,t,e):this.push(u,1,0)},y.fork=function(){return this.states=new s(this),this.head=this.tail=new n(i,0,0),this.len=0,this},y.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(i,0,0),this.len=0),this},y.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r).tail.next=e.next,this.tail=t,this.len+=r,this},y.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t}},{34:34,37:37}],37:[function(e,t,r){"use strict";function n(){s.call(this)}function i(e,t,r){e.length<40?f.write(e,t,r):t.utf8Write(e,r)}t.exports=n;var s=e(36),o=n.prototype=Object.create(s.prototype);o.constructor=n;var u=e(34),f=u.utf8,a=u.Buffer;n.alloc=function(e){return(n.alloc=a.allocUnsafe)(e)};var h=a&&a.prototype instanceof Uint8Array&&"set"===a.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){e.copy(t,r,0,e.length)};o.bytes=function(e){"string"==typeof e&&(e=a.from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this.push(h,t,e),this},o.string=function(e){var t=a.byteLength(e);return this.uint32(t),t&&this.push(i,t,e),this}},{34:34,36:36}],38:[function(e,t,r){(function(t){"use strict";function n(e,t,r){return"function"==typeof t?(r=t,t=new o.Root):t||(t=new o.Root),t.load(e,r)}function i(e,t){return t||(t=new o.Root),t.loadSync(e)}function s(){o.Reader.i()}var o=t.protobuf=r;o.load=n,o.loadSync=i,o.roots={};try{o.tokenize=e("./tokenize"),o.parse=e("./parse"),o.common=e("./common")}catch(e){}o.Writer=e(36),o.BufferWriter=e(37),o.Reader=e(24),o.BufferReader=e(25),o.encoder=e(15),o.decoder=e(14),o.verifier=e(35),o.converter=e(12),o.ReflectionObject=e(22),o.Namespace=e(21),o.Root=e(26),o.Enum=e(16),o.Type=e(30),o.Field=e(17),o.OneOf=e(23),o.MapField=e(18),o.Service=e(29),o.Method=e(20),o.Class=e(11),o.Message=e(19),o.types=e(31),o.rpc=e(27),o.util=e(32),o.configure=s,"function"==typeof define&&define.amd&&define(["long"],function(e){return e&&(o.util.Long=e,s()),o})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{11:11,12:12,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,29:29,30:30,31:31,32:32,35:35,36:36,37:37,undefined:void 0}]},{},[38]); | ||
//# sourceMappingURL=protobuf.min.js.map |
/*! | ||
* protobuf.js v6.3.1 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 27 Dec 2016 16:55:50 UTC | ||
* protobuf.js v6.4.0 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 03 Jan 2017 15:34:50 UTC | ||
* Licensed under the BSD-3-Clause License | ||
* see: https://github.com/dcodeIO/protobuf.js for details | ||
*/ | ||
!function t(e,r,n){function i(o,u){if(!r[o]){if(!e[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[o]={exports:{}};e[o][0].call(l.exports,function(t){var r=e[o][1][t];return i(r?r:t)},l,l.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=2;n<arguments.length;)r.push(arguments[n++]);var i=!0;return new Promise(function(n,s){r.push(function(t){if(i)if(i=!1,t)s(t);else{for(var e=[],r=1;r<arguments.length;)e.push(arguments[r++]);n.apply(null,e)}});try{t.apply(e||this,r)}catch(t){i&&(i=!1,s(t))}})}e.exports=n},{}],2:[function(t,e,r){"use strict";var n=r;n.length=function(t){var e=t.length;if(!e)return 0;for(var r=0;--e%4>1&&"="===t.charAt(e);)++r;return Math.ceil(3*t.length)/4-r};for(var i=new Array(64),s=new Array(123),o=0;o<64;)s[i[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(t,e,r){for(var n,s=[],o=0,u=0;e<r;){var a=t[e++];switch(u){case 0:s[o++]=i[a>>2],n=(3&a)<<4,u=1;break;case 1:s[o++]=i[n|a>>4],n=(15&a)<<2,u=2;break;case 2:s[o++]=i[n|a>>6],s[o++]=i[63&a],u=0}}return u&&(s[o++]=i[n],s[o]=61,1===u&&(s[o+1]=61)),String.fromCharCode.apply(String,s)};var u="invalid encoding";n.decode=function(t,e,r){for(var n,i=r,o=0,a=0;a<t.length;){var f=t.charCodeAt(a++);if(61===f&&o>1)break;if(void 0===(f=s[f]))throw Error(u);switch(o){case 0:n=f,o=1;break;case 1:e[r++]=n<<2|(48&f)>>4,n=f,o=2;break;case 2:e[r++]=(15&n)<<4|(60&f)>>2,n=f,o=3;break;case 3:e[r++]=(3&n)<<6|f,o=0}}if(1===o)throw Error(u);return r-i}},{}],3:[function(t,e,r){"use strict";function n(){function t(){for(var e=[],r=0;r<arguments.length;)e.push(arguments[r++]);var n=i.apply(null,e),l=c;if(h.length){var p=h[h.length-1];s.test(p)?l=++c:a.test(p)&&++l,u.test(p)&&!u.test(n)?(l=++c,d=!0):d&&f.test(p)&&(l=--c,d=!1),o.test(n)&&(l=--c)}for(r=0;r<l;++r)n="\t"+n;return h.push(n),t}function e(t){return"function "+(t?t.replace(/[^\w_$]/g,"_"):"")+"("+l.join(", ")+") {\n"+h.join("\n")+"\n}"}function r(e,r){"object"==typeof e&&(r=e,e=void 0);var i=t.str(e);n.verbose&&console.log("--- codegen ---\n"+i.replace(/^/gm,"> ").replace(/\t/g," "));var s=Object.keys(r||(r={}));return Function.apply(null,s.concat("return "+i)).apply(null,s.map(function(t){return r[t]}))}for(var l=[],h=[],c=1,d=!1,p=0;p<arguments.length;)l.push(arguments[p++]);return t.str=e,t.eof=r,t}function i(t){for(var e=[],r=1;r<arguments.length;)e.push(arguments[r++]);return r=0,t.replace(/%([djs])/g,function(t,n){var i=e[r++];switch(n){case"j":return JSON.stringify(i);default:return String(i)}})}e.exports=n;var s=/[{[]$/,o=/^[}\]]/,u=/:$/,a=/^\s*(?:if|else if|while|for)\b|\b(?:else)\s*$/,f=/\b(?:break|continue);?$|^\s*return\b/;n.supported=!1;try{n.supported=1===n("a","b")("return a-b").eof()(2,1)}catch(t){}n.verbose=!1},{}],4:[function(t,e,r){"use strict";function n(){this.a={}}e.exports=n;var i=n.prototype;i.on=function(t,e,r){return(this.a[t]||(this.a[t]=[])).push({fn:e,ctx:r||this}),this},i.off=function(t,e){if(void 0===t)this.a={};else if(void 0===e)this.a[t]=[];else for(var r=this.a[t],n=0;n<r.length;)r[n].fn===e?r.splice(n,1):++n;return this},i.emit=function(t){var e=this.a[t];if(e){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,r)}return this}},{}],5:[function(t,e,r){"use strict";function n(t){for(var e=Object.keys(this),r=0;r<e.length;++r)t[e[r]]=this[e[r]];var n=t.prototype=Object.create(this.prototype);return n.constructor=t,n}e.exports=n},{}],6:[function(t,e,r){"use strict";function n(t,e){return e?u&&u.readFile?u.readFile(t,"utf8",function(r,n){return r&&"undefined"!=typeof XMLHttpRequest?i(t,e):e(r,n)}):i(t,e):s(n,this,t)}function i(t,e){var r=new XMLHttpRequest;r.onreadystatechange=function(){return 4===r.readyState?0===r.status||200===r.status?e(null,r.responseText):e(Error("status "+r.status)):void 0},r.open("GET",t),r.send()}e.exports=n;var s=t(1),o=t(7),u=o("fs")},{1:1,7:7}],7:[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},{}],8:[function(t,e,r){"use strict";var n=r,i=n.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},s=n.normalize=function(t){t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var e=t.split("/"),r=i(t),n="";r&&(n=e.shift()+"/");for(var s=0;s<e.length;)".."===e[s]?s>0?e.splice(--s,2):r?e.splice(s,1):++s:"."===e[s]?e.splice(s,1):++s;return n+e.join("/")};n.resolve=function(t,e,r){return r||(e=s(e)),i(e)?e:(r||(t=s(t)),(t=t.replace(/(?:\/|^)[^\/]+$/,"")).length?s(t+"/"+e):e)}},{}],9:[function(t,e,r){"use strict";function n(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return t(r);o+r>n&&(s=t(n),o=0);var u=e.call(s,o,o+=r);return 7&o&&(o=(7|o)+1),u}}e.exports=n},{}],10:[function(t,e,r){"use strict";var n=r;n.length=function(t){for(var e=0,r=0,n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:55296===(64512&r)&&56320===(64512&t.charCodeAt(n+1))?(++n,e+=4):e+=3;return e},n.read=function(t,e,r){var n=r-e;if(n<1)return"";for(var i,s=null,o=[],u=0;e<r;)i=t[e++],i<128?o[u++]=i:i>191&&i<224?o[u++]=(31&i)<<6|63&t[e++]:i>239&&i<365?(i=((7&i)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[u++]=55296+(i>>10),o[u++]=56320+(1023&i)):o[u++]=(15&i)<<12|(63&t[e++])<<6|63&t[e++],u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0);return s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):u?String.fromCharCode.apply(String,o.slice(0,u)):""},n.write=function(t,e,r){for(var n,i,s=r,o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?e[r++]=n:n<2048?(e[r++]=n>>6|192,e[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=t.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,e[r++]=n>>18|240,e[r++]=n>>12&63|128,e[r++]=n>>6&63|128,e[r++]=63&n|128):(e[r++]=n>>12|224,e[r++]=n>>6&63|128,e[r++]=63&n|128);return r-s}},{}],11:[function(t,e,r){"use strict";function n(t){return i(t)}function i(e,r){if(s||(s=t(32)),!(e instanceof s))throw a("type","a Type");if(r){if("function"!=typeof r)throw a("ctor","a function")}else r=function(t){return function(e){t.call(this,e)}}(o);r.constructor=n;var i=r.prototype=new o;return i.constructor=r,u.merge(r,o,!0),r.$type=e,i.$type=e,e.getFieldsArray().forEach(function(t){i[t.name]=Array.isArray(t.resolve().defaultValue)?u.emptyArray:u.isObject(t.defaultValue)&&!t.long?u.emptyObject:t.defaultValue}),e.getOneofsArray().forEach(function(t){u.prop(i,t.resolve().name,{get:function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(t.oneof.indexOf(e[r])>-1)return e[r]},set:function(e){for(var r=t.oneof,n=0;n<r.length;++n)r[n]!==e&&delete this[r[n]]}})}),e.setCtor(r),i}e.exports=n;var s,o=t(19),u=t(34),a=u.b;n.create=i,n.prototype=o},{19:19,32:32,34:34}],12:[function(t,e,r){"use strict";function n(t,e){/\/|\./.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),n[t]=e}e.exports=n,n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var i;n("duration",{Duration:i={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:i}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}})},{}],13:[function(t,e,r){"use strict";function n(e,r,n,o,u){i||(i=t(32),s=t(19)),o||(o={});for(var a,f=Object.keys(o.defaults?e.fields:r),l=0;l<f.length;++l){var h=e.fields[a=f[l]],c=r[a];if(h)if(h.repeated){if((c||o.defaults)&&(n[a]=[],c))for(var d=0,p=c.length;d<p;++d)n[a].push(u(h,c[d],o))}else n[a]=u(h,c,o);else o.fieldsOnly||(n[a]=c)}return n}e.exports=n;var i,s,o=t(16),u=t(34);n.toJson=function t(e,r,i){if(i||(i={}),r instanceof s)return n(r.$type,r,{},i,t);if(i.enums&&e.resolvedType instanceof o)return i.enums===String?e.resolvedType.getValuesById()[r]:0|r;if(i.longs&&e.long){var a="u"===e.type.charAt(0);if(i.longs===Number)return"number"==typeof r?r:u.LongBits.from(r).toNumber(a);if(i.longs===String)return"number"==typeof r?u.Long.fromNumber(r,a).toString():(r=u.Long.fromValue(r),r.unsigned=a,r.toString())}if(i.bytes&&e.bytes){if(i.bytes===String)return u.base64.encode(r,0,r.length);if(i.bytes===Array)return Array.prototype.slice.call(r);if(i.bytes===u.Buffer&&!u.Buffer.isBuffer(r))return u.Buffer.from(r)}return r},n.toMessage=function t(e,r,s){switch(typeof r){case"object":if(r){if(e.resolvedType instanceof i)return n(e.resolvedType,r,new(e.resolvedType.getCtor()),s,t);if("bytes"===e.type)return u.Buffer?u.Buffer.isBuffer(r)?r:u.Buffer.from(r):r instanceof u.Array?r:new u.Array(r)}break;case"string":if(e.resolvedType instanceof o)return e.resolvedType.values[r]||0;if(e.long)return u.Long.fromString(r,"u"===e.type.charAt(0));if(e.bytes){var a=u.newBuffer(u.base64.length(r));return u.base64.decode(r,a,0),a}break;case"number":if(e.long)return u.Long.fromNumber(r,"u"===e.type.charAt(0))}return r}},{16:16,19:19,32:32,34:34}],14:[function(t,e,r){"use strict";function n(t){var e=t.getFieldsArray(),r=o.codegen("r","l")("r instanceof Reader||(r=Reader.create(r))")("var c=l===undefined?r.len:r.pos+l,m=new(this.getCtor())")("while(r.pos<c){")("var t=r.uint32()");t.group&&r("if((t&7)===4)")("break"),r("switch(t>>>3){");for(var n=0;n<e.length;++n){var u=e[n].resolve(),a=u.resolvedType instanceof i?"uint32":u.type,f="m"+o.safeProp(u.name);if(r("case %d:",u.id),u.map){var l=u.resolvedKeyType?"uint32":u.keyType;r("r.skip().pos++")("if(%s===util.emptyObject)",f)("%s={}",f)("var k=r.%s()",l)('if(typeof k==="object")')("k=util.longToHash(k)")("r.pos++"),void 0===s.basic[a]?r("%s[k]=types[%d].decode(r,r.uint32())",f,n):r("%s[k]=r.%s()",f,a)}else u.repeated?(r("%s&&%s.length||(%s=[])",f,f,f),u.packed&&void 0!==s.packed[a]&&r("if((t&7)===2){")("var e=r.uint32()+r.pos")("while(r.pos<e)")("%s.push(r.%s())",f,a)("}else"),void 0===s.basic[a]?r(u.resolvedType.group?"%s.push(types[%d].decode(r))":"%s.push(types[%d].decode(r,r.uint32()))",f,n):r("%s.push(r.%s())",f,a)):void 0===s.basic[a]?r(u.resolvedType.group?"%s=types[%d].decode(r)":"%s=types[%d].decode(r,r.uint32())",f,n):r("%s=r.%s()",f,a);r("break")}return r("default:")("r.skipType(t&7)")("break")("}")("}")("return m")}e.exports=n;var i=t(16),s=t(33),o=t(34)},{16:16,33:33,34:34}],15:[function(t,e,r){"use strict";function n(t,e,r,n){return e.resolvedType.group?t("types[%d].encode(%s,w.uint32(%d)).uint32(%d)",r,n,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%d].encode(%s,w.uint32(%d).fork()).ldelim()",r,n,(e.id<<3|2)>>>0)}function i(t){for(var e,r,i=t.getFieldsArray(),a=t.getOneofsArray(),f=u.codegen("m","w")("w||(w=Writer.create())"),e=0;e<i.length;++e){var l=i[e].resolve(),h=l.resolvedType instanceof s?"uint32":l.type,c=o.basic[h];if(r="m"+u.safeProp(l.name),l.map){var d=l.resolvedKeyType?"uint32":l.keyType;f("if(%s&&%s!==util.emptyObject){",r,r)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",r)("w.uint32(%d).fork().uint32(%d).%s(ks[i])",(l.id<<3|2)>>>0,8|o.mapKey[d],d),void 0===c?f("types[%d].encode(%s[ks[i]],w.uint32(18).fork()).ldelim()",e,r):f("w.uint32(%d).%s(%s[ks[i]])",16|c,h,r),f("w.ldelim()")("}")("}")}else l.repeated?l.packed&&void 0!==o.packed[h]?f("if(%s&&%s.length){",r,r)("w.uint32(%d).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",r)("w.%s(%s[i])",h,r)("w.ldelim()",l.id)("}"):(f("if(%s)",r)("for(var i=0;i<%s.length;++i)",r),void 0===c?n(f,l,e,r+"[i]"):f("w.uint32(%d).%s(%s[i])",(l.id<<3|c)>>>0,h,r)):l.partOf||(l.required||(l.long?f("if(%s!==undefined&&util.longNe(%s,%d,%d))",r,r,l.defaultValue.low,l.defaultValue.high):f("if(%s!==undefined&&%s!==%j)",r,r,l.defaultValue)),void 0===c?n(f,l,e,r):f("w.uint32(%d).%s(%s)",(l.id<<3|c)>>>0,h,r))}for(var e=0;e<a.length;++e){var p=a[e];f("switch(%s){","m.get"+p.ucName+"()");for(var v=p.getFieldsArray(),y=0;y<v.length;++y){var l=v[y],h=l.resolvedType instanceof s?"uint32":l.type,c=o.basic[h];r="m"+u.safeProp(l.name),f("case%j:",l.name),void 0===c?n(f,l,i.indexOf(l),r):f("w.uint32(%d).%s(%s)",(l.id<<3|c)>>>0,h,r),f("break;")}f("}")}return f("return w")}e.exports=i;var s=t(16),o=t(33),u=t(34)},{16:16,33:33,34:34}],16:[function(t,e,r){"use strict";function n(t,e,r){s.call(this,t,r),this.values=e||{},this.c=null}function i(t){return t.c=null,t}e.exports=n;var s=t(22),o=s.extend(n);n.className="Enum";var u=t(34),a=u.b;u.props(o,{valuesById:{get:function(){return this.c||(this.c={},Object.keys(this.values).forEach(function(t){var e=this.values[t];if(this.c[e])throw Error("duplicate id "+e+" in "+this);this.c[e]=t},this)),this.c}}}),n.testJSON=function(t){return Boolean(t&&t.values)},n.fromJSON=function(t,e){return new n(t,e.values,e.options)},o.toJSON=function(){return{options:this.options,values:this.values}},o.add=function(t,e){if(!u.isString(t))throw a("name");if(!u.isInteger(e)||e<0)throw a("id","a non-negative integer");if(void 0!==this.values[t])throw Error("duplicate name '"+t+"' in "+this);if(void 0!==this.getValuesById()[e])throw Error("duplicate id "+e+" in "+this);return this.values[t]=e,i(this)},o.remove=function(t){if(!u.isString(t))throw a("name");if(void 0===this.values[t])throw Error("'"+t+"' is not a name of "+this);return delete this.values[t],i(this)}},{22:22,34:34}],17:[function(t,e,r){"use strict";function n(t,e,r,n,s,o){if(l.isObject(n)?(o=n,n=s=void 0):l.isObject(s)&&(o=s,s=void 0),i.call(this,t,o),!l.isInteger(e)||e<0)throw h("id","a non-negative integer");if(!l.isString(r))throw h("type");if(void 0!==s&&!l.isString(s))throw h("extend");if(void 0!==n&&!/^required|optional|repeated$/.test(n=n.toString().toLowerCase()))throw h("rule","a valid rule string");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=e,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.defaultValue=null,this.long=!!l.Long&&void 0!==f.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.d=null}e.exports=n;var i=t(22),s=i.extend(n);n.className="Field";var o,u,a=t(16),f=t(33),l=t(34),h=l.b;l.props(s,{packed:{get:s.isPacked=function(){return null===this.d&&(this.d=this.getOption("packed")!==!1),this.d}}}),s.setOption=function(t,e,r){return"packed"===t&&(this.d=null),i.prototype.setOption.call(this,t,e,r)},n.testJSON=function(t){return Boolean(t&&void 0!==t.id)},n.fromJSON=function(e,r){return void 0!==r.keyType?(u||(u=t(18)),u.fromJSON(e,r)):new n(e,r.id,r.type,r.rule,r.extend,r.options)},s.toJSON=function(){return{rule:"optional"!==this.rule&&this.rule||void 0,type:this.type,id:this.id,extend:this.extend,options:this.options}},s.resolve=function(){if(this.resolved)return this;var e=f.defaults[this.type];if(void 0===e)if(o||(o=t(32)),this.resolvedType=this.parent.lookup(this.type,o))e=null;else{if(!(this.resolvedType=this.parent.lookup(this.type,a)))throw Error("unresolvable field type: "+this.type);e=0}return this.map?this.defaultValue={}:this.repeated?this.defaultValue=[]:(this.options&&void 0!==this.options.default?this.defaultValue=this.options.default:this.defaultValue=e,this.long&&(this.defaultValue=l.Long.fromNumber(this.defaultValue,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.defaultValue))),i.prototype.resolve.call(this)}},{16:16,18:18,22:22,32:32,33:33,34:34}],18:[function(t,e,r){"use strict";function n(t,e,r,n,s){if(i.call(this,t,e,n,s),!a.isString(r))throw a.b("keyType");this.keyType=r,this.resolvedKeyType=null,this.map=!0}e.exports=n;var i=t(17),s=i.prototype,o=i.extend(n);n.className="MapField";var u=t(33),a=t(34);n.testJSON=function(t){return i.testJSON(t)&&void 0!==t.keyType},n.fromJSON=function(t,e){return new n(t,e.id,e.keyType,e.type,e.options)},o.toJSON=function(){return{keyType:this.keyType,type:this.type,id:this.id,extend:this.extend,options:this.options}},o.resolve=function(){if(this.resolved)return this;if(void 0===u.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return s.resolve.call(this)}},{17:17,33:33,34:34}],19:[function(t,e,r){"use strict";function n(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)this[e[r]]=t[e[r]]}e.exports=n;var i=t(13),s=n.prototype;s.asJSON=function(t){return i(this.$type,this,{},t,i.toJson)},n.from=function(t,e){return i(this.$type,t,new this.constructor,e,i.toMessage)},n.encode=function(t,e){return this.$type.encode(t,e)},n.encodeDelimited=function(t,e){return this.$type.encodeDelimited(t,e)},n.decode=function(t){return this.$type.decode(t)},n.decodeDelimited=function(t){return this.$type.decodeDelimited(t)},n.verify=function(t){return this.$type.verify(t)}},{13:13}],20:[function(t,e,r){"use strict";function n(t,e,r,n,s,o,f){if(u.isObject(s)?(f=s,s=o=void 0):u.isObject(o)&&(f=o,o=void 0),e&&!u.isString(e))throw a("type");if(!u.isString(r))throw a("requestType");if(!u.isString(n))throw a("responseType");i.call(this,t,f),this.type=e||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=n,this.responseStream=!!o||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null}e.exports=n;var i=t(22),s=i.extend(n);n.className="Method";var o=t(32),u=t(34),a=u.b;n.testJSON=function(t){return Boolean(t&&void 0!==t.requestType)},n.fromJSON=function(t,e){return new n(t,e.type,e.requestType,e.responseType,e.requestStream,e.responseStream,e.options)},s.toJSON=function(){return{type:"rpc"!==this.type&&this.type||void 0,requestType:this.requestType,requestStream:this.requestStream||void 0,responseType:this.responseType,responseStream:this.responseStream||void 0,options:this.options}},s.resolve=function(){if(this.resolved)return this;if(!(this.resolvedRequestType=this.parent.lookup(this.requestType,o)))throw Error("unresolvable request type: "+this.requestType);if(!(this.resolvedResponseType=this.parent.lookup(this.responseType,o)))throw Error("unresolvable response type: "+this.requestType);return i.prototype.resolve.call(this)}},{22:22,32:32,34:34}],21:[function(t,e,r){"use strict";function n(){f||(f=t(32)),l||(l=t(30)),h=[d,f,l,p,i],c="one of "+h.map(function(t){return t.name}).join(", ")}function i(t,e){u.call(this,t,e),this.nested=void 0,this.e=null,this.f=[]}function s(t){t.e=null;for(var e=0;e<t.f.length;++e)delete t[t.f[e]];return t.f=[],t}function o(t){if(t&&t.length){for(var e={},r=0;r<t.length;++r)e[t[r].name]=t[r].toJSON();return e}}e.exports=i;var u=t(22),a=u.extend(i);i.className="Namespace";var f,l,h,c,d=t(16),p=t(17),v=t(34),y=v.b;v.props(a,{nestedArray:{get:function(){return this.e||(this.e=v.toArray(this.nested))}}}),i.testJSON=function(t){return Boolean(t&&!t.fields&&!t.values&&void 0===t.id&&!t.oneof&&!t.methods&&void 0===t.requestType)},i.fromJSON=function(t,e){return new i(t,e.options).addJSON(e.nested)},a.toJSON=function(){return{options:this.options,nested:o(this.getNestedArray())}},i.arrayToJSON=o,a.addJSON=function(t){var e=this;return t&&(h||n(),Object.keys(t).forEach(function(r){for(var n=t[r],i=0;i<h.length;++i)if(h[i].testJSON(n))return e.add(h[i].fromJSON(r,n));throw y("nested."+r,"JSON for "+c)})),this},a.get=function(t){return void 0===this.nested?null:this.nested[t]||null},a.getEnum=function(t){if(this.nested&&this.nested[t]instanceof d)return this.nested[t].values;throw Error("no such enum")},a.add=function(t){if(h||n(),!t||h.indexOf(t.constructor)<0)throw y("object",c);if(t instanceof p&&void 0===t.extend)throw y("object","an extension field when not part of a type");if(this.nested){var e=this.get(t.name);if(e){if(!(e instanceof i&&t instanceof i)||e instanceof f||e instanceof l)throw Error("duplicate name '"+t.name+"' in "+this);for(var r=e.getNestedArray(),o=0;o<r.length;++o)t.add(r[o]);this.remove(e),this.nested||(this.nested={}),t.setOptions(e.options,!0)}}else this.nested={};return this.nested[t.name]=t,t.onAdd(this),s(this)},a.remove=function(t){if(!(t instanceof u))throw y("object","a ReflectionObject");if(t.parent!==this||!this.nested)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),s(this)},a.define=function(t,e){v.isString(t)?t=t.split("."):Array.isArray(t)||(e=t,t=void 0);var r=this;if(t)for(;t.length>0;){var n=t.shift();if(r.nested&&r.nested[n]){if(r=r.nested[n],!(r instanceof i))throw Error("path conflicts with non-namespace objects")}else r.add(r=new i(n))}return e&&r.addJSON(e),r},a.resolve=function(){f||(f=t(32)),l||(f=t(30));for(var e=this.getNestedArray(),r=0;r<e.length;++r)if(/^[A-Z]/.test(e[r].name)){if(e[r]instanceof f||e[r]instanceof l)this[e[r].name]=e[r];else{if(!(e[r]instanceof d))continue;this[e[r].name]=e[r].values}this.f.push(e[r].name)}return u.prototype.resolve.call(this)},a.resolveAll=function(){for(var t=this.getNestedArray(),e=0;e<t.length;)t[e]instanceof i?t[e++].resolveAll():t[e++].resolve();return a.resolve.call(this)},a.lookup=function(t,e,r){if("boolean"==typeof e&&(r=e,e=void 0),v.isString(t)&&t.length)t=t.split(".");else if(!t.length)return null;if(""===t[0])return this.getRoot().lookup(t.slice(1),e);var n=this.get(t[0]);return n&&1===t.length&&(!e||n instanceof e)||n instanceof i&&(n=n.lookup(t.slice(1),e,!0))?n:null===this.parent||r?null:this.parent.lookup(t,e)},a.lookupType=function(e){f||(f=t(32));var r=this.lookup(e,f);if(!r)throw Error("no such type");return r},a.lookupService=function(e){l||(l=t(30));var r=this.lookup(e,l);if(!r)throw Error("no such service");return r},a.lookupEnum=function(t){var e=this.lookup(t,d);if(!e)throw Error("no such enum");return e.values}},{16:16,17:17,22:22,30:30,32:32,34:34}],22:[function(t,e,r){"use strict";function n(t,e){if(!i.isString(t))throw o("name");if(e&&!i.isObject(e))throw o("options","an object");this.options=e,this.name=t,this.parent=null,this.resolved=!1}e.exports=n;var i=t(34);n.className="ReflectionObject",n.extend=i.extend;var s,o=i.b,u=n.prototype;i.props(u,{root:{get:function(){for(var t=this;null!==t.parent;)t=t.parent;return t}},fullName:{get:u.getFullName=function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}}),u.toJSON=function(){throw Error()},u.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var r=e.getRoot();s||(s=t(27)),r instanceof s&&r.g(this)},u.onRemove=function(e){var r=e.getRoot();s||(s=t(27)),r instanceof s&&r.h(this),this.parent=null,this.resolved=!1},u.resolve=function(){if(this.resolved)return this;var e=this.getRoot();return s||(s=t(27)),e instanceof s&&(this.resolved=!0),this},u.getOption=function(t){if(this.options)return this.options[t]},u.setOption=function(t,e,r){return r&&this.options&&void 0!==this.options[t]||((this.options||(this.options={}))[t]=e),this},u.setOptions=function(t,e){return t&&Object.keys(t).forEach(function(r){this.setOption(r,t[r],e)},this),this},u.toString=function(){var t=this.constructor.className,e=this.getFullName();return e.length?t+" "+e:t}},{27:27,34:34}],23:[function(t,e,r){"use strict";function n(t,e,r){if(Array.isArray(e)||(r=e,e=void 0),s.call(this,t,r),e&&!Array.isArray(e))throw f("fieldNames","an Array");this.ucName=a.ucFirst(this.name),this.oneof=e||[],this.i=[]}function i(t){t.parent&&t.i.forEach(function(e){e.parent||t.parent.add(e)})}e.exports=n;var s=t(22),o=s.extend(n);n.className="OneOf";var u=t(17),a=t(34),f=a.b;a.prop(o,"fieldsArray",{get:function(){return this.i}}),n.testJSON=function(t){return Boolean(t.oneof)},n.fromJSON=function(t,e){return new n(t,e.oneof,e.options)},o.toJSON=function(){return{oneof:this.oneof,options:this.options}},o.add=function(t){if(!(t instanceof u))throw f("field","a Field");return t.parent&&t.parent.remove(t),this.oneof.push(t.name),this.i.push(t),t.partOf=this,i(this),this},o.remove=function(t){if(!(t instanceof u))throw f("field","a Field");var e=this.i.indexOf(t);if(e<0)throw Error(t+" is not a member of "+this);return this.i.splice(e,1),e=this.oneof.indexOf(t.name),e>-1&&this.oneof.splice(e,1),t.parent&&t.parent.remove(t),t.partOf=null,this},o.onAdd=function(t){s.prototype.onAdd.call(this,t);var e=this;this.oneof.forEach(function(r){var n=t.get(r);n&&!n.partOf&&(n.partOf=e,e.i.push(n))}),i(this)},o.onRemove=function(t){this.i.forEach(function(t){t.parent&&t.parent.remove(t)}),s.prototype.onRemove.call(this,t)}},{17:17,22:22,34:34}],24:[function(t,e,r){"use strict";function n(t){return/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(t)}function i(t){return/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/.test(t)}function s(t){return/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/.test(t)}function o(t){return null===t?null:t.toLowerCase()}function u(t){return t.substring(0,1)+t.substring(1).replace(/_([a-z])(?=[a-z]|$)/g,function(t,e){return e.toUpperCase()})}function a(t,e,r){function w(t,e){var r=a.filename;return a.filename=null,Error("illegal "+(e||"token")+" '"+t+"' ("+(r?r+", ":"")+"line "+Z.line()+")")}function k(){var t,e=[];do{if('"'!==(t=W())&&"'"!==t)throw w(t);e.push(W()),Q(t),t=G()}while('"'===t||"'"===t);return e.join("")}function x(t){var e=W();switch(o(e)){case"'":case'"':return X(e),k();case"true":return!0;case"false":return!1}try{return N(e)}catch(r){if(t&&i(e))return e;throw w(e,"value")}}function O(){var t=A(W()),e=t;return Q("to",!0)&&(e=A(W())),Q(";"),[t,e]}function N(t){var e=1;"-"===t.charAt(0)&&(e=-1,t=t.substring(1));var r=o(t);switch(r){case"inf":return e*(1/0);case"nan":return NaN;case"0":return 0}if(/^[1-9][0-9]*$/.test(t))return e*parseInt(t,10);if(/^0[x][0-9a-f]+$/.test(r))return e*parseInt(t,16);if(/^0[0-7]+$/.test(t))return e*parseInt(t,8);if(/^(?!e)[0-9]*(?:\.[0-9]*)?(?:[e][+-]?[0-9]+)?$/.test(r))return e*parseFloat(t);throw w(t,"number")}function A(t,e){var r=o(t);switch(r){case"max":return 536870911;case"0":return 0}if("-"===t.charAt(0)&&!e)throw w(t,"id");if(/^-?[1-9][0-9]*$/.test(t))return parseInt(t,10);if(/^-?0[x][0-9a-f]+$/.test(r))return parseInt(t,16);if(/^-?0[0-7]+$/.test(t))return parseInt(t,8);throw w(t,"id")}function S(){if(void 0!==P)throw w("package");if(P=W(),!i(P))throw w(P,"name");rt=rt.define(P),Q(";")}function j(){var t,e=G();switch(e){case"weak":t=H||(H=[]),W();break;case"public":W();default:t=_||(_=[])}e=k(),Q(";"),t.push(e)}function T(){if(Q("="),K=o(k()),tt="proto3"===K,!tt&&"proto2"!==K)throw w(K,"syntax");Q(";")}function E(t,e){switch(e){case"option":return $(t,e),Q(";"),!0;case"message":return F(t,e),!0;case"enum":return V(t,e),!0;case"service":return C(t,e),!0;case"extend":return D(t,e),!0}return!1}function F(t,e){var r=W();if(!n(r))throw w(r,"type name");var s=new h(r);if(Q("{",!0)){for(;"}"!==(e=W());){var u=o(e);if(!E(s,e))switch(u){case"map":B(s,u);break;case"required":case"optional":case"repeated":J(s,u);break;case"oneof":L(s,u);break;case"extensions":(s.extensions||(s.extensions=[])).push(O(s,u));break;case"reserved":(s.reserved||(s.reserved=[])).push(O(s,u));break;default:if(!tt||!i(e))throw w(e);X(e),J(s,"optional")}}Q(";",!0)}else Q(";");t.add(s)}function J(t,e,r){var s=W();if("group"===o(s))return void q(t,e);if(!i(s))throw w(s,"type");var u=W();if(!n(u))throw w(u,"name");u=nt(u),Q("=");var a=A(W()),f=M(new c(u,a,s,e,r));f.repeated&&void 0!==m.packed[s]&&!tt&&f.setOption("packed",!1,!0),t.add(f)}function q(t,e){var r=W();if(!n(r))throw w(r,"name");var i=b.lcFirst(r);r===i&&(r=b.ucFirst(r)),Q("=");var s=A(W()),u=new h(r);u.group=!0;var a=new c(i,s,r,e);for(Q("{");"}"!==(et=W());)switch(et=o(et)){case"option":$(u,et),Q(";");break;case"required":case"optional":case"repeated":J(u,et);break;default:throw w(et)}Q(";",!0),t.add(u).add(a)}function B(t){Q("<");var e=W();if(void 0===m.mapKey[e])throw w(e,"type");Q(",");var r=W();if(!i(r))throw w(r,"type");Q(">");var s=W();if(!n(s))throw w(s,"name");s=nt(s),Q("=");var o=A(W()),u=M(new d(s,o,e,r));t.add(u)}function L(t,e){var r=W();if(!n(r))throw w(r,"name");r=nt(r);var i=new p(r);if(Q("{",!0)){for(;"}"!==(e=W());)"option"===e?($(i,e),Q(";")):(X(e),J(i,"optional"));Q(";",!0)}else Q(";");t.add(i)}function V(t,e){var r=W();if(!n(r))throw w(r,"name");var i={},s=new v(r,i);if(Q("{",!0)){for(;"}"!==(e=W());)"option"===o(e)?($(s,e),Q(";")):I(s,e);Q(";",!0)}else Q(";");t.add(s)}function I(t,e){if(!n(e))throw w(e,"name");var r=e;Q("=");var i=A(W(),!0);t.values[r]=i,M({})}function $(t,e){var r=Q("(",!0),n=W();if(!i(n))throw w(n,"name");r&&(Q(")"),n="("+n+")",e=G(),s(e)&&(n+=e,W())),Q("="),z(t,n)}function z(t,e){if(Q("{",!0))for(;"}"!==(et=W());){if(!n(et))throw w(et,"name");e=e+"."+et,Q(":",!0)?R(t,e,x(!0)):z(t,e)}else R(t,e,x(!0))}function R(t,e,r){t.setOption?t.setOption(e,r):t[e]=r}function M(t){if(Q("[",!0)){do $(t,"option");while(Q(",",!0));Q("]")}return Q(";"),t}function C(t,e){if(e=W(),!n(e))throw w(e,"service name");var r=e,i=new y(r);if(Q("{",!0)){for(;"}"!==(e=W());){var s=o(e);switch(s){case"option":$(i,s),Q(";");break;case"rpc":U(i,s);break;default:throw w(e)}}Q(";",!0)}else Q(";");t.add(i)}function U(t,e){var r=e,s=W();if(!n(s))throw w(s,"name");var u,a,f,l;Q("(");var h;if(Q(h="stream",!0)&&(a=!0),!i(e=W()))throw w(e);if(u=e,Q(")"),Q("returns"),Q("("),Q(h,!0)&&(l=!0),!i(e=W()))throw w(e);f=e,Q(")");var c=new g(s,r,u,f,a,l);if(Q("{",!0)){for(;"}"!==(e=W());){var d=o(e);switch(d){case"option":$(c,d),Q(";");break;default:throw w(e)}}Q(";",!0)}else Q(";");t.add(c)}function D(t,e){var r=W();if(!i(r))throw w(r,"reference");if(Q("{",!0)){for(;"}"!==(e=W());){var n=o(e);switch(n){case"required":case"repeated":case"optional":J(t,n,r);break;default:if(!tt||!i(e))throw w(e);X(e),J(t,"optional",r)}}Q(";",!0)}else Q(";")}e instanceof l?r||(r={}):(e=new l,r=e||{});var P,_,H,K,Z=f(t),W=Z.next,X=Z.push,G=Z.peek,Q=Z.skip,Y=!0,tt=!1;e||(e=new l);for(var et,rt=e,nt=r.keepCase?function(t){return t}:u;null!==(et=W());){var it=o(et);switch(it){case"package":if(!Y)throw w(et);S();break;case"import":if(!Y)throw w(et);j();break;case"syntax":if(!Y)throw w(et);T();break;case"option":if(!Y)throw w(et);$(rt,et),Q(";");break;default:if(E(rt,et)){Y=!1;continue}throw w(et)}}return a.filename=null,{package:P,imports:_,weakImports:H,syntax:K,root:e}}e.exports=a;var f=t(31),l=t(27),h=t(32),c=t(17),d=t(18),p=t(23),v=t(16),y=t(30),g=t(20),m=t(33),b=t(34)},{16:16,17:17,18:18,20:20,23:23,27:27,30:30,31:31,32:32,33:33,34:34}],25:[function(t,e,r){"use strict";function n(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function i(t){this.buf=t,this.pos=0,this.len=t.length}function s(){var t=new k(0,0),e=0;if(this.len-this.pos>4){for(e=0;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}else{for(e=0;e<4;++e){if(this.pos>=this.len)throw n(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}if(this.pos>=this.len)throw n(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}if(this.len-this.pos>4){for(e=0;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t; | ||
}else for(e=0;e<5;++e){if(this.pos>=this.len)throw n(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function o(){return s.call(this).toLong()}function u(){return s.call(this).toNumber()}function a(){return s.call(this).toLong(!0)}function f(){return s.call(this).toNumber(!0)}function l(){return s.call(this).zzDecode().toLong()}function h(){return s.call(this).zzDecode().toNumber()}function c(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw n(this,8);return new k(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}function p(){return d.call(this).toLong(!0)}function v(){return d.call(this).toNumber(!0)}function y(){return d.call(this).zzDecode().toLong()}function g(){return d.call(this).zzDecode().toNumber()}function m(){w.Long?(O.int64=o,O.uint64=a,O.sint64=l,O.fixed64=p,O.sfixed64=y):(O.int64=u,O.uint64=f,O.sint64=h,O.fixed64=v,O.sfixed64=g)}e.exports=i;var b,w=t(36),k=w.LongBits,x=w.utf8;i.create=w.Buffer?function(e){return b||(b=t(26)),(i.create=function(t){return new b(t)})(e)}:function(t){return new i(t)};var O=i.prototype;O.j=w.Array.prototype.subarray||w.Array.prototype.slice,O.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,n(this,10);return t}}(),O.int32=function(){return 0|this.uint32()},O.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},O.bool=function(){return 0!==this.uint32()},O.fixed32=function(){if(this.pos+4>this.len)throw n(this,4);return c(this.buf,this.pos+=4)},O.sfixed32=function(){var t=this.fixed32();return t>>>1^-(1&t)};var N="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[3]?function(r,n){return e[0]=r[n],e[1]=r[n+1],e[2]=r[n+2],e[3]=r[n+3],t[0]}:function(r,n){return e[3]=r[n],e[2]=r[n+1],e[1]=r[n+2],e[0]=r[n+3],t[0]}}():function(t,e){var r=c(t,e+4),n=2*(r>>31)+1,i=r>>>23&255,s=8388607&r;return 255===i?s?NaN:n*(1/0):0===i?1.401298464324817e-45*n*s:n*Math.pow(2,i-150)*(s+8388608)};O.float=function(){if(this.pos+4>this.len)throw n(this,4);var t=N(this.buf,this.pos);return this.pos+=4,t};var A="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[7]?function(r,n){return e[0]=r[n],e[1]=r[n+1],e[2]=r[n+2],e[3]=r[n+3],e[4]=r[n+4],e[5]=r[n+5],e[6]=r[n+6],e[7]=r[n+7],t[0]}:function(r,n){return e[7]=r[n],e[6]=r[n+1],e[5]=r[n+2],e[4]=r[n+3],e[3]=r[n+4],e[2]=r[n+5],e[1]=r[n+6],e[0]=r[n+7],t[0]}}():function(t,e){var r=c(t,e+4),n=c(t,e+8),i=2*(n>>31)+1,s=n>>>20&2047,o=4294967296*(1048575&n)+r;return 2047===s?o?NaN:i*(1/0):0===s?5e-324*i*o:i*Math.pow(2,s-1075)*(o+4503599627370496)};O.double=function(){if(this.pos+8>this.len)throw n(this,4);var t=A(this.buf,this.pos);return this.pos+=8,t},O.bytes=function(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw n(this,t);return this.pos+=t,e===r?new this.buf.constructor(0):this.j.call(this.buf,e,r)},O.string=function(){var t=this.bytes();return x.read(t,0,t.length)},O.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw n(this,t);this.pos+=t}else do if(this.pos>=this.len)throw n(this);while(128&this.buf[this.pos++]);return this},O.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4===(t=7&this.uint32()))break;this.skipType(t)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type: "+t)}return this},i.k=m,m()},{26:26,36:36}],26:[function(t,e,r){"use strict";function n(t){i.call(this,t)}e.exports=n;var i=t(25),s=n.prototype=Object.create(i.prototype);s.constructor=n;var o=t(36);o.Buffer&&(s.j=o.Buffer.prototype.slice),s.string=function(){var t=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len))}},{25:25,36:36}],27:[function(t,e,r){"use strict";function n(t){o.call(this,"",t),this.deferred=[],this.files=[]}function i(){}function s(t){var e=t.parent.lookup(t.extend);if(e){var r=new l(t.getFullName(),t.id,t.type,t.rule,(void 0),t.options);return r.declaringField=t,t.extensionField=r,e.add(r),!0}return!1}e.exports=n;var o=t(21),u=o.extend(n);n.className="Root";var a,f,l=t(17),h=t(34);n.fromJSON=function(t,e){return e||(e=new n),e.setOptions(t.options).addJSON(t.nested)},u.resolvePath=h.path.resolve;var c=function(){try{a=t(24),f=t(12)}catch(t){}c=null};u.load=function t(e,r,n){function s(t,e){if(n){var r=n;n=null,r(t,e)}}function o(t,e){try{if(h.isString(e)&&"{"===e.charAt(0)&&(e=JSON.parse(e)),h.isString(e)){a.filename=t;var n=a(e,l,r);n.imports&&n.imports.forEach(function(e){u(l.resolvePath(t,e))}),n.weakImports&&n.weakImports.forEach(function(e){u(l.resolvePath(t,e),!0)})}else l.setOptions(e.options).addJSON(e.nested)}catch(t){return void s(t)}d||p||s(null,l)}function u(t,e){var r=t.lastIndexOf("google/protobuf/");if(r>-1){var i=t.substring(r);i in f&&(t=i)}if(!(l.files.indexOf(t)>-1)){if(l.files.push(t),t in f)return void(d?o(t,f[t]):(++p,setTimeout(function(){--p,o(t,f[t])})));if(d){var u;try{u=h.fs.readFileSync(t).toString("utf8")}catch(t){return void(e||s(t))}o(t,u)}else++p,h.fetch(t,function(r,i){if(--p,n)return r?void(e||s(r)):void o(t,i)})}}c&&c(),"function"==typeof r&&(n=r,r=void 0);var l=this;if(!n)return h.asPromise(t,l,e);var d=n===i,p=0;return h.isString(e)&&(e=[e]),e.forEach(function(t){u(l.resolvePath("",t))}),d?l:void(p||s(null,l))},u.loadSync=function(t,e){return this.load(t,e,i)},u.g=function(t){var e=this.deferred.slice();this.deferred=[];for(var r=0;r<e.length;)s(e[r])?e.splice(r,1):++r;if(this.deferred=e,t instanceof l&&void 0!==t.extend&&!t.extensionField&&!s(t)&&this.deferred.indexOf(t)<0)this.deferred.push(t);else if(t instanceof o){var n=t.getNestedArray();for(r=0;r<n.length;++r)this.g(n[r])}},u.h=function(t){if(t instanceof l){if(void 0!==t.extend&&!t.extensionField){var e=this.deferred.indexOf(t);e>-1&&this.deferred.splice(e,1)}t.extensionField&&(t.extensionField.parent.remove(t.extensionField),t.extensionField=null)}else if(t instanceof o)for(var r=t.getNestedArray(),n=0;n<r.length;++n)this.h(r[n])}},{12:12,17:17,21:21,24:24,34:34}],28:[function(t,e,r){"use strict";var n=r;n.Service=t(29)},{29:29}],29:[function(t,e,r){"use strict";function n(t){s.call(this),this.$rpc=t}e.exports=n;var i=t(34),s=i.EventEmitter,o=n.prototype=Object.create(s.prototype);o.constructor=n,o.end=function(t){return this.$rpc&&(t||this.$rpc(null,null,null),this.$rpc=null,this.emit("end").off()),this}},{34:34}],30:[function(t,e,r){"use strict";function n(t,e){s.call(this,t,e),this.methods={},this.l=null}function i(t){return t.l=null,t}e.exports=n;var s=t(21),o=s.prototype,u=s.extend(n);n.className="Service";var a=t(20),f=t(34),l=t(28);f.props(u,{methodsArray:{get:function(){return this.l||(this.l=f.toArray(this.methods))}}}),n.testJSON=function(t){return Boolean(t&&t.methods)},n.fromJSON=function(t,e){var r=new n(t,e.options);return e.methods&&Object.keys(e.methods).forEach(function(t){r.add(a.fromJSON(t,e.methods[t]))}),r},u.toJSON=function(){var t=o.toJSON.call(this);return{options:t&&t.options||void 0,methods:s.arrayToJSON(this.getMethodsArray())||{},nested:t&&t.nested||void 0}},u.get=function(t){return o.get.call(this,t)||this.methods[t]||null},u.resolveAll=function(){for(var t=this.getMethodsArray(),e=0;e<t.length;++e)t[e].resolve();return o.resolve.call(this)},u.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);return t instanceof a?(this.methods[t.name]=t,t.parent=this,i(this)):o.add.call(this,t)},u.remove=function(t){if(t instanceof a){if(this.methods[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.methods[t.name],t.parent=null,i(this)}return o.remove.call(this,t)},u.create=function(t,e,r){var n=new l.Service(t);return this.getMethodsArray().forEach(function(i){n[f.lcFirst(i.name)]=function(s,o){if(n.$rpc){if(!s)throw f.b("request","not null");i.resolve();var u;try{u=(e?i.resolvedRequestType.encodeDelimited(s):i.resolvedRequestType.encode(s)).finish()}catch(t){return void("function"==typeof setImmediate?setImmediate:setTimeout)(function(){o(t)})}t(i,u,function(t,e){if(t)return n.emit("error",t,i),o?o(t):void 0;if(null===e)return void n.end(!0);var s;try{s=r?i.resolvedResponseType.decodeDelimited(e):i.resolvedResponseType.decode(e)}catch(t){return n.emit("error",t,i),o?o("error",t):void 0}return n.emit("data",s,i),o?o(null,s):void 0})}}}),n}},{20:20,21:21,28:28,34:34}],31:[function(t,e,r){"use strict";function n(t){return t.replace(/\\(.?)/g,function(t,e){switch(e){case"\\":case"":return e;case"0":return"\0";default:return e}})}function i(t){function e(t){return Error("illegal "+t+" (line "+p+")")}function r(){var r="'"===y?u:o;r.lastIndex=c-1;var i=r.exec(t);if(!i)throw e("string");return c=r.lastIndex,f(y),y=null,n(i[1])}function i(e){return t.charAt(e)}function a(){if(v.length>0)return v.shift();if(y)return r();var n,o,u;do{if(c===d)return null;for(n=!1;/\s/.test(u=i(c));)if("\n"===u&&++p,++c===d)return null;if("/"===i(c)){if(++c===d)throw e("comment");if("/"===i(c)){for(;"\n"!==i(++c);)if(c===d)return null;++c,++p,n=!0}else{if("*"!==(u=i(c)))return"/";do{if("\n"===u&&++p,++c===d)return null;o=u,u=i(c)}while("*"!==o||"/"!==u);++c,n=!0}}}while(n);if(c===d)return null;var a=c;s.lastIndex=0;var f=s.test(i(a++));if(!f)for(;a<d&&!s.test(i(a));)++a;var l=t.substring(c,c=a);return'"'!==l&&"'"!==l||(y=l),l}function f(t){v.push(t)}function l(){if(!v.length){var t=a();if(null===t)return null;f(t)}return v[0]}function h(t,r){var n=l(),i=n===t;if(i)return a(),!0;if(!r)throw e("token '"+n+"', '"+t+"' expected");return!1}t=t.toString();var c=0,d=t.length,p=1,v=[],y=null;return{line:function(){return p},next:a,peek:l,push:f,skip:h}}e.exports=i;var s=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,u=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},{}],32:[function(t,e,r){"use strict";function n(t,e){s.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this.m=null,this.i=null,this.n=null,this.o=null,this.p=null}function i(t){return t.m=t.i=t.o=t.p=null,delete t.encode,delete t.decode,delete t.verify,t}e.exports=n;var s=t(21),o=s.prototype,u=s.extend(n);n.className="Type";var a,f,l,h=t(16),c=t(23),d=t(17),p=t(30),v=t(11),y=t(19),g=t(25),m=t(38),b=t(13),w=t(34);w.props(u,{fieldsById:{get:function(){if(this.m)return this.m;this.m={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var r=this.fields[t[e]],n=r.id;if(this.m[n])throw Error("duplicate id "+n+" in "+this);this.m[n]=r}return this.m}},fieldsArray:{get:function(){return this.i||(this.i=w.toArray(this.fields))}},repeatedFieldsArray:{get:function(){return this.n||(this.n=this.getFieldsArray().filter(function(t){return t.repeated}))}},oneofsArray:{get:function(){return this.o||(this.o=w.toArray(this.oneofs))}},ctor:{get:function(){return this.p||(this.p=v.create(this).constructor)},set:function(t){if(t&&!(t.prototype instanceof y))throw w.b("ctor","a Message constructor");t.from||(t.from=y.from),this.p=t}}}),n.testJSON=function(t){return Boolean(t&&t.fields)};var k=[h,n,d,p];n.fromJSON=function(t,e){var r=new n(t,e.options);return r.extensions=e.extensions,r.reserved=e.reserved,e.fields&&Object.keys(e.fields).forEach(function(t){r.add(d.fromJSON(t,e.fields[t]))}),e.oneofs&&Object.keys(e.oneofs).forEach(function(t){r.add(c.fromJSON(t,e.oneofs[t]))}),e.nested&&Object.keys(e.nested).forEach(function(t){for(var n=e.nested[t],i=0;i<k.length;++i)if(k[i].testJSON(n))return void r.add(k[i].fromJSON(t,n));throw Error("invalid nested object in "+r+": "+t)}),e.extensions&&e.extensions.length&&(r.extensions=e.extensions),e.reserved&&e.reserved.length&&(r.reserved=e.reserved),e.group&&(r.group=!0),r},u.toJSON=function(){var t=o.toJSON.call(this);return{options:t&&t.options||void 0,oneofs:s.arrayToJSON(this.getOneofsArray()),fields:s.arrayToJSON(this.getFieldsArray().filter(function(t){return!t.declaringField}))||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:t&&t.nested||void 0}},u.resolveAll=function(){for(var t=this.getFieldsArray(),e=0;e<t.length;)t[e++].resolve();var r=this.getOneofsArray();for(e=0;e<r.length;)r[e++].resolve();return o.resolve.call(this)},u.get=function(t){return o.get.call(this,t)||this.fields&&this.fields[t]||this.oneofs&&this.oneofs[t]||null},u.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof d&&void 0===t.extend){if(this.getFieldsById()[t.id])throw Error("duplicate id "+t.id+" in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),i(this)}return t instanceof c?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),i(this)):o.add.call(this,t)},u.remove=function(t){if(t instanceof d&&void 0===t.extend){if(this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.message=null,i(this)}return o.remove.call(this,t)},u.create=function(t){return new(this.getCtor())(t)},u.from=function(t,e){return b(this,t,new(this.getCtor()),e,b.toMessage)},u.setup=function(){return a||(a=t(15),f=t(14),l=t(37)),this.encode=a(this).eof(this.getFullName()+"$encode",{Writer:m,types:this.getFieldsArray().map(function(t){return t.resolvedType}),util:w}),this.decode=f(this).eof(this.getFullName()+"$decode",{Reader:g,types:this.getFieldsArray().map(function(t){return t.resolvedType}),util:w}),this.verify=l(this).eof(this.getFullName()+"$verify",{types:this.getFieldsArray().map(function(t){return t.resolvedType}),util:w}),this},u.encode=function(t,e){return this.setup().encode(t,e)},u.encodeDelimited=function(t,e){return this.encode(t,e&&e.len?e.fork():e).ldelim()},u.decode=function(t,e){return this.setup().decode(t,e)},u.decodeDelimited=function(t){return t=t instanceof g?t:g.create(t),this.decode(t,t.uint32())},u.verify=function(t){return this.setup().verify(t)}},{11:11,13:13,14:14,15:15,16:16,17:17,19:19,21:21,23:23,25:25,30:30,34:34,37:37,38:38}],33:[function(t,e,r){"use strict";function n(t,e){var r=0,n={};for(e|=0;r<t.length;)n[o[r+e]]=t[r++];return n}var i=r,s=t(34),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes","message"];i.basic=n([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=n([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",s.emptyArray,null]),i.long=n([0,0,0,1,1],7),i.mapKey=n([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=n([1,5,0,0,0,5,5,0,0,0,1,1,0])},{34:34}],34:[function(t,e,r){"use strict";var n=e.exports=t(36);n.asPromise=t(1),n.codegen=t(3),n.EventEmitter=t(4),n.extend=t(5),n.fetch=t(6),n.path=t(8),n.fs=n.inquire("fs"),n.toArray=function(t){if(!t)return[];for(var e=Object.keys(t),r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=t[e[i]];return n},n.b=function(t,e){return TypeError(t+" must be "+(e||"a string"))},n.merge=function(t,e,r){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)void 0!==t[n[i]]&&r||(t[n[i]]=e[n[i]]);return t},n.safeProp=function(t){return'["'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"]'},n.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},n.newBuffer=function(t){return t=t||0,n.Buffer?n.Buffer.allocUnsafe(t):new("undefined"!=typeof Uint8Array?Uint8Array:Array)(t)}},{1:1,3:3,36:36,4:4,5:5,6:6,8:8}],35:[function(t,e,r){"use strict";function n(t,e){this.lo=t,this.hi=e}e.exports=n;var i=t(36),s=n.prototype,o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1},n.fromNumber=function(t){if(0===t)return o;var e=t<0;t=Math.abs(t);var r=t>>>0,i=(t-r)/4294967296>>>0;return e&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(t){if("number"==typeof t)return n.fromNumber(t);if("string"==typeof t){if(!i.Long)return n.fromNumber(parseInt(t,10));t=i.Long.fromString(t)}return t.low||t.high?new n(t.low>>>0,t.high>>>0):o},s.toNumber=function(t){return!t&&this.hi>>>31?(this.lo=~this.lo+1>>>0,this.hi=~this.hi>>>0,this.lo||(this.hi=this.hi+1>>>0),-(this.lo+4294967296*this.hi)):this.lo+4294967296*this.hi},s.toLong=function(t){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var u=String.prototype.charCodeAt;n.fromHash=function(t){return new n((u.call(t,0)|u.call(t,1)<<8|u.call(t,2)<<16|u.call(t,3)<<24)>>>0,(u.call(t,4)|u.call(t,5)<<8|u.call(t,6)<<16|u.call(t,7)<<24)>>>0)},s.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},s.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},s.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},s.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:r<128?9:10}},{36:36}],36:[function(require,module,exports){(function(global){"use strict";var util=exports;util.LongBits=require(35),util.base64=require(2),util.inquire=require(7),util.utf8=require(10),util.pool=require(9),util.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),util.isIE8=!1;try{util.isIE8=eval("!-[1,]")}catch(t){}util.Buffer=function(){try{var t=util.inquire("buffer").Buffer;return t.prototype.utf8Write?(t.from||(t.from=function(e,r){return new t(e,r)}),t.allocUnsafe||(t.allocUnsafe=function(e){return new t(e)}),t):null}catch(t){return null}}(),util.Array="undefined"==typeof Uint8Array?Array:Uint8Array,util.Long=global.dcodeIO&&global.dcodeIO.Long||util.inquire("long"),util.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},util.isString=function(t){return"string"==typeof t||t instanceof String},util.isObject=function(t){return t&&"object"==typeof t},util.longToHash=function(t){return t?util.LongBits.from(t).toHash():"\0\0\0\0\0\0\0\0"},util.longFromHash=function(t,e){var r=util.LongBits.fromHash(t);return util.Long?util.Long.fromBits(r.lo,r.hi,e):r.toNumber(Boolean(e))},util.longNeq=function(t,e){return"number"==typeof t?"number"==typeof e?t!==e:(t=util.LongBits.fromNumber(t)).lo!==e.low||t.hi!==e.high:"number"==typeof e?(e=util.LongBits.fromNumber(e)).lo!==t.low||e.hi!==t.high:t.low!==e.low||t.high!==e.high},util.longNe=function(t,e,r){if("object"==typeof t)return t.low!==e||t.high!==r;var n=util.LongBits.from(t);return n.lo!==e||n.hi!==r},util.ucFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},util.props=function(t,e){Object.keys(e).forEach(function(r){util.prop(t,r,e[r])})},util.prop=function(t,e,r){var n=util.ucFirst(e);r.get&&(t["get"+n]=r.get),r.set&&(t["set"+n]=util.isIE8?function(t){r.set.call(this,t),this[e]=t}:r.set),util.isIE8?void 0!==r.value&&(t[e]=r.value):Object.defineProperty(t,e,r)},util.emptyArray=Object.freeze?Object.freeze([]):[],util.emptyObject=Object.freeze?Object.freeze({}):{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,2:2,35:35,7:7,9:9}],37:[function(t,e,r){"use strict";function n(t,e){return"invalid value for field "+t.getFullName()+" ("+e+(t.repeated&&"array"!==e?"[]":t.map&&"object"!==e?"{k:"+t.keyType+"}":"")+" expected)"}function i(t,e,r,i){if(e.resolvedType)if(e.resolvedType instanceof u){t("switch(%s){",i)("default:")("return%j",n(e,"enum value"));for(var s=f.toArray(e.resolvedType.values),o=0;o<s.length;++o)t("case %d:",s[o]);t("break")("}")}else e.resolvedType instanceof a&&t("var r;")("if(r=types[%d].verify(%s))",r,i)("return r");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",i)("return%j",n(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",n(e,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',i)("return%j",n(e,"number"));break;case"bool":t('if(typeof %s!=="boolean")',i)("return%j",n(e,"boolean"));break;case"string":t("if(!util.isString(%s))",i)("return%j",n(e,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",n(e,"buffer"))}}function s(t,e,r){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))",r)("return%j",n(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9]\\d*))$/.test(%s))",r)("return%j",n(e,"integer|Long key"));break;case"bool":t("if(!/^true|false|0|1$/.test(%s))",r)("return%j",n(e,"boolean key"))}}function o(t){for(var e=t.getFieldsArray(),r=f.codegen("m"),o=0;o<e.length;++o){var u=e[o].resolve(),l="m"+f.safeProp(u.name);u.map?(r("if(%s!==undefined){",l)("if(!util.isObject(%s))",l)("return%j",n(u,"object"))("var k=Object.keys(%s)",l)("for(var i=0;i<k.length;++i){"),s(r,u,"k[i]"),i(r,u,o,l+"[k[i]]"),r("}")("}")):u.repeated?(r("if(%s!==undefined){",l)("if(!Array.isArray(%s))",l)("return%j",n(u,"array"))("for(var i=0;i<%s.length;++i){",l),i(r,u,o,l+"[i]"),r("}")("}")):(u.required||(u.resolvedType instanceof a?r("if(%s!==undefined&&%s!==null){",l,l):r("if(%s!==undefined){",l)),i(r,u,o,l),u.required||r("}"))}return r("return null")}e.exports=o;var u=t(16),a=t(32),f=t(34)},{16:16,32:32,34:34}],38:[function(t,e,r){"use strict";function n(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function i(){}function s(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function o(){this.len=0,this.head=new n(i,0,0),this.tail=this.head,this.states=null}function u(t,e,r){e[r]=255&t}function a(t,e,r){for(;t>127;)e[r++]=127&t|128,t>>>=7;e[r]=t}function f(t,e,r){for(;t.hi;)e[r++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=127&t.lo|128,t.lo=t.lo>>>7;e[r++]=t.lo}function l(t,e,r){e[r++]=255&t,e[r++]=t>>>8&255,e[r++]=t>>>16&255,e[r]=t>>>24}e.exports=o;var h,c=t(36),d=c.LongBits,p=c.base64,v=c.utf8;o.create=c.Buffer?function(){return h||(h=t(39)),(o.create=function(){return new h})()}:function(){return new o},o.alloc=function(t){return new c.Array(t)},c.Array!==Array&&(o.alloc=c.pool(o.alloc,c.Array.prototype.subarray));var y=o.prototype;y.push=function(t,e,r){return this.tail=this.tail.next=new n(t,e,r),this.len+=e,this},y.uint32=function(t){return t>>>=0,this.push(a,t<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)},y.int32=function(t){return t<0?this.push(f,10,d.fromNumber(t)):this.uint32(t)},y.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},y.uint64=function(t){var e=d.from(t);return this.push(f,e.length(),e)},y.int64=y.uint64,y.sint64=function(t){var e=d.from(t).zzEncode();return this.push(f,e.length(),e)},y.bool=function(t){return this.push(u,1,t?1:0)},y.fixed32=function(t){return this.push(l,4,t>>>0)},y.sfixed32=function(t){return this.push(l,4,t<<1^t>>31)},y.fixed64=function(t){var e=d.from(t);return this.push(l,4,e.lo).push(l,4,e.hi)},y.sfixed64=function(t){var e=d.from(t).zzEncode();return this.push(l,4,e.lo).push(l,4,e.hi)};var g="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[3]?function(r,n,i){t[0]=r,n[i++]=e[0],n[i++]=e[1],n[i++]=e[2],n[i]=e[3]}:function(r,n,i){t[0]=r,n[i++]=e[3],n[i++]=e[2],n[i++]=e[1],n[i]=e[0]}}():function(t,e,r){var n=t<0?1:0;if(n&&(t=-t),0===t)l(1/t>0?0:2147483648,e,r);else if(isNaN(t))l(2147483647,e,r);else if(t>3.4028234663852886e38)l((n<<31|2139095040)>>>0,e,r);else if(t<1.1754943508222875e-38)l((n<<31|Math.round(t/1.401298464324817e-45))>>>0,e,r);else{var i=Math.floor(Math.log(t)/Math.LN2),s=8388607&Math.round(t*Math.pow(2,-i)*8388608);l((n<<31|i+127<<23|s)>>>0,e,r)}};y.float=function(t){return this.push(g,4,t)};var m="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),e=new Uint8Array(t.buffer);return t[0]=-0,e[7]?function(r,n,i){t[0]=r,n[i++]=e[0],n[i++]=e[1],n[i++]=e[2],n[i++]=e[3],n[i++]=e[4],n[i++]=e[5],n[i++]=e[6],n[i]=e[7]}:function(r,n,i){t[0]=r,n[i++]=e[7],n[i++]=e[6],n[i++]=e[5],n[i++]=e[4],n[i++]=e[3],n[i++]=e[2],n[i++]=e[1],n[i]=e[0]}}():function(t,e,r){var n=t<0?1:0;if(n&&(t=-t),0===t)l(0,e,r),l(1/t>0?0:2147483648,e,r+4);else if(isNaN(t))l(4294967295,e,r),l(2147483647,e,r+4);else if(t>1.7976931348623157e308)l(0,e,r),l((n<<31|2146435072)>>>0,e,r+4);else{var i;if(t<2.2250738585072014e-308)i=t/5e-324,l(i>>>0,e,r),l((n<<31|i/4294967296)>>>0,e,r+4);else{var s=Math.floor(Math.log(t)/Math.LN2);1024===s&&(s=1023),i=t*Math.pow(2,-s),l(4503599627370496*i>>>0,e,r),l((n<<31|s+1023<<20|1048576*i&1048575)>>>0,e,r+4)}}};y.double=function(t){return this.push(m,8,t)};var b=c.Array.prototype.set?function(t,e,r){e.set(t,r)}:function(t,e,r){for(var n=0;n<t.length;++n)e[r+n]=t[n]};y.bytes=function(t){var e=t.length>>>0;if("string"==typeof t&&e){var r=o.alloc(e=p.length(t));p.decode(t,r,0),t=r}return e?this.uint32(e).push(b,e,t):this.push(u,1,0)},y.string=function(t){var e=v.length(t);return e?this.uint32(e).push(v.write,e,t):this.push(u,1,0)},y.fork=function(){return this.states=new s(this),this.head=this.tail=new n(i,0,0),this.len=0,this},y.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(i,0,0),this.len=0),this},y.ldelim=function(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r).tail.next=t.next,this.tail=e,this.len+=r,this},y.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e}},{36:36,39:39}],39:[function(t,e,r){"use strict";function n(){s.call(this)}function i(t,e,r){t.length<40?a.write(t,e,r):e.utf8Write(t,r)}e.exports=n;var s=t(38),o=n.prototype=Object.create(s.prototype);o.constructor=n;var u=t(36),a=u.utf8,f=u.Buffer;n.alloc=function(t){return(n.alloc=f.allocUnsafe)(t)};var l=f&&f.prototype instanceof Uint8Array&&"set"===f.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){t.copy(e,r,0,t.length)};o.bytes=function(t){"string"==typeof t&&(t=f.from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this.push(l,e,t),this},o.string=function(t){var e=f.byteLength(t);return this.uint32(e),e&&this.push(i,e,t),this}},{36:36,38:38}],40:[function(t,e,r){(function(e){"use strict";function n(t,e,r){return"function"==typeof e?(r=e,e=new o.Root):e||(e=new o.Root),e.load(t,r)}function i(t,e){return e||(e=new o.Root),e.loadSync(t)}function s(){o.Reader.k()}var o=e.protobuf=r;o.load=n,o.loadSync=i,o.roots={};try{o.tokenize=t(31),o.parse=t(24),o.common=t(12)}catch(t){}o.Writer=t(38),o.BufferWriter=t(39),o.Reader=t(25),o.BufferReader=t(26),o.encoder=t(15),o.decoder=t(14),o.verifier=t(37),o.ReflectionObject=t(22),o.Namespace=t(21),o.Root=t(27),o.Enum=t(16),o.Type=t(32),o.Field=t(17),o.OneOf=t(23),o.MapField=t(18),o.Service=t(30),o.Method=t(20),o.Class=t(11),o.Message=t(19),o.types=t(33),o.rpc=t(28),o.util=t(34),o.configure=s,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&(o.util.Long=t,s()),o})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{11:11,12:12,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,30:30,31:31,32:32,33:33,34:34,37:37,38:38,39:39}]},{},[40]); | ||
!function e(t,r,n){function i(o,u){if(!r[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(e){var r=t[o][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";function n(e,t){for(var r=[],n=2;n<arguments.length;)r.push(arguments[n++]);var i=!0;return new Promise(function(n,s){r.push(function(e){if(i)if(i=!1,e)s(e);else{for(var t=[],r=1;r<arguments.length;)t.push(arguments[r++]);n.apply(null,t)}});try{e.apply(t||this,r)}catch(e){i&&(i=!1,s(e))}})}t.exports=n},{}],2:[function(e,t,r){"use strict";var n=r;n.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),s=new Array(123),o=0;o<64;)s[i[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,r){for(var n,s=[],o=0,u=0;t<r;){var a=e[t++];switch(u){case 0:s[o++]=i[a>>2],n=(3&a)<<4,u=1;break;case 1:s[o++]=i[n|a>>4],n=(15&a)<<2,u=2;break;case 2:s[o++]=i[n|a>>6],s[o++]=i[63&a],u=0}}return u&&(s[o++]=i[n],s[o]=61,1===u&&(s[o+1]=61)),String.fromCharCode.apply(String,s)};var u="invalid encoding";n.decode=function(e,t,r){for(var n,i=r,o=0,a=0;a<e.length;){var f=e.charCodeAt(a++);if(61===f&&o>1)break;if(void 0===(f=s[f]))throw Error(u);switch(o){case 0:n=f,o=1;break;case 1:t[r++]=n<<2|(48&f)>>4,n=f,o=2;break;case 2:t[r++]=(15&n)<<4|(60&f)>>2,n=f,o=3;break;case 3:t[r++]=(3&n)<<6|f,o=0}}if(1===o)throw Error(u);return r-i},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)}},{}],3:[function(e,t,r){"use strict";function n(){function e(){for(var t=[],r=0;r<arguments.length;)t.push(arguments[r++]);var n=i.apply(null,t),l=c;if(h.length){var p=h[h.length-1];s.test(p)?l=++c:a.test(p)&&++l,u.test(p)&&!u.test(n)?(l=++c,d=!0):d&&f.test(p)&&(l=--c,d=!1),o.test(n)&&(l=--c)}for(r=0;r<l;++r)n="\t"+n;return h.push(n),e}function t(e){return"function "+(e?e.replace(/[^\w_$]/g,"_"):"")+"("+l.join(", ")+") {\n"+h.join("\n")+"\n}"}function r(t,r){"object"==typeof t&&(r=t,t=void 0);var i=e.str(t);n.verbose&&console.log("--- codegen ---\n"+i.replace(/^/gm,"> ").replace(/\t/g," "));var s=Object.keys(r||(r={}));return Function.apply(null,s.concat("return "+i)).apply(null,s.map(function(e){return r[e]}))}for(var l=[],h=[],c=1,d=!1,p=0;p<arguments.length;)l.push(arguments[p++]);return e.str=t,e.eof=r,e}function i(e){for(var t=[],r=1;r<arguments.length;)t.push(arguments[r++]);return r=0,e.replace(/%([djs])/g,function(e,n){var i=t[r++];switch(n){case"j":return JSON.stringify(i);default:return String(i)}})}t.exports=n;var s=/[{[]$/,o=/^[}\]]/,u=/:$/,a=/^\s*(?:if|}?else if|while|for)\b|\b(?:else)\s*$/,f=/\b(?:break|continue);?$|^\s*return\b/;n.sprintf=i,n.supported=!1;try{n.supported=1===n("a","b")("return a-b").eof()(2,1)}catch(e){}n.verbose=!1},{}],4:[function(e,t,r){"use strict";function n(){this.a={}}t.exports=n;var i=n.prototype;i.on=function(e,t,r){return(this.a[e]||(this.a[e]=[])).push({fn:t,ctx:r||this}),this},i.off=function(e,t){if(void 0===e)this.a={};else if(void 0===t)this.a[e]=[];else for(var r=this.a[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},i.emit=function(e){var t=this.a[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},{}],5:[function(e,t,r){"use strict";function n(e){for(var t=Object.keys(this),r=0;r<t.length;++r)e[t[r]]=this[t[r]];var n=e.prototype=Object.create(this.prototype);return n.constructor=e,n}t.exports=n},{}],6:[function(e,t,r){"use strict";function n(e,t){return t?u&&u.readFile?u.readFile(e,"utf8",function(r,n){return r&&"undefined"!=typeof XMLHttpRequest?i(e,t):t(r,n)}):i(e,t):s(n,this,e)}function i(e,t){var r=new XMLHttpRequest;r.onreadystatechange=function(){return 4===r.readyState?0===r.status||200===r.status?t(null,r.responseText):t(Error("status "+r.status)):void 0},r.open("GET",e),r.send()}t.exports=n;var s=e(1),o=e(7),u=o("fs")},{1:1,7:7}],7:[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},{}],8:[function(e,t,r){"use strict";var n=r,i=n.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},s=n.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var t=e.split("/"),r=i(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return n+t.join("/")};n.resolve=function(e,t,r){return r||(t=s(t)),i(t)?t:(r||(e=s(e)),(e=e.replace(/(?:\/|^)[^\/]+$/,"")).length?s(e+"/"+t):t)}},{}],9:[function(e,t,r){"use strict";function n(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var u=t.call(s,o,o+=r);return 7&o&&(o=(7|o)+1),u}}t.exports=n},{}],10:[function(e,t,r){"use strict";var n=r;n.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},n.read=function(e,t,r){var n=r-t;if(n<1)return"";for(var i,s=null,o=[],u=0;t<r;)i=e[t++],i<128?o[u++]=i:i>191&&i<224?o[u++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[u++]=55296+(i>>10),o[u++]=56320+(1023&i)):o[u++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0);return s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):u?String.fromCharCode.apply(String,o.slice(0,u)):""},n.write=function(e,t,r){for(var n,i,s=r,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}},{}],11:[function(e,t,r){"use strict";function n(e){return i(e)}function i(t,r){if(s||(s=e(33)),!(t instanceof s))throw TypeError("type must be a Type");if(r){if("function"!=typeof r)throw TypeError("ctor must be a function")}else r=function(e){return function(t){e.call(this,t)}}(o);r.constructor=n;var i=r.prototype=new o;return i.constructor=r,u.merge(r,o,!0),r.$type=t,i.$type=t,t.fieldsArray.forEach(function(e){i[e.name]=Array.isArray(e.resolve().defaultValue)?u.emptyArray:u.isObject(e.defaultValue)&&!e.long?u.emptyObject:e.defaultValue}),t.oneofsArray.forEach(function(e){Object.defineProperty(i,e.resolve().name,{get:function(){for(var t=Object.keys(this),r=t.length-1;r>-1;--r)if(e.oneof.indexOf(t[r])>-1)return t[r]},set:function(t){for(var r=e.oneof,n=0;n<r.length;++n)r[n]!==t&&delete this[r[n]]}})}),t.ctor=r,i}t.exports=n;var s,o=e(20),u=e(35);n.create=i,n.prototype=o},{20:20,33:33,35:35}],12:[function(e,t,r){"use strict";function n(e,t){/\/|\./.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}t.exports=n,n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var i;n("duration",{Duration:i={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:i}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}})},{}],13:[function(e,t,r){"use strict";function n(e,t,r){if(e.resolvedType)return e.resolvedType instanceof s?a("f.enums(s%s,%d,types[%d].values,o)",r,0,t):a("types[%d].convert(s%s,f,o)",t,r);switch(e.type){case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":return a("f.longs(s%s,%d,%d,%j,o)",r,0,0,"u"===e.type.charAt(0));case"bytes":return a("f.bytes(s%s,%j,o)",r,Array.prototype.slice.call(e.defaultValue))}return null}function i(e){var t=e.fieldsArray,r=u.codegen("s","f","o")("if(!o)")("o={}")("var d=f.create(s,this,o)");if(t.length){r("if(d){");var i;t.forEach(function(e,t){var s=u.safeProp(e.resolve().name);e.repeated?(r("if(s%s&&s%s.length){",s,s)("d%s=[]",s)("for(var i=0;i<s%s.length;++i)",s),(i=n(e,t,s+"[i]"))?r("d%s.push(%s)",s,i):r("d%s.push(s%s[i])",s,s),r("}else if(o.defaults||o.arrays)")("d%s=[]",s)):(i=n(e,t,s))?r("d%s=%s",s,i):r("if(d%s===undefined&&o.defaults)",s)("d%s=%j",s,e.defaultValue)}),r("}")}return r("return d")}t.exports=i;var s=e(17),o=e(14),u=e(35),a=u.codegen.sprintf;u.merge(i,o)},{14:14,17:17,35:35}],14:[function(e,t,r){"use strict";var n=r,i=e(37);n.json={create:function(e,t,r){return e?r.fieldsOnly?{}:i.merge({},e):null},enums:function(e,t,r,n){if(n.defaults)void 0===e&&(e=t);else if(void 0===e||e===t)return;return n.enums===String&&"number"==typeof e?r[e]:e},longs:function(e,t,r,n,s){if(e){if(!i.longNe(e,t,r)&&!s.defaults)return}else{if(!s.defaults)return;e={low:t,high:r}}return s.longs===Number?"number"==typeof e?e:i.LongBits.from(e).toNumber(n):s.longs===String?"number"==typeof e?i.Long.fromNumber(e,n).toString():(e=i.Long.fromValue(e),e.unsigned=n,e.toString()):e},bytes:function(e,t,r){if(e){if(!e.length&&!r.defaults)return}else{if(!r.defaults)return;e=t}return r.bytes===String?i.base64.encode(e,0,e.length):r.bytes===Array?Array.prototype.slice.call(e):r.bytes!==i.Buffer||i.Buffer.isBuffer(e)?e:i.Buffer.from(e)}},n.message={create:function(e,t,r){return e?new(t.ctor?t.ctor:t)(r.fieldsOnly?void 0:e):null},enums:function(e,t,r){return"string"==typeof e?r[e]:0|e},longs:function(e,t,r,n){return"string"==typeof e?i.Long.fromString(e,n):"number"==typeof e?i.Long.fromNumber(e,n):e},bytes:function(e){if(i.Buffer)return i.Buffer.isBuffer(e)?e:i.Buffer.from(e,"base64");if("string"==typeof e){var t=i.newBuffer(i.base64.length(e));return i.base64.decode(e,t,0),t}return e instanceof i.Array?e:new i.Array(e)}}},{37:37}],15:[function(e,t,r){"use strict";function n(e){var t=e.fieldsArray,r=o.codegen("r","l")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new(this.ctor)")("while(r.pos<c){")("var t=r.uint32()");e.group&&r("if((t&7)===4)")("break"),r("switch(t>>>3){");for(var n=0;n<t.length;++n){var u=t[n].resolve(),a=u.resolvedType instanceof i?"uint32":u.type,f="m"+o.safeProp(u.name);if(r("case %d:",u.id),u.map){var l=u.resolvedKeyType?"uint32":u.keyType;r("r.skip().pos++")("if(%s===util.emptyObject)",f)("%s={}",f)("var k=r.%s()",l)('if(typeof k==="object")')("k=util.longToHash(k)")("r.pos++"),void 0===s.basic[a]?r("%s[k]=types[%d].decode(r,r.uint32())",f,n):r("%s[k]=r.%s()",f,a)}else u.repeated?(r("if(!(%s&&%s.length))",f,f)("%s=[]",f),u.packed&&void 0!==s.packed[a]&&r("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",f,a)("}else"),void 0===s.basic[a]?r(u.resolvedType.group?"%s.push(types[%d].decode(r))":"%s.push(types[%d].decode(r,r.uint32()))",f,n):r("%s.push(r.%s())",f,a)):void 0===s.basic[a]?r(u.resolvedType.group?"%s=types[%d].decode(r)":"%s=types[%d].decode(r,r.uint32())",f,n):r("%s=r.%s()",f,a);r("break")}return r("default:")("r.skipType(t&7)")("break")("}")("}")("return m")}t.exports=n;var i=e(17),s=e(34),o=e(35)},{17:17,34:34,35:35}],16:[function(e,t,r){"use strict";function n(e,t,r,n){return t.resolvedType.group?e("types[%d].encode(%s,w.uint32(%d)).uint32(%d)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%d].encode(%s,w.uint32(%d).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}function i(e){for(var t,r,i=e.fieldsArray,a=e.oneofsArray,f=u.codegen("m","w")("if(!w)")("w=Writer.create()"),t=0;t<i.length;++t){var l=i[t].resolve(),h=l.resolvedType instanceof s?"uint32":l.type,c=o.basic[h];if(r="m"+u.safeProp(l.name),l.map){var d=l.resolvedKeyType?"uint32":l.keyType;f("if(%s&&%s!==util.emptyObject){",r,r)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",r)("w.uint32(%d).fork().uint32(%d).%s(ks[i])",(l.id<<3|2)>>>0,8|o.mapKey[d],d),void 0===c?f("types[%d].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",t,r):f(".uint32(%d).%s(%s[ks[i]]).ldelim()",16|c,h,r),f("}")("}")}else l.repeated?l.packed&&void 0!==o.packed[h]?f("if(%s&&%s.length){",r,r)("w.uint32(%d).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",r)("w.%s(%s[i])",h,r)("w.ldelim()",l.id)("}"):(f("if(%s){",r)("for(var i=0;i<%s.length;++i)",r),void 0===c?n(f,l,t,r+"[i]"):f("w.uint32(%d).%s(%s[i])",(l.id<<3|c)>>>0,h,r),f("}")):l.partOf||(l.required||(l.long?f("if(%s!==undefined&&%s!==null&&util.longNe(%s,%d,%d))",r,r,r,l.defaultValue.low,l.defaultValue.high):l.bytes?f("if(%s&&%s.length"+(l.defaultValue.length?"&&util.arrayNe(%s,%j)":"")+")",r,r,r,Array.prototype.slice.call(l.defaultValue)):f("if(%s!==undefined&&%s!==%j)",r,r,l.defaultValue)),void 0===c?n(f,l,t,r):f("w.uint32(%d).%s(%s)",(l.id<<3|c)>>>0,h,r))}for(var t=0;t<a.length;++t){var p=a[t];f("switch(%s){","m"+u.safeProp(p.name));for(var v=p.fieldsArray,y=0;y<v.length;++y){var l=v[y],h=l.resolvedType instanceof s?"uint32":l.type,c=o.basic[h];r="m"+u.safeProp(l.name),f("case%j:",l.name),void 0===c?n(f,l,i.indexOf(l),r):f("w.uint32(%d).%s(%s)",(l.id<<3|c)>>>0,h,r),f("break;")}f("}")}return f("return w")}t.exports=i;var s=e(17),o=e(34),u=e(35)},{17:17,34:34,35:35}],17:[function(e,t,r){"use strict";function n(e,t,r){i.call(this,e,r),this.valuesById={},this.values=Object.create(this.valuesById);var n=this;Object.keys(t||{}).forEach(function(e){var r;"number"==typeof t[e]?r=t[e]:(r=parseInt(e,10),e=t[e]),n.valuesById[n.values[e]=r]=e})}t.exports=n;var i=e(23),s=i.extend(n);n.className="Enum";var o=e(35);n.testJSON=function(e){return Boolean(e&&e.values)},n.fromJSON=function(e,t){return new n(e,t.values,t.options)},s.toJSON=function(){return{options:this.options,values:this.values}},s.add=function(e,t){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(void 0!==this.valuesById[t])throw Error("duplicate id "+t+" in "+this);return this.valuesById[this.values[e]=t]=e,this},s.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(void 0===t)throw Error("'"+e+"' is not a name of "+this);return delete this.valuesById[t],delete this.values[e],this}},{23:23,35:35}],18:[function(e,t,r){"use strict";function n(e,t,r,n,s,o){if(l.isObject(n)?(o=n,n=s=void 0):l.isObject(s)&&(o=s,s=void 0),i.call(this,e,o),!l.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!l.isString(r))throw TypeError("type must be a string");if(void 0!==s&&!l.isString(s))throw TypeError("extend must be a string");if(void 0!==n&&!/^required|optional|repeated$/.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.defaultValue=null,this.long=!!l.Long&&void 0!==f.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.b=null}t.exports=n;var i=e(23),s=i.extend(n);n.className="Field";var o,u,a=e(17),f=e(34),l=e(35);Object.defineProperties(s,{packed:{get:function(){return null===this.b&&(this.b=this.getOption("packed")!==!1),this.b}}}),s.setOption=function(e,t,r){return"packed"===e&&(this.b=null),i.prototype.setOption.call(this,e,t,r)},n.testJSON=function(e){return Boolean(e&&void 0!==e.id)},n.fromJSON=function(t,r){return void 0!==r.keyType?(u||(u=e(19)),u.fromJSON(t,r)):new n(t,r.id,r.type,r.rule,r.extend,r.options)},s.toJSON=function(){return{rule:"optional"!==this.rule&&this.rule||void 0,type:this.type,id:this.id,extend:this.extend,options:this.options}},s.resolve=function(){if(this.resolved)return this;var t=f.defaults[this.type];if(void 0===t)if(o||(o=e(33)),this.resolvedType=this.parent.lookup(this.type,o))t=null;else{if(!(this.resolvedType=this.parent.lookup(this.type,a)))throw Error("unresolvable field type: "+this.type);t=0}if(this.map)this.defaultValue={};else if(this.repeated)this.defaultValue=[];else if(this.options&&void 0!==this.options.default?(this.defaultValue=this.options.default,this.resolvedType instanceof a&&"string"==typeof this.defaultValue&&(this.defaultValue=this.resolvedType.values[this.defaultValue]||0)):this.defaultValue=t,this.long)this.defaultValue=l.Long.fromNumber(this.defaultValue,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.defaultValue);else if(this.bytes&&"string"==typeof this.defaultValue){var r;l.base64.test(this.defaultValue)?l.base64.decode(this.defaultValue,r=l.newBuffer(l.base64.length(this.defaultValue)),0):l.utf8.write(this.defaultValue,r=l.newBuffer(l.utf8.length(this.defaultValue)),0),this.defaultValue=r}return i.prototype.resolve.call(this)}},{17:17,19:19,23:23,33:33,34:34,35:35}],19:[function(e,t,r){"use strict";function n(e,t,r,n,s){if(i.call(this,e,t,n,s),!a.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}t.exports=n;var i=e(18),s=i.prototype,o=i.extend(n);n.className="MapField";var u=e(34),a=e(35);n.testJSON=function(e){return i.testJSON(e)&&void 0!==e.keyType},n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options)},o.toJSON=function(){return{keyType:this.keyType,type:this.type,id:this.id,extend:this.extend,options:this.options}},o.resolve=function(){if(this.resolved)return this;if(void 0===u.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return s.resolve.call(this)}},{18:18,34:34,35:35}],20:[function(e,t,r){"use strict";function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}t.exports=n;var i=e(14),s=n.prototype;s.asJSON=function(e){return this.$type.convert(this,i.json,e)},n.from=function(e,t){return this.$type.convert(e,i.message,t)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.convert=function(e,t,r){return this.$type.convert(e,t,r)}},{14:14}],21:[function(e,t,r){"use strict";function n(e,t,r,n,s,o,a){if(u.isObject(s)?(a=s,s=o=void 0):u.isObject(o)&&(a=o,o=void 0),t&&!u.isString(t))throw TypeError("type must be a string");if(!u.isString(r))throw TypeError("requestType must be a string");if(!u.isString(n))throw TypeError("responseType must be a string");i.call(this,e,a),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=n,this.responseStream=!!o||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null}t.exports=n;var i=e(23),s=i.extend(n);n.className="Method";var o=e(33),u=e(35);n.testJSON=function(e){return Boolean(e&&void 0!==e.requestType)},n.fromJSON=function(e,t){return new n(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options)},s.toJSON=function(){return{type:"rpc"!==this.type&&this.type||void 0,requestType:this.requestType,requestStream:this.requestStream||void 0,responseType:this.responseType,responseStream:this.responseStream||void 0,options:this.options}},s.resolve=function(){if(this.resolved)return this;if(!(this.resolvedRequestType=this.parent.lookup(this.requestType,o)))throw Error("unresolvable request type: "+this.requestType);if(!(this.resolvedResponseType=this.parent.lookup(this.responseType,o)))throw Error("unresolvable response type: "+this.requestType);return i.prototype.resolve.call(this)}},{23:23,33:33,35:35}],22:[function(e,t,r){"use strict";function n(){f||(f=e(33)),l||(l=e(31)),h=[d,f,l,p,i],c="one of "+h.map(function(e){return e.name}).join(", ")}function i(e,t){u.call(this,e,t),this.nested=void 0,this.c=null,this.d=[]}function s(e){e.c=null;for(var t=0;t<e.d.length;++t)delete e[e.d[t]];return e.d=[],e}function o(e){if(e&&e.length){for(var t={},r=0;r<e.length;++r)t[e[r].name]=e[r].toJSON();return t}}t.exports=i;var u=e(23),a=u.extend(i);i.className="Namespace";var f,l,h,c,d=e(17),p=e(18),v=e(35);Object.defineProperties(a,{nestedArray:{get:function(){return this.c||(this.c=v.toArray(this.nested))}}}),i.testJSON=function(e){return Boolean(e&&!e.fields&&!e.values&&void 0===e.id&&!e.oneof&&!e.methods&&void 0===e.requestType)},i.fromJSON=function(e,t){return new i(e,t.options).addJSON(t.nested)},a.toJSON=function(){return{options:this.options,nested:o(this.nestedArray)}},i.arrayToJSON=o,a.addJSON=function(e){var t=this;return e&&(h||n(),Object.keys(e).forEach(function(r){for(var n=e[r],i=0;i<h.length;++i)if(h[i].testJSON(n))return t.add(h[i].fromJSON(r,n));throw TypeError("nested."+r+" must be JSON for "+c)})),this},a.get=function(e){return void 0===this.nested?null:this.nested[e]||null},a.getEnum=function(e){if(this.nested&&this.nested[e]instanceof d)return this.nested[e].values;throw Error("no such enum")},a.add=function(e){if(h||n(),!e||h.indexOf(e.constructor)<0)throw TypeError("object must be "+c);if(e instanceof p&&void 0===e.extend)throw TypeError("object must be an extension field when not part of a type");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof i&&e instanceof i)||t instanceof f||t instanceof l)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,o=0;o<r.length;++o)e.add(r[o]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),s(this)},a.remove=function(e){if(!(e instanceof u))throw TypeError("object must be a ReflectionObject");if(e.parent!==this||!this.nested)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),s(this)},a.define=function(e,t){v.isString(e)?e=e.split("."):Array.isArray(e)||(t=e,e=void 0);var r=this;if(e)for(;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(r=r.nested[n],!(r instanceof i))throw Error("path conflicts with non-namespace objects")}else r.add(r=new i(n))}return t&&r.addJSON(t),r},a.resolve=function(){f||(f=e(33)),l||(f=e(31));for(var t=this.nestedArray,r=0;r<t.length;++r)if(/^[A-Z]/.test(t[r].name)){if(t[r]instanceof f||t[r]instanceof l)this[t[r].name]=t[r];else{if(!(t[r]instanceof d))continue;this[t[r].name]=t[r].values}this.d.push(t[r].name)}return u.prototype.resolve.call(this)},a.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof i?e[t++].resolveAll():e[t++].resolve();return a.resolve.call(this)},a.lookup=function(e,t,r){if("boolean"==typeof t&&(r=t,t=void 0),v.isString(e)&&e.length)e=e.split(".");else if(!e.length)return null;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);return n&&1===e.length&&(!t||n instanceof t)||n instanceof i&&(n=n.lookup(e.slice(1),t,!0))?n:null===this.parent||r?null:this.parent.lookup(e,t)},a.lookupType=function(t){f||(f=e(33));var r=this.lookup(t,f);if(!r)throw Error("no such type");return r},a.lookupService=function(t){l||(l=e(31));var r=this.lookup(t,l);if(!r)throw Error("no such service");return r},a.lookupEnum=function(e){var t=this.lookup(e,d);if(!t)throw Error("no such enum");return t.values}},{17:17,18:18,23:23,31:31,33:33,35:35}],23:[function(e,t,r){"use strict";function n(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1}t.exports=n;var i=e(35);n.className="ReflectionObject",n.extend=i.extend;var s,o=n.prototype;Object.defineProperties(o,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.toJSON=function(){throw Error()},o.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var r=t.root;s||(s=e(28)),r instanceof s&&r.e(this)},o.onRemove=function(t){var r=t.root;s||(s=e(28)),r instanceof s&&r.f(this),this.parent=null,this.resolved=!1},o.resolve=function(){return this.resolved?this:(s||(s=e(28)),this.root instanceof s&&(this.resolved=!0),this)},o.getOption=function(e){if(this.options)return this.options[e]},o.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.setOptions=function(e,t){return e&&Object.keys(e).forEach(function(r){this.setOption(r,e[r],t)},this),this},o.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e}},{28:28,35:35}],24:[function(e,t,r){"use strict";function n(e,t,r){if(Array.isArray(t)||(r=t,t=void 0),s.call(this,e,r),t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.g=[]}function i(e){e.parent&&e.g.forEach(function(t){t.parent||e.parent.add(t)})}t.exports=n;var s=e(23),o=s.extend(n);n.className="OneOf";var u=e(18);Object.defineProperty(o,"fieldsArray",{get:function(){return this.g}}),n.testJSON=function(e){return Boolean(e.oneof)},n.fromJSON=function(e,t){return new n(e,t.oneof,t.options)},o.toJSON=function(){return{oneof:this.oneof,options:this.options}},o.add=function(e){if(!(e instanceof u))throw TypeError("field must be a Field");return e.parent&&e.parent.remove(e),this.oneof.push(e.name),this.g.push(e),e.partOf=this,i(this),this},o.remove=function(e){if(!(e instanceof u))throw TypeError("field must be a Field");var t=this.g.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.g.splice(t,1),t=this.oneof.indexOf(e.name),t>-1&&this.oneof.splice(t,1),e.parent&&e.parent.remove(e),e.partOf=null,this},o.onAdd=function(e){s.prototype.onAdd.call(this,e);var t=this;this.oneof.forEach(function(r){var n=e.get(r);n&&!n.partOf&&(n.partOf=t,t.g.push(n))}),i(this)},o.onRemove=function(e){this.g.forEach(function(e){e.parent&&e.parent.remove(e)}),s.prototype.onRemove.call(this,e)}},{18:18,23:23}],25:[function(e,t,r){"use strict";function n(e){return/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(e)}function i(e){return/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/.test(e)}function s(e){return/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/.test(e)}function o(e){return null===e?null:e.toLowerCase()}function u(e){return e.substring(0,1)+e.substring(1).replace(/_([a-z])(?=[a-z]|$)/g,function(e,t){return t.toUpperCase()})}function a(e,t,r){function w(e,t){var r=a.filename;return a.filename=null,Error("illegal "+(t||"token")+" '"+e+"' ("+(r?r+", ":"")+"line "+K.line()+")")}function k(){var e,t=[];do{if('"'!==(e=W())&&"'"!==e)throw w(e);t.push(W()),Q(e),e=G()}while('"'===e||"'"===e);return t.join("")}function x(e){var t=W();switch(o(t)){case"'":case'"':return X(t),k();case"true":return!0;case"false":return!1}try{return A(t)}catch(r){if(e&&i(t))return t;throw w(t,"value")}}function O(){var e=N(W()),t=e;return Q("to",!0)&&(t=N(W())),Q(";"),[e,t]}function A(e){var t=1;"-"===e.charAt(0)&&(t=-1,e=e.substring(1));var r=o(e);switch(r){case"inf":return t*(1/0);case"nan":return NaN;case"0":return 0}if(/^[1-9][0-9]*$/.test(e))return t*parseInt(e,10);if(/^0[x][0-9a-f]+$/.test(r))return t*parseInt(e,16);if(/^0[0-7]+$/.test(e))return t*parseInt(e,8);if(/^(?!e)[0-9]*(?:\.[0-9]*)?(?:[e][+-]?[0-9]+)?$/.test(r))return t*parseFloat(e);throw w(e,"number")}function N(e,t){var r=o(e);switch(r){case"max":return 536870911;case"0":return 0}if("-"===e.charAt(0)&&!t)throw w(e,"id");if(/^-?[1-9][0-9]*$/.test(e))return parseInt(e,10);if(/^-?0[x][0-9a-f]+$/.test(r))return parseInt(e,16);if(/^-?0[0-7]+$/.test(e))return parseInt(e,8);throw w(e,"id")}function S(){if(void 0!==D)throw w("package");if(D=W(),!i(D))throw w(D,"name");re=re.define(D),Q(";")}function T(){var e,t=G();switch(t){case"weak":e=H||(H=[]),W();break;case"public":W();default:e=_||(_=[])}t=k(),Q(";"),e.push(t)}function j(){if(Q("="),Z=o(k()),ee="proto3"===Z,!ee&&"proto2"!==Z)throw w(Z,"syntax");Q(";")}function E(e,t){switch(t){case"option":return F(e,t),Q(";"),!0;case"message":return V(e,t),!0;case"enum":return z(e,t),!0;case"service":return M(e,t),!0;case"extend":return U(e,t),!0}return!1}function V(e,t){var r=W();if(!n(r))throw w(r,"type name");var s=new h(r);if(Q("{",!0)){for(;"}"!==(t=W());){var u=o(t);if(!E(s,t))switch(u){case"map":L(s,u);break;case"required":case"optional":case"repeated":B(s,u);break;case"oneof":q(s,u);break;case"extensions":(s.extensions||(s.extensions=[])).push(O(s,u));break;case"reserved":(s.reserved||(s.reserved=[])).push(O(s,u));break;default:if(!ee||!i(t))throw w(t);X(t),B(s,"optional")}}Q(";",!0)}else Q(";");e.add(s)}function B(e,t,r){var s=W();if("group"===o(s))return void J(e,t);if(!i(s))throw w(s,"type");var u=W();if(!n(u))throw w(u,"name");u=ne(u),Q("=");var a=N(W()),f=C(new c(u,a,s,t,r));f.repeated&&void 0!==g.packed[s]&&!ee&&f.setOption("packed",!1,!0),e.add(f)}function J(e,t){var r=W();if(!n(r))throw w(r,"name");var i=b.lcFirst(r);r===i&&(r=b.ucFirst(r)),Q("=");var s=N(W()),u=new h(r);u.group=!0;var a=new c(i,s,r,t);for(Q("{");"}"!==(te=W());)switch(te=o(te)){case"option":F(u,te),Q(";");break;case"required":case"optional":case"repeated":B(u,te);break;default:throw w(te)}Q(";",!0),e.add(u).add(a)}function L(e){Q("<");var t=W();if(void 0===g.mapKey[t])throw w(t,"type");Q(",");var r=W();if(!i(r))throw w(r,"type");Q(">");var s=W();if(!n(s))throw w(s,"name");s=ne(s),Q("=");var o=N(W()),u=C(new d(s,o,t,r));e.add(u)}function q(e,t){var r=W();if(!n(r))throw w(r,"name");r=ne(r);var i=new p(r);if(Q("{",!0)){for(;"}"!==(t=W());)"option"===t?(F(i,t),Q(";")):(X(t),B(i,"optional"));Q(";",!0)}else Q(";");e.add(i)}function z(e,t){var r=W();if(!n(r))throw w(r,"name");var i=new v(r);if(Q("{",!0)){for(;"}"!==(t=W());)"option"===o(t)?(F(i,t),Q(";")):$(i,t);Q(";",!0)}else Q(";");e.add(i)}function $(e,t){if(!n(t))throw w(t,"name");var r=t;Q("=");var i=N(W(),!0);e.add(r,i),C({})}function F(e,t){var r=Q("(",!0),n=W();if(!i(n))throw w(n,"name");r&&(Q(")"),n="("+n+")",t=G(),s(t)&&(n+=t,W())),Q("="),I(e,n)}function I(e,t){if(Q("{",!0))for(;"}"!==(te=W());){if(!n(te))throw w(te,"name");t=t+"."+te,Q(":",!0)?R(e,t,x(!0)):I(e,t)}else R(e,t,x(!0))}function R(e,t,r){e.setOption?e.setOption(t,r):e[t]=r}function C(e){if(Q("[",!0)){do F(e,"option");while(Q(",",!0));Q("]")}return Q(";"),e}function M(e,t){if(t=W(),!n(t))throw w(t,"service name");var r=t,i=new y(r);if(Q("{",!0)){for(;"}"!==(t=W());){var s=o(t);switch(s){case"option":F(i,s),Q(";");break;case"rpc":P(i,s);break;default:throw w(t)}}Q(";",!0)}else Q(";");e.add(i)}function P(e,t){var r=t,s=W();if(!n(s))throw w(s,"name");var u,a,f,l;Q("(");var h;if(Q(h="stream",!0)&&(a=!0),!i(t=W()))throw w(t);if(u=t,Q(")"),Q("returns"),Q("("),Q(h,!0)&&(l=!0),!i(t=W()))throw w(t);f=t,Q(")");var c=new m(s,r,u,f,a,l);if(Q("{",!0)){for(;"}"!==(t=W());){var d=o(t);switch(d){case"option":F(c,d),Q(";");break;default:throw w(t)}}Q(";",!0)}else Q(";");e.add(c)}function U(e,t){var r=W();if(!i(r))throw w(r,"reference");if(Q("{",!0)){for(;"}"!==(t=W());){ | ||
var n=o(t);switch(n){case"required":case"repeated":case"optional":B(e,n,r);break;default:if(!ee||!i(t))throw w(t);X(t),B(e,"optional",r)}}Q(";",!0)}else Q(";")}t instanceof l||(r=t,t=new l),r||(r=a.defaults);var D,_,H,Z,K=f(e),W=K.next,X=K.push,G=K.peek,Q=K.skip,Y=!0,ee=!1;t||(t=new l);for(var te,re=t,ne=r.keepCase?function(e){return e}:u;null!==(te=W());){var ie=o(te);switch(ie){case"package":if(!Y)throw w(te);S();break;case"import":if(!Y)throw w(te);T();break;case"syntax":if(!Y)throw w(te);j();break;case"option":if(!Y)throw w(te);F(re,te),Q(";");break;default:if(E(re,te)){Y=!1;continue}throw w(te)}}return a.filename=null,{package:D,imports:_,weakImports:H,syntax:Z,root:t}}t.exports=a,a.filename=null,a.defaults={keepCase:!1};var f=e(32),l=e(28),h=e(33),c=e(18),d=e(19),p=e(24),v=e(17),y=e(31),m=e(21),g=e(34),b=e(35)},{17:17,18:18,19:19,21:21,24:24,28:28,31:31,32:32,33:33,34:34,35:35}],26:[function(e,t,r){"use strict";function n(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function i(e){this.buf=e,this.pos=0,this.len=e.length}function s(){var e=new k(0,0),t=0;if(this.len-this.pos>4){for(t=0;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e}else{for(t=0;t<4;++t){if(this.pos>=this.len)throw n(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}if(this.pos>=this.len)throw n(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e}if(this.len-this.pos>4){for(t=0;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(t=0;t<5;++t){if(this.pos>=this.len)throw n(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function o(){return s.call(this).toLong()}function u(){return s.call(this).toNumber()}function a(){return s.call(this).toLong(!0)}function f(){return s.call(this).toNumber(!0)}function l(){return s.call(this).zzDecode().toLong()}function h(){return s.call(this).zzDecode().toNumber()}function c(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw n(this,8);return new k(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}function p(){return d.call(this).toLong(!0)}function v(){return d.call(this).toNumber(!0)}function y(){return d.call(this).zzDecode().toLong()}function m(){return d.call(this).zzDecode().toNumber()}function g(){w.Long?(O.int64=o,O.uint64=a,O.sint64=l,O.fixed64=p,O.sfixed64=y):(O.int64=u,O.uint64=f,O.sint64=h,O.fixed64=v,O.sfixed64=m)}t.exports=i;var b,w=e(37),k=w.LongBits,x=w.utf8;i.create=w.Buffer?function(t){return b||(b=e(27)),(i.create=function(e){return w.Buffer.isBuffer(e)?new b(e):new i(e)})(t)}:function(e){return new i(e)};var O=i.prototype;O.h=w.Array.prototype.subarray||w.Array.prototype.slice,O.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,n(this,10);return e}}(),O.int32=function(){return 0|this.uint32()},O.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},O.bool=function(){return 0!==this.uint32()},O.fixed32=function(){if(this.pos+4>this.len)throw n(this,4);return c(this.buf,this.pos+=4)},O.sfixed32=function(){var e=this.fixed32();return e>>>1^-(1&e)};var A="undefined"!=typeof Float32Array?function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[3]?function(r,n){return t[0]=r[n],t[1]=r[n+1],t[2]=r[n+2],t[3]=r[n+3],e[0]}:function(r,n){return t[3]=r[n],t[2]=r[n+1],t[1]=r[n+2],t[0]=r[n+3],e[0]}}():function(e,t){var r=c(e,t+4),n=2*(r>>31)+1,i=r>>>23&255,s=8388607&r;return 255===i?s?NaN:n*(1/0):0===i?1.401298464324817e-45*n*s:n*Math.pow(2,i-150)*(s+8388608)};O.float=function(){if(this.pos+4>this.len)throw n(this,4);var e=A(this.buf,this.pos);return this.pos+=4,e};var N="undefined"!=typeof Float64Array?function(){var e=new Float64Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[7]?function(r,n){return t[0]=r[n],t[1]=r[n+1],t[2]=r[n+2],t[3]=r[n+3],t[4]=r[n+4],t[5]=r[n+5],t[6]=r[n+6],t[7]=r[n+7],e[0]}:function(r,n){return t[7]=r[n],t[6]=r[n+1],t[5]=r[n+2],t[4]=r[n+3],t[3]=r[n+4],t[2]=r[n+5],t[1]=r[n+6],t[0]=r[n+7],e[0]}}():function(e,t){var r=c(e,t+4),n=c(e,t+8),i=2*(n>>31)+1,s=n>>>20&2047,o=4294967296*(1048575&n)+r;return 2047===s?o?NaN:i*(1/0):0===s?5e-324*i*o:i*Math.pow(2,s-1075)*(o+4503599627370496)};O.double=function(){if(this.pos+8>this.len)throw n(this,4);var e=N(this.buf,this.pos);return this.pos+=8,e},O.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw n(this,e);return this.pos+=e,t===r?new this.buf.constructor(0):this.h.call(this.buf,t,r)},O.string=function(){var e=this.bytes();return x.read(e,0,e.length)},O.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw n(this,e);this.pos+=e}else do if(this.pos>=this.len)throw n(this);while(128&this.buf[this.pos++]);return this},O.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4===(e=7&this.uint32()))break;this.skipType(e)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},i.i=g,g()},{27:27,37:37}],27:[function(e,t,r){"use strict";function n(e){i.call(this,e)}t.exports=n;var i=e(26),s=n.prototype=Object.create(i.prototype);s.constructor=n;var o=e(37);o.Buffer&&(s.h=o.Buffer.prototype.slice),s.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},{26:26,37:37}],28:[function(e,t,r){"use strict";function n(e){o.call(this,"",e),this.deferred=[],this.files=[]}function i(){}function s(e){var t=e.parent.lookup(e.extend);if(t){var r=new l(e.fullName,e.id,e.type,e.rule,(void 0),e.options);return r.declaringField=e,e.extensionField=r,t.add(r),!0}return!1}t.exports=n;var o=e(22),u=o.extend(n);n.className="Root";var a,f,l=e(18),h=e(35);n.fromJSON=function(e,t){return t||(t=new n),t.setOptions(e.options).addJSON(e.nested)},u.resolvePath=h.path.resolve;var c=function(){try{a=e(25),f=e(12)}catch(e){}c=null};u.load=function e(t,r,n){function s(e,t){if(n){var r=n;n=null,r(e,t)}}function o(e,t){try{if(h.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),h.isString(t)){a.filename=e;var n=a(t,l,r);n.imports&&n.imports.forEach(function(t){u(l.resolvePath(e,t))}),n.weakImports&&n.weakImports.forEach(function(t){u(l.resolvePath(e,t),!0)})}else l.setOptions(t.options).addJSON(t.nested)}catch(e){if(d)throw e;return void s(e)}d||p||s(null,l)}function u(e,t){var r=e.lastIndexOf("google/protobuf/");if(r>-1){var i=e.substring(r);i in f&&(e=i)}if(!(l.files.indexOf(e)>-1)){if(l.files.push(e),e in f)return void(d?o(e,f[e]):(++p,setTimeout(function(){--p,o(e,f[e])})));if(d){var u;try{u=h.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||s(e))}o(e,u)}else++p,h.fetch(e,function(r,i){if(--p,n)return r?void(t||s(r)):void o(e,i)})}}c&&c(),"function"==typeof r&&(n=r,r=void 0);var l=this;if(!n)return h.asPromise(e,l,t);var d=n===i,p=0;return h.isString(t)&&(t=[t]),t.forEach(function(e){u(l.resolvePath("",e))}),d?l:void(p||s(null,l))},u.loadSync=function(e,t){return this.load(e,t,i)},u.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)},u.e=function(e){var t=this.deferred.slice();this.deferred=[];for(var r=0;r<t.length;)s(t[r])?t.splice(r,1):++r;if(this.deferred=t,e instanceof l&&void 0!==e.extend&&!e.extensionField&&!s(e)&&this.deferred.indexOf(e)<0)this.deferred.push(e);else if(e instanceof o){var n=e.nestedArray;for(r=0;r<n.length;++r)this.e(n[r])}},u.f=function(e){if(e instanceof l){if(void 0!==e.extend&&!e.extensionField){var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}e.extensionField&&(e.extensionField.parent.remove(e.extensionField),e.extensionField=null)}else if(e instanceof o)for(var r=e.nestedArray,n=0;n<r.length;++n)this.f(r[n])}},{12:12,18:18,22:22,25:25,35:35}],29:[function(e,t,r){"use strict";var n=r;n.Service=e(30)},{30:30}],30:[function(e,t,r){"use strict";function n(e){s.call(this),this.$rpc=e}t.exports=n;var i=e(35),s=i.EventEmitter,o=n.prototype=Object.create(s.prototype);o.constructor=n,o.end=function(e){return this.$rpc&&(e||this.$rpc(null,null,null),this.$rpc=null,this.emit("end").off()),this}},{35:35}],31:[function(e,t,r){"use strict";function n(e,t){s.call(this,e,t),this.methods={},this.j=null}function i(e){return e.j=null,e}t.exports=n;var s=e(22),o=s.prototype,u=s.extend(n);n.className="Service";var a=e(21),f=e(35),l=e(29);Object.defineProperties(u,{methodsArray:{get:function(){return this.j||(this.j=f.toArray(this.methods))}}}),n.testJSON=function(e){return Boolean(e&&e.methods)},n.fromJSON=function(e,t){var r=new n(e,t.options);return t.methods&&Object.keys(t.methods).forEach(function(e){r.add(a.fromJSON(e,t.methods[e]))}),r},u.toJSON=function(){var e=o.toJSON.call(this);return{options:e&&e.options||void 0,methods:s.arrayToJSON(this.methodsArray)||{},nested:e&&e.nested||void 0}},u.get=function(e){return o.get.call(this,e)||this.methods[e]||null},u.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return o.resolve.call(this)},u.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof a?(this.methods[e.name]=e,e.parent=this,i(this)):o.add.call(this,e)},u.remove=function(e){if(e instanceof a){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,i(this)}return o.remove.call(this,e)},u.create=function(e,t,r){var n=new l.Service(e);return this.methodsArray.forEach(function(i){n[f.lcFirst(i.name)]=function(s,o){if(n.$rpc){if(!s)throw TypeError("request must not be null");i.resolve();var u;try{u=(t?i.resolvedRequestType.encodeDelimited(s):i.resolvedRequestType.encode(s)).finish()}catch(e){return void("function"==typeof setImmediate?setImmediate:setTimeout)(function(){o(e)})}e(i,u,function(e,t){if(e)return n.emit("error",e,i),o?o(e):void 0;if(null===t)return void n.end(!0);var s;try{s=r?i.resolvedResponseType.decodeDelimited(t):i.resolvedResponseType.decode(t)}catch(e){return n.emit("error",e,i),o?o("error",e):void 0}return n.emit("data",s,i),o?o(null,s):void 0})}}}),n}},{21:21,22:22,29:29,35:35}],32:[function(e,t,r){"use strict";function n(e){return e.replace(/\\(.?)/g,function(e,t){switch(t){case"\\":case"":return t;case"0":return"\0";default:return t}})}function i(e){function t(e){return Error("illegal "+e+" (line "+p+")")}function r(){var r="'"===y?u:o;r.lastIndex=c-1;var i=r.exec(e);if(!i)throw t("string");return c=r.lastIndex,f(y),y=null,n(i[1])}function i(t){return e.charAt(t)}function a(){if(v.length>0)return v.shift();if(y)return r();var n,o,u;do{if(c===d)return null;for(n=!1;/\s/.test(u=i(c));)if("\n"===u&&++p,++c===d)return null;if("/"===i(c)){if(++c===d)throw t("comment");if("/"===i(c)){for(;"\n"!==i(++c);)if(c===d)return null;++c,++p,n=!0}else{if("*"!==(u=i(c)))return"/";do{if("\n"===u&&++p,++c===d)return null;o=u,u=i(c)}while("*"!==o||"/"!==u);++c,n=!0}}}while(n);if(c===d)return null;var a=c;s.lastIndex=0;var f=s.test(i(a++));if(!f)for(;a<d&&!s.test(i(a));)++a;var l=e.substring(c,c=a);return'"'!==l&&"'"!==l||(y=l),l}function f(e){v.push(e)}function l(){if(!v.length){var e=a();if(null===e)return null;f(e)}return v[0]}function h(e,r){var n=l(),i=n===e;if(i)return a(),!0;if(!r)throw t("token '"+n+"', '"+e+"' expected");return!1}e=e.toString();var c=0,d=e.length,p=1,v=[],y=null;return{line:function(){return p},next:a,peek:l,push:f,skip:h}}t.exports=i;var s=/[\s{}=;:[\],'"()<>]/g,o=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,u=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},{}],33:[function(e,t,r){"use strict";function n(e,t){s.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this.k=null,this.g=null,this.l=null,this.m=null,this.n=null}function i(e){return e.k=e.g=e.m=e.n=null,delete e.encode,delete e.decode,delete e.verify,e}t.exports=n;var s=e(22),o=s.prototype,u=s.extend(n);n.className="Type";var a=e(17),f=e(24),l=e(18),h=e(31),c=e(11),d=e(20),p=e(26),v=e(39),y=e(35),m=e(16),g=e(15),b=e(38),w=e(13);Object.defineProperties(u,{fieldsById:{get:function(){if(this.k)return this.k;this.k={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this.k[n])throw Error("duplicate id "+n+" in "+this);this.k[n]=r}return this.k}},fieldsArray:{get:function(){return this.g||(this.g=y.toArray(this.fields))}},repeatedFieldsArray:{get:function(){return this.l||(this.l=this.fieldsArray.filter(function(e){return e.repeated}))}},oneofsArray:{get:function(){return this.m||(this.m=y.toArray(this.oneofs))}},ctor:{get:function(){return this.n||(this.n=c.create(this).constructor)},set:function(e){if(e&&!(e.prototype instanceof d))throw TypeError("ctor must be a Message constructor");e.from||(e.from=d.from),this.n=e}}}),n.testJSON=function(e){return Boolean(e&&e.fields)};var k=[a,n,l,h];n.fromJSON=function(e,t){var r=new n(e,t.options);return r.extensions=t.extensions,r.reserved=t.reserved,t.fields&&Object.keys(t.fields).forEach(function(e){r.add(l.fromJSON(e,t.fields[e]))}),t.oneofs&&Object.keys(t.oneofs).forEach(function(e){r.add(f.fromJSON(e,t.oneofs[e]))}),t.nested&&Object.keys(t.nested).forEach(function(e){for(var n=t.nested[e],i=0;i<k.length;++i)if(k[i].testJSON(n))return void r.add(k[i].fromJSON(e,n));throw Error("invalid nested object in "+r+": "+e)}),t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),r},u.toJSON=function(){var e=o.toJSON.call(this);return{options:e&&e.options||void 0,oneofs:s.arrayToJSON(this.oneofsArray),fields:s.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}))||{},extensions:this.extensions&&this.extensions.length?this.extensions:void 0,reserved:this.reserved&&this.reserved.length?this.reserved:void 0,group:this.group||void 0,nested:e&&e.nested||void 0}},u.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return o.resolve.call(this)},u.get=function(e){return o.get.call(this,e)||this.fields&&this.fields[e]||this.oneofs&&this.oneofs[e]||null},u.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof l&&void 0===e.extend){if(this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),i(this)}return e instanceof f?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),i(this)):o.add.call(this,e)},u.remove=function(e){if(e instanceof l&&void 0===e.extend){if(this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.message=null,i(this)}return o.remove.call(this,e)},u.create=function(e){return new this.ctor(e)},u.from=function(e,t){return this.convert(e,w.message,t)},u.setup=function(){var e=this.fullName,t=this.fieldsArray.map(function(e){return e.resolve().resolvedType});return this.encode=m(this).eof(e+"$encode",{Writer:v,types:t,util:y}),this.decode=g(this).eof(e+"$decode",{Reader:p,types:t,util:y}),this.verify=b(this).eof(e+"$verify",{types:t,util:y}),this.convert=w(this).eof(e+"$convert",{types:t,util:y}),this},u.encode=function(e,t){return this.setup().encode(e,t)},u.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},u.decode=function(e,t){return this.setup().decode(e,t)},u.decodeDelimited=function(e){return e=e instanceof p?e:p.create(e),this.decode(e,e.uint32())},u.verify=function(e){return this.setup().verify(e)},u.convert=function(e,t,r){return this.setup().convert(e,t,r)}},{11:11,13:13,15:15,16:16,17:17,18:18,20:20,22:22,24:24,26:26,31:31,35:35,38:38,39:39}],34:[function(e,t,r){"use strict";function n(e,t){var r=0,n={};for(t|=0;r<e.length;)n[o[r+t]]=e[r++];return n}var i=r,s=e(35),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes","message"];i.basic=n([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=n([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",s.emptyArray,null]),i.long=n([0,0,0,1,1],7),i.mapKey=n([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=n([1,5,0,0,0,5,5,0,0,0,1,1,0])},{35:35}],35:[function(e,t,r){"use strict";var n=t.exports=e(37);n.asPromise=e(1),n.codegen=e(3),n.EventEmitter=e(4),n.extend=e(5),n.fetch=e(6),n.path=e(8),n.fs=n.inquire("fs"),n.toArray=function(e){return e?Object.values?Object.values(e):Object.keys(e).map(function(t){return e[t]}):[]},n.merge=function(e,t,r){if(t)for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e},n.safeProp=function(e){return'["'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"]'},n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)},n.newBuffer=function(e){return e=e||0,n.Buffer?n.Buffer.allocUnsafe(e):new("undefined"!=typeof Uint8Array?Uint8Array:Array)(e)}},{1:1,3:3,37:37,4:4,5:5,6:6,8:8}],36:[function(e,t,r){"use strict";function n(e,t){this.lo=e,this.hi=t}t.exports=n;var i=e(37),s=n.prototype,o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var u=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if("string"==typeof e){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):o},s.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},s.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===u?o:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},s.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},s.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},s.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},s.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},{37:37}],37:[function(e,t,r){(function(t){"use strict";var n=r;n.base64=e(2),n.inquire=e(7),n.utf8=e(10),n.pool=e(9),n.LongBits=e(36),n.isNode=Boolean(t.process&&t.process.versions&&t.process.versions.node),n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?(e.from||(e.from=function(t,r){return new e(t,r)}),e.allocUnsafe||(e.allocUnsafe=function(t){return new e(t)}),e):null}catch(e){return null}}(),n.Array="undefined"==typeof Uint8Array?Array:Uint8Array,n.Long=t.dcodeIO&&t.dcodeIO.Long||n.inquire("long"),n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.longNe=function(e,t,r){if("object"==typeof e)return e.low!==t||e.high!==r;var i=n.LongBits.from(e);return i.lo!==t||i.hi!==r},n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.arrayNe=function(e,t){if(e.length===t.length)for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,2:2,36:36,7:7,9:9}],38:[function(e,t,r){"use strict";function n(e,t){return e.fullName.substring(1)+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function i(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof u){e("switch(%s){",i)("default:")("return%j",n(t,"enum value"));for(var s=a.toArray(t.resolvedType.values),o=0;o<s.length;++o)e("case %d:",s[o]);e("break")("}")}else e("var e;")("if(e=types[%d].verify(%s))",r,i)("return e");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",n(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",n(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",n(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",n(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",n(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",n(t,"buffer"))}}function s(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))",r)("return%j",n(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9]\\d*))$/.test(%s))",r)("return%j",n(t,"integer|Long key"));break;case"bool":e("if(!/^true|false|0|1$/.test(%s))",r)("return%j",n(t,"boolean key"))}}function o(e){var t=e.fieldsArray;if(!t.length)return a.codegen()("return null");for(var r=a.codegen("m"),o=0;o<t.length;++o){var f=t[o].resolve(),l="m"+a.safeProp(f.name);f.map?(r("if(%s!==undefined){",l)("if(!util.isObject(%s))",l)("return%j",n(f,"object"))("var k=Object.keys(%s)",l)("for(var i=0;i<k.length;++i){"),s(r,f,"k[i]"),i(r,f,o,l+"[k[i]]"),r("}")("}")):f.repeated?(r("if(%s!==undefined){",l)("if(!Array.isArray(%s))",l)("return%j",n(f,"array"))("for(var i=0;i<%s.length;++i){",l),i(r,f,o,l+"[i]"),r("}")("}")):(f.required||(!f.resolvedType||f.resolvedType instanceof u?r("if(%s!==undefined){",l):r("if(%s!==undefined&&%s!==null){",l,l)),i(r,f,o,l),f.required||r("}"))}return r("return null")}t.exports=o;var u=e(17),a=e(35)},{17:17,35:35}],39:[function(e,t,r){"use strict";function n(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function i(){}function s(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function o(){this.len=0,this.head=new n(i,0,0),this.tail=this.head,this.states=null}function u(e,t,r){t[r]=255&e}function a(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e}function f(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function l(e,t,r){t[r++]=255&e,t[r++]=e>>>8&255,t[r++]=e>>>16&255,t[r]=e>>>24}t.exports=o;var h,c=e(37),d=c.LongBits,p=c.base64,v=c.utf8;o.create=c.Buffer?function(){return h||(h=e(40)),(o.create=function(){return new h})()}:function(){return new o},o.alloc=function(e){return new c.Array(e)},c.Array!==Array&&(o.alloc=c.pool(o.alloc,c.Array.prototype.subarray));var y=o.prototype;y.push=function(e,t,r){return this.tail=this.tail.next=new n(e,t,r),this.len+=t,this},y.uint32=function(e){return e>>>=0,this.push(a,e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)},y.int32=function(e){return e<0?this.push(f,10,d.fromNumber(e)):this.uint32(e)},y.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},y.uint64=function(e){var t=d.from(e);return this.push(f,t.length(),t)},y.int64=y.uint64,y.sint64=function(e){var t=d.from(e).zzEncode();return this.push(f,t.length(),t)},y.bool=function(e){return this.push(u,1,e?1:0)},y.fixed32=function(e){return this.push(l,4,e>>>0)},y.sfixed32=function(e){return this.push(l,4,e<<1^e>>31)},y.fixed64=function(e){var t=d.from(e);return this.push(l,4,t.lo).push(l,4,t.hi)},y.sfixed64=function(e){var t=d.from(e).zzEncode();return this.push(l,4,t.lo).push(l,4,t.hi)};var m="undefined"!=typeof Float32Array?function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[3]?function(r,n,i){e[0]=r,n[i++]=t[0],n[i++]=t[1],n[i++]=t[2],n[i]=t[3]}:function(r,n,i){e[0]=r,n[i++]=t[3],n[i++]=t[2],n[i++]=t[1],n[i]=t[0]}}():function(e,t,r){var n=e<0?1:0;if(n&&(e=-e),0===e)l(1/e>0?0:2147483648,t,r);else if(isNaN(e))l(2147483647,t,r);else if(e>3.4028234663852886e38)l((n<<31|2139095040)>>>0,t,r);else if(e<1.1754943508222875e-38)l((n<<31|Math.round(e/1.401298464324817e-45))>>>0,t,r);else{var i=Math.floor(Math.log(e)/Math.LN2),s=8388607&Math.round(e*Math.pow(2,-i)*8388608);l((n<<31|i+127<<23|s)>>>0,t,r)}};y.float=function(e){return this.push(m,4,e)};var g="undefined"!=typeof Float64Array?function(){var e=new Float64Array(1),t=new Uint8Array(e.buffer);return e[0]=-0,t[7]?function(r,n,i){e[0]=r,n[i++]=t[0],n[i++]=t[1],n[i++]=t[2],n[i++]=t[3],n[i++]=t[4],n[i++]=t[5],n[i++]=t[6],n[i]=t[7]}:function(r,n,i){e[0]=r,n[i++]=t[7],n[i++]=t[6],n[i++]=t[5],n[i++]=t[4],n[i++]=t[3],n[i++]=t[2],n[i++]=t[1],n[i]=t[0]}}():function(e,t,r){var n=e<0?1:0;if(n&&(e=-e),0===e)l(0,t,r),l(1/e>0?0:2147483648,t,r+4);else if(isNaN(e))l(4294967295,t,r),l(2147483647,t,r+4);else if(e>1.7976931348623157e308)l(0,t,r),l((n<<31|2146435072)>>>0,t,r+4);else{var i;if(e<2.2250738585072014e-308)i=e/5e-324,l(i>>>0,t,r),l((n<<31|i/4294967296)>>>0,t,r+4);else{var s=Math.floor(Math.log(e)/Math.LN2);1024===s&&(s=1023),i=e*Math.pow(2,-s),l(4503599627370496*i>>>0,t,r),l((n<<31|s+1023<<20|1048576*i&1048575)>>>0,t,r+4)}}};y.double=function(e){return this.push(g,8,e)};var b=c.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};y.bytes=function(e){var t=e.length>>>0;if("string"==typeof e&&t){var r=o.alloc(t=p.length(e));p.decode(e,r,0),e=r}return t?this.uint32(t).push(b,t,e):this.push(u,1,0)},y.string=function(e){var t=v.length(e);return t?this.uint32(t).push(v.write,t,e):this.push(u,1,0)},y.fork=function(){return this.states=new s(this),this.head=this.tail=new n(i,0,0),this.len=0,this},y.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(i,0,0),this.len=0),this},y.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r).tail.next=e.next,this.tail=t,this.len+=r,this},y.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t}},{37:37,40:40}],40:[function(e,t,r){"use strict";function n(){s.call(this)}function i(e,t,r){e.length<40?a.write(e,t,r):t.utf8Write(e,r)}t.exports=n;var s=e(39),o=n.prototype=Object.create(s.prototype);o.constructor=n;var u=e(37),a=u.utf8,f=u.Buffer;n.alloc=function(e){return(n.alloc=f.allocUnsafe)(e)};var l=f&&f.prototype instanceof Uint8Array&&"set"===f.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){e.copy(t,r,0,e.length)};o.bytes=function(e){"string"==typeof e&&(e=f.from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this.push(l,t,e),this},o.string=function(e){var t=f.byteLength(e);return this.uint32(t),t&&this.push(i,t,e),this}},{37:37,39:39}],41:[function(e,t,r){(function(t){"use strict";function n(e,t,r){return"function"==typeof t?(r=t,t=new o.Root):t||(t=new o.Root),t.load(e,r)}function i(e,t){return t||(t=new o.Root),t.loadSync(e)}function s(){o.Reader.i()}var o=t.protobuf=r;o.load=n,o.loadSync=i,o.roots={};try{o.tokenize=e(32),o.parse=e(25),o.common=e(12)}catch(e){}o.Writer=e(39),o.BufferWriter=e(40),o.Reader=e(26),o.BufferReader=e(27),o.encoder=e(16),o.decoder=e(15),o.verifier=e(38),o.converter=e(13),o.ReflectionObject=e(23),o.Namespace=e(22),o.Root=e(28),o.Enum=e(17),o.Type=e(33),o.Field=e(18),o.OneOf=e(24),o.MapField=e(19),o.Service=e(31),o.Method=e(21),o.Class=e(11),o.Message=e(20),o.types=e(34),o.rpc=e(29),o.util=e(35),o.configure=s,"function"==typeof define&&define.amd&&define(["long"],function(e){return e&&(o.util.Long=e,s()),o})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{11:11,12:12,13:13,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,31:31,32:32,33:33,34:34,35:35,38:38,39:39,40:40}]},{},[41]); | ||
//# sourceMappingURL=protobuf.min.js.map |
/*! | ||
* protobuf.js v6.3.1 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 27 Dec 2016 16:55:50 UTC | ||
* protobuf.js v6.4.0 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 03 Jan 2017 15:34:50 UTC | ||
* Licensed under the BSD-3-Clause License | ||
@@ -129,2 +129,11 @@ * see: https://github.com/dcodeIO/protobuf.js for details | ||
/** | ||
* Tests if the specified string appears to be base64 encoded. | ||
* @param {string} string String to test | ||
* @returns {boolean} `true` if probably base64 encoded, otherwise false | ||
*/ | ||
base64.test = function test(string) { | ||
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); | ||
}; | ||
},{}],2:[function(require,module,exports){ | ||
@@ -313,7 +322,8 @@ "use strict"; | ||
protobuf.Writer = require(10); | ||
protobuf.BufferWriter = require(11); | ||
protobuf.Reader = require(6); | ||
protobuf.BufferReader = require(7); | ||
protobuf.util = require(9); | ||
protobuf.Writer = require(11); | ||
protobuf.BufferWriter = require(12); | ||
protobuf.Reader = require(7); | ||
protobuf.BufferReader = require(8); | ||
protobuf.converters = require(6); | ||
protobuf.util = require(10); | ||
protobuf.roots = {}; | ||
@@ -338,7 +348,140 @@ protobuf.configure = configure; | ||
},{"10":10,"11":11,"6":6,"7":7,"9":9}],6:[function(require,module,exports){ | ||
},{"10":10,"11":11,"12":12,"6":6,"7":7,"8":8}],6:[function(require,module,exports){ | ||
"use strict"; | ||
var converters = exports; | ||
var util = require(10); | ||
/** | ||
* JSON conversion options as used by {@link Message#asJSON}. | ||
* @typedef JSONConversionOptions | ||
* @type {Object} | ||
* @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field | ||
* @property {*} [longs] Long conversion type. Only relevant with a long library. | ||
* Valid values are `String` and `Number` (the global types). | ||
* Defaults to a possibly unsafe number without, and a `Long` with a long library. | ||
* @property {*} [enums=Number] Enum value conversion type. | ||
* Valid values are `String` and `Number` (the global types). | ||
* Defaults to the numeric ids. | ||
* @property {*} [bytes] Bytes value conversion type. | ||
* Valid values are `Array` and `String` (the global types). | ||
* Defaults to return the underlying buffer type. | ||
* @property {boolean} [defaults=false] Also sets default values on the resulting object | ||
* @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false` | ||
*/ | ||
/** | ||
* Converter implementation producing JSON. | ||
* @type {ConverterImpl} | ||
*/ | ||
converters.json = { | ||
create: function(value, typeOrCtor, options) { | ||
if (!value) | ||
return null; | ||
return options.fieldsOnly | ||
? {} | ||
: util.merge({}, value); | ||
}, | ||
enums: function(value, defaultValue, values, options) { | ||
if (!options.defaults) { | ||
if (value === undefined || value === defaultValue) | ||
return undefined; | ||
} else if (value === undefined) | ||
value = defaultValue; | ||
return options.enums === String && typeof value === "number" | ||
? values[value] | ||
: value; | ||
}, | ||
longs: function(value, defaultLow, defaultHigh, unsigned, options) { | ||
if (!value) { | ||
if (options.defaults) | ||
value = { low: defaultLow, high: defaultHigh }; | ||
else | ||
return undefined; | ||
} else if (!util.longNe(value, defaultLow, defaultHigh) && !options.defaults) | ||
return undefined; | ||
if (options.longs === Number) | ||
return typeof value === "number" | ||
? value | ||
: util.LongBits.from(value).toNumber(unsigned); | ||
if (options.longs === String) { | ||
if (typeof value === "number") | ||
return util.Long.fromNumber(value, unsigned).toString(); | ||
value = util.Long.fromValue(value); // has no unsigned option | ||
value.unsigned = unsigned; | ||
return value.toString(); | ||
} | ||
return value; | ||
}, | ||
bytes: function(value, defaultValue, options) { | ||
if (!value) { | ||
if (options.defaults) | ||
value = defaultValue; | ||
else | ||
return undefined; | ||
} else if (!value.length && !options.defaults) | ||
return undefined; | ||
return options.bytes === String | ||
? util.base64.encode(value, 0, value.length) | ||
: options.bytes === Array | ||
? Array.prototype.slice.call(value) | ||
: options.bytes === util.Buffer && !util.Buffer.isBuffer(value) | ||
? util.Buffer.from(value) // polyfilled | ||
: value; | ||
} | ||
}; | ||
/** | ||
* Message conversion options as used by {@link Message.from} and {@link Type#from}. | ||
* @typedef MessageConversionOptions | ||
* @type {Object} | ||
* @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field | ||
*/ | ||
// Note that options.defaults and options.arrays also affect the message converter. | ||
// As defaults are already on the prototype, usage is not recommended and thus undocumented. | ||
/** | ||
* Converter implementation producing runtime messages. | ||
* @type {ConverterImpl} | ||
*/ | ||
converters.message = { | ||
create: function(value, typeOrCtor, options) { | ||
if (!value) | ||
return null; | ||
// can't use instanceof Type here because converters are also part of the minimal runtime | ||
return new (typeOrCtor.ctor ? typeOrCtor.ctor : typeOrCtor)(options.fieldsOnly ? undefined : value); | ||
}, | ||
enums: function(value, defaultValue, values) { | ||
if (typeof value === "string") | ||
return values[value]; | ||
return value | 0; | ||
}, | ||
longs: function(value, defaultLow, defaultHigh, unsigned) { | ||
if (typeof value === "string") | ||
return util.Long.fromString(value, unsigned); | ||
if (typeof value === "number") | ||
return util.Long.fromNumber(value, unsigned); | ||
return value; | ||
}, | ||
bytes: function(value/*, defaultValue*/) { | ||
if (util.Buffer) | ||
return util.Buffer.isBuffer(value) | ||
? value | ||
: util.Buffer.from(value, "base64"); // polyfilled | ||
if (typeof value === "string") { | ||
var buf = util.newBuffer(util.base64.length(value)); | ||
util.base64.decode(value, buf, 0); | ||
return buf; | ||
} | ||
return value instanceof util.Array | ||
? value | ||
: new util.Array(value); | ||
} | ||
}; | ||
},{"10":10}],7:[function(require,module,exports){ | ||
"use strict"; | ||
module.exports = Reader; | ||
var util = require(9); | ||
var util = require(10); | ||
@@ -391,5 +534,7 @@ var BufferReader; // cyclic | ||
if (!BufferReader) | ||
BufferReader = require(7); | ||
BufferReader = require(8); | ||
return (Reader.create = function create_buffer(buffer) { | ||
return new BufferReader(buffer); | ||
return util.Buffer.isBuffer(buffer) | ||
? new BufferReader(buffer) | ||
: new Reader(buffer); | ||
})(buffer); | ||
@@ -830,3 +975,3 @@ } | ||
default: | ||
throw Error("invalid wire type: " + wireType); | ||
throw Error("invalid wire type " + wireType + " at offset " + this.pos); | ||
} | ||
@@ -857,7 +1002,7 @@ return this; | ||
},{"7":7,"9":9}],7:[function(require,module,exports){ | ||
},{"10":10,"8":8}],8:[function(require,module,exports){ | ||
"use strict"; | ||
module.exports = BufferReader; | ||
var Reader = require(6); | ||
var Reader = require(7); | ||
/** @alias BufferReader.prototype */ | ||
@@ -867,3 +1012,3 @@ var BufferReaderPrototype = BufferReader.prototype = Object.create(Reader.prototype); | ||
var util = require(9); | ||
var util = require(10); | ||
@@ -892,3 +1037,3 @@ /** | ||
},{"6":6,"9":9}],8:[function(require,module,exports){ | ||
},{"10":10,"7":7}],9:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -898,3 +1043,3 @@ | ||
var util = require(9); | ||
var util = require(10); | ||
@@ -948,2 +1093,9 @@ /** | ||
/** | ||
* Zero hash. | ||
* @memberof util.LongBits | ||
* @type {string} | ||
*/ | ||
var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; | ||
/** | ||
* Constructs new long bits from the specified number. | ||
@@ -956,6 +1108,7 @@ * @param {number} value Value | ||
return zero; | ||
var sign = value < 0; | ||
value = Math.abs(value); | ||
var sign = value < 0; | ||
if (sign) | ||
value = -value; | ||
var lo = value >>> 0, | ||
hi = (value - lo) / 4294967296 >>> 0; | ||
hi = (value - lo) / 4294967296 >>> 0; | ||
if (sign) { | ||
@@ -982,2 +1135,3 @@ hi = ~hi >>> 0; | ||
if (typeof value === "string") { | ||
/* istanbul ignore else */ | ||
if (util.Long) | ||
@@ -998,7 +1152,7 @@ value = util.Long.fromString(value); | ||
if (!unsigned && this.hi >>> 31) { | ||
this.lo = ~this.lo + 1 >>> 0; | ||
this.hi = ~this.hi >>> 0; | ||
if (!this.lo) | ||
this.hi = this.hi + 1 >>> 0; | ||
return -(this.lo + this.hi * 4294967296); | ||
var lo = ~this.lo + 1 >>> 0, | ||
hi = ~this.hi >>> 0; | ||
if (!lo) | ||
hi = hi + 1 >>> 0; | ||
return -(lo + hi * 4294967296); | ||
} | ||
@@ -1016,2 +1170,3 @@ return this.lo + this.hi * 4294967296; | ||
? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) | ||
/* istanbul ignore next */ | ||
: { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; | ||
@@ -1028,2 +1183,4 @@ }; | ||
LongBits.fromHash = function fromHash(hash) { | ||
if (hash === zeroHash) | ||
return zero; | ||
return new LongBits( | ||
@@ -1100,3 +1257,3 @@ ( charCodeAt.call(hash, 0) | ||
},{"9":9}],9:[function(require,module,exports){ | ||
},{"10":10}],10:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -1107,3 +1264,2 @@ "use strict"; | ||
util.LongBits = require(8); | ||
util.base64 = require(1); | ||
@@ -1114,2 +1270,4 @@ util.inquire = require(2); | ||
util.LongBits = require(9); | ||
/** | ||
@@ -1123,9 +1281,2 @@ * Whether running within node or not. | ||
/** | ||
* Whether running within IE8 or not. | ||
* @memberof util | ||
* @type {boolean} | ||
*/ | ||
util.isIE8 = false; try { util.isIE8 = eval("!-[1,]"); } catch (e) {} // eslint-disable-line no-eval, no-empty | ||
/** | ||
* Node's Buffer class if available. | ||
@@ -1206,3 +1357,3 @@ * @type {?function(new: Buffer)} | ||
? util.LongBits.from(value).toHash() | ||
: "\0\0\0\0\0\0\0\0"; | ||
: util.LongBits.zeroHash; | ||
}; | ||
@@ -1224,19 +1375,2 @@ | ||
/** | ||
* Tests if two possibly long values are not equal. | ||
* @param {number|Long} a First value | ||
* @param {number|Long} b Second value | ||
* @returns {boolean} `true` if not equal | ||
* @deprecated Use {@link util.longNe|longNe} instead | ||
*/ | ||
util.longNeq = function longNeq(a, b) { | ||
return typeof a === "number" | ||
? typeof b === "number" | ||
? a !== b | ||
: (a = util.LongBits.fromNumber(a)).lo !== b.low || a.hi !== b.high | ||
: typeof b === "number" | ||
? (b = util.LongBits.fromNumber(b)).lo !== a.low || b.hi !== a.high | ||
: a.low !== b.low || a.high !== b.high; | ||
}; | ||
/** | ||
* Tests if a possibily long value equals the specified low and high bits. | ||
@@ -1256,48 +1390,2 @@ * @param {number|string|Long} val Value to test | ||
/** | ||
* Converts the first character of a string to upper case. | ||
* @param {string} str String to convert | ||
* @returns {string} Converted string | ||
*/ | ||
util.ucFirst = function ucFirst(str) { // lcFirst counterpart is in core util | ||
return str.charAt(0).toUpperCase() + str.substring(1); | ||
}; | ||
/** | ||
* Defines the specified properties on the specified target. Also adds getters and setters for non-ES5 environments. | ||
* @param {Object} target Target object | ||
* @param {Object} descriptors Property descriptors | ||
* @returns {undefined} | ||
*/ | ||
util.props = function props(target, descriptors) { | ||
Object.keys(descriptors).forEach(function(key) { | ||
util.prop(target, key, descriptors[key]); | ||
}); | ||
}; | ||
/** | ||
* Defines the specified property on the specified target. Also adds getters and setters for non-ES5 environments. | ||
* @param {Object} target Target object | ||
* @param {string} key Property name | ||
* @param {Object} descriptor Property descriptor | ||
* @returns {undefined} | ||
*/ | ||
util.prop = function prop(target, key, descriptor) { | ||
var ucKey = util.ucFirst(key); | ||
if (descriptor.get) | ||
target["get" + ucKey] = descriptor.get; | ||
if (descriptor.set) | ||
target["set" + ucKey] = util.isIE8 | ||
? function(value) { | ||
descriptor.set.call(this, value); | ||
this[key] = value; | ||
} | ||
: descriptor.set; | ||
if (util.isIE8) { | ||
if (descriptor.value !== undefined) | ||
target[key] = descriptor.value; | ||
} else | ||
Object.defineProperty(target, key, descriptor); | ||
}; | ||
/** | ||
* An immuable empty array. | ||
@@ -1315,9 +1403,23 @@ * @memberof util | ||
/** | ||
* Tests if two arrays are not equal. | ||
* @param {Array.<*>} a Array 1 | ||
* @param {Array.<*>} b Array 2 | ||
* @returns {boolean} `true` if not equal, otherwise `false` | ||
*/ | ||
util.arrayNe = function arrayNe(a, b) { | ||
if (a.length === b.length) | ||
for (var i = 0; i < a.length; ++i) | ||
if (a[i] !== b[i]) | ||
return true; | ||
return false; | ||
}; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"1":1,"2":2,"3":3,"4":4,"8":8}],10:[function(require,module,exports){ | ||
},{"1":1,"2":2,"3":3,"4":4,"9":9}],11:[function(require,module,exports){ | ||
"use strict"; | ||
module.exports = Writer; | ||
var util = require(9); | ||
var util = require(10); | ||
@@ -1453,3 +1555,3 @@ var BufferWriter; // cyclic | ||
if (!BufferWriter) | ||
BufferWriter = require(11); | ||
BufferWriter = require(12); | ||
return (Writer.create = function create_buffer() { | ||
@@ -1866,7 +1968,7 @@ return new BufferWriter(); | ||
},{"11":11,"9":9}],11:[function(require,module,exports){ | ||
},{"10":10,"12":12}],12:[function(require,module,exports){ | ||
"use strict"; | ||
module.exports = BufferWriter; | ||
var Writer = require(10); | ||
var Writer = require(11); | ||
/** @alias BufferWriter.prototype */ | ||
@@ -1876,3 +1978,3 @@ var BufferWriterPrototype = BufferWriter.prototype = Object.create(Writer.prototype); | ||
var util = require(9); | ||
var util = require(10); | ||
@@ -1941,5 +2043,5 @@ var utf8 = util.utf8, | ||
},{"10":10,"9":9}]},{},[5]) | ||
},{"10":10,"11":11}]},{},[5]) | ||
//# sourceMappingURL=protobuf.js.map |
/*! | ||
* protobuf.js v6.3.1 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 27 Dec 2016 16:55:50 UTC | ||
* protobuf.js v6.4.0 (c) 2016, Daniel Wirtz | ||
* Compiled Tue, 03 Jan 2017 15:34:50 UTC | ||
* Licensed under the BSD-3-Clause License | ||
* see: https://github.com/dcodeIO/protobuf.js for details | ||
*/ | ||
!function t(i,n,r){function e(s,u){if(!n[s]){if(!i[s]){var h="function"==typeof require&&require;if(!u&&h)return h(s,!0);if(o)return o(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[s]={exports:{}};i[s][0].call(l.exports,function(t){var n=i[s][1][t];return e(n?n:t)},l,l.exports,t,i,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)e(r[s]);return e}({1:[function(t,i,n){"use strict";var r=n;r.length=function(t){var i=t.length;if(!i)return 0;for(var n=0;--i%4>1&&"="===t.charAt(i);)++n;return Math.ceil(3*t.length)/4-n};for(var e=new Array(64),o=new Array(123),s=0;s<64;)o[e[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(t,i,n){for(var r,o=[],s=0,u=0;i<n;){var h=t[i++];switch(u){case 0:o[s++]=e[h>>2],r=(3&h)<<4,u=1;break;case 1:o[s++]=e[r|h>>4],r=(15&h)<<2,u=2;break;case 2:o[s++]=e[r|h>>6],o[s++]=e[63&h],u=0}}return u&&(o[s++]=e[r],o[s]=61,1===u&&(o[s+1]=61)),String.fromCharCode.apply(String,o)};var u="invalid encoding";r.decode=function(t,i,n){for(var r,e=n,s=0,h=0;h<t.length;){var f=t.charCodeAt(h++);if(61===f&&s>1)break;if(void 0===(f=o[f]))throw Error(u);switch(s){case 0:r=f,s=1;break;case 1:i[n++]=r<<2|(48&f)>>4,r=f,s=2;break;case 2:i[n++]=(15&r)<<4|(60&f)>>2,r=f,s=3;break;case 3:i[n++]=(3&r)<<6|f,s=0}}if(1===s)throw Error(u);return n-e}},{}],2:[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},{}],3:[function(t,i,n){"use strict";function r(t,i,n){var r=n||8192,e=r>>>1,o=null,s=r;return function(n){if(n<1||n>e)return t(n);s+n>r&&(o=t(r),s=0);var u=i.call(o,s,s+=n);return 7&s&&(s=(7|s)+1),u}}i.exports=r},{}],4:[function(t,i,n){"use strict";var r=n;r.length=function(t){for(var i=0,n=0,r=0;r<t.length;++r)n=t.charCodeAt(r),n<128?i+=1:n<2048?i+=2:55296===(64512&n)&&56320===(64512&t.charCodeAt(r+1))?(++r,i+=4):i+=3;return i},r.read=function(t,i,n){var r=n-i;if(r<1)return"";for(var e,o=null,s=[],u=0;i<n;)e=t[i++],e<128?s[u++]=e:e>191&&e<224?s[u++]=(31&e)<<6|63&t[i++]:e>239&&e<365?(e=((7&e)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536,s[u++]=55296+(e>>10),s[u++]=56320+(1023&e)):s[u++]=(15&e)<<12|(63&t[i++])<<6|63&t[i++],u>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),u=0);return o?(u&&o.push(String.fromCharCode.apply(String,s.slice(0,u))),o.join("")):u?String.fromCharCode.apply(String,s.slice(0,u)):""},r.write=function(t,i,n){for(var r,e,o=n,s=0;s<t.length;++s)r=t.charCodeAt(s),r<128?i[n++]=r:r<2048?(i[n++]=r>>6|192,i[n++]=63&r|128):55296===(64512&r)&&56320===(64512&(e=t.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&e),++s,i[n++]=r>>18|240,i[n++]=r>>12&63|128,i[n++]=r>>6&63|128,i[n++]=63&r|128):(i[n++]=r>>12|224,i[n++]=r>>6&63|128,i[n++]=63&r|128);return n-o}},{}],5:[function(t,i,n){(function(i){"use strict";function r(){e.Reader.a()}var e=i.protobuf=n;e.Writer=t(10),e.BufferWriter=t(11),e.Reader=t(6),e.BufferReader=t(7),e.util=t(9),e.roots={},e.configure=r,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&(e.util.Long=t,r()),e})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,11:11,6:6,7:7,9:9}],6:[function(t,i,n){"use strict";function r(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function e(t){this.buf=t,this.pos=0,this.len=t.length}function o(){var t=new A(0,0),i=0;if(this.len-this.pos>4){for(i=0;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}else{for(i=0;i<4;++i){if(this.pos>=this.len)throw r(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}if(this.pos>=this.len)throw r(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}if(this.len-this.pos>4){for(i=0;i<5;++i)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}else for(i=0;i<5;++i){if(this.pos>=this.len)throw r(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function s(){return o.call(this).toLong()}function u(){return o.call(this).toNumber()}function h(){return o.call(this).toLong(!0)}function f(){return o.call(this).toNumber(!0)}function l(){return o.call(this).zzDecode().toLong()}function a(){return o.call(this).zzDecode().toNumber()}function c(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw r(this,8);return new A(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}function d(){return p.call(this).toLong(!0)}function b(){return p.call(this).toNumber(!0)}function g(){return p.call(this).zzDecode().toLong()}function v(){return p.call(this).zzDecode().toNumber()}function y(){m.Long?(N.int64=s,N.uint64=h,N.sint64=l,N.fixed64=d,N.sfixed64=g):(N.int64=u,N.uint64=f,N.sint64=a,N.fixed64=b,N.sfixed64=v)}i.exports=e;var w,m=t(9),A=m.LongBits,x=m.utf8;e.create=m.Buffer?function(i){return w||(w=t(7)),(e.create=function(t){return new w(t)})(i)}:function(t){return new e(t)};var N=e.prototype;N.b=m.Array.prototype.subarray||m.Array.prototype.slice,N.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,r(this,10);return t}}(),N.int32=function(){return 0|this.uint32()},N.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},N.bool=function(){return 0!==this.uint32()},N.fixed32=function(){if(this.pos+4>this.len)throw r(this,4);return c(this.buf,this.pos+=4)},N.sfixed32=function(){var t=this.fixed32();return t>>>1^-(1&t)};var L="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),i=new Uint8Array(t.buffer);return t[0]=-0,i[3]?function(n,r){return i[0]=n[r],i[1]=n[r+1],i[2]=n[r+2],i[3]=n[r+3],t[0]}:function(n,r){return i[3]=n[r],i[2]=n[r+1],i[1]=n[r+2],i[0]=n[r+3],t[0]}}():function(t,i){var n=c(t,i+4),r=2*(n>>31)+1,e=n>>>23&255,o=8388607&n;return 255===e?o?NaN:r*(1/0):0===e?1.401298464324817e-45*r*o:r*Math.pow(2,e-150)*(o+8388608)};N.float=function(){if(this.pos+4>this.len)throw r(this,4);var t=L(this.buf,this.pos);return this.pos+=4,t};var z="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),i=new Uint8Array(t.buffer);return t[0]=-0,i[7]?function(n,r){return i[0]=n[r],i[1]=n[r+1],i[2]=n[r+2],i[3]=n[r+3],i[4]=n[r+4],i[5]=n[r+5],i[6]=n[r+6],i[7]=n[r+7],t[0]}:function(n,r){return i[7]=n[r],i[6]=n[r+1],i[5]=n[r+2],i[4]=n[r+3],i[3]=n[r+4],i[2]=n[r+5],i[1]=n[r+6],i[0]=n[r+7],t[0]}}():function(t,i){var n=c(t,i+4),r=c(t,i+8),e=2*(r>>31)+1,o=r>>>20&2047,s=4294967296*(1048575&r)+n;return 2047===o?s?NaN:e*(1/0):0===o?5e-324*e*s:e*Math.pow(2,o-1075)*(s+4503599627370496)};N.double=function(){if(this.pos+8>this.len)throw r(this,4);var t=z(this.buf,this.pos);return this.pos+=8,t},N.bytes=function(){var t=this.uint32(),i=this.pos,n=this.pos+t;if(n>this.len)throw r(this,t);return this.pos+=t,i===n?new this.buf.constructor(0):this.b.call(this.buf,i,n)},N.string=function(){var t=this.bytes();return x.read(t,0,t.length)},N.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw r(this,t);this.pos+=t}else do if(this.pos>=this.len)throw r(this);while(128&this.buf[this.pos++]);return this},N.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4===(t=7&this.uint32()))break;this.skipType(t)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type: "+t)}return this},e.a=y,y()},{7:7,9:9}],7:[function(t,i,n){"use strict";function r(t){e.call(this,t)}i.exports=r;var e=t(6),o=r.prototype=Object.create(e.prototype);o.constructor=r;var s=t(9);s.Buffer&&(o.b=s.Buffer.prototype.slice),o.string=function(){var t=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len))}},{6:6,9:9}],8:[function(t,i,n){"use strict";function r(t,i){this.lo=t,this.hi=i}i.exports=r;var e=t(9),o=r.prototype,s=r.zero=new r(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1},r.fromNumber=function(t){if(0===t)return s;var i=t<0;t=Math.abs(t);var n=t>>>0,e=(t-n)/4294967296>>>0;return i&&(e=~e>>>0,n=~n>>>0,++n>4294967295&&(n=0,++e>4294967295&&(e=0))),new r(n,e)},r.from=function(t){if("number"==typeof t)return r.fromNumber(t);if("string"==typeof t){if(!e.Long)return r.fromNumber(parseInt(t,10));t=e.Long.fromString(t)}return t.low||t.high?new r(t.low>>>0,t.high>>>0):s},o.toNumber=function(t){return!t&&this.hi>>>31?(this.lo=~this.lo+1>>>0,this.hi=~this.hi>>>0,this.lo||(this.hi=this.hi+1>>>0),-(this.lo+4294967296*this.hi)):this.lo+4294967296*this.hi},o.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var u=String.prototype.charCodeAt;r.fromHash=function(t){return new r((u.call(t,0)|u.call(t,1)<<8|u.call(t,2)<<16|u.call(t,3)<<24)>>>0,(u.call(t,4)|u.call(t,5)<<8|u.call(t,6)<<16|u.call(t,7)<<24)>>>0)},o.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},o.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},o.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}},{9:9}],9:[function(require,module,exports){(function(global){"use strict";var util=exports;util.LongBits=require(8),util.base64=require(1),util.inquire=require(2),util.utf8=require(4),util.pool=require(3),util.isNode=Boolean(global.process&&global.process.versions&&global.process.versions.node),util.isIE8=!1;try{util.isIE8=eval("!-[1,]")}catch(t){}util.Buffer=function(){try{var t=util.inquire("buffer").Buffer;return t.prototype.utf8Write?(t.from||(t.from=function(i,n){return new t(i,n)}),t.allocUnsafe||(t.allocUnsafe=function(i){return new t(i)}),t):null}catch(t){return null}}(),util.Array="undefined"==typeof Uint8Array?Array:Uint8Array,util.Long=global.dcodeIO&&global.dcodeIO.Long||util.inquire("long"),util.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},util.isString=function(t){return"string"==typeof t||t instanceof String},util.isObject=function(t){return t&&"object"==typeof t},util.longToHash=function(t){return t?util.LongBits.from(t).toHash():"\0\0\0\0\0\0\0\0"},util.longFromHash=function(t,i){var n=util.LongBits.fromHash(t);return util.Long?util.Long.fromBits(n.lo,n.hi,i):n.toNumber(Boolean(i))},util.longNeq=function(t,i){return"number"==typeof t?"number"==typeof i?t!==i:(t=util.LongBits.fromNumber(t)).lo!==i.low||t.hi!==i.high:"number"==typeof i?(i=util.LongBits.fromNumber(i)).lo!==t.low||i.hi!==t.high:t.low!==i.low||t.high!==i.high},util.longNe=function(t,i,n){if("object"==typeof t)return t.low!==i||t.high!==n;var r=util.LongBits.from(t);return r.lo!==i||r.hi!==n},util.ucFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},util.props=function(t,i){Object.keys(i).forEach(function(n){util.prop(t,n,i[n])})},util.prop=function(t,i,n){var r=util.ucFirst(i);n.get&&(t["get"+r]=n.get),n.set&&(t["set"+r]=util.isIE8?function(t){n.set.call(this,t),this[i]=t}:n.set),util.isIE8?void 0!==n.value&&(t[i]=n.value):Object.defineProperty(t,i,n)},util.emptyArray=Object.freeze?Object.freeze([]):[],util.emptyObject=Object.freeze?Object.freeze({}):{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,2:2,3:3,4:4,8:8}],10:[function(t,i,n){"use strict";function r(t,i,n){this.fn=t,this.len=i,this.next=void 0,this.val=n}function e(){}function o(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function s(){this.len=0,this.head=new r(e,0,0),this.tail=this.head,this.states=null}function u(t,i,n){i[n]=255&t}function h(t,i,n){for(;t>127;)i[n++]=127&t|128,t>>>=7;i[n]=t}function f(t,i,n){for(;t.hi;)i[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)i[n++]=127&t.lo|128,t.lo=t.lo>>>7;i[n++]=t.lo}function l(t,i,n){i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n]=t>>>24}i.exports=s;var a,c=t(9),p=c.LongBits,d=c.base64,b=c.utf8;s.create=c.Buffer?function(){return a||(a=t(11)),(s.create=function(){return new a})()}:function(){return new s},s.alloc=function(t){return new c.Array(t)},c.Array!==Array&&(s.alloc=c.pool(s.alloc,c.Array.prototype.subarray));var g=s.prototype;g.push=function(t,i,n){return this.tail=this.tail.next=new r(t,i,n),this.len+=i,this},g.uint32=function(t){return t>>>=0,this.push(h,t<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)},g.int32=function(t){return t<0?this.push(f,10,p.fromNumber(t)):this.uint32(t)},g.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},g.uint64=function(t){var i=p.from(t);return this.push(f,i.length(),i)},g.int64=g.uint64,g.sint64=function(t){var i=p.from(t).zzEncode();return this.push(f,i.length(),i)},g.bool=function(t){return this.push(u,1,t?1:0)},g.fixed32=function(t){return this.push(l,4,t>>>0)},g.sfixed32=function(t){return this.push(l,4,t<<1^t>>31)},g.fixed64=function(t){var i=p.from(t);return this.push(l,4,i.lo).push(l,4,i.hi)},g.sfixed64=function(t){var i=p.from(t).zzEncode();return this.push(l,4,i.lo).push(l,4,i.hi)};var v="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),i=new Uint8Array(t.buffer);return t[0]=-0,i[3]?function(n,r,e){t[0]=n,r[e++]=i[0],r[e++]=i[1],r[e++]=i[2],r[e]=i[3]}:function(n,r,e){t[0]=n,r[e++]=i[3],r[e++]=i[2],r[e++]=i[1],r[e]=i[0]}}():function(t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)l(1/t>0?0:2147483648,i,n);else if(isNaN(t))l(2147483647,i,n);else if(t>3.4028234663852886e38)l((r<<31|2139095040)>>>0,i,n);else if(t<1.1754943508222875e-38)l((r<<31|Math.round(t/1.401298464324817e-45))>>>0,i,n);else{var e=Math.floor(Math.log(t)/Math.LN2),o=8388607&Math.round(t*Math.pow(2,-e)*8388608);l((r<<31|e+127<<23|o)>>>0,i,n)}};g.float=function(t){return this.push(v,4,t)};var y="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),i=new Uint8Array(t.buffer);return t[0]=-0,i[7]?function(n,r,e){t[0]=n,r[e++]=i[0],r[e++]=i[1],r[e++]=i[2],r[e++]=i[3],r[e++]=i[4],r[e++]=i[5],r[e++]=i[6],r[e]=i[7]}:function(n,r,e){t[0]=n,r[e++]=i[7],r[e++]=i[6],r[e++]=i[5],r[e++]=i[4],r[e++]=i[3],r[e++]=i[2],r[e++]=i[1],r[e]=i[0]}}():function(t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)l(0,i,n),l(1/t>0?0:2147483648,i,n+4);else if(isNaN(t))l(4294967295,i,n),l(2147483647,i,n+4);else if(t>1.7976931348623157e308)l(0,i,n),l((r<<31|2146435072)>>>0,i,n+4);else{var e;if(t<2.2250738585072014e-308)e=t/5e-324,l(e>>>0,i,n),l((r<<31|e/4294967296)>>>0,i,n+4);else{var o=Math.floor(Math.log(t)/Math.LN2);1024===o&&(o=1023),e=t*Math.pow(2,-o),l(4503599627370496*e>>>0,i,n),l((r<<31|o+1023<<20|1048576*e&1048575)>>>0,i,n+4)}}};g.double=function(t){return this.push(y,8,t)};var w=c.Array.prototype.set?function(t,i,n){i.set(t,n)}:function(t,i,n){for(var r=0;r<t.length;++r)i[n+r]=t[r]};g.bytes=function(t){var i=t.length>>>0;if("string"==typeof t&&i){var n=s.alloc(i=d.length(t));d.decode(t,n,0),t=n}return i?this.uint32(i).push(w,i,t):this.push(u,1,0)},g.string=function(t){var i=b.length(t);return i?this.uint32(i).push(b.write,i,t):this.push(u,1,0)},g.fork=function(){return this.states=new o(this),this.head=this.tail=new r(e,0,0),this.len=0,this},g.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new r(e,0,0),this.len=0),this},g.ldelim=function(){var t=this.head,i=this.tail,n=this.len;return this.reset().uint32(n).tail.next=t.next,this.tail=i,this.len+=n,this},g.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,i,n),n+=t.len,t=t.next;return i}},{11:11,9:9}],11:[function(t,i,n){"use strict";function r(){o.call(this)}function e(t,i,n){t.length<40?h.write(t,i,n):i.utf8Write(t,n)}i.exports=r;var o=t(10),s=r.prototype=Object.create(o.prototype);s.constructor=r;var u=t(9),h=u.utf8,f=u.Buffer;r.alloc=function(t){return(r.alloc=f.allocUnsafe)(t)};var l=f&&f.prototype instanceof Uint8Array&&"set"===f.prototype.set.name?function(t,i,n){i.set(t,n)}:function(t,i,n){t.copy(i,n,0,t.length)};s.bytes=function(t){"string"==typeof t&&(t=f.from(t,"base64"));var i=t.length>>>0;return this.uint32(i),i&&this.push(l,i,t),this},s.string=function(t){var i=f.byteLength(t);return this.uint32(i),i&&this.push(e,i,t),this}},{10:10,9:9}]},{},[5]); | ||
!function t(n,r,i){function e(s,u){if(!r[s]){if(!n[s]){var f="function"==typeof require&&require;if(!u&&f)return f(s,!0);if(o)return o(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var a=r[s]={exports:{}};n[s][0].call(a.exports,function(t){var r=n[s][1][t];return e(r?r:t)},a,a.exports,t,n,r,i)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)e(i[s]);return e}({1:[function(t,n,r){"use strict";var i=r;i.length=function(t){var n=t.length;if(!n)return 0;for(var r=0;--n%4>1&&"="===t.charAt(n);)++r;return Math.ceil(3*t.length)/4-r};for(var e=new Array(64),o=new Array(123),s=0;s<64;)o[e[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(t,n,r){for(var i,o=[],s=0,u=0;n<r;){var f=t[n++];switch(u){case 0:o[s++]=e[f>>2],i=(3&f)<<4,u=1;break;case 1:o[s++]=e[i|f>>4],i=(15&f)<<2,u=2;break;case 2:o[s++]=e[i|f>>6],o[s++]=e[63&f],u=0}}return u&&(o[s++]=e[i],o[s]=61,1===u&&(o[s+1]=61)),String.fromCharCode.apply(String,o)};var u="invalid encoding";i.decode=function(t,n,r){for(var i,e=r,s=0,f=0;f<t.length;){var h=t.charCodeAt(f++);if(61===h&&s>1)break;if(void 0===(h=o[h]))throw Error(u);switch(s){case 0:i=h,s=1;break;case 1:n[r++]=i<<2|(48&h)>>4,i=h,s=2;break;case 2:n[r++]=(15&i)<<4|(60&h)>>2,i=h,s=3;break;case 3:n[r++]=(3&i)<<6|h,s=0}}if(1===s)throw Error(u);return r-e},i.test=function(t){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(t)}},{}],2:[function(require,module,exports){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},{}],3:[function(t,n,r){"use strict";function i(t,n,r){var i=r||8192,e=i>>>1,o=null,s=i;return function(r){if(r<1||r>e)return t(r);s+r>i&&(o=t(i),s=0);var u=n.call(o,s,s+=r);return 7&s&&(s=(7|s)+1),u}}n.exports=i},{}],4:[function(t,n,r){"use strict";var i=r;i.length=function(t){for(var n=0,r=0,i=0;i<t.length;++i)r=t.charCodeAt(i),r<128?n+=1:r<2048?n+=2:55296===(64512&r)&&56320===(64512&t.charCodeAt(i+1))?(++i,n+=4):n+=3;return n},i.read=function(t,n,r){var i=r-n;if(i<1)return"";for(var e,o=null,s=[],u=0;n<r;)e=t[n++],e<128?s[u++]=e:e>191&&e<224?s[u++]=(31&e)<<6|63&t[n++]:e>239&&e<365?(e=((7&e)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,s[u++]=55296+(e>>10),s[u++]=56320+(1023&e)):s[u++]=(15&e)<<12|(63&t[n++])<<6|63&t[n++],u>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),u=0);return o?(u&&o.push(String.fromCharCode.apply(String,s.slice(0,u))),o.join("")):u?String.fromCharCode.apply(String,s.slice(0,u)):""},i.write=function(t,n,r){for(var i,e,o=r,s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=63&i|128):55296===(64512&i)&&56320===(64512&(e=t.charCodeAt(s+1)))?(i=65536+((1023&i)<<10)+(1023&e),++s,n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=63&i|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=63&i|128);return r-o}},{}],5:[function(t,n,r){(function(n){"use strict";function i(){e.Reader.a()}var e=n.protobuf=r;e.Writer=t(11),e.BufferWriter=t(12),e.Reader=t(7),e.BufferReader=t(8),e.converters=t(6),e.util=t(10),e.roots={},e.configure=i,"function"==typeof define&&define.amd&&define(["long"],function(t){return t&&(e.util.Long=t,i()),e})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,11:11,12:12,6:6,7:7,8:8}],6:[function(t,n,r){"use strict";var i=r,e=t(10);i.json={create:function(t,n,r){return t?r.fieldsOnly?{}:e.merge({},t):null},enums:function(t,n,r,i){if(i.defaults)void 0===t&&(t=n);else if(void 0===t||t===n)return;return i.enums===String&&"number"==typeof t?r[t]:t},longs:function(t,n,r,i,o){if(t){if(!e.longNe(t,n,r)&&!o.defaults)return}else{if(!o.defaults)return;t={low:n,high:r}}return o.longs===Number?"number"==typeof t?t:e.LongBits.from(t).toNumber(i):o.longs===String?"number"==typeof t?e.Long.fromNumber(t,i).toString():(t=e.Long.fromValue(t),t.unsigned=i,t.toString()):t},bytes:function(t,n,r){if(t){if(!t.length&&!r.defaults)return}else{if(!r.defaults)return;t=n}return r.bytes===String?e.base64.encode(t,0,t.length):r.bytes===Array?Array.prototype.slice.call(t):r.bytes!==e.Buffer||e.Buffer.isBuffer(t)?t:e.Buffer.from(t)}},i.message={create:function(t,n,r){return t?new(n.ctor?n.ctor:n)(r.fieldsOnly?void 0:t):null},enums:function(t,n,r){return"string"==typeof t?r[t]:0|t},longs:function(t,n,r,i){return"string"==typeof t?e.Long.fromString(t,i):"number"==typeof t?e.Long.fromNumber(t,i):t},bytes:function(t){if(e.Buffer)return e.Buffer.isBuffer(t)?t:e.Buffer.from(t,"base64");if("string"==typeof t){var n=e.newBuffer(e.base64.length(t));return e.base64.decode(t,n,0),n}return t instanceof e.Array?t:new e.Array(t)}}},{10:10}],7:[function(t,n,r){"use strict";function i(t,n){return RangeError("index out of range: "+t.pos+" + "+(n||1)+" > "+t.len)}function e(t){this.buf=t,this.pos=0,this.len=t.length}function o(){var t=new A(0,0),n=0;if(this.len-this.pos>4){for(n=0;n<4;++n)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*n)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}else{for(n=0;n<4;++n){if(this.pos>=this.len)throw i(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*n)>>>0,this.buf[this.pos++]<128)return t}if(this.pos>=this.len)throw i(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t}if(this.len-this.pos>4){for(n=0;n<5;++n)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*n+3)>>>0,this.buf[this.pos++]<128)return t}else for(n=0;n<5;++n){if(this.pos>=this.len)throw i(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*n+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function s(){return o.call(this).toLong()}function u(){return o.call(this).toNumber()}function f(){return o.call(this).toLong(!0)}function h(){return o.call(this).toNumber(!0)}function a(){return o.call(this).zzDecode().toLong()}function l(){return o.call(this).zzDecode().toNumber()}function c(t,n){return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw i(this,8);return new A(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}function d(){return p.call(this).toLong(!0)}function g(){return p.call(this).toNumber(!0)}function b(){return p.call(this).zzDecode().toLong()}function y(){return p.call(this).zzDecode().toNumber()}function v(){w.Long?(B.int64=s,B.uint64=f,B.sint64=a,B.fixed64=d,B.sfixed64=b):(B.int64=u,B.uint64=h,B.sint64=l,B.fixed64=g,B.sfixed64=y)}n.exports=e;var m,w=t(10),A=w.LongBits,N=w.utf8;e.create=w.Buffer?function(n){return m||(m=t(8)),(e.create=function(t){return w.Buffer.isBuffer(t)?new m(t):new e(t)})(n)}:function(t){return new e(t)};var B=e.prototype;B.b=w.Array.prototype.subarray||w.Array.prototype.slice,B.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,i(this,10);return t}}(),B.int32=function(){return 0|this.uint32()},B.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},B.bool=function(){return 0!==this.uint32()},B.fixed32=function(){if(this.pos+4>this.len)throw i(this,4);return c(this.buf,this.pos+=4)},B.sfixed32=function(){var t=this.fixed32();return t>>>1^-(1&t)};var x="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),n=new Uint8Array(t.buffer);return t[0]=-0,n[3]?function(r,i){return n[0]=r[i],n[1]=r[i+1],n[2]=r[i+2],n[3]=r[i+3],t[0]}:function(r,i){return n[3]=r[i],n[2]=r[i+1],n[1]=r[i+2],n[0]=r[i+3],t[0]}}():function(t,n){var r=c(t,n+4),i=2*(r>>31)+1,e=r>>>23&255,o=8388607&r;return 255===e?o?NaN:i*(1/0):0===e?1.401298464324817e-45*i*o:i*Math.pow(2,e-150)*(o+8388608)};B.float=function(){if(this.pos+4>this.len)throw i(this,4);var t=x(this.buf,this.pos);return this.pos+=4,t};var L="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),n=new Uint8Array(t.buffer);return t[0]=-0,n[7]?function(r,i){return n[0]=r[i],n[1]=r[i+1],n[2]=r[i+2],n[3]=r[i+3],n[4]=r[i+4],n[5]=r[i+5],n[6]=r[i+6],n[7]=r[i+7],t[0]}:function(r,i){return n[7]=r[i],n[6]=r[i+1],n[5]=r[i+2],n[4]=r[i+3],n[3]=r[i+4],n[2]=r[i+5],n[1]=r[i+6],n[0]=r[i+7],t[0]}}():function(t,n){var r=c(t,n+4),i=c(t,n+8),e=2*(i>>31)+1,o=i>>>20&2047,s=4294967296*(1048575&i)+r;return 2047===o?s?NaN:e*(1/0):0===o?5e-324*e*s:e*Math.pow(2,o-1075)*(s+4503599627370496)};B.double=function(){if(this.pos+8>this.len)throw i(this,4);var t=L(this.buf,this.pos);return this.pos+=8,t},B.bytes=function(){var t=this.uint32(),n=this.pos,r=this.pos+t;if(r>this.len)throw i(this,t);return this.pos+=t,n===r?new this.buf.constructor(0):this.b.call(this.buf,n,r)},B.string=function(){var t=this.bytes();return N.read(t,0,t.length)},B.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw i(this,t);this.pos+=t}else do if(this.pos>=this.len)throw i(this);while(128&this.buf[this.pos++]);return this},B.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){if(4===(t=7&this.uint32()))break;this.skipType(t)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},e.a=v,v()},{10:10,8:8}],8:[function(t,n,r){"use strict";function i(t){e.call(this,t)}n.exports=i;var e=t(7),o=i.prototype=Object.create(e.prototype);o.constructor=i;var s=t(10);s.Buffer&&(o.b=s.Buffer.prototype.slice),o.string=function(){var t=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len))}},{10:10,7:7}],9:[function(t,n,r){"use strict";function i(t,n){this.lo=t,this.hi=n}n.exports=i;var e=t(10),o=i.prototype,s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var u=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return s;var n=t<0;n&&(t=-t);var r=t>>>0,e=(t-r)/4294967296>>>0;return n&&(e=~e>>>0,r=~r>>>0,++r>4294967295&&(r=0,++e>4294967295&&(e=0))),new i(r,e)},i.from=function(t){if("number"==typeof t)return i.fromNumber(t);if("string"==typeof t){if(!e.Long)return i.fromNumber(parseInt(t,10));t=e.Long.fromString(t)}return t.low||t.high?new i(t.low>>>0,t.high>>>0):s},o.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,r=~this.hi>>>0;return n||(r=r+1>>>0),-(n+4294967296*r)}return this.lo+4294967296*this.hi},o.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var f=String.prototype.charCodeAt;i.fromHash=function(t){return t===u?s:new i((f.call(t,0)|f.call(t,1)<<8|f.call(t,2)<<16|f.call(t,3)<<24)>>>0,(f.call(t,4)|f.call(t,5)<<8|f.call(t,6)<<16|f.call(t,7)<<24)>>>0)},o.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},o.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},o.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===n?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:r<128?9:10}},{10:10}],10:[function(t,n,r){(function(n){"use strict";var i=r;i.base64=t(1),i.inquire=t(2),i.utf8=t(4),i.pool=t(3),i.LongBits=t(9),i.isNode=Boolean(n.process&&n.process.versions&&n.process.versions.node),i.Buffer=function(){try{var t=i.inquire("buffer").Buffer;return t.prototype.utf8Write?(t.from||(t.from=function(n,r){return new t(n,r)}),t.allocUnsafe||(t.allocUnsafe=function(n){return new t(n)}),t):null}catch(t){return null}}(),i.Array="undefined"==typeof Uint8Array?Array:Uint8Array,i.Long=n.dcodeIO&&n.dcodeIO.Long||i.inquire("long"),i.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},i.isString=function(t){return"string"==typeof t||t instanceof String},i.isObject=function(t){return t&&"object"==typeof t},i.longToHash=function(t){return t?i.LongBits.from(t).toHash():i.LongBits.zeroHash},i.longFromHash=function(t,n){var r=i.LongBits.fromHash(t);return i.Long?i.Long.fromBits(r.lo,r.hi,n):r.toNumber(Boolean(n))},i.longNe=function(t,n,r){if("object"==typeof t)return t.low!==n||t.high!==r;var e=i.LongBits.from(t);return e.lo!==n||e.hi!==r},i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.arrayNe=function(t,n){if(t.length===n.length)for(var r=0;r<t.length;++r)if(t[r]!==n[r])return!0;return!1}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,2:2,3:3,4:4,9:9}],11:[function(t,n,r){"use strict";function i(t,n,r){this.fn=t,this.len=n,this.next=void 0,this.val=r}function e(){}function o(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function s(){this.len=0,this.head=new i(e,0,0),this.tail=this.head,this.states=null}function u(t,n,r){n[r]=255&t}function f(t,n,r){for(;t>127;)n[r++]=127&t|128,t>>>=7;n[r]=t}function h(t,n,r){for(;t.hi;)n[r++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)n[r++]=127&t.lo|128,t.lo=t.lo>>>7;n[r++]=t.lo}function a(t,n,r){n[r++]=255&t,n[r++]=t>>>8&255,n[r++]=t>>>16&255,n[r]=t>>>24}n.exports=s;var l,c=t(10),p=c.LongBits,d=c.base64,g=c.utf8;s.create=c.Buffer?function(){return l||(l=t(12)),(s.create=function(){return new l})()}:function(){return new s},s.alloc=function(t){return new c.Array(t)},c.Array!==Array&&(s.alloc=c.pool(s.alloc,c.Array.prototype.subarray));var b=s.prototype;b.push=function(t,n,r){return this.tail=this.tail.next=new i(t,n,r),this.len+=n,this},b.uint32=function(t){return t>>>=0,this.push(f,t<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)},b.int32=function(t){return t<0?this.push(h,10,p.fromNumber(t)):this.uint32(t)},b.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},b.uint64=function(t){var n=p.from(t);return this.push(h,n.length(),n)},b.int64=b.uint64,b.sint64=function(t){var n=p.from(t).zzEncode();return this.push(h,n.length(),n)},b.bool=function(t){return this.push(u,1,t?1:0)},b.fixed32=function(t){return this.push(a,4,t>>>0)},b.sfixed32=function(t){return this.push(a,4,t<<1^t>>31)},b.fixed64=function(t){var n=p.from(t);return this.push(a,4,n.lo).push(a,4,n.hi)},b.sfixed64=function(t){var n=p.from(t).zzEncode();return this.push(a,4,n.lo).push(a,4,n.hi)};var y="undefined"!=typeof Float32Array?function(){var t=new Float32Array(1),n=new Uint8Array(t.buffer);return t[0]=-0,n[3]?function(r,i,e){t[0]=r,i[e++]=n[0],i[e++]=n[1],i[e++]=n[2],i[e]=n[3]}:function(r,i,e){t[0]=r,i[e++]=n[3],i[e++]=n[2],i[e++]=n[1],i[e]=n[0]}}():function(t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)a(1/t>0?0:2147483648,n,r);else if(isNaN(t))a(2147483647,n,r);else if(t>3.4028234663852886e38)a((i<<31|2139095040)>>>0,n,r);else if(t<1.1754943508222875e-38)a((i<<31|Math.round(t/1.401298464324817e-45))>>>0,n,r);else{var e=Math.floor(Math.log(t)/Math.LN2),o=8388607&Math.round(t*Math.pow(2,-e)*8388608);a((i<<31|e+127<<23|o)>>>0,n,r)}};b.float=function(t){return this.push(y,4,t)};var v="undefined"!=typeof Float64Array?function(){var t=new Float64Array(1),n=new Uint8Array(t.buffer);return t[0]=-0,n[7]?function(r,i,e){t[0]=r,i[e++]=n[0],i[e++]=n[1],i[e++]=n[2],i[e++]=n[3],i[e++]=n[4],i[e++]=n[5],i[e++]=n[6],i[e]=n[7]}:function(r,i,e){t[0]=r,i[e++]=n[7],i[e++]=n[6],i[e++]=n[5],i[e++]=n[4],i[e++]=n[3],i[e++]=n[2],i[e++]=n[1],i[e]=n[0]}}():function(t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)a(0,n,r),a(1/t>0?0:2147483648,n,r+4);else if(isNaN(t))a(4294967295,n,r),a(2147483647,n,r+4);else if(t>1.7976931348623157e308)a(0,n,r),a((i<<31|2146435072)>>>0,n,r+4);else{var e;if(t<2.2250738585072014e-308)e=t/5e-324,a(e>>>0,n,r),a((i<<31|e/4294967296)>>>0,n,r+4);else{var o=Math.floor(Math.log(t)/Math.LN2);1024===o&&(o=1023),e=t*Math.pow(2,-o),a(4503599627370496*e>>>0,n,r),a((i<<31|o+1023<<20|1048576*e&1048575)>>>0,n,r+4)}}};b.double=function(t){return this.push(v,8,t)};var m=c.Array.prototype.set?function(t,n,r){n.set(t,r)}:function(t,n,r){for(var i=0;i<t.length;++i)n[r+i]=t[i]};b.bytes=function(t){var n=t.length>>>0;if("string"==typeof t&&n){var r=s.alloc(n=d.length(t));d.decode(t,r,0),t=r}return n?this.uint32(n).push(m,n,t):this.push(u,1,0)},b.string=function(t){var n=g.length(t);return n?this.uint32(n).push(g.write,n,t):this.push(u,1,0)},b.fork=function(){return this.states=new o(this),this.head=this.tail=new i(e,0,0),this.len=0,this},b.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new i(e,0,0),this.len=0),this},b.ldelim=function(){var t=this.head,n=this.tail,r=this.len;return this.reset().uint32(r).tail.next=t.next,this.tail=n,this.len+=r,this},b.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,n,r),r+=t.len,t=t.next;return n}},{10:10,12:12}],12:[function(t,n,r){"use strict";function i(){o.call(this)}function e(t,n,r){t.length<40?f.write(t,n,r):n.utf8Write(t,r)}n.exports=i;var o=t(11),s=i.prototype=Object.create(o.prototype);s.constructor=i;var u=t(10),f=u.utf8,h=u.Buffer;i.alloc=function(t){return(i.alloc=h.allocUnsafe)(t)};var a=h&&h.prototype instanceof Uint8Array&&"set"===h.prototype.set.name?function(t,n,r){n.set(t,r)}:function(t,n,r){t.copy(n,r,0,t.length)};s.bytes=function(t){"string"==typeof t&&(t=h.from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this.push(a,n,t),this},s.string=function(t){var n=h.byteLength(t);return this.uint32(n),n&&this.push(e,n,t),this}},{10:10,11:11}]},{},[5]); | ||
//# sourceMappingURL=protobuf.min.js.map |
@@ -72,3 +72,6 @@ "use strict"; | ||
if (options.module) { | ||
writeln("declare module ", JSON.stringify(options.module), " {"); | ||
writeln("export = ", options.module, ";"); | ||
writeln(); | ||
writeln("declare namespace ", options.module, " {"); | ||
writeln(); | ||
++indent; | ||
@@ -78,3 +81,5 @@ } | ||
// handle all | ||
getChildrenOf(undefined).forEach(handleElement); | ||
getChildrenOf(undefined).forEach(function(child) { | ||
handleElement(child, null); | ||
}); | ||
@@ -134,5 +139,8 @@ // process queued | ||
// writes a comment | ||
function writeComment(comment) { | ||
if (!comment || options.comments === false) | ||
function writeComment(comment, otherwiseNewline) { | ||
if (!comment || options.comments === false) { | ||
if (otherwiseNewline) | ||
writeln(); | ||
return; | ||
} | ||
var first = true; | ||
@@ -164,8 +172,8 @@ comment.split(/\r?\n/g).forEach(function(line) { | ||
// tests if an element is considered class-like | ||
function isClass(element) { | ||
// tests if an element is considered to be a class or class-like | ||
function isClassLike(element) { | ||
return element && (element.kind === "class" || element.kind === "interface" || element.kind === "mixin"); | ||
} | ||
// tests if an element is considered an interface | ||
// tests if an element is considered to be an interface | ||
function isInterface(element) { | ||
@@ -175,2 +183,7 @@ return element && (element.kind === "interface" || (getTypeOf(element) === 'Object' && element.properties && element.properties.length)); | ||
// tests if an element is considered to be a namespace | ||
function isNamespace(element) { | ||
return element && (element.kind === "namespace" || element.kind === "module"); | ||
} | ||
// gets all children of the specified parent | ||
@@ -224,6 +237,7 @@ function getChildrenOf(parent) { | ||
// begins writing the definition of the specified element | ||
function begin(element) { | ||
writeComment(element.comment); | ||
if (element.scope === "global" && !options.module) | ||
write("declare "); | ||
function begin(element, is_interface) { | ||
writeComment(element.comment, is_interface || isInterface(element) || isClassLike(element) || isNamespace(element) || element.isEnum); | ||
if (element.scope !== "global" || options.module || is_interface || isInterface(element)) | ||
return; | ||
write("export "); | ||
} | ||
@@ -246,3 +260,3 @@ | ||
if (element.params) | ||
element.params.forEach(function(param, i) { | ||
element.params.forEach(function(param) { | ||
var path = param.name.split(/\./g); | ||
@@ -252,4 +266,5 @@ if (path.length === 1) | ||
type: getTypeOf(param), | ||
variable: param.variable === true, | ||
optional: param.optional === true, | ||
defaultValue: param.defaultvalue // TODO | ||
defaultValue: param.defaultvalue // TODO | ||
}; | ||
@@ -263,3 +278,8 @@ else // Property syntax (TODO) | ||
var param = params[name]; | ||
write(name, param.optional ? "?: " : ": ", param.type); | ||
var type = param.type; | ||
if (param.variable) { | ||
name = "..." + name; | ||
type = param.type.charAt(0) === "(" ? "any[]" : param.type + "[]"; | ||
} | ||
write(name, !param.variable && param.optional ? "?: " : ": ", type); | ||
if (i < paramNames.length - 1) | ||
@@ -284,6 +304,10 @@ write(", "); | ||
function writeInterface(element) { | ||
writeln(); | ||
writeln("interface ", element.name, " {"); | ||
++indent; | ||
element.properties.forEach(function(property) { | ||
writeln(property.name, ": ", getTypeOf(property), ";"); | ||
write(property.name); | ||
if (property.optional) | ||
write("?"); | ||
writeln(": ", getTypeOf(property), ";"); | ||
}); | ||
@@ -299,26 +323,41 @@ --indent; | ||
// handles a single element of any understood type | ||
function handleElement(element, parent) { | ||
function handleElement(element, parent, insideClass) { | ||
if (seen[element.longname]) | ||
return; | ||
seen[element.longname] = element; | ||
if (isClass(element)) | ||
return handleClass(element, parent); | ||
switch (element.kind) { | ||
return true; | ||
if (isClassLike(element)) { | ||
if (insideClass) | ||
return false; | ||
handleClass(element, parent); | ||
} else switch (element.kind) { | ||
case "module": | ||
case "namespace": | ||
return handleNamespace(element, parent); | ||
if (insideClass) | ||
return false; | ||
handleNamespace(element, parent); | ||
break; | ||
case "constant": | ||
case "member": | ||
return handleMember(element, parent); | ||
if (insideClass && element.isEnum) | ||
return false; | ||
handleMember(element, parent); | ||
break; | ||
case "function": | ||
return handleFunction(element, parent); | ||
handleFunction(element, parent); | ||
break; | ||
case "typedef": | ||
return handleTypeDef(element, parent); | ||
if (insideClass) | ||
return false; | ||
handleTypeDef(element, parent); | ||
break; | ||
case "package": | ||
break; | ||
} | ||
seen[element.longname] = element; | ||
return true; | ||
} | ||
// handles (just) a namespace | ||
function handleNamespace(element, parent) { | ||
function handleNamespace(element/*, parent*/) { | ||
begin(element); | ||
writeln("module ", element.name, " {"); | ||
writeln("namespace ", element.name, " {"); | ||
++indent; | ||
@@ -340,4 +379,5 @@ getChildrenOf(element).forEach(function(child) { | ||
function handleClass(element, parent) { | ||
begin(element); | ||
if (isInterface(element)) | ||
var is_interface = isInterface(element); | ||
begin(element, is_interface); | ||
if (is_interface) | ||
write("interface "); | ||
@@ -372,12 +412,10 @@ else { | ||
// constructor | ||
if (!isInterface(element) && !element.virtual) | ||
if (!is_interface && !element.virtual) | ||
handleFunction(element, parent, true); | ||
// members except inner classes | ||
var innerClasses = []; | ||
// class-compatible members | ||
var inner = []; | ||
getChildrenOf(element).forEach(function(child) { | ||
if (isClass(child)) | ||
innerClasses.push(child); | ||
else | ||
handleElement(child, element); | ||
if (!handleElement(child, element, true)) | ||
inner.push(child); | ||
}); | ||
@@ -388,9 +426,11 @@ | ||
if (innerClasses.length) { | ||
writeln(""); | ||
begin(element); | ||
writeln("module ", element.name, " {"); | ||
// class-incompatible members | ||
if (inner.length) { | ||
writeln(); | ||
if (element.scope === "global" && !options.module) | ||
write("export "); | ||
writeln("namespace ", element.name, " {"); | ||
++indent; | ||
innerClasses.forEach(function(inner) { | ||
handleClass(inner, element); | ||
inner.forEach(function(child) { | ||
handleElement(child, element); | ||
}); | ||
@@ -408,7 +448,8 @@ --indent; | ||
writeln("enum ", element.name, "{"); | ||
writeln("enum ", element.name, " {"); | ||
++indent; | ||
element.properties.forEach(function(property, i) { | ||
writeComment(property); | ||
write(p.name); | ||
write(property.name); | ||
if (property.defaultvalue !== undefined) | ||
write(" = ", JSON.stringify(property.defaultvalue)); | ||
if (i < element.properties.length - 1) | ||
@@ -424,3 +465,3 @@ writeln(","); | ||
if (isClass(parent)) { | ||
if (isClassLike(parent)) { | ||
if (element.access) | ||
@@ -457,3 +498,3 @@ write(element.access, " "); | ||
begin(element); | ||
if (isClass(parent)) { | ||
if (isClassLike(parent)) { | ||
if (element.access) | ||
@@ -474,3 +515,3 @@ write(element.access, " "); | ||
if (isInterface(element)) { | ||
if (isClass(parent)) | ||
if (isClassLike(parent)) | ||
queuedInterfaces.push(element); | ||
@@ -482,3 +523,3 @@ else { | ||
} else { | ||
begin(element); | ||
begin(element, true); | ||
if (element.access) | ||
@@ -485,0 +526,0 @@ write(element.access, " "); |
{ | ||
"name": "protobufjs", | ||
"version": "6.3.1", | ||
"version": "6.4.0", | ||
"description": "Protocol Buffers for JavaScript (& TypeScript).", | ||
@@ -21,3 +21,4 @@ "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>", | ||
], | ||
"main": "src/index", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"bin": { | ||
@@ -27,3 +28,2 @@ "pbjs": "bin/pbjs", | ||
}, | ||
"types": "types/protobuf.js.d.ts", | ||
"scripts": { | ||
@@ -33,2 +33,3 @@ "bench": "node bench", | ||
"changelog": "node scripts/changelog -w", | ||
"coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js", | ||
"docs": "jsdoc -c jsdoc.docs.json -R README.md", | ||
@@ -39,4 +40,4 @@ "lint": "eslint src runtime", | ||
"prof": "node bench/prof", | ||
"test": "tape tests/*.js | tap-spec", | ||
"types": "node bin/pbts --name protobufjs --out types/protobuf.js.d.ts src && tsc types/test.ts --lib es2015 --noEmit", | ||
"test": "tape -r ./lib/tape-adapter tests/*.js | tap-spec", | ||
"types": "node bin/pbts --main --global protobuf --out index.d.ts src && tsc tests/typescript.ts --lib es2015 --noEmit && tsc tests/data/test.ts --lib es2015 --noEmit", | ||
"zuul": "zuul --ui tape --no-coverage --concurrency 4 -- tests/*.js", | ||
@@ -48,19 +49,19 @@ "zuul-local": "zuul --ui tape --concurrency 1 --local 8080 --disable-tunnel -- tests/*.js", | ||
"dependencies": { | ||
"@protobufjs/aspromise": "^1.0.4", | ||
"@protobufjs/base64": "^1.0.4", | ||
"@protobufjs/codegen": "^1.0.3", | ||
"@protobufjs/eventemitter": "^1.0.4", | ||
"@protobufjs/extend": "^1.0.1", | ||
"@protobufjs/fetch": "^1.0.3", | ||
"@protobufjs/inquire": "^1.0.1", | ||
"@protobufjs/path": "^1.0.1", | ||
"@protobufjs/pool": "^1.0.4", | ||
"@protobufjs/utf8": "^1.0.5" | ||
"@protobufjs/aspromise": "^1.0.5", | ||
"@protobufjs/base64": "^1.0.5", | ||
"@protobufjs/codegen": "^1.0.4", | ||
"@protobufjs/eventemitter": "^1.0.5", | ||
"@protobufjs/extend": "^1.0.2", | ||
"@protobufjs/fetch": "^1.0.4", | ||
"@protobufjs/inquire": "^1.0.2", | ||
"@protobufjs/path": "^1.0.2", | ||
"@protobufjs/pool": "^1.0.5", | ||
"@protobufjs/utf8": "^1.0.6" | ||
}, | ||
"optionalDependencies": { | ||
"long": "^3.2.0" | ||
"long": "^3.2.0", | ||
"@types/long": "^3.0.31" | ||
}, | ||
"devDependencies": { | ||
"@types/long": "^3.0.31", | ||
"@types/node": "6.0.54", | ||
"@types/node": "6.0.55", | ||
"benchmark": "^2.1.3", | ||
@@ -87,3 +88,5 @@ "browserify": "^13.1.1", | ||
"tape": "^4.6.3", | ||
"tmp": "0.0.31", | ||
"typescript": "^2.1.4", | ||
"uglify-js": "^2.7.5", | ||
"vinyl-buffer": "^1.0.0", | ||
@@ -90,0 +93,0 @@ "vinyl-fs": "^2.4.4", |
@@ -241,5 +241,4 @@ protobuf.js | ||
```ts | ||
/// <reference path="node_modules/protobufjs/types/protobuf.js.d.ts" /> | ||
import * as protobuf from "protobufjs"; | ||
import * as Long from "long"; // optional | ||
... | ||
@@ -250,2 +249,4 @@ ``` | ||
Additional configuration might be necessary when not utilizing node, i.e. reference [protobuf.js.d.ts](https://github.com/dcodeIO/protobuf.js/blob/master/index.d.ts) and [long.js.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/long/index.d.ts). | ||
Module Structure | ||
@@ -319,7 +320,6 @@ ---------------- | ||
* [Google's Developer Guide](https://developers.google.com/protocol-buffers/docs/overview) | ||
* [protobuf.js API Documentation](http://dcode.io/protobuf.js/) and [CHANGELOG](https://github.com/dcodeIO/protobuf.js/blob/master/CHANGELOG.md) | ||
* [Frequently asked questions](https://github.com/dcodeIO/protobuf.js/wiki) on our wiki | ||
* [More questions and answers](http://stackoverflow.com/questions/tagged/protobuf.js) on StackOverflow | ||
* [Questions and answers on StackOverflow](http://stackoverflow.com/questions/tagged/protobuf.js) | ||
Command line | ||
@@ -362,6 +362,10 @@ ------------ | ||
--no-create Does not generate create functions used for runtime compatibility. | ||
--no-encode Does not generate encode functions. | ||
--no-decode Does not generate decode functions. | ||
--no-verify Does not generate verify functions. | ||
--no-convert Does not generate convert functions like asJSON and from. | ||
--no-delimited Does not generate delimited encode/decode functions. | ||
--no-beautify Does not beautify generated code. | ||
--no-comments Does not output any JSDoc comments. | ||
@@ -402,2 +406,6 @@ usage: pbjs [options] file1.proto file2.json ... | ||
-m, --main Whether building the main library without any imports. | ||
-g, --global Name of the global object in browser environments, if any. | ||
--no-comments Does not output any JSDoc comments. | ||
@@ -460,3 +468,3 @@ | ||
Building the TypeScript definition to `types/`: | ||
Building the TypeScript definition to `index.d.ts`: | ||
@@ -544,5 +552,6 @@ ``` | ||
* If typed arrays are not supported by the environment, plain arrays will be used instead. | ||
* Support for pre-ES5 environments like IE8 can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js) and, instead of using property getters and setters on reflection objects, calling the respective functions prefixed with `get`, `set` or `is` directly (i.e. calling `Type#getFieldsById()` instead of accessing `Type#fieldsById`). Note that this also applies to virtual oneof properties (use `getKind`, `setKind` for example if the oneof is named `kind`). | ||
* Support for pre-ES5 environments (except IE8) can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js). | ||
* Support for [Content Security Policy](https://w3c.github.io/webappsec-csp/)-restricted environments (like Chrome extensions without [unsafe-eval](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval)) can be achieved by generating and using static code instead. | ||
* If you need a proper way to work with 64 bit values (uint64, int64 etc.), you can install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)). | ||
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) |
@@ -10,2 +10,3 @@ // This file exports just the bare minimum required to work with statically generated code. | ||
protobuf.BufferReader = require("../src/reader_buffer"); | ||
protobuf.converters = require("../src/converters"); | ||
protobuf.util = require("../src/util/runtime"); | ||
@@ -12,0 +13,0 @@ protobuf.roots = {}; |
var fs = require("fs"), | ||
path = require("path"), | ||
pbjs = require("../cli/pbjs"); | ||
pbjs = require("../cli/pbjs"), | ||
pbts = require("../cli/pbts"); | ||
@@ -9,3 +10,4 @@ [ | ||
"tests/data/mapbox/vector_tile.proto", | ||
"tests/data/ambiguous-names.proto" | ||
"tests/data/ambiguous-names.proto", | ||
"tests/data/test.proto" | ||
] | ||
@@ -23,4 +25,24 @@ .forEach(function(file) { | ||
throw err; | ||
fs.writeFileSync(out, fs.readFileSync(out).toString("utf8").replace(/\"protobufjs\/runtime\"/, "\"../../runtime\""), "utf8"); | ||
var pathToRuntime = path.relative(path.dirname(out), "runtime").replace(/\\/g, "/"); | ||
fs.writeFileSync(out, fs.readFileSync(out).toString("utf8").replace(/\"protobufjs\/runtime\"/g, JSON.stringify(pathToRuntime)), "utf8"); | ||
console.log("pbjs: " + file + " -> " + out); | ||
}) | ||
}); | ||
[ | ||
"tests/data/test.js" | ||
] | ||
.forEach(function(file) { | ||
var out = file.replace(/\.js$/, ".d.ts"); | ||
pbts.main([ | ||
"--out", out, | ||
"--no-comments", | ||
file | ||
], function(err) { | ||
if (err) | ||
throw err; | ||
var pathToProtobufjs = path.relative(path.dirname(out), "").replace(/\\/g, "/"); | ||
fs.writeFileSync(out, fs.readFileSync(out).toString("utf8").replace(/\"protobufjs\"/g, JSON.stringify(pathToProtobufjs)), "utf8"); | ||
console.log("pbts: " + file + " -> " + out); | ||
}); | ||
}); |
@@ -9,4 +9,2 @@ "use strict"; | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -35,3 +33,3 @@ * Constructs a class instance, which is also a message prototype. | ||
if (!(type instanceof Type)) | ||
throw TypeError("type", "a Type"); | ||
throw TypeError("type must be a Type"); | ||
@@ -41,3 +39,3 @@ if (ctor) { | ||
if (typeof ctor !== "function") | ||
throw TypeError("ctor", "a function"); | ||
throw TypeError("ctor must be a function"); | ||
} else | ||
@@ -65,3 +63,3 @@ ctor = (function(MessageCtor) { | ||
// Messages have non-enumerable default values on their prototype | ||
type.getFieldsArray().forEach(function(field) { | ||
type.fieldsArray.forEach(function(field) { | ||
// objects on the prototype must be immmutable. users must assign a new object instance and | ||
@@ -78,5 +76,5 @@ // cannot use Array#push on empty arrays on the prototype for example, as this would modify | ||
// Messages have non-enumerable getters and setters for each virtual oneof field | ||
type.getOneofsArray().forEach(function(oneof) { | ||
util.prop(prototype, oneof.resolve().name, { | ||
get: function getVirtual() { | ||
type.oneofsArray.forEach(function(oneof) { | ||
Object.defineProperty(prototype, oneof.resolve().name, { | ||
get: function() { | ||
// > If the parser encounters multiple members of the same oneof on the wire, only the last member seen is used in the parsed message. | ||
@@ -88,3 +86,3 @@ for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) | ||
}, | ||
set: function setVirtual(value) { | ||
set: function(value) { | ||
for (var keys = oneof.oneof, i = 0; i < keys.length; ++i) | ||
@@ -94,3 +92,2 @@ if (keys[i] !== value) | ||
} | ||
// see util.prop for IE8 support | ||
}); | ||
@@ -100,3 +97,3 @@ }); | ||
// Register | ||
type.setCtor(ctor); | ||
type.ctor = ctor; | ||
@@ -103,0 +100,0 @@ return prototype; |
@@ -9,10 +9,10 @@ "use strict"; | ||
* @param {string} name Short name as in `google/protobuf/[name].proto` or full file name | ||
* @param {Object} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition | ||
* @param {Object.<string,*>} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition | ||
* @returns {undefined} | ||
* @property {Object} google/protobuf/any.proto Any | ||
* @property {Object} google/protobuf/duration.proto Duration | ||
* @property {Object} google/protobuf/empty.proto Empty | ||
* @property {Object} google/protobuf/struct.proto Struct, Value, NullValue and ListValue | ||
* @property {Object} google/protobuf/timestamp.proto Timestamp | ||
* @property {Object} google/protobuf/wrappers.proto Wrappers | ||
* @property {Object.<string,*>} google/protobuf/any.proto Any | ||
* @property {Object.<string,*>} google/protobuf/duration.proto Duration | ||
* @property {Object.<string,*>} google/protobuf/empty.proto Empty | ||
* @property {Object.<string,*>} google/protobuf/struct.proto Struct, Value, NullValue and ListValue | ||
* @property {Object.<string,*>} google/protobuf/timestamp.proto Timestamp | ||
* @property {Object.<string,*>} google/protobuf/wrappers.proto Wrappers | ||
*/ | ||
@@ -19,0 +19,0 @@ function common(name, json) { |
@@ -15,7 +15,7 @@ "use strict"; | ||
/* eslint-disable no-unexpected-multiline */ | ||
var fields = mtype.getFieldsArray(); | ||
var fields = mtype.fieldsArray; | ||
var gen = util.codegen("r", "l") | ||
("r instanceof Reader||(r=Reader.create(r))") | ||
("var c=l===undefined?r.len:r.pos+l,m=new(this.getCtor())") | ||
("if(!(r instanceof Reader))") | ||
("r=Reader.create(r)") | ||
("var c=l===undefined?r.len:r.pos+l,m=new(this.ctor)") | ||
("while(r.pos<c){") | ||
@@ -56,3 +56,4 @@ ("var t=r.uint32()"); | ||
("%s&&%s.length||(%s=[])", ref, ref, ref); | ||
("if(!(%s&&%s.length))", ref, ref) | ||
("%s=[]", ref); | ||
@@ -62,4 +63,4 @@ // Packed | ||
("if((t&7)===2){") | ||
("var e=r.uint32()+r.pos") | ||
("while(r.pos<e)") | ||
("var c2=r.uint32()+r.pos") | ||
("while(r.pos<c2)") | ||
("%s.push(r.%s())", ref, type) | ||
@@ -66,0 +67,0 @@ ("}else"); |
@@ -21,6 +21,7 @@ "use strict"; | ||
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ | ||
var fields = mtype.getFieldsArray(); | ||
var oneofs = mtype.getOneofsArray(); | ||
var fields = mtype.fieldsArray; | ||
var oneofs = mtype.oneofsArray; | ||
var gen = util.codegen("m", "w") | ||
("w||(w=Writer.create())"); | ||
("if(!w)") | ||
("w=Writer.create()"); | ||
@@ -42,7 +43,6 @@ var i, ref; | ||
if (wireType === undefined) gen | ||
("types[%d].encode(%s[ks[i]],w.uint32(18).fork()).ldelim()", i, ref); // can't be groups | ||
("types[%d].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", i, ref); // can't be groups | ||
else gen | ||
("w.uint32(%d).%s(%s[ks[i]])", 16 | wireType, type, ref); | ||
(".uint32(%d).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); | ||
gen | ||
("w.ldelim()") | ||
("}") | ||
@@ -67,3 +67,3 @@ ("}"); | ||
("if(%s)", ref) | ||
("if(%s){", ref) | ||
("for(var i=0;i<%s.length;++i)", ref); | ||
@@ -74,2 +74,4 @@ if (wireType === undefined) | ||
("w.uint32(%d).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); | ||
gen | ||
("}"); | ||
@@ -82,6 +84,7 @@ } | ||
if (field.long) { | ||
gen | ||
("if(%s!==undefined&&util.longNe(%s,%d,%d))", ref, ref, field.defaultValue.low, field.defaultValue.high); | ||
} else gen | ||
if (field.long) gen | ||
("if(%s!==undefined&&%s!==null&&util.longNe(%s,%d,%d))", ref, ref, ref, field.defaultValue.low, field.defaultValue.high); | ||
else if (field.bytes) gen | ||
("if(%s&&%s.length" + (field.defaultValue.length ? "&&util.arrayNe(%s,%j)" : "") + ")", ref, ref, ref, Array.prototype.slice.call(field.defaultValue)); | ||
else gen | ||
("if(%s!==undefined&&%s!==%j)", ref, ref, field.defaultValue); | ||
@@ -101,4 +104,4 @@ | ||
gen | ||
("switch(%s){", "m.get" + oneof.ucName + "()"); | ||
var oneofFields = oneof.getFieldsArray(); | ||
("switch(%s){", "m" + util.safeProp(oneof.name)); | ||
var oneofFields = oneof.fieldsArray; | ||
for (var j = 0; j < oneofFields.length; ++j) { | ||
@@ -105,0 +108,0 @@ var field = oneofFields[j], |
@@ -12,4 +12,2 @@ "use strict"; | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -22,3 +20,3 @@ * Constructs a new enum instance. | ||
* @param {Object.<string,number>} [values] Enum values as an object, by name | ||
* @param {Object} [options] Declared options | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
@@ -29,49 +27,28 @@ function Enum(name, values, options) { | ||
/** | ||
* Enum values by name. | ||
* @type {Object.<string,number>} | ||
* Enum values by id. | ||
* @type {Object.<number,string>} | ||
*/ | ||
this.values = values || {}; // toJSON, marker | ||
this.valuesById = {}; | ||
/** | ||
* Cached values by id. | ||
* @type {?Object.<number,string>} | ||
* @private | ||
* Enum values by name. | ||
* @type {Object.<string,number>} | ||
*/ | ||
this._valuesById = null; | ||
} | ||
this.values = Object.create(this.valuesById); // toJSON, marker | ||
util.props(EnumPrototype, { | ||
// Note that values inherit valuesById on their prototype which makes them a TypeScript- | ||
// compatible enum. This is used by pbts to write actual enum definitions that work for | ||
// static and reflection code alike instead of emitting generic object definitions. | ||
/** | ||
* Enum values by id. | ||
* @name Enum#valuesById | ||
* @type {Object.<number,string>} | ||
* @readonly | ||
*/ | ||
valuesById: { | ||
get: function getValuesById() { | ||
if (!this._valuesById) { | ||
this._valuesById = {}; | ||
Object.keys(this.values).forEach(function(name) { | ||
var id = this.values[name]; | ||
if (this._valuesById[id]) | ||
throw Error("duplicate id " + id + " in " + this); | ||
this._valuesById[id] = name; | ||
}, this); | ||
} | ||
return this._valuesById; | ||
var self = this; | ||
Object.keys(values || {}).forEach(function(key) { | ||
var val; | ||
if (typeof values[key] === "number") | ||
val = values[key]; | ||
else { | ||
val = parseInt(key, 10); | ||
key = values[key]; | ||
} | ||
} | ||
/** | ||
* Gets this enum's values by id. This is an alias of {@link Enum#valuesById|valuesById}'s getter for use within non-ES5 environments. | ||
* @name Enum#getValuesById | ||
* @function | ||
* @returns {Object.<number,string>} | ||
*/ | ||
}); | ||
function clearCache(enm) { | ||
enm._valuesById = null; | ||
return enm; | ||
self.valuesById[self.values[key] = val] = key; | ||
}); | ||
} | ||
@@ -121,6 +98,6 @@ | ||
if (!util.isString(name)) | ||
throw TypeError("name"); | ||
throw TypeError("name must be a string"); | ||
/* istanbul ignore next */ | ||
if (!util.isInteger(id) || id < 0) | ||
throw TypeError("id", "a non-negative integer"); | ||
if (!util.isInteger(id)) | ||
throw TypeError("id must be an integer"); | ||
/* istanbul ignore next */ | ||
@@ -130,7 +107,7 @@ if (this.values[name] !== undefined) | ||
/* istanbul ignore next */ | ||
if (this.getValuesById()[id] !== undefined) | ||
if (this.valuesById[id] !== undefined) | ||
throw Error("duplicate id " + id + " in " + this); | ||
this.values[name] = id; | ||
return clearCache(this); | ||
this.valuesById[this.values[name] = id] = name; | ||
return this; | ||
}; | ||
@@ -147,7 +124,9 @@ | ||
if (!util.isString(name)) | ||
throw TypeError("name"); | ||
if (this.values[name] === undefined) | ||
throw TypeError("name must be a string"); | ||
var val = this.values[name]; | ||
if (val === undefined) | ||
throw Error("'" + name + "' is not a name of " + this); | ||
delete this.valuesById[val]; | ||
delete this.values[name]; | ||
return clearCache(this); | ||
return this; | ||
}; |
@@ -17,4 +17,2 @@ "use strict"; | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -28,5 +26,5 @@ * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. | ||
* @param {string} type Value type | ||
* @param {string|Object} [rule="optional"] Field rule | ||
* @param {string|Object} [extend] Extended type if different from parent | ||
* @param {Object} [options] Declared options | ||
* @param {string|Object.<string,*>} [rule="optional"] Field rule | ||
* @param {string|Object.<string,*>} [extend] Extended type if different from parent | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
@@ -45,12 +43,12 @@ function Field(name, id, type, rule, extend, options) { | ||
if (!util.isInteger(id) || id < 0) | ||
throw TypeError("id", "a non-negative integer"); | ||
throw TypeError("id must be a non-negative integer"); | ||
/* istanbul ignore next */ | ||
if (!util.isString(type)) | ||
throw TypeError("type"); | ||
throw TypeError("type must be a string"); | ||
/* istanbul ignore next */ | ||
if (extend !== undefined && !util.isString(extend)) | ||
throw TypeError("extend"); | ||
throw TypeError("extend must be a string"); | ||
/* istanbul ignore next */ | ||
if (rule !== undefined && !/^required|optional|repeated$/.test(rule = rule.toString().toLowerCase())) | ||
throw TypeError("rule", "a valid rule string"); | ||
throw TypeError("rule must be a string rule"); | ||
@@ -161,3 +159,3 @@ /** | ||
util.props(FieldPrototype, { | ||
Object.defineProperties(FieldPrototype, { | ||
@@ -171,3 +169,3 @@ /** | ||
packed: { | ||
get: FieldPrototype.isPacked = function() { | ||
get: function() { | ||
// defaults to packed=true if not explicity set to false | ||
@@ -179,9 +177,2 @@ if (this._packed === null) | ||
} | ||
/** | ||
* Determines whether this field is packed. This is an alias of {@link Field#packed|packed}'s getter for use within non-ES5 environments. | ||
* @name Field#isPacked | ||
* @function | ||
* @returns {boolean} | ||
*/ | ||
}); | ||
@@ -210,3 +201,3 @@ | ||
* @param {string} name Field name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {Field} Created field | ||
@@ -267,5 +258,7 @@ * @throws {TypeError} If arguments are invalid | ||
else { | ||
if (this.options && this.options["default"] !== undefined) | ||
if (this.options && this.options["default"] !== undefined) { | ||
this.defaultValue = this.options["default"]; | ||
else | ||
if (this.resolvedType instanceof Enum && typeof this.defaultValue === "string") | ||
this.defaultValue = this.resolvedType.values[this.defaultValue] || 0; | ||
} else | ||
this.defaultValue = typeDefault; | ||
@@ -277,2 +270,9 @@ | ||
Object.freeze(this.defaultValue); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it) | ||
} else if (this.bytes && typeof this.defaultValue === "string") { | ||
var buf; | ||
if (util.base64.test(this.defaultValue)) | ||
util.base64.decode(this.defaultValue, buf = util.newBuffer(util.base64.length(this.defaultValue)), 0); | ||
else | ||
util.utf8.write(this.defaultValue, buf = util.newBuffer(util.utf8.length(this.defaultValue)), 0); | ||
this.defaultValue = buf; | ||
} | ||
@@ -279,0 +279,0 @@ } |
@@ -19,2 +19,3 @@ "use strict"; | ||
* @returns {undefined} | ||
* @see {@link Root#load} | ||
*/ | ||
@@ -38,2 +39,3 @@ function load(filename, root, callback) { | ||
* @returns {undefined} | ||
* @see {@link Root#load} | ||
* @variation 2 | ||
@@ -50,2 +52,3 @@ */ | ||
* @returns {Promise<Root>} Promise | ||
* @see {@link Root#load} | ||
* @variation 3 | ||
@@ -63,2 +66,3 @@ */ | ||
* @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid | ||
* @see {@link Root#loadSync} | ||
*/ | ||
@@ -97,2 +101,3 @@ function loadSync(filename, root) { | ||
protobuf.verifier = require("./verifier"); | ||
protobuf.converter = require("./converter"); | ||
@@ -121,2 +126,3 @@ // Reflection | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -130,2 +136,3 @@ * Reconfigures the library according to the environment. | ||
/* istanbul ignore next */ | ||
// Be nice to AMD | ||
@@ -132,0 +139,0 @@ if (typeof define === "function" && define.amd) |
@@ -24,3 +24,3 @@ "use strict"; | ||
* @param {string} type Value type | ||
* @param {Object} [options] Declared options | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
@@ -32,3 +32,3 @@ function MapField(name, id, keyType, type, options) { | ||
if (!util.isString(keyType)) | ||
throw util._TypeError("keyType"); | ||
throw TypeError("keyType must be a string"); | ||
@@ -53,3 +53,3 @@ /** | ||
* Tests if the specified JSON object describes a map field. | ||
* @param {Object} json JSON object to test | ||
* @param {*} json JSON object to test | ||
* @returns {boolean} `true` if the object describes a field | ||
@@ -64,3 +64,3 @@ */ | ||
* @param {string} name Field name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {MapField} Created map field | ||
@@ -67,0 +67,0 @@ * @throws {TypeError} If arguments are invalid |
"use strict"; | ||
module.exports = Message; | ||
var convert = require("./convert"); | ||
var converters = require("./converters"); | ||
@@ -9,8 +9,6 @@ /** | ||
* | ||
* This method should be called from your custom constructors, i.e. `Message.call(this, properties)`. | ||
* This function should also be called from your custom constructors, i.e. `Message.call(this, properties)`. | ||
* @classdesc Abstract runtime message. | ||
* @extends {Object} | ||
* @constructor | ||
* @param {Object.<string,*>} [properties] Properties to set | ||
* @abstract | ||
* @see {@link Class.create} | ||
@@ -49,3 +47,3 @@ */ | ||
MessagePrototype.asJSON = function asJSON(options) { | ||
return convert(this.$type, this, {}, options, convert.toJson); | ||
return this.$type.convert(this, converters.json, options); | ||
}; | ||
@@ -60,3 +58,3 @@ | ||
Message.from = function from(object, options) { | ||
return convert(this.$type, object, new this.constructor(), options, convert.toMessage); | ||
return this.$type.convert(object, converters.message, options); | ||
}; | ||
@@ -116,1 +114,12 @@ | ||
}; | ||
/** | ||
* Converts an object or runtime message of this type. | ||
* @param {Message|Object} source Source object or runtime message | ||
* @param {ConverterImpl} impl Converter implementation to use, i.e. {@link converters.json} or {@link converters.message} | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Message|Object} Converted object or runtime message | ||
*/ | ||
Message.convert = function convert(source, impl, options) { | ||
return this.$type.convert(source, impl, options); | ||
}; |
@@ -13,4 +13,2 @@ "use strict"; | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -25,10 +23,12 @@ * Constructs a new service method instance. | ||
* @param {string} responseType Response message type | ||
* @param {boolean|Object} [requestStream] Whether the request is streamed | ||
* @param {boolean|Object} [responseStream] Whether the response is streamed | ||
* @param {Object} [options] Declared options | ||
* @param {boolean|Object.<string,*>} [requestStream] Whether the request is streamed | ||
* @param {boolean|Object.<string,*>} [responseStream] Whether the response is streamed | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
function Method(name, type, requestType, responseType, requestStream, responseStream, options) { | ||
/* istanbul ignore next */ | ||
if (util.isObject(requestStream)) { | ||
options = requestStream; | ||
requestStream = responseStream = undefined; | ||
/* istanbul ignore next */ | ||
} else if (util.isObject(responseStream)) { | ||
@@ -41,9 +41,9 @@ options = responseStream; | ||
if (type && !util.isString(type)) | ||
throw TypeError("type"); | ||
throw TypeError("type must be a string"); | ||
/* istanbul ignore next */ | ||
if (!util.isString(requestType)) | ||
throw TypeError("requestType"); | ||
throw TypeError("requestType must be a string"); | ||
/* istanbul ignore next */ | ||
if (!util.isString(responseType)) | ||
throw TypeError("responseType"); | ||
throw TypeError("responseType must be a string"); | ||
@@ -97,3 +97,3 @@ ReflectionObject.call(this, name, options); | ||
* Tests if the specified JSON object describes a service method. | ||
* @param {Object} json JSON object | ||
* @param {*} json JSON object | ||
* @returns {boolean} `true` if the object describes a map field | ||
@@ -108,3 +108,3 @@ */ | ||
* @param {string} name Method name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {Method} Created method | ||
@@ -111,0 +111,0 @@ * @throws {TypeError} If arguments are invalid |
@@ -33,4 +33,2 @@ "use strict"; | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -42,3 +40,3 @@ * Constructs a new namespace instance. | ||
* @param {string} name Namespace name | ||
* @param {Object} [options] Declared options | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
@@ -77,3 +75,3 @@ function Namespace(name, options) { | ||
util.props(NamespacePrototype, { | ||
Object.defineProperties(NamespacePrototype, { | ||
@@ -87,3 +85,3 @@ /** | ||
nestedArray: { | ||
get: function getNestedArray() { | ||
get: function() { | ||
return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); | ||
@@ -114,3 +112,3 @@ } | ||
* @param {string} name Namespace name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {Namespace} Created namespace | ||
@@ -129,3 +127,3 @@ * @throws {TypeError} If arguments are invalid | ||
options : this.options, | ||
nested : arrayToJSON(this.getNestedArray()) | ||
nested : arrayToJSON(this.nestedArray) | ||
}; | ||
@@ -166,3 +164,3 @@ }; | ||
return ns.add(nestedTypes[j].fromJSON(nestedName, nested)); | ||
throw TypeError("nested." + nestedName, "JSON for " + nestedError); | ||
throw TypeError("nested." + nestedName + " must be JSON for " + nestedError); | ||
}); | ||
@@ -210,6 +208,6 @@ } | ||
if (!object || nestedTypes.indexOf(object.constructor) < 0) | ||
throw TypeError("object", nestedError); | ||
throw TypeError("object must be " + nestedError); | ||
/* istanbul ignore next */ | ||
if (object instanceof Field && object.extend === undefined) | ||
throw TypeError("object", "an extension field when not part of a type"); | ||
throw TypeError("object must be an extension field when not part of a type"); | ||
@@ -224,3 +222,3 @@ if (!this.nested) | ||
// replace plain namespace but keep existing nested elements and options | ||
var nested = prev.getNestedArray(); | ||
var nested = prev.nestedArray; | ||
for (var i = 0; i < nested.length; ++i) | ||
@@ -254,3 +252,3 @@ object.add(nested[i]); | ||
if (!(object instanceof ReflectionObject)) | ||
throw TypeError("object", "a ReflectionObject"); | ||
throw TypeError("object must be a ReflectionObject"); | ||
/* istanbul ignore next */ | ||
@@ -310,3 +308,3 @@ if (object.parent !== this || !this.nested) | ||
// module with reflection-based solutions where the condition is met. | ||
var nested = this.getNestedArray(); | ||
var nested = this.nestedArray; | ||
for (var i = 0; i < nested.length; ++i) | ||
@@ -331,3 +329,3 @@ if (/^[A-Z]/.test(nested[i].name)) { | ||
NamespacePrototype.resolveAll = function resolveAll() { | ||
var nested = this.getNestedArray(), i = 0; | ||
var nested = this.nestedArray, i = 0; | ||
while (i < nested.length) | ||
@@ -359,3 +357,3 @@ if (nested[i] instanceof Namespace) | ||
if (path[0] === "") | ||
return this.getRoot().lookup(path.slice(1), filterType); | ||
return this.root.lookup(path.slice(1), filterType); | ||
// Test if the first part matches any nested object, and if so, traverse if path contains more | ||
@@ -362,0 +360,0 @@ var found = this.get(path[0]); |
@@ -11,4 +11,2 @@ "use strict"; | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -19,3 +17,3 @@ * Constructs a new reflection object instance. | ||
* @param {string} name Object name | ||
* @param {Object} [options] Declared options | ||
* @param {Object.<string,*>} [options] Declared options | ||
* @abstract | ||
@@ -27,6 +25,6 @@ */ | ||
if (!util.isString(name)) | ||
throw TypeError("name"); | ||
throw TypeError("name must be a string"); | ||
/* istanbul ignore next */ | ||
if (options && !util.isObject(options)) | ||
throw TypeError("options", "an object"); | ||
throw TypeError("options must be an object"); | ||
@@ -61,3 +59,3 @@ /** | ||
util.props(ReflectionObjectPrototype, { | ||
Object.defineProperties(ReflectionObjectPrototype, { | ||
@@ -71,3 +69,3 @@ /** | ||
root: { | ||
get: function getRoot() { | ||
get: function() { | ||
var ptr = this; | ||
@@ -87,3 +85,3 @@ while (ptr.parent !== null) | ||
fullName: { | ||
get: ReflectionObjectPrototype.getFullName = function getFullName() { | ||
get: function() { | ||
var path = [ this.name ], | ||
@@ -102,3 +100,3 @@ ptr = this.parent; | ||
* Converts this reflection object to its JSON representation. | ||
* @returns {Object} JSON object | ||
* @returns {Object.<string,*>} JSON object | ||
* @abstract | ||
@@ -120,3 +118,3 @@ */ | ||
this.resolved = false; | ||
var root = parent.getRoot(); | ||
var root = parent.root; | ||
if (!Root) | ||
@@ -134,3 +132,3 @@ Root = require("./root"); | ||
ReflectionObjectPrototype.onRemove = function onRemove(parent) { | ||
var root = parent.getRoot(); | ||
var root = parent.root; | ||
if (!Root) | ||
@@ -151,6 +149,5 @@ Root = require("./root"); | ||
return this; | ||
var root = this.getRoot(); | ||
if (!Root) | ||
Root = require("./root"); | ||
if (root instanceof Root) | ||
if (this.root instanceof Root) | ||
this.resolved = true; // only if part of a root | ||
@@ -203,4 +200,4 @@ return this; | ||
ReflectionObjectPrototype.toString = function toString() { | ||
var className = this.constructor.className; | ||
var fullName = this.getFullName(); | ||
var className = this.constructor.className, | ||
fullName = this.fullName; | ||
if (fullName.length) | ||
@@ -207,0 +204,0 @@ return className + " " + fullName; |
@@ -10,7 +10,4 @@ "use strict"; | ||
var Field = require("./field"), | ||
util = require("./util"); | ||
var Field = require("./field"); | ||
var TypeError = util._TypeError; | ||
/** | ||
@@ -23,3 +20,3 @@ * Constructs a new oneof instance. | ||
* @param {string[]|Object} [fieldNames] Field names | ||
* @param {Object} [options] Declared options | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
@@ -35,11 +32,5 @@ function OneOf(name, fieldNames, options) { | ||
if (fieldNames && !Array.isArray(fieldNames)) | ||
throw TypeError("fieldNames", "an Array"); | ||
throw TypeError("fieldNames must be an Array"); | ||
/** | ||
* Upper cased name for getter/setter calls. | ||
* @type {string} | ||
*/ | ||
this.ucName = util.ucFirst(this.name); | ||
/** | ||
* Field names that belong to this oneof. | ||
@@ -64,4 +55,4 @@ * @type {string[]} | ||
*/ | ||
util.prop(OneOfPrototype, "fieldsArray", { | ||
get: function getFieldsArray() { | ||
Object.defineProperty(OneOfPrototype, "fieldsArray", { | ||
get: function() { | ||
return this._fieldsArray; | ||
@@ -83,3 +74,3 @@ } | ||
* @param {string} name Oneof name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {MapField} Created oneof | ||
@@ -127,3 +118,3 @@ * @throws {TypeError} If arguments are invalid | ||
if (!(field instanceof Field)) | ||
throw TypeError("field", "a Field"); | ||
throw TypeError("field must be a Field"); | ||
@@ -148,3 +139,3 @@ if (field.parent) | ||
if (!(field instanceof Field)) | ||
throw TypeError("field", "a Field"); | ||
throw TypeError("field must be a Field"); | ||
@@ -151,0 +142,0 @@ var index = this._fieldsArray.indexOf(field); |
"use strict"; | ||
module.exports = parse; | ||
parse.filename = null; | ||
parse.defaults = { keepCase: false }; | ||
var tokenize = require("./tokenize"), | ||
@@ -41,3 +44,3 @@ Root = require("./root"), | ||
* @typedef ParserResult | ||
* @type {Object} | ||
* @type {Object.<string,*>} | ||
* @property {string|undefined} package Package name, if declared | ||
@@ -53,3 +56,3 @@ * @property {string[]|undefined} imports Imports, if any | ||
* @typedef ParseOptions | ||
* @type {Object} | ||
* @type {Object.<string,*>} | ||
* @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case | ||
@@ -63,5 +66,6 @@ */ | ||
* @param {Root} root Root to populate | ||
* @param {ParseOptions} [options] Parse options | ||
* @param {ParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. | ||
* @returns {ParserResult} Parser result | ||
* @property {string} filename=null Currently processing file name for error reporting, if known | ||
* @property {ParseOptions} defaults Default {@link ParseOptions} | ||
*/ | ||
@@ -71,6 +75,7 @@ function parse(source, root, options) { | ||
if (!(root instanceof Root)) { | ||
options = root; | ||
root = new Root(); | ||
options = root || {}; | ||
} else if (!options) | ||
options = {}; | ||
} | ||
if (!options) | ||
options = parse.defaults; | ||
@@ -413,4 +418,3 @@ var tn = tokenize(source), | ||
var values = {}; | ||
var enm = new Enum(name, values); | ||
var enm = new Enum(name); | ||
if (skip("{", true)) { | ||
@@ -439,3 +443,3 @@ while ((token = next()) !== "}") { | ||
var value = parseId(next(), true); | ||
parent.values[name] = value; | ||
parent.add(name, value); | ||
parseInlineOptions({}); // skips enum value options | ||
@@ -670,5 +674,5 @@ } | ||
* @param {string} source Source contents | ||
* @param {ParseOptions} [options] Parse options | ||
* @param {ParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. | ||
* @returns {ParserResult} Parser result | ||
* @variation 2 | ||
*/ |
@@ -54,3 +54,5 @@ "use strict"; | ||
return (Reader.create = function create_buffer(buffer) { | ||
return new BufferReader(buffer); | ||
return util.Buffer.isBuffer(buffer) | ||
? new BufferReader(buffer) | ||
: new Reader(buffer); | ||
})(buffer); | ||
@@ -491,3 +493,3 @@ } | ||
default: | ||
throw Error("invalid wire type: " + wireType); | ||
throw Error("invalid wire type " + wireType + " at offset " + this.pos); | ||
} | ||
@@ -494,0 +496,0 @@ return this; |
@@ -21,3 +21,3 @@ "use strict"; | ||
* @constructor | ||
* @param {Object} [options] Top level options | ||
* @param {Object.<string,*>} [options] Top level options | ||
*/ | ||
@@ -42,3 +42,3 @@ function Root(options) { | ||
* Loads a JSON definition into a root namespace. | ||
* @param {*} json JSON definition | ||
* @param {Object.<string,*>|*} json JSON definition | ||
* @param {Root} [root] Root namespace, defaults to create a new one if omitted | ||
@@ -48,2 +48,3 @@ * @returns {Root} Root namespace | ||
Root.fromJSON = function fromJSON(json, root) { | ||
// note that `json` actually must be of type `Object.<string,*>` but TypeScript | ||
if (!root) | ||
@@ -93,2 +94,4 @@ root = new Root(); | ||
return util.asPromise(load, self, filename); | ||
var sync = callback === SYNC; // undocumented | ||
@@ -104,4 +107,2 @@ // Finishes loading by calling the callback (exactly once) | ||
var sync = callback === SYNC; // undocumented | ||
// Processes a single file | ||
@@ -127,2 +128,4 @@ function process(filename, source) { | ||
} catch (err) { | ||
if (sync) | ||
throw err; | ||
finish(err); | ||
@@ -223,3 +226,3 @@ return; | ||
* @param {string|string[]} filename Names of one or multiple files to load | ||
* @param {ParseOptions} [options] Parse options | ||
* @param {ParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. | ||
* @returns {Promise<Root>} Promise | ||
@@ -233,3 +236,3 @@ * @variation 3 | ||
* @param {string|string[]} filename Names of one or multiple files to load | ||
* @param {ParseOptions} [options] Parse options | ||
* @param {ParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. | ||
* @returns {Root} Root namespace | ||
@@ -243,2 +246,13 @@ * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid | ||
/** | ||
* @override | ||
*/ | ||
RootPrototype.resolveAll = function resolveAll() { | ||
if (this.deferred.length) | ||
throw Error("unresolvable extensions: " + this.deferred.map(function(field) { | ||
return "'extend " + field.extend + "' in " + field.parent.fullName; | ||
}).join(", ")); | ||
return Namespace.prototype.resolveAll.call(this); | ||
}; | ||
/** | ||
* Handles a deferred declaring extension field by creating a sister field to represent it within its extended type. | ||
@@ -253,3 +267,3 @@ * @param {Field} field Declaring extension field witin the declaring type | ||
if (extendedType) { | ||
var sisterField = new Field(field.getFullName(), field.id, field.type, field.rule, undefined, field.options); | ||
var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options); | ||
sisterField.declaringField = field; | ||
@@ -284,3 +298,3 @@ field.extensionField = sisterField; | ||
else if (object instanceof Namespace) { | ||
var nested = object.getNestedArray(); | ||
var nested = object.nestedArray; | ||
for (i = 0; i < nested.length; ++i) // recurse into the namespace | ||
@@ -311,3 +325,3 @@ this._handleAdd(nested[i]); | ||
} else if (object instanceof Namespace) { | ||
var nested = object.getNestedArray(); | ||
var nested = object.nestedArray; | ||
for (var i = 0; i < nested.length; ++i) // recurse into the namespace | ||
@@ -314,0 +328,0 @@ this._handleRemove(nested[i]); |
@@ -42,3 +42,3 @@ "use strict"; | ||
util.props(ServicePrototype, { | ||
Object.defineProperties(ServicePrototype, { | ||
@@ -52,3 +52,3 @@ /** | ||
methodsArray: { | ||
get: function getMethodsArray() { | ||
get: function() { | ||
return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); | ||
@@ -67,3 +67,3 @@ } | ||
* Tests if the specified JSON object describes a service. | ||
* @param {Object} json JSON object to test | ||
* @param {*} json JSON object to test | ||
* @returns {boolean} `true` if the object describes a service | ||
@@ -78,3 +78,3 @@ */ | ||
* @param {string} name Service name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {Service} Created service | ||
@@ -99,3 +99,3 @@ * @throws {TypeError} If arguments are invalid | ||
options : inherited && inherited.options || undefined, | ||
methods : Namespace.arrayToJSON(this.getMethodsArray()) || {}, | ||
methods : Namespace.arrayToJSON(this.methodsArray) || {}, | ||
nested : inherited && inherited.nested || undefined | ||
@@ -116,3 +116,3 @@ }; | ||
ServicePrototype.resolveAll = function resolveAll() { | ||
var methods = this.getMethodsArray(); | ||
var methods = this.methodsArray; | ||
for (var i = 0; i < methods.length; ++i) | ||
@@ -183,3 +183,3 @@ methods[i].resolve(); | ||
var rpcService = new rpc.Service(rpcImpl); | ||
this.getMethodsArray().forEach(function(method) { | ||
this.methodsArray.forEach(function(method) { | ||
rpcService[util.lcFirst(method.name)] = function callVirtual(request, /* optional */ callback) { | ||
@@ -191,3 +191,3 @@ if (!rpcService.$rpc) // already ended? | ||
if (!request) | ||
throw util._TypeError("request", "not null"); | ||
throw TypeError("request must not be null"); | ||
@@ -194,0 +194,0 @@ method.resolve(); |
@@ -24,3 +24,3 @@ "use strict"; | ||
* Handle object returned from {@link tokenize}. | ||
* @typedef {Object} TokenizerHandle | ||
* @typedef {Object.<string,*>} TokenizerHandle | ||
* @property {function():number} line Gets the current line number | ||
@@ -27,0 +27,0 @@ * @property {function():?string} next Gets the next token and advances (`null` on eof) |
@@ -20,9 +20,8 @@ "use strict"; | ||
Writer = require("./writer"), | ||
convert = require("./convert"), | ||
util = require("./util"); | ||
util = require("./util"), | ||
encoder = require("./encoder"), | ||
decoder = require("./decoder"), | ||
verifier = require("./verifier"), | ||
converter = require("./converter"); | ||
var encoder, // might become cyclic | ||
decoder, // might become cyclic | ||
verifier; // cyclic | ||
/** | ||
@@ -34,3 +33,3 @@ * Constructs a new reflected message type instance. | ||
* @param {string} name Message name | ||
* @param {Object} [options] Declared options | ||
* @param {Object.<string,*>} [options] Declared options | ||
*/ | ||
@@ -106,3 +105,3 @@ function Type(name, options) { | ||
util.props(TypePrototype, { | ||
Object.defineProperties(TypePrototype, { | ||
@@ -116,3 +115,3 @@ /** | ||
fieldsById: { | ||
get: function getFieldsById() { | ||
get: function() { | ||
if (this._fieldsById) | ||
@@ -143,3 +142,3 @@ return this._fieldsById; | ||
fieldsArray: { | ||
get: function getFieldsArray() { | ||
get: function() { | ||
return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); | ||
@@ -156,4 +155,4 @@ } | ||
repeatedFieldsArray: { | ||
get: function getRepeatedFieldsArray() { | ||
return this._repeatedFieldsArray || (this._repeatedFieldsArray = this.getFieldsArray().filter(function(field) { return field.repeated; })); | ||
get: function() { | ||
return this._repeatedFieldsArray || (this._repeatedFieldsArray = this.fieldsArray.filter(function(field) { return field.repeated; })); | ||
} | ||
@@ -169,3 +168,3 @@ }, | ||
oneofsArray: { | ||
get: function getOneofsArray() { | ||
get: function() { | ||
return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); | ||
@@ -181,8 +180,8 @@ } | ||
ctor: { | ||
get: function getCtor() { | ||
get: function() { | ||
return this._ctor || (this._ctor = Class.create(this).constructor); | ||
}, | ||
set: function setCtor(ctor) { | ||
set: function(ctor) { | ||
if (ctor && !(ctor.prototype instanceof Message)) | ||
throw util._TypeError("ctor", "a Message constructor"); | ||
throw TypeError("ctor must be a Message constructor"); | ||
if (!ctor.from) | ||
@@ -217,3 +216,3 @@ ctor.from = Message.from; | ||
* @param {string} name Message name | ||
* @param {Object} json JSON object | ||
* @param {Object.<string,*>} json JSON object | ||
* @returns {Type} Created message type | ||
@@ -260,4 +259,4 @@ */ | ||
options : inherited && inherited.options || undefined, | ||
oneofs : Namespace.arrayToJSON(this.getOneofsArray()), | ||
fields : Namespace.arrayToJSON(this.getFieldsArray().filter(function(obj) { return !obj.declaringField; })) || {}, | ||
oneofs : Namespace.arrayToJSON(this.oneofsArray), | ||
fields : Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; })) || {}, | ||
extensions : this.extensions && this.extensions.length ? this.extensions : undefined, | ||
@@ -274,6 +273,6 @@ reserved : this.reserved && this.reserved.length ? this.reserved : undefined, | ||
TypePrototype.resolveAll = function resolveAll() { | ||
var fields = this.getFieldsArray(), i = 0; | ||
var fields = this.fieldsArray, i = 0; | ||
while (i < fields.length) | ||
fields[i++].resolve(); | ||
var oneofs = this.getOneofsArray(); i = 0; | ||
var oneofs = this.oneofsArray; i = 0; | ||
while (i < oneofs.length) | ||
@@ -305,3 +304,3 @@ oneofs[i++].resolve(); | ||
// type instead. | ||
if (this.getFieldsById()[object.id]) | ||
if (this.fieldsById[object.id]) | ||
throw Error("duplicate id " + object.id + " in " + this); | ||
@@ -346,7 +345,7 @@ if (object.parent) | ||
* Creates a new message of this type using the specified properties. | ||
* @param {Object} [properties] Properties to set | ||
* @param {Object.<string,*>} [properties] Properties to set | ||
* @returns {Message} Runtime message | ||
*/ | ||
TypePrototype.create = function create(properties) { | ||
return new (this.getCtor())(properties); | ||
return new this.ctor(properties); | ||
}; | ||
@@ -356,3 +355,3 @@ | ||
* Creates a new message of this type from a JSON object by converting strings and numbers to their respective field types. | ||
* @param {Object} object JSON object | ||
* @param {Object.<string,*>} object JSON object | ||
* @param {MessageConversionOptions} [options] Conversion options | ||
@@ -362,3 +361,3 @@ * @returns {Message} Runtime message | ||
TypePrototype.from = function from(object, options) { | ||
return convert(this, object, new (this.getCtor())(), options, convert.toMessage); | ||
return this.convert(object, converter.message, options); | ||
}; | ||
@@ -373,21 +372,22 @@ | ||
// multiple times (V8, soft-deopt prototype-check). | ||
if (!encoder) { | ||
encoder = require("./encoder"); | ||
decoder = require("./decoder"); | ||
verifier = require("./verifier"); | ||
} | ||
this.encode = encoder(this).eof(this.getFullName() + "$encode", { | ||
var fullName = this.fullName, | ||
types = this.fieldsArray.map(function(fld) { return fld.resolve().resolvedType; }); | ||
this.encode = encoder(this).eof(fullName + "$encode", { | ||
Writer : Writer, | ||
types : this.getFieldsArray().map(function(fld) { return fld.resolvedType; }), | ||
types : types, | ||
util : util | ||
}); | ||
this.decode = decoder(this).eof(this.getFullName() + "$decode", { | ||
this.decode = decoder(this).eof(fullName + "$decode", { | ||
Reader : Reader, | ||
types : this.getFieldsArray().map(function(fld) { return fld.resolvedType; }), | ||
types : types, | ||
util : util | ||
}); | ||
this.verify = verifier(this).eof(this.getFullName() + "$verify", { | ||
types : this.getFieldsArray().map(function(fld) { return fld.resolvedType; }), | ||
this.verify = verifier(this).eof(fullName + "$verify", { | ||
types : types, | ||
util : util | ||
}); | ||
this.convert = converter(this).eof(fullName + "$convert", { | ||
types : types, | ||
util : util | ||
}); | ||
return this; | ||
@@ -444,1 +444,12 @@ }; | ||
}; | ||
/** | ||
* Converts an object or runtime message. | ||
* @param {Message|Object} source Source object or runtime message | ||
* @param {ConverterImpl} impl Converter implementation to use, i.e. {@link converters.json} or {@link converters.message} | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Message|Object} Converted object or runtime message | ||
*/ | ||
TypePrototype.convert = function convert_setup(source, impl, options) { | ||
return this.setup().convert(source, impl, options); // overrides this method | ||
}; |
@@ -18,3 +18,3 @@ "use strict"; | ||
* Node's fs module if available. | ||
* @type {Object} | ||
* @type {Object.<string,*>} | ||
*/ | ||
@@ -29,29 +29,13 @@ util.fs = util.inquire("fs"); | ||
util.toArray = function toArray(object) { | ||
if (!object) | ||
return []; | ||
var names = Object.keys(object), | ||
length = names.length; | ||
var array = new Array(length); | ||
for (var i = 0; i < length; ++i) | ||
array[i] = object[names[i]]; | ||
return array; | ||
return object ? Object.values ? Object.values(object) : Object.keys(object).map(function(key) { | ||
return object[key]; | ||
}) : []; | ||
}; | ||
/** | ||
* Creates a type error. | ||
* @param {string} name Argument name | ||
* @param {string} [description="a string"] Expected argument descripotion | ||
* @returns {TypeError} Created type error | ||
* @private | ||
*/ | ||
util._TypeError = function(name, description) { | ||
return TypeError(name + " must be " + (description || "a string")); | ||
}; | ||
/** | ||
* Merges the properties of the source object into the destination object. | ||
* @param {Object} dst Destination object | ||
* @param {Object} src Source object | ||
* @param {Object.<string,*>} dst Destination object | ||
* @param {Object.<string,*>} src Source object | ||
* @param {boolean} [ifNotSet=false] Merges only if the key is not already set | ||
* @returns {Object} Destination object | ||
* @returns {Object.<string,*>} Destination object | ||
*/ | ||
@@ -78,7 +62,7 @@ util.merge = function merge(dst, src, ifNotSet) { | ||
/** | ||
* Converts the second character of a string to lower case. | ||
* Converts the first character of a string to lower case. | ||
* @param {string} str String to convert | ||
* @returns {string} Converted string | ||
*/ | ||
util.lcFirst = function lcFirst(str) { // ucFirst counterpart is in runtime util | ||
util.lcFirst = function lcFirst(str) { | ||
return str.charAt(0).toLowerCase() + str.substring(1); | ||
@@ -88,2 +72,11 @@ }; | ||
/** | ||
* Converts the first character of a string to upper case. | ||
* @param {string} str String to convert | ||
* @returns {string} Converted string | ||
*/ | ||
util.ucFirst = function ucFirst(str) { | ||
return str.charAt(0).toUpperCase() + str.substring(1); | ||
}; | ||
/** | ||
* Creates a new buffer of whatever type supported by the environment. | ||
@@ -90,0 +83,0 @@ * @param {number} [size=0] Buffer size |
@@ -54,2 +54,9 @@ "use strict"; | ||
/** | ||
* Zero hash. | ||
* @memberof util.LongBits | ||
* @type {string} | ||
*/ | ||
var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; | ||
/** | ||
* Constructs new long bits from the specified number. | ||
@@ -62,6 +69,7 @@ * @param {number} value Value | ||
return zero; | ||
var sign = value < 0; | ||
value = Math.abs(value); | ||
var sign = value < 0; | ||
if (sign) | ||
value = -value; | ||
var lo = value >>> 0, | ||
hi = (value - lo) / 4294967296 >>> 0; | ||
hi = (value - lo) / 4294967296 >>> 0; | ||
if (sign) { | ||
@@ -88,2 +96,3 @@ hi = ~hi >>> 0; | ||
if (typeof value === "string") { | ||
/* istanbul ignore else */ | ||
if (util.Long) | ||
@@ -104,7 +113,7 @@ value = util.Long.fromString(value); | ||
if (!unsigned && this.hi >>> 31) { | ||
this.lo = ~this.lo + 1 >>> 0; | ||
this.hi = ~this.hi >>> 0; | ||
if (!this.lo) | ||
this.hi = this.hi + 1 >>> 0; | ||
return -(this.lo + this.hi * 4294967296); | ||
var lo = ~this.lo + 1 >>> 0, | ||
hi = ~this.hi >>> 0; | ||
if (!lo) | ||
hi = hi + 1 >>> 0; | ||
return -(lo + hi * 4294967296); | ||
} | ||
@@ -122,2 +131,3 @@ return this.lo + this.hi * 4294967296; | ||
? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) | ||
/* istanbul ignore next */ | ||
: { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; | ||
@@ -134,2 +144,4 @@ }; | ||
LongBits.fromHash = function fromHash(hash) { | ||
if (hash === zeroHash) | ||
return zero; | ||
return new LongBits( | ||
@@ -136,0 +148,0 @@ ( charCodeAt.call(hash, 0) |
@@ -5,3 +5,2 @@ "use strict"; | ||
util.LongBits = require("./longbits"); | ||
util.base64 = require("@protobufjs/base64"); | ||
@@ -12,2 +11,4 @@ util.inquire = require("@protobufjs/inquire"); | ||
util.LongBits = require("./longbits"); | ||
/** | ||
@@ -21,9 +22,2 @@ * Whether running within node or not. | ||
/** | ||
* Whether running within IE8 or not. | ||
* @memberof util | ||
* @type {boolean} | ||
*/ | ||
util.isIE8 = false; try { util.isIE8 = eval("!-[1,]"); } catch (e) {} // eslint-disable-line no-eval, no-empty | ||
/** | ||
* Node's Buffer class if available. | ||
@@ -104,3 +98,3 @@ * @type {?function(new: Buffer)} | ||
? util.LongBits.from(value).toHash() | ||
: "\0\0\0\0\0\0\0\0"; | ||
: util.LongBits.zeroHash; | ||
}; | ||
@@ -122,19 +116,2 @@ | ||
/** | ||
* Tests if two possibly long values are not equal. | ||
* @param {number|Long} a First value | ||
* @param {number|Long} b Second value | ||
* @returns {boolean} `true` if not equal | ||
* @deprecated Use {@link util.longNe|longNe} instead | ||
*/ | ||
util.longNeq = function longNeq(a, b) { | ||
return typeof a === "number" | ||
? typeof b === "number" | ||
? a !== b | ||
: (a = util.LongBits.fromNumber(a)).lo !== b.low || a.hi !== b.high | ||
: typeof b === "number" | ||
? (b = util.LongBits.fromNumber(b)).lo !== a.low || b.hi !== a.high | ||
: a.low !== b.low || a.high !== b.high; | ||
}; | ||
/** | ||
* Tests if a possibily long value equals the specified low and high bits. | ||
@@ -154,48 +131,2 @@ * @param {number|string|Long} val Value to test | ||
/** | ||
* Converts the first character of a string to upper case. | ||
* @param {string} str String to convert | ||
* @returns {string} Converted string | ||
*/ | ||
util.ucFirst = function ucFirst(str) { // lcFirst counterpart is in core util | ||
return str.charAt(0).toUpperCase() + str.substring(1); | ||
}; | ||
/** | ||
* Defines the specified properties on the specified target. Also adds getters and setters for non-ES5 environments. | ||
* @param {Object} target Target object | ||
* @param {Object} descriptors Property descriptors | ||
* @returns {undefined} | ||
*/ | ||
util.props = function props(target, descriptors) { | ||
Object.keys(descriptors).forEach(function(key) { | ||
util.prop(target, key, descriptors[key]); | ||
}); | ||
}; | ||
/** | ||
* Defines the specified property on the specified target. Also adds getters and setters for non-ES5 environments. | ||
* @param {Object} target Target object | ||
* @param {string} key Property name | ||
* @param {Object} descriptor Property descriptor | ||
* @returns {undefined} | ||
*/ | ||
util.prop = function prop(target, key, descriptor) { | ||
var ucKey = util.ucFirst(key); | ||
if (descriptor.get) | ||
target["get" + ucKey] = descriptor.get; | ||
if (descriptor.set) | ||
target["set" + ucKey] = util.isIE8 | ||
? function(value) { | ||
descriptor.set.call(this, value); | ||
this[key] = value; | ||
} | ||
: descriptor.set; | ||
if (util.isIE8) { | ||
if (descriptor.value !== undefined) | ||
target[key] = descriptor.value; | ||
} else | ||
Object.defineProperty(target, key, descriptor); | ||
}; | ||
/** | ||
* An immuable empty array. | ||
@@ -212,1 +143,15 @@ * @memberof util | ||
util.emptyObject = Object.freeze ? Object.freeze({}) : {}; | ||
/** | ||
* Tests if two arrays are not equal. | ||
* @param {Array.<*>} a Array 1 | ||
* @param {Array.<*>} b Array 2 | ||
* @returns {boolean} `true` if not equal, otherwise `false` | ||
*/ | ||
util.arrayNe = function arrayNe(a, b) { | ||
if (a.length === b.length) | ||
for (var i = 0; i < a.length; ++i) | ||
if (a[i] !== b[i]) | ||
return true; | ||
return false; | ||
}; |
@@ -5,7 +5,6 @@ "use strict"; | ||
var Enum = require("./enum"), | ||
Type = require("./type"), | ||
util = require("./util"); | ||
function invalid(field, expected) { | ||
return "invalid value for field " + field.getFullName() + " (" + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected)"; | ||
return field.fullName.substring(1) + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected"; | ||
} | ||
@@ -26,6 +25,6 @@ | ||
("}"); | ||
} else if (field.resolvedType instanceof Type) gen | ||
("var r;") | ||
("if(r=types[%d].verify(%s))", fieldIndex, ref) | ||
("return r"); | ||
} else gen | ||
("var e;") | ||
("if(e=types[%d].verify(%s))", fieldIndex, ref) | ||
("return e"); | ||
} else { | ||
@@ -105,3 +104,5 @@ switch (field.type) { | ||
/* eslint-disable no-unexpected-multiline */ | ||
var fields = mtype.getFieldsArray(); | ||
var fields = mtype.fieldsArray; | ||
if (!fields.length) | ||
return util.codegen()("return null"); | ||
var gen = util.codegen("m"); | ||
@@ -139,3 +140,3 @@ | ||
if (!field.required) { | ||
if (field.resolvedType instanceof Type) gen | ||
if (field.resolvedType && !(field.resolvedType instanceof Enum)) gen | ||
("if(%s!==undefined&&%s!==null){", ref, ref); | ||
@@ -142,0 +143,0 @@ else gen |
@@ -17,3 +17,4 @@ var tape = require("tape"); | ||
var valueBuffer = protobuf.util.newBuffer(0); | ||
var valueBuffer = protobuf.util.newBuffer(1); | ||
valueBuffer[0] = 0; | ||
var any = Any.create({ | ||
@@ -33,4 +34,3 @@ type_url: "some.type", | ||
var writer = Any.encode(any), | ||
buf, | ||
msg; | ||
buf; | ||
@@ -41,4 +41,4 @@ function verifyEncode(test, buf) { | ||
test.equal(buf[11] , 2 << 3 | 2, "a tag with id 2, wire type 2"); | ||
test.equal(buf[12] , 0 , "a field length of 0"); | ||
test.equal(buf.length, 13 , "13 bytes in total"); | ||
test.equal(buf[12] , 1 , "a field length of 1"); | ||
test.equal(buf.length, 14 , "14 bytes in total"); | ||
} | ||
@@ -58,3 +58,3 @@ | ||
msg = Any.decode(buf); | ||
var msg = Any.decode(buf); | ||
@@ -71,8 +71,8 @@ test.deepEqual(msg, any, "an equal message"); | ||
test.equal(buf[0] , 13 , "a length of 13"); | ||
test.equal(buf[0] , 14 , "a length of 14"); | ||
test.equal(buf[1] , 1 << 3 | 2, "a tag with id 1, wire type 2"); | ||
test.equal(buf[2] , 9 , "a field length of 9"); | ||
test.equal(buf[12] , 2 << 3 | 2, "a tag with id 2, wire type 2"); | ||
test.equal(buf[13] , 0 , "a field length of 0"); | ||
test.equal(buf.length, 14 , "14 bytes in total"); | ||
test.equal(buf[13] , 1 , "a field length of 1"); | ||
test.equal(buf.length, 15 , "15 bytes in total"); | ||
@@ -84,3 +84,3 @@ test.end(); | ||
msg = Any.decodeDelimited(buf); | ||
var msg = Any.decodeDelimited(buf); | ||
test.deepEqual(msg, any, "an equal message"); | ||
@@ -87,0 +87,0 @@ |
@@ -20,3 +20,4 @@ var tape = require("tape"); | ||
var valueBuffer = protobuf.util.newBuffer(0); | ||
var valueBuffer = protobuf.util.newBuffer(1); | ||
valueBuffer[0] = 0; | ||
var any = new Any({ | ||
@@ -45,4 +46,4 @@ type_url: "some.type", | ||
test.equal(buf[11] , 2 << 3 | 2, "a tag with id 2, wire type 2"); | ||
test.equal(buf[12] , 0 , "a field length of 0"); | ||
test.equal(buf.length, 13 , "13 bytes in total"); | ||
test.equal(buf[12] , 1 , "a field length of 1"); | ||
test.equal(buf.length, 14 , "14 bytes in total"); | ||
@@ -65,8 +66,8 @@ test.end(); | ||
test.equal(buf[0] , 13 , "a length of 13"); | ||
test.equal(buf[0] , 14 , "a length of 14"); | ||
test.equal(buf[1] , 1 << 3 | 2, "a tag with id 1, wire type 2"); | ||
test.equal(buf[2] , 9 , "a field length of 9"); | ||
test.equal(buf[12] , 2 << 3 | 2, "a tag with id 2, wire type 2"); | ||
test.equal(buf[13] , 0 , "a field length of 0"); | ||
test.equal(buf.length, 14 , "14 bytes in total"); | ||
test.equal(buf[13] , 1 , "a field length of 1"); | ||
test.equal(buf.length, 15 , "15 bytes in total"); | ||
@@ -73,0 +74,0 @@ test.end(); |
var tape = require("tape"); | ||
var protobuf = require(".."); | ||
@@ -50,2 +51,20 @@ | ||
test.test("called with arrays = true", function(test) { | ||
var obj = Message.create().asJSON({ arrays: true }); | ||
test.equal(obj.stringVal, undefined, "should not set stringVal"); | ||
test.same(obj.stringRepeated, [], "should set stringRepeated"); | ||
test.equal(obj.uint64Val, undefined, "should not set uint64Val"); | ||
test.same(obj.uint64Repeated, [], "should set uint64Repeated"); | ||
test.equal(obj.bytesVal, undefined, "should not set bytesVal"); | ||
test.same(obj.bytesRepeated, [], "should set bytesRepeated"); | ||
test.equal(obj.enumVal, undefined, "should not set enumVal"); | ||
test.same(obj.enumRepeated, [], "should set enumRepeated"); | ||
test.end(); | ||
}); | ||
test.test("should convert", function(test) { | ||
@@ -52,0 +71,0 @@ var buf = protobuf.util.newBuffer(3); |
@@ -1,3 +0,7 @@ | ||
"use strict"; // eslint-disable-line strict | ||
// $> pbjs --target static-module --wrap commonjs --root test_ambiguous-names --out tests/data/ambiguous-names.js tests/data/ambiguous-names.proto | ||
// Generated Mon, 02 Jan 2017 21:00:30 UTC | ||
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex*/ | ||
"use strict"; | ||
var $protobuf = require("../../runtime"); | ||
@@ -32,6 +36,5 @@ | ||
* A whatever. | ||
* @name A#whatever | ||
* @type {string} | ||
*/ | ||
$prototype["whatever"] = ""; | ||
$prototype.whatever = ""; | ||
@@ -48,27 +51,23 @@ /** | ||
/** | ||
* Encodes the specified A. | ||
* Encodes the specified A message. | ||
* @function | ||
* @param {A|Object} message A or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {A|Object} message A message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
A.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.whatever!==undefined&&m.whatever!=="") | ||
w.uint32(10).string(m.whatever) | ||
return w | ||
A.encode = (function(Writer) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.whatever !== undefined && message.whatever !== "") { | ||
writer.uint32(10).string(message.whatever); | ||
} | ||
return writer; | ||
};})($protobuf.Writer); | ||
/** | ||
* Encodes the specified A, length delimited. | ||
* @param {A|Object} message A or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified A message, length delimited. | ||
* @param {A|Object} message A message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -80,35 +79,31 @@ A.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a A from the specified reader or buffer. | ||
* Decodes a A message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {A} A | ||
*/ | ||
A.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.A | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.whatever=r.string() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
} | ||
A.decode = (function(Reader) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.A(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.whatever = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader); | ||
/** | ||
* Decodes a A from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a A message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {A} A | ||
@@ -122,21 +117,56 @@ */ | ||
/** | ||
* Verifies a A. | ||
* Verifies a A message. | ||
* @function | ||
* @param {A|Object} message A or plain object to verify | ||
* @param {A|Object} message A message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
A.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function verify(m) { | ||
if(m.whatever!==undefined){ | ||
if(!util.isString(m.whatever)) | ||
return"invalid value for field .A.whatever (string expected)" | ||
A.verify = (function(util) { return function verify(message) { | ||
if (message.whatever !== undefined) { | ||
if (!util.isString(message.whatever)) { | ||
return "A.whatever: string expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util); | ||
/** | ||
* Converts a A message. | ||
* @function | ||
* @param {A|Object} source A message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {A|Object} Converted message | ||
*/ | ||
A.convert = (function() { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.whatever === undefined && options.defaults) { | ||
dst.whatever = ""; | ||
} | ||
} | ||
return dst; | ||
};})(); | ||
/** | ||
* Creates a A message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {A} A | ||
*/ | ||
A.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this A message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return A; | ||
@@ -166,7 +196,9 @@ })(); | ||
* B A. | ||
* @name B#A | ||
* @type {A} | ||
*/ | ||
$prototype["A"] = null; | ||
$prototype.A = null; | ||
// Referenced types | ||
var $types = ["A"]; $lazyTypes.push($types); | ||
/** | ||
@@ -182,27 +214,23 @@ * Creates a new B instance using the specified properties. | ||
/** | ||
* Encodes the specified B. | ||
* Encodes the specified B message. | ||
* @function | ||
* @param {B|Object} message B or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {B|Object} message B message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
B.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = ["A"]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.A!==undefined&&m.A!==null) | ||
types[0].encode(m.A,w.uint32(10).fork()).ldelim() | ||
return w | ||
B.encode = (function(Writer, types) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.A !== undefined && message.A !== null) { | ||
types[0].encode(message.A, writer.uint32(10).fork()).ldelim(); | ||
} | ||
return writer; | ||
};})($protobuf.Writer, $types); | ||
/** | ||
* Encodes the specified B, length delimited. | ||
* @param {B|Object} message B or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified B message, length delimited. | ||
* @param {B|Object} message B message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -214,35 +242,31 @@ B.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a B from the specified reader or buffer. | ||
* Decodes a B message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {B} B | ||
*/ | ||
B.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = ["A"]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.B | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.A=types[0].decode(r,r.uint32()) | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
} | ||
B.decode = (function(Reader, types) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.B(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.A = types[0].decode(reader, reader.uint32()); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader, $types); | ||
/** | ||
* Decodes a B from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a B message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {B} B | ||
@@ -256,22 +280,55 @@ */ | ||
/** | ||
* Verifies a B. | ||
* Verifies a B message. | ||
* @function | ||
* @param {B|Object} message B or plain object to verify | ||
* @param {B|Object} message B message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
B.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = ["A"]); | ||
return function verify(m) { | ||
if(m.A!==undefined&&m.A!==null){ | ||
var r; | ||
if(r=types[0].verify(m.A)) | ||
return r | ||
B.verify = (function(types) { return function verify(message) { | ||
if (message.A !== undefined && message.A !== null) { | ||
var err; | ||
if (err = types[0].verify(message.A)) { | ||
return err; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($types); | ||
/** | ||
* Converts a B message. | ||
* @function | ||
* @param {B|Object} source B message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {B|Object} Converted message | ||
*/ | ||
B.convert = (function(types) { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
dst.A = types[0].convert(src.A, impl, options); | ||
} | ||
return dst; | ||
};})($types); | ||
/** | ||
* Creates a B message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {B} B | ||
*/ | ||
B.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this B message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return B; | ||
@@ -285,3 +342,3 @@ })(); | ||
return; | ||
path = path.split('.'); | ||
path = path.split("."); | ||
var ptr = $root; | ||
@@ -288,0 +345,0 @@ while (path.length) |
@@ -1,5 +0,9 @@ | ||
"use strict"; // eslint-disable-line strict | ||
// $> pbjs --target static-module --wrap commonjs --root test_vector_tile --out tests/data/mapbox/vector_tile.js tests/data/mapbox/vector_tile.proto | ||
// Generated Mon, 02 Jan 2017 21:00:30 UTC | ||
var $protobuf = require("../../runtime"); | ||
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex*/ | ||
"use strict"; | ||
var $protobuf = require("../../../runtime"); | ||
// Lazily resolved type references | ||
@@ -41,7 +45,9 @@ var $lazyTypes = []; | ||
* Tile layers. | ||
* @name vector_tile.Tile#layers | ||
* @type {Array.<vector_tile.Tile.Layer>} | ||
*/ | ||
$prototype["layers"] = $protobuf.util.emptyArray; | ||
$prototype.layers = $protobuf.util.emptyArray; | ||
// Referenced types | ||
var $types = ["vector_tile.Tile.Layer"]; $lazyTypes.push($types); | ||
/** | ||
@@ -57,28 +63,25 @@ * Creates a new Tile instance using the specified properties. | ||
/** | ||
* Encodes the specified Tile. | ||
* Encodes the specified Tile message. | ||
* @function | ||
* @param {vector_tile.Tile|Object} message Tile or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {vector_tile.Tile|Object} message Tile message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Tile.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = ["vector_tile.Tile.Layer"]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.layers) | ||
for(var i=0;i<m.layers.length;++i) | ||
types[0].encode(m.layers[i],w.uint32(26).fork()).ldelim() | ||
return w | ||
Tile.encode = (function(Writer, types) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.layers) { | ||
for (var i = 0; i < message.layers.length; ++i) { | ||
types[0].encode(message.layers[i], writer.uint32(26).fork()).ldelim(); | ||
} | ||
} | ||
return writer; | ||
};})($protobuf.Writer, $types); | ||
/** | ||
* Encodes the specified Tile, length delimited. | ||
* @param {vector_tile.Tile|Object} message Tile or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified Tile message, length delimited. | ||
* @param {vector_tile.Tile|Object} message Tile message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -90,36 +93,34 @@ Tile.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a Tile from the specified reader or buffer. | ||
* Decodes a Tile message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {vector_tile.Tile} Tile | ||
*/ | ||
Tile.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = ["vector_tile.Tile.Layer"]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.vector_tile.Tile | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 3: | ||
m.layers&&m.layers.length||(m.layers=[]) | ||
m.layers.push(types[0].decode(r,r.uint32())) | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
Tile.decode = (function(Reader, types) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.vector_tile.Tile(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 3: | ||
if (!(message.layers && message.layers.length)) { | ||
message.layers = []; | ||
} | ||
message.layers.push(types[0].decode(reader, reader.uint32())); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader, $types); | ||
/** | ||
* Decodes a Tile from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a Tile message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {vector_tile.Tile} Tile | ||
@@ -133,39 +134,89 @@ */ | ||
/** | ||
* Verifies a Tile. | ||
* Verifies a Tile message. | ||
* @function | ||
* @param {vector_tile.Tile|Object} message Tile or plain object to verify | ||
* @param {vector_tile.Tile|Object} message Tile message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Tile.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = ["vector_tile.Tile.Layer"]); | ||
return function verify(m) { | ||
if(m.layers!==undefined){ | ||
if(!Array.isArray(m.layers)) | ||
return"invalid value for field .vector_tile.Tile.layers (array expected)" | ||
for(var i=0;i<m.layers.length;++i){ | ||
var r; | ||
if(r=types[0].verify(m.layers[i])) | ||
return r | ||
Tile.verify = (function(types) { return function verify(message) { | ||
if (message.layers !== undefined) { | ||
if (!Array.isArray(message.layers)) { | ||
return "vector_tile.Tile.layers: array expected"; | ||
} | ||
for (var i = 0; i < message.layers.length; ++i) { | ||
var err; | ||
if (err = types[0].verify(message.layers[i])) { | ||
return err; | ||
} | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($types); | ||
/** | ||
* GeomType values. | ||
* @exports vector_tile.Tile.GeomType | ||
* @type {Object.<string,number>} | ||
* Converts a Tile message. | ||
* @function | ||
* @param {vector_tile.Tile|Object} source Tile message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile|Object} Converted message | ||
*/ | ||
Tile.GeomType = { | ||
Tile.convert = (function(types) { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (src.layers && src.layers.length) { | ||
dst.layers = []; | ||
for (var i = 0; i < src.layers.length; ++i) { | ||
dst.layers.push(types[0].convert(src.layers[i], impl, options)); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.layers = []; | ||
} | ||
} | ||
} | ||
return dst; | ||
};})($types); | ||
UNKNOWN: 0, | ||
POINT: 1, | ||
LINESTRING: 2, | ||
POLYGON: 3 | ||
/** | ||
* Creates a Tile message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile} Tile | ||
*/ | ||
Tile.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this Tile message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
/** | ||
* GeomType enum. | ||
* @name GeomType | ||
* @memberof vector_tile.Tile | ||
* @enum {number} | ||
* @property {number} UNKNOWN=0 UNKNOWN value | ||
* @property {number} POINT=1 POINT value | ||
* @property {number} LINESTRING=2 LINESTRING value | ||
* @property {number} POLYGON=3 POLYGON value | ||
*/ | ||
Tile.GeomType = (function() { | ||
var valuesById = {}, | ||
values = Object.create(valuesById); | ||
values[valuesById[0] = "UNKNOWN"] = 0; | ||
values[valuesById[1] = "POINT"] = 1; | ||
values[valuesById[2] = "LINESTRING"] = 2; | ||
values[valuesById[3] = "POLYGON"] = 3; | ||
return values; | ||
})(); | ||
Tile.Value = (function() { | ||
@@ -192,48 +243,41 @@ | ||
* Value stringValue. | ||
* @name vector_tile.Tile.Value#stringValue | ||
* @type {string} | ||
*/ | ||
$prototype["stringValue"] = ""; | ||
$prototype.stringValue = ""; | ||
/** | ||
* Value floatValue. | ||
* @name vector_tile.Tile.Value#floatValue | ||
* @type {number} | ||
*/ | ||
$prototype["floatValue"] = 0; | ||
$prototype.floatValue = 0; | ||
/** | ||
* Value doubleValue. | ||
* @name vector_tile.Tile.Value#doubleValue | ||
* @type {number} | ||
*/ | ||
$prototype["doubleValue"] = 0; | ||
$prototype.doubleValue = 0; | ||
/** | ||
* Value intValue. | ||
* @name vector_tile.Tile.Value#intValue | ||
* @type {number|Long} | ||
*/ | ||
$prototype["intValue"] = $protobuf.util.emptyObject; | ||
$prototype.intValue = $protobuf.util.emptyObject; | ||
/** | ||
* Value uintValue. | ||
* @name vector_tile.Tile.Value#uintValue | ||
* @type {number|Long} | ||
*/ | ||
$prototype["uintValue"] = $protobuf.util.emptyObject; | ||
$prototype.uintValue = $protobuf.util.emptyObject; | ||
/** | ||
* Value sintValue. | ||
* @name vector_tile.Tile.Value#sintValue | ||
* @type {number|Long} | ||
*/ | ||
$prototype["sintValue"] = $protobuf.util.emptyObject; | ||
$prototype.sintValue = $protobuf.util.emptyObject; | ||
/** | ||
* Value boolValue. | ||
* @name vector_tile.Tile.Value#boolValue | ||
* @type {boolean} | ||
*/ | ||
$prototype["boolValue"] = false; | ||
$prototype.boolValue = false; | ||
@@ -250,39 +294,41 @@ /** | ||
/** | ||
* Encodes the specified Value. | ||
* Encodes the specified Value message. | ||
* @function | ||
* @param {vector_tile.Tile.Value|Object} message Value or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {vector_tile.Tile.Value|Object} message Value message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Value.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,null,null,null,null,null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.stringValue!==undefined&&m.stringValue!=="") | ||
w.uint32(10).string(m.stringValue) | ||
if(m.floatValue!==undefined&&m.floatValue!==0) | ||
w.uint32(21).float(m.floatValue) | ||
if(m.doubleValue!==undefined&&m.doubleValue!==0) | ||
w.uint32(25).double(m.doubleValue) | ||
if(m.intValue!==undefined&&util.longNe(m.intValue,0,0)) | ||
w.uint32(32).int64(m.intValue) | ||
if(m.uintValue!==undefined&&util.longNe(m.uintValue,0,0)) | ||
w.uint32(40).uint64(m.uintValue) | ||
if(m.sintValue!==undefined&&util.longNe(m.sintValue,0,0)) | ||
w.uint32(48).sint64(m.sintValue) | ||
if(m.boolValue!==undefined&&m.boolValue!==false) | ||
w.uint32(56).bool(m.boolValue) | ||
return w | ||
Value.encode = (function(Writer, util) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.stringValue !== undefined && message.stringValue !== "") { | ||
writer.uint32(10).string(message.stringValue); | ||
} | ||
if (message.floatValue !== undefined && message.floatValue !== 0) { | ||
writer.uint32(21).float(message.floatValue); | ||
} | ||
if (message.doubleValue !== undefined && message.doubleValue !== 0) { | ||
writer.uint32(25).double(message.doubleValue); | ||
} | ||
if (message.intValue !== undefined && message.intValue !== null && util.longNe(message.intValue, 0, 0)) { | ||
writer.uint32(32).int64(message.intValue); | ||
} | ||
if (message.uintValue !== undefined && message.uintValue !== null && util.longNe(message.uintValue, 0, 0)) { | ||
writer.uint32(40).uint64(message.uintValue); | ||
} | ||
if (message.sintValue !== undefined && message.sintValue !== null && util.longNe(message.sintValue, 0, 0)) { | ||
writer.uint32(48).sint64(message.sintValue); | ||
} | ||
if (message.boolValue !== undefined && message.boolValue !== false) { | ||
writer.uint32(56).bool(message.boolValue); | ||
} | ||
return writer; | ||
};})($protobuf.Writer, $protobuf.util); | ||
/** | ||
* Encodes the specified Value, length delimited. | ||
* @param {vector_tile.Tile.Value|Object} message Value or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified Value message, length delimited. | ||
* @param {vector_tile.Tile.Value|Object} message Value message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -294,53 +340,55 @@ Value.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a Value from the specified reader or buffer. | ||
* Decodes a Value message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {vector_tile.Tile.Value} Value | ||
*/ | ||
Value.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,null,null,null,null,null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.vector_tile.Tile.Value | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.stringValue=r.string() | ||
break | ||
case 2: | ||
m.floatValue=r.float() | ||
break | ||
case 3: | ||
m.doubleValue=r.double() | ||
break | ||
case 4: | ||
m.intValue=r.int64() | ||
break | ||
case 5: | ||
m.uintValue=r.uint64() | ||
break | ||
case 6: | ||
m.sintValue=r.sint64() | ||
break | ||
case 7: | ||
m.boolValue=r.bool() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
} | ||
Value.decode = (function(Reader) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.vector_tile.Tile.Value(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.stringValue = reader.string(); | ||
break; | ||
case 2: | ||
message.floatValue = reader.float(); | ||
break; | ||
case 3: | ||
message.doubleValue = reader.double(); | ||
break; | ||
case 4: | ||
message.intValue = reader.int64(); | ||
break; | ||
case 5: | ||
message.uintValue = reader.uint64(); | ||
break; | ||
case 6: | ||
message.sintValue = reader.sint64(); | ||
break; | ||
case 7: | ||
message.boolValue = reader.bool(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader); | ||
/** | ||
* Decodes a Value from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a Value message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {vector_tile.Tile.Value} Value | ||
@@ -354,45 +402,98 @@ */ | ||
/** | ||
* Verifies a Value. | ||
* Verifies a Value message. | ||
* @function | ||
* @param {vector_tile.Tile.Value|Object} message Value or plain object to verify | ||
* @param {vector_tile.Tile.Value|Object} message Value message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Value.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,null,null,null,null,null]); | ||
return function verify(m) { | ||
if(m.stringValue!==undefined){ | ||
if(!util.isString(m.stringValue)) | ||
return"invalid value for field .vector_tile.Tile.Value.stringValue (string expected)" | ||
Value.verify = (function(util) { return function verify(message) { | ||
if (message.stringValue !== undefined) { | ||
if (!util.isString(message.stringValue)) { | ||
return "vector_tile.Tile.Value.stringValue: string expected"; | ||
} | ||
if(m.floatValue!==undefined){ | ||
if(typeof m.floatValue!=="number") | ||
return"invalid value for field .vector_tile.Tile.Value.floatValue (number expected)" | ||
} | ||
if (message.floatValue !== undefined) { | ||
if (typeof message.floatValue !== "number") { | ||
return "vector_tile.Tile.Value.floatValue: number expected"; | ||
} | ||
if(m.doubleValue!==undefined){ | ||
if(typeof m.doubleValue!=="number") | ||
return"invalid value for field .vector_tile.Tile.Value.doubleValue (number expected)" | ||
} | ||
if (message.doubleValue !== undefined) { | ||
if (typeof message.doubleValue !== "number") { | ||
return "vector_tile.Tile.Value.doubleValue: number expected"; | ||
} | ||
if(m.intValue!==undefined){ | ||
if(!util.isInteger(m.intValue)&&!(m.intValue&&util.isInteger(m.intValue.low)&&util.isInteger(m.intValue.high))) | ||
return"invalid value for field .vector_tile.Tile.Value.intValue (integer|Long expected)" | ||
} | ||
if (message.intValue !== undefined) { | ||
if (!util.isInteger(message.intValue) && !(message.intValue && util.isInteger(message.intValue.low) && util.isInteger(message.intValue.high))) { | ||
return "vector_tile.Tile.Value.intValue: integer|Long expected"; | ||
} | ||
if(m.uintValue!==undefined){ | ||
if(!util.isInteger(m.uintValue)&&!(m.uintValue&&util.isInteger(m.uintValue.low)&&util.isInteger(m.uintValue.high))) | ||
return"invalid value for field .vector_tile.Tile.Value.uintValue (integer|Long expected)" | ||
} | ||
if (message.uintValue !== undefined) { | ||
if (!util.isInteger(message.uintValue) && !(message.uintValue && util.isInteger(message.uintValue.low) && util.isInteger(message.uintValue.high))) { | ||
return "vector_tile.Tile.Value.uintValue: integer|Long expected"; | ||
} | ||
if(m.sintValue!==undefined){ | ||
if(!util.isInteger(m.sintValue)&&!(m.sintValue&&util.isInteger(m.sintValue.low)&&util.isInteger(m.sintValue.high))) | ||
return"invalid value for field .vector_tile.Tile.Value.sintValue (integer|Long expected)" | ||
} | ||
if (message.sintValue !== undefined) { | ||
if (!util.isInteger(message.sintValue) && !(message.sintValue && util.isInteger(message.sintValue.low) && util.isInteger(message.sintValue.high))) { | ||
return "vector_tile.Tile.Value.sintValue: integer|Long expected"; | ||
} | ||
if(m.boolValue!==undefined){ | ||
if(typeof m.boolValue!=="boolean") | ||
return"invalid value for field .vector_tile.Tile.Value.boolValue (boolean expected)" | ||
} | ||
if (message.boolValue !== undefined) { | ||
if (typeof message.boolValue !== "boolean") { | ||
return "vector_tile.Tile.Value.boolValue: boolean expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util); | ||
/** | ||
* Converts a Value message. | ||
* @function | ||
* @param {vector_tile.Tile.Value|Object} source Value message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile.Value|Object} Converted message | ||
*/ | ||
Value.convert = (function() { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.stringValue === undefined && options.defaults) { | ||
dst.stringValue = ""; | ||
} | ||
if (dst.floatValue === undefined && options.defaults) { | ||
dst.floatValue = 0; | ||
} | ||
if (dst.doubleValue === undefined && options.defaults) { | ||
dst.doubleValue = 0; | ||
} | ||
dst.intValue = impl.longs(src.intValue, 0, 0, false, options); | ||
dst.uintValue = impl.longs(src.uintValue, 0, 0, true, options); | ||
dst.sintValue = impl.longs(src.sintValue, 0, 0, false, options); | ||
if (dst.boolValue === undefined && options.defaults) { | ||
dst.boolValue = false; | ||
} | ||
} | ||
return dst; | ||
};})(); | ||
/** | ||
* Creates a Value message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile.Value} Value | ||
*/ | ||
Value.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this Value message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return Value; | ||
@@ -422,28 +523,27 @@ })(); | ||
* Feature id. | ||
* @name vector_tile.Tile.Feature#id | ||
* @type {number|Long} | ||
*/ | ||
$prototype["id"] = $protobuf.util.emptyObject; | ||
$prototype.id = $protobuf.util.emptyObject; | ||
/** | ||
* Feature tags. | ||
* @name vector_tile.Tile.Feature#tags | ||
* @type {Array.<number>} | ||
*/ | ||
$prototype["tags"] = $protobuf.util.emptyArray; | ||
$prototype.tags = $protobuf.util.emptyArray; | ||
/** | ||
* Feature type. | ||
* @name vector_tile.Tile.Feature#type | ||
* @type {number} | ||
*/ | ||
$prototype["type"] = "UNKNOWN"; | ||
$prototype.type = 0; | ||
/** | ||
* Feature geometry. | ||
* @name vector_tile.Tile.Feature#geometry | ||
* @type {Array.<number>} | ||
*/ | ||
$prototype["geometry"] = $protobuf.util.emptyArray; | ||
$prototype.geometry = $protobuf.util.emptyArray; | ||
// Referenced types | ||
var $types = [null, null, "vector_tile.Tile.GeomType", null]; $lazyTypes.push($types); | ||
/** | ||
@@ -459,41 +559,40 @@ * Creates a new Feature instance using the specified properties. | ||
/** | ||
* Encodes the specified Feature. | ||
* Encodes the specified Feature message. | ||
* @function | ||
* @param {vector_tile.Tile.Feature|Object} message Feature or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {vector_tile.Tile.Feature|Object} message Feature message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Feature.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,"vector_tile.Tile.GeomType",null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.id!==undefined&&util.longNe(m.id,0,0)) | ||
w.uint32(8).uint64(m.id) | ||
if(m.tags&&m.tags.length){ | ||
w.uint32(18).fork() | ||
for(var i=0;i<m.tags.length;++i) | ||
w.uint32(m.tags[i]) | ||
w.ldelim() | ||
Feature.encode = (function(Writer, util) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
if (message.id !== undefined && message.id !== null && util.longNe(message.id, 0, 0)) { | ||
writer.uint32(8).uint64(message.id); | ||
} | ||
if (message.tags && message.tags.length) { | ||
writer.uint32(18).fork(); | ||
for (var i = 0; i < message.tags.length; ++i) { | ||
writer.uint32(message.tags[i]); | ||
} | ||
if(m.type!==undefined&&m.type!=="UNKNOWN") | ||
w.uint32(24).uint32(m.type) | ||
if(m.geometry&&m.geometry.length){ | ||
w.uint32(34).fork() | ||
for(var i=0;i<m.geometry.length;++i) | ||
w.uint32(m.geometry[i]) | ||
w.ldelim() | ||
writer.ldelim(); | ||
} | ||
if (message.type !== undefined && message.type !== 0) { | ||
writer.uint32(24).uint32(message.type); | ||
} | ||
if (message.geometry && message.geometry.length) { | ||
writer.uint32(34).fork(); | ||
for (var i = 0; i < message.geometry.length; ++i) { | ||
writer.uint32(message.geometry[i]); | ||
} | ||
return w | ||
writer.ldelim(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return writer; | ||
};})($protobuf.Writer, $protobuf.util); | ||
/** | ||
* Encodes the specified Feature, length delimited. | ||
* @param {vector_tile.Tile.Feature|Object} message Feature or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified Feature message, length delimited. | ||
* @param {vector_tile.Tile.Feature|Object} message Feature message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -505,56 +604,63 @@ Feature.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a Feature from the specified reader or buffer. | ||
* Decodes a Feature message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {vector_tile.Tile.Feature} Feature | ||
*/ | ||
Feature.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,"vector_tile.Tile.GeomType",null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.vector_tile.Tile.Feature | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.id=r.uint64() | ||
break | ||
case 2: | ||
m.tags&&m.tags.length||(m.tags=[]) | ||
if((t&7)===2){ | ||
var e=r.uint32()+r.pos | ||
while(r.pos<e) | ||
m.tags.push(r.uint32()) | ||
}else | ||
m.tags.push(r.uint32()) | ||
break | ||
case 3: | ||
m.type=r.uint32() | ||
break | ||
case 4: | ||
m.geometry&&m.geometry.length||(m.geometry=[]) | ||
if((t&7)===2){ | ||
var e=r.uint32()+r.pos | ||
while(r.pos<e) | ||
m.geometry.push(r.uint32()) | ||
}else | ||
m.geometry.push(r.uint32()) | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
Feature.decode = (function(Reader) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.vector_tile.Tile.Feature(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.id = reader.uint64(); | ||
break; | ||
case 2: | ||
if (!(message.tags && message.tags.length)) { | ||
message.tags = []; | ||
} | ||
if ((tag & 7) === 2) { | ||
var end2 = reader.uint32() + reader.pos; | ||
while (reader.pos < end2) { | ||
message.tags.push(reader.uint32()); | ||
} | ||
} else { | ||
message.tags.push(reader.uint32()); | ||
} | ||
break; | ||
case 3: | ||
message.type = reader.uint32(); | ||
break; | ||
case 4: | ||
if (!(message.geometry && message.geometry.length)) { | ||
message.geometry = []; | ||
} | ||
if ((tag & 7) === 2) { | ||
var end2 = reader.uint32() + reader.pos; | ||
while (reader.pos < end2) { | ||
message.geometry.push(reader.uint32()); | ||
} | ||
} else { | ||
message.geometry.push(reader.uint32()); | ||
} | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader); | ||
/** | ||
* Decodes a Feature from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a Feature message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {vector_tile.Tile.Feature} Feature | ||
@@ -568,48 +674,107 @@ */ | ||
/** | ||
* Verifies a Feature. | ||
* Verifies a Feature message. | ||
* @function | ||
* @param {vector_tile.Tile.Feature|Object} message Feature or plain object to verify | ||
* @param {vector_tile.Tile.Feature|Object} message Feature message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Feature.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,"vector_tile.Tile.GeomType",null]); | ||
return function verify(m) { | ||
if(m.id!==undefined){ | ||
if(!util.isInteger(m.id)&&!(m.id&&util.isInteger(m.id.low)&&util.isInteger(m.id.high))) | ||
return"invalid value for field .vector_tile.Tile.Feature.id (integer|Long expected)" | ||
Feature.verify = (function(util) { return function verify(message) { | ||
if (message.id !== undefined) { | ||
if (!util.isInteger(message.id) && !(message.id && util.isInteger(message.id.low) && util.isInteger(message.id.high))) { | ||
return "vector_tile.Tile.Feature.id: integer|Long expected"; | ||
} | ||
if(m.tags!==undefined){ | ||
if(!Array.isArray(m.tags)) | ||
return"invalid value for field .vector_tile.Tile.Feature.tags (array expected)" | ||
for(var i=0;i<m.tags.length;++i){ | ||
if(!util.isInteger(m.tags[i])) | ||
return"invalid value for field .vector_tile.Tile.Feature.tags (integer[] expected)" | ||
} | ||
if (message.tags !== undefined) { | ||
if (!Array.isArray(message.tags)) { | ||
return "vector_tile.Tile.Feature.tags: array expected"; | ||
} | ||
for (var i = 0; i < message.tags.length; ++i) { | ||
if (!util.isInteger(message.tags[i])) { | ||
return "vector_tile.Tile.Feature.tags: integer[] expected"; | ||
} | ||
} | ||
if(m.type!==undefined){ | ||
switch(m.type){ | ||
default: | ||
return"invalid value for field .vector_tile.Tile.Feature.type (enum value expected)" | ||
case 0: | ||
case 1: | ||
case 2: | ||
case 3: | ||
break | ||
} | ||
if (message.type !== undefined) { | ||
switch (message.type) { | ||
default: | ||
return "vector_tile.Tile.Feature.type: enum value expected"; | ||
case 0: | ||
case 1: | ||
case 2: | ||
case 3: | ||
break; | ||
} | ||
} | ||
if (message.geometry !== undefined) { | ||
if (!Array.isArray(message.geometry)) { | ||
return "vector_tile.Tile.Feature.geometry: array expected"; | ||
} | ||
for (var i = 0; i < message.geometry.length; ++i) { | ||
if (!util.isInteger(message.geometry[i])) { | ||
return "vector_tile.Tile.Feature.geometry: integer[] expected"; | ||
} | ||
} | ||
if(m.geometry!==undefined){ | ||
if(!Array.isArray(m.geometry)) | ||
return"invalid value for field .vector_tile.Tile.Feature.geometry (array expected)" | ||
for(var i=0;i<m.geometry.length;++i){ | ||
if(!util.isInteger(m.geometry[i])) | ||
return"invalid value for field .vector_tile.Tile.Feature.geometry (integer[] expected)" | ||
} | ||
return null; | ||
};})($protobuf.util); | ||
/** | ||
* Converts a Feature message. | ||
* @function | ||
* @param {vector_tile.Tile.Feature|Object} source Feature message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile.Feature|Object} Converted message | ||
*/ | ||
Feature.convert = (function(types) { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
dst.id = impl.longs(src.id, 0, 0, true, options); | ||
if (src.tags && src.tags.length) { | ||
dst.tags = []; | ||
for (var i = 0; i < src.tags.length; ++i) { | ||
dst.tags.push(src.tags[i]); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.tags = []; | ||
} | ||
} | ||
return null | ||
dst.type = impl.enums(src.type, 0, types[2], options); | ||
if (src.geometry && src.geometry.length) { | ||
dst.geometry = []; | ||
for (var i = 0; i < src.geometry.length; ++i) { | ||
dst.geometry.push(src.geometry[i]); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.geometry = []; | ||
} | ||
} | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return dst; | ||
};})($types); | ||
/** | ||
* Creates a Feature message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile.Feature} Feature | ||
*/ | ||
Feature.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this Feature message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return Feature; | ||
@@ -639,42 +804,39 @@ })(); | ||
* Layer version. | ||
* @name vector_tile.Tile.Layer#version | ||
* @type {number} | ||
*/ | ||
$prototype["version"] = 1; | ||
$prototype.version = 1; | ||
/** | ||
* Layer name. | ||
* @name vector_tile.Tile.Layer#name | ||
* @type {string} | ||
*/ | ||
$prototype["name"] = ""; | ||
$prototype.name = ""; | ||
/** | ||
* Layer features. | ||
* @name vector_tile.Tile.Layer#features | ||
* @type {Array.<vector_tile.Tile.Feature>} | ||
*/ | ||
$prototype["features"] = $protobuf.util.emptyArray; | ||
$prototype.features = $protobuf.util.emptyArray; | ||
/** | ||
* Layer keys. | ||
* @name vector_tile.Tile.Layer#keys | ||
* @type {Array.<string>} | ||
*/ | ||
$prototype["keys"] = $protobuf.util.emptyArray; | ||
$prototype.keys = $protobuf.util.emptyArray; | ||
/** | ||
* Layer values. | ||
* @name vector_tile.Tile.Layer#values | ||
* @type {Array.<vector_tile.Tile.Value>} | ||
*/ | ||
$prototype["values"] = $protobuf.util.emptyArray; | ||
$prototype.values = $protobuf.util.emptyArray; | ||
/** | ||
* Layer extent. | ||
* @name vector_tile.Tile.Layer#extent | ||
* @type {number} | ||
*/ | ||
$prototype["extent"] = 4096; | ||
$prototype.extent = 4096; | ||
// Referenced types | ||
var $types = [null, null, "vector_tile.Tile.Feature", null, "vector_tile.Tile.Value", null]; $lazyTypes.push($types); | ||
/** | ||
@@ -690,38 +852,40 @@ * Creates a new Layer instance using the specified properties. | ||
/** | ||
* Encodes the specified Layer. | ||
* Encodes the specified Layer message. | ||
* @function | ||
* @param {vector_tile.Tile.Layer|Object} message Layer or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {vector_tile.Tile.Layer|Object} message Layer message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Layer.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,"vector_tile.Tile.Feature",null,"vector_tile.Tile.Value",null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
w.uint32(120).uint32(m.version) | ||
w.uint32(10).string(m.name) | ||
if(m.features) | ||
for(var i=0;i<m.features.length;++i) | ||
types[2].encode(m.features[i],w.uint32(18).fork()).ldelim() | ||
if(m.keys) | ||
for(var i=0;i<m.keys.length;++i) | ||
w.uint32(26).string(m.keys[i]) | ||
if(m.values) | ||
for(var i=0;i<m.values.length;++i) | ||
types[4].encode(m.values[i],w.uint32(34).fork()).ldelim() | ||
if(m.extent!==undefined&&m.extent!==4096) | ||
w.uint32(40).uint32(m.extent) | ||
return w | ||
Layer.encode = (function(Writer, types) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
writer.uint32(120).uint32(message.version); | ||
writer.uint32(10).string(message.name); | ||
if (message.features) { | ||
for (var i = 0; i < message.features.length; ++i) { | ||
types[2].encode(message.features[i], writer.uint32(18).fork()).ldelim(); | ||
} | ||
} | ||
if (message.keys) { | ||
for (var i = 0; i < message.keys.length; ++i) { | ||
writer.uint32(26).string(message.keys[i]); | ||
} | ||
} | ||
if (message.values) { | ||
for (var i = 0; i < message.values.length; ++i) { | ||
types[4].encode(message.values[i], writer.uint32(34).fork()).ldelim(); | ||
} | ||
} | ||
if (message.extent !== undefined && message.extent !== 4096) { | ||
writer.uint32(40).uint32(message.extent); | ||
} | ||
return writer; | ||
};})($protobuf.Writer, $types); | ||
/** | ||
* Encodes the specified Layer, length delimited. | ||
* @param {vector_tile.Tile.Layer|Object} message Layer or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified Layer message, length delimited. | ||
* @param {vector_tile.Tile.Layer|Object} message Layer message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -733,53 +897,60 @@ Layer.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a Layer from the specified reader or buffer. | ||
* Decodes a Layer message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {vector_tile.Tile.Layer} Layer | ||
*/ | ||
Layer.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,"vector_tile.Tile.Feature",null,"vector_tile.Tile.Value",null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.vector_tile.Tile.Layer | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 15: | ||
m.version=r.uint32() | ||
break | ||
case 1: | ||
m.name=r.string() | ||
break | ||
case 2: | ||
m.features&&m.features.length||(m.features=[]) | ||
m.features.push(types[2].decode(r,r.uint32())) | ||
break | ||
case 3: | ||
m.keys&&m.keys.length||(m.keys=[]) | ||
m.keys.push(r.string()) | ||
break | ||
case 4: | ||
m.values&&m.values.length||(m.values=[]) | ||
m.values.push(types[4].decode(r,r.uint32())) | ||
break | ||
case 5: | ||
m.extent=r.uint32() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
Layer.decode = (function(Reader, types) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.vector_tile.Tile.Layer(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 15: | ||
message.version = reader.uint32(); | ||
break; | ||
case 1: | ||
message.name = reader.string(); | ||
break; | ||
case 2: | ||
if (!(message.features && message.features.length)) { | ||
message.features = []; | ||
} | ||
message.features.push(types[2].decode(reader, reader.uint32())); | ||
break; | ||
case 3: | ||
if (!(message.keys && message.keys.length)) { | ||
message.keys = []; | ||
} | ||
message.keys.push(reader.string()); | ||
break; | ||
case 4: | ||
if (!(message.values && message.values.length)) { | ||
message.values = []; | ||
} | ||
message.values.push(types[4].decode(reader, reader.uint32())); | ||
break; | ||
case 5: | ||
message.extent = reader.uint32(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader, $types); | ||
/** | ||
* Decodes a Layer from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a Layer message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {vector_tile.Tile.Layer} Layer | ||
@@ -793,51 +964,130 @@ */ | ||
/** | ||
* Verifies a Layer. | ||
* Verifies a Layer message. | ||
* @function | ||
* @param {vector_tile.Tile.Layer|Object} message Layer or plain object to verify | ||
* @param {vector_tile.Tile.Layer|Object} message Layer message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Layer.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,"vector_tile.Tile.Feature",null,"vector_tile.Tile.Value",null]); | ||
return function verify(m) { | ||
if(!util.isInteger(m.version)) | ||
return"invalid value for field .vector_tile.Tile.Layer.version (integer expected)" | ||
if(!util.isString(m.name)) | ||
return"invalid value for field .vector_tile.Tile.Layer.name (string expected)" | ||
if(m.features!==undefined){ | ||
if(!Array.isArray(m.features)) | ||
return"invalid value for field .vector_tile.Tile.Layer.features (array expected)" | ||
for(var i=0;i<m.features.length;++i){ | ||
var r; | ||
if(r=types[2].verify(m.features[i])) | ||
return r | ||
Layer.verify = (function(util, types) { return function verify(message) { | ||
if (!util.isInteger(message.version)) { | ||
return "vector_tile.Tile.Layer.version: integer expected"; | ||
} | ||
if (!util.isString(message.name)) { | ||
return "vector_tile.Tile.Layer.name: string expected"; | ||
} | ||
if (message.features !== undefined) { | ||
if (!Array.isArray(message.features)) { | ||
return "vector_tile.Tile.Layer.features: array expected"; | ||
} | ||
for (var i = 0; i < message.features.length; ++i) { | ||
var err; | ||
if (err = types[2].verify(message.features[i])) { | ||
return err; | ||
} | ||
} | ||
if(m.keys!==undefined){ | ||
if(!Array.isArray(m.keys)) | ||
return"invalid value for field .vector_tile.Tile.Layer.keys (array expected)" | ||
for(var i=0;i<m.keys.length;++i){ | ||
if(!util.isString(m.keys[i])) | ||
return"invalid value for field .vector_tile.Tile.Layer.keys (string[] expected)" | ||
} | ||
if (message.keys !== undefined) { | ||
if (!Array.isArray(message.keys)) { | ||
return "vector_tile.Tile.Layer.keys: array expected"; | ||
} | ||
for (var i = 0; i < message.keys.length; ++i) { | ||
if (!util.isString(message.keys[i])) { | ||
return "vector_tile.Tile.Layer.keys: string[] expected"; | ||
} | ||
} | ||
if(m.values!==undefined){ | ||
if(!Array.isArray(m.values)) | ||
return"invalid value for field .vector_tile.Tile.Layer.values (array expected)" | ||
for(var i=0;i<m.values.length;++i){ | ||
var r; | ||
if(r=types[4].verify(m.values[i])) | ||
return r | ||
} | ||
if (message.values !== undefined) { | ||
if (!Array.isArray(message.values)) { | ||
return "vector_tile.Tile.Layer.values: array expected"; | ||
} | ||
for (var i = 0; i < message.values.length; ++i) { | ||
var err; | ||
if (err = types[4].verify(message.values[i])) { | ||
return err; | ||
} | ||
} | ||
if(m.extent!==undefined){ | ||
if(!util.isInteger(m.extent)) | ||
return"invalid value for field .vector_tile.Tile.Layer.extent (integer expected)" | ||
} | ||
if (message.extent !== undefined) { | ||
if (!util.isInteger(message.extent)) { | ||
return "vector_tile.Tile.Layer.extent: integer expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util, $types); | ||
/** | ||
* Converts a Layer message. | ||
* @function | ||
* @param {vector_tile.Tile.Layer|Object} source Layer message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile.Layer|Object} Converted message | ||
*/ | ||
Layer.convert = (function(types) { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.version === undefined && options.defaults) { | ||
dst.version = 1; | ||
} | ||
if (dst.name === undefined && options.defaults) { | ||
dst.name = ""; | ||
} | ||
if (src.features && src.features.length) { | ||
dst.features = []; | ||
for (var i = 0; i < src.features.length; ++i) { | ||
dst.features.push(types[2].convert(src.features[i], impl, options)); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.features = []; | ||
} | ||
} | ||
if (src.keys && src.keys.length) { | ||
dst.keys = []; | ||
for (var i = 0; i < src.keys.length; ++i) { | ||
dst.keys.push(src.keys[i]); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.keys = []; | ||
} | ||
} | ||
if (src.values && src.values.length) { | ||
dst.values = []; | ||
for (var i = 0; i < src.values.length; ++i) { | ||
dst.values.push(types[4].convert(src.values[i], impl, options)); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.values = []; | ||
} | ||
} | ||
if (dst.extent === undefined && options.defaults) { | ||
dst.extent = 4096; | ||
} | ||
} | ||
return dst; | ||
};})($types); | ||
/** | ||
* Creates a Layer message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {vector_tile.Tile.Layer} Layer | ||
*/ | ||
Layer.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this Layer message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return Layer; | ||
@@ -857,3 +1107,3 @@ })(); | ||
return; | ||
path = path.split('.'); | ||
path = path.split("."); | ||
var ptr = $root; | ||
@@ -860,0 +1110,0 @@ while (path.length) |
@@ -1,3 +0,7 @@ | ||
"use strict"; // eslint-disable-line strict | ||
// $> pbjs --target static-module --wrap commonjs --root test_package --out tests/data/package.js tests/data/package.proto | ||
// Generated Mon, 02 Jan 2017 21:00:30 UTC | ||
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex*/ | ||
"use strict"; | ||
var $protobuf = require("../../runtime"); | ||
@@ -32,112 +36,99 @@ | ||
* Package name. | ||
* @name Package#name | ||
* @type {string} | ||
*/ | ||
$prototype["name"] = ""; | ||
$prototype.name = ""; | ||
/** | ||
* Package version. | ||
* @name Package#version | ||
* @type {string} | ||
*/ | ||
$prototype["version"] = ""; | ||
$prototype.version = ""; | ||
/** | ||
* Package description. | ||
* @name Package#description | ||
* @type {string} | ||
*/ | ||
$prototype["description"] = ""; | ||
$prototype.description = ""; | ||
/** | ||
* Package author. | ||
* @name Package#author | ||
* @type {string} | ||
*/ | ||
$prototype["author"] = ""; | ||
$prototype.author = ""; | ||
/** | ||
* Package license. | ||
* @name Package#license | ||
* @type {string} | ||
*/ | ||
$prototype["license"] = ""; | ||
$prototype.license = ""; | ||
/** | ||
* Package repository. | ||
* @name Package#repository | ||
* @type {Package.Repository} | ||
*/ | ||
$prototype["repository"] = null; | ||
$prototype.repository = null; | ||
/** | ||
* Package bugs. | ||
* @name Package#bugs | ||
* @type {string} | ||
*/ | ||
$prototype["bugs"] = ""; | ||
$prototype.bugs = ""; | ||
/** | ||
* Package homepage. | ||
* @name Package#homepage | ||
* @type {string} | ||
*/ | ||
$prototype["homepage"] = ""; | ||
$prototype.homepage = ""; | ||
/** | ||
* Package keywords. | ||
* @name Package#keywords | ||
* @type {Array.<string>} | ||
*/ | ||
$prototype["keywords"] = $protobuf.util.emptyArray; | ||
$prototype.keywords = $protobuf.util.emptyArray; | ||
/** | ||
* Package main. | ||
* @name Package#main | ||
* @type {string} | ||
*/ | ||
$prototype["main"] = ""; | ||
$prototype.main = ""; | ||
/** | ||
* Package bin. | ||
* @name Package#bin | ||
* @type {string} | ||
*/ | ||
$prototype["bin"] = $protobuf.util.emptyObject; | ||
$prototype.bin = $protobuf.util.emptyObject; | ||
/** | ||
* Package scripts. | ||
* @name Package#scripts | ||
* @type {string} | ||
*/ | ||
$prototype["scripts"] = $protobuf.util.emptyObject; | ||
$prototype.scripts = $protobuf.util.emptyObject; | ||
/** | ||
* Package dependencies. | ||
* @name Package#dependencies | ||
* @type {string} | ||
*/ | ||
$prototype["dependencies"] = $protobuf.util.emptyObject; | ||
$prototype.dependencies = $protobuf.util.emptyObject; | ||
/** | ||
* Package optionalDependencies. | ||
* @name Package#optionalDependencies | ||
* @type {string} | ||
*/ | ||
$prototype["optionalDependencies"] = $protobuf.util.emptyObject; | ||
$prototype.optionalDependencies = $protobuf.util.emptyObject; | ||
/** | ||
* Package devDependencies. | ||
* @name Package#devDependencies | ||
* @type {string} | ||
*/ | ||
$prototype["devDependencies"] = $protobuf.util.emptyObject; | ||
$prototype.devDependencies = $protobuf.util.emptyObject; | ||
/** | ||
* Package types. | ||
* @name Package#types | ||
* @type {string} | ||
*/ | ||
$prototype["types"] = ""; | ||
$prototype.types = ""; | ||
// Referenced types | ||
var $types = [null, null, null, null, null, "Package.Repository", null, null, null, null, null, null, null, null, null, null]; $lazyTypes.push($types); | ||
/** | ||
@@ -153,83 +144,80 @@ * Creates a new Package instance using the specified properties. | ||
/** | ||
* Encodes the specified Package. | ||
* Encodes the specified Package message. | ||
* @function | ||
* @param {Package|Object} message Package or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {Package|Object} message Package message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Package.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,null,null,null,"Package.Repository",null,null,null,null,null,null,null,null,null,null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.name!==undefined&&m.name!=="") | ||
w.uint32(10).string(m.name) | ||
if(m.version!==undefined&&m.version!=="") | ||
w.uint32(18).string(m.version) | ||
if(m.description!==undefined&&m.description!=="") | ||
w.uint32(26).string(m.description) | ||
if(m.author!==undefined&&m.author!=="") | ||
w.uint32(34).string(m.author) | ||
if(m.license!==undefined&&m.license!=="") | ||
w.uint32(42).string(m.license) | ||
if(m.repository!==undefined&&m.repository!==null) | ||
types[5].encode(m.repository,w.uint32(50).fork()).ldelim() | ||
if(m.bugs!==undefined&&m.bugs!=="") | ||
w.uint32(58).string(m.bugs) | ||
if(m.homepage!==undefined&&m.homepage!=="") | ||
w.uint32(66).string(m.homepage) | ||
if(m.keywords) | ||
for(var i=0;i<m.keywords.length;++i) | ||
w.uint32(74).string(m.keywords[i]) | ||
if(m.main!==undefined&&m.main!=="") | ||
w.uint32(82).string(m.main) | ||
if(m.bin&&m.bin!==util.emptyObject){ | ||
for(var ks=Object.keys(m.bin),i=0;i<ks.length;++i){ | ||
w.uint32(90).fork().uint32(10).string(ks[i]) | ||
w.uint32(18).string(m.bin[ks[i]]) | ||
w.ldelim() | ||
} | ||
Package.encode = (function(Writer, util, types) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
if (message.name !== undefined && message.name !== "") { | ||
writer.uint32(10).string(message.name); | ||
} | ||
if (message.version !== undefined && message.version !== "") { | ||
writer.uint32(18).string(message.version); | ||
} | ||
if (message.description !== undefined && message.description !== "") { | ||
writer.uint32(26).string(message.description); | ||
} | ||
if (message.author !== undefined && message.author !== "") { | ||
writer.uint32(34).string(message.author); | ||
} | ||
if (message.license !== undefined && message.license !== "") { | ||
writer.uint32(42).string(message.license); | ||
} | ||
if (message.repository !== undefined && message.repository !== null) { | ||
types[5].encode(message.repository, writer.uint32(50).fork()).ldelim(); | ||
} | ||
if (message.bugs !== undefined && message.bugs !== "") { | ||
writer.uint32(58).string(message.bugs); | ||
} | ||
if (message.homepage !== undefined && message.homepage !== "") { | ||
writer.uint32(66).string(message.homepage); | ||
} | ||
if (message.keywords) { | ||
for (var i = 0; i < message.keywords.length; ++i) { | ||
writer.uint32(74).string(message.keywords[i]); | ||
} | ||
if(m.scripts&&m.scripts!==util.emptyObject){ | ||
for(var ks=Object.keys(m.scripts),i=0;i<ks.length;++i){ | ||
w.uint32(98).fork().uint32(10).string(ks[i]) | ||
w.uint32(18).string(m.scripts[ks[i]]) | ||
w.ldelim() | ||
} | ||
} | ||
if (message.main !== undefined && message.main !== "") { | ||
writer.uint32(82).string(message.main); | ||
} | ||
if (message.bin && message.bin !== util.emptyObject) { | ||
for (var keys = Object.keys(message.bin), i = 0; i < keys.length; ++i) { | ||
writer.uint32(90).fork().uint32(10).string(keys[i]).uint32(18).string(message.bin[keys[i]]).ldelim(); | ||
} | ||
if(m.dependencies&&m.dependencies!==util.emptyObject){ | ||
for(var ks=Object.keys(m.dependencies),i=0;i<ks.length;++i){ | ||
w.uint32(106).fork().uint32(10).string(ks[i]) | ||
w.uint32(18).string(m.dependencies[ks[i]]) | ||
w.ldelim() | ||
} | ||
} | ||
if (message.scripts && message.scripts !== util.emptyObject) { | ||
for (var keys = Object.keys(message.scripts), i = 0; i < keys.length; ++i) { | ||
writer.uint32(98).fork().uint32(10).string(keys[i]).uint32(18).string(message.scripts[keys[i]]).ldelim(); | ||
} | ||
if(m.optionalDependencies&&m.optionalDependencies!==util.emptyObject){ | ||
for(var ks=Object.keys(m.optionalDependencies),i=0;i<ks.length;++i){ | ||
w.uint32(114).fork().uint32(10).string(ks[i]) | ||
w.uint32(18).string(m.optionalDependencies[ks[i]]) | ||
w.ldelim() | ||
} | ||
} | ||
if (message.dependencies && message.dependencies !== util.emptyObject) { | ||
for (var keys = Object.keys(message.dependencies), i = 0; i < keys.length; ++i) { | ||
writer.uint32(106).fork().uint32(10).string(keys[i]).uint32(18).string(message.dependencies[keys[i]]).ldelim(); | ||
} | ||
if(m.devDependencies&&m.devDependencies!==util.emptyObject){ | ||
for(var ks=Object.keys(m.devDependencies),i=0;i<ks.length;++i){ | ||
w.uint32(122).fork().uint32(10).string(ks[i]) | ||
w.uint32(18).string(m.devDependencies[ks[i]]) | ||
w.ldelim() | ||
} | ||
} | ||
if (message.optionalDependencies && message.optionalDependencies !== util.emptyObject) { | ||
for (var keys = Object.keys(message.optionalDependencies), i = 0; i < keys.length; ++i) { | ||
writer.uint32(114).fork().uint32(10).string(keys[i]).uint32(18).string(message.optionalDependencies[keys[i]]).ldelim(); | ||
} | ||
if(m.types!==undefined&&m.types!=="") | ||
w.uint32(138).string(m.types) | ||
return w | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.devDependencies && message.devDependencies !== util.emptyObject) { | ||
for (var keys = Object.keys(message.devDependencies), i = 0; i < keys.length; ++i) { | ||
writer.uint32(122).fork().uint32(10).string(keys[i]).uint32(18).string(message.devDependencies[keys[i]]).ldelim(); | ||
} | ||
} | ||
if (message.types !== undefined && message.types !== "") { | ||
writer.uint32(138).string(message.types); | ||
} | ||
return writer; | ||
};})($protobuf.Writer, $protobuf.util, $types); | ||
/** | ||
* Encodes the specified Package, length delimited. | ||
* @param {Package|Object} message Package or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified Package message, length delimited. | ||
* @param {Package|Object} message Package message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -241,116 +229,139 @@ Package.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a Package from the specified reader or buffer. | ||
* Decodes a Package message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {Package} Package | ||
*/ | ||
Package.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,null,null,null,"Package.Repository",null,null,null,null,null,null,null,null,null,null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.Package | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.name=r.string() | ||
break | ||
case 2: | ||
m.version=r.string() | ||
break | ||
case 3: | ||
m.description=r.string() | ||
break | ||
case 4: | ||
m.author=r.string() | ||
break | ||
case 5: | ||
m.license=r.string() | ||
break | ||
case 6: | ||
m.repository=types[5].decode(r,r.uint32()) | ||
break | ||
case 7: | ||
m.bugs=r.string() | ||
break | ||
case 8: | ||
m.homepage=r.string() | ||
break | ||
case 9: | ||
m.keywords&&m.keywords.length||(m.keywords=[]) | ||
m.keywords.push(r.string()) | ||
break | ||
case 10: | ||
m.main=r.string() | ||
break | ||
case 11: | ||
r.skip().pos++ | ||
if(m.bin===util.emptyObject) | ||
m.bin={} | ||
var k=r.string() | ||
if(typeof k==="object") | ||
k=util.longToHash(k) | ||
r.pos++ | ||
m.bin[k]=r.string() | ||
break | ||
case 12: | ||
r.skip().pos++ | ||
if(m.scripts===util.emptyObject) | ||
m.scripts={} | ||
var k=r.string() | ||
if(typeof k==="object") | ||
k=util.longToHash(k) | ||
r.pos++ | ||
m.scripts[k]=r.string() | ||
break | ||
case 13: | ||
r.skip().pos++ | ||
if(m.dependencies===util.emptyObject) | ||
m.dependencies={} | ||
var k=r.string() | ||
if(typeof k==="object") | ||
k=util.longToHash(k) | ||
r.pos++ | ||
m.dependencies[k]=r.string() | ||
break | ||
case 14: | ||
r.skip().pos++ | ||
if(m.optionalDependencies===util.emptyObject) | ||
m.optionalDependencies={} | ||
var k=r.string() | ||
if(typeof k==="object") | ||
k=util.longToHash(k) | ||
r.pos++ | ||
m.optionalDependencies[k]=r.string() | ||
break | ||
case 15: | ||
r.skip().pos++ | ||
if(m.devDependencies===util.emptyObject) | ||
m.devDependencies={} | ||
var k=r.string() | ||
if(typeof k==="object") | ||
k=util.longToHash(k) | ||
r.pos++ | ||
m.devDependencies[k]=r.string() | ||
break | ||
case 17: | ||
m.types=r.string() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
Package.decode = (function(Reader, util, types) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.Package(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.name = reader.string(); | ||
break; | ||
case 2: | ||
message.version = reader.string(); | ||
break; | ||
case 3: | ||
message.description = reader.string(); | ||
break; | ||
case 4: | ||
message.author = reader.string(); | ||
break; | ||
case 5: | ||
message.license = reader.string(); | ||
break; | ||
case 6: | ||
message.repository = types[5].decode(reader, reader.uint32()); | ||
break; | ||
case 7: | ||
message.bugs = reader.string(); | ||
break; | ||
case 8: | ||
message.homepage = reader.string(); | ||
break; | ||
case 9: | ||
if (!(message.keywords && message.keywords.length)) { | ||
message.keywords = []; | ||
} | ||
message.keywords.push(reader.string()); | ||
break; | ||
case 10: | ||
message.main = reader.string(); | ||
break; | ||
case 11: | ||
reader.skip().pos++; | ||
if (message.bin === util.emptyObject) { | ||
message.bin = {}; | ||
} | ||
var key = reader.string(); | ||
if (typeof key === "object") { | ||
key = util.longToHash(key); | ||
} | ||
reader.pos++; | ||
message.bin[key] = reader.string(); | ||
break; | ||
case 12: | ||
reader.skip().pos++; | ||
if (message.scripts === util.emptyObject) { | ||
message.scripts = {}; | ||
} | ||
var key = reader.string(); | ||
if (typeof key === "object") { | ||
key = util.longToHash(key); | ||
} | ||
reader.pos++; | ||
message.scripts[key] = reader.string(); | ||
break; | ||
case 13: | ||
reader.skip().pos++; | ||
if (message.dependencies === util.emptyObject) { | ||
message.dependencies = {}; | ||
} | ||
var key = reader.string(); | ||
if (typeof key === "object") { | ||
key = util.longToHash(key); | ||
} | ||
reader.pos++; | ||
message.dependencies[key] = reader.string(); | ||
break; | ||
case 14: | ||
reader.skip().pos++; | ||
if (message.optionalDependencies === util.emptyObject) { | ||
message.optionalDependencies = {}; | ||
} | ||
var key = reader.string(); | ||
if (typeof key === "object") { | ||
key = util.longToHash(key); | ||
} | ||
reader.pos++; | ||
message.optionalDependencies[key] = reader.string(); | ||
break; | ||
case 15: | ||
reader.skip().pos++; | ||
if (message.devDependencies === util.emptyObject) { | ||
message.devDependencies = {}; | ||
} | ||
var key = reader.string(); | ||
if (typeof key === "object") { | ||
key = util.longToHash(key); | ||
} | ||
reader.pos++; | ||
message.devDependencies[key] = reader.string(); | ||
break; | ||
case 17: | ||
message.types = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader, $protobuf.util, $types); | ||
/** | ||
* Decodes a Package from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a Package message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {Package} Package | ||
@@ -364,111 +375,217 @@ */ | ||
/** | ||
* Verifies a Package. | ||
* Verifies a Package message. | ||
* @function | ||
* @param {Package|Object} message Package or plain object to verify | ||
* @param {Package|Object} message Package message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Package.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null,null,null,null,"Package.Repository",null,null,null,null,null,null,null,null,null,null]); | ||
return function verify(m) { | ||
if(m.name!==undefined){ | ||
if(!util.isString(m.name)) | ||
return"invalid value for field .Package.name (string expected)" | ||
Package.verify = (function(util, types) { return function verify(message) { | ||
if (message.name !== undefined) { | ||
if (!util.isString(message.name)) { | ||
return "Package.name: string expected"; | ||
} | ||
if(m.version!==undefined){ | ||
if(!util.isString(m.version)) | ||
return"invalid value for field .Package.version (string expected)" | ||
} | ||
if (message.version !== undefined) { | ||
if (!util.isString(message.version)) { | ||
return "Package.version: string expected"; | ||
} | ||
if(m.description!==undefined){ | ||
if(!util.isString(m.description)) | ||
return"invalid value for field .Package.description (string expected)" | ||
} | ||
if (message.description !== undefined) { | ||
if (!util.isString(message.description)) { | ||
return "Package.description: string expected"; | ||
} | ||
if(m.author!==undefined){ | ||
if(!util.isString(m.author)) | ||
return"invalid value for field .Package.author (string expected)" | ||
} | ||
if (message.author !== undefined) { | ||
if (!util.isString(message.author)) { | ||
return "Package.author: string expected"; | ||
} | ||
if(m.license!==undefined){ | ||
if(!util.isString(m.license)) | ||
return"invalid value for field .Package.license (string expected)" | ||
} | ||
if (message.license !== undefined) { | ||
if (!util.isString(message.license)) { | ||
return "Package.license: string expected"; | ||
} | ||
if(m.repository!==undefined&&m.repository!==null){ | ||
var r; | ||
if(r=types[5].verify(m.repository)) | ||
return r | ||
} | ||
if (message.repository !== undefined && message.repository !== null) { | ||
var err; | ||
if (err = types[5].verify(message.repository)) { | ||
return err; | ||
} | ||
if(m.bugs!==undefined){ | ||
if(!util.isString(m.bugs)) | ||
return"invalid value for field .Package.bugs (string expected)" | ||
} | ||
if (message.bugs !== undefined) { | ||
if (!util.isString(message.bugs)) { | ||
return "Package.bugs: string expected"; | ||
} | ||
if(m.homepage!==undefined){ | ||
if(!util.isString(m.homepage)) | ||
return"invalid value for field .Package.homepage (string expected)" | ||
} | ||
if (message.homepage !== undefined) { | ||
if (!util.isString(message.homepage)) { | ||
return "Package.homepage: string expected"; | ||
} | ||
if(m.keywords!==undefined){ | ||
if(!Array.isArray(m.keywords)) | ||
return"invalid value for field .Package.keywords (array expected)" | ||
for(var i=0;i<m.keywords.length;++i){ | ||
if(!util.isString(m.keywords[i])) | ||
return"invalid value for field .Package.keywords (string[] expected)" | ||
} | ||
if (message.keywords !== undefined) { | ||
if (!Array.isArray(message.keywords)) { | ||
return "Package.keywords: array expected"; | ||
} | ||
for (var i = 0; i < message.keywords.length; ++i) { | ||
if (!util.isString(message.keywords[i])) { | ||
return "Package.keywords: string[] expected"; | ||
} | ||
} | ||
if(m.main!==undefined){ | ||
if(!util.isString(m.main)) | ||
return"invalid value for field .Package.main (string expected)" | ||
} | ||
if (message.main !== undefined) { | ||
if (!util.isString(message.main)) { | ||
return "Package.main: string expected"; | ||
} | ||
if(m.bin!==undefined){ | ||
if(!util.isObject(m.bin)) | ||
return"invalid value for field .Package.bin (object expected)" | ||
var k=Object.keys(m.bin) | ||
for(var i=0;i<k.length;++i){ | ||
if(!util.isString(m.bin[k[i]])) | ||
return"invalid value for field .Package.bin (string{k:string} expected)" | ||
} | ||
if (message.bin !== undefined) { | ||
if (!util.isObject(message.bin)) { | ||
return "Package.bin: object expected"; | ||
} | ||
var key = Object.keys(message.bin); | ||
for (var i = 0; i < key.length; ++i) { | ||
if (!util.isString(message.bin[key[i]])) { | ||
return "Package.bin: string{key:string} expected"; | ||
} | ||
} | ||
if(m.scripts!==undefined){ | ||
if(!util.isObject(m.scripts)) | ||
return"invalid value for field .Package.scripts (object expected)" | ||
var k=Object.keys(m.scripts) | ||
for(var i=0;i<k.length;++i){ | ||
if(!util.isString(m.scripts[k[i]])) | ||
return"invalid value for field .Package.scripts (string{k:string} expected)" | ||
} | ||
if (message.scripts !== undefined) { | ||
if (!util.isObject(message.scripts)) { | ||
return "Package.scripts: object expected"; | ||
} | ||
var key = Object.keys(message.scripts); | ||
for (var i = 0; i < key.length; ++i) { | ||
if (!util.isString(message.scripts[key[i]])) { | ||
return "Package.scripts: string{key:string} expected"; | ||
} | ||
} | ||
if(m.dependencies!==undefined){ | ||
if(!util.isObject(m.dependencies)) | ||
return"invalid value for field .Package.dependencies (object expected)" | ||
var k=Object.keys(m.dependencies) | ||
for(var i=0;i<k.length;++i){ | ||
if(!util.isString(m.dependencies[k[i]])) | ||
return"invalid value for field .Package.dependencies (string{k:string} expected)" | ||
} | ||
if (message.dependencies !== undefined) { | ||
if (!util.isObject(message.dependencies)) { | ||
return "Package.dependencies: object expected"; | ||
} | ||
var key = Object.keys(message.dependencies); | ||
for (var i = 0; i < key.length; ++i) { | ||
if (!util.isString(message.dependencies[key[i]])) { | ||
return "Package.dependencies: string{key:string} expected"; | ||
} | ||
} | ||
if(m.optionalDependencies!==undefined){ | ||
if(!util.isObject(m.optionalDependencies)) | ||
return"invalid value for field .Package.optionalDependencies (object expected)" | ||
var k=Object.keys(m.optionalDependencies) | ||
for(var i=0;i<k.length;++i){ | ||
if(!util.isString(m.optionalDependencies[k[i]])) | ||
return"invalid value for field .Package.optionalDependencies (string{k:string} expected)" | ||
} | ||
if (message.optionalDependencies !== undefined) { | ||
if (!util.isObject(message.optionalDependencies)) { | ||
return "Package.optionalDependencies: object expected"; | ||
} | ||
var key = Object.keys(message.optionalDependencies); | ||
for (var i = 0; i < key.length; ++i) { | ||
if (!util.isString(message.optionalDependencies[key[i]])) { | ||
return "Package.optionalDependencies: string{key:string} expected"; | ||
} | ||
} | ||
if(m.devDependencies!==undefined){ | ||
if(!util.isObject(m.devDependencies)) | ||
return"invalid value for field .Package.devDependencies (object expected)" | ||
var k=Object.keys(m.devDependencies) | ||
for(var i=0;i<k.length;++i){ | ||
if(!util.isString(m.devDependencies[k[i]])) | ||
return"invalid value for field .Package.devDependencies (string{k:string} expected)" | ||
} | ||
if (message.devDependencies !== undefined) { | ||
if (!util.isObject(message.devDependencies)) { | ||
return "Package.devDependencies: object expected"; | ||
} | ||
var key = Object.keys(message.devDependencies); | ||
for (var i = 0; i < key.length; ++i) { | ||
if (!util.isString(message.devDependencies[key[i]])) { | ||
return "Package.devDependencies: string{key:string} expected"; | ||
} | ||
} | ||
if(m.types!==undefined){ | ||
if(!util.isString(m.types)) | ||
return"invalid value for field .Package.types (string expected)" | ||
} | ||
if (message.types !== undefined) { | ||
if (!util.isString(message.types)) { | ||
return "Package.types: string expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util, $types); | ||
/** | ||
* Converts a Package message. | ||
* @function | ||
* @param {Package|Object} source Package message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Package|Object} Converted message | ||
*/ | ||
Package.convert = (function(types) { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.name === undefined && options.defaults) { | ||
dst.name = ""; | ||
} | ||
if (dst.version === undefined && options.defaults) { | ||
dst.version = ""; | ||
} | ||
if (dst.description === undefined && options.defaults) { | ||
dst.description = ""; | ||
} | ||
if (dst.author === undefined && options.defaults) { | ||
dst.author = ""; | ||
} | ||
if (dst.license === undefined && options.defaults) { | ||
dst.license = ""; | ||
} | ||
dst.repository = types[5].convert(src.repository, impl, options); | ||
if (dst.bugs === undefined && options.defaults) { | ||
dst.bugs = ""; | ||
} | ||
if (dst.homepage === undefined && options.defaults) { | ||
dst.homepage = ""; | ||
} | ||
if (src.keywords && src.keywords.length) { | ||
dst.keywords = []; | ||
for (var i = 0; i < src.keywords.length; ++i) { | ||
dst.keywords.push(src.keywords[i]); | ||
} | ||
} else { | ||
if (options.defaults || options.arrays) { | ||
dst.keywords = []; | ||
} | ||
} | ||
if (dst.main === undefined && options.defaults) { | ||
dst.main = ""; | ||
} | ||
if (dst.bin === undefined && options.defaults) { | ||
dst.bin = {}; | ||
} | ||
if (dst.scripts === undefined && options.defaults) { | ||
dst.scripts = {}; | ||
} | ||
if (dst.dependencies === undefined && options.defaults) { | ||
dst.dependencies = {}; | ||
} | ||
if (dst.optionalDependencies === undefined && options.defaults) { | ||
dst.optionalDependencies = {}; | ||
} | ||
if (dst.devDependencies === undefined && options.defaults) { | ||
dst.devDependencies = {}; | ||
} | ||
if (dst.types === undefined && options.defaults) { | ||
dst.types = ""; | ||
} | ||
} | ||
return dst; | ||
};})($types); | ||
/** | ||
* Creates a Package message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Package} Package | ||
*/ | ||
Package.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this Package message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
Package.Repository = (function() { | ||
@@ -495,13 +612,11 @@ | ||
* Repository type. | ||
* @name Package.Repository#type | ||
* @type {string} | ||
*/ | ||
$prototype["type"] = ""; | ||
$prototype.type = ""; | ||
/** | ||
* Repository url. | ||
* @name Package.Repository#url | ||
* @type {string} | ||
*/ | ||
$prototype["url"] = ""; | ||
$prototype.url = ""; | ||
@@ -518,29 +633,26 @@ /** | ||
/** | ||
* Encodes the specified Repository. | ||
* Encodes the specified Repository message. | ||
* @function | ||
* @param {Package.Repository|Object} message Repository or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {Package.Repository|Object} message Repository message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
Repository.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.type!==undefined&&m.type!=="") | ||
w.uint32(10).string(m.type) | ||
if(m.url!==undefined&&m.url!=="") | ||
w.uint32(18).string(m.url) | ||
return w | ||
Repository.encode = (function(Writer) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.type !== undefined && message.type !== "") { | ||
writer.uint32(10).string(message.type); | ||
} | ||
if (message.url !== undefined && message.url !== "") { | ||
writer.uint32(18).string(message.url); | ||
} | ||
return writer; | ||
};})($protobuf.Writer); | ||
/** | ||
* Encodes the specified Repository, length delimited. | ||
* @param {Package.Repository|Object} message Repository or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified Repository message, length delimited. | ||
* @param {Package.Repository|Object} message Repository message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -552,38 +664,35 @@ Repository.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a Repository from the specified reader or buffer. | ||
* Decodes a Repository message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {Package.Repository} Repository | ||
*/ | ||
Repository.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.Package.Repository | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.type=r.string() | ||
break | ||
case 2: | ||
m.url=r.string() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
} | ||
Repository.decode = (function(Reader) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.Package.Repository(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.type = reader.string(); | ||
break; | ||
case 2: | ||
message.url = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader); | ||
/** | ||
* Decodes a Repository from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a Repository message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {Package.Repository} Repository | ||
@@ -597,25 +706,64 @@ */ | ||
/** | ||
* Verifies a Repository. | ||
* Verifies a Repository message. | ||
* @function | ||
* @param {Package.Repository|Object} message Repository or plain object to verify | ||
* @param {Package.Repository|Object} message Repository message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
Repository.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null,null]); | ||
return function verify(m) { | ||
if(m.type!==undefined){ | ||
if(!util.isString(m.type)) | ||
return"invalid value for field .Package.Repository.type (string expected)" | ||
Repository.verify = (function(util) { return function verify(message) { | ||
if (message.type !== undefined) { | ||
if (!util.isString(message.type)) { | ||
return "Package.Repository.type: string expected"; | ||
} | ||
if(m.url!==undefined){ | ||
if(!util.isString(m.url)) | ||
return"invalid value for field .Package.Repository.url (string expected)" | ||
} | ||
if (message.url !== undefined) { | ||
if (!util.isString(message.url)) { | ||
return "Package.Repository.url: string expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util); | ||
/** | ||
* Converts a Repository message. | ||
* @function | ||
* @param {Package.Repository|Object} source Repository message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Package.Repository|Object} Converted message | ||
*/ | ||
Repository.convert = (function() { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.type === undefined && options.defaults) { | ||
dst.type = ""; | ||
} | ||
if (dst.url === undefined && options.defaults) { | ||
dst.url = ""; | ||
} | ||
} | ||
return dst; | ||
};})(); | ||
/** | ||
* Creates a Repository message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Package.Repository} Repository | ||
*/ | ||
Repository.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this Repository message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return Repository; | ||
@@ -632,3 +780,3 @@ })(); | ||
return; | ||
path = path.split('.'); | ||
path = path.split("."); | ||
var ptr = $root; | ||
@@ -635,0 +783,0 @@ while (path.length) |
@@ -1,3 +0,7 @@ | ||
"use strict"; // eslint-disable-line strict | ||
// $> pbjs --target static-module --wrap commonjs --root test_rpc --out tests/data/rpc.js tests/data/rpc.proto | ||
// Generated Mon, 02 Jan 2017 21:00:30 UTC | ||
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex*/ | ||
"use strict"; | ||
var $protobuf = require("../../runtime"); | ||
@@ -17,3 +21,3 @@ | ||
* @type {function} | ||
* @param {Method} method Reflected method being called | ||
* @param {$protobuf.Method} method Reflected method being called | ||
* @param {Uint8Array} requestData Request data | ||
@@ -34,3 +38,3 @@ * @param {RPCCallback} callback Callback function | ||
/** | ||
* Constructs a new MyService. | ||
* Constructs a new MyService service. | ||
* @exports MyService | ||
@@ -61,3 +65,3 @@ * @constructor | ||
this.responseDelimited = Boolean(responseDelimited); | ||
}; | ||
} | ||
@@ -74,3 +78,3 @@ /** | ||
* Calls MyMethod. | ||
* @param {MyRequest|Object} request MyRequest or plain object | ||
* @param {MyRequest|Object} request MyRequest message or plain object | ||
* @param {MyService_myMethod_Callback} callback Node-style callback called with the error, if any, and MyResponse | ||
@@ -84,3 +88,3 @@ * @returns {undefined} | ||
} catch (err) { | ||
(typeof setImmediate === 'function' ? setImmediate : setTimeout)(function() { callback(err); }); | ||
(typeof setImmediate === "function" ? setImmediate : setTimeout)(function() { callback(err); }); | ||
return; | ||
@@ -129,6 +133,5 @@ } | ||
* MyRequest path. | ||
* @name MyRequest#path | ||
* @type {string} | ||
*/ | ||
$prototype["path"] = ""; | ||
$prototype.path = ""; | ||
@@ -145,27 +148,23 @@ /** | ||
/** | ||
* Encodes the specified MyRequest. | ||
* Encodes the specified MyRequest message. | ||
* @function | ||
* @param {MyRequest|Object} message MyRequest or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {MyRequest|Object} message MyRequest message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
MyRequest.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.path!==undefined&&m.path!=="") | ||
w.uint32(10).string(m.path) | ||
return w | ||
MyRequest.encode = (function(Writer) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.path !== undefined && message.path !== "") { | ||
writer.uint32(10).string(message.path); | ||
} | ||
return writer; | ||
};})($protobuf.Writer); | ||
/** | ||
* Encodes the specified MyRequest, length delimited. | ||
* @param {MyRequest|Object} message MyRequest or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified MyRequest message, length delimited. | ||
* @param {MyRequest|Object} message MyRequest message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -177,35 +176,31 @@ MyRequest.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a MyRequest from the specified reader or buffer. | ||
* Decodes a MyRequest message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {MyRequest} MyRequest | ||
*/ | ||
MyRequest.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.MyRequest | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 1: | ||
m.path=r.string() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
} | ||
MyRequest.decode = (function(Reader) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.MyRequest(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.path = reader.string(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader); | ||
/** | ||
* Decodes a MyRequest from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a MyRequest message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {MyRequest} MyRequest | ||
@@ -219,21 +214,56 @@ */ | ||
/** | ||
* Verifies a MyRequest. | ||
* Verifies a MyRequest message. | ||
* @function | ||
* @param {MyRequest|Object} message MyRequest or plain object to verify | ||
* @param {MyRequest|Object} message MyRequest message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
MyRequest.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function verify(m) { | ||
if(m.path!==undefined){ | ||
if(!util.isString(m.path)) | ||
return"invalid value for field .MyRequest.path (string expected)" | ||
MyRequest.verify = (function(util) { return function verify(message) { | ||
if (message.path !== undefined) { | ||
if (!util.isString(message.path)) { | ||
return "MyRequest.path: string expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util); | ||
/** | ||
* Converts a MyRequest message. | ||
* @function | ||
* @param {MyRequest|Object} source MyRequest message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {MyRequest|Object} Converted message | ||
*/ | ||
MyRequest.convert = (function() { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.path === undefined && options.defaults) { | ||
dst.path = ""; | ||
} | ||
} | ||
return dst; | ||
};})(); | ||
/** | ||
* Creates a MyRequest message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {MyRequest} MyRequest | ||
*/ | ||
MyRequest.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this MyRequest message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return MyRequest; | ||
@@ -263,6 +293,5 @@ })(); | ||
* MyResponse status. | ||
* @name MyResponse#status | ||
* @type {number} | ||
*/ | ||
$prototype["status"] = 0; | ||
$prototype.status = 0; | ||
@@ -279,27 +308,23 @@ /** | ||
/** | ||
* Encodes the specified MyResponse. | ||
* Encodes the specified MyResponse message. | ||
* @function | ||
* @param {MyResponse|Object} message MyResponse or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* @param {MyResponse|Object} message MyResponse message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
MyResponse.encode = (function() { | ||
/* eslint-disable */ | ||
var Writer = $protobuf.Writer; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function encode(m, w) { | ||
w||(w=Writer.create()) | ||
if(m.status!==undefined&&m.status!==0) | ||
w.uint32(16).int32(m.status) | ||
return w | ||
MyResponse.encode = (function(Writer) { return function encode(message, writer) { | ||
if (!writer) { | ||
writer = Writer.create(); | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
if (message.status !== undefined && message.status !== 0) { | ||
writer.uint32(16).int32(message.status); | ||
} | ||
return writer; | ||
};})($protobuf.Writer); | ||
/** | ||
* Encodes the specified MyResponse, length delimited. | ||
* @param {MyResponse|Object} message MyResponse or plain object to encode | ||
* @param {Writer} [writer] Writer to encode to | ||
* @returns {Writer} Writer | ||
* Encodes the specified MyResponse message, length delimited. | ||
* @param {MyResponse|Object} message MyResponse message or plain object to encode | ||
* @param {$protobuf.Writer} [writer] Writer to encode to | ||
* @returns {$protobuf.Writer} Writer | ||
*/ | ||
@@ -311,35 +336,31 @@ MyResponse.encodeDelimited = function encodeDelimited(message, writer) { | ||
/** | ||
* Decodes a MyResponse from the specified reader or buffer. | ||
* Decodes a MyResponse message from the specified reader or buffer. | ||
* @function | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @param {number} [length] Message length if known beforehand | ||
* @returns {MyResponse} MyResponse | ||
*/ | ||
MyResponse.decode = (function() { | ||
/* eslint-disable */ | ||
var Reader = $protobuf.Reader; | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function decode(r, l) { | ||
r instanceof Reader||(r=Reader.create(r)) | ||
var c=l===undefined?r.len:r.pos+l,m=new $root.MyResponse | ||
while(r.pos<c){ | ||
var t=r.uint32() | ||
switch(t>>>3){ | ||
case 2: | ||
m.status=r.int32() | ||
break | ||
default: | ||
r.skipType(t&7) | ||
break | ||
} | ||
MyResponse.decode = (function(Reader) { return function decode(reader, len) { | ||
if (!(reader instanceof Reader)) { | ||
reader = Reader.create(reader); | ||
} | ||
var end = len === undefined ? reader.len : reader.pos + len, message = new $root.MyResponse(); | ||
while (reader.pos < end) { | ||
var tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 2: | ||
message.status = reader.int32(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
return m | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return message; | ||
};})($protobuf.Reader); | ||
/** | ||
* Decodes a MyResponse from the specified reader or buffer, length delimited. | ||
* @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* Decodes a MyResponse message from the specified reader or buffer, length delimited. | ||
* @param {$protobuf.Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from | ||
* @returns {MyResponse} MyResponse | ||
@@ -353,21 +374,56 @@ */ | ||
/** | ||
* Verifies a MyResponse. | ||
* Verifies a MyResponse message. | ||
* @function | ||
* @param {MyResponse|Object} message MyResponse or plain object to verify | ||
* @param {MyResponse|Object} message MyResponse message or plain object to verify | ||
* @returns {?string} `null` if valid, otherwise the reason why it is not | ||
*/ | ||
MyResponse.verify = (function() { | ||
/* eslint-disable */ | ||
var util = $protobuf.util; | ||
var types; $lazyTypes.push(types = [null]); | ||
return function verify(m) { | ||
if(m.status!==undefined){ | ||
if(!util.isInteger(m.status)) | ||
return"invalid value for field .MyResponse.status (integer expected)" | ||
MyResponse.verify = (function(util) { return function verify(message) { | ||
if (message.status !== undefined) { | ||
if (!util.isInteger(message.status)) { | ||
return "MyResponse.status: integer expected"; | ||
} | ||
return null | ||
} | ||
/* eslint-enable */ | ||
})(); | ||
return null; | ||
};})($protobuf.util); | ||
/** | ||
* Converts a MyResponse message. | ||
* @function | ||
* @param {MyResponse|Object} source MyResponse message or plain object to convert | ||
* @param {*} impl Converter implementation to use | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {MyResponse|Object} Converted message | ||
*/ | ||
MyResponse.convert = (function() { return function convert(src, impl, options) { | ||
if (!options) { | ||
options = {}; | ||
} | ||
var dst = impl.create(src, this, options); | ||
if (dst) { | ||
if (dst.status === undefined && options.defaults) { | ||
dst.status = 0; | ||
} | ||
} | ||
return dst; | ||
};})(); | ||
/** | ||
* Creates a MyResponse message from JSON. | ||
* @param {Object.<string,*>} source Source object | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {MyResponse} MyResponse | ||
*/ | ||
MyResponse.from = function from(source, options) { | ||
return this.convert(source, $protobuf.converters.message, options); | ||
}; | ||
/** | ||
* Converts this MyResponse message to JSON. | ||
* @param {Object.<string,*>} [options] Conversion options | ||
* @returns {Object.<string,*>} JSON object | ||
*/ | ||
$prototype.asJSON = function asJSON(options) { | ||
return this.constructor.convert(this, $protobuf.converters.json, options); | ||
}; | ||
return MyResponse; | ||
@@ -381,3 +437,3 @@ })(); | ||
return; | ||
path = path.split('.'); | ||
path = path.split("."); | ||
var ptr = $root; | ||
@@ -384,0 +440,0 @@ while (path.length) |
@@ -10,3 +10,3 @@ var tape = require("tape"); | ||
}); | ||
test.deepEqual(enm.getValuesById(), valsById = { | ||
test.deepEqual(enm.valuesById, valsById = { | ||
1: 'a', | ||
@@ -22,3 +22,3 @@ 2: 'b' | ||
}, "should allow adding new values"); | ||
test.deepEqual(enm.getValuesById(), { | ||
test.deepEqual(enm.valuesById, { | ||
1: 'a', | ||
@@ -34,3 +34,3 @@ 2: 'b', | ||
}, "should allow removing existing values"); | ||
test.deepEqual(enm.getValuesById(), { | ||
test.deepEqual(enm.valuesById, { | ||
1: 'a', | ||
@@ -37,0 +37,0 @@ 3: 'c' |
@@ -19,9 +19,9 @@ var tape = require("tape"); | ||
test.equal(message.num, 1, "should initialize the last value"); | ||
test.equal(message.getKind(), "num", "should reference the last value"); | ||
test.equal(message.kind, "num", "should reference the last value"); | ||
message.setKind('num'); | ||
message.kind = 'num'; | ||
test.notOk(message.hasOwnProperty('str'), "should delete other values"); | ||
message.str = "a"; | ||
message.setKind('str'); // message.kind = 'str' if IE8 support isn't required | ||
message.kind = 'str'; | ||
@@ -33,3 +33,3 @@ test.notOk(message.hasOwnProperty('num'), "should delete the previous value"); | ||
message.num = 0; // default | ||
message.setKind('num'); | ||
message.kind = 'num'; | ||
test.notOk(message.hasOwnProperty('str'), "should delete the previous value"); | ||
@@ -36,0 +36,0 @@ test.equal(message.num, 0, "should set the new value"); |
@@ -47,3 +47,3 @@ var tape = require("tape"); | ||
return test.fail(err.message); | ||
test.ok(response instanceof MyResponse.getCtor(), "should return an instance of MyResponse"); | ||
test.ok(response instanceof MyResponse.ctor, "should return an instance of MyResponse"); | ||
test.deepEqual(response, { | ||
@@ -50,0 +50,0 @@ status: 200 |
@@ -46,3 +46,3 @@ var tape = require("tape"); | ||
test.notOk(err, "should not raise an error"); | ||
test.ok(res instanceof DoSomethingResponse.getCtor(), "should return a properly typed response"); | ||
test.ok(res instanceof DoSomethingResponse.ctor, "should return a properly typed response"); | ||
test.ok(dataEmitted, "should have emitted the data event"); | ||
@@ -49,0 +49,0 @@ service.end(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
3383086
173
42362
551
26
12
30
+ Added@types/long@3.0.32(transitive)
Updated@protobufjs/aspromise@^1.0.5
Updated@protobufjs/base64@^1.0.5
Updated@protobufjs/codegen@^1.0.4
Updated@protobufjs/extend@^1.0.2
Updated@protobufjs/fetch@^1.0.4
Updated@protobufjs/inquire@^1.0.2
Updated@protobufjs/path@^1.0.2
Updated@protobufjs/pool@^1.0.5
Updated@protobufjs/utf8@^1.0.6