protobufjs 5.0.1 → 5.0.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.
Files changed (170) hide show
  1. package/.travis.yml +2 -1
  2. package/README.md +144 -22
  3. package/bin/pbjs +2 -2
  4. package/bower.json +2 -2
  5. package/cli/pbjs/targets/amd.js +1 -1
  6. package/cli/pbjs/targets/json.js +8 -0
  7. package/cli/pbjs/util.js +1 -1
  8. package/cli/pbjs.js +1 -1
  9. package/dist/protobuf-light.js +166 -128
  10. package/dist/protobuf-light.min.js +88 -81
  11. package/dist/protobuf-light.min.js.gz +0 -0
  12. package/dist/protobuf-light.min.map +4 -4
  13. package/dist/protobuf.js +171 -129
  14. package/dist/protobuf.min.js +106 -98
  15. package/dist/protobuf.min.js.gz +0 -0
  16. package/dist/protobuf.min.map +4 -4
  17. package/docs/ProtoBuf.Builder.Message.html +1408 -971
  18. package/docs/ProtoBuf.Builder.Service.html +266 -197
  19. package/docs/ProtoBuf.Builder.html +758 -542
  20. package/docs/ProtoBuf.DotProto.Parser.html +223 -161
  21. package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
  22. package/docs/ProtoBuf.DotProto.html +20 -12
  23. package/docs/ProtoBuf.Element.html +554 -554
  24. package/docs/ProtoBuf.Map.html +158 -123
  25. package/docs/ProtoBuf.Reflect.Element.html +286 -143
  26. package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
  27. package/docs/ProtoBuf.Reflect.Enum.html +757 -537
  28. package/docs/ProtoBuf.Reflect.Extension.html +73 -56
  29. package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
  30. package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
  31. package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
  32. package/docs/ProtoBuf.Reflect.Message.html +915 -651
  33. package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
  34. package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
  35. package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
  36. package/docs/ProtoBuf.Reflect.Service.html +721 -511
  37. package/docs/ProtoBuf.Reflect.T.html +268 -197
  38. package/docs/ProtoBuf.Reflect.html +20 -12
  39. package/docs/ProtoBuf.Util.html +169 -118
  40. package/docs/ProtoBuf.html +840 -628
  41. package/docs/ProtoBuf.js.html +177 -134
  42. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  43. package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
  44. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  45. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  46. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  47. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  48. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  49. package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
  50. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  51. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  52. package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
  53. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  54. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  55. package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  56. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  57. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  58. package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
  59. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  60. package/docs/index.html +7 -5
  61. package/docs/styles/jsdoc-default.css +95 -75
  62. package/docs/styles/prettify-tomorrow.css +1 -1
  63. package/examples/protoify/json.js +123 -123
  64. package/examples/protoify/json.json +123 -123
  65. package/examples/websocket/server.js +4 -4
  66. package/externs/protobuf.js +1 -1
  67. package/jsdoc.json +1 -1
  68. package/package.json +2 -2
  69. package/scripts/build.js +53 -53
  70. package/src/ProtoBuf/Builder/Message.js +9 -5
  71. package/src/ProtoBuf/Builder.js +19 -2
  72. package/src/ProtoBuf/DotProto/Parser.js +5 -1
  73. package/src/ProtoBuf/Reflect/Element.js +13 -1
  74. package/src/ProtoBuf/Reflect/Message/Field.js +2 -2
  75. package/src/ProtoBuf/Reflect/Message.js +6 -1
  76. package/src/ProtoBuf/Util.js +116 -116
  77. package/src/bower.json +1 -1
  78. package/src/google/protobuf/descriptor.json +27 -1
  79. package/tests/bench.txt +373 -373
  80. package/tests/complex.json +8 -1
  81. package/tests/custom-options.json +169 -169
  82. package/tests/extend.json +71 -71
  83. package/tests/imports.json +83 -83
  84. package/tests/nodeunit-browser/nodeunit.css +70 -70
  85. package/tests/nodeunit-browser/nodeunit.js +2108 -2108
  86. package/tests/options.json +32 -32
  87. package/tests/proto2js/Bar.json +46 -46
  88. package/tests/suite.js +43 -1
  89. package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
  90. package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
  91. package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
  92. package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
  93. package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
  94. package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
  95. package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
  96. package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
  97. package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
  98. package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
  99. package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
  100. package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
  101. package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
  102. package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
  103. package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
  104. package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
  105. package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
  106. package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
  107. package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
  108. package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
  109. package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
  110. package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
  111. package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
  112. package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
  113. package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
  114. package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
  115. package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
  116. package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
  117. package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
  118. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
  119. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
  120. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
  121. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
  122. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
  123. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
  124. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
  125. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
  126. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
  127. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
  128. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
  129. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
  130. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
  131. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
  132. package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
  133. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
  134. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
  135. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
  136. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
  137. package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
  138. package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
  139. package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
  140. package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
  141. package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
  142. package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
  143. package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
  144. package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
  145. package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
  146. package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
  147. package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
  148. package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
  149. package/sandbox/gapi/test.js +0 -17
  150. package/sandbox/gapi/test.proto +0 -12
  151. package/sandbox/issue146/MyOptions.proto +0 -28
  152. package/sandbox/issue146/Sample.proto +0 -21
  153. package/sandbox/issue146/main.js +0 -3
  154. package/sandbox/issue147/enum.proto +0 -8
  155. package/sandbox/issue147/main.js +0 -3
  156. package/sandbox/issue182/commands.proto +0 -10
  157. package/sandbox/issue182/execute.js +0 -22
  158. package/sandbox/issue182/session_commands.proto +0 -14
  159. package/sandbox/issue289/A.proto +0 -8
  160. package/sandbox/issue289/B.proto +0 -8
  161. package/sandbox/issue289/common.proto +0 -5
  162. package/sandbox/issue289/main.js +0 -7
  163. package/sandbox/issue300/IAuth.proto +0 -14
  164. package/sandbox/issue300/Request.proto +0 -14
  165. package/sandbox/issue300/main.js +0 -26
  166. package/sandbox/issue347/index.js +0 -27
  167. package/sandbox/issue355/main.proto +0 -15
  168. package/sandbox/issue42/innerextend.proto +0 -18
  169. package/sandbox/issue42/main.js +0 -8
  170. package/sandbox/issue42/outerextend.proto +0 -17
@@ -3,85 +3,92 @@
3
3
  Released under the Apache License, Version 2.0
4
4
  see: https://github.com/dcodeIO/protobuf.js for details
5
5
  */
6
- (function(h,y){"function"===typeof define&&define.amd?define(["bytebuffer"],y):"function"===typeof require&&"object"===typeof module&&module&&module.exports?module.exports=y(require("bytebuffer"),!0):(h.dcodeIO=h.dcodeIO||{}).ProtoBuf=y(h.dcodeIO.ByteBuffer)})(this,function(h,y){var c={};c.ByteBuffer=h;c.Long=h.Long||null;c.VERSION="5.0.1";c.WIRE_TYPES={};c.WIRE_TYPES.VARINT=0;c.WIRE_TYPES.BITS64=1;c.WIRE_TYPES.LDELIM=2;c.WIRE_TYPES.STARTGROUP=3;c.WIRE_TYPES.ENDGROUP=4;c.WIRE_TYPES.BITS32=5;c.PACKABLE_WIRE_TYPES=
7
- [c.WIRE_TYPES.VARINT,c.WIRE_TYPES.BITS64,c.WIRE_TYPES.BITS32];c.TYPES={int32:{name:"int32",wireType:c.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:c.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:c.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:c.WIRE_TYPES.VARINT,defaultValue:c.Long?c.Long.ZERO:void 0},uint64:{name:"uint64",wireType:c.WIRE_TYPES.VARINT,defaultValue:c.Long?c.Long.UZERO:void 0},sint64:{name:"sint64",wireType:c.WIRE_TYPES.VARINT,
8
- defaultValue:c.Long?c.Long.ZERO:void 0},bool:{name:"bool",wireType:c.WIRE_TYPES.VARINT,defaultValue:!1},"double":{name:"double",wireType:c.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:c.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:c.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:c.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:c.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:c.WIRE_TYPES.BITS64,
9
- defaultValue:c.Long?c.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:c.WIRE_TYPES.BITS64,defaultValue:c.Long?c.Long.ZERO:void 0},"float":{name:"float",wireType:c.WIRE_TYPES.BITS32,defaultValue:0},"enum":{name:"enum",wireType:c.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:c.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:c.WIRE_TYPES.STARTGROUP,defaultValue:null}};c.MAP_KEY_TYPES=[c.TYPES.int32,c.TYPES.sint32,c.TYPES.sfixed32,c.TYPES.uint32,c.TYPES.fixed32,
10
- c.TYPES.int64,c.TYPES.sint64,c.TYPES.sfixed64,c.TYPES.uint64,c.TYPES.fixed64,c.TYPES.bool,c.TYPES.string,c.TYPES.bytes];c.ID_MIN=1;c.ID_MAX=536870911;c.convertFieldsToCamelCase=!1;c.populateAccessors=!0;c.populateDefaults=!0;c.Util=function(){var b={};b.IS_NODE=!("object"!==typeof process||"[object process]"!==process+""||process.browser);b.XHR=function(){for(var b=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},
11
- function(){return new ActiveXObject("Microsoft.XMLHTTP")}],c=null,h=0;h<b.length;h++){try{c=b[h]()}catch(l){continue}break}if(!c)throw Error("XMLHttpRequest is not supported");return c};b.fetch=function(c,h){h&&"function"!=typeof h&&(h=null);if(b.IS_NODE){var n=require("fs");if(h)n.readFile(c,function(b,c){b?h(null):h(""+c)});else try{return n.readFileSync(c)}catch(l){return null}}else{var g=b.XHR();g.open("GET",c,h?!0:!1);g.setRequestHeader("Accept","text/plain");"function"===typeof g.overrideMimeType&&
12
- g.overrideMimeType("text/plain");if(h)g.onreadystatechange=function(){4==g.readyState&&(200==g.status||0==g.status&&"string"===typeof g.responseText?h(g.responseText):h(null))},4!=g.readyState&&g.send(null);else return g.send(null),200==g.status||0==g.status&&"string"===typeof g.responseText?g.responseText:null}};b.toCamelCase=function(b){return b.replace(/_([a-zA-Z])/g,function(b,c){return c.toUpperCase()})};return b}();c.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,
6
+ var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,p,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[p]=d.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
7
+ $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};
8
+ $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var p=0;return $jscomp.iteratorPrototype(function(){return p<e.length?{done:!1,value:e[p++]}:{done:!0}})};
9
+ $jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,p){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var d=0,c={next:function(){if(d<e.length){var t=d++;return{value:p(t,e[t]),done:!1}}c.next=function(){return{done:!0,value:void 0}};return c.next()}};c[Symbol.iterator]=function(){return c};return c};
10
+ $jscomp.polyfill=function(e,p,d,c){if(p){d=$jscomp.global;e=e.split(".");for(c=0;c<e.length-1;c++){var t=e[c];t in d||(d[t]={});d=d[t]}e=e[e.length-1];c=d[e];p=p(c);p!=c&&null!=p&&$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:p})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");
11
+ $jscomp.polyfill("Array.prototype.entries",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e,d){return[e,d]})}},"es6-impl","es3");$jscomp.polyfill("Array.prototype.values",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e,d){return d})}},"es6","es3");
12
+ (function(e,p){"function"===typeof define&&define.amd?define(["bytebuffer"],p):"function"===typeof require&&"object"===typeof module&&module&&module.exports?module.exports=p(require("bytebuffer"),!0):(e.dcodeIO=e.dcodeIO||{}).ProtoBuf=p(e.dcodeIO.ByteBuffer)})(this,function(e,p){var d={};d.ByteBuffer=e;d.Long=e.Long||null;d.VERSION="5.0.2";d.WIRE_TYPES={};d.WIRE_TYPES.VARINT=0;d.WIRE_TYPES.BITS64=1;d.WIRE_TYPES.LDELIM=2;d.WIRE_TYPES.STARTGROUP=3;d.WIRE_TYPES.ENDGROUP=4;d.WIRE_TYPES.BITS32=5;d.PACKABLE_WIRE_TYPES=
13
+ [d.WIRE_TYPES.VARINT,d.WIRE_TYPES.BITS64,d.WIRE_TYPES.BITS32];d.TYPES={int32:{name:"int32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:d.WIRE_TYPES.VARINT,defaultValue:d.Long?d.Long.ZERO:void 0},uint64:{name:"uint64",wireType:d.WIRE_TYPES.VARINT,defaultValue:d.Long?d.Long.UZERO:void 0},sint64:{name:"sint64",wireType:d.WIRE_TYPES.VARINT,
14
+ defaultValue:d.Long?d.Long.ZERO:void 0},bool:{name:"bool",wireType:d.WIRE_TYPES.VARINT,defaultValue:!1},"double":{name:"double",wireType:d.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:d.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:d.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:d.WIRE_TYPES.BITS64,
15
+ defaultValue:d.Long?d.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:d.WIRE_TYPES.BITS64,defaultValue:d.Long?d.Long.ZERO:void 0},"float":{name:"float",wireType:d.WIRE_TYPES.BITS32,defaultValue:0},"enum":{name:"enum",wireType:d.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:d.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:d.WIRE_TYPES.STARTGROUP,defaultValue:null}};d.MAP_KEY_TYPES=[d.TYPES.int32,d.TYPES.sint32,d.TYPES.sfixed32,d.TYPES.uint32,d.TYPES.fixed32,
16
+ d.TYPES.int64,d.TYPES.sint64,d.TYPES.sfixed64,d.TYPES.uint64,d.TYPES.fixed64,d.TYPES.bool,d.TYPES.string,d.TYPES.bytes];d.ID_MIN=1;d.ID_MAX=536870911;d.convertFieldsToCamelCase=!1;d.populateAccessors=!0;d.populateDefaults=!0;d.Util=function(){var c={};c.IS_NODE=!("object"!==typeof process||"[object process]"!==process+""||process.browser);c.XHR=function(){for(var c=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},
17
+ function(){return new ActiveXObject("Microsoft.XMLHTTP")}],d=null,e=0;e<c.length;e++){try{d=c[e]()}catch(k){continue}break}if(!d)throw Error("XMLHttpRequest is not supported");return d};c.fetch=function(d,e){e&&"function"!=typeof e&&(e=null);if(c.IS_NODE){var t=require("fs");if(e)t.readFile(d,function(c,b){c?e(null):e(""+b)});else try{return t.readFileSync(d)}catch(l){return null}}else{var k=c.XHR();k.open("GET",d,e?!0:!1);k.setRequestHeader("Accept","text/plain");"function"===typeof k.overrideMimeType&&
18
+ k.overrideMimeType("text/plain");if(e)k.onreadystatechange=function(){4==k.readyState&&(200==k.status||0==k.status&&"string"===typeof k.responseText?e(k.responseText):e(null))},4!=k.readyState&&k.send(null);else return k.send(null),200==k.status||0==k.status&&"string"===typeof k.responseText?k.responseText:null}};c.toCamelCase=function(c){return c.replace(/_([a-zA-Z])/g,function(c,e){return e.toUpperCase()})};return c}();d.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,
13
19
  TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
