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