o11y 238.2.0 → 238.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/o11y/client/client.js.map +1 -1
- package/dist/modules/o11y/client/collectors/core-collector/interfaces/CoreEnvelopeContents.d.ts +3 -3
- package/dist/modules/o11y/client/interfaces/Instrumentation.d.ts +3 -4
- package/dist/modules/o11y/client/interfaces/index.d.ts +1 -0
- package/dist/modules/o11y/client/library/InstrumentationImpl.d.ts +1 -2
- package/dist/modules/o11y/client/library/NextgenImpl.d.ts +2 -4
- package/dist/modules/o11y/client/shared/index.d.ts +1 -1
- package/dist/modules/o11y/collectors/collectors/core-collector/interfaces/CoreEnvelopeContents.d.ts +3 -3
- package/dist/modules/o11y/collectors/collectors.js +1 -1
- package/dist/modules/o11y/collectors/collectors.js.map +1 -1
- package/dist/modules/o11y/collectors/interfaces/Instrumentation.d.ts +3 -4
- package/dist/modules/o11y/collectors/interfaces/index.d.ts +1 -0
- package/dist/modules/o11y/collectors/library/InstrumentationImpl.d.ts +1 -2
- package/dist/modules/o11y/collectors/library/NextgenImpl.d.ts +2 -4
- package/dist/modules/o11y/collectors/shared/index.d.ts +1 -1
- package/dist/modules/o11y/shared/collectors/core-collector/interfaces/CoreEnvelopeContents.d.ts +3 -3
- package/dist/modules/o11y/shared/interfaces/Instrumentation.d.ts +3 -4
- package/dist/modules/o11y/shared/interfaces/index.d.ts +1 -0
- package/dist/modules/o11y/shared/library/InstrumentationImpl.d.ts +1 -2
- package/dist/modules/o11y/shared/library/NextgenImpl.d.ts +2 -4
- package/dist/modules/o11y/shared/shared/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/modules/o11y/client/collectors/core-collector/interfaces/CoreEnvelopeContents.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UpCounter } from '
|
|
2
|
-
import { ValueRecorder } from '
|
|
3
|
-
import { Schema } from '
|
|
1
|
+
import { UpCounter } from '../../metrics/UpCounter';
|
|
2
|
+
import { ValueRecorder } from '../../metrics/ValueRecorder';
|
|
3
|
+
import { Schema } from '../../../interfaces';
|
|
4
4
|
import { LogMessage } from './LogMessage';
|
|
5
5
|
import { StaticAttributes } from './StaticAttributes';
|
|
6
6
|
export interface CoreEnvelopeContents {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { LightningElement, MetricsTags, SchematizedData } from 'o11y/shared';
|
|
2
|
-
import { LogPromptListener } from 'src/shared/TypeDefinitions';
|
|
1
|
+
import { LightningElement, LogPromptListener, MetricsTags, SchematizedData } from 'o11y/shared';
|
|
3
2
|
import { Activity } from './Activity';
|
|
4
3
|
import { ApiOptions } from './ApiOptions';
|
|
5
4
|
import { DomEventApiOptions } from './DomEventApiOptions';
|
|
6
5
|
import { Schema } from './Schema';
|
|
7
6
|
export interface Instrumentation {
|
|
8
|
-
log(userSchemaOrText: Schema, userData?: SchematizedData, options?: ApiOptions): void;
|
|
7
|
+
log(userSchemaOrText: Schema | string, userData?: SchematizedData, options?: ApiOptions): void;
|
|
9
8
|
error(error: unknown, userSchemaOrText?: Schema | string, userData?: SchematizedData, options?: ApiOptions): void;
|
|
10
9
|
startActivity(name: string, options?: ApiOptions): Activity;
|
|
11
|
-
domEvent(event: Event, handledBy: HTMLElement | LightningElement, userSchemaOrText?: Schema, userData?: SchematizedData, options?: DomEventApiOptions): void;
|
|
10
|
+
domEvent(event: Event, handledBy: HTMLElement | LightningElement, userSchemaOrText?: Schema | string, userData?: SchematizedData, options?: DomEventApiOptions): void;
|
|
12
11
|
incrementCounter(operation: string, increment?: number, hasError?: boolean, tags?: MetricsTags): void;
|
|
13
12
|
trackValue(operation: string, value: number, hasError?: boolean, tags?: MetricsTags): void;
|
|
14
13
|
registerForLogPrompt(listener: LogPromptListener): void;
|
|
@@ -10,6 +10,7 @@ export { InstrumentationContext } from './InstrumentationContext';
|
|
|
10
10
|
export { InstrumentedAppMethods } from './InstrumentedAppMethods';
|
|
11
11
|
export { InstrumentedAppOptions } from './InstrumentedAppOptions';
|
|
12
12
|
export { LogCollector } from './LogCollector';
|
|
13
|
+
export { LogCollectorOptions } from './LogCollectorOptions';
|
|
13
14
|
export { LogMeta } from './LogMeta';
|
|
14
15
|
export { Metric } from './Metric';
|
|
15
16
|
export { MetricsCollector } from './MetricsCollector';
|
|
@@ -4,8 +4,7 @@ import { onActivityError } from './ActivityImpl';
|
|
|
4
4
|
import { MetricsImpl } from './MetricsImpl';
|
|
5
5
|
import { NextgenImpl } from './NextgenImpl';
|
|
6
6
|
import { PublicSafety } from './PublicSafety';
|
|
7
|
-
import { LightningElement, MetricsTags, SchematizedData } from 'o11y/shared';
|
|
8
|
-
import { LogPromptListener } from 'src/shared/TypeDefinitions';
|
|
7
|
+
import { LightningElement, LogPromptListener, MetricsTags, SchematizedData } from 'o11y/shared';
|
|
9
8
|
export declare class InstrumentationImpl implements Instrumentation, MetricsReporter {
|
|
10
9
|
private readonly _nextGen;
|
|
11
10
|
private readonly _name;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { BufferedLog, Instrumentation, InstrumentationContext, InstrumentedAppMethods, InstrumentedAppOptions, LogCollector, MetricsCollector, Nextgen, PayloadProvider, Schema, SchematizedPayload } from '../interfaces';
|
|
1
|
+
import { BufferedLog, Instrumentation, InstrumentationContext, InstrumentedAppMethods, InstrumentedAppOptions, LogCollector, LogCollectorOptions, MetricsCollector, Nextgen, PayloadProvider, Schema, SchematizedPayload } from '../interfaces';
|
|
2
2
|
import { AutomaticClickTracker } from './AutomaticClickTracker';
|
|
3
|
-
import { SchematizedData } from 'o11y/shared';
|
|
4
|
-
import { LogCollectorOptions } from 'src/interfaces/LogCollectorOptions';
|
|
5
|
-
import { LogPromptListener } from 'src/shared/TypeDefinitions';
|
|
3
|
+
import { LogPromptListener, SchematizedData } from 'o11y/shared';
|
|
6
4
|
export declare class NextgenImpl implements Nextgen {
|
|
7
5
|
private readonly _logCollectors;
|
|
8
6
|
private readonly _instruments;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { LazyMapToList } from './LazyMapToList';
|
|
2
2
|
export { utility } from './Utility';
|
|
3
3
|
export { schemaUtil } from './SchemaUtil';
|
|
4
|
-
export
|
|
4
|
+
export * from './TypeDefinitions';
|
package/dist/modules/o11y/collectors/collectors/core-collector/interfaces/CoreEnvelopeContents.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UpCounter } from '
|
|
2
|
-
import { ValueRecorder } from '
|
|
3
|
-
import { Schema } from '
|
|
1
|
+
import { UpCounter } from '../../metrics/UpCounter';
|
|
2
|
+
import { ValueRecorder } from '../../metrics/ValueRecorder';
|
|
3
|
+
import { Schema } from '../../../interfaces';
|
|
4
4
|
import { LogMessage } from './LogMessage';
|
|
5
5
|
import { StaticAttributes } from './StaticAttributes';
|
|
6
6
|
export interface CoreEnvelopeContents {
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
7
|
-
var __protobufjs;!function(g){var r,e,t;r={1:[function(o,s){s.exports=function(o,s){for(var a=Array(arguments.length-1),u=0,l=2,p=!0;l<arguments.length;)a[u++]=arguments[l++];return new Promise((function(l,f){a[u]=function(o){if(p)if(p=!1,o)f(o);else{for(var s=Array(arguments.length-1),a=0;a<s.length;)s[a++]=arguments[a];l.apply(null,s)}};try{o.apply(s||null,a)}catch(o){p&&(p=!1,f(o))}}))}},{}],2:[function(o,s,a){var u=a;u.length=function(o){var s=o.length;if(!s)return 0;for(var a=0;1<--s%4&&"="==o[0|s];)++a;return Math.ceil(3*o.length)/4-a};for(var l=Array(64),p=Array(123),f=0;f<64;)p[l[f]=f<26?f+65:f<52?f+71:f<62?f-4:f-59|43]=f++;u.encode=function(o,s,a){for(var u,p=null,f=[],c=0,h=0;s<a;){var d=o[s++];switch(h){case 0:f[c++]=l[d>>2],u=(3&d)<<4,h=1;break;case 1:f[c++]=l[u|d>>4],u=(15&d)<<2,h=2;break;case 2:f[c++]=l[u|d>>6],f[c++]=l[63&d],h=0}8191<c&&((p=p||[]).push(String.fromCharCode.apply(String,f)),c=0)}return h&&(f[c++]=l[u],f[c++]=61,1===h&&(f[c++]=61)),p?(c&&p.push(String.fromCharCode.apply(String,f.slice(0,c))),p.join("")):String.fromCharCode.apply(String,f.slice(0,c))};var c="invalid encoding";u.decode=function(o,s,a){for(var u,l=a,f=0,h=0;h<o.length;){var d=o.charCodeAt(h++);if(61===d&&1<f)break;if((d=p[d])===g)throw Error(c);switch(f){case 0:u=d,f=1;break;case 1:s[a++]=u<<2|(48&d)>>4,u=d,f=2;break;case 2:s[a++]=(15&u)<<4|(60&d)>>2,u=d,f=3;break;case 3:s[a++]=(3&u)<<6|d,f=0}}if(1===f)throw Error(c);return a-l},u.test=function(o){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o)}},{}],3:[function(o,s){(s.exports=function o(s,a){"string"==typeof s&&(a=s,s=g);var u=[];function l(s){if("string"!=typeof s){var a=p();if(o.verbose&&console.log("codegen: "+a),a="return "+a,s){for(var f=Object.keys(s),c=Array(f.length+1),h=Array(f.length),d=0;d<f.length;)c[d]=f[d],h[d]=s[f[d++]];return c[d]=a,Function.apply(null,c).apply(null,h)}return Function(a)()}for(var y=Array(arguments.length-1),m=0;m<y.length;)y[m]=arguments[++m];if(m=0,s=s.replace(/%([%dfijs])/g,(function(o,s){var a=y[m++];switch(s){case"d":case"f":return+a+"";case"i":return Math.floor(a)+"";case"j":return JSON.stringify(a);case"s":return a+""}return"%"})),m!==y.length)throw Error("parameter count mismatch");return u.push(s),l}function p(o){return"function "+(o||a||"")+"("+(s&&s.join(",")||"")+"){\n "+u.join("\n ")+"\n}"}return l.toString=p,l}).verbose=!1},{}],4:[function(o,s){function a(){this.t={}}(s.exports=a).prototype.on=function(o,s,a){return(this.t[o]||(this.t[o]=[])).push({fn:s,ctx:a||this}),this},a.prototype.off=function(o,s){if(o===g)this.t={};else if(s===g)this.t[o]=[];else for(var a=this.t[o],u=0;u<a.length;)a[u].fn===s?a.splice(u,1):++u;return this},a.prototype.emit=function(o){var s=this.t[o];if(s){for(var a=[],u=1;u<arguments.length;)a.push(arguments[u++]);for(u=0;u<s.length;)s[u].fn.apply(s[u++].ctx,a)}return this}},{}],5:[function(o,s){s.exports=l;var a=o(1),u=o(7)("fs");function l(o,s,p){return s="function"==typeof s?(p=s,{}):s||{},p?!s.xhr&&u&&u.readFile?u.readFile(o,(function(a,u){return a&&"undefined"!=typeof XMLHttpRequest?l.xhr(o,s,p):a?p(a):p(null,s.binary?u:u.toString("utf8"))})):l.xhr(o,s,p):a(l,this,o,s)}l.xhr=function(o,s,a){var u=new XMLHttpRequest;u.onreadystatechange=function(){if(4!==u.readyState)return g;if(0!==u.status&&200!==u.status)return a(Error("status "+u.status));if(s.binary){var o=u.response;if(!o){o=[];for(var l=0;l<u.responseText.length;++l)o.push(255&u.responseText.charCodeAt(l))}return a(null,"undefined"!=typeof Uint8Array?new Uint8Array(o):o)}return a(null,u.responseText)},s.binary&&("overrideMimeType"in u&&u.overrideMimeType("text/plain; charset=x-user-defined"),u.responseType="arraybuffer"),u.open("GET",o),u.send()}},{1:1,7:7}],6:[function(o,s){function a(o){function s(o,s,a,u){var l=s<0?1:0;if(l&&(s=-s),0===s)o(0<1/s?0:2147483648,a,u);else if(isNaN(s))o(2143289344,a,u);else if(34028234663852886e22<s)o((l<<31|2139095040)>>>0,a,u);else if(s<11754943508222875e-54)o((l<<31|Math.round(s/1401298464324817e-60))>>>0,a,u);else{var p=Math.floor(Math.log(s)/Math.LN2);o((l<<31|127+p<<23|8388607&Math.round(s*Math.pow(2,-p)*8388608))>>>0,a,u)}}function a(o,s,a){var u=o(s,a),l=2*(u>>31)+1,p=u>>>23&255,f=8388607&u;return 255==p?f?NaN:1/0*l:0==p?1401298464324817e-60*l*f:l*Math.pow(2,p-150)*(8388608+f)}function c(o,s,a){m[0]=o,s[a]=v[0],s[a+1]=v[1],s[a+2]=v[2],s[a+3]=v[3]}function h(o,s,a){m[0]=o,s[a]=v[3],s[a+1]=v[2],s[a+2]=v[1],s[a+3]=v[0]}function d(o,s){return v[0]=o[s],v[1]=o[s+1],v[2]=o[s+2],v[3]=o[s+3],m[0]}function y(o,s){return v[3]=o[s],v[2]=o[s+1],v[1]=o[s+2],v[0]=o[s+3],m[0]}var m,v,b,w,O,j;function E(o,s,a,u,l,p){var f=u<0?1:0;if(f&&(u=-u),0===u)o(0,l,p+s),o(0<1/u?0:2147483648,l,p+a);else if(isNaN(u))o(0,l,p+s),o(2146959360,l,p+a);else if(17976931348623157e292<u)o(0,l,p+s),o((f<<31|2146435072)>>>0,l,p+a);else{var c;if(u<22250738585072014e-324)o((c=u/5e-324)>>>0,l,p+s),o((f<<31|c/4294967296)>>>0,l,p+a);else{var h=Math.floor(Math.log(u)/Math.LN2);1024===h&&(h=1023),o(4503599627370496*(c=u*Math.pow(2,-h))>>>0,l,p+s),o((f<<31|h+1023<<20|1048576*c&1048575)>>>0,l,p+a)}}}function k(o,s,a,u,l){var p=o(u,l+s),f=o(u,l+a),c=2*(f>>31)+1,h=f>>>20&2047,d=4294967296*(1048575&f)+p;return 2047==h?d?NaN:1/0*c:0==h?5e-324*c*d:c*Math.pow(2,h-1075)*(d+4503599627370496)}function T(o,s,a){w[0]=o,s[a]=O[0],s[a+1]=O[1],s[a+2]=O[2],s[a+3]=O[3],s[a+4]=O[4],s[a+5]=O[5],s[a+6]=O[6],s[a+7]=O[7]}function S(o,s,a){w[0]=o,s[a]=O[7],s[a+1]=O[6],s[a+2]=O[5],s[a+3]=O[4],s[a+4]=O[3],s[a+5]=O[2],s[a+6]=O[1],s[a+7]=O[0]}function A(o,s){return O[0]=o[s],O[1]=o[s+1],O[2]=o[s+2],O[3]=o[s+3],O[4]=o[s+4],O[5]=o[s+5],O[6]=o[s+6],O[7]=o[s+7],w[0]}function N(o,s){return O[7]=o[s],O[6]=o[s+1],O[5]=o[s+2],O[4]=o[s+3],O[3]=o[s+4],O[2]=o[s+5],O[1]=o[s+6],O[0]=o[s+7],w[0]}return"undefined"!=typeof Float32Array?(m=new Float32Array([-0]),b=128===(v=new Uint8Array(m.buffer))[3],o.writeFloatLE=b?c:h,o.writeFloatBE=b?h:c,o.readFloatLE=b?d:y,o.readFloatBE=b?y:d):(o.writeFloatLE=s.bind(null,u),o.writeFloatBE=s.bind(null,l),o.readFloatLE=a.bind(null,p),o.readFloatBE=a.bind(null,f)),"undefined"!=typeof Float64Array?(w=new Float64Array([-0]),j=128===(O=new Uint8Array(w.buffer))[7],o.writeDoubleLE=j?T:S,o.writeDoubleBE=j?S:T,o.readDoubleLE=j?A:N,o.readDoubleBE=j?N:A):(o.writeDoubleLE=E.bind(null,u,0,4),o.writeDoubleBE=E.bind(null,l,4,0),o.readDoubleLE=k.bind(null,p,0,4),o.readDoubleBE=k.bind(null,f,4,0)),o}function u(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}function l(o,s,a){s[a]=o>>>24,s[a+1]=o>>>16&255,s[a+2]=o>>>8&255,s[a+3]=255&o}function p(o,s){return(o[s]|o[s+1]<<8|o[s+2]<<16|o[s+3]<<24)>>>0}function f(o,s){return(o[s]<<24|o[s+1]<<16|o[s+2]<<8|o[s+3])>>>0}s.exports=a(a)},{}],7:[function(t,i,n){function r(t){try{var i=eval("require")(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}i.exports=r},{}],8:[function(o,s,a){var u=a,l=u.isAbsolute=function(o){return/^(?:\/|\w+:)/.test(o)},p=u.normalize=function(o){var s=(o=o.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),a=l(o),u="";a&&(u=s.shift()+"/");for(var p=0;p<s.length;)".."===s[p]?0<p&&".."!==s[p-1]?s.splice(--p,2):a?s.splice(p,1):++p:"."===s[p]?s.splice(p,1):++p;return u+s.join("/")};u.resolve=function(o,s,a){return a||(s=p(s)),l(s)?s:(a||(o=p(o)),(o=o.replace(/(?:\/|^)[^/]+$/,"")).length?p(o+"/"+s):s)}},{}],9:[function(o,s){s.exports=function(o,s,a){var u=a||8192,l=u>>>1,p=null,f=u;return function(a){if(a<1||l<a)return o(a);u<f+a&&(p=o(u),f=0);var c=s.call(p,f,f+=a);return 7&f&&(f=1+(7|f)),c}}},{}],10:[function(o,s,a){var u=a;u.length=function(o){for(var s=0,a=0,u=0;u<o.length;++u)(a=o.charCodeAt(u))<128?s+=1:a<2048?s+=2:55296==(64512&a)&&56320==(64512&o.charCodeAt(u+1))?(++u,s+=4):s+=3;return s},u.read=function(o,s,a){if(a-s<1)return"";for(var u,l=null,p=[],f=0;s<a;)(u=o[s++])<128?p[f++]=u:191<u&&u<224?p[f++]=(31&u)<<6|63&o[s++]:239<u&&u<365?(u=((7&u)<<18|(63&o[s++])<<12|(63&o[s++])<<6|63&o[s++])-65536,p[f++]=55296+(u>>10),p[f++]=56320+(1023&u)):p[f++]=(15&u)<<12|(63&o[s++])<<6|63&o[s++],8191<f&&((l=l||[]).push(String.fromCharCode.apply(String,p)),f=0);return l?(f&&l.push(String.fromCharCode.apply(String,p.slice(0,f))),l.join("")):String.fromCharCode.apply(String,p.slice(0,f))},u.write=function(o,s,a){for(var u,l,p=a,f=0;f<o.length;++f)(u=o.charCodeAt(f))<128?s[a++]=u:(u<2048?s[a++]=u>>6|192:(55296==(64512&u)&&56320==(64512&(l=o.charCodeAt(f+1)))?(u=65536+((1023&u)<<10)+(1023&l),++f,s[a++]=u>>18|240,s[a++]=u>>12&63|128):s[a++]=u>>12|224,s[a++]=u>>6&63|128),s[a++]=63&u|128);return a-p}},{}],11:[function(o,s,a){var u=a,l=o(14),p=o(33);function f(o,s,a,u){if(s.resolvedType)if(s.resolvedType instanceof l){o("switch(d%s){",u);for(var p=s.resolvedType.values,f=Object.keys(p),c=0;c<f.length;++c)s.repeated&&p[f[c]]===s.typeDefault&&o("default:"),o("case%j:",f[c])("case %i:",p[f[c]])("m%s=%j",u,p[f[c]])("break");o("}")}else o('if(typeof d%s!=="object")',u)("throw TypeError(%j)",s.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",u,a,u);else{var h=!1;switch(s.type){case"double":case"float":o("m%s=Number(d%s)",u,u);break;case"uint32":case"fixed32":o("m%s=d%s>>>0",u,u);break;case"int32":case"sint32":case"sfixed32":o("m%s=d%s|0",u,u);break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o("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":o('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)",u)("m%s=d%s",u,u);break;case"string":o("m%s=String(d%s)",u,u);break;case"bool":o("m%s=Boolean(d%s)",u,u)}}return o}function c(o,s,a,u){if(s.resolvedType)s.resolvedType instanceof l?o("d%s=o.enums===String?types[%i].values[m%s]:m%s",u,a,u,u):o("d%s=types[%i].toObject(m%s,o)",u,a,u);else{var p=!1;switch(s.type){case"double":case"float":o("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",u,u,u,u);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o('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,p?"true":"",u);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",u,u,u,u,u);break;default:o("d%s=m%s",u,u)}}return o}u.fromObject=function(o){var s=o.fieldsArray,a=p.codegen(["d"],o.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!s.length)return a("return new this.ctor");a("var m=new this.ctor");for(var u=0;u<s.length;++u){var c=s[u].resolve(),h=p.safeProp(c.name);c.map?(a("if(d%s){",h)('if(typeof d%s!=="object")',h)("throw TypeError(%j)",c.fullName+": object expected")("m%s={}",h)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",h),f(a,c,u,h+"[ks[i]]")("}")("}")):c.repeated?(a("if(d%s){",h)("if(!Array.isArray(d%s))",h)("throw TypeError(%j)",c.fullName+": array expected")("m%s=[]",h)("for(var i=0;i<d%s.length;++i){",h),f(a,c,u,h+"[i]")("}")("}")):(c.resolvedType instanceof l||a("if(d%s!=null){",h),f(a,c,u,h),c.resolvedType instanceof l||a("}"))}return a("return m")},u.toObject=function(o){var s=o.fieldsArray.slice().sort(p.compareFieldsById);if(!s.length)return p.codegen()("return {}");for(var a=p.codegen(["m","o"],o.name+"$toObject")("if(!o)")("o={}")("var d={}"),u=[],f=[],h=[],d=0;d<s.length;++d)s[d].partOf||(s[d].resolve().repeated?u:s[d].map?f:h).push(s[d]);if(u.length){for(a("if(o.arrays||o.defaults){"),d=0;d<u.length;++d)a("d%s=[]",p.safeProp(u[d].name));a("}")}if(f.length){for(a("if(o.objects||o.defaults){"),d=0;d<f.length;++d)a("d%s={}",p.safeProp(f[d].name));a("}")}if(h.length){for(a("if(o.defaults){"),d=0;d<h.length;++d){var y=h[d],m=p.safeProp(y.name);if(y.resolvedType instanceof l)a("d%s=o.enums===String?%j:%j",m,y.resolvedType.valuesById[y.typeDefault],y.typeDefault);else if(y.long)a("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",m)("}else")("d%s=o.longs===String?%j:%i",m,y.typeDefault.toString(),y.typeDefault.toNumber());else if(y.bytes){var v="["+Array.prototype.slice.call(y.typeDefault).join(",")+"]";a("if(o.bytes===String)d%s=%j",m,String.fromCharCode.apply(String,y.typeDefault))("else{")("d%s=%s",m,v)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",m,m)("}")}else a("d%s=%j",m,y.typeDefault)}a("}")}var b=!1;for(d=0;d<s.length;++d){y=s[d];var w=o.i.indexOf(y);m=p.safeProp(y.name),y.map?(b||(b=!0,a("var ks2")),a("if(m%s&&(ks2=Object.keys(m%s)).length){",m,m)("d%s={}",m)("for(var j=0;j<ks2.length;++j){"),c(a,y,w,m+"[ks2[j]]")("}")):y.repeated?(a("if(m%s&&m%s.length){",m,m)("d%s=[]",m)("for(var j=0;j<m%s.length;++j){",m),c(a,y,w,m+"[j]")("}")):(a("if(m%s!=null&&m.hasOwnProperty(%j)){",m,y.name),c(a,y,w,m),y.partOf&&a("if(o.oneofs)")("d%s=%j",p.safeProp(y.partOf.name),y.name)),a("}")}return a("return d")}},{14:14,33:33}],12:[function(o,s){s.exports=function(o){var s=l.codegen(["r","l"],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(o){return o.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&s("if((t&7)===4)")("break"),s("switch(t>>>3){");for(var p=0;p<o.fieldsArray.length;++p){var f=o.i[p].resolve(),c=f.resolvedType instanceof a?"int32":f.type,h="m"+l.safeProp(f.name);s("case %i:",f.id),f.map?(s("if(%s===util.emptyObject)",h)("%s={}",h)("var c2 = r.uint32()+r.pos"),u.defaults[f.keyType]!==g?s("k=%j",u.defaults[f.keyType]):s("k=null"),u.defaults[c]!==g?s("value=%j",u.defaults[c]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",f.keyType)("case 2:"),u.basic[c]===g?s("value=types[%i].decode(r,r.uint32())",p):s("value=r.%s()",c),s("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),u.long[f.keyType]!==g?s('%s[typeof k==="object"?util.longToHash(k):k]=value',h):s("%s[k]=value",h)):f.repeated?(s("if(!(%s&&%s.length))",h,h)("%s=[]",h),u.packed[c]!==g&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",h,c)("}else"),u.basic[c]===g?s(f.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",h,p):s("%s.push(r.%s())",h,c)):u.basic[c]===g?s(f.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",h,p):s("%s=r.%s()",h,c),s("break")}for(s("default:")("r.skipType(t&7)")("break")("}")("}"),p=0;p<o.i.length;++p){var d=o.i[p];d.required&&s("if(!m.hasOwnProperty(%j))",d.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+d.name+"'")}return s("return m")};var a=o(14),u=o(32),l=o(33)},{14:14,32:32,33:33}],13:[function(o,s){s.exports=function(o){for(var s,f=l.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),c=o.fieldsArray.slice().sort(l.compareFieldsById),h=0;h<c.length;++h){var d=c[h].resolve(),y=o.i.indexOf(d),m=d.resolvedType instanceof a?"int32":d.type,v=u.basic[m];s="m"+l.safeProp(d.name),d.map?(f("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,d.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(d.id<<3|2)>>>0,8|u.mapKey[d.keyType],d.keyType),v===g?f("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",y,s):f(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|v,m,s),f("}")("}")):d.repeated?(f("if(%s!=null&&%s.length){",s,s),d.packed&&u.packed[m]!==g?f("w.uint32(%i).fork()",(d.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",m,s)("w.ldelim()"):(f("for(var i=0;i<%s.length;++i)",s),v===g?p(f,d,y,s+"[i]"):f("w.uint32(%i).%s(%s[i])",(d.id<<3|v)>>>0,m,s)),f("}")):(d.optional&&f("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,d.name),v===g?p(f,d,y,s):f("w.uint32(%i).%s(%s)",(d.id<<3|v)>>>0,m,s))}return f("return w")};var a=o(14),u=o(32),l=o(33);function p(o,s,a,u){return s.resolvedType.group?o("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",a,u,(s.id<<3|3)>>>0,(s.id<<3|4)>>>0):o("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",a,u,(s.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="Enum";var u=o(21),l=o(33);function p(o,s,u,l,p){if(a.call(this,o,u),s&&"object"!=typeof s)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=l,this.comments=p||{},this.reserved=g,s)for(var f=Object.keys(s),c=0;c<f.length;++c)"number"==typeof s[f[c]]&&(this.valuesById[this.values[f[c]]=s[f[c]]]=f[c])}p.fromJSON=function(o,s){var a=new p(o,s.values,s.options,s.comment,s.comments);return a.reserved=s.reserved,a},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return l.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"comment",s?this.comment:g,"comments",s?this.comments:g])},p.prototype.add=function(o,s,a){if(!l.isString(o))throw TypeError("name must be a string");if(!l.isInteger(s))throw TypeError("id must be an integer");if(this.values[o]!==g)throw Error("duplicate name '"+o+"' in "+this);if(this.isReservedId(s))throw Error("id "+s+" is reserved in "+this);if(this.isReservedName(o))throw Error("name '"+o+"' is reserved in "+this);if(this.valuesById[s]!==g){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+s+" in "+this);this.values[o]=s}else this.valuesById[this.values[o]=s]=o;return this.comments[o]=a||null,this},p.prototype.remove=function(o){if(!l.isString(o))throw TypeError("name must be a string");var s=this.values[o];if(null==s)throw Error("name '"+o+"' does not exist in "+this);return delete this.valuesById[s],delete this.values[o],delete this.comments[o],this},p.prototype.isReservedId=function(o){return u.isReservedId(this.reserved,o)},p.prototype.isReservedName=function(o){return u.isReservedName(this.reserved,o)}},{21:21,22:22,33:33}],15:[function(o,s){s.exports=h;var a=o(22);((h.prototype=Object.create(a.prototype)).constructor=h).className="Field";var u,l=o(14),p=o(32),f=o(33),c=/^required|optional|repeated$/;function h(o,s,u,l,h,d,y){if(f.isObject(l)?(y=h,d=l,l=h=g):f.isObject(h)&&(y=d,d=h,h=g),a.call(this,o,d),!f.isInteger(s)||s<0)throw TypeError("id must be a non-negative integer");if(!f.isString(u))throw TypeError("type must be a string");if(l!==g&&!c.test(l=l.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(h!==g&&!f.isString(h))throw TypeError("extend must be a string");this.rule=l&&"optional"!==l?l:g,this.type=u,this.id=s,this.extend=h||g,this.required="required"===l,this.optional=!this.required,this.repeated="repeated"===l,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!f.Long&&p.long[u]!==g,this.bytes="bytes"===u,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.n=null,this.comment=y}h.fromJSON=function(o,s){return new h(o,s.id,s.type,s.rule,s.extend,s.options,s.comment)},Object.defineProperty(h.prototype,"packed",{get:function(){return null===this.n&&(this.n=!1!==this.getOption("packed")),this.n}}),h.prototype.setOption=function(o,s,u){return"packed"===o&&(this.n=null),a.prototype.setOption.call(this,o,s,u)},h.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return f.toObject(["rule","optional"!==this.rule&&this.rule||g,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},h.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=p.defaults[this.type])===g&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof u?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof l&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(this.options.packed===g||!this.resolvedType||this.resolvedType instanceof l)||delete this.options.packed,Object.keys(this.options).length||(this.options=g)),this.long)this.typeDefault=f.Long.fromNumber(this.typeDefault,"u"==this.type[0]),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var o;f.base64.test(this.typeDefault)?f.base64.decode(this.typeDefault,o=f.newBuffer(f.base64.length(this.typeDefault)),0):f.utf8.write(this.typeDefault,o=f.newBuffer(f.utf8.length(this.typeDefault)),0),this.typeDefault=o}return this.map?this.defaultValue=f.emptyObject:this.repeated?this.defaultValue=f.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),a.prototype.resolve.call(this)},h.d=function(o,s,a,u){return"function"==typeof s?s=f.decorateType(s).name:s&&"object"==typeof s&&(s=f.decorateEnum(s).name),function(l,p){f.decorateType(l.constructor).add(new h(p,o,s,a,{default:u}))}},h.r=function(o){u=o}},{14:14,22:22,32:32,33:33}],16:[function(o,s){var a=s.exports=o(17);a.build="light",a.load=function(o,s,u){return(s="function"==typeof s?(u=s,new a.Root):s||new a.Root).load(o,u)},a.loadSync=function(o,s){return(s=s||new a.Root).loadSync(o)},a.encoder=o(13),a.decoder=o(12),a.verifier=o(36),a.converter=o(11),a.ReflectionObject=o(22),a.Namespace=o(21),a.Root=o(26),a.Enum=o(14),a.Type=o(31),a.Field=o(15),a.OneOf=o(23),a.MapField=o(18),a.Service=o(30),a.Method=o(20),a.Message=o(19),a.wrappers=o(37),a.types=o(32),a.util=o(33),a.ReflectionObject.r(a.Root),a.Namespace.r(a.Type,a.Service,a.Enum),a.Root.r(a.Type),a.Field.r(a.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,36:36,37:37}],17:[function(o,s,a){var u=a;u.build="minimal",u.Writer=o(38),u.BufferWriter=o(39),u.Reader=o(24),u.BufferReader=o(25),u.util=o(35),u.rpc=o(28),u.roots=o(27),(u.configure=function(){u.util.r(),u.Writer.r(u.BufferWriter),u.Reader.r(u.BufferReader)})()},{24:24,25:25,27:27,28:28,35:35,38:38,39:39}],18:[function(o,s){s.exports=p;var a=o(15);((p.prototype=Object.create(a.prototype)).constructor=p).className="MapField";var u=o(32),l=o(33);function p(o,s,u,p,f,c){if(a.call(this,o,s,p,g,g,f,c),!l.isString(u))throw TypeError("keyType must be a string");this.keyType=u,this.resolvedKeyType=null,this.map=!0}p.fromJSON=function(o,s){return new p(o,s.id,s.keyType,s.type,s.options,s.comment)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return l.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},p.prototype.resolve=function(){if(this.resolved)return this;if(u.mapKey[this.keyType]===g)throw Error("invalid key type: "+this.keyType);return a.prototype.resolve.call(this)},p.d=function(o,s,a){return"function"==typeof a?a=l.decorateType(a).name:a&&"object"==typeof a&&(a=l.decorateEnum(a).name),function(u,f){l.decorateType(u.constructor).add(new p(f,o,s,a))}}},{15:15,32:32,33:33}],19:[function(o,s){s.exports=u;var a=o(35);function u(o){if(o)for(var s=Object.keys(o),a=0;a<s.length;++a)this[s[a]]=o[s[a]]}u.create=function(o){return this.$type.create(o)},u.encode=function(o,s){return this.$type.encode(o,s)},u.encodeDelimited=function(o,s){return this.$type.encodeDelimited(o,s)},u.decode=function(o){return this.$type.decode(o)},u.decodeDelimited=function(o){return this.$type.decodeDelimited(o)},u.verify=function(o){return this.$type.verify(o)},u.fromObject=function(o){return this.$type.fromObject(o)},u.toObject=function(o,s){return this.$type.toObject(o,s)},u.prototype.toJSON=function(){return this.$type.toObject(this,a.toJSONOptions)}},{35:35}],20:[function(o,s){s.exports=l;var a=o(22);((l.prototype=Object.create(a.prototype)).constructor=l).className="Method";var u=o(33);function l(o,s,l,p,f,c,h,d,y){if(u.isObject(f)?(h=f,f=c=g):u.isObject(c)&&(h=c,c=g),s!==g&&!u.isString(s))throw TypeError("type must be a string");if(!u.isString(l))throw TypeError("requestType must be a string");if(!u.isString(p))throw TypeError("responseType must be a string");a.call(this,o,h),this.type=s||"rpc",this.requestType=l,this.requestStream=!!f||g,this.responseType=p,this.responseStream=!!c||g,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=d,this.parsedOptions=y}l.fromJSON=function(o,s){return new l(o,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},l.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["type","rpc"!==this.type&&this.type||g,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",s?this.comment:g,"parsedOptions",this.parsedOptions])},l.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),a.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(o,s){s.exports=d;var a=o(22);((d.prototype=Object.create(a.prototype)).constructor=d).className="Namespace";var u,l,p,f=o(15),c=o(33);function h(o,s){if(!o||!o.length)return g;for(var a={},u=0;u<o.length;++u)a[o[u].name]=o[u].toJSON(s);return a}function d(o,s){a.call(this,o,s),this.nested=g,this.e=null}function y(o){return o.e=null,o}d.fromJSON=function(o,s){return new d(o,s.options).addJSON(s.nested)},d.arrayToJSON=h,d.isReservedId=function(o,s){if(o)for(var a=0;a<o.length;++a)if("string"!=typeof o[a]&&o[a][0]<=s&&o[a][1]>s)return!0;return!1},d.isReservedName=function(o,s){if(o)for(var a=0;a<o.length;++a)if(o[a]===s)return!0;return!1},Object.defineProperty(d.prototype,"nestedArray",{get:function(){return this.e||(this.e=c.toArray(this.nested))}}),d.prototype.toJSON=function(o){return c.toObject(["options",this.options,"nested",h(this.nestedArray,o)])},d.prototype.addJSON=function(o){if(o)for(var s,a=Object.keys(o),c=0;c<a.length;++c)s=o[a[c]],this.add((s.fields!==g?u.fromJSON:s.values!==g?p.fromJSON:s.methods!==g?l.fromJSON:s.id!==g?f.fromJSON:d.fromJSON)(a[c],s));return this},d.prototype.get=function(o){return this.nested&&this.nested[o]||null},d.prototype.getEnum=function(o){if(this.nested&&this.nested[o]instanceof p)return this.nested[o].values;throw Error("no such enum: "+o)},d.prototype.add=function(o){if(!(o instanceof f&&o.extend!==g||o instanceof u||o instanceof p||o instanceof l||o instanceof d))throw TypeError("object must be a valid nested object");if(this.nested){var s=this.get(o.name);if(s){if(!(s instanceof d&&o instanceof d)||s instanceof u||s instanceof l)throw Error("duplicate name '"+o.name+"' in "+this);for(var a=s.nestedArray,c=0;c<a.length;++c)o.add(a[c]);this.remove(s),this.nested||(this.nested={}),o.setOptions(s.options,!0)}}else this.nested={};return(this.nested[o.name]=o).onAdd(this),y(this)},d.prototype.remove=function(o){if(!(o instanceof a))throw TypeError("object must be a ReflectionObject");if(o.parent!==this)throw Error(o+" is not a member of "+this);return delete this.nested[o.name],Object.keys(this.nested).length||(this.nested=g),o.onRemove(this),y(this)},d.prototype.define=function(o,s){if(c.isString(o))o=o.split(".");else if(!Array.isArray(o))throw TypeError("illegal path");if(o&&o.length&&""===o[0])throw Error("path must be relative");for(var a=this;0<o.length;){var u=o.shift();if(a.nested&&a.nested[u]){if(!((a=a.nested[u])instanceof d))throw Error("path conflicts with non-namespace objects")}else a.add(a=new d(u))}return s&&a.addJSON(s),a},d.prototype.resolveAll=function(){for(var o=this.nestedArray,s=0;s<o.length;)o[s]instanceof d?o[s++].resolveAll():o[s++].resolve();return this.resolve()},d.prototype.lookup=function(o,s,a){if("boolean"==typeof s?(a=s,s=g):s&&!Array.isArray(s)&&(s=[s]),c.isString(o)&&o.length){if("."===o)return this.root;o=o.split(".")}else if(!o.length)return this;if(""===o[0])return this.root.lookup(o.slice(1),s);var u=this.get(o[0]);if(u){if(1===o.length){if(!s||~s.indexOf(u.constructor))return u}else if(u instanceof d&&(u=u.lookup(o.slice(1),s,!0)))return u}else for(var l=0;l<this.nestedArray.length;++l)if(this.e[l]instanceof d&&(u=this.e[l].lookup(o,s,!0)))return u;return null===this.parent||a?null:this.parent.lookup(o,s)},d.prototype.lookupType=function(o){var s=this.lookup(o,[u]);if(!s)throw Error("no such type: "+o);return s},d.prototype.lookupEnum=function(o){var s=this.lookup(o,[p]);if(!s)throw Error("no such Enum '"+o+"' in "+this);return s},d.prototype.lookupTypeOrEnum=function(o){var s=this.lookup(o,[u,p]);if(!s)throw Error("no such Type or Enum '"+o+"' in "+this);return s},d.prototype.lookupService=function(o){var s=this.lookup(o,[l]);if(!s)throw Error("no such Service '"+o+"' in "+this);return s},d.r=function(o,s,a){u=o,l=s,p=a}},{15:15,22:22,33:33}],22:[function(o,s){(s.exports=l).className="ReflectionObject";var a,u=o(33);function l(o,s){if(!u.isString(o))throw TypeError("name must be a string");if(s&&!u.isObject(s))throw TypeError("options must be an object");this.options=s,this.parsedOptions=null,this.name=o,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(l.prototype,{root:{get:function(){for(var o=this;null!==o.parent;)o=o.parent;return o}},fullName:{get:function(){for(var o=[this.name],s=this.parent;s;)o.unshift(s.name),s=s.parent;return o.join(".")}}}),l.prototype.toJSON=function(){throw Error()},l.prototype.onAdd=function(o){this.parent&&this.parent!==o&&this.parent.remove(this),this.parent=o,this.resolved=!1;var s=o.root;s instanceof a&&s.u(this)},l.prototype.onRemove=function(o){var s=o.root;s instanceof a&&s.o(this),this.parent=null,this.resolved=!1},l.prototype.resolve=function(){return this.resolved||this.root instanceof a&&(this.resolved=!0),this},l.prototype.getOption=function(o){return this.options?this.options[o]:g},l.prototype.setOption=function(o,s,a){return a&&this.options&&this.options[o]!==g||((this.options||(this.options={}))[o]=s),this},l.prototype.setParsedOption=function(o,s,a){this.parsedOptions||(this.parsedOptions=[]);var l=this.parsedOptions;if(a){var p=l.find((function(s){return Object.prototype.hasOwnProperty.call(s,o)}));if(p){var f=p[o];u.setProperty(f,a,s)}else(p={})[o]=u.setProperty({},a,s),l.push(p)}else{var c={};c[o]=s,l.push(c)}return this},l.prototype.setOptions=function(o,s){if(o)for(var a=Object.keys(o),u=0;u<a.length;++u)this.setOption(a[u],o[a[u]],s);return this},l.prototype.toString=function(){var o=this.constructor.className,s=this.fullName;return s.length?o+" "+s:o},l.r=function(o){a=o}},{33:33}],23:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="OneOf";var u=o(15),l=o(33);function p(o,s,u,l){if(Array.isArray(s)||(u=s,s=g),a.call(this,o,u),s!==g&&!Array.isArray(s))throw TypeError("fieldNames must be an Array");this.oneof=s||[],this.fieldsArray=[],this.comment=l}function f(o){if(o.parent)for(var s=0;s<o.fieldsArray.length;++s)o.fieldsArray[s].parent||o.parent.add(o.fieldsArray[s])}p.fromJSON=function(o,s){return new p(o,s.oneof,s.options,s.comment)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return l.toObject(["options",this.options,"oneof",this.oneof,"comment",s?this.comment:g])},p.prototype.add=function(o){if(!(o instanceof u))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),f(o.partOf=this),this},p.prototype.remove=function(o){if(!(o instanceof u))throw TypeError("field must be a Field");var s=this.fieldsArray.indexOf(o);if(s<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(s,1),-1<(s=this.oneof.indexOf(o.name))&&this.oneof.splice(s,1),o.partOf=null,this},p.prototype.onAdd=function(o){a.prototype.onAdd.call(this,o);for(var s=0;s<this.oneof.length;++s){var u=o.get(this.oneof[s]);u&&!u.partOf&&(u.partOf=this).fieldsArray.push(u)}f(this)},p.prototype.onRemove=function(o){for(var s,u=0;u<this.fieldsArray.length;++u)(s=this.fieldsArray[u]).parent&&s.parent.remove(s);a.prototype.onRemove.call(this,o)},p.d=function(){for(var o=Array(arguments.length),s=0;s<arguments.length;)o[s]=arguments[s++];return function(s,a){l.decorateType(s.constructor).add(new p(a,o)),Object.defineProperty(s,a,{get:l.oneOfGetter(o),set:l.oneOfSetter(o)})}}},{15:15,22:22,33:33}],24:[function(o,s){s.exports=c;var a,u=o(35),l=u.LongBits,p=u.utf8;function f(o,s){return RangeError("index out of range: "+o.pos+" + "+(s||1)+" > "+o.len)}function c(o){this.buf=o,this.pos=0,this.len=o.length}function h(){return u.Buffer?function(o){return(c.create=function(o){return u.Buffer.isBuffer(o)?new a(o):y(o)})(o)}:y}var d,y="undefined"!=typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new c(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new c(o);throw Error("illegal buffer")};function m(){var o=new l(0,0),s=0;if(!(4<this.len-this.pos)){for(;s<3;++s){if(this.pos>=this.len)throw f(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*s)>>>0,o}for(;s<4;++s)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;if(s=0,4<this.len-this.pos){for(;s<5;++s)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}else for(;s<5;++s){if(this.pos>=this.len)throw f(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function v(o,s){return(o[s-4]|o[s-3]<<8|o[s-2]<<16|o[s-1]<<24)>>>0}function b(){if(this.pos+8>this.len)throw f(this,8);return new l(v(this.buf,this.pos+=4),v(this.buf,this.pos+=4))}c.create=h(),c.prototype.f=u.Array.prototype.subarray||u.Array.prototype.slice,c.prototype.uint32=(d=4294967295,function(){if(d=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return d;if((this.pos+=5)>this.len)throw this.pos=this.len,f(this,10);return d}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw f(this,4);return v(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw f(this,4);return 0|v(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw f(this,4);var o=u.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},c.prototype.double=function(){if(this.pos+8>this.len)throw f(this,4);var o=u.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},c.prototype.bytes=function(){var o=this.uint32(),s=this.pos,a=this.pos+o;if(a>this.len)throw f(this,o);return this.pos+=o,Array.isArray(this.buf)?this.buf.slice(s,a):s===a?new this.buf.constructor(0):this.f.call(this.buf,s,a)},c.prototype.string=function(){var o=this.bytes();return p.read(o,0,o.length)},c.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw f(this,o);this.pos+=o}else do{if(this.pos>=this.len)throw f(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},c.r=function(o){a=o,c.create=h(),a.r();var s=u.Long?"toLong":"toNumber";u.merge(c.prototype,{int64:function(){return m.call(this)[s](!1)},uint64:function(){return m.call(this)[s](!0)},sint64:function(){return m.call(this).zzDecode()[s](!1)},fixed64:function(){return b.call(this)[s](!0)},sfixed64:function(){return b.call(this)[s](!1)}})}},{35:35}],25:[function(o,s){s.exports=l;var a=o(24);(l.prototype=Object.create(a.prototype)).constructor=l;var u=o(35);function l(o){a.call(this,o)}l.r=function(){u.Buffer&&(l.prototype.f=u.Buffer.prototype.slice)},l.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},l.r()},{24:24,35:35}],26:[function(o,s){s.exports=y;var a=o(21);((y.prototype=Object.create(a.prototype)).constructor=y).className="Root";var u,l,p,f=o(15),c=o(14),h=o(23),d=o(33);function y(o){a.call(this,"",o),this.deferred=[],this.files=[]}function m(){}y.fromJSON=function(o,s){return s=s||new y,o.options&&s.setOptions(o.options),s.addJSON(o.nested)},y.prototype.resolvePath=d.path.resolve,y.prototype.fetch=d.fetch,y.prototype.load=function o(s,a,u){"function"==typeof a&&(u=a,a=g);var f=this;if(!u)return d.asPromise(o,f,s,a);var c=u===m;function h(o,s){if(u){var a=u;if(u=null,c)throw o;a(o,s)}}function y(o){var s=o.lastIndexOf("google/protobuf/");if(-1<s){var a=o.substring(s);if(a in p)return a}return null}function v(o,s){try{if(d.isString(s)&&"{"==s[0]&&(s=JSON.parse(s)),d.isString(s)){l.filename=o;var u,p=l(s,f,a),m=0;if(p.imports)for(;m<p.imports.length;++m)(u=y(p.imports[m])||f.resolvePath(o,p.imports[m]))&&b(u);if(p.weakImports)for(m=0;m<p.weakImports.length;++m)(u=y(p.weakImports[m])||f.resolvePath(o,p.weakImports[m]))&&b(u,!0)}else f.setOptions(s.options).addJSON(s.nested)}catch(o){h(o)}c||w||h(null,f)}function b(o,s){if(!~f.files.indexOf(o))if(f.files.push(o),o in p)c?v(o,p[o]):(++w,setTimeout((function(){--w,v(o,p[o])})));else if(c){var a;try{a=d.fs.readFileSync(o).toString("utf8")}catch(a){return void(s||h(a))}v(o,a)}else++w,f.fetch(o,(function(a,l){--w,u&&(a?s?w||h(null,f):h(a):v(o,l))}))}var w=0;d.isString(s)&&(s=[s]);for(var O,j=0;j<s.length;++j)(O=f.resolvePath("",s[j]))&&b(O);return c?f:(w||h(null,f),g)},y.prototype.loadSync=function(o,s){if(!d.isNode)throw Error("not supported");return this.load(o,s,m)},y.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(o){return"'extend "+o.extend+"' in "+o.parent.fullName})).join(", "));return a.prototype.resolveAll.call(this)};var v=/^[A-Z]/;function b(o,s){var a=s.parent.lookup(s.extend);if(a){var u=new f(s.fullName,s.id,s.type,s.rule,g,s.options);return(u.declaringField=s).extensionField=u,a.add(u),1}}y.prototype.u=function(o){if(o instanceof f)o.extend===g||o.extensionField||b(0,o)||this.deferred.push(o);else if(o instanceof c)v.test(o.name)&&(o.parent[o.name]=o.values);else if(!(o instanceof h)){if(o instanceof u)for(var s=0;s<this.deferred.length;)b(0,this.deferred[s])?this.deferred.splice(s,1):++s;for(var a=0;a<o.nestedArray.length;++a)this.u(o.e[a]);v.test(o.name)&&(o.parent[o.name]=o)}},y.prototype.o=function(o){if(o instanceof f){if(o.extend!==g)if(o.extensionField)o.extensionField.parent.remove(o.extensionField),o.extensionField=null;else{var s=this.deferred.indexOf(o);-1<s&&this.deferred.splice(s,1)}}else if(o instanceof c)v.test(o.name)&&delete o.parent[o.name];else if(o instanceof a){for(var u=0;u<o.nestedArray.length;++u)this.o(o.e[u]);v.test(o.name)&&delete o.parent[o.name]}},y.r=function(o,s,a){u=o,l=s,p=a}},{14:14,15:15,21:21,23:23,33:33}],27:[function(o,s){s.exports={}},{}],28:[function(o,s,a){a.Service=o(29)},{29:29}],29:[function(o,s){s.exports=u;var a=o(35);function u(o,s,u){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!s,this.responseDelimited=!!u}((u.prototype=Object.create(a.EventEmitter.prototype)).constructor=u).prototype.rpcCall=function o(s,u,l,p,f){if(!p)throw TypeError("request must be specified");var c=this;if(!f)return a.asPromise(o,c,s,u,l,p);if(!c.rpcImpl)return setTimeout((function(){f(Error("already ended"))}),0),g;try{return c.rpcImpl(s,u[c.requestDelimited?"encodeDelimited":"encode"](p).finish(),(function(o,a){if(o)return c.emit("error",o,s),f(o);if(null===a)return c.end(!0),g;if(!(a instanceof l))try{a=l[c.responseDelimited?"decodeDelimited":"decode"](a)}catch(o){return c.emit("error",o,s),f(o)}return c.emit("data",a,s),f(null,a)}))}catch(o){return c.emit("error",o,s),setTimeout((function(){f(o)}),0),g}},u.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(o,s){s.exports=f;var a=o(21);((f.prototype=Object.create(a.prototype)).constructor=f).className="Service";var u=o(20),l=o(33),p=o(28);function f(o,s){a.call(this,o,s),this.methods={},this.h=null}function c(o){return o.h=null,o}f.fromJSON=function(o,s){var a=new f(o,s.options);if(s.methods)for(var l=Object.keys(s.methods),p=0;p<l.length;++p)a.add(u.fromJSON(l[p],s.methods[l[p]]));return s.nested&&a.addJSON(s.nested),a.comment=s.comment,a},f.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),u=!!o&&!!o.keepComments;return l.toObject(["options",s&&s.options||g,"methods",a.arrayToJSON(this.methodsArray,o)||{},"nested",s&&s.nested||g,"comment",u?this.comment:g])},Object.defineProperty(f.prototype,"methodsArray",{get:function(){return this.h||(this.h=l.toArray(this.methods))}}),f.prototype.get=function(o){return this.methods[o]||a.prototype.get.call(this,o)},f.prototype.resolveAll=function(){for(var o=this.methodsArray,s=0;s<o.length;++s)o[s].resolve();return a.prototype.resolve.call(this)},f.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);return o instanceof u?c((this.methods[o.name]=o).parent=this):a.prototype.add.call(this,o)},f.prototype.remove=function(o){if(o instanceof u){if(this.methods[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.methods[o.name],o.parent=null,c(this)}return a.prototype.remove.call(this,o)},f.prototype.create=function(o,s,a){for(var u,f=new p.Service(o,s,a),c=0;c<this.methodsArray.length;++c){var h=l.lcFirst((u=this.h[c]).resolve().name).replace(/[^$\w_]/g,"");f[h]=l.codegen(["r","c"],l.isReserved(h)?h+"_":h)("return this.rpcCall(m,q,s,r,c)")({m:u,q:u.resolvedRequestType.ctor,s:u.resolvedResponseType.ctor})}return f}},{20:20,21:21,28:28,33:33}],31:[function(o,s){s.exports=E;var a=o(21);((E.prototype=Object.create(a.prototype)).constructor=E).className="Type";var u=o(14),l=o(23),p=o(15),f=o(18),c=o(30),h=o(19),d=o(24),y=o(38),m=o(33),v=o(13),b=o(12),w=o(36),O=o(11),j=o(37);function E(o,s){a.call(this,o,s),this.fields={},this.oneofs=g,this.extensions=g,this.reserved=g,this.group=g,this.c=null,this.i=null,this.a=null,this.l=null}function k(o){return o.c=o.i=o.a=null,delete o.encode,delete o.decode,delete o.verify,o}Object.defineProperties(E.prototype,{fieldsById:{get:function(){if(this.c)return this.c;this.c={};for(var o=Object.keys(this.fields),s=0;s<o.length;++s){var a=this.fields[o[s]],u=a.id;if(this.c[u])throw Error("duplicate id "+u+" in "+this);this.c[u]=a}return this.c}},fieldsArray:{get:function(){return this.i||(this.i=m.toArray(this.fields))}},oneofsArray:{get:function(){return this.a||(this.a=m.toArray(this.oneofs))}},ctor:{get:function(){return this.l||(this.ctor=E.generateConstructor(this)())},set:function(o){var s=o.prototype;s instanceof h||((o.prototype=new h).constructor=o,m.merge(o.prototype,s)),o.$type=o.prototype.$type=this,m.merge(o,h,!0),this.l=o;for(var a=0;a<this.fieldsArray.length;++a)this.i[a].resolve();var u={};for(a=0;a<this.oneofsArray.length;++a)u[this.a[a].resolve().name]={get:m.oneOfGetter(this.a[a].oneof),set:m.oneOfSetter(this.a[a].oneof)};a&&Object.defineProperties(o.prototype,u)}}}),E.generateConstructor=function(o){for(var s,a=m.codegen(["p"],o.name),u=0;u<o.fieldsArray.length;++u)(s=o.i[u]).map?a("this%s={}",m.safeProp(s.name)):s.repeated&&a("this%s=[]",m.safeProp(s.name));return a("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]]")},E.fromJSON=function(o,s){var h=new E(o,s.options);h.extensions=s.extensions,h.reserved=s.reserved;for(var d=Object.keys(s.fields),y=0;y<d.length;++y)h.add((void 0!==s.fields[d[y]].keyType?f.fromJSON:p.fromJSON)(d[y],s.fields[d[y]]));if(s.oneofs)for(d=Object.keys(s.oneofs),y=0;y<d.length;++y)h.add(l.fromJSON(d[y],s.oneofs[d[y]]));if(s.nested)for(d=Object.keys(s.nested),y=0;y<d.length;++y){var m=s.nested[d[y]];h.add((m.id!==g?p.fromJSON:m.fields!==g?E.fromJSON:m.values!==g?u.fromJSON:m.methods!==g?c.fromJSON:a.fromJSON)(d[y],m))}return s.extensions&&s.extensions.length&&(h.extensions=s.extensions),s.reserved&&s.reserved.length&&(h.reserved=s.reserved),s.group&&(h.group=!0),s.comment&&(h.comment=s.comment),h},E.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),u=!!o&&!!o.keepComments;return m.toObject(["options",s&&s.options||g,"oneofs",a.arrayToJSON(this.oneofsArray,o),"fields",a.arrayToJSON(this.fieldsArray.filter((function(o){return!o.declaringField})),o)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:g,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"group",this.group||g,"nested",s&&s.nested||g,"comment",u?this.comment:g])},E.prototype.resolveAll=function(){for(var o=this.fieldsArray,s=0;s<o.length;)o[s++].resolve();var u=this.oneofsArray;for(s=0;s<u.length;)u[s++].resolve();return a.prototype.resolveAll.call(this)},E.prototype.get=function(o){return this.fields[o]||this.oneofs&&this.oneofs[o]||this.nested&&this.nested[o]||null},E.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);if(o instanceof p&&o.extend===g){if(this.c?this.c[o.id]:this.fieldsById[o.id])throw Error("duplicate id "+o.id+" in "+this);if(this.isReservedId(o.id))throw Error("id "+o.id+" is reserved in "+this);if(this.isReservedName(o.name))throw Error("name '"+o.name+"' is reserved in "+this);return o.parent&&o.parent.remove(o),(this.fields[o.name]=o).message=this,o.onAdd(this),k(this)}return o instanceof l?(this.oneofs||(this.oneofs={}),(this.oneofs[o.name]=o).onAdd(this),k(this)):a.prototype.add.call(this,o)},E.prototype.remove=function(o){if(o instanceof p&&o.extend===g){if(!this.fields||this.fields[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.fields[o.name],o.parent=null,o.onRemove(this),k(this)}if(o instanceof l){if(!this.oneofs||this.oneofs[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.oneofs[o.name],o.parent=null,o.onRemove(this),k(this)}return a.prototype.remove.call(this,o)},E.prototype.isReservedId=function(o){return a.isReservedId(this.reserved,o)},E.prototype.isReservedName=function(o){return a.isReservedName(this.reserved,o)},E.prototype.create=function(o){return new this.ctor(o)},E.prototype.setup=function(){for(var o=this.fullName,s=[],a=0;a<this.fieldsArray.length;++a)s.push(this.i[a].resolve().resolvedType);this.encode=v(this)({Writer:y,types:s,util:m}),this.decode=b(this)({Reader:d,types:s,util:m}),this.verify=w(this)({types:s,util:m}),this.fromObject=O.fromObject(this)({types:s,util:m}),this.toObject=O.toObject(this)({types:s,util:m});var u=j[o];if(u){var l=Object.create(this);l.fromObject=this.fromObject,this.fromObject=u.fromObject.bind(l),l.toObject=this.toObject,this.toObject=u.toObject.bind(l)}return this},E.prototype.encode=function(o,s){return this.setup().encode(o,s)},E.prototype.encodeDelimited=function(o,s){return this.encode(o,s&&s.len?s.fork():s).ldelim()},E.prototype.decode=function(o,s){return this.setup().decode(o,s)},E.prototype.decodeDelimited=function(o){return o instanceof d||(o=d.create(o)),this.decode(o,o.uint32())},E.prototype.verify=function(o){return this.setup().verify(o)},E.prototype.fromObject=function(o){return this.setup().fromObject(o)},E.prototype.toObject=function(o,s){return this.setup().toObject(o,s)},E.d=function(o){return function(s){m.decorateType(s,o)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,36:36,37:37,38:38}],32:[function(o,s,a){var u=a,l=o(33),p=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function f(o,s){var a=0,u={};for(s|=0;a<o.length;)u[p[a+s]]=o[a++];return u}u.basic=f([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=f([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",l.emptyArray,null]),u.long=f([0,0,0,1,1],7),u.mapKey=f([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=f([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(o,s){var a,u,l=s.exports=o(35),p=o(27);l.codegen=o(3),l.fetch=o(5),l.path=o(8),l.fs=l.inquire("fs"),l.toArray=function(o){if(o){for(var s=Object.keys(o),a=Array(s.length),u=0;u<s.length;)a[u]=o[s[u++]];return a}return[]},l.toObject=function(o){for(var s={},a=0;a<o.length;){var u=o[a++],l=o[a++];l!==g&&(s[u]=l)}return s};var f=/\\/g,c=/"/g;l.isReserved=function(o){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(o)},l.safeProp=function(o){return!/^[$\w_]+$/.test(o)||l.isReserved(o)?'["'+o.replace(f,"\\\\").replace(c,'\\"')+'"]':"."+o},l.ucFirst=function(o){return o[0].toUpperCase()+o.substring(1)};var h=/_([a-z])/g;l.camelCase=function(o){return o.substring(0,1)+o.substring(1).replace(h,(function(o,s){return s.toUpperCase()}))},l.compareFieldsById=function(o,s){return o.id-s.id},l.decorateType=function(s,u){if(s.$type)return u&&s.$type.name!==u&&(l.decorateRoot.remove(s.$type),s.$type.name=u,l.decorateRoot.add(s.$type)),s.$type;var p=new(a=a||o(31))(u||s.name);return l.decorateRoot.add(p),p.ctor=s,Object.defineProperty(s,"$type",{value:p,enumerable:!1}),Object.defineProperty(s.prototype,"$type",{value:p,enumerable:!1}),p};var d=0;l.decorateEnum=function(s){if(s.$type)return s.$type;var a=new(u=u||o(14))("Enum"+d++,s);return l.decorateRoot.add(a),Object.defineProperty(s,"$type",{value:a,enumerable:!1}),a},l.setProperty=function(o,s,a){if("object"!=typeof o)throw TypeError("dst must be an object");if(!s)throw TypeError("path must be specified");return function o(s,a,u){var l=a.shift();if(0<a.length)s[l]=o(s[l]||{},a,u);else{var p=s[l];p&&(u=[].concat(p).concat(u)),s[l]=u}return s}(o,s=s.split("."),a)},Object.defineProperty(l,"decorateRoot",{get:function(){return p.decorated||(p.decorated=new(o(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,5:5,8:8}],34:[function(o,s){s.exports=u;var a=o(35);function u(o,s){this.lo=o>>>0,this.hi=s>>>0}var l=u.zero=new u(0,0);l.toNumber=function(){return 0},l.zzEncode=l.zzDecode=function(){return this},l.length=function(){return 1};var p=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(o){if(0===o)return l;var s=o<0;s&&(o=-o);var a=o>>>0,p=(o-a)/4294967296>>>0;return s&&(p=~p>>>0,a=~a>>>0,4294967295<++a&&(a=0,4294967295<++p&&(p=0))),new u(a,p)},u.from=function(o){if("number"==typeof o)return u.fromNumber(o);if(a.isString(o)){if(!a.Long)return u.fromNumber(parseInt(o,10));o=a.Long.fromString(o)}return o.low||o.high?new u(o.low>>>0,o.high>>>0):l},u.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var s=1+~this.lo>>>0,a=~this.hi>>>0;return s||(a=a+1>>>0),-(s+4294967296*a)}return this.lo+4294967296*this.hi},u.prototype.toLong=function(o){return a.Long?new a.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var f=String.prototype.charCodeAt;u.fromHash=function(o){return o===p?l:new u((f.call(o,0)|f.call(o,1)<<8|f.call(o,2)<<16|f.call(o,3)<<24)>>>0,(f.call(o,4)|f.call(o,5)<<8|f.call(o,6)<<16|f.call(o,7)<<24)>>>0)},u.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},u.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},u.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},u.prototype.length=function(){var o=this.lo,s=(this.lo>>>28|this.hi<<4)>>>0,a=this.hi>>>24;return 0==a?0==s?o<16384?o<128?1:2:o<2097152?3:4:s<16384?s<128?5:6:s<2097152?7:8:a<128?9:10}},{35:35}],35:[function(o,s,a){var u=a;function l(o,s,a){for(var u=Object.keys(s),l=0;l<u.length;++l)o[u[l]]!==g&&a||(o[u[l]]=s[u[l]]);return o}function p(o){function s(o,a){if(!(this instanceof s))return new s(o,a);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),a&&l(this,a)}return(s.prototype=Object.create(Error.prototype)).constructor=s,Object.defineProperty(s.prototype,"name",{get:function(){return o}}),s.prototype.toString=function(){return this.name+": "+this.message},s}u.asPromise=o(1),u.base64=o(2),u.EventEmitter=o(4),u.float=o(6),u.inquire=o(7),u.utf8=o(10),u.pool=o(9),u.LongBits=o(34),u.isNode=!!("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),u.global=u.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,u.emptyArray=Object.freeze?Object.freeze([]):[],u.emptyObject=Object.freeze?Object.freeze({}):{},u.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},u.isString=function(o){return"string"==typeof o||o instanceof String},u.isObject=function(o){return o&&"object"==typeof o},u.isset=u.isSet=function(o,s){var a=o[s];return null!=a&&o.hasOwnProperty(s)&&("object"!=typeof a||0<(Array.isArray(a)?a.length:Object.keys(a).length))},u.Buffer=null,u.v=null,u.b=null,u.newBuffer=function(o){return"number"==typeof o?u.Buffer?u.b(o):new u.Array(o):u.Buffer?u.v(o):"undefined"==typeof Uint8Array?o:new Uint8Array(o)},u.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,u.Long=u.global.dcodeIO&&u.global.dcodeIO.Long||u.global.Long||u.inquire("long"),u.key2Re=/^true|false|0|1$/,u.key32Re=/^-?(?:0|[1-9][0-9]*)$/,u.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,u.longToHash=function(o){return o?u.LongBits.from(o).toHash():u.LongBits.zeroHash},u.longFromHash=function(o,s){var a=u.LongBits.fromHash(o);return u.Long?u.Long.fromBits(a.lo,a.hi,s):a.toNumber(!!s)},u.merge=l,u.lcFirst=function(o){return o[0].toLowerCase()+o.substring(1)},u.newError=p,u.ProtocolError=p("ProtocolError"),u.oneOfGetter=function(o){for(var s={},a=0;a<o.length;++a)s[o[a]]=1;return function(){for(var o=Object.keys(this),a=o.length-1;-1<a;--a)if(1===s[o[a]]&&this[o[a]]!==g&&null!==this[o[a]])return o[a]}},u.oneOfSetter=function(o){return function(s){for(var a=0;a<o.length;++a)o[a]!==s&&delete this[o[a]]}},u.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},u.r=function(){var o=u.Buffer;o?(u.v=o.from!==Uint8Array.from&&o.from||function(s,a){return new o(s,a)},u.b=o.allocUnsafe||function(s){return new o(s)}):u.v=u.b=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(o,s){s.exports=function(o){var s=u.codegen(["m"],o.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),a={};o.oneofsArray.length&&s("var p={}");for(var c=0;c<o.fieldsArray.length;++c){var h=o.i[c].resolve(),d="m"+u.safeProp(h.name);if(h.optional&&s("if(%s!=null&&m.hasOwnProperty(%j)){",d,h.name),h.map)s("if(!util.isObject(%s))",d)("return%j",l(h,"object"))("var k=Object.keys(%s)",d)("for(var i=0;i<k.length;++i){"),f(s,h,"k[i]"),p(s,h,c,d+"[k[i]]")("}");else if(h.repeated)s("if(!Array.isArray(%s))",d)("return%j",l(h,"array"))("for(var i=0;i<%s.length;++i){",d),p(s,h,c,d+"[i]")("}");else{if(h.partOf){var y=u.safeProp(h.partOf.name);1===a[h.partOf.name]&&s("if(p%s===1)",y)("return%j",h.partOf.name+": multiple values"),a[h.partOf.name]=1,s("p%s=1",y)}p(s,h,c,d)}h.optional&&s("}")}return s("return null")};var a=o(14),u=o(33);function l(o,s){return o.name+": "+s+(o.repeated&&"array"!==s?"[]":o.map&&"object"!==s?"{k:"+o.keyType+"}":"")+" expected"}function p(o,s,u,p){if(s.resolvedType)if(s.resolvedType instanceof a){o("switch(%s){",p)("default:")("return%j",l(s,"enum value"));for(var f=Object.keys(s.resolvedType.values),c=0;c<f.length;++c)o("case %i:",s.resolvedType.values[f[c]]);o("break")("}")}else o("{")("var e=types[%i].verify(%s);",u,p)("if(e)")("return%j+e",s.name+".")("}");else switch(s.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.isInteger(%s))",p)("return%j",l(s,"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",l(s,"integer|Long"));break;case"float":case"double":o('if(typeof %s!=="number")',p)("return%j",l(s,"number"));break;case"bool":o('if(typeof %s!=="boolean")',p)("return%j",l(s,"boolean"));break;case"string":o("if(!util.isString(%s))",p)("return%j",l(s,"string"));break;case"bytes":o('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',p,p,p)("return%j",l(s,"buffer"))}return o}function f(o,s,a){switch(s.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.key32Re.test(%s))",a)("return%j",l(s,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.key64Re.test(%s))",a)("return%j",l(s,"integer|Long key"));break;case"bool":o("if(!util.key2Re.test(%s))",a)("return%j",l(s,"boolean key"))}return o}},{14:14,33:33}],37:[function(o,s,a){var u=a,l=o(19);u[".google.protobuf.Any"]={fromObject:function(o){if(o&&o["@type"]){var s=o["@type"].substring(1+o["@type"].lastIndexOf("/")),a=this.lookup(s);if(a){var u="."==o["@type"][0]?o["@type"].substr(1):o["@type"];return~u.indexOf("/")||(u="/"+u),this.create({type_url:u,value:a.encode(a.fromObject(o)).finish()})}}return this.fromObject(o)},toObject:function(o,s){var a="",u="";if(s&&s.json&&o.type_url&&o.value){u=o.type_url.substring(1+o.type_url.lastIndexOf("/")),a=o.type_url.substring(0,1+o.type_url.lastIndexOf("/"));var p=this.lookup(u);p&&(o=p.decode(o.value))}if(o instanceof this.ctor||!(o instanceof l))return this.toObject(o,s);var f=o.$type.toObject(o,s);return""===a&&(a="type.googleapis.com/"),u=a+("."===o.$type.fullName[0]?o.$type.fullName.substr(1):o.$type.fullName),f["@type"]=u,f}}},{19:19}],38:[function(o,s){s.exports=y;var a,u=o(35),l=u.LongBits,p=u.base64,f=u.utf8;function c(o,s,a){this.fn=o,this.len=s,this.next=g,this.val=a}function h(){}function d(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function y(){this.len=0,this.head=new c(h,0,0),this.tail=this.head,this.states=null}function m(){return u.Buffer?function(){return(y.create=function(){return new a})()}:function(){return new y}}function v(o,s,a){s[a]=255&o}function b(o,s){this.len=o,this.next=g,this.val=s}function w(o,s,a){for(;o.hi;)s[a++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;127<o.lo;)s[a++]=127&o.lo|128,o.lo=o.lo>>>7;s[a++]=o.lo}function O(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}y.create=m(),y.alloc=function(o){return new u.Array(o)},u.Array!==Array&&(y.alloc=u.pool(y.alloc,u.Array.prototype.subarray)),y.prototype.p=function(o,s,a){return this.tail=this.tail.next=new c(o,s,a),this.len+=s,this},(b.prototype=Object.create(c.prototype)).fn=function(o,s,a){for(;127<o;)s[a++]=127&o|128,o>>>=7;s[a]=o},y.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new b((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this},y.prototype.int32=function(o){return o<0?this.p(w,10,l.fromNumber(o)):this.uint32(o)},y.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},y.prototype.int64=y.prototype.uint64=function(o){var s=l.from(o);return this.p(w,s.length(),s)},y.prototype.sint64=function(o){var s=l.from(o).zzEncode();return this.p(w,s.length(),s)},y.prototype.bool=function(o){return this.p(v,1,o?1:0)},y.prototype.sfixed32=y.prototype.fixed32=function(o){return this.p(O,4,o>>>0)},y.prototype.sfixed64=y.prototype.fixed64=function(o){var s=l.from(o);return this.p(O,4,s.lo).p(O,4,s.hi)},y.prototype.float=function(o){return this.p(u.float.writeFloatLE,4,o)},y.prototype.double=function(o){return this.p(u.float.writeDoubleLE,8,o)};var j=u.Array.prototype.set?function(o,s,a){s.set(o,a)}:function(o,s,a){for(var u=0;u<o.length;++u)s[a+u]=o[u]};y.prototype.bytes=function(o){var s=o.length>>>0;if(!s)return this.p(v,1,0);if(u.isString(o)){var a=y.alloc(s=p.length(o));p.decode(o,a,0),o=a}return this.uint32(s).p(j,s,o)},y.prototype.string=function(o){var s=f.length(o);return s?this.uint32(s).p(f.write,s,o):this.p(v,1,0)},y.prototype.fork=function(){return this.states=new d(this),this.head=this.tail=new c(h,0,0),this.len=0,this},y.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 c(h,0,0),this.len=0),this},y.prototype.ldelim=function(){var o=this.head,s=this.tail,a=this.len;return this.reset().uint32(a),a&&(this.tail.next=o.next,this.tail=s,this.len+=a),this},y.prototype.finish=function(){for(var o=this.head.next,s=this.constructor.alloc(this.len),a=0;o;)o.fn(o.val,s,a),a+=o.len,o=o.next;return s},y.r=function(o){a=o,y.create=m(),a.r()}},{35:35}],39:[function(o,s){s.exports=l;var a=o(38);(l.prototype=Object.create(a.prototype)).constructor=l;var u=o(35);function l(){a.call(this)}function p(o,s,a){o.length<40?u.utf8.write(o,s,a):s.utf8Write?s.utf8Write(o,a):s.write(o,a)}l.r=function(){l.alloc=u.b,l.writeBytesBuffer=u.Buffer&&u.Buffer.prototype instanceof Uint8Array&&"set"===u.Buffer.prototype.set.name?function(o,s,a){s.set(o,a)}:function(o,s,a){if(o.copy)o.copy(s,a,0,o.length);else for(var u=0;u<o.length;)s[a++]=o[u++]}},l.prototype.bytes=function(o){u.isString(o)&&(o=u.v(o,"base64"));var s=o.length>>>0;return this.uint32(s),s&&this.p(l.writeBytesBuffer,s,o),this},l.prototype.string=function(o){var s=u.Buffer.byteLength(o);return this.uint32(s),s&&this.p(p,s,o),this},l.r()},{35:35,38:38}]},e={},t=[16],__protobufjs=function o(s){var a=e[s];return a||r[s][0].call(a=e[s]={exports:{}},o,a,a.exports),a.exports}(t[0])}();import{utility,schemaUtil,LazyMapToList}from"o11y/shared";const core_envelope={namespace:"sf.instrumentation",name:"CoreEnvelope",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{options:{},rule:"repeated",id:2,type:"LogMessage"},schemaName:{options:{},id:1,type:"string"}}},Metrics:{fields:{valueRecorders:{options:{},rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{options:{},rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{options:{},id:6,type:"string"},generatedTimestamp:{options:{},id:2,type:"double"},bundleCount:{options:{},id:3,type:"uint32"},upCounterCount:{options:{},id:4,type:"uint32"},valueRecorderCount:{options:{},id:5,type:"uint32"},key:{options:{},id:1,type:"string"}}},LogMessage:{fields:{appPayload:{options:{},id:10,type:"Payload"},data:{options:{},id:2,type:"bytes"},rootId:{options:{},id:4,type:"string"},pagePayload:{options:{},id:7,type:"Payload"},loggerAppName:{options:{},id:8,type:"string"},loggerName:{options:{},id:6,type:"string"},connectionType:{options:{},id:9,type:"string"},age:{options:{},id:3,type:"double"},seq:{options:{},id:5,type:"uint32"},timestamp:{options:{},id:1,type:"double"}}},CoreEnvelope:{options:{"(meta.msg.desc)":"This message is used to contain data that the Core ui-telemetry Connect API endpoint accepts."},fields:{diagnostics:{options:{},id:1,type:"CoreEnvelopeDiagnostics"},bundles:{options:{},rule:"repeated",id:2,type:"MessageBundle"},metrics:{options:{},id:3,type:"Metrics"},staticAttributes:{options:{},id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{options:{},id:1,type:"string"},value:{options:{},id:2,type:"string"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},values:{options:{},rule:"repeated",id:4,type:"double"},name:{options:{},id:1,type:"string"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{options:{},id:2,type:"string"},appName:{options:{},id:1,type:"string"},deviceModel:{options:{},id:5,type:"string"},sdkVersion:{options:{},id:6,type:"string"},deviceId:{options:{},id:4,type:"string"},appExperience:{options:{},id:3,type:"string"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},name:{options:{},id:1,type:"string"},value:{options:{},id:4,type:"uint32"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}};class ProtobufUtil{constructor(){this._typeStore=new Map}getSchemaType(o){utility.requireArgument(o,"schema");const s=schemaUtil.getSchemaId(o);let a=this._typeStore.get(s);if(!a){a=__protobufjs.Root.fromJSON(o.pbjsSchema).lookupType(s),this._typeStore.set(s,a)}return a}validate(o,s){utility.requireArgument(o,"schema"),utility.requireArgument(s,"data");const a=this.getSchemaType(o),u=a.verify(s);if(u)throw new Error(`Data is invalid for ${a.fullName}: ${u}`);return a}encode(o,s){const a=this.validate(o,s),u=a.fromObject(s);return a.encode(u).finish()}encodePayload(o){if(o&&o.schema&&o.payload)return{schemaName:schemaUtil.getSchemaId(o.schema),payload:this.encode(o.schema,o.payload)}}getLogMessage(o,s,a){return{timestamp:a.timestamp,data:this.encode(o,s),age:utility.getAge(a.timestamp),rootId:a.rootId,seq:a.sequence,loggerName:a.loggerName,pagePayload:this.encodePayload(a.pagePayload),loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:this.encodePayload(a.appPayload)}}}const protobufUtil=new ProtobufUtil;var UploadMode;!function(o){o[o.fetchBinary=0]="fetchBinary",o[o.fetchFile=1]="fetchFile",o[o.noUpload=2]="noUpload"}(UploadMode||(UploadMode={}));const version="238.0.0",coreEnvelopeKey="o11y";class CoreEnvelopeBuilder{constructor(){this._envelope={diagnostics:{key:coreEnvelopeKey,generatedTimestamp:void 0,bundleCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:version},bundles:[],metrics:{upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(o){return this._envelope.staticAttributes=o,this}withLogs(o,s){let a=this._envelope.bundles.find((s=>s.schemaName===o));if(a)for(const o of s)a.messages.push(o);else a={schemaName:o,messages:s},this._envelope.bundles.push(a);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static _getMetricTags(o){const s=o.getTags();if(s)return Object.entries(s).map((o=>({name:o[0],value:o[1].toString()})))}static getUpCounters(o,s=!0){return o.map((o=>{const a={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),value:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};return s&&o.reset(),a}))}static getValueRecorders(o,s=!0){return o.map((o=>{const a={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),values:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};return s&&o.reset(),a}))}withUpCounters(o){for(const s of o)this._envelope.metrics.upCounters.push(s);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(o){for(const s of o)this._envelope.metrics.valueRecorders.push(s);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=utility.time().tsNow,this._envelope}}const defaultMaxUniqueSchemas=1e4,defaultMaxDelayBeforeUpload=1e4,defaultMessagesLimit=10,defaultMetricsLimit=10,defaultFormDataKey="telemetry",defaultUploadMode=UploadMode.fetchBinary;class CoreCollector{constructor(o,s,a,u){this._messagesLimit=defaultMessagesLimit,this._metricsLimit=defaultMetricsLimit,this._formDataKey=defaultFormDataKey,this._uploadInterval=defaultMaxDelayBeforeUpload,this._messageSize=0,this.uploadEndpoint=o,this.uploadMode=null==s?defaultUploadMode:s;const l=__protobufjs.Root.fromJSON(core_envelope.pbjsSchema);this._coreEnvelopeType=l.lookupType("CoreEnvelope"),a&&(this._staticAttributes={appName:a.appName,appVersion:a.appVersion,appExperience:a.appExperience,deviceId:a.deviceId,deviceModel:a.deviceModel,sdkVersion:a.sdkVersion});let p=defaultMaxUniqueSchemas;if(u){const o=u.maxUniqueSchemas;if(void 0!==o){if("number"!=typeof o||!(o>0))throw new Error("options.maxUniqueSchemas, if defined, must be > 0");p=o}const s=u.messagesLimit;if(void 0!==s){if("number"!=typeof s||!(s>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=s}const a=u.metricsLimit;if(void 0!==a){if("number"!=typeof a||!(a>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=a}utility.requireArgumentIfDefined(u.formDataKeyName,"options.formDataKeyName","string")&&(this._formDataKey=u.formDataKeyName),utility.requireArgumentIfDefined(u.uploadFailedListener,"options.uploadFailedListener","function")&&(this._uploadFailedListener=u.uploadFailedListener)}this._messageBuffers=new LazyMapToList(p),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(o){if(void 0===o&&(o=defaultMaxDelayBeforeUpload),"number"!=typeof o||!(o>0))throw new Error("uploadInterval, if defined, must be > 0");o!==this._uploadInterval&&(this._uploadInterval=o,this._restartTimer())}get uploadEndpoint(){return this._uploadEndpoint}set uploadEndpoint(o){utility.requireArgumentIfDefined(o,"uploadEndpoint","string"),this._uploadEndpoint=o}get uploadMode(){return this._uploadMode}set uploadMode(o){if(utility.requireArgumentIfDefined(o,"uploadMode","number"),void 0===o&&(o=defaultUploadMode),!(o in UploadMode))throw new Error(`Unsupported upload mode: ${o}`);this._uploadMode=o}getByteSize(o){return o>=1?this._buildProtoEncodedCoreEnvelope(!1).byteLength:o>=.5?this._emptySize+this._messageSize+8*this.metricsCount:this._emptySize+this._messageSize}_stopTimer(){void 0!==this._intervalHandle&&(clearInterval(this._intervalHandle),this._intervalHandle=void 0)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval((()=>{this.hasData&&this._upload()}),this._uploadInterval)}async collect(o,s,a){schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload));const u=protobufUtil.getLogMessage(o,s,a);if(!this._messageBuffers.push(o,u))throw new Error(`Buffer is full. Refusing schemaId ${schemaUtil.getSchemaId(o)}`);if(this._messageSize+=utility.estimateObjectSize(u),this._shouldUpload())return this._upload()}_shouldUpload(){return this._immediateUpload&&this.hasData||this.messagesCount>=this._messagesLimit||this.metricsCount>=this._metricsLimit}async _upload(o){if(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===UploadMode.noUpload)return;const s=this._getContentsOfCoreEnvelope(!0);return this._uploadContents(s,o)}async _uploadContents(o,s){const a=this._buildProtoEncodedCoreEnvelopeFrom(o);let u;switch(this._uploadMode){case UploadMode.fetchBinary:u={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:a};break;case UploadMode.fetchFile:const o=new FormData;o.append(this._formDataKey,new Blob([a])),u={method:"POST",body:o}}const l={envelopeContents:o};try{if(l.response=await fetch(this._uploadEndpoint,u),!l.response.ok)throw new Error("HTTP Not OK");return l}catch(o){if(l.error=o,!s&&this._uploadFailedListener)try{this._uploadFailedListener(l)}catch(o){}throw l}}_checkUploadState(){if(void 0===this._uploadEndpoint)throw new Error("Upload endpoint is unset");if(this._uploadMode===UploadMode.noUpload)throw new Error("Upload mode is unset")}async upload(o){return this._checkUploadState(),utility.requireArgumentIfDefined(o,"contents","object")?this._uploadContents(o,!0):this.hasData?this._upload(!0):void 0}get hasData(){return this.messagesCount>0||this.metricsCount>0}get messagesCount(){return this._messageBuffers.totalItemCount}get metricsCount(){let o=0;if(this._metricsExtractors){let s=this._metricsExtractors.getAllUpCounters();o+=s&&s.length||0,s=this._metricsExtractors.getAllValueRecorders(),o+=s&&s.length||0}return o}getProtoEncodedCoreEnvelope(){return this._buildProtoEncodedCoreEnvelope(!0)}getContentsOfCoreEnvelope(){return this._getContentsOfCoreEnvelope(!0)}_getContentsOfCoreEnvelope(o){const s={staticAttributes:this._staticAttributes,messages:this._messageBuffers.getAllMessages(o)};return this._metricsExtractors&&(s.upCounters=CoreEnvelopeBuilder.getUpCounters(this._metricsExtractors.getAllUpCounters(),o),s.valueRecorders=CoreEnvelopeBuilder.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),o)),o&&(this._messageSize=0),s}_buildProtoEncodedCoreEnvelope(o){const s=this._getContentsOfCoreEnvelope(o);return this._buildProtoEncodedCoreEnvelopeFrom(s)}_buildProtoEncodedCoreEnvelopeFrom(o){const s=new CoreEnvelopeBuilder;return o.staticAttributes&&s.withStaticAttributes(o.staticAttributes),o.messages&&o.messages.forEach(((o,a)=>{s.withLogs(schemaUtil.getSchemaId(a),o)})),o.upCounters&&s.withUpCounters(o.upCounters),o.valueRecorders&&s.withValueRecorders(o.valueRecorders),this._encodeCoreEnvelope(s.build())}_encodeCoreEnvelope(o){const s=this._coreEnvelopeType.verify(o);if(s)throw new Error(`Invalid CoreEnvelope: ${s}`);return this._coreEnvelopeType.encode(o).finish()}receiveMetricsExtractors(o){this._metricsExtractors=o}}const metricsCollectionMilliseconds=3e4;class HybridCollector{constructor(){if("undefined"==typeof __nimbus)throw new Error("Nimbus is unavailable");if(!__nimbus.plugins||!__nimbus.plugins.observability)throw new Error("Observability plugin not found in Nimbus plugins");this._observability=__nimbus.plugins.observability,setInterval((()=>{this._collectMetrics()}),metricsCollectionMilliseconds)}collect(o,s,a){schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload));const u=protobufUtil.getLogMessage(o,s,a),l={timestamp:a.timestamp,rootId:a.rootId,sequence:a.sequence,loggerName:a.loggerName,pagePayload:u.pagePayload,loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:u.appPayload};this._observability.log(schemaUtil.getSchemaId(o),u.data,l)}receiveMetricsExtractors(o){this._metricsExtractors=o}addRootActivityListeners(o,s){utility.requireArgument(o,"activityStarted","function"),utility.requireArgument(s,"activityEnded","function"),this._observability.addRootActivityListeners(o,s)}notifyIdleDetected(o){this._observability.idleDetected(o)}_collectMetrics(){if(this._metricsExtractors){const o=this._metricsExtractors.getAllUpCounters(),s=this._metricsExtractors.getAllValueRecorders(),a=[],u=[];for(const o of s){const s={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),values:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};a.push(s),o.reset()}for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),value:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};u.push(o),s.reset()}if(a.length>0||u.length>0){const o={upCounters:u,valueRecorders:a};this._observability.logMetrics(o)}}}_getMetricTags(o){const s=o.getTags();return s?Object.entries(s).map((o=>({name:o[0],value:o[1].toString()}))):[]}}export{CoreCollector,HybridCollector};
|
|
7
|
+
var __protobufjs;!function(g){var r,e,t;r={1:[function(o,s){s.exports=function(o,s){for(var a=Array(arguments.length-1),u=0,p=2,l=!0;p<arguments.length;)a[u++]=arguments[p++];return new Promise((function(p,f){a[u]=function(o){if(l)if(l=!1,o)f(o);else{for(var s=Array(arguments.length-1),a=0;a<s.length;)s[a++]=arguments[a];p.apply(null,s)}};try{o.apply(s||null,a)}catch(o){l&&(l=!1,f(o))}}))}},{}],2:[function(o,s,a){var u=a;u.length=function(o){var s=o.length;if(!s)return 0;for(var a=0;1<--s%4&&"="==o[0|s];)++a;return Math.ceil(3*o.length)/4-a};for(var p=Array(64),l=Array(123),f=0;f<64;)l[p[f]=f<26?f+65:f<52?f+71:f<62?f-4:f-59|43]=f++;u.encode=function(o,s,a){for(var u,l=null,f=[],c=0,h=0;s<a;){var d=o[s++];switch(h){case 0:f[c++]=p[d>>2],u=(3&d)<<4,h=1;break;case 1:f[c++]=p[u|d>>4],u=(15&d)<<2,h=2;break;case 2:f[c++]=p[u|d>>6],f[c++]=p[63&d],h=0}8191<c&&((l=l||[]).push(String.fromCharCode.apply(String,f)),c=0)}return h&&(f[c++]=p[u],f[c++]=61,1===h&&(f[c++]=61)),l?(c&&l.push(String.fromCharCode.apply(String,f.slice(0,c))),l.join("")):String.fromCharCode.apply(String,f.slice(0,c))};var c="invalid encoding";u.decode=function(o,s,a){for(var u,p=a,f=0,h=0;h<o.length;){var d=o.charCodeAt(h++);if(61===d&&1<f)break;if((d=l[d])===g)throw Error(c);switch(f){case 0:u=d,f=1;break;case 1:s[a++]=u<<2|(48&d)>>4,u=d,f=2;break;case 2:s[a++]=(15&u)<<4|(60&d)>>2,u=d,f=3;break;case 3:s[a++]=(3&u)<<6|d,f=0}}if(1===f)throw Error(c);return a-p},u.test=function(o){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o)}},{}],3:[function(o,s){(s.exports=function o(s,a){"string"==typeof s&&(a=s,s=g);var u=[];function p(s){if("string"!=typeof s){var a=l();if(o.verbose&&console.log("codegen: "+a),a="return "+a,s){for(var f=Object.keys(s),c=Array(f.length+1),h=Array(f.length),d=0;d<f.length;)c[d]=f[d],h[d]=s[f[d++]];return c[d]=a,Function.apply(null,c).apply(null,h)}return Function(a)()}for(var y=Array(arguments.length-1),m=0;m<y.length;)y[m]=arguments[++m];if(m=0,s=s.replace(/%([%dfijs])/g,(function(o,s){var a=y[m++];switch(s){case"d":case"f":return+a+"";case"i":return Math.floor(a)+"";case"j":return JSON.stringify(a);case"s":return a+""}return"%"})),m!==y.length)throw Error("parameter count mismatch");return u.push(s),p}function l(o){return"function "+(o||a||"")+"("+(s&&s.join(",")||"")+"){\n "+u.join("\n ")+"\n}"}return p.toString=l,p}).verbose=!1},{}],4:[function(o,s){function a(){this.t={}}(s.exports=a).prototype.on=function(o,s,a){return(this.t[o]||(this.t[o]=[])).push({fn:s,ctx:a||this}),this},a.prototype.off=function(o,s){if(o===g)this.t={};else if(s===g)this.t[o]=[];else for(var a=this.t[o],u=0;u<a.length;)a[u].fn===s?a.splice(u,1):++u;return this},a.prototype.emit=function(o){var s=this.t[o];if(s){for(var a=[],u=1;u<arguments.length;)a.push(arguments[u++]);for(u=0;u<s.length;)s[u].fn.apply(s[u++].ctx,a)}return this}},{}],5:[function(o,s){s.exports=p;var a=o(1),u=o(7)("fs");function p(o,s,l){return s="function"==typeof s?(l=s,{}):s||{},l?!s.xhr&&u&&u.readFile?u.readFile(o,(function(a,u){return a&&"undefined"!=typeof XMLHttpRequest?p.xhr(o,s,l):a?l(a):l(null,s.binary?u:u.toString("utf8"))})):p.xhr(o,s,l):a(p,this,o,s)}p.xhr=function(o,s,a){var u=new XMLHttpRequest;u.onreadystatechange=function(){if(4!==u.readyState)return g;if(0!==u.status&&200!==u.status)return a(Error("status "+u.status));if(s.binary){var o=u.response;if(!o){o=[];for(var p=0;p<u.responseText.length;++p)o.push(255&u.responseText.charCodeAt(p))}return a(null,"undefined"!=typeof Uint8Array?new Uint8Array(o):o)}return a(null,u.responseText)},s.binary&&("overrideMimeType"in u&&u.overrideMimeType("text/plain; charset=x-user-defined"),u.responseType="arraybuffer"),u.open("GET",o),u.send()}},{1:1,7:7}],6:[function(o,s){function a(o){function s(o,s,a,u){var p=s<0?1:0;if(p&&(s=-s),0===s)o(0<1/s?0:2147483648,a,u);else if(isNaN(s))o(2143289344,a,u);else if(34028234663852886e22<s)o((p<<31|2139095040)>>>0,a,u);else if(s<11754943508222875e-54)o((p<<31|Math.round(s/1401298464324817e-60))>>>0,a,u);else{var l=Math.floor(Math.log(s)/Math.LN2);o((p<<31|127+l<<23|8388607&Math.round(s*Math.pow(2,-l)*8388608))>>>0,a,u)}}function a(o,s,a){var u=o(s,a),p=2*(u>>31)+1,l=u>>>23&255,f=8388607&u;return 255==l?f?NaN:1/0*p:0==l?1401298464324817e-60*p*f:p*Math.pow(2,l-150)*(8388608+f)}function c(o,s,a){m[0]=o,s[a]=v[0],s[a+1]=v[1],s[a+2]=v[2],s[a+3]=v[3]}function h(o,s,a){m[0]=o,s[a]=v[3],s[a+1]=v[2],s[a+2]=v[1],s[a+3]=v[0]}function d(o,s){return v[0]=o[s],v[1]=o[s+1],v[2]=o[s+2],v[3]=o[s+3],m[0]}function y(o,s){return v[3]=o[s],v[2]=o[s+1],v[1]=o[s+2],v[0]=o[s+3],m[0]}var m,v,b,w,O,j;function k(o,s,a,u,p,l){var f=u<0?1:0;if(f&&(u=-u),0===u)o(0,p,l+s),o(0<1/u?0:2147483648,p,l+a);else if(isNaN(u))o(0,p,l+s),o(2146959360,p,l+a);else if(17976931348623157e292<u)o(0,p,l+s),o((f<<31|2146435072)>>>0,p,l+a);else{var c;if(u<22250738585072014e-324)o((c=u/5e-324)>>>0,p,l+s),o((f<<31|c/4294967296)>>>0,p,l+a);else{var h=Math.floor(Math.log(u)/Math.LN2);1024===h&&(h=1023),o(4503599627370496*(c=u*Math.pow(2,-h))>>>0,p,l+s),o((f<<31|h+1023<<20|1048576*c&1048575)>>>0,p,l+a)}}}function E(o,s,a,u,p){var l=o(u,p+s),f=o(u,p+a),c=2*(f>>31)+1,h=f>>>20&2047,d=4294967296*(1048575&f)+l;return 2047==h?d?NaN:1/0*c:0==h?5e-324*c*d:c*Math.pow(2,h-1075)*(d+4503599627370496)}function T(o,s,a){w[0]=o,s[a]=O[0],s[a+1]=O[1],s[a+2]=O[2],s[a+3]=O[3],s[a+4]=O[4],s[a+5]=O[5],s[a+6]=O[6],s[a+7]=O[7]}function A(o,s,a){w[0]=o,s[a]=O[7],s[a+1]=O[6],s[a+2]=O[5],s[a+3]=O[4],s[a+4]=O[3],s[a+5]=O[2],s[a+6]=O[1],s[a+7]=O[0]}function S(o,s){return O[0]=o[s],O[1]=o[s+1],O[2]=o[s+2],O[3]=o[s+3],O[4]=o[s+4],O[5]=o[s+5],O[6]=o[s+6],O[7]=o[s+7],w[0]}function N(o,s){return O[7]=o[s],O[6]=o[s+1],O[5]=o[s+2],O[4]=o[s+3],O[3]=o[s+4],O[2]=o[s+5],O[1]=o[s+6],O[0]=o[s+7],w[0]}return"undefined"!=typeof Float32Array?(m=new Float32Array([-0]),b=128===(v=new Uint8Array(m.buffer))[3],o.writeFloatLE=b?c:h,o.writeFloatBE=b?h:c,o.readFloatLE=b?d:y,o.readFloatBE=b?y:d):(o.writeFloatLE=s.bind(null,u),o.writeFloatBE=s.bind(null,p),o.readFloatLE=a.bind(null,l),o.readFloatBE=a.bind(null,f)),"undefined"!=typeof Float64Array?(w=new Float64Array([-0]),j=128===(O=new Uint8Array(w.buffer))[7],o.writeDoubleLE=j?T:A,o.writeDoubleBE=j?A:T,o.readDoubleLE=j?S:N,o.readDoubleBE=j?N:S):(o.writeDoubleLE=k.bind(null,u,0,4),o.writeDoubleBE=k.bind(null,p,4,0),o.readDoubleLE=E.bind(null,l,0,4),o.readDoubleBE=E.bind(null,f,4,0)),o}function u(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}function p(o,s,a){s[a]=o>>>24,s[a+1]=o>>>16&255,s[a+2]=o>>>8&255,s[a+3]=255&o}function l(o,s){return(o[s]|o[s+1]<<8|o[s+2]<<16|o[s+3]<<24)>>>0}function f(o,s){return(o[s]<<24|o[s+1]<<16|o[s+2]<<8|o[s+3])>>>0}s.exports=a(a)},{}],7:[function(t,i,n){function r(t){try{var i=eval("require")(t);if(i&&(i.length||Object.keys(i).length))return i}catch(t){}return null}i.exports=r},{}],8:[function(o,s,a){var u=a,p=u.isAbsolute=function(o){return/^(?:\/|\w+:)/.test(o)},l=u.normalize=function(o){var s=(o=o.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),a=p(o),u="";a&&(u=s.shift()+"/");for(var l=0;l<s.length;)".."===s[l]?0<l&&".."!==s[l-1]?s.splice(--l,2):a?s.splice(l,1):++l:"."===s[l]?s.splice(l,1):++l;return u+s.join("/")};u.resolve=function(o,s,a){return a||(s=l(s)),p(s)?s:(a||(o=l(o)),(o=o.replace(/(?:\/|^)[^/]+$/,"")).length?l(o+"/"+s):s)}},{}],9:[function(o,s){s.exports=function(o,s,a){var u=a||8192,p=u>>>1,l=null,f=u;return function(a){if(a<1||p<a)return o(a);u<f+a&&(l=o(u),f=0);var c=s.call(l,f,f+=a);return 7&f&&(f=1+(7|f)),c}}},{}],10:[function(o,s,a){var u=a;u.length=function(o){for(var s=0,a=0,u=0;u<o.length;++u)(a=o.charCodeAt(u))<128?s+=1:a<2048?s+=2:55296==(64512&a)&&56320==(64512&o.charCodeAt(u+1))?(++u,s+=4):s+=3;return s},u.read=function(o,s,a){if(a-s<1)return"";for(var u,p=null,l=[],f=0;s<a;)(u=o[s++])<128?l[f++]=u:191<u&&u<224?l[f++]=(31&u)<<6|63&o[s++]:239<u&&u<365?(u=((7&u)<<18|(63&o[s++])<<12|(63&o[s++])<<6|63&o[s++])-65536,l[f++]=55296+(u>>10),l[f++]=56320+(1023&u)):l[f++]=(15&u)<<12|(63&o[s++])<<6|63&o[s++],8191<f&&((p=p||[]).push(String.fromCharCode.apply(String,l)),f=0);return p?(f&&p.push(String.fromCharCode.apply(String,l.slice(0,f))),p.join("")):String.fromCharCode.apply(String,l.slice(0,f))},u.write=function(o,s,a){for(var u,p,l=a,f=0;f<o.length;++f)(u=o.charCodeAt(f))<128?s[a++]=u:(u<2048?s[a++]=u>>6|192:(55296==(64512&u)&&56320==(64512&(p=o.charCodeAt(f+1)))?(u=65536+((1023&u)<<10)+(1023&p),++f,s[a++]=u>>18|240,s[a++]=u>>12&63|128):s[a++]=u>>12|224,s[a++]=u>>6&63|128),s[a++]=63&u|128);return a-l}},{}],11:[function(o,s,a){var u=a,p=o(14),l=o(33);function f(o,s,a,u){if(s.resolvedType)if(s.resolvedType instanceof p){o("switch(d%s){",u);for(var l=s.resolvedType.values,f=Object.keys(l),c=0;c<f.length;++c)s.repeated&&l[f[c]]===s.typeDefault&&o("default:"),o("case%j:",f[c])("case %i:",l[f[c]])("m%s=%j",u,l[f[c]])("break");o("}")}else o('if(typeof d%s!=="object")',u)("throw TypeError(%j)",s.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",u,a,u);else{var h=!1;switch(s.type){case"double":case"float":o("m%s=Number(d%s)",u,u);break;case"uint32":case"fixed32":o("m%s=d%s>>>0",u,u);break;case"int32":case"sint32":case"sfixed32":o("m%s=d%s|0",u,u);break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o("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":o('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)",u)("m%s=d%s",u,u);break;case"string":o("m%s=String(d%s)",u,u);break;case"bool":o("m%s=Boolean(d%s)",u,u)}}return o}function c(o,s,a,u){if(s.resolvedType)s.resolvedType instanceof p?o("d%s=o.enums===String?types[%i].values[m%s]:m%s",u,a,u,u):o("d%s=types[%i].toObject(m%s,o)",u,a,u);else{var l=!1;switch(s.type){case"double":case"float":o("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",u,u,u,u);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o('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,l?"true":"",u);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",u,u,u,u,u);break;default:o("d%s=m%s",u,u)}}return o}u.fromObject=function(o){var s=o.fieldsArray,a=l.codegen(["d"],o.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!s.length)return a("return new this.ctor");a("var m=new this.ctor");for(var u=0;u<s.length;++u){var c=s[u].resolve(),h=l.safeProp(c.name);c.map?(a("if(d%s){",h)('if(typeof d%s!=="object")',h)("throw TypeError(%j)",c.fullName+": object expected")("m%s={}",h)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",h),f(a,c,u,h+"[ks[i]]")("}")("}")):c.repeated?(a("if(d%s){",h)("if(!Array.isArray(d%s))",h)("throw TypeError(%j)",c.fullName+": array expected")("m%s=[]",h)("for(var i=0;i<d%s.length;++i){",h),f(a,c,u,h+"[i]")("}")("}")):(c.resolvedType instanceof p||a("if(d%s!=null){",h),f(a,c,u,h),c.resolvedType instanceof p||a("}"))}return a("return m")},u.toObject=function(o){var s=o.fieldsArray.slice().sort(l.compareFieldsById);if(!s.length)return l.codegen()("return {}");for(var a=l.codegen(["m","o"],o.name+"$toObject")("if(!o)")("o={}")("var d={}"),u=[],f=[],h=[],d=0;d<s.length;++d)s[d].partOf||(s[d].resolve().repeated?u:s[d].map?f:h).push(s[d]);if(u.length){for(a("if(o.arrays||o.defaults){"),d=0;d<u.length;++d)a("d%s=[]",l.safeProp(u[d].name));a("}")}if(f.length){for(a("if(o.objects||o.defaults){"),d=0;d<f.length;++d)a("d%s={}",l.safeProp(f[d].name));a("}")}if(h.length){for(a("if(o.defaults){"),d=0;d<h.length;++d){var y=h[d],m=l.safeProp(y.name);if(y.resolvedType instanceof p)a("d%s=o.enums===String?%j:%j",m,y.resolvedType.valuesById[y.typeDefault],y.typeDefault);else if(y.long)a("if(util.Long){")("var n=new util.Long(%i,%i,%j)",y.typeDefault.low,y.typeDefault.high,y.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",m)("}else")("d%s=o.longs===String?%j:%i",m,y.typeDefault.toString(),y.typeDefault.toNumber());else if(y.bytes){var v="["+Array.prototype.slice.call(y.typeDefault).join(",")+"]";a("if(o.bytes===String)d%s=%j",m,String.fromCharCode.apply(String,y.typeDefault))("else{")("d%s=%s",m,v)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",m,m)("}")}else a("d%s=%j",m,y.typeDefault)}a("}")}var b=!1;for(d=0;d<s.length;++d){y=s[d];var w=o.i.indexOf(y);m=l.safeProp(y.name),y.map?(b||(b=!0,a("var ks2")),a("if(m%s&&(ks2=Object.keys(m%s)).length){",m,m)("d%s={}",m)("for(var j=0;j<ks2.length;++j){"),c(a,y,w,m+"[ks2[j]]")("}")):y.repeated?(a("if(m%s&&m%s.length){",m,m)("d%s=[]",m)("for(var j=0;j<m%s.length;++j){",m),c(a,y,w,m+"[j]")("}")):(a("if(m%s!=null&&m.hasOwnProperty(%j)){",m,y.name),c(a,y,w,m),y.partOf&&a("if(o.oneofs)")("d%s=%j",l.safeProp(y.partOf.name),y.name)),a("}")}return a("return d")}},{14:14,33:33}],12:[function(o,s){s.exports=function(o){var s=p.codegen(["r","l"],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(o){return o.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&s("if((t&7)===4)")("break"),s("switch(t>>>3){");for(var l=0;l<o.fieldsArray.length;++l){var f=o.i[l].resolve(),c=f.resolvedType instanceof a?"int32":f.type,h="m"+p.safeProp(f.name);s("case %i:",f.id),f.map?(s("if(%s===util.emptyObject)",h)("%s={}",h)("var c2 = r.uint32()+r.pos"),u.defaults[f.keyType]!==g?s("k=%j",u.defaults[f.keyType]):s("k=null"),u.defaults[c]!==g?s("value=%j",u.defaults[c]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",f.keyType)("case 2:"),u.basic[c]===g?s("value=types[%i].decode(r,r.uint32())",l):s("value=r.%s()",c),s("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),u.long[f.keyType]!==g?s('%s[typeof k==="object"?util.longToHash(k):k]=value',h):s("%s[k]=value",h)):f.repeated?(s("if(!(%s&&%s.length))",h,h)("%s=[]",h),u.packed[c]!==g&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",h,c)("}else"),u.basic[c]===g?s(f.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",h,l):s("%s.push(r.%s())",h,c)):u.basic[c]===g?s(f.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",h,l):s("%s=r.%s()",h,c),s("break")}for(s("default:")("r.skipType(t&7)")("break")("}")("}"),l=0;l<o.i.length;++l){var d=o.i[l];d.required&&s("if(!m.hasOwnProperty(%j))",d.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+d.name+"'")}return s("return m")};var a=o(14),u=o(32),p=o(33)},{14:14,32:32,33:33}],13:[function(o,s){s.exports=function(o){for(var s,f=p.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),c=o.fieldsArray.slice().sort(p.compareFieldsById),h=0;h<c.length;++h){var d=c[h].resolve(),y=o.i.indexOf(d),m=d.resolvedType instanceof a?"int32":d.type,v=u.basic[m];s="m"+p.safeProp(d.name),d.map?(f("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,d.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(d.id<<3|2)>>>0,8|u.mapKey[d.keyType],d.keyType),v===g?f("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",y,s):f(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|v,m,s),f("}")("}")):d.repeated?(f("if(%s!=null&&%s.length){",s,s),d.packed&&u.packed[m]!==g?f("w.uint32(%i).fork()",(d.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",m,s)("w.ldelim()"):(f("for(var i=0;i<%s.length;++i)",s),v===g?l(f,d,y,s+"[i]"):f("w.uint32(%i).%s(%s[i])",(d.id<<3|v)>>>0,m,s)),f("}")):(d.optional&&f("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,d.name),v===g?l(f,d,y,s):f("w.uint32(%i).%s(%s)",(d.id<<3|v)>>>0,m,s))}return f("return w")};var a=o(14),u=o(32),p=o(33);function l(o,s,a,u){return s.resolvedType.group?o("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",a,u,(s.id<<3|3)>>>0,(s.id<<3|4)>>>0):o("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",a,u,(s.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(o,s){s.exports=l;var a=o(22);((l.prototype=Object.create(a.prototype)).constructor=l).className="Enum";var u=o(21),p=o(33);function l(o,s,u,p,l){if(a.call(this,o,u),s&&"object"!=typeof s)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=p,this.comments=l||{},this.reserved=g,s)for(var f=Object.keys(s),c=0;c<f.length;++c)"number"==typeof s[f[c]]&&(this.valuesById[this.values[f[c]]=s[f[c]]]=f[c])}l.fromJSON=function(o,s){var a=new l(o,s.values,s.options,s.comment,s.comments);return a.reserved=s.reserved,a},l.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return p.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"comment",s?this.comment:g,"comments",s?this.comments:g])},l.prototype.add=function(o,s,a){if(!p.isString(o))throw TypeError("name must be a string");if(!p.isInteger(s))throw TypeError("id must be an integer");if(this.values[o]!==g)throw Error("duplicate name '"+o+"' in "+this);if(this.isReservedId(s))throw Error("id "+s+" is reserved in "+this);if(this.isReservedName(o))throw Error("name '"+o+"' is reserved in "+this);if(this.valuesById[s]!==g){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+s+" in "+this);this.values[o]=s}else this.valuesById[this.values[o]=s]=o;return this.comments[o]=a||null,this},l.prototype.remove=function(o){if(!p.isString(o))throw TypeError("name must be a string");var s=this.values[o];if(null==s)throw Error("name '"+o+"' does not exist in "+this);return delete this.valuesById[s],delete this.values[o],delete this.comments[o],this},l.prototype.isReservedId=function(o){return u.isReservedId(this.reserved,o)},l.prototype.isReservedName=function(o){return u.isReservedName(this.reserved,o)}},{21:21,22:22,33:33}],15:[function(o,s){s.exports=h;var a=o(22);((h.prototype=Object.create(a.prototype)).constructor=h).className="Field";var u,p=o(14),l=o(32),f=o(33),c=/^required|optional|repeated$/;function h(o,s,u,p,h,d,y){if(f.isObject(p)?(y=h,d=p,p=h=g):f.isObject(h)&&(y=d,d=h,h=g),a.call(this,o,d),!f.isInteger(s)||s<0)throw TypeError("id must be a non-negative integer");if(!f.isString(u))throw TypeError("type must be a string");if(p!==g&&!c.test(p=p.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(h!==g&&!f.isString(h))throw TypeError("extend must be a string");this.rule=p&&"optional"!==p?p:g,this.type=u,this.id=s,this.extend=h||g,this.required="required"===p,this.optional=!this.required,this.repeated="repeated"===p,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!f.Long&&l.long[u]!==g,this.bytes="bytes"===u,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.n=null,this.comment=y}h.fromJSON=function(o,s){return new h(o,s.id,s.type,s.rule,s.extend,s.options,s.comment)},Object.defineProperty(h.prototype,"packed",{get:function(){return null===this.n&&(this.n=!1!==this.getOption("packed")),this.n}}),h.prototype.setOption=function(o,s,u){return"packed"===o&&(this.n=null),a.prototype.setOption.call(this,o,s,u)},h.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return f.toObject(["rule","optional"!==this.rule&&this.rule||g,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},h.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=l.defaults[this.type])===g&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof u?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof p&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(this.options.packed===g||!this.resolvedType||this.resolvedType instanceof p)||delete this.options.packed,Object.keys(this.options).length||(this.options=g)),this.long)this.typeDefault=f.Long.fromNumber(this.typeDefault,"u"==this.type[0]),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var o;f.base64.test(this.typeDefault)?f.base64.decode(this.typeDefault,o=f.newBuffer(f.base64.length(this.typeDefault)),0):f.utf8.write(this.typeDefault,o=f.newBuffer(f.utf8.length(this.typeDefault)),0),this.typeDefault=o}return this.map?this.defaultValue=f.emptyObject:this.repeated?this.defaultValue=f.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof u&&(this.parent.ctor.prototype[this.name]=this.defaultValue),a.prototype.resolve.call(this)},h.d=function(o,s,a,u){return"function"==typeof s?s=f.decorateType(s).name:s&&"object"==typeof s&&(s=f.decorateEnum(s).name),function(p,l){f.decorateType(p.constructor).add(new h(l,o,s,a,{default:u}))}},h.r=function(o){u=o}},{14:14,22:22,32:32,33:33}],16:[function(o,s){var a=s.exports=o(17);a.build="light",a.load=function(o,s,u){return(s="function"==typeof s?(u=s,new a.Root):s||new a.Root).load(o,u)},a.loadSync=function(o,s){return(s=s||new a.Root).loadSync(o)},a.encoder=o(13),a.decoder=o(12),a.verifier=o(36),a.converter=o(11),a.ReflectionObject=o(22),a.Namespace=o(21),a.Root=o(26),a.Enum=o(14),a.Type=o(31),a.Field=o(15),a.OneOf=o(23),a.MapField=o(18),a.Service=o(30),a.Method=o(20),a.Message=o(19),a.wrappers=o(37),a.types=o(32),a.util=o(33),a.ReflectionObject.r(a.Root),a.Namespace.r(a.Type,a.Service,a.Enum),a.Root.r(a.Type),a.Field.r(a.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,36:36,37:37}],17:[function(o,s,a){var u=a;u.build="minimal",u.Writer=o(38),u.BufferWriter=o(39),u.Reader=o(24),u.BufferReader=o(25),u.util=o(35),u.rpc=o(28),u.roots=o(27),(u.configure=function(){u.util.r(),u.Writer.r(u.BufferWriter),u.Reader.r(u.BufferReader)})()},{24:24,25:25,27:27,28:28,35:35,38:38,39:39}],18:[function(o,s){s.exports=l;var a=o(15);((l.prototype=Object.create(a.prototype)).constructor=l).className="MapField";var u=o(32),p=o(33);function l(o,s,u,l,f,c){if(a.call(this,o,s,l,g,g,f,c),!p.isString(u))throw TypeError("keyType must be a string");this.keyType=u,this.resolvedKeyType=null,this.map=!0}l.fromJSON=function(o,s){return new l(o,s.id,s.keyType,s.type,s.options,s.comment)},l.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return p.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:g])},l.prototype.resolve=function(){if(this.resolved)return this;if(u.mapKey[this.keyType]===g)throw Error("invalid key type: "+this.keyType);return a.prototype.resolve.call(this)},l.d=function(o,s,a){return"function"==typeof a?a=p.decorateType(a).name:a&&"object"==typeof a&&(a=p.decorateEnum(a).name),function(u,f){p.decorateType(u.constructor).add(new l(f,o,s,a))}}},{15:15,32:32,33:33}],19:[function(o,s){s.exports=u;var a=o(35);function u(o){if(o)for(var s=Object.keys(o),a=0;a<s.length;++a)this[s[a]]=o[s[a]]}u.create=function(o){return this.$type.create(o)},u.encode=function(o,s){return this.$type.encode(o,s)},u.encodeDelimited=function(o,s){return this.$type.encodeDelimited(o,s)},u.decode=function(o){return this.$type.decode(o)},u.decodeDelimited=function(o){return this.$type.decodeDelimited(o)},u.verify=function(o){return this.$type.verify(o)},u.fromObject=function(o){return this.$type.fromObject(o)},u.toObject=function(o,s){return this.$type.toObject(o,s)},u.prototype.toJSON=function(){return this.$type.toObject(this,a.toJSONOptions)}},{35:35}],20:[function(o,s){s.exports=p;var a=o(22);((p.prototype=Object.create(a.prototype)).constructor=p).className="Method";var u=o(33);function p(o,s,p,l,f,c,h,d,y){if(u.isObject(f)?(h=f,f=c=g):u.isObject(c)&&(h=c,c=g),s!==g&&!u.isString(s))throw TypeError("type must be a string");if(!u.isString(p))throw TypeError("requestType must be a string");if(!u.isString(l))throw TypeError("responseType must be a string");a.call(this,o,h),this.type=s||"rpc",this.requestType=p,this.requestStream=!!f||g,this.responseType=l,this.responseStream=!!c||g,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=d,this.parsedOptions=y}p.fromJSON=function(o,s){return new p(o,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},p.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return u.toObject(["type","rpc"!==this.type&&this.type||g,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",s?this.comment:g,"parsedOptions",this.parsedOptions])},p.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),a.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(o,s){s.exports=d;var a=o(22);((d.prototype=Object.create(a.prototype)).constructor=d).className="Namespace";var u,p,l,f=o(15),c=o(33);function h(o,s){if(!o||!o.length)return g;for(var a={},u=0;u<o.length;++u)a[o[u].name]=o[u].toJSON(s);return a}function d(o,s){a.call(this,o,s),this.nested=g,this.e=null}function y(o){return o.e=null,o}d.fromJSON=function(o,s){return new d(o,s.options).addJSON(s.nested)},d.arrayToJSON=h,d.isReservedId=function(o,s){if(o)for(var a=0;a<o.length;++a)if("string"!=typeof o[a]&&o[a][0]<=s&&o[a][1]>s)return!0;return!1},d.isReservedName=function(o,s){if(o)for(var a=0;a<o.length;++a)if(o[a]===s)return!0;return!1},Object.defineProperty(d.prototype,"nestedArray",{get:function(){return this.e||(this.e=c.toArray(this.nested))}}),d.prototype.toJSON=function(o){return c.toObject(["options",this.options,"nested",h(this.nestedArray,o)])},d.prototype.addJSON=function(o){if(o)for(var s,a=Object.keys(o),c=0;c<a.length;++c)s=o[a[c]],this.add((s.fields!==g?u.fromJSON:s.values!==g?l.fromJSON:s.methods!==g?p.fromJSON:s.id!==g?f.fromJSON:d.fromJSON)(a[c],s));return this},d.prototype.get=function(o){return this.nested&&this.nested[o]||null},d.prototype.getEnum=function(o){if(this.nested&&this.nested[o]instanceof l)return this.nested[o].values;throw Error("no such enum: "+o)},d.prototype.add=function(o){if(!(o instanceof f&&o.extend!==g||o instanceof u||o instanceof l||o instanceof p||o instanceof d))throw TypeError("object must be a valid nested object");if(this.nested){var s=this.get(o.name);if(s){if(!(s instanceof d&&o instanceof d)||s instanceof u||s instanceof p)throw Error("duplicate name '"+o.name+"' in "+this);for(var a=s.nestedArray,c=0;c<a.length;++c)o.add(a[c]);this.remove(s),this.nested||(this.nested={}),o.setOptions(s.options,!0)}}else this.nested={};return(this.nested[o.name]=o).onAdd(this),y(this)},d.prototype.remove=function(o){if(!(o instanceof a))throw TypeError("object must be a ReflectionObject");if(o.parent!==this)throw Error(o+" is not a member of "+this);return delete this.nested[o.name],Object.keys(this.nested).length||(this.nested=g),o.onRemove(this),y(this)},d.prototype.define=function(o,s){if(c.isString(o))o=o.split(".");else if(!Array.isArray(o))throw TypeError("illegal path");if(o&&o.length&&""===o[0])throw Error("path must be relative");for(var a=this;0<o.length;){var u=o.shift();if(a.nested&&a.nested[u]){if(!((a=a.nested[u])instanceof d))throw Error("path conflicts with non-namespace objects")}else a.add(a=new d(u))}return s&&a.addJSON(s),a},d.prototype.resolveAll=function(){for(var o=this.nestedArray,s=0;s<o.length;)o[s]instanceof d?o[s++].resolveAll():o[s++].resolve();return this.resolve()},d.prototype.lookup=function(o,s,a){if("boolean"==typeof s?(a=s,s=g):s&&!Array.isArray(s)&&(s=[s]),c.isString(o)&&o.length){if("."===o)return this.root;o=o.split(".")}else if(!o.length)return this;if(""===o[0])return this.root.lookup(o.slice(1),s);var u=this.get(o[0]);if(u){if(1===o.length){if(!s||~s.indexOf(u.constructor))return u}else if(u instanceof d&&(u=u.lookup(o.slice(1),s,!0)))return u}else for(var p=0;p<this.nestedArray.length;++p)if(this.e[p]instanceof d&&(u=this.e[p].lookup(o,s,!0)))return u;return null===this.parent||a?null:this.parent.lookup(o,s)},d.prototype.lookupType=function(o){var s=this.lookup(o,[u]);if(!s)throw Error("no such type: "+o);return s},d.prototype.lookupEnum=function(o){var s=this.lookup(o,[l]);if(!s)throw Error("no such Enum '"+o+"' in "+this);return s},d.prototype.lookupTypeOrEnum=function(o){var s=this.lookup(o,[u,l]);if(!s)throw Error("no such Type or Enum '"+o+"' in "+this);return s},d.prototype.lookupService=function(o){var s=this.lookup(o,[p]);if(!s)throw Error("no such Service '"+o+"' in "+this);return s},d.r=function(o,s,a){u=o,p=s,l=a}},{15:15,22:22,33:33}],22:[function(o,s){(s.exports=p).className="ReflectionObject";var a,u=o(33);function p(o,s){if(!u.isString(o))throw TypeError("name must be a string");if(s&&!u.isObject(s))throw TypeError("options must be an object");this.options=s,this.parsedOptions=null,this.name=o,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(p.prototype,{root:{get:function(){for(var o=this;null!==o.parent;)o=o.parent;return o}},fullName:{get:function(){for(var o=[this.name],s=this.parent;s;)o.unshift(s.name),s=s.parent;return o.join(".")}}}),p.prototype.toJSON=function(){throw Error()},p.prototype.onAdd=function(o){this.parent&&this.parent!==o&&this.parent.remove(this),this.parent=o,this.resolved=!1;var s=o.root;s instanceof a&&s.u(this)},p.prototype.onRemove=function(o){var s=o.root;s instanceof a&&s.o(this),this.parent=null,this.resolved=!1},p.prototype.resolve=function(){return this.resolved||this.root instanceof a&&(this.resolved=!0),this},p.prototype.getOption=function(o){return this.options?this.options[o]:g},p.prototype.setOption=function(o,s,a){return a&&this.options&&this.options[o]!==g||((this.options||(this.options={}))[o]=s),this},p.prototype.setParsedOption=function(o,s,a){this.parsedOptions||(this.parsedOptions=[]);var p=this.parsedOptions;if(a){var l=p.find((function(s){return Object.prototype.hasOwnProperty.call(s,o)}));if(l){var f=l[o];u.setProperty(f,a,s)}else(l={})[o]=u.setProperty({},a,s),p.push(l)}else{var c={};c[o]=s,p.push(c)}return this},p.prototype.setOptions=function(o,s){if(o)for(var a=Object.keys(o),u=0;u<a.length;++u)this.setOption(a[u],o[a[u]],s);return this},p.prototype.toString=function(){var o=this.constructor.className,s=this.fullName;return s.length?o+" "+s:o},p.r=function(o){a=o}},{33:33}],23:[function(o,s){s.exports=l;var a=o(22);((l.prototype=Object.create(a.prototype)).constructor=l).className="OneOf";var u=o(15),p=o(33);function l(o,s,u,p){if(Array.isArray(s)||(u=s,s=g),a.call(this,o,u),s!==g&&!Array.isArray(s))throw TypeError("fieldNames must be an Array");this.oneof=s||[],this.fieldsArray=[],this.comment=p}function f(o){if(o.parent)for(var s=0;s<o.fieldsArray.length;++s)o.fieldsArray[s].parent||o.parent.add(o.fieldsArray[s])}l.fromJSON=function(o,s){return new l(o,s.oneof,s.options,s.comment)},l.prototype.toJSON=function(o){var s=!!o&&!!o.keepComments;return p.toObject(["options",this.options,"oneof",this.oneof,"comment",s?this.comment:g])},l.prototype.add=function(o){if(!(o instanceof u))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),f(o.partOf=this),this},l.prototype.remove=function(o){if(!(o instanceof u))throw TypeError("field must be a Field");var s=this.fieldsArray.indexOf(o);if(s<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(s,1),-1<(s=this.oneof.indexOf(o.name))&&this.oneof.splice(s,1),o.partOf=null,this},l.prototype.onAdd=function(o){a.prototype.onAdd.call(this,o);for(var s=0;s<this.oneof.length;++s){var u=o.get(this.oneof[s]);u&&!u.partOf&&(u.partOf=this).fieldsArray.push(u)}f(this)},l.prototype.onRemove=function(o){for(var s,u=0;u<this.fieldsArray.length;++u)(s=this.fieldsArray[u]).parent&&s.parent.remove(s);a.prototype.onRemove.call(this,o)},l.d=function(){for(var o=Array(arguments.length),s=0;s<arguments.length;)o[s]=arguments[s++];return function(s,a){p.decorateType(s.constructor).add(new l(a,o)),Object.defineProperty(s,a,{get:p.oneOfGetter(o),set:p.oneOfSetter(o)})}}},{15:15,22:22,33:33}],24:[function(o,s){s.exports=c;var a,u=o(35),p=u.LongBits,l=u.utf8;function f(o,s){return RangeError("index out of range: "+o.pos+" + "+(s||1)+" > "+o.len)}function c(o){this.buf=o,this.pos=0,this.len=o.length}function h(){return u.Buffer?function(o){return(c.create=function(o){return u.Buffer.isBuffer(o)?new a(o):y(o)})(o)}:y}var d,y="undefined"!=typeof Uint8Array?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new c(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new c(o);throw Error("illegal buffer")};function m(){var o=new p(0,0),s=0;if(!(4<this.len-this.pos)){for(;s<3;++s){if(this.pos>=this.len)throw f(this);if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(127&this.buf[this.pos++])<<7*s)>>>0,o}for(;s<4;++s)if(o.lo=(o.lo|(127&this.buf[this.pos])<<7*s)>>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(127&this.buf[this.pos])<<28)>>>0,o.hi=(o.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return o;if(s=0,4<this.len-this.pos){for(;s<5;++s)if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}else for(;s<5;++s){if(this.pos>=this.len)throw f(this);if(o.hi=(o.hi|(127&this.buf[this.pos])<<7*s+3)>>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}function v(o,s){return(o[s-4]|o[s-3]<<8|o[s-2]<<16|o[s-1]<<24)>>>0}function b(){if(this.pos+8>this.len)throw f(this,8);return new p(v(this.buf,this.pos+=4),v(this.buf,this.pos+=4))}c.create=h(),c.prototype.f=u.Array.prototype.subarray||u.Array.prototype.slice,c.prototype.uint32=(d=4294967295,function(){if(d=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return d;if((this.pos+=5)>this.len)throw this.pos=this.len,f(this,10);return d}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(1&o)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw f(this,4);return v(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw f(this,4);return 0|v(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw f(this,4);var o=u.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o},c.prototype.double=function(){if(this.pos+8>this.len)throw f(this,4);var o=u.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o},c.prototype.bytes=function(){var o=this.uint32(),s=this.pos,a=this.pos+o;if(a>this.len)throw f(this,o);return this.pos+=o,Array.isArray(this.buf)?this.buf.slice(s,a):s===a?new this.buf.constructor(0):this.f.call(this.buf,s,a)},c.prototype.string=function(){var o=this.bytes();return l.read(o,0,o.length)},c.prototype.skip=function(o){if("number"==typeof o){if(this.pos+o>this.len)throw f(this,o);this.pos+=o}else do{if(this.pos>=this.len)throw f(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(o=7&this.uint32());)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this},c.r=function(o){a=o,c.create=h(),a.r();var s=u.Long?"toLong":"toNumber";u.merge(c.prototype,{int64:function(){return m.call(this)[s](!1)},uint64:function(){return m.call(this)[s](!0)},sint64:function(){return m.call(this).zzDecode()[s](!1)},fixed64:function(){return b.call(this)[s](!0)},sfixed64:function(){return b.call(this)[s](!1)}})}},{35:35}],25:[function(o,s){s.exports=p;var a=o(24);(p.prototype=Object.create(a.prototype)).constructor=p;var u=o(35);function p(o){a.call(this,o)}p.r=function(){u.Buffer&&(p.prototype.f=u.Buffer.prototype.slice)},p.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))},p.r()},{24:24,35:35}],26:[function(o,s){s.exports=y;var a=o(21);((y.prototype=Object.create(a.prototype)).constructor=y).className="Root";var u,p,l,f=o(15),c=o(14),h=o(23),d=o(33);function y(o){a.call(this,"",o),this.deferred=[],this.files=[]}function m(){}y.fromJSON=function(o,s){return s=s||new y,o.options&&s.setOptions(o.options),s.addJSON(o.nested)},y.prototype.resolvePath=d.path.resolve,y.prototype.fetch=d.fetch,y.prototype.load=function o(s,a,u){"function"==typeof a&&(u=a,a=g);var f=this;if(!u)return d.asPromise(o,f,s,a);var c=u===m;function h(o,s){if(u){var a=u;if(u=null,c)throw o;a(o,s)}}function y(o){var s=o.lastIndexOf("google/protobuf/");if(-1<s){var a=o.substring(s);if(a in l)return a}return null}function v(o,s){try{if(d.isString(s)&&"{"==s[0]&&(s=JSON.parse(s)),d.isString(s)){p.filename=o;var u,l=p(s,f,a),m=0;if(l.imports)for(;m<l.imports.length;++m)(u=y(l.imports[m])||f.resolvePath(o,l.imports[m]))&&b(u);if(l.weakImports)for(m=0;m<l.weakImports.length;++m)(u=y(l.weakImports[m])||f.resolvePath(o,l.weakImports[m]))&&b(u,!0)}else f.setOptions(s.options).addJSON(s.nested)}catch(o){h(o)}c||w||h(null,f)}function b(o,s){if(!~f.files.indexOf(o))if(f.files.push(o),o in l)c?v(o,l[o]):(++w,setTimeout((function(){--w,v(o,l[o])})));else if(c){var a;try{a=d.fs.readFileSync(o).toString("utf8")}catch(a){return void(s||h(a))}v(o,a)}else++w,f.fetch(o,(function(a,p){--w,u&&(a?s?w||h(null,f):h(a):v(o,p))}))}var w=0;d.isString(s)&&(s=[s]);for(var O,j=0;j<s.length;++j)(O=f.resolvePath("",s[j]))&&b(O);return c?f:(w||h(null,f),g)},y.prototype.loadSync=function(o,s){if(!d.isNode)throw Error("not supported");return this.load(o,s,m)},y.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(o){return"'extend "+o.extend+"' in "+o.parent.fullName})).join(", "));return a.prototype.resolveAll.call(this)};var v=/^[A-Z]/;function b(o,s){var a=s.parent.lookup(s.extend);if(a){var u=new f(s.fullName,s.id,s.type,s.rule,g,s.options);return(u.declaringField=s).extensionField=u,a.add(u),1}}y.prototype.u=function(o){if(o instanceof f)o.extend===g||o.extensionField||b(0,o)||this.deferred.push(o);else if(o instanceof c)v.test(o.name)&&(o.parent[o.name]=o.values);else if(!(o instanceof h)){if(o instanceof u)for(var s=0;s<this.deferred.length;)b(0,this.deferred[s])?this.deferred.splice(s,1):++s;for(var a=0;a<o.nestedArray.length;++a)this.u(o.e[a]);v.test(o.name)&&(o.parent[o.name]=o)}},y.prototype.o=function(o){if(o instanceof f){if(o.extend!==g)if(o.extensionField)o.extensionField.parent.remove(o.extensionField),o.extensionField=null;else{var s=this.deferred.indexOf(o);-1<s&&this.deferred.splice(s,1)}}else if(o instanceof c)v.test(o.name)&&delete o.parent[o.name];else if(o instanceof a){for(var u=0;u<o.nestedArray.length;++u)this.o(o.e[u]);v.test(o.name)&&delete o.parent[o.name]}},y.r=function(o,s,a){u=o,p=s,l=a}},{14:14,15:15,21:21,23:23,33:33}],27:[function(o,s){s.exports={}},{}],28:[function(o,s,a){a.Service=o(29)},{29:29}],29:[function(o,s){s.exports=u;var a=o(35);function u(o,s,u){if("function"!=typeof o)throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!s,this.responseDelimited=!!u}((u.prototype=Object.create(a.EventEmitter.prototype)).constructor=u).prototype.rpcCall=function o(s,u,p,l,f){if(!l)throw TypeError("request must be specified");var c=this;if(!f)return a.asPromise(o,c,s,u,p,l);if(!c.rpcImpl)return setTimeout((function(){f(Error("already ended"))}),0),g;try{return c.rpcImpl(s,u[c.requestDelimited?"encodeDelimited":"encode"](l).finish(),(function(o,a){if(o)return c.emit("error",o,s),f(o);if(null===a)return c.end(!0),g;if(!(a instanceof p))try{a=p[c.responseDelimited?"decodeDelimited":"decode"](a)}catch(o){return c.emit("error",o,s),f(o)}return c.emit("data",a,s),f(null,a)}))}catch(o){return c.emit("error",o,s),setTimeout((function(){f(o)}),0),g}},u.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(o,s){s.exports=f;var a=o(21);((f.prototype=Object.create(a.prototype)).constructor=f).className="Service";var u=o(20),p=o(33),l=o(28);function f(o,s){a.call(this,o,s),this.methods={},this.h=null}function c(o){return o.h=null,o}f.fromJSON=function(o,s){var a=new f(o,s.options);if(s.methods)for(var p=Object.keys(s.methods),l=0;l<p.length;++l)a.add(u.fromJSON(p[l],s.methods[p[l]]));return s.nested&&a.addJSON(s.nested),a.comment=s.comment,a},f.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),u=!!o&&!!o.keepComments;return p.toObject(["options",s&&s.options||g,"methods",a.arrayToJSON(this.methodsArray,o)||{},"nested",s&&s.nested||g,"comment",u?this.comment:g])},Object.defineProperty(f.prototype,"methodsArray",{get:function(){return this.h||(this.h=p.toArray(this.methods))}}),f.prototype.get=function(o){return this.methods[o]||a.prototype.get.call(this,o)},f.prototype.resolveAll=function(){for(var o=this.methodsArray,s=0;s<o.length;++s)o[s].resolve();return a.prototype.resolve.call(this)},f.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);return o instanceof u?c((this.methods[o.name]=o).parent=this):a.prototype.add.call(this,o)},f.prototype.remove=function(o){if(o instanceof u){if(this.methods[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.methods[o.name],o.parent=null,c(this)}return a.prototype.remove.call(this,o)},f.prototype.create=function(o,s,a){for(var u,f=new l.Service(o,s,a),c=0;c<this.methodsArray.length;++c){var h=p.lcFirst((u=this.h[c]).resolve().name).replace(/[^$\w_]/g,"");f[h]=p.codegen(["r","c"],p.isReserved(h)?h+"_":h)("return this.rpcCall(m,q,s,r,c)")({m:u,q:u.resolvedRequestType.ctor,s:u.resolvedResponseType.ctor})}return f}},{20:20,21:21,28:28,33:33}],31:[function(o,s){s.exports=k;var a=o(21);((k.prototype=Object.create(a.prototype)).constructor=k).className="Type";var u=o(14),p=o(23),l=o(15),f=o(18),c=o(30),h=o(19),d=o(24),y=o(38),m=o(33),v=o(13),b=o(12),w=o(36),O=o(11),j=o(37);function k(o,s){a.call(this,o,s),this.fields={},this.oneofs=g,this.extensions=g,this.reserved=g,this.group=g,this.c=null,this.i=null,this.a=null,this.l=null}function E(o){return o.c=o.i=o.a=null,delete o.encode,delete o.decode,delete o.verify,o}Object.defineProperties(k.prototype,{fieldsById:{get:function(){if(this.c)return this.c;this.c={};for(var o=Object.keys(this.fields),s=0;s<o.length;++s){var a=this.fields[o[s]],u=a.id;if(this.c[u])throw Error("duplicate id "+u+" in "+this);this.c[u]=a}return this.c}},fieldsArray:{get:function(){return this.i||(this.i=m.toArray(this.fields))}},oneofsArray:{get:function(){return this.a||(this.a=m.toArray(this.oneofs))}},ctor:{get:function(){return this.l||(this.ctor=k.generateConstructor(this)())},set:function(o){var s=o.prototype;s instanceof h||((o.prototype=new h).constructor=o,m.merge(o.prototype,s)),o.$type=o.prototype.$type=this,m.merge(o,h,!0),this.l=o;for(var a=0;a<this.fieldsArray.length;++a)this.i[a].resolve();var u={};for(a=0;a<this.oneofsArray.length;++a)u[this.a[a].resolve().name]={get:m.oneOfGetter(this.a[a].oneof),set:m.oneOfSetter(this.a[a].oneof)};a&&Object.defineProperties(o.prototype,u)}}}),k.generateConstructor=function(o){for(var s,a=m.codegen(["p"],o.name),u=0;u<o.fieldsArray.length;++u)(s=o.i[u]).map?a("this%s={}",m.safeProp(s.name)):s.repeated&&a("this%s=[]",m.safeProp(s.name));return a("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]]")},k.fromJSON=function(o,s){var h=new k(o,s.options);h.extensions=s.extensions,h.reserved=s.reserved;for(var d=Object.keys(s.fields),y=0;y<d.length;++y)h.add((void 0!==s.fields[d[y]].keyType?f.fromJSON:l.fromJSON)(d[y],s.fields[d[y]]));if(s.oneofs)for(d=Object.keys(s.oneofs),y=0;y<d.length;++y)h.add(p.fromJSON(d[y],s.oneofs[d[y]]));if(s.nested)for(d=Object.keys(s.nested),y=0;y<d.length;++y){var m=s.nested[d[y]];h.add((m.id!==g?l.fromJSON:m.fields!==g?k.fromJSON:m.values!==g?u.fromJSON:m.methods!==g?c.fromJSON:a.fromJSON)(d[y],m))}return s.extensions&&s.extensions.length&&(h.extensions=s.extensions),s.reserved&&s.reserved.length&&(h.reserved=s.reserved),s.group&&(h.group=!0),s.comment&&(h.comment=s.comment),h},k.prototype.toJSON=function(o){var s=a.prototype.toJSON.call(this,o),u=!!o&&!!o.keepComments;return m.toObject(["options",s&&s.options||g,"oneofs",a.arrayToJSON(this.oneofsArray,o),"fields",a.arrayToJSON(this.fieldsArray.filter((function(o){return!o.declaringField})),o)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:g,"reserved",this.reserved&&this.reserved.length?this.reserved:g,"group",this.group||g,"nested",s&&s.nested||g,"comment",u?this.comment:g])},k.prototype.resolveAll=function(){for(var o=this.fieldsArray,s=0;s<o.length;)o[s++].resolve();var u=this.oneofsArray;for(s=0;s<u.length;)u[s++].resolve();return a.prototype.resolveAll.call(this)},k.prototype.get=function(o){return this.fields[o]||this.oneofs&&this.oneofs[o]||this.nested&&this.nested[o]||null},k.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);if(o instanceof l&&o.extend===g){if(this.c?this.c[o.id]:this.fieldsById[o.id])throw Error("duplicate id "+o.id+" in "+this);if(this.isReservedId(o.id))throw Error("id "+o.id+" is reserved in "+this);if(this.isReservedName(o.name))throw Error("name '"+o.name+"' is reserved in "+this);return o.parent&&o.parent.remove(o),(this.fields[o.name]=o).message=this,o.onAdd(this),E(this)}return o instanceof p?(this.oneofs||(this.oneofs={}),(this.oneofs[o.name]=o).onAdd(this),E(this)):a.prototype.add.call(this,o)},k.prototype.remove=function(o){if(o instanceof l&&o.extend===g){if(!this.fields||this.fields[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.fields[o.name],o.parent=null,o.onRemove(this),E(this)}if(o instanceof p){if(!this.oneofs||this.oneofs[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.oneofs[o.name],o.parent=null,o.onRemove(this),E(this)}return a.prototype.remove.call(this,o)},k.prototype.isReservedId=function(o){return a.isReservedId(this.reserved,o)},k.prototype.isReservedName=function(o){return a.isReservedName(this.reserved,o)},k.prototype.create=function(o){return new this.ctor(o)},k.prototype.setup=function(){for(var o=this.fullName,s=[],a=0;a<this.fieldsArray.length;++a)s.push(this.i[a].resolve().resolvedType);this.encode=v(this)({Writer:y,types:s,util:m}),this.decode=b(this)({Reader:d,types:s,util:m}),this.verify=w(this)({types:s,util:m}),this.fromObject=O.fromObject(this)({types:s,util:m}),this.toObject=O.toObject(this)({types:s,util:m});var u=j[o];if(u){var p=Object.create(this);p.fromObject=this.fromObject,this.fromObject=u.fromObject.bind(p),p.toObject=this.toObject,this.toObject=u.toObject.bind(p)}return this},k.prototype.encode=function(o,s){return this.setup().encode(o,s)},k.prototype.encodeDelimited=function(o,s){return this.encode(o,s&&s.len?s.fork():s).ldelim()},k.prototype.decode=function(o,s){return this.setup().decode(o,s)},k.prototype.decodeDelimited=function(o){return o instanceof d||(o=d.create(o)),this.decode(o,o.uint32())},k.prototype.verify=function(o){return this.setup().verify(o)},k.prototype.fromObject=function(o){return this.setup().fromObject(o)},k.prototype.toObject=function(o,s){return this.setup().toObject(o,s)},k.d=function(o){return function(s){m.decorateType(s,o)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,36:36,37:37,38:38}],32:[function(o,s,a){var u=a,p=o(33),l=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function f(o,s){var a=0,u={};for(s|=0;a<o.length;)u[l[a+s]]=o[a++];return u}u.basic=f([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=f([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",p.emptyArray,null]),u.long=f([0,0,0,1,1],7),u.mapKey=f([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=f([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(o,s){var a,u,p=s.exports=o(35),l=o(27);p.codegen=o(3),p.fetch=o(5),p.path=o(8),p.fs=p.inquire("fs"),p.toArray=function(o){if(o){for(var s=Object.keys(o),a=Array(s.length),u=0;u<s.length;)a[u]=o[s[u++]];return a}return[]},p.toObject=function(o){for(var s={},a=0;a<o.length;){var u=o[a++],p=o[a++];p!==g&&(s[u]=p)}return s};var f=/\\/g,c=/"/g;p.isReserved=function(o){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(o)},p.safeProp=function(o){return!/^[$\w_]+$/.test(o)||p.isReserved(o)?'["'+o.replace(f,"\\\\").replace(c,'\\"')+'"]':"."+o},p.ucFirst=function(o){return o[0].toUpperCase()+o.substring(1)};var h=/_([a-z])/g;p.camelCase=function(o){return o.substring(0,1)+o.substring(1).replace(h,(function(o,s){return s.toUpperCase()}))},p.compareFieldsById=function(o,s){return o.id-s.id},p.decorateType=function(s,u){if(s.$type)return u&&s.$type.name!==u&&(p.decorateRoot.remove(s.$type),s.$type.name=u,p.decorateRoot.add(s.$type)),s.$type;var l=new(a=a||o(31))(u||s.name);return p.decorateRoot.add(l),l.ctor=s,Object.defineProperty(s,"$type",{value:l,enumerable:!1}),Object.defineProperty(s.prototype,"$type",{value:l,enumerable:!1}),l};var d=0;p.decorateEnum=function(s){if(s.$type)return s.$type;var a=new(u=u||o(14))("Enum"+d++,s);return p.decorateRoot.add(a),Object.defineProperty(s,"$type",{value:a,enumerable:!1}),a},p.setProperty=function(o,s,a){if("object"!=typeof o)throw TypeError("dst must be an object");if(!s)throw TypeError("path must be specified");return function o(s,a,u){var p=a.shift();if(0<a.length)s[p]=o(s[p]||{},a,u);else{var l=s[p];l&&(u=[].concat(l).concat(u)),s[p]=u}return s}(o,s=s.split("."),a)},Object.defineProperty(p,"decorateRoot",{get:function(){return l.decorated||(l.decorated=new(o(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,5:5,8:8}],34:[function(o,s){s.exports=u;var a=o(35);function u(o,s){this.lo=o>>>0,this.hi=s>>>0}var p=u.zero=new u(0,0);p.toNumber=function(){return 0},p.zzEncode=p.zzDecode=function(){return this},p.length=function(){return 1};var l=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(o){if(0===o)return p;var s=o<0;s&&(o=-o);var a=o>>>0,l=(o-a)/4294967296>>>0;return s&&(l=~l>>>0,a=~a>>>0,4294967295<++a&&(a=0,4294967295<++l&&(l=0))),new u(a,l)},u.from=function(o){if("number"==typeof o)return u.fromNumber(o);if(a.isString(o)){if(!a.Long)return u.fromNumber(parseInt(o,10));o=a.Long.fromString(o)}return o.low||o.high?new u(o.low>>>0,o.high>>>0):p},u.prototype.toNumber=function(o){if(!o&&this.hi>>>31){var s=1+~this.lo>>>0,a=~this.hi>>>0;return s||(a=a+1>>>0),-(s+4294967296*a)}return this.lo+4294967296*this.hi},u.prototype.toLong=function(o){return a.Long?new a.Long(0|this.lo,0|this.hi,!!o):{low:0|this.lo,high:0|this.hi,unsigned:!!o}};var f=String.prototype.charCodeAt;u.fromHash=function(o){return o===l?p:new u((f.call(o,0)|f.call(o,1)<<8|f.call(o,2)<<16|f.call(o,3)<<24)>>>0,(f.call(o,4)|f.call(o,5)<<8|f.call(o,6)<<16|f.call(o,7)<<24)>>>0)},u.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},u.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},u.prototype.zzDecode=function(){var o=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this},u.prototype.length=function(){var o=this.lo,s=(this.lo>>>28|this.hi<<4)>>>0,a=this.hi>>>24;return 0==a?0==s?o<16384?o<128?1:2:o<2097152?3:4:s<16384?s<128?5:6:s<2097152?7:8:a<128?9:10}},{35:35}],35:[function(o,s,a){var u=a;function p(o,s,a){for(var u=Object.keys(s),p=0;p<u.length;++p)o[u[p]]!==g&&a||(o[u[p]]=s[u[p]]);return o}function l(o){function s(o,a){if(!(this instanceof s))return new s(o,a);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),a&&p(this,a)}return(s.prototype=Object.create(Error.prototype)).constructor=s,Object.defineProperty(s.prototype,"name",{get:function(){return o}}),s.prototype.toString=function(){return this.name+": "+this.message},s}u.asPromise=o(1),u.base64=o(2),u.EventEmitter=o(4),u.float=o(6),u.inquire=o(7),u.utf8=o(10),u.pool=o(9),u.LongBits=o(34),u.isNode=!!("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),u.global=u.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,u.emptyArray=Object.freeze?Object.freeze([]):[],u.emptyObject=Object.freeze?Object.freeze({}):{},u.isInteger=Number.isInteger||function(o){return"number"==typeof o&&isFinite(o)&&Math.floor(o)===o},u.isString=function(o){return"string"==typeof o||o instanceof String},u.isObject=function(o){return o&&"object"==typeof o},u.isset=u.isSet=function(o,s){var a=o[s];return null!=a&&o.hasOwnProperty(s)&&("object"!=typeof a||0<(Array.isArray(a)?a.length:Object.keys(a).length))},u.Buffer=null,u.v=null,u.b=null,u.newBuffer=function(o){return"number"==typeof o?u.Buffer?u.b(o):new u.Array(o):u.Buffer?u.v(o):"undefined"==typeof Uint8Array?o:new Uint8Array(o)},u.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,u.Long=u.global.dcodeIO&&u.global.dcodeIO.Long||u.global.Long||u.inquire("long"),u.key2Re=/^true|false|0|1$/,u.key32Re=/^-?(?:0|[1-9][0-9]*)$/,u.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,u.longToHash=function(o){return o?u.LongBits.from(o).toHash():u.LongBits.zeroHash},u.longFromHash=function(o,s){var a=u.LongBits.fromHash(o);return u.Long?u.Long.fromBits(a.lo,a.hi,s):a.toNumber(!!s)},u.merge=p,u.lcFirst=function(o){return o[0].toLowerCase()+o.substring(1)},u.newError=l,u.ProtocolError=l("ProtocolError"),u.oneOfGetter=function(o){for(var s={},a=0;a<o.length;++a)s[o[a]]=1;return function(){for(var o=Object.keys(this),a=o.length-1;-1<a;--a)if(1===s[o[a]]&&this[o[a]]!==g&&null!==this[o[a]])return o[a]}},u.oneOfSetter=function(o){return function(s){for(var a=0;a<o.length;++a)o[a]!==s&&delete this[o[a]]}},u.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},u.r=function(){var o=u.Buffer;o?(u.v=o.from!==Uint8Array.from&&o.from||function(s,a){return new o(s,a)},u.b=o.allocUnsafe||function(s){return new o(s)}):u.v=u.b=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(o,s){s.exports=function(o){var s=u.codegen(["m"],o.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),a={};o.oneofsArray.length&&s("var p={}");for(var c=0;c<o.fieldsArray.length;++c){var h=o.i[c].resolve(),d="m"+u.safeProp(h.name);if(h.optional&&s("if(%s!=null&&m.hasOwnProperty(%j)){",d,h.name),h.map)s("if(!util.isObject(%s))",d)("return%j",p(h,"object"))("var k=Object.keys(%s)",d)("for(var i=0;i<k.length;++i){"),f(s,h,"k[i]"),l(s,h,c,d+"[k[i]]")("}");else if(h.repeated)s("if(!Array.isArray(%s))",d)("return%j",p(h,"array"))("for(var i=0;i<%s.length;++i){",d),l(s,h,c,d+"[i]")("}");else{if(h.partOf){var y=u.safeProp(h.partOf.name);1===a[h.partOf.name]&&s("if(p%s===1)",y)("return%j",h.partOf.name+": multiple values"),a[h.partOf.name]=1,s("p%s=1",y)}l(s,h,c,d)}h.optional&&s("}")}return s("return null")};var a=o(14),u=o(33);function p(o,s){return o.name+": "+s+(o.repeated&&"array"!==s?"[]":o.map&&"object"!==s?"{k:"+o.keyType+"}":"")+" expected"}function l(o,s,u,l){if(s.resolvedType)if(s.resolvedType instanceof a){o("switch(%s){",l)("default:")("return%j",p(s,"enum value"));for(var f=Object.keys(s.resolvedType.values),c=0;c<f.length;++c)o("case %i:",s.resolvedType.values[f[c]]);o("break")("}")}else o("{")("var e=types[%i].verify(%s);",u,l)("if(e)")("return%j+e",s.name+".")("}");else switch(s.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.isInteger(%s))",l)("return%j",p(s,"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)))",l,l,l,l)("return%j",p(s,"integer|Long"));break;case"float":case"double":o('if(typeof %s!=="number")',l)("return%j",p(s,"number"));break;case"bool":o('if(typeof %s!=="boolean")',l)("return%j",p(s,"boolean"));break;case"string":o("if(!util.isString(%s))",l)("return%j",p(s,"string"));break;case"bytes":o('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',l,l,l)("return%j",p(s,"buffer"))}return o}function f(o,s,a){switch(s.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":o("if(!util.key32Re.test(%s))",a)("return%j",p(s,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":o("if(!util.key64Re.test(%s))",a)("return%j",p(s,"integer|Long key"));break;case"bool":o("if(!util.key2Re.test(%s))",a)("return%j",p(s,"boolean key"))}return o}},{14:14,33:33}],37:[function(o,s,a){var u=a,p=o(19);u[".google.protobuf.Any"]={fromObject:function(o){if(o&&o["@type"]){var s=o["@type"].substring(1+o["@type"].lastIndexOf("/")),a=this.lookup(s);if(a){var u="."==o["@type"][0]?o["@type"].substr(1):o["@type"];return~u.indexOf("/")||(u="/"+u),this.create({type_url:u,value:a.encode(a.fromObject(o)).finish()})}}return this.fromObject(o)},toObject:function(o,s){var a="",u="";if(s&&s.json&&o.type_url&&o.value){u=o.type_url.substring(1+o.type_url.lastIndexOf("/")),a=o.type_url.substring(0,1+o.type_url.lastIndexOf("/"));var l=this.lookup(u);l&&(o=l.decode(o.value))}if(o instanceof this.ctor||!(o instanceof p))return this.toObject(o,s);var f=o.$type.toObject(o,s);return""===a&&(a="type.googleapis.com/"),u=a+("."===o.$type.fullName[0]?o.$type.fullName.substr(1):o.$type.fullName),f["@type"]=u,f}}},{19:19}],38:[function(o,s){s.exports=y;var a,u=o(35),p=u.LongBits,l=u.base64,f=u.utf8;function c(o,s,a){this.fn=o,this.len=s,this.next=g,this.val=a}function h(){}function d(o){this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}function y(){this.len=0,this.head=new c(h,0,0),this.tail=this.head,this.states=null}function m(){return u.Buffer?function(){return(y.create=function(){return new a})()}:function(){return new y}}function v(o,s,a){s[a]=255&o}function b(o,s){this.len=o,this.next=g,this.val=s}function w(o,s,a){for(;o.hi;)s[a++]=127&o.lo|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;127<o.lo;)s[a++]=127&o.lo|128,o.lo=o.lo>>>7;s[a++]=o.lo}function O(o,s,a){s[a]=255&o,s[a+1]=o>>>8&255,s[a+2]=o>>>16&255,s[a+3]=o>>>24}y.create=m(),y.alloc=function(o){return new u.Array(o)},u.Array!==Array&&(y.alloc=u.pool(y.alloc,u.Array.prototype.subarray)),y.prototype.p=function(o,s,a){return this.tail=this.tail.next=new c(o,s,a),this.len+=s,this},(b.prototype=Object.create(c.prototype)).fn=function(o,s,a){for(;127<o;)s[a++]=127&o|128,o>>>=7;s[a]=o},y.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new b((o>>>=0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this},y.prototype.int32=function(o){return o<0?this.p(w,10,p.fromNumber(o)):this.uint32(o)},y.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)},y.prototype.int64=y.prototype.uint64=function(o){var s=p.from(o);return this.p(w,s.length(),s)},y.prototype.sint64=function(o){var s=p.from(o).zzEncode();return this.p(w,s.length(),s)},y.prototype.bool=function(o){return this.p(v,1,o?1:0)},y.prototype.sfixed32=y.prototype.fixed32=function(o){return this.p(O,4,o>>>0)},y.prototype.sfixed64=y.prototype.fixed64=function(o){var s=p.from(o);return this.p(O,4,s.lo).p(O,4,s.hi)},y.prototype.float=function(o){return this.p(u.float.writeFloatLE,4,o)},y.prototype.double=function(o){return this.p(u.float.writeDoubleLE,8,o)};var j=u.Array.prototype.set?function(o,s,a){s.set(o,a)}:function(o,s,a){for(var u=0;u<o.length;++u)s[a+u]=o[u]};y.prototype.bytes=function(o){var s=o.length>>>0;if(!s)return this.p(v,1,0);if(u.isString(o)){var a=y.alloc(s=l.length(o));l.decode(o,a,0),o=a}return this.uint32(s).p(j,s,o)},y.prototype.string=function(o){var s=f.length(o);return s?this.uint32(s).p(f.write,s,o):this.p(v,1,0)},y.prototype.fork=function(){return this.states=new d(this),this.head=this.tail=new c(h,0,0),this.len=0,this},y.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 c(h,0,0),this.len=0),this},y.prototype.ldelim=function(){var o=this.head,s=this.tail,a=this.len;return this.reset().uint32(a),a&&(this.tail.next=o.next,this.tail=s,this.len+=a),this},y.prototype.finish=function(){for(var o=this.head.next,s=this.constructor.alloc(this.len),a=0;o;)o.fn(o.val,s,a),a+=o.len,o=o.next;return s},y.r=function(o){a=o,y.create=m(),a.r()}},{35:35}],39:[function(o,s){s.exports=p;var a=o(38);(p.prototype=Object.create(a.prototype)).constructor=p;var u=o(35);function p(){a.call(this)}function l(o,s,a){o.length<40?u.utf8.write(o,s,a):s.utf8Write?s.utf8Write(o,a):s.write(o,a)}p.r=function(){p.alloc=u.b,p.writeBytesBuffer=u.Buffer&&u.Buffer.prototype instanceof Uint8Array&&"set"===u.Buffer.prototype.set.name?function(o,s,a){s.set(o,a)}:function(o,s,a){if(o.copy)o.copy(s,a,0,o.length);else for(var u=0;u<o.length;)s[a++]=o[u++]}},p.prototype.bytes=function(o){u.isString(o)&&(o=u.v(o,"base64"));var s=o.length>>>0;return this.uint32(s),s&&this.p(p.writeBytesBuffer,s,o),this},p.prototype.string=function(o){var s=u.Buffer.byteLength(o);return this.uint32(s),s&&this.p(l,s,o),this},p.r()},{35:35,38:38}]},e={},t=[16],__protobufjs=function o(s){var a=e[s];return a||r[s][0].call(a=e[s]={exports:{}},o,a,a.exports),a.exports}(t[0])}();import{utility,schemaUtil,LazyMapToList}from"o11y/shared";const core_envelope={namespace:"sf.instrumentation",name:"CoreEnvelope",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{options:{},rule:"repeated",id:2,type:"LogMessage"},schemaName:{options:{},id:1,type:"string"}}},Metrics:{fields:{bucketHistograms:{options:{},rule:"repeated",id:3,type:"BucketHistogram"},valueRecorders:{options:{},rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{options:{},rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{options:{},id:6,type:"string"},generatedTimestamp:{options:{},id:2,type:"double"},bundleCount:{options:{},id:3,type:"uint32"},upCounterCount:{options:{},id:4,type:"uint32"},valueRecorderCount:{options:{},id:5,type:"uint32"},key:{options:{},id:1,type:"string"},bucketHistogramCount:{options:{},id:7,type:"uint32"}}},LogMessage:{fields:{appPayload:{options:{},id:10,type:"Payload"},data:{options:{},id:2,type:"bytes"},rootId:{options:{},id:4,type:"string"},pagePayload:{options:{},id:7,type:"Payload"},loggerAppName:{options:{},id:8,type:"string"},loggerName:{options:{},id:6,type:"string"},connectionType:{options:{},id:9,type:"string"},age:{options:{},id:3,type:"double"},seq:{options:{},id:5,type:"uint32"},timestamp:{options:{},id:1,type:"double"}}},CoreEnvelope:{options:{"(meta.msg.desc)":"This message is used to contain data that the Core ui-telemetry Connect API endpoint accepts."},fields:{diagnostics:{options:{},id:1,type:"CoreEnvelopeDiagnostics"},bundles:{options:{},rule:"repeated",id:2,type:"MessageBundle"},metrics:{options:{},id:3,type:"Metrics"},staticAttributes:{options:{},id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{options:{},id:1,type:"string"},value:{options:{},id:2,type:"string"}}},BucketHistogram:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:7,type:"string"},ownerAppName:{options:{},id:8,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},values:{options:{},rule:"repeated",id:4,type:"double"},buckets:{options:{},rule:"repeated",id:5,type:"uint32"},name:{options:{},id:1,type:"string"},tags:{options:{},rule:"repeated",id:6,type:"MetricTag"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},values:{options:{},rule:"repeated",id:4,type:"double"},name:{options:{},id:1,type:"string"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{options:{},id:2,type:"string"},appName:{options:{},id:1,type:"string"},deviceModel:{options:{},id:5,type:"string"},sdkVersion:{options:{},id:6,type:"string"},deviceId:{options:{},id:4,type:"string"},appExperience:{options:{},id:3,type:"string"}}},Payload:{fields:{payload:{options:{},id:2,type:"bytes"},schemaName:{options:{},id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{options:{},id:3,type:"double"},ownerName:{options:{},id:6,type:"string"},ownerAppName:{options:{},id:7,type:"string"},createdTimestamp:{options:{},id:2,type:"double"},name:{options:{},id:1,type:"string"},value:{options:{},id:4,type:"uint32"},tags:{options:{},rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}};class ProtobufUtil{constructor(){this._typeStore=new Map}getSchemaType(o){utility.requireArgument(o,"schema");const s=schemaUtil.getSchemaId(o);let a=this._typeStore.get(s);if(!a){a=__protobufjs.Root.fromJSON(o.pbjsSchema).lookupType(s),this._typeStore.set(s,a)}return a}validate(o,s){utility.requireArgument(o,"schema"),utility.requireArgument(s,"data");const a=this.getSchemaType(o),u=a.verify(s);if(u)throw new Error(`Data is invalid for ${a.fullName}: ${u}`);return a}encode(o,s){const a=this.validate(o,s),u=a.fromObject(s);return a.encode(u).finish()}encodePayload(o){if(o&&o.schema&&o.payload)return{schemaName:schemaUtil.getSchemaId(o.schema),payload:this.encode(o.schema,o.payload)}}getLogMessage(o,s,a){return{timestamp:a.timestamp,data:this.encode(o,s),age:utility.getAge(a.timestamp),rootId:a.rootId,seq:a.sequence,loggerName:a.loggerName,pagePayload:this.encodePayload(a.pagePayload),loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:this.encodePayload(a.appPayload)}}}const protobufUtil=new ProtobufUtil;var UploadMode;!function(o){o[o.fetchBinary=0]="fetchBinary",o[o.fetchFile=1]="fetchFile",o[o.noUpload=2]="noUpload"}(UploadMode||(UploadMode={}));const version="238.10.0",coreEnvelopeKey="o11y";class CoreEnvelopeBuilder{constructor(){this._envelope={diagnostics:{key:coreEnvelopeKey,generatedTimestamp:void 0,bundleCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:version},bundles:[],metrics:{upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(o){return this._envelope.staticAttributes=o,this}withLogs(o,s){let a=this._envelope.bundles.find((s=>s.schemaName===o));if(a)for(const o of s)a.messages.push(o);else a={schemaName:o,messages:s},this._envelope.bundles.push(a);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static _getMetricTags(o){const s=o.getTags();if(s)return Object.entries(s).map((o=>({name:o[0],value:o[1].toString()})))}static getUpCounters(o,s=!0){return o.map((o=>{const a={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),value:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};return s&&o.reset(),a}))}static getValueRecorders(o,s=!0){return o.map((o=>{const a={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),values:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};return s&&o.reset(),a}))}withUpCounters(o){for(const s of o)this._envelope.metrics.upCounters.push(s);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(o){for(const s of o)this._envelope.metrics.valueRecorders.push(s);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=utility.time().tsNow,this._envelope}}const defaultMaxUniqueSchemas=1e4,defaultMaxDelayBeforeUpload=1e4,defaultMessagesLimit=10,defaultMetricsLimit=10,defaultFormDataKey="telemetry",defaultUploadMode=UploadMode.fetchBinary;class CoreCollector{constructor(o,s,a,u){this._messagesLimit=defaultMessagesLimit,this._metricsLimit=defaultMetricsLimit,this._formDataKey=defaultFormDataKey,this._uploadInterval=defaultMaxDelayBeforeUpload,this._messageSize=0,this.uploadEndpoint=o,this.uploadMode=null==s?defaultUploadMode:s;const p=__protobufjs.Root.fromJSON(core_envelope.pbjsSchema);this._coreEnvelopeType=p.lookupType("CoreEnvelope"),a&&(this._staticAttributes={appName:a.appName,appVersion:a.appVersion,appExperience:a.appExperience,deviceId:a.deviceId,deviceModel:a.deviceModel,sdkVersion:a.sdkVersion});let l=defaultMaxUniqueSchemas;if(u){const o=u.maxUniqueSchemas;if(void 0!==o){if("number"!=typeof o||!(o>0))throw new Error("options.maxUniqueSchemas, if defined, must be > 0");l=o}const s=u.messagesLimit;if(void 0!==s){if("number"!=typeof s||!(s>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=s}const a=u.metricsLimit;if(void 0!==a){if("number"!=typeof a||!(a>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=a}utility.requireArgumentIfDefined(u.formDataKeyName,"options.formDataKeyName","string")&&(this._formDataKey=u.formDataKeyName),utility.requireArgumentIfDefined(u.uploadFailedListener,"options.uploadFailedListener","function")&&(this._uploadFailedListener=u.uploadFailedListener)}this._messageBuffers=new LazyMapToList(l),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(o){if(void 0===o&&(o=defaultMaxDelayBeforeUpload),"number"!=typeof o||!(o>0))throw new Error("uploadInterval, if defined, must be > 0");o!==this._uploadInterval&&(this._uploadInterval=o,this._restartTimer())}get uploadEndpoint(){return this._uploadEndpoint}set uploadEndpoint(o){utility.requireArgumentIfDefined(o,"uploadEndpoint","string"),this._uploadEndpoint=o}get uploadMode(){return this._uploadMode}set uploadMode(o){if(utility.requireArgumentIfDefined(o,"uploadMode","number"),void 0===o&&(o=defaultUploadMode),!(o in UploadMode))throw new Error(`Unsupported upload mode: ${o}`);this._uploadMode=o}getByteSize(o){return o>=1?this._buildProtoEncodedCoreEnvelope(!1).byteLength:o>=.5?this._emptySize+this._messageSize+8*this.metricsCount:this._emptySize+this._messageSize}_stopTimer(){void 0!==this._intervalHandle&&(clearInterval(this._intervalHandle),this._intervalHandle=void 0)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval((()=>{this.hasData&&this._upload()}),this._uploadInterval)}async collect(o,s,a){schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload));const u=protobufUtil.getLogMessage(o,s,a);if(!this._messageBuffers.push(o,u))throw new Error(`Buffer is full. Refusing schemaId ${schemaUtil.getSchemaId(o)}`);if(this._messageSize+=utility.estimateObjectSize(u),this._shouldUpload())return this._upload()}_shouldUpload(){return this._immediateUpload&&this.hasData||this.messagesCount>=this._messagesLimit||this.metricsCount>=this._metricsLimit}async _upload(o){if(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===UploadMode.noUpload)return;const s=this._getContentsOfCoreEnvelope(!0);return this._uploadContents(s,o)}async _uploadContents(o,s){const a=this._buildProtoEncodedCoreEnvelopeFrom(o);let u;switch(this._uploadMode){case UploadMode.fetchBinary:u={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:a};break;case UploadMode.fetchFile:const o=new FormData;o.append(this._formDataKey,new Blob([a])),u={method:"POST",body:o}}const p={envelopeContents:o};try{if(p.response=await fetch(this._uploadEndpoint,u),!p.response.ok)throw new Error("HTTP Not OK");return p}catch(o){if(p.error=o,!s&&this._uploadFailedListener)try{this._uploadFailedListener(p)}catch(o){}throw p}}_checkUploadState(){if(void 0===this._uploadEndpoint)throw new Error("Upload endpoint is unset");if(this._uploadMode===UploadMode.noUpload)throw new Error("Upload mode is unset")}async upload(o){return this._checkUploadState(),utility.requireArgumentIfDefined(o,"contents","object")?this._uploadContents(o,!0):this.hasData?this._upload(!0):void 0}get hasData(){return this.messagesCount>0||this.metricsCount>0}get messagesCount(){return this._messageBuffers.totalItemCount}get metricsCount(){let o=0;if(this._metricsExtractors){let s=this._metricsExtractors.getAllUpCounters();o+=s&&s.length||0,s=this._metricsExtractors.getAllValueRecorders(),o+=s&&s.length||0}return o}getProtoEncodedCoreEnvelope(){return this._buildProtoEncodedCoreEnvelope(!0)}getContentsOfCoreEnvelope(){return this._getContentsOfCoreEnvelope(!0)}_getContentsOfCoreEnvelope(o){const s={staticAttributes:this._staticAttributes,messages:this._messageBuffers.getAllMessages(o)};return this._metricsExtractors&&(s.upCounters=CoreEnvelopeBuilder.getUpCounters(this._metricsExtractors.getAllUpCounters(),o),s.valueRecorders=CoreEnvelopeBuilder.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),o)),o&&(this._messageSize=0),s}_buildProtoEncodedCoreEnvelope(o){const s=this._getContentsOfCoreEnvelope(o);return this._buildProtoEncodedCoreEnvelopeFrom(s)}_buildProtoEncodedCoreEnvelopeFrom(o){const s=new CoreEnvelopeBuilder;return o.staticAttributes&&s.withStaticAttributes(o.staticAttributes),o.messages&&o.messages.forEach(((o,a)=>{s.withLogs(schemaUtil.getSchemaId(a),o)})),o.upCounters&&s.withUpCounters(o.upCounters),o.valueRecorders&&s.withValueRecorders(o.valueRecorders),this._encodeCoreEnvelope(s.build())}_encodeCoreEnvelope(o){const s=this._coreEnvelopeType.verify(o);if(s)throw new Error(`Invalid CoreEnvelope: ${s}`);return this._coreEnvelopeType.encode(o).finish()}receiveMetricsExtractors(o){this._metricsExtractors=o}}const metricsCollectionMilliseconds=3e4;class HybridCollector{constructor(){if("undefined"==typeof __nimbus)throw new Error("Nimbus is unavailable");if(!__nimbus.plugins||!__nimbus.plugins.observability)throw new Error("Observability plugin not found in Nimbus plugins");this._observability=__nimbus.plugins.observability,setInterval((()=>{this._collectMetrics()}),metricsCollectionMilliseconds)}collect(o,s,a){schemaUtil.isInternal(o)&&s.userPayload&&(s.userPayload=protobufUtil.encodePayload(s.userPayload));const u=protobufUtil.getLogMessage(o,s,a),p={timestamp:a.timestamp,rootId:a.rootId,sequence:a.sequence,loggerName:a.loggerName,pagePayload:u.pagePayload,loggerAppName:a.loggerAppName,connectionType:a.connectionType,appPayload:u.appPayload};this._observability.log(schemaUtil.getSchemaId(o),u.data,p)}receiveMetricsExtractors(o){this._metricsExtractors=o}addRootActivityListeners(o,s){utility.requireArgument(o,"activityStarted","function"),utility.requireArgument(s,"activityEnded","function"),this._observability.addRootActivityListeners(o,s)}notifyIdleDetected(o){this._observability.idleDetected(o)}_collectMetrics(){if(this._metricsExtractors){const o=this._metricsExtractors.getAllUpCounters(),s=this._metricsExtractors.getAllValueRecorders(),a=[],u=[];for(const o of s){const s={name:o.getName(),createdTimestamp:o.getCreatedOn(),lastUpdatedTimestamp:o.getLastUpdatedOn(),values:o.getData(),ownerName:o.getOwnerName(),ownerAppName:o.getOwnerAppName(),tags:this._getMetricTags(o)};a.push(s),o.reset()}for(const s of o){const o={name:s.getName(),createdTimestamp:s.getCreatedOn(),lastUpdatedTimestamp:s.getLastUpdatedOn(),value:s.getData(),ownerName:s.getOwnerName(),ownerAppName:s.getOwnerAppName(),tags:this._getMetricTags(s)};u.push(o),s.reset()}if(a.length>0||u.length>0){const o={upCounters:u,valueRecorders:a};this._observability.logMetrics(o)}}}_getMetricTags(o){const s=o.getTags();return s?Object.entries(s).map((o=>({name:o[0],value:o[1].toString()}))):[]}}export{CoreCollector,HybridCollector};
|
|
8
8
|
//# sourceMappingURL=collectors.js.map
|