14
- BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g};c.Reflect=function(b){function c(a,e){if(a&&"number"===typeof a.low&&"number"===typeof a.high&&"boolean"===typeof a.unsigned&&a.low===a.low&&a.high===a.high)return new b.Long(a.low,a.high,"undefined"===
15
- typeof e?a.unsigned:e);if("string"===typeof a)return b.Long.fromString(a,e||!1,10);if("number"===typeof a)return b.Long.fromNumber(a,e||!1);throw Error("not convertible to Long");}function s(a,e){var m=e.readVarint32(),d=m&7,m=m>>>3;switch(d){case b.WIRE_TYPES.VARINT:do m=e.readUint8();while(128===(m&128));break;case b.WIRE_TYPES.BITS64:e.offset+=8;break;case b.WIRE_TYPES.LDELIM:m=e.readVarint32();e.offset+=m;break;case b.WIRE_TYPES.STARTGROUP:s(m,e);break;case b.WIRE_TYPES.ENDGROUP:if(m===a)return!1;
16
- throw Error("Illegal GROUPEND after unknown group: "+m+" ("+a+" expected)");case b.WIRE_TYPES.BITS32:e.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+a+": "+d);}return!0}var n={},l=function(a,e,b){this.builder=a;this.parent=e;this.name=b},g=l.prototype;g.fqn=function(){var a=this.name,e=this;do{e=e.parent;if(null==e)break;a=e.name+"."+a}while(1);return a};g.toString=function(a){return(a?this.className+" ":"")+this.fqn()};g.build=function(){throw Error(this.toString(!0)+
17
- " cannot be built directly");};n.T=l;var d=function(a,e,b,d,r){l.call(this,a,e,b);this.className="Namespace";this.children=[];this.options=d||{};this.syntax=r||"proto2"},g=d.prototype=Object.create(l.prototype);g.getChildren=function(a){a=a||null;if(null==a)return this.children.slice();for(var e=[],b=0,d=this.children.length;b<d;++b)this.children[b]instanceof a&&e.push(this.children[b]);return e};g.addChild=function(a){var e;if(e=this.getChild(a.name))if(e instanceof t.Field&&e.name!==e.originalName&&
18
- null===this.getChild(e.originalName))e.name=e.originalName;else if(a instanceof t.Field&&a.name!==a.originalName&&null===this.getChild(a.originalName))a.name=a.originalName;else throw Error("Duplicate name in namespace "+this.toString(!0)+": "+a.name);this.children.push(a)};g.getChild=function(a){for(var e="number"===typeof a?"id":"name",b=0,d=this.children.length;b<d;++b)if(this.children[b][e]===a)return this.children[b];return null};g.resolve=function(a,e){var b="string"===typeof a?a.split("."):
19
- a,d=this,r=0;if(""===b[r]){for(;null!==d.parent;)d=d.parent;r++}do{do{if(!(d instanceof n.Namespace)){d=null;break}d=d.getChild(b[r]);if(!(d&&d instanceof n.T)||e&&!(d instanceof n.Namespace)){d=null;break}r++}while(r<b.length);if(null!=d)break;if(null!==this.parent)return this.parent.resolve(a,e)}while(null!=d);return d};g.qn=function(a){var e=[],b=a;do e.unshift(b.name),b=b.parent;while(null!==b);for(b=1;b<=e.length;b++){var d=e.slice(e.length-b);if(a===this.resolve(d,a instanceof n.Namespace))return d.join(".")}return a.fqn()};
20
- g.build=function(){for(var a={},b=this.children,m=0,c=b.length,r;m<c;++m)r=b[m],r instanceof d&&(a[r.name]=r.build());Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt()});return a};g.buildOpt=function(){for(var a={},b=Object.keys(this.options),d=0,c=b.length;d<c;++d)a[b[d]]=this.options[b[d]];return a};g.getOption=function(a){return"undefined"===typeof a?this.options:"undefined"!==typeof this.options[a]?this.options[a]:null};n.Namespace=d;var k=function(a,e,d,c){this.type=
21
- a;this.resolvedType=e;this.isMapKey=d;this.syntax=c;if(d&&0>b.MAP_KEY_TYPES.indexOf(a))throw Error("Invalid map key type: "+a.name);},f=k.prototype;k.defaultFieldValue=function(a){"string"===typeof a&&(a=b.TYPES[a]);if("undefined"===typeof a.defaultValue)throw Error("default value for type "+a.name+" is not supported");return a==b.TYPES.bytes?new h(0):a.defaultValue};f.verifyValue=function(a){function e(a,b){throw Error("Illegal value for "+d.toString(!0)+" of type "+d.type.name+": "+a+" ("+b+")");
22
- }var d=this;switch(this.type){case b.TYPES.int32:case b.TYPES.sint32:case b.TYPES.sfixed32:return("number"!==typeof a||a===a&&0!==a%1)&&e(typeof a,"not an integer"),4294967295<a?a|0:a;case b.TYPES.uint32:case b.TYPES.fixed32:return("number"!==typeof a||a===a&&0!==a%1)&&e(typeof a,"not an integer"),0>a?a>>>0:a;case b.TYPES.int64:case b.TYPES.sint64:case b.TYPES.sfixed64:if(b.Long)try{return c(a,!1)}catch(f){e(typeof a,f.message)}else e(typeof a,"requires Long.js");case b.TYPES.uint64:case b.TYPES.fixed64:if(b.Long)try{return c(a,
23
- !0)}catch(r){e(typeof a,r.message)}else e(typeof a,"requires Long.js");case b.TYPES.bool:return"boolean"!==typeof a&&e(typeof a,"not a boolean"),a;case b.TYPES["float"]:case b.TYPES["double"]:return"number"!==typeof a&&e(typeof a,"not a number"),a;case b.TYPES.string:return"string"===typeof a||a&&a instanceof String||e(typeof a,"not a string"),""+a;case b.TYPES.bytes:return h.isByteBuffer(a)?a:h.wrap(a,"base64");case b.TYPES["enum"]:for(var v=this.resolvedType.getChildren(b.Reflect.Enum.Value),g=
24
- 0;g<v.length;g++)if(v[g].name==a||v[g].id==a)return v[g].id;if("proto3"===this.syntax)return("number"!==typeof a||a===a&&0!==a%1)&&e(typeof a,"not an integer"),(4294967295<a||0>a)&&e(typeof a,"not in range for uint32"),a;e(a,"not a valid enum value");case b.TYPES.group:case b.TYPES.message:a&&"object"===typeof a||e(typeof a,"object expected");if(a instanceof this.resolvedType.clazz)return a;if(a instanceof b.Builder.Message){var v={},g;for(g in a)a.hasOwnProperty(g)&&(v[g]=a[g]);a=v}return new this.resolvedType.clazz(a)}throw Error("[INTERNAL] Illegal value for "+
25
- this.toString(!0)+": "+a+" (undefined type "+this.type+")");};f.calculateLength=function(a,e){if(null===e)return 0;var d;switch(this.type){case b.TYPES.int32:return 0>e?h.calculateVarint64(e):h.calculateVarint32(e);case b.TYPES.uint32:return h.calculateVarint32(e);case b.TYPES.sint32:return h.calculateVarint32(h.zigZagEncode32(e));case b.TYPES.fixed32:case b.TYPES.sfixed32:case b.TYPES["float"]:return 4;case b.TYPES.int64:case b.TYPES.uint64:return h.calculateVarint64(e);case b.TYPES.sint64:return h.calculateVarint64(h.zigZagEncode64(e));
26
- case b.TYPES.fixed64:case b.TYPES.sfixed64:return 8;case b.TYPES.bool:return 1;case b.TYPES["enum"]:return h.calculateVarint32(e);case b.TYPES["double"]:return 8;case b.TYPES.string:return d=h.calculateUTF8Bytes(e),h.calculateVarint32(d)+d;case b.TYPES.bytes:if(0>e.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+e.remaining()+" bytes remaining");return h.calculateVarint32(e.remaining())+e.remaining();case b.TYPES.message:return d=this.resolvedType.calculate(e),h.calculateVarint32(d)+
27
- d;case b.TYPES.group:return d=this.resolvedType.calculate(e),d+h.calculateVarint32(a<<3|b.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+e+" (unknown type)");};f.encodeValue=function(a,e,d){if(null===e)return d;switch(this.type){case b.TYPES.int32:0>e?d.writeVarint64(e):d.writeVarint32(e);break;case b.TYPES.uint32:d.writeVarint32(e);break;case b.TYPES.sint32:d.writeVarint32ZigZag(e);break;case b.TYPES.fixed32:d.writeUint32(e);break;case b.TYPES.sfixed32:d.writeInt32(e);
28
- break;case b.TYPES.int64:case b.TYPES.uint64:d.writeVarint64(e);break;case b.TYPES.sint64:d.writeVarint64ZigZag(e);break;case b.TYPES.fixed64:d.writeUint64(e);break;case b.TYPES.sfixed64:d.writeInt64(e);break;case b.TYPES.bool:"string"===typeof e?d.writeVarint32("false"===e.toLowerCase()?0:!!e):d.writeVarint32(e?1:0);break;case b.TYPES["enum"]:d.writeVarint32(e);break;case b.TYPES["float"]:d.writeFloat32(e);break;case b.TYPES["double"]:d.writeFloat64(e);break;case b.TYPES.string:d.writeVString(e);
29
- break;case b.TYPES.bytes:if(0>e.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+e.remaining()+" bytes remaining");a=e.offset;d.writeVarint32(e.remaining());d.append(e);e.offset=a;break;case b.TYPES.message:a=(new h).LE();this.resolvedType.encode(e,a);d.writeVarint32(a.offset);d.append(a.flip());break;case b.TYPES.group:this.resolvedType.encode(e,d);d.writeVarint32(a<<3|b.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+
30
- e+" (unknown type)");}return d};f.decode=function(a,e,d){if(e!=this.type.wireType)throw Error("Unexpected wire type for element");switch(this.type){case b.TYPES.int32:return a.readVarint32()|0;case b.TYPES.uint32:return a.readVarint32()>>>0;case b.TYPES.sint32:return a.readVarint32ZigZag()|0;case b.TYPES.fixed32:return a.readUint32()>>>0;case b.TYPES.sfixed32:return a.readInt32()|0;case b.TYPES.int64:return a.readVarint64();case b.TYPES.uint64:return a.readVarint64().toUnsigned();case b.TYPES.sint64:return a.readVarint64ZigZag();
31
- case b.TYPES.fixed64:return a.readUint64();case b.TYPES.sfixed64:return a.readInt64();case b.TYPES.bool:return!!a.readVarint32();case b.TYPES["enum"]:return a.readVarint32();case b.TYPES["float"]:return a.readFloat();case b.TYPES["double"]:return a.readDouble();case b.TYPES.string:return a.readVString();case b.TYPES.bytes:d=a.readVarint32();if(a.remaining()<d)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+d+" required but got only "+a.remaining());e=a.clone();e.limit=e.offset+d;
32
- a.offset+=d;return e;case b.TYPES.message:return d=a.readVarint32(),this.resolvedType.decode(a,d);case b.TYPES.group:return this.resolvedType.decode(a,-1,d)}throw Error("[INTERNAL] Illegal decode type");};f.valueFromString=function(a){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case b.TYPES.int32:case b.TYPES.sint32:case b.TYPES.sfixed32:case b.TYPES.uint32:case b.TYPES.fixed32:return this.verifyValue(parseInt(a));case b.TYPES.int64:case b.TYPES.sint64:case b.TYPES.sfixed64:case b.TYPES.uint64:case b.TYPES.fixed64:return this.verifyValue(a);
33
- case b.TYPES.bool:return"true"===a;case b.TYPES.string:return this.verifyValue(a);case b.TYPES.bytes:return h.fromBinary(a)}};f.valueToString=function(a){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===b.TYPES.bytes?a.toString("binary"):a.toString()};n.Element=k;var t=function(a,b,c,f,r,g){d.call(this,a,b,c,f,g);this.className="Message";this.extensions=void 0;this.clazz=null;this.isGroup=!!r;this._fieldsByName=this._fieldsById=this._fields=null},f=
34
- t.prototype=Object.create(d.prototype);f.build=function(a){if(this.clazz&&!a)return this.clazz;a=function(a,b){function e(b,d,c,f){if(null===b||"object"!==typeof b){if(f&&f instanceof a.Reflect.Enum){var m=a.Reflect.Enum.getName(f.object,b);if(null!==m)return m}return b}if(h.isByteBuffer(b))return d?b.toBase64():b.toBuffer();if(a.Long.isLong(b))return c?b.toString():a.Long.fromValue(b);var g;if(Array.isArray(b))return g=[],b.forEach(function(a,b){g[b]=e(a,d,c,f)}),g;g={};if(b instanceof a.Map){for(var m=
35
- b.entries(),k=m.next();!k.done;k=m.next())g[b.keyElem.valueToString(k.value[0])]=e(k.value[1],d,c,b.valueElem.resolvedType);return g}var m=b.$type,k=void 0,q;for(q in b)b.hasOwnProperty(q)&&(m&&(k=m.getChild(q))?g[q]=e(b[q],d,c,k.resolvedType):g[q]=e(b[q],d,c));return g}var d=b.getChildren(a.Reflect.Message.Field),c=b.getChildren(a.Reflect.Message.OneOf),m=function(e,f){a.Builder.Message.call(this);for(var g=0,k=c.length;g<k;++g)this[c[g].name]=null;g=0;for(k=d.length;g<k;++g){var q=d[g];this[q.name]=
36
- q.repeated?[]:q.map?new a.Map(q):null;!q.required&&"proto3"!==b.syntax||null===q.defaultValue||(this[q.name]=q.defaultValue)}if(0<arguments.length)if(1!==arguments.length||null===e||"object"!==typeof e||!("function"!==typeof e.encode||e instanceof m)||Array.isArray(e)||e instanceof a.Map||h.isByteBuffer(e)||e instanceof ArrayBuffer||a.Long&&e instanceof a.Long)for(g=0,k=arguments.length;g<k;++g)"undefined"!==typeof(q=arguments[g])&&this.$set(d[g].name,q);else this.$set(e)},f=m.prototype=Object.create(a.Builder.Message.prototype);
37
- f.add=function(e,d,c){var f=b._fieldsByName[e];if(!c){if(!f)throw Error(this+"#"+e+" is undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+f.toString(!0));if(!f.repeated)throw Error(this+"#"+e+" is not a repeated field");d=f.verifyValue(d,!0)}null===this[e]&&(this[e]=[]);this[e].push(d);return this};f.$add=f.add;f.set=function(e,d,f){if(e&&"object"===typeof e){f=d;for(var c in e)e.hasOwnProperty(c)&&"undefined"!==typeof(d=e[c])&&this.$set(c,d,f);return this}c=
38
- b._fieldsByName[e];if(f)this[e]=d;else{if(!c)throw Error(this+"#"+e+" is not a field: undefined");if(!(c instanceof a.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+c.toString(!0));this[c.name]=d=c.verifyValue(d)}c&&c.oneof&&(f=this[c.oneof.name],null!==d?(null!==f&&f!==c.name&&(this[f]=null),this[c.oneof.name]=c.name):f===e&&(this[c.oneof.name]=null));return this};f.$set=f.set;f.get=function(e,d){if(d)return this[e];var c=b._fieldsByName[e];if(!(c&&c instanceof a.Reflect.Message.Field))throw Error(this+
39
- "#"+e+" is not a field: undefined");if(!(c instanceof a.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+c.toString(!0));return this[c.name]};f.$get=f.get;for(var g=0;g<d.length;g++){var k=d[g];k instanceof a.Reflect.Message.ExtensionField||b.builder.options.populateAccessors&&function(a){var e=a.originalName.replace(/(_[a-zA-Z])/g,function(a){return a.toUpperCase().replace("_","")}),e=e.substring(0,1).toUpperCase()+e.substring(1),d=a.originalName.replace(/([A-Z])/g,function(a){return"_"+
40
- a}),c=function(b,e){this[a.name]=e?b:a.verifyValue(b);return this},m=function(){return this[a.name]};null===b.getChild("set"+e)&&(f["set"+e]=c);null===b.getChild("set_"+d)&&(f["set_"+d]=c);null===b.getChild("get"+e)&&(f["get"+e]=m);null===b.getChild("get_"+d)&&(f["get_"+d]=m)}(k)}f.encode=function(a,e){"boolean"===typeof a&&(e=a,a=void 0);var d=!1;a||(a=new h,d=!0);var c=a.littleEndian;try{return b.encode(this,a.LE(),e),(d?a.flip():a).LE(c)}catch(f){throw a.LE(c),f;}};m.encode=function(a,b,e){return(new m(a)).encode(b,
41
- e)};f.calculate=function(){return b.calculate(this)};f.encodeDelimited=function(a,e){var d=!1;a||(a=new h,d=!0);var c=(new h).LE();b.encode(this,c,e).flip();a.writeVarint32(c.remaining());a.append(c);return d?a.flip():a};f.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toArrayBuffer()),a;}};f.toArrayBuffer=f.encodeAB;f.encodeNB=function(){try{return this.encode().toBuffer()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toBuffer()),a;}};
42
- f.toBuffer=f.encodeNB;f.encode64=function(){try{return this.encode().toBase64()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toBase64()),a;}};f.toBase64=f.encode64;f.encodeHex=function(){try{return this.encode().toHex()}catch(a){throw a.encoded&&(a.encoded=a.encoded.toHex()),a;}};f.toHex=f.encodeHex;f.toRaw=function(a,b){return e(this,!!a,!!b,this.$type)};f.encodeJSON=function(){return JSON.stringify(e(this,!0,!0,this.$type))};m.decode=function(a,e,d){"string"===typeof e&&(d=e);"string"===typeof a&&
43
- (a=h.wrap(a,d?d:"base64"));a=h.isByteBuffer(a)?a:h.wrap(a);e=a.littleEndian;try{var c=b.decode(a.LE());a.LE(e);return c}catch(f){throw a.LE(e),f;}};m.decodeDelimited=function(a,e){"string"===typeof a&&(a=h.wrap(a,e?e:"base64"));a=h.isByteBuffer(a)?a:h.wrap(a);if(1>a.remaining())return null;var d=a.offset,c=a.readVarint32();if(a.remaining()<c)return a.offset=d,null;try{var f=b.decode(a.slice(a.offset,a.offset+c).LE());a.offset+=c;return f}catch(m){throw a.offset+=c,m;}};m.decode64=function(a){return m.decode(a,
44
- "base64")};m.decodeHex=function(a){return m.decode(a,"hex")};m.decodeJSON=function(a){return new m(JSON.parse(a))};f.toString=function(){return b.toString()};Object.defineProperty&&(Object.defineProperty(m,"$options",{value:b.buildOpt()}),Object.defineProperty(f,"$options",{value:m.$options}),Object.defineProperty(m,"$type",{value:b}),Object.defineProperty(f,"$type",{value:b}));return m}(b,this);this._fields=[];this._fieldsById={};this._fieldsByName={};for(var e=0,d=this.children.length,c;e<d;e++)if(c=
45
- this.children[e],c instanceof x||c instanceof t||c instanceof A){if(a.hasOwnProperty(c.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+c.toString(!0)+" cannot override static property '"+c.name+"'");a[c.name]=c.build()}else if(c instanceof t.Field)c.build(),this._fields.push(c),this._fieldsById[c.id]=c,this._fieldsByName[c.name]=c;else if(!(c instanceof t.OneOf||c instanceof w))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[e].toString(!0));return this.clazz=
46
- a};f.encode=function(a,b,d){for(var c=null,f,g=0,k=this._fields.length,h;g<k;++g)f=this._fields[g],h=a[f.name],f.required&&null===h?null===c&&(c=f):f.encode(d?h:f.verifyValue(h),b,a);if(null!==c)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+c),a.encoded=b,a;return b};f.calculate=function(a){for(var b=0,d=0,c=this._fields.length,f,g;d<c;++d){f=this._fields[d];g=a[f.name];if(f.required&&null===g)throw Error("Missing at least one required field for "+this.toString(!0)+
47
- ": "+f);b+=f.calculate(g,a)}return b};f.decode=function(a,e,d){e="number"===typeof e?e:-1;for(var c=a.offset,f=new this.clazz,g,k,h;a.offset<c+e||-1===e&&0<a.remaining();){g=a.readVarint32();k=g&7;h=g>>>3;if(k===b.WIRE_TYPES.ENDGROUP){if(h!==d)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+h+" ("+(d?d+" expected":"not a group")+")");break}if(g=this._fieldsById[h])g.repeated&&!g.options.packed?f[g.name].push(g.decode(k,a)):g.map?(k=g.decode(k,a),f[g.name].set(k[0],k[1])):(f[g.name]=
48
- g.decode(k,a),g.oneof&&(k=f[g.oneof.name],null!==k&&k!==g.name&&(f[k]=null),f[g.oneof.name]=g.name));else switch(k){case b.WIRE_TYPES.VARINT:a.readVarint32();break;case b.WIRE_TYPES.BITS32:a.offset+=4;break;case b.WIRE_TYPES.BITS64:a.offset+=8;break;case b.WIRE_TYPES.LDELIM:g=a.readVarint32();a.offset+=g;break;case b.WIRE_TYPES.STARTGROUP:for(;s(h,a););break;default:throw Error("Illegal wire type for unknown field "+h+" in "+this.toString(!0)+"#decode: "+k);}}a=0;for(e=this._fields.length;a<e;++a)if(g=
49
- this._fields[a],null===f[g.name])if("proto3"===this.syntax)f[g.name]=g.defaultValue;else{if(g.required)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+g.name),a.decoded=f,a;b.populateDefaults&&null!==g.defaultValue&&(f[g.name]=g.defaultValue)}return f};n.Message=t;var z=function(a,e,d,c,f,g,k,h,w,p){l.call(this,a,e,g);this.className="Message.Field";this.required="required"===d;this.repeated="repeated"===d;this.map="map"===d;this.keyType=c||null;this.type=f;this.resolvedType=
50
- null;this.id=k;this.options=h||{};this.defaultValue=null;this.oneof=w||null;this.syntax=p||"proto2";this.originalName=this.name;this.keyElement=this.element=null;!this.builder.options.convertFieldsToCamelCase||this instanceof t.ExtensionField||(this.name=b.Util.toCamelCase(this.name))},f=z.prototype=Object.create(l.prototype);f.build=function(){this.element=new k(this.type,this.resolvedType,!1,this.syntax);this.map&&(this.keyElement=new k(this.keyType,void 0,!0,this.syntax));"proto3"!==this.syntax||
51
- this.repeated||this.map?"undefined"!==typeof this.options["default"]&&(this.defaultValue=this.verifyValue(this.options["default"])):this.defaultValue=k.defaultFieldValue(this.type)};f.verifyValue=function(a,e){function d(a,b){throw Error("Illegal value for "+c.toString(!0)+" of type "+c.type.name+": "+a+" ("+b+")");}e=e||!1;var c=this;if(null===a)return this.required&&d(typeof a,"required"),"proto3"===this.syntax&&this.type!==b.TYPES.message&&d(typeof a,"proto3 field without field presence cannot be null"),
52
- null;var f;if(this.repeated&&!e){Array.isArray(a)||(a=[a]);var g=[];for(f=0;f<a.length;f++)g.push(this.element.verifyValue(a[f]));return g}if(this.map&&!e){if(a instanceof b.Map)return a;a instanceof Object||d(typeof a,"expected ProtoBuf.Map or raw object for map field");return new b.Map(this,a)}!this.repeated&&Array.isArray(a)&&d(typeof a,"no array expected");return this.element.verifyValue(a)};f.hasWirePresence=function(a,e){if("proto3"!==this.syntax)return null!==a;if(this.oneof&&e[this.oneof.name]===
53
- this.name)return!0;switch(this.type){case b.TYPES.int32:case b.TYPES.sint32:case b.TYPES.sfixed32:case b.TYPES.uint32:case b.TYPES.fixed32:return 0!==a;case b.TYPES.int64:case b.TYPES.sint64:case b.TYPES.sfixed64:case b.TYPES.uint64:case b.TYPES.fixed64:return 0!==a.low||0!==a.high;case b.TYPES.bool:return a;case b.TYPES["float"]:case b.TYPES["double"]:return 0!==a;case b.TYPES.string:return 0<a.length;case b.TYPES.bytes:return 0<a.remaining();case b.TYPES["enum"]:return 0!==a;case b.TYPES.message:return null!==
54
- a;default:return!0}};f.encode=function(a,e,d){if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return e;try{if(this.repeated){var c;if(this.options.packed&&0<=b.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){e.writeVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);e.ensureCapacity(e.offset+=1);var f=e.offset;for(c=0;c<a.length;c++)this.element.encodeValue(this.id,a[c],e);var g=e.offset-
55
- f,k=h.calculateVarint32(g);if(1<k){var w=e.slice(f,e.offset),f=f+(k-1);e.offset=f;e.append(w)}e.writeVarint32(g,f-k)}else for(c=0;c<a.length;c++)e.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a[c],e)}else this.map?a.forEach(function(a,d,c){c=h.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,d)+h.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);e.writeVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);e.writeVarint32(c);
56
- e.writeVarint32(8|this.keyType.wireType);this.keyElement.encodeValue(1,d,e);e.writeVarint32(16|this.type.wireType);this.element.encodeValue(2,a,e)},this):this.hasWirePresence(a,d)&&(e.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+a+" ("+t+")");}return e};f.calculate=function(a,d){a=this.verifyValue(a);if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+
57
- ": "+this.type);if(null===a||this.repeated&&0==a.length)return 0;var c=0;try{if(this.repeated){var f,g;if(this.options.packed&&0<=b.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){c+=h.calculateVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);for(f=g=0;f<a.length;f++)g+=this.element.calculateLength(this.id,a[f]);c+=h.calculateVarint32(g);c+=g}else for(f=0;f<a.length;f++)c+=h.calculateVarint32(this.id<<3|this.type.wireType),c+=this.element.calculateLength(this.id,a[f])}else this.map?a.forEach(function(a,
58
- d,e){a=h.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,d)+h.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);c+=h.calculateVarint32(this.id<<3|b.WIRE_TYPES.LDELIM);c+=h.calculateVarint32(a);c+=a},this):this.hasWirePresence(a,d)&&(c+=h.calculateVarint32(this.id<<3|this.type.wireType),c+=this.element.calculateLength(this.id,a))}catch(k){throw Error("Illegal value for "+this.toString(!0)+": "+a+" ("+k+")");}return c};f.decode=function(a,d,c){if(!(!this.map&&
59
- a==this.type.wireType||!c&&this.repeated&&this.options.packed&&a==b.WIRE_TYPES.LDELIM||this.map&&a==b.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+a+" ("+this.type.wireType+" expected)");if(a==b.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&0<=b.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)&&!c){a=d.readVarint32();a=d.offset+a;for(c=[];d.offset<a;)c.push(this.decode(this.type.wireType,d,!0));return c}if(this.map){var f=k.defaultFieldValue(this.keyType);
60
- c=k.defaultFieldValue(this.type);a=d.readVarint32();if(d.remaining()<a)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+a+" required but got only "+d.remaining());var g=d.clone();g.limit=g.offset+a;for(d.offset+=a;0<g.remaining();)if(d=g.readVarint32(),a=d&7,d>>>=3,1===d)f=this.keyElement.decode(g,a,d);else if(2===d)c=this.element.decode(g,a,d);else throw Error("Unexpected tag in map field key/value submessage");return[f,c]}return this.element.decode(d,a,this.id)};n.Message.Field=
61
- z;f=function(a,d,b,c,f,g,k){z.call(this,a,d,b,null,c,f,g,k)};f.prototype=Object.create(z.prototype);n.Message.ExtensionField=f;n.Message.OneOf=function(a,d,b){l.call(this,a,d,b);this.fields=[]};var x=function(a,b,c,f,g){d.call(this,a,b,c,f,g);this.className="Enum";this.object=null};x.getName=function(a,d){for(var b=Object.keys(a),c=0,f;c<b.length;++c)if(a[f=b[c]]===d)return f;return null};(x.prototype=Object.create(d.prototype)).build=function(a){if(this.object&&!a)return this.object;a=new b.Builder.Enum;
62
- for(var d=this.getChildren(x.Value),c=0,f=d.length;c<f;++c)a[d[c].name]=d[c].id;Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt(),enumerable:!1});return this.object=a};n.Enum=x;f=function(a,d,b,c){l.call(this,a,d,b);this.className="Enum.Value";this.id=c};f.prototype=Object.create(l.prototype);n.Enum.Value=f;var w=function(a,d,b,c){l.call(this,a,d,b);this.field=c};w.prototype=Object.create(l.prototype);n.Extension=w;var A=function(a,b,c,f){d.call(this,a,b,c,f);this.className=
63
- "Service";this.clazz=null};(A.prototype=Object.create(d.prototype)).build=function(a){return this.clazz&&!a?this.clazz:this.clazz=function(a,d){for(var b=function(b){a.Builder.Service.call(this);this.rpcImpl=b||function(a,b,d){setTimeout(d.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},c=b.prototype=Object.create(a.Builder.Service.prototype),f=d.getChildren(a.Reflect.Service.RPCMethod),g=0;g<f.length;g++)(function(a){c[a.name]=function(b,c){try{try{b=
64
- a.resolvedRequestType.clazz.decode(h.wrap(b))}catch(e){if(!(e instanceof TypeError))throw e;}if(null===b||"object"!==typeof b)throw Error("Illegal arguments");b instanceof a.resolvedRequestType.clazz||(b=new a.resolvedRequestType.clazz(b));this.rpcImpl(a.fqn(),b,function(b,e){if(b)c(b);else{null===e&&(e="");try{e=a.resolvedResponseType.clazz.decode(e)}catch(f){}e&&e instanceof a.resolvedResponseType.clazz?c(null,e):c(Error("Illegal response type received in service method "+d.name+"#"+a.name))}})}catch(f){setTimeout(c.bind(this,
65
- f),0)}};b[a.name]=function(d,c,e){(new b(d))[a.name](c,e)};Object.defineProperty&&(Object.defineProperty(b[a.name],"$options",{value:a.buildOpt()}),Object.defineProperty(c[a.name],"$options",{value:b[a.name].$options}))})(f[g]);Object.defineProperty&&(Object.defineProperty(b,"$options",{value:d.buildOpt()}),Object.defineProperty(c,"$options",{value:b.$options}),Object.defineProperty(b,"$type",{value:d}),Object.defineProperty(c,"$type",{value:d}));return b}(b,this)};n.Service=A;var u=function(a,b,
66
- d,c){l.call(this,a,b,d);this.className="Service.Method";this.options=c||{}};(u.prototype=Object.create(l.prototype)).buildOpt=g.buildOpt;n.Service.Method=u;g=function(a,b,d,c,f,g,k,h){u.call(this,a,b,d,h);this.className="Service.RPCMethod";this.requestName=c;this.responseName=f;this.requestStream=g;this.responseStream=k;this.resolvedResponseType=this.resolvedRequestType=null};g.prototype=Object.create(u.prototype);n.Service.RPCMethod=g;return n}(c);c.Builder=function(b,c,h){function n(b){b.messages&&
67
- b.messages.forEach(function(c){c.syntax=b.syntax;n(c)});b.enums&&b.enums.forEach(function(c){c.syntax=b.syntax})}var l=function(b){this.ptr=this.ns=new h.Namespace(this,null,"");this.resolved=!1;this.result=null;this.files={};this.importRoot=null;this.options=b||{}},g=l.prototype;l.isMessage=function(b){return"string"!==typeof b.name||"undefined"!==typeof b.values||"undefined"!==typeof b.rpc?!1:!0};l.isMessageField=function(b){return"string"!==typeof b.rule||"string"!==typeof b.name||"string"!==typeof b.type||
68
- "undefined"===typeof b.id?!1:!0};l.isEnum=function(b){return"string"===typeof b.name&&"undefined"!==typeof b.values&&Array.isArray(b.values)&&0!==b.values.length?!0:!1};l.isService=function(b){return"string"===typeof b.name&&"object"===typeof b.rpc&&b.rpc?!0:!1};l.isExtend=function(b){return"string"!==typeof b.ref?!1:!0};g.reset=function(){this.ptr=this.ns;return this};g.define=function(b){if("string"!==typeof b||!c.TYPEREF.test(b))throw Error("illegal namespace: "+b);b.split(".").forEach(function(b){var d=
69
- this.ptr.getChild(b);null===d&&this.ptr.addChild(d=new h.Namespace(this,this.ptr,b));this.ptr=d},this);return this};g.create=function(d){if(!d)return this;if(Array.isArray(d)){if(0===d.length)return this;d=d.slice()}else d=[d];for(var c=[d];0<c.length;){d=c.pop();if(!Array.isArray(d))throw Error("not a valid namespace: "+JSON.stringify(d));for(;0<d.length;){var f=d.shift();if(l.isMessage(f)){var g=new h.Message(this,this.ptr,f.name,f.options,f.isGroup,f.syntax),n={};f.oneofs&&Object.keys(f.oneofs).forEach(function(b){g.addChild(n[b]=
70
- new h.Message.OneOf(this,g,b))},this);f.fields&&f.fields.forEach(function(b){if(null!==g.getChild(b.id|0))throw Error("duplicate or invalid field id in "+g.name+": "+b.id);if(b.options&&"object"!==typeof b.options)throw Error("illegal field options in "+g.name+"#"+b.name);var d=null;if("string"===typeof b.oneof&&!(d=n[b.oneof]))throw Error("illegal oneof in "+g.name+"#"+b.name+": "+b.oneof);b=new h.Message.Field(this,g,b.rule,b.keytype,b.type,b.name,b.id,b.options,d,f.syntax);d&&d.fields.push(b);
71
- g.addChild(b)},this);var p=[];f.enums&&f.enums.forEach(function(b){p.push(b)});f.messages&&f.messages.forEach(function(b){p.push(b)});f.services&&f.services.forEach(function(b){p.push(b)});f.extensions&&(g.extensions="number"===typeof f.extensions[0]?[f.extensions]:f.extensions);this.ptr.addChild(g);if(0<p.length){c.push(d);d=p;p=null;this.ptr=g;g=null;continue}p=null}else if(l.isEnum(f))g=new h.Enum(this,this.ptr,f.name,f.options,f.syntax),f.values.forEach(function(b){g.addChild(new h.Enum.Value(this,
72
- g,b.name,b.id))},this),this.ptr.addChild(g);else if(l.isService(f))g=new h.Service(this,this.ptr,f.name,f.options),Object.keys(f.rpc).forEach(function(b){var d=f.rpc[b];g.addChild(new h.Service.RPCMethod(this,g,b,d.request,d.response,!!d.request_stream,!!d.response_stream,d.options))},this),this.ptr.addChild(g);else if(l.isExtend(f))if(g=this.ptr.resolve(f.ref,!0))f.fields.forEach(function(d){if(null!==g.getChild(d.id|0))throw Error("duplicate extended field id in "+g.name+": "+d.id);if(g.extensions){var c=
73
- !1;g.extensions.forEach(function(a){d.id>=a[0]&&d.id<=a[1]&&(c=!0)});if(!c)throw Error("illegal extended field id in "+g.name+": "+d.id+" (not within valid ranges)");}var f=d.name;this.options.convertFieldsToCamelCase&&(f=b.Util.toCamelCase(f));var f=new h.Message.ExtensionField(this,g,d.rule,d.type,this.ptr.fqn()+"."+f,d.id,d.options),a=new h.Extension(this,this.ptr,d.name,f);f.extension=a;this.ptr.addChild(a);g.addChild(f)},this);else{if(!/\.?google\.protobuf\./.test(f.ref))throw Error("extended message "+
74
- f.ref+" is not defined");}else throw Error("not a valid definition: "+JSON.stringify(f));g=f=null}d=null;this.ptr=this.ptr.parent}this.resolved=!1;this.result=null;return this};g["import"]=function(d,c){var f="/";if("string"===typeof c){b.Util.IS_NODE&&(c=require("path").resolve(c));if(!0===this.files[c])return this.reset();this.files[c]=!0}else if("object"===typeof c){var g=c.root;b.Util.IS_NODE&&(g=require("path").resolve(g));if(0<=g.indexOf("\\")||0<=c.file.indexOf("\\"))f="\\";g=g+f+c.file;if(!0===
75
- this.files[g])return this.reset();this.files[g]=!0}if(d.imports&&0<d.imports.length){var h=!1;if("object"===typeof c){if(this.importRoot=c.root,h=!0,g=this.importRoot,c=c.file,0<=g.indexOf("\\")||0<=c.indexOf("\\"))f="\\"}else"string"===typeof c?this.importRoot?g=this.importRoot:0<=c.indexOf("/")?(g=c.replace(/\/[^\/]*$/,""),""===g&&(g="/")):0<=c.indexOf("\\")?(g=c.replace(/\\[^\\]*$/,""),f="\\"):g=".":g=null;for(var l=0;l<d.imports.length;l++)if("string"===typeof d.imports[l]){if(!g)throw Error("cannot determine import root");
76
- var p=d.imports[l];if("google/protobuf/descriptor.proto"!==p&&(p=g+f+p,!0!==this.files[p])){/\.proto$/i.test(p)&&!b.DotProto&&(p=p.replace(/\.proto$/,".json"));var s=b.Util.fetch(p);if(null===s)throw Error("failed to import '"+p+"' in '"+c+"': file not found");if(/\.json$/i.test(p))this["import"](JSON.parse(s+""),p);else this["import"](b.DotProto.Parser.parse(s),p)}}else if(c)if(/\.(\w+)$/.test(c))this["import"](d.imports[l],c.replace(/^(.+)\.(\w+)$/,function(a,b,d){return b+"_import"+l+"."+d}));
77
- else this["import"](d.imports[l],c+"_import"+l);else this["import"](d.imports[l]);h&&(this.importRoot=null)}d["package"]&&this.define(d["package"]);d.syntax&&n(d);var u=this.ptr;d.options&&Object.keys(d.options).forEach(function(a){u.options[a]=d.options[a]});d.messages&&(this.create(d.messages),this.ptr=u);d.enums&&(this.create(d.enums),this.ptr=u);d.services&&(this.create(d.services),this.ptr=u);d["extends"]&&this.create(d["extends"]);return this.reset()};g.resolveAll=function(){var d;if(null==
78
- this.ptr||"object"===typeof this.ptr.type)return this;if(this.ptr instanceof h.Namespace)this.ptr.children.forEach(function(b){this.ptr=b;this.resolveAll()},this);else if(this.ptr instanceof h.Message.Field){if(c.TYPE.test(this.ptr.type))this.ptr.type=b.TYPES[this.ptr.type];else{if(!c.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);d=(this.ptr instanceof h.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,
79
- !0);if(!d)throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.resolvedType=d;if(d instanceof h.Enum){if(this.ptr.type=b.TYPES["enum"],"proto3"===this.ptr.syntax&&"proto3"!==d.syntax)throw Error("proto3 message cannot reference proto2 enum");}else if(d instanceof h.Message)this.ptr.type=d.isGroup?b.TYPES.group:b.TYPES.message;else throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);}if(this.ptr.map){if(!c.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+
80
- this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=b.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof b.Reflect.Service.Method)if(this.ptr instanceof b.Reflect.Service.RPCMethod){d=this.ptr.parent.resolve(this.ptr.requestName,!0);if(!(d&&d instanceof b.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);this.ptr.resolvedRequestType=d;d=this.ptr.parent.resolve(this.ptr.responseName,!0);if(!(d&&d instanceof b.Reflect.Message))throw Error("Illegal type reference in "+
81
- this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=d}else throw Error("illegal service type in "+this.ptr.toString(!0));else if(!(this.ptr instanceof b.Reflect.Message.OneOf||this.ptr instanceof b.Reflect.Extension||this.ptr instanceof b.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()};g.build=function(b){this.reset();this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null);null===this.result&&
82
- (this.result=this.ns.build());if(!b)return this.result;b="string"===typeof b?b.split("."):b;for(var c=this.result,g=0;g<b.length;g++)if(c[b[g]])c=c[b[g]];else{c=null;break}return c};g.lookup=function(b,c){return b?this.ns.resolve(b,c):this.ns};g.toString=function(){return"Builder"};l.Message=function(){};l.Enum=function(){};l.Service=function(){};return l}(c,c.Lang,c.Reflect);c.Map=function(b,c){function h(b){var c=0;return{next:function(){return c<b.length?{done:!1,value:b[c++]}:{done:!0}}}}var n=
83
- function(b,d){if(!b.map)throw Error("field is not a map");this.field=b;this.keyElem=new c.Element(b.keyType,null,!0,b.syntax);this.valueElem=new c.Element(b.type,b.resolvedType,!1,b.syntax);this.map={};Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}});if(d)for(var h=Object.keys(d),f=0;f<h.length;f++){var l=this.keyElem.valueFromString(h[f]),n=this.valueElem.verifyValue(d[h[f]]);this.map[this.keyElem.valueToString(l)]={key:l,value:n}}},l=n.prototype;l.clear=function(){this.map=
84
- {}};l["delete"]=function(b){b=this.keyElem.valueToString(this.keyElem.verifyValue(b));var c=b in this.map;delete this.map[b];return c};l.entries=function(){for(var b=[],c=Object.keys(this.map),k=0,f;k<c.length;k++)b.push([(f=this.map[c[k]]).key,f.value]);return h(b)};l.keys=function(){for(var b=[],c=Object.keys(this.map),k=0;k<c.length;k++)b.push(this.map[c[k]].key);return h(b)};l.values=function(){for(var b=[],c=Object.keys(this.map),k=0;k<c.length;k++)b.push(this.map[c[k]].value);return h(b)};l.forEach=
85
- function(b,c){for(var h=Object.keys(this.map),f=0,l;f<h.length;f++)b.call(c,(l=this.map[h[f]]).value,l.key,this)};l.set=function(b,c){var h=this.keyElem.verifyValue(b),f=this.valueElem.verifyValue(c);this.map[this.keyElem.valueToString(h)]={key:h,value:f};return this};l.get=function(b){b=this.keyElem.valueToString(this.keyElem.verifyValue(b));return b in this.map?this.map[b].value:void 0};l.has=function(b){return this.keyElem.valueToString(this.keyElem.verifyValue(b))in this.map};return n}(c,c.Reflect);
86
- c.newBuilder=function(b){b=b||{};"undefined"===typeof b.convertFieldsToCamelCase&&(b.convertFieldsToCamelCase=c.convertFieldsToCamelCase);"undefined"===typeof b.populateAccessors&&(b.populateAccessors=c.populateAccessors);return new c.Builder(b)};c.loadJson=function(b,h,s){if("string"===typeof h||h&&"string"===typeof h.file&&"string"===typeof h.root)s=h,h=null;h&&"object"===typeof h||(h=c.newBuilder());"string"===typeof b&&(b=JSON.parse(b));h["import"](b,s);h.resolveAll();return h};c.loadJsonFile=
87
- function(b,h,s){h&&"object"===typeof h?(s=h,h=null):h&&"function"===typeof h||(h=null);if(h)return c.Util.fetch("string"===typeof b?b:b.root+"/"+b.file,function(l){if(null===l)h(Error("Failed to fetch file"));else try{h(null,c.loadJson(JSON.parse(l),s,b))}catch(g){h(g)}});var n=c.Util.fetch("object"===typeof b?b.root+"/"+b.file:b);return null===n?null:c.loadJson(JSON.parse(n),s,b)};return c});
20
+ BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g};d.Reflect=function(c){function d(a,g){if(a&&"number"===typeof a.low&&"number"===typeof a.high&&"boolean"===typeof a.unsigned&&a.low===a.low&&a.high===a.high)return new c.Long(a.low,a.high,"undefined"===
21
+ typeof g?a.unsigned:g);if("string"===typeof a)return c.Long.fromString(a,g||!1,10);if("number"===typeof a)return c.Long.fromNumber(a,g||!1);throw Error("not convertible to Long");}function z(a,g){var h=g.readVarint32(),b=h&7,h=h>>>3;switch(b){case c.WIRE_TYPES.VARINT:do h=g.readUint8();while(128===(h&128));break;case c.WIRE_TYPES.BITS64:g.offset+=8;break;case c.WIRE_TYPES.LDELIM:h=g.readVarint32();g.offset+=h;break;case c.WIRE_TYPES.STARTGROUP:z(h,g);break;case c.WIRE_TYPES.ENDGROUP:if(h===a)return!1;
22
+ throw Error("Illegal GROUPEND after unknown group: "+h+" ("+a+" expected)");case c.WIRE_TYPES.BITS32:g.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+a+": "+b);}return!0}var r={},k=function(a,g,c){this.builder=a;this.parent=g;this.name=c},l=k.prototype;l.fqn=function(){var a=this.name,g=this;do{g=g.parent;if(null==g)break;a=g.name+"."+a}while(1);return a};l.toString=function(a){return(a?this.className+" ":"")+this.fqn()};l.build=function(){throw Error(this.toString(!0)+
23
+ " cannot be built directly");};r.T=k;var b=function(a,g,c,b,e){k.call(this,a,g,c);this.className="Namespace";this.children=[];this.options=b||{};this.syntax=e||"proto2"},l=b.prototype=Object.create(k.prototype);l.getChildren=function(a){a=a||null;if(null==a)return this.children.slice();for(var g=[],c=0,b=this.children.length;c<b;++c)this.children[c]instanceof a&&g.push(this.children[c]);return g};l.addChild=function(a){var c;if(c=this.getChild(a.name))if(c instanceof u.Field&&c.name!==c.originalName&&
24
+ null===this.getChild(c.originalName))c.name=c.originalName;else if(a instanceof u.Field&&a.name!==a.originalName&&null===this.getChild(a.originalName))a.name=a.originalName;else throw Error("Duplicate name in namespace "+this.toString(!0)+": "+a.name);this.children.push(a)};l.getChild=function(a){for(var c="number"===typeof a?"id":"name",h=0,b=this.children.length;h<b;++h)if(this.children[h][c]===a)return this.children[h];return null};l.resolve=function(a,c){var g="string"===typeof a?a.split("."):
25
+ a,b=this,e=0;if(""===g[e]){for(;null!==b.parent;)b=b.parent;e++}do{do{if(!(b instanceof r.Namespace)){b=null;break}b=b.getChild(g[e]);if(!(b&&b instanceof r.T)||c&&!(b instanceof r.Namespace)){b=null;break}e++}while(e<g.length);if(null!=b)break;if(null!==this.parent)return this.parent.resolve(a,c)}while(null!=b);return b};l.qn=function(a){var c=[],b=a;do c.unshift(b.name),b=b.parent;while(null!==b);for(b=1;b<=c.length;b++){var e=c.slice(c.length-b);if(a===this.resolve(e,a instanceof r.Namespace))return e.join(".")}return a.fqn()};
26
+ l.build=function(){for(var a={},c=this.children,h=0,e=c.length,d;h<e;++h)d=c[h],d instanceof b&&(a[d.name]=d.build());Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt()});return a};l.buildOpt=function(){for(var a={},c=Object.keys(this.options),b=0,e=c.length;b<e;++b)a[c[b]]=this.options[c[b]];return a};l.getOption=function(a){return"undefined"===typeof a?this.options:"undefined"!==typeof this.options[a]?this.options[a]:null};r.Namespace=b;var m=function(a,g,b,e,d){this.type=
27
+ a;this.resolvedType=g;this.isMapKey=b;this.syntax=e;this.name=d;if(b&&0>c.MAP_KEY_TYPES.indexOf(a))throw Error("Invalid map key type: "+a.name);},f=m.prototype;m.defaultFieldValue=function(a){"string"===typeof a&&(a=c.TYPES[a]);if("undefined"===typeof a.defaultValue)throw Error("default value for type "+a.name+" is not supported");return a==c.TYPES.bytes?new e(0):a.defaultValue};f.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"};f.verifyValue=function(a){function g(a,
28
+ c){throw Error("Illegal value for "+b.toString(!0)+" of type "+b.type.name+": "+a+" ("+c+")");}var b=this;switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),4294967295<a?a|0:a;case c.TYPES.uint32:case c.TYPES.fixed32:return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),0>a?a>>>0:a;case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:if(c.Long)try{return d(a,!1)}catch(w){g(typeof a,
29
+ w.message)}else g(typeof a,"requires Long.js");case c.TYPES.uint64:case c.TYPES.fixed64:if(c.Long)try{return d(a,!0)}catch(w){g(typeof a,w.message)}else g(typeof a,"requires Long.js");case c.TYPES.bool:return"boolean"!==typeof a&&g(typeof a,"not a boolean"),a;case c.TYPES["float"]:case c.TYPES["double"]:return"number"!==typeof a&&g(typeof a,"not a number"),a;case c.TYPES.string:return"string"===typeof a||a&&a instanceof String||g(typeof a,"not a string"),""+a;case c.TYPES.bytes:return e.isByteBuffer(a)?
30
+ a:e.wrap(a,"base64");case c.TYPES["enum"]:for(var v=this.resolvedType.getChildren(c.Reflect.Enum.Value),q=0;q<v.length;q++)if(v[q].name==a||v[q].id==a)return v[q].id;if("proto3"===this.syntax)return("number"!==typeof a||a===a&&0!==a%1)&&g(typeof a,"not an integer"),(4294967295<a||0>a)&&g(typeof a,"not in range for uint32"),a;g(a,"not a valid enum value");case c.TYPES.group:case c.TYPES.message:a&&"object"===typeof a||g(typeof a,"object expected");if(a instanceof this.resolvedType.clazz)return a;if(a instanceof
31
+ c.Builder.Message){var v={},q;for(q in a)a.hasOwnProperty(q)&&(v[q]=a[q]);a=v}return new this.resolvedType.clazz(a)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+a+" (undefined type "+this.type+")");};f.calculateLength=function(a,g){if(null===g)return 0;var b;switch(this.type){case c.TYPES.int32:return 0>g?e.calculateVarint64(g):e.calculateVarint32(g);case c.TYPES.uint32:return e.calculateVarint32(g);case c.TYPES.sint32:return e.calculateVarint32(e.zigZagEncode32(g));case c.TYPES.fixed32:case c.TYPES.sfixed32:case c.TYPES["float"]:return 4;
32
+ case c.TYPES.int64:case c.TYPES.uint64:return e.calculateVarint64(g);case c.TYPES.sint64:return e.calculateVarint64(e.zigZagEncode64(g));case c.TYPES.fixed64:case c.TYPES.sfixed64:return 8;case c.TYPES.bool:return 1;case c.TYPES["enum"]:return e.calculateVarint32(g);case c.TYPES["double"]:return 8;case c.TYPES.string:return b=e.calculateUTF8Bytes(g),e.calculateVarint32(b)+b;case c.TYPES.bytes:if(0>g.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+g.remaining()+" bytes remaining");
33
+ return e.calculateVarint32(g.remaining())+g.remaining();case c.TYPES.message:return b=this.resolvedType.calculate(g),e.calculateVarint32(b)+b;case c.TYPES.group:return b=this.resolvedType.calculate(g),b+e.calculateVarint32(a<<3|c.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+g+" (unknown type)");};f.encodeValue=function(a,g,b){if(null===g)return b;switch(this.type){case c.TYPES.int32:0>g?b.writeVarint64(g):b.writeVarint32(g);break;case c.TYPES.uint32:b.writeVarint32(g);
34
+ break;case c.TYPES.sint32:b.writeVarint32ZigZag(g);break;case c.TYPES.fixed32:b.writeUint32(g);break;case c.TYPES.sfixed32:b.writeInt32(g);break;case c.TYPES.int64:case c.TYPES.uint64:b.writeVarint64(g);break;case c.TYPES.sint64:b.writeVarint64ZigZag(g);break;case c.TYPES.fixed64:b.writeUint64(g);break;case c.TYPES.sfixed64:b.writeInt64(g);break;case c.TYPES.bool:"string"===typeof g?b.writeVarint32("false"===g.toLowerCase()?0:!!g):b.writeVarint32(g?1:0);break;case c.TYPES["enum"]:b.writeVarint32(g);
35
+ break;case c.TYPES["float"]:b.writeFloat32(g);break;case c.TYPES["double"]:b.writeFloat64(g);break;case c.TYPES.string:b.writeVString(g);break;case c.TYPES.bytes:if(0>g.remaining())throw Error("Illegal value for "+this.toString(!0)+": "+g.remaining()+" bytes remaining");a=g.offset;b.writeVarint32(g.remaining());b.append(g);g.offset=a;break;case c.TYPES.message:a=(new e).LE();this.resolvedType.encode(g,a);b.writeVarint32(a.offset);b.append(a.flip());break;case c.TYPES.group:this.resolvedType.encode(g,
36
+ b);b.writeVarint32(a<<3|c.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+g+" (unknown type)");}return b};f.decode=function(a,b,e){if(b!=this.type.wireType)throw Error("Unexpected wire type for element");switch(this.type){case c.TYPES.int32:return a.readVarint32()|0;case c.TYPES.uint32:return a.readVarint32()>>>0;case c.TYPES.sint32:return a.readVarint32ZigZag()|0;case c.TYPES.fixed32:return a.readUint32()>>>0;case c.TYPES.sfixed32:return a.readInt32()|
37
+ 0;case c.TYPES.int64:return a.readVarint64();case c.TYPES.uint64:return a.readVarint64().toUnsigned();case c.TYPES.sint64:return a.readVarint64ZigZag();case c.TYPES.fixed64:return a.readUint64();case c.TYPES.sfixed64:return a.readInt64();case c.TYPES.bool:return!!a.readVarint32();case c.TYPES["enum"]:return a.readVarint32();case c.TYPES["float"]:return a.readFloat();case c.TYPES["double"]:return a.readDouble();case c.TYPES.string:return a.readVString();case c.TYPES.bytes:e=a.readVarint32();if(a.remaining()<
38
+ e)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+e+" required but got only "+a.remaining());b=a.clone();b.limit=b.offset+e;a.offset+=e;return b;case c.TYPES.message:return e=a.readVarint32(),this.resolvedType.decode(a,e);case c.TYPES.group:return this.resolvedType.decode(a,-1,e)}throw Error("[INTERNAL] Illegal decode type");};f.valueFromString=function(a){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:case c.TYPES.uint32:case c.TYPES.fixed32:return this.verifyValue(parseInt(a));
39
+ case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:case c.TYPES.uint64:case c.TYPES.fixed64:return this.verifyValue(a);case c.TYPES.bool:return"true"===a;case c.TYPES.string:return this.verifyValue(a);case c.TYPES.bytes:return e.fromBinary(a)}};f.valueToString=function(a){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===c.TYPES.bytes?a.toString("binary"):a.toString()};r.Element=m;var u=function(a,c,e,d,q,f){b.call(this,a,c,e,d,f);this.className=
40
+ "Message";this.extensions=void 0;this.clazz=null;this.isGroup=!!q;this._fieldsByName=this._fieldsById=this._fields=null},f=u.prototype=Object.create(b.prototype);f.build=function(a){if(this.clazz&&!a)return this.clazz;a=function(a,c){function b(c,g,f,d){if(null===c||"object"!==typeof c){if(d&&d instanceof a.Reflect.Enum){var h=a.Reflect.Enum.getName(d.object,c);if(null!==h)return h}return c}if(e.isByteBuffer(c))return g?c.toBase64():c.toBuffer();if(a.Long.isLong(c))return f?c.toString():a.Long.fromValue(c);
41
+ var n;if(Array.isArray(c))return n=[],c.forEach(function(a,c){n[c]=b(a,g,f,d)}),n;n={};if(c instanceof a.Map){for(var h=c.entries(),m=h.next();!m.done;m=h.next())n[c.keyElem.valueToString(m.value[0])]=b(m.value[1],g,f,c.valueElem.resolvedType);return n}var h=c.$type,m=void 0,q;for(q in c)c.hasOwnProperty(q)&&(h&&(m=h.getChild(q))?n[q]=b(c[q],g,f,m.resolvedType):n[q]=b(c[q],g,f));return n}var g=c.getChildren(a.Reflect.Message.Field),d=c.getChildren(a.Reflect.Message.OneOf),f=function(b,h){a.Builder.Message.call(this);
42
+ for(var n=0,m=d.length;n<m;++n)this[d[n].name]=null;n=0;for(m=g.length;n<m;++n){var q=g[n];this[q.name]=q.repeated?[]:q.map?new a.Map(q):null;!q.required&&"proto3"!==c.syntax||null===q.defaultValue||(this[q.name]=q.defaultValue)}if(0<arguments.length)if(1!==arguments.length||null===b||"object"!==typeof b||!("function"!==typeof b.encode||b instanceof f)||Array.isArray(b)||b instanceof a.Map||e.isByteBuffer(b)||b instanceof ArrayBuffer||a.Long&&b instanceof a.Long)for(n=0,m=arguments.length;n<m;++n)"undefined"!==
43
+ typeof(q=arguments[n])&&this.$set(g[n].name,q);else this.$set(b)},h=f.prototype=Object.create(a.Builder.Message.prototype);h.add=function(b,g,e){var f=c._fieldsByName[b];if(!e){if(!f)throw Error(this+"#"+b+" is undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: "+f.toString(!0));if(!f.repeated)throw Error(this+"#"+b+" is not a repeated field");g=f.verifyValue(g,!0)}null===this[b]&&(this[b]=[]);this[b].push(g);return this};h.$add=h.add;h.set=function(b,
44
+ g,e){if(b&&"object"===typeof b){e=g;for(var f in b)b.hasOwnProperty(f)&&"undefined"!==typeof(g=b[f])&&void 0===c._oneofsByName[f]&&this.$set(f,g,e);return this}f=c._fieldsByName[b];if(e)this[b]=g;else{if(!f)throw Error(this+"#"+b+" is not a field: undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: "+f.toString(!0));this[f.name]=g=f.verifyValue(g)}f&&f.oneof&&(e=this[f.oneof.name],null!==g?(null!==e&&e!==f.name&&(this[e]=null),this[f.oneof.name]=f.name):
45
+ e===b&&(this[f.oneof.name]=null));return this};h.$set=h.set;h.get=function(b,g){if(g)return this[b];var f=c._fieldsByName[b];if(!(f&&f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: undefined");if(!(f instanceof a.Reflect.Message.Field))throw Error(this+"#"+b+" is not a field: "+f.toString(!0));return this[f.name]};h.$get=h.get;for(var m=0;m<g.length;m++){var q=g[m];q instanceof a.Reflect.Message.ExtensionField||c.builder.options.populateAccessors&&function(a){var b=
46
+ a.originalName.replace(/(_[a-zA-Z])/g,function(a){return a.toUpperCase().replace("_","")}),b=b.substring(0,1).toUpperCase()+b.substring(1),g=a.originalName.replace(/([A-Z])/g,function(a){return"_"+a}),f=function(c,b){this[a.name]=b?c:a.verifyValue(c);return this},e=function(){return this[a.name]};null===c.getChild("set"+b)&&(h["set"+b]=f);null===c.getChild("set_"+g)&&(h["set_"+g]=f);null===c.getChild("get"+b)&&(h["get"+b]=e);null===c.getChild("get_"+g)&&(h["get_"+g]=e)}(q)}h.encode=function(a,b){"boolean"===
47
+ typeof a&&(b=a,a=void 0);var g=!1;a||(a=new e,g=!0);var f=a.littleEndian;try{return c.encode(this,a.LE(),b),(g?a.flip():a).LE(f)}catch(C){throw a.LE(f),C;}};f.encode=function(a,c,b){return(new f(a)).encode(c,b)};h.calculate=function(){return c.calculate(this)};h.encodeDelimited=function(a,b){var g=!1;a||(a=new e,g=!0);var f=(new e).LE();c.encode(this,f,b).flip();a.writeVarint32(f.remaining());a.append(f);return g?a.flip():a};h.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(n){throw n.encoded&&
48
+ (n.encoded=n.encoded.toArrayBuffer()),n;}};h.toArrayBuffer=h.encodeAB;h.encodeNB=function(){try{return this.encode().toBuffer()}catch(n){throw n.encoded&&(n.encoded=n.encoded.toBuffer()),n;}};h.toBuffer=h.encodeNB;h.encode64=function(){try{return this.encode().toBase64()}catch(n){throw n.encoded&&(n.encoded=n.encoded.toBase64()),n;}};h.toBase64=h.encode64;h.encodeHex=function(){try{return this.encode().toHex()}catch(n){throw n.encoded&&(n.encoded=n.encoded.toHex()),n;}};h.toHex=h.encodeHex;h.toRaw=
49
+ function(a,c){return b(this,!!a,!!c,this.$type)};h.encodeJSON=function(){return JSON.stringify(b(this,!0,!0,this.$type))};f.decode=function(a,b,g){"string"===typeof b&&(g=b,b=-1);"string"===typeof a?a=e.wrap(a,g?g:"base64"):e.isByteBuffer(a)||(a=e.wrap(a));g=a.littleEndian;try{var f=c.decode(a.LE(),b);a.LE(g);return f}catch(C){throw a.LE(g),C;}};f.decodeDelimited=function(a,b){"string"===typeof a?a=e.wrap(a,b?b:"base64"):e.isByteBuffer(a)||(a=e.wrap(a));if(1>a.remaining())return null;var g=a.offset,
50
+ f=a.readVarint32();if(a.remaining()<f)return a.offset=g,null;try{var h=c.decode(a.slice(a.offset,a.offset+f).LE());a.offset+=f;return h}catch(E){throw a.offset+=f,E;}};f.decode64=function(a){return f.decode(a,"base64")};f.decodeHex=function(a){return f.decode(a,"hex")};f.decodeJSON=function(a){return new f(JSON.parse(a))};h.toString=function(){return c.toString()};Object.defineProperty&&(Object.defineProperty(f,"$options",{value:c.buildOpt()}),Object.defineProperty(h,"$options",{value:f.$options}),
51
+ Object.defineProperty(f,"$type",{value:c}),Object.defineProperty(h,"$type",{value:c}));return f}(c,this);this._fields=[];this._fieldsById={};this._fieldsByName={};this._oneofsByName={};for(var b=0,d=this.children.length,f;b<d;b++)if(f=this.children[b],f instanceof x||f instanceof u||f instanceof D){if(a.hasOwnProperty(f.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+f.toString(!0)+" cannot override static property '"+f.name+"'");a[f.name]=f.build()}else if(f instanceof u.Field)f.build(),
52
+ this._fields.push(f),this._fieldsById[f.id]=f,this._fieldsByName[f.name]=f;else if(f instanceof u.OneOf)this._oneofsByName[f.name]=f;else if(!(f instanceof u.OneOf||f instanceof y))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[b].toString(!0));return this.clazz=a};f.encode=function(a,c,b){for(var g=null,f,e=0,h=this._fields.length,d;e<h;++e)f=this._fields[e],d=a[f.name],f.required&&null===d?null===g&&(g=f):f.encode(b?d:f.verifyValue(d),c,a);if(null!==g)throw a=Error("Missing at least one required field for "+
53
+ this.toString(!0)+": "+g),a.encoded=c,a;return c};f.calculate=function(a){for(var c=0,b=0,f=this._fields.length,e,d;b<f;++b){e=this._fields[b];d=a[e.name];if(e.required&&null===d)throw Error("Missing at least one required field for "+this.toString(!0)+": "+e);c+=e.calculate(d,a)}return c};f.decode=function(a,b,f){"number"!==typeof b&&(b=-1);for(var g=a.offset,e=new this.clazz,d,h,m;a.offset<g+b||-1===b&&0<a.remaining();){d=a.readVarint32();h=d&7;m=d>>>3;if(h===c.WIRE_TYPES.ENDGROUP){if(m!==f)throw Error("Illegal group end indicator for "+
54
+ this.toString(!0)+": "+m+" ("+(f?f+" expected":"not a group")+")");break}if(d=this._fieldsById[m])d.repeated&&!d.options.packed?e[d.name].push(d.decode(h,a)):d.map?(h=d.decode(h,a),e[d.name].set(h[0],h[1])):(e[d.name]=d.decode(h,a),d.oneof&&(h=e[d.oneof.name],null!==h&&h!==d.name&&(e[h]=null),e[d.oneof.name]=d.name));else switch(h){case c.WIRE_TYPES.VARINT:a.readVarint32();break;case c.WIRE_TYPES.BITS32:a.offset+=4;break;case c.WIRE_TYPES.BITS64:a.offset+=8;break;case c.WIRE_TYPES.LDELIM:d=a.readVarint32();
55
+ a.offset+=d;break;case c.WIRE_TYPES.STARTGROUP:for(;z(m,a););break;default:throw Error("Illegal wire type for unknown field "+m+" in "+this.toString(!0)+"#decode: "+h);}}a=0;for(b=this._fields.length;a<b;++a)if(d=this._fields[a],null===e[d.name])if("proto3"===this.syntax)e[d.name]=d.defaultValue;else{if(d.required)throw a=Error("Missing at least one required field for "+this.toString(!0)+": "+d.name),a.decoded=e,a;c.populateDefaults&&null!==d.defaultValue&&(e[d.name]=d.defaultValue)}return e};r.Message=
56
+ u;var p=function(a,b,f,e,d,m,l,y,t,z){k.call(this,a,b,m);this.className="Message.Field";this.required="required"===f;this.repeated="repeated"===f;this.map="map"===f;this.keyType=e||null;this.type=d;this.resolvedType=null;this.id=l;this.options=y||{};this.defaultValue=null;this.oneof=t||null;this.syntax=z||"proto2";this.originalName=this.name;this.keyElement=this.element=null;!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=c.Util.toCamelCase(this.name))},
57
+ f=p.prototype=Object.create(k.prototype);f.build=function(){this.element=new m(this.type,this.resolvedType,!1,this.syntax,this.name);this.map&&(this.keyElement=new m(this.keyType,void 0,!0,this.syntax,this.name));"proto3"!==this.syntax||this.repeated||this.map?"undefined"!==typeof this.options["default"]&&(this.defaultValue=this.verifyValue(this.options["default"])):this.defaultValue=m.defaultFieldValue(this.type)};f.verifyValue=function(a,b){function g(a,c){throw Error("Illegal value for "+f.toString(!0)+
58
+ " of type "+f.type.name+": "+a+" ("+c+")");}b=b||!1;var f=this;if(null===a)return this.required&&g(typeof a,"required"),"proto3"===this.syntax&&this.type!==c.TYPES.message&&g(typeof a,"proto3 field without field presence cannot be null"),null;var e;if(this.repeated&&!b){Array.isArray(a)||(a=[a]);var d=[];for(e=0;e<a.length;e++)d.push(this.element.verifyValue(a[e]));return d}if(this.map&&!b){if(a instanceof c.Map)return a;a instanceof Object||g(typeof a,"expected ProtoBuf.Map or raw object for map field");
59
+ return new c.Map(this,a)}!this.repeated&&Array.isArray(a)&&g(typeof a,"no array expected");return this.element.verifyValue(a)};f.hasWirePresence=function(a,b){if("proto3"!==this.syntax)return null!==a;if(this.oneof&&b[this.oneof.name]===this.name)return!0;switch(this.type){case c.TYPES.int32:case c.TYPES.sint32:case c.TYPES.sfixed32:case c.TYPES.uint32:case c.TYPES.fixed32:return 0!==a;case c.TYPES.int64:case c.TYPES.sint64:case c.TYPES.sfixed64:case c.TYPES.uint64:case c.TYPES.fixed64:return 0!==
60
+ a.low||0!==a.high;case c.TYPES.bool:return a;case c.TYPES["float"]:case c.TYPES["double"]:return 0!==a;case c.TYPES.string:return 0<a.length;case c.TYPES.bytes:return 0<a.remaining();case c.TYPES["enum"]:return 0!==a;case c.TYPES.message:return null!==a;default:return!0}};f.encode=function(a,b,f){if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return b;try{if(this.repeated){var g;
61
+ if(this.options.packed&&0<=c.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){b.writeVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);b.ensureCapacity(b.offset+=1);var d=b.offset;for(g=0;g<a.length;g++)this.element.encodeValue(this.id,a[g],b);var h=b.offset-d,m=e.calculateVarint32(h);if(1<m){var l=b.slice(d,b.offset),d=d+(m-1);b.offset=d;b.append(l)}b.writeVarint32(h,d-m)}else for(g=0;g<a.length;g++)b.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a[g],b)}else this.map?a.forEach(function(a,
62
+ g,f){f=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,g)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);b.writeVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);b.writeVarint32(f);b.writeVarint32(8|this.keyType.wireType);this.keyElement.encodeValue(1,g,b);b.writeVarint32(16|this.type.wireType);this.element.encodeValue(2,a,b)},this):this.hasWirePresence(a,f)&&(b.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,a,b))}catch(F){throw Error("Illegal value for "+
63
+ this.toString(!0)+": "+a+" ("+F+")");}return b};f.calculate=function(a,b){a=this.verifyValue(a);if(null===this.type||"object"!==typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===a||this.repeated&&0==a.length)return 0;var g=0;try{if(this.repeated){var f,d;if(this.options.packed&&0<=c.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)){g+=e.calculateVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);for(f=d=0;f<a.length;f++)d+=this.element.calculateLength(this.id,
64
+ a[f]);g+=e.calculateVarint32(d);g+=d}else for(f=0;f<a.length;f++)g+=e.calculateVarint32(this.id<<3|this.type.wireType),g+=this.element.calculateLength(this.id,a[f])}else this.map?a.forEach(function(a,b,f){a=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,b)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,a);g+=e.calculateVarint32(this.id<<3|c.WIRE_TYPES.LDELIM);g+=e.calculateVarint32(a);g+=a},this):this.hasWirePresence(a,b)&&(g+=e.calculateVarint32(this.id<<
65
+ 3|this.type.wireType),g+=this.element.calculateLength(this.id,a))}catch(w){throw Error("Illegal value for "+this.toString(!0)+": "+a+" ("+w+")");}return g};f.decode=function(a,b,f){if(!(!this.map&&a==this.type.wireType||!f&&this.repeated&&this.options.packed&&a==c.WIRE_TYPES.LDELIM||this.map&&a==c.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+a+" ("+this.type.wireType+" expected)");if(a==c.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&0<=c.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)&&
66
+ !f){a=b.readVarint32();a=b.offset+a;for(f=[];b.offset<a;)f.push(this.decode(this.type.wireType,b,!0));return f}if(this.map){var g=m.defaultFieldValue(this.keyType);f=m.defaultFieldValue(this.type);a=b.readVarint32();if(b.remaining()<a)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+a+" required but got only "+b.remaining());var d=b.clone();d.limit=d.offset+a;for(b.offset+=a;0<d.remaining();)if(b=d.readVarint32(),a=b&7,b>>>=3,1===b)g=this.keyElement.decode(d,a,b);else if(2===b)f=
67
+ this.element.decode(d,a,b);else throw Error("Unexpected tag in map field key/value submessage");return[g,f]}return this.element.decode(b,a,this.id)};r.Message.Field=p;f=function(a,b,c,f,d,e,m){p.call(this,a,b,c,null,f,d,e,m)};f.prototype=Object.create(p.prototype);r.Message.ExtensionField=f;r.Message.OneOf=function(a,b,c){k.call(this,a,b,c);this.fields=[]};var x=function(a,c,f,d,e){b.call(this,a,c,f,d,e);this.className="Enum";this.object=null};x.getName=function(a,b){for(var c=Object.keys(a),f=0,
68
+ g;f<c.length;++f)if(a[g=c[f]]===b)return g;return null};(x.prototype=Object.create(b.prototype)).build=function(a){if(this.object&&!a)return this.object;a=new c.Builder.Enum;for(var b=this.getChildren(x.Value),f=0,d=b.length;f<d;++f)a[b[f].name]=b[f].id;Object.defineProperty&&Object.defineProperty(a,"$options",{value:this.buildOpt(),enumerable:!1});return this.object=a};r.Enum=x;f=function(a,b,c,f){k.call(this,a,b,c);this.className="Enum.Value";this.id=f};f.prototype=Object.create(k.prototype);r.Enum.Value=
69
+ f;var y=function(a,b,c,f){k.call(this,a,b,c);this.field=f};y.prototype=Object.create(k.prototype);r.Extension=y;var D=function(a,c,f,d){b.call(this,a,c,f,d);this.className="Service";this.clazz=null};(D.prototype=Object.create(b.prototype)).build=function(a){return this.clazz&&!a?this.clazz:this.clazz=function(a,b){for(var c=function(b){a.Builder.Service.call(this);this.rpcImpl=b||function(a,b,c){setTimeout(c.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),
70
+ 0)}},f=c.prototype=Object.create(a.Builder.Service.prototype),d=b.getChildren(a.Reflect.Service.RPCMethod),g=0;g<d.length;g++)(function(a){f[a.name]=function(c,f){try{try{c=a.resolvedRequestType.clazz.decode(e.wrap(c))}catch(A){if(!(A instanceof TypeError))throw A;}if(null===c||"object"!==typeof c)throw Error("Illegal arguments");c instanceof a.resolvedRequestType.clazz||(c=new a.resolvedRequestType.clazz(c));this.rpcImpl(a.fqn(),c,function(c,d){if(c)f(c);else{null===d&&(d="");try{d=a.resolvedResponseType.clazz.decode(d)}catch(G){}d&&
71
+ d instanceof a.resolvedResponseType.clazz?f(null,d):f(Error("Illegal response type received in service method "+b.name+"#"+a.name))}})}catch(A){setTimeout(f.bind(this,A),0)}};c[a.name]=function(b,f,d){(new c(b))[a.name](f,d)};Object.defineProperty&&(Object.defineProperty(c[a.name],"$options",{value:a.buildOpt()}),Object.defineProperty(f[a.name],"$options",{value:c[a.name].$options}))})(d[g]);Object.defineProperty&&(Object.defineProperty(c,"$options",{value:b.buildOpt()}),Object.defineProperty(f,"$options",
72
+ {value:c.$options}),Object.defineProperty(c,"$type",{value:b}),Object.defineProperty(f,"$type",{value:b}));return c}(c,this)};r.Service=D;var B=function(a,b,c,f){k.call(this,a,b,c);this.className="Service.Method";this.options=f||{}};(B.prototype=Object.create(k.prototype)).buildOpt=l.buildOpt;r.Service.Method=B;l=function(a,b,c,f,d,e,m,l){B.call(this,a,b,c,l);this.className="Service.RPCMethod";this.requestName=f;this.responseName=d;this.requestStream=e;this.responseStream=m;this.resolvedResponseType=
73
+ this.resolvedRequestType=null};l.prototype=Object.create(B.prototype);r.Service.RPCMethod=l;return r}(d);d.Builder=function(c,d,e){function t(b){b.messages&&b.messages.forEach(function(c){c.syntax=b.syntax;t(c)});b.enums&&b.enums.forEach(function(c){c.syntax=b.syntax})}var k=function(b){this.ptr=this.ns=new e.Namespace(this,null,"");this.resolved=!1;this.result=null;this.files={};this.importRoot=null;this.options=b||{}},l=k.prototype;k.isMessage=function(b){return"string"!==typeof b.name||"undefined"!==
74
+ typeof b.values||"undefined"!==typeof b.rpc?!1:!0};k.isMessageField=function(b){return"string"!==typeof b.rule||"string"!==typeof b.name||"string"!==typeof b.type||"undefined"===typeof b.id?!1:!0};k.isEnum=function(b){return"string"===typeof b.name&&"undefined"!==typeof b.values&&Array.isArray(b.values)&&0!==b.values.length?!0:!1};k.isService=function(b){return"string"===typeof b.name&&"object"===typeof b.rpc&&b.rpc?!0:!1};k.isExtend=function(b){return"string"!==typeof b.ref?!1:!0};l.reset=function(){this.ptr=
75
+ this.ns;return this};l.define=function(b){if("string"!==typeof b||!d.TYPEREF.test(b))throw Error("illegal namespace: "+b);b.split(".").forEach(function(b){var c=this.ptr.getChild(b);null===c&&this.ptr.addChild(c=new e.Namespace(this,this.ptr,b));this.ptr=c},this);return this};l.create=function(b){if(!b)return this;if(Array.isArray(b)){if(0===b.length)return this;b=b.slice()}else b=[b];for(var d=[b];0<d.length;){b=d.pop();if(!Array.isArray(b))throw Error("not a valid namespace: "+JSON.stringify(b));
76
+ for(;0<b.length;){var f=b.shift();if(k.isMessage(f)){var l=new e.Message(this,this.ptr,f.name,f.options,f.isGroup,f.syntax),t={};f.oneofs&&Object.keys(f.oneofs).forEach(function(b){l.addChild(t[b]=new e.Message.OneOf(this,l,b))},this);f.fields&&f.fields.forEach(function(b){if(null!==l.getChild(b.id|0))throw Error("duplicate or invalid field id in "+l.name+": "+b.id);if(b.options&&"object"!==typeof b.options)throw Error("illegal field options in "+l.name+"#"+b.name);var c=null;if("string"===typeof b.oneof&&
77
+ !(c=t[b.oneof]))throw Error("illegal oneof in "+l.name+"#"+b.name+": "+b.oneof);b=new e.Message.Field(this,l,b.rule,b.keytype,b.type,b.name,b.id,b.options,c,f.syntax);c&&c.fields.push(b);l.addChild(b)},this);var r=[];f.enums&&f.enums.forEach(function(b){r.push(b)});f.messages&&f.messages.forEach(function(b){r.push(b)});f.services&&f.services.forEach(function(b){r.push(b)});f.extensions&&(l.extensions="number"===typeof f.extensions[0]?[f.extensions]:f.extensions);this.ptr.addChild(l);if(0<r.length){d.push(b);
78
+ b=r;r=null;this.ptr=l;l=null;continue}r=null}else if(k.isEnum(f))l=new e.Enum(this,this.ptr,f.name,f.options,f.syntax),f.values.forEach(function(b){l.addChild(new e.Enum.Value(this,l,b.name,b.id))},this),this.ptr.addChild(l);else if(k.isService(f))l=new e.Service(this,this.ptr,f.name,f.options),Object.keys(f.rpc).forEach(function(b){var c=f.rpc[b];l.addChild(new e.Service.RPCMethod(this,l,b,c.request,c.response,!!c.request_stream,!!c.response_stream,c.options))},this),this.ptr.addChild(l);else if(k.isExtend(f))if(l=
79
+ this.ptr.resolve(f.ref,!0))f.fields.forEach(function(b){if(null!==l.getChild(b.id|0))throw Error("duplicate extended field id in "+l.name+": "+b.id);if(l.extensions){var f=!1;l.extensions.forEach(function(a){b.id>=a[0]&&b.id<=a[1]&&(f=!0)});if(!f)throw Error("illegal extended field id in "+l.name+": "+b.id+" (not within valid ranges)");}var d=b.name;this.options.convertFieldsToCamelCase&&(d=c.Util.toCamelCase(d));var d=new e.Message.ExtensionField(this,l,b.rule,b.type,this.ptr.fqn()+"."+d,b.id,b.options),
80
+ a=new e.Extension(this,this.ptr,b.name,d);d.extension=a;this.ptr.addChild(a);l.addChild(d)},this);else{if(!/\.?google\.protobuf\./.test(f.ref))throw Error("extended message "+f.ref+" is not defined");}else throw Error("not a valid definition: "+JSON.stringify(f));l=f=null}b=null;this.ptr=this.ptr.parent}this.resolved=!1;this.result=null;return this};l["import"]=function(b,d){var f="/";if("string"===typeof d){c.Util.IS_NODE&&(d=require("path").resolve(d));if(!0===this.files[d])return this.reset();
81
+ this.files[d]=!0}else if("object"===typeof d){var e=d.root;c.Util.IS_NODE&&(e=require("path").resolve(e));if(0<=e.indexOf("\\")||0<=d.file.indexOf("\\"))f="\\";e=c.Util.IS_NODE?require("path").join(e,d.file):e+f+d.file;if(!0===this.files[e])return this.reset();this.files[e]=!0}if(b.imports&&0<b.imports.length){var l=!1;if("object"===typeof d){if(this.importRoot=d.root,l=!0,e=this.importRoot,d=d.file,0<=e.indexOf("\\")||0<=d.indexOf("\\"))f="\\"}else"string"===typeof d?this.importRoot?e=this.importRoot:
82
+ 0<=d.indexOf("/")?(e=d.replace(/\/[^\/]*$/,""),""===e&&(e="/")):0<=d.indexOf("\\")?(e=d.replace(/\\[^\\]*$/,""),f="\\"):e=".":e=null;for(var m=0;m<b.imports.length;m++)if("string"===typeof b.imports[m]){if(!e)throw Error("cannot determine import root");var k=b.imports[m];if("google/protobuf/descriptor.proto"!==k&&(k=c.Util.IS_NODE?require("path").join(e,k):e+f+k,!0!==this.files[k])){/\.proto$/i.test(k)&&!c.DotProto&&(k=k.replace(/\.proto$/,".json"));var r=c.Util.fetch(k);if(null===r)throw Error("failed to import '"+
83
+ k+"' in '"+d+"': file not found");if(/\.json$/i.test(k))this["import"](JSON.parse(r+""),k);else this["import"](c.DotProto.Parser.parse(r),k)}}else if(d)if(/\.(\w+)$/.test(d))this["import"](b.imports[m],d.replace(/^(.+)\.(\w+)$/,function(a,b,c){return b+"_import"+m+"."+c}));else this["import"](b.imports[m],d+"_import"+m);else this["import"](b.imports[m]);l&&(this.importRoot=null)}b["package"]&&this.define(b["package"]);b.syntax&&t(b);var p=this.ptr;b.options&&Object.keys(b.options).forEach(function(a){p.options[a]=
84
+ b.options[a]});b.messages&&(this.create(b.messages),this.ptr=p);b.enums&&(this.create(b.enums),this.ptr=p);b.services&&(this.create(b.services),this.ptr=p);b["extends"]&&this.create(b["extends"]);return this.reset()};l.resolveAll=function(){var b;if(null==this.ptr||"object"===typeof this.ptr.type)return this;if(this.ptr instanceof e.Namespace)this.ptr.children.forEach(function(b){this.ptr=b;this.resolveAll()},this);else if(this.ptr instanceof e.Message.Field){if(d.TYPE.test(this.ptr.type))this.ptr.type=
85
+ c.TYPES[this.ptr.type];else{if(!d.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);b=(this.ptr instanceof e.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0);if(!b)throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.resolvedType=b;if(b instanceof e.Enum){if(this.ptr.type=c.TYPES["enum"],"proto3"===this.ptr.syntax&&"proto3"!==b.syntax)throw Error("proto3 message cannot reference proto2 enum");
86
+ }else if(b instanceof e.Message)this.ptr.type=b.isGroup?c.TYPES.group:c.TYPES.message;else throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);}if(this.ptr.map){if(!d.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=c.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==c.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&
87
+ (this.ptr.options.packed=!0)}else if(this.ptr instanceof c.Reflect.Service.Method)if(this.ptr instanceof c.Reflect.Service.RPCMethod){b=this.ptr.parent.resolve(this.ptr.requestName,!0);if(!(b&&b instanceof c.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);this.ptr.resolvedRequestType=b;b=this.ptr.parent.resolve(this.ptr.responseName,!0);if(!(b&&b instanceof c.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+
88
+ ": "+this.ptr.responseName);this.ptr.resolvedResponseType=b}else throw Error("illegal service type in "+this.ptr.toString(!0));else if(!(this.ptr instanceof c.Reflect.Message.OneOf||this.ptr instanceof c.Reflect.Extension||this.ptr instanceof c.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()};l.build=function(b){this.reset();this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null);null===this.result&&(this.result=this.ns.build());
89
+ if(!b)return this.result;b="string"===typeof b?b.split("."):b;for(var c=this.result,f=0;f<b.length;f++)if(c[b[f]])c=c[b[f]];else{c=null;break}return c};l.lookup=function(b,c){return b?this.ns.resolve(b,c):this.ns};l.toString=function(){return"Builder"};k.Message=function(){};k.Enum=function(){};k.Service=function(){};return k}(d,d.Lang,d.Reflect);d.Map=function(c,d){function e(c){var b=0;return{next:function(){return b<c.length?{done:!1,value:c[b++]}:{done:!0}}}}var t=function(c,b){if(!c.map)throw Error("field is not a map");
90
+ this.field=c;this.keyElem=new d.Element(c.keyType,null,!0,c.syntax);this.valueElem=new d.Element(c.type,c.resolvedType,!1,c.syntax);this.map={};Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}});if(b)for(var e=Object.keys(b),f=0;f<e.length;f++){var l=this.keyElem.valueFromString(e[f]),k=this.valueElem.verifyValue(b[e[f]]);this.map[this.keyElem.valueToString(l)]={key:l,value:k}}},k=t.prototype;k.clear=function(){this.map={}};k["delete"]=function(c){c=this.keyElem.valueToString(this.keyElem.verifyValue(c));
91
+ var b=c in this.map;delete this.map[c];return b};k.entries=function(){for(var c=[],b=Object.keys(this.map),d=0,f;d<b.length;d++)c.push([(f=this.map[b[d]]).key,f.value]);return e(c)};k.keys=function(){for(var c=[],b=Object.keys(this.map),d=0;d<b.length;d++)c.push(this.map[b[d]].key);return e(c)};k.values=function(){for(var c=[],b=Object.keys(this.map),d=0;d<b.length;d++)c.push(this.map[b[d]].value);return e(c)};k.forEach=function(c,b){for(var d=Object.keys(this.map),f=0,e;f<d.length;f++)c.call(b,(e=
92
+ this.map[d[f]]).value,e.key,this)};k.set=function(c,b){var d=this.keyElem.verifyValue(c),f=this.valueElem.verifyValue(b);this.map[this.keyElem.valueToString(d)]={key:d,value:f};return this};k.get=function(c){c=this.keyElem.valueToString(this.keyElem.verifyValue(c));if(c in this.map)return this.map[c].value};k.has=function(c){return this.keyElem.valueToString(this.keyElem.verifyValue(c))in this.map};return t}(d,d.Reflect);d.newBuilder=function(c){c=c||{};"undefined"===typeof c.convertFieldsToCamelCase&&
93
+ (c.convertFieldsToCamelCase=d.convertFieldsToCamelCase);"undefined"===typeof c.populateAccessors&&(c.populateAccessors=d.populateAccessors);return new d.Builder(c)};d.loadJson=function(c,e,p){if("string"===typeof e||e&&"string"===typeof e.file&&"string"===typeof e.root)p=e,e=null;e&&"object"===typeof e||(e=d.newBuilder());"string"===typeof c&&(c=JSON.parse(c));e["import"](c,p);e.resolveAll();return e};d.loadJsonFile=function(c,e,p){e&&"object"===typeof e?(p=e,e=null):e&&"function"===typeof e||(e=
94
+ null);if(e)return d.Util.fetch("string"===typeof c?c:c.root+"/"+c.file,function(k){if(null===k)e(Error("Failed to fetch file"));else try{e(null,d.loadJson(JSON.parse(k),p,c))}catch(l){e(l)}});var r=d.Util.fetch("object"===typeof c?c.root+"/"+c.file:c);return null===r?null:d.loadJson(JSON.parse(r),p,c)};return d});
Binary file