UNPKG

deadem

Version:

JavaScript (Node.js & Browsers) parser for Deadlock (Valve Source 2 Engine) demo/replay files

4 lines 746 kB
(function(ue,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(ue=typeof globalThis<"u"?globalThis:ue||self,R(ue.deadem={}))})(this,function(ue){"use strict";var Du=Object.defineProperty;var Pu=(ue,R,Ge)=>R in ue?Du(ue,R,{enumerable:!0,configurable:!0,writable:!0,value:Ge}):ue[R]=Ge;var Nt=(ue,R,Ge)=>Pu(ue,typeof R!="symbol"?R+"":R,Ge);class R{static isTrue(e,t="Assertion failed"){if(!e)throw new Error(t)}}function Ge(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var ii={exports:{}},ri={exports:{}},ni={},Rt={},si,Dr;function Pr(){if(Dr)return si;Dr=1,si=d;function d(e,t){for(var i=new Array(arguments.length-1),s=0,n=2,o=!0;n<arguments.length;)i[s++]=arguments[n++];return new Promise(function(u,p){i[s]=function(c){if(o)if(o=!1,c)p(c);else{for(var y=new Array(arguments.length-1),_=0;_<y.length;)y[_++]=arguments[_];u.apply(null,y)}};try{e.apply(t||null,i)}catch(h){o&&(o=!1,p(h))}})}return si}var oi={},wr;function Os(){return wr||(wr=1,function(d){var e=d;e.length=function(r){var u=r.length;if(!u)return 0;for(var p=0;--u%4>1&&r.charAt(u)==="=";)++p;return Math.ceil(r.length*3)/4-p};for(var t=new Array(64),i=new Array(123),s=0;s<64;)i[t[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;e.encode=function(r,u,p){for(var h=null,c=[],y=0,_=0,E;u<p;){var S=r[u++];switch(_){case 0:c[y++]=t[S>>2],E=(S&3)<<4,_=1;break;case 1:c[y++]=t[E|S>>4],E=(S&15)<<2,_=2;break;case 2:c[y++]=t[E|S>>6],c[y++]=t[S&63],_=0;break}y>8191&&((h||(h=[])).push(String.fromCharCode.apply(String,c)),y=0)}return _&&(c[y++]=t[E],c[y++]=61,_===1&&(c[y++]=61)),h?(y&&h.push(String.fromCharCode.apply(String,c.slice(0,y))),h.join("")):String.fromCharCode.apply(String,c.slice(0,y))};var n="invalid encoding";e.decode=function(r,u,p){for(var h=p,c=0,y,_=0;_<r.length;){var E=r.charCodeAt(_++);if(E===61&&c>1)break;if((E=i[E])===void 0)throw Error(n);switch(c){case 0:y=E,c=1;break;case 1:u[p++]=y<<2|(E&48)>>4,y=E,c=2;break;case 2:u[p++]=(y&15)<<4|(E&60)>>2,y=E,c=3;break;case 3:u[p++]=(y&3)<<6|E,c=0;break}}if(c===1)throw Error(n);return p-h},e.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}}(oi)),oi}var ai,kr;function vs(){if(kr)return ai;kr=1,ai=d;function d(){this._listeners={}}return d.prototype.on=function(t,i,s){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:i,ctx:s||this}),this},d.prototype.off=function(t,i){if(t===void 0)this._listeners={};else if(i===void 0)this._listeners[t]=[];else for(var s=this._listeners[t],n=0;n<s.length;)s[n].fn===i?s.splice(n,1):++n;return this},d.prototype.emit=function(t){var i=this._listeners[t];if(i){for(var s=[],n=1;n<arguments.length;)s.push(arguments[n++]);for(n=0;n<i.length;)i[n].fn.apply(i[n++].ctx,s)}return this},ai}var di,Lr;function bs(){if(Lr)return di;Lr=1,di=d(d);function d(n){return typeof Float32Array<"u"?function(){var o=new Float32Array([-0]),r=new Uint8Array(o.buffer),u=r[3]===128;function p(_,E,S){o[0]=_,E[S]=r[0],E[S+1]=r[1],E[S+2]=r[2],E[S+3]=r[3]}function h(_,E,S){o[0]=_,E[S]=r[3],E[S+1]=r[2],E[S+2]=r[1],E[S+3]=r[0]}n.writeFloatLE=u?p:h,n.writeFloatBE=u?h:p;function c(_,E){return r[0]=_[E],r[1]=_[E+1],r[2]=_[E+2],r[3]=_[E+3],o[0]}function y(_,E){return r[3]=_[E],r[2]=_[E+1],r[1]=_[E+2],r[0]=_[E+3],o[0]}n.readFloatLE=u?c:y,n.readFloatBE=u?y:c}():function(){function o(u,p,h,c){var y=p<0?1:0;if(y&&(p=-p),p===0)u(1/p>0?0:2147483648,h,c);else if(isNaN(p))u(2143289344,h,c);else if(p>34028234663852886e22)u((y<<31|2139095040)>>>0,h,c);else if(p<11754943508222875e-54)u((y<<31|Math.round(p/1401298464324817e-60))>>>0,h,c);else{var _=Math.floor(Math.log(p)/Math.LN2),E=Math.round(p*Math.pow(2,-_)*8388608)&8388607;u((y<<31|_+127<<23|E)>>>0,h,c)}}n.writeFloatLE=o.bind(null,e),n.writeFloatBE=o.bind(null,t);function r(u,p,h){var c=u(p,h),y=(c>>31)*2+1,_=c>>>23&255,E=c&8388607;return _===255?E?NaN:y*(1/0):_===0?y*1401298464324817e-60*E:y*Math.pow(2,_-150)*(E+8388608)}n.readFloatLE=r.bind(null,i),n.readFloatBE=r.bind(null,s)}(),typeof Float64Array<"u"?function(){var o=new Float64Array([-0]),r=new Uint8Array(o.buffer),u=r[7]===128;function p(_,E,S){o[0]=_,E[S]=r[0],E[S+1]=r[1],E[S+2]=r[2],E[S+3]=r[3],E[S+4]=r[4],E[S+5]=r[5],E[S+6]=r[6],E[S+7]=r[7]}function h(_,E,S){o[0]=_,E[S]=r[7],E[S+1]=r[6],E[S+2]=r[5],E[S+3]=r[4],E[S+4]=r[3],E[S+5]=r[2],E[S+6]=r[1],E[S+7]=r[0]}n.writeDoubleLE=u?p:h,n.writeDoubleBE=u?h:p;function c(_,E){return r[0]=_[E],r[1]=_[E+1],r[2]=_[E+2],r[3]=_[E+3],r[4]=_[E+4],r[5]=_[E+5],r[6]=_[E+6],r[7]=_[E+7],o[0]}function y(_,E){return r[7]=_[E],r[6]=_[E+1],r[5]=_[E+2],r[4]=_[E+3],r[3]=_[E+4],r[2]=_[E+5],r[1]=_[E+6],r[0]=_[E+7],o[0]}n.readDoubleLE=u?c:y,n.readDoubleBE=u?y:c}():function(){function o(u,p,h,c,y,_){var E=c<0?1:0;if(E&&(c=-c),c===0)u(0,y,_+p),u(1/c>0?0:2147483648,y,_+h);else if(isNaN(c))u(0,y,_+p),u(2146959360,y,_+h);else if(c>17976931348623157e292)u(0,y,_+p),u((E<<31|2146435072)>>>0,y,_+h);else{var S;if(c<22250738585072014e-324)S=c/5e-324,u(S>>>0,y,_+p),u((E<<31|S/4294967296)>>>0,y,_+h);else{var I=Math.floor(Math.log(c)/Math.LN2);I===1024&&(I=1023),S=c*Math.pow(2,-I),u(S*4503599627370496>>>0,y,_+p),u((E<<31|I+1023<<20|S*1048576&1048575)>>>0,y,_+h)}}}n.writeDoubleLE=o.bind(null,e,0,4),n.writeDoubleBE=o.bind(null,t,4,0);function r(u,p,h,c,y){var _=u(c,y+p),E=u(c,y+h),S=(E>>31)*2+1,I=E>>>20&2047,M=4294967296*(E&1048575)+_;return I===2047?M?NaN:S*(1/0):I===0?S*5e-324*M:S*Math.pow(2,I-1075)*(M+4503599627370496)}n.readDoubleLE=r.bind(null,i,0,4),n.readDoubleBE=r.bind(null,s,4,0)}(),n}function e(n,o,r){o[r]=n&255,o[r+1]=n>>>8&255,o[r+2]=n>>>16&255,o[r+3]=n>>>24}function t(n,o,r){o[r]=n>>>24,o[r+1]=n>>>16&255,o[r+2]=n>>>8&255,o[r+3]=n&255}function i(n,o){return(n[o]|n[o+1]<<8|n[o+2]<<16|n[o+3]<<24)>>>0}function s(n,o){return(n[o]<<24|n[o+1]<<16|n[o+2]<<8|n[o+3])>>>0}return di}function Ds(d){throw new Error('Could not dynamically require "'+d+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var li,Ur;function Gr(){if(Ur)return li;Ur=1,li=d;function d(e){try{var t=Ds(e);if(t&&(t.length||Object.keys(t).length))return t}catch{}return null}return li}var pi={},Br;function Ps(){return Br||(Br=1,function(d){var e=d;e.length=function(i){for(var s=0,n=0,o=0;o<i.length;++o)n=i.charCodeAt(o),n<128?s+=1:n<2048?s+=2:(n&64512)===55296&&(i.charCodeAt(o+1)&64512)===56320?(++o,s+=4):s+=3;return s},e.read=function(i,s,n){var o=n-s;if(o<1)return"";for(var r=null,u=[],p=0,h;s<n;)h=i[s++],h<128?u[p++]=h:h>191&&h<224?u[p++]=(h&31)<<6|i[s++]&63:h>239&&h<365?(h=((h&7)<<18|(i[s++]&63)<<12|(i[s++]&63)<<6|i[s++]&63)-65536,u[p++]=55296+(h>>10),u[p++]=56320+(h&1023)):u[p++]=(h&15)<<12|(i[s++]&63)<<6|i[s++]&63,p>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,u)),p=0);return r?(p&&r.push(String.fromCharCode.apply(String,u.slice(0,p))),r.join("")):String.fromCharCode.apply(String,u.slice(0,p))},e.write=function(i,s,n){for(var o=n,r,u,p=0;p<i.length;++p)r=i.charCodeAt(p),r<128?s[n++]=r:r<2048?(s[n++]=r>>6|192,s[n++]=r&63|128):(r&64512)===55296&&((u=i.charCodeAt(p+1))&64512)===56320?(r=65536+((r&1023)<<10)+(u&1023),++p,s[n++]=r>>18|240,s[n++]=r>>12&63|128,s[n++]=r>>6&63|128,s[n++]=r&63|128):(s[n++]=r>>12|224,s[n++]=r>>6&63|128,s[n++]=r&63|128);return n-o}}(pi)),pi}var ui,Vr;function ws(){if(Vr)return ui;Vr=1,ui=d;function d(e,t,i){var s=i||8192,n=s>>>1,o=null,r=s;return function(p){if(p<1||p>n)return e(p);r+p>s&&(o=e(s),r=0);var h=t.call(o,r,r+=p);return r&7&&(r=(r|7)+1),h}}return ui}var ci,xr;function ks(){if(xr)return ci;xr=1,ci=e;var d=Pe();function e(n,o){this.lo=n>>>0,this.hi=o>>>0}var t=e.zero=new e(0,0);t.toNumber=function(){return 0},t.zzEncode=t.zzDecode=function(){return this},t.length=function(){return 1};var i=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(o){if(o===0)return t;var r=o<0;r&&(o=-o);var u=o>>>0,p=(o-u)/4294967296>>>0;return r&&(p=~p>>>0,u=~u>>>0,++u>4294967295&&(u=0,++p>4294967295&&(p=0))),new e(u,p)},e.from=function(o){if(typeof o=="number")return e.fromNumber(o);if(d.isString(o))if(d.Long)o=d.Long.fromString(o);else return e.fromNumber(parseInt(o,10));return o.low||o.high?new e(o.low>>>0,o.high>>>0):t},e.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var r=~this.lo+1>>>0,u=~this.hi>>>0;return r||(u=u+1>>>0),-(r+u*4294967296)}return this.lo+this.hi*4294967296},e.prototype.toLong=function(o){return d.Long?new d.Long(this.lo|0,this.hi|0,!!o):{low:this.lo|0,high:this.hi|0,unsigned:!!o}};var s=String.prototype.charCodeAt;return e.fromHash=function(o){return o===i?t:new e((s.call(o,0)|s.call(o,1)<<8|s.call(o,2)<<16|s.call(o,3)<<24)>>>0,(s.call(o,4)|s.call(o,5)<<8|s.call(o,6)<<16|s.call(o,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this},e.prototype.zzDecode=function(){var o=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},e.prototype.length=function(){var o=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,u=this.hi>>>24;return u===0?r===0?o<16384?o<128?1:2:o<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:u<128?9:10},ci}var Fr;function Pe(){return Fr||(Fr=1,function(d){var e=d;e.asPromise=Pr(),e.base64=Os(),e.EventEmitter=vs(),e.float=bs(),e.inquire=Gr(),e.utf8=Ps(),e.pool=ws(),e.LongBits=ks(),e.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),e.global=e.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||Rt,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},e.isString=function(n){return typeof n=="string"||n instanceof String},e.isObject=function(n){return n&&typeof n=="object"},e.isset=e.isSet=function(n,o){var r=n[o];return r!=null&&n.hasOwnProperty(o)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1},e.Buffer=function(){try{var s=e.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(n){return typeof n=="number"?e.Buffer?e._Buffer_allocUnsafe(n):new e.Array(n):e.Buffer?e._Buffer_from(n):typeof Uint8Array>"u"?n:new Uint8Array(n)},e.Array=typeof Uint8Array<"u"?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(n){return n?e.LongBits.from(n).toHash():e.LongBits.zeroHash},e.longFromHash=function(n,o){var r=e.LongBits.fromHash(n);return e.Long?e.Long.fromBits(r.lo,r.hi,o):r.toNumber(!!o)};function t(s,n,o){for(var r=Object.keys(n),u=0;u<r.length;++u)(s[r[u]]===void 0||!o)&&(s[r[u]]=n[r[u]]);return s}e.merge=t,e.lcFirst=function(n){return n.charAt(0).toLowerCase()+n.substring(1)};function i(s){function n(o,r){if(!(this instanceof n))return new n(o,r);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&t(this,r)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return s},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),n}e.newError=i,e.ProtocolError=i("ProtocolError"),e.oneOfGetter=function(n){for(var o={},r=0;r<n.length;++r)o[n[r]]=1;return function(){for(var u=Object.keys(this),p=u.length-1;p>-1;--p)if(o[u[p]]===1&&this[u[p]]!==void 0&&this[u[p]]!==null)return u[p]}},e.oneOfSetter=function(n){return function(o){for(var r=0;r<n.length;++r)n[r]!==o&&delete this[n[r]]}},e.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},e._configure=function(){var s=e.Buffer;if(!s){e._Buffer_from=e._Buffer_allocUnsafe=null;return}e._Buffer_from=s.from!==Uint8Array.from&&s.from||function(o,r){return new s(o,r)},e._Buffer_allocUnsafe=s.allocUnsafe||function(o){return new s(o)}}}(Rt)),Rt}var _i,Kr;function fi(){if(Kr)return _i;Kr=1,_i=u;var d=Pe(),e,t=d.LongBits,i=d.base64,s=d.utf8;function n(I,M,m){this.fn=I,this.len=M,this.next=void 0,this.val=m}function o(){}function r(I){this.head=I.head,this.tail=I.tail,this.len=I.len,this.next=I.states}function u(){this.len=0,this.head=new n(o,0,0),this.tail=this.head,this.states=null}var p=function(){return d.Buffer?function(){return(u.create=function(){return new e})()}:function(){return new u}};u.create=p(),u.alloc=function(M){return new d.Array(M)},d.Array!==Array&&(u.alloc=d.pool(u.alloc,d.Array.prototype.subarray)),u.prototype._push=function(M,m,O){return this.tail=this.tail.next=new n(M,m,O),this.len+=m,this};function h(I,M,m){M[m]=I&255}function c(I,M,m){for(;I>127;)M[m++]=I&127|128,I>>>=7;M[m]=I}function y(I,M){this.len=I,this.next=void 0,this.val=M}y.prototype=Object.create(n.prototype),y.prototype.fn=c,u.prototype.uint32=function(M){return this.len+=(this.tail=this.tail.next=new y((M=M>>>0)<128?1:M<16384?2:M<2097152?3:M<268435456?4:5,M)).len,this},u.prototype.int32=function(M){return M<0?this._push(_,10,t.fromNumber(M)):this.uint32(M)},u.prototype.sint32=function(M){return this.uint32((M<<1^M>>31)>>>0)};function _(I,M,m){for(;I.hi;)M[m++]=I.lo&127|128,I.lo=(I.lo>>>7|I.hi<<25)>>>0,I.hi>>>=7;for(;I.lo>127;)M[m++]=I.lo&127|128,I.lo=I.lo>>>7;M[m++]=I.lo}u.prototype.uint64=function(M){var m=t.from(M);return this._push(_,m.length(),m)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(M){var m=t.from(M).zzEncode();return this._push(_,m.length(),m)},u.prototype.bool=function(M){return this._push(h,1,M?1:0)};function E(I,M,m){M[m]=I&255,M[m+1]=I>>>8&255,M[m+2]=I>>>16&255,M[m+3]=I>>>24}u.prototype.fixed32=function(M){return this._push(E,4,M>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(M){var m=t.from(M);return this._push(E,4,m.lo)._push(E,4,m.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(M){return this._push(d.float.writeFloatLE,4,M)},u.prototype.double=function(M){return this._push(d.float.writeDoubleLE,8,M)};var S=d.Array.prototype.set?function(M,m,O){m.set(M,O)}:function(M,m,O){for(var v=0;v<M.length;++v)m[O+v]=M[v]};return u.prototype.bytes=function(M){var m=M.length>>>0;if(!m)return this._push(h,1,0);if(d.isString(M)){var O=u.alloc(m=i.length(M));i.decode(M,O,0),M=O}return this.uint32(m)._push(S,m,M)},u.prototype.string=function(M){var m=s.length(M);return m?this.uint32(m)._push(s.write,m,M):this._push(h,1,0)},u.prototype.fork=function(){return this.states=new r(this),this.head=this.tail=new n(o,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(o,0,0),this.len=0),this},u.prototype.ldelim=function(){var M=this.head,m=this.tail,O=this.len;return this.reset().uint32(O),O&&(this.tail.next=M.next,this.tail=m,this.len+=O),this},u.prototype.finish=function(){for(var M=this.head.next,m=this.constructor.alloc(this.len),O=0;M;)M.fn(M.val,m,O),O+=M.len,M=M.next;return m},u._configure=function(I){e=I,u.create=p(),e._configure()},_i}var yi,Hr;function Ls(){if(Hr)return yi;Hr=1,yi=t;var d=fi();(t.prototype=Object.create(d.prototype)).constructor=t;var e=Pe();function t(){d.call(this)}t._configure=function(){t.alloc=e._Buffer_allocUnsafe,t.writeBytesBuffer=e.Buffer&&e.Buffer.prototype instanceof Uint8Array&&e.Buffer.prototype.set.name==="set"?function(n,o,r){o.set(n,r)}:function(n,o,r){if(n.copy)n.copy(o,r,0,n.length);else for(var u=0;u<n.length;)o[r++]=n[u++]}},t.prototype.bytes=function(n){e.isString(n)&&(n=e._Buffer_from(n,"base64"));var o=n.length>>>0;return this.uint32(o),o&&this._push(t.writeBytesBuffer,o,n),this};function i(s,n,o){s.length<40?e.utf8.write(s,n,o):n.utf8Write?n.utf8Write(s,o):n.write(s,o)}return t.prototype.string=function(n){var o=e.Buffer.byteLength(n);return this.uint32(o),o&&this._push(i,o,n),this},t._configure(),yi}var Ei,Wr;function hi(){if(Wr)return Ei;Wr=1,Ei=n;var d=Pe(),e,t=d.LongBits,i=d.utf8;function s(c,y){return RangeError("index out of range: "+c.pos+" + "+(y||1)+" > "+c.len)}function n(c){this.buf=c,this.pos=0,this.len=c.length}var o=typeof Uint8Array<"u"?function(y){if(y instanceof Uint8Array||Array.isArray(y))return new n(y);throw Error("illegal buffer")}:function(y){if(Array.isArray(y))return new n(y);throw Error("illegal buffer")},r=function(){return d.Buffer?function(_){return(n.create=function(S){return d.Buffer.isBuffer(S)?new e(S):o(S)})(_)}:o};n.create=r(),n.prototype._slice=d.Array.prototype.subarray||d.Array.prototype.slice,n.prototype.uint32=function(){var y=4294967295;return function(){if(y=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(y=(y|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(y=(y|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(y=(y|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(y=(y|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return y;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return y}}(),n.prototype.int32=function(){return this.uint32()|0},n.prototype.sint32=function(){var y=this.uint32();return y>>>1^-(y&1)|0};function u(){var c=new t(0,0),y=0;if(this.len-this.pos>4){for(;y<4;++y)if(c.lo=(c.lo|(this.buf[this.pos]&127)<<y*7)>>>0,this.buf[this.pos++]<128)return c;if(c.lo=(c.lo|(this.buf[this.pos]&127)<<28)>>>0,c.hi=(c.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return c;y=0}else{for(;y<3;++y){if(this.pos>=this.len)throw s(this);if(c.lo=(c.lo|(this.buf[this.pos]&127)<<y*7)>>>0,this.buf[this.pos++]<128)return c}return c.lo=(c.lo|(this.buf[this.pos++]&127)<<y*7)>>>0,c}if(this.len-this.pos>4){for(;y<5;++y)if(c.hi=(c.hi|(this.buf[this.pos]&127)<<y*7+3)>>>0,this.buf[this.pos++]<128)return c}else for(;y<5;++y){if(this.pos>=this.len)throw s(this);if(c.hi=(c.hi|(this.buf[this.pos]&127)<<y*7+3)>>>0,this.buf[this.pos++]<128)return c}throw Error("invalid varint encoding")}n.prototype.bool=function(){return this.uint32()!==0};function p(c,y){return(c[y-4]|c[y-3]<<8|c[y-2]<<16|c[y-1]<<24)>>>0}n.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return p(this.buf,this.pos+=4)},n.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return p(this.buf,this.pos+=4)|0};function h(){if(this.pos+8>this.len)throw s(this,8);return new t(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}return n.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var y=d.float.readFloatLE(this.buf,this.pos);return this.pos+=4,y},n.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var y=d.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,y},n.prototype.bytes=function(){var y=this.uint32(),_=this.pos,E=this.pos+y;if(E>this.len)throw s(this,y);if(this.pos+=y,Array.isArray(this.buf))return this.buf.slice(_,E);if(_===E){var S=d.Buffer;return S?S.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,_,E)},n.prototype.string=function(){var y=this.bytes();return i.read(y,0,y.length)},n.prototype.skip=function(y){if(typeof y=="number"){if(this.pos+y>this.len)throw s(this,y);this.pos+=y}else do if(this.pos>=this.len)throw s(this);while(this.buf[this.pos++]&128);return this},n.prototype.skipType=function(c){switch(c){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(c=this.uint32()&7)!==4;)this.skipType(c);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+c+" at offset "+this.pos)}return this},n._configure=function(c){e=c,n.create=r(),e._configure();var y=d.Long?"toLong":"toNumber";d.merge(n.prototype,{int64:function(){return u.call(this)[y](!1)},uint64:function(){return u.call(this)[y](!0)},sint64:function(){return u.call(this).zzDecode()[y](!1)},fixed64:function(){return h.call(this)[y](!0)},sfixed64:function(){return h.call(this)[y](!1)}})},Ei}var gi,jr;function Us(){if(jr)return gi;jr=1,gi=t;var d=hi();(t.prototype=Object.create(d.prototype)).constructor=t;var e=Pe();function t(i){d.call(this,i)}return t._configure=function(){e.Buffer&&(t.prototype._slice=e.Buffer.prototype.slice)},t.prototype.string=function(){var s=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+s,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+s,this.len))},t._configure(),gi}var Ci={},Si,zr;function Gs(){if(zr)return Si;zr=1,Si=e;var d=Pe();(e.prototype=Object.create(d.EventEmitter.prototype)).constructor=e;function e(t,i,s){if(typeof t!="function")throw TypeError("rpcImpl must be a function");d.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!i,this.responseDelimited=!!s}return e.prototype.rpcCall=function t(i,s,n,o,r){if(!o)throw TypeError("request must be specified");var u=this;if(!r)return d.asPromise(t,u,i,s,n,o);if(!u.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return u.rpcImpl(i,s[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(h,c){if(h)return u.emit("error",h,i),r(h);if(c===null){u.end(!0);return}if(!(c instanceof n))try{c=n[u.responseDelimited?"decodeDelimited":"decode"](c)}catch(y){return u.emit("error",y,i),r(y)}return u.emit("data",c,i),r(null,c)})}catch(p){u.emit("error",p,i),setTimeout(function(){r(p)},0);return}},e.prototype.end=function(i){return this.rpcImpl&&(i||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},Si}var qr;function Yr(){return qr||(qr=1,function(d){var e=d;e.Service=Gs()}(Ci)),Ci}var mi,$r;function Jr(){return $r||($r=1,mi={}),mi}var Qr;function Bs(){return Qr||(Qr=1,function(d){var e=d;e.build="minimal",e.Writer=fi(),e.BufferWriter=Ls(),e.Reader=hi(),e.BufferReader=Us(),e.util=Pe(),e.rpc=Yr(),e.roots=Jr(),e.configure=t;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}t()}(ni)),ni}var Ti={exports:{}},Mi,Xr;function Vs(){if(Xr)return Mi;Xr=1,Mi=d;function d(e,t){typeof e=="string"&&(t=e,e=void 0);var i=[];function s(o){if(typeof o!="string"){var r=n();if(d.verbose&&console.log("codegen: "+r),r="return "+r,o){for(var u=Object.keys(o),p=new Array(u.length+1),h=new Array(u.length),c=0;c<u.length;)p[c]=u[c],h[c]=o[u[c++]];return p[c]=r,Function.apply(null,p).apply(null,h)}return Function(r)()}for(var y=new Array(arguments.length-1),_=0;_<y.length;)y[_]=arguments[++_];if(_=0,o=o.replace(/%([%dfijs])/g,function(S,I){var M=y[_++];switch(I){case"d":case"f":return String(Number(M));case"i":return String(Math.floor(M));case"j":return JSON.stringify(M);case"s":return String(M)}return"%"}),_!==y.length)throw Error("parameter count mismatch");return i.push(o),s}function n(o){return"function "+(o||t||"")+"("+(e&&e.join(",")||"")+`){ `+i.join(` `)+` }`}return s.toString=n,s}return d.verbose=!1,Mi}var Ai,Zr;function xs(){if(Zr)return Ai;Zr=1,Ai=i;var d=Pr(),e=Gr(),t=e("fs");function i(s,n,o){return typeof n=="function"?(o=n,n={}):n||(n={}),o?!n.xhr&&t&&t.readFile?t.readFile(s,function(u,p){return u&&typeof XMLHttpRequest<"u"?i.xhr(s,n,o):u?o(u):o(null,n.binary?p:p.toString("utf8"))}):i.xhr(s,n,o):d(i,this,s,n)}return i.xhr=function(n,o,r){var u=new XMLHttpRequest;u.onreadystatechange=function(){if(u.readyState===4){if(u.status!==0&&u.status!==200)return r(Error("status "+u.status));if(o.binary){var h=u.response;if(!h){h=[];for(var c=0;c<u.responseText.length;++c)h.push(u.responseText.charCodeAt(c)&255)}return r(null,typeof Uint8Array<"u"?new Uint8Array(h):h)}return r(null,u.responseText)}},o.binary&&("overrideMimeType"in u&&u.overrideMimeType("text/plain; charset=x-user-defined"),u.responseType="arraybuffer"),u.open("GET",n),u.send()},Ai}var Ii={},en;function Fs(){return en||(en=1,function(d){var e=d,t=e.isAbsolute=function(n){return/^(?:\/|\w+:)/.test(n)},i=e.normalize=function(n){n=n.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var o=n.split("/"),r=t(n),u="";r&&(u=o.shift()+"/");for(var p=0;p<o.length;)o[p]===".."?p>0&&o[p-1]!==".."?o.splice(--p,2):r?o.splice(p,1):++p:o[p]==="."?o.splice(p,1):++p;return u+o.join("/")};e.resolve=function(n,o,r){return r||(o=i(o)),t(o)?o:(r||(n=i(n)),(n=n.replace(/(?:\/|^)[^/]+$/,"")).length?i(n+"/"+o):o)}}(Ii)),Ii}var Ni={},tn;function We(){return tn||(tn=1,function(d){var e=d,t=Ee(),i=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(n,o){var r=0,u={};for(o|=0;r<n.length;)u[i[r+o]]=n[r++];return u}e.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),e.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",t.emptyArray,null]),e.long=s([0,0,0,1,1],7),e.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),e.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])}(Ni)),Ni}var Ri,rn;function Fe(){if(rn)return Ri;rn=1,Ri=o;var d=je();((o.prototype=Object.create(d.prototype)).constructor=o).className="Field";var e=Ne(),t=We(),i=Ee(),s,n=/^required|optional|repeated$/;o.fromJSON=function(u,p){return new o(u,p.id,p.type,p.rule,p.extend,p.options,p.comment)};function o(r,u,p,h,c,y,_){if(i.isObject(h)?(_=c,y=h,h=c=void 0):i.isObject(c)&&(_=y,y=c,c=void 0),d.call(this,r,y),!i.isInteger(u)||u<0)throw TypeError("id must be a non-negative integer");if(!i.isString(p))throw TypeError("type must be a string");if(h!==void 0&&!n.test(h=h.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(c!==void 0&&!i.isString(c))throw TypeError("extend must be a string");h==="proto3_optional"&&(h="optional"),this.rule=h&&h!=="optional"?h:void 0,this.type=p,this.id=u,this.extend=c||void 0,this.required=h==="required",this.optional=!this.required,this.repeated=h==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=i.Long?t.long[p]!==void 0:!1,this.bytes=p==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=_}return Object.defineProperty(o.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}}),o.prototype.setOption=function(u,p,h){return u==="packed"&&(this._packed=null),d.prototype.setOption.call(this,u,p,h)},o.prototype.toJSON=function(u){var p=u?!!u.keepComments:!1;return i.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",p?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=t.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof s?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof e&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof e))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=i.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var u;i.base64.test(this.typeDefault)?i.base64.decode(this.typeDefault,u=i.newBuffer(i.base64.length(this.typeDefault)),0):i.utf8.write(this.typeDefault,u=i.newBuffer(i.utf8.length(this.typeDefault)),0),this.typeDefault=u}return this.map?this.defaultValue=i.emptyObject:this.repeated?this.defaultValue=i.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof s&&(this.parent.ctor.prototype[this.name]=this.defaultValue),d.prototype.resolve.call(this)},o.d=function(u,p,h,c){return typeof p=="function"?p=i.decorateType(p).name:p&&typeof p=="object"&&(p=i.decorateEnum(p).name),function(_,E){i.decorateType(_.constructor).add(new o(E,u,p,h,{default:c}))}},o._configure=function(u){s=u},Ri}var Oi,nn;function dt(){if(nn)return Oi;nn=1,Oi=i;var d=je();((i.prototype=Object.create(d.prototype)).constructor=i).className="OneOf";var e=Fe(),t=Ee();function i(n,o,r,u){if(Array.isArray(o)||(r=o,o=void 0),d.call(this,n,r),!(o===void 0||Array.isArray(o)))throw TypeError("fieldNames must be an Array");this.oneof=o||[],this.fieldsArray=[],this.comment=u}i.fromJSON=function(o,r){return new i(o,r.oneof,r.options,r.comment)},i.prototype.toJSON=function(o){var r=o?!!o.keepComments:!1;return t.toObject(["options",this.options,"oneof",this.oneof,"comment",r?this.comment:void 0])};function s(n){if(n.parent)for(var o=0;o<n.fieldsArray.length;++o)n.fieldsArray[o].parent||n.parent.add(n.fieldsArray[o])}return i.prototype.add=function(o){if(!(o instanceof e))throw TypeError("field must be a Field");return o.parent&&o.parent!==this.parent&&o.parent.remove(o),this.oneof.push(o.name),this.fieldsArray.push(o),o.partOf=this,s(this),this},i.prototype.remove=function(o){if(!(o instanceof e))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(o);if(r<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(r,1),r=this.oneof.indexOf(o.name),r>-1&&this.oneof.splice(r,1),o.partOf=null,this},i.prototype.onAdd=function(o){d.prototype.onAdd.call(this,o);for(var r=this,u=0;u<this.oneof.length;++u){var p=o.get(this.oneof[u]);p&&!p.partOf&&(p.partOf=r,r.fieldsArray.push(p))}s(this)},i.prototype.onRemove=function(o){for(var r=0,u;r<this.fieldsArray.length;++r)(u=this.fieldsArray[r]).parent&&u.parent.remove(u);d.prototype.onRemove.call(this,o)},i.d=function(){for(var o=new Array(arguments.length),r=0;r<arguments.length;)o[r]=arguments[r++];return function(p,h){t.decorateType(p.constructor).add(new i(h,o)),Object.defineProperty(p,h,{get:t.oneOfGetter(o),set:t.oneOfSetter(o)})}},Oi}var vi,sn;function lt(){if(sn)return vi;sn=1,vi=u;var d=je();((u.prototype=Object.create(d.prototype)).constructor=u).className="Namespace";var e=Fe(),t=Ee(),i=dt(),s,n,o;u.fromJSON=function(c,y){return new u(c,y.options).addJSON(y.nested)};function r(h,c){if(h&&h.length){for(var y={},_=0;_<h.length;++_)y[h[_].name]=h[_].toJSON(c);return y}}u.arrayToJSON=r,u.isReservedId=function(c,y){if(c){for(var _=0;_<c.length;++_)if(typeof c[_]!="string"&&c[_][0]<=y&&c[_][1]>y)return!0}return!1},u.isReservedName=function(c,y){if(c){for(var _=0;_<c.length;++_)if(c[_]===y)return!0}return!1};function u(h,c){d.call(this,h,c),this.nested=void 0,this._nestedArray=null}function p(h){return h._nestedArray=null,h}return Object.defineProperty(u.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=t.toArray(this.nested))}}),u.prototype.toJSON=function(c){return t.toObject(["options",this.options,"nested",r(this.nestedArray,c)])},u.prototype.addJSON=function(c){var y=this;if(c)for(var _=Object.keys(c),E=0,S;E<_.length;++E)S=c[_[E]],y.add((S.fields!==void 0?s.fromJSON:S.values!==void 0?o.fromJSON:S.methods!==void 0?n.fromJSON:S.id!==void 0?e.fromJSON:u.fromJSON)(_[E],S));return this},u.prototype.get=function(c){return this.nested&&this.nested[c]||null},u.prototype.getEnum=function(c){if(this.nested&&this.nested[c]instanceof o)return this.nested[c].values;throw Error("no such enum: "+c)},u.prototype.add=function(c){if(!(c instanceof e&&c.extend!==void 0||c instanceof s||c instanceof i||c instanceof o||c instanceof n||c instanceof u))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var y=this.get(c.name);if(y)if(y instanceof u&&c instanceof u&&!(y instanceof s||y instanceof n)){for(var _=y.nestedArray,E=0;E<_.length;++E)c.add(_[E]);this.remove(y),this.nested||(this.nested={}),c.setOptions(y.options,!0)}else throw Error("duplicate name '"+c.name+"' in "+this)}return this.nested[c.name]=c,c.onAdd(this),p(this)},u.prototype.remove=function(c){if(!(c instanceof d))throw TypeError("object must be a ReflectionObject");if(c.parent!==this)throw Error(c+" is not a member of "+this);return delete this.nested[c.name],Object.keys(this.nested).length||(this.nested=void 0),c.onRemove(this),p(this)},u.prototype.define=function(c,y){if(t.isString(c))c=c.split(".");else if(!Array.isArray(c))throw TypeError("illegal path");if(c&&c.length&&c[0]==="")throw Error("path must be relative");for(var _=this;c.length>0;){var E=c.shift();if(_.nested&&_.nested[E]){if(_=_.nested[E],!(_ instanceof u))throw Error("path conflicts with non-namespace objects")}else _.add(_=new u(E))}return y&&_.addJSON(y),_},u.prototype.resolveAll=function(){for(var c=this.nestedArray,y=0;y<c.length;)c[y]instanceof u?c[y++].resolveAll():c[y++].resolve();return this.resolve()},u.prototype.lookup=function(c,y,_){if(typeof y=="boolean"?(_=y,y=void 0):y&&!Array.isArray(y)&&(y=[y]),t.isString(c)&&c.length){if(c===".")return this.root;c=c.split(".")}else if(!c.length)return this;if(c[0]==="")return this.root.lookup(c.slice(1),y);var E=this.get(c[0]);if(E){if(c.length===1){if(!y||y.indexOf(E.constructor)>-1)return E}else if(E instanceof u&&(E=E.lookup(c.slice(1),y,!0)))return E}else for(var S=0;S<this.nestedArray.length;++S)if(this._nestedArray[S]instanceof u&&(E=this._nestedArray[S].lookup(c,y,!0)))return E;return this.parent===null||_?null:this.parent.lookup(c,y)},u.prototype.lookupType=function(c){var y=this.lookup(c,[s]);if(!y)throw Error("no such type: "+c);return y},u.prototype.lookupEnum=function(c){var y=this.lookup(c,[o]);if(!y)throw Error("no such Enum '"+c+"' in "+this);return y},u.prototype.lookupTypeOrEnum=function(c){var y=this.lookup(c,[s,o]);if(!y)throw Error("no such Type or Enum '"+c+"' in "+this);return y},u.prototype.lookupService=function(c){var y=this.lookup(c,[n]);if(!y)throw Error("no such Service '"+c+"' in "+this);return y},u._configure=function(h,c,y){s=h,n=c,o=y},vi}var bi,on;function Di(){if(on)return bi;on=1,bi=i;var d=Fe();((i.prototype=Object.create(d.prototype)).constructor=i).className="MapField";var e=We(),t=Ee();function i(s,n,o,r,u,p){if(d.call(this,s,n,r,void 0,void 0,u,p),!t.isString(o))throw TypeError("keyType must be a string");this.keyType=o,this.resolvedKeyType=null,this.map=!0}return i.fromJSON=function(n,o){return new i(n,o.id,o.keyType,o.type,o.options,o.comment)},i.prototype.toJSON=function(n){var o=n?!!n.keepComments:!1;return t.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",o?this.comment:void 0])},i.prototype.resolve=function(){if(this.resolved)return this;if(e.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return d.prototype.resolve.call(this)},i.d=function(n,o,r){return typeof r=="function"?r=t.decorateType(r).name:r&&typeof r=="object"&&(r=t.decorateEnum(r).name),function(p,h){t.decorateType(p.constructor).add(new i(h,n,o,r))}},bi}var Pi,an;function wi(){if(an)return Pi;an=1,Pi=t;var d=je();((t.prototype=Object.create(d.prototype)).constructor=t).className="Method";var e=Ee();function t(i,s,n,o,r,u,p,h,c){if(e.isObject(r)?(p=r,r=u=void 0):e.isObject(u)&&(p=u,u=void 0),!(s===void 0||e.isString(s)))throw TypeError("type must be a string");if(!e.isString(n))throw TypeError("requestType must be a string");if(!e.isString(o))throw TypeError("responseType must be a string");d.call(this,i,p),this.type=s||"rpc",this.requestType=n,this.requestStream=r?!0:void 0,this.responseType=o,this.responseStream=u?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=h,this.parsedOptions=c}return t.fromJSON=function(s,n){return new t(s,n.type,n.requestType,n.responseType,n.requestStream,n.responseStream,n.options,n.comment,n.parsedOptions)},t.prototype.toJSON=function(s){var n=s?!!s.keepComments:!1;return e.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",n?this.comment:void 0,"parsedOptions",this.parsedOptions])},t.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),d.prototype.resolve.call(this))},Pi}var ki,dn;function Li(){if(dn)return ki;dn=1,ki=s;var d=lt();((s.prototype=Object.create(d.prototype)).constructor=s).className="Service";var e=wi(),t=Ee(),i=Yr();function s(o,r){d.call(this,o,r),this.methods={},this._methodsArray=null}s.fromJSON=function(r,u){var p=new s(r,u.options);if(u.methods)for(var h=Object.keys(u.methods),c=0;c<h.length;++c)p.add(e.fromJSON(h[c],u.methods[h[c]]));return u.nested&&p.addJSON(u.nested),p.comment=u.comment,p},s.prototype.toJSON=function(r){var u=d.prototype.toJSON.call(this,r),p=r?!!r.keepComments:!1;return t.toObject(["options",u&&u.options||void 0,"methods",d.arrayToJSON(this.methodsArray,r)||{},"nested",u&&u.nested||void 0,"comment",p?this.comment:void 0])},Object.defineProperty(s.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=t.toArray(this.methods))}});function n(o){return o._methodsArray=null,o}return s.prototype.get=function(r){return this.methods[r]||d.prototype.get.call(this,r)},s.prototype.resolveAll=function(){for(var r=this.methodsArray,u=0;u<r.length;++u)r[u].resolve();return d.prototype.resolve.call(this)},s.prototype.add=function(r){if(this.get(r.name))throw Error("duplicate name '"+r.name+"' in "+this);return r instanceof e?(this.methods[r.name]=r,r.parent=this,n(this)):d.prototype.add.call(this,r)},s.prototype.remove=function(r){if(r instanceof e){if(this.methods[r.name]!==r)throw Error(r+" is not a member of "+this);return delete this.methods[r.name],r.parent=null,n(this)}return d.prototype.remove.call(this,r)},s.prototype.create=function(r,u,p){for(var h=new i.Service(r,u,p),c=0,y;c<this.methodsArray.length;++c){var _=t.lcFirst((y=this._methodsArray[c]).resolve().name).replace(/[^$\w_]/g,"");h[_]=t.codegen(["r","c"],t.isReserved(_)?_+"_":_)("return this.rpcCall(m,q,s,r,c)")({m:y,q:y.resolvedRequestType.ctor,s:y.resolvedResponseType.ctor})}return h},ki}var Ui,ln;function Gi(){if(ln)return Ui;ln=1,Ui=e;var d=Pe();function e(t){if(t)for(var i=Object.keys(t),s=0;s<i.length;++s)this[i[s]]=t[i[s]]}return e.create=function(i){return this.$type.create(i)},e.encode=function(i,s){return this.$type.encode(i,s)},e.encodeDelimited=function(i,s){return this.$type.encodeDelimited(i,s)},e.decode=function(i){return this.$type.decode(i)},e.decodeDelimited=function(i){return this.$type.decodeDelimited(i)},e.verify=function(i){return this.$type.verify(i)},e.fromObject=function(i){return this.$type.fromObject(i)},e.toObject=function(i,s){return this.$type.toObject(i,s)},e.prototype.toJSON=function(){return this.$type.toObject(this,d.toJSONOptions)},Ui}var Bi,pn;function un(){if(pn)return Bi;pn=1,Bi=s;var d=Ne(),e=We(),t=Ee();function i(n){return"missing required '"+n.name+"'"}function s(n){var o=t.codegen(["r","l"],n.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(n.fieldsArray.filter(function(y){return y.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");n.group&&o("if((t&7)===4)")("break"),o("switch(t>>>3){");for(var r=0;r<n.fieldsArray.length;++r){var u=n._fieldsArray[r].resolve(),p=u.resolvedType instanceof d?"int32":u.type,h="m"+t.safeProp(u.name);o("case %i: {",u.id),u.map?(o("if(%s===util.emptyObject)",h)("%s={}",h)("var c2 = r.uint32()+r.pos"),e.defaults[u.keyType]!==void 0?o("k=%j",e.defaults[u.keyType]):o("k=null"),e.defaults[p]!==void 0?o("value=%j",e.defaults[p]):o("value=null"),o("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",u.keyType)("case 2:"),e.basic[p]===void 0?o("value=types[%i].decode(r,r.uint32())",r):o("value=r.%s()",p),o("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),e.long[u.keyType]!==void 0?o('%s[typeof k==="object"?util.longToHash(k):k]=value',h):o("%s[k]=value",h)):u.repeated?(o("if(!(%s&&%s.length))",h,h)("%s=[]",h),e.packed[p]!==void 0&&o("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",h,p)("}else"),e.basic[p]===void 0?o(u.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",h,r):o("%s.push(r.%s())",h,p)):e.basic[p]===void 0?o(u.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",h,r):o("%s=r.%s()",h,p),o("break")("}")}for(o("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<n._fieldsArray.length;++r){var c=n._fieldsArray[r];c.required&&o("if(!m.hasOwnProperty(%j))",c.name)("throw util.ProtocolError(%j,{instance:m})",i(c))}return o("return m")}return Bi}var Vi,cn;function _n(){if(cn)return Vi;cn=1,Vi=n;var d=Ne(),e=Ee();function t(o,r){return o.name+": "+r+(o.repeated&&r!=="array"?"[]":o.map&&r!=="object"?"{k:"+o.keyType+"}":"")+" expected"}function i(o,r,u,p){if(r.resolvedType)if(r.resolvedType instanceof d){o("switch(%s){",p)("default:")("return%j",t(r,"enum value"));for(var h=Object.keys(r.resolvedType.values),c=0;c<h.length;++c)o("case %i:",r.resolvedType.values[h[c]]);o("break")("}")}else o("{")("var e=types[%i].verify(%s);",u,p)("if(e)")("return%j+e",r.name+".")("}");else switch(r.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.isInteger(%s))",p)("return%j",t(r,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",p,p,p,p)("return%j",t(r,"integer|Long"));break;case"float":case"double":o('if(typeof %s!=="number")',p)("return%j",t(r,"number"));break;case"bool":o('if(typeof %s!=="boolean")',p)("return%j",t(r,"boolean"));break;case"string":o("if(!util.isString(%s))",p)("return%j",t(r,"string"));break;case"bytes":o('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",t(r,"buffer"));break}return o}function s(o,r,u){switch(r.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.key32Re.test(%s))",u)("return%j",t(r,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.key64Re.test(%s))",u)("return%j",t(r,"integer|Long key"));break;case"bool":o("if(!util.key2Re.test(%s))",u)("return%j",t(r,"boolean key"));break}return o}function n(o){var r=e.codegen(["m"],o.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),u=o.oneofsArray,p={};u.length&&r("var p={}");for(var h=0;h<o.fieldsArray.length;++h){var c=o._fieldsArray[h].resolve(),y="m"+e.safeProp(c.name);if(c.optional&&r("if(%s!=null&&m.hasOwnProperty(%j)){",y,c.name),c.map)r("if(!util.isObject(%s))",y)("return%j",t(c,"object"))("var k=Object.keys(%s)",y)("for(var i=0;i<k.length;++i){"),s(r,c,"k[i]"),i(r,c,h,y+"[k[i]]")("}");else if(c.repeated)r("if(!Array.isArray(%s))",y)("return%j",t(c,"array"))("for(var i=0;i<%s.length;++i){",y),i(r,c,h,y+"[i]")("}");else{if(c.partOf){var _=e.safeProp(c.partOf.name);p[c.partOf.name]===1&&r("if(p%s===1)",_)("return%j",c.partOf.name+": multiple values"),p[c.partOf.name]=1,r("p%s=1",_)}i(r,c,h,y)}c.optional&&r("}")}return r("return null")}return Vi}var xi={},fn;function yn(){return fn||(fn=1,function(d){var e=d,t=Ne(),i=Ee();function s(o,r,u,p){var h=!1;if(r.resolvedType)if(r.resolvedType instanceof t){o("switch(d%s){",p);for(var c=r.resolvedType.values,y=Object.keys(c),_=0;_<y.length;++_)c[y[_]]===r.typeDefault&&!h&&(o("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',p,p,p),r.repeated||o("break"),h=!0),o("case%j:",y[_])("case %i:",c[y[_]])("m%s=%j",p,c[y[_]])("break");o("}")}else o('if(typeof d%s!=="object")',p)("throw TypeError(%j)",r.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",p,u,p);else{var E=!1;switch(r.type){case"double":case"float":o("m%s=Number(d%s)",p,p);break;case"uint32":case"fixed32":o("m%s=d%s>>>0",p,p);break;case"int32":case"sint32":case"sfixed32":o("m%s=d%s|0",p,p);break;case"uint64":E=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",p,p,E)('else if(typeof d%s==="string")',p)("m%s=parseInt(d%s,10)",p,p)('else if(typeof d%s==="number")',p)("m%s=d%s",p,p)('else if(typeof d%s==="object")',p)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",p,p,p,E?"true":"");break;case"bytes":o('if(typeof d%s==="string")',p)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",p,p,p)("else if(d%s.length >= 0)",p)("m%s=d%s",p,p);break;case"string":o("m%s=String(d%s)",p,p);break;case"bool":o("m%s=Boolean(d%s)",p,p);break}}return o}e.fromObject=function(r){var u=r.fieldsArray,p=i.codegen(["d"],r.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!u.length)return p("return new this.ctor");p("var m=new this.ctor");for(var h=0;h<u.length;++h){var c=u[h].resolve(),y=i.safeProp(c.name);c.map?(p("if(d%s){",y)('if(typeof d%s!=="object")',y)("throw TypeError(%j)",c.fullName+": object expected")("m%s={}",y)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",y),s(p,c,h,y+"[ks[i]]")("}")("}")):c.repeated?(p("if(d%s){",y)("if(!Array.isArray(d%s))",y)("throw TypeError(%j)",c.fullName+": array expected")("m%s=[]",y)("for(var i=0;i<d%s.length;++i){",y),s(p,c,h,y+"[i]")("}")("}")):(c.resolvedType instanceof t||p("if(d%s!=null){",y),s(p,c,h,y),c.resolvedType instanceof t||p("}"))}return p("return m")};function n(o,r,u,p){if(r.resolvedType)r.resolvedType instanceof t?o("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",p,u,p,p,u,p,p):o("d%s=types[%i].toObject(m%s,o)",p,u,p);else{var h=!1;switch(r.type){case"double":case"float":o("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",p,p,p,p);break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o('if(typeof m%s==="number")',p)("d%s=o.longs===String?String(m%s):m%s",p,p,p)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",p,p,p,p,h?"true":"",p);break;case"bytes":o("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",p,p,p,p,p);break;default:o("d%s=m%s",p,p);break}}return o}e.toObject=function(r){var u=r.fieldsArray.slice().sort(i.compareFieldsById);if(!u.length)return i.codegen()("return {}");for(var p=i.codegen(["m","o"],r.name+"$toObject")("if(!o)")("o={}")("var d={}"),h=[],c=[],y=[],_=0;_<u.length;++_)u[_].partOf||(u[_].resolve().repeated?h:u[_].map?c:y).push(u[_]);if(h.length){for(p("if(o.arrays||o.defaults){"),_=0;_<h.length;++_)p("d%s=[]",i.safeProp(h[_].name));p("}")}if(c.length){for(p("if(o.objects||o.defaults){"),_=0;_<c.length;++_)p("d%s={}",i.safeProp(c[_].name));p("}")}if(y.length){for(p("if(o.defaults){"),_=0;_<y.length;++_){var E=y[_],S=i.safeProp(E.name);if(E.resolvedType instanceof t)p("d%s=o.enums===String?%j:%j",S,E.resolvedType.valuesById[E.typeDefault],E.typeDefault);else if(E.long)p("if(util.Long){")("var n=new util.Long(%i,%i,%j)",E.typeDefault.low,E.typeDefault.high,E.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",S)("}else")("d%s=o.longs===String?%j:%i",S,E.typeDefault.toString(),E.typeDefault.toNumber());else if(E.bytes){var I="["+Array.prototype.slice.call(E.typeDefault).join(",")+"]";p("if(o.bytes===String)d%s=%j",S,String.fromCharCode.apply(String,E.typeDefault))("else{")("d%s=%s",S,I)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",S,S)("}")}else p("d%s=%j",S,E.typeDefault)}p("}")}var M=!1;for(_=0;_<u.length;++_){var E=u[_],m=r._fieldsArray.indexOf(E),S=i.safeProp(E.name);E.map?(M||(M=!0,p("var ks2")),p("if(m%s&&(ks2=Object.keys(m%s)).length){",S,S)("d%s={}",S)("for(var j=0;j<ks2.length;++j){"),n(p,E,m,S+"[ks2[j]]")("}")):E.repeated?(p("if(m%s&&m%s.length){",S,S)("d%s=[]",S)("for(var j=0;j<m%s.length;++j){",S),n(p,E,m,S+"[j]")("}")):(p("if(m%s!=null&&m.hasOwnProperty(%j)){",S,E.name),n(p,E,m,S),E.partOf&&p("if(o.oneofs)")("d%s=%j",i.safeProp(E.partOf.name),E.name)),p("}")}return p("return d")}}(xi)),xi}var Fi={},En;function hn(){return En||(En=1,function(d){var e=d,t=Gi();e[".google.protobuf.Any"]={fromObject:function(i){if(i&&i["@type"]){var s=i["@type"].substring(i["@type"].lastIndexOf("/")+1),n=this.lookup(s);if(n){var o=i["@type"].charAt(0)==="."?i["@type"].slice(1):i["@type"];return o.indexOf("/")===-1&&(o="/"+o),this.create({type_url:o,value:n.encode(n.fromObject(i)).finish()})}}return this.fromObject(i)},toObject:function(i,s){var n="type.googleapis.com/",o="",r="";if(s&&s.json&&i.type_url&&i.value){r=i.type_url.substring(i.type_url.lastIndexOf("/")+1),o=i.type_url.substring(0,i.type_url.lastIndexOf("/")+1);var u=this.lookup(r);u&&(i=u.decode(i.value))}if(!(i instanceof this.ctor)&&i instanceof t){var p=i.$type.toObject(i,s),h=i.$type.fullName[0]==="."?i.$type.fullName.slice(1):i.$type.fullName;return o===""&&(o=n),r=o+h,p["@type"]=r,p}return this.toObject(i,s)}}}(Fi)),Fi}var Ki,gn;function Hi(){if(gn)return Ki;gn=1,Ki=S;var d=lt();((S.prototype=Object.create(d.prototype)).constructor=S).className="Type";var e=Ne(),t=dt(),i=Fe(),s=Di(),n=Li(),o=Gi(),r=hi(),u=fi(),p=Ee(),h=An(),c=un(),y=_n(),_=yn(),E=hn();function S(M,m){d.call(this,M,m),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArr