@bitrix24/b24jssdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @version @bitrix24/b24jssdk v0.1.1
2
+ * @version @bitrix24/b24jssdk v0.1.2
3
3
  * @copyright (c) 2024 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -8,7 +8,6 @@
8
8
  'use strict';
9
9
 
10
10
  const luxon = require('luxon');
11
- const $protobuf = require('protobufjs');
12
11
  const axios = require('axios');
13
12
  const qs = require('qs');
14
13
 
@@ -1606,7 +1605,7 @@ class Http {
1606
1605
  result.logTag = this.#logTag;
1607
1606
  }
1608
1607
  result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
1609
- result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.1.1";
1608
+ result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.1.2";
1610
1609
  if (!!result.data && !!result.data.start) {
1611
1610
  delete result.data.start;
1612
1611
  }
@@ -4690,6 +4689,4542 @@ class ChannelManager {
4690
4689
  }
4691
4690
  }
4692
4691
 
4692
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4693
+
4694
+ function getDefaultExportFromCjs (x) {
4695
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
4696
+ }
4697
+
4698
+ var protobuf = {exports: {}};
4699
+
4700
+ /*!
4701
+ * protobuf.js v6.8.6 (c) 2016, daniel wirtz
4702
+ * compiled mon, 26 feb 2018 11:35:34 utc
4703
+ * licensed under the bsd-3-clause license
4704
+ * see: https://github.com/dcodeio/protobuf.js for details
4705
+ *
4706
+ * Modify a list for integration with Bitrix Framework:
4707
+ * - removed integration with RequireJS and AMD package builders;
4708
+ */
4709
+
4710
+ var hasRequiredProtobuf;
4711
+
4712
+ function requireProtobuf () {
4713
+ if (hasRequiredProtobuf) return protobuf.exports;
4714
+ hasRequiredProtobuf = 1;
4715
+ (function (module) {
4716
+ (function(undefined$1) {
4717
+ (function prelude(modules, cache, entries) {
4718
+ function $require(name) {
4719
+ var $module = cache[name];
4720
+ if (!$module)
4721
+ modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);
4722
+ return $module.exports;
4723
+ }
4724
+ var protobuf = $require(entries[0]);
4725
+ if (module && module.exports)
4726
+ module.exports = protobuf;
4727
+ })({ 1: [function(require, module2, exports) {
4728
+ module2.exports = asPromise;
4729
+ function asPromise(fn, ctx) {
4730
+ var params = new Array(arguments.length - 1), offset = 0, index = 2, pending = true;
4731
+ while (index < arguments.length)
4732
+ params[offset++] = arguments[index++];
4733
+ return new Promise(function executor(resolve, reject) {
4734
+ params[offset] = function callback(err) {
4735
+ if (pending) {
4736
+ pending = false;
4737
+ if (err)
4738
+ reject(err);
4739
+ else {
4740
+ var params2 = new Array(arguments.length - 1), offset2 = 0;
4741
+ while (offset2 < params2.length)
4742
+ params2[offset2++] = arguments[offset2];
4743
+ resolve.apply(null, params2);
4744
+ }
4745
+ }
4746
+ };
4747
+ try {
4748
+ fn.apply(ctx || null, params);
4749
+ } catch (err) {
4750
+ if (pending) {
4751
+ pending = false;
4752
+ reject(err);
4753
+ }
4754
+ }
4755
+ });
4756
+ }
4757
+ }, {}], 2: [function(require, module2, exports) {
4758
+ var base64 = exports;
4759
+ base64.length = function length(string) {
4760
+ var p = string.length;
4761
+ if (!p)
4762
+ return 0;
4763
+ var n = 0;
4764
+ while (--p % 4 > 1 && string.charAt(p) === "=")
4765
+ ++n;
4766
+ return Math.ceil(string.length * 3) / 4 - n;
4767
+ };
4768
+ var b64 = new Array(64);
4769
+ var s64 = new Array(123);
4770
+ for (var i = 0; i < 64; )
4771
+ s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
4772
+ base64.encode = function encode(buffer, start, end) {
4773
+ var parts = null, chunk = [];
4774
+ var i2 = 0, j = 0, t;
4775
+ while (start < end) {
4776
+ var b = buffer[start++];
4777
+ switch (j) {
4778
+ case 0:
4779
+ chunk[i2++] = b64[b >> 2];
4780
+ t = (b & 3) << 4;
4781
+ j = 1;
4782
+ break;
4783
+ case 1:
4784
+ chunk[i2++] = b64[t | b >> 4];
4785
+ t = (b & 15) << 2;
4786
+ j = 2;
4787
+ break;
4788
+ case 2:
4789
+ chunk[i2++] = b64[t | b >> 6];
4790
+ chunk[i2++] = b64[b & 63];
4791
+ j = 0;
4792
+ break;
4793
+ }
4794
+ if (i2 > 8191) {
4795
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
4796
+ i2 = 0;
4797
+ }
4798
+ }
4799
+ if (j) {
4800
+ chunk[i2++] = b64[t];
4801
+ chunk[i2++] = 61;
4802
+ if (j === 1)
4803
+ chunk[i2++] = 61;
4804
+ }
4805
+ if (parts) {
4806
+ if (i2)
4807
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i2)));
4808
+ return parts.join("");
4809
+ }
4810
+ return String.fromCharCode.apply(String, chunk.slice(0, i2));
4811
+ };
4812
+ var invalidEncoding = "invalid encoding";
4813
+ base64.decode = function decode(string, buffer, offset) {
4814
+ var start = offset;
4815
+ var j = 0, t;
4816
+ for (var i2 = 0; i2 < string.length; ) {
4817
+ var c = string.charCodeAt(i2++);
4818
+ if (c === 61 && j > 1)
4819
+ break;
4820
+ if ((c = s64[c]) === undefined$1)
4821
+ throw Error(invalidEncoding);
4822
+ switch (j) {
4823
+ case 0:
4824
+ t = c;
4825
+ j = 1;
4826
+ break;
4827
+ case 1:
4828
+ buffer[offset++] = t << 2 | (c & 48) >> 4;
4829
+ t = c;
4830
+ j = 2;
4831
+ break;
4832
+ case 2:
4833
+ buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
4834
+ t = c;
4835
+ j = 3;
4836
+ break;
4837
+ case 3:
4838
+ buffer[offset++] = (t & 3) << 6 | c;
4839
+ j = 0;
4840
+ break;
4841
+ }
4842
+ }
4843
+ if (j === 1)
4844
+ throw Error(invalidEncoding);
4845
+ return offset - start;
4846
+ };
4847
+ base64.test = function test(string) {
4848
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
4849
+ };
4850
+ }, {}], 3: [function(require, module2, exports) {
4851
+ module2.exports = codegen;
4852
+ function codegen(functionParams, functionName) {
4853
+ if (typeof functionParams === "string") {
4854
+ functionName = functionParams;
4855
+ functionParams = undefined$1;
4856
+ }
4857
+ var body = [];
4858
+ function Codegen(formatStringOrScope) {
4859
+ if (typeof formatStringOrScope !== "string") {
4860
+ var source = toString();
4861
+ if (codegen.verbose)
4862
+ console.log("codegen: " + source);
4863
+ source = "return " + source;
4864
+ if (formatStringOrScope) {
4865
+ var scopeKeys = Object.keys(formatStringOrScope), scopeParams = new Array(scopeKeys.length + 1), scopeValues = new Array(scopeKeys.length), scopeOffset = 0;
4866
+ while (scopeOffset < scopeKeys.length) {
4867
+ scopeParams[scopeOffset] = scopeKeys[scopeOffset];
4868
+ scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
4869
+ }
4870
+ scopeParams[scopeOffset] = source;
4871
+ return Function.apply(null, scopeParams).apply(null, scopeValues);
4872
+ }
4873
+ return Function(source)();
4874
+ }
4875
+ var formatParams = new Array(arguments.length - 1), formatOffset = 0;
4876
+ while (formatOffset < formatParams.length)
4877
+ formatParams[formatOffset] = arguments[++formatOffset];
4878
+ formatOffset = 0;
4879
+ formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
4880
+ var value = formatParams[formatOffset++];
4881
+ switch ($1) {
4882
+ case "d":
4883
+ case "f":
4884
+ return String(Number(value));
4885
+ case "i":
4886
+ return String(Math.floor(value));
4887
+ case "j":
4888
+ return JSON.stringify(value);
4889
+ case "s":
4890
+ return String(value);
4891
+ }
4892
+ return "%";
4893
+ });
4894
+ if (formatOffset !== formatParams.length)
4895
+ throw Error("parameter count mismatch");
4896
+ body.push(formatStringOrScope);
4897
+ return Codegen;
4898
+ }
4899
+ function toString(functionNameOverride) {
4900
+ return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
4901
+ }
4902
+ Codegen.toString = toString;
4903
+ return Codegen;
4904
+ }
4905
+ codegen.verbose = false;
4906
+ }, {}], 4: [function(require, module2, exports) {
4907
+ module2.exports = EventEmitter;
4908
+ function EventEmitter() {
4909
+ this._listeners = {};
4910
+ }
4911
+ EventEmitter.prototype.on = function on(evt, fn, ctx) {
4912
+ (this._listeners[evt] || (this._listeners[evt] = [])).push({
4913
+ fn,
4914
+ ctx: ctx || this
4915
+ });
4916
+ return this;
4917
+ };
4918
+ EventEmitter.prototype.off = function off(evt, fn) {
4919
+ if (evt === undefined$1)
4920
+ this._listeners = {};
4921
+ else {
4922
+ if (fn === undefined$1)
4923
+ this._listeners[evt] = [];
4924
+ else {
4925
+ var listeners = this._listeners[evt];
4926
+ for (var i = 0; i < listeners.length; )
4927
+ if (listeners[i].fn === fn)
4928
+ listeners.splice(i, 1);
4929
+ else
4930
+ ++i;
4931
+ }
4932
+ }
4933
+ return this;
4934
+ };
4935
+ EventEmitter.prototype.emit = function emit(evt) {
4936
+ var listeners = this._listeners[evt];
4937
+ if (listeners) {
4938
+ var args = [], i = 1;
4939
+ for (; i < arguments.length; )
4940
+ args.push(arguments[i++]);
4941
+ for (i = 0; i < listeners.length; )
4942
+ listeners[i].fn.apply(listeners[i++].ctx, args);
4943
+ }
4944
+ return this;
4945
+ };
4946
+ }, {}], 5: [function(require, module2, exports) {
4947
+ module2.exports = fetch;
4948
+ var asPromise = require(1), inquire = require(7);
4949
+ var fs = inquire("fs");
4950
+ function fetch(filename, options, callback) {
4951
+ if (typeof options === "function") {
4952
+ callback = options;
4953
+ options = {};
4954
+ } else if (!options)
4955
+ options = {};
4956
+ if (!callback)
4957
+ return asPromise(fetch, this, filename, options);
4958
+ if (!options.xhr && fs && fs.readFile)
4959
+ return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
4960
+ return err && typeof XMLHttpRequest !== "undefined" ? fetch.xhr(filename, options, callback) : err ? callback(err) : callback(null, options.binary ? contents : contents.toString("utf8"));
4961
+ });
4962
+ return fetch.xhr(filename, options, callback);
4963
+ }
4964
+ fetch.xhr = function fetch_xhr(filename, options, callback) {
4965
+ var xhr = new XMLHttpRequest();
4966
+ xhr.onreadystatechange = function fetchOnReadyStateChange() {
4967
+ if (xhr.readyState !== 4)
4968
+ return undefined$1;
4969
+ if (xhr.status !== 0 && xhr.status !== 200)
4970
+ return callback(Error("status " + xhr.status));
4971
+ if (options.binary) {
4972
+ var buffer = xhr.response;
4973
+ if (!buffer) {
4974
+ buffer = [];
4975
+ for (var i = 0; i < xhr.responseText.length; ++i)
4976
+ buffer.push(xhr.responseText.charCodeAt(i) & 255);
4977
+ }
4978
+ return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
4979
+ }
4980
+ return callback(null, xhr.responseText);
4981
+ };
4982
+ if (options.binary) {
4983
+ if ("overrideMimeType" in xhr)
4984
+ xhr.overrideMimeType("text/plain; charset=x-user-defined");
4985
+ xhr.responseType = "arraybuffer";
4986
+ }
4987
+ xhr.open("GET", filename);
4988
+ xhr.send();
4989
+ };
4990
+ }, { "1": 1, "7": 7 }], 6: [function(require, module2, exports) {
4991
+ module2.exports = factory(factory);
4992
+ function factory(exports2) {
4993
+ if (typeof Float32Array !== "undefined") (function() {
4994
+ var f32 = new Float32Array([-0]), f8b = new Uint8Array(f32.buffer), le = f8b[3] === 128;
4995
+ function writeFloat_f32_cpy(val, buf, pos) {
4996
+ f32[0] = val;
4997
+ buf[pos] = f8b[0];
4998
+ buf[pos + 1] = f8b[1];
4999
+ buf[pos + 2] = f8b[2];
5000
+ buf[pos + 3] = f8b[3];
5001
+ }
5002
+ function writeFloat_f32_rev(val, buf, pos) {
5003
+ f32[0] = val;
5004
+ buf[pos] = f8b[3];
5005
+ buf[pos + 1] = f8b[2];
5006
+ buf[pos + 2] = f8b[1];
5007
+ buf[pos + 3] = f8b[0];
5008
+ }
5009
+ exports2.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
5010
+ exports2.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
5011
+ function readFloat_f32_cpy(buf, pos) {
5012
+ f8b[0] = buf[pos];
5013
+ f8b[1] = buf[pos + 1];
5014
+ f8b[2] = buf[pos + 2];
5015
+ f8b[3] = buf[pos + 3];
5016
+ return f32[0];
5017
+ }
5018
+ function readFloat_f32_rev(buf, pos) {
5019
+ f8b[3] = buf[pos];
5020
+ f8b[2] = buf[pos + 1];
5021
+ f8b[1] = buf[pos + 2];
5022
+ f8b[0] = buf[pos + 3];
5023
+ return f32[0];
5024
+ }
5025
+ exports2.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
5026
+ exports2.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
5027
+ })();
5028
+ else (function() {
5029
+ function writeFloat_ieee754(writeUint, val, buf, pos) {
5030
+ var sign = val < 0 ? 1 : 0;
5031
+ if (sign)
5032
+ val = -val;
5033
+ if (val === 0)
5034
+ writeUint(1 / val > 0 ? (
5035
+ /* positive */
5036
+ 0
5037
+ ) : (
5038
+ /* negative 0 */
5039
+ 2147483648
5040
+ ), buf, pos);
5041
+ else if (isNaN(val))
5042
+ writeUint(2143289344, buf, pos);
5043
+ else if (val > 34028234663852886e22)
5044
+ writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
5045
+ else if (val < 11754943508222875e-54)
5046
+ writeUint((sign << 31 | Math.round(val / 1401298464324817e-60)) >>> 0, buf, pos);
5047
+ else {
5048
+ var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
5049
+ writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
5050
+ }
5051
+ }
5052
+ exports2.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
5053
+ exports2.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
5054
+ function readFloat_ieee754(readUint, buf, pos) {
5055
+ var uint = readUint(buf, pos), sign = (uint >> 31) * 2 + 1, exponent = uint >>> 23 & 255, mantissa = uint & 8388607;
5056
+ return exponent === 255 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 1401298464324817e-60 * mantissa : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
5057
+ }
5058
+ exports2.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
5059
+ exports2.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
5060
+ })();
5061
+ if (typeof Float64Array !== "undefined") (function() {
5062
+ var f64 = new Float64Array([-0]), f8b = new Uint8Array(f64.buffer), le = f8b[7] === 128;
5063
+ function writeDouble_f64_cpy(val, buf, pos) {
5064
+ f64[0] = val;
5065
+ buf[pos] = f8b[0];
5066
+ buf[pos + 1] = f8b[1];
5067
+ buf[pos + 2] = f8b[2];
5068
+ buf[pos + 3] = f8b[3];
5069
+ buf[pos + 4] = f8b[4];
5070
+ buf[pos + 5] = f8b[5];
5071
+ buf[pos + 6] = f8b[6];
5072
+ buf[pos + 7] = f8b[7];
5073
+ }
5074
+ function writeDouble_f64_rev(val, buf, pos) {
5075
+ f64[0] = val;
5076
+ buf[pos] = f8b[7];
5077
+ buf[pos + 1] = f8b[6];
5078
+ buf[pos + 2] = f8b[5];
5079
+ buf[pos + 3] = f8b[4];
5080
+ buf[pos + 4] = f8b[3];
5081
+ buf[pos + 5] = f8b[2];
5082
+ buf[pos + 6] = f8b[1];
5083
+ buf[pos + 7] = f8b[0];
5084
+ }
5085
+ exports2.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
5086
+ exports2.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
5087
+ function readDouble_f64_cpy(buf, pos) {
5088
+ f8b[0] = buf[pos];
5089
+ f8b[1] = buf[pos + 1];
5090
+ f8b[2] = buf[pos + 2];
5091
+ f8b[3] = buf[pos + 3];
5092
+ f8b[4] = buf[pos + 4];
5093
+ f8b[5] = buf[pos + 5];
5094
+ f8b[6] = buf[pos + 6];
5095
+ f8b[7] = buf[pos + 7];
5096
+ return f64[0];
5097
+ }
5098
+ function readDouble_f64_rev(buf, pos) {
5099
+ f8b[7] = buf[pos];
5100
+ f8b[6] = buf[pos + 1];
5101
+ f8b[5] = buf[pos + 2];
5102
+ f8b[4] = buf[pos + 3];
5103
+ f8b[3] = buf[pos + 4];
5104
+ f8b[2] = buf[pos + 5];
5105
+ f8b[1] = buf[pos + 6];
5106
+ f8b[0] = buf[pos + 7];
5107
+ return f64[0];
5108
+ }
5109
+ exports2.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
5110
+ exports2.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
5111
+ })();
5112
+ else (function() {
5113
+ function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
5114
+ var sign = val < 0 ? 1 : 0;
5115
+ if (sign)
5116
+ val = -val;
5117
+ if (val === 0) {
5118
+ writeUint(0, buf, pos + off0);
5119
+ writeUint(1 / val > 0 ? (
5120
+ /* positive */
5121
+ 0
5122
+ ) : (
5123
+ /* negative 0 */
5124
+ 2147483648
5125
+ ), buf, pos + off1);
5126
+ } else if (isNaN(val)) {
5127
+ writeUint(0, buf, pos + off0);
5128
+ writeUint(2146959360, buf, pos + off1);
5129
+ } else if (val > 17976931348623157e292) {
5130
+ writeUint(0, buf, pos + off0);
5131
+ writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
5132
+ } else {
5133
+ var mantissa;
5134
+ if (val < 22250738585072014e-324) {
5135
+ mantissa = val / 5e-324;
5136
+ writeUint(mantissa >>> 0, buf, pos + off0);
5137
+ writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
5138
+ } else {
5139
+ var exponent = Math.floor(Math.log(val) / Math.LN2);
5140
+ if (exponent === 1024)
5141
+ exponent = 1023;
5142
+ mantissa = val * Math.pow(2, -exponent);
5143
+ writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
5144
+ writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
5145
+ }
5146
+ }
5147
+ }
5148
+ exports2.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
5149
+ exports2.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
5150
+ function readDouble_ieee754(readUint, off0, off1, buf, pos) {
5151
+ var lo = readUint(buf, pos + off0), hi = readUint(buf, pos + off1);
5152
+ var sign = (hi >> 31) * 2 + 1, exponent = hi >>> 20 & 2047, mantissa = 4294967296 * (hi & 1048575) + lo;
5153
+ return exponent === 2047 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 5e-324 * mantissa : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
5154
+ }
5155
+ exports2.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
5156
+ exports2.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
5157
+ })();
5158
+ return exports2;
5159
+ }
5160
+ function writeUintLE(val, buf, pos) {
5161
+ buf[pos] = val & 255;
5162
+ buf[pos + 1] = val >>> 8 & 255;
5163
+ buf[pos + 2] = val >>> 16 & 255;
5164
+ buf[pos + 3] = val >>> 24;
5165
+ }
5166
+ function writeUintBE(val, buf, pos) {
5167
+ buf[pos] = val >>> 24;
5168
+ buf[pos + 1] = val >>> 16 & 255;
5169
+ buf[pos + 2] = val >>> 8 & 255;
5170
+ buf[pos + 3] = val & 255;
5171
+ }
5172
+ function readUintLE(buf, pos) {
5173
+ return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0;
5174
+ }
5175
+ function readUintBE(buf, pos) {
5176
+ return (buf[pos] << 24 | buf[pos + 1] << 16 | buf[pos + 2] << 8 | buf[pos + 3]) >>> 0;
5177
+ }
5178
+ }, {}], 7: [function(require, module2, exports) {
5179
+ module2.exports = inquire;
5180
+ function inquire(moduleName) {
5181
+ try {
5182
+ var mod = require(moduleName);
5183
+ if (mod && (mod.length || Object.keys(mod).length))
5184
+ return mod;
5185
+ } catch (e) {
5186
+ }
5187
+ return null;
5188
+ }
5189
+ }, {}], 8: [function(require, module2, exports) {
5190
+ var path = exports;
5191
+ var isAbsolute = (
5192
+ /**
5193
+ * Tests if the specified path is absolute.
5194
+ * @param {string} path Path to test
5195
+ * @returns {boolean} `true` if path is absolute
5196
+ */
5197
+ path.isAbsolute = function isAbsolute2(path2) {
5198
+ return /^(?:\/|\w+:)/.test(path2);
5199
+ }
5200
+ );
5201
+ var normalize = (
5202
+ /**
5203
+ * Normalizes the specified path.
5204
+ * @param {string} path Path to normalize
5205
+ * @returns {string} Normalized path
5206
+ */
5207
+ path.normalize = function normalize2(path2) {
5208
+ path2 = path2.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
5209
+ var parts = path2.split("/"), absolute = isAbsolute(path2), prefix = "";
5210
+ if (absolute)
5211
+ prefix = parts.shift() + "/";
5212
+ for (var i = 0; i < parts.length; ) {
5213
+ if (parts[i] === "..") {
5214
+ if (i > 0 && parts[i - 1] !== "..")
5215
+ parts.splice(--i, 2);
5216
+ else if (absolute)
5217
+ parts.splice(i, 1);
5218
+ else
5219
+ ++i;
5220
+ } else if (parts[i] === ".")
5221
+ parts.splice(i, 1);
5222
+ else
5223
+ ++i;
5224
+ }
5225
+ return prefix + parts.join("/");
5226
+ }
5227
+ );
5228
+ path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
5229
+ if (!alreadyNormalized)
5230
+ includePath = normalize(includePath);
5231
+ if (isAbsolute(includePath))
5232
+ return includePath;
5233
+ if (!alreadyNormalized)
5234
+ originPath = normalize(originPath);
5235
+ return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
5236
+ };
5237
+ }, {}], 9: [function(require, module2, exports) {
5238
+ module2.exports = pool;
5239
+ function pool(alloc, slice, size) {
5240
+ var SIZE = size || 8192;
5241
+ var MAX = SIZE >>> 1;
5242
+ var slab = null;
5243
+ var offset = SIZE;
5244
+ return function pool_alloc(size2) {
5245
+ if (size2 < 1 || size2 > MAX)
5246
+ return alloc(size2);
5247
+ if (offset + size2 > SIZE) {
5248
+ slab = alloc(SIZE);
5249
+ offset = 0;
5250
+ }
5251
+ var buf = slice.call(slab, offset, offset += size2);
5252
+ if (offset & 7)
5253
+ offset = (offset | 7) + 1;
5254
+ return buf;
5255
+ };
5256
+ }
5257
+ }, {}], 10: [function(require, module2, exports) {
5258
+ var utf8 = exports;
5259
+ utf8.length = function utf8_length(string) {
5260
+ var len = 0, c = 0;
5261
+ for (var i = 0; i < string.length; ++i) {
5262
+ c = string.charCodeAt(i);
5263
+ if (c < 128)
5264
+ len += 1;
5265
+ else if (c < 2048)
5266
+ len += 2;
5267
+ else if ((c & 64512) === 55296 && (string.charCodeAt(i + 1) & 64512) === 56320) {
5268
+ ++i;
5269
+ len += 4;
5270
+ } else
5271
+ len += 3;
5272
+ }
5273
+ return len;
5274
+ };
5275
+ utf8.read = function utf8_read(buffer, start, end) {
5276
+ var len = end - start;
5277
+ if (len < 1)
5278
+ return "";
5279
+ var parts = null, chunk = [], i = 0, t;
5280
+ while (start < end) {
5281
+ t = buffer[start++];
5282
+ if (t < 128)
5283
+ chunk[i++] = t;
5284
+ else if (t > 191 && t < 224)
5285
+ chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
5286
+ else if (t > 239 && t < 365) {
5287
+ t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 65536;
5288
+ chunk[i++] = 55296 + (t >> 10);
5289
+ chunk[i++] = 56320 + (t & 1023);
5290
+ } else
5291
+ chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
5292
+ if (i > 8191) {
5293
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
5294
+ i = 0;
5295
+ }
5296
+ }
5297
+ if (parts) {
5298
+ if (i)
5299
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
5300
+ return parts.join("");
5301
+ }
5302
+ return String.fromCharCode.apply(String, chunk.slice(0, i));
5303
+ };
5304
+ utf8.write = function utf8_write(string, buffer, offset) {
5305
+ var start = offset, c1, c2;
5306
+ for (var i = 0; i < string.length; ++i) {
5307
+ c1 = string.charCodeAt(i);
5308
+ if (c1 < 128) {
5309
+ buffer[offset++] = c1;
5310
+ } else if (c1 < 2048) {
5311
+ buffer[offset++] = c1 >> 6 | 192;
5312
+ buffer[offset++] = c1 & 63 | 128;
5313
+ } else if ((c1 & 64512) === 55296 && ((c2 = string.charCodeAt(i + 1)) & 64512) === 56320) {
5314
+ c1 = 65536 + ((c1 & 1023) << 10) + (c2 & 1023);
5315
+ ++i;
5316
+ buffer[offset++] = c1 >> 18 | 240;
5317
+ buffer[offset++] = c1 >> 12 & 63 | 128;
5318
+ buffer[offset++] = c1 >> 6 & 63 | 128;
5319
+ buffer[offset++] = c1 & 63 | 128;
5320
+ } else {
5321
+ buffer[offset++] = c1 >> 12 | 224;
5322
+ buffer[offset++] = c1 >> 6 & 63 | 128;
5323
+ buffer[offset++] = c1 & 63 | 128;
5324
+ }
5325
+ }
5326
+ return offset - start;
5327
+ };
5328
+ }, {}], 11: [function(require, module2, exports) {
5329
+ module2.exports = common;
5330
+ var commonRe = /\/|\./;
5331
+ function common(name, json) {
5332
+ if (!commonRe.test(name)) {
5333
+ name = "google/protobuf/" + name + ".proto";
5334
+ json = { nested: { google: { nested: { protobuf: { nested: json } } } } };
5335
+ }
5336
+ common[name] = json;
5337
+ }
5338
+ common("any", {
5339
+ /**
5340
+ * Properties of a google.protobuf.Any message.
5341
+ * @interface IAny
5342
+ * @type {Object}
5343
+ * @property {string} [typeUrl]
5344
+ * @property {Uint8Array} [bytes]
5345
+ * @memberof common
5346
+ */
5347
+ Any: {
5348
+ fields: {
5349
+ type_url: {
5350
+ type: "string",
5351
+ id: 1
5352
+ },
5353
+ value: {
5354
+ type: "bytes",
5355
+ id: 2
5356
+ }
5357
+ }
5358
+ }
5359
+ });
5360
+ var timeType;
5361
+ common("duration", {
5362
+ /**
5363
+ * Properties of a google.protobuf.Duration message.
5364
+ * @interface IDuration
5365
+ * @type {Object}
5366
+ * @property {number|Long} [seconds]
5367
+ * @property {number} [nanos]
5368
+ * @memberof common
5369
+ */
5370
+ Duration: timeType = {
5371
+ fields: {
5372
+ seconds: {
5373
+ type: "int64",
5374
+ id: 1
5375
+ },
5376
+ nanos: {
5377
+ type: "int32",
5378
+ id: 2
5379
+ }
5380
+ }
5381
+ }
5382
+ });
5383
+ common("timestamp", {
5384
+ /**
5385
+ * Properties of a google.protobuf.Timestamp message.
5386
+ * @interface ITimestamp
5387
+ * @type {Object}
5388
+ * @property {number|Long} [seconds]
5389
+ * @property {number} [nanos]
5390
+ * @memberof common
5391
+ */
5392
+ Timestamp: timeType
5393
+ });
5394
+ common("empty", {
5395
+ /**
5396
+ * Properties of a google.protobuf.Empty message.
5397
+ * @interface IEmpty
5398
+ * @memberof common
5399
+ */
5400
+ Empty: {
5401
+ fields: {}
5402
+ }
5403
+ });
5404
+ common("struct", {
5405
+ /**
5406
+ * Properties of a google.protobuf.Struct message.
5407
+ * @interface IStruct
5408
+ * @type {Object}
5409
+ * @property {Object.<string,IValue>} [fields]
5410
+ * @memberof common
5411
+ */
5412
+ Struct: {
5413
+ fields: {
5414
+ fields: {
5415
+ keyType: "string",
5416
+ type: "Value",
5417
+ id: 1
5418
+ }
5419
+ }
5420
+ },
5421
+ /**
5422
+ * Properties of a google.protobuf.Value message.
5423
+ * @interface IValue
5424
+ * @type {Object}
5425
+ * @property {string} [kind]
5426
+ * @property {0} [nullValue]
5427
+ * @property {number} [numberValue]
5428
+ * @property {string} [stringValue]
5429
+ * @property {boolean} [boolValue]
5430
+ * @property {IStruct} [structValue]
5431
+ * @property {IListValue} [listValue]
5432
+ * @memberof common
5433
+ */
5434
+ Value: {
5435
+ oneofs: {
5436
+ kind: {
5437
+ oneof: [
5438
+ "nullValue",
5439
+ "numberValue",
5440
+ "stringValue",
5441
+ "boolValue",
5442
+ "structValue",
5443
+ "listValue"
5444
+ ]
5445
+ }
5446
+ },
5447
+ fields: {
5448
+ nullValue: {
5449
+ type: "NullValue",
5450
+ id: 1
5451
+ },
5452
+ numberValue: {
5453
+ type: "double",
5454
+ id: 2
5455
+ },
5456
+ stringValue: {
5457
+ type: "string",
5458
+ id: 3
5459
+ },
5460
+ boolValue: {
5461
+ type: "bool",
5462
+ id: 4
5463
+ },
5464
+ structValue: {
5465
+ type: "Struct",
5466
+ id: 5
5467
+ },
5468
+ listValue: {
5469
+ type: "ListValue",
5470
+ id: 6
5471
+ }
5472
+ }
5473
+ },
5474
+ NullValue: {
5475
+ values: {
5476
+ NULL_VALUE: 0
5477
+ }
5478
+ },
5479
+ /**
5480
+ * Properties of a google.protobuf.ListValue message.
5481
+ * @interface IListValue
5482
+ * @type {Object}
5483
+ * @property {Array.<IValue>} [values]
5484
+ * @memberof common
5485
+ */
5486
+ ListValue: {
5487
+ fields: {
5488
+ values: {
5489
+ rule: "repeated",
5490
+ type: "Value",
5491
+ id: 1
5492
+ }
5493
+ }
5494
+ }
5495
+ });
5496
+ common("wrappers", {
5497
+ /**
5498
+ * Properties of a google.protobuf.DoubleValue message.
5499
+ * @interface IDoubleValue
5500
+ * @type {Object}
5501
+ * @property {number} [value]
5502
+ * @memberof common
5503
+ */
5504
+ DoubleValue: {
5505
+ fields: {
5506
+ value: {
5507
+ type: "double",
5508
+ id: 1
5509
+ }
5510
+ }
5511
+ },
5512
+ /**
5513
+ * Properties of a google.protobuf.FloatValue message.
5514
+ * @interface IFloatValue
5515
+ * @type {Object}
5516
+ * @property {number} [value]
5517
+ * @memberof common
5518
+ */
5519
+ FloatValue: {
5520
+ fields: {
5521
+ value: {
5522
+ type: "float",
5523
+ id: 1
5524
+ }
5525
+ }
5526
+ },
5527
+ /**
5528
+ * Properties of a google.protobuf.Int64Value message.
5529
+ * @interface IInt64Value
5530
+ * @type {Object}
5531
+ * @property {number|Long} [value]
5532
+ * @memberof common
5533
+ */
5534
+ Int64Value: {
5535
+ fields: {
5536
+ value: {
5537
+ type: "int64",
5538
+ id: 1
5539
+ }
5540
+ }
5541
+ },
5542
+ /**
5543
+ * Properties of a google.protobuf.UInt64Value message.
5544
+ * @interface IUInt64Value
5545
+ * @type {Object}
5546
+ * @property {number|Long} [value]
5547
+ * @memberof common
5548
+ */
5549
+ UInt64Value: {
5550
+ fields: {
5551
+ value: {
5552
+ type: "uint64",
5553
+ id: 1
5554
+ }
5555
+ }
5556
+ },
5557
+ /**
5558
+ * Properties of a google.protobuf.Int32Value message.
5559
+ * @interface IInt32Value
5560
+ * @type {Object}
5561
+ * @property {number} [value]
5562
+ * @memberof common
5563
+ */
5564
+ Int32Value: {
5565
+ fields: {
5566
+ value: {
5567
+ type: "int32",
5568
+ id: 1
5569
+ }
5570
+ }
5571
+ },
5572
+ /**
5573
+ * Properties of a google.protobuf.UInt32Value message.
5574
+ * @interface IUInt32Value
5575
+ * @type {Object}
5576
+ * @property {number} [value]
5577
+ * @memberof common
5578
+ */
5579
+ UInt32Value: {
5580
+ fields: {
5581
+ value: {
5582
+ type: "uint32",
5583
+ id: 1
5584
+ }
5585
+ }
5586
+ },
5587
+ /**
5588
+ * Properties of a google.protobuf.BoolValue message.
5589
+ * @interface IBoolValue
5590
+ * @type {Object}
5591
+ * @property {boolean} [value]
5592
+ * @memberof common
5593
+ */
5594
+ BoolValue: {
5595
+ fields: {
5596
+ value: {
5597
+ type: "bool",
5598
+ id: 1
5599
+ }
5600
+ }
5601
+ },
5602
+ /**
5603
+ * Properties of a google.protobuf.StringValue message.
5604
+ * @interface IStringValue
5605
+ * @type {Object}
5606
+ * @property {string} [value]
5607
+ * @memberof common
5608
+ */
5609
+ StringValue: {
5610
+ fields: {
5611
+ value: {
5612
+ type: "string",
5613
+ id: 1
5614
+ }
5615
+ }
5616
+ },
5617
+ /**
5618
+ * Properties of a google.protobuf.BytesValue message.
5619
+ * @interface IBytesValue
5620
+ * @type {Object}
5621
+ * @property {Uint8Array} [value]
5622
+ * @memberof common
5623
+ */
5624
+ BytesValue: {
5625
+ fields: {
5626
+ value: {
5627
+ type: "bytes",
5628
+ id: 1
5629
+ }
5630
+ }
5631
+ }
5632
+ });
5633
+ common("field_mask", {
5634
+ /**
5635
+ * Properties of a google.protobuf.FieldMask message.
5636
+ * @interface IDoubleValue
5637
+ * @type {Object}
5638
+ * @property {number} [value]
5639
+ * @memberof common
5640
+ */
5641
+ FieldMask: {
5642
+ fields: {
5643
+ paths: {
5644
+ rule: "repeated",
5645
+ type: "string",
5646
+ id: 1
5647
+ }
5648
+ }
5649
+ }
5650
+ });
5651
+ common.get = function get(file) {
5652
+ return common[file] || null;
5653
+ };
5654
+ }, {}], 12: [function(require, module2, exports) {
5655
+ var converter = exports;
5656
+ var Enum = require(15), util = require(37);
5657
+ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
5658
+ if (field.resolvedType) {
5659
+ if (field.resolvedType instanceof Enum) {
5660
+ gen("switch(d%s){", prop);
5661
+ for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
5662
+ if (field.repeated && values[keys[i]] === field.typeDefault) gen("default:");
5663
+ gen("case%j:", keys[i])("case %i:", values[keys[i]])("m%s=%j", prop, values[keys[i]])("break");
5664
+ }
5665
+ gen("}");
5666
+ } else gen('if(typeof d%s!=="object")', prop)("throw TypeError(%j)", field.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop);
5667
+ } else {
5668
+ var isUnsigned = false;
5669
+ switch (field.type) {
5670
+ case "double":
5671
+ case "float":
5672
+ gen("m%s=Number(d%s)", prop, prop);
5673
+ break;
5674
+ case "uint32":
5675
+ case "fixed32":
5676
+ gen("m%s=d%s>>>0", prop, prop);
5677
+ break;
5678
+ case "int32":
5679
+ case "sint32":
5680
+ case "sfixed32":
5681
+ gen("m%s=d%s|0", prop, prop);
5682
+ break;
5683
+ case "uint64":
5684
+ isUnsigned = true;
5685
+ // eslint-disable-line no-fallthrough
5686
+ case "int64":
5687
+ case "sint64":
5688
+ case "fixed64":
5689
+ case "sfixed64":
5690
+ gen("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned)('else if(typeof d%s==="string")', prop)("m%s=parseInt(d%s,10)", prop, prop)('else if(typeof d%s==="number")', prop)("m%s=d%s", prop, prop)('else if(typeof d%s==="object")', prop)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : "");
5691
+ break;
5692
+ case "bytes":
5693
+ gen('if(typeof d%s==="string")', prop)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop)("else if(d%s.length)", prop)("m%s=d%s", prop, prop);
5694
+ break;
5695
+ case "string":
5696
+ gen("m%s=String(d%s)", prop, prop);
5697
+ break;
5698
+ case "bool":
5699
+ gen("m%s=Boolean(d%s)", prop, prop);
5700
+ break;
5701
+ }
5702
+ }
5703
+ return gen;
5704
+ }
5705
+ converter.fromObject = function fromObject(mtype) {
5706
+ var fields = mtype.fieldsArray;
5707
+ var gen = util.codegen(["d"], mtype.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
5708
+ if (!fields.length) return gen("return new this.ctor");
5709
+ gen("var m=new this.ctor");
5710
+ for (var i = 0; i < fields.length; ++i) {
5711
+ var field = fields[i].resolve(), prop = util.safeProp(field.name);
5712
+ if (field.map) {
5713
+ gen("if(d%s){", prop)('if(typeof d%s!=="object")', prop)("throw TypeError(%j)", field.fullName + ": object expected")("m%s={}", prop)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", prop);
5714
+ genValuePartial_fromObject(
5715
+ gen,
5716
+ field,
5717
+ /* not sorted */
5718
+ i,
5719
+ prop + "[ks[i]]"
5720
+ )("}")("}");
5721
+ } else if (field.repeated) {
5722
+ gen("if(d%s){", prop)("if(!Array.isArray(d%s))", prop)("throw TypeError(%j)", field.fullName + ": array expected")("m%s=[]", prop)("for(var i=0;i<d%s.length;++i){", prop);
5723
+ genValuePartial_fromObject(
5724
+ gen,
5725
+ field,
5726
+ /* not sorted */
5727
+ i,
5728
+ prop + "[i]"
5729
+ )("}")("}");
5730
+ } else {
5731
+ if (!(field.resolvedType instanceof Enum)) gen("if(d%s!=null){", prop);
5732
+ genValuePartial_fromObject(
5733
+ gen,
5734
+ field,
5735
+ /* not sorted */
5736
+ i,
5737
+ prop
5738
+ );
5739
+ if (!(field.resolvedType instanceof Enum)) gen("}");
5740
+ }
5741
+ }
5742
+ return gen("return m");
5743
+ };
5744
+ function genValuePartial_toObject(gen, field, fieldIndex, prop) {
5745
+ if (field.resolvedType) {
5746
+ if (field.resolvedType instanceof Enum) gen("d%s=o.enums===String?types[%i].values[m%s]:m%s", prop, fieldIndex, prop, prop);
5747
+ else gen("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);
5748
+ } else {
5749
+ var isUnsigned = false;
5750
+ switch (field.type) {
5751
+ case "double":
5752
+ case "float":
5753
+ gen("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", prop, prop, prop, prop);
5754
+ break;
5755
+ case "uint64":
5756
+ isUnsigned = true;
5757
+ // eslint-disable-line no-fallthrough
5758
+ case "int64":
5759
+ case "sint64":
5760
+ case "fixed64":
5761
+ case "sfixed64":
5762
+ gen('if(typeof m%s==="number")', prop)("d%s=o.longs===String?String(m%s):m%s", prop, prop, prop)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true" : "", prop);
5763
+ break;
5764
+ case "bytes":
5765
+ gen("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop);
5766
+ break;
5767
+ default:
5768
+ gen("d%s=m%s", prop, prop);
5769
+ break;
5770
+ }
5771
+ }
5772
+ return gen;
5773
+ }
5774
+ converter.toObject = function toObject(mtype) {
5775
+ var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
5776
+ if (!fields.length)
5777
+ return util.codegen()("return {}");
5778
+ var gen = util.codegen(["m", "o"], mtype.name + "$toObject")("if(!o)")("o={}")("var d={}");
5779
+ var repeatedFields = [], mapFields = [], normalFields = [], i = 0;
5780
+ for (; i < fields.length; ++i)
5781
+ if (!fields[i].partOf)
5782
+ (fields[i].resolve().repeated ? repeatedFields : fields[i].map ? mapFields : normalFields).push(fields[i]);
5783
+ if (repeatedFields.length) {
5784
+ gen("if(o.arrays||o.defaults){");
5785
+ for (i = 0; i < repeatedFields.length; ++i) gen("d%s=[]", util.safeProp(repeatedFields[i].name));
5786
+ gen("}");
5787
+ }
5788
+ if (mapFields.length) {
5789
+ gen("if(o.objects||o.defaults){");
5790
+ for (i = 0; i < mapFields.length; ++i) gen("d%s={}", util.safeProp(mapFields[i].name));
5791
+ gen("}");
5792
+ }
5793
+ if (normalFields.length) {
5794
+ gen("if(o.defaults){");
5795
+ for (i = 0; i < normalFields.length; ++i) {
5796
+ var field = normalFields[i], prop = util.safeProp(field.name);
5797
+ if (field.resolvedType instanceof Enum) gen("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);
5798
+ else if (field.long) gen("if(util.Long){")("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)("}else")("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber());
5799
+ else if (field.bytes) gen("d%s=o.bytes===String?%j:%s", prop, String.fromCharCode.apply(String, field.typeDefault), "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]");
5800
+ else gen("d%s=%j", prop, field.typeDefault);
5801
+ }
5802
+ gen("}");
5803
+ }
5804
+ var hasKs2 = false;
5805
+ for (i = 0; i < fields.length; ++i) {
5806
+ var field = fields[i], index = mtype._fieldsArray.indexOf(field), prop = util.safeProp(field.name);
5807
+ if (field.map) {
5808
+ if (!hasKs2) {
5809
+ hasKs2 = true;
5810
+ gen("var ks2");
5811
+ }
5812
+ gen("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop)("d%s={}", prop)("for(var j=0;j<ks2.length;++j){");
5813
+ genValuePartial_toObject(
5814
+ gen,
5815
+ field,
5816
+ /* sorted */
5817
+ index,
5818
+ prop + "[ks2[j]]"
5819
+ )("}");
5820
+ } else if (field.repeated) {
5821
+ gen("if(m%s&&m%s.length){", prop, prop)("d%s=[]", prop)("for(var j=0;j<m%s.length;++j){", prop);
5822
+ genValuePartial_toObject(
5823
+ gen,
5824
+ field,
5825
+ /* sorted */
5826
+ index,
5827
+ prop + "[j]"
5828
+ )("}");
5829
+ } else {
5830
+ gen("if(m%s!=null&&m.hasOwnProperty(%j)){", prop, field.name);
5831
+ genValuePartial_toObject(
5832
+ gen,
5833
+ field,
5834
+ /* sorted */
5835
+ index,
5836
+ prop
5837
+ );
5838
+ if (field.partOf) gen("if(o.oneofs)")("d%s=%j", util.safeProp(field.partOf.name), field.name);
5839
+ }
5840
+ gen("}");
5841
+ }
5842
+ return gen("return d");
5843
+ };
5844
+ }, { "15": 15, "37": 37 }], 13: [function(require, module2, exports) {
5845
+ module2.exports = decoder;
5846
+ var Enum = require(15), types = require(36), util = require(37);
5847
+ function missing(field) {
5848
+ return "missing required '" + field.name + "'";
5849
+ }
5850
+ function decoder(mtype) {
5851
+ var gen = util.codegen(["r", "l"], mtype.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field2) {
5852
+ return field2.map;
5853
+ }).length ? ",k" : ""))("while(r.pos<c){")("var t=r.uint32()");
5854
+ if (mtype.group) gen("if((t&7)===4)")("break");
5855
+ gen("switch(t>>>3){");
5856
+ var i = 0;
5857
+ for (; i < /* initializes */
5858
+ mtype.fieldsArray.length; ++i) {
5859
+ var field = mtype._fieldsArray[i].resolve(), type = field.resolvedType instanceof Enum ? "int32" : field.type, ref = "m" + util.safeProp(field.name);
5860
+ gen("case %i:", field.id);
5861
+ if (field.map) {
5862
+ gen("r.skip().pos++")("if(%s===util.emptyObject)", ref)("%s={}", ref)("k=r.%s()", field.keyType)("r.pos++");
5863
+ if (types.long[field.keyType] !== undefined$1) {
5864
+ if (types.basic[type] === undefined$1) gen('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())', ref, i);
5865
+ else gen('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()', ref, type);
5866
+ } else {
5867
+ if (types.basic[type] === undefined$1) gen("%s[k]=types[%i].decode(r,r.uint32())", ref, i);
5868
+ else gen("%s[k]=r.%s()", ref, type);
5869
+ }
5870
+ } else if (field.repeated) {
5871
+ gen("if(!(%s&&%s.length))", ref, ref)("%s=[]", ref);
5872
+ if (types.packed[type] !== undefined$1) gen("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", ref, type)("}else");
5873
+ if (types.basic[type] === undefined$1) gen(field.resolvedType.group ? "%s.push(types[%i].decode(r))" : "%s.push(types[%i].decode(r,r.uint32()))", ref, i);
5874
+ else gen("%s.push(r.%s())", ref, type);
5875
+ } else if (types.basic[type] === undefined$1) gen(field.resolvedType.group ? "%s=types[%i].decode(r)" : "%s=types[%i].decode(r,r.uint32())", ref, i);
5876
+ else gen("%s=r.%s()", ref, type);
5877
+ gen("break");
5878
+ }
5879
+ gen("default:")("r.skipType(t&7)")("break")("}")("}");
5880
+ for (i = 0; i < mtype._fieldsArray.length; ++i) {
5881
+ var rfield = mtype._fieldsArray[i];
5882
+ if (rfield.required) gen("if(!m.hasOwnProperty(%j))", rfield.name)("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
5883
+ }
5884
+ return gen("return m");
5885
+ }
5886
+ }, { "15": 15, "36": 36, "37": 37 }], 14: [function(require, module2, exports) {
5887
+ module2.exports = encoder;
5888
+ var Enum = require(15), types = require(36), util = require(37);
5889
+ function genTypePartial(gen, field, fieldIndex, ref) {
5890
+ return field.resolvedType.group ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0) : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0);
5891
+ }
5892
+ function encoder(mtype) {
5893
+ var gen = util.codegen(["m", "w"], mtype.name + "$encode")("if(!w)")("w=Writer.create()");
5894
+ var i, ref;
5895
+ var fields = (
5896
+ /* initializes */
5897
+ mtype.fieldsArray.slice().sort(util.compareFieldsById)
5898
+ );
5899
+ for (var i = 0; i < fields.length; ++i) {
5900
+ var field = fields[i].resolve(), index = mtype._fieldsArray.indexOf(field), type = field.resolvedType instanceof Enum ? "int32" : field.type, wireType = types.basic[type];
5901
+ ref = "m" + util.safeProp(field.name);
5902
+ if (field.map) {
5903
+ gen("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", ref)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
5904
+ if (wireType === undefined$1) gen("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref);
5905
+ else gen(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref);
5906
+ gen("}")("}");
5907
+ } else if (field.repeated) {
5908
+ gen("if(%s!=null&&%s.length){", ref, ref);
5909
+ if (field.packed && types.packed[type] !== undefined$1) {
5910
+ gen("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", ref)("w.%s(%s[i])", type, ref)("w.ldelim()");
5911
+ } else {
5912
+ gen("for(var i=0;i<%s.length;++i)", ref);
5913
+ if (wireType === undefined$1)
5914
+ genTypePartial(gen, field, index, ref + "[i]");
5915
+ else gen("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref);
5916
+ }
5917
+ gen("}");
5918
+ } else {
5919
+ if (field.optional) gen("if(%s!=null&&m.hasOwnProperty(%j))", ref, field.name);
5920
+ if (wireType === undefined$1)
5921
+ genTypePartial(gen, field, index, ref);
5922
+ else gen("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref);
5923
+ }
5924
+ }
5925
+ return gen("return w");
5926
+ }
5927
+ }, { "15": 15, "36": 36, "37": 37 }], 15: [function(require, module2, exports) {
5928
+ module2.exports = Enum;
5929
+ var ReflectionObject = require(24);
5930
+ ((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum";
5931
+ var Namespace = require(23), util = require(37);
5932
+ function Enum(name, values, options, comment, comments) {
5933
+ ReflectionObject.call(this, name, options);
5934
+ if (values && typeof values !== "object")
5935
+ throw TypeError("values must be an object");
5936
+ this.valuesById = {};
5937
+ this.values = Object.create(this.valuesById);
5938
+ this.comment = comment;
5939
+ this.comments = comments || {};
5940
+ this.reserved = undefined$1;
5941
+ if (values) {
5942
+ for (var keys = Object.keys(values), i = 0; i < keys.length; ++i)
5943
+ if (typeof values[keys[i]] === "number")
5944
+ this.valuesById[this.values[keys[i]] = values[keys[i]]] = keys[i];
5945
+ }
5946
+ }
5947
+ Enum.fromJSON = function fromJSON(name, json) {
5948
+ var enm = new Enum(name, json.values, json.options, json.comment, json.comments);
5949
+ enm.reserved = json.reserved;
5950
+ return enm;
5951
+ };
5952
+ Enum.prototype.toJSON = function toJSON(toJSONOptions) {
5953
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
5954
+ return util.toObject([
5955
+ "options",
5956
+ this.options,
5957
+ "values",
5958
+ this.values,
5959
+ "reserved",
5960
+ this.reserved && this.reserved.length ? this.reserved : undefined$1,
5961
+ "comment",
5962
+ keepComments ? this.comment : undefined$1,
5963
+ "comments",
5964
+ keepComments ? this.comments : undefined$1
5965
+ ]);
5966
+ };
5967
+ Enum.prototype.add = function add(name, id, comment) {
5968
+ if (!util.isString(name))
5969
+ throw TypeError("name must be a string");
5970
+ if (!util.isInteger(id))
5971
+ throw TypeError("id must be an integer");
5972
+ if (this.values[name] !== undefined$1)
5973
+ throw Error("duplicate name '" + name + "' in " + this);
5974
+ if (this.isReservedId(id))
5975
+ throw Error("id " + id + " is reserved in " + this);
5976
+ if (this.isReservedName(name))
5977
+ throw Error("name '" + name + "' is reserved in " + this);
5978
+ if (this.valuesById[id] !== undefined$1) {
5979
+ if (!(this.options && this.options.allow_alias))
5980
+ throw Error("duplicate id " + id + " in " + this);
5981
+ this.values[name] = id;
5982
+ } else
5983
+ this.valuesById[this.values[name] = id] = name;
5984
+ this.comments[name] = comment || null;
5985
+ return this;
5986
+ };
5987
+ Enum.prototype.remove = function remove(name) {
5988
+ if (!util.isString(name))
5989
+ throw TypeError("name must be a string");
5990
+ var val = this.values[name];
5991
+ if (val == null)
5992
+ throw Error("name '" + name + "' does not exist in " + this);
5993
+ delete this.valuesById[val];
5994
+ delete this.values[name];
5995
+ delete this.comments[name];
5996
+ return this;
5997
+ };
5998
+ Enum.prototype.isReservedId = function isReservedId(id) {
5999
+ return Namespace.isReservedId(this.reserved, id);
6000
+ };
6001
+ Enum.prototype.isReservedName = function isReservedName(name) {
6002
+ return Namespace.isReservedName(this.reserved, name);
6003
+ };
6004
+ }, { "23": 23, "24": 24, "37": 37 }], 16: [function(require, module2, exports) {
6005
+ module2.exports = Field;
6006
+ var ReflectionObject = require(24);
6007
+ ((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field";
6008
+ var Enum = require(15), types = require(36), util = require(37);
6009
+ var Type;
6010
+ var ruleRe = /^required|optional|repeated$/;
6011
+ Field.fromJSON = function fromJSON(name, json) {
6012
+ return new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);
6013
+ };
6014
+ function Field(name, id, type, rule, extend, options, comment) {
6015
+ if (util.isObject(rule)) {
6016
+ comment = extend;
6017
+ options = rule;
6018
+ rule = extend = undefined$1;
6019
+ } else if (util.isObject(extend)) {
6020
+ comment = options;
6021
+ options = extend;
6022
+ extend = undefined$1;
6023
+ }
6024
+ ReflectionObject.call(this, name, options);
6025
+ if (!util.isInteger(id) || id < 0)
6026
+ throw TypeError("id must be a non-negative integer");
6027
+ if (!util.isString(type))
6028
+ throw TypeError("type must be a string");
6029
+ if (rule !== undefined$1 && !ruleRe.test(rule = rule.toString().toLowerCase()))
6030
+ throw TypeError("rule must be a string rule");
6031
+ if (extend !== undefined$1 && !util.isString(extend))
6032
+ throw TypeError("extend must be a string");
6033
+ this.rule = rule && rule !== "optional" ? rule : undefined$1;
6034
+ this.type = type;
6035
+ this.id = id;
6036
+ this.extend = extend || undefined$1;
6037
+ this.required = rule === "required";
6038
+ this.optional = !this.required;
6039
+ this.repeated = rule === "repeated";
6040
+ this.map = false;
6041
+ this.message = null;
6042
+ this.partOf = null;
6043
+ this.typeDefault = null;
6044
+ this.defaultValue = null;
6045
+ this.long = util.Long ? types.long[type] !== undefined$1 : (
6046
+ /* istanbul ignore next */
6047
+ false
6048
+ );
6049
+ this.bytes = type === "bytes";
6050
+ this.resolvedType = null;
6051
+ this.extensionField = null;
6052
+ this.declaringField = null;
6053
+ this._packed = null;
6054
+ this.comment = comment;
6055
+ }
6056
+ Object.defineProperty(Field.prototype, "packed", {
6057
+ get: function() {
6058
+ if (this._packed === null)
6059
+ this._packed = this.getOption("packed") !== false;
6060
+ return this._packed;
6061
+ }
6062
+ });
6063
+ Field.prototype.setOption = function setOption(name, value, ifNotSet) {
6064
+ if (name === "packed")
6065
+ this._packed = null;
6066
+ return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet);
6067
+ };
6068
+ Field.prototype.toJSON = function toJSON(toJSONOptions) {
6069
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
6070
+ return util.toObject([
6071
+ "rule",
6072
+ this.rule !== "optional" && this.rule || undefined$1,
6073
+ "type",
6074
+ this.type,
6075
+ "id",
6076
+ this.id,
6077
+ "extend",
6078
+ this.extend,
6079
+ "options",
6080
+ this.options,
6081
+ "comment",
6082
+ keepComments ? this.comment : undefined$1
6083
+ ]);
6084
+ };
6085
+ Field.prototype.resolve = function resolve() {
6086
+ if (this.resolved)
6087
+ return this;
6088
+ if ((this.typeDefault = types.defaults[this.type]) === undefined$1) {
6089
+ this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);
6090
+ if (this.resolvedType instanceof Type)
6091
+ this.typeDefault = null;
6092
+ else
6093
+ this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]];
6094
+ }
6095
+ if (this.options && this.options["default"] != null) {
6096
+ this.typeDefault = this.options["default"];
6097
+ if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string")
6098
+ this.typeDefault = this.resolvedType.values[this.typeDefault];
6099
+ }
6100
+ if (this.options) {
6101
+ if (this.options.packed === true || this.options.packed !== undefined$1 && this.resolvedType && !(this.resolvedType instanceof Enum))
6102
+ delete this.options.packed;
6103
+ if (!Object.keys(this.options).length)
6104
+ this.options = undefined$1;
6105
+ }
6106
+ if (this.long) {
6107
+ this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u");
6108
+ if (Object.freeze)
6109
+ Object.freeze(this.typeDefault);
6110
+ } else if (this.bytes && typeof this.typeDefault === "string") {
6111
+ var buf;
6112
+ if (util.base64.test(this.typeDefault))
6113
+ util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0);
6114
+ else
6115
+ util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0);
6116
+ this.typeDefault = buf;
6117
+ }
6118
+ if (this.map)
6119
+ this.defaultValue = util.emptyObject;
6120
+ else if (this.repeated)
6121
+ this.defaultValue = util.emptyArray;
6122
+ else
6123
+ this.defaultValue = this.typeDefault;
6124
+ if (this.parent instanceof Type)
6125
+ this.parent.ctor.prototype[this.name] = this.defaultValue;
6126
+ return ReflectionObject.prototype.resolve.call(this);
6127
+ };
6128
+ Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) {
6129
+ if (typeof fieldType === "function")
6130
+ fieldType = util.decorateType(fieldType).name;
6131
+ else if (fieldType && typeof fieldType === "object")
6132
+ fieldType = util.decorateEnum(fieldType).name;
6133
+ return function fieldDecorator(prototype, fieldName) {
6134
+ util.decorateType(prototype.constructor).add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue }));
6135
+ };
6136
+ };
6137
+ Field._configure = function configure(Type_) {
6138
+ Type = Type_;
6139
+ };
6140
+ }, { "15": 15, "24": 24, "36": 36, "37": 37 }], 17: [function(require, module2, exports) {
6141
+ var protobuf = module2.exports = require(18);
6142
+ protobuf.build = "light";
6143
+ function load(filename, root, callback) {
6144
+ if (typeof root === "function") {
6145
+ callback = root;
6146
+ root = new protobuf.Root();
6147
+ } else if (!root)
6148
+ root = new protobuf.Root();
6149
+ return root.load(filename, callback);
6150
+ }
6151
+ protobuf.load = load;
6152
+ function loadSync(filename, root) {
6153
+ if (!root)
6154
+ root = new protobuf.Root();
6155
+ return root.loadSync(filename);
6156
+ }
6157
+ protobuf.loadSync = loadSync;
6158
+ protobuf.encoder = require(14);
6159
+ protobuf.decoder = require(13);
6160
+ protobuf.verifier = require(40);
6161
+ protobuf.converter = require(12);
6162
+ protobuf.ReflectionObject = require(24);
6163
+ protobuf.Namespace = require(23);
6164
+ protobuf.Root = require(29);
6165
+ protobuf.Enum = require(15);
6166
+ protobuf.Type = require(35);
6167
+ protobuf.Field = require(16);
6168
+ protobuf.OneOf = require(25);
6169
+ protobuf.MapField = require(20);
6170
+ protobuf.Service = require(33);
6171
+ protobuf.Method = require(22);
6172
+ protobuf.Message = require(21);
6173
+ protobuf.wrappers = require(41);
6174
+ protobuf.types = require(36);
6175
+ protobuf.util = require(37);
6176
+ protobuf.ReflectionObject._configure(protobuf.Root);
6177
+ protobuf.Namespace._configure(protobuf.Type, protobuf.Service);
6178
+ protobuf.Root._configure(protobuf.Type);
6179
+ protobuf.Field._configure(protobuf.Type);
6180
+ }, { "12": 12, "13": 13, "14": 14, "15": 15, "16": 16, "18": 18, "20": 20, "21": 21, "22": 22, "23": 23, "24": 24, "25": 25, "29": 29, "33": 33, "35": 35, "36": 36, "37": 37, "40": 40, "41": 41 }], 18: [function(require, module2, exports) {
6181
+ var protobuf = exports;
6182
+ protobuf.build = "minimal";
6183
+ protobuf.Writer = require(42);
6184
+ protobuf.BufferWriter = require(43);
6185
+ protobuf.Reader = require(27);
6186
+ protobuf.BufferReader = require(28);
6187
+ protobuf.util = require(39);
6188
+ protobuf.rpc = require(31);
6189
+ protobuf.roots = require(30);
6190
+ protobuf.configure = configure;
6191
+ function configure() {
6192
+ protobuf.Reader._configure(protobuf.BufferReader);
6193
+ protobuf.util._configure();
6194
+ }
6195
+ protobuf.Writer._configure(protobuf.BufferWriter);
6196
+ configure();
6197
+ }, { "27": 27, "28": 28, "30": 30, "31": 31, "39": 39, "42": 42, "43": 43 }], 19: [function(require, module2, exports) {
6198
+ var protobuf = module2.exports = require(17);
6199
+ protobuf.build = "full";
6200
+ protobuf.tokenize = require(34);
6201
+ protobuf.parse = require(26);
6202
+ protobuf.common = require(11);
6203
+ protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common);
6204
+ }, { "11": 11, "17": 17, "26": 26, "34": 34 }], 20: [function(require, module2, exports) {
6205
+ module2.exports = MapField;
6206
+ var Field = require(16);
6207
+ ((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField";
6208
+ var types = require(36), util = require(37);
6209
+ function MapField(name, id, keyType, type, options, comment) {
6210
+ Field.call(this, name, id, type, undefined$1, undefined$1, options, comment);
6211
+ if (!util.isString(keyType))
6212
+ throw TypeError("keyType must be a string");
6213
+ this.keyType = keyType;
6214
+ this.resolvedKeyType = null;
6215
+ this.map = true;
6216
+ }
6217
+ MapField.fromJSON = function fromJSON(name, json) {
6218
+ return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);
6219
+ };
6220
+ MapField.prototype.toJSON = function toJSON(toJSONOptions) {
6221
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
6222
+ return util.toObject([
6223
+ "keyType",
6224
+ this.keyType,
6225
+ "type",
6226
+ this.type,
6227
+ "id",
6228
+ this.id,
6229
+ "extend",
6230
+ this.extend,
6231
+ "options",
6232
+ this.options,
6233
+ "comment",
6234
+ keepComments ? this.comment : undefined$1
6235
+ ]);
6236
+ };
6237
+ MapField.prototype.resolve = function resolve() {
6238
+ if (this.resolved)
6239
+ return this;
6240
+ if (types.mapKey[this.keyType] === undefined$1)
6241
+ throw Error("invalid key type: " + this.keyType);
6242
+ return Field.prototype.resolve.call(this);
6243
+ };
6244
+ MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {
6245
+ if (typeof fieldValueType === "function")
6246
+ fieldValueType = util.decorateType(fieldValueType).name;
6247
+ else if (fieldValueType && typeof fieldValueType === "object")
6248
+ fieldValueType = util.decorateEnum(fieldValueType).name;
6249
+ return function mapFieldDecorator(prototype, fieldName) {
6250
+ util.decorateType(prototype.constructor).add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType));
6251
+ };
6252
+ };
6253
+ }, { "16": 16, "36": 36, "37": 37 }], 21: [function(require, module2, exports) {
6254
+ module2.exports = Message;
6255
+ var util = require(39);
6256
+ function Message(properties) {
6257
+ if (properties)
6258
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6259
+ this[keys[i]] = properties[keys[i]];
6260
+ }
6261
+ Message.create = function create(properties) {
6262
+ return this.$type.create(properties);
6263
+ };
6264
+ Message.encode = function encode(message, writer) {
6265
+ return this.$type.encode(message, writer);
6266
+ };
6267
+ Message.encodeDelimited = function encodeDelimited(message, writer) {
6268
+ return this.$type.encodeDelimited(message, writer);
6269
+ };
6270
+ Message.decode = function decode(reader) {
6271
+ return this.$type.decode(reader);
6272
+ };
6273
+ Message.decodeDelimited = function decodeDelimited(reader) {
6274
+ return this.$type.decodeDelimited(reader);
6275
+ };
6276
+ Message.verify = function verify(message) {
6277
+ return this.$type.verify(message);
6278
+ };
6279
+ Message.fromObject = function fromObject(object) {
6280
+ return this.$type.fromObject(object);
6281
+ };
6282
+ Message.toObject = function toObject(message, options) {
6283
+ return this.$type.toObject(message, options);
6284
+ };
6285
+ Message.prototype.toJSON = function toJSON() {
6286
+ return this.$type.toObject(this, util.toJSONOptions);
6287
+ };
6288
+ }, { "39": 39 }], 22: [function(require, module2, exports) {
6289
+ module2.exports = Method;
6290
+ var ReflectionObject = require(24);
6291
+ ((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method";
6292
+ var util = require(37);
6293
+ function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment) {
6294
+ if (util.isObject(requestStream)) {
6295
+ options = requestStream;
6296
+ requestStream = responseStream = undefined$1;
6297
+ } else if (util.isObject(responseStream)) {
6298
+ options = responseStream;
6299
+ responseStream = undefined$1;
6300
+ }
6301
+ if (!(type === undefined$1 || util.isString(type)))
6302
+ throw TypeError("type must be a string");
6303
+ if (!util.isString(requestType))
6304
+ throw TypeError("requestType must be a string");
6305
+ if (!util.isString(responseType))
6306
+ throw TypeError("responseType must be a string");
6307
+ ReflectionObject.call(this, name, options);
6308
+ this.type = type || "rpc";
6309
+ this.requestType = requestType;
6310
+ this.requestStream = requestStream ? true : undefined$1;
6311
+ this.responseType = responseType;
6312
+ this.responseStream = responseStream ? true : undefined$1;
6313
+ this.resolvedRequestType = null;
6314
+ this.resolvedResponseType = null;
6315
+ this.comment = comment;
6316
+ }
6317
+ Method.fromJSON = function fromJSON(name, json) {
6318
+ return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment);
6319
+ };
6320
+ Method.prototype.toJSON = function toJSON(toJSONOptions) {
6321
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
6322
+ return util.toObject([
6323
+ "type",
6324
+ this.type !== "rpc" && /* istanbul ignore next */
6325
+ this.type || undefined$1,
6326
+ "requestType",
6327
+ this.requestType,
6328
+ "requestStream",
6329
+ this.requestStream,
6330
+ "responseType",
6331
+ this.responseType,
6332
+ "responseStream",
6333
+ this.responseStream,
6334
+ "options",
6335
+ this.options,
6336
+ "comment",
6337
+ keepComments ? this.comment : undefined$1
6338
+ ]);
6339
+ };
6340
+ Method.prototype.resolve = function resolve() {
6341
+ if (this.resolved)
6342
+ return this;
6343
+ this.resolvedRequestType = this.parent.lookupType(this.requestType);
6344
+ this.resolvedResponseType = this.parent.lookupType(this.responseType);
6345
+ return ReflectionObject.prototype.resolve.call(this);
6346
+ };
6347
+ }, { "24": 24, "37": 37 }], 23: [function(require, module2, exports) {
6348
+ module2.exports = Namespace;
6349
+ var ReflectionObject = require(24);
6350
+ ((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace";
6351
+ var Enum = require(15), Field = require(16), util = require(37);
6352
+ var Type, Service;
6353
+ Namespace.fromJSON = function fromJSON(name, json) {
6354
+ return new Namespace(name, json.options).addJSON(json.nested);
6355
+ };
6356
+ function arrayToJSON(array, toJSONOptions) {
6357
+ if (!(array && array.length))
6358
+ return undefined$1;
6359
+ var obj = {};
6360
+ for (var i = 0; i < array.length; ++i)
6361
+ obj[array[i].name] = array[i].toJSON(toJSONOptions);
6362
+ return obj;
6363
+ }
6364
+ Namespace.arrayToJSON = arrayToJSON;
6365
+ Namespace.isReservedId = function isReservedId(reserved, id) {
6366
+ if (reserved) {
6367
+ for (var i = 0; i < reserved.length; ++i)
6368
+ if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] >= id)
6369
+ return true;
6370
+ }
6371
+ return false;
6372
+ };
6373
+ Namespace.isReservedName = function isReservedName(reserved, name) {
6374
+ if (reserved) {
6375
+ for (var i = 0; i < reserved.length; ++i)
6376
+ if (reserved[i] === name)
6377
+ return true;
6378
+ }
6379
+ return false;
6380
+ };
6381
+ function Namespace(name, options) {
6382
+ ReflectionObject.call(this, name, options);
6383
+ this.nested = undefined$1;
6384
+ this._nestedArray = null;
6385
+ }
6386
+ function clearCache(namespace) {
6387
+ namespace._nestedArray = null;
6388
+ return namespace;
6389
+ }
6390
+ Object.defineProperty(Namespace.prototype, "nestedArray", {
6391
+ get: function() {
6392
+ return this._nestedArray || (this._nestedArray = util.toArray(this.nested));
6393
+ }
6394
+ });
6395
+ Namespace.prototype.toJSON = function toJSON(toJSONOptions) {
6396
+ return util.toObject([
6397
+ "options",
6398
+ this.options,
6399
+ "nested",
6400
+ arrayToJSON(this.nestedArray, toJSONOptions)
6401
+ ]);
6402
+ };
6403
+ Namespace.prototype.addJSON = function addJSON(nestedJson) {
6404
+ var ns = this;
6405
+ if (nestedJson) {
6406
+ for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {
6407
+ nested = nestedJson[names[i]];
6408
+ ns.add(
6409
+ // most to least likely
6410
+ (nested.fields !== undefined$1 ? Type.fromJSON : nested.values !== undefined$1 ? Enum.fromJSON : nested.methods !== undefined$1 ? Service.fromJSON : nested.id !== undefined$1 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested)
6411
+ );
6412
+ }
6413
+ }
6414
+ return this;
6415
+ };
6416
+ Namespace.prototype.get = function get(name) {
6417
+ return this.nested && this.nested[name] || null;
6418
+ };
6419
+ Namespace.prototype.getEnum = function getEnum(name) {
6420
+ if (this.nested && this.nested[name] instanceof Enum)
6421
+ return this.nested[name].values;
6422
+ throw Error("no such enum: " + name);
6423
+ };
6424
+ Namespace.prototype.add = function add(object) {
6425
+ if (!(object instanceof Field && object.extend !== undefined$1 || object instanceof Type || object instanceof Enum || object instanceof Service || object instanceof Namespace))
6426
+ throw TypeError("object must be a valid nested object");
6427
+ if (!this.nested)
6428
+ this.nested = {};
6429
+ else {
6430
+ var prev = this.get(object.name);
6431
+ if (prev) {
6432
+ if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) {
6433
+ var nested = prev.nestedArray;
6434
+ for (var i = 0; i < nested.length; ++i)
6435
+ object.add(nested[i]);
6436
+ this.remove(prev);
6437
+ if (!this.nested)
6438
+ this.nested = {};
6439
+ object.setOptions(prev.options, true);
6440
+ } else
6441
+ throw Error("duplicate name '" + object.name + "' in " + this);
6442
+ }
6443
+ }
6444
+ this.nested[object.name] = object;
6445
+ object.onAdd(this);
6446
+ return clearCache(this);
6447
+ };
6448
+ Namespace.prototype.remove = function remove(object) {
6449
+ if (!(object instanceof ReflectionObject))
6450
+ throw TypeError("object must be a ReflectionObject");
6451
+ if (object.parent !== this)
6452
+ throw Error(object + " is not a member of " + this);
6453
+ delete this.nested[object.name];
6454
+ if (!Object.keys(this.nested).length)
6455
+ this.nested = undefined$1;
6456
+ object.onRemove(this);
6457
+ return clearCache(this);
6458
+ };
6459
+ Namespace.prototype.define = function define(path, json) {
6460
+ if (util.isString(path))
6461
+ path = path.split(".");
6462
+ else if (!Array.isArray(path))
6463
+ throw TypeError("illegal path");
6464
+ if (path && path.length && path[0] === "")
6465
+ throw Error("path must be relative");
6466
+ var ptr = this;
6467
+ while (path.length > 0) {
6468
+ var part = path.shift();
6469
+ if (ptr.nested && ptr.nested[part]) {
6470
+ ptr = ptr.nested[part];
6471
+ if (!(ptr instanceof Namespace))
6472
+ throw Error("path conflicts with non-namespace objects");
6473
+ } else
6474
+ ptr.add(ptr = new Namespace(part));
6475
+ }
6476
+ if (json)
6477
+ ptr.addJSON(json);
6478
+ return ptr;
6479
+ };
6480
+ Namespace.prototype.resolveAll = function resolveAll() {
6481
+ var nested = this.nestedArray, i = 0;
6482
+ while (i < nested.length)
6483
+ if (nested[i] instanceof Namespace)
6484
+ nested[i++].resolveAll();
6485
+ else
6486
+ nested[i++].resolve();
6487
+ return this.resolve();
6488
+ };
6489
+ Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) {
6490
+ if (typeof filterTypes === "boolean") {
6491
+ parentAlreadyChecked = filterTypes;
6492
+ filterTypes = undefined$1;
6493
+ } else if (filterTypes && !Array.isArray(filterTypes))
6494
+ filterTypes = [filterTypes];
6495
+ if (util.isString(path) && path.length) {
6496
+ if (path === ".")
6497
+ return this.root;
6498
+ path = path.split(".");
6499
+ } else if (!path.length)
6500
+ return this;
6501
+ if (path[0] === "")
6502
+ return this.root.lookup(path.slice(1), filterTypes);
6503
+ var found = this.get(path[0]);
6504
+ if (found) {
6505
+ if (path.length === 1) {
6506
+ if (!filterTypes || filterTypes.indexOf(found.constructor) > -1)
6507
+ return found;
6508
+ } else if (found instanceof Namespace && (found = found.lookup(path.slice(1), filterTypes, true)))
6509
+ return found;
6510
+ } else
6511
+ for (var i = 0; i < this.nestedArray.length; ++i)
6512
+ if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i].lookup(path, filterTypes, true)))
6513
+ return found;
6514
+ if (this.parent === null || parentAlreadyChecked)
6515
+ return null;
6516
+ return this.parent.lookup(path, filterTypes);
6517
+ };
6518
+ Namespace.prototype.lookupType = function lookupType(path) {
6519
+ var found = this.lookup(path, [Type]);
6520
+ if (!found)
6521
+ throw Error("no such type: " + path);
6522
+ return found;
6523
+ };
6524
+ Namespace.prototype.lookupEnum = function lookupEnum(path) {
6525
+ var found = this.lookup(path, [Enum]);
6526
+ if (!found)
6527
+ throw Error("no such Enum '" + path + "' in " + this);
6528
+ return found;
6529
+ };
6530
+ Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {
6531
+ var found = this.lookup(path, [Type, Enum]);
6532
+ if (!found)
6533
+ throw Error("no such Type or Enum '" + path + "' in " + this);
6534
+ return found;
6535
+ };
6536
+ Namespace.prototype.lookupService = function lookupService(path) {
6537
+ var found = this.lookup(path, [Service]);
6538
+ if (!found)
6539
+ throw Error("no such Service '" + path + "' in " + this);
6540
+ return found;
6541
+ };
6542
+ Namespace._configure = function(Type_, Service_) {
6543
+ Type = Type_;
6544
+ Service = Service_;
6545
+ };
6546
+ }, { "15": 15, "16": 16, "24": 24, "37": 37 }], 24: [function(require, module2, exports) {
6547
+ module2.exports = ReflectionObject;
6548
+ ReflectionObject.className = "ReflectionObject";
6549
+ var util = require(37);
6550
+ var Root;
6551
+ function ReflectionObject(name, options) {
6552
+ if (!util.isString(name))
6553
+ throw TypeError("name must be a string");
6554
+ if (options && !util.isObject(options))
6555
+ throw TypeError("options must be an object");
6556
+ this.options = options;
6557
+ this.name = name;
6558
+ this.parent = null;
6559
+ this.resolved = false;
6560
+ this.comment = null;
6561
+ this.filename = null;
6562
+ }
6563
+ Object.defineProperties(ReflectionObject.prototype, {
6564
+ /**
6565
+ * Reference to the root namespace.
6566
+ * @name ReflectionObject#root
6567
+ * @type {Root}
6568
+ * @readonly
6569
+ */
6570
+ root: {
6571
+ get: function() {
6572
+ var ptr = this;
6573
+ while (ptr.parent !== null)
6574
+ ptr = ptr.parent;
6575
+ return ptr;
6576
+ }
6577
+ },
6578
+ /**
6579
+ * Full name including leading dot.
6580
+ * @name ReflectionObject#fullName
6581
+ * @type {string}
6582
+ * @readonly
6583
+ */
6584
+ fullName: {
6585
+ get: function() {
6586
+ var path = [this.name], ptr = this.parent;
6587
+ while (ptr) {
6588
+ path.unshift(ptr.name);
6589
+ ptr = ptr.parent;
6590
+ }
6591
+ return path.join(".");
6592
+ }
6593
+ }
6594
+ });
6595
+ ReflectionObject.prototype.toJSON = /* istanbul ignore next */
6596
+ function toJSON() {
6597
+ throw Error();
6598
+ };
6599
+ ReflectionObject.prototype.onAdd = function onAdd(parent) {
6600
+ if (this.parent && this.parent !== parent)
6601
+ this.parent.remove(this);
6602
+ this.parent = parent;
6603
+ this.resolved = false;
6604
+ var root = parent.root;
6605
+ if (root instanceof Root)
6606
+ root._handleAdd(this);
6607
+ };
6608
+ ReflectionObject.prototype.onRemove = function onRemove(parent) {
6609
+ var root = parent.root;
6610
+ if (root instanceof Root)
6611
+ root._handleRemove(this);
6612
+ this.parent = null;
6613
+ this.resolved = false;
6614
+ };
6615
+ ReflectionObject.prototype.resolve = function resolve() {
6616
+ if (this.resolved)
6617
+ return this;
6618
+ if (this.root instanceof Root)
6619
+ this.resolved = true;
6620
+ return this;
6621
+ };
6622
+ ReflectionObject.prototype.getOption = function getOption(name) {
6623
+ if (this.options)
6624
+ return this.options[name];
6625
+ return undefined$1;
6626
+ };
6627
+ ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) {
6628
+ if (!ifNotSet || !this.options || this.options[name] === undefined$1)
6629
+ (this.options || (this.options = {}))[name] = value;
6630
+ return this;
6631
+ };
6632
+ ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) {
6633
+ if (options)
6634
+ for (var keys = Object.keys(options), i = 0; i < keys.length; ++i)
6635
+ this.setOption(keys[i], options[keys[i]], ifNotSet);
6636
+ return this;
6637
+ };
6638
+ ReflectionObject.prototype.toString = function toString() {
6639
+ var className = this.constructor.className, fullName = this.fullName;
6640
+ if (fullName.length)
6641
+ return className + " " + fullName;
6642
+ return className;
6643
+ };
6644
+ ReflectionObject._configure = function(Root_) {
6645
+ Root = Root_;
6646
+ };
6647
+ }, { "37": 37 }], 25: [function(require, module2, exports) {
6648
+ module2.exports = OneOf;
6649
+ var ReflectionObject = require(24);
6650
+ ((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf";
6651
+ var Field = require(16), util = require(37);
6652
+ function OneOf(name, fieldNames, options, comment) {
6653
+ if (!Array.isArray(fieldNames)) {
6654
+ options = fieldNames;
6655
+ fieldNames = undefined$1;
6656
+ }
6657
+ ReflectionObject.call(this, name, options);
6658
+ if (!(fieldNames === undefined$1 || Array.isArray(fieldNames)))
6659
+ throw TypeError("fieldNames must be an Array");
6660
+ this.oneof = fieldNames || [];
6661
+ this.fieldsArray = [];
6662
+ this.comment = comment;
6663
+ }
6664
+ OneOf.fromJSON = function fromJSON(name, json) {
6665
+ return new OneOf(name, json.oneof, json.options, json.comment);
6666
+ };
6667
+ OneOf.prototype.toJSON = function toJSON(toJSONOptions) {
6668
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
6669
+ return util.toObject([
6670
+ "options",
6671
+ this.options,
6672
+ "oneof",
6673
+ this.oneof,
6674
+ "comment",
6675
+ keepComments ? this.comment : undefined$1
6676
+ ]);
6677
+ };
6678
+ function addFieldsToParent(oneof) {
6679
+ if (oneof.parent) {
6680
+ for (var i = 0; i < oneof.fieldsArray.length; ++i)
6681
+ if (!oneof.fieldsArray[i].parent)
6682
+ oneof.parent.add(oneof.fieldsArray[i]);
6683
+ }
6684
+ }
6685
+ OneOf.prototype.add = function add(field) {
6686
+ if (!(field instanceof Field))
6687
+ throw TypeError("field must be a Field");
6688
+ if (field.parent && field.parent !== this.parent)
6689
+ field.parent.remove(field);
6690
+ this.oneof.push(field.name);
6691
+ this.fieldsArray.push(field);
6692
+ field.partOf = this;
6693
+ addFieldsToParent(this);
6694
+ return this;
6695
+ };
6696
+ OneOf.prototype.remove = function remove(field) {
6697
+ if (!(field instanceof Field))
6698
+ throw TypeError("field must be a Field");
6699
+ var index = this.fieldsArray.indexOf(field);
6700
+ if (index < 0)
6701
+ throw Error(field + " is not a member of " + this);
6702
+ this.fieldsArray.splice(index, 1);
6703
+ index = this.oneof.indexOf(field.name);
6704
+ if (index > -1)
6705
+ this.oneof.splice(index, 1);
6706
+ field.partOf = null;
6707
+ return this;
6708
+ };
6709
+ OneOf.prototype.onAdd = function onAdd(parent) {
6710
+ ReflectionObject.prototype.onAdd.call(this, parent);
6711
+ var self = this;
6712
+ for (var i = 0; i < this.oneof.length; ++i) {
6713
+ var field = parent.get(this.oneof[i]);
6714
+ if (field && !field.partOf) {
6715
+ field.partOf = self;
6716
+ self.fieldsArray.push(field);
6717
+ }
6718
+ }
6719
+ addFieldsToParent(this);
6720
+ };
6721
+ OneOf.prototype.onRemove = function onRemove(parent) {
6722
+ for (var i = 0, field; i < this.fieldsArray.length; ++i)
6723
+ if ((field = this.fieldsArray[i]).parent)
6724
+ field.parent.remove(field);
6725
+ ReflectionObject.prototype.onRemove.call(this, parent);
6726
+ };
6727
+ OneOf.d = function decorateOneOf() {
6728
+ var fieldNames = new Array(arguments.length), index = 0;
6729
+ while (index < arguments.length)
6730
+ fieldNames[index] = arguments[index++];
6731
+ return function oneOfDecorator(prototype, oneofName) {
6732
+ util.decorateType(prototype.constructor).add(new OneOf(oneofName, fieldNames));
6733
+ Object.defineProperty(prototype, oneofName, {
6734
+ get: util.oneOfGetter(fieldNames),
6735
+ set: util.oneOfSetter(fieldNames)
6736
+ });
6737
+ };
6738
+ };
6739
+ }, { "16": 16, "24": 24, "37": 37 }], 26: [function(require, module2, exports) {
6740
+ module2.exports = parse;
6741
+ parse.filename = null;
6742
+ parse.defaults = { keepCase: false };
6743
+ var tokenize = require(34), Root = require(29), Type = require(35), Field = require(16), MapField = require(20), OneOf = require(25), Enum = require(15), Service = require(33), Method = require(22), types = require(36), util = require(37);
6744
+ var base10Re = /^[1-9][0-9]*$/, base10NegRe = /^-?[1-9][0-9]*$/, base16Re = /^0[x][0-9a-fA-F]+$/, base16NegRe = /^-?0[x][0-9a-fA-F]+$/, base8Re = /^0[0-7]+$/, base8NegRe = /^-?0[0-7]+$/, numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/, typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, fqTypeRefRe = /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;
6745
+ function parse(source, root, options) {
6746
+ if (!(root instanceof Root)) {
6747
+ options = root;
6748
+ root = new Root();
6749
+ }
6750
+ if (!options)
6751
+ options = parse.defaults;
6752
+ var tn = tokenize(source, options.alternateCommentMode || false), next = tn.next, push = tn.push, peek = tn.peek, skip = tn.skip, cmnt = tn.cmnt;
6753
+ var head = true, pkg, imports, weakImports, syntax, isProto3 = false;
6754
+ var ptr = root;
6755
+ var applyCase = options.keepCase ? function(name) {
6756
+ return name;
6757
+ } : util.camelCase;
6758
+ function illegal(token2, name, insideTryCatch) {
6759
+ var filename = parse.filename;
6760
+ if (!insideTryCatch)
6761
+ parse.filename = null;
6762
+ return Error("illegal " + (name || "token") + " '" + token2 + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")");
6763
+ }
6764
+ function readString() {
6765
+ var values = [], token2;
6766
+ do {
6767
+ if ((token2 = next()) !== '"' && token2 !== "'")
6768
+ throw illegal(token2);
6769
+ values.push(next());
6770
+ skip(token2);
6771
+ token2 = peek();
6772
+ } while (token2 === '"' || token2 === "'");
6773
+ return values.join("");
6774
+ }
6775
+ function readValue(acceptTypeRef) {
6776
+ var token2 = next();
6777
+ switch (token2) {
6778
+ case "'":
6779
+ case '"':
6780
+ push(token2);
6781
+ return readString();
6782
+ case "true":
6783
+ case "TRUE":
6784
+ return true;
6785
+ case "false":
6786
+ case "FALSE":
6787
+ return false;
6788
+ }
6789
+ try {
6790
+ return parseNumber(
6791
+ token2,
6792
+ /* insideTryCatch */
6793
+ true
6794
+ );
6795
+ } catch (e) {
6796
+ if (typeRefRe.test(token2))
6797
+ return token2;
6798
+ throw illegal(token2, "value");
6799
+ }
6800
+ }
6801
+ function readRanges(target, acceptStrings) {
6802
+ var token2, start;
6803
+ do {
6804
+ if (acceptStrings && ((token2 = peek()) === '"' || token2 === "'"))
6805
+ target.push(readString());
6806
+ else
6807
+ target.push([start = parseId(next()), skip("to", true) ? parseId(next()) : start]);
6808
+ } while (skip(",", true));
6809
+ skip(";");
6810
+ }
6811
+ function parseNumber(token2, insideTryCatch) {
6812
+ var sign = 1;
6813
+ if (token2.charAt(0) === "-") {
6814
+ sign = -1;
6815
+ token2 = token2.substring(1);
6816
+ }
6817
+ switch (token2) {
6818
+ case "inf":
6819
+ case "INF":
6820
+ case "Inf":
6821
+ return sign * Infinity;
6822
+ case "nan":
6823
+ case "NAN":
6824
+ case "Nan":
6825
+ case "NaN":
6826
+ return NaN;
6827
+ case "0":
6828
+ return 0;
6829
+ }
6830
+ if (base10Re.test(token2))
6831
+ return sign * parseInt(token2, 10);
6832
+ if (base16Re.test(token2))
6833
+ return sign * parseInt(token2, 16);
6834
+ if (base8Re.test(token2))
6835
+ return sign * parseInt(token2, 8);
6836
+ if (numberRe.test(token2))
6837
+ return sign * parseFloat(token2);
6838
+ throw illegal(token2, "number", insideTryCatch);
6839
+ }
6840
+ function parseId(token2, acceptNegative) {
6841
+ switch (token2) {
6842
+ case "max":
6843
+ case "MAX":
6844
+ case "Max":
6845
+ return 536870911;
6846
+ case "0":
6847
+ return 0;
6848
+ }
6849
+ if (!acceptNegative && token2.charAt(0) === "-")
6850
+ throw illegal(token2, "id");
6851
+ if (base10NegRe.test(token2))
6852
+ return parseInt(token2, 10);
6853
+ if (base16NegRe.test(token2))
6854
+ return parseInt(token2, 16);
6855
+ if (base8NegRe.test(token2))
6856
+ return parseInt(token2, 8);
6857
+ throw illegal(token2, "id");
6858
+ }
6859
+ function parsePackage() {
6860
+ if (pkg !== undefined$1)
6861
+ throw illegal("package");
6862
+ pkg = next();
6863
+ if (!typeRefRe.test(pkg))
6864
+ throw illegal(pkg, "name");
6865
+ ptr = ptr.define(pkg);
6866
+ skip(";");
6867
+ }
6868
+ function parseImport() {
6869
+ var token2 = peek();
6870
+ var whichImports;
6871
+ switch (token2) {
6872
+ case "weak":
6873
+ whichImports = weakImports || (weakImports = []);
6874
+ next();
6875
+ break;
6876
+ case "public":
6877
+ next();
6878
+ // eslint-disable-line no-fallthrough
6879
+ default:
6880
+ whichImports = imports || (imports = []);
6881
+ break;
6882
+ }
6883
+ token2 = readString();
6884
+ skip(";");
6885
+ whichImports.push(token2);
6886
+ }
6887
+ function parseSyntax() {
6888
+ skip("=");
6889
+ syntax = readString();
6890
+ isProto3 = syntax === "proto3";
6891
+ if (!isProto3 && syntax !== "proto2")
6892
+ throw illegal(syntax, "syntax");
6893
+ skip(";");
6894
+ }
6895
+ function parseCommon(parent, token2) {
6896
+ switch (token2) {
6897
+ case "option":
6898
+ parseOption(parent, token2);
6899
+ skip(";");
6900
+ return true;
6901
+ case "message":
6902
+ parseType(parent, token2);
6903
+ return true;
6904
+ case "enum":
6905
+ parseEnum(parent, token2);
6906
+ return true;
6907
+ case "service":
6908
+ parseService(parent, token2);
6909
+ return true;
6910
+ case "extend":
6911
+ parseExtension(parent, token2);
6912
+ return true;
6913
+ }
6914
+ return false;
6915
+ }
6916
+ function ifBlock(obj, fnIf, fnElse) {
6917
+ var trailingLine = tn.line;
6918
+ if (obj) {
6919
+ obj.comment = cmnt();
6920
+ obj.filename = parse.filename;
6921
+ }
6922
+ if (skip("{", true)) {
6923
+ var token2;
6924
+ while ((token2 = next()) !== "}")
6925
+ fnIf(token2);
6926
+ skip(";", true);
6927
+ } else {
6928
+ if (fnElse)
6929
+ fnElse();
6930
+ skip(";");
6931
+ if (obj && typeof obj.comment !== "string")
6932
+ obj.comment = cmnt(trailingLine);
6933
+ }
6934
+ }
6935
+ function parseType(parent, token2) {
6936
+ if (!nameRe.test(token2 = next()))
6937
+ throw illegal(token2, "type name");
6938
+ var type = new Type(token2);
6939
+ ifBlock(type, function parseType_block(token3) {
6940
+ if (parseCommon(type, token3))
6941
+ return;
6942
+ switch (token3) {
6943
+ case "map":
6944
+ parseMapField(type);
6945
+ break;
6946
+ case "required":
6947
+ case "optional":
6948
+ case "repeated":
6949
+ parseField(type, token3);
6950
+ break;
6951
+ case "oneof":
6952
+ parseOneOf(type, token3);
6953
+ break;
6954
+ case "extensions":
6955
+ readRanges(type.extensions || (type.extensions = []));
6956
+ break;
6957
+ case "reserved":
6958
+ readRanges(type.reserved || (type.reserved = []), true);
6959
+ break;
6960
+ default:
6961
+ if (!isProto3 || !typeRefRe.test(token3))
6962
+ throw illegal(token3);
6963
+ push(token3);
6964
+ parseField(type, "optional");
6965
+ break;
6966
+ }
6967
+ });
6968
+ parent.add(type);
6969
+ }
6970
+ function parseField(parent, rule, extend) {
6971
+ var type = next();
6972
+ if (type === "group") {
6973
+ parseGroup(parent, rule);
6974
+ return;
6975
+ }
6976
+ if (!typeRefRe.test(type))
6977
+ throw illegal(type, "type");
6978
+ var name = next();
6979
+ if (!nameRe.test(name))
6980
+ throw illegal(name, "name");
6981
+ name = applyCase(name);
6982
+ skip("=");
6983
+ var field = new Field(name, parseId(next()), type, rule, extend);
6984
+ ifBlock(field, function parseField_block(token2) {
6985
+ if (token2 === "option") {
6986
+ parseOption(field, token2);
6987
+ skip(";");
6988
+ } else
6989
+ throw illegal(token2);
6990
+ }, function parseField_line() {
6991
+ parseInlineOptions(field);
6992
+ });
6993
+ parent.add(field);
6994
+ if (!isProto3 && field.repeated && (types.packed[type] !== undefined$1 || types.basic[type] === undefined$1))
6995
+ field.setOption(
6996
+ "packed",
6997
+ false,
6998
+ /* ifNotSet */
6999
+ true
7000
+ );
7001
+ }
7002
+ function parseGroup(parent, rule) {
7003
+ var name = next();
7004
+ if (!nameRe.test(name))
7005
+ throw illegal(name, "name");
7006
+ var fieldName = util.lcFirst(name);
7007
+ if (name === fieldName)
7008
+ name = util.ucFirst(name);
7009
+ skip("=");
7010
+ var id = parseId(next());
7011
+ var type = new Type(name);
7012
+ type.group = true;
7013
+ var field = new Field(fieldName, id, name, rule);
7014
+ field.filename = parse.filename;
7015
+ ifBlock(type, function parseGroup_block(token2) {
7016
+ switch (token2) {
7017
+ case "option":
7018
+ parseOption(type, token2);
7019
+ skip(";");
7020
+ break;
7021
+ case "required":
7022
+ case "optional":
7023
+ case "repeated":
7024
+ parseField(type, token2);
7025
+ break;
7026
+ /* istanbul ignore next */
7027
+ default:
7028
+ throw illegal(token2);
7029
+ }
7030
+ });
7031
+ parent.add(type).add(field);
7032
+ }
7033
+ function parseMapField(parent) {
7034
+ skip("<");
7035
+ var keyType = next();
7036
+ if (types.mapKey[keyType] === undefined$1)
7037
+ throw illegal(keyType, "type");
7038
+ skip(",");
7039
+ var valueType = next();
7040
+ if (!typeRefRe.test(valueType))
7041
+ throw illegal(valueType, "type");
7042
+ skip(">");
7043
+ var name = next();
7044
+ if (!nameRe.test(name))
7045
+ throw illegal(name, "name");
7046
+ skip("=");
7047
+ var field = new MapField(applyCase(name), parseId(next()), keyType, valueType);
7048
+ ifBlock(field, function parseMapField_block(token2) {
7049
+ if (token2 === "option") {
7050
+ parseOption(field, token2);
7051
+ skip(";");
7052
+ } else
7053
+ throw illegal(token2);
7054
+ }, function parseMapField_line() {
7055
+ parseInlineOptions(field);
7056
+ });
7057
+ parent.add(field);
7058
+ }
7059
+ function parseOneOf(parent, token2) {
7060
+ if (!nameRe.test(token2 = next()))
7061
+ throw illegal(token2, "name");
7062
+ var oneof = new OneOf(applyCase(token2));
7063
+ ifBlock(oneof, function parseOneOf_block(token3) {
7064
+ if (token3 === "option") {
7065
+ parseOption(oneof, token3);
7066
+ skip(";");
7067
+ } else {
7068
+ push(token3);
7069
+ parseField(oneof, "optional");
7070
+ }
7071
+ });
7072
+ parent.add(oneof);
7073
+ }
7074
+ function parseEnum(parent, token2) {
7075
+ if (!nameRe.test(token2 = next()))
7076
+ throw illegal(token2, "name");
7077
+ var enm = new Enum(token2);
7078
+ ifBlock(enm, function parseEnum_block(token3) {
7079
+ switch (token3) {
7080
+ case "option":
7081
+ parseOption(enm, token3);
7082
+ skip(";");
7083
+ break;
7084
+ case "reserved":
7085
+ readRanges(enm.reserved || (enm.reserved = []), true);
7086
+ break;
7087
+ default:
7088
+ parseEnumValue(enm, token3);
7089
+ }
7090
+ });
7091
+ parent.add(enm);
7092
+ }
7093
+ function parseEnumValue(parent, token2) {
7094
+ if (!nameRe.test(token2))
7095
+ throw illegal(token2, "name");
7096
+ skip("=");
7097
+ var value = parseId(next(), true), dummy = {};
7098
+ ifBlock(dummy, function parseEnumValue_block(token3) {
7099
+ if (token3 === "option") {
7100
+ parseOption(dummy, token3);
7101
+ skip(";");
7102
+ } else
7103
+ throw illegal(token3);
7104
+ }, function parseEnumValue_line() {
7105
+ parseInlineOptions(dummy);
7106
+ });
7107
+ parent.add(token2, value, dummy.comment);
7108
+ }
7109
+ function parseOption(parent, token2) {
7110
+ var isCustom = skip("(", true);
7111
+ if (!typeRefRe.test(token2 = next()))
7112
+ throw illegal(token2, "name");
7113
+ var name = token2;
7114
+ if (isCustom) {
7115
+ skip(")");
7116
+ name = "(" + name + ")";
7117
+ token2 = peek();
7118
+ if (fqTypeRefRe.test(token2)) {
7119
+ name += token2;
7120
+ next();
7121
+ }
7122
+ }
7123
+ skip("=");
7124
+ parseOptionValue(parent, name);
7125
+ }
7126
+ function parseOptionValue(parent, name) {
7127
+ if (skip("{", true)) {
7128
+ do {
7129
+ if (!nameRe.test(token = next()))
7130
+ throw illegal(token, "name");
7131
+ if (peek() === "{")
7132
+ parseOptionValue(parent, name + "." + token);
7133
+ else {
7134
+ skip(":");
7135
+ if (peek() === "{")
7136
+ parseOptionValue(parent, name + "." + token);
7137
+ else
7138
+ setOption(parent, name + "." + token, readValue());
7139
+ }
7140
+ } while (!skip("}", true));
7141
+ } else
7142
+ setOption(parent, name, readValue());
7143
+ }
7144
+ function setOption(parent, name, value) {
7145
+ if (parent.setOption)
7146
+ parent.setOption(name, value);
7147
+ }
7148
+ function parseInlineOptions(parent) {
7149
+ if (skip("[", true)) {
7150
+ do {
7151
+ parseOption(parent, "option");
7152
+ } while (skip(",", true));
7153
+ skip("]");
7154
+ }
7155
+ return parent;
7156
+ }
7157
+ function parseService(parent, token2) {
7158
+ if (!nameRe.test(token2 = next()))
7159
+ throw illegal(token2, "service name");
7160
+ var service = new Service(token2);
7161
+ ifBlock(service, function parseService_block(token3) {
7162
+ if (parseCommon(service, token3))
7163
+ return;
7164
+ if (token3 === "rpc")
7165
+ parseMethod(service, token3);
7166
+ else
7167
+ throw illegal(token3);
7168
+ });
7169
+ parent.add(service);
7170
+ }
7171
+ function parseMethod(parent, token2) {
7172
+ var type = token2;
7173
+ if (!nameRe.test(token2 = next()))
7174
+ throw illegal(token2, "name");
7175
+ var name = token2, requestType, requestStream, responseType, responseStream;
7176
+ skip("(");
7177
+ if (skip("stream", true))
7178
+ requestStream = true;
7179
+ if (!typeRefRe.test(token2 = next()))
7180
+ throw illegal(token2);
7181
+ requestType = token2;
7182
+ skip(")");
7183
+ skip("returns");
7184
+ skip("(");
7185
+ if (skip("stream", true))
7186
+ responseStream = true;
7187
+ if (!typeRefRe.test(token2 = next()))
7188
+ throw illegal(token2);
7189
+ responseType = token2;
7190
+ skip(")");
7191
+ var method = new Method(name, type, requestType, responseType, requestStream, responseStream);
7192
+ ifBlock(method, function parseMethod_block(token3) {
7193
+ if (token3 === "option") {
7194
+ parseOption(method, token3);
7195
+ skip(";");
7196
+ } else
7197
+ throw illegal(token3);
7198
+ });
7199
+ parent.add(method);
7200
+ }
7201
+ function parseExtension(parent, token2) {
7202
+ if (!typeRefRe.test(token2 = next()))
7203
+ throw illegal(token2, "reference");
7204
+ var reference = token2;
7205
+ ifBlock(null, function parseExtension_block(token3) {
7206
+ switch (token3) {
7207
+ case "required":
7208
+ case "repeated":
7209
+ case "optional":
7210
+ parseField(parent, token3, reference);
7211
+ break;
7212
+ default:
7213
+ if (!isProto3 || !typeRefRe.test(token3))
7214
+ throw illegal(token3);
7215
+ push(token3);
7216
+ parseField(parent, "optional", reference);
7217
+ break;
7218
+ }
7219
+ });
7220
+ }
7221
+ var token;
7222
+ while ((token = next()) !== null) {
7223
+ switch (token) {
7224
+ case "package":
7225
+ if (!head)
7226
+ throw illegal(token);
7227
+ parsePackage();
7228
+ break;
7229
+ case "import":
7230
+ if (!head)
7231
+ throw illegal(token);
7232
+ parseImport();
7233
+ break;
7234
+ case "syntax":
7235
+ if (!head)
7236
+ throw illegal(token);
7237
+ parseSyntax();
7238
+ break;
7239
+ case "option":
7240
+ if (!head)
7241
+ throw illegal(token);
7242
+ parseOption(ptr, token);
7243
+ skip(";");
7244
+ break;
7245
+ default:
7246
+ if (parseCommon(ptr, token)) {
7247
+ head = false;
7248
+ continue;
7249
+ }
7250
+ throw illegal(token);
7251
+ }
7252
+ }
7253
+ parse.filename = null;
7254
+ return {
7255
+ "package": pkg,
7256
+ "imports": imports,
7257
+ weakImports,
7258
+ syntax,
7259
+ root
7260
+ };
7261
+ }
7262
+ }, { "15": 15, "16": 16, "20": 20, "22": 22, "25": 25, "29": 29, "33": 33, "34": 34, "35": 35, "36": 36, "37": 37 }], 27: [function(require, module2, exports) {
7263
+ module2.exports = Reader;
7264
+ var util = require(39);
7265
+ var BufferReader;
7266
+ var LongBits = util.LongBits, utf8 = util.utf8;
7267
+ function indexOutOfRange(reader, writeLength) {
7268
+ return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
7269
+ }
7270
+ function Reader(buffer) {
7271
+ this.buf = buffer;
7272
+ this.pos = 0;
7273
+ this.len = buffer.length;
7274
+ }
7275
+ var create_array = typeof Uint8Array !== "undefined" ? function create_typed_array(buffer) {
7276
+ if (buffer instanceof Uint8Array || Array.isArray(buffer))
7277
+ return new Reader(buffer);
7278
+ throw Error("illegal buffer");
7279
+ } : function create_array2(buffer) {
7280
+ if (Array.isArray(buffer))
7281
+ return new Reader(buffer);
7282
+ throw Error("illegal buffer");
7283
+ };
7284
+ Reader.create = util.Buffer ? function create_buffer_setup(buffer) {
7285
+ return (Reader.create = function create_buffer(buffer2) {
7286
+ return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2);
7287
+ })(buffer);
7288
+ } : create_array;
7289
+ Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */
7290
+ util.Array.prototype.slice;
7291
+ Reader.prototype.uint32 = /* @__PURE__ */ function read_uint32_setup() {
7292
+ var value = 4294967295;
7293
+ return function read_uint32() {
7294
+ value = (this.buf[this.pos] & 127) >>> 0;
7295
+ if (this.buf[this.pos++] < 128) return value;
7296
+ value = (value | (this.buf[this.pos] & 127) << 7) >>> 0;
7297
+ if (this.buf[this.pos++] < 128) return value;
7298
+ value = (value | (this.buf[this.pos] & 127) << 14) >>> 0;
7299
+ if (this.buf[this.pos++] < 128) return value;
7300
+ value = (value | (this.buf[this.pos] & 127) << 21) >>> 0;
7301
+ if (this.buf[this.pos++] < 128) return value;
7302
+ value = (value | (this.buf[this.pos] & 15) << 28) >>> 0;
7303
+ if (this.buf[this.pos++] < 128) return value;
7304
+ if ((this.pos += 5) > this.len) {
7305
+ this.pos = this.len;
7306
+ throw indexOutOfRange(this, 10);
7307
+ }
7308
+ return value;
7309
+ };
7310
+ }();
7311
+ Reader.prototype.int32 = function read_int32() {
7312
+ return this.uint32() | 0;
7313
+ };
7314
+ Reader.prototype.sint32 = function read_sint32() {
7315
+ var value = this.uint32();
7316
+ return value >>> 1 ^ -(value & 1) | 0;
7317
+ };
7318
+ function readLongVarint() {
7319
+ var bits = new LongBits(0, 0);
7320
+ var i = 0;
7321
+ if (this.len - this.pos > 4) {
7322
+ for (; i < 4; ++i) {
7323
+ bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
7324
+ if (this.buf[this.pos++] < 128)
7325
+ return bits;
7326
+ }
7327
+ bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
7328
+ bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
7329
+ if (this.buf[this.pos++] < 128)
7330
+ return bits;
7331
+ i = 0;
7332
+ } else {
7333
+ for (; i < 3; ++i) {
7334
+ if (this.pos >= this.len)
7335
+ throw indexOutOfRange(this);
7336
+ bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
7337
+ if (this.buf[this.pos++] < 128)
7338
+ return bits;
7339
+ }
7340
+ bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;
7341
+ return bits;
7342
+ }
7343
+ if (this.len - this.pos > 4) {
7344
+ for (; i < 5; ++i) {
7345
+ bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
7346
+ if (this.buf[this.pos++] < 128)
7347
+ return bits;
7348
+ }
7349
+ } else {
7350
+ for (; i < 5; ++i) {
7351
+ if (this.pos >= this.len)
7352
+ throw indexOutOfRange(this);
7353
+ bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
7354
+ if (this.buf[this.pos++] < 128)
7355
+ return bits;
7356
+ }
7357
+ }
7358
+ throw Error("invalid varint encoding");
7359
+ }
7360
+ Reader.prototype.bool = function read_bool() {
7361
+ return this.uint32() !== 0;
7362
+ };
7363
+ function readFixed32_end(buf, end) {
7364
+ return (buf[end - 4] | buf[end - 3] << 8 | buf[end - 2] << 16 | buf[end - 1] << 24) >>> 0;
7365
+ }
7366
+ Reader.prototype.fixed32 = function read_fixed32() {
7367
+ if (this.pos + 4 > this.len)
7368
+ throw indexOutOfRange(this, 4);
7369
+ return readFixed32_end(this.buf, this.pos += 4);
7370
+ };
7371
+ Reader.prototype.sfixed32 = function read_sfixed32() {
7372
+ if (this.pos + 4 > this.len)
7373
+ throw indexOutOfRange(this, 4);
7374
+ return readFixed32_end(this.buf, this.pos += 4) | 0;
7375
+ };
7376
+ function readFixed64() {
7377
+ if (this.pos + 8 > this.len)
7378
+ throw indexOutOfRange(this, 8);
7379
+ return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
7380
+ }
7381
+ Reader.prototype.float = function read_float() {
7382
+ if (this.pos + 4 > this.len)
7383
+ throw indexOutOfRange(this, 4);
7384
+ var value = util.float.readFloatLE(this.buf, this.pos);
7385
+ this.pos += 4;
7386
+ return value;
7387
+ };
7388
+ Reader.prototype.double = function read_double() {
7389
+ if (this.pos + 8 > this.len)
7390
+ throw indexOutOfRange(this, 4);
7391
+ var value = util.float.readDoubleLE(this.buf, this.pos);
7392
+ this.pos += 8;
7393
+ return value;
7394
+ };
7395
+ Reader.prototype.bytes = function read_bytes() {
7396
+ var length = this.uint32(), start = this.pos, end = this.pos + length;
7397
+ if (end > this.len)
7398
+ throw indexOutOfRange(this, length);
7399
+ this.pos += length;
7400
+ if (Array.isArray(this.buf))
7401
+ return this.buf.slice(start, end);
7402
+ return start === end ? new this.buf.constructor(0) : this._slice.call(this.buf, start, end);
7403
+ };
7404
+ Reader.prototype.string = function read_string() {
7405
+ var bytes = this.bytes();
7406
+ return utf8.read(bytes, 0, bytes.length);
7407
+ };
7408
+ Reader.prototype.skip = function skip(length) {
7409
+ if (typeof length === "number") {
7410
+ if (this.pos + length > this.len)
7411
+ throw indexOutOfRange(this, length);
7412
+ this.pos += length;
7413
+ } else {
7414
+ do {
7415
+ if (this.pos >= this.len)
7416
+ throw indexOutOfRange(this);
7417
+ } while (this.buf[this.pos++] & 128);
7418
+ }
7419
+ return this;
7420
+ };
7421
+ Reader.prototype.skipType = function(wireType) {
7422
+ switch (wireType) {
7423
+ case 0:
7424
+ this.skip();
7425
+ break;
7426
+ case 1:
7427
+ this.skip(8);
7428
+ break;
7429
+ case 2:
7430
+ this.skip(this.uint32());
7431
+ break;
7432
+ case 3:
7433
+ do {
7434
+ if ((wireType = this.uint32() & 7) === 4)
7435
+ break;
7436
+ this.skipType(wireType);
7437
+ } while (true);
7438
+ break;
7439
+ case 5:
7440
+ this.skip(4);
7441
+ break;
7442
+ /* istanbul ignore next */
7443
+ default:
7444
+ throw Error("invalid wire type " + wireType + " at offset " + this.pos);
7445
+ }
7446
+ return this;
7447
+ };
7448
+ Reader._configure = function(BufferReader_) {
7449
+ BufferReader = BufferReader_;
7450
+ var fn = util.Long ? "toLong" : (
7451
+ /* istanbul ignore next */
7452
+ "toNumber"
7453
+ );
7454
+ util.merge(Reader.prototype, {
7455
+ int64: function read_int64() {
7456
+ return readLongVarint.call(this)[fn](false);
7457
+ },
7458
+ uint64: function read_uint64() {
7459
+ return readLongVarint.call(this)[fn](true);
7460
+ },
7461
+ sint64: function read_sint64() {
7462
+ return readLongVarint.call(this).zzDecode()[fn](false);
7463
+ },
7464
+ fixed64: function read_fixed64() {
7465
+ return readFixed64.call(this)[fn](true);
7466
+ },
7467
+ sfixed64: function read_sfixed64() {
7468
+ return readFixed64.call(this)[fn](false);
7469
+ }
7470
+ });
7471
+ };
7472
+ }, { "39": 39 }], 28: [function(require, module2, exports) {
7473
+ module2.exports = BufferReader;
7474
+ var Reader = require(27);
7475
+ (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
7476
+ var util = require(39);
7477
+ function BufferReader(buffer) {
7478
+ Reader.call(this, buffer);
7479
+ }
7480
+ if (util.Buffer)
7481
+ BufferReader.prototype._slice = util.Buffer.prototype.slice;
7482
+ BufferReader.prototype.string = function read_string_buffer() {
7483
+ var len = this.uint32();
7484
+ return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len));
7485
+ };
7486
+ }, { "27": 27, "39": 39 }], 29: [function(require, module2, exports) {
7487
+ module2.exports = Root;
7488
+ var Namespace = require(23);
7489
+ ((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root";
7490
+ var Field = require(16), Enum = require(15), OneOf = require(25), util = require(37);
7491
+ var Type, parse, common;
7492
+ function Root(options) {
7493
+ Namespace.call(this, "", options);
7494
+ this.deferred = [];
7495
+ this.files = [];
7496
+ }
7497
+ Root.fromJSON = function fromJSON(json, root) {
7498
+ if (!root)
7499
+ root = new Root();
7500
+ if (json.options)
7501
+ root.setOptions(json.options);
7502
+ return root.addJSON(json.nested);
7503
+ };
7504
+ Root.prototype.resolvePath = util.path.resolve;
7505
+ function SYNC() {
7506
+ }
7507
+ Root.prototype.load = function load(filename, options, callback) {
7508
+ if (typeof options === "function") {
7509
+ callback = options;
7510
+ options = undefined$1;
7511
+ }
7512
+ var self = this;
7513
+ if (!callback)
7514
+ return util.asPromise(load, self, filename, options);
7515
+ var sync = callback === SYNC;
7516
+ function finish(err, root) {
7517
+ if (!callback)
7518
+ return;
7519
+ var cb = callback;
7520
+ callback = null;
7521
+ if (sync)
7522
+ throw err;
7523
+ cb(err, root);
7524
+ }
7525
+ function process(filename2, source) {
7526
+ try {
7527
+ if (util.isString(source) && source.charAt(0) === "{")
7528
+ source = JSON.parse(source);
7529
+ if (!util.isString(source))
7530
+ self.setOptions(source.options).addJSON(source.nested);
7531
+ else {
7532
+ parse.filename = filename2;
7533
+ var parsed = parse(source, self, options), resolved2, i2 = 0;
7534
+ if (parsed.imports) {
7535
+ for (; i2 < parsed.imports.length; ++i2)
7536
+ if (resolved2 = self.resolvePath(filename2, parsed.imports[i2]))
7537
+ fetch(resolved2);
7538
+ }
7539
+ if (parsed.weakImports) {
7540
+ for (i2 = 0; i2 < parsed.weakImports.length; ++i2)
7541
+ if (resolved2 = self.resolvePath(filename2, parsed.weakImports[i2]))
7542
+ fetch(resolved2, true);
7543
+ }
7544
+ }
7545
+ } catch (err) {
7546
+ finish(err);
7547
+ }
7548
+ if (!sync && !queued)
7549
+ finish(null, self);
7550
+ }
7551
+ function fetch(filename2, weak) {
7552
+ var idx = filename2.lastIndexOf("google/protobuf/");
7553
+ if (idx > -1) {
7554
+ var altname = filename2.substring(idx);
7555
+ if (altname in common)
7556
+ filename2 = altname;
7557
+ }
7558
+ if (self.files.indexOf(filename2) > -1)
7559
+ return;
7560
+ self.files.push(filename2);
7561
+ if (filename2 in common) {
7562
+ if (sync)
7563
+ process(filename2, common[filename2]);
7564
+ else {
7565
+ ++queued;
7566
+ setTimeout(function() {
7567
+ --queued;
7568
+ process(filename2, common[filename2]);
7569
+ });
7570
+ }
7571
+ return;
7572
+ }
7573
+ if (sync) {
7574
+ var source;
7575
+ try {
7576
+ source = util.fs.readFileSync(filename2).toString("utf8");
7577
+ } catch (err) {
7578
+ if (!weak)
7579
+ finish(err);
7580
+ return;
7581
+ }
7582
+ process(filename2, source);
7583
+ } else {
7584
+ ++queued;
7585
+ util.fetch(filename2, function(err, source2) {
7586
+ --queued;
7587
+ if (!callback)
7588
+ return;
7589
+ if (err) {
7590
+ if (!weak)
7591
+ finish(err);
7592
+ else if (!queued)
7593
+ finish(null, self);
7594
+ return;
7595
+ }
7596
+ process(filename2, source2);
7597
+ });
7598
+ }
7599
+ }
7600
+ var queued = 0;
7601
+ if (util.isString(filename))
7602
+ filename = [filename];
7603
+ for (var i = 0, resolved; i < filename.length; ++i)
7604
+ if (resolved = self.resolvePath("", filename[i]))
7605
+ fetch(resolved);
7606
+ if (sync)
7607
+ return self;
7608
+ if (!queued)
7609
+ finish(null, self);
7610
+ return undefined$1;
7611
+ };
7612
+ Root.prototype.loadSync = function loadSync(filename, options) {
7613
+ if (!util.isNode)
7614
+ throw Error("not supported");
7615
+ return this.load(filename, options, SYNC);
7616
+ };
7617
+ Root.prototype.resolveAll = function resolveAll() {
7618
+ if (this.deferred.length)
7619
+ throw Error("unresolvable extensions: " + this.deferred.map(function(field) {
7620
+ return "'extend " + field.extend + "' in " + field.parent.fullName;
7621
+ }).join(", "));
7622
+ return Namespace.prototype.resolveAll.call(this);
7623
+ };
7624
+ var exposeRe = /^[A-Z]/;
7625
+ function tryHandleExtension(root, field) {
7626
+ var extendedType = field.parent.lookup(field.extend);
7627
+ if (extendedType) {
7628
+ var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined$1, field.options);
7629
+ sisterField.declaringField = field;
7630
+ field.extensionField = sisterField;
7631
+ extendedType.add(sisterField);
7632
+ return true;
7633
+ }
7634
+ return false;
7635
+ }
7636
+ Root.prototype._handleAdd = function _handleAdd(object) {
7637
+ if (object instanceof Field) {
7638
+ if (
7639
+ /* an extension field (implies not part of a oneof) */
7640
+ object.extend !== undefined$1 && /* not already handled */
7641
+ !object.extensionField
7642
+ ) {
7643
+ if (!tryHandleExtension(this, object))
7644
+ this.deferred.push(object);
7645
+ }
7646
+ } else if (object instanceof Enum) {
7647
+ if (exposeRe.test(object.name))
7648
+ object.parent[object.name] = object.values;
7649
+ } else if (!(object instanceof OneOf)) {
7650
+ if (object instanceof Type)
7651
+ for (var i = 0; i < this.deferred.length; )
7652
+ if (tryHandleExtension(this, this.deferred[i]))
7653
+ this.deferred.splice(i, 1);
7654
+ else
7655
+ ++i;
7656
+ for (var j = 0; j < /* initializes */
7657
+ object.nestedArray.length; ++j)
7658
+ this._handleAdd(object._nestedArray[j]);
7659
+ if (exposeRe.test(object.name))
7660
+ object.parent[object.name] = object;
7661
+ }
7662
+ };
7663
+ Root.prototype._handleRemove = function _handleRemove(object) {
7664
+ if (object instanceof Field) {
7665
+ if (
7666
+ /* an extension field */
7667
+ object.extend !== undefined$1
7668
+ ) {
7669
+ if (
7670
+ /* already handled */
7671
+ object.extensionField
7672
+ ) {
7673
+ object.extensionField.parent.remove(object.extensionField);
7674
+ object.extensionField = null;
7675
+ } else {
7676
+ var index = this.deferred.indexOf(object);
7677
+ if (index > -1)
7678
+ this.deferred.splice(index, 1);
7679
+ }
7680
+ }
7681
+ } else if (object instanceof Enum) {
7682
+ if (exposeRe.test(object.name))
7683
+ delete object.parent[object.name];
7684
+ } else if (object instanceof Namespace) {
7685
+ for (var i = 0; i < /* initializes */
7686
+ object.nestedArray.length; ++i)
7687
+ this._handleRemove(object._nestedArray[i]);
7688
+ if (exposeRe.test(object.name))
7689
+ delete object.parent[object.name];
7690
+ }
7691
+ };
7692
+ Root._configure = function(Type_, parse_, common_) {
7693
+ Type = Type_;
7694
+ parse = parse_;
7695
+ common = common_;
7696
+ };
7697
+ }, { "15": 15, "16": 16, "23": 23, "25": 25, "37": 37 }], 30: [function(require, module2, exports) {
7698
+ module2.exports = {};
7699
+ }, {}], 31: [function(require, module2, exports) {
7700
+ var rpc = exports;
7701
+ rpc.Service = require(32);
7702
+ }, { "32": 32 }], 32: [function(require, module2, exports) {
7703
+ module2.exports = Service;
7704
+ var util = require(39);
7705
+ (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
7706
+ function Service(rpcImpl, requestDelimited, responseDelimited) {
7707
+ if (typeof rpcImpl !== "function")
7708
+ throw TypeError("rpcImpl must be a function");
7709
+ util.EventEmitter.call(this);
7710
+ this.rpcImpl = rpcImpl;
7711
+ this.requestDelimited = Boolean(requestDelimited);
7712
+ this.responseDelimited = Boolean(responseDelimited);
7713
+ }
7714
+ Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {
7715
+ if (!request)
7716
+ throw TypeError("request must be specified");
7717
+ var self = this;
7718
+ if (!callback)
7719
+ return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);
7720
+ if (!self.rpcImpl) {
7721
+ setTimeout(function() {
7722
+ callback(Error("already ended"));
7723
+ }, 0);
7724
+ return undefined$1;
7725
+ }
7726
+ try {
7727
+ return self.rpcImpl(
7728
+ method,
7729
+ requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),
7730
+ function rpcCallback(err, response) {
7731
+ if (err) {
7732
+ self.emit("error", err, method);
7733
+ return callback(err);
7734
+ }
7735
+ if (response === null) {
7736
+ self.end(
7737
+ /* endedByRPC */
7738
+ true
7739
+ );
7740
+ return undefined$1;
7741
+ }
7742
+ if (!(response instanceof responseCtor)) {
7743
+ try {
7744
+ response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response);
7745
+ } catch (err2) {
7746
+ self.emit("error", err2, method);
7747
+ return callback(err2);
7748
+ }
7749
+ }
7750
+ self.emit("data", response, method);
7751
+ return callback(null, response);
7752
+ }
7753
+ );
7754
+ } catch (err) {
7755
+ self.emit("error", err, method);
7756
+ setTimeout(function() {
7757
+ callback(err);
7758
+ }, 0);
7759
+ return undefined$1;
7760
+ }
7761
+ };
7762
+ Service.prototype.end = function end(endedByRPC) {
7763
+ if (this.rpcImpl) {
7764
+ if (!endedByRPC)
7765
+ this.rpcImpl(null, null, null);
7766
+ this.rpcImpl = null;
7767
+ this.emit("end").off();
7768
+ }
7769
+ return this;
7770
+ };
7771
+ }, { "39": 39 }], 33: [function(require, module2, exports) {
7772
+ module2.exports = Service;
7773
+ var Namespace = require(23);
7774
+ ((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service";
7775
+ var Method = require(22), util = require(37), rpc = require(31);
7776
+ function Service(name, options) {
7777
+ Namespace.call(this, name, options);
7778
+ this.methods = {};
7779
+ this._methodsArray = null;
7780
+ }
7781
+ Service.fromJSON = function fromJSON(name, json) {
7782
+ var service = new Service(name, json.options);
7783
+ if (json.methods)
7784
+ for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i)
7785
+ service.add(Method.fromJSON(names[i], json.methods[names[i]]));
7786
+ if (json.nested)
7787
+ service.addJSON(json.nested);
7788
+ service.comment = json.comment;
7789
+ return service;
7790
+ };
7791
+ Service.prototype.toJSON = function toJSON(toJSONOptions) {
7792
+ var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);
7793
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
7794
+ return util.toObject([
7795
+ "options",
7796
+ inherited && inherited.options || undefined$1,
7797
+ "methods",
7798
+ Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */
7799
+ {},
7800
+ "nested",
7801
+ inherited && inherited.nested || undefined$1,
7802
+ "comment",
7803
+ keepComments ? this.comment : undefined$1
7804
+ ]);
7805
+ };
7806
+ Object.defineProperty(Service.prototype, "methodsArray", {
7807
+ get: function() {
7808
+ return this._methodsArray || (this._methodsArray = util.toArray(this.methods));
7809
+ }
7810
+ });
7811
+ function clearCache(service) {
7812
+ service._methodsArray = null;
7813
+ return service;
7814
+ }
7815
+ Service.prototype.get = function get(name) {
7816
+ return this.methods[name] || Namespace.prototype.get.call(this, name);
7817
+ };
7818
+ Service.prototype.resolveAll = function resolveAll() {
7819
+ var methods = this.methodsArray;
7820
+ for (var i = 0; i < methods.length; ++i)
7821
+ methods[i].resolve();
7822
+ return Namespace.prototype.resolve.call(this);
7823
+ };
7824
+ Service.prototype.add = function add(object) {
7825
+ if (this.get(object.name))
7826
+ throw Error("duplicate name '" + object.name + "' in " + this);
7827
+ if (object instanceof Method) {
7828
+ this.methods[object.name] = object;
7829
+ object.parent = this;
7830
+ return clearCache(this);
7831
+ }
7832
+ return Namespace.prototype.add.call(this, object);
7833
+ };
7834
+ Service.prototype.remove = function remove(object) {
7835
+ if (object instanceof Method) {
7836
+ if (this.methods[object.name] !== object)
7837
+ throw Error(object + " is not a member of " + this);
7838
+ delete this.methods[object.name];
7839
+ object.parent = null;
7840
+ return clearCache(this);
7841
+ }
7842
+ return Namespace.prototype.remove.call(this, object);
7843
+ };
7844
+ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {
7845
+ var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
7846
+ for (var i = 0, method; i < /* initializes */
7847
+ this.methodsArray.length; ++i) {
7848
+ var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
7849
+ rpcService[methodName] = util.codegen(["r", "c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
7850
+ m: method,
7851
+ q: method.resolvedRequestType.ctor,
7852
+ s: method.resolvedResponseType.ctor
7853
+ });
7854
+ }
7855
+ return rpcService;
7856
+ };
7857
+ }, { "22": 22, "23": 23, "31": 31, "37": 37 }], 34: [function(require, module2, exports) {
7858
+ module2.exports = tokenize;
7859
+ var delimRe = /[\s{}=;:[\],'"()<>]/g, stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g;
7860
+ var setCommentRe = /^ *[*/]+ */, setCommentAltRe = /^\s*\*?\/*/, setCommentSplitRe = /\n/g, whitespaceRe = /\s/, unescapeRe = /\\(.?)/g;
7861
+ var unescapeMap = {
7862
+ "0": "\0",
7863
+ "r": "\r",
7864
+ "n": "\n",
7865
+ "t": " "
7866
+ };
7867
+ function unescape(str) {
7868
+ return str.replace(unescapeRe, function($0, $1) {
7869
+ switch ($1) {
7870
+ case "\\":
7871
+ case "":
7872
+ return $1;
7873
+ default:
7874
+ return unescapeMap[$1] || "";
7875
+ }
7876
+ });
7877
+ }
7878
+ tokenize.unescape = unescape;
7879
+ function tokenize(source, alternateCommentMode) {
7880
+ source = source.toString();
7881
+ var offset = 0, length = source.length, line = 1, commentType = null, commentText = null, commentLine = 0, commentLineEmpty = false;
7882
+ var stack = [];
7883
+ var stringDelim = null;
7884
+ function illegal(subject) {
7885
+ return Error("illegal " + subject + " (line " + line + ")");
7886
+ }
7887
+ function readString() {
7888
+ var re = stringDelim === "'" ? stringSingleRe : stringDoubleRe;
7889
+ re.lastIndex = offset - 1;
7890
+ var match = re.exec(source);
7891
+ if (!match)
7892
+ throw illegal("string");
7893
+ offset = re.lastIndex;
7894
+ push(stringDelim);
7895
+ stringDelim = null;
7896
+ return unescape(match[1]);
7897
+ }
7898
+ function charAt(pos) {
7899
+ return source.charAt(pos);
7900
+ }
7901
+ function setComment(start, end) {
7902
+ commentType = source.charAt(start++);
7903
+ commentLine = line;
7904
+ commentLineEmpty = false;
7905
+ var lookback;
7906
+ if (alternateCommentMode) {
7907
+ lookback = 2;
7908
+ } else {
7909
+ lookback = 3;
7910
+ }
7911
+ var commentOffset = start - lookback, c;
7912
+ do {
7913
+ if (--commentOffset < 0 || (c = source.charAt(commentOffset)) === "\n") {
7914
+ commentLineEmpty = true;
7915
+ break;
7916
+ }
7917
+ } while (c === " " || c === " ");
7918
+ var lines = source.substring(start, end).split(setCommentSplitRe);
7919
+ for (var i = 0; i < lines.length; ++i)
7920
+ lines[i] = lines[i].replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "").trim();
7921
+ commentText = lines.join("\n").trim();
7922
+ }
7923
+ function isDoubleSlashCommentLine(startOffset) {
7924
+ var endOffset = findEndOfLine(startOffset);
7925
+ var lineText = source.substring(startOffset, endOffset);
7926
+ var isComment = /^\s*\/{1,2}/.test(lineText);
7927
+ return isComment;
7928
+ }
7929
+ function findEndOfLine(cursor) {
7930
+ var endOffset = cursor;
7931
+ while (endOffset < length && charAt(endOffset) !== "\n") {
7932
+ endOffset++;
7933
+ }
7934
+ return endOffset;
7935
+ }
7936
+ function next() {
7937
+ if (stack.length > 0)
7938
+ return stack.shift();
7939
+ if (stringDelim)
7940
+ return readString();
7941
+ var repeat, prev, curr, start, isDoc;
7942
+ do {
7943
+ if (offset === length)
7944
+ return null;
7945
+ repeat = false;
7946
+ while (whitespaceRe.test(curr = charAt(offset))) {
7947
+ if (curr === "\n")
7948
+ ++line;
7949
+ if (++offset === length)
7950
+ return null;
7951
+ }
7952
+ if (charAt(offset) === "/") {
7953
+ if (++offset === length) {
7954
+ throw illegal("comment");
7955
+ }
7956
+ if (charAt(offset) === "/") {
7957
+ if (!alternateCommentMode) {
7958
+ isDoc = charAt(start = offset + 1) === "/";
7959
+ while (charAt(++offset) !== "\n") {
7960
+ if (offset === length) {
7961
+ return null;
7962
+ }
7963
+ }
7964
+ ++offset;
7965
+ if (isDoc) {
7966
+ setComment(start, offset - 1);
7967
+ }
7968
+ ++line;
7969
+ repeat = true;
7970
+ } else {
7971
+ start = offset;
7972
+ isDoc = false;
7973
+ if (isDoubleSlashCommentLine(offset)) {
7974
+ isDoc = true;
7975
+ do {
7976
+ offset = findEndOfLine(offset);
7977
+ if (offset === length) {
7978
+ break;
7979
+ }
7980
+ offset++;
7981
+ } while (isDoubleSlashCommentLine(offset));
7982
+ } else {
7983
+ offset = Math.min(length, findEndOfLine(offset) + 1);
7984
+ }
7985
+ if (isDoc) {
7986
+ setComment(start, offset);
7987
+ }
7988
+ line++;
7989
+ repeat = true;
7990
+ }
7991
+ } else if ((curr = charAt(offset)) === "*") {
7992
+ start = offset + 1;
7993
+ isDoc = alternateCommentMode || charAt(start) === "*";
7994
+ do {
7995
+ if (curr === "\n") {
7996
+ ++line;
7997
+ }
7998
+ if (++offset === length) {
7999
+ throw illegal("comment");
8000
+ }
8001
+ prev = curr;
8002
+ curr = charAt(offset);
8003
+ } while (prev !== "*" || curr !== "/");
8004
+ ++offset;
8005
+ if (isDoc) {
8006
+ setComment(start, offset - 2);
8007
+ }
8008
+ repeat = true;
8009
+ } else {
8010
+ return "/";
8011
+ }
8012
+ }
8013
+ } while (repeat);
8014
+ var end = offset;
8015
+ delimRe.lastIndex = 0;
8016
+ var delim = delimRe.test(charAt(end++));
8017
+ if (!delim)
8018
+ while (end < length && !delimRe.test(charAt(end)))
8019
+ ++end;
8020
+ var token = source.substring(offset, offset = end);
8021
+ if (token === '"' || token === "'")
8022
+ stringDelim = token;
8023
+ return token;
8024
+ }
8025
+ function push(token) {
8026
+ stack.push(token);
8027
+ }
8028
+ function peek() {
8029
+ if (!stack.length) {
8030
+ var token = next();
8031
+ if (token === null)
8032
+ return null;
8033
+ push(token);
8034
+ }
8035
+ return stack[0];
8036
+ }
8037
+ function skip(expected, optional) {
8038
+ var actual = peek(), equals = actual === expected;
8039
+ if (equals) {
8040
+ next();
8041
+ return true;
8042
+ }
8043
+ if (!optional)
8044
+ throw illegal("token '" + actual + "', '" + expected + "' expected");
8045
+ return false;
8046
+ }
8047
+ function cmnt(trailingLine) {
8048
+ var ret = null;
8049
+ if (trailingLine === undefined$1) {
8050
+ if (commentLine === line - 1 && (alternateCommentMode || commentType === "*" || commentLineEmpty)) {
8051
+ ret = commentText;
8052
+ }
8053
+ } else {
8054
+ if (commentLine < trailingLine) {
8055
+ peek();
8056
+ }
8057
+ if (commentLine === trailingLine && !commentLineEmpty && (alternateCommentMode || commentType === "/")) {
8058
+ ret = commentText;
8059
+ }
8060
+ }
8061
+ return ret;
8062
+ }
8063
+ return Object.defineProperty({
8064
+ next,
8065
+ peek,
8066
+ push,
8067
+ skip,
8068
+ cmnt
8069
+ }, "line", {
8070
+ get: function() {
8071
+ return line;
8072
+ }
8073
+ });
8074
+ }
8075
+ }, {}], 35: [function(require, module2, exports) {
8076
+ module2.exports = Type;
8077
+ var Namespace = require(23);
8078
+ ((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type";
8079
+ var Enum = require(15), OneOf = require(25), Field = require(16), MapField = require(20), Service = require(33), Message = require(21), Reader = require(27), Writer = require(42), util = require(37), encoder = require(14), decoder = require(13), verifier = require(40), converter = require(12), wrappers = require(41);
8080
+ function Type(name, options) {
8081
+ Namespace.call(this, name, options);
8082
+ this.fields = {};
8083
+ this.oneofs = undefined$1;
8084
+ this.extensions = undefined$1;
8085
+ this.reserved = undefined$1;
8086
+ this.group = undefined$1;
8087
+ this._fieldsById = null;
8088
+ this._fieldsArray = null;
8089
+ this._oneofsArray = null;
8090
+ this._ctor = null;
8091
+ }
8092
+ Object.defineProperties(Type.prototype, {
8093
+ /**
8094
+ * Message fields by id.
8095
+ * @name Type#fieldsById
8096
+ * @type {Object.<number,Field>}
8097
+ * @readonly
8098
+ */
8099
+ fieldsById: {
8100
+ get: function() {
8101
+ if (this._fieldsById)
8102
+ return this._fieldsById;
8103
+ this._fieldsById = {};
8104
+ for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) {
8105
+ var field = this.fields[names[i]], id = field.id;
8106
+ if (this._fieldsById[id])
8107
+ throw Error("duplicate id " + id + " in " + this);
8108
+ this._fieldsById[id] = field;
8109
+ }
8110
+ return this._fieldsById;
8111
+ }
8112
+ },
8113
+ /**
8114
+ * Fields of this message as an array for iteration.
8115
+ * @name Type#fieldsArray
8116
+ * @type {Field[]}
8117
+ * @readonly
8118
+ */
8119
+ fieldsArray: {
8120
+ get: function() {
8121
+ return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields));
8122
+ }
8123
+ },
8124
+ /**
8125
+ * Oneofs of this message as an array for iteration.
8126
+ * @name Type#oneofsArray
8127
+ * @type {OneOf[]}
8128
+ * @readonly
8129
+ */
8130
+ oneofsArray: {
8131
+ get: function() {
8132
+ return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs));
8133
+ }
8134
+ },
8135
+ /**
8136
+ * The registered constructor, if any registered, otherwise a generic constructor.
8137
+ * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.
8138
+ * @name Type#ctor
8139
+ * @type {Constructor<{}>}
8140
+ */
8141
+ ctor: {
8142
+ get: function() {
8143
+ return this._ctor || (this.ctor = Type.generateConstructor(this)());
8144
+ },
8145
+ set: function(ctor) {
8146
+ var prototype = ctor.prototype;
8147
+ if (!(prototype instanceof Message)) {
8148
+ (ctor.prototype = new Message()).constructor = ctor;
8149
+ util.merge(ctor.prototype, prototype);
8150
+ }
8151
+ ctor.$type = ctor.prototype.$type = this;
8152
+ util.merge(ctor, Message, true);
8153
+ this._ctor = ctor;
8154
+ var i = 0;
8155
+ for (; i < /* initializes */
8156
+ this.fieldsArray.length; ++i)
8157
+ this._fieldsArray[i].resolve();
8158
+ var ctorProperties = {};
8159
+ for (i = 0; i < /* initializes */
8160
+ this.oneofsArray.length; ++i)
8161
+ ctorProperties[this._oneofsArray[i].resolve().name] = {
8162
+ get: util.oneOfGetter(this._oneofsArray[i].oneof),
8163
+ set: util.oneOfSetter(this._oneofsArray[i].oneof)
8164
+ };
8165
+ if (i)
8166
+ Object.defineProperties(ctor.prototype, ctorProperties);
8167
+ }
8168
+ }
8169
+ });
8170
+ Type.generateConstructor = function generateConstructor(mtype) {
8171
+ var gen = util.codegen(["p"], mtype.name);
8172
+ for (var i = 0, field; i < mtype.fieldsArray.length; ++i)
8173
+ if ((field = mtype._fieldsArray[i]).map) gen("this%s={}", util.safeProp(field.name));
8174
+ else if (field.repeated) gen("this%s=[]", util.safeProp(field.name));
8175
+ return gen("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]");
8176
+ };
8177
+ function clearCache(type) {
8178
+ type._fieldsById = type._fieldsArray = type._oneofsArray = null;
8179
+ delete type.encode;
8180
+ delete type.decode;
8181
+ delete type.verify;
8182
+ return type;
8183
+ }
8184
+ Type.fromJSON = function fromJSON(name, json) {
8185
+ var type = new Type(name, json.options);
8186
+ type.extensions = json.extensions;
8187
+ type.reserved = json.reserved;
8188
+ var names = Object.keys(json.fields), i = 0;
8189
+ for (; i < names.length; ++i)
8190
+ type.add(
8191
+ (typeof json.fields[names[i]].keyType !== "undefined" ? MapField.fromJSON : Field.fromJSON)(names[i], json.fields[names[i]])
8192
+ );
8193
+ if (json.oneofs)
8194
+ for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i)
8195
+ type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]]));
8196
+ if (json.nested)
8197
+ for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {
8198
+ var nested = json.nested[names[i]];
8199
+ type.add(
8200
+ // most to least likely
8201
+ (nested.id !== undefined$1 ? Field.fromJSON : nested.fields !== undefined$1 ? Type.fromJSON : nested.values !== undefined$1 ? Enum.fromJSON : nested.methods !== undefined$1 ? Service.fromJSON : Namespace.fromJSON)(names[i], nested)
8202
+ );
8203
+ }
8204
+ if (json.extensions && json.extensions.length)
8205
+ type.extensions = json.extensions;
8206
+ if (json.reserved && json.reserved.length)
8207
+ type.reserved = json.reserved;
8208
+ if (json.group)
8209
+ type.group = true;
8210
+ if (json.comment)
8211
+ type.comment = json.comment;
8212
+ return type;
8213
+ };
8214
+ Type.prototype.toJSON = function toJSON(toJSONOptions) {
8215
+ var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);
8216
+ var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
8217
+ return util.toObject([
8218
+ "options",
8219
+ inherited && inherited.options || undefined$1,
8220
+ "oneofs",
8221
+ Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),
8222
+ "fields",
8223
+ Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) {
8224
+ return !obj.declaringField;
8225
+ }), toJSONOptions) || {},
8226
+ "extensions",
8227
+ this.extensions && this.extensions.length ? this.extensions : undefined$1,
8228
+ "reserved",
8229
+ this.reserved && this.reserved.length ? this.reserved : undefined$1,
8230
+ "group",
8231
+ this.group || undefined$1,
8232
+ "nested",
8233
+ inherited && inherited.nested || undefined$1,
8234
+ "comment",
8235
+ keepComments ? this.comment : undefined$1
8236
+ ]);
8237
+ };
8238
+ Type.prototype.resolveAll = function resolveAll() {
8239
+ var fields = this.fieldsArray, i = 0;
8240
+ while (i < fields.length)
8241
+ fields[i++].resolve();
8242
+ var oneofs = this.oneofsArray;
8243
+ i = 0;
8244
+ while (i < oneofs.length)
8245
+ oneofs[i++].resolve();
8246
+ return Namespace.prototype.resolveAll.call(this);
8247
+ };
8248
+ Type.prototype.get = function get(name) {
8249
+ return this.fields[name] || this.oneofs && this.oneofs[name] || this.nested && this.nested[name] || null;
8250
+ };
8251
+ Type.prototype.add = function add(object) {
8252
+ if (this.get(object.name))
8253
+ throw Error("duplicate name '" + object.name + "' in " + this);
8254
+ if (object instanceof Field && object.extend === undefined$1) {
8255
+ if (this._fieldsById ? (
8256
+ /* istanbul ignore next */
8257
+ this._fieldsById[object.id]
8258
+ ) : this.fieldsById[object.id])
8259
+ throw Error("duplicate id " + object.id + " in " + this);
8260
+ if (this.isReservedId(object.id))
8261
+ throw Error("id " + object.id + " is reserved in " + this);
8262
+ if (this.isReservedName(object.name))
8263
+ throw Error("name '" + object.name + "' is reserved in " + this);
8264
+ if (object.parent)
8265
+ object.parent.remove(object);
8266
+ this.fields[object.name] = object;
8267
+ object.message = this;
8268
+ object.onAdd(this);
8269
+ return clearCache(this);
8270
+ }
8271
+ if (object instanceof OneOf) {
8272
+ if (!this.oneofs)
8273
+ this.oneofs = {};
8274
+ this.oneofs[object.name] = object;
8275
+ object.onAdd(this);
8276
+ return clearCache(this);
8277
+ }
8278
+ return Namespace.prototype.add.call(this, object);
8279
+ };
8280
+ Type.prototype.remove = function remove(object) {
8281
+ if (object instanceof Field && object.extend === undefined$1) {
8282
+ if (!this.fields || this.fields[object.name] !== object)
8283
+ throw Error(object + " is not a member of " + this);
8284
+ delete this.fields[object.name];
8285
+ object.parent = null;
8286
+ object.onRemove(this);
8287
+ return clearCache(this);
8288
+ }
8289
+ if (object instanceof OneOf) {
8290
+ if (!this.oneofs || this.oneofs[object.name] !== object)
8291
+ throw Error(object + " is not a member of " + this);
8292
+ delete this.oneofs[object.name];
8293
+ object.parent = null;
8294
+ object.onRemove(this);
8295
+ return clearCache(this);
8296
+ }
8297
+ return Namespace.prototype.remove.call(this, object);
8298
+ };
8299
+ Type.prototype.isReservedId = function isReservedId(id) {
8300
+ return Namespace.isReservedId(this.reserved, id);
8301
+ };
8302
+ Type.prototype.isReservedName = function isReservedName(name) {
8303
+ return Namespace.isReservedName(this.reserved, name);
8304
+ };
8305
+ Type.prototype.create = function create(properties) {
8306
+ return new this.ctor(properties);
8307
+ };
8308
+ Type.prototype.setup = function setup() {
8309
+ var fullName = this.fullName, types = [];
8310
+ for (var i = 0; i < /* initializes */
8311
+ this.fieldsArray.length; ++i)
8312
+ types.push(this._fieldsArray[i].resolve().resolvedType);
8313
+ this.encode = encoder(this)({
8314
+ Writer,
8315
+ types,
8316
+ util
8317
+ });
8318
+ this.decode = decoder(this)({
8319
+ Reader,
8320
+ types,
8321
+ util
8322
+ });
8323
+ this.verify = verifier(this)({
8324
+ types,
8325
+ util
8326
+ });
8327
+ this.fromObject = converter.fromObject(this)({
8328
+ types,
8329
+ util
8330
+ });
8331
+ this.toObject = converter.toObject(this)({
8332
+ types,
8333
+ util
8334
+ });
8335
+ var wrapper = wrappers[fullName];
8336
+ if (wrapper) {
8337
+ var originalThis = Object.create(this);
8338
+ originalThis.fromObject = this.fromObject;
8339
+ this.fromObject = wrapper.fromObject.bind(originalThis);
8340
+ originalThis.toObject = this.toObject;
8341
+ this.toObject = wrapper.toObject.bind(originalThis);
8342
+ }
8343
+ return this;
8344
+ };
8345
+ Type.prototype.encode = function encode_setup(message, writer) {
8346
+ return this.setup().encode(message, writer);
8347
+ };
8348
+ Type.prototype.encodeDelimited = function encodeDelimited(message, writer) {
8349
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
8350
+ };
8351
+ Type.prototype.decode = function decode_setup(reader, length) {
8352
+ return this.setup().decode(reader, length);
8353
+ };
8354
+ Type.prototype.decodeDelimited = function decodeDelimited(reader) {
8355
+ if (!(reader instanceof Reader))
8356
+ reader = Reader.create(reader);
8357
+ return this.decode(reader, reader.uint32());
8358
+ };
8359
+ Type.prototype.verify = function verify_setup(message) {
8360
+ return this.setup().verify(message);
8361
+ };
8362
+ Type.prototype.fromObject = function fromObject(object) {
8363
+ return this.setup().fromObject(object);
8364
+ };
8365
+ Type.prototype.toObject = function toObject(message, options) {
8366
+ return this.setup().toObject(message, options);
8367
+ };
8368
+ Type.d = function decorateType(typeName) {
8369
+ return function typeDecorator(target) {
8370
+ util.decorateType(target, typeName);
8371
+ };
8372
+ };
8373
+ }, { "12": 12, "13": 13, "14": 14, "15": 15, "16": 16, "20": 20, "21": 21, "23": 23, "25": 25, "27": 27, "33": 33, "37": 37, "40": 40, "41": 41, "42": 42 }], 36: [function(require, module2, exports) {
8374
+ var types = exports;
8375
+ var util = require(37);
8376
+ var s = [
8377
+ "double",
8378
+ // 0
8379
+ "float",
8380
+ // 1
8381
+ "int32",
8382
+ // 2
8383
+ "uint32",
8384
+ // 3
8385
+ "sint32",
8386
+ // 4
8387
+ "fixed32",
8388
+ // 5
8389
+ "sfixed32",
8390
+ // 6
8391
+ "int64",
8392
+ // 7
8393
+ "uint64",
8394
+ // 8
8395
+ "sint64",
8396
+ // 9
8397
+ "fixed64",
8398
+ // 10
8399
+ "sfixed64",
8400
+ // 11
8401
+ "bool",
8402
+ // 12
8403
+ "string",
8404
+ // 13
8405
+ "bytes"
8406
+ // 14
8407
+ ];
8408
+ function bake(values, offset) {
8409
+ var i = 0, o = {};
8410
+ offset |= 0;
8411
+ while (i < values.length) o[s[i + offset]] = values[i++];
8412
+ return o;
8413
+ }
8414
+ types.basic = bake([
8415
+ /* double */
8416
+ 1,
8417
+ /* float */
8418
+ 5,
8419
+ /* int32 */
8420
+ 0,
8421
+ /* uint32 */
8422
+ 0,
8423
+ /* sint32 */
8424
+ 0,
8425
+ /* fixed32 */
8426
+ 5,
8427
+ /* sfixed32 */
8428
+ 5,
8429
+ /* int64 */
8430
+ 0,
8431
+ /* uint64 */
8432
+ 0,
8433
+ /* sint64 */
8434
+ 0,
8435
+ /* fixed64 */
8436
+ 1,
8437
+ /* sfixed64 */
8438
+ 1,
8439
+ /* bool */
8440
+ 0,
8441
+ /* string */
8442
+ 2,
8443
+ /* bytes */
8444
+ 2
8445
+ ]);
8446
+ types.defaults = bake([
8447
+ /* double */
8448
+ 0,
8449
+ /* float */
8450
+ 0,
8451
+ /* int32 */
8452
+ 0,
8453
+ /* uint32 */
8454
+ 0,
8455
+ /* sint32 */
8456
+ 0,
8457
+ /* fixed32 */
8458
+ 0,
8459
+ /* sfixed32 */
8460
+ 0,
8461
+ /* int64 */
8462
+ 0,
8463
+ /* uint64 */
8464
+ 0,
8465
+ /* sint64 */
8466
+ 0,
8467
+ /* fixed64 */
8468
+ 0,
8469
+ /* sfixed64 */
8470
+ 0,
8471
+ /* bool */
8472
+ false,
8473
+ /* string */
8474
+ "",
8475
+ /* bytes */
8476
+ util.emptyArray,
8477
+ /* message */
8478
+ null
8479
+ ]);
8480
+ types.long = bake([
8481
+ /* int64 */
8482
+ 0,
8483
+ /* uint64 */
8484
+ 0,
8485
+ /* sint64 */
8486
+ 0,
8487
+ /* fixed64 */
8488
+ 1,
8489
+ /* sfixed64 */
8490
+ 1
8491
+ ], 7);
8492
+ types.mapKey = bake([
8493
+ /* int32 */
8494
+ 0,
8495
+ /* uint32 */
8496
+ 0,
8497
+ /* sint32 */
8498
+ 0,
8499
+ /* fixed32 */
8500
+ 5,
8501
+ /* sfixed32 */
8502
+ 5,
8503
+ /* int64 */
8504
+ 0,
8505
+ /* uint64 */
8506
+ 0,
8507
+ /* sint64 */
8508
+ 0,
8509
+ /* fixed64 */
8510
+ 1,
8511
+ /* sfixed64 */
8512
+ 1,
8513
+ /* bool */
8514
+ 0,
8515
+ /* string */
8516
+ 2
8517
+ ], 2);
8518
+ types.packed = bake([
8519
+ /* double */
8520
+ 1,
8521
+ /* float */
8522
+ 5,
8523
+ /* int32 */
8524
+ 0,
8525
+ /* uint32 */
8526
+ 0,
8527
+ /* sint32 */
8528
+ 0,
8529
+ /* fixed32 */
8530
+ 5,
8531
+ /* sfixed32 */
8532
+ 5,
8533
+ /* int64 */
8534
+ 0,
8535
+ /* uint64 */
8536
+ 0,
8537
+ /* sint64 */
8538
+ 0,
8539
+ /* fixed64 */
8540
+ 1,
8541
+ /* sfixed64 */
8542
+ 1,
8543
+ /* bool */
8544
+ 0
8545
+ ]);
8546
+ }, { "37": 37 }], 37: [function(require, module2, exports) {
8547
+ var util = module2.exports = require(39);
8548
+ var roots = require(30);
8549
+ var Type, Enum;
8550
+ util.codegen = require(3);
8551
+ util.fetch = require(5);
8552
+ util.path = require(8);
8553
+ util.fs = util.inquire("fs");
8554
+ util.toArray = function toArray(object) {
8555
+ if (object) {
8556
+ var keys = Object.keys(object), array = new Array(keys.length), index = 0;
8557
+ while (index < keys.length)
8558
+ array[index] = object[keys[index++]];
8559
+ return array;
8560
+ }
8561
+ return [];
8562
+ };
8563
+ util.toObject = function toObject(array) {
8564
+ var object = {}, index = 0;
8565
+ while (index < array.length) {
8566
+ var key = array[index++], val = array[index++];
8567
+ if (val !== undefined$1)
8568
+ object[key] = val;
8569
+ }
8570
+ return object;
8571
+ };
8572
+ var safePropBackslashRe = /\\/g, safePropQuoteRe = /"/g;
8573
+ util.isReserved = function isReserved(name) {
8574
+ 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);
8575
+ };
8576
+ util.safeProp = function safeProp(prop) {
8577
+ if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop))
8578
+ return '["' + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, '\\"') + '"]';
8579
+ return "." + prop;
8580
+ };
8581
+ util.ucFirst = function ucFirst(str) {
8582
+ return str.charAt(0).toUpperCase() + str.substring(1);
8583
+ };
8584
+ var camelCaseRe = /_([a-z])/g;
8585
+ util.camelCase = function camelCase(str) {
8586
+ return str.substring(0, 1) + str.substring(1).replace(camelCaseRe, function($0, $1) {
8587
+ return $1.toUpperCase();
8588
+ });
8589
+ };
8590
+ util.compareFieldsById = function compareFieldsById(a, b) {
8591
+ return a.id - b.id;
8592
+ };
8593
+ util.decorateType = function decorateType(ctor, typeName) {
8594
+ if (ctor.$type) {
8595
+ if (typeName && ctor.$type.name !== typeName) {
8596
+ util.decorateRoot.remove(ctor.$type);
8597
+ ctor.$type.name = typeName;
8598
+ util.decorateRoot.add(ctor.$type);
8599
+ }
8600
+ return ctor.$type;
8601
+ }
8602
+ if (!Type)
8603
+ Type = require(35);
8604
+ var type = new Type(typeName || ctor.name);
8605
+ util.decorateRoot.add(type);
8606
+ type.ctor = ctor;
8607
+ Object.defineProperty(ctor, "$type", { value: type, enumerable: false });
8608
+ Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false });
8609
+ return type;
8610
+ };
8611
+ var decorateEnumIndex = 0;
8612
+ util.decorateEnum = function decorateEnum(object) {
8613
+ if (object.$type)
8614
+ return object.$type;
8615
+ if (!Enum)
8616
+ Enum = require(15);
8617
+ var enm = new Enum("Enum" + decorateEnumIndex++, object);
8618
+ util.decorateRoot.add(enm);
8619
+ Object.defineProperty(object, "$type", { value: enm, enumerable: false });
8620
+ return enm;
8621
+ };
8622
+ Object.defineProperty(util, "decorateRoot", {
8623
+ get: function() {
8624
+ return roots["decorated"] || (roots["decorated"] = new (require(29))());
8625
+ }
8626
+ });
8627
+ }, { "15": 15, "29": 29, "3": 3, "30": 30, "35": 35, "39": 39, "5": 5, "8": 8 }], 38: [function(require, module2, exports) {
8628
+ module2.exports = LongBits;
8629
+ var util = require(39);
8630
+ function LongBits(lo, hi) {
8631
+ this.lo = lo >>> 0;
8632
+ this.hi = hi >>> 0;
8633
+ }
8634
+ var zero = LongBits.zero = new LongBits(0, 0);
8635
+ zero.toNumber = function() {
8636
+ return 0;
8637
+ };
8638
+ zero.zzEncode = zero.zzDecode = function() {
8639
+ return this;
8640
+ };
8641
+ zero.length = function() {
8642
+ return 1;
8643
+ };
8644
+ var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
8645
+ LongBits.fromNumber = function fromNumber(value) {
8646
+ if (value === 0)
8647
+ return zero;
8648
+ var sign = value < 0;
8649
+ if (sign)
8650
+ value = -value;
8651
+ var lo = value >>> 0, hi = (value - lo) / 4294967296 >>> 0;
8652
+ if (sign) {
8653
+ hi = ~hi >>> 0;
8654
+ lo = ~lo >>> 0;
8655
+ if (++lo > 4294967295) {
8656
+ lo = 0;
8657
+ if (++hi > 4294967295)
8658
+ hi = 0;
8659
+ }
8660
+ }
8661
+ return new LongBits(lo, hi);
8662
+ };
8663
+ LongBits.from = function from(value) {
8664
+ if (typeof value === "number")
8665
+ return LongBits.fromNumber(value);
8666
+ if (util.isString(value)) {
8667
+ if (util.Long)
8668
+ value = util.Long.fromString(value);
8669
+ else
8670
+ return LongBits.fromNumber(parseInt(value, 10));
8671
+ }
8672
+ return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
8673
+ };
8674
+ LongBits.prototype.toNumber = function toNumber(unsigned) {
8675
+ if (!unsigned && this.hi >>> 31) {
8676
+ var lo = ~this.lo + 1 >>> 0, hi = ~this.hi >>> 0;
8677
+ if (!lo)
8678
+ hi = hi + 1 >>> 0;
8679
+ return -(lo + hi * 4294967296);
8680
+ }
8681
+ return this.lo + this.hi * 4294967296;
8682
+ };
8683
+ LongBits.prototype.toLong = function toLong(unsigned) {
8684
+ return util.Long ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
8685
+ };
8686
+ var charCodeAt = String.prototype.charCodeAt;
8687
+ LongBits.fromHash = function fromHash(hash) {
8688
+ if (hash === zeroHash)
8689
+ return zero;
8690
+ return new LongBits(
8691
+ (charCodeAt.call(hash, 0) | charCodeAt.call(hash, 1) << 8 | charCodeAt.call(hash, 2) << 16 | charCodeAt.call(hash, 3) << 24) >>> 0,
8692
+ (charCodeAt.call(hash, 4) | charCodeAt.call(hash, 5) << 8 | charCodeAt.call(hash, 6) << 16 | charCodeAt.call(hash, 7) << 24) >>> 0
8693
+ );
8694
+ };
8695
+ LongBits.prototype.toHash = function toHash() {
8696
+ return String.fromCharCode(
8697
+ this.lo & 255,
8698
+ this.lo >>> 8 & 255,
8699
+ this.lo >>> 16 & 255,
8700
+ this.lo >>> 24,
8701
+ this.hi & 255,
8702
+ this.hi >>> 8 & 255,
8703
+ this.hi >>> 16 & 255,
8704
+ this.hi >>> 24
8705
+ );
8706
+ };
8707
+ LongBits.prototype.zzEncode = function zzEncode() {
8708
+ var mask = this.hi >> 31;
8709
+ this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
8710
+ this.lo = (this.lo << 1 ^ mask) >>> 0;
8711
+ return this;
8712
+ };
8713
+ LongBits.prototype.zzDecode = function zzDecode() {
8714
+ var mask = -(this.lo & 1);
8715
+ this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
8716
+ this.hi = (this.hi >>> 1 ^ mask) >>> 0;
8717
+ return this;
8718
+ };
8719
+ LongBits.prototype.length = function length() {
8720
+ var part0 = this.lo, part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, part2 = this.hi >>> 24;
8721
+ return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10;
8722
+ };
8723
+ }, { "39": 39 }], 39: [function(require, module2, exports) {
8724
+ var util = exports;
8725
+ util.asPromise = require(1);
8726
+ util.base64 = require(2);
8727
+ util.EventEmitter = require(4);
8728
+ util.float = require(6);
8729
+ util.inquire = require(7);
8730
+ util.utf8 = require(10);
8731
+ util.pool = require(9);
8732
+ util.LongBits = require(38);
8733
+ util.emptyArray = Object.freeze ? Object.freeze([]) : (
8734
+ /* istanbul ignore next */
8735
+ []
8736
+ );
8737
+ util.emptyObject = Object.freeze ? Object.freeze({}) : (
8738
+ /* istanbul ignore next */
8739
+ {}
8740
+ );
8741
+ util.isNode = Boolean(commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node);
8742
+ util.isInteger = Number.isInteger || /* istanbul ignore next */
8743
+ function isInteger(value) {
8744
+ return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
8745
+ };
8746
+ util.isString = function isString(value) {
8747
+ return typeof value === "string" || value instanceof String;
8748
+ };
8749
+ util.isObject = function isObject(value) {
8750
+ return value && typeof value === "object";
8751
+ };
8752
+ util.isset = /**
8753
+ * Checks if a property on a message is considered to be present.
8754
+ * @param {Object} obj Plain object or message instance
8755
+ * @param {string} prop Property name
8756
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
8757
+ */
8758
+ util.isSet = function isSet(obj, prop) {
8759
+ var value = obj[prop];
8760
+ if (value != null && obj.hasOwnProperty(prop))
8761
+ return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
8762
+ return false;
8763
+ };
8764
+ util.Buffer = function() {
8765
+ try {
8766
+ var Buffer = util.inquire("buffer").Buffer;
8767
+ return Buffer.prototype.utf8Write ? Buffer : (
8768
+ /* istanbul ignore next */
8769
+ null
8770
+ );
8771
+ } catch (e) {
8772
+ return null;
8773
+ }
8774
+ }();
8775
+ util._Buffer_from = null;
8776
+ util._Buffer_allocUnsafe = null;
8777
+ util.newBuffer = function newBuffer(sizeOrArray) {
8778
+ return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray);
8779
+ };
8780
+ util.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
8781
+ util.Long = /* istanbul ignore next */
8782
+ commonjsGlobal.dcodeIO && /* istanbul ignore next */
8783
+ commonjsGlobal.dcodeIO.Long || util.inquire("long");
8784
+ util.key2Re = /^true|false|0|1$/;
8785
+ util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
8786
+ util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
8787
+ util.longToHash = function longToHash(value) {
8788
+ return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash;
8789
+ };
8790
+ util.longFromHash = function longFromHash(hash, unsigned) {
8791
+ var bits = util.LongBits.fromHash(hash);
8792
+ if (util.Long)
8793
+ return util.Long.fromBits(bits.lo, bits.hi, unsigned);
8794
+ return bits.toNumber(Boolean(unsigned));
8795
+ };
8796
+ function merge(dst, src, ifNotSet) {
8797
+ for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)
8798
+ if (dst[keys[i]] === undefined$1 || !ifNotSet)
8799
+ dst[keys[i]] = src[keys[i]];
8800
+ return dst;
8801
+ }
8802
+ util.merge = merge;
8803
+ util.lcFirst = function lcFirst(str) {
8804
+ return str.charAt(0).toLowerCase() + str.substring(1);
8805
+ };
8806
+ function newError(name) {
8807
+ function CustomError(message, properties) {
8808
+ if (!(this instanceof CustomError))
8809
+ return new CustomError(message, properties);
8810
+ Object.defineProperty(this, "message", { get: function() {
8811
+ return message;
8812
+ } });
8813
+ if (Error.captureStackTrace)
8814
+ Error.captureStackTrace(this, CustomError);
8815
+ else
8816
+ Object.defineProperty(this, "stack", { value: new Error().stack || "" });
8817
+ if (properties)
8818
+ merge(this, properties);
8819
+ }
8820
+ (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;
8821
+ Object.defineProperty(CustomError.prototype, "name", { get: function() {
8822
+ return name;
8823
+ } });
8824
+ CustomError.prototype.toString = function toString() {
8825
+ return this.name + ": " + this.message;
8826
+ };
8827
+ return CustomError;
8828
+ }
8829
+ util.newError = newError;
8830
+ util.ProtocolError = newError("ProtocolError");
8831
+ util.oneOfGetter = function getOneOf(fieldNames) {
8832
+ var fieldMap = {};
8833
+ for (var i = 0; i < fieldNames.length; ++i)
8834
+ fieldMap[fieldNames[i]] = 1;
8835
+ return function() {
8836
+ for (var keys = Object.keys(this), i2 = keys.length - 1; i2 > -1; --i2)
8837
+ if (fieldMap[keys[i2]] === 1 && this[keys[i2]] !== undefined$1 && this[keys[i2]] !== null)
8838
+ return keys[i2];
8839
+ };
8840
+ };
8841
+ util.oneOfSetter = function setOneOf(fieldNames) {
8842
+ return function(name) {
8843
+ for (var i = 0; i < fieldNames.length; ++i)
8844
+ if (fieldNames[i] !== name)
8845
+ delete this[fieldNames[i]];
8846
+ };
8847
+ };
8848
+ util.toJSONOptions = {
8849
+ longs: String,
8850
+ enums: String,
8851
+ bytes: String,
8852
+ json: true
8853
+ };
8854
+ util._configure = function() {
8855
+ var Buffer = util.Buffer;
8856
+ if (!Buffer) {
8857
+ util._Buffer_from = util._Buffer_allocUnsafe = null;
8858
+ return;
8859
+ }
8860
+ util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || /* istanbul ignore next */
8861
+ function Buffer_from(value, encoding) {
8862
+ return new Buffer(value, encoding);
8863
+ };
8864
+ util._Buffer_allocUnsafe = Buffer.allocUnsafe || /* istanbul ignore next */
8865
+ function Buffer_allocUnsafe(size) {
8866
+ return new Buffer(size);
8867
+ };
8868
+ };
8869
+ }, { "1": 1, "10": 10, "2": 2, "38": 38, "4": 4, "6": 6, "7": 7, "9": 9 }], 40: [function(require, module2, exports) {
8870
+ module2.exports = verifier;
8871
+ var Enum = require(15), util = require(37);
8872
+ function invalid(field, expected) {
8873
+ return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:" + field.keyType + "}" : "") + " expected";
8874
+ }
8875
+ function genVerifyValue(gen, field, fieldIndex, ref) {
8876
+ if (field.resolvedType) {
8877
+ if (field.resolvedType instanceof Enum) {
8878
+ gen("switch(%s){", ref)("default:")("return%j", invalid(field, "enum value"));
8879
+ for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen("case %i:", field.resolvedType.values[keys[j]]);
8880
+ gen("break")("}");
8881
+ } else {
8882
+ gen("{")("var e=types[%i].verify(%s);", fieldIndex, ref)("if(e)")("return%j+e", field.name + ".")("}");
8883
+ }
8884
+ } else {
8885
+ switch (field.type) {
8886
+ case "int32":
8887
+ case "uint32":
8888
+ case "sint32":
8889
+ case "fixed32":
8890
+ case "sfixed32":
8891
+ gen("if(!util.isInteger(%s))", ref)("return%j", invalid(field, "integer"));
8892
+ break;
8893
+ case "int64":
8894
+ case "uint64":
8895
+ case "sint64":
8896
+ case "fixed64":
8897
+ case "sfixed64":
8898
+ gen("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref)("return%j", invalid(field, "integer|Long"));
8899
+ break;
8900
+ case "float":
8901
+ case "double":
8902
+ gen('if(typeof %s!=="number")', ref)("return%j", invalid(field, "number"));
8903
+ break;
8904
+ case "bool":
8905
+ gen('if(typeof %s!=="boolean")', ref)("return%j", invalid(field, "boolean"));
8906
+ break;
8907
+ case "string":
8908
+ gen("if(!util.isString(%s))", ref)("return%j", invalid(field, "string"));
8909
+ break;
8910
+ case "bytes":
8911
+ gen('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', ref, ref, ref)("return%j", invalid(field, "buffer"));
8912
+ break;
8913
+ }
8914
+ }
8915
+ return gen;
8916
+ }
8917
+ function genVerifyKey(gen, field, ref) {
8918
+ switch (field.keyType) {
8919
+ case "int32":
8920
+ case "uint32":
8921
+ case "sint32":
8922
+ case "fixed32":
8923
+ case "sfixed32":
8924
+ gen("if(!util.key32Re.test(%s))", ref)("return%j", invalid(field, "integer key"));
8925
+ break;
8926
+ case "int64":
8927
+ case "uint64":
8928
+ case "sint64":
8929
+ case "fixed64":
8930
+ case "sfixed64":
8931
+ gen("if(!util.key64Re.test(%s))", ref)("return%j", invalid(field, "integer|Long key"));
8932
+ break;
8933
+ case "bool":
8934
+ gen("if(!util.key2Re.test(%s))", ref)("return%j", invalid(field, "boolean key"));
8935
+ break;
8936
+ }
8937
+ return gen;
8938
+ }
8939
+ function verifier(mtype) {
8940
+ var gen = util.codegen(["m"], mtype.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected");
8941
+ var oneofs = mtype.oneofsArray, seenFirstField = {};
8942
+ if (oneofs.length) gen("var p={}");
8943
+ for (var i = 0; i < /* initializes */
8944
+ mtype.fieldsArray.length; ++i) {
8945
+ var field = mtype._fieldsArray[i].resolve(), ref = "m" + util.safeProp(field.name);
8946
+ if (field.optional) gen("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name);
8947
+ if (field.map) {
8948
+ gen("if(!util.isObject(%s))", ref)("return%j", invalid(field, "object"))("var k=Object.keys(%s)", ref)("for(var i=0;i<k.length;++i){");
8949
+ genVerifyKey(gen, field, "k[i]");
8950
+ genVerifyValue(gen, field, i, ref + "[k[i]]")("}");
8951
+ } else if (field.repeated) {
8952
+ gen("if(!Array.isArray(%s))", ref)("return%j", invalid(field, "array"))("for(var i=0;i<%s.length;++i){", ref);
8953
+ genVerifyValue(gen, field, i, ref + "[i]")("}");
8954
+ } else {
8955
+ if (field.partOf) {
8956
+ var oneofProp = util.safeProp(field.partOf.name);
8957
+ if (seenFirstField[field.partOf.name] === 1) gen("if(p%s===1)", oneofProp)("return%j", field.partOf.name + ": multiple values");
8958
+ seenFirstField[field.partOf.name] = 1;
8959
+ gen("p%s=1", oneofProp);
8960
+ }
8961
+ genVerifyValue(gen, field, i, ref);
8962
+ }
8963
+ if (field.optional) gen("}");
8964
+ }
8965
+ return gen("return null");
8966
+ }
8967
+ }, { "15": 15, "37": 37 }], 41: [function(require, module2, exports) {
8968
+ var wrappers = exports;
8969
+ var Message = require(21);
8970
+ wrappers[".google.protobuf.Any"] = {
8971
+ fromObject: function(object) {
8972
+ if (object && object["@type"]) {
8973
+ var type = this.lookup(object["@type"]);
8974
+ if (type) {
8975
+ var type_url = object["@type"].charAt(0) === "." ? object["@type"].substr(1) : object["@type"];
8976
+ return this.create({
8977
+ type_url: "/" + type_url,
8978
+ value: type.encode(type.fromObject(object)).finish()
8979
+ });
8980
+ }
8981
+ }
8982
+ return this.fromObject(object);
8983
+ },
8984
+ toObject: function(message, options) {
8985
+ if (options && options.json && message.type_url && message.value) {
8986
+ var name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1);
8987
+ var type = this.lookup(name);
8988
+ if (type)
8989
+ message = type.decode(message.value);
8990
+ }
8991
+ if (!(message instanceof this.ctor) && message instanceof Message) {
8992
+ var object = message.$type.toObject(message, options);
8993
+ object["@type"] = message.$type.fullName;
8994
+ return object;
8995
+ }
8996
+ return this.toObject(message, options);
8997
+ }
8998
+ };
8999
+ }, { "21": 21 }], 42: [function(require, module2, exports) {
9000
+ module2.exports = Writer;
9001
+ var util = require(39);
9002
+ var BufferWriter;
9003
+ var LongBits = util.LongBits, base64 = util.base64, utf8 = util.utf8;
9004
+ function Op(fn, len, val) {
9005
+ this.fn = fn;
9006
+ this.len = len;
9007
+ this.next = undefined$1;
9008
+ this.val = val;
9009
+ }
9010
+ function noop() {
9011
+ }
9012
+ function State(writer) {
9013
+ this.head = writer.head;
9014
+ this.tail = writer.tail;
9015
+ this.len = writer.len;
9016
+ this.next = writer.states;
9017
+ }
9018
+ function Writer() {
9019
+ this.len = 0;
9020
+ this.head = new Op(noop, 0, 0);
9021
+ this.tail = this.head;
9022
+ this.states = null;
9023
+ }
9024
+ Writer.create = util.Buffer ? function create_buffer_setup() {
9025
+ return (Writer.create = function create_buffer() {
9026
+ return new BufferWriter();
9027
+ })();
9028
+ } : function create_array() {
9029
+ return new Writer();
9030
+ };
9031
+ Writer.alloc = function alloc(size) {
9032
+ return new util.Array(size);
9033
+ };
9034
+ if (util.Array !== Array)
9035
+ Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);
9036
+ Writer.prototype._push = function push(fn, len, val) {
9037
+ this.tail = this.tail.next = new Op(fn, len, val);
9038
+ this.len += len;
9039
+ return this;
9040
+ };
9041
+ function writeByte(val, buf, pos) {
9042
+ buf[pos] = val & 255;
9043
+ }
9044
+ function writeVarint32(val, buf, pos) {
9045
+ while (val > 127) {
9046
+ buf[pos++] = val & 127 | 128;
9047
+ val >>>= 7;
9048
+ }
9049
+ buf[pos] = val;
9050
+ }
9051
+ function VarintOp(len, val) {
9052
+ this.len = len;
9053
+ this.next = undefined$1;
9054
+ this.val = val;
9055
+ }
9056
+ VarintOp.prototype = Object.create(Op.prototype);
9057
+ VarintOp.prototype.fn = writeVarint32;
9058
+ Writer.prototype.uint32 = function write_uint32(value) {
9059
+ this.len += (this.tail = this.tail.next = new VarintOp(
9060
+ (value = value >>> 0) < 128 ? 1 : value < 16384 ? 2 : value < 2097152 ? 3 : value < 268435456 ? 4 : 5,
9061
+ value
9062
+ )).len;
9063
+ return this;
9064
+ };
9065
+ Writer.prototype.int32 = function write_int32(value) {
9066
+ return value < 0 ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) : this.uint32(value);
9067
+ };
9068
+ Writer.prototype.sint32 = function write_sint32(value) {
9069
+ return this.uint32((value << 1 ^ value >> 31) >>> 0);
9070
+ };
9071
+ function writeVarint64(val, buf, pos) {
9072
+ while (val.hi) {
9073
+ buf[pos++] = val.lo & 127 | 128;
9074
+ val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
9075
+ val.hi >>>= 7;
9076
+ }
9077
+ while (val.lo > 127) {
9078
+ buf[pos++] = val.lo & 127 | 128;
9079
+ val.lo = val.lo >>> 7;
9080
+ }
9081
+ buf[pos++] = val.lo;
9082
+ }
9083
+ Writer.prototype.uint64 = function write_uint64(value) {
9084
+ var bits = LongBits.from(value);
9085
+ return this._push(writeVarint64, bits.length(), bits);
9086
+ };
9087
+ Writer.prototype.int64 = Writer.prototype.uint64;
9088
+ Writer.prototype.sint64 = function write_sint64(value) {
9089
+ var bits = LongBits.from(value).zzEncode();
9090
+ return this._push(writeVarint64, bits.length(), bits);
9091
+ };
9092
+ Writer.prototype.bool = function write_bool(value) {
9093
+ return this._push(writeByte, 1, value ? 1 : 0);
9094
+ };
9095
+ function writeFixed32(val, buf, pos) {
9096
+ buf[pos] = val & 255;
9097
+ buf[pos + 1] = val >>> 8 & 255;
9098
+ buf[pos + 2] = val >>> 16 & 255;
9099
+ buf[pos + 3] = val >>> 24;
9100
+ }
9101
+ Writer.prototype.fixed32 = function write_fixed32(value) {
9102
+ return this._push(writeFixed32, 4, value >>> 0);
9103
+ };
9104
+ Writer.prototype.sfixed32 = Writer.prototype.fixed32;
9105
+ Writer.prototype.fixed64 = function write_fixed64(value) {
9106
+ var bits = LongBits.from(value);
9107
+ return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);
9108
+ };
9109
+ Writer.prototype.sfixed64 = Writer.prototype.fixed64;
9110
+ Writer.prototype.float = function write_float(value) {
9111
+ return this._push(util.float.writeFloatLE, 4, value);
9112
+ };
9113
+ Writer.prototype.double = function write_double(value) {
9114
+ return this._push(util.float.writeDoubleLE, 8, value);
9115
+ };
9116
+ var writeBytes = util.Array.prototype.set ? function writeBytes_set(val, buf, pos) {
9117
+ buf.set(val, pos);
9118
+ } : function writeBytes_for(val, buf, pos) {
9119
+ for (var i = 0; i < val.length; ++i)
9120
+ buf[pos + i] = val[i];
9121
+ };
9122
+ Writer.prototype.bytes = function write_bytes(value) {
9123
+ var len = value.length >>> 0;
9124
+ if (!len)
9125
+ return this._push(writeByte, 1, 0);
9126
+ if (util.isString(value)) {
9127
+ var buf = Writer.alloc(len = base64.length(value));
9128
+ base64.decode(value, buf, 0);
9129
+ value = buf;
9130
+ }
9131
+ return this.uint32(len)._push(writeBytes, len, value);
9132
+ };
9133
+ Writer.prototype.string = function write_string(value) {
9134
+ var len = utf8.length(value);
9135
+ return len ? this.uint32(len)._push(utf8.write, len, value) : this._push(writeByte, 1, 0);
9136
+ };
9137
+ Writer.prototype.fork = function fork() {
9138
+ this.states = new State(this);
9139
+ this.head = this.tail = new Op(noop, 0, 0);
9140
+ this.len = 0;
9141
+ return this;
9142
+ };
9143
+ Writer.prototype.reset = function reset() {
9144
+ if (this.states) {
9145
+ this.head = this.states.head;
9146
+ this.tail = this.states.tail;
9147
+ this.len = this.states.len;
9148
+ this.states = this.states.next;
9149
+ } else {
9150
+ this.head = this.tail = new Op(noop, 0, 0);
9151
+ this.len = 0;
9152
+ }
9153
+ return this;
9154
+ };
9155
+ Writer.prototype.ldelim = function ldelim() {
9156
+ var head = this.head, tail = this.tail, len = this.len;
9157
+ this.reset().uint32(len);
9158
+ if (len) {
9159
+ this.tail.next = head.next;
9160
+ this.tail = tail;
9161
+ this.len += len;
9162
+ }
9163
+ return this;
9164
+ };
9165
+ Writer.prototype.finish = function finish() {
9166
+ var head = this.head.next, buf = this.constructor.alloc(this.len), pos = 0;
9167
+ while (head) {
9168
+ head.fn(head.val, buf, pos);
9169
+ pos += head.len;
9170
+ head = head.next;
9171
+ }
9172
+ return buf;
9173
+ };
9174
+ Writer._configure = function(BufferWriter_) {
9175
+ BufferWriter = BufferWriter_;
9176
+ };
9177
+ }, { "39": 39 }], 43: [function(require, module2, exports) {
9178
+ module2.exports = BufferWriter;
9179
+ var Writer = require(42);
9180
+ (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
9181
+ var util = require(39);
9182
+ var Buffer = util.Buffer;
9183
+ function BufferWriter() {
9184
+ Writer.call(this);
9185
+ }
9186
+ BufferWriter.alloc = function alloc_buffer(size) {
9187
+ return (BufferWriter.alloc = util._Buffer_allocUnsafe)(size);
9188
+ };
9189
+ var writeBytesBuffer = Buffer && Buffer.prototype instanceof Uint8Array && Buffer.prototype.set.name === "set" ? function writeBytesBuffer_set(val, buf, pos) {
9190
+ buf.set(val, pos);
9191
+ } : function writeBytesBuffer_copy(val, buf, pos) {
9192
+ if (val.copy)
9193
+ val.copy(buf, pos, 0, val.length);
9194
+ else for (var i = 0; i < val.length; )
9195
+ buf[pos++] = val[i++];
9196
+ };
9197
+ BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
9198
+ if (util.isString(value))
9199
+ value = util._Buffer_from(value, "base64");
9200
+ var len = value.length >>> 0;
9201
+ this.uint32(len);
9202
+ if (len)
9203
+ this._push(writeBytesBuffer, len, value);
9204
+ return this;
9205
+ };
9206
+ function writeStringBuffer(val, buf, pos) {
9207
+ if (val.length < 40)
9208
+ util.utf8.write(val, buf, pos);
9209
+ else
9210
+ buf.utf8Write(val, pos);
9211
+ }
9212
+ BufferWriter.prototype.string = function write_string_buffer(value) {
9213
+ var len = Buffer.byteLength(value);
9214
+ this.uint32(len);
9215
+ if (len)
9216
+ this._push(writeStringBuffer, len, value);
9217
+ return this;
9218
+ };
9219
+ }, { "39": 39, "42": 42 }] }, {}, [19]);
9220
+ })();
9221
+ } (protobuf));
9222
+ return protobuf.exports;
9223
+ }
9224
+
9225
+ var protobufExports = /*@__PURE__*/ requireProtobuf();
9226
+ const $protobuf = /*@__PURE__*/getDefaultExportFromCjs(protobufExports);
9227
+
4693
9228
  let $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
4694
9229
  const $root = $protobuf.roots["push-server"] || ($protobuf.roots["push-server"] = {});
4695
9230
  $root.RequestBatch = function() {
@@ -5718,11 +10253,8 @@ $root.JsonResponse = function() {
5718
10253
  return JsonResponse;
5719
10254
  }();
5720
10255
 
5721
- $root["Response"];
5722
10256
  const ResponseBatch = $root["ResponseBatch"];
5723
- $root["Request"];
5724
10257
  const RequestBatch = $root["RequestBatch"];
5725
- $root["IncomingMessagesRequest"];
5726
10258
  const IncomingMessage = $root["IncomingMessage"];
5727
10259
  const Receiver = $root["Receiver"];
5728
10260